decocms 4.365.0 → 4.365.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 (488) hide show
  1. package/dist/client/assets/{AlertCircle-bl0yU7gy.js → AlertCircle-BPZWT1gc.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CHPDNuDf.js → AreaChart-CxCPUfZu.js} +3 -3
  3. package/dist/client/assets/{ArrowLeft-CpbUCYpB.js → ArrowLeft-c3HIgil5.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-CkVUmxaa.js → ArrowRight-BHzAyFwu.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-BQQdFypM.js → ArrowUp-DywwLYcR.js} +1 -1
  6. package/dist/client/assets/{Check-BJaMheL7.js → Check-PyGET9iL.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-BNNyBNMK.js → CheckCircle-4Be5K85Z.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-2Ti1evDh.js → ChevronRight-vY_5m8VB.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-Cp-tcsrs.js → ChevronUp-B9QGJbr0.js} +1 -1
  10. package/dist/client/assets/{Copy01-BrL9ZrVF.js → Copy01-BbtQlTnV.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-_mwanoIZ.js → CreditCard01-2jrzrshR.js} +1 -1
  12. package/dist/client/assets/{Database01-Dm_V08L3.js → Database01-B8rfUUUF.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-B8slOnrw.js → DotsVertical-zFAA_as9.js} +1 -1
  14. package/dist/client/assets/{Download01-Bl2-HJHJ.js → Download01-CSiLQIib.js} +1 -1
  15. package/dist/client/assets/{ErrorBarContext-nVgseQIz.js → ErrorBarContext-D7xML5iT.js} +1 -1
  16. package/dist/client/assets/{Eye-B_BMkWWc.js → Eye-BRXlESxS.js} +1 -1
  17. package/dist/client/assets/{File02-3fotvfyl.js → File02-D4JZqTxD.js} +1 -1
  18. package/dist/client/assets/{GitBranch01-Dr0NRbj6.js → GitBranch01-95kZh6WB.js} +1 -1
  19. package/dist/client/assets/{Globe01-DMnQmvOn.js → Globe01-Dej65_H6.js} +1 -1
  20. package/dist/client/assets/{HardDrive-CxNWrsuq.js → HardDrive-DCLQ4vdy.js} +1 -1
  21. package/dist/client/assets/{Image01-DMAKgzzX.js → Image01-Dd-Rx_B5.js} +1 -1
  22. package/dist/client/assets/{Key01-CVfJV98q.js → Key01-CQFO2R8H.js} +1 -1
  23. package/dist/client/assets/{Link01-CKw3sRrv.js → Link01-pGxgI9VT.js} +1 -1
  24. package/dist/client/assets/{LinkExternal01-OjBTsG9L.js → LinkExternal01-Jetqi62I.js} +1 -1
  25. package/dist/client/assets/MessageCircle01-D2dDPrBD.js +1 -0
  26. package/dist/client/assets/{Monitor01-Bc6Zvq9B.js → Monitor01-Bw-h-DKp.js} +1 -1
  27. package/dist/client/assets/{Package-DTeqx5ul.js → Package-CF-S4NRB.js} +1 -1
  28. package/dist/client/assets/{Palette-CiXH5EXK.js → Palette-DuCZiZH-.js} +1 -1
  29. package/dist/client/assets/{Play-BPdpqeiE.js → Play-BTJRmkRf.js} +1 -1
  30. package/dist/client/assets/{Plus-kQ9d0PiA.js → Plus-BUGmioCX.js} +1 -1
  31. package/dist/client/assets/Printer-B2Ij2s1c.js +1 -0
  32. package/dist/client/assets/{SearchLg-Cecpe6x9.js → SearchLg-De3yWxzK.js} +1 -1
  33. package/dist/client/assets/{SearchMd-hBr_biLL.js → SearchMd-DanltqT5.js} +1 -1
  34. package/dist/client/assets/{Sector-B0yBxg4a.js → Sector-DqvqR1iU.js} +2 -2
  35. package/dist/client/assets/{Settings02-BqKUeA5H.js → Settings02-C-HNbNsn.js} +1 -1
  36. package/dist/client/assets/{Share07-D8xQrAsX.js → Share07-C4Gw_nzw.js} +1 -1
  37. package/dist/client/assets/{Shield01-Dav77ssu.js → Shield01-7bhnSYVs.js} +1 -1
  38. package/dist/client/assets/{Stars01-DWjpdjKn.js → Stars01-BmtGexbk.js} +1 -1
  39. package/dist/client/assets/{Sun-wxsl7cI_.js → Sun-D5AClOdh.js} +1 -1
  40. package/dist/client/assets/{SwitchHorizontal01-CCraiYIJ.js → SwitchHorizontal01-CCmSX-Ww.js} +1 -1
  41. package/dist/client/assets/{Tool01-E6Rv0Nbs.js → Tool01-C1VYYGhf.js} +1 -1
  42. package/dist/client/assets/{Tool02-Darwb8nP.js → Tool02-A5gv-OOO.js} +1 -1
  43. package/dist/client/assets/{Trash01-BB2ymX9J.js → Trash01-DkwdEhkp.js} +1 -1
  44. package/dist/client/assets/{TrendUp01-PJuAXI74.js → TrendUp01-CQWL_vX5.js} +1 -1
  45. package/dist/client/assets/{Upload01-BtBtAyal.js → Upload01-BlEOH700.js} +1 -1
  46. package/dist/client/assets/{User01-CtDIPHIF.js → User01-C2ILPAHc.js} +1 -1
  47. package/dist/client/assets/{UserSquare-BflxhZ_l.js → UserSquare-DY1wI6ZR.js} +1 -1
  48. package/dist/client/assets/{Users01-9HTYv5bx.js → Users01-bydaoxbh.js} +1 -1
  49. package/dist/client/assets/{Users03-D8RoJqiC.js → Users03-3yW32m45.js} +1 -1
  50. package/dist/client/assets/X-DejWyAyX.js +1 -0
  51. package/dist/client/assets/{XCircle-Dvf0BUKb.js → XCircle-SVZraRfE.js} +1 -1
  52. package/dist/client/assets/{XClose-DPfGLo7I.js → XClose-wkdnmhrB.js} +1 -1
  53. package/dist/client/assets/{Zap-ChgjHdxL.js → Zap-0km1-ru7.js} +1 -1
  54. package/dist/client/assets/{ZoomOut-BAhVAzy1.js → ZoomOut-BA2ZiotX.js} +1 -1
  55. package/dist/client/assets/access-gate-DpZqBld0.js +1 -0
  56. package/dist/client/assets/add-connection-dialog-DB5JJjad.js +1 -0
  57. package/dist/client/assets/agent-analytics-CAHUVirD.js +2 -0
  58. package/dist/client/assets/agent-app-BeMC8z8k.js +1 -0
  59. package/dist/client/assets/agent-assets-DsMv2xEg.js +1 -0
  60. package/dist/client/assets/agent-automation-BY5j9rqa.js +20 -0
  61. package/dist/client/assets/agent-automations-1_XWI0cB.js +1 -0
  62. package/dist/client/assets/agent-connect-sources-CGYs_l_4.js +1 -0
  63. package/dist/client/assets/agent-deck-BqKNWwGC.js +1 -0
  64. package/dist/client/assets/agent-e2e-DSg6pAM6.js +1 -0
  65. package/dist/client/assets/agent-file-QzuIvb2U.js +1 -0
  66. package/dist/client/assets/agent-git-B5SGdxwk.js +3 -0
  67. package/dist/client/assets/agent-hosting-CWM0TAgK.js +1 -0
  68. package/dist/client/assets/agent-icon-BjknPEfN.js +1 -0
  69. package/dist/client/assets/agent-library-file-DOj4Pso1.js +1 -0
  70. package/dist/client/assets/agent-monitor-D0SLtbEO.js +1 -0
  71. package/dist/client/assets/agent-overview-4MzJb6Tv.js +1 -0
  72. package/dist/client/assets/agent-settings-D4SL-PIa.js +1 -0
  73. package/dist/client/assets/agent-site-editor-BDP-vSUl.js +24 -0
  74. package/dist/client/assets/agent-site-editor-code-C2z-Az-Y.js +2 -0
  75. package/dist/client/assets/agent-site-editor-content-JPYekiK_.js +2 -0
  76. package/dist/client/assets/agent-site-editor-preview-CFLjaarK.js +504 -0
  77. package/dist/client/assets/agent-view-Bp9ooHxf.js +1 -0
  78. package/dist/client/assets/agent-view-guard-B7qYW-b3.js +1 -0
  79. package/dist/client/assets/agents-list-h96XaSKk.js +1 -0
  80. package/dist/client/assets/ai-providers-COWdzwzu.js +1 -0
  81. package/dist/client/assets/{alert-DkgzGFz6.js → alert-CvK2RkF3.js} +1 -1
  82. package/dist/client/assets/{alert-dialog-BdwUra4d.js → alert-dialog-CDARhUOh.js} +2 -2
  83. package/dist/client/assets/{api-keys-Bl99t7Nm.js → api-keys-Ba-S9F5Y.js} +1 -1
  84. package/dist/client/assets/api-keys-DeCwNgs3.js +1 -0
  85. package/dist/client/assets/app-editor-CsOLGnt4.js +1 -0
  86. package/dist/client/assets/asset-utils-DQpbxjwd.js +1 -0
  87. package/dist/client/assets/{auth-vfqjjrgv.js → auth-Cyjh0UQp.js} +1 -1
  88. package/dist/client/assets/{auth-catchall-CZ_cFv3z.js → auth-catchall-BbOJ2FpE.js} +1 -1
  89. package/dist/client/assets/{auth-entry-Cp4v6AT2.js → auth-entry-CIc1-YG9.js} +1 -1
  90. package/dist/client/assets/{auth-split-layout-BB-yAg-2.js → auth-split-layout-WGnYlU-M.js} +1 -1
  91. package/dist/client/assets/{authenticate-and-persist-oauth-CpB-R1LO.js → authenticate-and-persist-oauth-Dgc5b4Jr.js} +1 -1
  92. package/dist/client/assets/{automation-list-row-DKusfCau.js → automation-list-row-Dyqat6cE.js} +1 -1
  93. package/dist/client/assets/automation-runs-DkHp_jZr.js +1 -0
  94. package/dist/client/assets/automations-BSGRkynt.js +1 -0
  95. package/dist/client/assets/{autosend-u-W4xgi7.js → autosend-BBoss6Ia.js} +1 -1
  96. package/dist/client/assets/{avatar-BpU54ct-.js → avatar-CO3n6wLC.js} +1 -1
  97. package/dist/client/assets/backoff-8mStPHYB.js +1 -0
  98. package/dist/client/assets/{badge-DJ5ezE5-.js → badge-DUpgRwQu.js} +1 -1
  99. package/dist/client/assets/{block-document-7Ngv587f.js → block-document-CVyeCLBq.js} +3 -3
  100. package/dist/client/assets/blocks-preview-workspace-context-CLQbGv9t.js +1 -0
  101. package/dist/client/assets/{breadcrumb-Dlcs3jWo.js → breadcrumb-FJ1G6kmP.js} +1 -1
  102. package/dist/client/assets/buckets-BTZUX3pR.js +1 -0
  103. package/dist/client/assets/build-improve-prompt-doc-CcAYvBOj.js +2 -0
  104. package/dist/client/assets/bulk-category-panel-9cEfFq4L.js +1 -0
  105. package/dist/client/assets/{calendar-B8BrEMls.js → calendar-Bb8OUNd8.js} +1 -1
  106. package/dist/client/assets/{capability-load-error-CdMFNpdR.js → capability-load-error-Ctg9pY-k.js} +1 -1
  107. package/dist/client/assets/{cards-BfP1wflC.js → cards-CbRL3hJc.js} +1 -1
  108. package/dist/client/assets/category-editor-DLB1OCyq.js +1 -0
  109. package/dist/client/assets/{chart-zbtN9_7R.js → chart-DqNrc8dZ.js} +1 -1
  110. package/dist/client/assets/{chat-context-CD1rWX64.js → chat-context-B40ngn3f.js} +9 -9
  111. package/dist/client/assets/{checkbox-DwVdLA7e.js → checkbox-STVvKX8k.js} +1 -1
  112. package/dist/client/assets/choose-editor-DVdbAy2O.js +1 -0
  113. package/dist/client/assets/claim-phase-copy-0btUuJoC.js +1 -0
  114. package/dist/client/assets/{cli-auth-success-BtBj1xJE.js → cli-auth-success-DmTxFaq5.js} +1 -1
  115. package/dist/client/assets/{client-icons-BcSFyY79.js → client-icons-CR99ZCoE.js} +1 -1
  116. package/dist/client/assets/collapsible-Cf4ZreOo.js +1 -0
  117. package/dist/client/assets/collection-detail-oWaNi-hD.js +1 -0
  118. package/dist/client/assets/collection-display-button-CkKXuKd-.js +1 -0
  119. package/dist/client/assets/{collection-search-Bi-DttH4.js → collection-search-CDaDEv2c.js} +1 -1
  120. package/dist/client/assets/{collection-table-wrapper-DfAhVjGn.js → collection-table-wrapper-B036tBOl.js} +1 -1
  121. package/dist/client/assets/{collection-tabs-BZkkvpP_.js → collection-tabs-CkeFxbT3.js} +1 -1
  122. package/dist/client/assets/{command-cJVGaRa3.js → command-D7YFT70c.js} +1 -1
  123. package/dist/client/assets/{command-palette-store-BNo0UXiS.js → command-palette-store-BcwFt5eE.js} +1 -1
  124. package/dist/client/assets/commerce-onboarding-BcoYZTQG.js +1 -0
  125. package/dist/client/assets/{companion-mcps-section-smAU7jYC.js → companion-mcps-section-CS9qQ8v0.js} +1 -1
  126. package/dist/client/assets/{connect-Bn7h46Ea.js → connect-BM6ZfhOz.js} +2 -2
  127. package/dist/client/assets/connect-layout-De5w9TxQ.js +1 -0
  128. package/dist/client/assets/{connection-card-DCMUv-0w.js → connection-card-kANJRcvf.js} +1 -1
  129. package/dist/client/assets/connection-detail-Ckkh02Py.js +1 -0
  130. package/dist/client/assets/{connection-D6f54N4w.js → connection-di4Fldx3.js} +1 -1
  131. package/dist/client/assets/{connection-form-helpers-BiJdmlDA.js → connection-form-helpers-fWne-kOd.js} +1 -1
  132. package/dist/client/assets/connections-BKm7IMTt.js +1 -0
  133. package/dist/client/assets/{create-organization-dialog-IR2z5bIs.js → create-organization-dialog-BmgLNeEx.js} +1 -1
  134. package/dist/client/assets/decofile-api-BhjpITFN.js +1 -0
  135. package/dist/client/assets/{decopilot-CK3rN_ad.js → decopilot-ClO0uusm.js} +2 -2
  136. package/dist/client/assets/dialog-Dxe0Jgna.js +1 -0
  137. package/dist/client/assets/discover-BdugM7FR.js +1 -0
  138. package/dist/client/assets/domain-settings-Dp-mWih8.js +1 -0
  139. package/dist/client/assets/{download-app-dialog-CNd8ka-x.js → download-app-dialog-lwMMuYsF.js} +1 -1
  140. package/dist/client/assets/{drawer-DsG6Si3V.js → drawer-1GzYkddr.js} +1 -1
  141. package/dist/client/assets/{dropdown-menu-4cRHTbic.js → dropdown-menu-Bws_0K_q.js} +1 -1
  142. package/dist/client/assets/{editor-NTP5Xcj9.js → editor-U5ucetu-.js} +1 -1
  143. package/dist/client/assets/{empty-state-DmTochCH.js → empty-state-BjMIbq91.js} +1 -1
  144. package/dist/client/assets/{empty-state-D86Jkx4H.js → empty-state-C3Z_6q55.js} +1 -1
  145. package/dist/client/assets/{extract-connection-data-B3hIAjiC.js → extract-connection-data-BAjOM4U5.js} +1 -1
  146. package/dist/client/assets/file-explorer-LFC3Ac60.js +2 -0
  147. package/dist/client/assets/{file-preview-BbFH5cdB.js → file-preview-n35lcg8c.js} +1 -1
  148. package/dist/client/assets/{file-share-button-ChoXQdlr.js → file-share-button-D04rfik7.js} +2 -2
  149. package/dist/client/assets/{file-type-icon-DJQFeBpV.js → file-type-icon-C4dI9q_n.js} +1 -1
  150. package/dist/client/assets/{folder-icon-BRLOuEpt.js → folder-icon-pWHmymOf.js} +1 -1
  151. package/dist/client/assets/{form-DhUF_Mtg.js → form-CRSWplOb.js} +1 -1
  152. package/dist/client/assets/{gateway-client-Cb37izH_.js → gateway-client-D45uHvIc.js} +1 -1
  153. package/dist/client/assets/general-C7RGB0Oj.js +1 -0
  154. package/dist/client/assets/{github-icon-cJDFDEm7.js → github-icon-CsH29e4W.js} +1 -1
  155. package/dist/client/assets/{github-repo-C0igpkr9.js → github-repo-BknN0SVI.js} +1 -1
  156. package/dist/client/assets/home-CpLcM3nB.js +1 -0
  157. package/dist/client/assets/hooks-CE7d6Dy1.js +15 -0
  158. package/dist/client/assets/{hooks-BrcP19Uo.js → hooks-CxBYuMc8.js} +2 -2
  159. package/dist/client/assets/{index-epfDD3H5.js → index-4fsCOuPz.js} +2 -2
  160. package/dist/client/assets/index-B53DWiGz.js +1 -0
  161. package/dist/client/assets/{index-BQzHGsvt.js → index-BJDZS0O4.js} +11 -11
  162. package/dist/client/assets/index-BQwroePl.js +1 -0
  163. package/dist/client/assets/{index-Df6f9kP3.js → index-BRigOSQu.js} +1 -1
  164. package/dist/client/assets/{index-CoYeuRng.js → index-CBcq1VSB.js} +1 -1
  165. package/dist/client/assets/index-CFUteTrc.js +1 -0
  166. package/dist/client/assets/{index-gctAQu2T.js → index-CVJEcf37.js} +74 -74
  167. package/dist/client/assets/{index-DQ6uuKpF.js → index-CblYf_yB.js} +8 -8
  168. package/dist/client/assets/{index-BywxOh2e.js → index-CcEd_wWL.js} +1 -1
  169. package/dist/client/assets/index-Clbrhj--.js +1 -0
  170. package/dist/client/assets/{index-CImKKZ20.js → index-CxOPSFx9.js} +1 -1
  171. package/dist/client/assets/index-CyYEAXEU.js +1 -0
  172. package/dist/client/assets/{index-eVyHwFa9.js → index-DAN6A7hZ.js} +1 -1
  173. package/dist/client/assets/{index-DJADaZ4J.css → index-DUflXgSu.css} +1 -1
  174. package/dist/client/assets/index-Dio39w6e.js +26 -0
  175. package/dist/client/assets/index-DsI9yqDT.js +1 -0
  176. package/dist/client/assets/{index-redirect-DxBD4sTo.js → index-redirect-Bw20Ba6Y.js} +1 -1
  177. package/dist/client/assets/{infiniteQueryObserver-Da0v0sXC.js → infiniteQueryObserver-BSmIgXE3.js} +1 -1
  178. package/dist/client/assets/infra-billing-DFEuQtvU.js +1 -0
  179. package/dist/client/assets/{input-eBmoU-9D.js → input-C8MQoDCb.js} +1 -1
  180. package/dist/client/assets/{input-DlvEXkej.js → input-CQyA0V5b.js} +1 -1
  181. package/dist/client/assets/{input-C9QH7mMV.js → input-DD_DI_Km.js} +2 -2
  182. package/dist/client/assets/{integration-icon-YYg8l_RW.js → integration-icon-BV7Q9XOu.js} +1 -1
  183. package/dist/client/assets/{label-DGkzLfNU.js → label-Cfl8uGDP.js} +1 -1
  184. package/dist/client/assets/last-preview-page-B_KVLuYW.js +1 -0
  185. package/dist/client/assets/layout-Dm4T-Vne.js +1 -0
  186. package/dist/client/assets/legacy-agents-deep-Dd57JUEI.js +1 -0
  187. package/dist/client/assets/legacy-main-redirect-CWvMqmhB.js +1 -0
  188. package/dist/client/assets/{library-CKrgioQu.js → library-3DHQWojm.js} +4 -4
  189. package/dist/client/assets/login-CupMnybl.js +1 -0
  190. package/dist/client/assets/{markdown-BV0XgGTq.js → markdown-BvSl7QX1.js} +3 -3
  191. package/dist/client/assets/{mcp-app-renderer-Bv46PiO3.js → mcp-app-renderer-DJ7Ve9Yy.js} +2 -2
  192. package/dist/client/assets/{mcp-oauth-i7PCjbNf.js → mcp-oauth-OvlzbMCP.js} +1 -1
  193. package/dist/client/assets/members-Cuiahh5G.js +1 -0
  194. package/dist/client/assets/message-templates-wocfrCJF.js +1 -0
  195. package/dist/client/assets/{mini-report-page-k88VT2C2.js → mini-report-page-4Bd0cMlr.js} +1 -1
  196. package/dist/client/assets/{monaco-editor-kRD7y0Pc.js → monaco-editor-B2KCfh7a.js} +1 -1
  197. package/dist/client/assets/{monitoring-stats-row-CuCuR7PQ.js → monitoring-stats-row-CufhVlNy.js} +1 -1
  198. package/dist/client/assets/{multi-select-CltjjMwX.js → multi-select-BHFunwbq.js} +1 -1
  199. package/dist/client/assets/{mustache-Db7x-4gI.js → mustache-DyjElMuJ.js} +1 -1
  200. package/dist/client/assets/{oauth-callback-CT29B8-5.js → oauth-callback-4BOm__rV.js} +1 -1
  201. package/dist/client/assets/{oauth-callback-ai-provider-3CPoYshC.js → oauth-callback-ai-provider-Czk5gVgf.js} +1 -1
  202. package/dist/client/assets/{onboarding-DEm51GnF.js → onboarding-D2PsWH4h.js} +1 -1
  203. package/dist/client/assets/{optimistic-project-sidebar-views-Drtbh9Ui.js → optimistic-project-sidebar-views-B3vU1qR8.js} +1 -1
  204. package/dist/client/assets/{organization-choice-BdqJqB_v.js → organization-choice-C-PRPVPc.js} +1 -1
  205. package/dist/client/assets/orgs-DpmY6dw4.js +1 -0
  206. package/dist/client/assets/{page-seo-form-BXvLQ5tk.js → page-seo-form-gUB5sB3u.js} +1 -1
  207. package/dist/client/assets/{pair-BIPkH5eA.js → pair-98UY-0wm.js} +8 -8
  208. package/dist/client/assets/{popover-BfKN_4aI.js → popover-DAJR0ej2.js} +1 -1
  209. package/dist/client/assets/post-calendar-4XiTJrif.js +1 -0
  210. package/dist/client/assets/post-editor-CXRn_RK8.js +1 -0
  211. package/dist/client/assets/preview-content-Tw_jYCgT.js +1 -0
  212. package/dist/client/assets/{preview-dialog-CYbL8r4H.js → preview-dialog-Bg_Wo7YI.js} +1 -1
  213. package/dist/client/assets/{primitives-BXcg67BS.js → primitives-BfIYsPoI.js} +1 -1
  214. package/dist/client/assets/profile-CDs1X-Le.js +1 -0
  215. package/dist/client/assets/project-app-view-BPLB01Cj.js +1 -0
  216. package/dist/client/assets/project-feed-CeGbFvMT.js +1 -0
  217. package/dist/client/assets/{project-icon-Dk1HaDIZ.js → project-icon-D1x6NEST.js} +1 -1
  218. package/dist/client/assets/project-reports-fH8-r6df.js +1 -0
  219. package/dist/client/assets/project-tasks-tas6EPem.js +1 -0
  220. package/dist/client/assets/prompts-B-VqD1p-.js +1 -0
  221. package/dist/client/assets/record-editor-LOQZDk0V.js +1 -0
  222. package/dist/client/assets/redirect-editor-CgXt_KHn.js +1 -0
  223. package/dist/client/assets/registry-YMo7WLlx.js +2 -0
  224. package/dist/client/assets/{registry-layout-CRM-FBei.js → registry-layout-SseogjtO.js} +3 -3
  225. package/dist/client/assets/reports-DC8tSFj3.js +1 -0
  226. package/dist/client/assets/{reports-B1FmmHPo.js → reports-Q6oueood.js} +2 -2
  227. package/dist/client/assets/reports-tab-DE-TYPly.js +2 -0
  228. package/dist/client/assets/repositories-BoiOgwFm.js +1 -0
  229. package/dist/client/assets/repository-import-picker-DyEfEliR.js +1 -0
  230. package/dist/client/assets/repository-picker-DWJtJkZW.js +1 -0
  231. package/dist/client/assets/require-capability-DljrHpsM.js +1 -0
  232. package/dist/client/assets/{required-auth-layout-CraNNSBi.js → required-auth-layout-TTElzhIM.js} +1 -1
  233. package/dist/client/assets/{reset-password-DcO8_P05.js → reset-password-B1ylDKoe.js} +1 -1
  234. package/dist/client/assets/resizable-DOW_fL7z.js +1 -0
  235. package/dist/client/assets/retry-i8LvYSZg.js +1 -0
  236. package/dist/client/assets/{review-settings-CANg_Nan.js → review-settings-DHvMG4G0.js} +1 -1
  237. package/dist/client/assets/{rich-text-link-control-CCig2s9-.js → rich-text-link-control-HLhFAha7.js} +1 -1
  238. package/dist/client/assets/roles-BWbTlJZc.js +1 -0
  239. package/dist/client/assets/route-D26IsMv1.js +1 -0
  240. package/dist/client/assets/route-D_kbg4iH.js +1 -0
  241. package/dist/client/assets/route-jdsFbZW7.js +1 -0
  242. package/dist/client/assets/runnable-block-editor-Bi0Cv7yD.js +16 -0
  243. package/dist/client/assets/sandbox-git-api-CMdpE2TE.js +1 -0
  244. package/dist/client/assets/{sandbox-lifecycle-context-Beua1bNX.js → sandbox-lifecycle-context-BbTDNpeS.js} +2 -2
  245. package/dist/client/assets/save-changes-debug-nBi-n9eV.js +1 -0
  246. package/dist/client/assets/{schema-BzgrQmAY.js → schema-BegvnGCM.js} +1 -1
  247. package/dist/client/assets/{scroll-area-tBZq-ZvJ.js → scroll-area-CxxMejtk.js} +1 -1
  248. package/dist/client/assets/{search-input-CYERWjWv.js → search-input-axkgbTZ7.js} +1 -1
  249. package/dist/client/assets/secrets-kzqIbFmd.js +1 -0
  250. package/dist/client/assets/section-preview-url-Csj0_ZDg.js +1 -0
  251. package/dist/client/assets/sections-editor-B_t9OrnC.js +2 -0
  252. package/dist/client/assets/select-B2GRzoG3.js +1 -0
  253. package/dist/client/assets/select-model-BRHN792B.js +1 -0
  254. package/dist/client/assets/seo-editor-DvngP1ti.js +1 -0
  255. package/dist/client/assets/settings-tab-DFjZ-Fkn.js +5 -0
  256. package/dist/client/assets/sheet-BePDARR0.js +1 -0
  257. package/dist/client/assets/shell-layout-D2wS-FNX.js +1 -0
  258. package/dist/client/assets/sidebar-IspuJbto.js +1 -0
  259. package/dist/client/assets/skill-preview-BdtuUFgV.js +1 -0
  260. package/dist/client/assets/skills-QJ3mhNvI.js +1 -0
  261. package/dist/client/assets/sso-DKhL-ARh.js +1 -0
  262. package/dist/client/assets/{store-CjL9y_7d.js → store-B9Az6md3.js} +1 -1
  263. package/dist/client/assets/store-registry-hcgHbNGW.js +2 -0
  264. package/dist/client/assets/switch-DJ4Dr2_V.js +1 -0
  265. package/dist/client/assets/synced-repos-flbNGs20.js +1 -0
  266. package/dist/client/assets/{table-aIDGrvqv.js → table-CrJ9LOSc.js} +1 -1
  267. package/dist/client/assets/{tabs-Sr-wlkg3.js → tabs-DVMaAAMA.js} +1 -1
  268. package/dist/client/assets/{task-board-CazuPR-U.js → task-board-SlBuwhrX.js} +1 -1
  269. package/dist/client/assets/task-route-B4hPzw6u.js +1 -0
  270. package/dist/client/assets/{task-status-Cj8IGjJC.js → task-status-DhZZzZ6G.js} +1 -1
  271. package/dist/client/assets/{tasks-DzatESzy.js → tasks-B_rqCvr1.js} +4 -4
  272. package/dist/client/assets/tasks-CViGtGHm.js +1 -0
  273. package/dist/client/assets/{textarea-6VvdKhvF.js → textarea-BDMLJ5G-.js} +1 -1
  274. package/dist/client/assets/{thread-intent-DPwCeeGE.js → thread-intent-C7DpKTRQ.js} +1 -1
  275. package/dist/client/assets/thread-route-Bc63tvFc.js +1 -0
  276. package/dist/client/assets/{thread-route-BsrvgyVU.js → thread-route-BzWllNYG.js} +1 -1
  277. package/dist/client/assets/thread-sheet-body-CiausLhX.js +1 -0
  278. package/dist/client/assets/toggle-group-BW8cP6lf.js +1 -0
  279. package/dist/client/assets/{toolbar-icon-button-CSTgB2Je.js → toolbar-icon-button-A2ebiBUr.js} +1 -1
  280. package/dist/client/assets/tooltip-B7VLfO9w.js +1 -0
  281. package/dist/client/assets/{track-CDfY4FZL.js → track-BGU8HJCB.js} +1 -1
  282. package/dist/client/assets/{types-8hWP_tsZ.js → types-CrAbOCy3.js} +6 -6
  283. package/dist/client/assets/usage-stats-Bf1Ukas_.js +1 -0
  284. package/dist/client/assets/use-ai-providers-R1Jac-4Q.js +1 -0
  285. package/dist/client/assets/use-automations-BzLd_Cf7.js +1 -0
  286. package/dist/client/assets/{use-autosave-DRlRuq5e.js → use-autosave-BezKrA6F.js} +1 -1
  287. package/dist/client/assets/use-commerce-diagnostic-DTGIqIpu.js +1 -0
  288. package/dist/client/assets/use-connect-companion-CgerJAPe.js +1 -0
  289. package/dist/client/assets/{use-connection-tOIuuLKJ.js → use-connection-B4t4VJEN.js} +1 -1
  290. package/dist/client/assets/{use-copy-B4PUMZjo.js → use-copy-DQwrjGi4.js} +1 -1
  291. package/dist/client/assets/{use-create-virtual-mcp-x2IPUAAO.js → use-create-virtual-mcp-CHEKOqdh.js} +1 -1
  292. package/dist/client/assets/{use-date-fns-locale-use6rm0l.js → use-date-fns-locale-m0Q-8AAg.js} +1 -1
  293. package/dist/client/assets/{use-debounced-autosave-CWLgAozd.js → use-debounced-autosave-C82NqRut.js} +1 -1
  294. package/dist/client/assets/{use-debounced-value-BHZw1Wtv.js → use-debounced-value-SjJ8k_tD.js} +1 -1
  295. package/dist/client/assets/use-deco-credits-CIfhJ3OU.js +1 -0
  296. package/dist/client/assets/use-decopilot-events-DDnHJjGY.js +1 -0
  297. package/dist/client/assets/use-delete-connection-BWW3Qwe4.js +1 -0
  298. package/dist/client/assets/{use-deployment-admin-PTBGIrMl.js → use-deployment-admin-D4Et99Id.js} +1 -1
  299. package/dist/client/assets/use-fast-preview-draft-url-B8C-G0p2.js +1 -0
  300. package/dist/client/assets/use-file-configs-CKcyFOK-.js +1 -0
  301. package/dist/client/assets/{use-infinite-scroll-DnRzNQQc.js → use-infinite-scroll-C88xvDJq.js} +1 -1
  302. package/dist/client/assets/use-join-requests-CtMSd2H7.js +1 -0
  303. package/dist/client/assets/use-main-panel-tabs-BLf-yD79.js +1 -0
  304. package/dist/client/assets/use-mcp-auth-status-CF5e5Swp.js +1 -0
  305. package/dist/client/assets/{use-mcp-client-CzGi1Gun.js → use-mcp-client-DmOwsV3f.js} +6 -6
  306. package/dist/client/assets/{use-mcp-prompts-BJsq63pG.js → use-mcp-prompts-BKFfTbQi.js} +1 -1
  307. package/dist/client/assets/{use-mcp-tools-I4ahUYGD.js → use-mcp-tools-eOThR6gd.js} +1 -1
  308. package/dist/client/assets/{use-members-xjztJVBn.js → use-members-mw1URW2v.js} +1 -1
  309. package/dist/client/assets/use-mobile-WPuOYoIV.js +1 -0
  310. package/dist/client/assets/{use-navigate-to-agent-CBQsYRLL.js → use-navigate-to-agent-zGc1-u-z.js} +1 -1
  311. package/dist/client/assets/use-open-billing-url-BYWSUicc.js +1 -0
  312. package/dist/client/assets/use-org-auth-client-mMTl8cKp.js +1 -0
  313. package/dist/client/assets/{use-org-fs-Cm8FYvYP.js → use-org-fs-Ck9VysIz.js} +1 -1
  314. package/dist/client/assets/use-org-notice-Cb7z4nA0.js +1 -0
  315. package/dist/client/assets/{use-org-sso-CP_t4LLU.js → use-org-sso-CvkPQsKr.js} +1 -1
  316. package/dist/client/assets/{use-organization-roles-Cnixvt9H.js → use-organization-roles-wnmrYWSM.js} +1 -1
  317. package/dist/client/assets/use-organization-settings-CRw6qdb3.js +1 -0
  318. package/dist/client/assets/use-panel-navigate-ez3OqVq8.js +1 -0
  319. package/dist/client/assets/{use-project-native-view-presence-CJ7vLSBz.js → use-project-native-view-presence-DFjsPIlC.js} +1 -1
  320. package/dist/client/assets/use-project-scope-D9t-w7F3.js +1 -0
  321. package/dist/client/assets/use-registry-connections-BC1Pt8V1.js +1 -0
  322. package/dist/client/assets/use-releases-B_ioEYcb.js +1 -0
  323. package/dist/client/assets/use-route-default-main-B8Ci266p.js +1 -0
  324. package/dist/client/assets/use-secrets-BZEH47Ed.js +1 -0
  325. package/dist/client/assets/use-section-preview-base-D8ddLJeY.js +1 -0
  326. package/dist/client/assets/{use-session-runtime-Cs4eGT9k.js → use-session-runtime-CKDTMwlz.js} +1 -1
  327. package/dist/client/assets/use-tags-BnnveSvi.js +1 -0
  328. package/dist/client/assets/use-task-metadata-DQ-jzCVZ.js +1 -0
  329. package/dist/client/assets/{use-thread-outputs-DtpQGqCf.js → use-thread-outputs-ChimPCUk.js} +1 -1
  330. package/dist/client/assets/use-view-mode-CpyVGfy9.js +1 -0
  331. package/dist/client/assets/use-virtual-mcp-DvSX4N6q.js +1 -0
  332. package/dist/client/assets/useInfiniteQuery-CuoCKqDV.js +1 -0
  333. package/dist/client/assets/{useQueries-CnHkVL7d.js → useQueries-CCVXh4wK.js} +1 -1
  334. package/dist/client/assets/useSuspenseInfiniteQuery-BGyZ2Zcs.js +1 -0
  335. package/dist/client/assets/{users-CWHZPvdU.js → users-DgkJfwRz.js} +1 -1
  336. package/dist/client/assets/{utils-CdxSjBly.js → utils-D06E4WDv.js} +2 -2
  337. package/dist/client/assets/variant-calendar-B2YQFxru.js +1 -0
  338. package/dist/client/assets/{variant-matcher-override-BLTbL0Nb.js → variant-matcher-override-POFwaaTG.js} +1 -1
  339. package/dist/client/assets/view-mode-toggle-B09x-ETl.js +1 -0
  340. package/dist/client/assets/{virtual-mcp-CIE6gIFV.js → virtual-mcp-D-br_N6s.js} +1 -1
  341. package/dist/client/index.html +2 -2
  342. package/dist/server/cli.js +1 -1
  343. package/dist/server/server.js +1 -1
  344. package/package.json +1 -1
  345. package/dist/client/assets/Printer-Nban-oJk.js +0 -1
  346. package/dist/client/assets/access-gate-aVhmxNUP.js +0 -1
  347. package/dist/client/assets/add-connection-dialog-C2-znERG.js +0 -1
  348. package/dist/client/assets/agent-analytics-CLObAM6S.js +0 -2
  349. package/dist/client/assets/agent-app-DtLxy7iB.js +0 -1
  350. package/dist/client/assets/agent-assets-5J9H4wgC.js +0 -1
  351. package/dist/client/assets/agent-automation-DTYBStDc.js +0 -20
  352. package/dist/client/assets/agent-automations-DYZPALXC.js +0 -1
  353. package/dist/client/assets/agent-connect-sources-DJFWziK9.js +0 -1
  354. package/dist/client/assets/agent-deck-De0Y6qk5.js +0 -1
  355. package/dist/client/assets/agent-e2e-MVQ6vmAy.js +0 -1
  356. package/dist/client/assets/agent-file-IBnKf7Fw.js +0 -1
  357. package/dist/client/assets/agent-git-DjVoKiR8.js +0 -3
  358. package/dist/client/assets/agent-hosting-DbC8wvCr.js +0 -1
  359. package/dist/client/assets/agent-icon-DsGBCBNv.js +0 -1
  360. package/dist/client/assets/agent-library-file-CySHm683.js +0 -1
  361. package/dist/client/assets/agent-monitor-Duc2QTVQ.js +0 -1
  362. package/dist/client/assets/agent-overview-DAVTPrgq.js +0 -1
  363. package/dist/client/assets/agent-settings-DBEnACPy.js +0 -1
  364. package/dist/client/assets/agent-site-editor-CJ_722sF.js +0 -1
  365. package/dist/client/assets/agent-site-editor-code-CBPV2yNN.js +0 -2
  366. package/dist/client/assets/agent-site-editor-content-C-fwwsI7.js +0 -2
  367. package/dist/client/assets/agent-site-editor-preview-Be-uG2hV.js +0 -504
  368. package/dist/client/assets/agent-view-B3DdbJTr.js +0 -1
  369. package/dist/client/assets/agent-view-guard-DTG6Ut5n.js +0 -1
  370. package/dist/client/assets/agents-list-DNaOFYAO.js +0 -1
  371. package/dist/client/assets/ai-providers-BPcl_qgT.js +0 -1
  372. package/dist/client/assets/api-keys-CYMMtT0P.js +0 -1
  373. package/dist/client/assets/app-editor-_27_2g82.js +0 -1
  374. package/dist/client/assets/asset-utils-DTfzHa9m.js +0 -1
  375. package/dist/client/assets/automation-runs-Dt50JHCo.js +0 -1
  376. package/dist/client/assets/automations-DDydXmIK.js +0 -1
  377. package/dist/client/assets/backoff-CrEUbyZT.js +0 -1
  378. package/dist/client/assets/buckets-Wx6DtJNT.js +0 -1
  379. package/dist/client/assets/build-improve-prompt-doc-4aKzyTWA.js +0 -2
  380. package/dist/client/assets/bulk-category-panel-CclTC40F.js +0 -1
  381. package/dist/client/assets/category-editor-CuGxUDVJ.js +0 -1
  382. package/dist/client/assets/choose-editor-CE7aKrQp.js +0 -1
  383. package/dist/client/assets/collapsible-BDifv-q9.js +0 -1
  384. package/dist/client/assets/collection-detail-ec9sW8Ey.js +0 -1
  385. package/dist/client/assets/collection-display-button-C3CfuUhX.js +0 -1
  386. package/dist/client/assets/commerce-onboarding-Dxc7EEsL.js +0 -1
  387. package/dist/client/assets/connect-layout-Bby2uYqZ.js +0 -1
  388. package/dist/client/assets/connection-detail-C-Fe9wui.js +0 -1
  389. package/dist/client/assets/connections-CxSK9S4W.js +0 -1
  390. package/dist/client/assets/decode-html-entities-B4Qel6ov.js +0 -1
  391. package/dist/client/assets/decopilot-sse-pool-czpSFI9L.js +0 -1
  392. package/dist/client/assets/delay-CnY5UFtP.js +0 -1
  393. package/dist/client/assets/dialog--Jkwvpx1.js +0 -1
  394. package/dist/client/assets/discover-C7-JIKhR.js +0 -1
  395. package/dist/client/assets/domain-settings-Dh029s1M.js +0 -1
  396. package/dist/client/assets/file-explorer-B4d-xz4q.js +0 -2
  397. package/dist/client/assets/general-BY1zbaWS.js +0 -1
  398. package/dist/client/assets/home-CeJo7q7K.js +0 -1
  399. package/dist/client/assets/hooks-CxPd9b6i.js +0 -15
  400. package/dist/client/assets/index-1yGxjvng.js +0 -24
  401. package/dist/client/assets/index-C7tZKQ5s.js +0 -1
  402. package/dist/client/assets/index-CklK0EA_.js +0 -1
  403. package/dist/client/assets/index-D5CXQ9x9.js +0 -1
  404. package/dist/client/assets/index-Og5m3t85.js +0 -26
  405. package/dist/client/assets/index-Y6pd1REu.js +0 -1
  406. package/dist/client/assets/infra-billing-ChvPe0pr.js +0 -1
  407. package/dist/client/assets/invite-member-dialog-CeSVAfZq.js +0 -1
  408. package/dist/client/assets/layout-BIIr_imR.js +0 -1
  409. package/dist/client/assets/legacy-agents-deep-CdZo4h4A.js +0 -1
  410. package/dist/client/assets/legacy-main-redirect-CWWHewM6.js +0 -1
  411. package/dist/client/assets/login-svGY2sKo.js +0 -1
  412. package/dist/client/assets/members-BOTXfNHf.js +0 -1
  413. package/dist/client/assets/org-layout-BiRvLqL-.js +0 -1
  414. package/dist/client/assets/orgs-CMf-H7HH.js +0 -1
  415. package/dist/client/assets/post-calendar-BAQtpQvh.js +0 -1
  416. package/dist/client/assets/post-editor-DBJMHXYe.js +0 -1
  417. package/dist/client/assets/preview-content-CICx8Frq.js +0 -1
  418. package/dist/client/assets/profile-CUkJFM3_.js +0 -1
  419. package/dist/client/assets/project-app-view-BSYHmGj3.js +0 -1
  420. package/dist/client/assets/project-feed-BEGVLizK.js +0 -1
  421. package/dist/client/assets/project-reports-BozhFElP.js +0 -1
  422. package/dist/client/assets/project-tasks-DVexwc9x.js +0 -1
  423. package/dist/client/assets/prompts-Df-P8Zuz.js +0 -1
  424. package/dist/client/assets/record-editor-9YdHcAWO.js +0 -1
  425. package/dist/client/assets/redirect-editor-BohyWJXT.js +0 -1
  426. package/dist/client/assets/registry-BbkHDIpk.js +0 -2
  427. package/dist/client/assets/reports-SeFGRJSZ.js +0 -1
  428. package/dist/client/assets/reports-tab-D5rlmWEp.js +0 -2
  429. package/dist/client/assets/repositories-BXEjUV3F.js +0 -1
  430. package/dist/client/assets/repository-import-picker-Bc_O4k0-.js +0 -1
  431. package/dist/client/assets/repository-picker-DC97O6OK.js +0 -1
  432. package/dist/client/assets/require-capability-CoB1D-Ih.js +0 -1
  433. package/dist/client/assets/retry-CErkP7V6.js +0 -1
  434. package/dist/client/assets/roles-DEMri9Kk.js +0 -1
  435. package/dist/client/assets/runnable-block-editor-BD-IThSC.js +0 -16
  436. package/dist/client/assets/secrets-7Z0pTBUq.js +0 -1
  437. package/dist/client/assets/sections-editor-DoMH-fks.js +0 -2
  438. package/dist/client/assets/select-C9ZnmbzX.js +0 -1
  439. package/dist/client/assets/select-model-FK_tmltz.js +0 -1
  440. package/dist/client/assets/seo-editor-DNovpojV.js +0 -1
  441. package/dist/client/assets/settings-layout-Cd8jASua.js +0 -1
  442. package/dist/client/assets/settings-sidebar-DP80M_GR.js +0 -1
  443. package/dist/client/assets/settings-tab-DE3XUo7h.js +0 -5
  444. package/dist/client/assets/shell-controls-CnE-Tn5l.js +0 -1
  445. package/dist/client/assets/shell-layout-DMp5UdGb.js +0 -1
  446. package/dist/client/assets/skill-preview-D2lK4hU9.js +0 -1
  447. package/dist/client/assets/skills-xXfBybxi.js +0 -1
  448. package/dist/client/assets/source-system-tabs-CnEGUb4r.js +0 -1
  449. package/dist/client/assets/sso-DdBxRFrm.js +0 -1
  450. package/dist/client/assets/store-registry-BFRxGHgD.js +0 -2
  451. package/dist/client/assets/switch-DADMizS1.js +0 -1
  452. package/dist/client/assets/synced-repos-Cp7R03Jp.js +0 -1
  453. package/dist/client/assets/task-route-_NgFGVoT.js +0 -1
  454. package/dist/client/assets/tasks-BvZdYZ5R.js +0 -1
  455. package/dist/client/assets/thread-sheet-body-S2AS0IdJ.js +0 -1
  456. package/dist/client/assets/toggle-group-CHZjV-1n.js +0 -1
  457. package/dist/client/assets/toolbar-DAhC4RMM.js +0 -1
  458. package/dist/client/assets/usage-stats-B38oXMbk.js +0 -1
  459. package/dist/client/assets/use-ai-providers-DYf552qv.js +0 -1
  460. package/dist/client/assets/use-automations-DSRSDlyo.js +0 -1
  461. package/dist/client/assets/use-commerce-diagnostic-pXwQBZmy.js +0 -1
  462. package/dist/client/assets/use-connect-companion-Bt171l5d.js +0 -1
  463. package/dist/client/assets/use-deco-credits-Coxc4dyp.js +0 -1
  464. package/dist/client/assets/use-decopilot-events-V4xtyk7c.js +0 -1
  465. package/dist/client/assets/use-delete-connection-geT4L5Ed.js +0 -1
  466. package/dist/client/assets/use-file-configs-BLWnBKpa.js +0 -1
  467. package/dist/client/assets/use-join-requests-DL4guRSR.js +0 -1
  468. package/dist/client/assets/use-main-panel-tabs-BtAksZ1f.js +0 -1
  469. package/dist/client/assets/use-mcp-auth-status-CpecQqEX.js +0 -1
  470. package/dist/client/assets/use-open-billing-url-DaC9_MxZ.js +0 -1
  471. package/dist/client/assets/use-org-auth-client-DuxSmx0x.js +0 -1
  472. package/dist/client/assets/use-org-notice-lWz1PPs-.js +0 -1
  473. package/dist/client/assets/use-organization-settings-C-LQvPpq.js +0 -1
  474. package/dist/client/assets/use-panel-navigate-D2RT2tc_.js +0 -1
  475. package/dist/client/assets/use-project-scope-Ch_4TfMQ.js +0 -1
  476. package/dist/client/assets/use-registry-connections-CuDWC28C.js +0 -1
  477. package/dist/client/assets/use-secrets-BJDccjnS.js +0 -1
  478. package/dist/client/assets/use-section-preview-base-SCqBiLMF.js +0 -1
  479. package/dist/client/assets/use-status-sounds-BG-lkYEo.js +0 -1
  480. package/dist/client/assets/use-tags-DhkHJc7C.js +0 -1
  481. package/dist/client/assets/use-task-metadata-COSUQhUk.js +0 -1
  482. package/dist/client/assets/use-view-mode-CUARubnx.js +0 -1
  483. package/dist/client/assets/use-virtual-mcp-BMRFgR9g.js +0 -1
  484. package/dist/client/assets/useInfiniteQuery-DOeboQGx.js +0 -1
  485. package/dist/client/assets/useSuspenseInfiniteQuery-B5UzTlHS.js +0 -1
  486. package/dist/client/assets/variant-calendar-f9XxiGiP.js +0 -1
  487. package/dist/client/assets/view-mode-toggle-D31fXZcw.js +0 -1
  488. /package/dist/client/assets/{index-DDGTF8rc.css → agent-site-editor-DDGTF8rc.css} +0 -0
