@vellumai/web 0.11.1 → 0.11.2-dev.202608042227.b54139c

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 (573) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/{AnimatePresence-D23js3-M.js → AnimatePresence-Ctt0yeEv.js} +1 -1
  3. package/dist/assets/{BundleConfirmPage-C1-BZKI9.js → BundleConfirmPage-Cyi9KDtJ.js} +1 -1
  4. package/dist/assets/{Combination-C7TWRLS7.js → Combination-r1T8bzRv.js} +1 -1
  5. package/dist/assets/{a2a-invite-CfhpXDTT.js → a2a-invite-CuswvLmx.js} +1 -1
  6. package/dist/assets/{about-page-Dtg-I99x.js → about-page-CsyRgK3c.js} +1 -1
  7. package/dist/assets/access-DL6ZqmDW.js +1 -0
  8. package/dist/assets/{account-page-DP2HVinz.js → account-page-BckvBDX6.js} +1 -1
  9. package/dist/assets/{account-shell-BxZ339N3.js → account-shell-CrUI5eAF.js} +1 -1
  10. package/dist/assets/{acp-run-actions-BGbBYETY.js → acp-run-actions-SclBvksz.js} +1 -1
  11. package/dist/assets/acp-run-detail-panel-CvsVT-Fm.js +5 -0
  12. package/dist/assets/{acp-run-store-CmGaPJm1.js → acp-run-store-Beu3Bcgz.js} +1 -1
  13. package/dist/assets/activity-steps-panel-litv3D3H.js +1 -0
  14. package/dist/assets/{add-credential-modal-DQZ43BJU.js → add-credential-modal-huCvTQuI.js} +1 -1
  15. package/dist/assets/add-credits-modal-ChtBtqP0.js +1 -0
  16. package/dist/assets/ai-page-DEeQhQ4O.js +1 -0
  17. package/dist/assets/android-consumption-only-DVgl1UqJ.js +1 -0
  18. package/dist/assets/animate-DBLF0qC1.js +1 -0
  19. package/dist/assets/{animated-avatar-CDeJNhwm.js → animated-avatar-CB7bMVIp.js} +1 -1
  20. package/dist/assets/api-BMYk8zh_.js +1 -0
  21. package/dist/assets/api-CSQLVOps.js +1 -0
  22. package/dist/assets/{api-key-screen-CoLZh8vw.js → api-key-screen-CAISP4Mb.js} +1 -1
  23. package/dist/assets/{app-card-DgDV-yMd.js → app-card-CVbbaWgL.js} +1 -1
  24. package/dist/assets/{app-info-Bdfw54u1.js → app-info-C3XHVqpA.js} +1 -1
  25. package/dist/assets/archive-BQ3zdIPv.js +1 -0
  26. package/dist/assets/{archive-redirect-page-CWJIEUlH.js → archive-redirect-page-DH92Svcy.js} +1 -1
  27. package/dist/assets/{assistant-feature-flag-store-CMUNSAPL.js → assistant-feature-flag-store-B-Q1aqEl.js} +1 -1
  28. package/dist/assets/assistant-identity-store-CBR9g2br.js +1 -0
  29. package/dist/assets/{assistant-status-panel-Bt_19-BI.js → assistant-status-panel-Cpn_vawB.js} +1 -1
  30. package/dist/assets/auth-store-BQ6VXv_c.js +2 -0
  31. package/dist/assets/{avatar-random-IysJ0Bdt.js → avatar-random-KFUMUc0u.js} +1 -1
  32. package/dist/assets/{avatar-renderer-3EVhZ7TB.js → avatar-renderer-DhQrquOd.js} +1 -1
  33. package/dist/assets/background-task-actions-DOvMbNR5.js +1 -0
  34. package/dist/assets/{background-task-detail-panel-DqXuwo9q.js → background-task-detail-panel-BWdxuRXx.js} +1 -1
  35. package/dist/assets/{background-task-store-CN04oS2z.js → background-task-store-BYeLr6QX.js} +1 -1
  36. package/dist/assets/billing-page-sgpzYbPn.js +3 -0
  37. package/dist/assets/{billing-redirect-page-CiHoDQHE.js → billing-redirect-page-BSLp0gfo.js} +1 -1
  38. package/dist/assets/{bookmarks-page-Bk04EUIg.js → bookmarks-page-BT4HI-vx.js} +1 -1
  39. package/dist/assets/{browser-Bses4IN3.js → browser-BlLwMkM7.js} +2 -2
  40. package/dist/assets/build-state-CaPWg2qV.js +1 -0
  41. package/dist/assets/{button-Dy5001j6.js → button-fyWSnR9X.js} +1 -1
  42. package/dist/assets/{capture-error-FWzaVb8P.js → capture-error-Bj8_eutd.js} +1 -1
  43. package/dist/assets/channels-page-route-CCzU4jYB.js +9 -0
  44. package/dist/assets/{chat-avatar-CIF_o6y5.js → chat-avatar-yNiGc9Qd.js} +1 -1
  45. package/dist/assets/{chat-layout-slots-store-C325hn1X.js → chat-layout-slots-store-DEpMyhna.js} +1 -1
  46. package/dist/assets/chat-markdown-message-B-QgIcXI.js +1 -0
  47. package/dist/assets/checkbox-B-CErUSe.js +1 -0
  48. package/dist/assets/checkout-continuation-2s8QrvBM.js +1 -0
  49. package/dist/assets/checkout-page-6J1AkP4E.js +1 -0
  50. package/dist/assets/checkout-return-target-hzWGTubb.js +1 -0
  51. package/dist/assets/{client-feature-flag-store-Bg5XEI2b.js → client-feature-flag-store-DXK8Z7NT.js} +1 -1
  52. package/dist/assets/{client-identity-bdtPpHZK.js → client-identity-C7zeQXr0.js} +1 -1
  53. package/dist/assets/command-palette-DWMcsxOz.js +1 -0
  54. package/dist/assets/command-palette-window-page-DMIb9rDp.js +1 -0
  55. package/dist/assets/{community-page-BZmxfsXK.js → community-page-BDyUaDv3.js} +1 -1
  56. package/dist/assets/{confirm-dialog-DZX6LhLy.js → confirm-dialog-Ro8nszbc.js} +1 -1
  57. package/dist/assets/{connect-page-D_I1YM62.js → connect-page-DidjPRWR.js} +1 -1
  58. package/dist/assets/consent-DtZXy-Ve.js +1 -0
  59. package/dist/assets/{consent-controls-CiKmEzBn.js → consent-controls-YQyFfuPh.js} +1 -1
  60. package/dist/assets/{contacts-gateway-C628mrY_.js → contacts-gateway-B1tIdiPt.js} +1 -1
  61. package/dist/assets/contacts-page-route-BvLo0kNr.js +1 -0
  62. package/dist/assets/{conversation-cache-BzPdBPXN.js → conversation-cache-CtPnlBgy.js} +1 -1
  63. package/dist/assets/{conversation-list-fetchers-BZnx9EMN.js → conversation-list-fetchers-NHbvfoK8.js} +1 -1
  64. package/dist/assets/conversation-navigation-DtwiHfoU.js +1 -0
  65. package/dist/assets/{conversation-queries-3taor2DZ.js → conversation-queries-BgTAbbMF.js} +1 -1
  66. package/dist/assets/{conversation-store-C0tvFESx.js → conversation-store-CjNpaqPu.js} +1 -1
  67. package/dist/assets/{copy-to-clipboard-DaTa8Tbi.js → copy-to-clipboard-DTcTjpel.js} +1 -1
  68. package/dist/assets/{credential-entry-page-BCAYmsDK.js → credential-entry-page-DhbcJuKj.js} +1 -1
  69. package/dist/assets/credentials-page-CWUWEzME.js +1 -0
  70. package/dist/assets/csv-preview-7rmnNd2Y.js +4 -0
  71. package/dist/assets/{danger-zone-redirect-page-BcdEHbAX.js → danger-zone-redirect-page-KZYKMY7g.js} +1 -1
  72. package/dist/assets/debug-page-hmPXX1LP.js +4 -0
  73. package/dist/assets/{deploy-dialogs-CpUMrpHq.js → deploy-dialogs-CpUhx5Wn.js} +1 -1
  74. package/dist/assets/{deploy-store-BJ-njgv-.js → deploy-store-BNgH3BhM.js} +1 -1
  75. package/dist/assets/{detail-card-D-5EWmAS.js → detail-card-4afu5RY8.js} +1 -1
  76. package/dist/assets/{detail-drawer-BglFkWVa.js → detail-drawer-BFIRH__A.js} +1 -1
  77. package/dist/assets/detail-panel-stop-button-Cgd-fsGE.js +1 -0
  78. package/dist/assets/{detail-shell-D9L3L7AM.js → detail-shell-DnpawtUB.js} +1 -1
  79. package/dist/assets/developer-page-BxhmZb2S.js +1 -0
  80. package/dist/assets/{device-settings-DXp9L4iB.js → device-settings-CUIsZfaf.js} +1 -1
  81. package/dist/assets/{devices-redirect-page-BNpxDctf.js → devices-redirect-page-DUD9O4gf.js} +1 -1
  82. package/dist/assets/{diagnostics-CLHyv7Xw.js → diagnostics-Zt4l-3-X.js} +1 -1
  83. package/dist/assets/{dictation-overlay-w1YHEfFR.js → dictation-overlay-A8jW4gBJ.js} +1 -1
  84. package/dist/assets/{dictation-overlay-page-DUWJ13of.js → dictation-overlay-page-DZMkAXxV.js} +1 -1
  85. package/dist/assets/{dist-CQN0ZAOZ.js → dist-Ir4ISn-W.js} +1 -1
  86. package/dist/assets/{dist-CKLJHt4Z.js → dist-O0VP-1jJ.js} +1 -1
  87. package/dist/assets/doctor-handoff-store-BMewN4B5.js +1 -0
  88. package/dist/assets/document-viewer-container-DWSbD2Vy.js +2 -0
  89. package/dist/assets/document-viewer-page-CMhJ-yEr.js +1 -0
  90. package/dist/assets/{domains-OaR_FpOR.js → domains-Co-JSZix.js} +1 -1
  91. package/dist/assets/{dropdown-DswWMJhz.js → dropdown-Dj83uU1o.js} +1 -1
  92. package/dist/assets/{edge-swipe-arbiter-store-D9XJTxJJ.js → edge-swipe-arbiter-store-CfH9mu8t.js} +1 -1
  93. package/dist/assets/effective-timezone-D2ed4HNy.js +1 -0
  94. package/dist/assets/{emails-page-Bqr8Buvt.js → emails-page-CGGFauIm.js} +1 -1
  95. package/dist/assets/{environment-store-Bbx4f6SQ.js → environment-store-CaT6bPjE.js} +1 -1
  96. package/dist/assets/esm-BbrSOd_w.js +1 -0
  97. package/dist/assets/esm-C0etwxTR.js +2 -0
  98. package/dist/assets/esm-CyzcmycU.js +2 -0
  99. package/dist/assets/esm-D-JKXCx6.js +2 -0
  100. package/dist/assets/esm-DE276B3X.js +2 -0
  101. package/dist/assets/esm-DVBKSDsY.js +2 -0
  102. package/dist/assets/{esm-UUuqyyp5.js → esm-DiKqJtNt.js} +1 -1
  103. package/dist/assets/esm-YgGZjYiF.js +2 -0
  104. package/dist/assets/{esm-ClO8yhvi.js → esm-yDpngOhF.js} +2 -2
  105. package/dist/assets/feature-flag-catalog-K0ruEmRc.js +1 -0
  106. package/dist/assets/file-DOePafLU.js +1 -0
  107. package/dist/assets/file-editor-C17bp9Ul.js +1 -0
  108. package/dist/assets/file-markdown-DQoYQOq5.js +2 -0
  109. package/dist/assets/first-run-scope-B9Y4wKSQ.js +1 -0
  110. package/dist/assets/{funnel-events-RT_kdQHK.js → funnel-events-CQ8HwOa-.js} +1 -1
  111. package/dist/assets/general-page-m0mev7wE.js +1 -0
  112. package/dist/assets/{get-memory-stats-CthVfpul.js → get-memory-stats-C6qisNce.js} +1 -1
  113. package/dist/assets/{haptics-rJpeBta-.js → haptics-B3p6ezq1.js} +2 -2
  114. package/dist/assets/hatching-screen-Dv3wxBV9.js +1 -0
  115. package/dist/assets/home-page-route-CIWcCDlk.js +1 -0
  116. package/dist/assets/hosting-screen-L3YT9qlq.js +1 -0
  117. package/dist/assets/identity-DGwGuDNu.js +1 -0
  118. package/dist/assets/identity-page-route-B0LXvvHJ.js +7 -0
  119. package/dist/assets/index-BXn8XwZ4.css +2 -0
  120. package/dist/assets/index-COSnTmLV.js +11 -0
  121. package/dist/assets/{ingest-BbV11WbG.js → ingest-B6HgY85V.js} +1 -1
  122. package/dist/assets/{input-C-GkeWCw.js → input-B_e9sgY6.js} +1 -1
  123. package/dist/assets/{inspect-page-D_9E5ham.js → inspect-page-DZGJ3_DF.js} +4 -4
  124. package/dist/assets/{installed-plugins-query-6u0jUM-L.js → installed-plugins-query-B-E60ZeG.js} +1 -1
  125. package/dist/assets/{integration-icon-tiuVoy54.js → integration-icon-Ck3AD_AZ.js} +1 -1
  126. package/dist/assets/integrations-page-BnTDIPsE.js +1 -0
  127. package/dist/assets/{intelligence-layout-CVzq_bDm.js → intelligence-layout-WIGKQ4DS.js} +1 -1
  128. package/dist/assets/{invalidate-memory-queries-BPL6t0Cu.js → invalidate-memory-queries-CUCHL1MU.js} +1 -1
  129. package/dist/assets/{invalidate-plugin-queries-QmmXCyiN.js → invalidate-plugin-queries-DaqjVAFQ.js} +1 -1
  130. package/dist/assets/{keyboard-shortcuts-redirect-page-D_Rf5W7f.js → keyboard-shortcuts-redirect-page-CMfF0rtZ.js} +1 -1
  131. package/dist/assets/latest-assistant-text-DsAf5nM_.js +24 -0
  132. package/dist/assets/{library-detail-page-CKWN2cc7.js → library-detail-page-CBZQyjfQ.js} +1 -1
  133. package/dist/assets/library-page-CKmgCstM.js +1 -0
  134. package/dist/assets/{paperclip-DVE0scjU.js → lightbulb-NdZMkb6Y.js} +1 -1
  135. package/dist/assets/local-mode-StEqYyqw.js +39 -0
  136. package/dist/assets/local-runtime-upgrade-7dQktWp2.js +1 -0
  137. package/dist/assets/local-settings-Bx7FsNo5.js +1 -0
  138. package/dist/assets/{login-flow-llpmkEjN.js → login-flow-C4ibtEr1.js} +1 -1
  139. package/dist/assets/{login-page-SG4TPVDu.js → login-page-F6N_qd4T.js} +1 -1
  140. package/dist/assets/{logout-page-CBGk_cSN.js → logout-page-B0hW96ua.js} +1 -1
  141. package/dist/assets/{logs-layout-B4EPBuaC.js → logs-layout-3YyZqc3F.js} +1 -1
  142. package/dist/assets/media-preview-iDbnoYfk.js +1 -0
  143. package/dist/assets/memory-page-route-D94kYR-f.js +6 -0
  144. package/dist/assets/{memory-router-playground-page-ftfbkFhf.js → memory-router-playground-page-C2PQxytb.js} +1 -1
  145. package/dist/assets/{menu-CKZtG-s_.js → menu-D7gzADvH.js} +1 -1
  146. package/dist/assets/message-content-B6_GZQl9.js +1 -0
  147. package/dist/assets/message-files-panel-DeTBvyEy.js +1 -0
  148. package/dist/assets/messages-DseJQFO_.js +13 -0
  149. package/dist/assets/{metric-card-B-Tt9p-1.js → metric-card-BBatJnYJ.js} +1 -1
  150. package/dist/assets/mobile-sidebar-drawer-BaytB4Wh.js +1 -0
  151. package/dist/assets/modal-D946-vqt.js +1 -0
  152. package/dist/assets/native-anchor-DrIjle7B.js +1 -0
  153. package/dist/assets/native-biometric-BFYdgeUL.js +6 -0
  154. package/dist/assets/native-file-DRRlH1rv.js +2 -0
  155. package/dist/assets/{navigation-resolver-Lxhf-tbn.js → navigation-resolver-C6RwDq2H.js} +1 -1
  156. package/dist/assets/{not-found-p1VhZpMs.js → not-found-BJyEE9E7.js} +1 -1
  157. package/dist/assets/notice-Dslxs3H6.js +1 -0
  158. package/dist/assets/notifications-BBZLLHJ7.js +1 -0
  159. package/dist/assets/notifications-page-DQinn00V.js +1 -0
  160. package/dist/assets/{oauth-complete-page-KSpFlPD6.js → oauth-complete-page-Bm0a6IN8.js} +1 -1
  161. package/dist/assets/{oauth-connection-utils-D9CTptlA.js → oauth-connection-utils-BMitT9wL.js} +1 -1
  162. package/dist/assets/{oauth-popup-complete-page-C5cG_z3A.js → oauth-popup-complete-page-BNsjClnY.js} +1 -1
  163. package/dist/assets/{onboarding-layout-K7X9fV8B.js → onboarding-layout--37tB9YP.js} +1 -1
  164. package/dist/assets/onboarding-store-DnWbQiNA.js +1 -0
  165. package/dist/assets/open-workspace-file-BltzxPLh.js +2 -0
  166. package/dist/assets/{page-empty-state-B0da-Sm9.js → page-empty-state-ClhYSor9.js} +1 -1
  167. package/dist/assets/{page-shell-CN7ioeP_.js → page-shell-VITTYgLM.js} +1 -1
  168. package/dist/assets/pairing-page-CvD5zLsA.js +1 -0
  169. package/dist/assets/paperclip--f908Kg3.js +1 -0
  170. package/dist/assets/{password-reset-page-Bq3ehgjW.js → password-reset-page-BqC9qvJS.js} +1 -1
  171. package/dist/assets/pdf-file-preview-iKAI2_qQ.js +1 -0
  172. package/dist/assets/pdf-preview-DXBz91H7.js +2 -0
  173. package/dist/assets/{personality-page-DeZSBQ6W.js → personality-page-CUROlUST.js} +1 -1
  174. package/dist/assets/plans-page-DUYS0cbu.js +1 -0
  175. package/dist/assets/platform-detection-BXhmJnUZ.js +1 -0
  176. package/dist/assets/{platform-login-notice-D-yQLWUo.js → platform-login-notice-CMolXtmN.js} +1 -1
  177. package/dist/assets/{platform-loopback-page-DESnWJYO.js → platform-loopback-page-CmT91jzA.js} +1 -1
  178. package/dist/assets/{plugin-detail-page-DF9vmm23.js → plugin-detail-page-Cv-FGOia.js} +1 -1
  179. package/dist/assets/{plugins-page-BDZiCqWZ.js → plugins-page-DLqHWJtw.js} +1 -1
  180. package/dist/assets/plugins-surface-Cokf1YuT.js +1 -0
  181. package/dist/assets/popover-2EzQYOOf.js +1 -0
  182. package/dist/assets/{prefs-B6fvTCOn.js → prefs-DNKmoZMg.js} +1 -1
  183. package/dist/assets/preview-error-BDY8vKyA.js +1 -0
  184. package/dist/assets/preview-skeleton-DHkMnUP7.js +1 -0
  185. package/dist/assets/privacy-page-ob9lLxyy.js +1 -0
  186. package/dist/assets/{privacy-screen-D2EBZTX8.js → privacy-screen-OGHbIDa3.js} +1 -1
  187. package/dist/assets/{provider-callback-page-BZlfsT4J.js → provider-callback-page-CvY7wldu.js} +1 -1
  188. package/dist/assets/provider-key-CH3fSqvf.js +1 -0
  189. package/dist/assets/{provider-signup-page-D5mOXHww.js → provider-signup-page-B5LtbL5y.js} +1 -1
  190. package/dist/assets/{provisioning-targets-CT4slXZJ.js → provisioning-targets-BK0r8PFS.js} +1 -1
  191. package/dist/assets/push-registration-Sip6OSUC.js +2 -0
  192. package/dist/assets/{quick-input-page-COgnUnT_.js → quick-input-page-BaI_khk9.js} +1 -1
  193. package/dist/assets/radio-card-nav-CvOV_GmV.js +1 -0
  194. package/dist/assets/react-query.gen-CVlTRWus.js +1 -0
  195. package/dist/assets/react-query.gen-Y3EA71xS.js +1 -0
  196. package/dist/assets/remote-gateway-session-BwqxJZBJ.js +1 -0
  197. package/dist/assets/{research-facts-BcW4fghT.js → research-facts-BLXh3yRG.js} +1 -1
  198. package/dist/assets/{research-mock-page-BFm8-rLU.js → research-mock-page-C6Tv3kJd.js} +1 -1
  199. package/dist/assets/{research-onboarding-persistence-BN6g1lF7.js → research-onboarding-persistence-DRkA_L0x.js} +1 -1
  200. package/dist/assets/research-onboarding-route-DiM1EmlB.js +50 -0
  201. package/dist/assets/{research-results-view-BBf2iyCA.js → research-results-view-1qrQ00-t.js} +1 -1
  202. package/dist/assets/resolved-assistants-store-O7lFWIXI.js +1 -0
  203. package/dist/assets/{retire-confirm-dialog-m6ORm5Pq.js → retire-confirm-dialog-Dvnyjmcs.js} +1 -1
  204. package/dist/assets/{review-terms-screen-zzdu4AQi.js → review-terms-screen-BwYhdJD2.js} +1 -1
  205. package/dist/assets/{routes-GmNvdtLW.js → routes-CAe1h0Db.js} +1 -1
  206. package/dist/assets/routes-CTQZmUb6.js +23 -0
  207. package/dist/assets/runtime-upgrade-banner-D7nbieEW.js +2 -0
  208. package/dist/assets/{sandbox-bridge-CjHMJYTZ.js → sandbox-bridge-TDSWydru.js} +84 -2
  209. package/dist/assets/{schedules-B6KivAAT.js → schedules-DgU4kSjP.js} +1 -1
  210. package/dist/assets/schedules-page-CDnzNb2Y.js +1 -0
  211. package/dist/assets/{sdk.gen-BySz4QYj.js → sdk.gen-D7tvT1tz.js} +1 -1
  212. package/dist/assets/sdk.gen-DKp2Mbw9.js +1 -0
  213. package/dist/assets/{security-redirect-page-T1J6IoOb.js → security-redirect-page-D_7wOCtX.js} +1 -1
  214. package/dist/assets/select-assistant-screen-9T4BRd_t.js +1 -0
  215. package/dist/assets/semver-BpijV4FQ.js +1 -0
  216. package/dist/assets/{setting-row-DEyL7IUP.js → setting-row-tSQMbI46.js} +1 -1
  217. package/dist/assets/{settings-divider-Bf5WJ9ve.js → settings-divider-CeQNHK0m.js} +1 -1
  218. package/dist/assets/settings-layout-Du5Oap1d.js +1 -0
  219. package/dist/assets/settings-navigation-C1HwOIUt.js +1 -0
  220. package/dist/assets/share-feedback-modal-CnRDFGbB.js +2 -0
  221. package/dist/assets/{sidebar-tree-D6fHs4GK.js → sidebar-tree-CQFcWGT1.js} +1 -1
  222. package/dist/assets/{signup-page-DqfStkXZ.js → signup-page-bcvMAmof.js} +1 -1
  223. package/dist/assets/{signup-shell-CMXUBUal.js → signup-shell-ERxEk0WZ.js} +1 -1
  224. package/dist/assets/site-favicon-CqThQ_7z.js +1 -0
  225. package/dist/assets/{skill-detail-page-SvM2JKKY.js → skill-detail-page-D8PfNLuP.js} +1 -1
  226. package/dist/assets/{skill-detail-panel-Cpl1Z7V3.js → skill-detail-panel-CUbOWneV.js} +1 -1
  227. package/dist/assets/{skills-BL4RgwAd.js → skills-DKKY5OMN.js} +1 -1
  228. package/dist/assets/{skills-page-BYtAFZzb.js → skills-page-Bm3zL5Bu.js} +1 -1
  229. package/dist/assets/{slack-setup-wizard-dVkbEE6P.js → slack-setup-wizard-CnVC4l5B.js} +1 -1
  230. package/dist/assets/{sound-manager-DUo0lHGZ.js → sound-manager-C_1KnCOC.js} +1 -1
  231. package/dist/assets/{sounds-page-CfeiEoJP.js → sounds-page-CGUckr1i.js} +1 -1
  232. package/dist/assets/src-ly8ixpHd.js +293 -0
  233. package/dist/assets/{start-screen-CqbeEmEE.js → start-screen-CPmsm-kW.js} +1 -1
  234. package/dist/assets/subagent-detail-panel-Cko5R1_J.js +4 -0
  235. package/dist/assets/{subagent-store-DyKwOIj_.js → subagent-store-aUi9z1GE.js} +2 -2
  236. package/dist/assets/superpowers-page-ZtpKl4Lq.js +1 -0
  237. package/dist/assets/{system-events-page-Cg0uMSMs.js → system-events-page-Cy608Ykp.js} +1 -1
  238. package/dist/assets/{system-events-redirect-page-C44suO-c.js → system-events-redirect-page-BgYhdD3K.js} +1 -1
  239. package/dist/assets/{tag-D8NAGb0r.js → tag-Bz-I4QwU.js} +1 -1
  240. package/dist/assets/text-preview-DisMX4cO.js +1 -0
  241. package/dist/assets/{theme-preferences-LQuLaIA6.js → theme-preferences-Brs5RzlL.js} +1 -1
  242. package/dist/assets/{theme-stage-page-CnKpq5QT.js → theme-stage-page-wgK0C8Xl.js} +1 -1
  243. package/dist/assets/{threshold-presets-B-gOdjC4.js → threshold-presets-xxr02Qfr.js} +1 -1
  244. package/dist/assets/{tiptap-document-editor-D-lwPWrV.js → tiptap-document-editor-CYZc1P55.js} +2 -2
  245. package/dist/assets/{toast-DR7D7Uma.js → toast-DJj-rM9J.js} +1 -1
  246. package/dist/assets/tool-detail-panel-Bkj5ZAeI.js +2 -0
  247. package/dist/assets/transcript-message-body-shared-BFfgWZy2.js +1 -0
  248. package/dist/assets/{trust-rules-api-iUGCiDDM.js → trust-rules-api-DJrse6lT.js} +1 -1
  249. package/dist/assets/typed-storage-C92iOTRi.js +1 -0
  250. package/dist/assets/{upgrade-cancel-page-D8is9-gw.js → upgrade-cancel-page-BeY5T4kB.js} +1 -1
  251. package/dist/assets/{upgrade-success-page-3W1VuHqB.js → upgrade-success-page--joUbj6k.js} +1 -1
  252. package/dist/assets/{usage-redirect-page-C6qXe-4h.js → usage-redirect-page-BJBZlMum.js} +1 -1
  253. package/dist/assets/{use-active-assistant-id-CjvzlL4t.js → use-active-assistant-id-Bpz6E0Zc.js} +1 -1
  254. package/dist/assets/{use-app-theme-BLGjiz96.js → use-app-theme-FEeKltJv.js} +1 -1
  255. package/dist/assets/{use-assistant-avatar--4s_vvar.js → use-assistant-avatar-DMG3FqL-.js} +1 -1
  256. package/dist/assets/{use-assistant-capability-BaZVGuCu.js → use-assistant-capability-B8hrKD40.js} +1 -1
  257. package/dist/assets/use-assistant-identity-details-CeLOmSn3.js +1 -0
  258. package/dist/assets/use-attachment-preview-CZ1ukJ84.js +2 -0
  259. package/dist/assets/use-attachment-squares-DlMC872S.js +1 -0
  260. package/dist/assets/{use-avatar-accent-var-BaftJG7F.js → use-avatar-accent-var-BKR4YRg2.js} +1 -1
  261. package/dist/assets/{use-bookmarks-B6Y60m9F.js → use-bookmarks-CdFuT6Xg.js} +1 -1
  262. package/dist/assets/{use-bundled-avatar-components-IQw2k8-g.js → use-bundled-avatar-components-Dghk3JuB.js} +2 -2
  263. package/dist/assets/{use-bus-subscription-CyRPH_gr.js → use-bus-subscription-tfEbZIgy.js} +1 -1
  264. package/dist/assets/use-checkout-dismiss-refresh-DNcYC868.js +1 -0
  265. package/dist/assets/use-command-palette-sections-BCeqKPyX.js +1 -0
  266. package/dist/assets/{use-discord-nudge-CRU-lEHV.js → use-discord-nudge-CmlzC8SL.js} +1 -1
  267. package/dist/assets/{use-edge-swipe-Gst62FjL.js → use-edge-swipe-CwUOiFEN.js} +1 -1
  268. package/dist/assets/{use-edge-swipe-back-D12vbvly.js → use-edge-swipe-back-DwIF21EZ.js} +1 -1
  269. package/dist/assets/use-edit-app-BA6KXCBI.js +1 -0
  270. package/dist/assets/{use-effective-timezone-Bx9QaO25.js → use-effective-timezone-JzQxWxW2.js} +1 -1
  271. package/dist/assets/use-invite-link-dialog-BB8L3PzM.js +1 -0
  272. package/dist/assets/{use-ios-app-nudge-CrBEIZ8w.js → use-ios-app-nudge-DDQgAxyu.js} +1 -1
  273. package/dist/assets/use-is-org-ready-BsyTIiNf.js +1 -0
  274. package/dist/assets/use-local-file-info-CtbuzUis.js +1 -0
  275. package/dist/assets/{use-onboarding-login-X8pB53cV.js → use-onboarding-login-CJRp506m.js} +1 -1
  276. package/dist/assets/{use-platform-assistant-id-CIoqMsyh.js → use-platform-assistant-id-DN1IV-Ay.js} +1 -1
  277. package/dist/assets/{use-platform-gate-CqEOGZtI.js → use-platform-gate-lLb0F3yZ.js} +1 -1
  278. package/dist/assets/{use-reduced-motion-bjjt6x6d.js → use-reduced-motion-B48ljNsY.js} +1 -1
  279. package/dist/assets/{use-return-to-short-circuit-B295pgoV.js → use-return-to-short-circuit-DDqqgAes.js} +1 -1
  280. package/dist/assets/{use-save-twilio-credentials-CCp1iqBf.js → use-save-twilio-credentials-Bt8-VmNu.js} +1 -1
  281. package/dist/assets/{use-skill-actions-BLHTDn21.js → use-skill-actions-dO7SAuVJ.js} +1 -1
  282. package/dist/assets/{use-skill-detail-files-BVBb8uoK.js → use-skill-detail-files-_k3UzMmc.js} +1 -1
  283. package/dist/assets/use-sticky-profiles-C9kTgzMU.js +1 -0
  284. package/dist/assets/use-subagent-card-data-DnRhUNpn.js +1 -0
  285. package/dist/assets/{use-supports-bookmarks-DbG5HZ6P.js → use-supports-bookmarks-DV69KwnD.js} +1 -1
  286. package/dist/assets/use-supports-credentials-settings-CsSF8bXr.js +1 -0
  287. package/dist/assets/{use-swipe-engine-RAFE-Hrf.js → use-swipe-engine-D7g_j1e7.js} +1 -1
  288. package/dist/assets/use-transcript-message-by-id-BsMDrCkA.js +1 -0
  289. package/dist/assets/use-transcript-messages-oi26Ktnj.js +3 -0
  290. package/dist/assets/use-voice-sample-preview-Du5pNP6H.js +1 -0
  291. package/dist/assets/utils-CGftFn10.js +1 -0
  292. package/dist/assets/utils-D_YMyAVe.js +1 -0
  293. package/dist/assets/viewer-store-TG2_cF5e.js +1 -0
  294. package/dist/assets/voice-list-DkZ8sHUi.js +1 -0
  295. package/dist/assets/{voice-page-Bvgm-7L8.js → voice-page-CrASdsw3.js} +1 -1
  296. package/dist/assets/{voice-providers-note-g4IBSHFm.js → voice-providers-note-kpd6DEbi.js} +1 -1
  297. package/dist/assets/{weather-forecast-display-Bg_OjY6Q.js → weather-forecast-display-Dlxorv_U.js} +1 -1
  298. package/dist/assets/{web-C8NouSk8.js → web-BPjOkFge.js} +1 -1
  299. package/dist/assets/{web-RKFLO25W.js → web-BipFeLqE.js} +1 -1
  300. package/dist/assets/{web-XmQWRS1M.js → web-BlW9rsRn.js} +1 -1
  301. package/dist/assets/{web-Cv3bLSQ5.js → web-CaR0HElx.js} +1 -1
  302. package/dist/assets/{web-D82T2zyn.js → web-Co70Kw5W.js} +1 -1
  303. package/dist/assets/{web-s9eE6ZyC.js → web-CrlKvQfY.js} +1 -1
  304. package/dist/assets/{web-BEtLqoWJ.js → web-DDTE8DdB.js} +1 -1
  305. package/dist/assets/{web-ZsA8B5nq.js → web-DoTDNQCP.js} +1 -1
  306. package/dist/assets/welcome-screen-atrG4Qhw.js +1 -0
  307. package/dist/assets/{workflow-detail-panel-BNzNSNAT.js → workflow-detail-panel-BnbE0AWp.js} +1 -1
  308. package/dist/assets/{workflow-store-Cbd3x6KN.js → workflow-store-ClxNt3tJ.js} +1 -1
  309. package/dist/assets/workspace-page-D-yLftlB.js +1 -0
  310. package/dist/assets/workspace-path-links-DIex4SOO.js +1 -0
  311. package/dist/assets/workspace-tree-query-D58SWaA3.js +1 -0
  312. package/dist/index.html +283 -272
  313. package/package.json +1 -1
  314. package/dist/assets/access-BJiXpwUJ.js +0 -1
  315. package/dist/assets/acp-run-detail-panel-C_M19m8P.js +0 -5
  316. package/dist/assets/activity-steps-panel-BsmwWzP1.js +0 -1
  317. package/dist/assets/add-credits-modal-3Rsd1ZeS.js +0 -1
  318. package/dist/assets/ai-page-B9mJkV_p.js +0 -1
  319. package/dist/assets/api-C8TlQNEU.js +0 -1
  320. package/dist/assets/api-DDKNgE8n.js +0 -1
  321. package/dist/assets/assistant-identity-store-BczULg2T.js +0 -1
  322. package/dist/assets/auth-store-BwKMFgpK.js +0 -2
  323. package/dist/assets/background-task-actions-DX0pUvY9.js +0 -1
  324. package/dist/assets/billing-page-CED96NEp.js +0 -3
  325. package/dist/assets/build-state-DPMhQpLB.js +0 -1
  326. package/dist/assets/channels-page-route-BooWFQMp.js +0 -9
  327. package/dist/assets/chat-markdown-message-f4cLJfax.js +0 -2
  328. package/dist/assets/checkbox-BZTUJtxM.js +0 -1
  329. package/dist/assets/checkout-continuation-CcuqWhhp.js +0 -1
  330. package/dist/assets/checkout-page-BateK-Nf.js +0 -1
  331. package/dist/assets/checkout-return-target-Cib3fzdY.js +0 -1
  332. package/dist/assets/command-palette-B3TVIQUH.js +0 -1
  333. package/dist/assets/command-palette-window-page-Bp9WplfA.js +0 -1
  334. package/dist/assets/consent-s5g0Gmb2.js +0 -1
  335. package/dist/assets/contacts-page-route--hTzWT8X.js +0 -1
  336. package/dist/assets/conversation-navigation-D63NJmBl.js +0 -1
  337. package/dist/assets/credentials-page-CYBmOQhl.js +0 -1
  338. package/dist/assets/debug-page-CHuby9yt.js +0 -4
  339. package/dist/assets/detail-panel-stop-button-DgKaA6yz.js +0 -1
  340. package/dist/assets/developer-page-CUJqTs2_.js +0 -1
  341. package/dist/assets/dices-DcuIF52A.js +0 -1
  342. package/dist/assets/dist-BKxs5XmY.js +0 -1
  343. package/dist/assets/dist-BswnB-bR.js +0 -1
  344. package/dist/assets/doctor-handoff-store-DWNbuW3P.js +0 -1
  345. package/dist/assets/document-viewer-container-Doc7G7NK.js +0 -2
  346. package/dist/assets/document-viewer-page-_jndOS7P.js +0 -1
  347. package/dist/assets/effective-timezone-CnKC3vj0.js +0 -1
  348. package/dist/assets/esm-B2M2kM_8.js +0 -2
  349. package/dist/assets/esm-BgRAHqeR.js +0 -2
  350. package/dist/assets/esm-CXX8rcv3.js +0 -2
  351. package/dist/assets/esm-Chh8mHmh.js +0 -1
  352. package/dist/assets/esm-Cl2UNC_o.js +0 -2
  353. package/dist/assets/esm-DOATKqE3.js +0 -2
  354. package/dist/assets/feature-flag-catalog-CWHnoWvT.js +0 -1
  355. package/dist/assets/file-editor-DcH2Os5o.js +0 -1
  356. package/dist/assets/file-markdown-DBLxtb0M.js +0 -2
  357. package/dist/assets/first-run-scope-7wWjJ4Tn.js +0 -1
  358. package/dist/assets/general-page-DoAKoumC.js +0 -1
  359. package/dist/assets/handle-logout-BTgnSSUm.js +0 -1
  360. package/dist/assets/hatching-screen-Q59qvj8_.js +0 -1
  361. package/dist/assets/home-page-route-TPR5p3LW.js +0 -1
  362. package/dist/assets/hosting-screen-DRrmkmoO.js +0 -1
  363. package/dist/assets/identity-Cb4xS1Kk.js +0 -1
  364. package/dist/assets/identity-page-route-CvxG-nhn.js +0 -7
  365. package/dist/assets/index-Ch9eoFem.js +0 -11
  366. package/dist/assets/index-D8Xiv4z3.css +0 -2
  367. package/dist/assets/integrations-page-CnjTLjpf.js +0 -1
  368. package/dist/assets/latest-assistant-text-DPm0HIWu.js +0 -24
  369. package/dist/assets/library-page-CuNX2WgS.js +0 -1
  370. package/dist/assets/list-row-BYrmPIC4.js +0 -1
  371. package/dist/assets/local-mode-9zpgPNoq.js +0 -39
  372. package/dist/assets/local-runtime-upgrade-JwVgn034.js +0 -1
  373. package/dist/assets/local-settings-C-dW2vkq.js +0 -1
  374. package/dist/assets/memory-page-route-C8nIc6Mb.js +0 -6
  375. package/dist/assets/messages-BzNSqJQx.js +0 -13
  376. package/dist/assets/mobile-sidebar-drawer-BnxfQaDB.js +0 -1
  377. package/dist/assets/modal-DwsThLGg.js +0 -1
  378. package/dist/assets/mutation-error-CXV1BKlB.js +0 -1
  379. package/dist/assets/native-anchor-BiuEQHcy.js +0 -1
  380. package/dist/assets/native-biometric-B96mgKGP.js +0 -6
  381. package/dist/assets/native-file-BvwfoU6A.js +0 -2
  382. package/dist/assets/notice-DCp7WO3L.js +0 -1
  383. package/dist/assets/notifications-page-BAYd0t-0.js +0 -1
  384. package/dist/assets/onboarding-store-OVV4wyh5.js +0 -1
  385. package/dist/assets/open-workspace-file-DucrTmt3.js +0 -2
  386. package/dist/assets/pairing-page-BRPUYbzJ.js +0 -1
  387. package/dist/assets/panel-item-DGs4s9r-.js +0 -1
  388. package/dist/assets/plans-page-BxebYucs.js +0 -1
  389. package/dist/assets/platform-detection-a_IB3-0w.js +0 -1
  390. package/dist/assets/plugins-surface-C4peMNec.js +0 -1
  391. package/dist/assets/popover-BFL-uOLh.js +0 -1
  392. package/dist/assets/privacy-page-sZhcJ3uB.js +0 -1
  393. package/dist/assets/provider-key-w3CzmGtq.js +0 -1
  394. package/dist/assets/react-query.gen-0mspArBl.js +0 -1
  395. package/dist/assets/react-query.gen-BVTEjHsw.js +0 -1
  396. package/dist/assets/remote-gateway-session-CgxYHgOD.js +0 -1
  397. package/dist/assets/research-onboarding-route-ZOwRvfGs.js +0 -50
  398. package/dist/assets/resolved-assistants-store-8HQDfxZh.js +0 -1
  399. package/dist/assets/risk-uPLh5W5z.js +0 -3
  400. package/dist/assets/routes-BP00Ewbf.js +0 -23
  401. package/dist/assets/runtime-upgrade-banner-yZYtWxoJ.js +0 -2
  402. package/dist/assets/schedules-page-BQSGUmn5.js +0 -1
  403. package/dist/assets/sdk.gen-DVW3wpbx.js +0 -1
  404. package/dist/assets/select-assistant-screen-B5N_TUcG.js +0 -1
  405. package/dist/assets/session-corner-action-vhb51vd3.js +0 -1
  406. package/dist/assets/settings-layout-BtT0532M.js +0 -1
  407. package/dist/assets/settings-navigation-BDpUXrOI.js +0 -1
  408. package/dist/assets/share-feedback-modal-DO6_oaZg.js +0 -2
  409. package/dist/assets/site-favicon-Dh1OTgFr.js +0 -1
  410. package/dist/assets/src-BAS7a2RG.js +0 -293
  411. package/dist/assets/subagent-detail-panel-jp0r0ZFk.js +0 -4
  412. package/dist/assets/superpowers-page-DltosgGe.js +0 -1
  413. package/dist/assets/tool-detail-panel-CXcjfDGo.js +0 -2
  414. package/dist/assets/transcript-message-body-shared-woOFNF_q.js +0 -1
  415. package/dist/assets/typed-storage-C-R1po3l.js +0 -1
  416. package/dist/assets/use-assistant-identity-details-C99kNyQf.js +0 -1
  417. package/dist/assets/use-checkout-dismiss-refresh-BkIzNk6B.js +0 -1
  418. package/dist/assets/use-command-palette-sections-CAmbyguu.js +0 -1
  419. package/dist/assets/use-edit-app-BF9YK7AV.js +0 -1
  420. package/dist/assets/use-invite-link-dialog-DN2IHVZE.js +0 -1
  421. package/dist/assets/use-is-org-ready-zouQ5CN4.js +0 -1
  422. package/dist/assets/use-sticky-profiles-bdq2XW7H.js +0 -1
  423. package/dist/assets/use-subagent-card-data-B8JTa5rQ.js +0 -1
  424. package/dist/assets/use-supports-credentials-settings-CgWfA2eQ.js +0 -1
  425. package/dist/assets/utils-C-YNXdkX.js +0 -1
  426. package/dist/assets/utils-Ction0uF.js +0 -1
  427. package/dist/assets/viewer-store--hIQLNm5.js +0 -1
  428. package/dist/assets/voice-list-CCLkiF-c.js +0 -1
  429. package/dist/assets/welcome-screen-Cga6YuF9.js +0 -1
  430. package/dist/assets/workspace-page-BFJO59Ch.js +0 -1
  431. package/dist/assets/workspace-tree-query-CqcOBNKw.js +0 -1
  432. /package/dist/assets/{api-errors-SZKDzMLE.js → api-errors-CFiCT7Ap.js} +0 -0
  433. /package/dist/assets/{app-types-o5Qc-xkK.js → app-types-BDwXtDh_.js} +0 -0
  434. /package/dist/assets/{apple-logo-Cg-KnqW2.js → apple-logo-BIwlIlpk.js} +0 -0
  435. /package/dist/assets/{arrow-down-to-line-Bh_5sIPp.js → arrow-down-to-line-DMGjBlMw.js} +0 -0
  436. /package/dist/assets/{arrow-left-C2ylPLHq.js → arrow-left-W84B6oJL.js} +0 -0
  437. /package/dist/assets/{arrow-right-B-jRJNWP.js → arrow-right-ChqGeAaW.js} +0 -0
  438. /package/dist/assets/{arrow-up-BNd4Gpy7.js → arrow-up-CWzHzcyU.js} +0 -0
  439. /package/dist/assets/{avatar-bundled-components-CTd294ra.js → avatar-bundled-components-iI95J-ZL.js} +0 -0
  440. /package/dist/assets/{avatar-subagent-BpXST4nO.js → avatar-subagent-pOueFfxU.js} +0 -0
  441. /package/dist/assets/{avatar-svg-compositor-DclcUb1M.js → avatar-svg-compositor-BOYGuaxM.js} +0 -0
  442. /package/dist/assets/{avatar-tone-4L7foPzW.js → avatar-tone-BOo-ADtK.js} +0 -0
  443. /package/dist/assets/{ban-B__z3LwE.js → ban-BKp90l-0.js} +0 -0
  444. /package/dist/assets/{bell-Ct4a9v6Y.js → bell-2SnK9BVD.js} +0 -0
  445. /package/dist/assets/{brain-BIzJCPA6.js → brain-CN4zzNgU.js} +0 -0
  446. /package/dist/assets/{browser-timezone-DGz-HvxU.js → browser-timezone-9IQHD9Rp.js} +0 -0
  447. /package/dist/assets/{bug-VUcJFHwN.js → bug-DdmWJIkz.js} +0 -0
  448. /package/dist/assets/{build.umd-oXvZOmIf.js → build.umd-zd6Te11f.js} +0 -0
  449. /package/dist/assets/{by-tool-use-id-index-DcsiqOhc.js → by-tool-use-id-index-CwsBkYMU.js} +0 -0
  450. /package/dist/assets/{calendar-RYdAv74D.js → calendar-qrPKlf1H.js} +0 -0
  451. /package/dist/assets/{chart-column-BLKW3sjY.js → chart-column-k8S2UYq8.js} +0 -0
  452. /package/dist/assets/{chat-BIJEFb5u.js → chat-QHEStx4m.js} +0 -0
  453. /package/dist/assets/{check-sC49_hjU.js → check-Dt2rQhdg.js} +0 -0
  454. /package/dist/assets/{chevron-down-B5A-0g8A.js → chevron-down-BNidRDh1.js} +0 -0
  455. /package/dist/assets/{chevron-left-CytMddTB.js → chevron-left-CrxnPze-.js} +0 -0
  456. /package/dist/assets/{chevron-right-HU6H84S0.js → chevron-right-CANAtgGn.js} +0 -0
  457. /package/dist/assets/{chevron-up-2Qqarz0p.js → chevron-up-DofScvyy.js} +0 -0
  458. /package/dist/assets/{circle-alert-DVCpoZrc.js → circle-alert-DQMH8VJH.js} +0 -0
  459. /package/dist/assets/{circle-check-CjGnAahM.js → circle-check-DvrCdroD.js} +0 -0
  460. /package/dist/assets/{circle-check-big-DSsDH5_6.js → circle-check-big-DtV6IJuh.js} +0 -0
  461. /package/dist/assets/{circle-minus-DNfBAj4g.js → circle-minus-BBDKV6k6.js} +0 -0
  462. /package/dist/assets/{circle-x-17dBxF06.js → circle-x-DTjJzoQl.js} +0 -0
  463. /package/dist/assets/{client.gen-DHOmbzD9.js → client.gen-CV05d-kw.js} +0 -0
  464. /package/dist/assets/{clipboard-copy-JwIceweN.js → clipboard-copy-BYpgEh2O.js} +0 -0
  465. /package/dist/assets/{clock-BYTc0Ds9.js → clock-DeynsyYL.js} +0 -0
  466. /package/dist/assets/{cloud-off-BCBGTmt0.js → cloud-off-BFACQbO0.js} +0 -0
  467. /package/dist/assets/{cloud-RlApB3rO.js → cloud-q4J30bVb.js} +0 -0
  468. /package/dist/assets/{code-qafFA0_-.js → code-D6SOwRrI.js} +0 -0
  469. /package/dist/assets/{coins-Hrmb9tmj.js → coins-CcTuNVlN.js} +0 -0
  470. /package/dist/assets/{conversation-selection-B954w311.js → conversation-selection-hK0_sm_S.js} +0 -0
  471. /package/dist/assets/{create-selectors-B-P03-8K.js → create-selectors-CEbfsat6.js} +0 -0
  472. /package/dist/assets/{definitions-CL6e7nYF.js → definitions-D0FqUzOF.js} +0 -0
  473. /package/dist/assets/{definitions-BD-g60mP.js → definitions-IbMsXMGo.js} +0 -0
  474. /package/dist/assets/{dist-CFSiz2ry2.js → dist-GTkaLo4c2.js} +0 -0
  475. /package/dist/assets/{download-CywcQLB2.js → download-Cnb8zZrK.js} +0 -0
  476. /package/dist/assets/{edit-chat-session-Beky6Vpg.js → edit-chat-session-DJ2tzvAz.js} +0 -0
  477. /package/dist/assets/{ellipsis-BRJI5_P1.js → ellipsis-C5fQnusC.js} +0 -0
  478. /package/dist/assets/{ellipsis-vertical-nov0xhhF.js → ellipsis-vertical-qQRDY5dB.js} +0 -0
  479. /package/dist/assets/{emoji-catalog-data-5pJaL_3N.js → emoji-catalog-data-DrSbOeEu.js} +0 -0
  480. /package/dist/assets/{event-bus-CvZyJQ26.js → event-bus-DYZhc6yM.js} +0 -0
  481. /package/dist/assets/{external-link-CAce-RVu.js → external-link-GPGZ1LGU.js} +0 -0
  482. /package/dist/assets/{external-urls-97O9n0lb.js → external-urls-BL9qY0s8.js} +0 -0
  483. /package/dist/assets/{eye-DTyDWiqu.js → eye-B_jBDDRn.js} +0 -0
  484. /package/dist/assets/{eye-bbox-DE8r0Vt3.js → eye-bbox-fkuAvbnc.js} +0 -0
  485. /package/dist/assets/{eye-off-fuOP4Lij.js → eye-off-DQ4xakzN.js} +0 -0
  486. /package/dist/assets/{file-code-DD3K2kve.js → file-code-CrtJR2ax.js} +0 -0
  487. /package/dist/assets/{file-plus-Dq2xo7Ic.js → file-plus-DjC7wnGp.js} +0 -0
  488. /package/dist/assets/{file-text-BCsUYVEF.js → file-text-CwGsMgaa.js} +0 -0
  489. /package/dist/assets/{folder-g06qTW2O.js → folder-_l8GIyQp.js} +0 -0
  490. /package/dist/assets/{folder-open-CAb0DLYq.js → folder-open-BTlvhHNO.js} +0 -0
  491. /package/dist/assets/{format-date-CKGQir4m.js → format-date-CQUMvfqf.js} +0 -0
  492. /package/dist/assets/{format-file-size-Eu-Z0CxL.js → format-file-size-B5EMFtmw.js} +0 -0
  493. /package/dist/assets/{globe-BDvXuPkw.js → globe-CdLn4IX7.js} +0 -0
  494. /package/dist/assets/{hard-drive-CncrDZ7V.js → hard-drive-sI2ZzmqM.js} +0 -0
  495. /package/dist/assets/{hard-navigate-V2EFapkk.js → hard-navigate-Dou11GyV.js} +0 -0
  496. /package/dist/assets/{heart-2AHOP0tB.js → heart-DFD4eqW-.js} +0 -0
  497. /package/dist/assets/{inbox-DXYIwUrn.js → inbox-OC3STytq.js} +0 -0
  498. /package/dist/assets/{info-CYiVdnQV.js → info-DkhVkzmK.js} +0 -0
  499. /package/dist/assets/{is-electron-7N7iyz1y.js → is-electron-DLs5KNwr.js} +0 -0
  500. /package/dist/assets/{key-round-CSc3w5ka.js → key-round-BFkuiQGH.js} +0 -0
  501. /package/dist/assets/{laptop-ByoaxLxg.js → laptop-BGOychmC.js} +0 -0
  502. /package/dist/assets/{layout-grid-PPpVK0nJ.js → layout-grid-Ct4RT2Ea.js} +0 -0
  503. /package/dist/assets/{link-2-BMNZFfWH.js → link-2-DhyrrFaE.js} +0 -0
  504. /package/dist/assets/{link-CowyzCIZ.js → link-DOobzBVg.js} +0 -0
  505. /package/dist/assets/{link-click-BEiniqcG.js → link-click-CzL-O2k6.js} +0 -0
  506. /package/dist/assets/{list-CDyb1CGV.js → list-D2LnQ7lS.js} +0 -0
  507. /package/dist/assets/{loader-circle-BzJ2kz3F.js → loader-circle-DWWXcfTQ.js} +0 -0
  508. /package/dist/assets/{log-in-Bhye1kwc.js → log-in-D4nsqRbG.js} +0 -0
  509. /package/dist/assets/{log-out-BLE632qu.js → log-out-CF9mMMsz.js} +0 -0
  510. /package/dist/assets/{machine-sizes-D0oAlF9f.js → machine-sizes-CvnllWMa.js} +0 -0
  511. /package/dist/assets/{mail-DABv3_Ue.js → mail-DyUf40pu.js} +0 -0
  512. /package/dist/assets/{message-circle-gk_DFUIg.js → message-circle-ByXBaIaq.js} +0 -0
  513. /package/dist/assets/{message-square-zCNXaHYX.js → message-square-CHUvAEY9.js} +0 -0
  514. /package/dist/assets/{message-square-text-asdoy3SW.js → message-square-text-CN_v46So.js} +0 -0
  515. /package/dist/assets/{mic-DZrWtAAu.js → mic-BZZo0R22.js} +0 -0
  516. /package/dist/assets/{middleware-HE0NLvPl.js → middleware-Bxr-mmHu.js} +0 -0
  517. /package/dist/assets/{minimize-2-BR0ed4mI.js → minimize-2-Dj9FY4aF.js} +0 -0
  518. /package/dist/assets/{misc-CAQM4FGM.js → misc-DBwubycL.js} +0 -0
  519. /package/dist/assets/{monitor-B5vtTCxm.js → monitor-RX4oi4Nj.js} +0 -0
  520. /package/dist/assets/{moon-DSdti3GO.js → moon-CHW45huN.js} +0 -0
  521. /package/dist/assets/{native-deep-link-BJjxOpZm.js → native-deep-link-Cncq0GD6.js} +0 -0
  522. /package/dist/assets/{oauth-popup-Ql5xgtlO.js → oauth-popup-B6j6bx_5.js} +0 -0
  523. /package/dist/assets/{onboarding-step-layout-DGtbhZJb.js → onboarding-step-layout-C3Maoz0G.js} +0 -0
  524. /package/dist/assets/{optimistic-lifecycle-50vNA6dY.js → optimistic-lifecycle-KJTTe47z.js} +0 -0
  525. /package/dist/assets/{pdf-8fO1Wz7e.js → pdf-CwMfK7hM.js} +0 -0
  526. /package/dist/assets/{pencil-CLJIvYKH.js → pencil-Cm5DdeRM.js} +0 -0
  527. /package/dist/assets/{play-CCT817Ah.js → play-Dh6Bw5AP.js} +0 -0
  528. /package/dist/assets/{plugin-attribution-Hjqz10My.js → plugin-attribution-B0uhwtEJ.js} +0 -0
  529. /package/dist/assets/{plus-JG7kWjHA.js → plus-EJu6s6xR.js} +0 -0
  530. /package/dist/assets/{pointer-QlIwQKYH.js → pointer-DY1bgd8h.js} +0 -0
  531. /package/dist/assets/{prechat-EVefdGcO.js → prechat-Bn3NCSMT.js} +0 -0
  532. /package/dist/assets/{profile-metadata-BksFtHNq.js → profile-metadata-DuAgiz1O.js} +0 -0
  533. /package/dist/assets/{progress-bar-CJxkStgF.js → progress-bar-3GUUAhXi.js} +0 -0
  534. /package/dist/assets/{proxy-CNtrhN4q.js → proxy-CZ68u73m.js} +0 -0
  535. /package/dist/assets/{public-asset-CD3ouSWU.js → public-asset-CKQ1B7-c.js} +0 -0
  536. /package/dist/assets/{puzzle-CtM3jM-f.js → puzzle-4NgH5snP.js} +0 -0
  537. /package/dist/assets/{refresh-cw-Ci7hSykC.js → refresh-cw-EZQqnaxp.js} +0 -0
  538. /package/dist/assets/{repeat-CIQpv9Nd.js → repeat-CP_vsQPN.js} +0 -0
  539. /package/dist/assets/{rotate-ccw-Da_2DvhY.js → rotate-ccw-CL6IkaAI.js} +0 -0
  540. /package/dist/assets/{sdk.gen-DEFA-6EJ.js → sdk.gen-CmYY52M6.js} +0 -0
  541. /package/dist/assets/{search-DA3TmTuR.js → search-DL-2uX3K.js} +0 -0
  542. /package/dist/assets/{send-DHWUIK7G.js → send-Bdmy_GSE.js} +0 -0
  543. /package/dist/assets/{settings-DyEBEqeQ.js → settings-6_RIT4kT.js} +0 -0
  544. /package/dist/assets/{shield-9aFTFyT9.js → shield-CAWgGAqm.js} +0 -0
  545. /package/dist/assets/{shield-check-z7CU-gBq.js → shield-check-CNsbiH1v.js} +0 -0
  546. /package/dist/assets/{sliders-horizontal-slneqAyY.js → sliders-horizontal-BwdOIxz8.js} +0 -0
  547. /package/dist/assets/{smartphone-BbK6bGuE.js → smartphone-CIrxb2NM.js} +0 -0
  548. /package/dist/assets/{sparkles-DC8kqYjt.js → sparkles-DfEFn3Bh.js} +0 -0
  549. /package/dist/assets/{square-Bn3X6ZlO.js → square-DTFrgbZb.js} +0 -0
  550. /package/dist/assets/{status-badge-pill-ZNNoKV1T.js → status-badge-pill-B_SDkd4E.js} +0 -0
  551. /package/dist/assets/{sun-BKEPYS7Q.js → sun-BauGiwdK.js} +0 -0
  552. /package/dist/assets/{surface-parse-helpers-CEJ3tQ9Q.js → surface-parse-helpers-iPHZ9D7N.js} +0 -0
  553. /package/dist/assets/{target-cdw7WP5q.js → target-CJU4DUFo.js} +0 -0
  554. /package/dist/assets/{terminal-Cs_TREv-.js → terminal-BucMVaPU.js} +0 -0
  555. /package/dist/assets/{three-dot-indicator-CfjkCgEH.js → three-dot-indicator-BRr0F0MO.js} +0 -0
  556. /package/dist/assets/{toggle-D776PTw-.js → toggle-BEPV0rQM.js} +0 -0
  557. /package/dist/assets/{trash-2-De6X8YiM.js → trash-2-DfVRfykB.js} +0 -0
  558. /package/dist/assets/{triangle-alert--e3n47gm.js → triangle-alert-D6bAGtMw.js} +0 -0
  559. /package/dist/assets/{upload-Bdbyo_ok.js → upload-DsWG9TbD.js} +0 -0
  560. /package/dist/assets/{use-copy-to-clipboard-BarKTY4m.js → use-copy-to-clipboard-RUBxQIiE.js} +0 -0
  561. /package/dist/assets/{use-is-mobile-Cx2xnNUx.js → use-is-mobile-DVIn_Q66.js} +0 -0
  562. /package/dist/assets/{user-Dq9DUxnU.js → user-DHC7OLPE.js} +0 -0
  563. /package/dist/assets/{user-plus-CXMJ1x_5.js → user-plus-DjxxnQ8G.js} +0 -0
  564. /package/dist/assets/{users-DWDkv8ju.js → users-OcC3p9Jn.js} +0 -0
  565. /package/dist/assets/{video-CQJlht8Q.js → video-Dtwi0MD9.js} +0 -0
  566. /package/dist/assets/{volume-2-Bj3y3ZBJ.js → volume-2-BXDl4IEg.js} +0 -0
  567. /package/dist/assets/{workflow-DbPANJpf.js → workflow-Bsy5y3W0.js} +0 -0
  568. /package/dist/assets/{workflow-status-CgrMMiJT.js → workflow-status-CoN2UmmG.js} +0 -0
  569. /package/dist/assets/{workspace-theme-tokens-bLqHFK0a.js → workspace-theme-tokens-_I8QCLcq.js} +0 -0
  570. /package/dist/assets/{wrench-tjOqvzJ2.js → wrench-DhynFba1.js} +0 -0
  571. /package/dist/assets/{x-DuBvjmAE.js → x-D4O9yIS7.js} +0 -0
  572. /package/dist/assets/{xterm-Ip5qSQfD.js → xterm-C0nnACYt.js} +0 -0
  573. /package/dist/assets/{xterm-addon-fit-BbxIpbO2.js → xterm-addon-fit-yG7H3Zo8.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{o as e,r as t,t as n}from"./chunk-jRWAZmH_.js";import{t as r}from"./react-BFJW0bSv.js";import{C as i,F as a,S as o,_ as s,b as c,g as l,h as u,v as d,x as f,y as p}from"./button-Dy5001j6.js";import{t as m}from"./jsx-runtime-D3ZM-ToX.js";import{t as h}from"./cn-CJf7MmLX.js";import{t as g}from"./createLucideIcon-CAM1RhH8.js";import{t as _}from"./code-qafFA0_-.js";import{t as v}from"./link-CowyzCIZ.js";import{t as y}from"./message-square-text-asdoy3SW.js";import"./src-BAS7a2RG.js";var b=g(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),ee=g(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),te=g(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),x=e(r(),1),ne=e(a(),1),S=m();function C(e){this.content=e}C.prototype={constructor:C,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new C(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new C(n)},addToStart:function(e,t){return new C([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new C(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new C(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=C.from(e),e.size?new C(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=C.from(e),e.size?new C(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=C.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},C.from=function(e){if(e instanceof C)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new C(t)};function re(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&oe(e.charCodeAt(r-1))&&ae(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=re(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function ie(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&oe(e.charCodeAt(i-1))&&ae(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=ie(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function ae(e){return e>=56320&&e<57344}function oe(e){return e>=55296&&e<56320}var w=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return re(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return ie(this,e,t,n)}findIndex(e){if(e==0)return ce(0,e);if(e==this.size)return ce(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?ce(t+1,i):ce(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};w.empty=new w([],0);var se={index:0,offset:0};function ce(e,t){return se.index=e,se.offset=t,se}function le(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!le(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!le(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var T=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&le(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};T.none=[];var ue=class extends Error{},E=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=fe(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(de(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(w.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};E.empty=new E(w.empty,0,0);function de(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(de(a.content,t-i-1,n-i-1)))}function fe(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=fe(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function pe(e,t,n){if(n.openStart>e.depth)throw new ue(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ue(`Inconsistent open depths`);return me(e,t,n,0)}function me(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=me(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ye(a,xe(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ye(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Se(n,e);return ye(a,be(e,i,o,t,r))}}function he(e,t){if(!t.type.compatibleContent(e.type))throw new ue(`Cannot join `+t.type.name+` onto `+e.type.name)}function ge(e,t,n){let r=e.node(n);return he(r,t.node(n)),r}function _e(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function ve(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(_e(e.nodeAfter,r),a++));for(let e=a;e<o;e++)_e(i.child(e),r);t&&t.depth==n&&t.textOffset&&_e(t.nodeBefore,r)}function ye(e,t){if(!e.type.validContent(t))throw new ue(`Invalid content for node `+e.type.name);return e.copy(t)}function be(e,t,n,r,i){let a=e.depth>i&&ge(e,t,i+1),o=r.depth>i&&ge(n,r,i+1),s=[];return ve(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(he(a,o),_e(ye(a,be(e,t,n,r,i+1)),s)):(a&&_e(ye(a,xe(e,t,i+1)),s),ve(t,n,i,s),o&&_e(ye(o,xe(n,r,i+1)),s)),ve(r,null,i,s),new w(s)}function xe(e,t,n){let r=[];return ve(null,e,n,r),e.depth>n&&_e(ye(ge(e,t,n+1),xe(e,t,n+1)),r),ve(t,null,n,r),new w(r)}function Se(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(w.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Ce=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return T.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new De(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Ee.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Ee.set(t,r=new we);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Te,i}},we=class{constructor(){this.elts=[],this.i=0}},Te=12,Ee=new WeakMap,De=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},Oe=Object.create(null),ke=class e{constructor(e,t,n,r=T.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||w.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&le(this.attrs,t||e.defaultAttrs||Oe)&&T.sameSet(this.marks,n||T.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return E.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new E(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return pe(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Ce.resolveCached(this,e)}resolveNoCache(e){return Ce.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),je(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=w.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=T.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!T.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=w.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};ke.prototype.text=void 0;var Ae=class e extends ke{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):je(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function je(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Me=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Ne(t,n);if(r.next==null)return e.empty;let i=Pe(r);r.next&&r.err(`Unexpected trailing text`);let a=We(Ve(i));return Ge(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return w.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
1
+ import{o as e,r as t,t as n}from"./chunk-jRWAZmH_.js";import{t as r}from"./react-BFJW0bSv.js";import{A as i,C as a,D as o,E as s,M as c,O as l,W as u,j as d,k as f,w as p}from"./button-fyWSnR9X.js";import{t as m}from"./jsx-runtime-D3ZM-ToX.js";import{t as h}from"./cn-CJf7MmLX.js";import{t as g}from"./createLucideIcon-CAM1RhH8.js";import{t as _}from"./code-D6SOwRrI.js";import"./src-ly8ixpHd.js";import{t as v}from"./link-DOobzBVg.js";import{t as y}from"./message-square-text-CN_v46So.js";var b=g(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),ee=g(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),te=g(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),x=e(r(),1),ne=e(u(),1),S=m();function C(e){this.content=e}C.prototype={constructor:C,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new C(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new C(n)},addToStart:function(e,t){return new C([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new C(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new C(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=C.from(e),e.size?new C(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=C.from(e),e.size?new C(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=C.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},C.from=function(e){if(e instanceof C)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new C(t)};function re(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&oe(e.charCodeAt(r-1))&&ae(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=re(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function ie(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&oe(e.charCodeAt(i-1))&&ae(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=ie(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function ae(e){return e>=56320&&e<57344}function oe(e){return e>=55296&&e<56320}var w=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return re(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return ie(this,e,t,n)}findIndex(e){if(e==0)return ce(0,e);if(e==this.size)return ce(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?ce(t+1,i):ce(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};w.empty=new w([],0);var se={index:0,offset:0};function ce(e,t){return se.index=e,se.offset=t,se}function le(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!le(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!le(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var T=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&le(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};T.none=[];var ue=class extends Error{},E=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=fe(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(de(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(w.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};E.empty=new E(w.empty,0,0);function de(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(de(a.content,t-i-1,n-i-1)))}function fe(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=fe(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function pe(e,t,n){if(n.openStart>e.depth)throw new ue(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ue(`Inconsistent open depths`);return me(e,t,n,0)}function me(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=me(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ye(a,xe(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ye(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Se(n,e);return ye(a,be(e,i,o,t,r))}}function he(e,t){if(!t.type.compatibleContent(e.type))throw new ue(`Cannot join `+t.type.name+` onto `+e.type.name)}function ge(e,t,n){let r=e.node(n);return he(r,t.node(n)),r}function _e(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function ve(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(_e(e.nodeAfter,r),a++));for(let e=a;e<o;e++)_e(i.child(e),r);t&&t.depth==n&&t.textOffset&&_e(t.nodeBefore,r)}function ye(e,t){if(!e.type.validContent(t))throw new ue(`Invalid content for node `+e.type.name);return e.copy(t)}function be(e,t,n,r,i){let a=e.depth>i&&ge(e,t,i+1),o=r.depth>i&&ge(n,r,i+1),s=[];return ve(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(he(a,o),_e(ye(a,be(e,t,n,r,i+1)),s)):(a&&_e(ye(a,xe(e,t,i+1)),s),ve(t,n,i,s),o&&_e(ye(o,xe(n,r,i+1)),s)),ve(r,null,i,s),new w(s)}function xe(e,t,n){let r=[];return ve(null,e,n,r),e.depth>n&&_e(ye(ge(e,t,n+1),xe(e,t,n+1)),r),ve(t,null,n,r),new w(r)}function Se(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(w.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Ce=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return T.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new De(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Ee.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Ee.set(t,r=new we);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Te,i}},we=class{constructor(){this.elts=[],this.i=0}},Te=12,Ee=new WeakMap,De=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},Oe=Object.create(null),ke=class e{constructor(e,t,n,r=T.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||w.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&le(this.attrs,t||e.defaultAttrs||Oe)&&T.sameSet(this.marks,n||T.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return E.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new E(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return pe(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Ce.resolveCached(this,e)}resolveNoCache(e){return Ce.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),je(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=w.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=T.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!T.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=w.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};ke.prototype.text=void 0;var Ae=class e extends ke{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):je(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function je(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Me=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Ne(t,n);if(r.next==null)return e.empty;let i=Pe(r);r.next&&r.err(`Unexpected trailing text`);let a=We(Ve(i));return Ge(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return w.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
2
2
  `)}};Me.empty=new Me(!0);var Ne=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Pe(e){let t=[];do t.push(Fe(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Fe(e){let t=[];do t.push(Ie(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Ie(e){let t=Be(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Re(e,t);else break;return t}function Le(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Re(e,t){let n=Le(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Le(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function ze(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Be(e){if(e.eat(`(`)){let t=Pe(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=ze(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Ve(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function He(e,t){return t-e}function Ue(e,t){let n=[];return r(t),n.sort(He);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function We(e){let t=Object.create(null);return n(Ue(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Ue(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Me(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(He);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Ge(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Ke(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function qe(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Je(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function Ye(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Qe(e,r,t[r]);return n}var Xe=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Ye(e,n.attrs),this.defaultAttrs=Ke(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Me.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:qe(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new ke(this,this.computeAttrs(e),w.from(t),T.setFrom(n))}createChecked(e=null,t,n){return t=w.from(t),this.checkContent(t),new ke(this,this.computeAttrs(e),t,T.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=w.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(w.empty,!0);return i?new ke(this,e,t.append(i),T.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Je(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:T.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Ze(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Qe=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Ze(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},$e=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Ye(e,r.attrs),this.excluded=null;let i=Ke(this.attrs);this.instance=i?new T(this,i):null}create(e=null){return!e&&this.instance?this.instance:new T(this,qe(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Je(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},et=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=C.from(e.nodes),t.marks=C.from(e.marks||{}),this.nodes=Xe.compile(this.spec.nodes,this),this.marks=$e.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Me.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?tt(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:tt(this,n.split(` `))}this.nodeFromJSON=e=>ke.fromJSON(this,e),this.markFromJSON=e=>T.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Xe))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Ae(n,n.defaultAttrs,e,T.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function tt(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function nt(e){return e.tag!=null}function rt(e){return e.style!=null}var it=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(nt(e))this.tags.push(e);else if(rt(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new pt(this,t,!1);return n.addAll(e,T.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new pt(this,t,!0);return n.addAll(e,T.none,t.from,t.to),E.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(ht(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=gt(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=gt(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},at={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ot={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},st={ol:!0,ul:!0},ct=1,lt=2,ut=4;function dt(e,t,n){return t==null?e&&e.whitespace==`pre`?ct|lt:n&~ut:(t?ct:0)|(t===`full`?lt:0)}var ft=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=T.none,this.match=i||(a&ut?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(w.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ct)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=w.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(w.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!at.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},pt=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=dt(null,t.preserveWhitespace,0)|(n?ut:0);i=r?new ft(r.type,r.attrs,T.none,!0,t.topMatch||r.type.contentMatch,a):n?new ft(null,null,T.none,!0,null,a):new ft(e.schema.topNodeType,null,T.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&lt?`full`:this.localPreserveWS||(r.options&ct)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
3
3
  `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;st.hasOwnProperty(a)&&this.parser.normalizeLists&&mt(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:ot.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(at.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=T.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):_t(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=dt(e,i,a.options);a.options&ut&&a.content.length==0&&(o|=ut);let s=T.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):_t(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new ft(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=ct);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function mt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&st.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function ht(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function gt(e){let t={};for(let n in e)t[n]=e[n];return t}function _t(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var vt=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=bt(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return bt(t).createTextNode(e.text);let{dom:n,contentDOM:r}=wt(bt(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&wt(bt(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:wt(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=yt(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return yt(e.marks)}};function yt(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function bt(e){return e.document||window.document}var xt=new WeakMap;function St(e){let t=xt.get(e);return t===void 0&&xt.set(e,t=Ct(e)),t}function Ct(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function wt(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=St(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=wt(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Tt=65535,Et=2**16;function Dt(e,t){return e+t*Et}function Ot(e){return e&Tt}function kt(e){return(e-(e&Tt))/Et}var At=1,jt=2,Mt=4,Nt=8,Pt=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Nt)>0}get deletedBefore(){return(this.delInfo&(At|Mt))>0}get deletedAfter(){return(this.delInfo&(jt|Mt))>0}get deletedAcross(){return(this.delInfo&Mt)>0}},Ft=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=Ot(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+kt(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:Dt(o/3,e-s),f=e==s?jt:e==u?At:Mt;return(t<0?e!=s:e!=u)&&(f|=Nt),new Pt(a,f,d)}r+=l-c}return n?e+r:new Pt(e+r,0,null)}touches(e,t){let n=0,r=Ot(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Ft.empty=new Ft([]);var It=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new Pt(e,r,null)}},Lt=Object.create(null),D=class{getMap(){return Ft.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=Lt[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Lt)throw RangeError(`Duplicate use of step JSON ID `+e);return Lt[e]=t,t.prototype.jsonID=e,t}},Rt=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof ue)return e.fail(t.message);throw t}}};function zt(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(zt(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return w.fromArray(r)}var Bt=class e extends D{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new E(zt(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return Rt.fromReplace(e,this.from,this.to,i)}invert(){return new Vt(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};D.jsonID(`addMark`,Bt);var Vt=class e extends D{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new E(zt(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return Rt.fromReplace(e,this.from,this.to,n)}invert(){return new Bt(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};D.jsonID(`removeMark`,Vt);var Ht=class e extends D{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Rt.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Rt.fromReplace(e,this.pos,this.pos+1,new E(w.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Ut(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};D.jsonID(`addNodeMark`,Ht);var Ut=class e extends D{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Rt.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Rt.fromReplace(e,this.pos,this.pos+1,new E(w.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ht(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};D.jsonID(`removeNodeMark`,Ut);var Wt=class e extends D{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Kt(e,this.from,this.to)?Rt.fail(`Structure replace would overwrite content`):Rt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ft([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?E.empty:new E(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?E.empty:new E(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,E.fromJSON(t,n.slice),!!n.structure)}};Wt.MAP_BIAS=1,D.jsonID(`replace`,Wt);var Gt=class e extends D{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(Kt(e,this.from,this.gapFrom)||Kt(e,this.gapTo,this.to)))return Rt.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Rt.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?Rt.fromReplace(e,this.from,this.to,n):Rt.fail(`Content does not fit in gap`)}getMap(){return new Ft([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,E.fromJSON(t,n.slice),n.insert,!!n.structure)}};D.jsonID(`replaceAround`,Gt);function Kt(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function qt(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new Vt(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Bt(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function Jt(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof $e){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new Vt(t.from,t.to,t.style)))}function Yt(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Wt(s,l,E.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Vt(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new E(w.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Wt(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(w.empty,!0);e.replace(s,s,new E(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function Xt(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Zt(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!Xt(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Qt(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=w.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=w.from(r.node(e).copy(u)),d++):c--;let f=w.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=w.from(i.node(e).copy(f)),p++):l++;e.step(new Gt(c,l,o,s,new E(u.append(f),d,p),u.size-d,!0))}function $t(e,t,n=null,r=e){let i=tn(e,t),a=i&&nn(r,t);return a?i.map(en).concat({type:t,attrs:n}).concat(a.map(en)):null}function en(e){return{type:e,attrs:null}}function tn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function nn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function rn(e,t,n){let r=w.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=w.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new Gt(i,a,i,a,new E(r,0,0),n.length,!0))}function an(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&cn(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&sn(e,t,n,a),Yt(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new Gt(c,l,c+1,l-1,new E(w.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&on(e,t,n,a),!1}})}function on(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function sn(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
@@ -103,7 +103,7 @@ ${n}`}}),s}function rf(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants
103
103
  `,Mp=`️`,Np=`‍`,Pp=``,Fp=null,Ip=null;function Lp(e=[]){let t={};xf.groups=t;let n=new xf;Fp??=Vp(of),Ip??=Vp(sf),K(n,`'`,Qf),K(n,`{`,Ff),K(n,`}`,If),K(n,`[`,Lf),K(n,`]`,Rf),K(n,`(`,zf),K(n,`)`,Bf),K(n,`<`,Vf),K(n,`>`,Hf),K(n,`(`,Uf),K(n,`)`,Wf),K(n,`「`,Gf),K(n,`」`,Kf),K(n,`『`,qf),K(n,`』`,Jf),K(n,`<`,Yf),K(n,`>`,Xf),K(n,`&`,Zf),K(n,`*`,$f),K(n,`@`,ep),K(n,"`",np),K(n,`^`,rp),K(n,`:`,ip),K(n,`,`,ap),K(n,`$`,op),K(n,`.`,sp),K(n,`=`,cp),K(n,`!`,lp),K(n,`-`,up),K(n,`%`,dp),K(n,`|`,fp),K(n,`+`,pp),K(n,`#`,mp),K(n,`?`,hp),K(n,`"`,gp),K(n,`/`,yp),K(n,`;`,vp),K(n,`~`,bp),K(n,`_`,xp),K(n,`\\`,tp),K(n,`・`,_p);let r=G(n,Op,Mf,{[cf]:!0});G(r,Op,r);let i=G(r,Tp,Tf,{[df]:!0}),a=G(r,Ep,Ef,{[ff]:!0}),o=G(n,Tp,Cf,{[lf]:!0});G(o,Op,i),G(o,Tp,o),G(i,Op,i),G(i,Tp,i);let s=G(n,Ep,wf,{[uf]:!0});G(s,Tp),G(s,Op,a),G(s,Ep,s),G(a,Op,a),G(a,Tp),G(a,Ep,a);let c=K(n,jp,Pf,{[_f]:!0}),l=K(n,Ap,Nf,{[_f]:!0}),u=G(n,kp,Nf,{[_f]:!0});K(n,Pp,u),K(l,jp,c),K(l,Pp,u),G(l,kp,u),K(u,Ap),K(u,jp),G(u,kp,u),K(u,Pp,u);let d=G(n,Dp,Sp,{[mf]:!0});K(d,`#`),G(d,Dp,d),K(d,Mp,d);let f=K(d,Np);K(f,`#`),G(f,Dp,d);let p=[[Tp,o],[Op,i]],m=[[Tp,null],[Ep,s],[Op,a]];for(let e=0;e<Fp.length;e++)Bp(n,Fp[e],Of,Cf,p);for(let e=0;e<Ip.length;e++)Bp(n,Ip[e],kf,wf,m);yf(Of,{tld:!0,ascii:!0},t),yf(kf,{utld:!0,alpha:!0},t),Bp(n,`file`,Af,Cf,p),Bp(n,`mailto`,Af,Cf,p),Bp(n,`http`,jf,Cf,p),Bp(n,`https`,jf,Cf,p),Bp(n,`ftp`,jf,Cf,p),Bp(n,`ftps`,jf,Cf,p),yf(Af,{scheme:!0,ascii:!0},t),yf(jf,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[hf]:!0}:{[gf]:!0};r.indexOf(`-`)>=0?i[pf]=!0:Tp.test(r)?Op.test(r)?i[df]=!0:i[lf]=!0:i[cf]=!0,Sf(n,r,r,i)}return Sf(n,`localhost`,Df,{ascii:!0}),n.jd=new xf(Cp),{start:n,tokens:Object.assign({groups:t},wp)}}function Rp(e,t){let n=zp(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function zp(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function Bp(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new xf(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new xf(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function Vp(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var Hp={defaultProtocol:`http`,events:null,format:Wp,formatHref:Wp,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Up(e,t=null){let n=Object.assign({},Hp);e&&(n=Object.assign(n,e instanceof Up?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}Up.prototype={o:Hp,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:Hp[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function Wp(e){return e}function Gp(e,t){this.t=`token`,this.v=e,this.tk=t}Gp.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Hp.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function Kp(e,t){class n extends Gp{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var qp=Kp(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),Jp=Kp(`text`),Yp=Kp(`nl`),Xp=Kp(`url`,{isLink:!0,toHref(e=Hp.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==Df&&e[1].t===ip}}),Zp=e=>new xf(e);function Qp({groups:e}){let t=e.domain.concat([Zf,$f,ep,tp,np,rp,op,cp,up,Mf,dp,fp,pp,mp,yp,Cp,bp,xp]),n=[Qf,ip,ap,sp,lp,dp,hp,gp,vp,Vf,Hf,Ff,If,Rf,Lf,zf,Bf,Uf,Wf,Gf,Kf,qf,Jf,Yf,Xf],r=[Zf,Qf,$f,tp,np,rp,op,cp,up,Ff,If,dp,fp,pp,mp,hp,yp,Cp,bp,xp],i=Zp(),a=K(i,bp);W(a,r,a),W(a,e.domain,a);let o=Zp(),s=Zp(),c=Zp();W(i,e.domain,o),W(i,e.scheme,s),W(i,e.slashscheme,c),W(o,r,a),W(o,e.domain,o);let l=K(o,ep);K(a,ep,l),K(s,ep,l),K(c,ep,l);let u=K(a,sp);W(u,r,a),W(u,e.domain,a);let d=Zp();W(l,e.domain,d),W(d,e.domain,d);let f=K(d,sp);W(f,e.domain,d);let p=Zp(qp);W(f,e.tld,p),W(f,e.utld,p),K(l,Df,p);let m=K(d,up);K(m,up,m),W(m,e.domain,d),W(p,e.domain,d),K(p,sp,f),K(p,up,m);let h=K(o,up),g=K(o,sp);K(h,up,h),W(h,e.domain,o),W(g,r,a),W(g,e.domain,o);let _=Zp(Xp);W(g,e.tld,_),W(g,e.utld,_),W(_,e.domain,o),W(_,r,a),K(_,sp,g),K(_,up,h),K(_,ep,l);let v=K(_,ip),y=Zp(Xp);W(v,e.numeric,y);let b=Zp(Xp),ee=Zp();W(b,t,b),W(b,n,ee),W(ee,t,b),W(ee,n,ee),K(_,yp,b),K(y,yp,b);let te=K(s,ip),x=K(K(K(c,ip),yp),yp);W(s,e.domain,o),K(s,sp,g),K(s,up,h),W(c,e.domain,o),K(c,sp,g),K(c,up,h),W(te,e.domain,b),K(te,yp,b),K(te,hp,b),W(x,e.domain,b),W(x,t,b),K(x,yp,b);let ne=[[Ff,If],[Lf,Rf],[zf,Bf],[Vf,Hf],[Uf,Wf],[Gf,Kf],[qf,Jf],[Yf,Xf]];for(let e=0;e<ne.length;e++){let[r,i]=ne[e],a=K(b,r);K(ee,r,a);let o=Zp(Xp);W(a,t,o);let s=Zp();W(a,n,s),K(a,i,b),W(o,t,o),W(o,n,s),W(s,t,o),W(s,n,s),K(o,i,b),K(s,i,b)}return K(i,Df,_),K(i,Pf,Yp),{start:i,tokens:wp}}function $p(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(em(Jp,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(em(e,t,r))}}return o.length>0&&a.push(em(Jp,t,o)),a}function em(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var tm=typeof console<`u`&&console&&console.warn||(()=>{}),nm=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,q={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function rm(){return xf.groups={},q.scanner=null,q.parser=null,q.tokenQueue=[],q.pluginQueue=[],q.customSchemes=[],q.initialized=!1,q}function im(e,t=!1){if(q.initialized&&tm(`linkifyjs: already initialized - will not register custom scheme "${e}" ${nm}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
104
104
  1. Must only contain digits, lowercase ASCII letters or "-"
105
105
  2. Cannot start or end with "-"
106
- 3. "-" cannot repeat`);q.customSchemes.push([e,t])}function am(){q.scanner=Lp(q.customSchemes);for(let e=0;e<q.tokenQueue.length;e++)q.tokenQueue[e][1]({scanner:q.scanner});q.parser=Qp(q.scanner.tokens);for(let e=0;e<q.pluginQueue.length;e++)q.pluginQueue[e][1]({scanner:q.scanner,parser:q.parser});return q.initialized=!0,q}function om(e){return q.initialized||am(),$p(q.parser.start,e,Rp(q.scanner.start,e))}om.scan=Rp;function sm(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new Up(n),i=om(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var cm=`[\0- \xA0 ᠎ -\u2029  ]`,lm=new RegExp(cm),um=RegExp(`${cm}$`),dm=new RegExp(cm,`g`);function fm(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function pm(e){return new j({key:new M(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(bu(Gl(n.doc,[...t])).forEach(({newRange:t})=>{let n=ql(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!um.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(lm).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=om(n).map(t=>t.toObject(e.defaultProtocol));if(!fm(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{xu(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function mm(e){return new j({key:new M(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=_u(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function hm(e){return new j({key:new M(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=sm(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function gm(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(dm,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var _m=vd.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){im(e);return}im(e.scheme,e.optionalSlashes)})},onDestroy(){rm()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!gm(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!gm(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!gm(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,V(this.options.HTMLAttributes,e),0]:[`a`,V(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!gm(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!gm(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[af({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=sm(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!gm(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(pm({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!gm(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(mm({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(hm({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),vm=_m,ym=n((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),bm=n(((e,t)=>{t.exports=ym()})),xm=bm(),{getOwnPropertyNames:Sm,getOwnPropertySymbols:Cm}=Object,{hasOwnProperty:wm}=Object.prototype;function Tm(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function Em(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function Dm(e){return e?.[Symbol.toStringTag]}function Om(e){return Sm(e).concat(Cm(e))}var km=Object.hasOwn||((e,t)=>wm.call(e,t));function Am(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var jm=`__v`,Mm=`__o`,Nm=`_owner`,{getOwnPropertyDescriptor:Pm,keys:Fm}=Object;function Im(e,t){return e.byteLength===t.byteLength&&Ym(new Uint8Array(e),new Uint8Array(t))}function Lm(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Rm(e,t){return e.byteLength===t.byteLength&&Ym(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function zm(e,t){return Am(e.getTime(),t.getTime())}function Bm(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Vm(e,t){return e===t}function Hm(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Um=Am;function Wm(e,t,n){let r=Fm(e),i=r.length;if(Fm(t).length!==i)return!1;for(;i-- >0;)if(!Zm(e,t,n,r[i]))return!1;return!0}function Gm(e,t,n){let r=Om(e),i=r.length;if(Om(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!Zm(e,t,n,a)||(o=Pm(e,a),s=Pm(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Km(e,t){return Am(e.valueOf(),t.valueOf())}function qm(e,t){return e.source===t.source&&e.flags===t.flags}function Jm(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function Ym(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Xm(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Zm(e,t,n,r){return(r===Nm||r===Mm||r===jm)&&(e.$$typeof||t.$$typeof)?!0:km(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var Qm=`[object ArrayBuffer]`,$m=`[object Arguments]`,eh=`[object Boolean]`,th=`[object DataView]`,nh=`[object Date]`,rh=`[object Error]`,ih=`[object Map]`,ah=`[object Number]`,oh=`[object Object]`,sh=`[object RegExp]`,ch=`[object Set]`,lh=`[object String]`,uh={"[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},dh=`[object URL]`,fh=Object.prototype.toString;function ph({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=fh.call(h);if(b===nh)return r(h,g,_);if(b===sh)return u(h,g,_);if(b===ih)return o(h,g,_);if(b===ch)return d(h,g,_);if(b===oh)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===dh)return p(h,g,_);if(b===rh)return i(h,g,_);if(b===$m)return c(h,g,_);if(uh[b])return f(h,g,_);if(b===Qm)return e(h,g,_);if(b===th)return n(h,g,_);if(b===eh||b===ah||b===lh)return l(h,g,_);if(m){let e=m[b];if(!e){let t=Dm(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function mh({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Im,areArraysEqual:n?Gm:Lm,areDataViewsEqual:Rm,areDatesEqual:zm,areErrorsEqual:Bm,areFunctionsEqual:Vm,areMapsEqual:n?Tm(Hm,Gm):Hm,areNumbersEqual:Um,areObjectsEqual:n?Gm:Wm,arePrimitiveWrappersEqual:Km,areRegExpsEqual:qm,areSetsEqual:n?Tm(Jm,Gm):Jm,areTypedArraysEqual:n?Tm(Ym,Gm):Ym,areUrlsEqual:Xm,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=Em(r.areArraysEqual),t=Em(r.areMapsEqual),n=Em(r.areObjectsEqual),i=Em(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function hh(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function gh({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var _h=vh();vh({strict:!0}),vh({circular:!0}),vh({circular:!0,strict:!0}),vh({createInternalComparator:()=>Am}),vh({strict:!0,createInternalComparator:()=>Am}),vh({circular:!0,createInternalComparator:()=>Am}),vh({circular:!0,createInternalComparator:()=>Am,strict:!0});function vh(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=ph(mh(e));return gh({circular:t,comparator:a,createState:r,equals:n?n(a):hh(a),strict:i})}var yh=n((e=>{var t=r(),n=bm();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),bh=n(((e,t)=>{t.exports=yh()}))(),xh=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},Sh=({contentComponent:e})=>{let t=(0,xm.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,S.jsx)(S.Fragment,{children:Object.values(t)})};function Ch(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:ne.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var wh=class extends x.Component{constructor(e){super(e),this.editorContentRef=x.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=Ch(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{ref:xh(t,this.editorContentRef),...n}),e?.contentComponent&&(0,S.jsx)(Sh,{contentComponent:e.contentComponent})]})}},Th=(0,x.forwardRef)((e,t)=>{let n=x.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return x.createElement(wh,{key:n,innerRef:t,...e})}),Eh=x.memo(Th),Dh=typeof window<`u`?x.useLayoutEffect:x.useEffect,Oh=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function kh(e){let[t]=(0,x.useState)(()=>new Oh(e.editor)),n=(0,bh.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??_h);return Dh(()=>t.watch(e.editor),[e.editor,t]),(0,x.useDebugValue)(n),n}var Ah=!1,jh=typeof window>`u`,Mh=jh||!!(typeof window<`u`&&window.next),Nh=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return jh?(t&&Ah&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),t=!1):Mh&&e===void 0&&(t=!1,Ah&&console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")),t?this.createEditor():null}createEditor(){return new Hd({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Ph(e={},t=[]){let n=(0,x.useRef)(e);n.current=e;let[r]=(0,x.useState)(()=>new Nh(n)),i=(0,xm.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,x.useDebugValue)(i),(0,x.useEffect)(r.onRender(t)),kh({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var Fh=(0,x.createContext)({editor:null});Fh.Consumer;var Ih=()=>(0,x.useContext)(Fh),Lh=(0,x.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Rh=()=>(0,x.useContext)(Lh);x.forwardRef((e,t)=>{let{onDragStart:n}=Rh();return(0,S.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})}),x.createContext({markViewContentRef:()=>{}});var zh=(0,x.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});zh.displayName=`TiptapContext`;var Bh=()=>(0,x.useContext)(zh);function Vh({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,x.useMemo)(()=>({editor:r}),[r]),a=(0,x.useMemo)(()=>({editor:r}),[r]);return(0,S.jsx)(Fh.Provider,{value:a,children:(0,S.jsx)(zh.Provider,{value:i,children:n})})}Vh.displayName=`Tiptap`;function Hh({...e}){let{editor:t}=Bh();return(0,S.jsx)(Eh,{editor:t,...e})}Hh.displayName=`Tiptap.Content`,Object.assign(Vh,{Content:Hh});var Uh,Wh;if(typeof WeakMap<`u`){let e=new WeakMap;Uh=t=>e.get(t),Wh=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;Uh=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},Wh=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var Gh=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return Uh(e)||Wh(e,Kh(e))}};function Kh(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=qh(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new Gh(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&Jh(s,o,e),s}function qh(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function Jh(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=Yh(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function Yh(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Xh(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}new M(`selectingCells`);function Zh(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function Qh(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function $h(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=Zh(t.$head)||eg(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function eg(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function tg(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function ng(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function rg(e,t,n){let r=e.node(-1),i=Gh.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function ig(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}var ag=class e extends O{constructor(e,t=e){let n=e.node(-1),r=Gh.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new zn(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(tg(r)&&tg(i)&&ng(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return k.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=Gh.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=ig(e,0,l)),u>0&&(e=ig(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(w.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new E(w.from(o),1,1)}replace(e,t=E.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?E.empty:t)}let i=O.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new E(w.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=Gh.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=Gh.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=Gh.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=Gh.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new og(this.$anchorCell.pos,this.$headCell.pos)}};ag.prototype.visible=!1,O.jsonID(`cell`,ag);var og=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&ng(t,n)?new ag(t,n):O.near(n,1)}};new M(`fix-tables`);function sg(e){let t=e.selection,n=$h(e),r=n.node(-1),i=n.start(-1),a=Gh.get(r);return{...t instanceof ag?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function cg(e){return function(t,n){if(!Qh(t))return!1;if(n){let r=Xh(t.schema),i=sg(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function lg(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function ug(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?cg(e):function(t,n){if(!Qh(t))return!1;if(n){let r=Xh(t.schema),i=sg(t),a=t.tr,o=lg(`row`,i,r),s=lg(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}ug(`row`,{useDeprecatedLogic:!0}),ug(`column`,{useDeprecatedLogic:!0}),ug(`cell`,{useDeprecatedLogic:!0});function dg(e,t){let n=e.selection;if(!(n instanceof ag))return!1;if(t){let r=e.tr,i=Xh(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new E(i,0,0))}),r.docChanged&&t(r)}return!0}kc({ArrowLeft:pg(`horiz`,-1),ArrowRight:pg(`horiz`,1),ArrowUp:pg(`vert`,-1),ArrowDown:pg(`vert`,1),"Shift-ArrowLeft":mg(`horiz`,-1),"Shift-ArrowRight":mg(`horiz`,1),"Shift-ArrowUp":mg(`vert`,-1),"Shift-ArrowDown":mg(`vert`,1),Backspace:dg,"Mod-Backspace":dg,Delete:dg,"Mod-Delete":dg});function fg(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function pg(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof ag)return fg(n,r,O.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=hg(i,e,t);if(o==null)return!1;if(e==`horiz`)return fg(n,r,O.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=rg(i,e,t),s;return s=a?O.near(a,1):t<0?O.near(n.doc.resolve(i.before(-1)),-1):O.near(n.doc.resolve(i.after(-1)),1),fg(n,r,s)}}}function mg(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof ag)o=a;else{let r=hg(i,e,t);if(r==null)return!1;o=new ag(n.doc.resolve(r))}let s=rg(o.$headCell,e,t);return s?fg(n,r,new ag(o.$anchorCell,s)):!1}}function hg(e,t,n){if(!(e.state.selection instanceof k))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}new M(`tableColumnResizing`);function gg(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var _g=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&tl(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(d(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(o(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(f(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(u(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(i(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(l(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(p(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(c(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Lu(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof A){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof ag){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():gg(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&s(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},vg=e=>new j({key:typeof e.pluginKey==`string`?new M(e.pluginKey):e.pluginKey,view:t=>new _g({view:t,...e})});H.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[vg({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var yg=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return mu(e,{textSerializers:hu(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(d(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(o(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(f(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(u(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(i(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(l(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(p(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(c(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){if(!this.view?.dom?.parentNode)return;let{selection:e}=this.editor.state,t=Lu(this.view,e.from,e.to);s({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},bg=e=>new j({key:typeof e.pluginKey==`string`?new M(e.pluginKey):e.pluginKey,view:t=>new yg({view:t,...e})});H.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[bg({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function xg(e,t){return e??new M(t)}var Sg=typeof window<`u`?x.useLayoutEffect:x.useEffect,Cg=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),wg=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),Tg=new Set([`children`,`className`,`style`]),Eg=new Set([`tabIndex`]),Dg=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),Og={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function kg(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function Ag(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function jg(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||Dg.has(e)}function Mg(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Ng(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:Og[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function Pg(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function Fg(e){return Eg.has(e)}function Ig(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function Lg(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function Rg(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||wg.has(e)?String(t):`${t}px`}function zg(e,t){Cg.has(t)||e.style.removeProperty(Mg(t))}function Bg(e,t,n){Cg.has(t)||e.style.setProperty(Mg(t),Rg(t,n))}function Vg(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(Tg.has(r)||!jg(r)||kg(r,t[r])||kg(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=Ag(r);if(a==null||a===!1){Fg(r)&&Lg(e,r),e.removeAttribute(o);return}if(a===!0){Fg(r)&&Ig(e,r,!0),e.setAttribute(o,``);return}if(Fg(r)){Ig(e,r,a);return}e.setAttribute(o,String(a))})}function Hg(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function Ug(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){zg(e,t);return}Bg(e,t,a)}})}function Wg(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!kg(t,n))return;let{eventName:i,options:a}=Ng(t),o=t=>{n(Pg(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function Gg(e,t){let n=(0,x.useRef)({}),r=(0,x.useRef)([]);Sg(()=>{let i=n.current;return Hg(e,i.className,t.className),Ug(e,i.style,t.style),Vg(e,i,t),r.current=Wg(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var Kg=x.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,x.useRef)(document.createElement(`div`)),f=(0,x.useRef)(xg(e,`bubbleMenu`)).current;Gg(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Ih(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,x.useRef)(h);g.current=h;let[_,v]=(0,x.useState)(!1),y=(0,x.useRef)(!0);return(0,x.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=vg({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,x.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,ne.createPortal)(c,d.current)});x.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,x.useRef)(document.createElement(`div`)),d=(0,x.useRef)(xg(e,`floatingMenu`)).current;Gg(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Ih(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,x.useRef)(m);h.current=m;let[g,_]=(0,x.useState)(!1),v=(0,x.useRef)(!0);return(0,x.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=bg({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,x.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,ne.createPortal)(s,u.current)});var qg=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]};function Jg(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Jg(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Yg(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Yg(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var Xg=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Jg(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Yg(this,e,t,n)}findIndex(e){if(e==0)return Qg(0,e);if(e==this.size)return Qg(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Qg(t+1,i):Qg(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};Xg.empty=new Xg([],0);var Zg={index:0,offset:0};function Qg(e,t){return Zg.index=e,Zg.offset=t,Zg}function $g(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!$g(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!$g(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var e_=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&$g(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};e_.none=[];var t_=class extends Error{},J=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=r_(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(n_(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(Xg.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};J.empty=new J(Xg.empty,0,0);function n_(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(n_(a.content,t-i-1,n-i-1)))}function r_(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=r_(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function i_(e,t,n){if(n.openStart>e.depth)throw new t_(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new t_(`Inconsistent open depths`);return a_(e,t,n,0)}function a_(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=a_(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return u_(a,f_(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return u_(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=p_(n,e);return u_(a,d_(e,i,o,t,r))}}function o_(e,t){if(!t.type.compatibleContent(e.type))throw new t_(`Cannot join `+t.type.name+` onto `+e.type.name)}function s_(e,t,n){let r=e.node(n);return o_(r,t.node(n)),r}function c_(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function l_(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(c_(e.nodeAfter,r),a++));for(let e=a;e<o;e++)c_(i.child(e),r);t&&t.depth==n&&t.textOffset&&c_(t.nodeBefore,r)}function u_(e,t){return e.type.checkContent(t),e.copy(t)}function d_(e,t,n,r,i){let a=e.depth>i&&s_(e,t,i+1),o=r.depth>i&&s_(n,r,i+1),s=[];return l_(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(o_(a,o),c_(u_(a,d_(e,t,n,r,i+1)),s)):(a&&c_(u_(a,f_(e,t,i+1)),s),l_(t,n,i,s),o&&c_(u_(o,f_(n,r,i+1)),s)),l_(r,null,i,s),new Xg(s)}function f_(e,t,n){let r=[];return l_(null,e,n,r),e.depth>n&&c_(u_(s_(e,t,n+1),f_(e,t,n+1)),r),l_(t,null,n,r),new Xg(r)}function p_(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Xg.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var m_=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return e_.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new v_(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=__.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else __.set(t,r=new h_);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%g_,i}},h_=class{constructor(){this.elts=[],this.i=0}},g_=12,__=new WeakMap,v_=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},y_=Object.create(null),b_=class e{constructor(e,t,n,r=e_.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Xg.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&$g(this.attrs,t||e.defaultAttrs||y_)&&e_.sameSet(this.marks,n||e_.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return J.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new J(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return i_(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return m_.resolveCached(this,e)}resolveNoCache(e){return m_.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),x_(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=Xg.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=e_.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!e_.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=Xg.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};b_.prototype.text=void 0;function x_(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var S_=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new C_(t,n);if(r.next==null)return e.empty;let i=w_(r);r.next&&r.err(`Unexpected trailing text`);let a=P_(j_(i));return F_(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return Xg.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
106
+ 3. "-" cannot repeat`);q.customSchemes.push([e,t])}function am(){q.scanner=Lp(q.customSchemes);for(let e=0;e<q.tokenQueue.length;e++)q.tokenQueue[e][1]({scanner:q.scanner});q.parser=Qp(q.scanner.tokens);for(let e=0;e<q.pluginQueue.length;e++)q.pluginQueue[e][1]({scanner:q.scanner,parser:q.parser});return q.initialized=!0,q}function om(e){return q.initialized||am(),$p(q.parser.start,e,Rp(q.scanner.start,e))}om.scan=Rp;function sm(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new Up(n),i=om(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var cm=`[\0- \xA0 ᠎ -\u2029  ]`,lm=new RegExp(cm),um=RegExp(`${cm}$`),dm=new RegExp(cm,`g`);function fm(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function pm(e){return new j({key:new M(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(bu(Gl(n.doc,[...t])).forEach(({newRange:t})=>{let n=ql(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!um.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(lm).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=om(n).map(t=>t.toObject(e.defaultProtocol));if(!fm(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{xu(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function mm(e){return new j({key:new M(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=_u(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function hm(e){return new j({key:new M(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=sm(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function gm(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(dm,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var _m=vd.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){im(e);return}im(e.scheme,e.optionalSlashes)})},onDestroy(){rm()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!gm(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!gm(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!gm(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,V(this.options.HTMLAttributes,e),0]:[`a`,V(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!gm(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!gm(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[af({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=sm(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!gm(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(pm({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!gm(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(mm({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(hm({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),vm=_m,ym=n((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),bm=n(((e,t)=>{t.exports=ym()})),xm=bm(),{getOwnPropertyNames:Sm,getOwnPropertySymbols:Cm}=Object,{hasOwnProperty:wm}=Object.prototype;function Tm(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function Em(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function Dm(e){return e?.[Symbol.toStringTag]}function Om(e){return Sm(e).concat(Cm(e))}var km=Object.hasOwn||((e,t)=>wm.call(e,t));function Am(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var jm=`__v`,Mm=`__o`,Nm=`_owner`,{getOwnPropertyDescriptor:Pm,keys:Fm}=Object;function Im(e,t){return e.byteLength===t.byteLength&&Ym(new Uint8Array(e),new Uint8Array(t))}function Lm(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Rm(e,t){return e.byteLength===t.byteLength&&Ym(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function zm(e,t){return Am(e.getTime(),t.getTime())}function Bm(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Vm(e,t){return e===t}function Hm(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Um=Am;function Wm(e,t,n){let r=Fm(e),i=r.length;if(Fm(t).length!==i)return!1;for(;i-- >0;)if(!Zm(e,t,n,r[i]))return!1;return!0}function Gm(e,t,n){let r=Om(e),i=r.length;if(Om(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!Zm(e,t,n,a)||(o=Pm(e,a),s=Pm(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Km(e,t){return Am(e.valueOf(),t.valueOf())}function qm(e,t){return e.source===t.source&&e.flags===t.flags}function Jm(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function Ym(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Xm(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Zm(e,t,n,r){return(r===Nm||r===Mm||r===jm)&&(e.$$typeof||t.$$typeof)?!0:km(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var Qm=`[object ArrayBuffer]`,$m=`[object Arguments]`,eh=`[object Boolean]`,th=`[object DataView]`,nh=`[object Date]`,rh=`[object Error]`,ih=`[object Map]`,ah=`[object Number]`,oh=`[object Object]`,sh=`[object RegExp]`,ch=`[object Set]`,lh=`[object String]`,uh={"[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},dh=`[object URL]`,fh=Object.prototype.toString;function ph({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=fh.call(h);if(b===nh)return r(h,g,_);if(b===sh)return u(h,g,_);if(b===ih)return o(h,g,_);if(b===ch)return d(h,g,_);if(b===oh)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===dh)return p(h,g,_);if(b===rh)return i(h,g,_);if(b===$m)return c(h,g,_);if(uh[b])return f(h,g,_);if(b===Qm)return e(h,g,_);if(b===th)return n(h,g,_);if(b===eh||b===ah||b===lh)return l(h,g,_);if(m){let e=m[b];if(!e){let t=Dm(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function mh({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Im,areArraysEqual:n?Gm:Lm,areDataViewsEqual:Rm,areDatesEqual:zm,areErrorsEqual:Bm,areFunctionsEqual:Vm,areMapsEqual:n?Tm(Hm,Gm):Hm,areNumbersEqual:Um,areObjectsEqual:n?Gm:Wm,arePrimitiveWrappersEqual:Km,areRegExpsEqual:qm,areSetsEqual:n?Tm(Jm,Gm):Jm,areTypedArraysEqual:n?Tm(Ym,Gm):Ym,areUrlsEqual:Xm,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=Em(r.areArraysEqual),t=Em(r.areMapsEqual),n=Em(r.areObjectsEqual),i=Em(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function hh(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function gh({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var _h=vh();vh({strict:!0}),vh({circular:!0}),vh({circular:!0,strict:!0}),vh({createInternalComparator:()=>Am}),vh({strict:!0,createInternalComparator:()=>Am}),vh({circular:!0,createInternalComparator:()=>Am}),vh({circular:!0,createInternalComparator:()=>Am,strict:!0});function vh(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=ph(mh(e));return gh({circular:t,comparator:a,createState:r,equals:n?n(a):hh(a),strict:i})}var yh=n((e=>{var t=r(),n=bm();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),bh=n(((e,t)=>{t.exports=yh()}))(),xh=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},Sh=({contentComponent:e})=>{let t=(0,xm.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,S.jsx)(S.Fragment,{children:Object.values(t)})};function Ch(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:ne.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var wh=class extends x.Component{constructor(e){super(e),this.editorContentRef=x.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=Ch(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{ref:xh(t,this.editorContentRef),...n}),e?.contentComponent&&(0,S.jsx)(Sh,{contentComponent:e.contentComponent})]})}},Th=(0,x.forwardRef)((e,t)=>{let n=x.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return x.createElement(wh,{key:n,innerRef:t,...e})}),Eh=x.memo(Th),Dh=typeof window<`u`?x.useLayoutEffect:x.useEffect,Oh=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function kh(e){let[t]=(0,x.useState)(()=>new Oh(e.editor)),n=(0,bh.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??_h);return Dh(()=>t.watch(e.editor),[e.editor,t]),(0,x.useDebugValue)(n),n}var Ah=!1,jh=typeof window>`u`,Mh=jh||!!(typeof window<`u`&&window.next),Nh=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return jh?(t&&Ah&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),t=!1):Mh&&e===void 0&&(t=!1,Ah&&console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")),t?this.createEditor():null}createEditor(){return new Hd({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Ph(e={},t=[]){let n=(0,x.useRef)(e);n.current=e;let[r]=(0,x.useState)(()=>new Nh(n)),i=(0,xm.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,x.useDebugValue)(i),(0,x.useEffect)(r.onRender(t)),kh({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var Fh=(0,x.createContext)({editor:null});Fh.Consumer;var Ih=()=>(0,x.useContext)(Fh),Lh=(0,x.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Rh=()=>(0,x.useContext)(Lh);x.forwardRef((e,t)=>{let{onDragStart:n}=Rh();return(0,S.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})}),x.createContext({markViewContentRef:()=>{}});var zh=(0,x.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});zh.displayName=`TiptapContext`;var Bh=()=>(0,x.useContext)(zh);function Vh({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,x.useMemo)(()=>({editor:r}),[r]),a=(0,x.useMemo)(()=>({editor:r}),[r]);return(0,S.jsx)(Fh.Provider,{value:a,children:(0,S.jsx)(zh.Provider,{value:i,children:n})})}Vh.displayName=`Tiptap`;function Hh({...e}){let{editor:t}=Bh();return(0,S.jsx)(Eh,{editor:t,...e})}Hh.displayName=`Tiptap.Content`,Object.assign(Vh,{Content:Hh});var Uh,Wh;if(typeof WeakMap<`u`){let e=new WeakMap;Uh=t=>e.get(t),Wh=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;Uh=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},Wh=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var Gh=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return Uh(e)||Wh(e,Kh(e))}};function Kh(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=qh(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new Gh(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&Jh(s,o,e),s}function qh(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function Jh(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=Yh(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function Yh(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Xh(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}new M(`selectingCells`);function Zh(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function Qh(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function $h(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=Zh(t.$head)||eg(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function eg(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function tg(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function ng(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function rg(e,t,n){let r=e.node(-1),i=Gh.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function ig(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}var ag=class e extends O{constructor(e,t=e){let n=e.node(-1),r=Gh.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new zn(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(tg(r)&&tg(i)&&ng(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return k.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=Gh.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=ig(e,0,l)),u>0&&(e=ig(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(w.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new E(w.from(o),1,1)}replace(e,t=E.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?E.empty:t)}let i=O.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new E(w.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=Gh.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=Gh.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=Gh.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=Gh.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new og(this.$anchorCell.pos,this.$headCell.pos)}};ag.prototype.visible=!1,O.jsonID(`cell`,ag);var og=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&ng(t,n)?new ag(t,n):O.near(n,1)}};new M(`fix-tables`);function sg(e){let t=e.selection,n=$h(e),r=n.node(-1),i=n.start(-1),a=Gh.get(r);return{...t instanceof ag?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function cg(e){return function(t,n){if(!Qh(t))return!1;if(n){let r=Xh(t.schema),i=sg(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function lg(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function ug(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?cg(e):function(t,n){if(!Qh(t))return!1;if(n){let r=Xh(t.schema),i=sg(t),a=t.tr,o=lg(`row`,i,r),s=lg(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}ug(`row`,{useDeprecatedLogic:!0}),ug(`column`,{useDeprecatedLogic:!0}),ug(`cell`,{useDeprecatedLogic:!0});function dg(e,t){let n=e.selection;if(!(n instanceof ag))return!1;if(t){let r=e.tr,i=Xh(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new E(i,0,0))}),r.docChanged&&t(r)}return!0}kc({ArrowLeft:pg(`horiz`,-1),ArrowRight:pg(`horiz`,1),ArrowUp:pg(`vert`,-1),ArrowDown:pg(`vert`,1),"Shift-ArrowLeft":mg(`horiz`,-1),"Shift-ArrowRight":mg(`horiz`,1),"Shift-ArrowUp":mg(`vert`,-1),"Shift-ArrowDown":mg(`vert`,1),Backspace:dg,"Mod-Backspace":dg,Delete:dg,"Mod-Delete":dg});function fg(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function pg(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof ag)return fg(n,r,O.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=hg(i,e,t);if(o==null)return!1;if(e==`horiz`)return fg(n,r,O.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=rg(i,e,t),s;return s=a?O.near(a,1):t<0?O.near(n.doc.resolve(i.before(-1)),-1):O.near(n.doc.resolve(i.after(-1)),1),fg(n,r,s)}}}function mg(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof ag)o=a;else{let r=hg(i,e,t);if(r==null)return!1;o=new ag(n.doc.resolve(r))}let s=rg(o.$headCell,e,t);return s?fg(n,r,new ag(o.$anchorCell,s)):!1}}function hg(e,t,n){if(!(e.state.selection instanceof k))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}new M(`tableColumnResizing`);function gg(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var _g=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&tl(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(o(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(d(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(i(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(a(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(c(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(p(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(l(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(f(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Lu(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof A){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof ag){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():gg(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&s(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},vg=e=>new j({key:typeof e.pluginKey==`string`?new M(e.pluginKey):e.pluginKey,view:t=>new _g({view:t,...e})});H.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[vg({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var yg=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return mu(e,{textSerializers:hu(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(o(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(d(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(i(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(a(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(c(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(p(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(l(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(f(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){if(!this.view?.dom?.parentNode)return;let{selection:e}=this.editor.state,t=Lu(this.view,e.from,e.to);s({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},bg=e=>new j({key:typeof e.pluginKey==`string`?new M(e.pluginKey):e.pluginKey,view:t=>new yg({view:t,...e})});H.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[bg({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function xg(e,t){return e??new M(t)}var Sg=typeof window<`u`?x.useLayoutEffect:x.useEffect,Cg=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),wg=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),Tg=new Set([`children`,`className`,`style`]),Eg=new Set([`tabIndex`]),Dg=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),Og={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function kg(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function Ag(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function jg(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||Dg.has(e)}function Mg(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Ng(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:Og[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function Pg(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function Fg(e){return Eg.has(e)}function Ig(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function Lg(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function Rg(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||wg.has(e)?String(t):`${t}px`}function zg(e,t){Cg.has(t)||e.style.removeProperty(Mg(t))}function Bg(e,t,n){Cg.has(t)||e.style.setProperty(Mg(t),Rg(t,n))}function Vg(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(Tg.has(r)||!jg(r)||kg(r,t[r])||kg(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=Ag(r);if(a==null||a===!1){Fg(r)&&Lg(e,r),e.removeAttribute(o);return}if(a===!0){Fg(r)&&Ig(e,r,!0),e.setAttribute(o,``);return}if(Fg(r)){Ig(e,r,a);return}e.setAttribute(o,String(a))})}function Hg(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function Ug(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){zg(e,t);return}Bg(e,t,a)}})}function Wg(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!kg(t,n))return;let{eventName:i,options:a}=Ng(t),o=t=>{n(Pg(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function Gg(e,t){let n=(0,x.useRef)({}),r=(0,x.useRef)([]);Sg(()=>{let i=n.current;return Hg(e,i.className,t.className),Ug(e,i.style,t.style),Vg(e,i,t),r.current=Wg(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var Kg=x.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,x.useRef)(document.createElement(`div`)),f=(0,x.useRef)(xg(e,`bubbleMenu`)).current;Gg(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Ih(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,x.useRef)(h);g.current=h;let[_,v]=(0,x.useState)(!1),y=(0,x.useRef)(!0);return(0,x.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=vg({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,x.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,ne.createPortal)(c,d.current)});x.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,x.useRef)(document.createElement(`div`)),d=(0,x.useRef)(xg(e,`floatingMenu`)).current;Gg(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Ih(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,x.useRef)(m);h.current=m;let[g,_]=(0,x.useState)(!1),v=(0,x.useRef)(!0);return(0,x.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=bg({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,x.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,ne.createPortal)(s,u.current)});var qg=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]};function Jg(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Jg(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Yg(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Yg(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var Xg=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Jg(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Yg(this,e,t,n)}findIndex(e){if(e==0)return Qg(0,e);if(e==this.size)return Qg(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Qg(t+1,i):Qg(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};Xg.empty=new Xg([],0);var Zg={index:0,offset:0};function Qg(e,t){return Zg.index=e,Zg.offset=t,Zg}function $g(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!$g(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!$g(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var e_=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&$g(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};e_.none=[];var t_=class extends Error{},J=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=r_(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(n_(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(Xg.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};J.empty=new J(Xg.empty,0,0);function n_(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(n_(a.content,t-i-1,n-i-1)))}function r_(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=r_(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function i_(e,t,n){if(n.openStart>e.depth)throw new t_(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new t_(`Inconsistent open depths`);return a_(e,t,n,0)}function a_(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=a_(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return u_(a,f_(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return u_(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=p_(n,e);return u_(a,d_(e,i,o,t,r))}}function o_(e,t){if(!t.type.compatibleContent(e.type))throw new t_(`Cannot join `+t.type.name+` onto `+e.type.name)}function s_(e,t,n){let r=e.node(n);return o_(r,t.node(n)),r}function c_(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function l_(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(c_(e.nodeAfter,r),a++));for(let e=a;e<o;e++)c_(i.child(e),r);t&&t.depth==n&&t.textOffset&&c_(t.nodeBefore,r)}function u_(e,t){return e.type.checkContent(t),e.copy(t)}function d_(e,t,n,r,i){let a=e.depth>i&&s_(e,t,i+1),o=r.depth>i&&s_(n,r,i+1),s=[];return l_(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(o_(a,o),c_(u_(a,d_(e,t,n,r,i+1)),s)):(a&&c_(u_(a,f_(e,t,i+1)),s),l_(t,n,i,s),o&&c_(u_(o,f_(n,r,i+1)),s)),l_(r,null,i,s),new Xg(s)}function f_(e,t,n){let r=[];return l_(null,e,n,r),e.depth>n&&c_(u_(s_(e,t,n+1),f_(e,t,n+1)),r),l_(t,null,n,r),new Xg(r)}function p_(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Xg.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var m_=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return e_.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new v_(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=__.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else __.set(t,r=new h_);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%g_,i}},h_=class{constructor(){this.elts=[],this.i=0}},g_=12,__=new WeakMap,v_=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},y_=Object.create(null),b_=class e{constructor(e,t,n,r=e_.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Xg.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&$g(this.attrs,t||e.defaultAttrs||y_)&&e_.sameSet(this.marks,n||e_.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return J.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new J(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return i_(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return m_.resolveCached(this,e)}resolveNoCache(e){return m_.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),x_(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=Xg.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=e_.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!e_.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=Xg.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};b_.prototype.text=void 0;function x_(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var S_=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new C_(t,n);if(r.next==null)return e.empty;let i=w_(r);r.next&&r.err(`Unexpected trailing text`);let a=P_(j_(i));return F_(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return Xg.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
107
107
  `)}};S_.empty=new S_(!0);var C_=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function w_(e){let t=[];do t.push(T_(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function T_(e){let t=[];do t.push(E_(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function E_(e){let t=A_(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=O_(e,t);else break;return t}function D_(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function O_(e,t){let n=D_(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:D_(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function k_(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function A_(e){if(e.eat(`(`)){let t=w_(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=k_(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function j_(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function M_(e,t){return t-e}function N_(e,t){let n=[];return r(t),n.sort(M_);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function P_(e){let t=Object.create(null);return n(N_(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);N_(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new S_(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(M_);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function F_(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}var I_=65535,L_=2**16;function R_(e,t){return e+t*L_}function z_(e){return e&I_}function B_(e){return(e-(e&I_))/L_}var V_=1,H_=2,U_=4,W_=8,G_=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&W_)>0}get deletedBefore(){return(this.delInfo&(V_|U_))>0}get deletedAfter(){return(this.delInfo&(H_|U_))>0}get deletedAcross(){return(this.delInfo&U_)>0}},K_=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=z_(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+B_(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:R_(o/3,e-s),f=e==s?H_:e==u?V_:U_;return(t<0?e!=s:e!=u)&&(f|=W_),new G_(a,f,d)}r+=l-c}return n?e+r:new G_(e+r,0,null)}touches(e,t){let n=0,r=z_(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};K_.empty=new K_([]);var q_=Object.create(null),J_=class{getMap(){return K_.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=q_[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in q_)throw RangeError(`Duplicate use of step JSON ID `+e);return q_[e]=t,t.prototype.jsonID=e,t}},Y_=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof t_)return e.fail(t.message);throw t}}};function X_(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(X_(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return Xg.fromArray(r)}var Z_=class e extends J_{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new J(X_(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return Y_.fromReplace(e,this.from,this.to,i)}invert(){return new Q_(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};J_.jsonID(`addMark`,Z_);var Q_=class e extends J_{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new J(X_(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return Y_.fromReplace(e,this.from,this.to,n)}invert(){return new Z_(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};J_.jsonID(`removeMark`,Q_);var $_=class e extends J_{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Y_.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Y_.fromReplace(e,this.pos,this.pos+1,new J(Xg.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new ev(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};J_.jsonID(`addNodeMark`,$_);var ev=class e extends J_{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Y_.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Y_.fromReplace(e,this.pos,this.pos+1,new J(Xg.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new $_(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};J_.jsonID(`removeNodeMark`,ev);var tv=class e extends J_{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&rv(e,this.from,this.to)?Y_.fail(`Structure replace would overwrite content`):Y_.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new K_([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?J.empty:new J(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?J.empty:new J(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,J.fromJSON(t,n.slice),!!n.structure)}};tv.MAP_BIAS=1,J_.jsonID(`replace`,tv);var nv=class e extends J_{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(rv(e,this.from,this.gapFrom)||rv(e,this.gapTo,this.to)))return Y_.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Y_.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?Y_.fromReplace(e,this.from,this.to,n):Y_.fail(`Content does not fit in gap`)}getMap(){return new K_([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,J.fromJSON(t,n.slice),n.insert,!!n.structure)}};J_.jsonID(`replaceAround`,nv);function rv(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}var iv=class e extends J_{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return Y_.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return Y_.fromReplace(e,this.pos,this.pos+1,new J(Xg.from(r),0,+!t.isLeaf))}getMap(){return K_.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};J_.jsonID(`attr`,iv);var av=class e extends J_{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return Y_.ok(n)}getMap(){return K_.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};J_.jsonID(`docAttr`,av);var ov=class extends Error{};ov=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},ov.prototype=Object.create(Error.prototype),ov.prototype.constructor=ov,ov.prototype.name=`TransformError`;var sv=Object.create(null),Y=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new cv(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=J.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?J.empty:t),o==0&&vv(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),vv(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new dv(e):_v(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?_v(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):_v(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new hv(e.node(0))}static atStart(e){return _v(e,e,0,0,1)||new hv(e)}static atEnd(e){return _v(e,e,e.content.size,e.childCount,-1)||new hv(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=sv[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in sv)throw RangeError(`Duplicate use of selection JSON ID `+e);return sv[e]=t,t.prototype.jsonID=e,t}getBookmark(){return dv.between(this.$anchor,this.$head).getBookmark()}};Y.prototype.visible=!0;var cv=class{constructor(e,t){this.$from=e,this.$to=t}},lv=!1;function uv(e){!lv&&!e.parent.inlineContent&&(lv=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var dv=class e extends Y{constructor(e,t=e){uv(e),uv(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Y.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=J.empty){if(super.replace(e,t),t==J.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new fv(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=Y.findFrom(n,r,!0)||Y.findFrom(n,-r,!0);if(e)n=e.$head;else return Y.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(Y.findFrom(t,-r,!0)||Y.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};Y.jsonID(`text`,dv);var fv=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return dv.between(e.resolve(this.anchor),e.resolve(this.head))}},pv=class e extends Y{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?Y.near(a):new e(a)}content(){return new J(Xg.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new mv(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};pv.prototype.visible=!1,Y.jsonID(`node`,pv);var mv=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new fv(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&pv.isSelectable(n)?new pv(t):Y.near(t)}},hv=class e extends Y{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=J.empty){if(t==J.empty){e.delete(0,e.doc.content.size);let t=Y.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return gv}};Y.jsonID(`all`,hv);var gv={map(){return this},resolve(e){return new hv(e)}};function _v(e,t,n,r,i,a=!1){if(t.inlineContent)return dv.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=_v(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&pv.isSelectable(r))return pv.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function vv(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof tv||i instanceof nv))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(Y.near(e.doc.resolve(o),n))}function yv(e,t){return!t||!e?e:e.bind(t)}var bv=class{constructor(e,t,n){this.name=e,this.init=yv(t.init,n),this.apply=yv(t.apply,n)}};new bv(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new bv(`selection`,{init(e,t){return e.selection||Y.atStart(t.doc)},apply(e){return e.selection}}),new bv(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new bv(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});var xv=(e,t)=>{let{state:n,view:r}=e,{selection:i}=n;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0)return!1;let o=a.depth-1,s=a.node(o),c=a.index(o);if(c===0)return!1;if(s.type===t)return e.commands.lift(t.name);let l=s.child(c-1);if(l.type!==t||!l.lastChild?.isTextblock)return!1;let u=a.before(),d=u-1-1,{tr:f}=n;return f.delete(u,a.after()).insert(d,a.parent.content),f.setSelection(dv.create(f.doc,d)),r.dispatch(f.scrollIntoView()),!0},Sv=/^\s*>\s$/,Cv=U.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return qg(`blockquote`,{...V(this.options.HTMLAttributes,e),children:qg(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
108
108
  `).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
109
109
  `))}),n.join(`