decocms 4.367.7 → 4.368.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/dist/client/assets/{AlertCircle-CMdkAjxQ.js → AlertCircle-_dpPH4gp.js} +1 -1
  2. package/dist/client/assets/{AreaChart-jIv2Q0sS.js → AreaChart-D3UNwAze.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-DGJWLWaL.js → ArrowLeft-D5BILPql.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-D_1DZN2N.js → ArrowRight-CeIfu-_Z.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-Bx3jqyJU.js → ArrowUp-D3IJVwy-.js} +1 -1
  6. package/dist/client/assets/{Check-HvrCGvlV.js → Check-BrCocVFB.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-CQTpywHl.js → CheckCircle-BC0FabXU.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-dkkIYuGe.js → ChevronRight-B8w28Rs0.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-BANcOZ09.js → ChevronUp-BZtOj4Ay.js} +1 -1
  10. package/dist/client/assets/{Copy01-D4tr9F1r.js → Copy01-8HlwnVL4.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-CX8hLF54.js → CreditCard01-BuU2-7Xz.js} +1 -1
  12. package/dist/client/assets/{Database01-C6v3VKBC.js → Database01-CbAnK_KP.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-DEpQR8Rs.js → DotsVertical-wpNLDjEw.js} +1 -1
  14. package/dist/client/assets/{Download01-G8ZhNqF3.js → Download01-DGABlNWv.js} +1 -1
  15. package/dist/client/assets/{ErrorBarContext-DNwZJRAX.js → ErrorBarContext-BlJtJ6et.js} +1 -1
  16. package/dist/client/assets/{Eye-wRiP-IKY.js → Eye-DXMWNy9I.js} +1 -1
  17. package/dist/client/assets/{File02-C5Axd7Wg.js → File02-6XspF3iG.js} +1 -1
  18. package/dist/client/assets/{GitBranch01-xiI7ahmy.js → GitBranch01-DdWI6T46.js} +1 -1
  19. package/dist/client/assets/{Globe01-BJfrzyV2.js → Globe01-LbDP9lO6.js} +1 -1
  20. package/dist/client/assets/{HardDrive-BtlNN50l.js → HardDrive-DtG-DEiB.js} +1 -1
  21. package/dist/client/assets/{Image01-ZQpSr40Q.js → Image01-rPrP47_j.js} +1 -1
  22. package/dist/client/assets/{Key01-TUQZiePT.js → Key01-CJUZ2anZ.js} +1 -1
  23. package/dist/client/assets/{Link01-Dubdh0XV.js → Link01-B0bN5v1C.js} +1 -1
  24. package/dist/client/assets/{LinkExternal01-DsoIvXMf.js → LinkExternal01-k2QYzvNX.js} +1 -1
  25. package/dist/client/assets/{MessageCircle01-DrVOv17x.js → MessageCircle01-CjlDn3qL.js} +1 -1
  26. package/dist/client/assets/{Monitor01-8akol8yD.js → Monitor01-BWhdvhYh.js} +1 -1
  27. package/dist/client/assets/{Package-6pCyxdj-.js → Package-CUFEWgH0.js} +1 -1
  28. package/dist/client/assets/{Palette-8_jSprTt.js → Palette-D8sq7zSJ.js} +1 -1
  29. package/dist/client/assets/{Play-B2WDpGm-.js → Play-CaXzttX1.js} +1 -1
  30. package/dist/client/assets/{Plus-B6iViyXP.js → Plus-B76Mdzta.js} +1 -1
  31. package/dist/client/assets/{Printer-1AF1IGx9.js → Printer-CilcBFsl.js} +1 -1
  32. package/dist/client/assets/{SearchLg-o3jjSP_H.js → SearchLg-UbmzRtIb.js} +1 -1
  33. package/dist/client/assets/{SearchMd-BFooCWLz.js → SearchMd-Cz88FNXR.js} +1 -1
  34. package/dist/client/assets/{Sector-D27lvJUl.js → Sector-CupdVPpd.js} +1 -1
  35. package/dist/client/assets/{Settings02-11lXkxuh.js → Settings02-DCxh89vV.js} +1 -1
  36. package/dist/client/assets/{Share07-2izyqHpD.js → Share07-CNlETPcr.js} +1 -1
  37. package/dist/client/assets/{Shield01-C_NSoVzs.js → Shield01-UHqavRD7.js} +1 -1
  38. package/dist/client/assets/{Stars01-dQ6_BPZ3.js → Stars01-BPm_Roon.js} +1 -1
  39. package/dist/client/assets/{Sun-DqCbyuBS.js → Sun-BukuAUTA.js} +1 -1
  40. package/dist/client/assets/{SwitchHorizontal01-Chrl4_cZ.js → SwitchHorizontal01-DDZJCKkC.js} +1 -1
  41. package/dist/client/assets/{Tool01-DekOr9OW.js → Tool01-txvCBUcI.js} +1 -1
  42. package/dist/client/assets/{Tool02-CgXadMFZ.js → Tool02-DUdKhOIL.js} +1 -1
  43. package/dist/client/assets/{Trash01-DwLqZ5iv.js → Trash01-CeNVn9va.js} +1 -1
  44. package/dist/client/assets/{TrendUp01-BJ6ZxGib.js → TrendUp01-pvT8-WFv.js} +1 -1
  45. package/dist/client/assets/{Upload01-zIaNWjGg.js → Upload01-CdWOLhzl.js} +1 -1
  46. package/dist/client/assets/{User01-Cuc8TQ2e.js → User01-BFd06Lzl.js} +1 -1
  47. package/dist/client/assets/{UserSquare-DO483pcO.js → UserSquare-VWJ4b2Nu.js} +1 -1
  48. package/dist/client/assets/{Users01-C_FX7NZW.js → Users01-CSkRDmMq.js} +1 -1
  49. package/dist/client/assets/{Users03-CBIUviMz.js → Users03-CKweEAHJ.js} +1 -1
  50. package/dist/client/assets/{X-BbEHf0ox.js → X-Ch9pdqUF.js} +1 -1
  51. package/dist/client/assets/{XCircle-CIpucXWN.js → XCircle-CRFE9Sxc.js} +1 -1
  52. package/dist/client/assets/{XClose-D9lEUPrO.js → XClose-nb8sU8Mf.js} +1 -1
  53. package/dist/client/assets/{Zap-FJBBk1lb.js → Zap-cGv6CHKy.js} +1 -1
  54. package/dist/client/assets/{ZoomOut-DR5p3Py1.js → ZoomOut-kKuBc-4q.js} +1 -1
  55. package/dist/client/assets/{access-gate-BGLq5_fD.js → access-gate-Dna5j1xg.js} +1 -1
  56. package/dist/client/assets/{add-connection-dialog-CP-mB4l0.js → add-connection-dialog-Dv940sel.js} +1 -1
  57. package/dist/client/assets/{agent-analytics-CwkHNxxG.js → agent-analytics-BUFhTNrz.js} +1 -1
  58. package/dist/client/assets/agent-app-CwiQy74t.js +1 -0
  59. package/dist/client/assets/agent-assets-DBUnPpmJ.js +1 -0
  60. package/dist/client/assets/agent-automation-BUKjRQ0s.js +20 -0
  61. package/dist/client/assets/{agent-automations-BUDch-j3.js → agent-automations-CkHa31mG.js} +1 -1
  62. package/dist/client/assets/{agent-connect-sources-LY53id1I.js → agent-connect-sources-aEQ5U5Ys.js} +1 -1
  63. package/dist/client/assets/agent-deck-DZdDIvkK.js +1 -0
  64. package/dist/client/assets/{agent-e2e-CnVObhl4.js → agent-e2e-CVvHLDWr.js} +1 -1
  65. package/dist/client/assets/agent-file-B3z9GSFG.js +1 -0
  66. package/dist/client/assets/{agent-git-C-KtJQOB.js → agent-git-Xu4xVp7K.js} +2 -2
  67. package/dist/client/assets/{agent-hosting-Dr-g2CXP.js → agent-hosting-CqeGjFKK.js} +1 -1
  68. package/dist/client/assets/{agent-icon-CL_nl9mo.js → agent-icon-TqAwQbws.js} +1 -1
  69. package/dist/client/assets/agent-library-file-CyW6BWlf.js +1 -0
  70. package/dist/client/assets/{agent-monitor-SvCw0nUy.js → agent-monitor-CQJNHyJU.js} +1 -1
  71. package/dist/client/assets/{agent-overview-lLErih75.js → agent-overview-BMNsRpT6.js} +1 -1
  72. package/dist/client/assets/agent-settings-DW9H-Dv0.js +1 -0
  73. package/dist/client/assets/{agent-site-editor-BukowFNy.js → agent-site-editor-CIwfwhaR.js} +2 -2
  74. package/dist/client/assets/agent-site-editor-code-DerDfcPo.js +2 -0
  75. package/dist/client/assets/{agent-site-editor-content-DtzkoDLB.js → agent-site-editor-content-gT4XwcZF.js} +2 -2
  76. package/dist/client/assets/{agent-site-editor-preview-DX7U6V5V.js → agent-site-editor-preview-BxCHHAmi.js} +3 -3
  77. package/dist/client/assets/{agent-view-guard-BMN6ThUt.js → agent-view-guard-B9uu0uNy.js} +1 -1
  78. package/dist/client/assets/agent-view-mE-ErsH1.js +1 -0
  79. package/dist/client/assets/{agents-list-C6ZSW07I.js → agents-list-DEcIxmc7.js} +1 -1
  80. package/dist/client/assets/{ai-providers-D2C1qlv0.js → ai-providers-4TWNzC8y.js} +2 -2
  81. package/dist/client/assets/{alert-0Lc8v4N7.js → alert-B054apY1.js} +1 -1
  82. package/dist/client/assets/{alert-dialog-BcLnZa7A.js → alert-dialog-BQcocmj1.js} +1 -1
  83. package/dist/client/assets/api-keys-Dfv4dEMM.js +1 -0
  84. package/dist/client/assets/{api-keys-Cf6bK86U.js → api-keys-EFdKngWA.js} +1 -1
  85. package/dist/client/assets/app-editor-DAPu7E0g.js +1 -0
  86. package/dist/client/assets/{asset-utils-DIsXFmtL.js → asset-utils-D8QOLQKI.js} +1 -1
  87. package/dist/client/assets/{auth-DqeCOVzg.js → auth-CZC2Ujtf.js} +1 -1
  88. package/dist/client/assets/{auth-catchall-BNIBQ_XR.js → auth-catchall-CdCofhcq.js} +1 -1
  89. package/dist/client/assets/{auth-entry-Bq32N4lt.js → auth-entry-D76qGMln.js} +1 -1
  90. package/dist/client/assets/{auth-split-layout-DliwYz65.js → auth-split-layout-BqkQ5MRI.js} +1 -1
  91. package/dist/client/assets/{authenticate-and-persist-oauth-Eoth2qMz.js → authenticate-and-persist-oauth-CHdcX4lx.js} +1 -1
  92. package/dist/client/assets/{automation-list-row-CpdfZzhf.js → automation-list-row-CDBc0L1r.js} +1 -1
  93. package/dist/client/assets/{automation-runs-DIEXu2AA.js → automation-runs-BQLbZ_hL.js} +1 -1
  94. package/dist/client/assets/{automations-BpBth9hu.js → automations-CFVXwFqr.js} +1 -1
  95. package/dist/client/assets/{autosend-2Y4HgA_T.js → autosend-BA2WDHKH.js} +1 -1
  96. package/dist/client/assets/{avatar-YOwDvuCo.js → avatar-U_W3DOyI.js} +1 -1
  97. package/dist/client/assets/{badge-CKy1DnEV.js → badge-CTjh9J7T.js} +1 -1
  98. package/dist/client/assets/{block-document-aP19FM_M.js → block-document-DCeQa0yI.js} +1 -1
  99. package/dist/client/assets/{blocks-preview-workspace-context-DP5_u2Xp.js → blocks-preview-workspace-context-BdOEiss-.js} +1 -1
  100. package/dist/client/assets/{breadcrumb-BY8W5NfH.js → breadcrumb-DhYRM7a2.js} +1 -1
  101. package/dist/client/assets/{buckets-Bhe2phyM.js → buckets-DyboX_DE.js} +1 -1
  102. package/dist/client/assets/{build-improve-prompt-doc-DVZMfB_k.js → build-improve-prompt-doc-CVdAljgW.js} +1 -1
  103. package/dist/client/assets/{bulk-category-panel-dbBPINFu.js → bulk-category-panel-BLBAwogB.js} +1 -1
  104. package/dist/client/assets/{calendar-O0niDXgD.js → calendar-C3g1HVYe.js} +1 -1
  105. package/dist/client/assets/{capability-load-error-JtYpAIDC.js → capability-load-error-DsSoc04a.js} +1 -1
  106. package/dist/client/assets/{cards-CljnVFGF.js → cards-D3kB6iIj.js} +1 -1
  107. package/dist/client/assets/category-editor-CC0PdtIK.js +1 -0
  108. package/dist/client/assets/{chart-DjxuH9z1.js → chart-D_loKaX9.js} +1 -1
  109. package/dist/client/assets/{chat-context-DT13Ns9e.js → chat-context-Cor1QyQv.js} +1 -1
  110. package/dist/client/assets/{chat-draft-Bp7WKsio.js → chat-draft-DCJe5CEL.js} +1 -1
  111. package/dist/client/assets/{checkbox-BAc6ON84.js → checkbox-W4oibM4M.js} +1 -1
  112. package/dist/client/assets/{choose-editor-Db-m1tPL.js → choose-editor-CEzDxdDD.js} +1 -1
  113. package/dist/client/assets/{cli-auth-success-ORnUB4EZ.js → cli-auth-success-C_CF3b7k.js} +1 -1
  114. package/dist/client/assets/{client-icons-DH-s5V8p.js → client-icons-Bzg5KJqo.js} +1 -1
  115. package/dist/client/assets/{collapsible-Cfc5GOq6.js → collapsible-Q7VW373b.js} +1 -1
  116. package/dist/client/assets/{collection-detail-tLNt3mFd.js → collection-detail-Do-V1iEU.js} +1 -1
  117. package/dist/client/assets/{collection-display-button-Q83lUSRW.js → collection-display-button-DoWqp-k5.js} +1 -1
  118. package/dist/client/assets/{collection-search-DOotlcr-.js → collection-search-Ve8Od1Ze.js} +1 -1
  119. package/dist/client/assets/{collection-table-wrapper-L7fq3Ewq.js → collection-table-wrapper-CQd2BlgT.js} +1 -1
  120. package/dist/client/assets/{collection-tabs-77YTqRx_.js → collection-tabs-B31cxzhl.js} +1 -1
  121. package/dist/client/assets/{command-BbfSNpjK.js → command-BTJsPyoV.js} +1 -1
  122. package/dist/client/assets/{command-palette-store-CDXRiKfb.js → command-palette-store-B3FjlwOX.js} +1 -1
  123. package/dist/client/assets/{companion-mcps-section-B3OT3fvW.js → companion-mcps-section-BJrWJNrw.js} +1 -1
  124. package/dist/client/assets/{connect-DYMJSd71.js → connect-Dk6GxqPK.js} +2 -2
  125. package/dist/client/assets/{connect-layout-Cb-8wVa_.js → connect-layout-CJdyGLIg.js} +1 -1
  126. package/dist/client/assets/{connection-C0h_riCe.js → connection-BYgVvaQ-.js} +1 -1
  127. package/dist/client/assets/{connection-card-BnHVqPYb.js → connection-card-BlyShat1.js} +1 -1
  128. package/dist/client/assets/{connection-detail-BukOET2K.js → connection-detail-CtIhDsnP.js} +1 -1
  129. package/dist/client/assets/{connection-form-helpers-BGarejHH.js → connection-form-helpers-DfdZqD7N.js} +1 -1
  130. package/dist/client/assets/{connections-C94wvfI_.js → connections-DxJKDsbg.js} +1 -1
  131. package/dist/client/assets/{create-organization-dialog-BeMHfEec.js → create-organization-dialog-CiZy-ZG6.js} +1 -1
  132. package/dist/client/assets/{decofile-api-D5P6O-Yb.js → decofile-api-drrGQg3A.js} +1 -1
  133. package/dist/client/assets/{decopilot-DEim_pMB.js → decopilot-DB30hM5k.js} +1 -1
  134. package/dist/client/assets/{dialog-DIO2BT5L.js → dialog-FbeViKhV.js} +1 -1
  135. package/dist/client/assets/{discover-zXR45UVE.js → discover-Bkm8Ppdq.js} +1 -1
  136. package/dist/client/assets/{domain-settings-CoxAhG8y.js → domain-settings-di4lhBEH.js} +1 -1
  137. package/dist/client/assets/{download-app-dialog-B-5SSg-B.js → download-app-dialog-B0wRR8XY.js} +1 -1
  138. package/dist/client/assets/{drawer-Dp27hT9C.js → drawer-BFLllOI5.js} +1 -1
  139. package/dist/client/assets/{dropdown-menu-BzAnwSL0.js → dropdown-menu-Cg7EtBKr.js} +1 -1
  140. package/dist/client/assets/{editor-Dm21YC6a.js → editor-DfIJZemH.js} +3 -3
  141. package/dist/client/assets/{empty-state-F709JYnF.js → empty-state-B73golk2.js} +1 -1
  142. package/dist/client/assets/{empty-state-CvrLm3VU.js → empty-state-BUjKoJeI.js} +1 -1
  143. package/dist/client/assets/{extract-connection-data-Cfd0L2y0.js → extract-connection-data-OymVW05I.js} +1 -1
  144. package/dist/client/assets/{feature-gate-CSQct_zD.js → feature-gate-BtTiJvHf.js} +1 -1
  145. package/dist/client/assets/{feature-paywall-Cd5ZGlWk.js → feature-paywall-CxRYlO85.js} +1 -1
  146. package/dist/client/assets/{file-explorer-B6MMR_br.js → file-explorer-ChhaUDkc.js} +1 -1
  147. package/dist/client/assets/{file-preview-B3un6Sja.js → file-preview-B-3X414G.js} +1 -1
  148. package/dist/client/assets/{file-share-button-BXZcNnFk.js → file-share-button-BCcqyHI3.js} +1 -1
  149. package/dist/client/assets/{file-type-icon-CzM4dKXx.js → file-type-icon-CgjUbvA5.js} +1 -1
  150. package/dist/client/assets/{folder-icon-Bjs4wWQI.js → folder-icon-DIKFMRjx.js} +1 -1
  151. package/dist/client/assets/{form-DGoweIp4.js → form-ZSFKpKuR.js} +1 -1
  152. package/dist/client/assets/{gateway-client-BKFdOqFV.js → gateway-client-DDB4Jo5d.js} +1 -1
  153. package/dist/client/assets/{general-BER62NBk.js → general-B89BsePD.js} +1 -1
  154. package/dist/client/assets/{github-icon-D5mzGkJ1.js → github-icon-DvBRseH_.js} +1 -1
  155. package/dist/client/assets/home-EgbfGXHT.js +1 -0
  156. package/dist/client/assets/{hooks-DW28Wv6W.js → hooks-CY6XZOHF.js} +1 -1
  157. package/dist/client/assets/{hooks-DOi6gVdi.js → hooks-Czb0EjQM.js} +2 -2
  158. package/dist/client/assets/{index-BqEX4CxD.js → index-B8SDzCvY.js} +1 -1
  159. package/dist/client/assets/{index-26VXD9YQ.js → index-BLoGenx5.js} +1 -1
  160. package/dist/client/assets/{index-BiIMwVbK.js → index-BWW-QUD7.js} +1 -1
  161. package/dist/client/assets/{index-CLBWHxV4.js → index-B_q9xGDu.js} +1 -1
  162. package/dist/client/assets/{index-BKjzqVX4.js → index-BwNv0_X1.js} +1 -1
  163. package/dist/client/assets/{index-ebCjSNwh.js → index-C2PjpIk5.js} +39 -39
  164. package/dist/client/assets/{index-D3hBrAe3.js → index-CaeHd-kX.js} +1 -1
  165. package/dist/client/assets/{index-C7nGODiq.js → index-CbVT0Wha.js} +1 -1
  166. package/dist/client/assets/{index-D9Pa20nR.js → index-CiQ8AEuv.js} +1 -1
  167. package/dist/client/assets/{index-kzbDuxts.js → index-CyayjuN4.js} +1 -1
  168. package/dist/client/assets/{index-BVdPTogP.js → index-DDWK4S9N.js} +1 -1
  169. package/dist/client/assets/{index-Ch3pSh1a.js → index-DQH0Frt9.js} +1 -1
  170. package/dist/client/assets/{index-DDHop146.js → index-DgDEDYFd.js} +1 -1
  171. package/dist/client/assets/{index-C9jQATHx.js → index-bq82HRdX.js} +7 -7
  172. package/dist/client/assets/{index-DX88U1Fe.js → index-mL_OEvyk.js} +2 -2
  173. package/dist/client/assets/{index-redirect-bdPeOdFP.js → index-redirect-Cl5ECm8S.js} +1 -1
  174. package/dist/client/assets/{infiniteQueryObserver-CrlFqUXS.js → infiniteQueryObserver-Dk7f60ge.js} +1 -1
  175. package/dist/client/assets/{infra-billing-DBRnO5Xv.js → infra-billing-D-zABnxC.js} +1 -1
  176. package/dist/client/assets/{input-BfoQkl5k.js → input-B62UEC6S.js} +1 -1
  177. package/dist/client/assets/{input-DxpPAL6X.js → input-C4xdJkO9.js} +2 -2
  178. package/dist/client/assets/{input-DCAbperr.js → input-DYrUDn-6.js} +1 -1
  179. package/dist/client/assets/{integration-icon-DLbXRirx.js → integration-icon-DWVAXJ5W.js} +1 -1
  180. package/dist/client/assets/{label-BZvBRfsC.js → label-DHlCjoX-.js} +1 -1
  181. package/dist/client/assets/{last-preview-page-DgNuT4mN.js → last-preview-page-g2Wt-_qP.js} +1 -1
  182. package/dist/client/assets/{layout-D_2jgeSQ.js → layout-DvNX7Jhc.js} +1 -1
  183. package/dist/client/assets/{legacy-agents-deep-D9-8wOwe.js → legacy-agents-deep-B4F7_80Y.js} +1 -1
  184. package/dist/client/assets/{legacy-main-redirect-U48xVXg3.js → legacy-main-redirect-DLvBqWxl.js} +1 -1
  185. package/dist/client/assets/{library-DCHuYHcg.js → library-CceZemOg.js} +2 -2
  186. package/dist/client/assets/{login-DLU4Kv--.js → login-CX3-ibA4.js} +1 -1
  187. package/dist/client/assets/{markdown-BxIxTFHX.js → markdown-qqEQfcng.js} +33 -33
  188. package/dist/client/assets/{mcp-app-renderer-C5_SSFlp.js → mcp-app-renderer-Cj43EsNL.js} +1 -1
  189. package/dist/client/assets/{mcp-oauth-Cj16tOMc.js → mcp-oauth-lrCnpZRU.js} +1 -1
  190. package/dist/client/assets/{members-B8ghL5vq.js → members-BKOir_Pt.js} +1 -1
  191. package/dist/client/assets/{message-templates-C0k0djOm.js → message-templates-0mKRx1r7.js} +1 -1
  192. package/dist/client/assets/{mini-report-page-DPr8miDS.js → mini-report-page-CfZCYEQQ.js} +1 -1
  193. package/dist/client/assets/mock-board-CqCYQnTw.js +90 -0
  194. package/dist/client/assets/{monaco-editor-D7KtEG80.js → monaco-editor-BbS-xHlo.js} +1 -1
  195. package/dist/client/assets/{monitoring-stats-row-C8qE8vIX.js → monitoring-stats-row-CGLZvQvq.js} +1 -1
  196. package/dist/client/assets/{multi-select-PUmjNPLo.js → multi-select-DHogVRlv.js} +1 -1
  197. package/dist/client/assets/{mustache-DoPKkDOt.js → mustache-CaTcgxFU.js} +1 -1
  198. package/dist/client/assets/{oauth-callback-yzNiiBZS.js → oauth-callback-BDR5owZa.js} +1 -1
  199. package/dist/client/assets/{oauth-callback-ai-provider-BkPGppSA.js → oauth-callback-ai-provider-DSX_mvvw.js} +1 -1
  200. package/dist/client/assets/{onboarding-DNDx-VJt.js → onboarding-_X5jFwXg.js} +1 -1
  201. package/dist/client/assets/{optimistic-project-sidebar-views-DQAcmOUC.js → optimistic-project-sidebar-views-prl2BiPv.js} +1 -1
  202. package/dist/client/assets/org-file-open-context-CY-h563L.js +1 -0
  203. package/dist/client/assets/{organization-choice-X5fcp7VC.js → organization-choice-C7qy14tx.js} +1 -1
  204. package/dist/client/assets/{orgs-C71bHZfS.js → orgs-CgMPvHkg.js} +1 -1
  205. package/dist/client/assets/{page-seo-form-CJ5C4DO5.js → page-seo-form-CmXwxqgr.js} +1 -1
  206. package/dist/client/assets/{pair-D4JmcK-t.js → pair-CoC4CuoZ.js} +1 -1
  207. package/dist/client/assets/{plan-ladder-CQ1a44li.js → plan-ladder-DpgC6kIZ.js} +1 -1
  208. package/dist/client/assets/{popover-cYfVOF_J.js → popover-DJmzS7mv.js} +1 -1
  209. package/dist/client/assets/post-calendar-Dz5zavXp.js +1 -0
  210. package/dist/client/assets/post-editor-DWfeh8M1.js +1 -0
  211. package/dist/client/assets/{preview-content-DlgGWAMY.js → preview-content-C0VkspNR.js} +1 -1
  212. package/dist/client/assets/{preview-dialog-DMVdVz_V.js → preview-dialog-BZOqzTG2.js} +1 -1
  213. package/dist/client/assets/{primitives-7Kw_jkKz.js → primitives-jHhmgAQ9.js} +1 -1
  214. package/dist/client/assets/{profile-fIXgfLVj.js → profile-fLPl9mHC.js} +1 -1
  215. package/dist/client/assets/{project-app-view-DpkzCjxR.js → project-app-view-B7QzqtQA.js} +1 -1
  216. package/dist/client/assets/{project-feed-D1Rnls8q.js → project-feed-B--J89zr.js} +1 -1
  217. package/dist/client/assets/{project-icon-CWg_rHTZ.js → project-icon-BRc_SYWu.js} +1 -1
  218. package/dist/client/assets/project-reports-DeYwugwl.js +1 -0
  219. package/dist/client/assets/project-tasks-D7RrtRzg.js +1 -0
  220. package/dist/client/assets/{prompts-D1i8e1V8.js → prompts-C5wKMcEi.js} +1 -1
  221. package/dist/client/assets/record-editor-BMFTazO_.js +1 -0
  222. package/dist/client/assets/redirect-editor-Bz1hNhc-.js +1 -0
  223. package/dist/client/assets/registry-CBVz5tUq.js +2 -0
  224. package/dist/client/assets/{registry-layout-r2D039nl.js → registry-layout-B8hxuLqC.js} +1 -1
  225. package/dist/client/assets/{reports-TdOY4KuN.js → reports-BNMMk57f.js} +1 -1
  226. package/dist/client/assets/reports-BVwrD4fa.js +1 -0
  227. package/dist/client/assets/{reports-onboarding-s05s2vjv.js → reports-onboarding-Cvd1ByZr.js} +1 -1
  228. package/dist/client/assets/{reports-tab-D0Xwzbct.js → reports-tab-B1GRtFON.js} +2 -2
  229. package/dist/client/assets/{repositories-JDvNAhI8.js → repositories-CrrctYRd.js} +1 -1
  230. package/dist/client/assets/{repository-import-picker-BNluAY2V.js → repository-import-picker-CwyID9Hr.js} +1 -1
  231. package/dist/client/assets/{repository-picker-D9agNhNi.js → repository-picker-nA1fPR0i.js} +1 -1
  232. package/dist/client/assets/{require-capability-DjYcyxbJ.js → require-capability-Dq_uftSz.js} +1 -1
  233. package/dist/client/assets/{required-auth-layout-C3o3t9X1.js → required-auth-layout-bRQ8Relk.js} +1 -1
  234. package/dist/client/assets/{reset-password-DOQza5N6.js → reset-password-9EzqJ9Aj.js} +1 -1
  235. package/dist/client/assets/{resizable-BHYHfZY5.js → resizable-CHa_EJdX.js} +1 -1
  236. package/dist/client/assets/{review-settings-zUGfHLOe.js → review-settings-CuYs2gkJ.js} +1 -1
  237. package/dist/client/assets/{rich-text-link-control-BMZBKHAS.js → rich-text-link-control-BhNjJjUI.js} +1 -1
  238. package/dist/client/assets/{roles-CbYdUx8a.js → roles-DOIPyEeu.js} +1 -1
  239. package/dist/client/assets/{route--XOZLXQj.js → route-BJZVtvXD.js} +1 -1
  240. package/dist/client/assets/{route-BMqM-gRN.js → route-DVbh_JIM.js} +1 -1
  241. package/dist/client/assets/route-DXTx8B1o.js +1 -0
  242. package/dist/client/assets/{runnable-block-editor-eIl1ZAUD.js → runnable-block-editor-NBss0rGv.js} +1 -1
  243. package/dist/client/assets/{sandbox-lifecycle-context-dIh2VE9T.js → sandbox-lifecycle-context-Cwag3ZuW.js} +1 -1
  244. package/dist/client/assets/{schema-DLCqAhaO.js → schema-Difu_0cd.js} +1 -1
  245. package/dist/client/assets/{scroll-area-B6yfQzTQ.js → scroll-area-DizJqsMb.js} +1 -1
  246. package/dist/client/assets/{search-input-B9FxoKon.js → search-input-BFvnqi9T.js} +1 -1
  247. package/dist/client/assets/{secrets-Ckg8Rd0M.js → secrets-mAWyIyIG.js} +1 -1
  248. package/dist/client/assets/{sections-editor-DfusxW9l.js → sections-editor-BS-czeQw.js} +2 -2
  249. package/dist/client/assets/{select-BemZ3-RS.js → select-CQk1UktB.js} +1 -1
  250. package/dist/client/assets/{select-model-Dt_mcRLi.js → select-model-V6Ahwt40.js} +1 -1
  251. package/dist/client/assets/seo-editor-DqOS74Wa.js +1 -0
  252. package/dist/client/assets/{settings-tab-W9gLVP9Y.js → settings-tab-DgFFWLKL.js} +1 -1
  253. package/dist/client/assets/{sheet-CAYJdNnO.js → sheet-XW3igMAp.js} +1 -1
  254. package/dist/client/assets/{shell-layout-BZ9RU057.js → shell-layout-lFmUNyF7.js} +1 -1
  255. package/dist/client/assets/{sidebar-kfvz7bzl.js → sidebar-CaDkomsf.js} +1 -1
  256. package/dist/client/assets/{skill-preview-DKoageod.js → skill-preview-haMHuu3V.js} +1 -1
  257. package/dist/client/assets/skills-CQVB1v99.js +1 -0
  258. package/dist/client/assets/{sso-aIkFrBYs.js → sso-BguB6oWk.js} +1 -1
  259. package/dist/client/assets/{store-PyPRbE--.js → store-DfwhNMsh.js} +1 -1
  260. package/dist/client/assets/store-registry-k7nLI4El.js +2 -0
  261. package/dist/client/assets/{switch-CwYc17c1.js → switch-C44BHJ4_.js} +1 -1
  262. package/dist/client/assets/{synced-repos-LBwJXWce.js → synced-repos-CfvjXlOq.js} +1 -1
  263. package/dist/client/assets/{table-Dk8JamWN.js → table-vs5PY6MV.js} +1 -1
  264. package/dist/client/assets/{tabs-CScSsCn-.js → tabs-Be7MjhEn.js} +1 -1
  265. package/dist/client/assets/{task-board-WxptS5oC.js → task-board-NCKWK-L3.js} +1 -1
  266. package/dist/client/assets/{task-route-CgUDYaF5.js → task-route-BoHR4cN4.js} +1 -1
  267. package/dist/client/assets/{task-status-DYV2rHq2.js → task-status-DsfqndTm.js} +1 -1
  268. package/dist/client/assets/{tasks-Dyp4w1ZL.js → tasks-C_VDG237.js} +4 -4
  269. package/dist/client/assets/tasks-DjG_h180.js +1 -0
  270. package/dist/client/assets/{textarea-C-rDHIo4.js → textarea-Dt5uzYAk.js} +1 -1
  271. package/dist/client/assets/{thread-intent-Dqbb6tX6.js → thread-intent-BBez6nif.js} +1 -1
  272. package/dist/client/assets/{thread-route-DGpNj7En.js → thread-route-B0O5tMmh.js} +1 -1
  273. package/dist/client/assets/{thread-route-B7ApJPMo.js → thread-route-DhLwmRkM.js} +1 -1
  274. package/dist/client/assets/{thread-sheet-body-CXERmuvO.js → thread-sheet-body-qD1pkorX.js} +1 -1
  275. package/dist/client/assets/{toggle-group-BwAc-516.js → toggle-group-DXrH4GGv.js} +1 -1
  276. package/dist/client/assets/{toolbar-icon-button-D5CIjxUn.js → toolbar-icon-button-DkmObRsV.js} +1 -1
  277. package/dist/client/assets/{tooltip-D5dIOzcQ.js → tooltip-BbRZqSqs.js} +1 -1
  278. package/dist/client/assets/{track-CfasnexS.js → track-Cq81o3eA.js} +1 -1
  279. package/dist/client/assets/{types-BKgDxdgt.js → types-DfRui0tk.js} +1 -1
  280. package/dist/client/assets/{usage-stats-CzjkHtFz.js → usage-stats-CIfcRmIQ.js} +1 -1
  281. package/dist/client/assets/{use-ai-providers-DHpBr525.js → use-ai-providers-CzWjKGEV.js} +1 -1
  282. package/dist/client/assets/{use-automations-D8fUWM0i.js → use-automations-B1g8BCjF.js} +1 -1
  283. package/dist/client/assets/{use-autosave-BcXFrygg.js → use-autosave-zCYjHp0Q.js} +1 -1
  284. package/dist/client/assets/{use-connect-companion-BI8_ITvf.js → use-connect-companion-CSsGFFTC.js} +1 -1
  285. package/dist/client/assets/{use-connection-1DEAzFaJ.js → use-connection-D_iAIgTV.js} +1 -1
  286. package/dist/client/assets/{use-copy-CrTQ1bFc.js → use-copy-CXvvMCCk.js} +1 -1
  287. package/dist/client/assets/{use-create-virtual-mcp-6onzYx_V.js → use-create-virtual-mcp-wa9JpFSa.js} +1 -1
  288. package/dist/client/assets/{use-date-fns-locale-CKJk6bHw.js → use-date-fns-locale-DAtfdqMB.js} +1 -1
  289. package/dist/client/assets/{use-debounced-autosave-CscEX7LB.js → use-debounced-autosave-CGfqMI_2.js} +1 -1
  290. package/dist/client/assets/{use-debounced-value-Cd1Twr6w.js → use-debounced-value-BjFoL1TN.js} +1 -1
  291. package/dist/client/assets/{use-deco-credits-DXbh8RF9.js → use-deco-credits-KfquqRSe.js} +1 -1
  292. package/dist/client/assets/{use-decopilot-events-BorkAE1x.js → use-decopilot-events-3_YSe3LA.js} +1 -1
  293. package/dist/client/assets/{use-delete-connection-D14lo6hH.js → use-delete-connection-4mVlUDap.js} +1 -1
  294. package/dist/client/assets/{use-deployment-admin-CnWMkexv.js → use-deployment-admin-DiOvR37Z.js} +1 -1
  295. package/dist/client/assets/{use-entitlements-CW1G9reZ.js → use-entitlements-CZtG5Aw4.js} +1 -1
  296. package/dist/client/assets/{use-fast-preview-draft-url-C6GlSiLC.js → use-fast-preview-draft-url-tdElS5FG.js} +1 -1
  297. package/dist/client/assets/{use-file-configs-CIuxe_Ni.js → use-file-configs-BTKu0ddn.js} +1 -1
  298. package/dist/client/assets/{use-infinite-scroll-C3V6bChR.js → use-infinite-scroll-CqfaxXN1.js} +1 -1
  299. package/dist/client/assets/{use-join-requests-D9RxS7KW.js → use-join-requests-B4yW6raK.js} +1 -1
  300. package/dist/client/assets/{use-main-panel-tabs-DXkaeHMV.js → use-main-panel-tabs-Ch6v5oL2.js} +1 -1
  301. package/dist/client/assets/{use-mcp-auth-status-BH9IDFQ1.js → use-mcp-auth-status-BHDkqk7b.js} +1 -1
  302. package/dist/client/assets/{use-mcp-client-2uEIRhaM.js → use-mcp-client-oEME4UuR.js} +1 -1
  303. package/dist/client/assets/{use-mcp-prompts-CoIIHF5C.js → use-mcp-prompts-C3OTryE-.js} +1 -1
  304. package/dist/client/assets/{use-mcp-tools-BEXh2Dal.js → use-mcp-tools-5nC74C22.js} +1 -1
  305. package/dist/client/assets/{use-members-B9Bp6K2N.js → use-members-69QDyex7.js} +1 -1
  306. package/dist/client/assets/{use-mobile-CpN-x3jP.js → use-mobile-DAKfge6F.js} +1 -1
  307. package/dist/client/assets/{use-navigate-to-agent-D91bju80.js → use-navigate-to-agent-DxF2NRC6.js} +1 -1
  308. package/dist/client/assets/{use-open-billing-url-BerGO0rw.js → use-open-billing-url-B38x35SM.js} +1 -1
  309. package/dist/client/assets/{use-org-auth-client-r5wiYH2P.js → use-org-auth-client-DscVB01a.js} +1 -1
  310. package/dist/client/assets/{use-org-fs-Bts9OSaP.js → use-org-fs-fnC2xvX1.js} +1 -1
  311. package/dist/client/assets/{use-org-notice-CoJcS75H.js → use-org-notice-B1I6Lz9G.js} +1 -1
  312. package/dist/client/assets/{use-org-sso-dhAsVLFb.js → use-org-sso-Bkoh1g8c.js} +1 -1
  313. package/dist/client/assets/{use-organization-roles-kAP23ZDQ.js → use-organization-roles-BfyEvouz.js} +1 -1
  314. package/dist/client/assets/{use-organization-settings-OP1vKLQc.js → use-organization-settings-822MAvzA.js} +1 -1
  315. package/dist/client/assets/{use-panel-navigate-DArr9jKh.js → use-panel-navigate-CfBqSRJx.js} +1 -1
  316. package/dist/client/assets/{use-project-native-view-presence-7Bqoz-C1.js → use-project-native-view-presence-D8gp5jYC.js} +1 -1
  317. package/dist/client/assets/{use-project-scope-DUmb12wa.js → use-project-scope-UolqDpiW.js} +1 -1
  318. package/dist/client/assets/{use-registry-connections-T5KGR_Hv.js → use-registry-connections-fPqqwJHB.js} +1 -1
  319. package/dist/client/assets/{use-releases-C3yM6r03.js → use-releases-Cbg5_HwT.js} +1 -1
  320. package/dist/client/assets/{use-reports-diagnostic-vTs5yUh0.js → use-reports-diagnostic-Dlm42p32.js} +1 -1
  321. package/dist/client/assets/{use-route-default-main-D6cfsdMd.js → use-route-default-main-Dxf67Gay.js} +1 -1
  322. package/dist/client/assets/{use-secrets-CVFKBXHe.js → use-secrets-CPAFHAxr.js} +1 -1
  323. package/dist/client/assets/{use-section-preview-base-YyD8NP1s.js → use-section-preview-base-kMBmEGDx.js} +1 -1
  324. package/dist/client/assets/{use-session-runtime-Dg7Dw6FF.js → use-session-runtime-BBfRxqis.js} +1 -1
  325. package/dist/client/assets/{use-tags-yE947YEK.js → use-tags-BbWkKH-n.js} +1 -1
  326. package/dist/client/assets/{use-task-metadata-Cxd6otqh.js → use-task-metadata-C4b2me4e.js} +1 -1
  327. package/dist/client/assets/{use-thread-outputs-HjlkcFr2.js → use-thread-outputs-BBZhcvEI.js} +1 -1
  328. package/dist/client/assets/{use-view-mode-BsvAwGGR.js → use-view-mode-nKImchJM.js} +1 -1
  329. package/dist/client/assets/{use-virtual-mcp-De5-1hZU.js → use-virtual-mcp-Dd6It4Gy.js} +1 -1
  330. package/dist/client/assets/useInfiniteQuery-jh1wgrcQ.js +1 -0
  331. package/dist/client/assets/{useQueries-Dg8jJOK1.js → useQueries-Bz_0VuN2.js} +1 -1
  332. package/dist/client/assets/useSuspenseInfiniteQuery-B8nGcnhH.js +1 -0
  333. package/dist/client/assets/{users-DmBfcg5F.js → users-Bl2iF4g-.js} +1 -1
  334. package/dist/client/assets/{utils-Bx7x03n7.js → utils-8GjS8YYu.js} +1 -1
  335. package/dist/client/assets/variant-calendar-BGrVKKIo.js +1 -0
  336. package/dist/client/assets/{variant-matcher-override-DyHDH8Wv.js → variant-matcher-override-Dlsp2B8I.js} +1 -1
  337. package/dist/client/assets/{view-mode-toggle-Cr1ou40b.js → view-mode-toggle-BcLNRkIj.js} +1 -1
  338. package/dist/client/assets/{virtual-mcp-BvoWP1mU.js → virtual-mcp-KhrhV1xQ.js} +1 -1
  339. package/dist/client/index.html +1 -1
  340. package/dist/server/cli.js +59 -59
  341. package/dist/server/server.js +55 -55
  342. package/package.json +1 -1
  343. package/dist/client/assets/agent-app-DOZj_KNh.js +0 -1
  344. package/dist/client/assets/agent-assets-COVC5lPr.js +0 -1
  345. package/dist/client/assets/agent-automation-BWSPNjim.js +0 -20
  346. package/dist/client/assets/agent-deck-Ci4o3-Qm.js +0 -1
  347. package/dist/client/assets/agent-file-cFbD0OqV.js +0 -1
  348. package/dist/client/assets/agent-library-file-DXMpRwGw.js +0 -1
  349. package/dist/client/assets/agent-settings-BDT_wIMj.js +0 -1
  350. package/dist/client/assets/agent-site-editor-code-CaFMcCwi.js +0 -2
  351. package/dist/client/assets/agent-view-BOmW_Ep_.js +0 -1
  352. package/dist/client/assets/api-keys-C2lfrWiE.js +0 -1
  353. package/dist/client/assets/app-editor-Cbs0w-F0.js +0 -1
  354. package/dist/client/assets/category-editor-B984VME1.js +0 -1
  355. package/dist/client/assets/home-9LhFhaJr.js +0 -1
  356. package/dist/client/assets/mock-board-CLCjiMWY.js +0 -90
  357. package/dist/client/assets/post-calendar-DW1nVDLh.js +0 -1
  358. package/dist/client/assets/post-editor-C5j6zvkW.js +0 -1
  359. package/dist/client/assets/project-reports-BcpuMQY2.js +0 -1
  360. package/dist/client/assets/project-tasks-Cbu0gYbc.js +0 -1
  361. package/dist/client/assets/record-editor-CQeidmi2.js +0 -1
  362. package/dist/client/assets/redirect-editor-BL101gtT.js +0 -1
  363. package/dist/client/assets/registry-Dkgi61cL.js +0 -2
  364. package/dist/client/assets/reports-StG6MJZE.js +0 -1
  365. package/dist/client/assets/route-DJ7DRiHo.js +0 -1
  366. package/dist/client/assets/seo-editor-BEgFLCyp.js +0 -1
  367. package/dist/client/assets/skills-DZXynXjf.js +0 -1
  368. package/dist/client/assets/store-registry-mk4k386L.js +0 -2
  369. package/dist/client/assets/tasks-CwnRPaEK.js +0 -1
  370. package/dist/client/assets/useInfiniteQuery-TmIWCfQ-.js +0 -1
  371. package/dist/client/assets/useSuspenseInfiniteQuery-C8wrcyHJ.js +0 -1
  372. package/dist/client/assets/variant-calendar-DPR_CnEY.js +0 -1
@@ -1,29 +1,29 @@
1
- import{c as oo,r as H,b as rc,ac as Lf,j as D,h as $f,B as rl,ab as il,aa as zf,ad as Bf,d_ as ic,d$ as Ff,aw as Hf,dH as Vt,e0 as Vf,l as sc}from"./index-C9jQATHx.js";import{d as jf,g as Wf}from"./gateway-client-BKFdOqFV.js";import{d as Kf,c as Uf,e as _f,b as qf,D as Jf}from"./dialog-DIO2BT5L.js";import{a as Gf,F as Yf,b as Xf,c as Qf,d as Zf,f as eh}from"./form-DGoweIp4.js";import{I as th}from"./input-DCAbperr.js";import{t as sl}from"./utils-CVEq3hMx.js";import{T as nh,a as rh,c as ih}from"./tooltip-D5dIOzcQ.js";function sh(t,e){const n={};for(const r of t?.arguments??[])n[r.name]=r.required?il().min(1,e):il();return zf(n)}function oh(t,e){const n={};for(const r of t.arguments??[])n[r.name]=e?.[r.name]??"";return n}function cx(t){const e=oo.c(74),{prompt:n,setPrompt:r,onSubmit:i,defaultValues:s}=t,o=H.useId(),l=rc();let a,c;if(e[0]!==n||e[1]!==l){const ce=sh(n,l("chat.dialogPromptArguments.required"));c=Bf,a=Lf(ce),e[0]=n,e[1]=l,e[2]=a,e[3]=c}else a=e[2],c=e[3];let u;e[4]!==s||e[5]!==n?(u=n?oh(n,s):{},e[4]=s,e[5]=n,e[6]=u):u=e[6];let d;e[7]!==a||e[8]!==u?(d={resolver:a,defaultValues:u,mode:"onChange"},e[7]=a,e[8]=u,e[9]=d):d=e[9];const f=c(d);let h;e[10]!==n?.arguments?(h=n?.arguments??[],e[10]=n?.arguments,e[11]=h):h=e[11];const p=h;let g;e[12]!==f||e[13]!==i||e[14]!==r?(g=async ce=>{await i(ce),r(null),f.reset()},e[12]=f,e[13]=i,e[14]=r,e[15]=g):g=e[15];const m=g;let y;e[16]!==f||e[17]!==r?(y=ce=>{ce||(f.reset(),r(null))},e[16]=f,e[17]=r,e[18]=y):y=e[18];const b=y;if(!n)return null;let S;e[19]!==n._meta||e[20]!==n.name||e[21]!==n.title?(S=n.title||jf(n.name,Wf(n._meta)),e[19]=n._meta,e[20]=n.name,e[21]=n.title,e[22]=S):S=e[22];let C;e[23]!==S?(C=D.jsx(Kf,{children:D.jsx("span",{className:"capitalize",children:S})}),e[23]=S,e[24]=C):C=e[24];let v;e[25]!==n.description?(v=n.description&&D.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[25]=n.description,e[26]=v):v=e[26];let R;e[27]!==v||e[28]!==C?(R=D.jsxs(Uf,{children:[C,v]}),e[27]=v,e[28]=C,e[29]=R):R=e[29];let w;e[30]!==f||e[31]!==m?(w=ce=>{ce.stopPropagation(),f.handleSubmit(m)(ce)},e[30]=f,e[31]=m,e[32]=w):w=e[32];let N;if(e[33]!==p||e[34]!==f.control||e[35]!==f.formState.isSubmitting||e[36]!==l){let ce;e[38]!==f.control||e[39]!==f.formState.isSubmitting||e[40]!==l?(ce=Yt=>D.jsx(Yf,{control:f.control,name:Yt.name,render:Pf=>{const{field:nl}=Pf;return D.jsxs(Xf,{children:[D.jsxs(Qf,{className:"text-xs",children:[Yt.name,Yt.required?null:D.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ",l("chat.dialogPromptArguments.optional")]})]}),D.jsx(Zf,{children:D.jsx(th,{...nl,value:nl.value??"",required:Yt.required,placeholder:Yt.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),D.jsx(eh,{})]})}},Yt.name),e[38]=f.control,e[39]=f.formState.isSubmitting,e[40]=l,e[41]=ce):ce=e[41],N=p.map(ce),e[33]=p,e[34]=f.control,e[35]=f.formState.isSubmitting,e[36]=l,e[37]=N}else N=e[37];let I;e[42]!==b?(I=()=>b(!1),e[42]=b,e[43]=I):I=e[43];const Z=f.formState.isSubmitting;let le;e[44]!==l?(le=l("chat.dialogPromptArguments.cancel"),e[44]=l,e[45]=le):le=e[45];let ae;e[46]!==f.formState.isSubmitting||e[47]!==I||e[48]!==le?(ae=D.jsx(rl,{type:"button",variant:"ghost",onClick:I,disabled:Z,children:le}),e[46]=f.formState.isSubmitting,e[47]=I,e[48]=le,e[49]=ae):ae=e[49];let V;e[50]!==f.formState.isSubmitting||e[51]!==l?(V=f.formState.isSubmitting?D.jsxs("span",{className:"flex items-center gap-2",children:[D.jsx($f,{size:"xs"}),l("chat.dialogPromptArguments.loading")]}):l("chat.dialogPromptArguments.usePrompt"),e[50]=f.formState.isSubmitting,e[51]=l,e[52]=V):V=e[52];let q;e[53]!==f.formState.isSubmitting||e[54]!==o||e[55]!==V?(q=D.jsx(rl,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:V}),e[53]=f.formState.isSubmitting,e[54]=o,e[55]=V,e[56]=q):q=e[56];let z;e[57]!==ae||e[58]!==q?(z=D.jsxs(_f,{children:[ae,q]}),e[57]=ae,e[58]=q,e[59]=z):z=e[59];let J;e[60]!==o||e[61]!==w||e[62]!==N||e[63]!==z?(J=D.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[N,z]}),e[60]=o,e[61]=w,e[62]=N,e[63]=z,e[64]=J):J=e[64];let Oe;e[65]!==f||e[66]!==J?(Oe=D.jsx(Gf,{...f,children:J}),e[65]=f,e[66]=J,e[67]=Oe):Oe=e[67];let he;e[68]!==R||e[69]!==Oe?(he=D.jsxs(qf,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[R,Oe]}),e[68]=R,e[69]=Oe,e[70]=he):he=e[70];let Et;return e[71]!==b||e[72]!==he?(Et=D.jsx(Jf,{open:!0,onOpenChange:b,children:he}),e[71]=b,e[72]=he,e[73]=Et):Et=e[73],Et}var ol=Object.defineProperty,lh=(t,e)=>{let n={};for(var r in t)ol(n,r,{get:t[r],enumerable:!0});return ol(n,Symbol.toStringTag,{value:"Module"}),n};function re(t){this.content=t}re.prototype={constructor:re,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new re(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new re(n)},addToStart:function(t,e){return new re([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new re(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new re(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=re.from(t),t.size?new re(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=re.from(t),t.size?new re(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=re.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};re.from=function(t){if(t instanceof re)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new re(e)};function oc(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){let o=i.text,l=s.text,a=0;for(;o[a]==l[a];a++)n++;return a&&a<o.length&&a<l.length&&cc(o.charCodeAt(a-1))&&ac(o.charCodeAt(a))&&n--,n}if(i.content.size||s.content.size){let o=oc(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function lc(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let c=o.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,n--,r--;return d&&f&&d<c.length&&cc(c.charCodeAt(d-1))&&ac(c.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(o.content.size||l.content.size){let c=lc(o.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function ac(t){return t>=56320&&t<57344}function cc(t){return t>=55296&&t<56320}class k{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,l=0;l<n;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new k(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),i+=l.nodeSize),o=a}return new k(r,i)}cutByIndex(e,n){return e==n?k.empty:e==0&&n==this.content.length?this:new k(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new k(i,s)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return oc(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return lc(this,e,n,r)}findIndex(e){if(e==0)return gr(0,e);if(e==this.size)return gr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?gr(n+1,s):gr(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return k.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return k.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new k(n||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const Wi={index:0,offset:0};function gr(t,e){return Wi.index=t,Wi.offset=e,Wi}function Lr(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Lr(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Lr(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let $=class ks{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Lr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ks.none;if(e instanceof ks)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};$.none=[];class Jn extends Error{}class M{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=dc(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new M(r,this.openStart,this.openEnd)}removeBetween(e,n){return new M(uc(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return M.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new M(k.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new M(e,r,i)}}M.empty=new M(k.empty,0,0);function uc(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(i==e||s.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(uc(s.content,e-i-1,n-i-1)))}function dc(t,e,n,r,i,s){let{index:o,offset:l}=t.findIndex(e),a=t.maybeChild(o);if(l==e||a.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=dc(a.content,e-l-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,a);return c&&t.replaceChild(o,a.copy(c))}function ah(t,e,n){if(n.openStart>t.depth)throw new Jn("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Jn("Inconsistent open depths");return fc(t,e,n,0)}function fc(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=fc(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return Pt(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=ch(n,t);return Pt(s,pc(t,o,l,e,r))}else return Pt(s,$r(t,e,r))}function hc(t,e){if(!e.type.compatibleContent(t.type))throw new Jn("Cannot join "+e.type.name+" onto "+t.type.name)}function Ss(t,e,n){let r=t.node(n);return hc(r,e.node(n)),r}function It(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function In(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(It(t.nodeAfter,r),s++));for(let l=s;l<o;l++)It(i.child(l),r);e&&e.depth==n&&e.textOffset&&It(e.nodeBefore,r)}function Pt(t,e){if(!t.type.validContent(e))throw new Jn("Invalid content for node "+t.type.name);return t.copy(e)}function pc(t,e,n,r,i){let s=t.depth>i&&Ss(t,e,i+1),o=r.depth>i&&Ss(n,r,i+1),l=[];return In(null,t,i,l),s&&o&&e.index(i)==n.index(i)?(hc(s,o),It(Pt(s,pc(t,e,n,r,i+1)),l)):(s&&It(Pt(s,$r(t,e,i+1)),l),In(e,n,i,l),o&&It(Pt(o,$r(n,r,i+1)),l)),In(r,null,i,l),new k(l)}function $r(t,e,n){let r=[];if(In(null,t,n,r),t.depth>n){let i=Ss(t,e,n+1);It(Pt(i,$r(t,e,n+1)),r)}return In(e,null,n,r),new k(r)}function ch(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(k.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Gn{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return $.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new zr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Gn(n,r,s)}static resolveCached(e,n){let r=ll.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else ll.set(e,r=new uh);let i=r.elts[r.i]=Gn.resolve(e,n);return r.i=(r.i+1)%dh,i}}class uh{constructor(){this.elts=[],this.i=0}}const dh=12,ll=new WeakMap;class zr{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const fh=Object.create(null);let Lt=class xs{constructor(e,n,r,i=$.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||k.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Lr(this.attrs,n||e.defaultAttrs||fh)&&$.sameSet(this.marks,r||$.none)}copy(e=null){return e==this.content?this:new xs(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new xs(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return M.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new M(c,i.depth-o,s.depth-o)}replace(e,n,r){return ah(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Gn.resolveCached(this,e)}resolveNoCache(e){return Gn.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),mc(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=k.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=$.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!$.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=k.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Lt.prototype.text=void 0;class Br extends Lt{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):mc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Br(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Br(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function mc(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class jt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new hh(e,n);if(r.next==null)return jt.empty;let i=gc(r);r.next&&r.err("Unexpected trailing text");let s=Sh(kh(i));return xh(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,l){let a=o.matchFragment(e,r);if(a&&(!n||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,l.concat(u));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
2
- `)}}jt.empty=new jt(!0);class hh{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function gc(t){let e=[];do e.push(ph(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ph(t){let e=[];do e.push(mh(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function mh(t){let e=bh(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=gh(t,e);else break;return e}function al(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function gh(t,e){let n=al(t),r=n;return t.eat(",")&&(t.next!="}"?r=al(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function yh(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function bh(t){if(t.eat("(")){let e=gc(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=yh(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function kh(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=n())}else if(o.type=="star"){let a=n();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=n();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=n();i(s(o.expr,a),u),a=u}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=n();r(a,u),i(s(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function yc(t,e){return e-t}function cl(t,e){let n=[];return r(e),n.sort(yc);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&n.indexOf(a)==-1&&r(a)}}}function Sh(t){let e=Object.create(null);return n(cl(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);cl(t,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new jt(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(yc);s.next.push({type:i[o][0],next:e[l.join(",")]||n(l)})}return s}}function xh(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function bc(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function kc(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Sc(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let i in t)t[i].validate&&t[i].validate(e[i])}function xc(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Mh(t,r,e[r]);return n}let ul=class Cc{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=xc(e,r.attrs),this.defaultAttrs=bc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==jt.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:kc(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Lt(this,this.computeAttrs(e),k.from(n),$.setFrom(r))}createChecked(e=null,n,r){return n=k.from(n),this.checkContent(n),new Lt(this,this.computeAttrs(e),n,$.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=k.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(k.empty,!0);return s?new Lt(this,e,n.append(s),$.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Sc(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 n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:$.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Cc(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Ch(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class Mh{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Ch(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class vi{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=xc(e,i.attrs),this.excluded=null;let s=bc(this.attrs);this.instance=s?new $(this,s):null}create(e=null){return!e&&this.instance?this.instance:new $(this,kc(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new vi(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Sc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Mc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=re.from(e.nodes),n.marks=re.from(e.marks||{}),this.nodes=ul.compile(this.spec.nodes,this),this.marks=vi.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=jt.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?dl(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:dl(this,o.split(" "))}this.nodeFromJSON=i=>Lt.fromJSON(this,i),this.markFromJSON=i=>$.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ul){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Br(r,r.defaultAttrs,e,$.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function dl(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let l in t.marks){let a=t.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Eh(t){return t.tag!=null}function Th(t){return t.style!=null}class Fe{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(Eh(i))this.tags.push(i);else if(Th(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new hl(this,n,!1);return r.addAll(e,$.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new hl(this,n,!0);return r.addAll(e,$.none,n.from,n.to),M.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Ah(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=pl(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=pl(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Fe(e,Fe.schemaRules(e)))}}const Ec={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},wh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Tc={ol:!0,ul:!0},Yn=1,Cs=2,Pn=4;function fl(t,e,n){return e!=null?(e?Yn:0)|(e==="full"?Cs:0):t&&t.whitespace=="pre"?Yn|Cs:n&~Pn}class yr{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=$.none,this.match=s||(o&Pn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(k.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Yn)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=k.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ec.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class hl{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=fl(null,n.preserveWhitespace,0)|(r?Pn:0);i?s=new yr(i.type,i.attrs,$.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new yr(null,null,$.none,!0,null,o):s=new yr(e.schema.topNodeType,null,$.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&Cs?"full":this.localPreserveWS||(i.options&Yn)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
3
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(o.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=i.content[i.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Tc.hasOwnProperty(o)&&this.parser.normalizeLists&&vh(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:wh.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Ec.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
- `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,s=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=$.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):ml(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=fl(e,s,o.options);o.options&Pn&&o.content.length==0&&(l|=Pn);let a=$.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):ml(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new yr(e,n,a,i,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Yn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function vh(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Tc.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Ah(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function pl(t){let e={};for(let n in t)e[n]=t[n];return e}function ml(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class et{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=br(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,n);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return br(n).createTextNode(e.text);let{dom:r,contentDOM:i}=Or(br(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Or(br(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:Or(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new et(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=gl(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return gl(e.marks)}}function gl(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function br(t){return t.document||window.document}const yl=new WeakMap;function Nh(t){let e=yl.get(t);return e===void 0&&yl.set(t,e=Oh(t)),e}function Oh(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Or(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=Nh(r))&&s.indexOf(e)>-1)throw new 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 l,a=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:p}=Or(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const wc=65535,vc=Math.pow(2,16);function Dh(t,e){return t+e*vc}function bl(t){return t&wc}function Rh(t){return(t-(t&wc))/vc}const Ac=1,Nc=2,Dr=4,Oc=8;class Ms{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Oc)>0}get deletedBefore(){return(this.delInfo&(Ac|Dr))>0}get deletedAfter(){return(this.delInfo&(Nc|Dr))>0}get deletedAcross(){return(this.delInfo&Dr)>0}}class xe{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&xe.empty)return xe.empty}recover(e){let n=0,r=bl(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Rh(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+i+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:Dh(l/3,e-a),g=e==a?Nc:e==d?Ac:Dr;return(n<0?e!=a:e!=d)&&(g|=Oc),new Ms(h,g,p)}i+=u-c}return r?e+i:new Ms(e+i,0,null)}touches(e,n){let r=0,i=bl(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+n],u=this.ranges[i+r];e(l,l+c,a,a+u),s+=u-c}}invert(){return new xe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?xe.empty:new xe(e<0?[0,-e,0]:[0,0,e])}}xe.empty=new xe([]);class Xn{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Xn(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Xn;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new Ms(e,i,null)}}const Ki=Object.create(null);class fe{getMap(){return xe.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ki[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ki)throw new RangeError("Duplicate use of step JSON ID "+e);return Ki[e]=n,n.prototype.jsonID=e,n}}class G{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new G(e,null)}static fail(e){return new G(null,e)}static fromReplace(e,n,r,i){try{return G.ok(e.replace(n,r,i))}catch(s){if(s instanceof Jn)return G.fail(s.message);throw s}}}function lo(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(lo(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return k.fromArray(r)}class dt extends fe{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new M(lo(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return G.fromReplace(e,this.from,this.to,s)}invert(){return new Re(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new dt(n.pos,r.pos,this.mark)}merge(e){return e instanceof dt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new dt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new dt(n.from,n.to,e.markFromJSON(n.mark))}}fe.jsonID("addMark",dt);class Re extends fe{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new M(lo(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return G.fromReplace(e,this.from,this.to,r)}invert(){return new dt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Re(n.pos,r.pos,this.mark)}merge(e){return e instanceof Re&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Re(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Re(n.from,n.to,e.markFromJSON(n.mark))}}fe.jsonID("removeMark",Re);class ft extends fe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return G.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return G.fromReplace(e,this.pos,this.pos+1,new M(k.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new ft(this.pos,n.marks[i]);return new ft(this.pos,this.mark)}}return new Wt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ft(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ft(n.pos,e.markFromJSON(n.mark))}}fe.jsonID("addNodeMark",ft);class Wt extends fe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return G.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return G.fromReplace(e,this.pos,this.pos+1,new M(k.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new ft(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Wt(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Wt(n.pos,e.markFromJSON(n.mark))}}fe.jsonID("removeNodeMark",Wt);class _ extends fe{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Es(e,this.from,this.to)?G.fail("Structure replace would overwrite content"):G.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new xe([this.from,this.to-this.from,this.slice.size])}invert(e){return new _(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&_.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new _(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof _)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new _(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new _(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new _(n.from,n.to,M.fromJSON(e,n.slice),!!n.structure)}}_.MAP_BIAS=1;fe.jsonID("replace",_);class te extends fe{constructor(e,n,r,i,s,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Es(e,this.from,this.gapFrom)||Es(e,this.gapTo,this.to)))return G.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return G.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?G.fromReplace(e,this.from,this.to,r):G.fail("Content does not fit in gap")}getMap(){return new xe([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new te(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new te(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new te(n.from,n.to,n.gapFrom,n.gapTo,M.fromJSON(e,n.slice),n.insert,!!n.structure)}}fe.jsonID("replaceAround",te);function Es(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Ih(t,e,n,r){let i=[],s=[],o,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=h:i.push(o=new Re(f,h,d[g])));l&&l.to==f?l.to=h:s.push(l=new dt(f,h,r))}}),i.forEach(a=>t.step(a)),s.forEach(a=>t.step(a))}function Ph(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof vi){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=s):i.push({style:d,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>t.step(new Re(o.from,o.to,o.style)))}function ao(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new _(l,u,M.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Re(l,u,c.marks[f]));if(i&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new M(k.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new _(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(k.empty,!0);t.replace(l,l,new M(a,0,0))}for(let a=o.length-1;a>=0;a--)t.step(o[a])}function Lh(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Sn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+i,a=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(l,a,n))return r;if(r==0||o.type.spec.isolating||!Lh(o,l,a))break;l&&(i=1),a<o.childCount&&(s=1)}return null}function $h(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,c=l,u=k.empty,d=0;for(let p=s,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=k.from(r.node(p).copy(u)),d++):a--;let f=k.empty,h=0;for(let p=s,g=!1;p>n;p--)g||i.after(p+1)<i.end(p)?(g=!0,f=k.from(i.node(p).copy(f)),h++):c++;t.step(new te(a,c,o,l,new M(u.append(f),d,h),u.size-d,!0))}function co(t,e,n=null,r=t){let i=zh(t,e),s=i&&Bh(r,e);return s?i.map(kl).concat({type:e,attrs:n}).concat(s.map(kl)):null}function kl(t){return{type:t,attrs:null}}function zh(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function Bh(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:o}function Fh(t,e,n){let r=k.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=k.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new te(i,s,i,s,new M(r,0,0),n.length,!0))}function Hh(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&Vh(t.doc,t.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Rc(t,o,l,s),ao(t,t.mapping.slice(s).map(l,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return t.step(new te(d,f,d+1,f-1,new M(k.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&Dc(t,o,l,s),!1}})}function Dc(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Rc(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
5
- `))}})}function Vh(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function jh(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new te(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new M(k.from(o),0,0),1,!0))}function Xe(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<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 c=i.depth-1,u=n-2;c>s;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Wh(t,e,n=1,r){let i=t.doc.resolve(e),s=k.empty,o=k.empty;for(let l=i.depth,a=i.depth-n,c=n-1;l>a;l--,c--){s=k.from(i.node(l).copy(s));let u=r&&r[c];o=k.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}t.step(new _(e,e,new M(s.append(o),n,n),!0))}function St(t,e){let n=t.resolve(e),r=n.index();return Ic(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Kh(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Ic(t,e){return!!(t&&e&&!t.isLeaf&&Kh(t,e))}function Ai(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Ic(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Uh(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Rc(t,u.node(),u.before(),l)}o.inlineContent&&ao(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new _(c,a.map(e+n,-1),M.empty,!0)),r===!0){let u=t.doc.resolve(c);Dc(t,u.node(),u.before(),t.steps.length)}return t}function _h(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function uo(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(a,a,i);else{let d=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Ni(t,e,n=e,r=M.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return Pc(i,s,r)?new _(e,n,r):new qh(i,s,r).fit()}function Pc(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class qh{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=k.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=k.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new M(s,o,l);return e>-1?new te(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new _(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Ui(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(k.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ui(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new M(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ui(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new M(wn(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new M(wn(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));d=d.matchFragment(i)}let h=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let g=l.child(c),m=d.matchType(g.type);if(!m)break;c++,(c>1||a==0||g.content.size)&&(d=m,u.push(Lc(g.mark(f.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=vn(this.placed,n,k.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=l;g<h;g++){let y=m.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),m=y.content}this.unplaced=p?e==0?M.empty:new M(wn(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new M(wn(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!_i(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=_i(e,n,i,r,s);if(o){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=_i(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=vn(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=vn(this.placed,this.depth,k.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(k.empty,!0);n.childCount&&(this.placed=vn(this.placed,this.frontier.length,n))}}function wn(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(wn(t.firstChild.content,e-1,n)))}function vn(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(vn(t.lastChild.content,e-1,n)))}function Ui(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Lc(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Lc(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(k.empty,!0)))),t.copy(r)}function _i(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!Jh(n,s.content,o)?l:null}function Jh(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Gh(t){return t.spec.defining||t.spec.definingForContent}function Yh(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(Pc(i,s,r))return t.step(new _(e,n,r));let o=zc(i,s);o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:i.before(f)==h&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=Gh(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let g=0;g<o.length;g++){let m=o[(g+a)%o.length],y=!0;m<0&&(y=!1,m=-m);let b=i.node(m-1),S=i.index(m-1);if(b.canReplaceWith(S,S,p.type,p.marks))return t.replace(i.before(m),y?s.after(m):n,new M($c(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),n=s.after(h))}}function $c(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy($c(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(k.empty,!0))}return t}function Xh(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=_h(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new M(k.from(r),0,0))}function Qh(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),l=!1;for(let a=r.depth;a>o;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=i.depth;a>o;a--)i.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=i.depth;a>0&&n==i.start(a);a--)n=i.before(a);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=zc(r,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function zc(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class cn extends fe{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return G.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return G.fromReplace(e,this.pos,this.pos+1,new M(k.from(i),0,n.isLeaf?0:1))}getMap(){return xe.empty}invert(e){return new cn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new cn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new cn(n.pos,n.attr,n.value)}}fe.jsonID("attr",cn);class Qn extends fe{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return G.ok(r)}getMap(){return xe.empty}invert(e){return new Qn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Qn(n.attr,n.value)}}fe.jsonID("docAttr",Qn);let fn=class extends Error{};fn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};fn.prototype=Object.create(Error.prototype);fn.prototype.constructor=fn;fn.prototype.name="TransformError";class Bc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Xn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new fn(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=M.empty){let i=Ni(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new M(k.from(r),0,0))}delete(e,n){return this.replace(e,n,M.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Yh(this,e,n,r),this}replaceRangeWith(e,n,r){return Xh(this,e,n,r),this}deleteRange(e,n){return Qh(this,e,n),this}lift(e,n){return $h(this,e,n),this}join(e,n=1){return Uh(this,e,n),this}wrap(e,n){return Fh(this,e,n),this}setBlockType(e,n=e,r,i=null){return Hh(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return jh(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new cn(e,n,r)),this}setDocAttribute(e,n){return this.step(new Qn(e,n)),this}addNodeMark(e,n){return this.step(new ft(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof $)n.isInSet(r.marks)&&this.step(new Wt(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new Wt(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return Wh(this,e,n,r),this}addMark(e,n,r){return Ih(this,e,n,r),this}removeMark(e,n,r){return Ph(this,e,n,r),this}clearIncompatible(e,n,r){return ao(this,e,n,r),this}}const qi=Object.create(null);class O{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Zh(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=M.empty){let r=n.content.lastChild,i=null;for(let l=0;l<n.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(s);e.replaceRange(u.map(a.pos),u.map(c.pos),l?M.empty:n),l==0&&Cl(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(r),c=a.map(o.pos),u=a.map(l.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Cl(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new T(e):tn(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?tn(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):tn(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ke(e.node(0))}static atStart(e){return tn(e,e,0,0,1)||new ke(e)}static atEnd(e){return tn(e,e,e.content.size,e.childCount,-1)||new ke(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=qi[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in qi)throw new RangeError("Duplicate use of selection JSON ID "+e);return qi[e]=n,n.prototype.jsonID=e,n}getBookmark(){return T.between(this.$anchor,this.$head).getBookmark()}}O.prototype.visible=!0;class Zh{constructor(e,n){this.$from=e,this.$to=n}}let Sl=!1;function xl(t){!Sl&&!t.parent.inlineContent&&(Sl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class T extends O{constructor(e,n=e){xl(e),xl(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return O.near(r);let i=e.resolve(n.map(this.anchor));return new T(i.parent.inlineContent?i:r,r)}replace(e,n=M.empty){if(super.replace(e,n),n==M.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof T&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Oi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new T(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=O.findFrom(n,r,!0)||O.findFrom(n,-r,!0);if(s)n=s.$head;else return O.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(O.findFrom(e,-r,!0)||O.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new T(e,n)}}O.jsonID("text",T);class Oi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Oi(e.map(this.anchor),e.map(this.head))}resolve(e){return T.between(e.resolve(this.anchor),e.resolve(this.head))}}class E extends O{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?O.near(s):new E(s)}content(){return new M(k.from(this.node),0,0)}eq(e){return e instanceof E&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new fo(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new E(e.resolve(n.anchor))}static create(e,n){return new E(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}E.prototype.visible=!1;O.jsonID("node",E);class fo{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Oi(r,r):new fo(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&E.isSelectable(r)?new E(n):O.near(n)}}class ke extends O{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=M.empty){if(n==M.empty){e.delete(0,e.doc.content.size);let r=O.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ke(e)}map(e){return new ke(e)}eq(e){return e instanceof ke}getBookmark(){return ep}}O.jsonID("all",ke);const ep={map(){return this},resolve(t){return new ke(t)}};function tn(t,e,n,r,i,s=!1){if(e.inlineContent)return T.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&E.isSelectable(l))return E.create(t,n-(i<0?l.nodeSize:0))}else{let a=tn(t,l,n+i,i<0?l.childCount:0,i,s);if(a)return a}n+=l.nodeSize*i}return null}function Cl(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof _||i instanceof te))return;let s=t.mapping.maps[r],o;s.forEach((l,a,c,u)=>{o==null&&(o=u)}),t.setSelection(O.near(t.doc.resolve(o),n))}const Ml=1,kr=2,El=4;class tp extends Bc{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Ml)&~kr,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ml)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=kr,this}ensureMarks(e){return $.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&kr)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~kr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||$.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(O.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=El,this}get scrolledIntoView(){return(this.updated&El)>0}}function Tl(t,e){return!e||!t?t:t.bind(e)}class An{constructor(e,n,r){this.name=e,this.init=Tl(n.init,r),this.apply=Tl(n.apply,r)}}const np=[new An("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new An("selection",{init(t,e){return t.selection||O.atStart(e.doc)},apply(t){return t.selection}}),new An("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new An("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ji{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=np.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new An(r.key,r.spec.state,r))})}}class At{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,c=i?i[o].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new At(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new tp(this)}static create(e){let n=new Ji(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new At(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Ji(this.schema,e.plugins),r=n.fields,i=new At(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ji(e.schema,e.plugins),s=new At(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Lt.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=O.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[o.name]=c.fromJSON.call(a,e,n[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Fc(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Fc(i,e,{})),n[r]=i}return n}class F{constructor(e){this.spec=e,this.props={},e.props&&Fc(e.props,this,this.props),this.key=e.key?e.key.key:Hc("plugin")}getState(e){return e[this.key]}}const Gi=Object.create(null);function Hc(t){return t in Gi?t+"$"+ ++Gi[t]:(Gi[t]=0,t+"$")}class X{constructor(e="key"){this.key=Hc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Vc=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function jc(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Wc=(t,e,n)=>{let r=jc(t,n);if(!r)return!1;let i=ho(r);if(!i){let o=r.blockRange(),l=o&&Sn(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(Qc(t,i,e,-1))return!0;if(r.parent.content.size==0&&(hn(s,"end")||E.isSelectable(s)))for(let o=r.depth;;o--){let l=Ni(t.doc,r.before(o),r.after(o),M.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(hn(s,"end")?O.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):E.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},rp=(t,e,n)=>{let r=jc(t,n);if(!r)return!1;let i=ho(r);return i?Kc(t,i,e):!1},ip=(t,e,n)=>{let r=_c(t,n);if(!r)return!1;let i=po(r);return i?Kc(t,i,e):!1};function Kc(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Ni(t.doc,s,a,M.empty);if(!c||c.from!=s||c instanceof _&&c.slice.size>=a-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(T.create(u.doc,s)),n(u.scrollIntoView())}return!0}function hn(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Uc=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=ho(r)}let o=s&&s.nodeBefore;return!o||!E.isSelectable(o)?!1:(e&&e(t.tr.setSelection(E.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function ho(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function _c(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const qc=(t,e,n)=>{let r=_c(t,n);if(!r)return!1;let i=po(r);if(!i)return!1;let s=i.nodeAfter;if(Qc(t,i,e,1))return!0;if(r.parent.content.size==0&&(hn(s,"start")||E.isSelectable(s))){let o=Ni(t.doc,r.before(),r.after(),M.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(hn(s,"start")?O.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):E.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Jc=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=po(r)}let o=s&&s.nodeAfter;return!o||!E.isSelectable(o)?!1:(e&&e(t.tr.setSelection(E.create(t.doc,s.pos)).scrollIntoView()),!0)};function po(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const sp=(t,e)=>{let n=t.selection,r=n instanceof E,i;if(r){if(n.node.isTextblock||!St(t.doc,n.from))return!1;i=n.from}else if(i=Ai(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(E.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},op=(t,e)=>{let n=t.selection,r;if(n instanceof E){if(n.node.isTextblock||!St(t.doc,n.to))return!1;r=n.to}else if(r=Ai(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},lp=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Sn(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},Gc=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
6
- `).scrollIntoView()),!0)};function mo(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const ap=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=mo(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,o.createAndFill());a.setSelection(O.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Yc=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof ke||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=mo(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=t.tr.insert(o,s.createAndFill());l.setSelection(T.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Xc=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(Xe(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Sn(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function cp(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof E&&e.selection.node.isBlock)return!r.parentOffset||!Xe(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=mo(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(a&&l?{type:l}:null),o=h;break}else{if(h==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof T||e.selection instanceof ke)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Xe(u.doc,d,s.length,s);if(f||(s[0]=l?{type:l}:null,f=Xe(u.doc,d,s.length,s)),!f)return!1;if(u.split(d,s.length,s),!a&&c&&r.node(o).type!=l){let h=u.mapping.map(r.before(o)),p=u.doc.resolve(h);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(o)),l)}return n&&n(u.scrollIntoView()),!0}}const up=cp(),dp=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(E.create(t.doc,i))),!0)};function fp(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||St(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Qc(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&fp(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=k.empty;for(let y=o.length-1;y>=0;y--)p=k.from(o[y].create(null,p));p=k.from(i.copy(p));let g=t.tr.step(new te(e.pos-1,h,e.pos,h,new M(p,1,0),o.length,!0)),m=g.doc.resolve(h+2*o.length);m.nodeAfter&&m.nodeAfter.type==i.type&&St(g.doc,m.pos)&&g.join(m.pos),n(g.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&a?null:O.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Sn(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&hn(s,"start",!0)&&hn(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=s,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=k.empty;for(let S=p.length-1;S>=0;S--)y=k.from(p[S].copy(y));let b=t.tr.step(new te(e.pos-p.length,e.pos+s.nodeSize,e.pos+m,e.pos+s.nodeSize-m,new M(y,p.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function Zc(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(T.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const hp=Zc(-1),pp=Zc(1);function mp(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),l=o&&co(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function wl(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(o,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)i=!0;else{let u=n.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[o];s.setBlockType(l,a,t,e)}r(s.scrollIntoView())}return!0}}function go(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}go(Vc,Wc,Uc);go(Vc,qc,Jc);go(Gc,Yc,Xc,up);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function gp(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let l=r?n.tr:null;return yp(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function yp(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);s=new zr(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new zr(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=co(s,n,r,e);return l?(t&&bp(t,e,l,i,n),!0):!1}function bp(t,e,n,r,i){let s=k.empty;for(let u=n.length-1;u>=0;u--)s=k.from(n[u].type.create(n[u].attrs,s));t.step(new te(e.start-(r?2:0),e.end,e.start,e.end,new M(s,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==i&&(o=u+1);let l=n.length-o,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Xe(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function kp(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?Sp(e,n,t,s):xp(e,n,s):!0:!1}}function Sp(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new te(s-1,o,s,o,new M(k.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new zr(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=Sn(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return St(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function xp(t,e,n){let r=t.tr,i=n.parent;for(let h=n.end,p=n.endIndex-1,g=n.startIndex;p>g;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,o.content.append(a?k.empty:k.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new te(d-(l?1:0),f+(a?1:0),d+1,f-1,new M((l?k.empty:k.from(i.copy(k.empty))).append(a?k.empty:k.from(i.copy(k.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Cp(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=k.from(c?t.create():null),d=new M(k.from(t.create(null,k.from(l.type.create(null,u)))),c?3:1,0),f=s.start,h=s.end;n(e.tr.step(new te(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const ie=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},pn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Ts=null;const qe=function(t,e,n){let r=Ts||(Ts=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Mp=function(){Ts=null},Kt=function(t,e,n,r){return n&&(vl(t,e,n,r,-1)||vl(t,e,n,r,1))},Ep=/^(img|br|input|textarea|hr)$/i;function vl(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:ve(t))){let o=t.parentNode;if(!o||o.nodeType!=1||lr(t)||Ep.test(t.nodeName)||t.contentEditable=="false")return!1;e=ie(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?ve(t):0}else return!1}}function ve(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Tp(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=ve(t)}else if(t.parentNode&&!lr(t))e=ie(t),t=t.parentNode;else return null}}function wp(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!lr(t))e=ie(t)+1,t=t.parentNode;else return null}}function vp(t,e,n){for(let r=e==0,i=e==ve(t);r||i;){if(t==n)return!0;let s=ie(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==ve(t)}}function lr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Di=function(t){return t.focusNode&&Kt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function wt(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Ap(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Np(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(ve(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(ve(r.startContainer),r.startOffset)}}}const He=typeof navigator<"u"?navigator:null,Al=typeof document<"u"?document:null,xt=He&&He.userAgent||"",ws=/Edge\/(\d+)/.exec(xt),eu=/MSIE \d/.exec(xt),vs=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(xt),Se=!!(eu||vs||ws),pt=eu?document.documentMode:vs?+vs[1]:ws?+ws[1]:0,Ae=!Se&&/gecko\/(\d+)/i.test(xt);Ae&&+(/Firefox\/(\d+)/.exec(xt)||[0,0])[1];const As=!Se&&/Chrome\/(\d+)/.exec(xt),oe=!!As,tu=As?+As[1]:0,de=!Se&&!!He&&/Apple Computer/.test(He.vendor),mn=de&&(/Mobile\/\w+/.test(xt)||!!He&&He.maxTouchPoints>2),Te=mn||(He?/Mac/.test(He.platform):!1),nu=He?/Win/.test(He.platform):!1,Je=/Android \d/.test(xt),ar=!!Al&&"webkitFontSmoothing"in Al.documentElement.style,Op=ar?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Dp(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function je(t,e){return typeof t=="number"?t:t[e]}function Rp(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Nl(t,e,n){if(!Ns(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=pn(o);continue}let l=o,a=l==s.body,c=a?Dp(s):Rp(l),u=0,d=0;if(e.top<c.top+je(r,"top")?d=-(c.top-e.top+je(i,"top")):e.bottom>c.bottom-je(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+je(i,"top")-c.top:e.bottom-c.bottom+je(i,"bottom")),e.left<c.left+je(r,"left")?u=-(c.left-e.left+je(i,"left")):e.right>c.right-je(r,"right")&&(u=e.right-c.right+je(i,"right")),u||d)if(a)s.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let g=l.scrollLeft-h,m=l.scrollTop-p;e={left:e.left-g,top:e.top-m,right:e.right-g,bottom:e.bottom-m}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:pn(o)}}function Ip(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(s,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:ru(t.dom)}}function ru(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=pn(r));return e}function Pp({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;iu(n,r==0?0:r-e)}function iu(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Xt=null;function Lp(t){if(t.setActive)return t.setActive();if(Xt)return t.focus(Xt);let e=ru(t);t.focus(Xt==null?{get preventScroll(){return Xt={preventScroll:!0},!0}}:void 0),Xt||(Xt=!1,iu(e,0))}function su(t,e){let n,r=2e8,i,s=0,o=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=qe(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){n=u,r=g,i=g&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&g&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&a&&(n=a,i=c,r=0),n&&n.nodeType==3?$p(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:su(n,i)}function $p(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=st(r,1);if(o.top!=o.bottom&&yo(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function yo(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function zp(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Bp(t,e,n){let{node:r,offset:i}=su(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function Fp(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),o=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function ou(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(yo(e,c))return ou(o,e,c)}}if((s=(s+1)%r)==i)break}return t}function Hp(t,e){let n=t.dom.ownerDocument,r,i=0,s=Np(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!yo(e,c)||(o=ou(t.dom,e,c),!o))return null}if(de)for(let c=o;r&&c;c=pn(c))c.draggable&&(r=void 0);if(o=zp(o,e),r){if(Ae&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;ar&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Fp(t,r,i,e))}l==null&&(l=Bp(t,o,e));let a=t.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ns(t){return t.top<t.bottom||t.left<t.right}function st(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Ns(r))return r}return Array.prototype.find.call(n,Ns)||t.getBoundingClientRect()}const Vp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function lu(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=ar||Ae;if(r.nodeType==3)if(o&&(Vp.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=st(qe(r,i,i),n);if(Ae&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=st(qe(r,i-1,i-1),-1);if(c.top==a.top){let u=st(qe(r,i,i+1),-1);if(u.top!=a.top)return xn(u,u.left<c.left)}}return a}else{let a=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(a--,u=1):n<0?a--:c++,xn(st(qe(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==ve(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Yi(a.getBoundingClientRect(),!1)}if(s==null&&i<ve(r)){let a=r.childNodes[i];if(a.nodeType==1)return Yi(a.getBoundingClientRect(),!0)}return Yi(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==ve(r))){let a=r.childNodes[i-1],c=a.nodeType==3?qe(a,ve(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return xn(st(c,1),!1)}if(s==null&&i<ve(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?qe(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return xn(st(c,-1),!0)}return xn(st(r.nodeType==3?qe(r):r,-n),n>=0)}function xn(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Yi(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function au(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function jp(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return au(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=lu(t,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=qe(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const Wp=/[\u0590-\u08ac]/;function Kp(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=t.domSelection();return l?!Wp.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:o:au(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),m=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==g;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),m}):r.pos==r.start()||r.pos==r.end()}let Ol=null,Dl=null,Rl=!1;function Up(t,e,n){return Ol==e&&Dl==n?Rl:(Ol=e,Dl=n,Rl=n=="up"||n=="down"?jp(t,e,n):Kp(t,e,n))}const Ne=0,Il=1,Nt=2,Ie=3;class cr{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Ne,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>ie(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let l=i.children[o];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e||o instanceof uu){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof cu&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?ie(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?ie(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,l=0;;l++){let a=this.children[l],c=o+a.size;if(i==-1&&e<=c){let u=o+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=o;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=ie(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=ie(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let g=this.children[h],m=p+g.size;if(s>p&&o<m)return g.setSelection(e-p-g.border,n-p-g.border,r,i);p=m}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Ae||de)&&e==n){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
7
- `),d&&p==h.nodeValue.length)for(let g=h,m;g;g=g.parentNode){if(m=g.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:ie(m)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=h.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Ae&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&de)&&Kt(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Kt(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Ae)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+s.border,a=o-s.border;if(e>=l&&n<=a){this.dirty=e==r||n==o?Nt:Il,e==l&&n==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ie:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Nt:Ie}r=o}this.dirty=Nt}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Nt:Il;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class cu extends cr{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.hasAttribute("contenteditable")||(o.contentEditable="false"),o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Ne&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class _p extends cr{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class mt extends cr{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=et.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new mt(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ie||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ie&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ne){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ne}}slice(e,n,r){let i=mt.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=Ds(s,n,o,r)),e>0&&(s=Ds(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class gt extends cr{constructor(e,n,r,i,s,o,l){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,n,r,i,s,o){let l=s.nodeViews[n.type.name],a,c=l&&l(n,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=et.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=hu(u,r,n),c?a=new qp(e,n,r,i,u,d||null,f,c):n.isText?new Ri(e,n,r,i,u,f):new gt(e,n,r,i,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let i=this.children[r];if(this.dom.contains(i.dom.parentNode)){n.contentElement=i.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(i=>i.nodeType==1&&e.indexOf(i.parentNode)<0&&this.dom.contains(i));r?n.contentElement=r:n.getContent=()=>k.empty}}return n}matchesNode(e,n,r){return this.dirty==Ne&&e.eq(this.node)&&Fr(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new Gp(this,o&&o.node,e);Qp(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?$.none:this.node.child(u).marks,r,e,u),a.placeWidget(c,e,i)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e,f);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,i)||a.addNode(c,u,d,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Nt)&&(o&&this.protectLocalComposition(e,o),du(this.contentDOM,this.children,e),mn&&Zp(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof T)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=em(this.node.content,o,r-n,i-n);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new _p(this,s,n,i);e.input.compositionNodes.push(o),this.children=Ds(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Ie||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Ne}updateOuterDeco(e){if(Fr(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=fu(this.dom,this.nodeDOM,Os(this.outerDeco,this.node,n),Os(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.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 Pl(t,e,n,r,i){hu(r,e,t);let s=new gt(void 0,t,e,n,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class Ri extends gt{constructor(e,n,r,i,s,o){super(e,n,r,i,s,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Ie||this.dirty!=Ne&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ne||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Ne,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Ri(this.parent,i,this.outerDeco,this.innerDeco,s,s)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ie)}get domAtom(){return!1}isText(e){return this.node.text==e}}class uu extends cr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ne&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class qp extends gt{constructor(e,n,r,i,s,o,l,a){super(e,n,r,i,s,o,l),this.spec=a}update(e,n,r,i){if(this.dirty==Ie)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}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 du(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=Ll(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(o instanceof mt){let a=r?r.previousSibling:t.lastChild;du(o.contentDOM,o.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Ll(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Ln=function(t){t&&(this.nodeName=t)};Ln.prototype=Object.create(null);const Ot=[new Ln];function Os(t,e,n){if(t.length==0)return Ot;let r=n?Ot[0]:new Ln,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Ln(o.nodeName));for(let l in o){let a=o[l];a!=null&&(n&&i.length==1&&i.push(r=new Ln(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function fu(t,e,n,r){if(n==Ot&&r==Ot)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=n[s];if(s){let a;l&&l.nodeName==o.nodeName&&i!=t&&(a=i.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=Ot[0]),i=a}Jp(i,l||Ot[0],o)}return i}function Jp(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function hu(t,e,n){return fu(t,t,Ot,Os(e,n,t.nodeType!=1))}function Fr(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Ll(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Gp{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Yp(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;s<l&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Ne,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){a=u;break}}if(a<0&&this.index<this.top.children.length){let u=this.top.children[this.index];u instanceof mt&&u.dirty!=Ie&&u.mark.type==e[o].type&&u.spec.update&&!this.isLocked(u.dom)&&u.spec.update(e[o])&&(u.mark=e[o],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=mt.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==Ie&&o.dom==o.contentDOM&&(o.dirty=Nt),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof gt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Ie&&Fr(n,a.outerDeco));if(!f&&a.update(e,n,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Nt,d.updateChildren(i,o+1),d.dirty=Ne),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Fr(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=gt.create(this.top,n,r,i,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,i,s){let o=gt.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new cu(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof mt;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ri)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((de||oe)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new uu(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Yp(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof mt)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function Xp(t,e){return t.type.side-e.type.side}function Qp(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let u,d;for(;o<i.length&&i[o].to==s;){let m=i[o++];m.widget&&(u?(d||(d=[u])).push(m):u=m)}if(u)if(d){d.sort(Xp);for(let m=0;m<d.length;m++)n(d[m],c,!!a)}else n(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let m=0;m<l.length;m++)l[m].to<=s&&l.splice(m--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let m=p;o<i.length&&i[o].from<m&&(m=i[o].from);for(let y=0;y<l.length;y++)l[y].to<m&&(m=l[y].to);m<p&&(a=f.cut(m-s),f=f.cut(0,m-s),p=m,h=-1)}else for(;o<i.length&&i[o].to<p;)o++;let g=f.isInline&&!f.isLeaf?l.filter(m=>!m.inline):l.slice();r(f,g,e.forChild(s,f),h),s=p}}function Zp(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function em(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=n){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Ds(t,e,n,r,i){let s=[];for(let o=0,l=0;o<t.length;o++){let a=t[o],c=l,u=l+=a.size;c>=n||u<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,r)),i&&(s.push(i),i=void 0),u>n&&s.push(a.slice(n-c,a.size,r)))}return s}function bo(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Di(n)){for(a=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&E.isSelectable(d)&&i.parent&&!(d.isInline&&vp(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new E(o==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,o]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;c=ko(t,u,l,d)}return c}function pu(t){return t.editable?t.hasFocus():gu(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Qe(t,e=!1){let n=t.state.selection;if(mu(t,n),!pu(t))return;let r=t.input.mouseDown;if(!e&&oe&&r){let i=t.domSelectionRange(),s=t.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&Kt(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)nm(t);else{let{anchor:i,head:s}=n,o,l;$l&&!(n instanceof T)&&(n.$from.parent.inlineContent||(o=zl(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=zl(t,n.to))),t.docView.setSelection(i,s,t,e),$l&&(o&&Bl(o),l&&Bl(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&tm(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const $l=de||oe&&tu<63;function zl(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(de&&i&&i.contentEditable=="false")return Xi(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Xi(i);if(s)return Xi(s)}}function Xi(t){return t.contentEditable="true",de&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Bl(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function tm(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!pu(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function nm(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ie(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Se&&pt<=11&&(n.disabled=!0,n.disabled=!1)}function mu(t,e){if(e instanceof E){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Fl(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Fl(t)}function Fl(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ko(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||T.between(e,n,r)}function Hl(t){return t.editable&&!t.hasFocus()?!1:gu(t)}function gu(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function rm(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Kt(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Rs(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&O.findFrom(s,e)}function lt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Vl(t,e,n){let r=t.state.selection;if(r instanceof T)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return lt(t,new T(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Rs(t.state,e);return i&&i instanceof E?lt(t,i):!1}else if(!(Te&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?E.isSelectable(s)?lt(t,new E(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):ar?lt(t,new T(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof E&&r.node.isInline)return lt(t,new T(e>0?r.$to:r.$from));{let i=Rs(t.state,e);return i?lt(t,i):!1}}}function Hr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $n(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Qt(t,e){return e<0?im(t):sm(t)}function im(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Ae&&n.nodeType==1&&r<Hr(n)&&$n(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if($n(l,-1))i=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(yu(n))break;{let l=n.previousSibling;for(;l&&$n(l,-1);)i=n.parentNode,s=ie(l),l=l.previousSibling;if(l)n=l,r=Hr(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Is(t,n,r):i&&Is(t,i,s)}function sm(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Hr(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if($n(l,1))s=n,o=++r;else break}else{if(yu(n))break;{let l=n.nextSibling;for(;l&&$n(l,1);)s=l.parentNode,o=ie(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=Hr(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Is(t,s,o)}function yu(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function om(t,e){for(;t&&e==t.childNodes.length&&!lr(t);)e=ie(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function lm(t,e){for(;t&&!e&&!lr(t);)e=ie(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Is(t,e,n){if(e.nodeType!=3){let s,o;(o=om(e,n))?(e=o,n=0):(s=lm(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Di(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Qe(t)},50)}function jl(t,e){let n=t.state.doc.resolve(e);if(!(oe||nu)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Wl(t,e,n){let r=t.state.selection;if(r instanceof T&&!r.empty||n.indexOf("s")>-1||Te&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Rs(t.state,e);if(o&&o instanceof E)return lt(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof ke?O.near(o,e):O.findFrom(o,e);return l?lt(t,l):!1}return!1}function Kl(t,e){if(!(t.state.selection instanceof T))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Ul(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function am(t){if(!de||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Ul(t,r,"true"),setTimeout(()=>Ul(t,r,"false"),20)}return!1}function cm(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function um(t,e){let n=e.keyCode,r=cm(e);if(n==8||Te&&n==72&&r=="c")return Kl(t,-1)||Qt(t,-1);if(n==46&&!e.shiftKey||Te&&n==68&&r=="c")return Kl(t,1)||Qt(t,1);if(n==13||n==27)return!0;if(n==37||Te&&n==66&&r=="c"){let i=n==37?jl(t,t.state.selection.from)=="ltr"?-1:1:-1;return Vl(t,i,r)||Qt(t,i)}else if(n==39||Te&&n==70&&r=="c"){let i=n==39?jl(t,t.state.selection.from)=="ltr"?1:-1:1;return Vl(t,i,r)||Qt(t,i)}else{if(n==38||Te&&n==80&&r=="c")return Wl(t,-1,r)||Qt(t,-1);if(n==40||Te&&n==78&&r=="c")return am(t)||Wl(t,1,r)||Qt(t,1);if(r==(Te?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function So(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||et.fromSchema(t.state.schema),l=Mu(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Cu[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
8
-
9
- `);return{dom:a,text:f,slice:e}}function bu(t,e,n,r,i){let s=i.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||s||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return l=new M(k.from(t.state.schema.text(e.replace(/\r\n?/g,`
10
- `))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)l=d;else{let f=i.marks(),{schema:h}=t.state,p=et.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=pm(n),ar&&mm(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Fe.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!dm.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=gm(_l(l,+u[1],+u[2]),u[4]);else if(l=M.maxOpen(fm(l.content,i),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=_l(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const dm=/^(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 fm(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&Su(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=xu(o[o.length-1],s.length));let u=ku(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return k.from(o)}return t}function ku(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,k.from(t));return t}function Su(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Su(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(k.from(ku(n,t,i+1))))}}function xu(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,xu(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(k.empty,!0);return t.copy(n.append(r))}function Ps(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(s=0),i<r-1&&(l=Ps(l,e,n,r,i+1,s)),i>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(k.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function _l(t,e,n){return e<t.openStart&&(t=new M(Ps(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new M(Ps(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Cu={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function Mu(){return document.implementation.createHTMLDocument("title")}let Cn=null;function hm(t){let e=window.trustedTypes;if(!e)return t;if(!Cn){if(Cn=e.defaultPolicy)try{return Cn.createHTML(t)}catch{}Cn=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Cn.createHTML(t)}function pm(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Mu(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(t),s;if((s=i&&Cu[i[1].toLowerCase()])&&(t=s.map(o=>"<"+o+">").join("")+t+s.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=hm(t),s)for(let o=0;o<s.length;o++)r=r.querySelector(s[o])||r;for(let o=0;o<n.styleSheets.length;o++){let l=n.styleSheets[o];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let u=r.querySelectorAll(c.selectorText);for(let d=0;d<u.length;d++)u[d].style.cssText+=c.style.cssText}}}return r}function mm(t){let e=t.querySelectorAll(oe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function gm(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;try{a.checkAttrs(r[l+1])}catch{break}i=k.from(a.create(r[l+1],i)),s++,o++}return new M(i,s,o)}const me={},ge={},ym={touchstart:!0,touchmove:!0};class bm{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 km(t){for(let e in me){let n=me[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{xm(t,r)&&!xo(t,r)&&(t.editable||!(r.type in ge))&&n(t,r)},ym[e]?{passive:!0}:void 0)}de&&t.dom.addEventListener("input",()=>null),Ls(t)}function Ge(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Sm(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ls(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>xo(t,r))})}function xo(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function xm(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Cm(t,e){!xo(t,e)&&me[e.type]&&(t.editable||!(e.type in ge))&&me[e.type](t,e)}ge.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!vu(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Je&&oe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),mn&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,wt(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||um(t,n)?n.preventDefault():Ge(t,"key")};ge.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ge.keypress=(t,e)=>{let n=e;if(vu(t)||!n.charCode||n.ctrlKey&&!n.altKey||Te&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof T)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function ur(t){return{left:t.clientX,top:t.clientY}}function Mm(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Co(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,l=>o>s.depth?l(t,n,s.nodeAfter,s.before(o),i,!0):l(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function dr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Em(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&E.isSelectable(r)?(dr(t,new E(n)),!0):!1}function Tm(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof E&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(E.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(dr(t,E.create(t.state.doc,i)),!0):!1}function wm(t,e,n,r,i){return Co(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?Tm(t,n):Em(t,n))}function vm(t,e,n,r){return Co(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Am(t,e,n,r){return Co(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Nm(t,n,r)}function Nm(t,e,n){if(n.button!=0)return!1;let r=Eu(t,e,!0),i=t.state.doc;return r?(dr(t,r),r instanceof T&&i.eq(t.state.doc)&&(t.input.mouseDown=new Dm(t,r)),!0):!1}function Eu(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?T.create(r,0,r.content.size):null;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)return T.create(r,l+1,l+1+o.content.size);if(n&&E.isSelectable(o))return E.create(r,l)}return null}function Mo(t){return Vr(t)}const Tu=Te?"metaKey":"ctrlKey";me.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Mo(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&Mm(n,t.input.lastClick)&&!n[Tu]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let o=t.posAtCoords(ur(n));o&&(s=="singleClick"?t.input.mouseDown=new Om(t,o,n,!!r):(s=="doubleClick"?vm:Am)(t,o.pos,o.inside,n)?n.preventDefault():Ge(t,"pointer"))};let wu=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}};class Om extends wu{constructor(e,n,r,i){super(e),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[Tu],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof E&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ae&&!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()),Ge(e,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||Qe(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(ur(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ge(this.view,"pointer"):wm(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||de&&this.mightDrag&&!this.mightDrag.node.isAtom||oe&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(dr(this.view,O.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ge(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ge(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class Dm extends wu{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),Ge(this.view,"pointer");let n=this.view.posAtCoords(ur(e)),r=n&&Eu(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[o,l]=r.from<s.from?[s.to,r.from]:[s.from,r.to];dr(this.view,T.create(i,o,l))}}me.touchstart=t=>{t.input.lastTouch=Date.now(),Mo(t),Ge(t,"pointer")};me.touchmove=t=>{t.input.lastTouch=Date.now(),Ge(t,"pointer")};me.contextmenu=t=>Mo(t);function vu(t,e){return t.composing?!0:de&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Rm=Je?5e3:-1;ge.compositionstart=ge.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof T&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||oe&&nu&&Im(t)))t.markCursor=t.state.storedMarks||n.marks(),Vr(t,!0),t.markCursor=null;else if(Vr(t,!e.selection.empty),Ae&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}Au(t,Rm)};function Im(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}ge.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Au(t,20))};function Au(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Vr(t),e))}function Nu(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Pm(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Tp(e.focusNode,e.focusOffset),r=wp(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Vr(t,e=!1){if(!(Je&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Nu(t),e||t.docView&&t.docView.dirty){let n=bo(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Lm(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Zn=Se&&pt<15||mn&&Op<604;me.copy=ge.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Zn?null:n.clipboardData,o=r.content(),{dom:l,text:a}=So(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Lm(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function $m(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function zm(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?er(t,r.value,null,i,e):er(t,r.textContent,r.innerHTML,i,e)},50)}function er(t,e,n,r,i){let s=bu(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,s||M.empty)))return!0;if(!s)return!1;let o=$m(s),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ou(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ge.paste=(t,e)=>{let n=e;if(t.composing&&!Je)return;let r=Zn?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&er(t,Ou(r),r.getData("text/html"),i,n)?n.preventDefault():zm(t,n)};let Du=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const Bm=Te?"altKey":"ctrlKey";function Ru(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[Bm]}me.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(ur(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof E?i.to-1:i.to))){if(r&&r.mightDrag)o=E.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=E.create(t.state.doc,d.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:c,slice:u}=So(t,l);(!n.dataTransfer.files.length||!oe||tu>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Zn?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Zn||n.dataTransfer.setData("text/plain",c),t.dragging=new Du(u,Ru(t,n),o)};me.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ge.dragover=ge.dragenter=(t,e)=>e.preventDefault();ge.drop=(t,e)=>{try{Fm(t,e,t.dragging)}finally{t.dragging=null}};function Fm(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(ur(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",h=>{s=h(s,t,!1)}):s=bu(t,Ou(e.dataTransfer),Zn?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&Ru(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||M.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?uo(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let a=t.state.tr;if(o){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,s.content.firstChild):a.replaceRange(c,c,s),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&E.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))a.setSelection(new E(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),a.setSelection(ko(t,f,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}me.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Qe(t)},20))};me.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};me.beforeinput=(t,e)=>{if(Je&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,wt(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in ge)me[t]=ge[t];function tr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}let ql=class Iu{constructor(e,n){this.toDOM=e,this.spec=n||$t,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new tt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Iu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&tr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},zn=class $s{constructor(e,n){this.attrs=e,this.spec=n||$t}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new tt(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof $s&&tr(this.attrs,e.attrs)&&tr(this.spec,e.spec)}static is(e){return e.type instanceof $s}destroy(){}},Hm=class Pu{constructor(e,n){this.attrs=e,this.spec=n||$t}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new tt(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Pu&&tr(this.attrs,e.attrs)&&tr(this.spec,e.spec)}destroy(){}},tt=class Nn{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Nn(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Nn(e,e,new ql(n,r))}static inline(e,n,r,i){return new Nn(e,n,new zn(r,i))}static node(e,n,r,i){return new Nn(e,n,new Hm(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof zn}get widget(){return this.type instanceof ql}};const nn=[],$t={};let K=class ot{constructor(e,n){this.local=e.length?e:nn,this.children=n.length?n:nn}static create(e,n){return n.length?jr(n,e,0,$t):ue}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,i+l,s)}}map(e,n,r){return this==ue||e.maps.length==0?this:this.mapInner(e,n,0,0,r||$t)}mapInner(e,n,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(n,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?Vm(this.children,o||[],e,n,r,i,s):o?new ot(o.sort(zt),nn):ue}add(e,n){return n.length?this==ue?ot.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((l,a)=>{let c=a+r,u;if(u=zu(n,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,u,c+1):i.splice(s,0,a,a+l.nodeSize,jr(u,l,c+1,$t)),s+=3}});let o=$u(s?Bu(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new ot(o.length?this.local.concat(o).sort(zt):this.local,i||this.children)}remove(e){return e.length==0||this==ue?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+n,a=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,l+1);c!=ue?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ot(i,r):ue}forChild(e,n){if(this==ue)return this;if(n.isLeaf)return ot.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof zn){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new ot(i.sort(zt),nn);return r?new Lu([l,r]):l}return r||ue}eq(e){if(this==e)return!0;if(!(e instanceof ot)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Eo(this.localsInner(e))}localsInner(e){if(this==ue)return nn;if(e.inlineContent||!this.local.some(zn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof zn||n.push(this.local[r]);return n}forEachSet(e){e(this)}};K.empty=new K([],[]);K.removeOverlap=Eo;const ue=K.empty;let Lu=class rn{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,$t));return rn.from(r)}forChild(e,n){if(n.isLeaf)return K.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=ue&&(s instanceof rn?r=r.concat(s.members):r.push(s))}return rn.from(r)}eq(e){if(!(e instanceof rn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Eo(r?n:n.sort(zt)):nn}static from(e){switch(e.length){case 0:return ue;case 1:return e[0];default:return new rn(e.every(n=>n instanceof K)?e:e.reduce((n,r)=>n.concat(r instanceof K?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function Vm(t,e,n,r,i,s,o){let l=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,g)=>{let m=g-p-(h-f);for(let y=0;y<l.length;y+=3){let b=l[y+1];if(b<0||f>b+u-d)continue;let S=l[y]+u-d;h>=S?l[y+1]=f<=S?-2:-1:f>=u&&m&&(l[y]+=m,l[y+1]+=m)}d+=m}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-i;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+s,-1),h=f-i,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=l[c+2].mapInner(n,m,u+1,t[c]+s+1,o);y!=ue?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=jm(l,t,e,n,i,s,o),u=jr(c,r,0,o);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new K(e.sort(zt),l)}function $u(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new tt(i.from+e,i.to+e,i.type))}return n}function jm(t,e,n,r,i,s,o){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,i,c);d?n.push(d):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function zu(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function Bu(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function jr(t,e,n,r){let i=[],s=!1;e.forEach((l,a)=>{let c=zu(t,l,a+n);if(c){s=!0;let u=jr(c,l,n+a+1,r);u!=ue&&i.push(a,a+l.nodeSize,u)}});let o=$u(s?Bu(t):t,-n).sort(zt);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new K(o,i):ue}function zt(t,e){return t.from-e.from||t.to-e.to}function Eo(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Jl(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Jl(e,i,r.copy(s.from,r.to)));break}}}return e}function Jl(t,e,n){for(;e<t.length&&zt(n,t[e])>0;)e++;t.splice(e,0,n)}function Qi(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ue&&e.push(r)}),t.cursorWrapper&&e.push(K.create(t.state.doc,[t.cursorWrapper.deco])),Lu.from(e)}const Wm={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Km=Se&&pt<=11;class Um{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class _m{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Um,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Se&&pt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():de&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Km&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Wm)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Hl(this.view)){if(this.suppressingSelectionUpdates)return Qe(this.view);if(Se&&pt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Kt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=pn(s))n.add(s);for(let s=e.anchorNode;s;s=pn(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Hl(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||oe&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Ae&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||Gm(e,d)!=h)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Di(r)&&(c=bo(e))&&c.eq(O.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Qe(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),qm(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Ym(e,a)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Qe(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(Se&&pt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?ie(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?ie(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Gl=new WeakMap,Yl=!1;function qm(t){if(!Gl.has(t)&&(Gl.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ae,Yl)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."),Yl=!0}}function Xl(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Kt(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Jm(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Xl(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Xl(t,n):null}function Gm(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Ym(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(s,l.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function Xm(t,e,n,r){let{node:i,fromOffset:s,toOffset:o,from:l,to:a}=t.docView.parseRange(e,n),c=t.domSelectionRange(),u,d=c.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],Di(c)||u.push({node:c.focusNode,offset:c.focusOffset})),oe&&t.input.lastKeyCode===8)for(let y=o;y>s;y--){let b=i.childNodes[y-1],S=b.pmViewDesc;if(b.nodeName=="BR"&&!S){o=y;break}if(!S||S.size)break}let f=t.state.doc,h=t.someProp("domParser")||Fe.fromSchema(t.state.schema),p=f.resolve(l),g=null,m=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:Qm(r),context:p});if(u&&u[0].pos!=null){let y=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=y),g={anchor:y+l,head:b+l}}return{doc:m,sel:g,from:l,to:a}}const Qm=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(de&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||de&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},Zm=/^(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 eg(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let w=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,N=bo(t,w);if(N&&!t.state.selection.eq(N)){if(oe&&Je&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Z=>Z(t,wt(13,"Enter"))))return;let I=t.state.tr.setSelection(N);w=="pointer"?I.setMeta("pointer",!0):w=="key"&&I.scrollIntoView(),s&&I.setMeta("composition",s),t.dispatch(I)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=Xm(t,e,n,i),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=rg(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(mn&&t.input.lastIOSEnter>Date.now()-225||Je)&&i.some(w=>w.nodeType==1&&!Zm.test(w.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",w=>w(t,wt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof T&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let w=Ql(t,t.state.doc,c.sel);if(w&&!w.eq(t.state.selection)){let N=t.state.tr.setSelection(w);s&&N.setMeta("composition",s),t.dispatch(N)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof T&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),Se&&pt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let g=c.doc.resolveNoCache(p.start-c.from),m=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),b=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=p.endA;if((mn&&t.input.lastIOSEnter>Date.now()-225&&(!b||i.some(w=>w.nodeName=="DIV"||w.nodeName=="P"))||!b&&g.pos<c.doc.content.size&&(!g.sameParent(m)||!g.parent.inlineContent)&&g.pos<m.pos&&!/\S/.test(c.doc.textBetween(g.pos,m.pos,"","")))&&t.someProp("handleKeyDown",w=>w(t,wt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&ng(u,p.start,p.endA,g,m)&&t.someProp("handleKeyDown",w=>w(t,wt(8,"Backspace")))){Je&&oe&&t.domObserver.suppressSelectionUpdates();return}oe&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Je&&!b&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,m=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(w){return w(t,wt(13,"Enter"))})},20));let S=p.start,C=p.endA,v=w=>{let N=w||t.state.tr.replace(S,C,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let I=Ql(t,N.doc,c.sel);I&&!(oe&&t.composing&&I.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(I.head==S||I.head==N.mapping.map(C)-1)||Se&&I.empty&&I.head==S)&&N.setSelection(I)}return s&&N.setMeta("composition",s),N.scrollIntoView()},R;if(b)if(g.pos==m.pos){Se&&pt<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Qe(t),20));let w=v(t.state.tr.delete(S,C)),N=u.resolve(p.start).marksAcross(u.resolve(p.endA));N&&w.ensureMarks(N),t.dispatch(w)}else if(p.endA==p.endB&&(R=tg(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let w=v(t.state.tr);R.type=="add"?w.addMark(S,C,R.mark):w.removeMark(S,C,R.mark),t.dispatch(w)}else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let w=g.parent.textBetween(g.parentOffset,m.parentOffset),N=()=>v(t.state.tr.insertText(w,S,C));t.someProp("handleTextInput",I=>I(t,S,C,w,N))||t.dispatch(N())}else t.dispatch(v());else t.dispatch(v())}function Ql(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ko(t,e.resolve(n.anchor),e.resolve(n.head))}function tg(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,l,a;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(k.from(c).eq(t))return{mark:l,type:o}}function ng(t,e,n,r,i){if(n-e<=i.pos-r.pos||Zi(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Zi(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Zi(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Zi(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function rg(t,e,n,r,i){let s=t.findDiffStart(e,n),o=n+t.size,l=n+e.size;if(s==null)return null;let{a,b:c}=t.findDiffEnd(e,o,l);if(i=="end"){let u=Math.max(0,s-Math.min(a,c));r-=a+u-s}if(a<s&&o<l){let u=r<=s&&r>=a?s-r:0;s-=u,c=s+(c-a),a=s}else if(c<s){let u=r<=s&&r>=c?s-r:0;s-=u,a=s+(a-c),c=s}return{start:s,endA:a,endB:c}}class Fu{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new bm,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ra),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=ta(this),ea(this),this.nodeViews=na(this),this.docView=Pl(this.state.doc,Zl(this),Qi(this),this.dom,this),this.domObserver=new _m(this,(r,i,s,o)=>eg(this,r,i,s,o)),this.domObserver.start(),km(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ls(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ra),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Nu(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=na(this);sg(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ls(this),this.editable=ta(this),ea(this);let a=Qi(this),c=Zl(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(i.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Ip(this);if(o){this.domObserver.stop();let h=d&&(Se||oe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ig(i.selection,e.selection);if(d){let g=oe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Pm(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Pl(e.doc,c,a,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let p=this.input.mouseDown;h||!(p&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&rm(this)&&p.delaySelUpdate())?Qe(this,h):(mu(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Pp(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof E){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Nl(this,n.getBoundingClientRect(),e)}else Nl(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new Du(e.slice,e.move,i<0?void 0:E.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=n?n(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(Se){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&&Lp(this.dom),Qe(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Hp(this,e)}coordsAtPos(e,n=1){return lu(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Up(this,n||this.state,e)}pasteHTML(e,n){return er(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return er(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return So(this,e)}destroy(){this.docView&&(Sm(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Qi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Mp())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Cm(this,e)}domSelectionRange(){let e=this.domSelection();return e?de&&this.root.nodeType===11&&Ap(this.dom.ownerDocument)==this.dom&&Jm(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Fu.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Zl(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[tt.node(0,t.state.doc.content.size,e)]}function ea(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:tt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ta(t){return!t.someProp("editable",e=>e(t.state)===!1)}function ig(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function na(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function sg(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function ra(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var bt={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:"'"},Wr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},og=typeof navigator<"u"&&/Mac/.test(navigator.platform),lg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var se=0;se<10;se++)bt[48+se]=bt[96+se]=String(se);for(var se=1;se<=24;se++)bt[se+111]="F"+se;for(var se=65;se<=90;se++)bt[se]=String.fromCharCode(se+32),Wr[se]=String.fromCharCode(se);for(var es in bt)Wr.hasOwnProperty(es)||(Wr[es]=bt[es]);function ag(t){var e=og&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||lg&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Wr:bt)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const cg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ug=typeof navigator<"u"&&/Win/.test(navigator.platform);function dg(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))cg?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function fg(t){let e=Object.create(null);for(let n in t)e[dg(n)]=t[n];return e}function ts(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function hg(t){return new F({props:{handleKeyDown:Hu(t)}})}function Hu(t){let e=fg(t);return function(n,r){let i=ag(r),s,o=e[ts(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[ts(i,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(ug&&r.ctrlKey&&r.altKey)&&(s=bt[r.keyCode])&&s!=i){let l=e[ts(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}function Ii(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var un=class Vu{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(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l=[],a=!!e,c=e||s.tr,u=()=>(!a&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...g)=>{const m=this.buildProps(c,n),y=h(...g)(m);return l.push(y),d}])),run:u};return d}static createFakeChain(){const e=new Proxy({},{get:(n,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}static createFallbackCan(){const e=Vu.createFakeChain();return new Proxy({chain:()=>e},{get:(n,r)=>{if(r!=="then")return r==="chain"?n.chain:()=>!1}})}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l={tr:e,editor:i,view:o,state:Ii({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}};const pg=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{if(!t.isDestroyed){var n;e.dom.blur(),(n=window)===null||n===void 0||(n=n.getSelection())===null||n===void 0||n.removeAllRanges()}}),!0),mg=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),gg=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=Sn(h);if(l.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},yg=t=>e=>t(e),bg=()=>({state:t,dispatch:e})=>Yc(t,e),kg=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new T(r.doc.resolve(Math.max(o-1,0)))),!0},Sg=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const o=i.before(s),l=i.after(s);t.delete(o,l).scrollIntoView()}return!0}return!1};function Q(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}const xg=t=>({tr:e,state:n,dispatch:r})=>{const i=Q(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),a=s.after(o);e.delete(l,a).scrollIntoView()}return!0}return!1},Cg=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},Mg=t=>t.content?/^text(\*|\+)/.test(t.content):!1,ia=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return Mg(r)?n==="left"?t.start()-1:t.end()+1:t.pos},Eg=(t,e,n)=>({from:ia(t,n,"left"),to:ia(e,n,"right")}),Tg=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,i=n.steps.length;r.forEach(s=>{const o=n.mapping.slice(i),l=n.doc.resolve(o.map(s.$from.pos)),a=n.doc.resolve(o.map(s.$to.pos)),{from:c,to:u}=Eg(l,a,t.schema);n.deleteRange(c,u)}),n.selection.empty||n.setSelection(T.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},wg=()=>({commands:t})=>t.keyboardShortcut("Enter"),vg=()=>({state:t,dispatch:e})=>ap(t,e);function To(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Kr(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:To(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function ju(t,e,n={}){return t.find(r=>r.type===e&&Kr(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function sa(t,e,n={}){return!!ju(t,e,n)}function wo(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(a=>a.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(a=>a.type===e))return;if(!n){const a=r.node.marks.find(c=>c.type===e);a&&(n=a.attrs)}if(!ju([...r.node.marks],e,n))return;let i=r.index,s=t.start()+r.offset,o=i+1,l=s+r.node.nodeSize;for(;i>0&&sa([...t.parent.child(i-1).marks],e,n);)i-=1,s-=t.parent.child(i).nodeSize;for(;o<t.parent.childCount&&sa([...t.parent.child(o).marks],e,n);)l+=t.parent.child(o).nodeSize,o+=1;return{from:s,to:l}}function nt(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const Ag=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=nt(t,r.schema),{doc:o,selection:l}=n,{$from:a,from:c,to:u}=l;if(i){const d=wo(a,s,e);if(d&&d.from<=c&&d.to>=u){const f=T.create(o,d.from,d.to);n.setSelection(f)}}return!0},Ng=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function vo(t){return t instanceof T}function Ye(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function zs(t,e=null){if(!e)return null;const n=O.atStart(t),r=O.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?T.create(t,Ye(0,i,s),Ye(t.content.size,i,s)):T.create(t,Ye(e,i,s),Ye(e,i,s))}function Bs(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function nr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Og(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const Dg=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(nr()||Bs())&&r.dom.focus(),Og()&&!nr()&&!Bs()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!vo(n.state.selection))return o(),!0;const l=zs(i.doc,t)||n.state.selection,a=n.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Rg=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Ig=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Wu=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Wu(r)}return t};function On(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Wu(n)}function Ku(t){return typeof t?.nodesBetween=="function"}function gn(t,e,n){if(Ku(t))return t;const r=typeof t=="object"&&t!==null;n={slice:!0,parseOptions:{},...n};const i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return k.fromArray(t.map(o=>e.nodeFromJSON(o)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),gn("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,l="";const a=new Mc({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Fe.fromSchema(a).parseSlice(On(t),n.parseOptions):Fe.fromSchema(a).parse(On(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=Fe.fromSchema(e);return n.slice?s.parseSlice(On(t),n.parseOptions).content:s.parse(On(t),n.parseOptions)}return gn("",e,n)}function Uu(t){return!("type"in t)}function _u(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof _||i instanceof te))return;const s=t.mapping.maps[r];let o=0;s.forEach((l,a,c,u)=>{o===0&&(o=u)}),t.setSelection(O.near(t.doc.resolve(o),n))}const Pg=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=m=>{s.emit("contentError",{editor:s,error:m,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{gn(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(m){a(m)}try{var o;l=gn(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(m){return a(m),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;const p=Uu(l)?l.content:[l];if(p.forEach(m=>{m.check(),f=f?m.isText&&m.marks.length===0:!1,h=h?m.isBlock:!1}),u===d&&h){const{parent:m}=r.doc.resolve(u);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(u-=1,d+=1)}let g;if(f)Array.isArray(e)?g=e.map(m=>m.text||"").join(""):Ku(e)?g=p.map(m=>{var y;return(y=m.text)!==null&&y!==void 0?y:""}).join(""):typeof e=="object"&&e&&e.text?g=e.text:g=e,r.insertText(g,u,d);else{g=k.from(p);const m=r.doc.resolve(u),y=m.node(),b=m.parentOffset===0,S=y.isText||y.isTextblock,C=y.content.size>0;b&&S&&C&&h&&(u=Math.max(0,u-1)),r.replaceWith(u,d,p)}n.updateSelection&&_u(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0};function qu(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Lg=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:i,attrs:s,content:o,updateSelection:l=!0}=t;let a;typeof i=="number"?a=e.doc.resolve(i):i?a=i:a=e.selection.$from;const c=qu(a.parent.contentMatchAt(a.index()));if(!c)return!1;const u=Object.keys(c.spec.attrs||{}),d=s?Object.fromEntries(Object.entries(s).filter(([h])=>u.includes(h))):{};let f;if(o){const h=gn(o,r.schema);f=c.createAndFill(d,h)}else f=c.createAndFill(d);return f?(n&&(e.insert(a.pos,f),l&&_u(e,e.steps.length-1,-1)),!0):!1},$g=()=>({state:t,dispatch:e})=>sp(t,e),zg=()=>({state:t,dispatch:e})=>op(t,e),Bg=()=>({state:t,dispatch:e})=>Wc(t,e),Fg=()=>({state:t,dispatch:e})=>qc(t,e),Hg=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ai(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Vg=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ai(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},jg=()=>({state:t,dispatch:e})=>rp(t,e),Wg=()=>({state:t,dispatch:e})=>ip(t,e);function Ju(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Kg(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))nr()||Ju()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const Ug=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=Kg(t).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function Ze(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?Q(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(u,d)=>{if(u.isText)return;const f=Math.max(r,d),h=Math.min(i,d+u.nodeSize);l.push({node:u,from:f,to:h})});const a=i-r,c=l.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>Kr(u.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=a}const _g=(t,e={})=>({state:n,dispatch:r})=>Ze(n,Q(t,n.schema),e)?lp(n,r):!1,qg=()=>({state:t,dispatch:e})=>Xc(t,e),Jg=t=>({state:e,dispatch:n})=>{const r=Q(t,e.schema);return kp(r)(e,n)},Gg=()=>({state:t,dispatch:e})=>Gc(t,e);function Pi(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function oa(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const Yg=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=Pi(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=Q(t,r.schema)),l==="mark"&&(o=nt(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{s&&s===u.type&&(a=!0,i&&n.setNodeMarkup(d,void 0,oa(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&(a=!0,i&&n.addMark(d,d+u.nodeSize,o.create(oa(f.attrs,e))))})})}),a},Xg=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Qg=()=>({tr:t,dispatch:e})=>{if(e){const n=new ke(t.doc);t.setSelection(n)}return!0},Zg=()=>({state:t,dispatch:e})=>Uc(t,e),ey=()=>({state:t,dispatch:e})=>Jc(t,e),ty=()=>({state:t,dispatch:e})=>dp(t,e),ny=()=>({state:t,dispatch:e})=>pp(t,e),ry=()=>({state:t,dispatch:e})=>hp(t,e);function Fs(t,e,n={},r={}){return gn(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const iy=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{const{doc:a}=s;if(r.preserveWhitespace!=="full"){const c=Fs(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});if(o){const u=Uu(c)?c.content:[c];s.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!n)}return!0}return o&&s.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function Gu(t,e){const n=nt(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Yu(t,e){const n=new Bc(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function sy(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function oy(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Li(t){return e=>oy(e.$from,t)}function A(t,e,n){return t.config[e]===void 0&&t.parent?A(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?A(t.parent,e,n):null}):t.config[e]}function Ao(t){return t.map(e=>{const n=A(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return n?[e,...Ao(n())]:e}).flat(10)}function No(t,e){const n=et.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function Xu(t){return typeof t=="function"}function L(t,e=void 0,...n){return Xu(t)?e?t.bind(e)(...n):t(...n):t}function ly(t={}){return Object.keys(t).length===0&&t.constructor===Object}function yn(t){return{baseExtensions:t.filter(e=>e.type==="extension"),nodeExtensions:t.filter(e=>e.type==="node"),markExtensions:t.filter(e=>e.type==="mark")}}function Qu(t){const e=[],{nodeExtensions:n,markExtensions:r}=yn(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...o,...l];return t.forEach(c=>{const u=A(c,"addGlobalAttributes",{name:c.name,options:c.options,storage:c.storage,extensions:i});u&&u().forEach(d=>{let f;Array.isArray(d.types)?f=d.types:d.types==="*"?f=a:d.types==="nodes"?f=o:d.types==="marks"?f=l:f=[],f.forEach(h=>{Object.entries(d.attributes).forEach(([p,g])=>{e.push({type:h,name:p,attribute:{...s,...g}})})})})}),i.forEach(c=>{const u=A(c,"addAttributes",{name:c.name,options:c.options,storage:c.storage});if(!u)return;const d=u();Object.entries(d).forEach(([f,h])=>{const p={...s,...h};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:c.name,name:f,attribute:p})})}),e}function ay(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let l=0;l<o;l+=1){const a=t[l];if(a==="'"&&!i){r=!r,n+=a;continue}if(a==='"'&&!r){i=!i,n+=a;continue}if(!r&&!i){if(a==="("){s+=1,n+=a;continue}if(a===")"&&s>0){s-=1,n+=a;continue}if(a===";"&&s===0){e.push(n),n="";continue}}n+=a}return n&&e.push(n),e}function la(t){const e=[],n=ay(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],o=s.indexOf(":");if(o===-1)continue;const l=s.slice(0,o).trim(),a=s.slice(o+1).trim();l&&a&&e.push([l,a])}return e}function Y(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(i==="__proto__"){Object.defineProperty(r,i,{configurable:!0,enumerable:!0,value:s,writable:!0});return}if(!r[i]){r[i]=s;return}if(i==="class"){const o=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],a=o.filter(c=>!l.includes(c));r[i]=[...l,...a].join(" ")}else if(i==="style"){const o=new Map([...la(r[i]),...la(s)]);r[i]=Array.from(o.entries()).map(([l,a])=>`${l}: ${a}`).join("; ")}else r[i]=s}),r},{})}function bn(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Y(n,r),{})}function cy(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function aa(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):cy(n.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}}}}function ca(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&ly(n)?!1:n!=null))}function ua(t){var e,n;const r={};return!(!(t==null||(e=t.attribute)===null||e===void 0)&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),(t==null||(n=t.attribute)===null||n===void 0?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function Zu(t,e){var n;const r=Qu(t),{nodeExtensions:i,markExtensions:s}=yn(t),o=(n=i.find(c=>A(c,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(i.map(c=>{const u=r.filter(m=>m.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=ca({...t.reduce((m,y)=>{const b=A(y,"extendNodeSchema",d);return{...m,...b?b(c):{}}},{}),content:L(A(c,"content",d)),marks:L(A(c,"marks",d)),group:L(A(c,"group",d)),inline:L(A(c,"inline",d)),atom:L(A(c,"atom",d)),selectable:L(A(c,"selectable",d)),draggable:L(A(c,"draggable",d)),code:L(A(c,"code",d)),whitespace:L(A(c,"whitespace",d)),linebreakReplacement:L(A(c,"linebreakReplacement",d)),defining:L(A(c,"defining",d)),isolating:L(A(c,"isolating",d)),attrs:Object.fromEntries(u.map(ua))}),h=L(A(c,"parseHTML",d));h&&(f.parseDOM=h.map(m=>aa(m,u)));const p=A(c,"renderHTML",d);p&&(f.toDOM=m=>p({node:m,HTMLAttributes:bn(m,u)}));const g=A(c,"renderText",d);return g&&(f.toText=g),[c.name,f]})),a=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=ca({...t.reduce((g,m)=>{const y=A(m,"extendMarkSchema",d);return{...g,...y?y(c):{}}},{}),inclusive:L(A(c,"inclusive",d)),excludes:L(A(c,"excludes",d)),group:L(A(c,"group",d)),spanning:L(A(c,"spanning",d)),code:L(A(c,"code",d)),attrs:Object.fromEntries(u.map(ua))}),h=L(A(c,"parseHTML",d));h&&(f.parseDOM=h.map(g=>aa(g,u)));const p=A(c,"renderHTML",d);return p&&(f.toDOM=g=>p({mark:g,HTMLAttributes:bn(g,u)})),[c.name,f]}));return new Mc({topNode:o,nodes:l,marks:a})}function uy(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Bn(t){return t.sort((n,r)=>{const i=A(n,"priority")||100,s=A(r,"priority")||100;return i>s?-1:i<s?1:0})}function Oo(t){const e=Bn(Ao(t)),n=uy(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function dy(t,e){return Zu(Oo(t),e)}function fx(t,e){const n=dy(e),r=On(t);return Fe.fromSchema(n).parse(r).toJSON()}function ed(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
11
-
12
- `,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,i,(a,c,u,d)=>{a.isBlock&&c>r&&(l+=s);const f=o?.[a.type.name];if(f)return u&&(l+=f({node:a,pos:c,parent:u,index:d,range:e})),!1;if(a.isText){var h;l+=a==null||(h=a.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,i-c)}}),l}function fy(t,e){return ed(t,{from:0,to:t.content.size},e)}function td(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function hy(t,e){const n=Q(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function nd(t,e){const n=Pi(typeof e=="string"?e:e.name,t.schema);return n==="node"?hy(t,e):n==="mark"?Gu(t,e):{}}function py(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function my(t){const e=py(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function $i(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=n[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(s).map(l,-1),u=e.slice(s).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),my(r)}function Do(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=wo(n.resolve(t),i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}const gy=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,o=null;for(;s>0&&o===null;){const l=i.node(s);l?.type.name===e?o=l:s-=1}return[o,s]},yy=t=>{const e=t.depth-1;if(e<0)return null;const n=t.index(e);return n===0?null:t.node(e).child(n-1)};function Zt(t,e){return e.nodes[t]||e.marks[t]||null}function Rr(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}const by=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,c;const u=((a=(c=i.type.spec).toText)===null||a===void 0?void 0:a.call(c,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-s))}),n};function Hs(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?nt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>s?s.name===u.type.name:!0).find(u=>Kr(u.attrs,n,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:u,$to:d})=>{const f=u.pos,h=d.pos;t.doc.nodesBetween(f,h,(p,g)=>{if(s&&p.inlineContent&&!p.type.allowsMarkType(s))return!1;if(!p.isText&&!p.marks.length)return;const m=Math.max(f,g),y=Math.min(h,g+p.nodeSize),b=y-m;o+=b,l.push(...p.marks.map(S=>({mark:S,from:m,to:y})))})}),o===0)return!1;const a=l.filter(u=>s?s.name===u.mark.type.name:!0).filter(u=>Kr(u.mark.attrs,n,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=l.filter(u=>s?u.mark.type!==s&&u.mark.type.excludes(s):!0).reduce((u,d)=>u+d.to-d.from,0);return(a>0?a+c:a)>=o}function ky(t,e,n={}){if(!e)return Ze(t,null,n)||Hs(t,null,n);const r=Pi(e,t.schema);return r==="node"?Ze(t,e,n):r==="mark"?Hs(t,e,n):!1}const Sy=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=Li(l=>l.type.name===e)(t.selection);if(!s)return!1;const o=t.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},xy=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function da(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ns(t,e){const{nodeExtensions:n}=yn(e),r=n.find(s=>s.name===t);if(!r)return!1;const i=L(A(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof i!="string"?!1:i.split(" ").includes("list")}function fr(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){if(n){if(t.type.name==="hardBreak")return!0;if(t.isText){var r;return!/\S/.test((r=t.text)!==null&&r!==void 0?r:"")}}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(fr(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function rd(t){return t instanceof E}function Cy({selection:t,pos:e,nodeSize:n,selectedOnTextSelection:r=!1}){const{from:i,to:s}=t;return!!(i<=e&&s>=e+n||r&&vo(t)&&i>e&&s<e+n)}var id=class sd{constructor(e){this.position=e}static fromJSON(e){return new sd(e.position)}toJSON(){return{position:this.position}}};function My(t,e){const n=e.mapping.mapResult(t.position);return{position:new id(n.pos),mapResult:n}}function Ey(t){return new id(t)}function hx(t,e,n){const i=t.state.doc.content.size,s=Ye(e,0,i),o=Ye(n,0,i),l=t.coordsAtPos(s),a=t.coordsAtPos(o,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),f=Math.max(l.right,a.right),h={top:c,bottom:u,left:d,right:f,width:f-d,height:u-c,x:d,y:c};return{...h,toJSON:()=>h}}function Ty(t,e,n){const{selection:r}=e;let i=null;if(vo(r)&&(i=r.$cursor),i){var s;const l=(s=t.storedMarks)!==null&&s!==void 0?s:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(a=>a.type.excludes(n)))}const{ranges:o}=r;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=h&&p}return!c}),c})}const wy=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:l}=s,a=nt(t,r.schema);if(i)if(o){const c=Gu(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),g=Math.min(h+f.nodeSize,d);f.marks.find(m=>m.type===a)?f.marks.forEach(m=>{a===m.type&&n.addMark(p,g,a.create({...m.attrs,...e}))}):n.addMark(p,g,a.create(e))})});return Ty(r,n,a)},vy=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Ay=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Q(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>wl(s,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>wl(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Ny=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Ye(t,0,r.content.size),s=E.create(r,i);e.setSelection(s)}return!0},Oy=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=s.from,l=s.to),i&&n.doc.nodesBetween(o,l,(a,c)=>{a.isText||n.setNodeMarkup(c,void 0,{...a.attrs,dir:t})}),!0},Dy=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=T.atStart(r).from,l=T.atEnd(r).to,a=Ye(i,o,l),c=Ye(s,o,l),u=T.create(r,a,c);e.setSelection(u)}return!0},Ry=t=>({state:e,dispatch:n})=>{const r=Q(t,e.schema);return Cp(r)(e,n)};function fa(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const Iy=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,c=i.extensionManager.attributes,u=Rr(c,l.node().type.name,l.node().attrs);if(s instanceof E&&s.node.isBlock)return!l.parentOffset||!Xe(o,l.pos)?!1:(r&&(t&&fa(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:qu(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Xe(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Xe(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(s instanceof T&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),m=e.doc.resolve(g);l.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&fa(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},Py=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{const o=Q(t,r.schema),{$from:l,$to:a}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const u=l.node(-1);if(u.type!==o)return!1;const d=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){var f;let y=k.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let N=l.depth-b;N>=l.depth-3;N-=1)y=k.from(l.node(N).copy(y));const S=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,C={...Rr(d,l.node().type.name,l.node().attrs),...e},v=((f=o.contentMatch.defaultType)===null||f===void 0?void 0:f.createAndFill(C))||void 0;y=y.append(k.from(o.createAndFill(null,v)||void 0));const R=l.before(l.depth-(b-1));n.replace(R,l.after(-S),new M(y,4-b,0));let w=-1;n.doc.nodesBetween(R,n.doc.content.size,(N,I)=>{if(w>-1)return!1;N.isTextblock&&N.content.size===0&&(w=I+1)}),w>-1&&n.setSelection(T.near(n.doc.resolve(w))),n.scrollIntoView()}return!0}const h=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...Rr(d,u.type.name,u.attrs),...e},g={...Rr(d,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,a.pos);const m=h?[{type:o,attrs:p},{type:h,attrs:g}]:[{type:o,attrs:p}];if(!Xe(n.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:b}=r,{splittableMarks:S}=s.extensionManager,C=b||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,m).scrollIntoView(),!C||!i)return!0;const v=C.filter(R=>S.includes(R.type.name));n.ensureMarks(v)}return!0};function ha(t){return!t||t==="1"?null:t}function od(t,e){return ha(t)===ha(e)}const rs=(t,e)=>{const n=Li(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&St(t.doc,n.pos))||!od(n.node.attrs.type,i?.attrs.type)||t.join(n.pos),!0},is=(t,e)=>{const n=Li(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&St(t.doc,r))||!od(n.node.attrs.type,i?.attrs.type)||t.join(r),!0};function Ly(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return T.between(r,i)}const $y=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=Q(t,o.schema),p=Q(e,o.schema),{selection:g,storedMarks:m}=o,{$from:y,$to:b}=g,S=y.blockRange(b),C=m||g.$to.parentOffset&&g.$from.marks();if(!S)return!1;const v=Li(V=>ns(V.type.name,d))(g),R=g.from===0&&g.to===o.doc.content.size,w=o.doc.content.content,N=w.length===1?w[0]:null,I=R&&N&&ns(N.type.name,d)?{node:N,pos:0}:null,Z=v??I,le=!!v&&S.depth>=1&&S.depth-v.depth<=1,ae=!!I;if((le||ae)&&Z){if(Z.node.type===h)return R&&ae?a().command(({tr:V,dispatch:q})=>{const z=Ly(V);return z?(V.setSelection(z),q&&q(V),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(ns(Z.node.type.name,d)&&h.validContent(Z.node.content))return a().command(()=>(s.setNodeMarkup(Z.pos,h),!0)).command(()=>rs(s,h)).command(()=>is(s,h)).run()}return!n||!C||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>rs(s,h)).command(()=>is(s,h)).run():a().command(()=>{const V=u().wrapInList(h,r),q=C.filter(z=>f.includes(z.type.name));return s.ensureMarks(q),V?!0:c.clearNodes()}).wrapInList(h,r).command(()=>rs(s,h)).command(()=>is(s,h)).run()},zy=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=nt(t,r.schema);return Hs(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},By=(t,e,n={})=>({state:r,commands:i})=>{const s=Q(t,r.schema),o=Q(e,r.schema),l=Ze(r,s,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(o,a):i.setNode(s,{...a,...n})},Fy=(t,e={})=>({state:n,commands:r})=>{const i=Q(t,n.schema);return Ze(n,i,e)?r.lift(i):r.wrapIn(i,e)},Hy=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},Vy=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:i=!1}=t,{selection:s}=e,{empty:o,ranges:l}=s;if(o)return!0;const{nonClearableMarks:a}=r.extensionManager;if(n){const c=Object.values(r.schema.marks).filter(u=>i||!a.includes(u.name));l.forEach(u=>{for(const d of c)e.removeMark(u.$from.pos,u.$to.pos,d)})}return!0},jy=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{extendEmptyMarkRange:s=!1}=e,{selection:o}=n,l=nt(t,r.schema),{$from:a,empty:c,ranges:u}=o;if(!i)return!0;if(c&&s){var d;let{from:f,to:h}=o;const p=wo(a,l,(d=a.marks().find(g=>g.type===l))===null||d===void 0?void 0:d.attrs);p&&(f=p.from,h=p.to),n.removeMark(f,h,l)}else u.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},Wy=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(l,a)=>{if(l.isText)return;const c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},Ky=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=Pi(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=Q(t,r.schema)),l==="mark"&&(o=nt(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let f,h,p,g;n.selection.empty?r.doc.nodesBetween(u,d,(m,y)=>{s&&s===m.type&&(a=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m)}):r.doc.nodesBetween(u,d,(m,y)=>{y<u&&s&&s===m.type&&(a=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m),y>=u&&y<=d&&(s&&s===m.type&&(a=!0,i&&n.setNodeMarkup(y,void 0,{...m.attrs,...e})),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type&&(a=!0,i)){const S=Math.max(y,u),C=Math.min(y+m.nodeSize,d);n.addMark(S,C,o.create({...b.attrs,...e}))}}))}),h&&(f!==void 0&&i&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&i&&n.addMark(p,g,o.create({...m.attrs,...e}))}))}),a},sn=new X("__tiptap_decorations__"),Uy=t=>({tr:e,dispatch:n})=>(n&&e.setMeta(sn,{type:"force",name:t}),!0),_y=(t,e={})=>({state:n,dispatch:r})=>{const i=Q(t,n.schema);return mp(i,e)(n,r)},qy=(t,e={})=>({state:n,dispatch:r})=>{const i=Q(t,n.schema);return gp(i,e)(n,r)};var Jy=lh({blur:()=>pg,clearContent:()=>mg,clearNodes:()=>gg,command:()=>yg,createParagraphNear:()=>bg,cut:()=>kg,deleteCurrentNode:()=>Sg,deleteNode:()=>xg,deleteRange:()=>Cg,deleteSelection:()=>Tg,enter:()=>wg,exitCode:()=>vg,extendMarkRange:()=>Ag,first:()=>Ng,focus:()=>Dg,forEach:()=>Rg,insertContent:()=>Ig,insertContentAt:()=>Pg,insertDefaultBlock:()=>Lg,joinBackward:()=>Bg,joinDown:()=>zg,joinForward:()=>Fg,joinItemBackward:()=>Hg,joinItemForward:()=>Vg,joinTextblockBackward:()=>jg,joinTextblockForward:()=>Wg,joinUp:()=>$g,keyboardShortcut:()=>Ug,lift:()=>_g,liftEmptyBlock:()=>qg,liftListItem:()=>Jg,newlineInCode:()=>Gg,resetAttributes:()=>Yg,scrollIntoView:()=>Xg,selectAll:()=>Qg,selectNodeBackward:()=>Zg,selectNodeForward:()=>ey,selectParentNode:()=>ty,selectTextblockEnd:()=>ny,selectTextblockStart:()=>ry,setContent:()=>iy,setMark:()=>wy,setMeta:()=>vy,setNode:()=>Ay,setNodeSelection:()=>Ny,setTextDirection:()=>Oy,setTextSelection:()=>Dy,sinkListItem:()=>Ry,splitBlock:()=>Iy,splitListItem:()=>Py,toggleList:()=>$y,toggleMark:()=>zy,toggleNode:()=>By,toggleWrap:()=>Fy,undoInputRule:()=>Hy,unsetAllMarks:()=>Vy,unsetMark:()=>jy,unsetTextDirection:()=>Wy,updateAttributes:()=>Ky,updateDecorations:()=>Uy,wrapIn:()=>_y,wrapInList:()=>qy});const Mn=new WeakMap;function Gy(t,e){var n;Mn.set(t,((n=Mn.get(t))!==null&&n!==void 0?n:0)+1);try{return e()}finally{var r;const i=((r=Mn.get(t))!==null&&r!==void 0?r:1)-1;i>0?Mn.set(t,i):Mn.delete(t)}}var Yy=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function Xy(t){return t.kind==="widget"}function ld(t,e){const n=[],r=new Set;for(const i of t)i.kind==="widget"&&Xy(i)&&r.add(i.key),n.push(i.toPMDecoration(e));return{decorations:n,widgetKeys:r}}function Qy(t,e,n){const{decorations:r,widgetKeys:i}=ld(e,n);return{set:K.create(t,r),widgetKeys:i}}function ad({position:t,from:e,to:n,docSize:r}){return t<e?!1:t<n?!0:t===n&&n===r}function Zy({decorations:t,from:e,to:n,docSize:r,extensionName:i,warnedExtensions:s}){return t.filter(o=>ad({position:o.anchor,from:e,to:n,docSize:r})?!0:(o.anchor===n||s.has(i)||(s.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${e}, ${n}). It was ignored.`)),!1))}function e0(t){var e;const n=(e=t.spec)===null||e===void 0?void 0:e.key;return typeof n=="string"?n:void 0}function cd(t){return t.jsonID==="attr"}function t0(t){let e=!1;if(t.getMap().forEach(()=>{e=!0}),e||cd(t))return!0;const n=t;return typeof n.from=="number"&&typeof n.to=="number"}function n0(t,e){let n=null,r=0,i=0;for(let s=0;s<t.childCount&&!(i>e.to);s+=1){const o=i+t.child(s).nodeSize;o>=e.from&&(n===null&&(n=i),r=o),i=o}return n===null?null:{from:n,to:r}}function r0(t,e){if(t.steps.some(s=>!t0(s)))return{type:"full"};const n=$i(t).map(({newRange:s})=>s);t.steps.forEach((s,o)=>{if(!cd(s))return;const l=t.mapping.slice(o);n.push({from:l.map(s.pos,-1),to:l.map(s.pos+1)})});const r=[];for(const s of n){const o=n0(e,s);o&&r.push(o)}r.sort((s,o)=>s.from-o.from);const i=[];for(const s of r){const o=i[i.length-1];o&&s.from<=o.to?o.to=Math.max(o.to,s.to):i.push({...s})}return{type:"ranges",ranges:i}}function ud(t,e,n,r){return t.map(e,n,{onRemove:i=>{const s=i?.key;typeof s=="string"&&r.delete(s)}})}function i0(t,e,n){var r,i;const s=(r=e.decorationSetsByExtension[t])!==null&&r!==void 0?r:K.empty,o=new Set((i=e.widgetKeysByExtension[t])!==null&&i!==void 0?i:[]);return{set:ud(s,n.mapping,n.doc,o),widgetKeys:o}}function pa(t,e){const n=Object.values(e).flatMap(r=>r.find());return K.create(t,n)}function ma(t){const e=new Set;for(const n of Object.values(t))for(const r of n)e.add(r);return e}function s0(t,e){var n;switch((n=e.update)!==null&&n!==void 0?n:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${t}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${t}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function o0(t,e,n){return n?!0:t.update==="manual"?!1:t.shouldUpdate?t.shouldUpdate(e):e.tr.docChanged}const l0=new Set;var a0=class{constructor(t){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const n=sn.getState(e);n&&this.warnDuplicateWidgetKeys(n)},this.editor=t.editor,this.entries=this.resolveEntries(t.entries),this.entries.forEach(({name:e,spec:n})=>s0(e,n)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var t,e;return(t=(e=sn.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&t!==void 0?t:l0}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(t){const e=[];for(const{name:n,addDecorations:r}of t){const i=r();i&&e.push({name:n,spec:i})}return e}createPlugin(){const{editor:t,entries:e}=this;return new F({key:sn,state:{init:(n,r)=>{const i={},s={};for(const{name:l,spec:a}of e){const{set:c,widgetKeys:u}=this.buildFullSet(l,a,r);i[l]=c,s[l]=u}const o={decorationSetsByExtension:i,widgetKeysByExtension:s,mergedDecorationSet:this.buildMergedSet(r.doc,i),widgetKeys:ma(s)};return this.warnDuplicateWidgetKeys(o),o},apply:(n,r,i,s)=>{const o=n.getMeta(sn),l=o?.type==="force"&&!o.name,a=o?.type==="force"?o.name:void 0,c={},u={},d=new Set;return Gy(t,()=>{for(const{name:f,spec:h}of e){const p=l||a===f;if(o0(h,{editor:t,tr:n,oldState:i,newState:s},p))if(h.update==="changedRanges"&&n.docChanged&&!p){const g=this.applyChangedRangesRecompute(f,h,r,n,s);c[f]=g.set,u[f]=g.widgetKeys,d.add(f)}else{const{set:g,widgetKeys:m}=this.buildFullSet(f,h,s);c[f]=g,u[f]=m,d.add(f)}else{const g=i0(f,r,n);c[f]=g.set,u[f]=g.widgetKeys}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:c,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:n,decorationSetsByExtension:c,recomputedNames:d}),widgetKeys:ma(u)}}},props:{decorations(n){var r,i;return(r=(i=sn.getState(n))===null||i===void 0?void 0:i.mergedDecorationSet)!==null&&r!==void 0?r:K.empty}}})}applyChangedRangesRecompute(t,e,n,r,i){const s=r0(r,i.doc);return s.type==="full"?this.buildFullSet(t,e,i):this.rebuildRanges(t,e,n,r,i,s.ranges)}rebuildRanges(t,e,n,r,i,s){var o,l;const a=(o=n.decorationSetsByExtension[t])!==null&&o!==void 0?o:K.empty,c=new Set((l=n.widgetKeysByExtension[t])!==null&&l!==void 0?l:[]);let u=ud(a,r.mapping,r.doc,c);const d=i.doc.content.size;for(const{from:f,to:h}of s){const p=u.find(f,h).filter(y=>ad({position:y.from,from:f,to:h,docSize:d}));for(const y of p){const b=e0(y);b&&c.delete(b)}u=u.remove(p);const{decorations:g,widgetKeys:m}=ld(Zy({decorations:this.runCreate(t,"createInRange",()=>e.createInRange({editor:this.editor,state:i,view:this.mountedView,from:f,to:h})),from:f,to:h,docSize:d,extensionName:t,warnedExtensions:this.warnedOutOfRangeExtensions}),t);u=u.add(i.doc,g);for(const y of m)c.add(y)}return{set:u,widgetKeys:c}}buildFullSet(t,e,n){const r=this.runCreate(t,"create",()=>e.create({editor:this.editor,state:n,view:this.mountedView}));return Qy(n.doc,r,t)}runCreate(t,e,n){try{return n()}catch(r){return console.error(`[tiptap error]: Extension "${t}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(t){}buildMergedSet(t,e){const n=Object.keys(e);return n.length===1?e[n[0]]:pa(t,e)}mergeAfterApply({entries:t,previous:e,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return t.length===1?r[t[0].name]:i.size===0?e.mergedDecorationSet.map(n.mapping,n.doc):pa(n.doc,r)}};function c0(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&Object.is(t[i],e[i]))}function u0(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof E){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function d0(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}function px(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function mx(t,e){const n=t.getAttribute("style");if(!n)return null;const r=n.split(";").map(s=>s.trim()).filter(Boolean),i=e.toLowerCase();for(let s=r.length-1;s>=0;s-=1){const o=r[s],l=o.indexOf(":");if(l!==-1&&o.slice(0,l).trim().toLowerCase()===i)return o.slice(l+1).trim()}return null}function gx(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function yx(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function f0(t){return typeof t=="number"}function h0(t){return Object.prototype.toString.call(t).slice(8,-1)}function Sr(t){return h0(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ga(t,e,n){const r=t.split(`
1
+ import{c as fo,r as F,b as cc,ac as Hf,j as R,h as Vf,B as cl,ab as ul,aa as jf,ad as Wf,dY as uc,dZ as Kf,aw as Uf,d_ as Kt,d$ as _f,l as dc}from"./index-bq82HRdX.js";import{d as qf,g as Jf}from"./gateway-client-DDB4Jo5d.js";import{d as Gf,c as Yf,e as Xf,b as Qf,D as Zf}from"./dialog-FbeViKhV.js";import{a as eh,F as th,b as nh,c as rh,d as ih,f as sh}from"./form-ZSFKpKuR.js";import{I as oh}from"./input-DYrUDn-6.js";import{t as dl}from"./utils-CVEq3hMx.js";import{a as lh}from"./org-file-open-context-CY-h563L.js";import{T as ah,a as ch,c as uh}from"./tooltip-BbRZqSqs.js";function dh(t,e){const n={};for(const r of t?.arguments??[])n[r.name]=r.required?ul().min(1,e):ul();return jf(n)}function fh(t,e){const n={};for(const r of t.arguments??[])n[r.name]=e?.[r.name]??"";return n}function yx(t){const e=fo.c(74),{prompt:n,setPrompt:r,onSubmit:i,defaultValues:s}=t,o=F.useId(),l=cc();let a,c;if(e[0]!==n||e[1]!==l){const ie=dh(n,l("chat.dialogPromptArguments.required"));c=Wf,a=Hf(ie),e[0]=n,e[1]=l,e[2]=a,e[3]=c}else a=e[2],c=e[3];let u;e[4]!==s||e[5]!==n?(u=n?fh(n,s):{},e[4]=s,e[5]=n,e[6]=u):u=e[6];let d;e[7]!==a||e[8]!==u?(d={resolver:a,defaultValues:u,mode:"onChange"},e[7]=a,e[8]=u,e[9]=d):d=e[9];const f=c(d);let h;e[10]!==n?.arguments?(h=n?.arguments??[],e[10]=n?.arguments,e[11]=h):h=e[11];const p=h;let g;e[12]!==f||e[13]!==i||e[14]!==r?(g=async ie=>{await i(ie),r(null),f.reset()},e[12]=f,e[13]=i,e[14]=r,e[15]=g):g=e[15];const m=g;let y;e[16]!==f||e[17]!==r?(y=ie=>{ie||(f.reset(),r(null))},e[16]=f,e[17]=r,e[18]=y):y=e[18];const b=y;if(!n)return null;let S;e[19]!==n._meta||e[20]!==n.name||e[21]!==n.title?(S=n.title||qf(n.name,Jf(n._meta)),e[19]=n._meta,e[20]=n.name,e[21]=n.title,e[22]=S):S=e[22];let C;e[23]!==S?(C=R.jsx(Gf,{children:R.jsx("span",{className:"capitalize",children:S})}),e[23]=S,e[24]=C):C=e[24];let T;e[25]!==n.description?(T=n.description&&R.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[25]=n.description,e[26]=T):T=e[26];let N;e[27]!==T||e[28]!==C?(N=R.jsxs(Yf,{children:[C,T]}),e[27]=T,e[28]=C,e[29]=N):N=e[29];let v;e[30]!==f||e[31]!==m?(v=ie=>{ie.stopPropagation(),f.handleSubmit(m)(ie)},e[30]=f,e[31]=m,e[32]=v):v=e[32];let O;if(e[33]!==p||e[34]!==f.control||e[35]!==f.formState.isSubmitting||e[36]!==l){let ie;e[38]!==f.control||e[39]!==f.formState.isSubmitting||e[40]!==l?(ie=Le=>R.jsx(th,{control:f.control,name:Le.name,render:En=>{const{field:We}=En;return R.jsxs(nh,{children:[R.jsxs(rh,{className:"text-xs",children:[Le.name,Le.required?null:R.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ",l("chat.dialogPromptArguments.optional")]})]}),R.jsx(ih,{children:R.jsx(oh,{...We,value:We.value??"",required:Le.required,placeholder:Le.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),R.jsx(sh,{})]})}},Le.name),e[38]=f.control,e[39]=f.formState.isSubmitting,e[40]=l,e[41]=ie):ie=e[41],O=p.map(ie),e[33]=p,e[34]=f.control,e[35]=f.formState.isSubmitting,e[36]=l,e[37]=O}else O=e[37];let P;e[42]!==b?(P=()=>b(!1),e[42]=b,e[43]=P):P=e[43];const _=f.formState.isSubmitting;let ne;e[44]!==l?(ne=l("chat.dialogPromptArguments.cancel"),e[44]=l,e[45]=ne):ne=e[45];let ce;e[46]!==f.formState.isSubmitting||e[47]!==P||e[48]!==ne?(ce=R.jsx(cl,{type:"button",variant:"ghost",onClick:P,disabled:_,children:ne}),e[46]=f.formState.isSubmitting,e[47]=P,e[48]=ne,e[49]=ce):ce=e[49];let H;e[50]!==f.formState.isSubmitting||e[51]!==l?(H=f.formState.isSubmitting?R.jsxs("span",{className:"flex items-center gap-2",children:[R.jsx(Vf,{size:"xs"}),l("chat.dialogPromptArguments.loading")]}):l("chat.dialogPromptArguments.usePrompt"),e[50]=f.formState.isSubmitting,e[51]=l,e[52]=H):H=e[52];let J;e[53]!==f.formState.isSubmitting||e[54]!==o||e[55]!==H?(J=R.jsx(cl,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:H}),e[53]=f.formState.isSubmitting,e[54]=o,e[55]=H,e[56]=J):J=e[56];let V;e[57]!==ce||e[58]!==J?(V=R.jsxs(Xf,{children:[ce,J]}),e[57]=ce,e[58]=J,e[59]=V):V=e[59];let re;e[60]!==o||e[61]!==v||e[62]!==O||e[63]!==V?(re=R.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:v,children:[O,V]}),e[60]=o,e[61]=v,e[62]=O,e[63]=V,e[64]=re):re=e[64];let Se;e[65]!==f||e[66]!==re?(Se=R.jsx(eh,{...f,children:re}),e[65]=f,e[66]=re,e[67]=Se):Se=e[67];let Pe;e[68]!==N||e[69]!==Se?(Pe=R.jsxs(Qf,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[N,Se]}),e[68]=N,e[69]=Se,e[70]=Pe):Pe=e[70];let ot;return e[71]!==b||e[72]!==Pe?(ot=R.jsx(Zf,{open:!0,onOpenChange:b,children:Pe}),e[71]=b,e[72]=Pe,e[73]=ot):ot=e[73],ot}var fl=Object.defineProperty,hh=(t,e)=>{let n={};for(var r in t)fl(n,r,{get:t[r],enumerable:!0});return fl(n,Symbol.toStringTag,{value:"Module"}),n};function se(t){this.content=t}se.prototype={constructor:se,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new se(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new se(n)},addToStart:function(t,e){return new se([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new se(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new se(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=se.from(t),t.size?new se(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=se.from(t),t.size?new se(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=se.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};se.from=function(t){if(t instanceof se)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new se(e)};function fc(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){let o=i.text,l=s.text,a=0;for(;o[a]==l[a];a++)n++;return a&&a<o.length&&a<l.length&&mc(o.charCodeAt(a-1))&&pc(o.charCodeAt(a))&&n--,n}if(i.content.size||s.content.size){let o=fc(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function hc(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let c=o.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,n--,r--;return d&&f&&d<c.length&&mc(c.charCodeAt(d-1))&&pc(c.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(o.content.size||l.content.size){let c=hc(o.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function pc(t){return t>=56320&&t<57344}function mc(t){return t>=55296&&t<56320}class k{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,l=0;l<n;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new k(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),i+=l.nodeSize),o=a}return new k(r,i)}cutByIndex(e,n){return e==n?k.empty:e==0&&n==this.content.length?this:new k(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new k(i,s)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return fc(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return hc(this,e,n,r)}findIndex(e){if(e==0)return xr(0,e);if(e==this.size)return xr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?xr(n+1,s):xr(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return k.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return k.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new k(n||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const Ji={index:0,offset:0};function xr(t,e){return Ji.index=t,Ji.offset=e,Ji}function Hr(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Hr(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Hr(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let $=class Es{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Hr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Es.none;if(e instanceof Es)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};$.none=[];class Qn extends Error{}class M{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=yc(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new M(r,this.openStart,this.openEnd)}removeBetween(e,n){return new M(gc(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return M.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new M(k.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new M(e,r,i)}}M.empty=new M(k.empty,0,0);function gc(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(i==e||s.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(gc(s.content,e-i-1,n-i-1)))}function yc(t,e,n,r,i,s){let{index:o,offset:l}=t.findIndex(e),a=t.maybeChild(o);if(l==e||a.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=yc(a.content,e-l-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,a);return c&&t.replaceChild(o,a.copy(c))}function ph(t,e,n){if(n.openStart>t.depth)throw new Qn("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Qn("Inconsistent open depths");return bc(t,e,n,0)}function bc(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=bc(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return zt(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=mh(n,t);return zt(s,Sc(t,o,l,e,r))}else return zt(s,Vr(t,e,r))}function kc(t,e){if(!e.type.compatibleContent(t.type))throw new Qn("Cannot join "+e.type.name+" onto "+t.type.name)}function Ts(t,e,n){let r=t.node(n);return kc(r,e.node(n)),r}function $t(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function zn(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&($t(t.nodeAfter,r),s++));for(let l=s;l<o;l++)$t(i.child(l),r);e&&e.depth==n&&e.textOffset&&$t(e.nodeBefore,r)}function zt(t,e){if(!t.type.validContent(e))throw new Qn("Invalid content for node "+t.type.name);return t.copy(e)}function Sc(t,e,n,r,i){let s=t.depth>i&&Ts(t,e,i+1),o=r.depth>i&&Ts(n,r,i+1),l=[];return zn(null,t,i,l),s&&o&&e.index(i)==n.index(i)?(kc(s,o),$t(zt(s,Sc(t,e,n,r,i+1)),l)):(s&&$t(zt(s,Vr(t,e,i+1)),l),zn(e,n,i,l),o&&$t(zt(o,Vr(n,r,i+1)),l)),zn(r,null,i,l),new k(l)}function Vr(t,e,n){let r=[];if(zn(null,t,n,r),t.depth>n){let i=Ts(t,e,n+1);$t(zt(i,Vr(t,e,n+1)),r)}return zn(e,null,n,r),new k(r)}function mh(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(k.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Zn{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return $.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new jr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Zn(n,r,s)}static resolveCached(e,n){let r=hl.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else hl.set(e,r=new gh);let i=r.elts[r.i]=Zn.resolve(e,n);return r.i=(r.i+1)%yh,i}}class gh{constructor(){this.elts=[],this.i=0}}const yh=12,hl=new WeakMap;class jr{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const bh=Object.create(null);let Bt=class ws{constructor(e,n,r,i=$.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||k.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Hr(this.attrs,n||e.defaultAttrs||bh)&&$.sameSet(this.marks,r||$.none)}copy(e=null){return e==this.content?this:new ws(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ws(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return M.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new M(c,i.depth-o,s.depth-o)}replace(e,n,r){return ph(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Zn.resolveCached(this,e)}resolveNoCache(e){return Zn.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),xc(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=k.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=$.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!$.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=k.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Bt.prototype.text=void 0;class Wr extends Bt{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):xc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Wr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Wr(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function xc(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ut{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new kh(e,n);if(r.next==null)return Ut.empty;let i=Cc(r);r.next&&r.err("Unexpected trailing text");let s=wh(Th(i));return vh(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,l){let a=o.matchFragment(e,r);if(a&&(!n||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,l.concat(u));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
2
+ `)}}Ut.empty=new Ut(!0);class kh{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Cc(t){let e=[];do e.push(Sh(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Sh(t){let e=[];do e.push(xh(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function xh(t){let e=Eh(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Ch(t,e);else break;return e}function pl(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Ch(t,e){let n=pl(t),r=n;return t.eat(",")&&(t.next!="}"?r=pl(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Mh(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function Eh(t){if(t.eat("(")){let e=Cc(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Mh(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Th(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=n())}else if(o.type=="star"){let a=n();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=n();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=n();i(s(o.expr,a),u),a=u}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=n();r(a,u),i(s(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Mc(t,e){return e-t}function ml(t,e){let n=[];return r(e),n.sort(Mc);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&n.indexOf(a)==-1&&r(a)}}}function wh(t){let e=Object.create(null);return n(ml(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);ml(t,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new Ut(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(Mc);s.next.push({type:i[o][0],next:e[l.join(",")]||n(l)})}return s}}function vh(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Ec(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Tc(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function wc(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let i in t)t[i].validate&&t[i].validate(e[i])}function vc(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Nh(t,r,e[r]);return n}let gl=class Ac{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=vc(e,r.attrs),this.defaultAttrs=Ec(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ut.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:Tc(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Bt(this,this.computeAttrs(e),k.from(n),$.setFrom(r))}createChecked(e=null,n,r){return n=k.from(n),this.checkContent(n),new Bt(this,this.computeAttrs(e),n,$.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=k.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(k.empty,!0);return s?new Bt(this,e,n.append(s),$.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){wc(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 n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:$.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Ac(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Ah(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class Nh{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Ah(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ri{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=vc(e,i.attrs),this.excluded=null;let s=Ec(this.attrs);this.instance=s?new $(this,s):null}create(e=null){return!e&&this.instance?this.instance:new $(this,Tc(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Ri(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){wc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Nc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=se.from(e.nodes),n.marks=se.from(e.marks||{}),this.nodes=gl.compile(this.spec.nodes,this),this.marks=Ri.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Ut.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?yl(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:yl(this,o.split(" "))}this.nodeFromJSON=i=>Bt.fromJSON(this,i),this.markFromJSON=i=>$.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof gl){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Wr(r,r.defaultAttrs,e,$.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function yl(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let l in t.marks){let a=t.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Oh(t){return t.tag!=null}function Dh(t){return t.style!=null}class He{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(Oh(i))this.tags.push(i);else if(Dh(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new kl(this,n,!1);return r.addAll(e,$.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new kl(this,n,!0);return r.addAll(e,$.none,n.from,n.to),M.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Ph(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Sl(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Sl(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new He(e,He.schemaRules(e)))}}const Oc={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},Rh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Dc={ol:!0,ul:!0},er=1,vs=2,Bn=4;function bl(t,e,n){return e!=null?(e?er:0)|(e==="full"?vs:0):t&&t.whitespace=="pre"?er|vs:n&~Bn}class Cr{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=$.none,this.match=s||(o&Bn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(k.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&er)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=k.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Oc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class kl{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=bl(null,n.preserveWhitespace,0)|(r?Bn:0);i?s=new Cr(i.type,i.attrs,$.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Cr(null,null,$.none,!0,null,o):s=new Cr(e.schema.topNodeType,null,$.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&vs?"full":this.localPreserveWS||(i.options&er)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
3
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(o.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=i.content[i.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Dc.hasOwnProperty(o)&&this.parser.normalizeLists&&Ih(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Rh.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Oc.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,s=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=$.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):xl(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=bl(e,s,o.options);o.options&Bn&&o.content.length==0&&(l|=Bn);let a=$.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):xl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Cr(e,n,a,i,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=er)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function Ih(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Dc.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Ph(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Sl(t){let e={};for(let n in t)e[n]=t[n];return e}function xl(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class nt{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Mr(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,n);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return Mr(n).createTextNode(e.text);let{dom:r,contentDOM:i}=Lr(Mr(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Lr(Mr(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:Lr(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new nt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Cl(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Cl(e.marks)}}function Cl(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Mr(t){return t.document||window.document}const Ml=new WeakMap;function Lh(t){let e=Ml.get(t);return e===void 0&&Ml.set(t,e=$h(t)),e}function $h(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Lr(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=Lh(r))&&s.indexOf(e)>-1)throw new 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 l,a=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:p}=Lr(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Rc=65535,Ic=Math.pow(2,16);function zh(t,e){return t+e*Ic}function El(t){return t&Rc}function Bh(t){return(t-(t&Rc))/Ic}const Pc=1,Lc=2,$r=4,$c=8;class As{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&$c)>0}get deletedBefore(){return(this.delInfo&(Pc|$r))>0}get deletedAfter(){return(this.delInfo&(Lc|$r))>0}get deletedAcross(){return(this.delInfo&$r)>0}}class xe{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&xe.empty)return xe.empty}recover(e){let n=0,r=El(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Bh(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+i+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:zh(l/3,e-a),g=e==a?Lc:e==d?Pc:$r;return(n<0?e!=a:e!=d)&&(g|=$c),new As(h,g,p)}i+=u-c}return r?e+i:new As(e+i,0,null)}touches(e,n){let r=0,i=El(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+n],u=this.ranges[i+r];e(l,l+c,a,a+u),s+=u-c}}invert(){return new xe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?xe.empty:new xe(e<0?[0,-e,0]:[0,0,e])}}xe.empty=new xe([]);class tr{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new tr(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new tr;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new As(e,i,null)}}const Gi=Object.create(null);class fe{getMap(){return xe.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Gi[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Gi)throw new RangeError("Duplicate use of step JSON ID "+e);return Gi[e]=n,n.prototype.jsonID=e,n}}class G{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new G(e,null)}static fail(e){return new G(null,e)}static fromReplace(e,n,r,i){try{return G.ok(e.replace(n,r,i))}catch(s){if(s instanceof Qn)return G.fail(s.message);throw s}}}function ho(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(ho(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return k.fromArray(r)}class mt extends fe{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new M(ho(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return G.fromReplace(e,this.from,this.to,s)}invert(){return new De(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new mt(n.pos,r.pos,this.mark)}merge(e){return e instanceof mt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new mt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new mt(n.from,n.to,e.markFromJSON(n.mark))}}fe.jsonID("addMark",mt);class De extends fe{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new M(ho(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return G.fromReplace(e,this.from,this.to,r)}invert(){return new mt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new De(n.pos,r.pos,this.mark)}merge(e){return e instanceof De&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new De(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new De(n.from,n.to,e.markFromJSON(n.mark))}}fe.jsonID("removeMark",De);class gt extends fe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return G.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return G.fromReplace(e,this.pos,this.pos+1,new M(k.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new gt(this.pos,n.marks[i]);return new gt(this.pos,this.mark)}}return new _t(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new gt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new gt(n.pos,e.markFromJSON(n.mark))}}fe.jsonID("addNodeMark",gt);class _t extends fe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return G.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return G.fromReplace(e,this.pos,this.pos+1,new M(k.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new gt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new _t(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new _t(n.pos,e.markFromJSON(n.mark))}}fe.jsonID("removeNodeMark",_t);class q extends fe{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Ns(e,this.from,this.to)?G.fail("Structure replace would overwrite content"):G.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new xe([this.from,this.to-this.from,this.slice.size])}invert(e){return new q(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&q.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new q(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof q)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new q(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new q(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new q(n.from,n.to,M.fromJSON(e,n.slice),!!n.structure)}}q.MAP_BIAS=1;fe.jsonID("replace",q);class ee extends fe{constructor(e,n,r,i,s,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Ns(e,this.from,this.gapFrom)||Ns(e,this.gapTo,this.to)))return G.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return G.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?G.fromReplace(e,this.from,this.to,r):G.fail("Content does not fit in gap")}getMap(){return new xe([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new ee(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new ee(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ee(n.from,n.to,n.gapFrom,n.gapTo,M.fromJSON(e,n.slice),n.insert,!!n.structure)}}fe.jsonID("replaceAround",ee);function Ns(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Fh(t,e,n,r){let i=[],s=[],o,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=h:i.push(o=new De(f,h,d[g])));l&&l.to==f?l.to=h:s.push(l=new mt(f,h,r))}}),i.forEach(a=>t.step(a)),s.forEach(a=>t.step(a))}function Hh(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof Ri){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=s):i.push({style:d,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>t.step(new De(o.from,o.to,o.style)))}function po(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new q(l,u,M.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new De(l,u,c.marks[f]));if(i&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new M(k.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new q(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(k.empty,!0);t.replace(l,l,new M(a,0,0))}for(let a=o.length-1;a>=0;a--)t.step(o[a])}function Vh(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Mn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+i,a=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(l,a,n))return r;if(r==0||o.type.spec.isolating||!Vh(o,l,a))break;l&&(i=1),a<o.childCount&&(s=1)}return null}function jh(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,c=l,u=k.empty,d=0;for(let p=s,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=k.from(r.node(p).copy(u)),d++):a--;let f=k.empty,h=0;for(let p=s,g=!1;p>n;p--)g||i.after(p+1)<i.end(p)?(g=!0,f=k.from(i.node(p).copy(f)),h++):c++;t.step(new ee(a,c,o,l,new M(u.append(f),d,h),u.size-d,!0))}function mo(t,e,n=null,r=t){let i=Wh(t,e),s=i&&Kh(r,e);return s?i.map(Tl).concat({type:e,attrs:n}).concat(s.map(Tl)):null}function Tl(t){return{type:t,attrs:null}}function Wh(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function Kh(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:o}function Uh(t,e,n){let r=k.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=k.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new ee(i,s,i,s,new M(r,0,0),n.length,!0))}function _h(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&qh(t.doc,t.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Bc(t,o,l,s),po(t,t.mapping.slice(s).map(l,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return t.step(new ee(d,f,d+1,f-1,new M(k.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&zc(t,o,l,s),!1}})}function zc(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Bc(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
5
+ `))}})}function qh(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Jh(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ee(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new M(k.from(o),0,0),1,!0))}function Ze(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<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 c=i.depth-1,u=n-2;c>s;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Gh(t,e,n=1,r){let i=t.doc.resolve(e),s=k.empty,o=k.empty;for(let l=i.depth,a=i.depth-n,c=n-1;l>a;l--,c--){s=k.from(i.node(l).copy(s));let u=r&&r[c];o=k.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}t.step(new q(e,e,new M(s.append(o),n,n),!0))}function Et(t,e){let n=t.resolve(e),r=n.index();return Fc(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Yh(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Fc(t,e){return!!(t&&e&&!t.isLeaf&&Yh(t,e))}function Ii(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Fc(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Xh(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Bc(t,u.node(),u.before(),l)}o.inlineContent&&po(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new q(c,a.map(e+n,-1),M.empty,!0)),r===!0){let u=t.doc.resolve(c);zc(t,u.node(),u.before(),t.steps.length)}return t}function Qh(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function go(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(a,a,i);else{let d=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Pi(t,e,n=e,r=M.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return Hc(i,s,r)?new q(e,n,r):new Zh(i,s,r).fit()}function Hc(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Zh{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=k.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=k.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new M(s,o,l);return e>-1?new ee(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new q(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Yi(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(k.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Yi(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new M(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Yi(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new M(On(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new M(On(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));d=d.matchFragment(i)}let h=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let g=l.child(c),m=d.matchType(g.type);if(!m)break;c++,(c>1||a==0||g.content.size)&&(d=m,u.push(Vc(g.mark(f.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=Dn(this.placed,n,k.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=l;g<h;g++){let y=m.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),m=y.content}this.unplaced=p?e==0?M.empty:new M(On(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new M(On(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Xi(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Xi(e,n,i,r,s);if(o){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Xi(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Dn(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Dn(this.placed,this.depth,k.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(k.empty,!0);n.childCount&&(this.placed=Dn(this.placed,this.frontier.length,n))}}function On(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(On(t.firstChild.content,e-1,n)))}function Dn(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Dn(t.lastChild.content,e-1,n)))}function Yi(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Vc(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Vc(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(k.empty,!0)))),t.copy(r)}function Xi(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!ep(n,s.content,o)?l:null}function ep(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function tp(t){return t.spec.defining||t.spec.definingForContent}function np(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(Hc(i,s,r))return t.step(new q(e,n,r));let o=Wc(i,s);o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:i.before(f)==h&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=tp(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let g=0;g<o.length;g++){let m=o[(g+a)%o.length],y=!0;m<0&&(y=!1,m=-m);let b=i.node(m-1),S=i.index(m-1);if(b.canReplaceWith(S,S,p.type,p.marks))return t.replace(i.before(m),y?s.after(m):n,new M(jc(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),n=s.after(h))}}function jc(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(jc(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(k.empty,!0))}return t}function rp(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Qh(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new M(k.from(r),0,0))}function ip(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),l=!1;for(let a=r.depth;a>o;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=i.depth;a>o;a--)i.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=i.depth;a>0&&n==i.start(a);a--)n=i.before(a);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=Wc(r,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function Wc(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class fn extends fe{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return G.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return G.fromReplace(e,this.pos,this.pos+1,new M(k.from(i),0,n.isLeaf?0:1))}getMap(){return xe.empty}invert(e){return new fn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new fn(n.pos,n.attr,n.value)}}fe.jsonID("attr",fn);class nr extends fe{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return G.ok(r)}getMap(){return xe.empty}invert(e){return new nr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new nr(n.attr,n.value)}}fe.jsonID("docAttr",nr);let mn=class extends Error{};mn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};mn.prototype=Object.create(Error.prototype);mn.prototype.constructor=mn;mn.prototype.name="TransformError";class Kc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new tr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new mn(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=M.empty){let i=Pi(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new M(k.from(r),0,0))}delete(e,n){return this.replace(e,n,M.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return np(this,e,n,r),this}replaceRangeWith(e,n,r){return rp(this,e,n,r),this}deleteRange(e,n){return ip(this,e,n),this}lift(e,n){return jh(this,e,n),this}join(e,n=1){return Xh(this,e,n),this}wrap(e,n){return Uh(this,e,n),this}setBlockType(e,n=e,r,i=null){return _h(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Jh(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new fn(e,n,r)),this}setDocAttribute(e,n){return this.step(new nr(e,n)),this}addNodeMark(e,n){return this.step(new gt(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof $)n.isInSet(r.marks)&&this.step(new _t(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new _t(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return Gh(this,e,n,r),this}addMark(e,n,r){return Fh(this,e,n,r),this}removeMark(e,n,r){return Hh(this,e,n,r),this}clearIncompatible(e,n,r){return po(this,e,n,r),this}}const Qi=Object.create(null);class D{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new sp(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=M.empty){let r=n.content.lastChild,i=null;for(let l=0;l<n.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(s);e.replaceRange(u.map(a.pos),u.map(c.pos),l?M.empty:n),l==0&&Al(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(r),c=a.map(o.pos),u=a.map(l.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Al(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new w(e):sn(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?sn(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):sn(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new be(e.node(0))}static atStart(e){return sn(e,e,0,0,1)||new be(e)}static atEnd(e){return sn(e,e,e.content.size,e.childCount,-1)||new be(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Qi[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Qi)throw new RangeError("Duplicate use of selection JSON ID "+e);return Qi[e]=n,n.prototype.jsonID=e,n}getBookmark(){return w.between(this.$anchor,this.$head).getBookmark()}}D.prototype.visible=!0;class sp{constructor(e,n){this.$from=e,this.$to=n}}let wl=!1;function vl(t){!wl&&!t.parent.inlineContent&&(wl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class w extends D{constructor(e,n=e){vl(e),vl(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return D.near(r);let i=e.resolve(n.map(this.anchor));return new w(i.parent.inlineContent?i:r,r)}replace(e,n=M.empty){if(super.replace(e,n),n==M.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof w&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Li(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new w(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=D.findFrom(n,r,!0)||D.findFrom(n,-r,!0);if(s)n=s.$head;else return D.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(D.findFrom(e,-r,!0)||D.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new w(e,n)}}D.jsonID("text",w);class Li{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Li(e.map(this.anchor),e.map(this.head))}resolve(e){return w.between(e.resolve(this.anchor),e.resolve(this.head))}}class E extends D{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?D.near(s):new E(s)}content(){return new M(k.from(this.node),0,0)}eq(e){return e instanceof E&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new yo(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new E(e.resolve(n.anchor))}static create(e,n){return new E(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}E.prototype.visible=!1;D.jsonID("node",E);class yo{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Li(r,r):new yo(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&E.isSelectable(r)?new E(n):D.near(n)}}class be extends D{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=M.empty){if(n==M.empty){e.delete(0,e.doc.content.size);let r=D.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new be(e)}map(e){return new be(e)}eq(e){return e instanceof be}getBookmark(){return op}}D.jsonID("all",be);const op={map(){return this},resolve(t){return new be(t)}};function sn(t,e,n,r,i,s=!1){if(e.inlineContent)return w.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&E.isSelectable(l))return E.create(t,n-(i<0?l.nodeSize:0))}else{let a=sn(t,l,n+i,i<0?l.childCount:0,i,s);if(a)return a}n+=l.nodeSize*i}return null}function Al(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof q||i instanceof ee))return;let s=t.mapping.maps[r],o;s.forEach((l,a,c,u)=>{o==null&&(o=u)}),t.setSelection(D.near(t.doc.resolve(o),n))}const Nl=1,Er=2,Ol=4;class lp extends Kc{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Nl)&~Er,this.storedMarks=null,this}get selectionSet(){return(this.updated&Nl)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Er,this}ensureMarks(e){return $.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&Er)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Er,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||$.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(D.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Ol,this}get scrolledIntoView(){return(this.updated&Ol)>0}}function Dl(t,e){return!e||!t?t:t.bind(e)}class Rn{constructor(e,n,r){this.name=e,this.init=Dl(n.init,r),this.apply=Dl(n.apply,r)}}const ap=[new Rn("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Rn("selection",{init(t,e){return t.selection||D.atStart(e.doc)},apply(t){return t.selection}}),new Rn("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Rn("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Zi{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ap.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Rn(r.key,r.spec.state,r))})}}class Dt{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,c=i?i[o].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Dt(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new lp(this)}static create(e){let n=new Zi(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Dt(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Zi(this.schema,e.plugins),r=n.fields,i=new Dt(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Zi(e.schema,e.plugins),s=new Dt(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Bt.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=D.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[o.name]=c.fromJSON.call(a,e,n[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Uc(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Uc(i,e,{})),n[r]=i}return n}class B{constructor(e){this.spec=e,this.props={},e.props&&Uc(e.props,this,this.props),this.key=e.key?e.key.key:_c("plugin")}getState(e){return e[this.key]}}const es=Object.create(null);function _c(t){return t in es?t+"$"+ ++es[t]:(es[t]=0,t+"$")}class X{constructor(e="key"){this.key=_c(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const qc=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Jc(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Gc=(t,e,n)=>{let r=Jc(t,n);if(!r)return!1;let i=bo(r);if(!i){let o=r.blockRange(),l=o&&Mn(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(iu(t,i,e,-1))return!0;if(r.parent.content.size==0&&(gn(s,"end")||E.isSelectable(s)))for(let o=r.depth;;o--){let l=Pi(t.doc,r.before(o),r.after(o),M.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(gn(s,"end")?D.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):E.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},cp=(t,e,n)=>{let r=Jc(t,n);if(!r)return!1;let i=bo(r);return i?Yc(t,i,e):!1},up=(t,e,n)=>{let r=Qc(t,n);if(!r)return!1;let i=ko(r);return i?Yc(t,i,e):!1};function Yc(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Pi(t.doc,s,a,M.empty);if(!c||c.from!=s||c instanceof q&&c.slice.size>=a-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(w.create(u.doc,s)),n(u.scrollIntoView())}return!0}function gn(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Xc=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=bo(r)}let o=s&&s.nodeBefore;return!o||!E.isSelectable(o)?!1:(e&&e(t.tr.setSelection(E.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function bo(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Qc(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Zc=(t,e,n)=>{let r=Qc(t,n);if(!r)return!1;let i=ko(r);if(!i)return!1;let s=i.nodeAfter;if(iu(t,i,e,1))return!0;if(r.parent.content.size==0&&(gn(s,"start")||E.isSelectable(s))){let o=Pi(t.doc,r.before(),r.after(),M.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(gn(s,"start")?D.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):E.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},eu=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=ko(r)}let o=s&&s.nodeAfter;return!o||!E.isSelectable(o)?!1:(e&&e(t.tr.setSelection(E.create(t.doc,s.pos)).scrollIntoView()),!0)};function ko(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const dp=(t,e)=>{let n=t.selection,r=n instanceof E,i;if(r){if(n.node.isTextblock||!Et(t.doc,n.from))return!1;i=n.from}else if(i=Ii(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(E.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},fp=(t,e)=>{let n=t.selection,r;if(n instanceof E){if(n.node.isTextblock||!Et(t.doc,n.to))return!1;r=n.to}else if(r=Ii(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},hp=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Mn(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},tu=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
6
+ `).scrollIntoView()),!0)};function So(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const pp=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=So(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,o.createAndFill());a.setSelection(D.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},nu=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof be||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=So(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=t.tr.insert(o,s.createAndFill());l.setSelection(w.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},ru=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(Ze(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Mn(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function mp(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof E&&e.selection.node.isBlock)return!r.parentOffset||!Ze(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=So(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(a&&l?{type:l}:null),o=h;break}else{if(h==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof w||e.selection instanceof be)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Ze(u.doc,d,s.length,s);if(f||(s[0]=l?{type:l}:null,f=Ze(u.doc,d,s.length,s)),!f)return!1;if(u.split(d,s.length,s),!a&&c&&r.node(o).type!=l){let h=u.mapping.map(r.before(o)),p=u.doc.resolve(h);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(o)),l)}return n&&n(u.scrollIntoView()),!0}}const gp=mp(),yp=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(E.create(t.doc,i))),!0)};function bp(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Et(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function iu(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&bp(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=k.empty;for(let y=o.length-1;y>=0;y--)p=k.from(o[y].create(null,p));p=k.from(i.copy(p));let g=t.tr.step(new ee(e.pos-1,h,e.pos,h,new M(p,1,0),o.length,!0)),m=g.doc.resolve(h+2*o.length);m.nodeAfter&&m.nodeAfter.type==i.type&&Et(g.doc,m.pos)&&g.join(m.pos),n(g.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&a?null:D.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Mn(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&gn(s,"start",!0)&&gn(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=s,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=k.empty;for(let S=p.length-1;S>=0;S--)y=k.from(p[S].copy(y));let b=t.tr.step(new ee(e.pos-p.length,e.pos+s.nodeSize,e.pos+m,e.pos+s.nodeSize-m,new M(y,p.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function su(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(w.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const kp=su(-1),Sp=su(1);function xp(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),l=o&&mo(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Rl(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(o,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)i=!0;else{let u=n.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[o];s.setBlockType(l,a,t,e)}r(s.scrollIntoView())}return!0}}function xo(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}xo(qc,Gc,Xc);xo(qc,Zc,eu);xo(tu,nu,ru,gp);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Cp(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let l=r?n.tr:null;return Mp(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Mp(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);s=new jr(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new jr(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=mo(s,n,r,e);return l?(t&&Ep(t,e,l,i,n),!0):!1}function Ep(t,e,n,r,i){let s=k.empty;for(let u=n.length-1;u>=0;u--)s=k.from(n[u].type.create(n[u].attrs,s));t.step(new ee(e.start-(r?2:0),e.end,e.start,e.end,new M(s,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==i&&(o=u+1);let l=n.length-o,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Ze(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function Tp(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?wp(e,n,t,s):vp(e,n,s):!0:!1}}function wp(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new ee(s-1,o,s,o,new M(k.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new jr(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=Mn(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return Et(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function vp(t,e,n){let r=t.tr,i=n.parent;for(let h=n.end,p=n.endIndex-1,g=n.startIndex;p>g;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,o.content.append(a?k.empty:k.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new ee(d-(l?1:0),f+(a?1:0),d+1,f-1,new M((l?k.empty:k.from(i.copy(k.empty))).append(a?k.empty:k.from(i.copy(k.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Ap(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=k.from(c?t.create():null),d=new M(k.from(t.create(null,k.from(l.type.create(null,u)))),c?3:1,0),f=s.start,h=s.end;n(e.tr.step(new ee(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const oe=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},yn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Os=null;const Ge=function(t,e,n){let r=Os||(Os=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Np=function(){Os=null},qt=function(t,e,n,r){return n&&(Il(t,e,n,r,-1)||Il(t,e,n,r,1))},Op=/^(img|br|input|textarea|hr)$/i;function Il(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:ve(t))){let o=t.parentNode;if(!o||o.nodeType!=1||dr(t)||Op.test(t.nodeName)||t.contentEditable=="false")return!1;e=oe(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?ve(t):0}else return!1}}function ve(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Dp(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=ve(t)}else if(t.parentNode&&!dr(t))e=oe(t),t=t.parentNode;else return null}}function Rp(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!dr(t))e=oe(t)+1,t=t.parentNode;else return null}}function Ip(t,e,n){for(let r=e==0,i=e==ve(t);r||i;){if(t==n)return!0;let s=oe(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==ve(t)}}function dr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const $i=function(t){return t.focusNode&&qt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Nt(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Pp(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Lp(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(ve(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(ve(r.startContainer),r.startOffset)}}}const Ve=typeof navigator<"u"?navigator:null,Pl=typeof document<"u"?document:null,Tt=Ve&&Ve.userAgent||"",Ds=/Edge\/(\d+)/.exec(Tt),ou=/MSIE \d/.exec(Tt),Rs=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Tt),ke=!!(ou||Rs||Ds),bt=ou?document.documentMode:Rs?+Rs[1]:Ds?+Ds[1]:0,Ae=!ke&&/gecko\/(\d+)/i.test(Tt);Ae&&+(/Firefox\/(\d+)/.exec(Tt)||[0,0])[1];const Is=!ke&&/Chrome\/(\d+)/.exec(Tt),ae=!!Is,lu=Is?+Is[1]:0,de=!ke&&!!Ve&&/Apple Computer/.test(Ve.vendor),bn=de&&(/Mobile\/\w+/.test(Tt)||!!Ve&&Ve.maxTouchPoints>2),Te=bn||(Ve?/Mac/.test(Ve.platform):!1),au=Ve?/Win/.test(Ve.platform):!1,Ye=/Android \d/.test(Tt),fr=!!Pl&&"webkitFontSmoothing"in Pl.documentElement.style,$p=fr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function zp(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ke(t,e){return typeof t=="number"?t:t[e]}function Bp(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Ll(t,e,n){if(!Ps(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=yn(o);continue}let l=o,a=l==s.body,c=a?zp(s):Bp(l),u=0,d=0;if(e.top<c.top+Ke(r,"top")?d=-(c.top-e.top+Ke(i,"top")):e.bottom>c.bottom-Ke(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Ke(i,"top")-c.top:e.bottom-c.bottom+Ke(i,"bottom")),e.left<c.left+Ke(r,"left")?u=-(c.left-e.left+Ke(i,"left")):e.right>c.right-Ke(r,"right")&&(u=e.right-c.right+Ke(i,"right")),u||d)if(a)s.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let g=l.scrollLeft-h,m=l.scrollTop-p;e={left:e.left-g,top:e.top-m,right:e.right-g,bottom:e.bottom-m}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:yn(o)}}function Fp(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(s,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:cu(t.dom)}}function cu(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=yn(r));return e}function Hp({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;uu(n,r==0?0:r-e)}function uu(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let en=null;function Vp(t){if(t.setActive)return t.setActive();if(en)return t.focus(en);let e=cu(t);t.focus(en==null?{get preventScroll(){return en={preventScroll:!0},!0}}:void 0),en||(en=!1,uu(e,0))}function du(t,e){let n,r=2e8,i,s=0,o=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Ge(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){n=u,r=g,i=g&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&g&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&a&&(n=a,i=c,r=0),n&&n.nodeType==3?jp(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:du(n,i)}function jp(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=ct(r,1);if(o.top!=o.bottom&&Co(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function Co(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Wp(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Kp(t,e,n){let{node:r,offset:i}=du(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function Up(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),o=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function fu(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Co(e,c))return fu(o,e,c)}}if((s=(s+1)%r)==i)break}return t}function _p(t,e){let n=t.dom.ownerDocument,r,i=0,s=Lp(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!Co(e,c)||(o=fu(t.dom,e,c),!o))return null}if(de)for(let c=o;r&&c;c=yn(c))c.draggable&&(r=void 0);if(o=Wp(o,e),r){if(Ae&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;fr&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Up(t,r,i,e))}l==null&&(l=Kp(t,o,e));let a=t.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ps(t){return t.top<t.bottom||t.left<t.right}function ct(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Ps(r))return r}return Array.prototype.find.call(n,Ps)||t.getBoundingClientRect()}const qp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function hu(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=fr||Ae;if(r.nodeType==3)if(o&&(qp.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=ct(Ge(r,i,i),n);if(Ae&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=ct(Ge(r,i-1,i-1),-1);if(c.top==a.top){let u=ct(Ge(r,i,i+1),-1);if(u.top!=a.top)return Tn(u,u.left<c.left)}}return a}else{let a=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(a--,u=1):n<0?a--:c++,Tn(ct(Ge(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==ve(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return ts(a.getBoundingClientRect(),!1)}if(s==null&&i<ve(r)){let a=r.childNodes[i];if(a.nodeType==1)return ts(a.getBoundingClientRect(),!0)}return ts(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==ve(r))){let a=r.childNodes[i-1],c=a.nodeType==3?Ge(a,ve(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Tn(ct(c,1),!1)}if(s==null&&i<ve(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Ge(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return Tn(ct(c,-1),!0)}return Tn(ct(r.nodeType==3?Ge(r):r,-n),n>=0)}function Tn(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function ts(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function pu(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function Jp(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return pu(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=hu(t,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Ge(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const Gp=/[\u0590-\u08ac]/;function Yp(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=t.domSelection();return l?!Gp.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:o:pu(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),m=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==g;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),m}):r.pos==r.start()||r.pos==r.end()}let $l=null,zl=null,Bl=!1;function Xp(t,e,n){return $l==e&&zl==n?Bl:($l=e,zl=n,Bl=n=="up"||n=="down"?Jp(t,e,n):Yp(t,e,n))}const Ne=0,Fl=1,Rt=2,Re=3;class hr{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Ne,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>oe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let l=i.children[o];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e||o instanceof gu){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof mu&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?oe(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?oe(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,l=0;;l++){let a=this.children[l],c=o+a.size;if(i==-1&&e<=c){let u=o+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=o;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=oe(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=oe(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let g=this.children[h],m=p+g.size;if(s>p&&o<m)return g.setSelection(e-p-g.border,n-p-g.border,r,i);p=m}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Ae||de)&&e==n){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
7
+ `),d&&p==h.nodeValue.length)for(let g=h,m;g;g=g.parentNode){if(m=g.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:oe(m)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=h.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Ae&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&de)&&qt(l.node,l.offset,u.anchorNode,u.anchorOffset)&&qt(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Ae)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+s.border,a=o-s.border;if(e>=l&&n<=a){this.dirty=e==r||n==o?Rt:Fl,e==l&&n==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Re:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Rt:Re}r=o}this.dirty=Rt}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Rt:Fl;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class mu extends hr{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.hasAttribute("contenteditable")||(o.contentEditable="false"),o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Ne&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Qp extends hr{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class kt extends hr{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=nt.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new kt(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Re||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Re&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ne){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ne}}slice(e,n,r){let i=kt.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=$s(s,n,o,r)),e>0&&(s=$s(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class St extends hr{constructor(e,n,r,i,s,o,l){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,n,r,i,s,o){let l=s.nodeViews[n.type.name],a,c=l&&l(n,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=nt.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=ku(u,r,n),c?a=new Zp(e,n,r,i,u,d||null,f,c):n.isText?new zi(e,n,r,i,u,f):new St(e,n,r,i,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let i=this.children[r];if(this.dom.contains(i.dom.parentNode)){n.contentElement=i.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(i=>i.nodeType==1&&e.indexOf(i.parentNode)<0&&this.dom.contains(i));r?n.contentElement=r:n.getContent=()=>k.empty}}return n}matchesNode(e,n,r){return this.dirty==Ne&&e.eq(this.node)&&Kr(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new tm(this,o&&o.node,e);im(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?$.none:this.node.child(u).marks,r,e,u),a.placeWidget(c,e,i)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e,f);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,i)||a.addNode(c,u,d,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Rt)&&(o&&this.protectLocalComposition(e,o),yu(this.contentDOM,this.children,e),bn&&sm(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof w)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=om(this.node.content,o,r-n,i-n);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Qp(this,s,n,i);e.input.compositionNodes.push(o),this.children=$s(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Re||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Ne}updateOuterDeco(e){if(Kr(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=bu(this.dom,this.nodeDOM,Ls(this.outerDeco,this.node,n),Ls(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.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 Hl(t,e,n,r,i){ku(r,e,t);let s=new St(void 0,t,e,n,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class zi extends St{constructor(e,n,r,i,s,o){super(e,n,r,i,s,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Re||this.dirty!=Ne&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ne||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Ne,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new zi(this.parent,i,this.outerDeco,this.innerDeco,s,s)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Re)}get domAtom(){return!1}isText(e){return this.node.text==e}}class gu extends hr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ne&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Zp extends St{constructor(e,n,r,i,s,o,l,a){super(e,n,r,i,s,o,l),this.spec=a}update(e,n,r,i){if(this.dirty==Re)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}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 yu(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=Vl(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(o instanceof kt){let a=r?r.previousSibling:t.lastChild;yu(o.contentDOM,o.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Vl(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Fn=function(t){t&&(this.nodeName=t)};Fn.prototype=Object.create(null);const It=[new Fn];function Ls(t,e,n){if(t.length==0)return It;let r=n?It[0]:new Fn,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Fn(o.nodeName));for(let l in o){let a=o[l];a!=null&&(n&&i.length==1&&i.push(r=new Fn(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function bu(t,e,n,r){if(n==It&&r==It)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=n[s];if(s){let a;l&&l.nodeName==o.nodeName&&i!=t&&(a=i.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=It[0]),i=a}em(i,l||It[0],o)}return i}function em(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function ku(t,e,n){return bu(t,t,It,Ls(e,n,t.nodeType!=1))}function Kr(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Vl(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class tm{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=nm(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;s<l&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Ne,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){a=u;break}}if(a<0&&this.index<this.top.children.length){let u=this.top.children[this.index];u instanceof kt&&u.dirty!=Re&&u.mark.type==e[o].type&&u.spec.update&&!this.isLocked(u.dom)&&u.spec.update(e[o])&&(u.mark=e[o],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=kt.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==Re&&o.dom==o.contentDOM&&(o.dirty=Rt),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof St){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Re&&Kr(n,a.outerDeco));if(!f&&a.update(e,n,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Rt,d.updateChildren(i,o+1),d.dirty=Ne),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Kr(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=St.create(this.top,n,r,i,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,i,s){let o=St.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new mu(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof kt;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof zi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((de||ae)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new gu(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function nm(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof kt)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function rm(t,e){return t.type.side-e.type.side}function im(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let u,d;for(;o<i.length&&i[o].to==s;){let m=i[o++];m.widget&&(u?(d||(d=[u])).push(m):u=m)}if(u)if(d){d.sort(rm);for(let m=0;m<d.length;m++)n(d[m],c,!!a)}else n(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let m=0;m<l.length;m++)l[m].to<=s&&l.splice(m--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let m=p;o<i.length&&i[o].from<m&&(m=i[o].from);for(let y=0;y<l.length;y++)l[y].to<m&&(m=l[y].to);m<p&&(a=f.cut(m-s),f=f.cut(0,m-s),p=m,h=-1)}else for(;o<i.length&&i[o].to<p;)o++;let g=f.isInline&&!f.isLeaf?l.filter(m=>!m.inline):l.slice();r(f,g,e.forChild(s,f),h),s=p}}function sm(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function om(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=n){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function $s(t,e,n,r,i){let s=[];for(let o=0,l=0;o<t.length;o++){let a=t[o],c=l,u=l+=a.size;c>=n||u<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,r)),i&&(s.push(i),i=void 0),u>n&&s.push(a.slice(n-c,a.size,r)))}return s}function Mo(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if($i(n)){for(a=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&E.isSelectable(d)&&i.parent&&!(d.isInline&&Ip(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new E(o==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,o]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;c=Eo(t,u,l,d)}return c}function Su(t){return t.editable?t.hasFocus():Cu(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function et(t,e=!1){let n=t.state.selection;if(xu(t,n),!Su(t))return;let r=t.input.mouseDown;if(!e&&ae&&r){let i=t.domSelectionRange(),s=t.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&qt(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)am(t);else{let{anchor:i,head:s}=n,o,l;jl&&!(n instanceof w)&&(n.$from.parent.inlineContent||(o=Wl(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=Wl(t,n.to))),t.docView.setSelection(i,s,t,e),jl&&(o&&Kl(o),l&&Kl(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&lm(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const jl=de||ae&&lu<63;function Wl(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(de&&i&&i.contentEditable=="false")return ns(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return ns(i);if(s)return ns(s)}}function ns(t){return t.contentEditable="true",de&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Kl(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function lm(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Su(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function am(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,oe(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ke&&bt<=11&&(n.disabled=!0,n.disabled=!1)}function xu(t,e){if(e instanceof E){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Ul(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Ul(t)}function Ul(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Eo(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||w.between(e,n,r)}function _l(t){return t.editable&&!t.hasFocus()?!1:Cu(t)}function Cu(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function cm(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return qt(e.node,e.offset,n.anchorNode,n.anchorOffset)}function zs(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&D.findFrom(s,e)}function dt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function ql(t,e,n){let r=t.state.selection;if(r instanceof w)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return dt(t,new w(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=zs(t.state,e);return i&&i instanceof E?dt(t,i):!1}else if(!(Te&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?E.isSelectable(s)?dt(t,new E(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):fr?dt(t,new w(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof E&&r.node.isInline)return dt(t,new w(e>0?r.$to:r.$from));{let i=zs(t.state,e);return i?dt(t,i):!1}}}function Ur(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Hn(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function tn(t,e){return e<0?um(t):dm(t)}function um(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Ae&&n.nodeType==1&&r<Ur(n)&&Hn(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Hn(l,-1))i=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Mu(n))break;{let l=n.previousSibling;for(;l&&Hn(l,-1);)i=n.parentNode,s=oe(l),l=l.previousSibling;if(l)n=l,r=Ur(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Bs(t,n,r):i&&Bs(t,i,s)}function dm(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Ur(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Hn(l,1))s=n,o=++r;else break}else{if(Mu(n))break;{let l=n.nextSibling;for(;l&&Hn(l,1);)s=l.parentNode,o=oe(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=Ur(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Bs(t,s,o)}function Mu(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function fm(t,e){for(;t&&e==t.childNodes.length&&!dr(t);)e=oe(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function hm(t,e){for(;t&&!e&&!dr(t);)e=oe(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Bs(t,e,n){if(e.nodeType!=3){let s,o;(o=fm(e,n))?(e=o,n=0):(s=hm(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if($i(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&et(t)},50)}function Jl(t,e){let n=t.state.doc.resolve(e);if(!(ae||au)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Gl(t,e,n){let r=t.state.selection;if(r instanceof w&&!r.empty||n.indexOf("s")>-1||Te&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=zs(t.state,e);if(o&&o instanceof E)return dt(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof be?D.near(o,e):D.findFrom(o,e);return l?dt(t,l):!1}return!1}function Yl(t,e){if(!(t.state.selection instanceof w))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Xl(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function pm(t){if(!de||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Xl(t,r,"true"),setTimeout(()=>Xl(t,r,"false"),20)}return!1}function mm(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function gm(t,e){let n=e.keyCode,r=mm(e);if(n==8||Te&&n==72&&r=="c")return Yl(t,-1)||tn(t,-1);if(n==46&&!e.shiftKey||Te&&n==68&&r=="c")return Yl(t,1)||tn(t,1);if(n==13||n==27)return!0;if(n==37||Te&&n==66&&r=="c"){let i=n==37?Jl(t,t.state.selection.from)=="ltr"?-1:1:-1;return ql(t,i,r)||tn(t,i)}else if(n==39||Te&&n==70&&r=="c"){let i=n==39?Jl(t,t.state.selection.from)=="ltr"?1:-1:1;return ql(t,i,r)||tn(t,i)}else{if(n==38||Te&&n==80&&r=="c")return Gl(t,-1,r)||tn(t,-1);if(n==40||Te&&n==78&&r=="c")return pm(t)||Gl(t,1,r)||tn(t,1);if(r==(Te?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function To(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||nt.fromSchema(t.state.schema),l=Nu(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Au[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
8
+
9
+ `);return{dom:a,text:f,slice:e}}function Eu(t,e,n,r,i){let s=i.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||s||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return l=new M(k.from(t.state.schema.text(e.replace(/\r\n?/g,`
10
+ `))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)l=d;else{let f=i.marks(),{schema:h}=t.state,p=nt.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=Sm(n),fr&&xm(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||He.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!ym.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Cm(Ql(l,+u[1],+u[2]),u[4]);else if(l=M.maxOpen(bm(l.content,i),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=Ql(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const ym=/^(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 bm(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&wu(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=vu(o[o.length-1],s.length));let u=Tu(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return k.from(o)}return t}function Tu(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,k.from(t));return t}function wu(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=wu(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(k.from(Tu(n,t,i+1))))}}function vu(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,vu(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(k.empty,!0);return t.copy(n.append(r))}function Fs(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(s=0),i<r-1&&(l=Fs(l,e,n,r,i+1,s)),i>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(k.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function Ql(t,e,n){return e<t.openStart&&(t=new M(Fs(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new M(Fs(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Au={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function Nu(){return document.implementation.createHTMLDocument("title")}let wn=null;function km(t){let e=window.trustedTypes;if(!e)return t;if(!wn){if(wn=e.defaultPolicy)try{return wn.createHTML(t)}catch{}wn=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return wn.createHTML(t)}function Sm(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Nu(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(t),s;if((s=i&&Au[i[1].toLowerCase()])&&(t=s.map(o=>"<"+o+">").join("")+t+s.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=km(t),s)for(let o=0;o<s.length;o++)r=r.querySelector(s[o])||r;for(let o=0;o<n.styleSheets.length;o++){let l=n.styleSheets[o];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let u=r.querySelectorAll(c.selectorText);for(let d=0;d<u.length;d++)u[d].style.cssText+=c.style.cssText}}}return r}function xm(t){let e=t.querySelectorAll(ae?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Cm(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;try{a.checkAttrs(r[l+1])}catch{break}i=k.from(a.create(r[l+1],i)),s++,o++}return new M(i,s,o)}const pe={},me={},Mm={touchstart:!0,touchmove:!0};class Em{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 Tm(t){for(let e in pe){let n=pe[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{vm(t,r)&&!wo(t,r)&&(t.editable||!(r.type in me))&&n(t,r)},Mm[e]?{passive:!0}:void 0)}de&&t.dom.addEventListener("input",()=>null),Hs(t)}function Xe(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function wm(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Hs(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>wo(t,r))})}function wo(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function vm(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Am(t,e){!wo(t,e)&&pe[e.type]&&(t.editable||!(e.type in me))&&pe[e.type](t,e)}me.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Iu(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ye&&ae&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),bn&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Nt(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||gm(t,n)?n.preventDefault():Xe(t,"key")};me.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};me.keypress=(t,e)=>{let n=e;if(Iu(t)||!n.charCode||n.ctrlKey&&!n.altKey||Te&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof w)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function pr(t){return{left:t.clientX,top:t.clientY}}function Nm(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function vo(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,l=>o>s.depth?l(t,n,s.nodeAfter,s.before(o),i,!0):l(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function mr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Om(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&E.isSelectable(r)?(mr(t,new E(n)),!0):!1}function Dm(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof E&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(E.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(mr(t,E.create(t.state.doc,i)),!0):!1}function Rm(t,e,n,r,i){return vo(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?Dm(t,n):Om(t,n))}function Im(t,e,n,r){return vo(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Pm(t,e,n,r){return vo(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Lm(t,n,r)}function Lm(t,e,n){if(n.button!=0)return!1;let r=Ou(t,e,!0),i=t.state.doc;return r?(mr(t,r),r instanceof w&&i.eq(t.state.doc)&&(t.input.mouseDown=new zm(t,r)),!0):!1}function Ou(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?w.create(r,0,r.content.size):null;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)return w.create(r,l+1,l+1+o.content.size);if(n&&E.isSelectable(o))return E.create(r,l)}return null}function Ao(t){return _r(t)}const Du=Te?"metaKey":"ctrlKey";pe.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ao(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&Nm(n,t.input.lastClick)&&!n[Du]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let o=t.posAtCoords(pr(n));o&&(s=="singleClick"?t.input.mouseDown=new $m(t,o,n,!!r):(s=="doubleClick"?Im:Pm)(t,o.pos,o.inside,n)?n.preventDefault():Xe(t,"pointer"))};let Ru=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}};class $m extends Ru{constructor(e,n,r,i){super(e),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[Du],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof E&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ae&&!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()),Xe(e,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||et(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(pr(e))),this.updateAllowDefault(e),this.allowDefault||!n?Xe(this.view,"pointer"):Rm(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||de&&this.mightDrag&&!this.mightDrag.node.isAtom||ae&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(mr(this.view,D.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Xe(this.view,"pointer")}move(e){this.updateAllowDefault(e),Xe(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class zm extends Ru{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),Xe(this.view,"pointer");let n=this.view.posAtCoords(pr(e)),r=n&&Ou(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[o,l]=r.from<s.from?[s.to,r.from]:[s.from,r.to];mr(this.view,w.create(i,o,l))}}pe.touchstart=t=>{t.input.lastTouch=Date.now(),Ao(t),Xe(t,"pointer")};pe.touchmove=t=>{t.input.lastTouch=Date.now(),Xe(t,"pointer")};pe.contextmenu=t=>Ao(t);function Iu(t,e){return t.composing?!0:de&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Bm=Ye?5e3:-1;me.compositionstart=me.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof w&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ae&&au&&Fm(t)))t.markCursor=t.state.storedMarks||n.marks(),_r(t,!0),t.markCursor=null;else if(_r(t,!e.selection.empty),Ae&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}Pu(t,Bm)};function Fm(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}me.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Pu(t,20))};function Pu(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>_r(t),e))}function Lu(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Hm(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Dp(e.focusNode,e.focusOffset),r=Rp(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function _r(t,e=!1){if(!(Ye&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Lu(t),e||t.docView&&t.docView.dirty){let n=Mo(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Vm(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const rr=ke&&bt<15||bn&&$p<604;pe.copy=me.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=rr?null:n.clipboardData,o=r.content(),{dom:l,text:a}=To(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Vm(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function jm(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Wm(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ir(t,r.value,null,i,e):ir(t,r.textContent,r.innerHTML,i,e)},50)}function ir(t,e,n,r,i){let s=Eu(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,s||M.empty)))return!0;if(!s)return!1;let o=jm(s),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function $u(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}me.paste=(t,e)=>{let n=e;if(t.composing&&!Ye)return;let r=rr?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ir(t,$u(r),r.getData("text/html"),i,n)?n.preventDefault():Wm(t,n)};let zu=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const Km=Te?"altKey":"ctrlKey";function Bu(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[Km]}pe.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(pr(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof E?i.to-1:i.to))){if(r&&r.mightDrag)o=E.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=E.create(t.state.doc,d.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:c,slice:u}=To(t,l);(!n.dataTransfer.files.length||!ae||lu>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(rr?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",rr||n.dataTransfer.setData("text/plain",c),t.dragging=new zu(u,Bu(t,n),o)};pe.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};me.dragover=me.dragenter=(t,e)=>e.preventDefault();me.drop=(t,e)=>{try{Um(t,e,t.dragging)}finally{t.dragging=null}};function Um(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(pr(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",h=>{s=h(s,t,!1)}):s=Eu(t,$u(e.dataTransfer),rr?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&Bu(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||M.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?go(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let a=t.state.tr;if(o){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,s.content.firstChild):a.replaceRange(c,c,s),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&E.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))a.setSelection(new E(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),a.setSelection(Eo(t,f,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}pe.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&et(t)},20))};pe.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};pe.beforeinput=(t,e)=>{if(Ye&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Nt(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in me)pe[t]=me[t];function sr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}let Zl=class Fu{constructor(e,n){this.toDOM=e,this.spec=n||Ft,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new rt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Fu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&sr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Vn=class Vs{constructor(e,n){this.attrs=e,this.spec=n||Ft}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new rt(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Vs&&sr(this.attrs,e.attrs)&&sr(this.spec,e.spec)}static is(e){return e.type instanceof Vs}destroy(){}},_m=class Hu{constructor(e,n){this.attrs=e,this.spec=n||Ft}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new rt(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Hu&&sr(this.attrs,e.attrs)&&sr(this.spec,e.spec)}destroy(){}},rt=class In{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new In(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new In(e,e,new Zl(n,r))}static inline(e,n,r,i){return new In(e,n,new Vn(r,i))}static node(e,n,r,i){return new In(e,n,new _m(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Vn}get widget(){return this.type instanceof Zl}};const on=[],Ft={};let K=class ut{constructor(e,n){this.local=e.length?e:on,this.children=n.length?n:on}static create(e,n){return n.length?qr(n,e,0,Ft):ue}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,i+l,s)}}map(e,n,r){return this==ue||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Ft)}mapInner(e,n,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(n,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?qm(this.children,o||[],e,n,r,i,s):o?new ut(o.sort(Ht),on):ue}add(e,n){return n.length?this==ue?ut.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Wu(n,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,u,c+1):i.splice(s,0,a,a+l.nodeSize,qr(u,l,c+1,Ft)),s+=3}});let o=ju(s?Ku(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new ut(o.length?this.local.concat(o).sort(Ht):this.local,i||this.children)}remove(e){return e.length==0||this==ue?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+n,a=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,l+1);c!=ue?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ut(i,r):ue}forChild(e,n){if(this==ue)return this;if(n.isLeaf)return ut.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof Vn){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new ut(i.sort(Ht),on);return r?new Vu([l,r]):l}return r||ue}eq(e){if(this==e)return!0;if(!(e instanceof ut)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return No(this.localsInner(e))}localsInner(e){if(this==ue)return on;if(e.inlineContent||!this.local.some(Vn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Vn||n.push(this.local[r]);return n}forEachSet(e){e(this)}};K.empty=new K([],[]);K.removeOverlap=No;const ue=K.empty;let Vu=class ln{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Ft));return ln.from(r)}forChild(e,n){if(n.isLeaf)return K.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=ue&&(s instanceof ln?r=r.concat(s.members):r.push(s))}return ln.from(r)}eq(e){if(!(e instanceof ln)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?No(r?n:n.sort(Ht)):on}static from(e){switch(e.length){case 0:return ue;case 1:return e[0];default:return new ln(e.every(n=>n instanceof K)?e:e.reduce((n,r)=>n.concat(r instanceof K?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function qm(t,e,n,r,i,s,o){let l=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,g)=>{let m=g-p-(h-f);for(let y=0;y<l.length;y+=3){let b=l[y+1];if(b<0||f>b+u-d)continue;let S=l[y]+u-d;h>=S?l[y+1]=f<=S?-2:-1:f>=u&&m&&(l[y]+=m,l[y+1]+=m)}d+=m}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-i;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+s,-1),h=f-i,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=l[c+2].mapInner(n,m,u+1,t[c]+s+1,o);y!=ue?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Jm(l,t,e,n,i,s,o),u=qr(c,r,0,o);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new K(e.sort(Ht),l)}function ju(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new rt(i.from+e,i.to+e,i.type))}return n}function Jm(t,e,n,r,i,s,o){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,i,c);d?n.push(d):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function Wu(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function Ku(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function qr(t,e,n,r){let i=[],s=!1;e.forEach((l,a)=>{let c=Wu(t,l,a+n);if(c){s=!0;let u=qr(c,l,n+a+1,r);u!=ue&&i.push(a,a+l.nodeSize,u)}});let o=ju(s?Ku(t):t,-n).sort(Ht);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new K(o,i):ue}function Ht(t,e){return t.from-e.from||t.to-e.to}function No(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),ea(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),ea(e,i,r.copy(s.from,r.to)));break}}}return e}function ea(t,e,n){for(;e<t.length&&Ht(n,t[e])>0;)e++;t.splice(e,0,n)}function rs(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ue&&e.push(r)}),t.cursorWrapper&&e.push(K.create(t.state.doc,[t.cursorWrapper.deco])),Vu.from(e)}const Gm={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ym=ke&&bt<=11;class Xm{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Qm{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Xm,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ke&&bt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():de&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Ym&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Gm)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(_l(this.view)){if(this.suppressingSelectionUpdates)return et(this.view);if(ke&&bt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&qt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=yn(s))n.add(s);for(let s=e.anchorNode;s;s=yn(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&_l(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||ae&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Ae&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||tg(e,d)!=h)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&$i(r)&&(c=Mo(e))&&c.eq(D.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,et(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Zm(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,ng(e,a)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||et(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ke&&bt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?oe(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?oe(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ta=new WeakMap,na=!1;function Zm(t){if(!ta.has(t)&&(ta.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ae,na)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."),na=!0}}function ra(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return qt(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function eg(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return ra(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?ra(t,n):null}function tg(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function ng(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(s,l.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function rg(t,e,n,r){let{node:i,fromOffset:s,toOffset:o,from:l,to:a}=t.docView.parseRange(e,n),c=t.domSelectionRange(),u,d=c.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],$i(c)||u.push({node:c.focusNode,offset:c.focusOffset})),ae&&t.input.lastKeyCode===8)for(let y=o;y>s;y--){let b=i.childNodes[y-1],S=b.pmViewDesc;if(b.nodeName=="BR"&&!S){o=y;break}if(!S||S.size)break}let f=t.state.doc,h=t.someProp("domParser")||He.fromSchema(t.state.schema),p=f.resolve(l),g=null,m=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:ig(r),context:p});if(u&&u[0].pos!=null){let y=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=y),g={anchor:y+l,head:b+l}}return{doc:m,sel:g,from:l,to:a}}const ig=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(de&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||de&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},sg=/^(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 og(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let v=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,O=Mo(t,v);if(O&&!t.state.selection.eq(O)){if(ae&&Ye&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",_=>_(t,Nt(13,"Enter"))))return;let P=t.state.tr.setSelection(O);v=="pointer"?P.setMeta("pointer",!0):v=="key"&&P.scrollIntoView(),s&&P.setMeta("composition",s),t.dispatch(P)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=rg(t,e,n,i),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=cg(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(bn&&t.input.lastIOSEnter>Date.now()-225||Ye)&&i.some(v=>v.nodeType==1&&!sg.test(v.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",v=>v(t,Nt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof w&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let v=ia(t,t.state.doc,c.sel);if(v&&!v.eq(t.state.selection)){let O=t.state.tr.setSelection(v);s&&O.setMeta("composition",s),t.dispatch(O)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof w&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ke&&bt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let g=c.doc.resolveNoCache(p.start-c.from),m=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),b=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=p.endA;if((bn&&t.input.lastIOSEnter>Date.now()-225&&(!b||i.some(v=>v.nodeName=="DIV"||v.nodeName=="P"))||!b&&g.pos<c.doc.content.size&&(!g.sameParent(m)||!g.parent.inlineContent)&&g.pos<m.pos&&!/\S/.test(c.doc.textBetween(g.pos,m.pos,"","")))&&t.someProp("handleKeyDown",v=>v(t,Nt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&ag(u,p.start,p.endA,g,m)&&t.someProp("handleKeyDown",v=>v(t,Nt(8,"Backspace")))){Ye&&ae&&t.domObserver.suppressSelectionUpdates();return}ae&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Ye&&!b&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,m=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(v){return v(t,Nt(13,"Enter"))})},20));let S=p.start,C=p.endA,T=v=>{let O=v||t.state.tr.replace(S,C,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let P=ia(t,O.doc,c.sel);P&&!(ae&&t.composing&&P.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(P.head==S||P.head==O.mapping.map(C)-1)||ke&&P.empty&&P.head==S)&&O.setSelection(P)}return s&&O.setMeta("composition",s),O.scrollIntoView()},N;if(b)if(g.pos==m.pos){ke&&bt<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>et(t),20));let v=T(t.state.tr.delete(S,C)),O=u.resolve(p.start).marksAcross(u.resolve(p.endA));O&&v.ensureMarks(O),t.dispatch(v)}else if(p.endA==p.endB&&(N=lg(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let v=T(t.state.tr);N.type=="add"?v.addMark(S,C,N.mark):v.removeMark(S,C,N.mark),t.dispatch(v)}else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let v=g.parent.textBetween(g.parentOffset,m.parentOffset),O=()=>T(t.state.tr.insertText(v,S,C));t.someProp("handleTextInput",P=>P(t,S,C,v,O))||t.dispatch(O())}else t.dispatch(T());else t.dispatch(T())}function ia(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Eo(t,e.resolve(n.anchor),e.resolve(n.head))}function lg(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,l,a;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(k.from(c).eq(t))return{mark:l,type:o}}function ag(t,e,n,r,i){if(n-e<=i.pos-r.pos||is(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(is(s,!0,!0));return!o.parent.isTextblock||o.pos>n||is(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function is(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function cg(t,e,n,r,i){let s=t.findDiffStart(e,n),o=n+t.size,l=n+e.size;if(s==null)return null;let{a,b:c}=t.findDiffEnd(e,o,l);if(i=="end"){let u=Math.max(0,s-Math.min(a,c));r-=a+u-s}if(a<s&&o<l){let u=r<=s&&r>=a?s-r:0;s-=u,c=s+(c-a),a=s}else if(c<s){let u=r<=s&&r>=c?s-r:0;s-=u,a=s+(a-c),c=s}return{start:s,endA:a,endB:c}}class Uu{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Em,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ca),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=la(this),oa(this),this.nodeViews=aa(this),this.docView=Hl(this.state.doc,sa(this),rs(this),this.dom,this),this.domObserver=new Qm(this,(r,i,s,o)=>og(this,r,i,s,o)),this.domObserver.start(),Tm(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Hs(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ca),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Lu(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=aa(this);dg(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Hs(this),this.editable=la(this),oa(this);let a=rs(this),c=sa(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(i.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Fp(this);if(o){this.domObserver.stop();let h=d&&(ke||ae)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ug(i.selection,e.selection);if(d){let g=ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Hm(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Hl(e.doc,c,a,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let p=this.input.mouseDown;h||!(p&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&cm(this)&&p.delaySelUpdate())?et(this,h):(xu(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Hp(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof E){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Ll(this,n.getBoundingClientRect(),e)}else Ll(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new zu(e.slice,e.move,i<0?void 0:E.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=n?n(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(ke){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&&Vp(this.dom),et(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return _p(this,e)}coordsAtPos(e,n=1){return hu(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Xp(this,n||this.state,e)}pasteHTML(e,n){return ir(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ir(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return To(this,e)}destroy(){this.docView&&(wm(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],rs(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Np())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Am(this,e)}domSelectionRange(){let e=this.domSelection();return e?de&&this.root.nodeType===11&&Pp(this.dom.ownerDocument)==this.dom&&eg(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Uu.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function sa(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[rt.node(0,t.state.doc.content.size,e)]}function oa(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:rt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function la(t){return!t.someProp("editable",e=>e(t.state)===!1)}function ug(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function aa(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function dg(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function ca(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ct={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:"'"},Jr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},fg=typeof navigator<"u"&&/Mac/.test(navigator.platform),hg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var le=0;le<10;le++)Ct[48+le]=Ct[96+le]=String(le);for(var le=1;le<=24;le++)Ct[le+111]="F"+le;for(var le=65;le<=90;le++)Ct[le]=String.fromCharCode(le+32),Jr[le]=String.fromCharCode(le);for(var ss in Ct)Jr.hasOwnProperty(ss)||(Jr[ss]=Ct[ss]);function pg(t){var e=fg&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||hg&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Jr:Ct)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const mg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),gg=typeof navigator<"u"&&/Win/.test(navigator.platform);function yg(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))mg?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function bg(t){let e=Object.create(null);for(let n in t)e[yg(n)]=t[n];return e}function ls(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function kg(t){return new B({props:{handleKeyDown:_u(t)}})}function _u(t){let e=bg(t);return function(n,r){let i=pg(r),s,o=e[ls(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[ls(i,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(gg&&r.ctrlKey&&r.altKey)&&(s=Ct[r.keyCode])&&s!=i){let l=e[ls(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}function Bi(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var hn=class qu{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(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l=[],a=!!e,c=e||s.tr,u=()=>(!a&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...g)=>{const m=this.buildProps(c,n),y=h(...g)(m);return l.push(y),d}])),run:u};return d}static createFakeChain(){const e=new Proxy({},{get:(n,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}static createFallbackCan(){const e=qu.createFakeChain();return new Proxy({chain:()=>e},{get:(n,r)=>{if(r!=="then")return r==="chain"?n.chain:()=>!1}})}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l={tr:e,editor:i,view:o,state:Bi({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}};const Sg=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{if(!t.isDestroyed){var n;e.dom.blur(),(n=window)===null||n===void 0||(n=n.getSelection())===null||n===void 0||n.removeAllRanges()}}),!0),xg=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Cg=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=Mn(h);if(l.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},Mg=t=>e=>t(e),Eg=()=>({state:t,dispatch:e})=>nu(t,e),Tg=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new w(r.doc.resolve(Math.max(o-1,0)))),!0},wg=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const o=i.before(s),l=i.after(s);t.delete(o,l).scrollIntoView()}return!0}return!1};function Q(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}const vg=t=>({tr:e,state:n,dispatch:r})=>{const i=Q(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),a=s.after(o);e.delete(l,a).scrollIntoView()}return!0}return!1},Ag=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},Ng=t=>t.content?/^text(\*|\+)/.test(t.content):!1,ua=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return Ng(r)?n==="left"?t.start()-1:t.end()+1:t.pos},Og=(t,e,n)=>({from:ua(t,n,"left"),to:ua(e,n,"right")}),Dg=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,i=n.steps.length;r.forEach(s=>{const o=n.mapping.slice(i),l=n.doc.resolve(o.map(s.$from.pos)),a=n.doc.resolve(o.map(s.$to.pos)),{from:c,to:u}=Og(l,a,t.schema);n.deleteRange(c,u)}),n.selection.empty||n.setSelection(w.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},Rg=()=>({commands:t})=>t.keyboardShortcut("Enter"),Ig=()=>({state:t,dispatch:e})=>pp(t,e);function Oo(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Gr(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Oo(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Ju(t,e,n={}){return t.find(r=>r.type===e&&Gr(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function da(t,e,n={}){return!!Ju(t,e,n)}function Do(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(a=>a.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(a=>a.type===e))return;if(!n){const a=r.node.marks.find(c=>c.type===e);a&&(n=a.attrs)}if(!Ju([...r.node.marks],e,n))return;let i=r.index,s=t.start()+r.offset,o=i+1,l=s+r.node.nodeSize;for(;i>0&&da([...t.parent.child(i-1).marks],e,n);)i-=1,s-=t.parent.child(i).nodeSize;for(;o<t.parent.childCount&&da([...t.parent.child(o).marks],e,n);)l+=t.parent.child(o).nodeSize,o+=1;return{from:s,to:l}}function it(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const Pg=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=it(t,r.schema),{doc:o,selection:l}=n,{$from:a,from:c,to:u}=l;if(i){const d=Do(a,s,e);if(d&&d.from<=c&&d.to>=u){const f=w.create(o,d.from,d.to);n.setSelection(f)}}return!0},Lg=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Ro(t){return t instanceof w}function Qe(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function js(t,e=null){if(!e)return null;const n=D.atStart(t),r=D.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?w.create(t,Qe(0,i,s),Qe(t.content.size,i,s)):w.create(t,Qe(e,i,s),Qe(e,i,s))}function Ws(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function or(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function $g(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const zg=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(or()||Ws())&&r.dom.focus(),$g()&&!or()&&!Ws()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!Ro(n.state.selection))return o(),!0;const l=js(i.doc,t)||n.state.selection,a=n.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Bg=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Fg=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Gu=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Gu(r)}return t};function Pn(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Gu(n)}function Yu(t){return typeof t?.nodesBetween=="function"}function kn(t,e,n){if(Yu(t))return t;const r=typeof t=="object"&&t!==null;n={slice:!0,parseOptions:{},...n};const i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return k.fromArray(t.map(o=>e.nodeFromJSON(o)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),kn("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,l="";const a=new Nc({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?He.fromSchema(a).parseSlice(Pn(t),n.parseOptions):He.fromSchema(a).parse(Pn(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=He.fromSchema(e);return n.slice?s.parseSlice(Pn(t),n.parseOptions).content:s.parse(Pn(t),n.parseOptions)}return kn("",e,n)}function Xu(t){return!("type"in t)}function Qu(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof q||i instanceof ee))return;const s=t.mapping.maps[r];let o=0;s.forEach((l,a,c,u)=>{o===0&&(o=u)}),t.setSelection(D.near(t.doc.resolve(o),n))}const Hg=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=m=>{s.emit("contentError",{editor:s,error:m,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{kn(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(m){a(m)}try{var o;l=kn(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(m){return a(m),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;const p=Xu(l)?l.content:[l];if(p.forEach(m=>{m.check(),f=f?m.isText&&m.marks.length===0:!1,h=h?m.isBlock:!1}),u===d&&h){const{parent:m}=r.doc.resolve(u);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(u-=1,d+=1)}let g;if(f)Array.isArray(e)?g=e.map(m=>m.text||"").join(""):Yu(e)?g=p.map(m=>{var y;return(y=m.text)!==null&&y!==void 0?y:""}).join(""):typeof e=="object"&&e&&e.text?g=e.text:g=e,r.insertText(g,u,d);else{g=k.from(p);const m=r.doc.resolve(u),y=m.node(),b=m.parentOffset===0,S=y.isText||y.isTextblock,C=y.content.size>0;b&&S&&C&&h&&(u=Math.max(0,u-1)),r.replaceWith(u,d,p)}n.updateSelection&&Qu(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0};function Zu(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Vg=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:i,attrs:s,content:o,updateSelection:l=!0}=t;let a;typeof i=="number"?a=e.doc.resolve(i):i?a=i:a=e.selection.$from;const c=Zu(a.parent.contentMatchAt(a.index()));if(!c)return!1;const u=Object.keys(c.spec.attrs||{}),d=s?Object.fromEntries(Object.entries(s).filter(([h])=>u.includes(h))):{};let f;if(o){const h=kn(o,r.schema);f=c.createAndFill(d,h)}else f=c.createAndFill(d);return f?(n&&(e.insert(a.pos,f),l&&Qu(e,e.steps.length-1,-1)),!0):!1},jg=()=>({state:t,dispatch:e})=>dp(t,e),Wg=()=>({state:t,dispatch:e})=>fp(t,e),Kg=()=>({state:t,dispatch:e})=>Gc(t,e),Ug=()=>({state:t,dispatch:e})=>Zc(t,e),_g=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ii(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},qg=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ii(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Jg=()=>({state:t,dispatch:e})=>cp(t,e),Gg=()=>({state:t,dispatch:e})=>up(t,e);function ed(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Yg(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))or()||ed()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const Xg=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=Yg(t).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function tt(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?Q(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(u,d)=>{if(u.isText)return;const f=Math.max(r,d),h=Math.min(i,d+u.nodeSize);l.push({node:u,from:f,to:h})});const a=i-r,c=l.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>Gr(u.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=a}const Qg=(t,e={})=>({state:n,dispatch:r})=>tt(n,Q(t,n.schema),e)?hp(n,r):!1,Zg=()=>({state:t,dispatch:e})=>ru(t,e),ey=t=>({state:e,dispatch:n})=>{const r=Q(t,e.schema);return Tp(r)(e,n)},ty=()=>({state:t,dispatch:e})=>tu(t,e);function Fi(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function fa(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const ny=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=Fi(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=Q(t,r.schema)),l==="mark"&&(o=it(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{s&&s===u.type&&(a=!0,i&&n.setNodeMarkup(d,void 0,fa(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&(a=!0,i&&n.addMark(d,d+u.nodeSize,o.create(fa(f.attrs,e))))})})}),a},ry=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),iy=()=>({tr:t,dispatch:e})=>{if(e){const n=new be(t.doc);t.setSelection(n)}return!0},sy=()=>({state:t,dispatch:e})=>Xc(t,e),oy=()=>({state:t,dispatch:e})=>eu(t,e),ly=()=>({state:t,dispatch:e})=>yp(t,e),ay=()=>({state:t,dispatch:e})=>Sp(t,e),cy=()=>({state:t,dispatch:e})=>kp(t,e);function Ks(t,e,n={},r={}){return kn(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const uy=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{const{doc:a}=s;if(r.preserveWhitespace!=="full"){const c=Ks(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});if(o){const u=Xu(c)?c.content:[c];s.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!n)}return!0}return o&&s.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function td(t,e){const n=it(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function nd(t,e){const n=new Kc(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function dy(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function fy(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Hi(t){return e=>fy(e.$from,t)}function A(t,e,n){return t.config[e]===void 0&&t.parent?A(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?A(t.parent,e,n):null}):t.config[e]}function Io(t){return t.map(e=>{const n=A(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return n?[e,...Io(n())]:e}).flat(10)}function Po(t,e){const n=nt.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function rd(t){return typeof t=="function"}function L(t,e=void 0,...n){return rd(t)?e?t.bind(e)(...n):t(...n):t}function hy(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Sn(t){return{baseExtensions:t.filter(e=>e.type==="extension"),nodeExtensions:t.filter(e=>e.type==="node"),markExtensions:t.filter(e=>e.type==="mark")}}function id(t){const e=[],{nodeExtensions:n,markExtensions:r}=Sn(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...o,...l];return t.forEach(c=>{const u=A(c,"addGlobalAttributes",{name:c.name,options:c.options,storage:c.storage,extensions:i});u&&u().forEach(d=>{let f;Array.isArray(d.types)?f=d.types:d.types==="*"?f=a:d.types==="nodes"?f=o:d.types==="marks"?f=l:f=[],f.forEach(h=>{Object.entries(d.attributes).forEach(([p,g])=>{e.push({type:h,name:p,attribute:{...s,...g}})})})})}),i.forEach(c=>{const u=A(c,"addAttributes",{name:c.name,options:c.options,storage:c.storage});if(!u)return;const d=u();Object.entries(d).forEach(([f,h])=>{const p={...s,...h};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:c.name,name:f,attribute:p})})}),e}function py(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let l=0;l<o;l+=1){const a=t[l];if(a==="'"&&!i){r=!r,n+=a;continue}if(a==='"'&&!r){i=!i,n+=a;continue}if(!r&&!i){if(a==="("){s+=1,n+=a;continue}if(a===")"&&s>0){s-=1,n+=a;continue}if(a===";"&&s===0){e.push(n),n="";continue}}n+=a}return n&&e.push(n),e}function ha(t){const e=[],n=py(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],o=s.indexOf(":");if(o===-1)continue;const l=s.slice(0,o).trim(),a=s.slice(o+1).trim();l&&a&&e.push([l,a])}return e}function Y(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(i==="__proto__"){Object.defineProperty(r,i,{configurable:!0,enumerable:!0,value:s,writable:!0});return}if(!r[i]){r[i]=s;return}if(i==="class"){const o=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],a=o.filter(c=>!l.includes(c));r[i]=[...l,...a].join(" ")}else if(i==="style"){const o=new Map([...ha(r[i]),...ha(s)]);r[i]=Array.from(o.entries()).map(([l,a])=>`${l}: ${a}`).join("; ")}else r[i]=s}),r},{})}function xn(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Y(n,r),{})}function my(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function pa(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):my(n.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}}}}function ma(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&hy(n)?!1:n!=null))}function ga(t){var e,n;const r={};return!(!(t==null||(e=t.attribute)===null||e===void 0)&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),(t==null||(n=t.attribute)===null||n===void 0?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function sd(t,e){var n;const r=id(t),{nodeExtensions:i,markExtensions:s}=Sn(t),o=(n=i.find(c=>A(c,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(i.map(c=>{const u=r.filter(m=>m.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=ma({...t.reduce((m,y)=>{const b=A(y,"extendNodeSchema",d);return{...m,...b?b(c):{}}},{}),content:L(A(c,"content",d)),marks:L(A(c,"marks",d)),group:L(A(c,"group",d)),inline:L(A(c,"inline",d)),atom:L(A(c,"atom",d)),selectable:L(A(c,"selectable",d)),draggable:L(A(c,"draggable",d)),code:L(A(c,"code",d)),whitespace:L(A(c,"whitespace",d)),linebreakReplacement:L(A(c,"linebreakReplacement",d)),defining:L(A(c,"defining",d)),isolating:L(A(c,"isolating",d)),attrs:Object.fromEntries(u.map(ga))}),h=L(A(c,"parseHTML",d));h&&(f.parseDOM=h.map(m=>pa(m,u)));const p=A(c,"renderHTML",d);p&&(f.toDOM=m=>p({node:m,HTMLAttributes:xn(m,u)}));const g=A(c,"renderText",d);return g&&(f.toText=g),[c.name,f]})),a=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=ma({...t.reduce((g,m)=>{const y=A(m,"extendMarkSchema",d);return{...g,...y?y(c):{}}},{}),inclusive:L(A(c,"inclusive",d)),excludes:L(A(c,"excludes",d)),group:L(A(c,"group",d)),spanning:L(A(c,"spanning",d)),code:L(A(c,"code",d)),attrs:Object.fromEntries(u.map(ga))}),h=L(A(c,"parseHTML",d));h&&(f.parseDOM=h.map(g=>pa(g,u)));const p=A(c,"renderHTML",d);return p&&(f.toDOM=g=>p({mark:g,HTMLAttributes:xn(g,u)})),[c.name,f]}));return new Nc({topNode:o,nodes:l,marks:a})}function gy(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function jn(t){return t.sort((n,r)=>{const i=A(n,"priority")||100,s=A(r,"priority")||100;return i>s?-1:i<s?1:0})}function Lo(t){const e=jn(Io(t)),n=gy(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function yy(t,e){return sd(Lo(t),e)}function Sx(t,e){const n=yy(e),r=Pn(t);return He.fromSchema(n).parse(r).toJSON()}function od(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
11
+
12
+ `,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,i,(a,c,u,d)=>{a.isBlock&&c>r&&(l+=s);const f=o?.[a.type.name];if(f)return u&&(l+=f({node:a,pos:c,parent:u,index:d,range:e})),!1;if(a.isText){var h;l+=a==null||(h=a.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,i-c)}}),l}function by(t,e){return od(t,{from:0,to:t.content.size},e)}function ld(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function ky(t,e){const n=Q(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function ad(t,e){const n=Fi(typeof e=="string"?e:e.name,t.schema);return n==="node"?ky(t,e):n==="mark"?td(t,e):{}}function Sy(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function xy(t){const e=Sy(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Vi(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=n[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(s).map(l,-1),u=e.slice(s).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),xy(r)}function $o(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=Do(n.resolve(t),i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}const Cy=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,o=null;for(;s>0&&o===null;){const l=i.node(s);l?.type.name===e?o=l:s-=1}return[o,s]},My=t=>{const e=t.depth-1;if(e<0)return null;const n=t.index(e);return n===0?null:t.node(e).child(n-1)};function nn(t,e){return e.nodes[t]||e.marks[t]||null}function zr(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}const Ey=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,c;const u=((a=(c=i.type.spec).toText)===null||a===void 0?void 0:a.call(c,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-s))}),n};function Us(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?it(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>s?s.name===u.type.name:!0).find(u=>Gr(u.attrs,n,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:u,$to:d})=>{const f=u.pos,h=d.pos;t.doc.nodesBetween(f,h,(p,g)=>{if(s&&p.inlineContent&&!p.type.allowsMarkType(s))return!1;if(!p.isText&&!p.marks.length)return;const m=Math.max(f,g),y=Math.min(h,g+p.nodeSize),b=y-m;o+=b,l.push(...p.marks.map(S=>({mark:S,from:m,to:y})))})}),o===0)return!1;const a=l.filter(u=>s?s.name===u.mark.type.name:!0).filter(u=>Gr(u.mark.attrs,n,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=l.filter(u=>s?u.mark.type!==s&&u.mark.type.excludes(s):!0).reduce((u,d)=>u+d.to-d.from,0);return(a>0?a+c:a)>=o}function Ty(t,e,n={}){if(!e)return tt(t,null,n)||Us(t,null,n);const r=Fi(e,t.schema);return r==="node"?tt(t,e,n):r==="mark"?Us(t,e,n):!1}const wy=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=Hi(l=>l.type.name===e)(t.selection);if(!s)return!1;const o=t.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},vy=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function ya(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function as(t,e){const{nodeExtensions:n}=Sn(e),r=n.find(s=>s.name===t);if(!r)return!1;const i=L(A(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof i!="string"?!1:i.split(" ").includes("list")}function gr(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){if(n){if(t.type.name==="hardBreak")return!0;if(t.isText){var r;return!/\S/.test((r=t.text)!==null&&r!==void 0?r:"")}}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(gr(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function cd(t){return t instanceof E}function Ay({selection:t,pos:e,nodeSize:n,selectedOnTextSelection:r=!1}){const{from:i,to:s}=t;return!!(i<=e&&s>=e+n||r&&Ro(t)&&i>e&&s<e+n)}var ud=class dd{constructor(e){this.position=e}static fromJSON(e){return new dd(e.position)}toJSON(){return{position:this.position}}};function Ny(t,e){const n=e.mapping.mapResult(t.position);return{position:new ud(n.pos),mapResult:n}}function Oy(t){return new ud(t)}function xx(t,e,n){const i=t.state.doc.content.size,s=Qe(e,0,i),o=Qe(n,0,i),l=t.coordsAtPos(s),a=t.coordsAtPos(o,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),f=Math.max(l.right,a.right),h={top:c,bottom:u,left:d,right:f,width:f-d,height:u-c,x:d,y:c};return{...h,toJSON:()=>h}}function Dy(t,e,n){const{selection:r}=e;let i=null;if(Ro(r)&&(i=r.$cursor),i){var s;const l=(s=t.storedMarks)!==null&&s!==void 0?s:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(a=>a.type.excludes(n)))}const{ranges:o}=r;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=h&&p}return!c}),c})}const Ry=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:l}=s,a=it(t,r.schema);if(i)if(o){const c=td(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),g=Math.min(h+f.nodeSize,d);f.marks.find(m=>m.type===a)?f.marks.forEach(m=>{a===m.type&&n.addMark(p,g,a.create({...m.attrs,...e}))}):n.addMark(p,g,a.create(e))})});return Dy(r,n,a)},Iy=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Py=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Q(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>Rl(s,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Rl(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Ly=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Qe(t,0,r.content.size),s=E.create(r,i);e.setSelection(s)}return!0},$y=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=s.from,l=s.to),i&&n.doc.nodesBetween(o,l,(a,c)=>{a.isText||n.setNodeMarkup(c,void 0,{...a.attrs,dir:t})}),!0},zy=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=w.atStart(r).from,l=w.atEnd(r).to,a=Qe(i,o,l),c=Qe(s,o,l),u=w.create(r,a,c);e.setSelection(u)}return!0},By=t=>({state:e,dispatch:n})=>{const r=Q(t,e.schema);return Ap(r)(e,n)};function ba(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const Fy=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,c=i.extensionManager.attributes,u=zr(c,l.node().type.name,l.node().attrs);if(s instanceof E&&s.node.isBlock)return!l.parentOffset||!Ze(o,l.pos)?!1:(r&&(t&&ba(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:Zu(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Ze(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Ze(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(s instanceof w&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),m=e.doc.resolve(g);l.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&ba(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},Hy=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{const o=Q(t,r.schema),{$from:l,$to:a}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const u=l.node(-1);if(u.type!==o)return!1;const d=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){var f;let y=k.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let O=l.depth-b;O>=l.depth-3;O-=1)y=k.from(l.node(O).copy(y));const S=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,C={...zr(d,l.node().type.name,l.node().attrs),...e},T=((f=o.contentMatch.defaultType)===null||f===void 0?void 0:f.createAndFill(C))||void 0;y=y.append(k.from(o.createAndFill(null,T)||void 0));const N=l.before(l.depth-(b-1));n.replace(N,l.after(-S),new M(y,4-b,0));let v=-1;n.doc.nodesBetween(N,n.doc.content.size,(O,P)=>{if(v>-1)return!1;O.isTextblock&&O.content.size===0&&(v=P+1)}),v>-1&&n.setSelection(w.near(n.doc.resolve(v))),n.scrollIntoView()}return!0}const h=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...zr(d,u.type.name,u.attrs),...e},g={...zr(d,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,a.pos);const m=h?[{type:o,attrs:p},{type:h,attrs:g}]:[{type:o,attrs:p}];if(!Ze(n.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:b}=r,{splittableMarks:S}=s.extensionManager,C=b||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,m).scrollIntoView(),!C||!i)return!0;const T=C.filter(N=>S.includes(N.type.name));n.ensureMarks(T)}return!0};function ka(t){return!t||t==="1"?null:t}function fd(t,e){return ka(t)===ka(e)}const cs=(t,e)=>{const n=Hi(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Et(t.doc,n.pos))||!fd(n.node.attrs.type,i?.attrs.type)||t.join(n.pos),!0},us=(t,e)=>{const n=Hi(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Et(t.doc,r))||!fd(n.node.attrs.type,i?.attrs.type)||t.join(r),!0};function Vy(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return w.between(r,i)}const jy=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=Q(t,o.schema),p=Q(e,o.schema),{selection:g,storedMarks:m}=o,{$from:y,$to:b}=g,S=y.blockRange(b),C=m||g.$to.parentOffset&&g.$from.marks();if(!S)return!1;const T=Hi(H=>as(H.type.name,d))(g),N=g.from===0&&g.to===o.doc.content.size,v=o.doc.content.content,O=v.length===1?v[0]:null,P=N&&O&&as(O.type.name,d)?{node:O,pos:0}:null,_=T??P,ne=!!T&&S.depth>=1&&S.depth-T.depth<=1,ce=!!P;if((ne||ce)&&_){if(_.node.type===h)return N&&ce?a().command(({tr:H,dispatch:J})=>{const V=Vy(H);return V?(H.setSelection(V),J&&J(H),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(as(_.node.type.name,d)&&h.validContent(_.node.content))return a().command(()=>(s.setNodeMarkup(_.pos,h),!0)).command(()=>cs(s,h)).command(()=>us(s,h)).run()}return!n||!C||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>cs(s,h)).command(()=>us(s,h)).run():a().command(()=>{const H=u().wrapInList(h,r),J=C.filter(V=>f.includes(V.type.name));return s.ensureMarks(J),H?!0:c.clearNodes()}).wrapInList(h,r).command(()=>cs(s,h)).command(()=>us(s,h)).run()},Wy=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=it(t,r.schema);return Us(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Ky=(t,e,n={})=>({state:r,commands:i})=>{const s=Q(t,r.schema),o=Q(e,r.schema),l=tt(r,s,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(o,a):i.setNode(s,{...a,...n})},Uy=(t,e={})=>({state:n,commands:r})=>{const i=Q(t,n.schema);return tt(n,i,e)?r.lift(i):r.wrapIn(i,e)},_y=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},qy=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:i=!1}=t,{selection:s}=e,{empty:o,ranges:l}=s;if(o)return!0;const{nonClearableMarks:a}=r.extensionManager;if(n){const c=Object.values(r.schema.marks).filter(u=>i||!a.includes(u.name));l.forEach(u=>{for(const d of c)e.removeMark(u.$from.pos,u.$to.pos,d)})}return!0},Jy=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{extendEmptyMarkRange:s=!1}=e,{selection:o}=n,l=it(t,r.schema),{$from:a,empty:c,ranges:u}=o;if(!i)return!0;if(c&&s){var d;let{from:f,to:h}=o;const p=Do(a,l,(d=a.marks().find(g=>g.type===l))===null||d===void 0?void 0:d.attrs);p&&(f=p.from,h=p.to),n.removeMark(f,h,l)}else u.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},Gy=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(l,a)=>{if(l.isText)return;const c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},Yy=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=Fi(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=Q(t,r.schema)),l==="mark"&&(o=it(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let f,h,p,g;n.selection.empty?r.doc.nodesBetween(u,d,(m,y)=>{s&&s===m.type&&(a=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m)}):r.doc.nodesBetween(u,d,(m,y)=>{y<u&&s&&s===m.type&&(a=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m),y>=u&&y<=d&&(s&&s===m.type&&(a=!0,i&&n.setNodeMarkup(y,void 0,{...m.attrs,...e})),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type&&(a=!0,i)){const S=Math.max(y,u),C=Math.min(y+m.nodeSize,d);n.addMark(S,C,o.create({...b.attrs,...e}))}}))}),h&&(f!==void 0&&i&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&i&&n.addMark(p,g,o.create({...m.attrs,...e}))}))}),a},an=new X("__tiptap_decorations__"),Xy=t=>({tr:e,dispatch:n})=>(n&&e.setMeta(an,{type:"force",name:t}),!0),Qy=(t,e={})=>({state:n,dispatch:r})=>{const i=Q(t,n.schema);return xp(i,e)(n,r)},Zy=(t,e={})=>({state:n,dispatch:r})=>{const i=Q(t,n.schema);return Cp(i,e)(n,r)};var e0=hh({blur:()=>Sg,clearContent:()=>xg,clearNodes:()=>Cg,command:()=>Mg,createParagraphNear:()=>Eg,cut:()=>Tg,deleteCurrentNode:()=>wg,deleteNode:()=>vg,deleteRange:()=>Ag,deleteSelection:()=>Dg,enter:()=>Rg,exitCode:()=>Ig,extendMarkRange:()=>Pg,first:()=>Lg,focus:()=>zg,forEach:()=>Bg,insertContent:()=>Fg,insertContentAt:()=>Hg,insertDefaultBlock:()=>Vg,joinBackward:()=>Kg,joinDown:()=>Wg,joinForward:()=>Ug,joinItemBackward:()=>_g,joinItemForward:()=>qg,joinTextblockBackward:()=>Jg,joinTextblockForward:()=>Gg,joinUp:()=>jg,keyboardShortcut:()=>Xg,lift:()=>Qg,liftEmptyBlock:()=>Zg,liftListItem:()=>ey,newlineInCode:()=>ty,resetAttributes:()=>ny,scrollIntoView:()=>ry,selectAll:()=>iy,selectNodeBackward:()=>sy,selectNodeForward:()=>oy,selectParentNode:()=>ly,selectTextblockEnd:()=>ay,selectTextblockStart:()=>cy,setContent:()=>uy,setMark:()=>Ry,setMeta:()=>Iy,setNode:()=>Py,setNodeSelection:()=>Ly,setTextDirection:()=>$y,setTextSelection:()=>zy,sinkListItem:()=>By,splitBlock:()=>Fy,splitListItem:()=>Hy,toggleList:()=>jy,toggleMark:()=>Wy,toggleNode:()=>Ky,toggleWrap:()=>Uy,undoInputRule:()=>_y,unsetAllMarks:()=>qy,unsetMark:()=>Jy,unsetTextDirection:()=>Gy,updateAttributes:()=>Yy,updateDecorations:()=>Xy,wrapIn:()=>Qy,wrapInList:()=>Zy});const vn=new WeakMap;function t0(t,e){var n;vn.set(t,((n=vn.get(t))!==null&&n!==void 0?n:0)+1);try{return e()}finally{var r;const i=((r=vn.get(t))!==null&&r!==void 0?r:1)-1;i>0?vn.set(t,i):vn.delete(t)}}var n0=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function r0(t){return t.kind==="widget"}function hd(t,e){const n=[],r=new Set;for(const i of t)i.kind==="widget"&&r0(i)&&r.add(i.key),n.push(i.toPMDecoration(e));return{decorations:n,widgetKeys:r}}function i0(t,e,n){const{decorations:r,widgetKeys:i}=hd(e,n);return{set:K.create(t,r),widgetKeys:i}}function pd({position:t,from:e,to:n,docSize:r}){return t<e?!1:t<n?!0:t===n&&n===r}function s0({decorations:t,from:e,to:n,docSize:r,extensionName:i,warnedExtensions:s}){return t.filter(o=>pd({position:o.anchor,from:e,to:n,docSize:r})?!0:(o.anchor===n||s.has(i)||(s.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${e}, ${n}). It was ignored.`)),!1))}function o0(t){var e;const n=(e=t.spec)===null||e===void 0?void 0:e.key;return typeof n=="string"?n:void 0}function md(t){return t.jsonID==="attr"}function l0(t){let e=!1;if(t.getMap().forEach(()=>{e=!0}),e||md(t))return!0;const n=t;return typeof n.from=="number"&&typeof n.to=="number"}function a0(t,e){let n=null,r=0,i=0;for(let s=0;s<t.childCount&&!(i>e.to);s+=1){const o=i+t.child(s).nodeSize;o>=e.from&&(n===null&&(n=i),r=o),i=o}return n===null?null:{from:n,to:r}}function c0(t,e){if(t.steps.some(s=>!l0(s)))return{type:"full"};const n=Vi(t).map(({newRange:s})=>s);t.steps.forEach((s,o)=>{if(!md(s))return;const l=t.mapping.slice(o);n.push({from:l.map(s.pos,-1),to:l.map(s.pos+1)})});const r=[];for(const s of n){const o=a0(e,s);o&&r.push(o)}r.sort((s,o)=>s.from-o.from);const i=[];for(const s of r){const o=i[i.length-1];o&&s.from<=o.to?o.to=Math.max(o.to,s.to):i.push({...s})}return{type:"ranges",ranges:i}}function gd(t,e,n,r){return t.map(e,n,{onRemove:i=>{const s=i?.key;typeof s=="string"&&r.delete(s)}})}function u0(t,e,n){var r,i;const s=(r=e.decorationSetsByExtension[t])!==null&&r!==void 0?r:K.empty,o=new Set((i=e.widgetKeysByExtension[t])!==null&&i!==void 0?i:[]);return{set:gd(s,n.mapping,n.doc,o),widgetKeys:o}}function Sa(t,e){const n=Object.values(e).flatMap(r=>r.find());return K.create(t,n)}function xa(t){const e=new Set;for(const n of Object.values(t))for(const r of n)e.add(r);return e}function d0(t,e){var n;switch((n=e.update)!==null&&n!==void 0?n:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${t}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${t}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function f0(t,e,n){return n?!0:t.update==="manual"?!1:t.shouldUpdate?t.shouldUpdate(e):e.tr.docChanged}const h0=new Set;var p0=class{constructor(t){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const n=an.getState(e);n&&this.warnDuplicateWidgetKeys(n)},this.editor=t.editor,this.entries=this.resolveEntries(t.entries),this.entries.forEach(({name:e,spec:n})=>d0(e,n)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var t,e;return(t=(e=an.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&t!==void 0?t:h0}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(t){const e=[];for(const{name:n,addDecorations:r}of t){const i=r();i&&e.push({name:n,spec:i})}return e}createPlugin(){const{editor:t,entries:e}=this;return new B({key:an,state:{init:(n,r)=>{const i={},s={};for(const{name:l,spec:a}of e){const{set:c,widgetKeys:u}=this.buildFullSet(l,a,r);i[l]=c,s[l]=u}const o={decorationSetsByExtension:i,widgetKeysByExtension:s,mergedDecorationSet:this.buildMergedSet(r.doc,i),widgetKeys:xa(s)};return this.warnDuplicateWidgetKeys(o),o},apply:(n,r,i,s)=>{const o=n.getMeta(an),l=o?.type==="force"&&!o.name,a=o?.type==="force"?o.name:void 0,c={},u={},d=new Set;return t0(t,()=>{for(const{name:f,spec:h}of e){const p=l||a===f;if(f0(h,{editor:t,tr:n,oldState:i,newState:s},p))if(h.update==="changedRanges"&&n.docChanged&&!p){const g=this.applyChangedRangesRecompute(f,h,r,n,s);c[f]=g.set,u[f]=g.widgetKeys,d.add(f)}else{const{set:g,widgetKeys:m}=this.buildFullSet(f,h,s);c[f]=g,u[f]=m,d.add(f)}else{const g=u0(f,r,n);c[f]=g.set,u[f]=g.widgetKeys}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:c,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:n,decorationSetsByExtension:c,recomputedNames:d}),widgetKeys:xa(u)}}},props:{decorations(n){var r,i;return(r=(i=an.getState(n))===null||i===void 0?void 0:i.mergedDecorationSet)!==null&&r!==void 0?r:K.empty}}})}applyChangedRangesRecompute(t,e,n,r,i){const s=c0(r,i.doc);return s.type==="full"?this.buildFullSet(t,e,i):this.rebuildRanges(t,e,n,r,i,s.ranges)}rebuildRanges(t,e,n,r,i,s){var o,l;const a=(o=n.decorationSetsByExtension[t])!==null&&o!==void 0?o:K.empty,c=new Set((l=n.widgetKeysByExtension[t])!==null&&l!==void 0?l:[]);let u=gd(a,r.mapping,r.doc,c);const d=i.doc.content.size;for(const{from:f,to:h}of s){const p=u.find(f,h).filter(y=>pd({position:y.from,from:f,to:h,docSize:d}));for(const y of p){const b=o0(y);b&&c.delete(b)}u=u.remove(p);const{decorations:g,widgetKeys:m}=hd(s0({decorations:this.runCreate(t,"createInRange",()=>e.createInRange({editor:this.editor,state:i,view:this.mountedView,from:f,to:h})),from:f,to:h,docSize:d,extensionName:t,warnedExtensions:this.warnedOutOfRangeExtensions}),t);u=u.add(i.doc,g);for(const y of m)c.add(y)}return{set:u,widgetKeys:c}}buildFullSet(t,e,n){const r=this.runCreate(t,"create",()=>e.create({editor:this.editor,state:n,view:this.mountedView}));return i0(n.doc,r,t)}runCreate(t,e,n){try{return n()}catch(r){return console.error(`[tiptap error]: Extension "${t}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(t){}buildMergedSet(t,e){const n=Object.keys(e);return n.length===1?e[n[0]]:Sa(t,e)}mergeAfterApply({entries:t,previous:e,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return t.length===1?r[t[0].name]:i.size===0?e.mergedDecorationSet.map(n.mapping,n.doc):Sa(n.doc,r)}};function m0(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&Object.is(t[i],e[i]))}function g0(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof E){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function y0(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}function Cx(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function Mx(t,e){const n=t.getAttribute("style");if(!n)return null;const r=n.split(";").map(s=>s.trim()).filter(Boolean),i=e.toLowerCase();for(let s=r.length-1;s>=0;s-=1){const o=r[s],l=o.indexOf(":");if(l!==-1&&o.slice(0,l).trim().toLowerCase()===i)return o.slice(l+1).trim()}return null}function Ex(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function Tx(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function b0(t){return typeof t=="number"}function k0(t){return Object.prototype.toString.call(t).slice(8,-1)}function Tr(t){return k0(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Ca(t,e,n){const r=t.split(`
13
13
  `),i=[];let s="",o=0;const l=e.baseIndentSize||2;for(;o<r.length;){const u=r[o],d=u.match(e.itemPattern);if(!d){if(i.length>0)break;if(u.trim()===""){o+=1,s=`${s}${u}
14
14
  `;continue}else return}const f=e.extractItemData(d),{indentLevel:h,mainContent:p}=f;s=`${s}${u}
15
- `;const g=[p];for(o+=1;o<r.length;){var a;const S=r[o];if(S.trim()===""){var c;const C=r.slice(o+1).findIndex(v=>v.trim()!=="");if(C===-1)break;if((((c=r[o+1+C].match(/^(\s*)/))===null||c===void 0||(c=c[1])===null||c===void 0?void 0:c.length)||0)>h){g.push(S),s=`${s}${S}
15
+ `;const g=[p];for(o+=1;o<r.length;){var a;const S=r[o];if(S.trim()===""){var c;const C=r.slice(o+1).findIndex(T=>T.trim()!=="");if(C===-1)break;if((((c=r[o+1+C].match(/^(\s*)/))===null||c===void 0||(c=c[1])===null||c===void 0?void 0:c.length)||0)>h){g.push(S),s=`${s}${S}
16
16
  `,o+=1;continue}else break}if((((a=S.match(/^(\s*)/))===null||a===void 0||(a=a[1])===null||a===void 0?void 0:a.length)||0)>h)g.push(S),s=`${s}${S}
17
17
  `,o+=1;else break}let m;const y=g.slice(1);if(y.length>0){const S=y.map(C=>C.slice(h+l)).join(`
18
- `);S.trim()&&(e.customNestedParser?m=e.customNestedParser(S):m=n.blockTokens(S))}const b=e.createToken(f,m);i.push(b)}if(i.length!==0)return{items:i,raw:s}}function dd(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content;let l=`${i}${e.renderChildren([s])}`;return o&&o.length>0&&o.forEach((a,c)=>{var u,d;const f=(u=(d=e.renderChild)===null||d===void 0?void 0:d.call(e,a,c+1))!==null&&u!==void 0?u:e.renderChildren([a]);if(f!=null){const h=f.split(`
18
+ `);S.trim()&&(e.customNestedParser?m=e.customNestedParser(S):m=n.blockTokens(S))}const b=e.createToken(f,m);i.push(b)}if(i.length!==0)return{items:i,raw:s}}function yd(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content;let l=`${i}${e.renderChildren([s])}`;return o&&o.length>0&&o.forEach((a,c)=>{var u,d;const f=(u=(d=e.renderChild)===null||d===void 0?void 0:d.call(e,a,c+1))!==null&&u!==void 0?u:e.renderChildren([a]);if(f!=null){const h=f.split(`
19
19
  `).map(p=>p?e.indent(p):e.indent("")).join(`
20
20
  `);l+=a.type==="paragraph"?`
21
21
 
22
22
  ${h}`:`
23
- ${h}`}}),l}function ya(t){return typeof t.type=="string"?t.type:t.type.name}function bx(t,e){if(t.length!==e.length)return!1;const n=Array.from({length:e.length},()=>!1);return t.every(r=>{const i=ya(r),s=e.findIndex((o,l)=>!n[l]&&i===ya(o)&&c0(r.attrs,o.attrs));return s===-1?!1:(n[s]=!0,!0)})}function fd(t,e){const n={...t};return Sr(t)&&Sr(e)&&Object.keys(e).forEach(r=>{Sr(e[r])&&Sr(t[r])?n[r]=fd(t[r],e[r]):n[r]=e[r]}),n}function p0(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((l,a)=>{const c=s.mapping.map(a),u=s.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});s.removeMark(c,u,t.type),s.addMark(c,u,h)}}),s.docChanged&&e.view.dispatch(s)}var hr=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!==null&&e!==void 0?e:!0}};const m0=(t,e)=>{if(To(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,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 xr(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=by(c)+s;return o.forEach(f=>{if(u)return;const h=m0(d,f.find);if(!h)return;const p=h[0].length-s.length;if(p>0){const v=c.parentOffset-p;if(v<0||c.parent.textBetween(v,c.parentOffset)!==h[0].slice(0,p))return}const g=a.state.tr,m=Ii({state:a.state,transaction:g}),y={from:r-(h[0].length-s.length),to:i},{commands:b,chain:S,can:C}=new un({editor:n,state:m});f.handler({state:m,range:y,match:h,commands:b,chain:S,can:C})===null||!g.steps.length||(f.undoable&&g.setMeta(l,{transform:g,from:r,to:i,text:s}),a.dispatch(g),u=!0)}),u}function g0(t){const{editor:e,rules:n}=t,r=new F({state:{init(){return null},apply(i,s,o){const l=i.getMeta(r);if(l)return l;const a=i.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=No(k.from(c),o.schema);const{from:u}=a,d=u+c.length;xr({editor:e,from:u,to:d,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return xr({editor:e,from:s,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&xr({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?xr({editor:e,from:o.pos,to:o.pos,text:`
24
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Ro=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...L(A(this,"addOptions",{name:this.name}))}}get storage(){return{...L(A(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>fd(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},_t=class hd extends Ro{constructor(...e){super(...e),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new hd(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!s.find(l=>l?.type.name===n.name))return!1;const o=s.find(l=>l?.type.name===n.name);return o&&r.removeStoredMark(o),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},pd=class{constructor(t){this.find=t.find,this.handler=t.handler}};const y0=(t,e,n)=>{if(To(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function b0(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=t,{commands:a,chain:c,can:u}=new un({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(f,h)=>{var p,g,m,y;if(!((p=f.type)===null||p===void 0||(p=p.spec)===null||p===void 0)&&p.code||!(f.isText||f.isTextblock||f.isInline))return;const b=(g=(m=(y=f.content)===null||y===void 0?void 0:y.size)!==null&&m!==void 0?m:f.nodeSize)!==null&&g!==void 0?g:0,S=Math.max(r,h),C=Math.min(i,h+b);if(S>=C)return;const v=f.isText?f.text||"":f.textBetween(S-h,C-h,void 0,"");y0(v,s.find,o).forEach(R=>{if(R.index===void 0)return;const w=S+R.index+1,N=w+R[0].length,I={from:n.tr.mapping.map(w),to:n.tr.mapping.map(N)},Z=s.handler({state:n,range:I,match:R,commands:a,chain:c,can:u,pasteEvent:o,dropEvent:l});d.push(Z)})}),d.every(f=>f!==null)}let Cr=null;const k0=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function S0(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:c,from:u,to:d,rule:f,pasteEvt:h})=>{const p=c.tr,g=Ii({state:c,transaction:p});if(!(!b0({editor:e,state:g,from:Math.max(u-1,0),to:d.b-1,rule:f,pasteEvent:h,dropEvent:l})||!p.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,p}};return n.map(c=>new F({view(u){const d=h=>{var p;r=!((p=u.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?u.dom.parentElement:null,r&&(Cr=e)},f=()=>{Cr&&(Cr=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,d)=>{if(s=r===u.dom.parentElement,l=d,!s){const f=Cr;f?.isEditable&&setTimeout(()=>{const h=f.state.selection;h&&f.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(u,d)=>{var f;const h=(f=d.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return o=d,i=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(u,d,f)=>{const h=u[0],p=h.getMeta("uiEvent")==="paste"&&!i,g=h.getMeta("uiEvent")==="drop"&&!s,m=h.getMeta("applyPasteRules"),y=!!m;if(!p&&!g&&!y)return;if(y){let{text:C}=m;typeof C=="string"?C=C:C=No(k.from(C),f.schema);const{from:v}=m,R=v+C.length,w=k0(C);return a({rule:c,state:f,from:v,to:{b:R},pasteEvt:w})}const b=d.doc.content.findDiffStart(f.doc.content),S=d.doc.content.findDiffEnd(f.doc.content);if(!(!f0(b)||!S||b===S.b))return a({rule:c,state:f,from:b,to:S,pasteEvt:o})}}))}var zi=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=t,this.extensions=Oo(t),this.schema=Zu(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n=A(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Zt(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this,e=Bn([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Zt(r.name,this.schema)},s=[],o=A(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&A(r,"exitable",i)&&(l.ArrowRight=()=>_t.handleExit({editor:t,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}const a=hg(l);s.push(a);const c=A(r,"addInputRules",i);if(da(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=g0({editor:t,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const u=A(r,"addPasteRules",i);if(da(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=S0({editor:t,rules:f});s.push(...h)}}const d=A(r,"addProseMirrorPlugins",i);if(d){const f=d();s.push(...f)}return s}),n=this.createDecorationPlugin();return n&&e.push(n),e}createDecorationPlugin(){var t;const{editor:e}=this;(t=this.decorationManager)===null||t===void 0||t.destroy();const n=[];return this.extensions.forEach(r=>{const i=A(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Zt(r.name,this.schema)});i&&n.push({name:r.name,addDecorations:i})}),this.decorationManager=new a0({editor:e,entries:n}),this.decorationManager.plugin}get attributes(){return Qu(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=yn(this.extensions);return Object.fromEntries(e.filter(n=>!!A(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i=A(n,"addNodeView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Q(n.name,this.schema)});if(!i)return[];const s=i();if(!s)return[];const o=(l,a,c,u,d)=>{const f=bn(l,r);return s({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,o]}))}dispatchTransaction(t){const{editor:e}=this;return Bn([...this.extensions].reverse()).reduceRight((n,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Zt(r.name,this.schema)},s=A(r,"dispatchTransaction",i);return s?o=>{s.call(i,{transaction:o,next:n})}:n},t)}transformPastedHTML(t){const{editor:e}=this;return Bn([...this.extensions]).reduce((n,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Zt(r.name,this.schema)},s=A(r,"transformPastedHTML",i);return s?(o,l)=>{const a=n(o,l);return s.call(i,a)}:n},t||(n=>n))}get markViews(){const{editor:t}=this,{markExtensions:e}=yn(this.extensions);return Object.fromEntries(e.filter(n=>!!A(n,"addMarkView")).map(n=>{const r=this.attributes.filter(o=>o.type===n.name),i=A(n,"addMarkView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:nt(n.name,this.schema)});if(!i)return[];const s=(o,l,a)=>{const c=bn(o,r);return i()({mark:o,view:l,inline:a,editor:t,extension:n,HTMLAttributes:c,updateAttributes:u=>{p0(o,t,u)}})};return[n.name,s]}))}destroy(){var t;(t=this.decorationManager)===null||t===void 0||t.destroy(),this.extensions.forEach(e=>{let n=e;for(;n.parent;){const r=n.parent;r.child===n&&(r.child=null),n=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Zt(e.name,this.schema)};if(e.type==="mark"){var r,i;(!((r=L(A(e,"keepOnSplit",n)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((i=L(A(e,"clearable",n)))!==null&&i!==void 0)||i||this.nonClearableMarks.push(e.name)}const s=A(e,"onBeforeCreate",n),o=A(e,"onCreate",n),l=A(e,"onUpdate",n),a=A(e,"onSelectionUpdate",n),c=A(e,"onTransaction",n),u=A(e,"onFocus",n),d=A(e,"onBlur",n),f=A(e,"onDestroy",n);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};zi.resolve=Oo;zi.sort=Bn;zi.flatten=Ao;var U=class md extends Ro{constructor(...e){super(...e),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new md(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};const x0=U.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new F({key:new X("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,s=td(n),{blockSeparator:o}=this.options,l={...o!==void 0?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((a,c)=>a.$from.pos-c.$from.pos).map(({$from:a,$to:c})=>ed(r,{from:a.pos,to:c.pos},l)).join(o??`
23
+ ${h}`}}),l}function Ma(t){return typeof t.type=="string"?t.type:t.type.name}function wx(t,e){if(t.length!==e.length)return!1;const n=Array.from({length:e.length},()=>!1);return t.every(r=>{const i=Ma(r),s=e.findIndex((o,l)=>!n[l]&&i===Ma(o)&&m0(r.attrs,o.attrs));return s===-1?!1:(n[s]=!0,!0)})}function bd(t,e){const n={...t};return Tr(t)&&Tr(e)&&Object.keys(e).forEach(r=>{Tr(e[r])&&Tr(t[r])?n[r]=bd(t[r],e[r]):n[r]=e[r]}),n}function S0(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((l,a)=>{const c=s.mapping.map(a),u=s.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});s.removeMark(c,u,t.type),s.addMark(c,u,h)}}),s.docChanged&&e.view.dispatch(s)}var yr=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!==null&&e!==void 0?e:!0}};const x0=(t,e)=>{if(Oo(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,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 wr(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Ey(c)+s;return o.forEach(f=>{if(u)return;const h=x0(d,f.find);if(!h)return;const p=h[0].length-s.length;if(p>0){const T=c.parentOffset-p;if(T<0||c.parent.textBetween(T,c.parentOffset)!==h[0].slice(0,p))return}const g=a.state.tr,m=Bi({state:a.state,transaction:g}),y={from:r-(h[0].length-s.length),to:i},{commands:b,chain:S,can:C}=new hn({editor:n,state:m});f.handler({state:m,range:y,match:h,commands:b,chain:S,can:C})===null||!g.steps.length||(f.undoable&&g.setMeta(l,{transform:g,from:r,to:i,text:s}),a.dispatch(g),u=!0)}),u}function C0(t){const{editor:e,rules:n}=t,r=new B({state:{init(){return null},apply(i,s,o){const l=i.getMeta(r);if(l)return l;const a=i.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=Po(k.from(c),o.schema);const{from:u}=a,d=u+c.length;wr({editor:e,from:u,to:d,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return wr({editor:e,from:s,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&wr({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?wr({editor:e,from:o.pos,to:o.pos,text:`
24
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var zo=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...L(A(this,"addOptions",{name:this.name}))}}get storage(){return{...L(A(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>bd(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Gt=class kd extends zo{constructor(...e){super(...e),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new kd(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!s.find(l=>l?.type.name===n.name))return!1;const o=s.find(l=>l?.type.name===n.name);return o&&r.removeStoredMark(o),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Sd=class{constructor(t){this.find=t.find,this.handler=t.handler}};const M0=(t,e,n)=>{if(Oo(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function E0(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=t,{commands:a,chain:c,can:u}=new hn({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(f,h)=>{var p,g,m,y;if(!((p=f.type)===null||p===void 0||(p=p.spec)===null||p===void 0)&&p.code||!(f.isText||f.isTextblock||f.isInline))return;const b=(g=(m=(y=f.content)===null||y===void 0?void 0:y.size)!==null&&m!==void 0?m:f.nodeSize)!==null&&g!==void 0?g:0,S=Math.max(r,h),C=Math.min(i,h+b);if(S>=C)return;const T=f.isText?f.text||"":f.textBetween(S-h,C-h,void 0,"");M0(T,s.find,o).forEach(N=>{if(N.index===void 0)return;const v=S+N.index+1,O=v+N[0].length,P={from:n.tr.mapping.map(v),to:n.tr.mapping.map(O)},_=s.handler({state:n,range:P,match:N,commands:a,chain:c,can:u,pasteEvent:o,dropEvent:l});d.push(_)})}),d.every(f=>f!==null)}let vr=null;const T0=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function w0(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:c,from:u,to:d,rule:f,pasteEvt:h})=>{const p=c.tr,g=Bi({state:c,transaction:p});if(!(!E0({editor:e,state:g,from:Math.max(u-1,0),to:d.b-1,rule:f,pasteEvent:h,dropEvent:l})||!p.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,p}};return n.map(c=>new B({view(u){const d=h=>{var p;r=!((p=u.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?u.dom.parentElement:null,r&&(vr=e)},f=()=>{vr&&(vr=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,d)=>{if(s=r===u.dom.parentElement,l=d,!s){const f=vr;f?.isEditable&&setTimeout(()=>{const h=f.state.selection;h&&f.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(u,d)=>{var f;const h=(f=d.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return o=d,i=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(u,d,f)=>{const h=u[0],p=h.getMeta("uiEvent")==="paste"&&!i,g=h.getMeta("uiEvent")==="drop"&&!s,m=h.getMeta("applyPasteRules"),y=!!m;if(!p&&!g&&!y)return;if(y){let{text:C}=m;typeof C=="string"?C=C:C=Po(k.from(C),f.schema);const{from:T}=m,N=T+C.length,v=T0(C);return a({rule:c,state:f,from:T,to:{b:N},pasteEvt:v})}const b=d.doc.content.findDiffStart(f.doc.content),S=d.doc.content.findDiffEnd(f.doc.content);if(!(!b0(b)||!S||b===S.b))return a({rule:c,state:f,from:b,to:S,pasteEvt:o})}}))}var ji=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=t,this.extensions=Lo(t),this.schema=sd(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n=A(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:nn(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this,e=jn([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:nn(r.name,this.schema)},s=[],o=A(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&A(r,"exitable",i)&&(l.ArrowRight=()=>Gt.handleExit({editor:t,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}const a=kg(l);s.push(a);const c=A(r,"addInputRules",i);if(ya(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=C0({editor:t,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const u=A(r,"addPasteRules",i);if(ya(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=w0({editor:t,rules:f});s.push(...h)}}const d=A(r,"addProseMirrorPlugins",i);if(d){const f=d();s.push(...f)}return s}),n=this.createDecorationPlugin();return n&&e.push(n),e}createDecorationPlugin(){var t;const{editor:e}=this;(t=this.decorationManager)===null||t===void 0||t.destroy();const n=[];return this.extensions.forEach(r=>{const i=A(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:nn(r.name,this.schema)});i&&n.push({name:r.name,addDecorations:i})}),this.decorationManager=new p0({editor:e,entries:n}),this.decorationManager.plugin}get attributes(){return id(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Sn(this.extensions);return Object.fromEntries(e.filter(n=>!!A(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i=A(n,"addNodeView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Q(n.name,this.schema)});if(!i)return[];const s=i();if(!s)return[];const o=(l,a,c,u,d)=>{const f=xn(l,r);return s({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,o]}))}dispatchTransaction(t){const{editor:e}=this;return jn([...this.extensions].reverse()).reduceRight((n,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:nn(r.name,this.schema)},s=A(r,"dispatchTransaction",i);return s?o=>{s.call(i,{transaction:o,next:n})}:n},t)}transformPastedHTML(t){const{editor:e}=this;return jn([...this.extensions]).reduce((n,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:nn(r.name,this.schema)},s=A(r,"transformPastedHTML",i);return s?(o,l)=>{const a=n(o,l);return s.call(i,a)}:n},t||(n=>n))}get markViews(){const{editor:t}=this,{markExtensions:e}=Sn(this.extensions);return Object.fromEntries(e.filter(n=>!!A(n,"addMarkView")).map(n=>{const r=this.attributes.filter(o=>o.type===n.name),i=A(n,"addMarkView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:it(n.name,this.schema)});if(!i)return[];const s=(o,l,a)=>{const c=xn(o,r);return i()({mark:o,view:l,inline:a,editor:t,extension:n,HTMLAttributes:c,updateAttributes:u=>{S0(o,t,u)}})};return[n.name,s]}))}destroy(){var t;(t=this.decorationManager)===null||t===void 0||t.destroy(),this.extensions.forEach(e=>{let n=e;for(;n.parent;){const r=n.parent;r.child===n&&(r.child=null),n=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:nn(e.name,this.schema)};if(e.type==="mark"){var r,i;(!((r=L(A(e,"keepOnSplit",n)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((i=L(A(e,"clearable",n)))!==null&&i!==void 0)||i||this.nonClearableMarks.push(e.name)}const s=A(e,"onBeforeCreate",n),o=A(e,"onCreate",n),l=A(e,"onUpdate",n),a=A(e,"onSelectionUpdate",n),c=A(e,"onTransaction",n),u=A(e,"onFocus",n),d=A(e,"onBlur",n),f=A(e,"onDestroy",n);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};ji.resolve=Lo;ji.sort=jn;ji.flatten=Io;var U=class xd extends zo{constructor(...e){super(...e),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new xd(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};const v0=U.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new B({key:new X("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,s=ld(n),{blockSeparator:o}=this.options,l={...o!==void 0?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((a,c)=>a.$from.pos-c.$from.pos).map(({$from:a,$to:c})=>od(r,{from:a.pos,to:c.pos},l)).join(o??`
25
25
 
26
- `)}}})]}}),C0=U.create({name:"commands",addCommands(){return{...Jy}}}),M0=U.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r;const i=()=>{var s,o,l;if((s=(o=this.editor.options.coreExtensionOptions)===null||o===void 0||(o=o.delete)===null||o===void 0||(l=o.filterTransaction)===null||l===void 0?void 0:l.call(o,t))!==null&&s!==void 0?s:t.getMeta("y-sync$"))return;const a=Yu(t.before,[t,...e]);$i(a).forEach(u=>{a.mapping.mapResult(u.oldRange.from).deletedAfter&&a.mapping.mapResult(u.oldRange.to).deletedBefore&&a.before.nodesBetween(u.oldRange.from,u.oldRange.to,(d,f)=>{const h=f+d.nodeSize-2,p=u.oldRange.from<=f&&h<=u.oldRange.to;this.editor.emit("delete",{type:"node",node:d,from:f,to:h,newFrom:a.mapping.map(f),newTo:a.mapping.map(h),deletedRange:u.oldRange,newRange:u.newRange,partial:!p,editor:this.editor,transaction:t,combinedTransform:a})})});const c=a.mapping;a.steps.forEach((u,d)=>{if(u instanceof Re){var f,h;const p=c.slice(d).map(u.from,-1),g=c.slice(d).map(u.to),m=c.invert().map(p,-1),y=c.invert().map(g),b=p>0?(f=a.doc.nodeAt(p-1))===null||f===void 0?void 0:f.marks.some(C=>C.eq(u.mark)):!1,S=(h=a.doc.nodeAt(g))===null||h===void 0?void 0:h.marks.some(C=>C.eq(u.mark));this.editor.emit("delete",{type:"mark",mark:u.mark,from:u.from,to:u.to,deletedRange:{from:m,to:y},newRange:{from:p,to:g},partial:!!(S||b),editor:this.editor,transaction:t,combinedTransform:a})}})};!((n=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&n!==void 0)||n?setTimeout(i,0):i()}}),E0=U.create({name:"drop",addProseMirrorPlugins(){return[new F({key:new X("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),T0=U.create({name:"editable",addProseMirrorPlugins(){return[new F({key:new X("editable"),props:{editable:()=>this.editor.options.editable}})]}}),w0=new X("focusEvents"),v0=U.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new F({key:w0,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),A0=U.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,m=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?m===d.pos:O.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return nr()||Ju()?s:i},addProseMirrorPlugins(){return[new F({key:new X("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(h=>h.getMeta("composition")))return;const r=t.some(h=>h.docChanged)&&!e.doc.eq(n.doc),i=t.some(h=>h.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:l}=e.selection,a=O.atStart(e.doc).from,c=O.atEnd(e.doc).to;if(s||!(o===a&&l===c)||!fr(n.doc))return;const u=n.tr,d=Ii({state:n,transaction:u}),{commands:f}=new un({editor:this.editor,state:d});if(f.clearNodes(),!!u.steps.length)return u}})]}}),N0=U.create({name:"paste",addProseMirrorPlugins(){return[new F({key:new X("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),O0=U.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new F({key:new X("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!==null&&t!==void 0?t:"0"}}}})]}}),D0=U.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=yn(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new F({key:new X("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}});let ba=!1;function R0(t){if(ba)return;ba=!0;let e;try{e=_.fromJSON(t,{from:0,to:0}).slice.content}catch{return}e instanceof k||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var I0=class Dn{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},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?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Dn(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Dn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Dn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!i&&!o&&a.depth<=this.depth)return;const c=new Dn(a,this.editor,i,i||o?n:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const a=o[l];if(s[a]!==n[a])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}};const P0=`.ProseMirror {
26
+ `)}}})]}}),A0=U.create({name:"commands",addCommands(){return{...e0}}}),N0=U.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r;const i=()=>{var s,o,l;if((s=(o=this.editor.options.coreExtensionOptions)===null||o===void 0||(o=o.delete)===null||o===void 0||(l=o.filterTransaction)===null||l===void 0?void 0:l.call(o,t))!==null&&s!==void 0?s:t.getMeta("y-sync$"))return;const a=nd(t.before,[t,...e]);Vi(a).forEach(u=>{a.mapping.mapResult(u.oldRange.from).deletedAfter&&a.mapping.mapResult(u.oldRange.to).deletedBefore&&a.before.nodesBetween(u.oldRange.from,u.oldRange.to,(d,f)=>{const h=f+d.nodeSize-2,p=u.oldRange.from<=f&&h<=u.oldRange.to;this.editor.emit("delete",{type:"node",node:d,from:f,to:h,newFrom:a.mapping.map(f),newTo:a.mapping.map(h),deletedRange:u.oldRange,newRange:u.newRange,partial:!p,editor:this.editor,transaction:t,combinedTransform:a})})});const c=a.mapping;a.steps.forEach((u,d)=>{if(u instanceof De){var f,h;const p=c.slice(d).map(u.from,-1),g=c.slice(d).map(u.to),m=c.invert().map(p,-1),y=c.invert().map(g),b=p>0?(f=a.doc.nodeAt(p-1))===null||f===void 0?void 0:f.marks.some(C=>C.eq(u.mark)):!1,S=(h=a.doc.nodeAt(g))===null||h===void 0?void 0:h.marks.some(C=>C.eq(u.mark));this.editor.emit("delete",{type:"mark",mark:u.mark,from:u.from,to:u.to,deletedRange:{from:m,to:y},newRange:{from:p,to:g},partial:!!(S||b),editor:this.editor,transaction:t,combinedTransform:a})}})};!((n=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&n!==void 0)||n?setTimeout(i,0):i()}}),O0=U.create({name:"drop",addProseMirrorPlugins(){return[new B({key:new X("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),D0=U.create({name:"editable",addProseMirrorPlugins(){return[new B({key:new X("editable"),props:{editable:()=>this.editor.options.editable}})]}}),R0=new X("focusEvents"),I0=U.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new B({key:R0,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),P0=U.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,m=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?m===d.pos:D.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return or()||ed()?s:i},addProseMirrorPlugins(){return[new B({key:new X("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(h=>h.getMeta("composition")))return;const r=t.some(h=>h.docChanged)&&!e.doc.eq(n.doc),i=t.some(h=>h.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:l}=e.selection,a=D.atStart(e.doc).from,c=D.atEnd(e.doc).to;if(s||!(o===a&&l===c)||!gr(n.doc))return;const u=n.tr,d=Bi({state:n,transaction:u}),{commands:f}=new hn({editor:this.editor,state:d});if(f.clearNodes(),!!u.steps.length)return u}})]}}),L0=U.create({name:"paste",addProseMirrorPlugins(){return[new B({key:new X("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),$0=U.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new B({key:new X("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!==null&&t!==void 0?t:"0"}}}})]}}),z0=U.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Sn(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new B({key:new X("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}});let Ea=!1;function B0(t){if(Ea)return;Ea=!0;let e;try{e=q.fromJSON(t,{from:0,to:0}).slice.content}catch{return}e instanceof k||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var F0=class Ln{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},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?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Ln(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Ln(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Ln(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!i&&!o&&a.depth<=this.depth)return;const c=new Ln(a,this.editor,i,i||o?n:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const a=o[l];if(s[a]!==n[a])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}};const H0=`.ProseMirror {
27
27
  position: relative;
28
28
  }
29
29
 
@@ -93,49 +93,49 @@ img.ProseMirror-separator {
93
93
 
94
94
  .ProseMirror-focused .ProseMirror-gapcursor {
95
95
  display: block;
96
- }`;var L0=class extends Yy{constructor(t={}){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.hasWarnedStaleDecorationRead=!1,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:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:My,createMappablePosition:Ey},this.setOptions(t),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:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const n=zs(e,this.options.autofocus);this.editorState=At.create({doc:e,schema:this.schema,selection:n||void 0})}R0(this.schema),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),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){this.editorState=this.editorView.state;const t=this.editorView.dom;t?.editor&&delete t.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(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():un.createFakeChain()}can(){return this.commandManager?this.commandManager.can():un.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=d0(P0,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&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:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=Xu(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[T0,x0.configure({blockSeparator:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),C0,v0,A0,O0.configure({value:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.tabindex)===null||e===void 0?void 0:e.value}),E0,N0,M0,D0.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new zi(n,this)}createCommandManager(){this.commandManager=new un({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Fs(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;const n=Fs(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=At.create({doc:n,schema:this.schema,selection:zs(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,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(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new Fu(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();const a=this.view.dom;a.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(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)===null||u===void 0?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=o?.getMeta("focus"),a=o?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),a&&this.emit("blur",{editor:this,event:a.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return nd(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return ky(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return No(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
96
+ }`;var V0=class extends n0{constructor(t={}){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.hasWarnedStaleDecorationRead=!1,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:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Ny,createMappablePosition:Oy},this.setOptions(t),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:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const n=js(e,this.options.autofocus);this.editorState=Dt.create({doc:e,schema:this.schema,selection:n||void 0})}B0(this.schema),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),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){this.editorState=this.editorView.state;const t=this.editorView.dom;t?.editor&&delete t.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(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():hn.createFakeChain()}can(){return this.commandManager?this.commandManager.can():hn.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=y0(H0,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&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:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=rd(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[D0,v0.configure({blockSeparator:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),A0,I0,P0,$0.configure({value:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.tabindex)===null||e===void 0?void 0:e.value}),O0,L0,N0,z0.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new ji(n,this)}createCommandManager(){this.commandManager=new hn({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Ks(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;const n=Ks(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Dt.create({doc:n,schema:this.schema,selection:js(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,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(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new Uu(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();const a=this.view.dom;a.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(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)===null||u===void 0?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=o?.getMeta("focus"),a=o?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),a&&this.emit("blur",{editor:this,event:a.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return ad(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return Ty(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Po(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
97
97
 
98
- `,textSerializers:n={}}=t||{};return fy(this.state.doc,{blockSeparator:e,textSerializers:{...td(this.schema),...n}})}get isEmpty(){return fr(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(){var t,e;return(t=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&t!==void 0?t:!0}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new I0(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Ut(t){return new hr({find:t.find,handler:({state:e,range:n,match:r})=>{const i=L(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=n.from+l.indexOf(o),u=c+o.length;if(Do(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(h=>h===t.type&&h!==f.mark.type)).filter(f=>f.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+a,c);const d=n.from+a+o.length;s.addMark(n.from+a,d,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function $0(t){return new hr({find:t.find,handler:({state:e,range:n,match:r})=>{const i=L(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let l=n.to;const a=t.type.create(i);if(r[1]){let c=o+r[0].lastIndexOf(r[1]);c>l?c=l:l=c+r[1].length;const u=r[0][r[0].length-1];s.insertText(u,o+r[0].length-1),s.replaceWith(c,l,a)}else if(r[0]){const c=t.type.isInline?o:o-1;s.insert(c,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},undoable:t.undoable})}function Vs(t){return new hr({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=L(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function kn(t){return new hr({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=L(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),a=l&&co(l,t.type,s);if(!a)return null;if(o.wrap(l,a),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:f}=t.editor.extensionManager,h=d||u.$to.parentOffset&&u.$from.marks();if(h){const p=h.filter(g=>f.includes(g.type.name));o.ensureMarks(p)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,s).run()}const c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&St(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&o.join(n.from-1)},undoable:t.undoable})}const z0=t=>"touches"in t;var kx=class{constructor(t){var e,n,r,i,s,o;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=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.clientX-this.startX,c=l.clientY-this.startY;this.handleResize(a,c)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),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=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)},this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,!((e=t.options)===null||e===void 0)&&e.min&&(this.minSize={...this.minSize,...t.options.min}),!((n=t.options)===null||n===void 0)&&n.max&&(this.maxSize=t.options.max),!(t==null||(r=t.options)===null||r===void 0)&&r.directions&&(this.directions=t.options.directions),!((i=t.options)===null||i===void 0)&&i.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),!((s=t.options)===null||s===void 0)&&s.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),!((o=t.options)===null||o===void 0)&&o.createCustomHandle&&(this.createCustomHandle=t.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(){var t;return(t=this.contentElement)!==null&&t!==void 0?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}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(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),i=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(t.style.left="0"),s&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,z0(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.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(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,i,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,i=this.startHeight;const s=t.includes("right"),o=t.includes("left"),l=t.includes("bottom"),a=t.includes("top");return s?r=this.startWidth+e:o&&(r=this.startWidth-e),l?i=this.startHeight+n:a&&(i=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(s?e:-e)),(t==="top"||t==="bottom")&&(i=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,t):{width:r,height:i}}applyConstraints(t,e,n){var r,i;if(!n){var s,o;let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return!((s=this.maxSize)===null||s===void 0)&&s.width&&(c=Math.min(this.maxSize.width,c)),!((o=this.maxSize)===null||o===void 0)&&o.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let l=t,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),!((r=this.maxSize)===null||r===void 0)&&r.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),!((i=this.maxSize)===null||i===void 0)&&i.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",i=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:i?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}},ye=class gd extends Ro{constructor(...e){super(...e),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new gd(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},B0=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=()=>{try{return e.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n;const{view:r}=this.editor,i=t.target,s=i.nodeType===3?(e=i.parentElement)===null||e===void 0?void 0:e.closest("[data-drag-handle]"):i.closest("[data-drag-handle]");if(!this.dom||!((n=this.contentDOM)===null||n===void 0)&&n.contains(i)||!s)return;let o=0,l=0;if(this.dom!==s){var a,c,u,d;const b=this.dom.getBoundingClientRect(),S=s.getBoundingClientRect(),C=(a=t.offsetX)!==null&&a!==void 0?a:(c=t.nativeEvent)===null||c===void 0?void 0:c.offsetX,v=(u=t.offsetY)!==null&&u!==void 0?u:(d=t.nativeEvent)===null||d===void 0?void 0:d.offsetY;o=S.x-b.x+C,l=S.y-b.y+v}const f=this.dom.cloneNode(!0);try{const b=this.dom.getBoundingClientRect();f.style.width=`${Math.round(b.width)}px`,f.style.height=`${Math.round(b.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let h=null;try{var p;h=document.createElement("div"),h.style.position="absolute",h.style.top="-9999px",h.style.left="-9999px",h.style.pointerEvents="none",h.appendChild(f),document.body.appendChild(h),(p=t.dataTransfer)===null||p===void 0||p.setDragImage(f,o,l)}finally{h&&setTimeout(()=>{try{h?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const m=E.create(r.state.doc,g),y=r.state.tr.setSelection(m);r.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!(!((e=this.contentDOM)===null||e===void 0)&&e.contains(n))))return!1;const r=t.type.startsWith("drag"),i=t.type==="dragover"||t.type==="dragenter",s=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s&&!r)return!0;const{isEditable:o}=this.editor,{isDragging:l}=this,a=!!this.node.type.spec.draggable,c=E.isSelectable(this.node),u=t.type==="copy",d=t.type==="paste",f=t.type==="cut",h=t.type==="mousedown";if(!a&&c&&r&&t.target===this.dom&&t.preventDefault(),a&&r&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(a&&o&&!l&&h){const p=n.closest("[data-drag-handle]");p&&(this.dom===p||this.dom.contains(p))&&(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!(l||i||s||u||d||f||h&&c)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(nr()||Bs())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function kt(t){return new pd({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=L(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const u=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(Do(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(p=>p===t.type&&p!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&o.delete(f,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+l.length,o.addMark(n.from+u,c,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:F0,getOwnPropertySymbols:H0}=Object,{hasOwnProperty:V0}=Object.prototype;function ss(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function Mr(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,o=s.get(n),l=s.get(r);if(o&&l)return o===r&&l===n;s.set(n,r),s.set(r,n);const a=t(n,r,i);return s.delete(n),s.delete(r),a}}function j0(t){return t?.[Symbol.toStringTag]}function ka(t){return F0(t).concat(H0(t))}const W0=Object.hasOwn||((t,e)=>V0.call(t,e));function qt(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const K0="__v",U0="__o",_0="_owner",{getOwnPropertyDescriptor:Sa,keys:xa}=Object;function q0(t,e){return t.byteLength===e.byteLength&&Ur(new Uint8Array(t),new Uint8Array(e))}function J0(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function G0(t,e){return t.byteLength===e.byteLength&&Ur(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Y0(t,e){return qt(t.getTime(),e.getTime())}function X0(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Q0(t,e){return t===e}function Ca(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let o,l,a=0;for(;(o=s.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(i[d]){d++;continue}const f=o.value,h=l.value;if(n.equals(f[0],h[0],a,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){u=i[d]=!0;break}d++}if(!u)return!1;a++}return!0}const Z0=qt;function eb(t,e,n){const r=xa(t);let i=r.length;if(xa(e).length!==i)return!1;for(;i-- >0;)if(!yd(t,e,n,r[i]))return!1;return!0}function En(t,e,n){const r=ka(t);let i=r.length;if(ka(e).length!==i)return!1;let s,o,l;for(;i-- >0;)if(s=r[i],!yd(t,e,n,s)||(o=Sa(t,s),l=Sa(e,s),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function tb(t,e){return qt(t.valueOf(),e.valueOf())}function nb(t,e){return t.source===e.source&&t.flags===e.flags}function Ma(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let o,l;for(;(o=s.next())&&!o.done;){const a=e.values();let c=!1,u=0;for(;(l=a.next())&&!l.done;){if(!i[u]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){c=i[u]=!0;break}u++}if(!c)return!1}return!0}function Ur(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function rb(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function yd(t,e,n,r){return(r===_0||r===U0||r===K0)&&(t.$$typeof||e.$$typeof)?!0:W0(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const ib="[object ArrayBuffer]",sb="[object Arguments]",ob="[object Boolean]",lb="[object DataView]",ab="[object Date]",cb="[object Error]",ub="[object Map]",db="[object Number]",fb="[object Object]",hb="[object RegExp]",pb="[object Set]",mb="[object String]",gb={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},yb="[object URL]",bb=Object.prototype.toString;function kb({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(m,y,b){if(m===y)return!0;if(m==null||y==null)return!1;const S=typeof m;if(S!==typeof y)return!1;if(S!=="object")return S==="number"?l(m,y,b):S==="function"?s(m,y,b):!1;const C=m.constructor;if(C!==y.constructor)return!1;if(C===Object)return a(m,y,b);if(Array.isArray(m))return e(m,y,b);if(C===Date)return r(m,y,b);if(C===RegExp)return u(m,y,b);if(C===Map)return o(m,y,b);if(C===Set)return d(m,y,b);const v=bb.call(m);if(v===ab)return r(m,y,b);if(v===hb)return u(m,y,b);if(v===ub)return o(m,y,b);if(v===pb)return d(m,y,b);if(v===fb)return typeof m.then!="function"&&typeof y.then!="function"&&a(m,y,b);if(v===yb)return h(m,y,b);if(v===cb)return i(m,y,b);if(v===sb)return a(m,y,b);if(gb[v])return f(m,y,b);if(v===ib)return t(m,y,b);if(v===lb)return n(m,y,b);if(v===ob||v===db||v===mb)return c(m,y,b);if(p){let R=p[v];if(!R){const w=j0(m);w&&(R=p[w])}if(R)return R(m,y,b)}return!1}}function Sb({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:q0,areArraysEqual:n?En:J0,areDataViewsEqual:G0,areDatesEqual:Y0,areErrorsEqual:X0,areFunctionsEqual:Q0,areMapsEqual:n?ss(Ca,En):Ca,areNumbersEqual:Z0,areObjectsEqual:n?En:eb,arePrimitiveWrappersEqual:tb,areRegExpsEqual:nb,areSetsEqual:n?ss(Ma,En):Ma,areTypedArraysEqual:n?ss(Ur,En):Ur,areUrlsEqual:rb,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=Mr(r.areArraysEqual),s=Mr(r.areMapsEqual),o=Mr(r.areObjectsEqual),l=Mr(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:l})}return r}function xb(t){return function(e,n,r,i,s,o,l){return t(e,n,l)}}function Cb({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(l,a){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(l,a,{cache:c,equals:r,meta:u,strict:i})};if(t)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(l,a){return e(l,a,s)}}const Mb=Ct();Ct({strict:!0});Ct({circular:!0});Ct({circular:!0,strict:!0});Ct({createInternalComparator:()=>qt});Ct({strict:!0,createInternalComparator:()=>qt});Ct({circular:!0,createInternalComparator:()=>qt});Ct({circular:!0,createInternalComparator:()=>qt,strict:!0});function Ct(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=Sb(t),o=kb(s),l=n?n(o):xb(o);return Cb({circular:e,comparator:o,createState:r,equals:l,strict:i})}const Eb=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},Tb=({contentComponent:t})=>{const e=ic.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return D.jsx(D.Fragment,{children:Object.values(e)})};function wb(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(i=>i())}))};return{subscribe(i){return t.add(i),()=>{t.delete(i)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(i,s){e={...e,[i]:Vf.createPortal(s.reactElement,s.element,i)},r()},removeRenderer(i){const s={...e};delete s[i],e=s,r()}}}var vb=class extends Vt.Component{constructor(t){super(t),this.editorContentRef=Vt.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&(!((t=e.view.dom)===null||t===void 0)&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=wb(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{var e;if(!(!((e=t.view.dom)===null||e===void 0)&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return D.jsxs(D.Fragment,{children:[D.jsx("div",{ref:Eb(e,this.editorContentRef),...n}),t?.contentComponent&&D.jsx(Tb,{contentComponent:t.contentComponent})]})}};const Ab=H.forwardRef((t,e)=>{const n=Vt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Vt.createElement(vb,{key:n,innerRef:e,...t})}),Nb=Vt.memo(Ab),Ob=typeof window<"u"?H.useLayoutEffect:H.useEffect;var Db=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){let e;const n=i=>{i?.transaction!==void 0&&i.transaction===e||(e=i?.transaction,this.transactionNumber+=1,this.subscribers.forEach(s=>s()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function Rb(t){var e;const[n]=H.useState(()=>new Db(t.editor)),r=Ff.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:Mb);return Ob(()=>n.watch(t.editor),[t.editor,n]),H.useDebugValue(r),r}const Ib=!1,bd=typeof window>"u",Pb=bd||!!(typeof window<"u"&&window.next);var Lb=class kd{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return bd?(n&&Ib&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):Pb&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var r,i;return(r=(i=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(i,...n)},onBlur:(...n)=>{var r,i;return(r=(i=this.options.current).onBlur)===null||r===void 0?void 0:r.call(i,...n)},onCreate:(...n)=>{var r,i;return(r=(i=this.options.current).onCreate)===null||r===void 0?void 0:r.call(i,...n)},onDestroy:(...n)=>{var r,i;return(r=(i=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(i,...n)},onFocus:(...n)=>{var r,i;return(r=(i=this.options.current).onFocus)===null||r===void 0?void 0:r.call(i,...n)},onSelectionUpdate:(...n)=>{var r,i;return(r=(i=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(i,...n)},onTransaction:(...n)=>{var r,i;return(r=(i=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(i,...n)},onUpdate:(...n)=>{var r,i;return(r=(i=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(i,...n)},onContentError:(...n)=>{var r,i;return(r=(i=this.options.current).onContentError)===null||r===void 0?void 0:r.call(i,...n)},onDrop:(...n)=>{var r,i;return(r=(i=this.options.current).onDrop)===null||r===void 0?void 0:r.call(i,...n)},onPaste:(...n)=>{var r,i;return(r=(i=this.options.current).onPaste)===null||r===void 0?void 0:r.call(i,...n)},onDelete:(...n)=>{var r,i;return(r=(i=this.options.current).onDelete)===null||r===void 0?void 0:r.call(i,...n)},onMount:(...n)=>{var r,i;return(r=(i=this.options.current).onMount)===null||r===void 0?void 0:r.call(i,...n)},onUnmount:(...n)=>{var r,i;return(r=(i=this.options.current).onUnmount)===null||r===void 0?void 0:r.call(i,...n)}};return new L0(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=n.extensions)===null||o===void 0?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?kd.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,r)=>n===e[r]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Sx(t={},e=[]){const n=H.useRef(t);n.current=t;const[r]=H.useState(()=>new Lb(n)),i=ic.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return H.useDebugValue(i),H.useEffect(r.onRender(e)),Rb({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}const Io=H.createContext({editor:null});Io.Consumer;const xx=()=>H.useContext(Io),Sd=H.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),$b=()=>H.useContext(Sd),xd=Vt.forwardRef((t,e)=>{const{onDragStart:n}=$b(),r=t.as||"div";return D.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Ea(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function Ta(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function zb(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function Bb(t){if(Ea(t)||Ta(t))return!0;if(zb(t)){const e=t.type;if(e)return Ea(e)||Ta(e)}return!1}function Fb(){try{if(H.version)return parseInt(H.version.split(".")[0],10)>=19}catch{}return!1}var Hb=class{constructor(t,{editor:e,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isEditorContentInitialized?Hf.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,i=Fb(),s=Bb(e),o={...n};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=l=>{this.ref=l}),this.reactElement=D.jsx(e,{...o}),r==null||(t=r.contentComponent)===null||t===void 0||t.setRenderer(this.id,this)}updateProps(t={}){if(this.destroyed)return;let e=!1;const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const i=n[r];if(t[i]!==this.props[i]){e=!0;break}}e&&(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;e==null||(t=e.contentComponent)===null||t===void 0||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};Vt.createContext({markViewContentRef:()=>{}});function Vb(t){var e;const n=t.getRootNode(),r=typeof n.getSelection=="function"?n.getSelection():(e=t.ownerDocument)===null||e===void 0||(e=e.defaultView)===null||e===void 0?void 0:e.getSelection();if(!r||r.rangeCount===0)return null;const{anchorNode:i,anchorOffset:s,focusNode:o,focusOffset:l}=r;return!i||!o||!t.contains(i)||!t.contains(o)?null:()=>{try{r.setBaseAndExtent(i,s,o,l)}catch{}}}var jb=class extends B0{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{const r=this.getPos();typeof r!="number"||r===this.currentPos||(this.currentPos=r,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs=="function"&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");r?r.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,i){if(r==="storage"){var s;return(s=t.storage[e.name])!==null&&s!==void 0?s:{}}return Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={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:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode(),ref:H.createRef()};if(!this.component.displayName){const a=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=a(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:a=>{if(a&&this.contentDOMElement&&a.firstChild!==this.contentDOMElement){a.hasAttribute("data-node-view-wrapper")&&a.removeAttribute("data-node-view-wrapper");const c=Vb(this.contentDOMElement);a.appendChild(this.contentDOMElement),c?.()}}},i=this.component,s=H.memo(a=>D.jsx(Sd.Provider,{value:r,children:H.createElement(i,a)}));s.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new Hb(s,{editor:this.editor,props:t,as:o,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!((t=this.renderer.element.firstElementChild)===null||t===void 0)&&t.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.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{var t;this.selectionRafId=null;const e=(t=this.getPos())!==null&&t!==void 0?t:this.currentPos;if(typeof e=="number")if(Cy({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(t,e,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,l=this.decorations,a=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:o,oldDecorations:l,newNode:t,newDecorations:e,oldInnerDecorations:a,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(t===this.node)return this.node=t,this.decorations=e,this.innerDecorations=n,!0;const i=this.getPos();this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=i;const s={node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(s.getPos=()=>this.getPos()),r(s),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=bn(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function Cd(t,e){return n=>n.editor.contentComponent?new jb(t,n,e):{dom:document.createElement("span"),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}}const Po=H.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Po.displayName="TiptapContext";const Wb=()=>H.useContext(Po);function Md({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=H.useMemo(()=>({editor:n}),[n]),i=H.useMemo(()=>({editor:n}),[n]);return D.jsx(Io.Provider,{value:i,children:D.jsx(Po.Provider,{value:r,children:t})})}Md.displayName="Tiptap";function Ed({...t}){const{editor:e}=Wb();return D.jsx(Nb,{editor:e,...t})}Ed.displayName="Tiptap.Content";Object.assign(Md,{Content:Ed});function Kb(t){return t.storage.mention}function Cx(t,e,n){t.chain().focus().insertContentAt(e,[Ub(n),{type:"text",text:" "}]).run()}function Ub(t){return{type:"mention",attrs:t}}function Mx(t,e,n){const r=t.state.doc.nodeAt(e);return r?.type.name==="mention"&&r.attrs.id===n}function _b(t){const e=oo.c(34),{node:n,selected:r,view:i,editor:s,getPos:o}=t,{name:l,char:a,kind:c,id:u,args:d}=n.attrs,f=rc(),h=r&&i.editable,p=c==="task",g=a==="@",m=i.editable&&a==="/"&&(c==="prompt"||c===void 0);let y;e[0]!==d||e[1]!==s||e[2]!==o||e[3]!==u||e[4]!==l?(y=()=>{const Et=Kb(s)?.onEditChip;if(!Et||typeof o!="function")return;const ce=o();typeof ce=="number"&&Et({promptId:u,promptName:l,args:d??{},pos:ce})},e[0]=d,e[1]=s,e[2]=o,e[3]=u,e[4]=l,e[5]=y):y=e[5];const b=y;let S;e[6]!==m||e[7]!==b?(S=he=>{m&&(he.preventDefault(),he.stopPropagation(),b())},e[6]=m,e[7]=b,e[8]=S):S=e[8];const C=S;let v;e[9]!==m||e[10]!==b?(v=he=>{m&&(he.key!=="Enter"&&he.key!==" "||(he.preventDefault(),he.stopPropagation(),b()))},e[9]=m,e[10]=b,e[11]=v):v=e[11];const R=v,w=m?"button":void 0,N=m?0:void 0;let I;e[12]!==m||e[13]!==l||e[14]!==f?(I=m?f("chat.mention.editPrompt",{name:l?sl(l):""}):void 0,e[12]=m,e[13]=l,e[14]=f,e[15]=I):I=e[15];const Z=m?"cursor-pointer":"cursor-default",le=g?"bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",ae=h&&"outline-2 outline-blue-300 outline-offset-0",V=m&&"hover:brightness-95",q=!p&&"capitalize";let z;e[16]!==q||e[17]!==Z||e[18]!==le||e[19]!==ae||e[20]!==V?(z=sc("px-1 py-1 rounded","inline-flex items-center gap-1",Z,"select-none","text-xs font-light",le,ae,V,q),e[16]=q,e[17]=Z,e[18]=le,e[19]=ae,e[20]=V,e[21]=z):z=e[21];let J;e[22]!==p||e[23]!==l?(J=p?D.jsx("span",{className:"inline-block max-w-[220px] truncate align-bottom",children:l??""}):l?sl(l):"",e[22]=p,e[23]=l,e[24]=J):J=e[24];let Oe;return e[25]!==a||e[26]!==C||e[27]!==R||e[28]!==z||e[29]!==J||e[30]!==w||e[31]!==N||e[32]!==I?(Oe=D.jsxs(xd,{onClick:C,onKeyDown:R,role:w,tabIndex:N,"aria-label":I,className:z,children:[a,J]}),e[25]=a,e[26]=C,e[27]=R,e[28]=z,e[29]=J,e[30]=w,e[31]=N,e[32]=I,e[33]=Oe):Oe=e[33],Oe}const Ex=ye.create({name:"mention",group:"inline",inline:!0,atom:!0,addStorage(){return{onEditChip:null}},addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},char:{default:"/",parseHTML:t=>t.getAttribute("data-char")||"/",renderHTML:t=>t.char?{"data-char":t.char}:{}},metadata:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:t=>t.metadata?{"data-metadata":JSON.stringify(t.metadata)}:{}},kind:{default:void 0,parseHTML:t=>t.getAttribute("data-kind")||void 0,renderHTML:t=>t.kind?{"data-kind":t.kind}:{}},args:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-args")||"null")}catch{return null}},renderHTML:t=>t.args?{"data-args":JSON.stringify(t.args)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({HTMLAttributes:t}){return["span",Y(t,{"data-type":"mention"})]},renderText({node:t}){const e=t.attrs.char??"@",n=t.attrs.name??"";return`${e}${n}`},addNodeView(){return Cd(_b)}});function Tx(t,e,n){t.chain().focus().insertContentAt(e,[qb(n),{type:"text",text:" "}]).run()}function qb(t){return{type:"file",attrs:t}}function Jb(t){const e=oo.c(17),{node:n,selected:r,view:i}=t,{name:s,mimeType:o,data:l}=n.attrs,a=r&&i.editable;let c;e[0]!==o?(c=o.startsWith("image/"),e[0]=o,e[1]=c):c=e[1];const u=c,d=a&&"outline-2 outline-blue-300 outline-offset-0";let f;e[2]!==d?(f=sc("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",d),e[2]=d,e[3]=f):f=e[3];let h;e[4]!==s?(h=D.jsx(nh,{asChild:!0,children:D.jsx("span",{children:s})}),e[4]=s,e[5]=h):h=e[5];let p;e[6]!==l||e[7]!==u||e[8]!==o||e[9]!==s?(p=D.jsx(rh,{side:"top",className:"max-w-sm p-1.5",children:u?D.jsx("img",{src:`data:${o};base64,${l}`,alt:s,className:"max-w-full max-h-64 object-contain rounded"}):D.jsxs("div",{className:"text-xs",children:[D.jsx("div",{className:"font-medium",children:s}),D.jsx("div",{className:"text-muted-foreground mt-1",children:o})]})}),e[6]=l,e[7]=u,e[8]=o,e[9]=s,e[10]=p):p=e[10];let g;e[11]!==h||e[12]!==p?(g=D.jsxs(ih,{children:[h,p]}),e[11]=h,e[12]=p,e[13]=g):g=e[13];let m;return e[14]!==f||e[15]!==g?(m=D.jsx(xd,{className:f,children:g}),e[14]=f,e[15]=g,e[16]=m):m=e[16],m}const wx=ye.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},mimeType:{default:null,parseHTML:t=>t.getAttribute("data-mime-type")||null,renderHTML:t=>t.mimeType?{"data-mime-type":t.mimeType}:{}},size:{default:0,parseHTML:t=>{const e=t.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:t=>t.size?{"data-size":String(t.size)}:{}},data:{default:null,parseHTML:t=>t.getAttribute("data-data")||null,renderHTML:t=>t.data?{"data-data":t.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"file"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.mimeType&&(n["data-mime-type"]=t.attrs.mimeType),t.attrs.size&&(n["data-size"]=String(t.attrs.size)),t.attrs.data&&(n["data-data"]=t.attrs.data),["span",{...e,...n}]},renderText({node:t}){return`[${t.attrs.name??""}]`},addNodeView(){return Cd(Jb)}});function Gb(t={}){return new F({view(e){return new Yb(e,t)}})}class Yb{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.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),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let m=this.width/2*l;r={left:p.left,right:p.right,top:g-m,bottom:g+m}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=uo(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Jt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Td=function(t,e,n,r){return n&&(wa(t,e,n,r,-1)||wa(t,e,n,r,1))},Xb=/^(img|br|input|textarea|hr)$/i;function wa(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:_r(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Lo(t)||Xb.test(t.nodeName)||t.contentEditable=="false")return!1;e=Jt(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?_r(t):0}else return!1}}function _r(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Qb(t,e,n){for(let r=e==0,i=e==_r(t);r||i;){if(t==n)return!0;let s=Jt(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==_r(t)}}function Lo(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const wd=function(t){return t.focusNode&&Td(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function vd(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Ve=typeof navigator<"u"?navigator:null,va=typeof document<"u"?document:null,Mt=Ve&&Ve.userAgent||"",js=/Edge\/(\d+)/.exec(Mt),Ad=/MSIE \d/.exec(Mt),Ws=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mt),pr=!!(Ad||Ws||js),Nd=Ad?document.documentMode:Ws?+Ws[1]:js?+js[1]:0,Bi=!pr&&/gecko\/(\d+)/i.test(Mt);Bi&&+(/Firefox\/(\d+)/.exec(Mt)||[0,0])[1];const Ks=!pr&&/Chrome\/(\d+)/.exec(Mt),rt=!!Ks,Od=Ks?+Ks[1]:0,Gt=!pr&&!!Ve&&/Apple Computer/.test(Ve.vendor),$o=Gt&&(/Mobile\/\w+/.test(Mt)||!!Ve&&Ve.maxTouchPoints>2),we=$o||(Ve?/Mac/.test(Ve.platform):!1),Dd=Ve?/Win/.test(Ve.platform):!1,mr=/Android \d/.test(Mt),zo=!!va&&"webkitFontSmoothing"in va.documentElement.style,Zb=zo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function e1(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(wd(n)){for(a=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&E.isSelectable(d)&&i.parent&&!(d.isInline&&Qb(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new E(o==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,o]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;c=Id(t,u,l,d)}return c}function Rd(t){return t.editable?t.hasFocus():i1(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Bo(t,e=!1){let n=t.state.selection;if(r1(t,n),!!Rd(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&rt){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Td(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)n1(t);else{let{anchor:r,head:i}=n,s,o;Aa&&!(n instanceof T)&&(n.$from.parent.inlineContent||(s=Na(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Na(t,n.to))),t.docView.setSelection(r,i,t,e),Aa&&(s&&Oa(s),o&&Oa(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&t1(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Aa=Gt||rt&&Od<63;function Na(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Gt&&i&&i.contentEditable=="false")return ls(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return ls(i);if(s)return ls(s)}}function ls(t){return t.contentEditable="true",Gt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Oa(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function t1(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Rd(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function n1(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Jt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&pr&&Nd<=11&&(n.disabled=!0,n.disabled=!1)}function r1(t,e){if(e instanceof E){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Da(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Da(t)}function Da(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Id(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||T.between(e,n,r)}function i1(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Us(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&O.findFrom(s,e)}function at(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Ra(t,e,n){let r=t.state.selection;if(r instanceof T)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return at(t,new T(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Us(t.state,e);return i&&i instanceof E?at(t,i):!1}else if(!(we&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?E.isSelectable(s)?at(t,new E(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):zo?at(t,new T(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof E&&r.node.isInline)return at(t,new T(e>0?r.$to:r.$from));{let i=Us(t.state,e);return i?at(t,i):!1}}}function qr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Fn(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function en(t,e){return e<0?s1(t):o1(t)}function s1(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Bi&&n.nodeType==1&&r<qr(n)&&Fn(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Fn(l,-1))i=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Pd(n))break;{let l=n.previousSibling;for(;l&&Fn(l,-1);)i=n.parentNode,s=Jt(l),l=l.previousSibling;if(l)n=l,r=qr(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?_s(t,n,r):i&&_s(t,i,s)}function o1(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=qr(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Fn(l,1))s=n,o=++r;else break}else{if(Pd(n))break;{let l=n.nextSibling;for(;l&&Fn(l,1);)s=l.parentNode,o=Jt(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=qr(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&_s(t,s,o)}function Pd(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function l1(t,e){for(;t&&e==t.childNodes.length&&!Lo(t);)e=Jt(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function a1(t,e){for(;t&&!e&&!Lo(t);)e=Jt(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function _s(t,e,n){if(e.nodeType!=3){let s,o;(o=l1(e,n))?(e=o,n=0):(s=a1(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(wd(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Bo(t)},50)}function Ia(t,e){let n=t.state.doc.resolve(e);if(!(rt||Dd)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Pa(t,e,n){let r=t.state.selection;if(r instanceof T&&!r.empty||n.indexOf("s")>-1||we&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Us(t.state,e);if(o&&o instanceof E)return at(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof ke?O.near(o,e):O.findFrom(o,e);return l?at(t,l):!1}return!1}function La(t,e){if(!(t.state.selection instanceof T))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function $a(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function c1(t){if(!Gt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;$a(t,r,"true"),setTimeout(()=>$a(t,r,"false"),20)}return!1}function u1(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function d1(t,e){let n=e.keyCode,r=u1(e);if(n==8||we&&n==72&&r=="c")return La(t,-1)||en(t,-1);if(n==46&&!e.shiftKey||we&&n==68&&r=="c")return La(t,1)||en(t,1);if(n==13||n==27)return!0;if(n==37||we&&n==66&&r=="c"){let i=n==37?Ia(t,t.state.selection.from)=="ltr"?-1:1:-1;return Ra(t,i,r)||en(t,i)}else if(n==39||we&&n==70&&r=="c"){let i=n==39?Ia(t,t.state.selection.from)=="ltr"?1:-1:1;return Ra(t,i,r)||en(t,i)}else{if(n==38||we&&n==80&&r=="c")return Pa(t,-1,r)||en(t,-1);if(n==40||we&&n==78&&r=="c")return c1(t)||Pa(t,1,r)||en(t,1);if(r==(we?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ld(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||et.fromSchema(t.state.schema),l=Vd(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Hd[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
98
+ `,textSerializers:n={}}=t||{};return by(this.state.doc,{blockSeparator:e,textSerializers:{...ld(this.schema),...n}})}get isEmpty(){return gr(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(){var t,e;return(t=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&t!==void 0?t:!0}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new F0(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Jt(t){return new yr({find:t.find,handler:({state:e,range:n,match:r})=>{const i=L(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=n.from+l.indexOf(o),u=c+o.length;if($o(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(h=>h===t.type&&h!==f.mark.type)).filter(f=>f.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+a,c);const d=n.from+a+o.length;s.addMark(n.from+a,d,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function j0(t){return new yr({find:t.find,handler:({state:e,range:n,match:r})=>{const i=L(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let l=n.to;const a=t.type.create(i);if(r[1]){let c=o+r[0].lastIndexOf(r[1]);c>l?c=l:l=c+r[1].length;const u=r[0][r[0].length-1];s.insertText(u,o+r[0].length-1),s.replaceWith(c,l,a)}else if(r[0]){const c=t.type.isInline?o:o-1;s.insert(c,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},undoable:t.undoable})}function _s(t){return new yr({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=L(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function Cn(t){return new yr({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=L(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),a=l&&mo(l,t.type,s);if(!a)return null;if(o.wrap(l,a),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:f}=t.editor.extensionManager,h=d||u.$to.parentOffset&&u.$from.marks();if(h){const p=h.filter(g=>f.includes(g.type.name));o.ensureMarks(p)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,s).run()}const c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&Et(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&o.join(n.from-1)},undoable:t.undoable})}const W0=t=>"touches"in t;var vx=class{constructor(t){var e,n,r,i,s,o;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=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.clientX-this.startX,c=l.clientY-this.startY;this.handleResize(a,c)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),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=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)},this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,!((e=t.options)===null||e===void 0)&&e.min&&(this.minSize={...this.minSize,...t.options.min}),!((n=t.options)===null||n===void 0)&&n.max&&(this.maxSize=t.options.max),!(t==null||(r=t.options)===null||r===void 0)&&r.directions&&(this.directions=t.options.directions),!((i=t.options)===null||i===void 0)&&i.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),!((s=t.options)===null||s===void 0)&&s.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),!((o=t.options)===null||o===void 0)&&o.createCustomHandle&&(this.createCustomHandle=t.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(){var t;return(t=this.contentElement)!==null&&t!==void 0?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}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(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),i=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(t.style.left="0"),s&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,W0(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.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(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,i,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,i=this.startHeight;const s=t.includes("right"),o=t.includes("left"),l=t.includes("bottom"),a=t.includes("top");return s?r=this.startWidth+e:o&&(r=this.startWidth-e),l?i=this.startHeight+n:a&&(i=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(s?e:-e)),(t==="top"||t==="bottom")&&(i=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,t):{width:r,height:i}}applyConstraints(t,e,n){var r,i;if(!n){var s,o;let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return!((s=this.maxSize)===null||s===void 0)&&s.width&&(c=Math.min(this.maxSize.width,c)),!((o=this.maxSize)===null||o===void 0)&&o.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let l=t,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),!((r=this.maxSize)===null||r===void 0)&&r.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),!((i=this.maxSize)===null||i===void 0)&&i.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",i=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:i?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}},ge=class Cd extends zo{constructor(...e){super(...e),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Cd(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},K0=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=()=>{try{return e.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n;const{view:r}=this.editor,i=t.target,s=i.nodeType===3?(e=i.parentElement)===null||e===void 0?void 0:e.closest("[data-drag-handle]"):i.closest("[data-drag-handle]");if(!this.dom||!((n=this.contentDOM)===null||n===void 0)&&n.contains(i)||!s)return;let o=0,l=0;if(this.dom!==s){var a,c,u,d;const b=this.dom.getBoundingClientRect(),S=s.getBoundingClientRect(),C=(a=t.offsetX)!==null&&a!==void 0?a:(c=t.nativeEvent)===null||c===void 0?void 0:c.offsetX,T=(u=t.offsetY)!==null&&u!==void 0?u:(d=t.nativeEvent)===null||d===void 0?void 0:d.offsetY;o=S.x-b.x+C,l=S.y-b.y+T}const f=this.dom.cloneNode(!0);try{const b=this.dom.getBoundingClientRect();f.style.width=`${Math.round(b.width)}px`,f.style.height=`${Math.round(b.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let h=null;try{var p;h=document.createElement("div"),h.style.position="absolute",h.style.top="-9999px",h.style.left="-9999px",h.style.pointerEvents="none",h.appendChild(f),document.body.appendChild(h),(p=t.dataTransfer)===null||p===void 0||p.setDragImage(f,o,l)}finally{h&&setTimeout(()=>{try{h?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const m=E.create(r.state.doc,g),y=r.state.tr.setSelection(m);r.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!(!((e=this.contentDOM)===null||e===void 0)&&e.contains(n))))return!1;const r=t.type.startsWith("drag"),i=t.type==="dragover"||t.type==="dragenter",s=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s&&!r)return!0;const{isEditable:o}=this.editor,{isDragging:l}=this,a=!!this.node.type.spec.draggable,c=E.isSelectable(this.node),u=t.type==="copy",d=t.type==="paste",f=t.type==="cut",h=t.type==="mousedown";if(!a&&c&&r&&t.target===this.dom&&t.preventDefault(),a&&r&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(a&&o&&!l&&h){const p=n.closest("[data-drag-handle]");p&&(this.dom===p||this.dom.contains(p))&&(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!(l||i||s||u||d||f||h&&c)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(or()||Ws())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function Mt(t){return new Sd({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=L(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const u=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if($o(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(p=>p===t.type&&p!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&o.delete(f,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+l.length,o.addMark(n.from+u,c,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:U0,getOwnPropertySymbols:_0}=Object,{hasOwnProperty:q0}=Object.prototype;function ds(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function Ar(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,o=s.get(n),l=s.get(r);if(o&&l)return o===r&&l===n;s.set(n,r),s.set(r,n);const a=t(n,r,i);return s.delete(n),s.delete(r),a}}function J0(t){return t?.[Symbol.toStringTag]}function Ta(t){return U0(t).concat(_0(t))}const G0=Object.hasOwn||((t,e)=>q0.call(t,e));function Yt(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const Y0="__v",X0="__o",Q0="_owner",{getOwnPropertyDescriptor:wa,keys:va}=Object;function Z0(t,e){return t.byteLength===e.byteLength&&Yr(new Uint8Array(t),new Uint8Array(e))}function eb(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function tb(t,e){return t.byteLength===e.byteLength&&Yr(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function nb(t,e){return Yt(t.getTime(),e.getTime())}function rb(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function ib(t,e){return t===e}function Aa(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let o,l,a=0;for(;(o=s.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(i[d]){d++;continue}const f=o.value,h=l.value;if(n.equals(f[0],h[0],a,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){u=i[d]=!0;break}d++}if(!u)return!1;a++}return!0}const sb=Yt;function ob(t,e,n){const r=va(t);let i=r.length;if(va(e).length!==i)return!1;for(;i-- >0;)if(!Md(t,e,n,r[i]))return!1;return!0}function An(t,e,n){const r=Ta(t);let i=r.length;if(Ta(e).length!==i)return!1;let s,o,l;for(;i-- >0;)if(s=r[i],!Md(t,e,n,s)||(o=wa(t,s),l=wa(e,s),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function lb(t,e){return Yt(t.valueOf(),e.valueOf())}function ab(t,e){return t.source===e.source&&t.flags===e.flags}function Na(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let o,l;for(;(o=s.next())&&!o.done;){const a=e.values();let c=!1,u=0;for(;(l=a.next())&&!l.done;){if(!i[u]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){c=i[u]=!0;break}u++}if(!c)return!1}return!0}function Yr(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function cb(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Md(t,e,n,r){return(r===Q0||r===X0||r===Y0)&&(t.$$typeof||e.$$typeof)?!0:G0(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const ub="[object ArrayBuffer]",db="[object Arguments]",fb="[object Boolean]",hb="[object DataView]",pb="[object Date]",mb="[object Error]",gb="[object Map]",yb="[object Number]",bb="[object Object]",kb="[object RegExp]",Sb="[object Set]",xb="[object String]",Cb={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Mb="[object URL]",Eb=Object.prototype.toString;function Tb({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(m,y,b){if(m===y)return!0;if(m==null||y==null)return!1;const S=typeof m;if(S!==typeof y)return!1;if(S!=="object")return S==="number"?l(m,y,b):S==="function"?s(m,y,b):!1;const C=m.constructor;if(C!==y.constructor)return!1;if(C===Object)return a(m,y,b);if(Array.isArray(m))return e(m,y,b);if(C===Date)return r(m,y,b);if(C===RegExp)return u(m,y,b);if(C===Map)return o(m,y,b);if(C===Set)return d(m,y,b);const T=Eb.call(m);if(T===pb)return r(m,y,b);if(T===kb)return u(m,y,b);if(T===gb)return o(m,y,b);if(T===Sb)return d(m,y,b);if(T===bb)return typeof m.then!="function"&&typeof y.then!="function"&&a(m,y,b);if(T===Mb)return h(m,y,b);if(T===mb)return i(m,y,b);if(T===db)return a(m,y,b);if(Cb[T])return f(m,y,b);if(T===ub)return t(m,y,b);if(T===hb)return n(m,y,b);if(T===fb||T===yb||T===xb)return c(m,y,b);if(p){let N=p[T];if(!N){const v=J0(m);v&&(N=p[v])}if(N)return N(m,y,b)}return!1}}function wb({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:Z0,areArraysEqual:n?An:eb,areDataViewsEqual:tb,areDatesEqual:nb,areErrorsEqual:rb,areFunctionsEqual:ib,areMapsEqual:n?ds(Aa,An):Aa,areNumbersEqual:sb,areObjectsEqual:n?An:ob,arePrimitiveWrappersEqual:lb,areRegExpsEqual:ab,areSetsEqual:n?ds(Na,An):Na,areTypedArraysEqual:n?ds(Yr,An):Yr,areUrlsEqual:cb,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=Ar(r.areArraysEqual),s=Ar(r.areMapsEqual),o=Ar(r.areObjectsEqual),l=Ar(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:l})}return r}function vb(t){return function(e,n,r,i,s,o,l){return t(e,n,l)}}function Ab({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(l,a){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(l,a,{cache:c,equals:r,meta:u,strict:i})};if(t)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(l,a){return e(l,a,s)}}const Nb=wt();wt({strict:!0});wt({circular:!0});wt({circular:!0,strict:!0});wt({createInternalComparator:()=>Yt});wt({strict:!0,createInternalComparator:()=>Yt});wt({circular:!0,createInternalComparator:()=>Yt});wt({circular:!0,createInternalComparator:()=>Yt,strict:!0});function wt(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=wb(t),o=Tb(s),l=n?n(o):vb(o);return Ab({circular:e,comparator:o,createState:r,equals:l,strict:i})}const Ob=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},Db=({contentComponent:t})=>{const e=uc.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return R.jsx(R.Fragment,{children:Object.values(e)})};function Rb(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(i=>i())}))};return{subscribe(i){return t.add(i),()=>{t.delete(i)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(i,s){e={...e,[i]:_f.createPortal(s.reactElement,s.element,i)},r()},removeRenderer(i){const s={...e};delete s[i],e=s,r()}}}var Ib=class extends Kt.Component{constructor(t){super(t),this.editorContentRef=Kt.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&(!((t=e.view.dom)===null||t===void 0)&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=Rb(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{var e;if(!(!((e=t.view.dom)===null||e===void 0)&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return R.jsxs(R.Fragment,{children:[R.jsx("div",{ref:Ob(e,this.editorContentRef),...n}),t?.contentComponent&&R.jsx(Db,{contentComponent:t.contentComponent})]})}};const Pb=F.forwardRef((t,e)=>{const n=Kt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Kt.createElement(Ib,{key:n,innerRef:e,...t})}),Lb=Kt.memo(Pb),$b=typeof window<"u"?F.useLayoutEffect:F.useEffect;var zb=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){let e;const n=i=>{i?.transaction!==void 0&&i.transaction===e||(e=i?.transaction,this.transactionNumber+=1,this.subscribers.forEach(s=>s()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function Bb(t){var e;const[n]=F.useState(()=>new zb(t.editor)),r=Kf.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:Nb);return $b(()=>n.watch(t.editor),[t.editor,n]),F.useDebugValue(r),r}const Fb=!1,Ed=typeof window>"u",Hb=Ed||!!(typeof window<"u"&&window.next);var Vb=class Td{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return Ed?(n&&Fb&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):Hb&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var r,i;return(r=(i=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(i,...n)},onBlur:(...n)=>{var r,i;return(r=(i=this.options.current).onBlur)===null||r===void 0?void 0:r.call(i,...n)},onCreate:(...n)=>{var r,i;return(r=(i=this.options.current).onCreate)===null||r===void 0?void 0:r.call(i,...n)},onDestroy:(...n)=>{var r,i;return(r=(i=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(i,...n)},onFocus:(...n)=>{var r,i;return(r=(i=this.options.current).onFocus)===null||r===void 0?void 0:r.call(i,...n)},onSelectionUpdate:(...n)=>{var r,i;return(r=(i=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(i,...n)},onTransaction:(...n)=>{var r,i;return(r=(i=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(i,...n)},onUpdate:(...n)=>{var r,i;return(r=(i=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(i,...n)},onContentError:(...n)=>{var r,i;return(r=(i=this.options.current).onContentError)===null||r===void 0?void 0:r.call(i,...n)},onDrop:(...n)=>{var r,i;return(r=(i=this.options.current).onDrop)===null||r===void 0?void 0:r.call(i,...n)},onPaste:(...n)=>{var r,i;return(r=(i=this.options.current).onPaste)===null||r===void 0?void 0:r.call(i,...n)},onDelete:(...n)=>{var r,i;return(r=(i=this.options.current).onDelete)===null||r===void 0?void 0:r.call(i,...n)},onMount:(...n)=>{var r,i;return(r=(i=this.options.current).onMount)===null||r===void 0?void 0:r.call(i,...n)},onUnmount:(...n)=>{var r,i;return(r=(i=this.options.current).onUnmount)===null||r===void 0?void 0:r.call(i,...n)}};return new V0(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=n.extensions)===null||o===void 0?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Td.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,r)=>n===e[r]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Ax(t={},e=[]){const n=F.useRef(t);n.current=t;const[r]=F.useState(()=>new Vb(n)),i=uc.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return F.useDebugValue(i),F.useEffect(r.onRender(e)),Bb({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}const Bo=F.createContext({editor:null});Bo.Consumer;const Nx=()=>F.useContext(Bo),wd=F.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),jb=()=>F.useContext(wd),vd=Kt.forwardRef((t,e)=>{const{onDragStart:n}=jb(),r=t.as||"div";return R.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Oa(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function Da(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function Wb(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function Kb(t){if(Oa(t)||Da(t))return!0;if(Wb(t)){const e=t.type;if(e)return Oa(e)||Da(e)}return!1}function Ub(){try{if(F.version)return parseInt(F.version.split(".")[0],10)>=19}catch{}return!1}var _b=class{constructor(t,{editor:e,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isEditorContentInitialized?Uf.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,i=Ub(),s=Kb(e),o={...n};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=l=>{this.ref=l}),this.reactElement=R.jsx(e,{...o}),r==null||(t=r.contentComponent)===null||t===void 0||t.setRenderer(this.id,this)}updateProps(t={}){if(this.destroyed)return;let e=!1;const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const i=n[r];if(t[i]!==this.props[i]){e=!0;break}}e&&(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;e==null||(t=e.contentComponent)===null||t===void 0||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};Kt.createContext({markViewContentRef:()=>{}});function qb(t){var e;const n=t.getRootNode(),r=typeof n.getSelection=="function"?n.getSelection():(e=t.ownerDocument)===null||e===void 0||(e=e.defaultView)===null||e===void 0?void 0:e.getSelection();if(!r||r.rangeCount===0)return null;const{anchorNode:i,anchorOffset:s,focusNode:o,focusOffset:l}=r;return!i||!o||!t.contains(i)||!t.contains(o)?null:()=>{try{r.setBaseAndExtent(i,s,o,l)}catch{}}}var Jb=class extends K0{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{const r=this.getPos();typeof r!="number"||r===this.currentPos||(this.currentPos=r,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs=="function"&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");r?r.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,i){if(r==="storage"){var s;return(s=t.storage[e.name])!==null&&s!==void 0?s:{}}return Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={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:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode(),ref:F.createRef()};if(!this.component.displayName){const a=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=a(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:a=>{if(a&&this.contentDOMElement&&a.firstChild!==this.contentDOMElement){a.hasAttribute("data-node-view-wrapper")&&a.removeAttribute("data-node-view-wrapper");const c=qb(this.contentDOMElement);a.appendChild(this.contentDOMElement),c?.()}}},i=this.component,s=F.memo(a=>R.jsx(wd.Provider,{value:r,children:F.createElement(i,a)}));s.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new _b(s,{editor:this.editor,props:t,as:o,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!((t=this.renderer.element.firstElementChild)===null||t===void 0)&&t.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.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{var t;this.selectionRafId=null;const e=(t=this.getPos())!==null&&t!==void 0?t:this.currentPos;if(typeof e=="number")if(Ay({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(t,e,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,l=this.decorations,a=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:o,oldDecorations:l,newNode:t,newDecorations:e,oldInnerDecorations:a,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(t===this.node)return this.node=t,this.decorations=e,this.innerDecorations=n,!0;const i=this.getPos();this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=i;const s={node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(s.getPos=()=>this.getPos()),r(s),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=xn(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function Ad(t,e){return n=>n.editor.contentComponent?new Jb(t,n,e):{dom:document.createElement("span"),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}}const Fo=F.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Fo.displayName="TiptapContext";const Gb=()=>F.useContext(Fo);function Nd({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=F.useMemo(()=>({editor:n}),[n]),i=F.useMemo(()=>({editor:n}),[n]);return R.jsx(Bo.Provider,{value:i,children:R.jsx(Fo.Provider,{value:r,children:t})})}Nd.displayName="Tiptap";function Od({...t}){const{editor:e}=Gb();return R.jsx(Lb,{editor:e,...t})}Od.displayName="Tiptap.Content";Object.assign(Nd,{Content:Od});function Yb(t){if(typeof t!="object"||t===null)return null;const{volume:e,path:n}=t;return typeof e!="string"||e===""||typeof n!="string"||n===""?null:`${e}/${n}/SKILL.md`}function Xb(t){return t.storage.mention}function Ox(t,e,n){t.chain().focus().insertContentAt(e,[Qb(n),{type:"text",text:" "}]).run()}function Qb(t){return{type:"mention",attrs:t}}function Dx(t,e,n){const r=t.state.doc.nodeAt(e);return r?.type.name==="mention"&&r.attrs.id===n}function Zb(t){const e=fo.c(43),{node:n,selected:r,view:i,editor:s,getPos:o}=t,{name:l,char:a,kind:c,id:u,args:d,metadata:f}=n.attrs,h=cc(),p=F.useContext(lh),g=r&&i.editable,m=c==="task",y=a==="@",b=i.editable&&a==="/"&&(c==="prompt"||c===void 0);let S;e[0]!==c||e[1]!==f?(S=c==="skill"?Yb(f):null,e[0]=c,e[1]=f,e[2]=S):S=e[2];const C=S,T=!!p&&!!C,N=b||T;let v;e[3]!==d||e[4]!==s||e[5]!==o||e[6]!==u||e[7]!==l?(v=()=>{const ll=Xb(s)?.onEditChip;if(!ll||typeof o!="function")return;const al=o();typeof al=="number"&&ll({promptId:u,promptName:l,args:d??{},pos:al})},e[3]=d,e[4]=s,e[5]=o,e[6]=u,e[7]=l,e[8]=v):v=e[8];const O=v;let P;e[9]!==p||e[10]!==T||e[11]!==C||e[12]!==O?(P=()=>{if(T&&C){p.open(C);return}O()},e[9]=p,e[10]=T,e[11]=C,e[12]=O,e[13]=P):P=e[13];const _=P;let ne;e[14]!==_||e[15]!==N?(ne=lt=>{N&&(lt.preventDefault(),lt.stopPropagation(),_())},e[14]=_,e[15]=N,e[16]=ne):ne=e[16];const ce=ne;let H;e[17]!==_||e[18]!==N?(H=lt=>{N&&(lt.key!=="Enter"&&lt.key!==" "||(lt.preventDefault(),lt.stopPropagation(),_()))},e[17]=_,e[18]=N,e[19]=H):H=e[19];const J=H,V=N?"button":void 0,re=N?0:void 0;let Se;e[20]!==N||e[21]!==l||e[22]!==T||e[23]!==h?(Se=N?h(T?"chat.mention.openSkill":"chat.mention.editPrompt",{name:l?dl(l):""}):void 0,e[20]=N,e[21]=l,e[22]=T,e[23]=h,e[24]=Se):Se=e[24];const Pe=N?"cursor-pointer":"cursor-default",ot=y?"bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",ie=g&&"outline-2 outline-blue-300 outline-offset-0",Le=N&&"hover:brightness-95",En=!m&&"capitalize";let We;e[25]!==ie||e[26]!==Le||e[27]!==En||e[28]!==Pe||e[29]!==ot?(We=dc("px-1 py-1 rounded","inline-flex items-center gap-1",Pe,"select-none","text-xs font-light",ot,ie,Le,En),e[25]=ie,e[26]=Le,e[27]=En,e[28]=Pe,e[29]=ot,e[30]=We):We=e[30];let Zt;e[31]!==m||e[32]!==l?(Zt=m?R.jsx("span",{className:"inline-block max-w-[220px] truncate align-bottom",children:l??""}):l?dl(l):"",e[31]=m,e[32]=l,e[33]=Zt):Zt=e[33];let Sr;return e[34]!==a||e[35]!==ce||e[36]!==J||e[37]!==We||e[38]!==Zt||e[39]!==V||e[40]!==re||e[41]!==Se?(Sr=R.jsxs(vd,{onClick:ce,onKeyDown:J,role:V,tabIndex:re,"aria-label":Se,className:We,children:[a,Zt]}),e[34]=a,e[35]=ce,e[36]=J,e[37]=We,e[38]=Zt,e[39]=V,e[40]=re,e[41]=Se,e[42]=Sr):Sr=e[42],Sr}const Rx=ge.create({name:"mention",group:"inline",inline:!0,atom:!0,addStorage(){return{onEditChip:null}},addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},char:{default:"/",parseHTML:t=>t.getAttribute("data-char")||"/",renderHTML:t=>t.char?{"data-char":t.char}:{}},metadata:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:t=>t.metadata?{"data-metadata":JSON.stringify(t.metadata)}:{}},kind:{default:void 0,parseHTML:t=>t.getAttribute("data-kind")||void 0,renderHTML:t=>t.kind?{"data-kind":t.kind}:{}},args:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-args")||"null")}catch{return null}},renderHTML:t=>t.args?{"data-args":JSON.stringify(t.args)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({HTMLAttributes:t}){return["span",Y(t,{"data-type":"mention"})]},renderText({node:t}){const e=t.attrs.char??"@",n=t.attrs.name??"";return`${e}${n}`},addNodeView(){return Ad(Zb)}});function Ix(t,e,n){t.chain().focus().insertContentAt(e,[e1(n),{type:"text",text:" "}]).run()}function e1(t){return{type:"file",attrs:t}}function t1(t){const e=fo.c(17),{node:n,selected:r,view:i}=t,{name:s,mimeType:o,data:l}=n.attrs,a=r&&i.editable;let c;e[0]!==o?(c=o.startsWith("image/"),e[0]=o,e[1]=c):c=e[1];const u=c,d=a&&"outline-2 outline-blue-300 outline-offset-0";let f;e[2]!==d?(f=dc("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",d),e[2]=d,e[3]=f):f=e[3];let h;e[4]!==s?(h=R.jsx(ah,{asChild:!0,children:R.jsx("span",{children:s})}),e[4]=s,e[5]=h):h=e[5];let p;e[6]!==l||e[7]!==u||e[8]!==o||e[9]!==s?(p=R.jsx(ch,{side:"top",className:"max-w-sm p-1.5",children:u?R.jsx("img",{src:`data:${o};base64,${l}`,alt:s,className:"max-w-full max-h-64 object-contain rounded"}):R.jsxs("div",{className:"text-xs",children:[R.jsx("div",{className:"font-medium",children:s}),R.jsx("div",{className:"text-muted-foreground mt-1",children:o})]})}),e[6]=l,e[7]=u,e[8]=o,e[9]=s,e[10]=p):p=e[10];let g;e[11]!==h||e[12]!==p?(g=R.jsxs(uh,{children:[h,p]}),e[11]=h,e[12]=p,e[13]=g):g=e[13];let m;return e[14]!==f||e[15]!==g?(m=R.jsx(vd,{className:f,children:g}),e[14]=f,e[15]=g,e[16]=m):m=e[16],m}const Px=ge.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},mimeType:{default:null,parseHTML:t=>t.getAttribute("data-mime-type")||null,renderHTML:t=>t.mimeType?{"data-mime-type":t.mimeType}:{}},size:{default:0,parseHTML:t=>{const e=t.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:t=>t.size?{"data-size":String(t.size)}:{}},data:{default:null,parseHTML:t=>t.getAttribute("data-data")||null,renderHTML:t=>t.data?{"data-data":t.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"file"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.mimeType&&(n["data-mime-type"]=t.attrs.mimeType),t.attrs.size&&(n["data-size"]=String(t.attrs.size)),t.attrs.data&&(n["data-data"]=t.attrs.data),["span",{...e,...n}]},renderText({node:t}){return`[${t.attrs.name??""}]`},addNodeView(){return Ad(t1)}});function n1(t={}){return new B({view(e){return new r1(e,t)}})}class r1{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.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),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let m=this.width/2*l;r={left:p.left,right:p.right,top:g-m,bottom:g+m}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=go(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Xt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Dd=function(t,e,n,r){return n&&(Ra(t,e,n,r,-1)||Ra(t,e,n,r,1))},i1=/^(img|br|input|textarea|hr)$/i;function Ra(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Xr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Ho(t)||i1.test(t.nodeName)||t.contentEditable=="false")return!1;e=Xt(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Xr(t):0}else return!1}}function Xr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function s1(t,e,n){for(let r=e==0,i=e==Xr(t);r||i;){if(t==n)return!0;let s=Xt(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Xr(t)}}function Ho(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Rd=function(t){return t.focusNode&&Dd(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Id(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const je=typeof navigator<"u"?navigator:null,Ia=typeof document<"u"?document:null,vt=je&&je.userAgent||"",qs=/Edge\/(\d+)/.exec(vt),Pd=/MSIE \d/.exec(vt),Js=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vt),br=!!(Pd||Js||qs),Ld=Pd?document.documentMode:Js?+Js[1]:qs?+qs[1]:0,Wi=!br&&/gecko\/(\d+)/i.test(vt);Wi&&+(/Firefox\/(\d+)/.exec(vt)||[0,0])[1];const Gs=!br&&/Chrome\/(\d+)/.exec(vt),st=!!Gs,$d=Gs?+Gs[1]:0,Qt=!br&&!!je&&/Apple Computer/.test(je.vendor),Vo=Qt&&(/Mobile\/\w+/.test(vt)||!!je&&je.maxTouchPoints>2),we=Vo||(je?/Mac/.test(je.platform):!1),zd=je?/Win/.test(je.platform):!1,kr=/Android \d/.test(vt),jo=!!Ia&&"webkitFontSmoothing"in Ia.documentElement.style,o1=jo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function l1(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Rd(n)){for(a=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&E.isSelectable(d)&&i.parent&&!(d.isInline&&s1(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new E(o==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,o]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;c=Fd(t,u,l,d)}return c}function Bd(t){return t.editable?t.hasFocus():d1(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Wo(t,e=!1){let n=t.state.selection;if(u1(t,n),!!Bd(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&st){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Dd(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)c1(t);else{let{anchor:r,head:i}=n,s,o;Pa&&!(n instanceof w)&&(n.$from.parent.inlineContent||(s=La(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=La(t,n.to))),t.docView.setSelection(r,i,t,e),Pa&&(s&&$a(s),o&&$a(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&a1(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Pa=Qt||st&&$d<63;function La(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Qt&&i&&i.contentEditable=="false")return fs(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return fs(i);if(s)return fs(s)}}function fs(t){return t.contentEditable="true",Qt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function $a(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function a1(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Bd(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function c1(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Xt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&br&&Ld<=11&&(n.disabled=!0,n.disabled=!1)}function u1(t,e){if(e instanceof E){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(za(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else za(t)}function za(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Fd(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||w.between(e,n,r)}function d1(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ys(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&D.findFrom(s,e)}function ft(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Ba(t,e,n){let r=t.state.selection;if(r instanceof w)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return ft(t,new w(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Ys(t.state,e);return i&&i instanceof E?ft(t,i):!1}else if(!(we&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?E.isSelectable(s)?ft(t,new E(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):jo?ft(t,new w(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof E&&r.node.isInline)return ft(t,new w(e>0?r.$to:r.$from));{let i=Ys(t.state,e);return i?ft(t,i):!1}}}function Qr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Wn(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function rn(t,e){return e<0?f1(t):h1(t)}function f1(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Wi&&n.nodeType==1&&r<Qr(n)&&Wn(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Wn(l,-1))i=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Hd(n))break;{let l=n.previousSibling;for(;l&&Wn(l,-1);)i=n.parentNode,s=Xt(l),l=l.previousSibling;if(l)n=l,r=Qr(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Xs(t,n,r):i&&Xs(t,i,s)}function h1(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Qr(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Wn(l,1))s=n,o=++r;else break}else{if(Hd(n))break;{let l=n.nextSibling;for(;l&&Wn(l,1);)s=l.parentNode,o=Xt(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=Qr(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Xs(t,s,o)}function Hd(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function p1(t,e){for(;t&&e==t.childNodes.length&&!Ho(t);)e=Xt(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function m1(t,e){for(;t&&!e&&!Ho(t);)e=Xt(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Xs(t,e,n){if(e.nodeType!=3){let s,o;(o=p1(e,n))?(e=o,n=0):(s=m1(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Rd(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Wo(t)},50)}function Fa(t,e){let n=t.state.doc.resolve(e);if(!(st||zd)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Ha(t,e,n){let r=t.state.selection;if(r instanceof w&&!r.empty||n.indexOf("s")>-1||we&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Ys(t.state,e);if(o&&o instanceof E)return ft(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof be?D.near(o,e):D.findFrom(o,e);return l?ft(t,l):!1}return!1}function Va(t,e){if(!(t.state.selection instanceof w))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function ja(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function g1(t){if(!Qt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;ja(t,r,"true"),setTimeout(()=>ja(t,r,"false"),20)}return!1}function y1(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function b1(t,e){let n=e.keyCode,r=y1(e);if(n==8||we&&n==72&&r=="c")return Va(t,-1)||rn(t,-1);if(n==46&&!e.shiftKey||we&&n==68&&r=="c")return Va(t,1)||rn(t,1);if(n==13||n==27)return!0;if(n==37||we&&n==66&&r=="c"){let i=n==37?Fa(t,t.state.selection.from)=="ltr"?-1:1:-1;return Ba(t,i,r)||rn(t,i)}else if(n==39||we&&n==70&&r=="c"){let i=n==39?Fa(t,t.state.selection.from)=="ltr"?1:-1:1;return Ba(t,i,r)||rn(t,i)}else{if(n==38||we&&n==80&&r=="c")return Ha(t,-1,r)||rn(t,-1);if(n==40||we&&n==78&&r=="c")return g1(t)||Ha(t,1,r)||rn(t,1);if(r==(we?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Vd(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||nt.fromSchema(t.state.schema),l=qd(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=_d[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
99
99
 
100
- `);return{dom:a,text:f,slice:e}}function $d(t,e,n,r,i){let s=i.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||s||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return l=new M(k.from(t.state.schema.text(e.replace(/\r\n?/g,`
101
- `))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)l=d;else{let f=i.marks(),{schema:h}=t.state,p=et.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=m1(n),zo&&g1(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Fe.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!f1.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=y1(za(l,+u[1],+u[2]),u[4]);else if(l=M.maxOpen(h1(l.content,i),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=za(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const f1=/^(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 h1(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&Bd(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Fd(o[o.length-1],s.length));let u=zd(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return k.from(o)}return t}function zd(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,k.from(t));return t}function Bd(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Bd(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(k.from(zd(n,t,i+1))))}}function Fd(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Fd(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(k.empty,!0);return t.copy(n.append(r))}function qs(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(s=0),i<r-1&&(l=qs(l,e,n,r,i+1,s)),i>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(k.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function za(t,e,n){return e<t.openStart&&(t=new M(qs(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new M(qs(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Hd={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Ba=null;function Vd(){return Ba||(Ba=document.implementation.createHTMLDocument("title"))}let as=null;function p1(t){let e=window.trustedTypes;return e?(as||(as=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),as.createHTML(t)):t}function m1(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Vd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Hd[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=p1(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function g1(t){let e=t.querySelectorAll(rt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function y1(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=k.from(a.create(r[l+1],i)),s++,o++}return new M(i,s,o)}const Pe={},Ce={};function ht(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Ce.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Wd(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(mr&&rt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),$o&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,vd(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||d1(t,n)?n.preventDefault():ht(t,"key")};Ce.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ce.keypress=(t,e)=>{let n=e;if(Wd(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||we&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof T)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Fi(t){return{left:t.clientX,top:t.clientY}}function b1(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Fo(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,l=>o>s.depth?l(t,n,s.nodeAfter,s.before(o),i,!0):l(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function dn(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function k1(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&E.isSelectable(r)?(dn(t,new E(n)),!0):!1}function S1(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof E&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(E.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(dn(t,E.create(t.state.doc,i)),!0):!1}function x1(t,e,n,r,i){return Fo(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?S1(t,n):k1(t,n))}function C1(t,e,n,r){return Fo(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function M1(t,e,n,r){return Fo(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||E1(t,n,r)}function E1(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(dn(t,T.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)dn(t,T.create(r,l+1,l+1+o.content.size));else if(E.isSelectable(o))dn(t,E.create(r,l));else continue;return!0}}function Ho(t){return Jr(t)}const jd=we?"metaKey":"ctrlKey";Pe.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ho(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&b1(n,t.input.lastClick)&&!n[jd]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Fi(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new T1(t,o,n,!!r)):(s=="doubleClick"?C1:M1)(t,o.pos,o.inside,n)?n.preventDefault():ht(t,"pointer"))};class T1{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[jd],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof E&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Bi&&!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)),ht(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(()=>Bo(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Fi(e))),this.updateAllowDefault(e),this.allowDefault||!n?ht(this.view,"pointer"):x1(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Gt&&this.mightDrag&&!this.mightDrag.node.isAtom||rt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(dn(this.view,O.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ht(this.view,"pointer")}move(e){this.updateAllowDefault(e),ht(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)}}Pe.touchstart=t=>{t.input.lastTouch=Date.now(),Ho(t),ht(t,"pointer")};Pe.touchmove=t=>{t.input.lastTouch=Date.now(),ht(t,"pointer")};Pe.contextmenu=t=>Ho(t);function Wd(t,e){return t.composing?!0:Gt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const w1=mr?5e3:-1;Ce.compositionstart=Ce.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof T&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||rt&&Dd&&v1(t)))t.markCursor=t.state.storedMarks||n.marks(),Jr(t,!0),t.markCursor=null;else if(Jr(t,!e.selection.empty),Bi&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}Kd(t,w1)};function v1(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Ce.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Kd(t,20))};function Kd(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Jr(t),e))}function A1(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=N1());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function N1(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Jr(t,e=!1){if(!(mr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),A1(t),e||t.docView&&t.docView.dirty){let n=e1(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function O1(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const rr=pr&&Nd<15||$o&&Zb<604;Pe.copy=Ce.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=rr?null:n.clipboardData,o=r.content(),{dom:l,text:a}=Ld(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):O1(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function D1(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function R1(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Js(t,r.value,null,i,e):Js(t,r.textContent,r.innerHTML,i,e)},50)}function Js(t,e,n,r,i){let s=$d(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,s||M.empty)))return!0;if(!s)return!1;let o=D1(s),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ud(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ce.paste=(t,e)=>{let n=e;if(t.composing&&!mr)return;let r=rr?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Js(t,Ud(r),r.getData("text/html"),i,n)?n.preventDefault():R1(t,n)};class I1{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const P1=we?"altKey":"ctrlKey";function _d(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[P1]}Pe.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Fi(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof E?i.to-1:i.to))){if(r&&r.mightDrag)o=E.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=E.create(t.state.doc,d.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:c,slice:u}=Ld(t,l);(!n.dataTransfer.files.length||!rt||Od>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(rr?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",rr||n.dataTransfer.setData("text/plain",c),t.dragging=new I1(u,_d(t,n),o)};Pe.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ce.dragover=Ce.dragenter=(t,e)=>e.preventDefault();Ce.drop=(t,e)=>{try{L1(t,e,t.dragging)}finally{t.dragging=null}};function L1(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Fi(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",h=>{s=h(s,t,!1)}):s=$d(t,Ud(e.dataTransfer),rr?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&_d(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||M.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?uo(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let a=t.state.tr;if(o){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,s.content.firstChild):a.replaceRange(c,c,s),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&E.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))a.setSelection(new E(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),a.setSelection(Id(t,f,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}Pe.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Bo(t)},20))};Pe.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Pe.beforeinput=(t,e)=>{if(rt&&mr&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,vd(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Ce)Pe[t]=Ce[t];function ir(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Gr{constructor(e,n){this.toDOM=e,this.spec=n||Bt,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Be(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Gr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ir(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class yt{constructor(e,n){this.attrs=e,this.spec=n||Bt}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Be(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof yt&&ir(this.attrs,e.attrs)&&ir(this.spec,e.spec)}static is(e){return e.type instanceof yt}destroy(){}}class Vo{constructor(e,n){this.attrs=e,this.spec=n||Bt}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Be(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Vo&&ir(this.attrs,e.attrs)&&ir(this.spec,e.spec)}destroy(){}}class Be{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Be(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Be(e,e,new Gr(n,r))}static inline(e,n,r,i){return new Be(e,n,new yt(r,i))}static node(e,n,r,i){return new Be(e,n,new Vo(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof yt}get widget(){return this.type instanceof Gr}}const on=[],Bt={};class ee{constructor(e,n){this.local=e.length?e:on,this.children=n.length?n:on}static create(e,n){return n.length?Yr(n,e,0,Bt):pe}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,i+l,s)}}map(e,n,r){return this==pe||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Bt)}mapInner(e,n,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(n,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?$1(this.children,o||[],e,n,r,i,s):o?new ee(o.sort(Ft),on):pe}add(e,n){return n.length?this==pe?ee.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Jd(n,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,u,c+1):i.splice(s,0,a,a+l.nodeSize,Yr(u,l,c+1,Bt)),s+=3}});let o=qd(s?Gd(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new ee(o.length?this.local.concat(o).sort(Ft):this.local,i||this.children)}remove(e){return e.length==0||this==pe?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+n,a=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,l+1);c!=pe?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ee(i,r):pe}forChild(e,n){if(this==pe)return this;if(n.isLeaf)return ee.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof yt){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new ee(i.sort(Ft),on);return r?new vt([l,r]):l}return r||pe}eq(e){if(this==e)return!0;if(!(e instanceof ee)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return jo(this.localsInner(e))}localsInner(e){if(this==pe)return on;if(e.inlineContent||!this.local.some(yt.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof yt||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ee.empty=new ee([],[]);ee.removeOverlap=jo;const pe=ee.empty;class vt{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Bt));return vt.from(r)}forChild(e,n){if(n.isLeaf)return ee.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=pe&&(s instanceof vt?r=r.concat(s.members):r.push(s))}return vt.from(r)}eq(e){if(!(e instanceof vt)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?jo(r?n:n.sort(Ft)):on}static from(e){switch(e.length){case 0:return pe;case 1:return e[0];default:return new vt(e.every(n=>n instanceof ee)?e:e.reduce((n,r)=>n.concat(r instanceof ee?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function $1(t,e,n,r,i,s,o){let l=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,g)=>{let m=g-p-(h-f);for(let y=0;y<l.length;y+=3){let b=l[y+1];if(b<0||f>b+u-d)continue;let S=l[y]+u-d;h>=S?l[y+1]=f<=S?-2:-1:f>=u&&m&&(l[y]+=m,l[y+1]+=m)}d+=m}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-i;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+s,-1),h=f-i,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=l[c+2].mapInner(n,m,u+1,t[c]+s+1,o);y!=pe?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=z1(l,t,e,n,i,s,o),u=Yr(c,r,0,o);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ee(e.sort(Ft),l)}function qd(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Be(i.from+e,i.to+e,i.type))}return n}function z1(t,e,n,r,i,s,o){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,i,c);d?n.push(d):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function Jd(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function Gd(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Yr(t,e,n,r){let i=[],s=!1;e.forEach((l,a)=>{let c=Jd(t,l,a+n);if(c){s=!0;let u=Yr(c,l,n+a+1,r);u!=pe&&i.push(a,a+l.nodeSize,u)}});let o=qd(s?Gd(t):t,-n).sort(Ft);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new ee(o,i):pe}function Ft(t,e){return t.from-e.from||t.to-e.to}function jo(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Fa(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Fa(e,i,r.copy(s.from,r.to)));break}}}return e}function Fa(t,e,n){for(;e<t.length&&Ft(n,t[e])>0;)e++;t.splice(e,0,n)}class W extends O{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return W.valid(r)?new W(r):O.near(r)}content(){return M.empty}eq(e){return e instanceof W&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new W(e.resolve(n.pos))}getBookmark(){return new Wo(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!B1(e)||!F1(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&W.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let a=e.doc.resolve(i);if(W.valid(a))return a}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!E.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let l=e.doc.resolve(i);if(W.valid(l))return l}return null}}}W.prototype.visible=!1;W.findFrom=W.findGapCursorFrom;O.jsonID("gapcursor",W);class Wo{constructor(e){this.pos=e}map(e){return new Wo(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return W.valid(n)?new W(n):O.near(n)}}function Yd(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function B1(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Yd(i.type))return!0;if(i.inlineContent)return!1}}return!0}function F1(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Yd(i.type))return!0;if(i.inlineContent)return!1}}return!0}function H1(){return new F({props:{decorations:K1,createSelectionBetween(t,e,n){return e.pos==n.pos&&W.valid(n)?new W(n):null},handleClick:j1,handleKeyDown:V1,handleDOMEvents:{beforeinput:W1}}})}const V1=Hu({ArrowLeft:Er("horiz",-1),ArrowRight:Er("horiz",1),ArrowUp:Er("vert",-1),ArrowDown:Er("vert",1)});function Er(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof T){if(!s.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=W.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new W(c))),!0):!1}}function j1(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!W.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&E.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new W(r))),!0)}function W1(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof W))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=k.empty;for(let o=r.length-1;o>=0;o--)i=k.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new M(i,0,0));return s.setSelection(T.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function K1(t){if(!(t.selection instanceof W))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ee.create(t.doc,[Be.widget(t.selection.head,e,{key:"gapcursor"})])}var Xr=200,ne=function(){};ne.prototype.append=function(e){return e.length?(e=ne.from(e),!this.length&&e||e.length<Xr&&this.leafAppend(e)||this.length<Xr&&e.leafPrepend(this)||this.appendInner(e)):this};ne.prototype.prepend=function(e){return e.length?ne.from(e).append(this):this};ne.prototype.appendInner=function(e){return new U1(this,e)};ne.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ne.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ne.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ne.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};ne.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};ne.from=function(e){return e instanceof ne?e:e&&e.length?new Xd(e):ne.empty};var Xd=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Xr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Xr)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(ne);ne.empty=new Xd([]);var U1=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ne);const _1=500;class De{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new Le(d.map));let h=d.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new Le(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(s)):d.selection,a=new De(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,n,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Le(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?s.pop():l=l.slice(0,l.length-1)),s.push(f),n&&(o++,n=void 0),i||(a=f)}let c=o-r.depth;return c>J1&&(l=q1(l,c),o-=c),new De(l.append(s),o)}remapping(e,n){let r=new Xn;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new De(this.items.append(e.map(n=>new Le(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=n;this.items.forEach(f=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),m=f.selection&&f.selection.map(s.slice(a+1,h));m&&l++,r.push(new Le(p,g,m))}else r.push(new Le(p))},i);let c=[];for(let f=n;f<o;f++)c.push(new Le(s.maps[f]));let u=this.items.slice(0,i).append(c).append(r),d=new De(u,l);return d.emptyItemCount()>_1&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let d=new Le(c.invert(),a,u),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&r--},this.items.length,0),new De(ne.from(i.reverse()),s)}}De.empty=new De(ne.empty,0);function q1(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Le{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Le(n.getMap().invert(),n,this.selection)}}}class ct{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const J1=20;function G1(t,e,n,r){let i=n.getMeta(Ht),s;if(i)return i.historyState;n.getMeta(Q1)&&(t=new ct(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Ht))return o.getMeta(Ht).redo?new ct(t.done.addTransform(n,void 0,r,Ir(e)),t.undone,Ha(n.mapping.maps),t.prevTime,t.prevComposition):new ct(t.done,t.undone.addTransform(n,void 0,r,Ir(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Y1(n,t.prevRanges)),c=o?cs(t.prevRanges,n.mapping):Ha(n.mapping.maps);return new ct(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Ir(e)),De.empty,c,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new ct(t.done.rebased(n,s),t.undone.rebased(n,s),cs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ct(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),cs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Y1(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Ha(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function cs(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function X1(t,e,n){let r=Ir(e),i=Ht.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new ct(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Ht,{redo:n,historyState:a})}let us=!1,Va=null;function Ir(t){let e=t.plugins;if(Va!=e){us=!1,Va=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){us=!0;break}}return us}const Ht=new X("history"),Q1=new X("closeHistory");function Z1(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new F({key:Ht,state:{init(){return new ct(De.empty,De.empty,null,0,-1)},apply(e,n,r){return G1(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Zd:r=="historyRedo"?ef:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function Qd(t,e){return(n,r)=>{let i=Ht.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=X1(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const Zd=Qd(!1,!0),ef=Qd(!0,!0);U.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new F({key:new X("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit,s=this.options.autoTrim;if(i==null||i===0||s===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const l=o-i,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(a,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=o-(s-r),a=o;return e.deleteRange(l,a),!(this.storage.characters({node:e.doc})>r)}})]}});const ek=U.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Gb(this.options)]}});U.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new F({key:new X("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return K.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(!a.isText){if(!(i>=c&&i<=c+a.nodeSize-1))return!1;o+=1}});let l=0;return t.descendants((a,c)=>{if(a.isText||!(i>=c&&i<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(tt.node(c,c+a.nodeSize,{class:this.options.className}))}),K.create(t,s)}}})]}});const tk=U.create({name:"gapCursor",addProseMirrorPlugins(){return[H1()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=L(A(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),tf="placeholder",ja=new X("tiptap__placeholder");function nf(t){const{editor:e,placeholder:n,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=t,u=[a];return o&&u.push(c),tt.node(i,i+s.nodeSize,{class:u.join(" "),[r]:typeof n=="function"?n({editor:e,node:s,pos:i,hasAnchor:l}):n})}function rf(t,e){return typeof t=="function"?t(e):t}function sf({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:s,to:o}){const{anchor:l}=i,a=[],c=t.isEmpty;return r.nodesBetween(s,o,(u,d)=>{const f=l>=d&&l<=d+u.nodeSize,h=!u.isLeaf&&fr(u);return u.type.isTextblock&&(f||!e.showOnlyCurrent)&&h&&a.push(nf({editor:t,isEmptyDoc:c,dataAttribute:n,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:rf(e.emptyNodeClass,{editor:t,node:u,pos:d,hasAnchor:f})},node:u,pos:d})),e.includeChildren}),a}function of({editor:t,options:e,dataAttribute:n,doc:r,selection:i}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:s}=i,o=[],l=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const a=r.resolve(s),c=a.depth>0?a.node(1):a.nodeAfter,u=a.depth>0?a.before(1):s;if(c&&c.type.isTextblock&&fr(c)){const d=s>=u&&s<=u+c.nodeSize;o.push(nf({editor:t,isEmptyDoc:l,dataAttribute:n,hasAnchor:d,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:rf(e.emptyNodeClass,{editor:t,node:c,pos:u,hasAnchor:d})},node:c,pos:u}))}}else o.push(...sf({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return K.create(r,o)}function Hn(t,e){const n=t.resolve(e);if(n.depth===0){var r;const s=(r=n.nodeAfter)!==null&&r!==void 0?r:n.nodeBefore;if(!s)return{from:e,to:e};const o=n.nodeAfter?e:e-s.nodeSize;return{from:o,to:o+s.nodeSize}}const i=n.before(1);return{from:i,to:i+n.node(1).nodeSize}}function Vn(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function nk(t,e,n){const r=[];return t.forEach((i,s)=>{const o=s,l=o+i.nodeSize,a=o+1,c=l+1;a<n&&c>e&&r.push({from:o,to:l})}),r}function rk(t){if(t.length===0)return[];const e=[...t].sort((r,i)=>r.from-i.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){const i=n[n.length-1],s=e[r];s.from<=i.to?i.to=Math.max(i.to,s.to):n.push({...s})}return n}function ik(t,e){const n=nk(t,e.from,e.to);return n.push(Vn(t,Hn(t,e.from))),e.to>e.from?n.push(Vn(t,Hn(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(Vn(t,Hn(t,Math.min(e.from+1,t.content.size)))),n}function sk(t,e,n){const r=[];if(t.docChanged){const i=$i(t);for(const s of i)r.push(...ik(n.doc,s.newRange))}return t.selectionSet&&(r.push(Vn(n.doc,Hn(n.doc,t.mapping.map(e.selection.anchor)))),r.push(Vn(n.doc,Hn(n.doc,n.selection.anchor)))),rk(r)}function ok(t,e,n){const r=Math.max(0,Math.min(t,n.content.size));return{from:r,to:Math.max(r,Math.min(e,n.content.size))}}function lk({decorations:t,ranges:e,editor:n,options:r,dataAttribute:i,doc:s,selection:o}){let l=t;for(const a of e){const{from:c,to:u}=ok(a.from,a.to,s),d=l.find(c,u).filter(h=>h.from>=c&&h.to<=u);d.length&&(l=l.remove(d));const f=sf({editor:n,options:r,dataAttribute:i,doc:s,selection:o,from:c,to:u});f.length&&(l=l.add(s,f))}return l}function ak({editor:t,options:e,dataAttribute:n}){return{init(r,i){const s=of({editor:t,options:e,dataAttribute:n,doc:i.doc,selection:i.selection});return s??K.empty},apply(r,i,s,o){return!r.docChanged&&!r.selectionSet?i:lk({decorations:i.map(r.mapping,r.doc),ranges:sk(r,s,o),editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function ck(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function uk({editor:t,options:e}){const n=e.dataAttribute?`data-${ck(e.dataAttribute)}`:`data-${tf}`,r=e.showOnlyCurrent&&!e.includeChildren;return new F({key:ja,...r?{}:{state:ak({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:i,selection:s})=>of({editor:t,options:e,dataAttribute:n,doc:i,selection:s}):i=>{var s;return e.showOnlyWhenEditable&&!t.isEditable?K.empty:(s=ja.getState(i))!==null&&s!==void 0?s:K.empty}}})}const vx=U.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:tf,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[uk({editor:this.editor,options:this.options})]}});function Gs(t,e){return!t.selection.empty&&!rd(t.selection)&&e.isEditable}function dk(t,e){return Gs(t,e)&&!e.isFocused&&!e.view.dragging}function fk(){var t;(t=window.getSelection())===null||t===void 0||t.removeAllRanges()}function hk(t){t.focus()}U.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new F({key:new X("selection"),props:{decorations(n){return dk(n,t)?K.create(n.doc,[tt.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return Gs(n.state,t)&&fk(),!1},focus(n){return Gs(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&hk(n)}),!1}}}})]}});function Wa({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}const pk=U.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new X(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)===null||t===void 0?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new F({key:e,appendTransaction:(i,s,o)=>{const{doc:l,tr:a,schema:c}=o,u=e.getState(o),d=l.content.size,f=c.nodes[n];if(!i.some(h=>h.getMeta("skipTrailingNode"))&&u)return a.insert(d,f.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!Wa({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!Wa({node:o,types:r})}}})]}}),mk=U.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Zd(t,e),redo:()=>({state:t,dispatch:e})=>ef(t,e)}},addProseMirrorPlugins(){return[Z1(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()}}}),lf=new WeakSet,af=new WeakSet;function Tt(t){const e=t;return lf.add(e),e}function Ys(t){return Array.isArray(t)&&lf.has(t)}function cf(t){return t.flatMap(e=>e==null?[]:Array.isArray(e)&&af.has(e)&&!Ys(e)?cf(e):[e])}function gk(t,e){if(t==="slot")return 0;if(t instanceof Function){const i=t(e);return Array.isArray(i)&&!Ys(i)&&!af.has(i)?Tt(i):i}const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(Ys(n))return Tt([t,r,n]);if(n.length===0)return Tt([t,r]);const i=cf(n);return i.length===0?Tt([t,r]):Tt([t,r,...i])}return n!=null?Tt([t,r,n]):Tt([t,r])}const Qr=(t,e)=>gk(t,e),yk=(t,e)=>{var n;const{state:r}=t,{selection:i}=r;if(!i.empty)return!1;const{$from:s}=i;if(s.parentOffset!==0)return!1;const o=s.depth-1;if(o<0)return!1;const l=s.node(o),a=s.index(o);if(a===0)return!1;if(l.type===e)return t.commands.lift(e.name);const c=l.child(a-1);if(c.type!==e||!(!((n=c.lastChild)===null||n===void 0)&&n.isTextblock))return!1;const u=s.before()-1-1;return t.commands.command(({tr:d,dispatch:f})=>{if(!f)return!0;const h=s.parent.content,p=new M(h,0,0);return d.replace(u,s.after(),p),d.setSelection(T.create(d.doc,u+h.size)),d.scrollIntoView(),f(d),!0})},bk=/^\s*>\s$/,kk=ye.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Qr("blockquote",{...Y(this.options.HTMLAttributes,t),children:Qr("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((i,s)=>{var o,l;const a=((o=(l=e.renderChild)===null||l===void 0?void 0:l.call(e,i,s))!==null&&o!==void 0?o:e.renderChildren([i])).split(`
100
+ `);return{dom:a,text:f,slice:e}}function jd(t,e,n,r,i){let s=i.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||s||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return l=new M(k.from(t.state.schema.text(e.replace(/\r\n?/g,`
101
+ `))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)l=d;else{let f=i.marks(),{schema:h}=t.state,p=nt.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=C1(n),jo&&M1(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||He.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!k1.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=E1(Wa(l,+u[1],+u[2]),u[4]);else if(l=M.maxOpen(S1(l.content,i),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=Wa(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const k1=/^(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 S1(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&Kd(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Ud(o[o.length-1],s.length));let u=Wd(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return k.from(o)}return t}function Wd(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,k.from(t));return t}function Kd(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Kd(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(k.from(Wd(n,t,i+1))))}}function Ud(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ud(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(k.empty,!0);return t.copy(n.append(r))}function Qs(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(s=0),i<r-1&&(l=Qs(l,e,n,r,i+1,s)),i>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(k.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function Wa(t,e,n){return e<t.openStart&&(t=new M(Qs(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new M(Qs(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const _d={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Ka=null;function qd(){return Ka||(Ka=document.implementation.createHTMLDocument("title"))}let hs=null;function x1(t){let e=window.trustedTypes;return e?(hs||(hs=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),hs.createHTML(t)):t}function C1(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=qd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&_d[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=x1(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function M1(t){let e=t.querySelectorAll(st?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function E1(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=k.from(a.create(r[l+1],i)),s++,o++}return new M(i,s,o)}const Ie={},Ce={};function yt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Ce.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Gd(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(kr&&st&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Vo&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Id(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||b1(t,n)?n.preventDefault():yt(t,"key")};Ce.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ce.keypress=(t,e)=>{let n=e;if(Gd(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||we&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof w)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Ki(t){return{left:t.clientX,top:t.clientY}}function T1(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Ko(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,l=>o>s.depth?l(t,n,s.nodeAfter,s.before(o),i,!0):l(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function pn(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function w1(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&E.isSelectable(r)?(pn(t,new E(n)),!0):!1}function v1(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof E&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(E.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(pn(t,E.create(t.state.doc,i)),!0):!1}function A1(t,e,n,r,i){return Ko(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?v1(t,n):w1(t,n))}function N1(t,e,n,r){return Ko(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function O1(t,e,n,r){return Ko(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||D1(t,n,r)}function D1(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(pn(t,w.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)pn(t,w.create(r,l+1,l+1+o.content.size));else if(E.isSelectable(o))pn(t,E.create(r,l));else continue;return!0}}function Uo(t){return Zr(t)}const Jd=we?"metaKey":"ctrlKey";Ie.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Uo(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&T1(n,t.input.lastClick)&&!n[Jd]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Ki(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new R1(t,o,n,!!r)):(s=="doubleClick"?N1:O1)(t,o.pos,o.inside,n)?n.preventDefault():yt(t,"pointer"))};class R1{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Jd],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof E&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Wi&&!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)),yt(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(()=>Wo(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ki(e))),this.updateAllowDefault(e),this.allowDefault||!n?yt(this.view,"pointer"):A1(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Qt&&this.mightDrag&&!this.mightDrag.node.isAtom||st&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(pn(this.view,D.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):yt(this.view,"pointer")}move(e){this.updateAllowDefault(e),yt(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)}}Ie.touchstart=t=>{t.input.lastTouch=Date.now(),Uo(t),yt(t,"pointer")};Ie.touchmove=t=>{t.input.lastTouch=Date.now(),yt(t,"pointer")};Ie.contextmenu=t=>Uo(t);function Gd(t,e){return t.composing?!0:Qt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const I1=kr?5e3:-1;Ce.compositionstart=Ce.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof w&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||st&&zd&&P1(t)))t.markCursor=t.state.storedMarks||n.marks(),Zr(t,!0),t.markCursor=null;else if(Zr(t,!e.selection.empty),Wi&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}Yd(t,I1)};function P1(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Ce.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Yd(t,20))};function Yd(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Zr(t),e))}function L1(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=$1());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function $1(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Zr(t,e=!1){if(!(kr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),L1(t),e||t.docView&&t.docView.dirty){let n=l1(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function z1(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const lr=br&&Ld<15||Vo&&o1<604;Ie.copy=Ce.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=lr?null:n.clipboardData,o=r.content(),{dom:l,text:a}=Vd(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):z1(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function B1(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function F1(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Zs(t,r.value,null,i,e):Zs(t,r.textContent,r.innerHTML,i,e)},50)}function Zs(t,e,n,r,i){let s=jd(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,s||M.empty)))return!0;if(!s)return!1;let o=B1(s),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Xd(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ce.paste=(t,e)=>{let n=e;if(t.composing&&!kr)return;let r=lr?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Zs(t,Xd(r),r.getData("text/html"),i,n)?n.preventDefault():F1(t,n)};class H1{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const V1=we?"altKey":"ctrlKey";function Qd(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[V1]}Ie.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Ki(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof E?i.to-1:i.to))){if(r&&r.mightDrag)o=E.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=E.create(t.state.doc,d.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:c,slice:u}=Vd(t,l);(!n.dataTransfer.files.length||!st||$d>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(lr?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",lr||n.dataTransfer.setData("text/plain",c),t.dragging=new H1(u,Qd(t,n),o)};Ie.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ce.dragover=Ce.dragenter=(t,e)=>e.preventDefault();Ce.drop=(t,e)=>{try{j1(t,e,t.dragging)}finally{t.dragging=null}};function j1(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Ki(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",h=>{s=h(s,t,!1)}):s=jd(t,Xd(e.dataTransfer),lr?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&Qd(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||M.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?go(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let a=t.state.tr;if(o){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,s.content.firstChild):a.replaceRange(c,c,s),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&E.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))a.setSelection(new E(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),a.setSelection(Fd(t,f,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}Ie.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Wo(t)},20))};Ie.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ie.beforeinput=(t,e)=>{if(st&&kr&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Id(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Ce)Ie[t]=Ce[t];function ar(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class ei{constructor(e,n){this.toDOM=e,this.spec=n||Vt,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Fe(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ei&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ar(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class xt{constructor(e,n){this.attrs=e,this.spec=n||Vt}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Fe(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof xt&&ar(this.attrs,e.attrs)&&ar(this.spec,e.spec)}static is(e){return e.type instanceof xt}destroy(){}}class _o{constructor(e,n){this.attrs=e,this.spec=n||Vt}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Fe(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof _o&&ar(this.attrs,e.attrs)&&ar(this.spec,e.spec)}destroy(){}}class Fe{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Fe(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Fe(e,e,new ei(n,r))}static inline(e,n,r,i){return new Fe(e,n,new xt(r,i))}static node(e,n,r,i){return new Fe(e,n,new _o(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof xt}get widget(){return this.type instanceof ei}}const cn=[],Vt={};class Z{constructor(e,n){this.local=e.length?e:cn,this.children=n.length?n:cn}static create(e,n){return n.length?ti(n,e,0,Vt):he}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,i+l,s)}}map(e,n,r){return this==he||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Vt)}mapInner(e,n,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(n,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?W1(this.children,o||[],e,n,r,i,s):o?new Z(o.sort(jt),cn):he}add(e,n){return n.length?this==he?Z.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((l,a)=>{let c=a+r,u;if(u=ef(n,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,u,c+1):i.splice(s,0,a,a+l.nodeSize,ti(u,l,c+1,Vt)),s+=3}});let o=Zd(s?tf(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new Z(o.length?this.local.concat(o).sort(jt):this.local,i||this.children)}remove(e){return e.length==0||this==he?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+n,a=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,l+1);c!=he?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Z(i,r):he}forChild(e,n){if(this==he)return this;if(n.isLeaf)return Z.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof xt){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new Z(i.sort(jt),cn);return r?new Ot([l,r]):l}return r||he}eq(e){if(this==e)return!0;if(!(e instanceof Z)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return qo(this.localsInner(e))}localsInner(e){if(this==he)return cn;if(e.inlineContent||!this.local.some(xt.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof xt||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Z.empty=new Z([],[]);Z.removeOverlap=qo;const he=Z.empty;class Ot{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Vt));return Ot.from(r)}forChild(e,n){if(n.isLeaf)return Z.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=he&&(s instanceof Ot?r=r.concat(s.members):r.push(s))}return Ot.from(r)}eq(e){if(!(e instanceof Ot)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?qo(r?n:n.sort(jt)):cn}static from(e){switch(e.length){case 0:return he;case 1:return e[0];default:return new Ot(e.every(n=>n instanceof Z)?e:e.reduce((n,r)=>n.concat(r instanceof Z?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function W1(t,e,n,r,i,s,o){let l=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,g)=>{let m=g-p-(h-f);for(let y=0;y<l.length;y+=3){let b=l[y+1];if(b<0||f>b+u-d)continue;let S=l[y]+u-d;h>=S?l[y+1]=f<=S?-2:-1:f>=u&&m&&(l[y]+=m,l[y+1]+=m)}d+=m}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-i;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+s,-1),h=f-i,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=l[c+2].mapInner(n,m,u+1,t[c]+s+1,o);y!=he?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=K1(l,t,e,n,i,s,o),u=ti(c,r,0,o);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new Z(e.sort(jt),l)}function Zd(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Fe(i.from+e,i.to+e,i.type))}return n}function K1(t,e,n,r,i,s,o){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,i,c);d?n.push(d):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function ef(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function tf(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function ti(t,e,n,r){let i=[],s=!1;e.forEach((l,a)=>{let c=ef(t,l,a+n);if(c){s=!0;let u=ti(c,l,n+a+1,r);u!=he&&i.push(a,a+l.nodeSize,u)}});let o=Zd(s?tf(t):t,-n).sort(jt);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new Z(o,i):he}function jt(t,e){return t.from-e.from||t.to-e.to}function qo(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Ua(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Ua(e,i,r.copy(s.from,r.to)));break}}}return e}function Ua(t,e,n){for(;e<t.length&&jt(n,t[e])>0;)e++;t.splice(e,0,n)}class W extends D{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return W.valid(r)?new W(r):D.near(r)}content(){return M.empty}eq(e){return e instanceof W&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new W(e.resolve(n.pos))}getBookmark(){return new Jo(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!U1(e)||!_1(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&W.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let a=e.doc.resolve(i);if(W.valid(a))return a}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!E.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let l=e.doc.resolve(i);if(W.valid(l))return l}return null}}}W.prototype.visible=!1;W.findFrom=W.findGapCursorFrom;D.jsonID("gapcursor",W);class Jo{constructor(e){this.pos=e}map(e){return new Jo(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return W.valid(n)?new W(n):D.near(n)}}function nf(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function U1(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||nf(i.type))return!0;if(i.inlineContent)return!1}}return!0}function _1(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||nf(i.type))return!0;if(i.inlineContent)return!1}}return!0}function q1(){return new B({props:{decorations:X1,createSelectionBetween(t,e,n){return e.pos==n.pos&&W.valid(n)?new W(n):null},handleClick:G1,handleKeyDown:J1,handleDOMEvents:{beforeinput:Y1}}})}const J1=_u({ArrowLeft:Nr("horiz",-1),ArrowRight:Nr("horiz",1),ArrowUp:Nr("vert",-1),ArrowDown:Nr("vert",1)});function Nr(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof w){if(!s.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=W.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new W(c))),!0):!1}}function G1(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!W.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&E.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new W(r))),!0)}function Y1(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof W))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=k.empty;for(let o=r.length-1;o>=0;o--)i=k.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new M(i,0,0));return s.setSelection(w.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function X1(t){if(!(t.selection instanceof W))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Z.create(t.doc,[Fe.widget(t.selection.head,e,{key:"gapcursor"})])}var ni=200,te=function(){};te.prototype.append=function(e){return e.length?(e=te.from(e),!this.length&&e||e.length<ni&&this.leafAppend(e)||this.length<ni&&e.leafPrepend(this)||this.appendInner(e)):this};te.prototype.prepend=function(e){return e.length?te.from(e).append(this):this};te.prototype.appendInner=function(e){return new Q1(this,e)};te.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?te.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};te.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};te.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};te.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};te.from=function(e){return e instanceof te?e:e&&e.length?new rf(e):te.empty};var rf=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=ni)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=ni)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(te);te.empty=new rf([]);var Q1=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(te);const Z1=500;class Oe{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new $e(d.map));let h=d.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new $e(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(s)):d.selection,a=new Oe(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,n,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new $e(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?s.pop():l=l.slice(0,l.length-1)),s.push(f),n&&(o++,n=void 0),i||(a=f)}let c=o-r.depth;return c>tk&&(l=ek(l,c),o-=c),new Oe(l.append(s),o)}remapping(e,n){let r=new tr;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Oe(this.items.append(e.map(n=>new $e(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=n;this.items.forEach(f=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),m=f.selection&&f.selection.map(s.slice(a+1,h));m&&l++,r.push(new $e(p,g,m))}else r.push(new $e(p))},i);let c=[];for(let f=n;f<o;f++)c.push(new $e(s.maps[f]));let u=this.items.slice(0,i).append(c).append(r),d=new Oe(u,l);return d.emptyItemCount()>Z1&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let d=new $e(c.invert(),a,u),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&r--},this.items.length,0),new Oe(te.from(i.reverse()),s)}}Oe.empty=new Oe(te.empty,0);function ek(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class $e{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new $e(n.getMap().invert(),n,this.selection)}}}class ht{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const tk=20;function nk(t,e,n,r){let i=n.getMeta(Wt),s;if(i)return i.historyState;n.getMeta(sk)&&(t=new ht(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Wt))return o.getMeta(Wt).redo?new ht(t.done.addTransform(n,void 0,r,Br(e)),t.undone,_a(n.mapping.maps),t.prevTime,t.prevComposition):new ht(t.done,t.undone.addTransform(n,void 0,r,Br(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!rk(n,t.prevRanges)),c=o?ps(t.prevRanges,n.mapping):_a(n.mapping.maps);return new ht(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Br(e)),Oe.empty,c,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new ht(t.done.rebased(n,s),t.undone.rebased(n,s),ps(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ht(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ps(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function rk(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function _a(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function ps(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function ik(t,e,n){let r=Br(e),i=Wt.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new ht(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Wt,{redo:n,historyState:a})}let ms=!1,qa=null;function Br(t){let e=t.plugins;if(qa!=e){ms=!1,qa=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ms=!0;break}}return ms}const Wt=new X("history"),sk=new X("closeHistory");function ok(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new B({key:Wt,state:{init(){return new ht(Oe.empty,Oe.empty,null,0,-1)},apply(e,n,r){return nk(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?of:r=="historyRedo"?lf:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function sf(t,e){return(n,r)=>{let i=Wt.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=ik(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const of=sf(!1,!0),lf=sf(!0,!0);U.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new B({key:new X("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit,s=this.options.autoTrim;if(i==null||i===0||s===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const l=o-i,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(a,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=o-(s-r),a=o;return e.deleteRange(l,a),!(this.storage.characters({node:e.doc})>r)}})]}});const lk=U.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[n1(this.options)]}});U.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new B({key:new X("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return K.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(!a.isText){if(!(i>=c&&i<=c+a.nodeSize-1))return!1;o+=1}});let l=0;return t.descendants((a,c)=>{if(a.isText||!(i>=c&&i<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(rt.node(c,c+a.nodeSize,{class:this.options.className}))}),K.create(t,s)}}})]}});const ak=U.create({name:"gapCursor",addProseMirrorPlugins(){return[q1()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=L(A(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),af="placeholder",Ja=new X("tiptap__placeholder");function cf(t){const{editor:e,placeholder:n,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=t,u=[a];return o&&u.push(c),rt.node(i,i+s.nodeSize,{class:u.join(" "),[r]:typeof n=="function"?n({editor:e,node:s,pos:i,hasAnchor:l}):n})}function uf(t,e){return typeof t=="function"?t(e):t}function df({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:s,to:o}){const{anchor:l}=i,a=[],c=t.isEmpty;return r.nodesBetween(s,o,(u,d)=>{const f=l>=d&&l<=d+u.nodeSize,h=!u.isLeaf&&gr(u);return u.type.isTextblock&&(f||!e.showOnlyCurrent)&&h&&a.push(cf({editor:t,isEmptyDoc:c,dataAttribute:n,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:uf(e.emptyNodeClass,{editor:t,node:u,pos:d,hasAnchor:f})},node:u,pos:d})),e.includeChildren}),a}function ff({editor:t,options:e,dataAttribute:n,doc:r,selection:i}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:s}=i,o=[],l=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const a=r.resolve(s),c=a.depth>0?a.node(1):a.nodeAfter,u=a.depth>0?a.before(1):s;if(c&&c.type.isTextblock&&gr(c)){const d=s>=u&&s<=u+c.nodeSize;o.push(cf({editor:t,isEmptyDoc:l,dataAttribute:n,hasAnchor:d,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:uf(e.emptyNodeClass,{editor:t,node:c,pos:u,hasAnchor:d})},node:c,pos:u}))}}else o.push(...df({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return K.create(r,o)}function Kn(t,e){const n=t.resolve(e);if(n.depth===0){var r;const s=(r=n.nodeAfter)!==null&&r!==void 0?r:n.nodeBefore;if(!s)return{from:e,to:e};const o=n.nodeAfter?e:e-s.nodeSize;return{from:o,to:o+s.nodeSize}}const i=n.before(1);return{from:i,to:i+n.node(1).nodeSize}}function Un(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function ck(t,e,n){const r=[];return t.forEach((i,s)=>{const o=s,l=o+i.nodeSize,a=o+1,c=l+1;a<n&&c>e&&r.push({from:o,to:l})}),r}function uk(t){if(t.length===0)return[];const e=[...t].sort((r,i)=>r.from-i.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){const i=n[n.length-1],s=e[r];s.from<=i.to?i.to=Math.max(i.to,s.to):n.push({...s})}return n}function dk(t,e){const n=ck(t,e.from,e.to);return n.push(Un(t,Kn(t,e.from))),e.to>e.from?n.push(Un(t,Kn(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(Un(t,Kn(t,Math.min(e.from+1,t.content.size)))),n}function fk(t,e,n){const r=[];if(t.docChanged){const i=Vi(t);for(const s of i)r.push(...dk(n.doc,s.newRange))}return t.selectionSet&&(r.push(Un(n.doc,Kn(n.doc,t.mapping.map(e.selection.anchor)))),r.push(Un(n.doc,Kn(n.doc,n.selection.anchor)))),uk(r)}function hk(t,e,n){const r=Math.max(0,Math.min(t,n.content.size));return{from:r,to:Math.max(r,Math.min(e,n.content.size))}}function pk({decorations:t,ranges:e,editor:n,options:r,dataAttribute:i,doc:s,selection:o}){let l=t;for(const a of e){const{from:c,to:u}=hk(a.from,a.to,s),d=l.find(c,u).filter(h=>h.from>=c&&h.to<=u);d.length&&(l=l.remove(d));const f=df({editor:n,options:r,dataAttribute:i,doc:s,selection:o,from:c,to:u});f.length&&(l=l.add(s,f))}return l}function mk({editor:t,options:e,dataAttribute:n}){return{init(r,i){const s=ff({editor:t,options:e,dataAttribute:n,doc:i.doc,selection:i.selection});return s??K.empty},apply(r,i,s,o){return!r.docChanged&&!r.selectionSet?i:pk({decorations:i.map(r.mapping,r.doc),ranges:fk(r,s,o),editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function gk(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function yk({editor:t,options:e}){const n=e.dataAttribute?`data-${gk(e.dataAttribute)}`:`data-${af}`,r=e.showOnlyCurrent&&!e.includeChildren;return new B({key:Ja,...r?{}:{state:mk({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:i,selection:s})=>ff({editor:t,options:e,dataAttribute:n,doc:i,selection:s}):i=>{var s;return e.showOnlyWhenEditable&&!t.isEditable?K.empty:(s=Ja.getState(i))!==null&&s!==void 0?s:K.empty}}})}const Lx=U.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:af,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[yk({editor:this.editor,options:this.options})]}});function eo(t,e){return!t.selection.empty&&!cd(t.selection)&&e.isEditable}function bk(t,e){return eo(t,e)&&!e.isFocused&&!e.view.dragging}function kk(){var t;(t=window.getSelection())===null||t===void 0||t.removeAllRanges()}function Sk(t){t.focus()}U.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new B({key:new X("selection"),props:{decorations(n){return bk(n,t)?K.create(n.doc,[rt.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return eo(n.state,t)&&kk(),!1},focus(n){return eo(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&Sk(n)}),!1}}}})]}});function Ga({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}const xk=U.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new X(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)===null||t===void 0?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new B({key:e,appendTransaction:(i,s,o)=>{const{doc:l,tr:a,schema:c}=o,u=e.getState(o),d=l.content.size,f=c.nodes[n];if(!i.some(h=>h.getMeta("skipTrailingNode"))&&u)return a.insert(d,f.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!Ga({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!Ga({node:o,types:r})}}})]}}),Ck=U.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>of(t,e),redo:()=>({state:t,dispatch:e})=>lf(t,e)}},addProseMirrorPlugins(){return[ok(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()}}}),hf=new WeakSet,pf=new WeakSet;function At(t){const e=t;return hf.add(e),e}function to(t){return Array.isArray(t)&&hf.has(t)}function mf(t){return t.flatMap(e=>e==null?[]:Array.isArray(e)&&pf.has(e)&&!to(e)?mf(e):[e])}function Mk(t,e){if(t==="slot")return 0;if(t instanceof Function){const i=t(e);return Array.isArray(i)&&!to(i)&&!pf.has(i)?At(i):i}const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(to(n))return At([t,r,n]);if(n.length===0)return At([t,r]);const i=mf(n);return i.length===0?At([t,r]):At([t,r,...i])}return n!=null?At([t,r,n]):At([t,r])}const ri=(t,e)=>Mk(t,e),Ek=(t,e)=>{var n;const{state:r}=t,{selection:i}=r;if(!i.empty)return!1;const{$from:s}=i;if(s.parentOffset!==0)return!1;const o=s.depth-1;if(o<0)return!1;const l=s.node(o),a=s.index(o);if(a===0)return!1;if(l.type===e)return t.commands.lift(e.name);const c=l.child(a-1);if(c.type!==e||!(!((n=c.lastChild)===null||n===void 0)&&n.isTextblock))return!1;const u=s.before()-1-1;return t.commands.command(({tr:d,dispatch:f})=>{if(!f)return!0;const h=s.parent.content,p=new M(h,0,0);return d.replace(u,s.after(),p),d.setSelection(w.create(d.doc,u+h.size)),d.scrollIntoView(),f(d),!0})},Tk=/^\s*>\s$/,wk=ge.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return ri("blockquote",{...Y(this.options.HTMLAttributes,t),children:ri("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((i,s)=>{var o,l;const a=((o=(l=e.renderChild)===null||l===void 0?void 0:l.call(e,i,s))!==null&&o!==void 0?o:e.renderChildren([i])).split(`
102
102
  `).map(c=>c.trim()===""?n:`${n} ${c}`);r.push(a.join(`
103
103
  `))}),r.join(`
104
104
  ${n}
105
- `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>yk(this.editor,this.type)}},addInputRules(){return[kn({find:bk,type:this.type})]}}),Sk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,xk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Ck=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Mk=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Ek=_t.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Qr("strong",{...Y(this.options.HTMLAttributes,t),children:Qr("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ut({find:Sk,type:this.type}),Ut({find:Ck,type:this.type})]},addPasteRules(){return[kt({find:xk,type:this.type}),kt({find:Mk,type:this.type})]}}),Tk=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},wk=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},vk=_t.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Y(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ut({find:Tk,type:this.type})]},addPasteRules(){return[kt({find:wk,type:this.type})]}}),ds=4,Ak=/^```([a-z]+)?[\s\n]$/,Nk=/^~~~([a-z]+)?[\s\n]$/,Ok=ye.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:ds,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const r=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Y(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)===null||n===void 0?void 0:n.startsWith("```"))===!1&&((r=t.raw)===null||r===void 0?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)===null||n===void 0?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
105
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>Ek(this.editor,this.type)}},addInputRules(){return[Cn({find:Tk,type:this.type})]}}),vk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ak=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Nk=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Ok=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Dk=Gt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return ri("strong",{...Y(this.options.HTMLAttributes,t),children:ri("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Jt({find:vk,type:this.type}),Jt({find:Nk,type:this.type})]},addPasteRules(){return[Mt({find:Ak,type:this.type}),Mt({find:Ok,type:this.type})]}}),Rk=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},Ik=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},Pk=Gt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Y(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Jt({find:Rk,type:this.type})]},addPasteRules(){return[Mt({find:Ik,type:this.type})]}}),gs=4,Lk=/^```([a-z]+)?[\s\n]$/,$k=/^~~~([a-z]+)?[\s\n]$/,zk=ge.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:gs,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const r=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Y(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)===null||n===void 0?void 0:n.startsWith("```"))===!1&&((r=t.raw)===null||r===void 0?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)===null||n===void 0?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
106
106
  `):r=`\`\`\`${i}
107
107
 
108
- \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!==null&&e!==void 0?e:ds,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:a})=>{const{from:c,to:u}=i,d=r.doc.textBetween(c,u,`
108
+ \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!==null&&e!==void 0?e:gs,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:a})=>{const{from:c,to:u}=i,d=r.doc.textBetween(c,u,`
109
109
  `,`
110
110
  `).split(`
111
111
  `).map(f=>l+f).join(`
112
- `);return a.replaceWith(c,u,r.schema.text(d)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!==null&&e!==void 0?e:ds,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var a;const{pos:c}=s,u=s.start(),d=s.end(),f=r.doc.textBetween(u,d,`
112
+ `);return a.replaceWith(c,u,r.schema.text(d)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!==null&&e!==void 0?e:gs,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var a;const{pos:c}=s,u=s.start(),d=s.end(),f=r.doc.textBetween(u,d,`
113
113
  `,`
114
114
  `).split(`
115
- `);let h=0,p=0;const g=c-u;for(let S=0;S<f.length;S+=1){if(p+f[S].length>=g){h=S;break}p+=f[S].length+1}const m=((a=f[h].match(/^ */))===null||a===void 0?void 0:a[0])||"",y=Math.min(m.length,n);if(y===0)return!0;let b=u;for(let S=0;S<h;S+=1)b+=f[S].length+1;return l.delete(b,b+y),c-b<=y&&l.setSelection(T.create(l.doc,b)),!0}):t.commands.command(({tr:l})=>{const{from:a,to:c}=i,u=r.doc.textBetween(a,c,`
115
+ `);let h=0,p=0;const g=c-u;for(let S=0;S<f.length;S+=1){if(p+f[S].length>=g){h=S;break}p+=f[S].length+1}const m=((a=f[h].match(/^ */))===null||a===void 0?void 0:a[0])||"",y=Math.min(m.length,n);if(y===0)return!0;let b=u;for(let S=0;S<h;S+=1)b+=f[S].length+1;return l.delete(b,b+y),c-b<=y&&l.setSelection(w.create(l.doc,b)),!0}):t.commands.command(({tr:l})=>{const{from:a,to:c}=i,u=r.doc.textBetween(a,c,`
116
116
  `,`
117
117
  `).split(`
118
118
  `).map(d=>{var f;const h=((f=d.match(/^ */))===null||f===void 0?void 0:f[0])||"",p=Math.min(h.length,n);return d.slice(p)}).join(`
119
119
  `);return l.replaceWith(a,c,r.schema.text(u)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
120
120
 
121
- `);return!s||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:t})=>{if(!this.options.exitOnArrowUp)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;const s=r.before();return s>0?!1:t.commands.insertDefaultBlock({pos:s})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;const o=i.after();return o===void 0?!1:r.nodeAt(o)?t.commands.command(({tr:l})=>(l.setSelection(O.near(r.resolve(o))),!0)):t.commands.exitCode()}}},addInputRules(){return[Vs({find:Ak,type:this.type,getAttributes:t=>({language:t[1]})}),Vs({find:Nk,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new F({key:new X("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!n||!s)return!1;const{tr:o,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
122
- `));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(T.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),Dk=ye.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
121
+ `);return!s||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:t})=>{if(!this.options.exitOnArrowUp)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;const s=r.before();return s>0?!1:t.commands.insertDefaultBlock({pos:s})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;const o=i.after();return o===void 0?!1:r.nodeAt(o)?t.commands.command(({tr:l})=>(l.setSelection(D.near(r.resolve(o))),!0)):t.commands.exitCode()}}},addInputRules(){return[_s({find:Lk,type:this.type,getAttributes:t=>({language:t[1]})}),_s({find:$k,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new B({key:new X("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!n||!s)return!1;const{tr:o,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
122
+ `));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(w.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),Bk=ge.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
123
123
 
124
- `):""}),Rk=ye.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Y(this.options.HTMLAttributes,t)]},renderText(){return`
124
+ `):""}),Fk=ge.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Y(this.options.HTMLAttributes,t)]},renderText(){return`
125
125
  `},renderMarkdown:()=>`
126
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Ik=ye.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(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Y(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=!((n=t.attrs)===null||n===void 0)&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Vs({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),Pk=ye.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Y(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!u0(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return rd(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:l})=>{if(l){const{$to:a}=o.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(T.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(E.create(o.doc,a.pos)):o.setSelection(T.create(o.doc,a.pos));else{const u=s.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(o.insert(c,d),o.setSelection(T.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[$0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Lk=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,$k=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,zk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Bk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Fk=_t.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Y(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ut({find:Lk,type:this.type}),Ut({find:zk,type:this.type})]},addPasteRules(){return[kt({find:$k,type:this.type}),kt({find:Bk,type:this.type})]}}),Hk="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Vk="ελ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",Xs="numeric",Qs="ascii",Zs="alpha",jn="asciinumeric",Rn="alphanumeric",eo="domain",uf="emoji",jk="scheme",Wk="slashscheme",fs="whitespace";function Kk(t,e){return t in e||(e[t]=[]),e[t]}function Dt(t,e,n){e[Xs]&&(e[jn]=!0,e[Rn]=!0),e[Qs]&&(e[jn]=!0,e[Zs]=!0),e[jn]&&(e[Rn]=!0),e[Zs]&&(e[Rn]=!0),e[Rn]&&(e[eo]=!0),e[uf]&&(e[eo]=!0);for(const r in e){const i=Kk(r,n);i.indexOf(t)<0&&i.push(t)}}function Uk(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function be(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}be.groups={};be.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||be.groups;let i;return e&&e.j?i=e:(i=new be(e),n&&r&&Dt(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||be.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,l=i.go(t);if(l?(o=new be,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new be,s){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(Uk(o.t,r),n);Dt(s,a,r)}else n&&Dt(s,n,r);o.t=s}return i.j[t]=o,o}};const P=(t,e,n,r,i)=>t.ta(e,n,r,i),j=(t,e,n,r,i)=>t.tr(e,n,r,i),Ka=(t,e,n,r,i)=>t.ts(e,n,r,i),x=(t,e,n,r,i)=>t.tt(e,n,r,i),_e="WORD",to="UWORD",df="ASCIINUMERICAL",ff="ALPHANUMERICAL",sr="LOCALHOST",no="TLD",ro="UTLD",Pr="SCHEME",ln="SLASH_SCHEME",Ko="NUM",io="WS",Uo="NL",Wn="OPENBRACE",Kn="CLOSEBRACE",Zr="OPENBRACKET",ei="CLOSEBRACKET",ti="OPENPAREN",ni="CLOSEPAREN",ri="OPENANGLEBRACKET",ii="CLOSEANGLEBRACKET",si="FULLWIDTHLEFTPAREN",oi="FULLWIDTHRIGHTPAREN",li="LEFTCORNERBRACKET",ai="RIGHTCORNERBRACKET",ci="LEFTWHITECORNERBRACKET",ui="RIGHTWHITECORNERBRACKET",di="FULLWIDTHLESSTHAN",fi="FULLWIDTHGREATERTHAN",hi="AMPERSAND",pi="APOSTROPHE",mi="ASTERISK",ut="AT",gi="BACKSLASH",yi="BACKTICK",bi="CARET",Rt="COLON",_o="COMMA",ki="DOLLAR",$e="DOT",Si="EQUALS",qo="EXCLAMATION",Ee="HYPHEN",Un="PERCENT",xi="PIPE",Ci="PLUS",Mi="POUND",_n="QUERY",Jo="QUOTE",hf="FULLWIDTHMIDDLEDOT",Go="SEMI",ze="SLASH",qn="TILDE",Ei="UNDERSCORE",pf="EMOJI",Ti="SYM";var mf=Object.freeze({__proto__:null,ALPHANUMERICAL:ff,AMPERSAND:hi,APOSTROPHE:pi,ASCIINUMERICAL:df,ASTERISK:mi,AT:ut,BACKSLASH:gi,BACKTICK:yi,CARET:bi,CLOSEANGLEBRACKET:ii,CLOSEBRACE:Kn,CLOSEBRACKET:ei,CLOSEPAREN:ni,COLON:Rt,COMMA:_o,DOLLAR:ki,DOT:$e,EMOJI:pf,EQUALS:Si,EXCLAMATION:qo,FULLWIDTHGREATERTHAN:fi,FULLWIDTHLEFTPAREN:si,FULLWIDTHLESSTHAN:di,FULLWIDTHMIDDLEDOT:hf,FULLWIDTHRIGHTPAREN:oi,HYPHEN:Ee,LEFTCORNERBRACKET:li,LEFTWHITECORNERBRACKET:ci,LOCALHOST:sr,NL:Uo,NUM:Ko,OPENANGLEBRACKET:ri,OPENBRACE:Wn,OPENBRACKET:Zr,OPENPAREN:ti,PERCENT:Un,PIPE:xi,PLUS:Ci,POUND:Mi,QUERY:_n,QUOTE:Jo,RIGHTCORNERBRACKET:ai,RIGHTWHITECORNERBRACKET:ui,SCHEME:Pr,SEMI:Go,SLASH:ze,SLASH_SCHEME:ln,SYM:Ti,TILDE:qn,TLD:no,UNDERSCORE:Ei,UTLD:ro,UWORD:to,WORD:_e,WS:io});const We=/[a-z]/,Tn=new RegExp("\\p{L}","u"),hs=new RegExp("\\p{Emoji}","u"),Ke=/\d/,ps=/\s/,Ua="\r",ms=`
127
- `,_k="️",qk="‍",gs="";let Tr=null,wr=null;function Jk(t=[]){const e={};be.groups=e;const n=new be;Tr==null&&(Tr=_a(Hk)),wr==null&&(wr=_a(Vk)),x(n,"'",pi),x(n,"{",Wn),x(n,"}",Kn),x(n,"[",Zr),x(n,"]",ei),x(n,"(",ti),x(n,")",ni),x(n,"<",ri),x(n,">",ii),x(n,"(",si),x(n,")",oi),x(n,"「",li),x(n,"」",ai),x(n,"『",ci),x(n,"』",ui),x(n,"<",di),x(n,">",fi),x(n,"&",hi),x(n,"*",mi),x(n,"@",ut),x(n,"`",yi),x(n,"^",bi),x(n,":",Rt),x(n,",",_o),x(n,"$",ki),x(n,".",$e),x(n,"=",Si),x(n,"!",qo),x(n,"-",Ee),x(n,"%",Un),x(n,"|",xi),x(n,"+",Ci),x(n,"#",Mi),x(n,"?",_n),x(n,'"',Jo),x(n,"/",ze),x(n,";",Go),x(n,"~",qn),x(n,"_",Ei),x(n,"\\",gi),x(n,"・",hf);const r=j(n,Ke,Ko,{[Xs]:!0});j(r,Ke,r);const i=j(r,We,df,{[jn]:!0}),s=j(r,Tn,ff,{[Rn]:!0}),o=j(n,We,_e,{[Qs]:!0});j(o,Ke,i),j(o,We,o),j(i,Ke,i),j(i,We,i);const l=j(n,Tn,to,{[Zs]:!0});j(l,We),j(l,Ke,s),j(l,Tn,l),j(s,Ke,s),j(s,We),j(s,Tn,s);const a=x(n,ms,Uo,{[fs]:!0}),c=x(n,Ua,io,{[fs]:!0}),u=j(n,ps,io,{[fs]:!0});x(n,gs,u),x(c,ms,a),x(c,gs,u),j(c,ps,u),x(u,Ua),x(u,ms),j(u,ps,u),x(u,gs,u);const d=j(n,hs,pf,{[uf]:!0});x(d,"#"),j(d,hs,d),x(d,_k,d);const f=x(d,qk);x(f,"#"),j(f,hs,d);const h=[[We,o],[Ke,i]],p=[[We,null],[Tn,l],[Ke,s]];for(let g=0;g<Tr.length;g++)it(n,Tr[g],no,_e,h);for(let g=0;g<wr.length;g++)it(n,wr[g],ro,to,p);Dt(no,{tld:!0,ascii:!0},e),Dt(ro,{utld:!0,alpha:!0},e),it(n,"file",Pr,_e,h),it(n,"mailto",Pr,_e,h),it(n,"http",ln,_e,h),it(n,"https",ln,_e,h),it(n,"ftp",ln,_e,h),it(n,"ftps",ln,_e,h),Dt(Pr,{scheme:!0,ascii:!0},e),Dt(ln,{slashscheme:!0,ascii:!0},e),t=t.sort((g,m)=>g[0]>m[0]?1:-1);for(let g=0;g<t.length;g++){const m=t[g][0],b=t[g][1]?{[jk]:!0}:{[Wk]:!0};m.indexOf("-")>=0?b[eo]=!0:We.test(m)?Ke.test(m)?b[jn]=!0:b[Qs]=!0:b[Xs]=!0,Ka(n,m,m,b)}return Ka(n,"localhost",sr,{ascii:!0}),n.jd=new be(Ti),{start:n,tokens:Object.assign({groups:e},mf)}}function gf(t,e){const n=Gk(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;o<r&&(a=l.go(n[o]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[o].length,f++),c+=n[o].length,s+=n[o].length,o++;s-=d,o-=f,c-=d,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function Gk(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function it(t,e,n,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];t.j[a]?s=t.j[a]:(s=new be(r),s.jr=i.slice(),t.j[a]=s),t=s}return s=new be(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function _a(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const or={defaultProtocol:"http",events:null,format:qa,formatHref:qa,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Yo(t,e=null){let n=Object.assign({},or);t&&(n=Object.assign(n,t instanceof Yo?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}Yo.prototype={o:or,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:or[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function qa(t){return t}function yf(t,e){this.t="token",this.v=t,this.tk=e}yf.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=or.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:i,attributes:o,content:s,eventListeners:d}}};function Hi(t,e){class n extends yf{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Yk=Hi("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ja=Hi("text"),Xk=Hi("nl"),vr=Hi("url",{isLink:!0,toHref(t=or.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==sr&&t[1].t===Rt}}),Me=t=>new be(t);function Qk({groups:t}){const e=t.domain.concat([hi,mi,ut,gi,yi,bi,ki,Si,Ee,Ko,Un,xi,Ci,Mi,ze,Ti,qn,Ei]),n=[pi,Rt,_o,$e,qo,Un,_n,Jo,Go,ri,ii,Wn,Kn,ei,Zr,ti,ni,si,oi,li,ai,ci,ui,di,fi],r=[hi,pi,mi,gi,yi,bi,ki,Si,Ee,Wn,Kn,Un,xi,Ci,Mi,_n,ze,Ti,qn,Ei],i=Me(),s=x(i,qn);P(s,r,s),P(s,t.domain,s);const o=Me(),l=Me(),a=Me();P(i,t.domain,o),P(i,t.scheme,l),P(i,t.slashscheme,a),P(o,r,s),P(o,t.domain,o);const c=x(o,ut);x(s,ut,c),x(l,ut,c),x(a,ut,c);const u=x(s,$e);P(u,r,s),P(u,t.domain,s);const d=Me();P(c,t.domain,d),P(d,t.domain,d);const f=x(d,$e);P(f,t.domain,d);const h=Me(Yk);P(f,t.tld,h),P(f,t.utld,h),x(c,sr,h);const p=x(d,Ee);x(p,Ee,p),P(p,t.domain,d),P(h,t.domain,d),x(h,$e,f),x(h,Ee,p);const g=x(o,Ee),m=x(o,$e);x(g,Ee,g),P(g,t.domain,o),P(m,r,s),P(m,t.domain,o);const y=Me(vr);P(m,t.tld,y),P(m,t.utld,y),P(y,t.domain,o),P(y,r,s),x(y,$e,m),x(y,Ee,g),x(y,ut,c);const b=x(y,Rt),S=Me(vr);P(b,t.numeric,S);const C=Me(vr),v=Me();P(C,e,C),P(C,n,v),P(v,e,C),P(v,n,v),x(y,ze,C),x(S,ze,C);const R=x(l,Rt),w=x(a,Rt),N=x(w,ze),I=x(N,ze);P(l,t.domain,o),x(l,$e,m),x(l,Ee,g),P(a,t.domain,o),x(a,$e,m),x(a,Ee,g),P(R,t.domain,C),x(R,ze,C),x(R,_n,C),P(I,t.domain,C),P(I,e,C),x(I,ze,C);const Z=[[Wn,Kn],[Zr,ei],[ti,ni],[ri,ii],[si,oi],[li,ai],[ci,ui],[di,fi]];for(let le=0;le<Z.length;le++){const[ae,V]=Z[le],q=x(C,ae);x(v,ae,q);const z=Me(vr);P(q,e,z);const J=Me();P(q,n,J),x(q,V,C),P(z,e,z),P(z,n,J),P(J,e,z),P(J,n,J),x(z,V,C),x(J,V,C)}return x(i,sr,y),x(i,Uo,Xk),{start:i,tokens:mf}}function Zk(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;i<r&&!(a=l.go(n[i].t));)o.push(n[i++]);for(;i<r&&(c=a||l.go(n[i].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(ys(Ja,e,o)),o=[]),i-=f,u-=f;const h=d.t,p=n.slice(i-u,i);s.push(ys(h,e,p))}}return o.length>0&&s.push(ys(Ja,e,o)),s}function ys(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const eS=typeof console<"u"&&console&&console.warn||(()=>{}),tS="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",B={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function nS(){return be.groups={},B.scanner=null,B.parser=null,B.tokenQueue=[],B.pluginQueue=[],B.customSchemes=[],B.initialized=!1,B}function Ga(t,e=!1){if(B.initialized&&eS(`linkifyjs: already initialized - will not register custom scheme "${t}" ${tS}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
126
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Hk=ge.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(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Y(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=!((n=t.attrs)===null||n===void 0)&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>_s({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),Vk=ge.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Y(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!g0(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return cd(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:l})=>{if(l){const{$to:a}=o.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(w.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(E.create(o.doc,a.pos)):o.setSelection(w.create(o.doc,a.pos));else{const u=s.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(o.insert(c,d),o.setSelection(w.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[j0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),jk=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Wk=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Kk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Uk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,_k=Gt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Y(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Jt({find:jk,type:this.type}),Jt({find:Kk,type:this.type})]},addPasteRules(){return[Mt({find:Wk,type:this.type}),Mt({find:Uk,type:this.type})]}}),qk="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Jk="ελ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",no="numeric",ro="ascii",io="alpha",_n="asciinumeric",$n="alphanumeric",so="domain",gf="emoji",Gk="scheme",Yk="slashscheme",ys="whitespace";function Xk(t,e){return t in e||(e[t]=[]),e[t]}function Pt(t,e,n){e[no]&&(e[_n]=!0,e[$n]=!0),e[ro]&&(e[_n]=!0,e[io]=!0),e[_n]&&(e[$n]=!0),e[io]&&(e[$n]=!0),e[$n]&&(e[so]=!0),e[gf]&&(e[so]=!0);for(const r in e){const i=Xk(r,n);i.indexOf(t)<0&&i.push(t)}}function Qk(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function ye(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}ye.groups={};ye.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||ye.groups;let i;return e&&e.j?i=e:(i=new ye(e),n&&r&&Pt(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||ye.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,l=i.go(t);if(l?(o=new ye,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new ye,s){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(Qk(o.t,r),n);Pt(s,a,r)}else n&&Pt(s,n,r);o.t=s}return i.j[t]=o,o}};const I=(t,e,n,r,i)=>t.ta(e,n,r,i),j=(t,e,n,r,i)=>t.tr(e,n,r,i),Ya=(t,e,n,r,i)=>t.ts(e,n,r,i),x=(t,e,n,r,i)=>t.tt(e,n,r,i),Je="WORD",oo="UWORD",yf="ASCIINUMERICAL",bf="ALPHANUMERICAL",cr="LOCALHOST",lo="TLD",ao="UTLD",Fr="SCHEME",un="SLASH_SCHEME",Go="NUM",co="WS",Yo="NL",qn="OPENBRACE",Jn="CLOSEBRACE",ii="OPENBRACKET",si="CLOSEBRACKET",oi="OPENPAREN",li="CLOSEPAREN",ai="OPENANGLEBRACKET",ci="CLOSEANGLEBRACKET",ui="FULLWIDTHLEFTPAREN",di="FULLWIDTHRIGHTPAREN",fi="LEFTCORNERBRACKET",hi="RIGHTCORNERBRACKET",pi="LEFTWHITECORNERBRACKET",mi="RIGHTWHITECORNERBRACKET",gi="FULLWIDTHLESSTHAN",yi="FULLWIDTHGREATERTHAN",bi="AMPERSAND",ki="APOSTROPHE",Si="ASTERISK",pt="AT",xi="BACKSLASH",Ci="BACKTICK",Mi="CARET",Lt="COLON",Xo="COMMA",Ei="DOLLAR",ze="DOT",Ti="EQUALS",Qo="EXCLAMATION",Ee="HYPHEN",Gn="PERCENT",wi="PIPE",vi="PLUS",Ai="POUND",Yn="QUERY",Zo="QUOTE",kf="FULLWIDTHMIDDLEDOT",el="SEMI",Be="SLASH",Xn="TILDE",Ni="UNDERSCORE",Sf="EMOJI",Oi="SYM";var xf=Object.freeze({__proto__:null,ALPHANUMERICAL:bf,AMPERSAND:bi,APOSTROPHE:ki,ASCIINUMERICAL:yf,ASTERISK:Si,AT:pt,BACKSLASH:xi,BACKTICK:Ci,CARET:Mi,CLOSEANGLEBRACKET:ci,CLOSEBRACE:Jn,CLOSEBRACKET:si,CLOSEPAREN:li,COLON:Lt,COMMA:Xo,DOLLAR:Ei,DOT:ze,EMOJI:Sf,EQUALS:Ti,EXCLAMATION:Qo,FULLWIDTHGREATERTHAN:yi,FULLWIDTHLEFTPAREN:ui,FULLWIDTHLESSTHAN:gi,FULLWIDTHMIDDLEDOT:kf,FULLWIDTHRIGHTPAREN:di,HYPHEN:Ee,LEFTCORNERBRACKET:fi,LEFTWHITECORNERBRACKET:pi,LOCALHOST:cr,NL:Yo,NUM:Go,OPENANGLEBRACKET:ai,OPENBRACE:qn,OPENBRACKET:ii,OPENPAREN:oi,PERCENT:Gn,PIPE:wi,PLUS:vi,POUND:Ai,QUERY:Yn,QUOTE:Zo,RIGHTCORNERBRACKET:hi,RIGHTWHITECORNERBRACKET:mi,SCHEME:Fr,SEMI:el,SLASH:Be,SLASH_SCHEME:un,SYM:Oi,TILDE:Xn,TLD:lo,UNDERSCORE:Ni,UTLD:ao,UWORD:oo,WORD:Je,WS:co});const Ue=/[a-z]/,Nn=new RegExp("\\p{L}","u"),bs=new RegExp("\\p{Emoji}","u"),_e=/\d/,ks=/\s/,Xa="\r",Ss=`
127
+ `,Zk="️",eS="‍",xs="";let Or=null,Dr=null;function tS(t=[]){const e={};ye.groups=e;const n=new ye;Or==null&&(Or=Qa(qk)),Dr==null&&(Dr=Qa(Jk)),x(n,"'",ki),x(n,"{",qn),x(n,"}",Jn),x(n,"[",ii),x(n,"]",si),x(n,"(",oi),x(n,")",li),x(n,"<",ai),x(n,">",ci),x(n,"(",ui),x(n,")",di),x(n,"「",fi),x(n,"」",hi),x(n,"『",pi),x(n,"』",mi),x(n,"<",gi),x(n,">",yi),x(n,"&",bi),x(n,"*",Si),x(n,"@",pt),x(n,"`",Ci),x(n,"^",Mi),x(n,":",Lt),x(n,",",Xo),x(n,"$",Ei),x(n,".",ze),x(n,"=",Ti),x(n,"!",Qo),x(n,"-",Ee),x(n,"%",Gn),x(n,"|",wi),x(n,"+",vi),x(n,"#",Ai),x(n,"?",Yn),x(n,'"',Zo),x(n,"/",Be),x(n,";",el),x(n,"~",Xn),x(n,"_",Ni),x(n,"\\",xi),x(n,"・",kf);const r=j(n,_e,Go,{[no]:!0});j(r,_e,r);const i=j(r,Ue,yf,{[_n]:!0}),s=j(r,Nn,bf,{[$n]:!0}),o=j(n,Ue,Je,{[ro]:!0});j(o,_e,i),j(o,Ue,o),j(i,_e,i),j(i,Ue,i);const l=j(n,Nn,oo,{[io]:!0});j(l,Ue),j(l,_e,s),j(l,Nn,l),j(s,_e,s),j(s,Ue),j(s,Nn,s);const a=x(n,Ss,Yo,{[ys]:!0}),c=x(n,Xa,co,{[ys]:!0}),u=j(n,ks,co,{[ys]:!0});x(n,xs,u),x(c,Ss,a),x(c,xs,u),j(c,ks,u),x(u,Xa),x(u,Ss),j(u,ks,u),x(u,xs,u);const d=j(n,bs,Sf,{[gf]:!0});x(d,"#"),j(d,bs,d),x(d,Zk,d);const f=x(d,eS);x(f,"#"),j(f,bs,d);const h=[[Ue,o],[_e,i]],p=[[Ue,null],[Nn,l],[_e,s]];for(let g=0;g<Or.length;g++)at(n,Or[g],lo,Je,h);for(let g=0;g<Dr.length;g++)at(n,Dr[g],ao,oo,p);Pt(lo,{tld:!0,ascii:!0},e),Pt(ao,{utld:!0,alpha:!0},e),at(n,"file",Fr,Je,h),at(n,"mailto",Fr,Je,h),at(n,"http",un,Je,h),at(n,"https",un,Je,h),at(n,"ftp",un,Je,h),at(n,"ftps",un,Je,h),Pt(Fr,{scheme:!0,ascii:!0},e),Pt(un,{slashscheme:!0,ascii:!0},e),t=t.sort((g,m)=>g[0]>m[0]?1:-1);for(let g=0;g<t.length;g++){const m=t[g][0],b=t[g][1]?{[Gk]:!0}:{[Yk]:!0};m.indexOf("-")>=0?b[so]=!0:Ue.test(m)?_e.test(m)?b[_n]=!0:b[ro]=!0:b[no]=!0,Ya(n,m,m,b)}return Ya(n,"localhost",cr,{ascii:!0}),n.jd=new ye(Oi),{start:n,tokens:Object.assign({groups:e},xf)}}function Cf(t,e){const n=nS(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;o<r&&(a=l.go(n[o]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[o].length,f++),c+=n[o].length,s+=n[o].length,o++;s-=d,o-=f,c-=d,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function nS(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function at(t,e,n,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];t.j[a]?s=t.j[a]:(s=new ye(r),s.jr=i.slice(),t.j[a]=s),t=s}return s=new ye(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function Qa(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const ur={defaultProtocol:"http",events:null,format:Za,formatHref:Za,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function tl(t,e=null){let n=Object.assign({},ur);t&&(n=Object.assign(n,t instanceof tl?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}tl.prototype={o:ur,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:ur[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Za(t){return t}function Mf(t,e){this.t="token",this.v=t,this.tk=e}Mf.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=ur.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:i,attributes:o,content:s,eventListeners:d}}};function Ui(t,e){class n extends Mf{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const rS=Ui("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ec=Ui("text"),iS=Ui("nl"),Rr=Ui("url",{isLink:!0,toHref(t=ur.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==cr&&t[1].t===Lt}}),Me=t=>new ye(t);function sS({groups:t}){const e=t.domain.concat([bi,Si,pt,xi,Ci,Mi,Ei,Ti,Ee,Go,Gn,wi,vi,Ai,Be,Oi,Xn,Ni]),n=[ki,Lt,Xo,ze,Qo,Gn,Yn,Zo,el,ai,ci,qn,Jn,si,ii,oi,li,ui,di,fi,hi,pi,mi,gi,yi],r=[bi,ki,Si,xi,Ci,Mi,Ei,Ti,Ee,qn,Jn,Gn,wi,vi,Ai,Yn,Be,Oi,Xn,Ni],i=Me(),s=x(i,Xn);I(s,r,s),I(s,t.domain,s);const o=Me(),l=Me(),a=Me();I(i,t.domain,o),I(i,t.scheme,l),I(i,t.slashscheme,a),I(o,r,s),I(o,t.domain,o);const c=x(o,pt);x(s,pt,c),x(l,pt,c),x(a,pt,c);const u=x(s,ze);I(u,r,s),I(u,t.domain,s);const d=Me();I(c,t.domain,d),I(d,t.domain,d);const f=x(d,ze);I(f,t.domain,d);const h=Me(rS);I(f,t.tld,h),I(f,t.utld,h),x(c,cr,h);const p=x(d,Ee);x(p,Ee,p),I(p,t.domain,d),I(h,t.domain,d),x(h,ze,f),x(h,Ee,p);const g=x(o,Ee),m=x(o,ze);x(g,Ee,g),I(g,t.domain,o),I(m,r,s),I(m,t.domain,o);const y=Me(Rr);I(m,t.tld,y),I(m,t.utld,y),I(y,t.domain,o),I(y,r,s),x(y,ze,m),x(y,Ee,g),x(y,pt,c);const b=x(y,Lt),S=Me(Rr);I(b,t.numeric,S);const C=Me(Rr),T=Me();I(C,e,C),I(C,n,T),I(T,e,C),I(T,n,T),x(y,Be,C),x(S,Be,C);const N=x(l,Lt),v=x(a,Lt),O=x(v,Be),P=x(O,Be);I(l,t.domain,o),x(l,ze,m),x(l,Ee,g),I(a,t.domain,o),x(a,ze,m),x(a,Ee,g),I(N,t.domain,C),x(N,Be,C),x(N,Yn,C),I(P,t.domain,C),I(P,e,C),x(P,Be,C);const _=[[qn,Jn],[ii,si],[oi,li],[ai,ci],[ui,di],[fi,hi],[pi,mi],[gi,yi]];for(let ne=0;ne<_.length;ne++){const[ce,H]=_[ne],J=x(C,ce);x(T,ce,J);const V=Me(Rr);I(J,e,V);const re=Me();I(J,n,re),x(J,H,C),I(V,e,V),I(V,n,re),I(re,e,V),I(re,n,re),x(V,H,C),x(re,H,C)}return x(i,cr,y),x(i,Yo,iS),{start:i,tokens:xf}}function oS(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;i<r&&!(a=l.go(n[i].t));)o.push(n[i++]);for(;i<r&&(c=a||l.go(n[i].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(Cs(ec,e,o)),o=[]),i-=f,u-=f;const h=d.t,p=n.slice(i-u,i);s.push(Cs(h,e,p))}}return o.length>0&&s.push(Cs(ec,e,o)),s}function Cs(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const lS=typeof console<"u"&&console&&console.warn||(()=>{}),aS="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",z={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function cS(){return ye.groups={},z.scanner=null,z.parser=null,z.tokenQueue=[],z.pluginQueue=[],z.customSchemes=[],z.initialized=!1,z}function tc(t,e=!1){if(z.initialized&&lS(`linkifyjs: already initialized - will not register custom scheme "${t}" ${aS}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
128
128
  1. Must only contain digits, lowercase ASCII letters or "-"
129
129
  2. Cannot start or end with "-"
130
- 3. "-" cannot repeat`);B.customSchemes.push([t,e])}function rS(){B.scanner=Jk(B.customSchemes);for(let t=0;t<B.tokenQueue.length;t++)B.tokenQueue[t][1]({scanner:B.scanner});B.parser=Qk(B.scanner.tokens);for(let t=0;t<B.pluginQueue.length;t++)B.pluginQueue[t][1]({scanner:B.scanner,parser:B.parser});return B.initialized=!0,B}function Xo(t){return B.initialized||rS(),Zk(B.parser.start,t,gf(B.scanner.start,t))}Xo.scan=gf;function bf(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Yo(n),i=Xo(t),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}const Qo="[\0-   ᠎ -\u2029  ]",iS=new RegExp(Qo),sS=new RegExp(`${Qo}$`),oS=new RegExp(Qo,"g");function lS(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function aS(t){return new F({key:new X("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(a=>a.docChanged)&&!n.doc.eq(r.doc),s=e.some(a=>a.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=Yu(n.doc,[...e]);if($i(l).forEach(({newRange:a})=>{const c=sy(r.doc,a,f=>f.isTextblock);let u,d;if(c.length>1)u=c[0],d=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(c.length){const f=r.doc.textBetween(a.from,a.to," "," ");if(!sS.test(f))return;u=c[0],d=r.doc.textBetween(u.pos,a.to,void 0," ")}if(u&&d){const f=d.split(iS).filter(Boolean);if(f.length<=0)return!1;const h=f[f.length-1],p=u.pos+d.lastIndexOf(h);if(!h)return!1;const g=Xo(h).map(m=>m.toObject(t.defaultProtocol));if(!lS(g))return!1;g.filter(m=>m.isLink).map(m=>({...m,from:p+m.start+1,to:p+m.end+1})).filter(m=>r.schema.marks.code?!r.doc.rangeHasMark(m.from,m.to,r.schema.marks.code):!0).filter(m=>t.validate(m.value)).filter(m=>t.shouldAutoLink(m.value)).forEach(m=>{Do(m.from,m.to,r.doc).some(y=>y.mark.type===t.type)||o.addMark(m.from,m.to,t.type.create({href:m.href}))})}}),!!o.steps.length)return o}})}function cS(t){return new F({key:new X("handleClickLink"),props:{handleClick:(e,n,r)=>{if(r.button!==0||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{const a=r.target;if(!a)return!1;const c=t.editor.view.dom;i=a.closest("a"),i&&!c.contains(i)&&(i=null)}if(!i)return!1;let s=!1;if(t.enableClickSelection&&(s=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){var o,l;const a=nd(e.state,t.type.name),c=(o=i.href)!==null&&o!==void 0?o:a.href,u=(l=i.target)!==null&&l!==void 0?l:a.target;c&&(window.open(c,u),s=!0)}return s}}})}const uS=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,dS=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function kf(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function fS(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&kf(t,r)){r+=1;continue}let i=0;for(;r<e&&t[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function Sf(t,e,n){var r,i;const[,s,o]=e;return(e.index?t[e.index-1]:void 0)==="!"||kf(t,(r=e.index)!==null&&r!==void 0?r:0)||fS(t,(i=e.index)!==null&&i!==void 0?i:0)?!1:!!s.trim()&&n(o)}function xf(t){var e,n;const[r,i,s,,o,l,a]=t,c=(e=o??l)!==null&&e!==void 0?e:a;return{index:(n=t.index)!==null&&n!==void 0?n:0,text:r,replaceWith:i,data:{href:s,title:c||null,markdown:!0}}}function hS(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function Cf(t){var e,n,r;return{href:(e=t.data)===null||e===void 0?void 0:e.href,title:(n=(r=t.data)===null||r===void 0?void 0:r.title)!==null&&n!==void 0?n:null}}function pS(t){const e=Ut({find:n=>{const r=uS.exec(n);return!r||!Sf(n,r,t.isAllowedHref)?null:xf(r)},type:t.type,getAttributes:Cf});return new hr({find:e.find,handler:n=>{const r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function mS(t){const e=kt({find:n=>{var r,i;const s=[];for(const l of n.matchAll(dS))Sf(n,l,t.isAllowedHref)&&s.push(xf(l));const o=((r=(i=t.findPlainUrls)===null||i===void 0?void 0:i.call(t,n))!==null&&r!==void 0?r:[]).filter(l=>!s.some(a=>hS(a,l)));return[...s,...o]},type:t.type,getAttributes:Cf});return new pd({find:e.find,handler:n=>{var r;const i=e.handler(n);return i!==null&&n.state.tr.steps.length&&(!((r=n.match.data)===null||r===void 0)&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),i}})}function gS(t){return new F({key:new X("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=bf(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||i!==void 0&&!i(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function Ue(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(oS,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const Mf=_t.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(t=>{if(typeof t=="string"){Ga(t);return}Ga(t.scheme,t.optionalSlashes)})},onDestroy(){nS()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Ue(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!==null&&t!==void 0?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(n=this.options.HTMLAttributes.class)!==null&&n!==void 0?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Ue(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Ue(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Y(this.options.HTMLAttributes,t),0]:["a",Y(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,s;const o=(n=(r=t.attrs)===null||r===void 0?void 0:r.href)!==null&&n!==void 0?n:"",l=(i=(s=t.attrs)===null||s===void 0?void 0:s.title)!==null&&i!==void 0?i:"",a=e.renderChildren(t);return l?`[${a}](${o} "${l}")`:`[${a}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ue(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Ue(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[pS({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!Ue(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const t=e=>{const n=[];if(e){const{protocols:r,defaultProtocol:i}=this.options;bf(e).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Ue(o,r),protocols:r,defaultProtocol:i})).forEach(s=>{this.options.shouldAutoLink(s.value)&&n.push({text:s.value,data:{href:s.href},index:s.start})})}return n};return this.options.markdownLinks?[mS({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!Ue(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[kt({find:t,type:this.type,getAttributes:e=>{var n;return{href:(n=e.data)===null||n===void 0?void 0:n.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(aS({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Ue(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(cS({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(gS({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}});var Ax=Mf;const yS="listItem",Ya="textStyle",Xa=/^\s*([-+*])\s$/,Ef=ye.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:t}){return["ul",Y(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
131
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(yS,this.editor.getAttributes(Ya)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=kn({find:Xa,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=kn({find:Xa,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ya),editor:this.editor})),[t]}}),bS=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let h=i.depth;h>0;h-=1)if(i.node(h).type.name===e){s=h;break}if(s<0)return null;const o=i.node(s),l=i.index(s);if(l+1>=o.childCount)return null;const a=o.child(l+1);if(!n.includes(a.type.name))return null;const c=t.schema.nodes[e];let u=!1;if(a.forEach(h=>{h.type===c&&h.childCount>1&&(u=!0)}),!u)return null;const d=t.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;const f=[];return d.forEach(h=>{f.push(h)}),f.length===0?null:{listItemDepth:s,nestedList:d,nestedListPos:i.after(),insertPos:i.after(s),items:f}},kS=(t,e,n,r)=>{const i=bS(t,n,r);if(!i)return!1;const{selection:s}=t,{nestedList:o,nestedListPos:l,insertPos:a,items:c}=i,u=t.tr;u.delete(l,l+o.nodeSize);const d=u.mapping.map(a);return u.insert(d,k.from(c)),u.setSelection(s.map(u.doc,u.mapping)),e&&e(u),!0},SS=(t,e,n)=>kS(t.state,t.view.dispatch,e,n),Tf=(t,e)=>U.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>SS(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),wf=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],Ar="abcdefghijklmnopqrstuvwxyz",vf=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function Vi(t){let e=t,n="";for(const[r,i]of wf)for(;e>=r;)n+=i,e-=r;return n}function Zo(t){return Vi(t).toUpperCase()}function Af(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let i=!1;for(const[s,o]of wf)if(e.startsWith(o,n)){r+=s,n+=o.length,i=!0;break}if(!i)return 0}return r}function xS(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=Af(t);return e<=0?!1:(t===t.toLowerCase()?Vi(e):Zo(e))===t}function CS(t){const e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function wi(t){if(t<=26)return Ar[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?Ar[n]:Ar[e]+Ar[n]}function ji(t){if(!(!t||/^\d+$/.test(t))){if(xS(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function el(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=ji(t);if(e==="i"||e==="I")return Af(t);if(e==="a"||e==="A"){const r=CS(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function MS(t,e){if(t==="numeric")return String(e);switch(t){case"a":return wi(e);case"A":return wi(e).toUpperCase();case"i":return Vi(e);case"I":return Zo(e);default:return String(e)}}function ES(t){var e;if(t.length===0)return!1;const n=(e=ji(t[0]))!==null&&e!==void 0?e:"numeric",r=el(t[0]);if(r<1)return!1;for(let i=0;i<t.length;i++){const s=MS(n,r+i);if(t[i]!==s)return!1}return!0}function TS(t){return{type:ji(t),start:el(t)}}function wS(t){const{type:e,start:n}=TS(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function vS(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${wi(r)}${n}`;case"A":return`${wi(r).toUpperCase()}${n}`;case"i":return`${Vi(r)}${n}`;case"I":return`${Zo(r)}${n}`;default:return`${r}${n}`}}function AS(t){var e,n;const r=(e=t.tokens)===null||e===void 0?void 0:e[0];return!!(t.text&&((n=t.tokens)===null||n===void 0?void 0:n.length)===1&&r?.type==="list"&&r.ordered&&r.raw===t.text)}function NS(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}const Nf=ye.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Y(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;let i=[];if(t.tokens&&t.tokens.length>0){if(AS(t))return{type:"listItem",content:[{type:"paragraph",content:NS(t.text||"",e)}]};if(t.tokens.some(s=>s.type==="paragraph"))i=r(t.tokens);else{const s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){const o=r(t.tokens.slice(1));i.push(...o)}}else i=r(t.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>dd(t,e,r=>{if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){var i,s;const o=((i=r.meta)===null||i===void 0||(i=i.parentAttrs)===null||i===void 0?void 0:i.start)||1;return vS((s=r.meta)===null||s===void 0||(s=s.parentAttrs)===null||s===void 0?void 0:s.type,o-1+(r.index||0),". ")}return"- "},n),addExtensions(){return[Tf(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),tl=(t,e)=>{const{$from:n}=e.selection,r=Q(t,e.schema);let i=null,s=n.depth,o=n.pos,l=null;for(;s>0&&l===null;)i=n.node(s),i.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},Of=(t,e)=>{const n=tl(t,e);if(!n)return!1;const[,r]=gy(e,t,n.$pos.pos+4);return r},OS=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},Qa=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Ze(t.state,e)&&OS(t.state,e,n)){const{$anchor:s}=t.state.selection,o=t.state.doc.resolve(s.before()-1),l=[];o.node().descendants((u,d)=>{u.type.name===e&&l.push({node:u,pos:d})});const a=l.at(-1);if(!a)return!1;const c=t.state.doc.resolve(o.start()+a.pos+1);return t.chain().cut({from:s.start()-1,to:s.end()+1},c.end()).joinForward().run()}if(!Ze(t.state,e)||!xy(t.state))return!1;const{$from:r}=t.state.selection,i=r.depth-1;return r.node(i).type!==t.schema.nodes[e]||r.index(i)!==0?!1:t.chain().liftListItem(e).run()},DS=(t,e)=>{const n=Of(t,e),r=tl(t,e);return!r||!n?!1:n>r.depth},RS=(t,e)=>{const n=Of(t,e),r=tl(t,e);return!r||!n?!1:n<r.depth},Za=(t,e)=>{if(!Ze(t.state,e)||!Sy(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:DS(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():RS(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},IS=(t,e,n)=>{const{state:r}=t,{selection:i}=r;if(!i.empty)return!1;const{$from:s}=i;if(s.parentOffset!==0||!s.parent.isTextblock||Ze(r,e))return!1;const o=yy(s);if(!o||!n.includes(o.type.name))return!1;const l=o.lastChild;if(!l||l.type.name!==e)return!1;const a=s.parent;if(!l.canReplace(l.childCount,l.childCount,k.from(a)))return!1;const c=s.before(),u=s.after(),d=c-2;return t.commands.command(({tr:f,dispatch:h})=>(h&&(f.delete(c,u).insert(d,k.from(a)),f.setSelection(T.create(f.doc,d+1)),f.scrollIntoView()),!0))},Df=U.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Za(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Za(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Qa(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Qa(t,n,r)&&(e=!0)}),e},Tab:({editor:t})=>{for(const{itemName:e,wrapperNames:n}of this.options.listTypes)if(t.state.schema.nodes[e]!==void 0&&IS(t,e,n))return!0;return!1}}}}),so=new RegExp(`^(\\s*)(${vf})([.)])\\s+(.*)$`),PS=/^\s/,an={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function LS(t){return so.test(t.trimStart())}function $S(t){const e=t.trimStart();return an.bulletItem.test(e)||LS(e)||an.heading.test(e)||an.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||an.codeFence.test(e)||an.blockMath.test(e)}function zS(t){return Object.values(an).some(e=>e.test(t))}function BS(t){const e=[],n=[];let r=!1;return t.forEach(i=>{if(r){n.push(i);return}if(i.trim()===""){r=!0,n.push(i);return}if(e.length>0&&$S(i)){r=!0,n.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:n}}function FS(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(so);if(!s)break;const[,o,l,a,c]=s,u=o.length,d=parseInt(l,10),f=isNaN(d)?ji(l):void 0,h=isNaN(d)?el(l):d,p=[c];let g=n+1;const m=[i];let y=!1;for(;g<t.length;){const b=t[g];if(b.match(so))break;if(b.trim()==="")m.push(b),p.push(""),y=!0,g+=1;else if(b.match(PS)){const S=b.length-b.trimStart().length,C=u+l.length+1;m.push(b),p.push(b.slice(Math.min(S,C))),g+=1}else{if(y||zS(b))break;m.push(b),p.push(b),g+=1}}e.push({indent:u,number:h,type:f,content:p.join(`
130
+ 3. "-" cannot repeat`);z.customSchemes.push([t,e])}function uS(){z.scanner=tS(z.customSchemes);for(let t=0;t<z.tokenQueue.length;t++)z.tokenQueue[t][1]({scanner:z.scanner});z.parser=sS(z.scanner.tokens);for(let t=0;t<z.pluginQueue.length;t++)z.pluginQueue[t][1]({scanner:z.scanner,parser:z.parser});return z.initialized=!0,z}function nl(t){return z.initialized||uS(),oS(z.parser.start,t,Cf(z.scanner.start,t))}nl.scan=Cf;function Ef(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new tl(n),i=nl(t),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}const rl="[\0-   ᠎ -\u2029  ]",dS=new RegExp(rl),fS=new RegExp(`${rl}$`),hS=new RegExp(rl,"g");function pS(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function mS(t){return new B({key:new X("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(a=>a.docChanged)&&!n.doc.eq(r.doc),s=e.some(a=>a.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=nd(n.doc,[...e]);if(Vi(l).forEach(({newRange:a})=>{const c=dy(r.doc,a,f=>f.isTextblock);let u,d;if(c.length>1)u=c[0],d=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(c.length){const f=r.doc.textBetween(a.from,a.to," "," ");if(!fS.test(f))return;u=c[0],d=r.doc.textBetween(u.pos,a.to,void 0," ")}if(u&&d){const f=d.split(dS).filter(Boolean);if(f.length<=0)return!1;const h=f[f.length-1],p=u.pos+d.lastIndexOf(h);if(!h)return!1;const g=nl(h).map(m=>m.toObject(t.defaultProtocol));if(!pS(g))return!1;g.filter(m=>m.isLink).map(m=>({...m,from:p+m.start+1,to:p+m.end+1})).filter(m=>r.schema.marks.code?!r.doc.rangeHasMark(m.from,m.to,r.schema.marks.code):!0).filter(m=>t.validate(m.value)).filter(m=>t.shouldAutoLink(m.value)).forEach(m=>{$o(m.from,m.to,r.doc).some(y=>y.mark.type===t.type)||o.addMark(m.from,m.to,t.type.create({href:m.href}))})}}),!!o.steps.length)return o}})}function gS(t){return new B({key:new X("handleClickLink"),props:{handleClick:(e,n,r)=>{if(r.button!==0||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{const a=r.target;if(!a)return!1;const c=t.editor.view.dom;i=a.closest("a"),i&&!c.contains(i)&&(i=null)}if(!i)return!1;let s=!1;if(t.enableClickSelection&&(s=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){var o,l;const a=ad(e.state,t.type.name),c=(o=i.href)!==null&&o!==void 0?o:a.href,u=(l=i.target)!==null&&l!==void 0?l:a.target;c&&(window.open(c,u),s=!0)}return s}}})}const yS=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,bS=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function Tf(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function kS(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&Tf(t,r)){r+=1;continue}let i=0;for(;r<e&&t[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function wf(t,e,n){var r,i;const[,s,o]=e;return(e.index?t[e.index-1]:void 0)==="!"||Tf(t,(r=e.index)!==null&&r!==void 0?r:0)||kS(t,(i=e.index)!==null&&i!==void 0?i:0)?!1:!!s.trim()&&n(o)}function vf(t){var e,n;const[r,i,s,,o,l,a]=t,c=(e=o??l)!==null&&e!==void 0?e:a;return{index:(n=t.index)!==null&&n!==void 0?n:0,text:r,replaceWith:i,data:{href:s,title:c||null,markdown:!0}}}function SS(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function Af(t){var e,n,r;return{href:(e=t.data)===null||e===void 0?void 0:e.href,title:(n=(r=t.data)===null||r===void 0?void 0:r.title)!==null&&n!==void 0?n:null}}function xS(t){const e=Jt({find:n=>{const r=yS.exec(n);return!r||!wf(n,r,t.isAllowedHref)?null:vf(r)},type:t.type,getAttributes:Af});return new yr({find:e.find,handler:n=>{const r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function CS(t){const e=Mt({find:n=>{var r,i;const s=[];for(const l of n.matchAll(bS))wf(n,l,t.isAllowedHref)&&s.push(vf(l));const o=((r=(i=t.findPlainUrls)===null||i===void 0?void 0:i.call(t,n))!==null&&r!==void 0?r:[]).filter(l=>!s.some(a=>SS(a,l)));return[...s,...o]},type:t.type,getAttributes:Af});return new Sd({find:e.find,handler:n=>{var r;const i=e.handler(n);return i!==null&&n.state.tr.steps.length&&(!((r=n.match.data)===null||r===void 0)&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),i}})}function MS(t){return new B({key:new X("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=Ef(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||i!==void 0&&!i(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function qe(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(hS,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const Nf=Gt.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(t=>{if(typeof t=="string"){tc(t);return}tc(t.scheme,t.optionalSlashes)})},onDestroy(){cS()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!qe(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!==null&&t!==void 0?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(n=this.options.HTMLAttributes.class)!==null&&n!==void 0?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!qe(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!qe(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Y(this.options.HTMLAttributes,t),0]:["a",Y(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,s;const o=(n=(r=t.attrs)===null||r===void 0?void 0:r.href)!==null&&n!==void 0?n:"",l=(i=(s=t.attrs)===null||s===void 0?void 0:s.title)!==null&&i!==void 0?i:"",a=e.renderChildren(t);return l?`[${a}](${o} "${l}")`:`[${a}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qe(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!qe(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[xS({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!qe(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const t=e=>{const n=[];if(e){const{protocols:r,defaultProtocol:i}=this.options;Ef(e).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!qe(o,r),protocols:r,defaultProtocol:i})).forEach(s=>{this.options.shouldAutoLink(s.value)&&n.push({text:s.value,data:{href:s.href},index:s.start})})}return n};return this.options.markdownLinks?[CS({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!qe(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[Mt({find:t,type:this.type,getAttributes:e=>{var n;return{href:(n=e.data)===null||n===void 0?void 0:n.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(mS({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!qe(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(gS({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(MS({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}});var $x=Nf;const ES="listItem",nc="textStyle",rc=/^\s*([-+*])\s$/,Of=ge.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:t}){return["ul",Y(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
131
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ES,this.editor.getAttributes(nc)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Cn({find:rc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Cn({find:rc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(nc),editor:this.editor})),[t]}}),TS=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let h=i.depth;h>0;h-=1)if(i.node(h).type.name===e){s=h;break}if(s<0)return null;const o=i.node(s),l=i.index(s);if(l+1>=o.childCount)return null;const a=o.child(l+1);if(!n.includes(a.type.name))return null;const c=t.schema.nodes[e];let u=!1;if(a.forEach(h=>{h.type===c&&h.childCount>1&&(u=!0)}),!u)return null;const d=t.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;const f=[];return d.forEach(h=>{f.push(h)}),f.length===0?null:{listItemDepth:s,nestedList:d,nestedListPos:i.after(),insertPos:i.after(s),items:f}},wS=(t,e,n,r)=>{const i=TS(t,n,r);if(!i)return!1;const{selection:s}=t,{nestedList:o,nestedListPos:l,insertPos:a,items:c}=i,u=t.tr;u.delete(l,l+o.nodeSize);const d=u.mapping.map(a);return u.insert(d,k.from(c)),u.setSelection(s.map(u.doc,u.mapping)),e&&e(u),!0},vS=(t,e,n)=>wS(t.state,t.view.dispatch,e,n),Df=(t,e)=>U.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>vS(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),Rf=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],Ir="abcdefghijklmnopqrstuvwxyz",If=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function _i(t){let e=t,n="";for(const[r,i]of Rf)for(;e>=r;)n+=i,e-=r;return n}function il(t){return _i(t).toUpperCase()}function Pf(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let i=!1;for(const[s,o]of Rf)if(e.startsWith(o,n)){r+=s,n+=o.length,i=!0;break}if(!i)return 0}return r}function AS(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=Pf(t);return e<=0?!1:(t===t.toLowerCase()?_i(e):il(e))===t}function NS(t){const e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function Di(t){if(t<=26)return Ir[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?Ir[n]:Ir[e]+Ir[n]}function qi(t){if(!(!t||/^\d+$/.test(t))){if(AS(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function sl(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=qi(t);if(e==="i"||e==="I")return Pf(t);if(e==="a"||e==="A"){const r=NS(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function OS(t,e){if(t==="numeric")return String(e);switch(t){case"a":return Di(e);case"A":return Di(e).toUpperCase();case"i":return _i(e);case"I":return il(e);default:return String(e)}}function DS(t){var e;if(t.length===0)return!1;const n=(e=qi(t[0]))!==null&&e!==void 0?e:"numeric",r=sl(t[0]);if(r<1)return!1;for(let i=0;i<t.length;i++){const s=OS(n,r+i);if(t[i]!==s)return!1}return!0}function RS(t){return{type:qi(t),start:sl(t)}}function IS(t){const{type:e,start:n}=RS(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function PS(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${Di(r)}${n}`;case"A":return`${Di(r).toUpperCase()}${n}`;case"i":return`${_i(r)}${n}`;case"I":return`${il(r)}${n}`;default:return`${r}${n}`}}function LS(t){var e,n;const r=(e=t.tokens)===null||e===void 0?void 0:e[0];return!!(t.text&&((n=t.tokens)===null||n===void 0?void 0:n.length)===1&&r?.type==="list"&&r.ordered&&r.raw===t.text)}function $S(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}const Lf=ge.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Y(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;let i=[];if(t.tokens&&t.tokens.length>0){if(LS(t))return{type:"listItem",content:[{type:"paragraph",content:$S(t.text||"",e)}]};if(t.tokens.some(s=>s.type==="paragraph"))i=r(t.tokens);else{const s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){const o=r(t.tokens.slice(1));i.push(...o)}}else i=r(t.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>yd(t,e,r=>{if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){var i,s;const o=((i=r.meta)===null||i===void 0||(i=i.parentAttrs)===null||i===void 0?void 0:i.start)||1;return PS((s=r.meta)===null||s===void 0||(s=s.parentAttrs)===null||s===void 0?void 0:s.type,o-1+(r.index||0),". ")}return"- "},n),addExtensions(){return[Df(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),ol=(t,e)=>{const{$from:n}=e.selection,r=Q(t,e.schema);let i=null,s=n.depth,o=n.pos,l=null;for(;s>0&&l===null;)i=n.node(s),i.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},$f=(t,e)=>{const n=ol(t,e);if(!n)return!1;const[,r]=Cy(e,t,n.$pos.pos+4);return r},zS=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},ic=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!tt(t.state,e)&&zS(t.state,e,n)){const{$anchor:s}=t.state.selection,o=t.state.doc.resolve(s.before()-1),l=[];o.node().descendants((u,d)=>{u.type.name===e&&l.push({node:u,pos:d})});const a=l.at(-1);if(!a)return!1;const c=t.state.doc.resolve(o.start()+a.pos+1);return t.chain().cut({from:s.start()-1,to:s.end()+1},c.end()).joinForward().run()}if(!tt(t.state,e)||!vy(t.state))return!1;const{$from:r}=t.state.selection,i=r.depth-1;return r.node(i).type!==t.schema.nodes[e]||r.index(i)!==0?!1:t.chain().liftListItem(e).run()},BS=(t,e)=>{const n=$f(t,e),r=ol(t,e);return!r||!n?!1:n>r.depth},FS=(t,e)=>{const n=$f(t,e),r=ol(t,e);return!r||!n?!1:n<r.depth},sc=(t,e)=>{if(!tt(t.state,e)||!wy(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:BS(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():FS(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},HS=(t,e,n)=>{const{state:r}=t,{selection:i}=r;if(!i.empty)return!1;const{$from:s}=i;if(s.parentOffset!==0||!s.parent.isTextblock||tt(r,e))return!1;const o=My(s);if(!o||!n.includes(o.type.name))return!1;const l=o.lastChild;if(!l||l.type.name!==e)return!1;const a=s.parent;if(!l.canReplace(l.childCount,l.childCount,k.from(a)))return!1;const c=s.before(),u=s.after(),d=c-2;return t.commands.command(({tr:f,dispatch:h})=>(h&&(f.delete(c,u).insert(d,k.from(a)),f.setSelection(w.create(f.doc,d+1)),f.scrollIntoView()),!0))},zf=U.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&sc(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&sc(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&ic(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&ic(t,n,r)&&(e=!0)}),e},Tab:({editor:t})=>{for(const{itemName:e,wrapperNames:n}of this.options.listTypes)if(t.state.schema.nodes[e]!==void 0&&HS(t,e,n))return!0;return!1}}}}),uo=new RegExp(`^(\\s*)(${If})([.)])\\s+(.*)$`),VS=/^\s/,dn={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function jS(t){return uo.test(t.trimStart())}function WS(t){const e=t.trimStart();return dn.bulletItem.test(e)||jS(e)||dn.heading.test(e)||dn.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||dn.codeFence.test(e)||dn.blockMath.test(e)}function KS(t){return Object.values(dn).some(e=>e.test(t))}function US(t){const e=[],n=[];let r=!1;return t.forEach(i=>{if(r){n.push(i);return}if(i.trim()===""){r=!0,n.push(i);return}if(e.length>0&&WS(i)){r=!0,n.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:n}}function _S(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(uo);if(!s)break;const[,o,l,a,c]=s,u=o.length,d=parseInt(l,10),f=isNaN(d)?qi(l):void 0,h=isNaN(d)?sl(l):d,p=[c];let g=n+1;const m=[i];let y=!1;for(;g<t.length;){const b=t[g];if(b.match(uo))break;if(b.trim()==="")m.push(b),p.push(""),y=!0,g+=1;else if(b.match(VS)){const S=b.length-b.trimStart().length,C=u+l.length+1;m.push(b),p.push(b.slice(Math.min(S,C))),g+=1}else{if(y||KS(b))break;m.push(b),p.push(b),g+=1}}e.push({indent:u,number:h,type:f,content:p.join(`
132
132
  `).trim(),contentLines:p,raw:m.join(`
133
- `)}),r=g,n=g}return[e,r]}const HS=new RegExp(`^(${vf})([.)])\\s+(.+)$`);function VS(t){const e=t.split(`
134
- `).filter(r=>r.trim().length>0);if(e.length===0)return null;const n=[];for(const r of e){const i=r.trim().match(HS);if(!i)return null;n.push({marker:i[1],content:i[3]})}return ES(n.map(r=>r.marker))?{type:"orderedList",attrs:wS(n[0].marker),content:n.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function Rf(t,e,n){const r=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const{paragraphLines:o,blockLines:l}=BS(s.contentLines),a=o.join(`
133
+ `)}),r=g,n=g}return[e,r]}const qS=new RegExp(`^(${If})([.)])\\s+(.+)$`);function JS(t){const e=t.split(`
134
+ `).filter(r=>r.trim().length>0);if(e.length===0)return null;const n=[];for(const r of e){const i=r.trim().match(qS);if(!i)return null;n.push({marker:i[1],content:i[3]})}return DS(n.map(r=>r.marker))?{type:"orderedList",attrs:IS(n[0].marker),content:n.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function Bf(t,e,n){const r=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const{paragraphLines:o,blockLines:l}=US(s.contentLines),a=o.join(`
135
135
  `).trim(),c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});const u=l.join(`
136
- `).trim();if(u){const h=n.blockTokens(u);c.push(...h)}let d=i+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const h=Rf(f,Math.min(...f.map(p=>p.indent)),n);c.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:h,raw:f.map(p=>p.raw).join(`
137
- `)})}r.push({type:"list_item",raw:s.raw,tokens:c}),i=d}else i+=1}return r}function jS(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}const WS="listItem",ec="textStyle",tc=/^(\d+)\.\s$/;function nc(t){const e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}const If=ye.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:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>{const e=t.getAttribute("type");if(e)return e;const n=t.getAttribute("style");if(n){const i=nc(n);if(i)return i}const r=t.querySelector("li");if(r){const i=r.getAttribute("style");if(i){const s=nc(i);if(s)return s}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,i=Y(this.options.HTMLAttributes,r);return e!==1&&(i.start=e),n&&n!=="1"&&(i.type=n),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.typeMarker,i=t.items?jS(t.items,e):[],s={};return n!==1&&(s.start=n),r&&(s.type=r),Object.keys(s).length>0?{type:"orderedList",attrs:s,content:i}:{type:"orderedList",content:i}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
136
+ `).trim();if(u){const h=n.blockTokens(u);c.push(...h)}let d=i+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const h=Bf(f,Math.min(...f.map(p=>p.indent)),n);c.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:h,raw:f.map(p=>p.raw).join(`
137
+ `)})}r.push({type:"list_item",raw:s.raw,tokens:c}),i=d}else i+=1}return r}function GS(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}const YS="listItem",oc="textStyle",lc=/^(\d+)\.\s$/;function ac(t){const e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}const Ff=ge.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:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>{const e=t.getAttribute("type");if(e)return e;const n=t.getAttribute("style");if(n){const i=ac(n);if(i)return i}const r=t.querySelector("li");if(r){const i=r.getAttribute("style");if(i){const s=ac(i);if(s)return s}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,i=Y(this.options.HTMLAttributes,r);return e!==1&&(i.start=e),n&&n!=="1"&&(i.type=n),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.typeMarker,i=t.items?GS(t.items,e):[],s={};return n!==1&&(s.start=n),r&&(s.type=r),Object.keys(s).length>0?{type:"orderedList",attrs:s,content:i}:{type:"orderedList",content:i}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
138
138
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,i;const s=t.split(`
139
- `),[o,l]=FS(s);if(o.length===0)return;const a=Rf(o,o[0].indent,n);if(a.length!==0)return{type:"list",ordered:!0,start:((r=o[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(i=o[0])===null||i===void 0?void 0:i.type,items:a,raw:s.slice(0,l).join(`
140
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(WS,this.editor.getAttributes(ec)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new F({props:{handlePaste:(t,e)=>{var n,r;const i=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/html");if(i?.trim())return!1;const s=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s)return!1;const o=VS(s);if(!o)return!1;try{const l=t.state.schema.nodeFromJSON(o),a=t.state.tr.replaceSelectionWith(l);return t.dispatch(a),!0}catch{return!1}}}})]},addInputRules(){const t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1];let e=kn({find:tc,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=kn({find:tc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(ec)}),joinPredicate:t,editor:this.editor})),[e]}}),KS=/^\s*(\[([( |x])?\])\s$/,US="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",_S=(t,e,n)=>{var r;return(n==null||(r=n.checkboxLabel)===null||r===void 0?void 0:r.call(n,t,e))||`Task item checkbox for ${t.textContent||"empty task item"}`},qS=ye.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:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:t=>{var e;return(e=t.querySelector("div"))!==null&&e!==void 0?e:t}}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Y(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const r=`- [${!((n=t.attrs)===null||n===void 0)&&n.checked?"x":" "}] `;return dd(t,e,r)},addExtensions(){return this.options.nested?[Tf(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");o.style.cssText=US;const c=d=>{const f=_S(d,d.attrs.checked,this.options.a11y);l.setAttribute("aria-label",f),o.textContent=f};c(t),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=n();if(typeof p!="number")return!1;const g=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...g?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{i.setAttribute(d,f)}),i.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,o),i.append(s,a),Object.entries(e).forEach(([d,f])=>{i.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:i,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;i.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d);const f=r.extensionManager.attributes,h=bn(d,f),p=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return u.forEach(m=>{p.has(m)||(m in g?i.setAttribute(m,g[m]):i.removeAttribute(m))}),Object.entries(h).forEach(([m,y])=>{y==null?m in g?i.setAttribute(m,g[m]):i.removeAttribute(m):i.setAttribute(m,y)}),u=p,!0}}}},addInputRules(){return[kn({find:KS,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),JS=ye.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:t}){return["ul",Y(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
141
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const o=ga(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);if(o){const l={type:"taskList",raw:o.raw,items:o.items},a=s.slice(o.raw.length);return a.trim()?[l,...n.blockTokens(a)]:[l]}return n.blockTokens(s)},i=ga(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});U.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Ef.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Nf.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Df.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(If.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(qS.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(JS.configure(this.options.taskList)),t}});const Nr="&nbsp;",bs=" ",GS=ye.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Y(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Nr||n[0].text===Nr||n[0].raw===bs||n[0].text===bs)&&r.length===1&&r[0].type==="text"&&(r[0].text===Nr||r[0].text===bs)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{if(!t)return"";const r=Array.isArray(t.content)?t.content:[];if(r.length===0){var i,s;const o=Array.isArray(n==null||(i=n.previousNode)===null||i===void 0?void 0:i.content)?n.previousNode.content:[];return(n==null||(s=n.previousNode)===null||s===void 0?void 0:s.type)==="paragraph"&&o.length===0?Nr:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),YS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,XS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,QS=_t.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Y(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ut({find:YS,type:this.type})]},addPasteRules(){return[kt({find:XS,type:this.type})]}}),ZS=ye.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),ex=_t.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Y(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),tx=U.create({name:"starterKit",addExtensions(){const t=[];if(this.options.bold!==!1&&t.push(Ek.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(kk.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(Ef.configure(this.options.bulletList)),this.options.code!==!1&&t.push(vk.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(Ok.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(Dk.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(ek.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(tk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(Rk.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(Ik.configure(this.options.heading)),this.options.undoRedo!==!1&&t.push(mk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&t.push(Pk.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Fk.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Nf.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;t.push(Df.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var n;t.push(Mf.configure((n=this.options)===null||n===void 0?void 0:n.link))}if(this.options.orderedList!==!1&&t.push(If.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(GS.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(QS.configure(this.options.strike)),this.options.text!==!1&&t.push(ZS.configure(this.options.text)),this.options.underline!==!1){var r;t.push(ex.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var i;t.push(pk.configure((i=this.options)===null||i===void 0?void 0:i.trailingNode))}return t}});var Nx=tx;export{E as $,fx as A,dy as B,yx as C,K as D,U as E,wx as F,c0 as G,oy as H,xd as I,$0 as J,kx as K,bn as L,_t as M,ye as N,Ax as O,cx as P,JS as Q,Cd as R,qS as S,T,O as U,Hu as V,Zh as W,k as X,M as Y,ee as Z,Be as _,Rb as a,Bc as a0,hx as a1,vo as a2,fy as a3,td as a4,Nb as b,Ub as c,xx as d,Ex as e,Tx as f,mx as g,X as h,Cx as i,F as j,Kb as k,Mx as l,Y as m,Io as n,vx as o,tt as p,px as q,Jy as r,Nx as s,Bn as t,Sx as u,Ao as v,L as w,A as x,gx as y,bx as z};
139
+ `),[o,l]=_S(s);if(o.length===0)return;const a=Bf(o,o[0].indent,n);if(a.length!==0)return{type:"list",ordered:!0,start:((r=o[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(i=o[0])===null||i===void 0?void 0:i.type,items:a,raw:s.slice(0,l).join(`
140
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(YS,this.editor.getAttributes(oc)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new B({props:{handlePaste:(t,e)=>{var n,r;const i=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/html");if(i?.trim())return!1;const s=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s)return!1;const o=JS(s);if(!o)return!1;try{const l=t.state.schema.nodeFromJSON(o),a=t.state.tr.replaceSelectionWith(l);return t.dispatch(a),!0}catch{return!1}}}})]},addInputRules(){const t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1];let e=Cn({find:lc,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Cn({find:lc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(oc)}),joinPredicate:t,editor:this.editor})),[e]}}),XS=/^\s*(\[([( |x])?\])\s$/,QS="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",ZS=(t,e,n)=>{var r;return(n==null||(r=n.checkboxLabel)===null||r===void 0?void 0:r.call(n,t,e))||`Task item checkbox for ${t.textContent||"empty task item"}`},ex=ge.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:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:t=>{var e;return(e=t.querySelector("div"))!==null&&e!==void 0?e:t}}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Y(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const r=`- [${!((n=t.attrs)===null||n===void 0)&&n.checked?"x":" "}] `;return yd(t,e,r)},addExtensions(){return this.options.nested?[Df(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");o.style.cssText=QS;const c=d=>{const f=ZS(d,d.attrs.checked,this.options.a11y);l.setAttribute("aria-label",f),o.textContent=f};c(t),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=n();if(typeof p!="number")return!1;const g=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...g?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{i.setAttribute(d,f)}),i.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,o),i.append(s,a),Object.entries(e).forEach(([d,f])=>{i.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:i,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;i.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d);const f=r.extensionManager.attributes,h=xn(d,f),p=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return u.forEach(m=>{p.has(m)||(m in g?i.setAttribute(m,g[m]):i.removeAttribute(m))}),Object.entries(h).forEach(([m,y])=>{y==null?m in g?i.setAttribute(m,g[m]):i.removeAttribute(m):i.setAttribute(m,y)}),u=p,!0}}}},addInputRules(){return[Cn({find:XS,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),tx=ge.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:t}){return["ul",Y(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
141
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const o=Ca(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);if(o){const l={type:"taskList",raw:o.raw,items:o.items},a=s.slice(o.raw.length);return a.trim()?[l,...n.blockTokens(a)]:[l]}return n.blockTokens(s)},i=Ca(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});U.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Of.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Lf.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(zf.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Ff.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(ex.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(tx.configure(this.options.taskList)),t}});const Pr="&nbsp;",Ms=" ",nx=ge.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Y(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Pr||n[0].text===Pr||n[0].raw===Ms||n[0].text===Ms)&&r.length===1&&r[0].type==="text"&&(r[0].text===Pr||r[0].text===Ms)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{if(!t)return"";const r=Array.isArray(t.content)?t.content:[];if(r.length===0){var i,s;const o=Array.isArray(n==null||(i=n.previousNode)===null||i===void 0?void 0:i.content)?n.previousNode.content:[];return(n==null||(s=n.previousNode)===null||s===void 0?void 0:s.type)==="paragraph"&&o.length===0?Pr:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),rx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,ix=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,sx=Gt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Y(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Jt({find:rx,type:this.type})]},addPasteRules(){return[Mt({find:ix,type:this.type})]}}),ox=ge.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),lx=Gt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Y(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),ax=U.create({name:"starterKit",addExtensions(){const t=[];if(this.options.bold!==!1&&t.push(Dk.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(wk.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(Of.configure(this.options.bulletList)),this.options.code!==!1&&t.push(Pk.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(zk.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(Bk.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(lk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(ak.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(Fk.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(Hk.configure(this.options.heading)),this.options.undoRedo!==!1&&t.push(Ck.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&t.push(Vk.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(_k.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Lf.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;t.push(zf.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var n;t.push(Nf.configure((n=this.options)===null||n===void 0?void 0:n.link))}if(this.options.orderedList!==!1&&t.push(Ff.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(nx.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(sx.configure(this.options.strike)),this.options.text!==!1&&t.push(ox.configure(this.options.text)),this.options.underline!==!1){var r;t.push(lx.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var i;t.push(xk.configure((i=this.options)===null||i===void 0?void 0:i.trailingNode))}return t}});var zx=ax;export{E as $,Sx as A,yy as B,Tx as C,K as D,U as E,Px as F,m0 as G,fy as H,vd as I,j0 as J,vx as K,xn as L,Gt as M,ge as N,$x as O,yx as P,tx as Q,Ad as R,ex as S,w as T,D as U,_u as V,sp as W,k as X,M as Y,Z,Fe as _,Bb as a,Kc as a0,xx as a1,Ro as a2,by as a3,ld as a4,Lb as b,Qb as c,Nx as d,Rx as e,Ix as f,Mx as g,X as h,Ox as i,B as j,Xb as k,Dx as l,Y as m,Bo as n,Lx as o,rt as p,Cx as q,e0 as r,zx as s,jn as t,Ax as u,Io as v,L as w,A as x,Ex as y,wx as z};