@@ -1,4 +1,4 @@
1
- import{c as oo,r as H,b as rc,b0 as Lf,j as D,h as $f,B as rl,am as il,ak as zf,aF as Bf,ej as ic,ek as Ff,ar as Hf,aI as Vt,el as Vf,l as sc,a6 as jf,a7 as Wf,a9 as Kf}from"./index-gctAQu2T.js";import{d as Uf,g as _f}from"./gateway-client-Cb37izH_.js";import{d as qf,c as Jf,e as Gf,b as Yf,D as Xf}from"./dialog--Jkwvpx1.js";import{F as Qf,d as Zf,a as eh,e as th,b as nh,c as rh}from"./form-DhUF_Mtg.js";import{I as ih}from"./input-eBmoU-9D.js";import{t as sl}from"./utils-CVEq3hMx.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 ax(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||Uf(n.name,_f(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(qf,{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(Jf,{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(Zf,{control:f.control,name:Yt.name,render:Pf=>{const{field:nl}=Pf;return D.jsxs(eh,{children:[D.jsxs(th,{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(nh,{children:D.jsx(ih,{...nl,value:nl.value??"",required:Yt.required,placeholder:Yt.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),D.jsx(rh,{})]})}},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(Gf,{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(Qf,{...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(Yf,{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(Xf,{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(`
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,dZ as ic,d_ as Ff,aw as Hf,dG as Vt,d$ as Vf,l as sc}from"./index-CVJEcf37.js";import{d as jf,g as Wf}from"./gateway-client-D45uHvIc.js";import{d as Kf,c as Uf,e as _f,b as qf,D as Jf}from"./dialog-Dxe0Jgna.js";import{a as Gf,F as Yf,b as Xf,c as Qf,d as Zf,f as eh}from"./form-CRSWplOb.js";import{I as th}from"./input-C8MQoDCb.js";import{t as sl}from"./utils-CVEq3hMx.js";import{T as nh,a as rh,c as ih}from"./tooltip-B7VLfO9w.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
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
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
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(`
@@ -7,9 +7,9 @@ import{c as oo,r as H,b as rc,b0 as Lf,j as D,h as $f,B as rl,am as il,ak as zf,
7
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
8
 
9
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 dx(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=`
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
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 fx(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 hx(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function px(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 mx(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function gx(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(`
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(`
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
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}
@@ -20,7 +20,7 @@ import{c as oo,r as H,b as rc,b0 as Lf,j as D,h as $f,B as rl,am as il,ak as zf,
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 yx(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:`
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
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??`
25
25
 
26
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 {
@@ -95,10 +95,10 @@ img.ProseMirror-separator {
95
95
  display: block;
96
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=`
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 bx=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 kx(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 Sx=()=>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 xx(t,e,n){t.chain().focus().insertContentAt(e,[Ub(n),{type:"text",text:" "}]).run()}function Ub(t){return{type:"mention",attrs:t}}function Cx(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 Mx=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 Ex(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(jf,{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(Wf,{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(Kf,{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 Tx=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 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,`
99
99
 
100
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 wx=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(`
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(`
102
102
  `).map(c=>c.trim()===""?n:`${n} ${c}`);r.push(a.join(`
103
103
  `))}),r.join(`
104
104
  ${n}
@@ -127,7 +127,7 @@ ${n}
127
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.
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 vx=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,`
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
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(`
132
132
  `).trim(),contentLines:p,raw:m.join(`
133
133
  `)}),r=g,n=g}return[e,r]}const HS=new RegExp(`^(${vf})([.)])\\s+(.+)$`);function VS(t){const e=t.split(`
@@ -138,4 +138,4 @@ ${n}
138
138
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,i;const s=t.split(`
139
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
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 Ax=tx;export{E as $,dx as A,dy as B,gx as C,K as D,U as E,Tx as F,c0 as G,oy as H,xd as I,$0 as J,bx as K,bn as L,_t as M,ye as N,vx as O,ax 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,fx as a1,vo as a2,fy as a3,td as a4,Nb as b,Ub as c,Sx as d,Mx as e,Ex as f,px as g,X as h,xx as i,F as j,Kb as k,Cx as l,Y as m,Io as n,wx as o,tt as p,hx as q,Jy as r,Ax as s,Bn as t,kx as u,Ao as v,L as w,A as x,mx as y,yx as z};
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};