decocms 4.92.2 → 4.92.3

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 (235) hide show
  1. package/dist/client/assets/{AlertCircle-Cvc_10Uv.js → AlertCircle-B9GlbKHh.js} +1 -1
  2. package/dist/client/assets/{AreaChart-D4PMIsMV.js → AreaChart-DHN9bK0l.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-Dq6JgHsq.js → ArrowUp-DNZsq7Zt.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-DgI9ki5h.js → ArrowUpRight-DZZygrAi.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-B5oIKeSF.js → CheckCircle-BEcdXH7-.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-D_W2bIqv.js → ChevronDown-BSRiDjXd.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-BnIvJcIZ.js → ChevronRight-YmTewr_B.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-Ci-XiWb6.js → ChevronUp-D5F6V6Tm.js} +1 -1
  9. package/dist/client/assets/{Copy01-Q4xZmPKp.js → Copy01-BkGYkmm-.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-Bcfqjiks.js → DotsVertical-BmTi7wpl.js} +1 -1
  11. package/dist/client/assets/{Eye-BuukW7MV.js → Eye-B-ZfWIGj.js} +1 -1
  12. package/dist/client/assets/{FilterLines-Do4UgzmV.js → FilterLines-BwWG7tAk.js} +1 -1
  13. package/dist/client/assets/{Globe01-qjaQZUfN.js → Globe01-D3vBqhI7.js} +1 -1
  14. package/dist/client/assets/{Globe04-CqIGMVDi.js → Globe04-pvxBukgJ.js} +1 -1
  15. package/dist/client/assets/{HardDrive-DrLvUMYg.js → HardDrive-DutZPQFL.js} +1 -1
  16. package/dist/client/assets/{Image01-BWotytID.js → Image01-PIeYnf-K.js} +1 -1
  17. package/dist/client/assets/{Key01-BPZUhUcV.js → Key01-DhLD806C.js} +1 -1
  18. package/dist/client/assets/{LayoutLeft-COV7zlIC.js → LayoutLeft-BI-sXAac.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-CyMOdGfe.js → LinkExternal01-DO3QnLus.js} +1 -1
  20. package/dist/client/assets/{Monitor01-dLHbd0CB.js → Monitor01-BOILvS2u.js} +1 -1
  21. package/dist/client/assets/{Package-B7Qii2Tl.js → Package-DbEcG94t.js} +1 -1
  22. package/dist/client/assets/{Palette-tVNOj7Ym.js → Palette-CyZvWKmI.js} +1 -1
  23. package/dist/client/assets/{Play-BE8nTtBp.js → Play-B8fWmOst.js} +1 -1
  24. package/dist/client/assets/{Plus-5VWQJEkS.js → Plus-2c1jULco.js} +1 -1
  25. package/dist/client/assets/{SearchLg-BiyFAMx0.js → SearchLg-XmvudKlH.js} +1 -1
  26. package/dist/client/assets/{SearchMd-LbMkvaPD.js → SearchMd-lwIiBODG.js} +1 -1
  27. package/dist/client/assets/{Settings02-CU2rilKq.js → Settings02-DMpqOK24.js} +1 -1
  28. package/dist/client/assets/{Shield01-7KT2UKvg.js → Shield01-gTFc9c17.js} +1 -1
  29. package/dist/client/assets/{Star01-D4LxiizA.js → Star01-DoUbKevt.js} +1 -1
  30. package/dist/client/assets/{Stars01-HAbkffzq.js → Stars01-CJsm_THn.js} +1 -1
  31. package/dist/client/assets/{Stars02-CdgckoDr.js → Stars02-B08FvcHQ.js} +1 -1
  32. package/dist/client/assets/{Sun-Ca3eslhz.js → Sun-nDXz4jeM.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-DNcPUv7P.js → SwitchHorizontal01-Rgis0XWf.js} +1 -1
  34. package/dist/client/assets/{Tool01-DBXzU6aR.js → Tool01-BR3IBeV9.js} +1 -1
  35. package/dist/client/assets/{Tool02-rl8XhSPG.js → Tool02-B0-a0UMl.js} +1 -1
  36. package/dist/client/assets/{Trash01-DxXosbkh.js → Trash01-Ba6bCbNY.js} +1 -1
  37. package/dist/client/assets/{TrendUp01-BmzCTIbp.js → TrendUp01-CeRF_789.js} +1 -1
  38. package/dist/client/assets/{Upload01-CXsTipbe.js → Upload01-B14IruoN.js} +1 -1
  39. package/dist/client/assets/{User01-CZgThaZQ.js → User01-ByIE6k8L.js} +1 -1
  40. package/dist/client/assets/{Users01-IdyAszrF.js → Users01-BdldAr7H.js} +1 -1
  41. package/dist/client/assets/{Users03-3HXi1aia.js → Users03-Bx4g7VTC.js} +1 -1
  42. package/dist/client/assets/{X-CLG08ht8.js → X-Dif5I5BD.js} +1 -1
  43. package/dist/client/assets/{XCircle-pZ6nD22L.js → XCircle-C0OdV3N_.js} +1 -1
  44. package/dist/client/assets/{XClose-BYq2BBpT.js → XClose-DomD4542.js} +1 -1
  45. package/dist/client/assets/{Zap-C6tkfs5m.js → Zap-CEUVQQOc.js} +1 -1
  46. package/dist/client/assets/{ZapSquare-DdKvM81Z.js → ZapSquare-EvC2T9CP.js} +1 -1
  47. package/dist/client/assets/{ZoomOut-DAAhtu2Z.js → ZoomOut-BprgOfkE.js} +1 -1
  48. package/dist/client/assets/{access-gate-B8spscer.js → access-gate-NCJKEJqO.js} +1 -1
  49. package/dist/client/assets/{add-section-modal-De0GxBTc.js → add-section-modal-DBjaDtzc.js} +1 -1
  50. package/dist/client/assets/{agent-icon-BIj6WxKp.js → agent-icon-DicjSkHu.js} +1 -1
  51. package/dist/client/assets/{agents-list-Cc-986WT.js → agents-list-Bt1R4ueI.js} +1 -1
  52. package/dist/client/assets/{ai-providers-Ck_-NP1I.js → ai-providers-TK1CCOpK.js} +1 -1
  53. package/dist/client/assets/{alert-CI7flGPF.js → alert-C_4AvGUo.js} +1 -1
  54. package/dist/client/assets/{alert-dialog-D2oa47X8.js → alert-dialog-DDtUbhoS.js} +1 -1
  55. package/dist/client/assets/{app-editor-Cn-tT-ug.js → app-editor-ptKJtHHM.js} +1 -1
  56. package/dist/client/assets/{auth-Kymy4xkz.js → auth-CsHQFHV_.js} +1 -1
  57. package/dist/client/assets/{auth-catchall-B0gQyYvu.js → auth-catchall-_TQy6GDd.js} +1 -1
  58. package/dist/client/assets/{auth-entry-Crrd0hkP.js → auth-entry-_ePf9_J1.js} +1 -1
  59. package/dist/client/assets/{auth-split-layout-BO4l9cCp.js → auth-split-layout-D9UYTbxy.js} +1 -1
  60. package/dist/client/assets/{authenticate-and-persist-oauth-DAAmwSgR.js → authenticate-and-persist-oauth-CEv4KtcH.js} +1 -1
  61. package/dist/client/assets/{automation-list-row-D-cT9rxb.js → automation-list-row-CyDHI_uf.js} +1 -1
  62. package/dist/client/assets/{automation-runs-_XAGR1m2.js → automation-runs-D8v8nlly.js} +2 -2
  63. package/dist/client/assets/{automations-Bh1OF4xf.js → automations-BoSNNWPc.js} +1 -1
  64. package/dist/client/assets/{autosend-D-JHJKNK.js → autosend-BgYoPuWD.js} +1 -1
  65. package/dist/client/assets/{avatar-1o2VQKTj.js → avatar-BVdHZbMN.js} +1 -1
  66. package/dist/client/assets/{badge-dHBIjKyY.js → badge-C_9mnuBd.js} +1 -1
  67. package/dist/client/assets/{block-document-nemKITlN.js → block-document-CcMdXbqY.js} +1 -1
  68. package/dist/client/assets/{brand-context-DSZ7O9_c.js → brand-context-B-nZCoNx.js} +1 -1
  69. package/dist/client/assets/{buckets-BDkQllTH.js → buckets-DcRE1RUQ.js} +1 -1
  70. package/dist/client/assets/{bulk-category-panel-Cn58Io0u.js → bulk-category-panel-BkJQrEio.js} +1 -1
  71. package/dist/client/assets/calendar-Bxkf6gvE.js +102 -0
  72. package/dist/client/assets/{capability-load-error-DI4Ww9LY.js → capability-load-error-i6NCyxxk.js} +1 -1
  73. package/dist/client/assets/{card-CoG27DVs.js → card-C3gg1LtP.js} +1 -1
  74. package/dist/client/assets/{category-editor-BmpcIx1s.js → category-editor-CaGAyBNX.js} +1 -1
  75. package/dist/client/assets/{chat-context-glCfFIWX.js → chat-context-DSveBxCg.js} +1 -1
  76. package/dist/client/assets/{checkbox-BOAToSlJ.js → checkbox-Ba2-hx8r.js} +1 -1
  77. package/dist/client/assets/{cli-auth-success-CqzQrYb8.js → cli-auth-success-Cc2B25iW.js} +1 -1
  78. package/dist/client/assets/{collection-detail-I0O1ME9a.js → collection-detail-D9ZCPDhA.js} +1 -1
  79. package/dist/client/assets/{collection-display-button-Bw2bFMNm.js → collection-display-button-D_kIgil2.js} +1 -1
  80. package/dist/client/assets/{collection-search-DuPY-s4R.js → collection-search-TcSAZpqK.js} +1 -1
  81. package/dist/client/assets/{collection-table-wrapper-BOKHq7cp.js → collection-table-wrapper-H4bzUKoO.js} +1 -1
  82. package/dist/client/assets/{collection-tabs-CcN3J070.js → collection-tabs-CIRa_M2W.js} +1 -1
  83. package/dist/client/assets/{command-BB6Oir8o.js → command-3z1R7bvy.js} +1 -1
  84. package/dist/client/assets/{commerce-onboarding-DejhsIyX.js → commerce-onboarding-DbQ0hYyA.js} +1 -1
  85. package/dist/client/assets/{companions-core-C-kZqiTC.js → companions-core-C68sN4Wc.js} +1 -1
  86. package/dist/client/assets/{connect-desktop-dialog-CUGIAU17.js → connect-desktop-dialog-DEEL81vf.js} +1 -1
  87. package/dist/client/assets/{connection-card-7gBTmFox.js → connection-card-D_K36Swx.js} +1 -1
  88. package/dist/client/assets/{connection-detail-BB0rtYjx.js → connection-detail-CKGrDl_p.js} +1 -1
  89. package/dist/client/assets/{connection-form-helpers-CJKig9hy.js → connection-form-helpers-DyOAEqE9.js} +1 -1
  90. package/dist/client/assets/{connections-E7mextbc.js → connections-BJO0R_-8.js} +1 -1
  91. package/dist/client/assets/{decopilot-sse-pool-DEJZ4gJu.js → decopilot-sse-pool-CEQrv8Fn.js} +1 -1
  92. package/dist/client/assets/{dialog-ChJw5xnr.js → dialog-DUqhzGiD.js} +1 -1
  93. package/dist/client/assets/{domain-settings-B6Co6UtW.js → domain-settings-CRIqu0Bs.js} +1 -1
  94. package/dist/client/assets/{drawer-_WfOhyRU.js → drawer-DvhdIHph.js} +1 -1
  95. package/dist/client/assets/{dropdown-menu-B7HOgSu8.js → dropdown-menu-D5BTIZvH.js} +1 -1
  96. package/dist/client/assets/{empty-state-kSEyPCAz.js → empty-state-BHuw6cM9.js} +1 -1
  97. package/dist/client/assets/{extract-connection-data-oUFnwuwD.js → extract-connection-data-_NDoBHMa.js} +1 -1
  98. package/dist/client/assets/{file-explorer-CnTvRnvj.js → file-explorer-CUr9mfMv.js} +1 -1
  99. package/dist/client/assets/{file-type-icon-CeQVzqDu.js → file-type-icon-BOCZKON3.js} +1 -1
  100. package/dist/client/assets/{files-CCxNqj9u.js → files-CelFf8dg.js} +1 -1
  101. package/dist/client/assets/{form-BUM27CLj.js → form-C9InGmo4.js} +1 -1
  102. package/dist/client/assets/{general-BjF2DfAd.js → general-DlHL1tW3.js} +1 -1
  103. package/dist/client/assets/{github-repo-picker-4TIPzYjR.js → github-repo-picker-Biy9UFu8.js} +1 -1
  104. package/dist/client/assets/{hooks-CJqrF4BQ.js → hooks-DU-2h9eZ.js} +1 -1
  105. package/dist/client/assets/{index-DVotD2Sm.js → index-629FAmzK.js} +1 -1
  106. package/dist/client/assets/{index-BHqz24vm.js → index-BOgwoJjn.js} +1 -1
  107. package/dist/client/assets/{index-CWlzI7M3.js → index-BQK4XWOD.js} +2 -2
  108. package/dist/client/assets/{index-CR0rMz7E.js → index-CO3868Cu.js} +1 -1
  109. package/dist/client/assets/{index-BderZvBT.js → index-Cb_X1LK0.js} +1 -1
  110. package/dist/client/assets/{index-WDnleR3r.js → index-CbhDnqOu.js} +1 -1
  111. package/dist/client/assets/{index-D6ixbRYa.js → index-Cs6hIS7C.js} +4 -4
  112. package/dist/client/assets/{index-Bj_MaVUP.js → index-DBhNC4I_.js} +1 -1
  113. package/dist/client/assets/{index-CQwS9Ezr.js → index-DivFugQC.js} +1 -1
  114. package/dist/client/assets/{index-C8rlFaFO.js → index-DmhdwAgP.js} +3 -3
  115. package/dist/client/assets/{index-DyXd0E61.js → index-DnrPO2j2.js} +1 -1
  116. package/dist/client/assets/{index-CWGwstEz.js → index-Du80fsxC.js} +1 -1
  117. package/dist/client/assets/{index-CHWLrEqX.js → index-f6gbzJ8b.js} +1 -1
  118. package/dist/client/assets/{index-B_qFi_-_.js → index-nNhZx5bw.js} +27 -27
  119. package/dist/client/assets/index-oE__K1ye.css +1 -0
  120. package/dist/client/assets/{index-redirect-CZuVtK8Y.js → index-redirect-hJFu02mm.js} +1 -1
  121. package/dist/client/assets/{input-CWExGH7j.js → input-TkvVVsQL.js} +1 -1
  122. package/dist/client/assets/{integration-icon-BXEpLE2r.js → integration-icon-CWb3OXTV.js} +1 -1
  123. package/dist/client/assets/{invite-member-dialog-Cj35CA_W.js → invite-member-dialog-BA1mFY2X.js} +1 -1
  124. package/dist/client/assets/{label-BbLr7wPS.js → label-CB2o7dZ2.js} +1 -1
  125. package/dist/client/assets/{layout-yKsHfaYu.js → layout-CqMMMVMm.js} +1 -1
  126. package/dist/client/assets/{login-g6Yf2A86.js → login-B0EX352Z.js} +1 -1
  127. package/dist/client/assets/{mcp-oauth-B2KaqQoI.js → mcp-oauth-B5rKpHdd.js} +1 -1
  128. package/dist/client/assets/{members-yX31omZQ.js → members-Ds_Onv02.js} +1 -1
  129. package/dist/client/assets/{monaco-editor-CJKnQM68.js → monaco-editor-DfuNvLfy.js} +1 -1
  130. package/dist/client/assets/{monitoring-stats-row-DTqvYy56.js → monitoring-stats-row-B43TP1bq.js} +1 -1
  131. package/dist/client/assets/{multi-select-C9lH7lr4.js → multi-select-DhXl88EK.js} +1 -1
  132. package/dist/client/assets/{oauth-callback-DPu8Jv31.js → oauth-callback-CZ8I3e9V.js} +1 -1
  133. package/dist/client/assets/{oauth-callback-ai-provider-DXhgROtl.js → oauth-callback-ai-provider-BiKjtCpj.js} +1 -1
  134. package/dist/client/assets/{onboarding-b8UESLyK.js → onboarding-U4YqP9I9.js} +1 -1
  135. package/dist/client/assets/{org-install-DFTAzRMO.js → org-install-BYDat95r.js} +1 -1
  136. package/dist/client/assets/{org-layout-BbjFIQ-M.js → org-layout-CVqWtNQa.js} +1 -1
  137. package/dist/client/assets/{organization-choice-DjVV9MCZ.js → organization-choice-CkG6QFWH.js} +1 -1
  138. package/dist/client/assets/{orgs-B1jGApXW.js → orgs-B4DrO8iC.js} +1 -1
  139. package/dist/client/assets/{page-seo-form-DeD_2a8R.js → page-seo-form-8ToiuKnD.js} +1 -1
  140. package/dist/client/assets/page-seo-sheet-BTyypxho.js +1 -0
  141. package/dist/client/assets/{popover-kOy_asOa.js → popover-DwV6WXHS.js} +1 -1
  142. package/dist/client/assets/{post-editor-BZQdhdwo.js → post-editor-j9JAXwQN.js} +1 -1
  143. package/dist/client/assets/{primitives-Cyz_TV23.js → primitives-RdkZFzQM.js} +1 -1
  144. package/dist/client/assets/{profile-D5HUGTyF.js → profile-DwVJzm_R.js} +1 -1
  145. package/dist/client/assets/project-app-view-e40sJb24.js +1 -0
  146. package/dist/client/assets/record-editor-BBPLTix7.js +1 -0
  147. package/dist/client/assets/redirect-editor-C8EDxpmx.js +1 -0
  148. package/dist/client/assets/registry-CFSvMZwJ.js +2 -0
  149. package/dist/client/assets/{registry-layout-JPmaR-tb.js → registry-layout-C2NoRJs0.js} +2 -2
  150. package/dist/client/assets/{reports-Btc-1oN-.js → reports-J4B5GOoc.js} +1 -1
  151. package/dist/client/assets/{require-capability-BBszzyH9.js → require-capability-DnfzULDW.js} +1 -1
  152. package/dist/client/assets/{required-auth-layout-CR5_YK6W.js → required-auth-layout-ABsqitxw.js} +1 -1
  153. package/dist/client/assets/{reset-password-u9Nbv0bS.js → reset-password-CbrThkFS.js} +1 -1
  154. package/dist/client/assets/{roles-B7bUsR2h.js → roles-BqueMkJJ.js} +1 -1
  155. package/dist/client/assets/{search-input-B6akQV4Y.js → search-input-B-RkAjzQ.js} +1 -1
  156. package/dist/client/assets/{secrets-Dsj3iy5H.js → secrets-CEZOniOS.js} +1 -1
  157. package/dist/client/assets/{sections-editor-CvIj0bPs.js → sections-editor-BW9cZUKJ.js} +1 -1
  158. package/dist/client/assets/{select-4-vdHbLT.js → select-AzuoAc3H.js} +1 -1
  159. package/dist/client/assets/{select-model-CVcEVUsi.js → select-model-BAk08l-M.js} +1 -1
  160. package/dist/client/assets/{self-tool-result-Cwdk21K_.js → self-tool-result-C94YNykg.js} +1 -1
  161. package/dist/client/assets/{seo-editor-B0_qMHl0.js → seo-editor-CR8P7sfk.js} +1 -1
  162. package/dist/client/assets/{settings-layout-BURikhtl.js → settings-layout-9yQD_m0n.js} +1 -1
  163. package/dist/client/assets/{settings-section-DxqR9iml.js → settings-section-CNVe03BK.js} +1 -1
  164. package/dist/client/assets/{shell-controls-DYq3DSuV.js → shell-controls-5d4ZCRmi.js} +1 -1
  165. package/dist/client/assets/{shell-layout-DvMdeukx.js → shell-layout-6KUu0MA6.js} +1 -1
  166. package/dist/client/assets/{sidebar-AfeWMY1r.js → sidebar-DnKMI8jz.js} +1 -1
  167. package/dist/client/assets/{skeleton-DraYvTQP.js → skeleton-xDZ5Iwb8.js} +1 -1
  168. package/dist/client/assets/{sso-DWBNvY6X.js → sso-DNsZ7Hie.js} +1 -1
  169. package/dist/client/assets/{store-BFhYLhoT.js → store-BoCHTDSB.js} +1 -1
  170. package/dist/client/assets/store-registry-WZUtBjlh.js +2 -0
  171. package/dist/client/assets/{studio-tools-B3FHZXsQ.js → studio-tools-DIWsVaKg.js} +1 -1
  172. package/dist/client/assets/{switch-CyZjNvfZ.js → switch-DS9vYGS-.js} +1 -1
  173. package/dist/client/assets/{table-iG6kCmeS.js → table-DnoPpUup.js} +1 -1
  174. package/dist/client/assets/{tabs-C1LpzuaJ.js → tabs-2srR2H7A.js} +1 -1
  175. package/dist/client/assets/{textarea-B8dhUfp9.js → textarea-DjtAtA2l.js} +1 -1
  176. package/dist/client/assets/{toggle-group-c5TjS6xS.js → toggle-group-DGvoaiio.js} +1 -1
  177. package/dist/client/assets/{toolbar-Daz4jqLs.js → toolbar-CvkbyWaX.js} +1 -1
  178. package/dist/client/assets/{toolbar-icon-button-Bbbo7hyv.js → toolbar-icon-button-Cr-N30KB.js} +1 -1
  179. package/dist/client/assets/{tooltip-DE_gqCm3.js → tooltip-cvFTpZ9W.js} +1 -1
  180. package/dist/client/assets/{use-ai-providers-CGzSWtp7.js → use-ai-providers-ZLuBEaKb.js} +1 -1
  181. package/dist/client/assets/{use-automations-Btiu7Z09.js → use-automations-COcieFX-.js} +1 -1
  182. package/dist/client/assets/{use-autosave-DphOvxb9.js → use-autosave-C46oRXRb.js} +1 -1
  183. package/dist/client/assets/{use-capability-BNcFOggs.js → use-capability-3dRU8tE2.js} +1 -1
  184. package/dist/client/assets/{use-clock-tick-Dw7sAB29.js → use-clock-tick-BzcS25hV.js} +1 -1
  185. package/dist/client/assets/{use-collections-u5tkBX1a.js → use-collections-DaXoNaLL.js} +1 -1
  186. package/dist/client/assets/{use-connection-CcmTBTY-.js → use-connection-DM1ROgj3.js} +1 -1
  187. package/dist/client/assets/{use-copy-CveeH2p4.js → use-copy-DC217syR.js} +1 -1
  188. package/dist/client/assets/{use-create-virtual-mcp-jvSmQNTU.js → use-create-virtual-mcp-Clu62lnk.js} +1 -1
  189. package/dist/client/assets/{use-debounced-autosave-DFle-8Sb.js → use-debounced-autosave-DYog9M6N.js} +1 -1
  190. package/dist/client/assets/{use-debounced-value-D1xFGN32.js → use-debounced-value-CSp0_yRg.js} +1 -1
  191. package/dist/client/assets/{use-deco-credits-CV7sw9Em.js → use-deco-credits-Bm6Hzrca.js} +1 -1
  192. package/dist/client/assets/{use-decopilot-events-VInARyiN.js → use-decopilot-events-CX_EuT5c.js} +1 -1
  193. package/dist/client/assets/{use-delete-connection-DDV7XY4a.js → use-delete-connection-CxGr7t4A.js} +1 -1
  194. package/dist/client/assets/{use-deployment-admin-h9tth1Ey.js → use-deployment-admin-C6-1CBki.js} +1 -1
  195. package/dist/client/assets/{use-file-configs-BEHJ-b8Q.js → use-file-configs-DASxzk9O.js} +1 -1
  196. package/dist/client/assets/{use-infinite-scroll-BI8YTyTt.js → use-infinite-scroll-XidGSyic.js} +1 -1
  197. package/dist/client/assets/{use-join-requests-V5rMqfIc.js → use-join-requests-CjypbTMc.js} +1 -1
  198. package/dist/client/assets/{use-mcp-auth-status-DINFEYgi.js → use-mcp-auth-status-BpAt0IbR.js} +1 -1
  199. package/dist/client/assets/{use-mcp-client-PcphUWIj.js → use-mcp-client-DseZ3Mea.js} +1 -1
  200. package/dist/client/assets/{use-mcp-tools-CakNulXp.js → use-mcp-tools-DJGNLf9H.js} +1 -1
  201. package/dist/client/assets/{use-members-JooO5O_z.js → use-members-CncY3QG2.js} +1 -1
  202. package/dist/client/assets/{use-mobile-C57pT7o9.js → use-mobile-D8w2xyip.js} +1 -1
  203. package/dist/client/assets/{use-navigate-to-agent-DVHUkqpb.js → use-navigate-to-agent-YScxPu5L.js} +1 -1
  204. package/dist/client/assets/{use-org-auth-client-C0qPMRhc.js → use-org-auth-client-DjREcL_I.js} +1 -1
  205. package/dist/client/assets/{use-org-sso-BaYh30WC.js → use-org-sso-diAgeADE.js} +1 -1
  206. package/dist/client/assets/{use-organization-roles-BG6jMK7e.js → use-organization-roles-BuFi-QNO.js} +1 -1
  207. package/dist/client/assets/{use-organization-settings-DBhnNnJm.js → use-organization-settings-bBY4klS6.js} +1 -1
  208. package/dist/client/assets/{use-registry-app-Dyfesgrg.js → use-registry-app-Cy7ipz7c.js} +1 -1
  209. package/dist/client/assets/{use-registry-connections-CTtHQqlB.js → use-registry-connections-BZ0Z0jCg.js} +1 -1
  210. package/dist/client/assets/{use-secrets-BYzFSfMf.js → use-secrets-q_kPvC5B.js} +1 -1
  211. package/dist/client/assets/{use-status-sounds-DJxvpKl9.js → use-status-sounds-DG0Zyz9B.js} +1 -1
  212. package/dist/client/assets/use-t-BjZG1zRp.js +1 -0
  213. package/dist/client/assets/{use-view-mode-C0yNdLzJ.js → use-view-mode-B02hzmMj.js} +1 -1
  214. package/dist/client/assets/{use-virtual-mcp-BtFe5DoR.js → use-virtual-mcp-urYy02xb.js} +1 -1
  215. package/dist/client/assets/useInfiniteQuery-nK_JPgM8.js +1 -0
  216. package/dist/client/assets/{useRouterState-C6jzqArr.js → useRouterState-C7tRHRC7.js} +1 -1
  217. package/dist/client/assets/useSuspenseInfiniteQuery-_ObcRUnC.js +1 -0
  218. package/dist/client/assets/{users-C0dY9LVq.js → users-CZVOiXsq.js} +1 -1
  219. package/dist/client/assets/{variant-calendar-FpbApEV2.js → variant-calendar-DibyF3zD.js} +1 -1
  220. package/dist/client/assets/{view-mode-toggle-DwdmtuKb.js → view-mode-toggle-DziN7a9n.js} +1 -1
  221. package/dist/client/index.html +2 -2
  222. package/dist/server/cli.js +418 -418
  223. package/dist/server/server.js +288 -288
  224. package/package.json +1 -1
  225. package/dist/client/assets/calendar-C9b1I5Xh.js +0 -102
  226. package/dist/client/assets/index-DxTnZ0Oo.css +0 -1
  227. package/dist/client/assets/page-seo-sheet-BWnl0tVz.js +0 -1
  228. package/dist/client/assets/project-app-view-Bsaa-6LK.js +0 -1
  229. package/dist/client/assets/record-editor-Bjgurgfp.js +0 -1
  230. package/dist/client/assets/redirect-editor-DnT7ef0C.js +0 -1
  231. package/dist/client/assets/registry-DHjmo34d.js +0 -2
  232. package/dist/client/assets/store-registry-C50_5LUp.js +0 -2
  233. package/dist/client/assets/use-t-BeHordU2.js +0 -1
  234. package/dist/client/assets/useInfiniteQuery-mNPfD3Pk.js +0 -1
  235. package/dist/client/assets/useSuspenseInfiniteQuery-DIVSilzv.js +0 -1
@@ -0,0 +1,102 @@
1
+ import{r as A,bM as us,bN as Ll,j as b,at as jl,aM as ut,bO as Vl,c as ds,l as nt,bP as Fi}from"./index-DmhdwAgP.js";import{u as Wl}from"./use-t-BjZG1zRp.js";import{x as $l}from"./agent-icon-DicjSkHu.js";import{i as ql}from"./ChevronRight-YmTewr_B.js";function Hl(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function ib(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function ob(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function U(n){this.content=n}U.prototype={constructor:U,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new U(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new U(t)},addToStart:function(n,e){return new U([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new U(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new U(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=U.from(n),n.size?new U(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=U.from(n),n.size?new U(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=U.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};U.from=function(n){if(n instanceof U)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new U(e)};function fs(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=fs(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function hs(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){t-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:t,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||a.content.size){let c=hs(s.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}class v{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let s=0,a=0;a<t;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",s=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new v(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,s=0;s<t;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,t-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,t-s-1))),r.push(a),i+=a.nodeSize),s=l}return new v(r,i)}cutByIndex(e,t){return e==t?v.empty:e==0&&t==this.content.length?this:new v(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new v(i,o)}addToStart(e){return new v([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new v(this.content.concat(e),this.size+e.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 new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return fs(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return hs(this,e,t,r)}findIndex(e){if(e==0)return mn(0,e);if(e==this.size)return mn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),o=r+i.nodeSize;if(o>=e)return o==e?mn(t+1,o):mn(t,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return v.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new v(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return v.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new v(t||e,r)}static from(e){if(!e)return v.empty;if(e instanceof v)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new v([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}v.empty=new v([],0);const ir={index:0,offset:0};function mn(n,e){return ir.index=n,ir.offset=e,ir}function Dn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Dn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Dn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let j=class Tr{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||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&&Dn(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 new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Tr.none;if(e instanceof Tr)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};j.none=[];class En extends Error{}class S{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=ms(this.content,e+this.openStart,t);return r&&new S(r,this.openStart,this.openEnd)}removeBetween(e,t){return new S(ps(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return S.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new S(v.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new S(e,r,i)}}S.empty=new S(v.empty,0,0);function ps(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:a}=n.findIndex(t);if(i==e||o.isText){if(a!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(ps(o.content,e-i-1,t-i-1)))}function ms(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=ms(s.content,e-o-1,t,s);return a&&n.replaceChild(i,s.copy(a))}function Jl(n,e,t){if(t.openStart>n.depth)throw new En("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new En("Inconsistent open depths");return gs(n,e,t,0)}function gs(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=gs(n,e,t,r+1);return o.copy(o.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,a=s.content;return at(s,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=Yl(t,n);return at(o,bs(n,s,a,e,r))}else return at(o,Tn(n,e,r))}function ys(n,e){if(!e.type.compatibleContent(n.type))throw new En("Cannot join "+e.type.name+" onto "+n.type.name)}function Or(n,e,t){let r=n.node(t);return ys(r,e.node(t)),r}function st(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Ht(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(st(n.nodeAfter,r),o++));for(let a=o;a<s;a++)st(i.child(a),r);e&&e.depth==t&&e.textOffset&&st(e.nodeBefore,r)}function at(n,e){return n.type.checkContent(e),n.copy(e)}function bs(n,e,t,r,i){let o=n.depth>i&&Or(n,e,i+1),s=r.depth>i&&Or(t,r,i+1),a=[];return Ht(null,n,i,a),o&&s&&e.index(i)==t.index(i)?(ys(o,s),st(at(o,bs(n,e,t,r,i+1)),a)):(o&&st(at(o,Tn(n,e,i+1)),a),Ht(e,t,i,a),s&&st(at(s,Tn(t,r,i+1)),a)),Ht(r,null,i,a),new v(a)}function Tn(n,e,t){let r=[];if(Ht(null,n,t,r),n.depth>t){let i=Or(n,e,t+1);st(at(i,Tn(n,e,t+1)),r)}return Ht(e,null,t,r),new v(r)}function Yl(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(v.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Gt{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,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 new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}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 r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return j.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}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 r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new On(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1}return new Gt(t,r,o)}static resolveCached(e,t){let r=zi.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==t)return s}else zi.set(e,r=new Ul);let i=r.elts[r.i]=Gt.resolve(e,t);return r.i=(r.i+1)%Kl,i}}class Ul{constructor(){this.elts=[],this.i=0}}const Kl=12,zi=new WeakMap;class On{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Gl=Object.create(null);class be{constructor(e,t,r,i=j.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||v.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,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Dn(this.attrs,t||e.defaultAttrs||Gl)&&j.sameSet(this.marks,r||j.none)}copy(e=null){return e==this.content?this:new be(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new be(this.type,this.attrs,this.content,e)}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,r=!1){if(e==t)return S.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),a=i.start(s),c=i.node(s).content.cut(i.pos-a,o.pos-a);return new S(c,i.depth-s,o.depth-s)}replace(e,t,r){return Jl(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Gt.resolveCached(this,e)}resolveNoCache(e){return Gt.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),xs(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=v.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,t);return s?s.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=j.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!j.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=v.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}}be.prototype.text=void 0;class An extends be{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):xs(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(e){return e==this.marks?this:new An(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new An(this.type,this.attrs,e,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 xs(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class dt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Xl(e,t);if(r.next==null)return dt.empty;let i=vs(r);r.next&&r.err("Unexpected trailing text");let o=ic(rc(i));return oc(o,r),o}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,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type: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 r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!t||l.validEnd))return v.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=o(d,a.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
2
+ `)}}dt.empty=new dt(!0);class Xl{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 new SyntaxError(e+" (in content expression '"+this.string+"')")}}function vs(n){let e=[];do e.push(Ql(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Ql(n){let e=[];do e.push(Zl(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Zl(n){let e=nc(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=ec(n,e);else break;return e}function Li(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function ec(n,e){let t=Li(n),r=t;return n.eat(",")&&(n.next!="}"?r=Li(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function tc(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function nc(n){if(n.eat("(")){let e=vs(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=tc(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function rc(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=o(s.exprs[l],a);if(l==s.exprs.length-1)return c;i(c,a=t())}else if(s.type=="star"){let l=t();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=t();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=t();i(o(s.expr,l),u),l=u}if(s.max==-1)i(o(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=t();r(l,u),i(o(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function ks(n,e){return e-n}function ji(n,e){let t=[];return r(e),t.sort(ks);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&t.indexOf(l)==-1&&r(l)}}}function ic(n){let e=Object.create(null);return t(ji(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);ji(n,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new dt(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(ks);o.next.push({type:i[s][0],next:e[a.join(",")]||t(a)})}return o}}function oc(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ws(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Ss(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Ms(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Cs(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ac(n,r,e[r]);return t}let Vi=class Ns{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Cs(e,r.attrs),this.defaultAttrs=ws(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==dt.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:Ss(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new be(this,this.computeAttrs(e),v.from(t),j.setFrom(r))}createChecked(e=null,t,r){return t=v.from(t),this.checkContent(t),new be(this,this.computeAttrs(e),t,j.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=v.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(v.empty,!0);return o?new be(this,e,t.append(o),j.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ms(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 r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:j.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Ns(o,t,s));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function sc(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class ac{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?sc(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class $n{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Cs(e,i.attrs),this.excluded=null;let o=ws(this.attrs);this.instance=o?new j(this,o):null}create(e=null){return!e&&this.instance?this.instance:new j(this,Ss(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new $n(o,i++,t,s)),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){Ms(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Ds{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=U.from(e.nodes),t.marks=U.from(e.marks||{}),this.nodes=Vi.compile(this.spec.nodes,this),this.marks=$n.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=dt.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?Wi(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Wi(this,s.split(" "))}this.nodeFromJSON=i=>be.fromJSON(this,i),this.markFromJSON=i=>j.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Vi){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new An(r,r.defaultAttrs,e,j.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 new RangeError("Unknown node type: "+e);return t}}function Wi(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function lc(n){return n.tag!=null}function cc(n){return n.style!=null}class He{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(lc(i))this.tags.push(i);else if(cc(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new qi(this,t,!1);return r.addAll(e,j.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new qi(this,t,!0);return r.addAll(e,j.none,t.from,t.to),S.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(fc(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(s.getAttrs){let l=s.getAttrs(t);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let a=t[s];if((a.priority==null?50:a.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Hi(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Hi(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new He(e,He.schemaRules(e)))}}const Es={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},uc={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ts={ol:!0,ul:!0},Xt=1,Ar=2,Jt=4;function $i(n,e,t){return e!=null?(e?Xt:0)|(e==="full"?Ar:0):n&&n.whitespace=="pre"?Xt|Ar:t&~Jt}class gn{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=j.none,this.match=o||(s&Jt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(v.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Xt)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=v.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(v.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&&!Es.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class qi{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,s=$i(null,t.preserveWhitespace,0)|(r?Jt:0);i?o=new gn(i.type,i.attrs,j.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new gn(null,null,j.none,!0,null,s):o=new gn(e.schema.topNodeType,null,j.none,!0,null,s),this.nodes=[o],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 r=e.nodeValue,i=this.top,o=i.options&Ar?"full":this.localPreserveWS||(i.options&Xt)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
3
+ `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(s.text(a[l]),t,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;Ts.hasOwnProperty(s)&&this.parser.normalizeLists&&dc(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:uc.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(Es.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,t.attrs||null,r,t.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,o=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)t=this.enterInner(i[s],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=j.none;for(let a of i.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):Ji(a.type,e.type))&&(s=a.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r,!1);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=$i(e,o,s.options);s.options&Jt&&s.content.length==0&&(a|=Jt);let l=j.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Ji(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new gn(e,t,l,i,null,a)),this.open++,r}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;this.localPreserveWS&&(this.nodes[t].options|=Xt)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].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,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].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("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function dc(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ts.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function fc(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Hi(n){let e={};for(let t in n)e[t]=n[t];return e}function Ji(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class gt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=or(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,t);u&&(o.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=Sn(or(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Sn(or(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Sn(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new gt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Yi(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Yi(e.marks)}}function Yi(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function or(n){return n.document||window.document}const Ui=new WeakMap;function hc(n){let e=Ui.get(n);return e===void 0&&Ui.set(n,e=pc(n)),e}function pc(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function Sn(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=hc(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=Sn(n,f,t,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const Os=65535,As=Math.pow(2,16);function mc(n,e){return n+e*As}function Ki(n){return n&Os}function gc(n){return(n-(n&Os))/As}const Ps=1,Rs=2,Mn=4,Is=8;class Pr{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Is)>0}get deletedBefore(){return(this.delInfo&(Ps|Mn))>0}get deletedAfter(){return(this.delInfo&(Rs|Mn))>0}get deletedAcross(){return(this.delInfo&Mn)>0}}class ce{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ce.empty)return ce.empty}recover(e){let t=0,r=Ki(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+gc(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+o],u=this.ranges[a+s],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:t:t,h=l+i+(f<0?0:u);if(r)return h;let p=e==(t<0?l:d)?null:mc(a/3,e-l),g=e==l?Rs:e==d?Ps:Mn;return(t<0?e!=l:e!=d)&&(g|=Is),new Pr(h,g,p)}i+=u-c}return r?e+i:new Pr(e+i,0,null)}touches(e,t){let r=0,i=Ki(t),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+o],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),c=this.ranges[i+t],u=this.ranges[i+r];e(a,a+c,l,l+u),o+=u-c}}invert(){return new ce(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ce.empty:new ce(e<0?[0,-e,0]:[0,0,e])}}ce.empty=new ce([]);class Pn{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Pn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i: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=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Pn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],a=s.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Pr(e,i,null)}}const sr=Object.create(null);class ee{getMap(){return ce.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=sr[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in sr)throw new RangeError("Duplicate use of step JSON ID "+e);return sr[e]=t,t.prototype.jsonID=e,t}}class ${constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new $(e,null)}static fail(e){return new $(null,e)}static fromReplace(e,t,r,i){try{return $.ok(e.replace(t,r,i))}catch(o){if(o instanceof En)return $.fail(o.message);throw o}}}function Gr(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Gr(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return v.fromArray(r)}class We extends ee{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new S(Gr(t.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return $.fromReplace(e,this.from,this.to,o)}invert(){return new ge(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new We(t.pos,r.pos,this.mark)}merge(e){return e instanceof We&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new We(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new We(t.from,t.to,e.markFromJSON(t.mark))}}ee.jsonID("addMark",We);class ge extends ee{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new S(Gr(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return $.fromReplace(e,this.from,this.to,r)}invert(){return new We(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ge(t.pos,r.pos,this.mark)}merge(e){return e instanceof ge&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ge(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ge(t.from,t.to,e.markFromJSON(t.mark))}}ee.jsonID("removeMark",ge);class $e extends ee{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return $.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return $.fromReplace(e,this.pos,this.pos+1,new S(v.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new $e(this.pos,t.marks[i]);return new $e(this.pos,this.mark)}}return new ft(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new $e(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new $e(t.pos,e.markFromJSON(t.mark))}}ee.jsonID("addNodeMark",$e);class ft extends ee{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return $.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return $.fromReplace(e,this.pos,this.pos+1,new S(v.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new $e(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ft(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ft(t.pos,e.markFromJSON(t.mark))}}ee.jsonID("removeNodeMark",ft);class W extends ee{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Rr(e,this.from,this.to)?$.fail("Structure replace would overwrite content"):$.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ce([this.from,this.to-this.from,this.slice.size])}invert(e){return new W(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&W.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new W(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof W)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?S.empty:new S(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new W(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?S.empty:new S(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new W(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new W(t.from,t.to,S.fromJSON(e,t.slice),!!t.structure)}}W.MAP_BIAS=1;ee.jsonID("replace",W);class J extends ee{constructor(e,t,r,i,o,s,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Rr(e,this.from,this.gapFrom)||Rr(e,this.gapTo,this.to)))return $.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return $.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?$.fromReplace(e,this.from,this.to,r):$.fail("Content does not fit in gap")}getMap(){return new ce([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new J(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new J(t.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new J(t.from,t.to,t.gapFrom,t.gapTo,S.fromJSON(e,t.slice),t.insert,!!t.structure)}}ee.jsonID("replaceAround",J);function Rr(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function yc(n,e,t,r){let i=[],o=[],s,a;n.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,t),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=h:i.push(s=new ge(f,h,d[g])));a&&a.to==f?a.to=h:o.push(a=new We(f,h,r))}}),i.forEach(l=>n.step(l)),o.forEach(l=>n.step(l))}function bc(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof $n){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,t);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==o-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=o):i.push({style:d,from:Math.max(a,e),to:c,step:o})}}}),i.forEach(s=>n.step(new ge(s.from,s.to,s.style)))}function Xr(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new W(a,u,S.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new ge(a,u,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new S(v.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new W(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(v.empty,!0);n.replace(a,a,new S(l,0,0))}for(let l=s.length-1;l>=0;l--)n.step(s[l])}function xc(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function _t(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,o=0;;--r){let s=n.$from.node(r),a=n.$from.index(r)+i,l=n.$to.indexAfter(r)-o;if(r<n.depth&&s.canReplace(a,l,t))return r;if(r==0||s.type.spec.isolating||!xc(s,a,l))break;a&&(i=1),l<s.childCount&&(o=1)}return null}function vc(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,c=a,u=v.empty,d=0;for(let p=o,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,u=v.from(r.node(p).copy(u)),d++):l--;let f=v.empty,h=0;for(let p=o,g=!1;p>t;p--)g||i.after(p+1)<i.end(p)?(g=!0,f=v.from(i.node(p).copy(f)),h++):c++;n.step(new J(l,c,s,a,new S(u.append(f),d,h),u.size-d,!0))}function Qr(n,e,t=null,r=n){let i=kc(n,e),o=i&&wc(r,e);return o?i.map(Gi).concat({type:e,attrs:t}).concat(o.map(Gi)):null}function Gi(n){return{type:n,attrs:null}}function kc(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function wc(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:s}function Sc(n,e,t){let r=v.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let a=t[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=v.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new J(i,o,i,o,new S(r,0,0),t.length,!0))}function Mc(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&Cc(n.doc,n.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Bs(n,s,a,o),Xr(n,n.mapping.slice(o).map(a,1),r,void 0,c===null);let u=n.mapping.slice(o),d=u.map(a,1),f=u.map(a+s.nodeSize,1);return n.step(new J(d,f,d+1,f-1,new S(v.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&_s(n,s,a,o),!1}})}function _s(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Bs(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(`
5
+ `))}})}function Cc(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Nc(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new J(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new S(v.from(s),0,0),1,!0))}function Ie(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>o;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function Dc(n,e,t=1,r){let i=n.doc.resolve(e),o=v.empty,s=v.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){o=v.from(i.node(a).copy(o));let u=r&&r[c];s=v.from(u?u.type.create(u.attrs,s):i.node(a).copy(s))}n.step(new W(e,e,new S(o.append(s),t,t),!0))}function Ge(n,e){let t=n.resolve(e),r=t.index();return Fs(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Ec(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function Fs(n,e){return!!(n&&e&&!n.isLeaf&&Ec(n,e))}function qn(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&Fs(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Tc(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let a=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Bs(n,u.node(),u.before(),a)}s.inlineContent&&Xr(n,e+t-1,s,o.node().contentMatchAt(o.index()),r==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new W(c,l.map(e+t,-1),S.empty,!0)),r===!0){let u=n.doc.resolve(c);_s(n,u.node(),u.before(),n.steps.length)}return n}function Oc(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function Ac(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(o==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Hn(n,e,t=e,r=S.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return zs(i,o,r)?new W(e,t,r):new Pc(i,o,r).fit()}function zs(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Pc{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=v.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=v.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new S(o,s,a);return e>-1?new J(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new W(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=ar(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(t==1&&(s?c.matchType(s.type)||(d=c.fillBefore(v.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:d};if(t==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=ar(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new S(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=ar(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new S(Vt(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new S(Vt(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));d=d.matchFragment(i)}let h=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let g=a.child(c),m=d.matchType(g.type);if(!m)break;c++,(c>1||l==0||g.content.size)&&(d=m,u.push(Ls(g.mark(f.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=Wt(this.placed,t,v.from(u)),this.frontier[t].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=a;g<h;g++){let y=m.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),m=y.content}this.unplaced=p?e==0?S.empty:new S(Vt(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new S(Vt(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!lr(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=lr(e,t,i,r,o);if(s){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=lr(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Wt(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Wt(this.placed,this.depth,v.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(v.empty,!0);t.childCount&&(this.placed=Wt(this.placed,this.frontier.length,t))}}function Vt(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Vt(n.firstChild.content,e-1,t)))}function Wt(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Wt(n.lastChild.content,e-1,t)))}function ar(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Ls(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Ls(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(v.empty,!0)))),n.copy(r)}function lr(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!Rc(t,o.content,s)?a:null}function Rc(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Ic(n){return n.spec.defining||n.spec.definingForContent}function _c(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(zs(i,o,r))return n.step(new W(e,t,r));let s=Vs(i,o);s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?a=f:i.before(f)==h&&s.splice(1,0,-f)}let l=s.indexOf(a),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=Ic(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(a)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let g=0;g<s.length;g++){let m=s[(g+l)%s.length],y=!0;m<0&&(y=!1,m=-m);let x=i.node(m-1),w=i.index(m-1);if(x.canReplaceWith(w,w,p.type,p.marks))return n.replace(i.before(m),y?o.after(m):t,new S(js(r.content,0,r.openStart,h),h,r.openEnd))}}let d=n.steps.length;for(let f=s.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let h=s[f];h<0||(e=i.before(h),t=o.after(h))}}function js(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(js(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(v.empty,!0))}return n}function Bc(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Oc(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new S(v.from(r),0,0))}function Fc(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let s=r.sharedDepth(t),a=!1;for(let l=r.depth;l>s;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>s;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&t==i.start(l);l--)t=i.before(l);r=n.doc.resolve(e),i=n.doc.resolve(t)}}let o=Vs(r,i);for(let s=0;s<o.length;s++){let a=o[s],l=s==o.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function Vs(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Dt extends ee{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return $.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return $.fromReplace(e,this.pos,this.pos+1,new S(v.from(i),0,t.isLeaf?0:1))}getMap(){return ce.empty}invert(e){return new Dt(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Dt(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Dt(t.pos,t.attr,t.value)}}ee.jsonID("attr",Dt);class Qt extends ee{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return $.ok(r)}getMap(){return ce.empty}invert(e){return new Qt(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Qt(t.attr,t.value)}}ee.jsonID("docAttr",Qt);let Tt=class extends Error{};Tt=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Tt.prototype=Object.create(Error.prototype);Tt.prototype.constructor=Tt;Tt.prototype.name="TransformError";class Ws{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Pn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Tt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((o,s,a,l)=>{e=Math.min(e,a),t=Math.max(t,l)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=S.empty){let i=Hn(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new S(v.from(r),0,0))}delete(e,t){return this.replace(e,t,S.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return _c(this,e,t,r),this}replaceRangeWith(e,t,r){return Bc(this,e,t,r),this}deleteRange(e,t){return Fc(this,e,t),this}lift(e,t){return vc(this,e,t),this}join(e,t=1){return Tc(this,e,t),this}wrap(e,t){return Sc(this,e,t),this}setBlockType(e,t=e,r,i=null){return Mc(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Nc(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Dt(e,t,r)),this}setDocAttribute(e,t){return this.step(new Qt(e,t)),this}addNodeMark(e,t){return this.step(new $e(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof j)t.isInSet(r.marks)&&this.step(new ft(e,t));else{let i=r.marks,o,s=[];for(;o=t.isInSet(i);)s.push(new ft(e,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,t=1,r){return Dc(this,e,t,r),this}addMark(e,t,r){return yc(this,e,t,r),this}removeMark(e,t,r){return bc(this,e,t,r),this}clearIncompatible(e,t,r){return Xr(this,e,t,r),this}}const cr=Object.create(null);class B{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new zc(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=S.empty){let r=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(o);e.replaceRange(u.map(l.pos),u.map(c.pos),a?S.empty:t),a==0&&Zi(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Zi(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new I(e):Mt(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?Mt(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):Mt(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ue(e.node(0))}static atStart(e){return Mt(e,e,0,0,1)||new ue(e)}static atEnd(e){return Mt(e,e,e.content.size,e.childCount,-1)||new ue(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=cr[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in cr)throw new RangeError("Duplicate use of selection JSON ID "+e);return cr[e]=t,t.prototype.jsonID=e,t}getBookmark(){return I.between(this.$anchor,this.$head).getBookmark()}}B.prototype.visible=!0;class zc{constructor(e,t){this.$from=e,this.$to=t}}let Xi=!1;function Qi(n){!Xi&&!n.parent.inlineContent&&(Xi=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class I extends B{constructor(e,t=e){Qi(e),Qi(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return B.near(r);let i=e.resolve(t.map(this.anchor));return new I(i.parent.inlineContent?i:r,r)}replace(e,t=S.empty){if(super.replace(e,t),t==S.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof I&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Jn(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new I(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=B.findFrom(t,r,!0)||B.findFrom(t,-r,!0);if(o)t=o.$head;else return B.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(B.findFrom(e,-r,!0)||B.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new I(e,t)}}B.jsonID("text",I);class Jn{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Jn(e.map(this.anchor),e.map(this.head))}resolve(e){return I.between(e.resolve(this.anchor),e.resolve(this.head))}}class E extends B{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?B.near(o):new E(o)}content(){return new S(v.from(this.node),0,0)}eq(e){return e instanceof E&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Zr(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new E(e.resolve(t.anchor))}static create(e,t){return new E(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}E.prototype.visible=!1;B.jsonID("node",E);class Zr{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Jn(r,r):new Zr(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&E.isSelectable(r)?new E(t):B.near(t)}}class ue extends B{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=S.empty){if(t==S.empty){e.delete(0,e.doc.content.size);let r=B.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new ue(e)}map(e){return new ue(e)}eq(e){return e instanceof ue}getBookmark(){return Lc}}B.jsonID("all",ue);const Lc={map(){return this},resolve(n){return new ue(n)}};function Mt(n,e,t,r,i,o=!1){if(e.inlineContent)return I.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&E.isSelectable(a))return E.create(n,t-(i<0?a.nodeSize:0))}else{let l=Mt(n,a,t+i,i<0?a.childCount:0,i,o);if(l)return l}t+=a.nodeSize*i}return null}function Zi(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof W||i instanceof J))return;let o=n.mapping.maps[r],s;o.forEach((a,l,c,u)=>{s==null&&(s=u)}),n.setSelection(B.near(n.doc.resolve(s),t))}const eo=1,yn=2,to=4;class jc extends Ws{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|eo)&~yn,this.storedMarks=null,this}get selectionSet(){return(this.updated&eo)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=yn,this}ensureMarks(e){return j.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&yn)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~yn,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||j.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(B.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=to,this}get scrolledIntoView(){return(this.updated&to)>0}}function no(n,e){return!e||!n?n:n.bind(e)}class $t{constructor(e,t,r){this.name=e,this.init=no(t.init,r),this.apply=no(t.apply,r)}}const Vc=[new $t("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new $t("selection",{init(n,e){return n.selection||B.atStart(e.doc)},apply(n){return n.selection}}),new $t("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new $t("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class ur{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Vc.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new $t(r.key,r.spec.state,r))})}}class Nt{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,c=i?i[s].state:this,u=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Nt(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new jc(this)}static create(e){let t=new ur(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Nt(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new ur(this.schema,e.plugins),r=t.fields,i=new Nt(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new ur(e.schema,e.plugins),o=new Nt(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=be.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=B.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){o[s.name]=c.fromJSON.call(l,e,t[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function $s(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=$s(i,e,{})),t[r]=i}return t}class ke{constructor(e){this.spec=e,this.props={},e.props&&$s(e.props,this,this.props),this.key=e.key?e.key.key:qs("plugin")}getState(e){return e[this.key]}}const dr=Object.create(null);function qs(n){return n in dr?n+"$"+ ++dr[n]:(dr[n]=0,n+"$")}class Xe{constructor(e="key"){this.key=qs(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ei=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Hs(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Js=(n,e,t)=>{let r=Hs(n,t);if(!r)return!1;let i=ti(r);if(!i){let s=r.blockRange(),a=s&&_t(s);return a==null?!1:(e&&e(n.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(ta(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Ot(o,"end")||E.isSelectable(o)))for(let s=r.depth;;s--){let a=Hn(n.doc,r.before(s),r.after(s),S.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Ot(o,"end")?B.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):E.create(l.doc,i.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},Wc=(n,e,t)=>{let r=Hs(n,t);if(!r)return!1;let i=ti(r);return i?Ys(n,i,e):!1},$c=(n,e,t)=>{let r=Ks(n,t);if(!r)return!1;let i=ni(r);return i?Ys(n,i,e):!1};function Ys(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,a=s,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Hn(n.doc,o,l,S.empty);if(!c||c.from!=o||c instanceof W&&c.slice.size>=l-o)return!1;if(t){let u=n.tr.step(c);u.setSelection(I.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Ot(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Us=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=ti(r)}let s=o&&o.nodeBefore;return!s||!E.isSelectable(s)?!1:(e&&e(n.tr.setSelection(E.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function ti(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Ks(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Gs=(n,e,t)=>{let r=Ks(n,t);if(!r)return!1;let i=ni(r);if(!i)return!1;let o=i.nodeAfter;if(ta(n,i,e,1))return!0;if(r.parent.content.size==0&&(Ot(o,"start")||E.isSelectable(o))){let s=Hn(n.doc,r.before(),r.after(),S.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=n.tr.step(s);a.setSelection(Ot(o,"start")?B.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):E.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Xs=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=ni(r)}let s=o&&o.nodeAfter;return!s||!E.isSelectable(s)?!1:(e&&e(n.tr.setSelection(E.create(n.doc,o.pos)).scrollIntoView()),!0)};function ni(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const qc=(n,e)=>{let t=n.selection,r=t instanceof E,i;if(r){if(t.node.isTextblock||!Ge(n.doc,t.from))return!1;i=t.from}else if(i=qn(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(E.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Hc=(n,e)=>{let t=n.selection,r;if(t instanceof E){if(t.node.isTextblock||!Ge(n.doc,t.to))return!1;r=t.to}else if(r=qn(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Jc=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&_t(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},Qs=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
6
+ `).scrollIntoView()),!0)};function ri(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Yc=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),s=ri(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,s.createAndFill());l.setSelection(B.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Zs=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof ue||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=ri(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(s,o.createAndFill());a.setSelection(I.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},ea=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(Ie(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&_t(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function Uc(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof E&&e.selection.node.isBlock)return!r.parentOffset||!Ie(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,a,l=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=ri(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),o.unshift(l&&a?{type:a}:null),s=h;break}else{if(h==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof I||e.selection instanceof ue)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Ie(u.doc,d,o.length,o);if(f||(o[0]=a?{type:a}:null,f=Ie(u.doc,d,o.length,o)),!f)return!1;if(u.split(d,o.length,o),!l&&c&&r.node(s).type!=a){let h=u.mapping.map(r.before(s)),p=u.doc.resolve(h);a&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return t&&t(u.scrollIntoView()),!0}}const Kc=Uc(),Gc=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(E.create(n.doc,i))),!0)};function Xc(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Ge(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function ta(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&Xc(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(t){let h=e.pos+o.nodeSize,p=v.empty;for(let y=s.length-1;y>=0;y--)p=v.from(s[y].create(null,p));p=v.from(i.copy(p));let g=n.tr.step(new J(e.pos-1,h,e.pos,h,new S(p,1,0),s.length,!0)),m=g.doc.resolve(h+2*s.length);m.nodeAfter&&m.nodeAfter.type==i.type&&Ge(g.doc,m.pos)&&g.join(m.pos),t(g.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&l?null:B.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&_t(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&Ot(o,"start",!0)&&Ot(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=o,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let y=v.empty;for(let w=p.length-1;w>=0;w--)y=v.from(p[w].copy(y));let x=n.tr.step(new J(e.pos-p.length,e.pos+o.nodeSize,e.pos+m,e.pos+o.nodeSize-m,new S(y,p.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function na(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(I.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const Qc=na(-1),Zc=na(1);function eu(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),a=s&&Qr(s,n,e);return a?(r&&r(t.tr.wrap(s,a).scrollIntoView()),!0):!1}}function ro(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:a}}=t.selection.ranges[o];t.doc.nodesBetween(s,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[s];o.setBlockType(a,l,n,e)}r(o.scrollIntoView())}return!0}}function ii(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}ii(ei,Js,Us);ii(ei,Gs,Xs);ii(Qs,Zs,ea,Kc);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function tu(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o);if(!s)return!1;let a=r?t.tr:null;return nu(a,s,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function nu(n,e,t,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);o=new On(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new On(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Qr(o,t,r,e);return a?(n&&ru(n,e,a,i,t),!0):!1}function ru(n,e,t,r,i){let o=v.empty;for(let u=t.length-1;u>=0;u--)o=v.from(t[u].type.create(t[u].attrs,o));n.step(new J(e.start-(r?2:0),e.end,e.start,e.end,new S(o,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==i&&(s=u+1);let a=t.length-s,l=e.start+t.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Ie(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return n}function iu(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?ou(e,t,n,o):su(e,t,o):!0:!1}}function ou(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new J(o-1,s,o,s,new S(v.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new On(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=_t(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);return Ge(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function su(n,e,t){let r=n.tr,i=t.parent;for(let h=t.end,p=t.endIndex-1,g=t.startIndex;p>g;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?v.empty:v.from(i))))return!1;let d=o.pos,f=d+s.nodeSize;return r.step(new J(d-(a?1:0),f+(l?1:0),d+1,f-1,new S((a?v.empty:v.from(i.copy(v.empty))).append(l?v.empty:v.from(i.copy(v.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function au(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=v.from(c?n.create():null),d=new S(v.from(n.create(null,v.from(a.type.create(null,u)))),c?3:1,0),f=o.start,h=o.end;t(e.tr.step(new J(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const K=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},At=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Ir=null;const Pe=function(n,e,t){let r=Ir||(Ir=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},lu=function(){Ir=null},ht=function(n,e,t,r){return t&&(io(n,e,t,r,-1)||io(n,e,t,r,1))},cu=/^(img|br|input|textarea|hr)$/i;function io(n,e,t,r,i){for(var o;;){if(n==t&&e==r)return!0;if(e==(i<0?0:he(n))){let s=n.parentNode;if(!s||s.nodeType!=1||ln(n)||cu.test(n.nodeName)||n.contentEditable=="false")return!1;e=K(n)+(i<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else n=s,e=i<0?he(n):0}else return!1}}function he(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function uu(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=he(n)}else if(n.parentNode&&!ln(n))e=K(n),n=n.parentNode;else return null}}function du(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!ln(n))e=K(n)+1,n=n.parentNode;else return null}}function fu(n,e,t){for(let r=e==0,i=e==he(n);r||i;){if(n==t)return!0;let o=K(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==he(n)}}function ln(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Yn=function(n){return n.focusNode&&ht(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function tt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function hu(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function pu(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(he(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(he(r.startContainer),r.startOffset)}}}const Me=typeof navigator<"u"?navigator:null,oo=typeof document<"u"?document:null,Qe=Me&&Me.userAgent||"",_r=/Edge\/(\d+)/.exec(Qe),ra=/MSIE \d/.exec(Qe),Br=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qe),ae=!!(ra||Br||_r),Je=ra?document.documentMode:Br?+Br[1]:_r?+_r[1]:0,pe=!ae&&/gecko\/(\d+)/i.test(Qe);pe&&+(/Firefox\/(\d+)/.exec(Qe)||[0,0])[1];const Fr=!ae&&/Chrome\/(\d+)/.exec(Qe),X=!!Fr,ia=Fr?+Fr[1]:0,Z=!ae&&!!Me&&/Apple Computer/.test(Me.vendor),Pt=Z&&(/Mobile\/\w+/.test(Qe)||!!Me&&Me.maxTouchPoints>2),fe=Pt||(Me?/Mac/.test(Me.platform):!1),oa=Me?/Win/.test(Me.platform):!1,Re=/Android \d/.test(Qe),cn=!!oo&&"webkitFontSmoothing"in oo.documentElement.style,mu=cn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function gu(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Oe(n,e){return typeof n=="number"?n:n[e]}function yu(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function so(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=At(s);continue}let a=s,l=a==o.body,c=l?gu(o):yu(a),u=0,d=0;if(e.top<c.top+Oe(r,"top")?d=-(c.top-e.top+Oe(i,"top")):e.bottom>c.bottom-Oe(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Oe(i,"top")-c.top:e.bottom-c.bottom+Oe(i,"bottom")),e.left<c.left+Oe(r,"left")?u=-(c.left-e.left+Oe(i,"left")):e.right>c.right-Oe(r,"right")&&(u=e.right-c.right+Oe(i,"right")),u||d)if(l)o.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-h,m=a.scrollTop-p;e={left:e.left-g,top:e.top-m,right:e.right-g,bottom:e.bottom-m}}let f=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:At(s)}}function bu(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=n.root.elementFromPoint(o,s);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:sa(n.dom)}}function sa(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=At(r));return e}function xu({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;aa(t,r==0?0:r-e)}function aa(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let kt=null;function vu(n){if(n.setActive)return n.setActive();if(kt)return n.focus(kt);let e=sa(n);n.focus(kt==null?{get preventScroll(){return kt={preventScroll:!0},!0}}:void 0),kt||(kt=!1,aa(e,0))}function la(n,e){let t,r=2e8,i,o=0,s=e.top,a=e.top,l,c;for(let u=n.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Pe(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=s&&p.bottom>=a){s=Math.max(p.bottom,s),a=Math.min(p.top,a);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){t=u,r=g,i=g&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&g&&(o=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(o=d+1)}}return!t&&l&&(t=l,i=c,r=0),t&&t.nodeType==3?ku(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:la(t,i)}function ku(n,e){let t=n.nodeValue.length,r=document.createRange(),i;for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let s=Le(r,1);if(s.top!=s.bottom&&oi(e,s)){i={node:n,offset:o+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:n,offset:0}}function oi(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function wu(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Su(n,e,t){let{node:r,offset:i}=la(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function Mu(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let a=n.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),s=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;o=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function ca(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(oi(e,c))return ca(s,e,c)}}if((o=(o+1)%r)==i)break}return n}function Cu(n,e){let t=n.dom.ownerDocument,r,i=0,o=pu(t,e.left,e.top);o&&({node:r,offset:i}=o);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!oi(e,c)||(s=ca(n.dom,e,c),!s))return null}if(Z)for(let c=s;r&&c;c=At(c))c.draggable&&(r=void 0);if(s=wu(s,e),r){if(pe&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;cn&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=Mu(n,r,i,e))}a==null&&(a=Su(n,s,e));let l=n.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function ao(n){return n.top<n.bottom||n.left<n.right}function Le(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(ao(r))return r}return Array.prototype.find.call(t,ao)||n.getBoundingClientRect()}const Nu=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ua(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=cn||pe;if(r.nodeType==3)if(s&&(Nu.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let l=Le(Pe(r,i,i),t);if(pe&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Le(Pe(r,i-1,i-1),-1);if(c.top==l.top){let u=Le(Pe(r,i,i+1),-1);if(u.top!=l.top)return Bt(u,u.left<c.left)}}return l}else{let l=i,c=i,u=t<0?1:-1;return t<0&&!i?(c++,u=-1):t>=0&&i==r.nodeValue.length?(l--,u=1):t<0?l--:c++,Bt(Le(Pe(r,l,c),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==he(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return fr(l.getBoundingClientRect(),!1)}if(o==null&&i<he(r)){let l=r.childNodes[i];if(l.nodeType==1)return fr(l.getBoundingClientRect(),!0)}return fr(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==he(r))){let l=r.childNodes[i-1],c=l.nodeType==3?Pe(l,he(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Bt(Le(c,1),!1)}if(o==null&&i<he(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Pe(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return Bt(Le(c,-1),!0)}return Bt(Le(r.nodeType==3?Pe(r):r,-t),t>=0)}function Bt(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function fr(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function da(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Du(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return da(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=ua(n,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Pe(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Eu=/[\u0590-\u08ac]/;function Tu(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=n.domSelection();return a?!Eu.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?o:s:da(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:g}=n.domSelectionRange(),m=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),m}):r.pos==r.start()||r.pos==r.end()}let lo=null,co=null,uo=!1;function Ou(n,e,t){return lo==e&&co==t?uo:(lo=e,co=t,uo=t=="up"||t=="down"?Du(n,e,t):Tu(n,e,t))}const me=0,fo=1,rt=2,Ce=3;class un{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=me,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>K(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let a=i.children[s];if(a.size){i=a;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>e||s instanceof ha){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof fa&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?K(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?K(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(i==-1&&e<=c){let u=s+l.border;if(e>=u&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,u);e=s;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=K(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){o=K(d.dom);break}t+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let o=Math.min(e,t),s=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let g=this.children[h],m=p+g.size;if(o>p&&s<m)return g.setSelection(e-p-g.border,t-p-g.border,r,i);p=m}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((pe||Z)&&e==t){let{node:h,offset:p}=a;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
7
+ `),d&&p==h.nodeValue.length)for(let g=h,m;g;g=g.parentNode){if(m=g.nextSibling){m.nodeName=="BR"&&(a=l={node:m.parentNode,offset:K(m)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=h.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(pe&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&Z)&&ht(a.node,a.offset,u.anchorNode,u.anchorOffset)&&ht(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!(d&&pe)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>t){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let a=r+o.border,l=s-o.border;if(e>=a&&t<=l){this.dirty=e==r||t==s?rt:fo,e==a&&t==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Ce:o.markDirty(e-a,t-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?rt:Ce}r=s}this.dirty=rt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?rt:fo;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class fa extends un{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!t.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==me&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Au extends un{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class pt extends un{constructor(e,t,r,i,o){super(e,[],r,i),this.mark=t,this.spec=o}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=gt.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new pt(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Ce||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ce&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=me){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=me}}slice(e,t,r){let i=pt.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=Lr(o,t,s,r)),e>0&&(o=Lr(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ye extends un{constructor(e,t,r,i,o,s,a,l,c){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,t,r,i,o,s){let a=o.nodeViews[t.type.name],l,c=a&&a(t,o,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=gt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=ga(u,r,t),c?l=new Pu(e,t,r,i,u,d||null,f,c,o,s+1):t.isText?new Un(e,t,r,i,u,f,o):new Ye(e,t,r,i,u,d||null,f,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>v.empty)}return e}matchesNode(e,t,r){return this.dirty==me&&e.eq(this.node)&&Rn(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new Iu(this,s&&s.node,e);Fu(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?j.none:this.node.child(u).marks,r,e,u),l.placeWidget(c,e,i)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e,f);let h;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(c,u,d,h,e)||l.updateNextNode(c,u,d,e,f,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==rt)&&(s&&this.protectLocalComposition(e,s),pa(this.contentDOM,this.children,e),Pt&&zu(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof I)||r<t||i>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=Lu(this.node.content,s,r-t,i-t);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new Au(this,o,t,i);e.input.compositionNodes.push(s),this.children=Lr(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==Ce||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=me}updateOuterDeco(e){if(Rn(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=ma(this.dom,this.nodeDOM,zr(this.outerDeco,this.node,t),zr(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ho(n,e,t,r,i){ga(r,e,n);let o=new Ye(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Un extends Ye{constructor(e,t,r,i,o,s,a){super(e,t,r,i,o,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Ce||this.dirty!=me&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=me||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=me,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),o=document.createTextNode(i.text);return new Un(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Ce)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ha extends un{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==me&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Pu extends Ye{constructor(e,t,r,i,o,s,a,l,c,u){super(e,t,r,i,o,s,a,c,u),this.spec=l}update(e,t,r,i){if(this.dirty==Ce)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function pa(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==n){for(;a!=r;)r=po(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(s instanceof pt){let l=r?r.previousSibling:n.lastChild;pa(s.contentDOM,s.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=po(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const Yt=function(n){n&&(this.nodeName=n)};Yt.prototype=Object.create(null);const it=[new Yt];function zr(n,e,t){if(n.length==0)return it;let r=t?it[0]:new Yt,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new Yt(s.nodeName));for(let a in s){let l=s[a];l!=null&&(t&&i.length==1&&i.push(r=new Yt(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function ma(n,e,t,r){if(t==it&&r==it)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=t[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=it[0]),i=l}Ru(i,a||it[0],s)}return i}function Ru(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function ga(n,e,t){return ma(n,n,it,zr(e,t,n.nodeType!=1))}function Rn(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function po(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Iu{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=_u(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,i){let o=0,s=this.stack.length>>1,a=Math.min(s,e.length);for(;o<a&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=me,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=pt.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==Ce&&s.dom==s.contentDOM&&(s.dirty=rt),s.update(e,t,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Ye){let c=this.preMatch.matched.get(l);if(c!=null&&c!=o)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Ce&&Rn(t,l.outerDeco));if(!f&&l.update(e,t,r,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,t,r,i,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=rt,d.updateChildren(i,s+1),d.dirty=me),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Rn(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Ye.create(this.top,t,r,i,o,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,r,i,o){let s=Ye.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new fa(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof pt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Un)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Z||X)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new ha(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function _u(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof pt)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function Bu(n,e){return n.type.side-e.type.side}function Fu(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,i,e.forChild(o,u),c),o+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d;for(;s<i.length&&i[s].to==o;){let m=i[s++];m.widget&&(u?(d||(d=[u])).push(m):u=m)}if(u)if(d){d.sort(Bu);for(let m=0;m<d.length;m++)t(d[m],c,!!l)}else t(u,c,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(c<n.childCount)h=c,f=n.child(c++);else break;for(let m=0;m<a.length;m++)a[m].to<=o&&a.splice(m--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let p=o+f.nodeSize;if(f.isText){let m=p;s<i.length&&i[s].from<m&&(m=i[s].from);for(let y=0;y<a.length;y++)a[y].to<m&&(m=a[y].to);m<p&&(l=f.cut(m-o),f=f.cut(0,m-o),p=m,h=-1)}else for(;s<i.length&&i[s].to<p;)s++;let g=f.isInline&&!f.isLeaf?a.filter(m=>!m.inline):a.slice();r(f,g,e.forChild(o,f),h),o=p}}function zu(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Lu(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<n.childCount;){let c=n.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=t){if(o>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Lr(n,e,t,r,i){let o=[];for(let s=0,a=0;s<n.length;s++){let l=n[s],c=a,u=a+=l.size;c>=t||u<=e?o.push(l):(c<e&&o.push(l.slice(0,e-c,r)),i&&(o.push(i),i=void 0),u>t&&o.push(l.slice(t-c,l.size,r)))}return o}function si(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(Yn(t)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&E.isSelectable(d)&&i.parent&&!(d.isInline&&fu(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new E(s==f?a:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=s,f=s;for(let h=0;h<t.rangeCount;h++){let p=t.getRangeAt(h);d=Math.min(d,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,s]=f==n.state.selection.anchor?[f,d]:[d,f],a=r.resolve(s)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||n.state.selection.head<a.pos&&!o?1:-1;c=ai(n,u,a,d)}return c}function ya(n){return n.editable?n.hasFocus():xa(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function _e(n,e=!1){let t=n.state.selection;if(ba(n,t),!!ya(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&X){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ht(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Vu(n);else{let{anchor:r,head:i}=t,o,s;mo&&!(t instanceof I)&&(t.$from.parent.inlineContent||(o=go(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=go(n,t.to))),n.docView.setSelection(r,i,n,e),mo&&(o&&yo(o),s&&yo(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&ju(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const mo=Z||X&&ia<63;function go(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(Z&&i&&i.contentEditable=="false")return hr(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return hr(i);if(o)return hr(o)}}function hr(n){return n.contentEditable="true",Z&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function yo(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function ju(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!ya(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Vu(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,K(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&ae&&Je<=11&&(t.disabled=!0,t.disabled=!1)}function ba(n,e){if(e instanceof E){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(bo(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else bo(n)}function bo(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function ai(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||I.between(e,t,r)}function xo(n){return n.editable&&!n.hasFocus()?!1:xa(n)}function xa(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Wu(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return ht(e.node,e.offset,t.anchorNode,t.anchorOffset)}function jr(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&B.findFrom(o,e)}function je(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function vo(n,e,t){let r=n.state.selection;if(r instanceof I)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return je(n,new I(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=jr(n.state,e);return i&&i instanceof E?je(n,i):!1}else if(!(fe&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(a))&&!s.contentDOM?E.isSelectable(o)?je(n,new E(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):cn?je(n,new I(n.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof E&&r.node.isInline)return je(n,new I(e>0?r.$to:r.$from));{let i=jr(n.state,e);return i?je(n,i):!1}}}function In(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ut(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function wt(n,e){return e<0?$u(n):qu(n)}function $u(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(pe&&t.nodeType==1&&r<In(t)&&Ut(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(Ut(a,-1))i=t,o=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(va(t))break;{let a=t.previousSibling;for(;a&&Ut(a,-1);)i=t.parentNode,o=K(a),a=a.previousSibling;if(a)t=a,r=In(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Vr(n,t,r):i&&Vr(n,i,o)}function qu(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=In(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let a=t.childNodes[r];if(Ut(a,1))o=t,s=++r;else break}else{if(va(t))break;{let a=t.nextSibling;for(;a&&Ut(a,1);)o=a.parentNode,s=K(a)+1,a=a.nextSibling;if(a)t=a,r=0,i=In(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Vr(n,o,s)}function va(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Hu(n,e){for(;n&&e==n.childNodes.length&&!ln(n);)e=K(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Ju(n,e){for(;n&&!e&&!ln(n);)e=K(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Vr(n,e,t){if(e.nodeType!=3){let o,s;(s=Hu(e,t))?(e=s,t=0):(o=Ju(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Yn(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&_e(n)},50)}function ko(n,e){let t=n.state.doc.resolve(e);if(!(X||oa)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function wo(n,e,t){let r=n.state.selection;if(r instanceof I&&!r.empty||t.indexOf("s")>-1||fe&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=jr(n.state,e);if(s&&s instanceof E)return je(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof ue?B.near(s,e):B.findFrom(s,e);return a?je(n,a):!1}return!1}function So(n,e){if(!(n.state.selection instanceof I))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function Mo(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Yu(n){if(!Z||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Mo(n,r,"true"),setTimeout(()=>Mo(n,r,"false"),20)}return!1}function Uu(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Ku(n,e){let t=e.keyCode,r=Uu(e);if(t==8||fe&&t==72&&r=="c")return So(n,-1)||wt(n,-1);if(t==46&&!e.shiftKey||fe&&t==68&&r=="c")return So(n,1)||wt(n,1);if(t==13||t==27)return!0;if(t==37||fe&&t==66&&r=="c"){let i=t==37?ko(n,n.state.selection.from)=="ltr"?-1:1:-1;return vo(n,i,r)||wt(n,i)}else if(t==39||fe&&t==70&&r=="c"){let i=t==39?ko(n,n.state.selection.from)=="ltr"?1:-1:1;return vo(n,i,r)||wt(n,i)}else{if(t==38||fe&&t==80&&r=="c")return wo(n,-1,r)||wt(n,-1);if(t==40||fe&&t==78&&r=="c")return Yu(n)||wo(n,1,r)||wt(n,1);if(r==(fe?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function li(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=n.someProp("clipboardSerializer")||gt.fromSchema(n.state.schema),a=Na(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Ca[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=a.createElement(u[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
8
+
9
+ `);return{dom:l,text:f,slice:e}}function ka(n,e,t,r,i){let o=i.parent.type.spec.code,s,a;if(!t&&!e)return null;let l=!!e&&(r||o||!t);if(l){if(n.someProp("transformPastedText",f=>{e=f(e,o||r,n)}),o)return a=new S(v.from(n.state.schema.text(e.replace(/\r\n?/g,`
10
+ `))),0,0),n.someProp("transformPasted",f=>{a=f(a,n,!0)}),a;let d=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(d)a=d;else{let f=i.marks(),{schema:h}=n.state,p=gt.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=s.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),s=Zu(t),cn&&ed(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||He.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Gu.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=td(Co(a,+u[1],+u[2]),u[4]);else if(a=S.maxOpen(Xu(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=Co(a,d,f)}return n.someProp("transformPasted",d=>{a=d(a,n,l)}),a}const Gu=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Xu(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,s=[];if(n.forEach(a=>{if(!s)return;let l=i.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&o.length&&Sa(l,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Ma(s[s.length-1],o.length));let u=wa(a,l);s.push(u),i=i.matchType(u.type),o=l}}),s)return v.from(s)}return n}function wa(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,v.from(n));return n}function Sa(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Sa(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(v.from(wa(t,n,i+1))))}}function Ma(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Ma(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(v.empty,!0);return n.copy(t.append(r))}function Wr(n,e,t,r,i,o){let s=e<0?n.firstChild:n.lastChild,a=s.content;return n.childCount>1&&(o=0),i<r-1&&(a=Wr(a,e,t,r,i+1,o)),i>=t&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(v.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(a))}function Co(n,e,t){return e<n.openStart&&(n=new S(Wr(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new S(Wr(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Ca={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let No=null;function Na(){return No||(No=document.implementation.createHTMLDocument("title"))}let pr=null;function Qu(n){let e=window.trustedTypes;return e?(pr||(pr=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),pr.createHTML(n)):n}function Zu(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Na().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Ca[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=Qu(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function ed(n){let e=n.querySelectorAll(X?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function td(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:s}=n;for(let a=r.length-2;a>=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=v.from(l.create(r[a+1],i)),o++,s++}return new S(i,o,s)}const re={},ie={},nd={touchstart:!0,touchmove:!0};class rd{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function id(n){for(let e in re){let t=re[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{sd(n,r)&&!ci(n,r)&&(n.editable||!(r.type in ie))&&t(n,r)},nd[e]?{passive:!0}:void 0)}Z&&n.dom.addEventListener("input",()=>null),$r(n)}function qe(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function od(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function $r(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>ci(n,r))})}function ci(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function sd(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function ad(n,e){!ci(n,e)&&re[e.type]&&(n.editable||!(e.type in ie))&&re[e.type](n,e)}ie.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Ea(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Re&&X&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Pt&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,tt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Ku(n,t)?t.preventDefault():qe(n,"key")};ie.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};ie.keypress=(n,e)=>{let t=e;if(Ea(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||fe&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof I)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),o=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i,o))&&n.dispatch(o()),t.preventDefault()}};function Kn(n){return{left:n.clientX,top:n.clientY}}function ld(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function ui(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(e,a=>s>o.depth?a(n,t,o.nodeAfter,o.before(s),i,!0):a(n,t,o.node(s),o.before(s),i,!1)))return!0;return!1}function Et(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function cd(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&E.isSelectable(r)?(Et(n,new E(t)),!0):!1}function ud(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof E&&(r=t.node);let o=n.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(E.isSelectable(a)){r&&t.$from.depth>0&&s>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(s);break}}return i!=null?(Et(n,E.create(n.state.doc,i)),!0):!1}function dd(n,e,t,r,i){return ui(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?ud(n,t):cd(n,t))}function fd(n,e,t,r){return ui(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function hd(n,e,t,r){return ui(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||pd(n,t,r)}function pd(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Et(n,I.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)Et(n,I.create(r,a+1,a+1+s.content.size));else if(E.isSelectable(s))Et(n,E.create(r,a));else continue;return!0}}function di(n){return _n(n)}const Da=fe?"metaKey":"ctrlKey";re.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=di(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&ld(t,n.input.lastClick)&&!t[Da]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o,button:t.button};let s=n.posAtCoords(Kn(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new md(n,s,t,!!r)):(o=="doubleClick"?fd:hd)(n,s.pos,s.inside,t)?t.preventDefault():qe(n,"pointer"))};class md{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Da],this.allowDefault=r.shiftKey;let o,s;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);o=u.parent,s=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof E&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&pe&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),qe(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>_e(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Kn(e))),this.updateAllowDefault(e),this.allowDefault||!t?qe(this.view,"pointer"):dd(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Z&&this.mightDrag&&!this.mightDrag.node.isAtom||X&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Et(this.view,B.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):qe(this.view,"pointer")}move(e){this.updateAllowDefault(e),qe(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}re.touchstart=n=>{n.input.lastTouch=Date.now(),di(n),qe(n,"pointer")};re.touchmove=n=>{n.input.lastTouch=Date.now(),qe(n,"pointer")};re.contextmenu=n=>di(n);function Ea(n,e){return n.composing?!0:Z&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const gd=Re?5e3:-1;ie.compositionstart=ie.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof I&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||X&&oa&&yd(n)))n.markCursor=n.state.storedMarks||t.marks(),_n(n,!0),n.markCursor=null;else if(_n(n,!e.selection.empty),pe&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=n.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}Ta(n,gd)};function yd(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}ie.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Ta(n,20))};function Ta(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>_n(n),e))}function Oa(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=xd());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function bd(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=uu(e.focusNode,e.focusOffset),r=du(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function xd(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function _n(n,e=!1){if(!(Re&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Oa(n),e||n.docView&&n.docView.dirty){let t=si(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function vd(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Zt=ae&&Je<15||Pt&&mu<604;re.copy=ie.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Zt?null:t.clipboardData,s=r.content(),{dom:a,text:l}=li(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):vd(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function kd(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function wd(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?en(n,r.value,null,i,e):en(n,r.textContent,r.innerHTML,i,e)},50)}function en(n,e,t,r,i){let o=ka(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,o||S.empty)))return!0;if(!o)return!1;let s=kd(o),a=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Aa(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}ie.paste=(n,e)=>{let t=e;if(n.composing&&!Re)return;let r=Zt?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&en(n,Aa(r),r.getData("text/html"),i,t)?t.preventDefault():wd(n,t)};class Pa{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Sd=fe?"altKey":"ctrlKey";function Ra(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[Sd]}re.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(Kn(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof E?i.to-1:i.to))){if(r&&r.mightDrag)s=E.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(s=E.create(n.state.doc,d.posBefore))}}let a=(s||n.state.selection).content(),{dom:l,text:c,slice:u}=li(n,a);(!t.dataTransfer.files.length||!X||ia>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Zt?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Zt||t.dataTransfer.setData("text/plain",c),n.dragging=new Pa(u,Ra(n,t),s)};re.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};ie.dragover=ie.dragenter=(n,e)=>e.preventDefault();ie.drop=(n,e)=>{try{Md(n,e,n.dragging)}finally{n.dragging=null}};function Md(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Kn(e));if(!r)return;let i=n.state.doc.resolve(r.pos),o=t&&t.slice;o?n.someProp("transformPasted",h=>{o=h(o,n,!1)}):o=ka(n,Aa(e.dataTransfer),Zt?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(t&&Ra(n,e));if(n.someProp("handleDrop",h=>h(n,e,o||S.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let a=o?Ac(n.state.doc,i.pos,o):i.pos;a==null&&(a=i.pos);let l=n.state.tr;if(s){let{node:h}=t;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(d))return;let f=l.doc.resolve(c);if(u&&E.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new E(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),l.setSelection(ai(n,f,l.doc.resolve(h)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}re.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&_e(n)},20))};re.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};re.beforeinput=(n,e)=>{if(X&&Re&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,tt(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in ie)re[n]=ie[n];function tn(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Bn{constructor(e,t){this.toDOM=e,this.spec=t||lt,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new ye(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Bn&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&tn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ue{constructor(e,t){this.attrs=e,this.spec=t||lt}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new ye(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Ue&&tn(this.attrs,e.attrs)&&tn(this.spec,e.spec)}static is(e){return e.type instanceof Ue}destroy(){}}class fi{constructor(e,t){this.attrs=e,this.spec=t||lt}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=o.pos?null:new ye(o.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof fi&&tn(this.attrs,e.attrs)&&tn(this.spec,e.spec)}destroy(){}}class ye{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new ye(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new ye(e,e,new Bn(t,r))}static inline(e,t,r,i){return new ye(e,t,new Ue(r,i))}static node(e,t,r,i){return new ye(e,t,new fi(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ue}get widget(){return this.type instanceof Bn}}const Ct=[],lt={};class H{constructor(e,t){this.local=e.length?e:Ct,this.children=t.length?t:Ct}static create(e,t){return t.length?Fn(t,e,0,lt):Q}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=t&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,t-a,r,i+a,o)}}map(e,t,r){return this==Q||e.maps.length==0?this:this.mapInner(e,t,0,0,r||lt)}mapInner(e,t,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(t,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?Cd(this.children,s||[],e,t,r,i,o):s?new H(s.sort(ct),Ct):Q}add(e,t){return t.length?this==Q?H.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((a,l)=>{let c=l+r,u;if(u=_a(t,a,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,u,c+1):i.splice(o,0,l,l+a.nodeSize,Fn(u,a,c+1,lt)),o+=3}});let s=Ia(o?Ba(t):t,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new H(s.length?this.local.concat(s).sort(ct):this.local,i||this.children)}remove(e){return e.length==0||this==Q?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+t,l=r[o+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,a+1);c!=Q?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new H(i,r):Q}forChild(e,t){if(this==Q)return this;if(t.isLeaf)return H.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof Ue){let c=Math.max(o,l.from)-o,u=Math.min(s,l.to)-o;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new H(i.sort(ct),Ct);return r?new Ve([a,r]):a}return r||Q}eq(e){if(this==e)return!0;if(!(e instanceof H)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return hi(this.localsInner(e))}localsInner(e){if(this==Q)return Ct;if(e.inlineContent||!this.local.some(Ue.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ue||t.push(this.local[r]);return t}forEachSet(e){e(this)}}H.empty=new H([],[]);H.removeOverlap=hi;const Q=H.empty;class Ve{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,lt));return Ve.from(r)}forChild(e,t){if(t.isLeaf)return H.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=Q&&(o instanceof Ve?r=r.concat(o.members):r.push(o))}return Ve.from(r)}eq(e){if(!(e instanceof Ve)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let s=0;s<o.length;s++)t.push(o[s])}}return t?hi(r?t:t.sort(ct)):Ct}static from(e){switch(e.length){case 0:return Q;case 1:return e[0];default:return new Ve(e.every(t=>t instanceof H)?e:e.reduce((t,r)=>t.concat(r instanceof H?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Cd(n,e,t,r,i,o,s){let a=n.slice();for(let c=0,u=o;c<t.maps.length;c++){let d=0;t.maps[c].forEach((f,h,p,g)=>{let m=g-p-(h-f);for(let y=0;y<a.length;y+=3){let x=a[y+1];if(x<0||f>x+u-d)continue;let w=a[y]+u-d;h>=w?a[y+1]=f<=w?-2:-1:f>=u&&m&&(a[y]+=m,a[y+1]+=m)}d+=m}),u=t.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=t.map(n[c]+o),d=u-i;if(d<0||d>=r.content.size){l=!0;continue}let f=t.map(n[c+1]+o,-1),h=f-i,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=a[c+2].mapInner(t,m,u+1,n[c]+o+1,s);y!=Q?(a[c]=d,a[c+1]=h,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Nd(a,n,e,t,i,o,s),u=Fn(c,r,0,s);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new H(e.sort(ct),a)}function Ia(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new ye(i.from+e,i.to+e,i.type))}return t}function Nd(n,e,t,r,i,o,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,i,c);d?t.push(d):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+o+1);return t}function _a(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>t&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function Ba(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Fn(n,e,t,r){let i=[],o=!1;e.forEach((a,l)=>{let c=_a(n,a,l+t);if(c){o=!0;let u=Fn(c,a,t+l+1,r);u!=Q&&i.push(l,l+a.nodeSize,u)}});let s=Ia(o?Ba(n):n,-t).sort(ct);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new H(s,i):Q}function ct(n,e){return n.from-e.from||n.to-e.to}function hi(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),Do(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),Do(e,i,r.copy(o.from,r.to)));break}}}return e}function Do(n,e,t){for(;e<n.length&&ct(t,n[e])>0;)e++;n.splice(e,0,t)}function mr(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Q&&e.push(r)}),n.cursorWrapper&&e.push(H.create(n.state.doc,[n.cursorWrapper.deco])),Ve.from(e)}const Dd={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ed=ae&&Je<=11;class Td{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Od{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Td,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ae&&Je<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Z&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Ed&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Dd)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(xo(this.view)){if(this.suppressingSelectionUpdates)return _e(this.view);if(ae&&Je<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ht(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let o=e.focusNode;o;o=At(o))t.add(o);for(let o=e.anchorNode;o;o=At(o))if(t.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&xo(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let u=0;u<t.length;u++){let d=this.registerMutation(t[u],l);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(pe&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||Rd(e,d)!=h)&&f.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Yn(r)&&(c=si(e))&&c.eq(B.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,_e(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Ad(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Id(e,l)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||_e(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(ae&&Je<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f)}let s=i&&i.parentNode==e.target?K(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?K(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Eo=new WeakMap,To=!1;function Ad(n){if(!Eo.has(n)&&(Eo.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=pe,To)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),To=!0}}function Oo(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return ht(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function Pd(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Oo(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Oo(n,t):null}function Rd(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function Id(n,e){var t;let{focusNode:r,focusOffset:i}=n.domSelectionRange();for(let o of e)if(((t=o.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let s=o.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let a=s;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(o,a.firstChild),r==o&&n.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}function _d(n,e,t){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),c,u=l.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Yn(l)||c.push({node:l.focusNode,offset:l.focusOffset})),X&&n.input.lastKeyCode===8)for(let m=o;m>i;m--){let y=r.childNodes[m-1],x=y.pmViewDesc;if(y.nodeName=="BR"&&!x){o=m;break}if(!x||x.size)break}let d=n.state.doc,f=n.someProp("domParser")||He.fromSchema(n.state.schema),h=d.resolve(s),p=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:o,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Bd,context:h});if(c&&c[0].pos!=null){let m=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=m),p={anchor:m+s,head:y+s}}return{doc:g,sel:p,from:s,to:a}}function Bd(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Z&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Z&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Fd=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function zd(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,R=si(n,M);if(R&&!n.state.selection.eq(R)){if(X&&Re&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",te=>te(n,tt(13,"Enter"))))return;let _=n.state.tr.setSelection(R);M=="pointer"?_.setMeta("pointer",!0):M=="key"&&_.scrollIntoView(),o&&_.setMeta("composition",o),n.dispatch(_)}return}let s=n.state.doc.resolve(e),a=s.sharedDepth(t);e=s.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=_d(n,e,t),u=n.state.doc,d=u.slice(c.from,c.to),f,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,h="end"):(f=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let p=Vd(d.content,c.doc.content,c.from,f,h);if(p&&n.input.domChangeCount++,(Pt&&n.input.lastIOSEnter>Date.now()-225||Re)&&i.some(M=>M.nodeType==1&&!Fd.test(M.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",M=>M(n,tt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof I&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let M=Ao(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let R=n.state.tr.setSelection(M);o&&R.setMeta("composition",o),n.dispatch(R)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof I&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),ae&&Je<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let g=c.doc.resolveNoCache(p.start-c.from),m=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),x=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=p.endA;if((Pt&&n.input.lastIOSEnter>Date.now()-225&&(!x||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!x&&g.pos<c.doc.content.size&&(!g.sameParent(m)||!g.parent.inlineContent)&&g.pos<m.pos&&!/\S/.test(c.doc.textBetween(g.pos,m.pos,"","")))&&n.someProp("handleKeyDown",M=>M(n,tt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&jd(u,p.start,p.endA,g,m)&&n.someProp("handleKeyDown",M=>M(n,tt(8,"Backspace")))){Re&&X&&n.domObserver.suppressSelectionUpdates();return}X&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Re&&!x&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,m=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,tt(13,"Enter"))})},20));let w=p.start,N=p.endA,k=M=>{let R=M||n.state.tr.replace(w,N,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let _=Ao(n,R.doc,c.sel);_&&!(X&&n.composing&&_.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(_.head==w||_.head==R.mapping.map(N)-1)||ae&&_.empty&&_.head==w)&&R.setSelection(_)}return o&&R.setMeta("composition",o),R.scrollIntoView()},P;if(x)if(g.pos==m.pos){ae&&Je<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>_e(n),20));let M=k(n.state.tr.delete(w,N)),R=u.resolve(p.start).marksAcross(u.resolve(p.endA));R&&M.ensureMarks(R),n.dispatch(M)}else if(p.endA==p.endB&&(P=Ld(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let M=k(n.state.tr);P.type=="add"?M.addMark(w,N,P.mark):M.removeMark(w,N,P.mark),n.dispatch(M)}else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,m.parentOffset),R=()=>k(n.state.tr.insertText(M,w,N));n.someProp("handleTextInput",_=>_(n,w,N,M,R))||n.dispatch(R())}else n.dispatch(k());else n.dispatch(k())}function Ao(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:ai(n,e.resolve(t.anchor),e.resolve(t.head))}function Ld(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,o=r,s,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<t.length;u++)o=t[u].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(v.from(c).eq(n))return{mark:a,type:s}}function jd(n,e,t,r,i){if(t-e<=i.pos-r.pos||gr(r,!0,!1)<i.pos)return!1;let o=n.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&t==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(gr(o,!0,!0));return!s.parent.isTextblock||s.pos>t||gr(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function gr(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function Vd(n,e,t,r,i){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:s,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s<o&&n.size<e.size){let l=r<=o&&r>=s?o-r:0;o-=l,o&&o<e.size&&Po(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-s),s=o}else if(a<o){let l=r<=o&&r>=a?o-r:0;o-=l,o&&o<n.size&&Po(n.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function Po(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Fa{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new rd,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Fo),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=_o(this),Io(this),this.nodeViews=Bo(this),this.docView=ho(this.state.doc,Ro(this),mr(this),this.dom,this),this.domObserver=new Od(this,(r,i,o,s)=>zd(this,r,i,o,s)),this.domObserver.start(),id(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&$r(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Fo),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Oa(this),s=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Bo(this);$d(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&$r(this),this.editable=_o(this),Io(this);let l=mr(this),c=Ro(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&bu(this);if(s){this.domObserver.stop();let h=d&&(ae||X)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Wd(i.selection,e.selection);if(d){let p=X?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=bd(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=ho(e.doc,c,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Wu(this))?_e(this,h):(ba(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&xu(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof E){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&so(this,t.getBoundingClientRect(),e)}else so(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&o<this.state.doc.content.size&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Pa(e.slice,e.move,i<0?void 0:E.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(i=t?t(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(ae){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&vu(this.dom),_e(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Cu(this,e)}coordsAtPos(e,t=1){return ua(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Ou(this,t||this.state,e)}pasteHTML(e,t){return en(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return en(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return li(this,e)}destroy(){this.docView&&(od(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],mr(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,lu())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ad(this,e)}domSelectionRange(){let e=this.domSelection();return e?Z&&this.root.nodeType===11&&hu(this.dom.ownerDocument)==this.dom&&Pd(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Fa.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Ro(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[ye.node(0,n.state.doc.content.size,e)]}function Io(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:ye.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function _o(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Wd(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Bo(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function $d(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Fo(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ke={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},zn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},qd=typeof navigator<"u"&&/Mac/.test(navigator.platform),Hd=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var G=0;G<10;G++)Ke[48+G]=Ke[96+G]=String(G);for(var G=1;G<=24;G++)Ke[G+111]="F"+G;for(var G=65;G<=90;G++)Ke[G]=String.fromCharCode(G+32),zn[G]=String.fromCharCode(G);for(var yr in Ke)zn.hasOwnProperty(yr)||(zn[yr]=Ke[yr]);function Jd(n){var e=qd&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Hd&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?zn:Ke)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Yd=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Ud=typeof navigator<"u"&&/Win/.test(navigator.platform);function Kd(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))Yd?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function Gd(n){let e=Object.create(null);for(let t in n)e[Kd(t)]=n[t];return e}function br(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Xd(n){return new ke({props:{handleKeyDown:Qd(n)}})}function Qd(n){let e=Gd(n);return function(t,r){let i=Jd(r),o,s=e[br(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[br(i,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Ud&&r.ctrlKey&&r.altKey)&&(o=Ke[r.keyCode])&&o!=i){let a=e[br(o,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var Zd=Object.defineProperty,pi=(n,e)=>{for(var t in e)Zd(n,t,{get:e[t],enumerable:!0})};function Gn(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}var Xn=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,o=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([s,a])=>[s,(...c)=>{const u=a(...c)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:o}=r,s=[],a=!!n,l=n||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(l),s.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(t).map(([d,f])=>[d,(...p)=>{const g=this.buildProps(l,e),m=f(...p)(g);return s.push(m),u}])),run:c};return u}createCan(n){const{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,o=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:o}=r,s={tr:n,editor:r,view:o,state:Gn({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)(s)]))}};return s}},za={};pi(za,{blur:()=>ef,clearContent:()=>tf,clearNodes:()=>nf,command:()=>rf,createParagraphNear:()=>of,cut:()=>sf,deleteCurrentNode:()=>af,deleteNode:()=>lf,deleteRange:()=>cf,deleteSelection:()=>uf,enter:()=>df,exitCode:()=>ff,extendMarkRange:()=>hf,first:()=>pf,focus:()=>gf,forEach:()=>yf,insertContent:()=>bf,insertContentAt:()=>kf,joinBackward:()=>Mf,joinDown:()=>Sf,joinForward:()=>Cf,joinItemBackward:()=>Nf,joinItemForward:()=>Df,joinTextblockBackward:()=>Ef,joinTextblockForward:()=>Tf,joinUp:()=>wf,keyboardShortcut:()=>Af,lift:()=>Pf,liftEmptyBlock:()=>Rf,liftListItem:()=>If,newlineInCode:()=>_f,resetAttributes:()=>Bf,scrollIntoView:()=>Ff,selectAll:()=>zf,selectNodeBackward:()=>Lf,selectNodeForward:()=>jf,selectParentNode:()=>Vf,selectTextblockEnd:()=>Wf,selectTextblockStart:()=>$f,setContent:()=>qf,setMark:()=>uh,setMeta:()=>dh,setNode:()=>fh,setNodeSelection:()=>hh,setTextDirection:()=>ph,setTextSelection:()=>mh,sinkListItem:()=>gh,splitBlock:()=>yh,splitListItem:()=>bh,toggleList:()=>xh,toggleMark:()=>vh,toggleNode:()=>kh,toggleWrap:()=>wh,undoInputRule:()=>Sh,unsetAllMarks:()=>Mh,unsetMark:()=>Ch,unsetTextDirection:()=>Nh,updateAttributes:()=>Dh,wrapIn:()=>Eh,wrapInList:()=>Th});var ef=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),tf=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),nf=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:s})=>{n.doc.nodesBetween(o.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=_t(h);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},rf=n=>e=>n(e),of=()=>({state:n,dispatch:e})=>Zs(n,e),sf=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new I(r.doc.resolve(Math.max(s-1,0)))),!0},af=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const a=i.before(o),l=i.after(o);n.delete(a,l).scrollIntoView()}return!0}return!1};function Y(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var lf=n=>({tr:e,state:t,dispatch:r})=>{const i=Y(n,t.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const l=o.before(s),c=o.after(s);e.delete(l,c).scrollIntoView()}return!0}return!1},cf=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},uf=()=>({state:n,dispatch:e})=>ei(n,e),df=()=>({commands:n})=>n.keyboardShortcut("Enter"),ff=()=>({state:n,dispatch:e})=>Yc(n,e);function mi(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Ln(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:mi(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function La(n,e,t={}){return n.find(r=>r.type===e&&Ln(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function zo(n,e,t={}){return!!La(n,e,t)}function gi(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!La([...i.node.marks],e,t)))return;let s=i.index,a=n.start()+i.offset,l=s+1,c=a+i.node.nodeSize;for(;s>0&&zo([...n.parent.child(s-1).marks],e,t);)s-=1,a-=n.parent.child(s).nodeSize;for(;l<n.parent.childCount&&zo([...n.parent.child(l).marks],e,t);)c+=n.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function Be(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var hf=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=Be(n,r.schema),{doc:s,selection:a}=t,{$from:l,from:c,to:u}=a;if(i){const d=gi(l,o,e);if(d&&d.from<=c&&d.to>=u){const f=I.create(s,d.from,d.to);t.setSelection(f)}}return!0},pf=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function ja(n){return n instanceof I}function ot(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Va(n,e=null){if(!e)return null;const t=B.atStart(n),r=B.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?I.create(n,ot(0,i,o),ot(n.content.size,i,o)):I.create(n,ot(e,i,o),ot(e,i,o))}function qr(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function nn(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function mf(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var gf=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(nn()||qr())&&r.dom.focus(),mf()&&!nn()&&!qr()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(o&&n===null&&!ja(t.state.selection))return s(),!0;const a=Va(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},yf=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),bf=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Wa=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Wa(r)}return n};function bn(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Wa(t)}function rn(n,e,t){if(n instanceof be||n instanceof v)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return v.fromArray(n.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),rn("",e,t)}if(i){if(t.errorOnInvalidContent){let s=!1,a="";const l=new Ds({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?He.fromSchema(l).parseSlice(bn(n),t.parseOptions):He.fromSchema(l).parse(bn(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=He.fromSchema(e);return t.slice?o.parseSlice(bn(n),t.parseOptions).content:o.parse(bn(n),t.parseOptions)}return rn("",e,t)}function xf(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof W||i instanceof J))return;const o=n.mapping.maps[r];let s=0;o.forEach((a,l,c,u)=>{s===0&&(s=u)}),n.setSelection(B.near(n.doc.resolve(s),t))}var vf=n=>!("type"in n),kf=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=m=>{o.emit("contentError",{editor:o,error:m,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{rn(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(m){l(m)}try{a=rn(e,o.schema,{parseOptions:c,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:o.options.enableContentCheck})}catch(m){return l(m),!1}let{from:u,to:d}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,h=!0;if((vf(a)?a:[a]).forEach(m=>{m.check(),f=f?m.isText&&m.marks.length===0:!1,h=h?m.isBlock:!1}),u===d&&h){const{parent:m}=r.doc.resolve(u);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(u-=1,d+=1)}let g;if(f){if(Array.isArray(e))g=e.map(m=>m.text||"").join("");else if(e instanceof v){let m="";e.forEach(y=>{y.text&&(m+=y.text)}),g=m}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,d)}else{g=a;const m=r.doc.resolve(u),y=m.node(),x=m.parentOffset===0,w=y.isText||y.isTextblock,N=y.content.size>0;x&&w&&N&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}t.updateSelection&&xf(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},wf=()=>({state:n,dispatch:e})=>qc(n,e),Sf=()=>({state:n,dispatch:e})=>Hc(n,e),Mf=()=>({state:n,dispatch:e})=>Js(n,e),Cf=()=>({state:n,dispatch:e})=>Gs(n,e),Nf=()=>({state:n,dispatch:e,tr:t})=>{try{const r=qn(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Df=()=>({state:n,dispatch:e,tr:t})=>{try{const r=qn(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Ef=()=>({state:n,dispatch:e})=>Wc(n,e),Tf=()=>({state:n,dispatch:e})=>$c(n,e);function $a(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Of(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,s;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))nn()||$a()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}var Af=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=Of(n).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function on(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,s=e?Y(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(i,f+d.nodeSize);a.push({node:d,from:h,to:p})});const l=i-r,c=a.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Ln(d.node.attrs,t,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var Pf=(n,e={})=>({state:t,dispatch:r})=>{const i=Y(n,t.schema);return on(t,i,e)?Jc(t,r):!1},Rf=()=>({state:n,dispatch:e})=>ea(n,e),If=n=>({state:e,dispatch:t})=>{const r=Y(n,e.schema);return iu(r)(e,t)},_f=()=>({state:n,dispatch:e})=>Qs(n,e);function Qn(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Lo(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var Bf=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const a=Qn(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(o=Y(n,r.schema)),a==="mark"&&(s=Be(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{o&&o===u.type&&(l=!0,i&&t.setNodeMarkup(d,void 0,Lo(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(f=>{s===f.type&&(l=!0,i&&t.addMark(d,d+u.nodeSize,s.create(Lo(f.attrs,e))))})})}),l},Ff=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),zf=()=>({tr:n,dispatch:e})=>{if(e){const t=new ue(n.doc);n.setSelection(t)}return!0},Lf=()=>({state:n,dispatch:e})=>Us(n,e),jf=()=>({state:n,dispatch:e})=>Xs(n,e),Vf=()=>({state:n,dispatch:e})=>Gc(n,e),Wf=()=>({state:n,dispatch:e})=>Zc(n,e),$f=()=>({state:n,dispatch:e})=>Qc(n,e);function Hr(n,e,t={},r={}){return rn(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var qf=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{const{doc:l}=o;if(r.preserveWhitespace!=="full"){const c=Hr(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!t),!0}return s&&o.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function qa(n,e){const t=Be(e,n.schema),{from:r,to:i,empty:o}=n.selection,s=[];o?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function Hf(n,e){const t=new Ws(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function Jf(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function sb(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function Yf(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Zn(n){return e=>Yf(e.$from,n)}function D(n,e,t){return n.config[e]===void 0&&n.parent?D(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?D(n.parent,e,t):null}):n.config[e]}function yi(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=D(e,"addExtensions",t);return r?[e,...yi(r())]:e}).flat(10)}function bi(n,e){const t=gt.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function Ha(n){return typeof n=="function"}function L(n,e=void 0,...t){return Ha(n)?e?n.bind(e)(...t):n(...t):n}function Uf(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Rt(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function Ja(n){const e=[],{nodeExtensions:t,markExtensions:r}=Rt(n),i=[...t,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=t.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...s,...a];return n.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage,extensions:i},d=D(c,"addGlobalAttributes",u);if(!d)return;d().forEach(h=>{let p;Array.isArray(h.types)?p=h.types:h.types==="*"?p=l:h.types==="nodes"?p=s:h.types==="marks"?p=a:p=[],p.forEach(g=>{Object.entries(h.attributes).forEach(([m,y])=>{e.push({type:g,name:m,attribute:{...o,...y}})})})})}),i.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},d=D(c,"addAttributes",u);if(!d)return;const f=d();Object.entries(f).forEach(([h,p])=>{const g={...o,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:c.name,name:h,attribute:g})})}),e}function Kf(n){const e=[];let t="",r=!1,i=!1,o=0;const s=n.length;for(let a=0;a<s;a+=1){const l=n[a];if(l==="'"&&!i){r=!r,t+=l;continue}if(l==='"'&&!r){i=!i,t+=l;continue}if(!r&&!i){if(l==="("){o+=1,t+=l;continue}if(l===")"&&o>0){o-=1,t+=l;continue}if(l===";"&&o===0){e.push(t),t="";continue}}t+=l}return t&&e.push(t),e}function jo(n){const e=[],t=Kf(n||""),r=t.length;for(let i=0;i<r;i+=1){const o=t[i],s=o.indexOf(":");if(s===-1)continue;const a=o.slice(0,s).trim(),l=o.slice(s+1).trim();a&&l&&e.push([a,l])}return e}function Ya(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const a=o?String(o).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=new Map([...jo(r[i]),...jo(o)]);r[i]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[i]=o}),r},{})}function sn(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Ya(t,r),{})}function Gf(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Vo(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(t):Gf(t.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function Wo(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Uf(t)?!1:t!=null))}function $o(n){var e,t;const r={};return!((e=n?.attribute)!=null&&e.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),((t=n?.attribute)==null?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function Xf(n,e){var t;const r=Ja(n),{nodeExtensions:i,markExtensions:o}=Rt(n),s=(t=i.find(c=>D(c,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((y,x)=>{const w=D(x,"extendNodeSchema",d);return{...y,...w?w(c):{}}},{}),h=Wo({...f,content:L(D(c,"content",d)),marks:L(D(c,"marks",d)),group:L(D(c,"group",d)),inline:L(D(c,"inline",d)),atom:L(D(c,"atom",d)),selectable:L(D(c,"selectable",d)),draggable:L(D(c,"draggable",d)),code:L(D(c,"code",d)),whitespace:L(D(c,"whitespace",d)),linebreakReplacement:L(D(c,"linebreakReplacement",d)),defining:L(D(c,"defining",d)),isolating:L(D(c,"isolating",d)),attrs:Object.fromEntries(u.map($o))}),p=L(D(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>Vo(y,u)));const g=D(c,"renderHTML",d);g&&(h.toDOM=y=>g({node:y,HTMLAttributes:sn(y,u)}));const m=D(c,"renderText",d);return m&&(h.toText=m),[c.name,h]})),l=Object.fromEntries(o.map(c=>{const u=r.filter(m=>m.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((m,y)=>{const x=D(y,"extendMarkSchema",d);return{...m,...x?x(c):{}}},{}),h=Wo({...f,inclusive:L(D(c,"inclusive",d)),excludes:L(D(c,"excludes",d)),group:L(D(c,"group",d)),spanning:L(D(c,"spanning",d)),code:L(D(c,"code",d)),attrs:Object.fromEntries(u.map($o))}),p=L(D(c,"parseHTML",d));p&&(h.parseDOM=p.map(m=>Vo(m,u)));const g=D(c,"renderHTML",d);return g&&(h.toDOM=m=>g({mark:m,HTMLAttributes:sn(m,u)})),[c.name,h]}));return new Ds({topNode:s,nodes:a,marks:l})}function Qf(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Kt(n){return n.sort((t,r)=>{const i=D(t,"priority")||100,o=D(r,"priority")||100;return i>o?-1:i<o?1:0})}function Ua(n){const e=Kt(yi(n)),t=Qf(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Ka(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
11
+
12
+ `,textSerializers:s={}}=t||{};let a="";return n.nodesBetween(r,i,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=o);const h=s?.[l.type.name];if(h)return u&&(a+=h({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l?.text)==null?void 0:f.slice(Math.max(r,c)-c,i-c))}),a}function Zf(n,e){const t={from:0,to:n.content.size};return Ka(n,t,e)}function Ga(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function eh(n,e){const t=Y(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,a=>{o.push(a)});const s=o.reverse().find(a=>a.type.name===t.name);return s?{...s.attrs}:{}}function th(n,e){const t=Qn(typeof e=="string"?e:e.name,n.schema);return t==="node"?eh(n,e):t==="mark"?qa(n,e):{}}function nh(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function rh(n){const e=nh(n);return e.length===1?e:e.filter((t,r)=>!e.filter((o,s)=>s!==r).some(o=>t.oldRange.from>=o.oldRange.from&&t.oldRange.to<=o.oldRange.to&&t.newRange.from>=o.newRange.from&&t.newRange.to<=o.newRange.to))}function ih(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,o)=>{const s=[];if(i.ranges.length)i.forEach((a,l)=>{s.push({from:a,to:l})});else{const{from:a,to:l}=t[o];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{const c=e.slice(o).map(a,-1),u=e.slice(o).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),rh(r)}function Xa(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),s=gi(o,i.type);s&&r.push({mark:i,...s})}):t.nodesBetween(n,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}var ab=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let o=r,s=null;for(;o>0&&s===null;){const a=i.node(o);a?.type.name===e?s=a:o-=1}return[s,o]};function Ft(n,e){return e.nodes[n]||e.marks[n]||null}function Cn(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}var oh=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),t};function Jr(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?Be(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>Ln(d.attrs,t,{strict:!1}));let s=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;n.doc.nodesBetween(h,p,(g,m)=>{if(o&&g.inlineContent&&!g.type.allowsMarkType(o))return!1;if(!g.isText&&!g.marks.length)return;const y=Math.max(h,m),x=Math.min(p,m+g.nodeSize),w=x-y;s+=w,a.push(...g.marks.map(N=>({mark:N,from:y,to:x})))})}),s===0)return!1;const l=a.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>Ln(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>o?d.mark.type!==o&&d.mark.type.excludes(o):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=s}function sh(n,e,t={}){if(!e)return on(n,null,t)||Jr(n,null,t);const r=Qn(e,n.schema);return r==="node"?on(n,e,t):r==="mark"?Jr(n,e,t):!1}var lb=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const o=Zn(a=>a.type.name===e)(n.selection);if(!o)return!1;const s=n.doc.resolve(o.pos+1);return i.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},cb=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function qo(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Ho(n,e){const{nodeExtensions:t}=Rt(e),r=t.find(s=>s.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=L(D(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function xi(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&(xi(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function ub(n){return n instanceof E}var Qa=class Za{constructor(e){this.position=e}static fromJSON(e){return new Za(e.position)}toJSON(){return{position:this.position}}};function ah(n,e){const t=e.mapping.mapResult(n.position);return{position:new Qa(t.pos),mapResult:t}}function lh(n){return new Qa(n)}function ch(n,e,t){var r;const{selection:i}=e;let o=null;if(ja(i)&&(o=i.$cursor),o){const a=(r=n.storedMarks)!=null?r:o.marks();return o.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.type.excludes(t)))}const{ranges:s}=i;return s.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(t),p=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));c=h&&p}return!c}),c})}var uh=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:s,ranges:a}=o,l=Be(n,r.schema);if(i)if(s){const c=qa(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),g=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&t.addMark(p,g,l.create({...y.attrs,...e}))}):t.addMark(p,g,l.create(e))})});return ch(r,t,l)},dh=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),fh=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=Y(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>ro(o,{...s,...e})(t)?!0:a.clearNodes()).command(({state:a})=>ro(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},hh=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=ot(n,0,r.content.size),o=E.create(r,i);e.setSelection(o)}return!0},ph=(n,e)=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=r;let s,a;return typeof e=="number"?(s=e,a=e):e&&"from"in e&&"to"in e?(s=e.from,a=e.to):(s=o.from,a=o.to),i&&t.doc.nodesBetween(s,a,(l,c)=>{l.isText||t.setNodeMarkup(c,void 0,{...l.attrs,dir:n})}),!0},mh=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,s=I.atStart(r).from,a=I.atEnd(r).to,l=ot(i,s,a),c=ot(o,s,a),u=I.create(r,l,c);e.setSelection(u)}return!0},gh=n=>({state:e,dispatch:t})=>{const r=Y(n,e.schema);return au(r)(e,t)};function Jo(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}var yh=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:a,$to:l}=o,c=i.extensionManager.attributes,u=Cn(c,a.node().type.name,a.node().attrs);if(o instanceof E&&o.node.isBlock)return!a.parentOffset||!Ie(s,a.pos)?!1:(r&&(n&&Jo(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:Jf(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Ie(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&Ie(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(o instanceof I&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),m=e.doc.resolve(g);a.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}n&&Jo(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},bh=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var s;const a=Y(n,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let y=v.empty;const x=l.index(-1)?1:l.index(-2)?2:3;for(let R=l.depth-x;R>=l.depth-3;R-=1)y=v.from(l.node(R).copy(y));const w=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,N={...Cn(f,l.node().type.name,l.node().attrs),...e},k=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill(N))||void 0;y=y.append(v.from(a.createAndFill(null,k)||void 0));const P=l.before(l.depth-(x-1));t.replace(P,l.after(-w),new S(y,4-x,0));let M=-1;t.doc.nodesBetween(P,t.doc.content.size,(R,_)=>{if(M>-1)return!1;R.isTextblock&&R.content.size===0&&(M=_+1)}),M>-1&&t.setSelection(I.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...Cn(f,d.type.name,d.attrs),...e},g={...Cn(f,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const m=h?[{type:a,attrs:p},{type:h,attrs:g}]:[{type:a,attrs:p}];if(!Ie(t.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:x}=r,{splittableMarks:w}=o.extensionManager,N=x||y.$to.parentOffset&&y.$from.marks();if(t.split(l.pos,2,m).scrollIntoView(),!N||!i)return!0;const k=N.filter(P=>w.includes(P.type.name));t.ensureMarks(k)}return!0},xr=(n,e)=>{const t=Zn(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&Ge(n.doc,t.pos)&&n.join(t.pos),!0},vr=(n,e)=>{const t=Zn(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&Ge(n.doc,r)&&n.join(r),!0},xh=(n,e,t,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=Y(n,s.schema),p=Y(e,s.schema),{selection:g,storedMarks:m}=s,{$from:y,$to:x}=g,w=y.blockRange(x),N=m||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const k=Zn(P=>Ho(P.type.name,d))(g);if(w.depth>=1&&k&&w.depth-k.depth<=1){if(k.node.type===h)return c.liftListItem(p);if(Ho(k.node.type.name,d)&&h.validContent(k.node.content)&&a)return l().command(()=>(o.setNodeMarkup(k.pos,h),!0)).command(()=>xr(o,h)).command(()=>vr(o,h)).run()}return!t||!N||!a?l().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>xr(o,h)).command(()=>vr(o,h)).run():l().command(()=>{const P=u().wrapInList(h,r),M=N.filter(R=>f.includes(R.type.name));return o.ensureMarks(M),P?!0:c.clearNodes()}).wrapInList(h,r).command(()=>xr(o,h)).command(()=>vr(o,h)).run()},vh=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Be(n,r.schema);return Jr(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},kh=(n,e,t={})=>({state:r,commands:i})=>{const o=Y(n,r.schema),s=Y(e,r.schema),a=on(r,o,t);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...t})},wh=(n,e={})=>({state:t,commands:r})=>{const i=Y(n,t.schema);return on(t,i,e)?r.lift(i):r.wrapIn(i,e)},Sh=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const s=n.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){const l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,n.schema.text(o.text,l))}else s.delete(o.from,o.to)}return!0}}return!1},Mh=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},Ch=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=t,l=Be(n,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&s){let{from:f,to:h}=a;const p=(o=c.marks().find(m=>m.type===l))==null?void 0:o.attrs,g=gi(c,l,p);g&&(f=g.from,h=g.to),t.removeMark(f,h,l)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},Nh=n=>({tr:e,state:t,dispatch:r})=>{const{selection:i}=t;let o,s;return typeof n=="number"?(o=n,s=n):n&&"from"in n&&"to"in n?(o=n.from,s=n.to):(o=i.from,s=i.to),r&&e.doc.nodesBetween(o,s,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},Dh=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const a=Qn(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(o=Y(n,r.schema)),a==="mark"&&(s=Be(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let f,h,p,g;t.selection.empty?r.doc.nodesBetween(u,d,(m,y)=>{o&&o===m.type&&(l=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m)}):r.doc.nodesBetween(u,d,(m,y)=>{y<u&&o&&o===m.type&&(l=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m),y>=u&&y<=d&&(o&&o===m.type&&(l=!0,i&&t.setNodeMarkup(y,void 0,{...m.attrs,...e})),s&&m.marks.length&&m.marks.forEach(x=>{if(s===x.type&&(l=!0,i)){const w=Math.max(y,u),N=Math.min(y+m.nodeSize,d);t.addMark(w,N,s.create({...x.attrs,...e}))}}))}),h&&(f!==void 0&&i&&t.setNodeMarkup(f,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(m=>{s===m.type&&i&&t.addMark(p,g,s.create({...m.attrs,...e}))}))}),l},Eh=(n,e={})=>({state:t,dispatch:r})=>{const i=Y(n,t.schema);return eu(i,e)(t,r)},Th=(n,e={})=>({state:t,dispatch:r})=>{const i=Y(n,t.schema);return tu(i,e)(t,r)},Oh=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},er=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},Ah=(n,e)=>{if(mi(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function xn(n){var e;const{editor:t,from:r,to:i,text:o,rules:s,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=oh(c)+o;return s.forEach(f=>{if(u)return;const h=Ah(d,f.find);if(!h)return;const p=l.state.tr,g=Gn({state:l.state,transaction:p}),m={from:r-(h[0].length-o.length),to:i},{commands:y,chain:x,can:w}=new Xn({editor:t,state:g});f.handler({state:g,range:m,match:h,commands:y,chain:x,can:w})===null||!p.steps.length||(f.undoable&&p.setMeta(a,{transform:p,from:r,to:i,text:o}),l.dispatch(p),u=!0)}),u}function Ph(n){const{editor:e,rules:t}=n,r=new ke({state:{init(){return null},apply(i,o,s){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=bi(v.from(u),s.schema);const{from:d}=l,f=d+u.length;xn({editor:e,from:d,to:f,text:u,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return xn({editor:e,from:o,to:s,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&xn({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?xn({editor:e,from:s.pos,to:s.pos,text:`
13
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Rh(n){return Object.prototype.toString.call(n).slice(8,-1)}function vn(n){return Rh(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function el(n,e){const t={...n};return vn(n)&&vn(e)&&Object.keys(e).forEach(r=>{vn(e[r])&&vn(n[r])?t[r]=el(n[r],e[r]):t[r]=e[r]}),t}var vi=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...L(D(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...L(D(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>el(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},Ih=class tl extends vi{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new tl(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(c=>c?.type.name===t.name))return!1;const l=s.find(c=>c?.type.name===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function _h(n){return typeof n=="number"}var Bh=class{constructor(n){this.find=n.find,this.handler=n.handler}},Fh=(n,e,t)=>{if(mi(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function zh(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=n,{commands:l,chain:c,can:u}=new Xn({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(h,p)=>{var g,m,y,x,w;if((m=(g=h.type)==null?void 0:g.spec)!=null&&m.code||!(h.isText||h.isTextblock||h.isInline))return;const N=(w=(x=(y=h.content)==null?void 0:y.size)!=null?x:h.nodeSize)!=null?w:0,k=Math.max(r,p),P=Math.min(i,p+N);if(k>=P)return;const M=h.isText?h.text||"":h.textBetween(k-p,P-p,void 0,"");Fh(M,o.find,s).forEach(_=>{if(_.index===void 0)return;const te=k+_.index+1,Ee=te+_[0].length,we={from:t.tr.mapping.map(te),to:t.tr.mapping.map(Ee)},Te=o.handler({state:t,range:we,match:_,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(Te)})}),d.every(h=>h!==null)}var kn=null,Lh=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function jh(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const g=u.tr,m=Gn({state:u,transaction:g});if(!(!zh({editor:e,state:m,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new ke({view(d){const f=p=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(p.target)?d.dom.parentElement:null,r&&(kn=e)},h=()=>{kn&&(kn=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(o=r===d.dom.parentElement,a=f,!o){const h=kn;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return s=f,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!i,m=p.getMeta("uiEvent")==="drop"&&!o,y=p.getMeta("applyPasteRules"),x=!!y;if(!g&&!m&&!x)return;if(x){let{text:k}=y;typeof k=="string"?k=k:k=bi(v.from(k),h.schema);const{from:P}=y,M=P+k.length,R=Lh(k);return l({rule:u,state:h,from:P,to:{b:M},pasteEvt:R})}const w=f.doc.content.findDiffStart(h.doc.content),N=f.doc.content.findDiffEnd(h.doc.content);if(!(!_h(w)||!N||w===N.b))return l({rule:u,state:h,from:w,to:N,pasteEvt:s})}}))}var tr=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Ua(n),this.schema=Xf(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ft(e.name,this.schema)},r=D(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return Kt([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Ft(r.name,this.schema)},o=[],s=D(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&D(r,"exitable",i)&&(a.ArrowRight=()=>Ih.handleExit({editor:n,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([h,p])=>[h,()=>p({editor:n})]));a={...a,...f}}const l=Xd(a);o.push(l);const c=D(r,"addInputRules",i);if(qo(r,n.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=Ph({editor:n,rules:f}),p=Array.isArray(h)?h:[h];o.push(...p)}}const u=D(r,"addPasteRules",i);if(qo(r,n.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=jh({editor:n,rules:f});o.push(...h)}}const d=D(r,"addProseMirrorPlugins",i);if(d){const f=d();o.push(...f)}return o})}get attributes(){return Ja(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Rt(this.extensions);return Object.fromEntries(e.filter(t=>!!D(t,"addNodeView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Y(t.name,this.schema)},o=D(t,"addNodeView",i);if(!o)return[];const s=o();if(!s)return[];const a=(l,c,u,d,f)=>{const h=sn(l,r);return s({node:l,view:c,getPos:u,decorations:d,innerDecorations:f,editor:n,extension:t,HTMLAttributes:h})};return[t.name,a]}))}dispatchTransaction(n){const{editor:e}=this;return Kt([...this.extensions].reverse()).reduceRight((r,i)=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Ft(i.name,this.schema)},s=D(i,"dispatchTransaction",o);return s?a=>{s.call(o,{transaction:a,next:r})}:r},n)}transformPastedHTML(n){const{editor:e}=this;return Kt([...this.extensions]).reduce((r,i)=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Ft(i.name,this.schema)},s=D(i,"transformPastedHTML",o);return s?(a,l)=>{const c=r(a,l);return s.call(o,c)}:r},n||(r=>r))}get markViews(){const{editor:n}=this,{markExtensions:e}=Rt(this.extensions);return Object.fromEntries(e.filter(t=>!!D(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Be(t.name,this.schema)},o=D(t,"addMarkView",i);if(!o)return[];const s=(a,l,c)=>{const u=sn(a,r);return o()({mark:a,view:l,inline:c,editor:n,extension:t,HTMLAttributes:u,updateAttributes:d=>{ep(a,n,d)}})};return[t.name,s]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ft(e.name,this.schema)};e.type==="mark"&&((t=L(D(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const i=D(e,"onBeforeCreate",r),o=D(e,"onCreate",r),s=D(e,"onUpdate",r),a=D(e,"onSelectionUpdate",r),l=D(e,"onTransaction",r),c=D(e,"onFocus",r),u=D(e,"onBlur",r),d=D(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};tr.resolve=Ua;tr.sort=Kt;tr.flatten=yi;var Vh={};pi(Vh,{ClipboardTextSerializer:()=>rl,Commands:()=>il,Delete:()=>ol,Drop:()=>sl,Editable:()=>al,FocusEvents:()=>cl,Keymap:()=>ul,Paste:()=>dl,Tabindex:()=>fl,TextDirection:()=>hl,focusEventsPluginKey:()=>ll});var De=class nl extends vi{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new nl(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},rl=De.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ke({key:new Xe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),a=Math.max(...o.map(u=>u.$to.pos)),l=Ga(t);return Ka(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),il=De.create({name:"commands",addCommands(){return{...za}}}),ol=De.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const o=()=>{var s,a,l,c;if((c=(l=(a=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,n))!=null?c:n.getMeta("y-sync$"))return;const u=Hf(n.before,[n,...e]);ih(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,g)=>{const m=g+p.nodeSize-2,y=h.oldRange.from<=g&&m<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:g,to:m,newFrom:u.mapping.map(g),newTo:u.mapping.map(m),deletedRange:h.oldRange,newRange:h.newRange,partial:!y,editor:this.editor,transaction:n,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var g,m;if(h instanceof ge){const y=f.slice(p).map(h.from,-1),x=f.slice(p).map(h.to),w=f.invert().map(y,-1),N=f.invert().map(x),k=(g=u.doc.nodeAt(y-1))==null?void 0:g.marks.some(M=>M.eq(h.mark)),P=(m=u.doc.nodeAt(x))==null?void 0:m.marks.some(M=>M.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:N},newRange:{from:y,to:x},partial:!!(P||k),editor:this.editor,transaction:n,combinedTransform:u})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(o,0):o()}}),sl=De.create({name:"drop",addProseMirrorPlugins(){return[new ke({key:new Xe("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),al=De.create({name:"editable",addProseMirrorPlugins(){return[new ke({key:new Xe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ll=new Xe("focusEvents"),cl=De.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ke({key:ll,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),ul=De.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,m=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?m===d.pos:B.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return nn()||$a()?o:i},addProseMirrorPlugins(){return[new ke({key:new Xe("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),i=n.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:a}=e.selection,l=B.atStart(e.doc).from,c=B.atEnd(e.doc).to;if(o||!(s===l&&a===c)||!xi(t.doc))return;const f=t.tr,h=Gn({state:t,transaction:f}),{commands:p}=new Xn({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),dl=De.create({name:"paste",addProseMirrorPlugins(){return[new ke({key:new Xe("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),fl=De.create({name:"tabindex",addProseMirrorPlugins(){return[new ke({key:new Xe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),hl=De.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Rt(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ke({key:new Xe("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),Wh=class qt{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new qt(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new qt(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new qt(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,o=t.isAtom&&!t.isText,s=t.isInline,a=this.pos+r+(o?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!i&&!s&&l.depth<=this.depth)return;const c=new qt(l,this.editor,i,i||s?t:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const o=i.node.attrs,s=Object.keys(t);for(let a=0;a<s.length;a+=1){const l=s[a];if(o[l]!==t[l])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(t);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(l=>t[l]===s.node.attrs[l])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},$h=`.ProseMirror {
14
+ position: relative;
15
+ }
16
+
17
+ .ProseMirror {
18
+ word-wrap: break-word;
19
+ white-space: pre-wrap;
20
+ white-space: break-spaces;
21
+ -webkit-font-variant-ligatures: none;
22
+ font-variant-ligatures: none;
23
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
24
+ }
25
+
26
+ .ProseMirror [contenteditable="false"] {
27
+ white-space: normal;
28
+ }
29
+
30
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
31
+ white-space: pre-wrap;
32
+ }
33
+
34
+ .ProseMirror pre {
35
+ white-space: pre-wrap;
36
+ }
37
+
38
+ img.ProseMirror-separator {
39
+ display: inline !important;
40
+ border: none !important;
41
+ margin: 0 !important;
42
+ width: 0 !important;
43
+ height: 0 !important;
44
+ }
45
+
46
+ .ProseMirror-gapcursor {
47
+ display: none;
48
+ pointer-events: none;
49
+ position: absolute;
50
+ margin: 0;
51
+ }
52
+
53
+ .ProseMirror-gapcursor:after {
54
+ content: "";
55
+ display: block;
56
+ position: absolute;
57
+ top: -2px;
58
+ width: 20px;
59
+ border-top: 1px solid black;
60
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
61
+ }
62
+
63
+ @keyframes ProseMirror-cursor-blink {
64
+ to {
65
+ visibility: hidden;
66
+ }
67
+ }
68
+
69
+ .ProseMirror-hideselection *::selection {
70
+ background: transparent;
71
+ }
72
+
73
+ .ProseMirror-hideselection *::-moz-selection {
74
+ background: transparent;
75
+ }
76
+
77
+ .ProseMirror-hideselection * {
78
+ caret-color: transparent;
79
+ }
80
+
81
+ .ProseMirror-focused .ProseMirror-gapcursor {
82
+ display: block;
83
+ }`;function qh(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var Hh=class extends Oh{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:ah,createMappablePosition:lh},this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:o})=>this.options.onDrop(r,i,o)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=Va(e,this.options.autofocus);this.editorState=Nt.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n?.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=qh($h,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){const t=Ha(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;t=t.filter(s=>!s.key.startsWith(o))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const r=[...this.options.enableCoreExtensions?[al,rl.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),il,cl,ul,fl,sl,dl,ol,hl.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new tr(r,this)}createCommandManager(){this.commandManager=new Xn({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=Hr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=Hr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){const{editorProps:e,enableExtensionDispatchTransaction:t}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=t?this.extensionManager.dispatchTransaction(r):r,o=e.transformPastedHTML,s=this.extensionManager.transformPastedHTML(o);this.editorView=new Fa(n,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),i=t.includes(n),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const s=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=s?.getMeta("focus"),l=s?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),!(n.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return th(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return sh(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return bi(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`
84
+
85
+ `,textSerializers:t={}}=n||{};return Zf(this.state.doc,{blockSeparator:e,textSerializers:{...Ga(this.schema),...t}})}get isEmpty(){return xi(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n);return new Wh(e,this)}get $doc(){return this.$pos(0)}};function db(n){return new er({find:n.find,handler:({state:e,range:t,match:r})=>{const i=L(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],a=r[0];if(s){const l=a.search(/\S/),c=t.from+a.indexOf(s),u=c+s.length;if(Xa(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>c).length)return null;u<t.to&&o.delete(u,t.to),c>t.from&&o.delete(t.from+l,c);const f=t.from+l+s.length;o.addMark(t.from+l,f,n.type.create(i||{})),o.removeStoredMark(n.type)}},undoable:n.undoable})}function fb(n){return new er({find:n.find,handler:({state:e,range:t,match:r})=>{const i=L(n.getAttributes,void 0,r)||{},{tr:o}=e,s=t.from;let a=t.to;const l=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];o.insertText(d,s+r[0].length-1),o.replaceWith(u,a,l)}else if(r[0]){const c=n.type.isInline?s:s-1;o.insert(c,n.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()},undoable:n.undoable})}function hb(n){return new er({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=L(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)},undoable:n.undoable})}function pb(n){return new er({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=L(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),l=s.doc.resolve(t.from).blockRange(),c=l&&Qr(l,n.type,o);if(!c)return null;if(s.wrap(l,c),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const g=p.filter(m=>h.includes(m.type.name));s.ensureMarks(g)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,o).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Ge(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&s.join(t.from-1)},undoable:n.undoable})}function mb(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof E){const o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){const o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}function gb(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var Jh={};pi(Jh,{createAtomBlockMarkdownSpec:()=>Yh,createBlockMarkdownSpec:()=>Uh,createInlineMarkdownSpec:()=>Xh,parseAttributes:()=>ki,parseIndentedBlocks:()=>Qh,renderNestedMarkdownContent:()=>Zh,serializeAttributes:()=>wi});function ki(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(u=>u.trim().slice(1));e.class=c.join(" ")}const o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(e.id=o[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=t[f];h&&(e[c]=h.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function wi(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function Yh(n){const{nodeName:e,name:t,parseAttributes:r=ki,serializeAttributes:i=wi,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:a}=n,l=t||e,c=u=>{if(!a)return u;const d={};return a.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...o,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const g=p[1]||"",m=r(g);if(!s.find(x=>!(x in m)))return{type:e,raw:p[0],attributes:m}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=i(d),h=f?` {${f}}`:"";return`:::${l}${h} :::`}}}function Uh(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=ki,serializeAttributes:o=wi,defaultAttributes:s={},content:a="block",allowedAttributes:l}=n,c=t||e,u=d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const g=r(d);h=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...s,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),m=d.match(g);if(!m)return;const[y,x=""]=m,w=i(x);let N=1;const k=y.length;let P="";const M=/^:::([\w-]*)(\s.*)?/gm,R=d.slice(k);for(M.lastIndex=0;;){const _=M.exec(R);if(_===null)break;const te=_.index,Ee=_[1];if(!((p=_[2])!=null&&p.endsWith(":::"))){if(Ee)N+=1;else if(N-=1,N===0){const we=R.slice(0,te);P=we.trim();const Te=d.slice(0,k+te+_[0].length);let oe=[];if(P)if(a==="block")for(oe=h.blockTokens(we),oe.forEach(q=>{q.text&&(!q.tokens||q.tokens.length===0)&&(q.tokens=h.inlineTokens(q.text))});oe.length>0;){const q=oe[oe.length-1];if(q.type==="paragraph"&&(!q.text||q.text.trim()===""))oe.pop();else break}else oe=h.inlineTokens(P);return{type:e,raw:Te,attributes:w,content:P,tokens:oe}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=o(h),g=p?` {${p}}`:"",m=f.renderChildren(d.content||[],`
86
+
87
+ `);return`:::${c}${g}
88
+
89
+ ${m}
90
+
91
+ :::`}}}function Kh(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,i,o,s]=r;e[i]=o||s,r=t.exec(n)}return e}function Gh(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function Xh(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Kh,serializeAttributes:o=Gh,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=n,c=t||e,u=f=>{if(!l)return f;const h={};return l.forEach(p=>{const g=typeof p=="string"?p:p.name,m=typeof p=="string"?void 0:p.skipIfDefault;if(g in f){const y=f[g];if(m!==void 0&&y===m)return;h[g]=y}}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...s,...f.attributes};if(a)return h.createNode(e,p);const g=r?r(f):f.content||"";return g?h.createNode(e,p,[h.createTextNode(g)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),g=p?.index;return g!==void 0?g:-1},tokenize(f,h,p){const g=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),m=f.match(g);if(!m)return;let y="",x="";if(a){const[,N]=m;x=N}else{const[,N,k]=m;x=N,y=k||""}const w=i(x.trim());return{type:e,raw:m[0],content:y.trim(),attributes:w}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const p=u(f.attrs||{}),g=o(p),m=g?` ${g}`:"";return a?`[${c}${m}]`:`[${c}${m}]${h}[/${c}]`}}}function Qh(n,e,t){var r,i,o,s;const a=n.split(`
92
+ `),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const f=a[u],h=f.match(e.itemPattern);if(!h){if(l.length>0)break;if(f.trim()===""){u+=1,c=`${c}${f}
93
+ `;continue}else return}const p=e.extractItemData(h),{indentLevel:g,mainContent:m}=p;c=`${c}${f}
94
+ `;const y=[m];for(u+=1;u<a.length;){const k=a[u];if(k.trim()===""){const M=a.slice(u+1).findIndex(te=>te.trim()!=="");if(M===-1)break;if((((i=(r=a[u+1+M].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>g){y.push(k),c=`${c}${k}
95
+ `,u+=1;continue}else break}if((((s=(o=k.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:s.length)||0)>g)y.push(k),c=`${c}${k}
96
+ `,u+=1;else break}let x;const w=y.slice(1);if(w.length>0){const k=w.map(P=>P.slice(g+d)).join(`
97
+ `);k.trim()&&(e.customNestedParser?x=e.customNestedParser(k):x=t.blockTokens(k))}const N=e.createToken(p,x);l.push(N)}if(l.length!==0)return{items:l,raw:c}}function Zh(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(r):t,[o,...s]=n.content,a=e.renderChildren([o]);let l=`${i}${a}`;return s&&s.length>0&&s.forEach((c,u)=>{var d,f;const h=(f=(d=e.renderChild)==null?void 0:d.call(e,c,u+1))!=null?f:e.renderChildren([c]);if(h!=null){const p=h.split(`
98
+ `).map(g=>g?e.indent(g):e.indent("")).join(`
99
+ `);l+=c.type==="paragraph"?`
100
+
101
+ ${p}`:`
102
+ ${p}`}}),l}function ep(n,e,t={}){const{state:r}=e,{doc:i,tr:o}=r,s=n;i.descendants((a,l)=>{const c=o.mapping.map(l),u=o.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(h=>{if(h!==s)return!1;d=h}),!d)return;let f=!1;if(Object.keys(t).forEach(h=>{t[h]!==d.attrs[h]&&(f=!0)}),f){const h=n.type.create({...n.attrs,...t});o.removeMark(c,u,n.type),o.addMark(c,u,h)}}),o.docChanged&&e.view.dispatch(o)}var tp=class pl extends vi{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new pl(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},np=class{constructor(n,e,t){this.isDragging=!1,this.component=n,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(n){var e,t,r,i,o,s,a;const{view:l}=this.editor,c=n.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(c)||!u)return;let d=0,f=0;if(this.dom!==u){const x=this.dom.getBoundingClientRect(),w=u.getBoundingClientRect(),N=(i=n.offsetX)!=null?i:(r=n.nativeEvent)==null?void 0:r.offsetX,k=(s=n.offsetY)!=null?s:(o=n.nativeEvent)==null?void 0:o.offsetY;d=w.x-x.x+N,f=w.y-x.y+k}const h=this.dom.cloneNode(!0);try{const x=this.dom.getBoundingClientRect();h.style.width=`${Math.round(x.width)}px`,h.style.height=`${Math.round(x.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(h),document.body.appendChild(p),(a=n.dataTransfer)==null||a.setDragImage(h,d,f)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const m=E.create(l.state.doc,g),y=l.state.tr.setSelection(m);l.dispatch(y)}stopEvent(n){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:n});const t=n.target;if(!(this.dom.contains(t)&&!((e=this.contentDOM)!=null&&e.contains(t))))return!1;const i=n.type.startsWith("drag"),o=n.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!o&&!i)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=E.isSelectable(this.node),d=n.type==="copy",f=n.type==="paste",h=n.type==="cut",p=n.type==="mousedown";if(!c&&u&&i&&n.target===this.dom&&n.preventDefault(),c&&i&&!l&&n.target===this.dom)return n.preventDefault(),!1;if(c&&a&&!l&&p){const g=t.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||o||d||f||h||p&&u)}ignoreMutation(n){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:n}):this.node.isLeaf||this.node.isAtom?!0:n.type==="selection"||this.dom.contains(n.target)&&n.type==="childList"&&(nn()||qr())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===n.target&&n.type==="attributes"?!0:!this.contentDOM.contains(n.target)}updateAttributes(n){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...n}),!0)})}deleteNode(){const n=this.getPos();if(typeof n!="number")return;const e=n+this.node.nodeSize;this.editor.commands.deleteRange({from:n,to:e})}};function yb(n){return new Bh({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=L(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let c=t.to;if(a){const u=l.search(/\S/),d=t.from+l.indexOf(a),f=d+a.length;if(Xa(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===n.type&&m!==p.mark.type)).filter(p=>p.to>d).length)return null;f<t.to&&s.delete(f,t.to),d>t.from&&s.delete(t.from+u,d),c=t.from+u+a.length,s.addMark(t.from+u,c,n.type.create(o||{})),s.removeStoredMark(n.type)}}})}const{getOwnPropertyNames:rp,getOwnPropertySymbols:ip}=Object,{hasOwnProperty:op}=Object.prototype;function kr(n,e){return function(r,i,o){return n(r,i,o)&&e(r,i,o)}}function wn(n){return function(t,r,i){if(!t||!r||typeof t!="object"||typeof r!="object")return n(t,r,i);const{cache:o}=i,s=o.get(t),a=o.get(r);if(s&&a)return s===r&&a===t;o.set(t,r),o.set(r,t);const l=n(t,r,i);return o.delete(t),o.delete(r),l}}function sp(n){return n?.[Symbol.toStringTag]}function Yo(n){return rp(n).concat(ip(n))}const ap=Object.hasOwn||((n,e)=>op.call(n,e));function yt(n,e){return n===e||!n&&!e&&n!==n&&e!==e}const lp="__v",cp="__o",up="_owner",{getOwnPropertyDescriptor:Uo,keys:Ko}=Object;function dp(n,e){return n.byteLength===e.byteLength&&jn(new Uint8Array(n),new Uint8Array(e))}function fp(n,e,t){let r=n.length;if(e.length!==r)return!1;for(;r-- >0;)if(!t.equals(n[r],e[r],r,r,n,e,t))return!1;return!0}function hp(n,e){return n.byteLength===e.byteLength&&jn(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function pp(n,e){return yt(n.getTime(),e.getTime())}function mp(n,e){return n.name===e.name&&n.message===e.message&&n.cause===e.cause&&n.stack===e.stack}function gp(n,e){return n===e}function Go(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),o=n.entries();let s,a,l=0;for(;(s=o.next())&&!s.done;){const c=e.entries();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(i[d]){d++;continue}const f=s.value,h=a.value;if(t.equals(f[0],h[0],l,d,n,e,t)&&t.equals(f[1],h[1],f[0],h[0],n,e,t)){u=i[d]=!0;break}d++}if(!u)return!1;l++}return!0}const yp=yt;function bp(n,e,t){const r=Ko(n);let i=r.length;if(Ko(e).length!==i)return!1;for(;i-- >0;)if(!ml(n,e,t,r[i]))return!1;return!0}function zt(n,e,t){const r=Yo(n);let i=r.length;if(Yo(e).length!==i)return!1;let o,s,a;for(;i-- >0;)if(o=r[i],!ml(n,e,t,o)||(s=Uo(n,o),a=Uo(e,o),(s||a)&&(!s||!a||s.configurable!==a.configurable||s.enumerable!==a.enumerable||s.writable!==a.writable)))return!1;return!0}function xp(n,e){return yt(n.valueOf(),e.valueOf())}function vp(n,e){return n.source===e.source&&n.flags===e.flags}function Xo(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),o=n.values();let s,a;for(;(s=o.next())&&!s.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!i[u]&&t.equals(s.value,a.value,s.value,a.value,n,e,t)){c=i[u]=!0;break}u++}if(!c)return!1}return!0}function jn(n,e){let t=n.byteLength;if(e.byteLength!==t||n.byteOffset!==e.byteOffset)return!1;for(;t-- >0;)if(n[t]!==e[t])return!1;return!0}function kp(n,e){return n.hostname===e.hostname&&n.pathname===e.pathname&&n.protocol===e.protocol&&n.port===e.port&&n.hash===e.hash&&n.username===e.username&&n.password===e.password}function ml(n,e,t,r){return(r===up||r===cp||r===lp)&&(n.$$typeof||e.$$typeof)?!0:ap(e,r)&&t.equals(n[r],e[r],r,r,n,e,t)}const wp="[object ArrayBuffer]",Sp="[object Arguments]",Mp="[object Boolean]",Cp="[object DataView]",Np="[object Date]",Dp="[object Error]",Ep="[object Map]",Tp="[object Number]",Op="[object Object]",Ap="[object RegExp]",Pp="[object Set]",Rp="[object String]",Ip={"[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},_p="[object URL]",Bp=Object.prototype.toString;function Fp({areArrayBuffersEqual:n,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:s,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(m,y,x){if(m===y)return!0;if(m==null||y==null)return!1;const w=typeof m;if(w!==typeof y)return!1;if(w!=="object")return w==="number"?a(m,y,x):w==="function"?o(m,y,x):!1;const N=m.constructor;if(N!==y.constructor)return!1;if(N===Object)return l(m,y,x);if(Array.isArray(m))return e(m,y,x);if(N===Date)return r(m,y,x);if(N===RegExp)return u(m,y,x);if(N===Map)return s(m,y,x);if(N===Set)return d(m,y,x);const k=Bp.call(m);if(k===Np)return r(m,y,x);if(k===Ap)return u(m,y,x);if(k===Ep)return s(m,y,x);if(k===Pp)return d(m,y,x);if(k===Op)return typeof m.then!="function"&&typeof y.then!="function"&&l(m,y,x);if(k===_p)return h(m,y,x);if(k===Dp)return i(m,y,x);if(k===Sp)return l(m,y,x);if(Ip[k])return f(m,y,x);if(k===wp)return n(m,y,x);if(k===Cp)return t(m,y,x);if(k===Mp||k===Tp||k===Rp)return c(m,y,x);if(p){let P=p[k];if(!P){const M=sp(m);M&&(P=p[M])}if(P)return P(m,y,x)}return!1}}function zp({circular:n,createCustomConfig:e,strict:t}){let r={areArrayBuffersEqual:dp,areArraysEqual:t?zt:fp,areDataViewsEqual:hp,areDatesEqual:pp,areErrorsEqual:mp,areFunctionsEqual:gp,areMapsEqual:t?kr(Go,zt):Go,areNumbersEqual:yp,areObjectsEqual:t?zt:bp,arePrimitiveWrappersEqual:xp,areRegExpsEqual:vp,areSetsEqual:t?kr(Xo,zt):Xo,areTypedArraysEqual:t?kr(jn,zt):jn,areUrlsEqual:kp,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),n){const i=wn(r.areArraysEqual),o=wn(r.areMapsEqual),s=wn(r.areObjectsEqual),a=wn(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:s,areSetsEqual:a})}return r}function Lp(n){return function(e,t,r,i,o,s,a){return n(e,t,a)}}function jp({circular:n,comparator:e,createState:t,equals:r,strict:i}){if(t)return function(a,l){const{cache:c=n?new WeakMap:void 0,meta:u}=t();return e(a,l,{cache:c,equals:r,meta:u,strict:i})};if(n)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const o={cache:void 0,equals:r,meta:void 0,strict:i};return function(a,l){return e(a,l,o)}}const Vp=Ze();Ze({strict:!0});Ze({circular:!0});Ze({circular:!0,strict:!0});Ze({createInternalComparator:()=>yt});Ze({strict:!0,createInternalComparator:()=>yt});Ze({circular:!0,createInternalComparator:()=>yt});Ze({circular:!0,createInternalComparator:()=>yt,strict:!0});function Ze(n={}){const{circular:e=!1,createInternalComparator:t,createState:r,strict:i=!1}=n,o=zp(n),s=Fp(o),a=t?t(s):Lp(s);return jp({circular:e,comparator:s,createState:r,equals:a,strict:i})}var Wp=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},$p=({contentComponent:n})=>{const e=us.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return b.jsx(b.Fragment,{children:Object.values(e)})};function qp(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,r){e={...e,[t]:Vl.createPortal(r.reactElement,r.element,t)},n.forEach(i=>i())},removeRenderer(t){const r={...e};delete r[t],e=r,n.forEach(i=>i())}}}var Hp=class extends ut.Component{constructor(n){var e;super(n),this.editorContentRef=ut.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=n.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var n;const e=this.props.editor;if(e&&!e.isDestroyed&&((n=e.view.dom)!=null&&n.parentNode)){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=qp(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var n;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((n=e.view.dom)!=null&&n.parentNode))return;const t=document.createElement("div");t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){const{editor:n,innerRef:e,...t}=this.props;return b.jsxs(b.Fragment,{children:[b.jsx("div",{ref:Wp(e,this.editorContentRef),...t}),n?.contentComponent&&b.jsx($p,{contentComponent:n.contentComponent})]})}},Jp=A.forwardRef((n,e)=>{const t=ut.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return ut.createElement(Hp,{key:t,innerRef:e,...n})}),Yp=ut.memo(Jp),Up=typeof window<"u"?A.useLayoutEffect:A.useEffect,Kp=class{constructor(n){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=n,this.lastSnapshot={editor:n,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(n){return this.subscribers.add(n),()=>{this.subscribers.delete(n)}}watch(n){if(this.editor=n,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};function Gp(n){var e;const[t]=A.useState(()=>new Kp(n.editor)),r=Ll.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!=null?e:Vp);return Up(()=>t.watch(n.editor),[n.editor,t]),A.useDebugValue(r),r}var Xp=!1,Yr=typeof window>"u",Qp=Yr||!!(typeof window<"u"&&window.next),Zp=class gl{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(t=>t())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Yr||Qp?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)==null?void 0:o.call(i,...r)},onBlur:(...r)=>{var i,o;return(o=(i=this.options.current).onBlur)==null?void 0:o.call(i,...r)},onCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onCreate)==null?void 0:o.call(i,...r)},onDestroy:(...r)=>{var i,o;return(o=(i=this.options.current).onDestroy)==null?void 0:o.call(i,...r)},onFocus:(...r)=>{var i,o;return(o=(i=this.options.current).onFocus)==null?void 0:o.call(i,...r)},onSelectionUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)==null?void 0:o.call(i,...r)},onTransaction:(...r)=>{var i,o;return(o=(i=this.options.current).onTransaction)==null?void 0:o.call(i,...r)},onUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onUpdate)==null?void 0:o.call(i,...r)},onContentError:(...r)=>{var i,o;return(o=(i=this.options.current).onContentError)==null?void 0:o.call(i,...r)},onDrop:(...r)=>{var i,o;return(o=(i=this.options.current).onDrop)==null?void 0:o.call(i,...r)},onPaste:(...r)=>{var i,o;return(o=(i=this.options.current).onPaste)==null?void 0:o.call(i,...r)},onDelete:(...r)=>{var i,o;return(o=(i=this.options.current).onDelete)==null?void 0:o.call(i,...r)}};return new Hh(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(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((i,o)=>{var s;return i===((s=t.extensions)==null?void 0:s[o])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?gl.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const 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 bb(n={},e=[]){const t=A.useRef(n);t.current=n;const[r]=A.useState(()=>new Zp(t)),i=us.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return A.useDebugValue(i),A.useEffect(r.onRender(e)),Gp({editor:i,selector:({transactionNumber:o})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&o===0?0:o+1}),i}var Si=A.createContext({editor:null});Si.Consumer;var xb=()=>A.useContext(Si),yl=A.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),em=()=>A.useContext(yl),tm=ut.forwardRef((n,e)=>{const{onDragStart:t}=em(),r=n.as||"div";return b.jsx(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function Qo(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function Zo(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.forward_ref)"||n.$$typeof.description==="react.forward_ref"))}function nm(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.memo)"||n.$$typeof.description==="react.memo"))}function rm(n){if(Qo(n)||Zo(n))return!0;if(nm(n)){const e=n.type;if(e)return Qo(e)||Zo(e)}return!1}function im(){try{if(A.version)return parseInt(A.version.split(".")[0],10)>=19}catch{}return!1}var om=class{constructor(n,{editor:e,props:t={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=n,this.editor=e,this.props=t,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?jl.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var n;if(this.destroyed)return;const e=this.component,t=this.props,r=this.editor,i=im(),o=rm(e),s={...t};s.ref&&!(i||o)&&delete s.ref,!s.ref&&(i||o)&&(s.ref=a=>{this.ref=a}),this.reactElement=b.jsx(e,{...s}),(n=r?.contentComponent)==null||n.setRenderer(this.id,this)}updateProps(n={}){this.destroyed||(this.props={...this.props,...n},this.render())}destroy(){var n;this.destroyed=!0;const e=this.editor;(n=e?.contentComponent)==null||n.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(n){Object.keys(n).forEach(e=>{this.element.setAttribute(e,n[e])})}};ut.createContext({markViewContentRef:()=>{}});var sm=class extends np{constructor(n,e,t){if(super(n,e,t),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const n=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(t,r,i){var o;return r==="storage"?(o=n.storage[e.name])!=null?o:{}:Reflect.get(t,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const n={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:A.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},i=this.component,o=A.memo(l=>b.jsx(yl.Provider,{value:r,children:A.createElement(i,l)}));o.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new om(o,{editor:this.editor,props:n,as:s,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var n;if(this.renderer.element.firstElementChild&&!((n=this.renderer.element.firstElementChild)!=null&&n.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:n,to:e}=this.editor.state.selection,t=this.getPos();if(typeof t=="number")if(n<=t&&e>=t+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(n,e,t){const r=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(n.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,o=this.decorations,s=this.innerDecorations;return this.node=n,this.decorations=e,this.innerDecorations=t,this.options.update({oldNode:i,oldDecorations:o,newNode:n,newDecorations:e,oldInnerDecorations:s,innerDecorations:t,updateProps:()=>r({node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage})})}return n===this.node&&this.decorations===e&&this.innerDecorations===t||(this.node=n,this.decorations=e,this.innerDecorations=t,r({node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let n={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,t=sn(this.node,e);n=this.options.attrs({node:this.node,HTMLAttributes:t})}else n=this.options.attrs;this.renderer.updateAttributes(n)}}};function am(n,e){return t=>t.editor.contentComponent?new sm(n,t,e):{}}var Mi=A.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Mi.displayName="TiptapContext";var lm=()=>A.useContext(Mi);function bl({editor:n,instance:e,children:t}){const r=n??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=A.useMemo(()=>({editor:r}),[r]),o=A.useMemo(()=>({editor:r}),[r]);return b.jsx(Si.Provider,{value:o,children:b.jsx(Mi.Provider,{value:i,children:t})})}bl.displayName="Tiptap";function xl({...n}){const{editor:e}=lm();return b.jsx(Yp,{editor:e,...n})}xl.displayName="Tiptap.Content";Object.assign(bl,{Content:xl});function cm(n){return n.storage.mention}function vb(n,e,t){n.chain().focus().insertContentAt(e,[um(t),{type:"text",text:" "}]).run()}function um(n){return{type:"mention",attrs:n}}function dm(n){const e=ds.c(34),{node:t,selected:r,view:i,editor:o,getPos:s}=n,{name:a,char:l,kind:c,id:u,args:d}=t.attrs,f=Wl(),h=r&&i.editable,p=c==="task",g=l==="@",m=i.editable&&l==="/"&&(c==="prompt"||c==null);let y;e[0]!==d||e[1]!==o||e[2]!==s||e[3]!==u||e[4]!==a?(y=()=>{const xt=cm(o)?.onEditChip;if(!xt||typeof s!="function")return;const vt=s();typeof vt=="number"&&xt({promptId:u,promptName:a,args:d??{},pos:vt})},e[0]=d,e[1]=o,e[2]=s,e[3]=u,e[4]=a,e[5]=y):y=e[5];const x=y;let w;e[6]!==m||e[7]!==x?(w=C=>{m&&(C.preventDefault(),C.stopPropagation(),x())},e[6]=m,e[7]=x,e[8]=w):w=e[8];const N=w;let k;e[9]!==m||e[10]!==x?(k=C=>{m&&(C.key!=="Enter"&&C.key!==" "||(C.preventDefault(),C.stopPropagation(),x()))},e[9]=m,e[10]=x,e[11]=k):k=e[11];const P=k,M=m?"button":void 0,R=m?0:void 0;let _;e[12]!==m||e[13]!==a||e[14]!==f?(_=m?f("chat.mention.editPrompt",{name:a??""}):void 0,e[12]=m,e[13]=a,e[14]=f,e[15]=_):_=e[15];const te=m?"cursor-pointer":"cursor-default",Ee=g?"bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",we=h&&"outline-2 outline-blue-300 outline-offset-0",Te=m&&"hover:brightness-95",oe=!p&&"capitalize";let q;e[16]!==oe||e[17]!==te||e[18]!==Ee||e[19]!==we||e[20]!==Te?(q=nt("px-1 py-1 rounded","inline-flex items-center gap-1",te,"select-none","text-xs font-light",Ee,we,Te,oe),e[16]=oe,e[17]=te,e[18]=Ee,e[19]=we,e[20]=Te,e[21]=q):q=e[21];let Fe;e[22]!==p||e[23]!==a?(Fe=p?b.jsx("span",{className:"inline-block max-w-[220px] truncate align-bottom",children:a??""}):a?Hl(a):"",e[22]=p,e[23]=a,e[24]=Fe):Fe=e[24];let T;return e[25]!==l||e[26]!==N||e[27]!==P||e[28]!==q||e[29]!==Fe||e[30]!==M||e[31]!==R||e[32]!==_?(T=b.jsxs(tm,{onClick:N,onKeyDown:P,role:M,tabIndex:R,"aria-label":_,className:q,children:[l,Fe]}),e[25]=l,e[26]=N,e[27]=P,e[28]=q,e[29]=Fe,e[30]=M,e[31]=R,e[32]=_,e[33]=T):T=e[33],T}const kb=tp.create({name:"mention",group:"inline",inline:!0,atom:!0,addStorage(){return{onEditChip:null}},addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id")||null,renderHTML:n=>n.id?{"data-id":n.id}:{}},name:{default:null,parseHTML:n=>n.getAttribute("data-name")||null,renderHTML:n=>n.name?{"data-name":n.name}:{}},char:{default:"/",parseHTML:n=>n.getAttribute("data-char")||"/",renderHTML:n=>n.char?{"data-char":n.char}:{}},metadata:{default:null,parseHTML:n=>{try{return JSON.parse(n.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:n=>n.metadata?{"data-metadata":JSON.stringify(n.metadata)}:{}},kind:{default:null,parseHTML:n=>n.getAttribute("data-kind")||null,renderHTML:n=>n.kind?{"data-kind":n.kind}:{}},args:{default:null,parseHTML:n=>{try{return JSON.parse(n.getAttribute("data-args")||"null")}catch{return null}},renderHTML:n=>n.args?{"data-args":JSON.stringify(n.args)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({HTMLAttributes:n}){return["span",Ya(n,{"data-type":"mention"})]},renderText({node:n}){const e=n.attrs.char??"@",t=n.attrs.name??"";return`${e}${t}`},addNodeView(){return am(dm)}});function F(n){const e=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&e==="[object Date]"?new n.constructor(+n):typeof n=="number"||e==="[object Number]"||typeof n=="string"||e==="[object String]"?new Date(n):new Date(NaN)}function de(n,e){return n instanceof Date?new n.constructor(e):new Date(e)}function ne(n,e){const t=F(n);return isNaN(e)?de(n,NaN):(e&&t.setDate(t.getDate()+e),t)}function xe(n,e){const t=F(n);if(isNaN(e))return de(n,NaN);if(!e)return t;const r=t.getDate(),i=de(n,t.getTime());i.setMonth(t.getMonth()+e+1,0);const o=i.getDate();return r>=o?i:(t.setFullYear(i.getFullYear(),i.getMonth(),r),t)}const Ci=6048e5,fm=864e5;let hm={};function dn(){return hm}function Ne(n,e){const t=dn(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,i=F(n),o=i.getDay(),s=(o<r?7:0)+o-r;return i.setDate(i.getDate()-s),i.setHours(0,0,0,0),i}function mt(n){return Ne(n,{weekStartsOn:1})}function vl(n){const e=F(n),t=e.getFullYear(),r=de(n,0);r.setFullYear(t+1,0,4),r.setHours(0,0,0,0);const i=mt(r),o=de(n,0);o.setFullYear(t,0,4),o.setHours(0,0,0,0);const s=mt(o);return e.getTime()>=i.getTime()?t+1:e.getTime()>=s.getTime()?t:t-1}function It(n){const e=F(n);return e.setHours(0,0,0,0),e}function Vn(n){const e=F(n),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+n-+t}function Se(n,e){const t=It(n),r=It(e),i=+t-Vn(t),o=+r-Vn(r);return Math.round((i-o)/fm)}function pm(n){const e=vl(n),t=de(n,0);return t.setFullYear(e,0,4),t.setHours(0,0,0,0),mt(t)}function Ur(n,e){const t=e*7;return ne(n,t)}function mm(n,e){return xe(n,e*12)}function gm(n){let e;return n.forEach(function(t){const r=F(t);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function ym(n){let e;return n.forEach(t=>{const r=F(t);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function se(n,e){const t=It(n),r=It(e);return+t==+r}function Ni(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function bm(n){if(!Ni(n)&&typeof n!="number")return!1;const e=F(n);return!isNaN(Number(e))}function an(n,e){const t=F(n),r=F(e),i=t.getFullYear()-r.getFullYear(),o=t.getMonth()-r.getMonth();return i*12+o}function xm(n,e,t){const r=Ne(n,t),i=Ne(e,t),o=+r-Vn(r),s=+i-Vn(i);return Math.round((o-s)/Ci)}function Di(n){const e=F(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e}function le(n){const e=F(n);return e.setDate(1),e.setHours(0,0,0,0),e}function kl(n){const e=F(n),t=de(n,0);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}function Ei(n,e){const t=dn(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,i=F(n),o=i.getDay(),s=(o<r?-7:0)+6-(o-r);return i.setDate(i.getDate()+s),i.setHours(23,59,59,999),i}function wl(n){return Ei(n,{weekStartsOn:1})}const vm={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},km=(n,e,t)=>{let r;const i=vm[n];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+r:r+" ago":r};function wr(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const wm={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Sm={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Mm={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Cm={date:wr({formats:wm,defaultWidth:"full"}),time:wr({formats:Sm,defaultWidth:"full"}),dateTime:wr({formats:Mm,defaultWidth:"full"})},Nm={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Dm=(n,e,t,r)=>Nm[n];function Lt(n){return(e,t)=>{const r=t?.context?String(t.context):"standalone";let i;if(r==="formatting"&&n.formattingValues){const s=n.defaultFormattingWidth||n.defaultWidth,a=t?.width?String(t.width):s;i=n.formattingValues[a]||n.formattingValues[s]}else{const s=n.defaultWidth,a=t?.width?String(t.width):n.defaultWidth;i=n.values[a]||n.values[s]}const o=n.argumentCallback?n.argumentCallback(e):e;return i[o]}}const Em={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Tm={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Om={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Am={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Pm={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Rm={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Im=(n,e)=>{const t=Number(n),r=t%100;if(r>20||r<10)switch(r%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},_m={ordinalNumber:Im,era:Lt({values:Em,defaultWidth:"wide"}),quarter:Lt({values:Tm,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Lt({values:Om,defaultWidth:"wide"}),day:Lt({values:Am,defaultWidth:"wide"}),dayPeriod:Lt({values:Pm,defaultWidth:"wide",formattingValues:Rm,defaultFormattingWidth:"wide"})};function jt(n){return(e,t={})=>{const r=t.width,i=r&&n.matchPatterns[r]||n.matchPatterns[n.defaultMatchWidth],o=e.match(i);if(!o)return null;const s=o[0],a=r&&n.parsePatterns[r]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?Fm(a,d=>d.test(s)):Bm(a,d=>d.test(s));let c;c=n.valueCallback?n.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;const u=e.slice(s.length);return{value:c,rest:u}}}function Bm(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function Fm(n,e){for(let t=0;t<n.length;t++)if(e(n[t]))return t}function zm(n){return(e,t={})=>{const r=e.match(n.matchPattern);if(!r)return null;const i=r[0],o=e.match(n.parsePattern);if(!o)return null;let s=n.valueCallback?n.valueCallback(o[0]):o[0];s=t.valueCallback?t.valueCallback(s):s;const a=e.slice(i.length);return{value:s,rest:a}}}const Lm=/^(\d+)(th|st|nd|rd)?/i,jm=/\d+/i,Vm={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Wm={any:[/^b/i,/^(a|c)/i]},$m={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},qm={any:[/1/i,/2/i,/3/i,/4/i]},Hm={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Jm={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ym={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Um={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Km={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Gm={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Xm={ordinalNumber:zm({matchPattern:Lm,parsePattern:jm,valueCallback:n=>parseInt(n,10)}),era:jt({matchPatterns:Vm,defaultMatchWidth:"wide",parsePatterns:Wm,defaultParseWidth:"any"}),quarter:jt({matchPatterns:$m,defaultMatchWidth:"wide",parsePatterns:qm,defaultParseWidth:"any",valueCallback:n=>n+1}),month:jt({matchPatterns:Hm,defaultMatchWidth:"wide",parsePatterns:Jm,defaultParseWidth:"any"}),day:jt({matchPatterns:Ym,defaultMatchWidth:"wide",parsePatterns:Um,defaultParseWidth:"any"}),dayPeriod:jt({matchPatterns:Km,defaultMatchWidth:"any",parsePatterns:Gm,defaultParseWidth:"any"})},Sl={code:"en-US",formatDistance:km,formatLong:Cm,formatRelative:Dm,localize:_m,match:Xm,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Qm(n){const e=F(n);return Se(e,kl(e))+1}function Ml(n){const e=F(n),t=+mt(e)-+pm(e);return Math.round(t/Ci)+1}function Cl(n,e){const t=F(n),r=t.getFullYear(),i=dn(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,s=de(n,0);s.setFullYear(r+1,0,o),s.setHours(0,0,0,0);const a=Ne(s,e),l=de(n,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const c=Ne(l,e);return t.getTime()>=a.getTime()?r+1:t.getTime()>=c.getTime()?r:r-1}function Zm(n,e){const t=dn(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,i=Cl(n,e),o=de(n,0);return o.setFullYear(i,0,r),o.setHours(0,0,0,0),Ne(o,e)}function Nl(n,e){const t=F(n),r=+Ne(t,e)-+Zm(t,e);return Math.round(r/Ci)+1}function z(n,e){const t=n<0?"-":"",r=Math.abs(n).toString().padStart(e,"0");return t+r}const ze={y(n,e){const t=n.getFullYear(),r=t>0?t:1-t;return z(e==="yy"?r%100:r,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):z(t+1,2)},d(n,e){return z(n.getDate(),e.length)},a(n,e){const t=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(n,e){return z(n.getHours()%12||12,e.length)},H(n,e){return z(n.getHours(),e.length)},m(n,e){return z(n.getMinutes(),e.length)},s(n,e){return z(n.getSeconds(),e.length)},S(n,e){const t=e.length,r=n.getMilliseconds(),i=Math.trunc(r*Math.pow(10,t-3));return z(i,e.length)}},St={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},es={G:function(n,e,t){const r=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(r,{width:"abbreviated"});case"GGGGG":return t.era(r,{width:"narrow"});default:return t.era(r,{width:"wide"})}},y:function(n,e,t){if(e==="yo"){const r=n.getFullYear(),i=r>0?r:1-r;return t.ordinalNumber(i,{unit:"year"})}return ze.y(n,e)},Y:function(n,e,t,r){const i=Cl(n,r),o=i>0?i:1-i;if(e==="YY"){const s=o%100;return z(s,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):z(o,e.length)},R:function(n,e){const t=vl(n);return z(t,e.length)},u:function(n,e){const t=n.getFullYear();return z(t,e.length)},Q:function(n,e,t){const r=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return z(r,2);case"Qo":return t.ordinalNumber(r,{unit:"quarter"});case"QQQ":return t.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(r,{width:"narrow",context:"formatting"});default:return t.quarter(r,{width:"wide",context:"formatting"})}},q:function(n,e,t){const r=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return z(r,2);case"qo":return t.ordinalNumber(r,{unit:"quarter"});case"qqq":return t.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(r,{width:"narrow",context:"standalone"});default:return t.quarter(r,{width:"wide",context:"standalone"})}},M:function(n,e,t){const r=n.getMonth();switch(e){case"M":case"MM":return ze.M(n,e);case"Mo":return t.ordinalNumber(r+1,{unit:"month"});case"MMM":return t.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(r,{width:"narrow",context:"formatting"});default:return t.month(r,{width:"wide",context:"formatting"})}},L:function(n,e,t){const r=n.getMonth();switch(e){case"L":return String(r+1);case"LL":return z(r+1,2);case"Lo":return t.ordinalNumber(r+1,{unit:"month"});case"LLL":return t.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(r,{width:"narrow",context:"standalone"});default:return t.month(r,{width:"wide",context:"standalone"})}},w:function(n,e,t,r){const i=Nl(n,r);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):z(i,e.length)},I:function(n,e,t){const r=Ml(n);return e==="Io"?t.ordinalNumber(r,{unit:"week"}):z(r,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):ze.d(n,e)},D:function(n,e,t){const r=Qm(n);return e==="Do"?t.ordinalNumber(r,{unit:"dayOfYear"}):z(r,e.length)},E:function(n,e,t){const r=n.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(r,{width:"short",context:"formatting"});default:return t.day(r,{width:"wide",context:"formatting"})}},e:function(n,e,t,r){const i=n.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return z(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(n,e,t,r){const i=n.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return z(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(n,e,t){const r=n.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return z(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(r,{width:"short",context:"formatting"});default:return t.day(r,{width:"wide",context:"formatting"})}},a:function(n,e,t){const i=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(n,e,t){const r=n.getHours();let i;switch(r===12?i=St.noon:r===0?i=St.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(n,e,t){const r=n.getHours();let i;switch(r>=17?i=St.evening:r>=12?i=St.afternoon:r>=4?i=St.morning:i=St.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(n,e,t){if(e==="ho"){let r=n.getHours()%12;return r===0&&(r=12),t.ordinalNumber(r,{unit:"hour"})}return ze.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):ze.H(n,e)},K:function(n,e,t){const r=n.getHours()%12;return e==="Ko"?t.ordinalNumber(r,{unit:"hour"}):z(r,e.length)},k:function(n,e,t){let r=n.getHours();return r===0&&(r=24),e==="ko"?t.ordinalNumber(r,{unit:"hour"}):z(r,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):ze.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):ze.s(n,e)},S:function(n,e){return ze.S(n,e)},X:function(n,e,t){const r=n.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ns(r);case"XXXX":case"XX":return et(r);default:return et(r,":")}},x:function(n,e,t){const r=n.getTimezoneOffset();switch(e){case"x":return ns(r);case"xxxx":case"xx":return et(r);default:return et(r,":")}},O:function(n,e,t){const r=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+ts(r,":");default:return"GMT"+et(r,":")}},z:function(n,e,t){const r=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+ts(r,":");default:return"GMT"+et(r,":")}},t:function(n,e,t){const r=Math.trunc(n.getTime()/1e3);return z(r,e.length)},T:function(n,e,t){const r=n.getTime();return z(r,e.length)}};function ts(n,e=""){const t=n>0?"-":"+",r=Math.abs(n),i=Math.trunc(r/60),o=r%60;return o===0?t+String(i):t+String(i)+e+z(o,2)}function ns(n,e){return n%60===0?(n>0?"-":"+")+z(Math.abs(n)/60,2):et(n,e)}function et(n,e=""){const t=n>0?"-":"+",r=Math.abs(n),i=z(Math.trunc(r/60),2),o=z(r%60,2);return t+i+e+o}const rs=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Dl=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},eg=(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],r=t[1],i=t[2];if(!i)return rs(n,e);let o;switch(r){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",rs(r,e)).replace("{{time}}",Dl(i,e))},tg={p:Dl,P:eg},ng=/^D+$/,rg=/^Y+$/,ig=["D","DD","YY","YYYY"];function og(n){return ng.test(n)}function sg(n){return rg.test(n)}function ag(n,e,t){const r=lg(n,e,t);if(console.warn(r),ig.includes(n))throw new RangeError(r)}function lg(n,e,t){const r=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${r} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const cg=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ug=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,dg=/^'([^]*?)'?$/,fg=/''/g,hg=/[a-zA-Z]/;function bt(n,e,t){const r=dn(),i=t?.locale??r.locale??Sl,o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=F(n);if(!bm(a))throw new RangeError("Invalid time value");let l=e.match(ug).map(u=>{const d=u[0];if(d==="p"||d==="P"){const f=tg[d];return f(u,i.formatLong)}return u}).join("").match(cg).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:pg(u)};if(es[d])return{isToken:!0,value:u};if(d.match(hg))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:o,weekStartsOn:s,locale:i};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!t?.useAdditionalWeekYearTokens&&sg(d)||!t?.useAdditionalDayOfYearTokens&&og(d))&&ag(d,e,String(n));const f=es[d[0]];return f(a,d,i.localize,c)}).join("")}function pg(n){const e=n.match(dg);return e?e[1].replace(fg,"'"):n}function mg(n){const e=F(n),t=e.getFullYear(),r=e.getMonth(),i=de(n,0);return i.setFullYear(t,r+1,0),i.setHours(0,0,0,0),i.getDate()}function gg(n){return Math.trunc(+F(n)/1e3)}function yg(n){const e=F(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(0,0,0,0),e}function bg(n,e){return xm(yg(n),le(n),e)+1}function Kr(n,e){const t=F(n),r=F(e);return t.getTime()>r.getTime()}function El(n,e){const t=F(n),r=F(e);return+t<+r}function Ti(n,e){const t=F(n),r=F(e);return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()}function xg(n,e){const t=F(n),r=F(e);return t.getFullYear()===r.getFullYear()}function Sr(n,e){return ne(n,-e)}function Mr(n,e){const t=F(n),r=t.getFullYear(),i=t.getDate(),o=de(n,0);o.setFullYear(r,e,15),o.setHours(0,0,0,0);const s=mg(o);return t.setMonth(e,Math.min(i,s)),t}function is(n,e){const t=F(n);return isNaN(+t)?de(n,NaN):(t.setFullYear(e),t)}var O=function(){return O=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},O.apply(this,arguments)};function vg(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}function Tl(n,e,t){for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))}function fn(n){return n.mode==="multiple"}function hn(n){return n.mode==="range"}function nr(n){return n.mode==="single"}var kg={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function wg(n,e){return bt(n,"LLLL y",e)}function Sg(n,e){return bt(n,"d",e)}function Mg(n,e){return bt(n,"LLLL",e)}function Cg(n){return"".concat(n)}function Ng(n,e){return bt(n,"cccccc",e)}function Dg(n,e){return bt(n,"yyyy",e)}var Eg=Object.freeze({__proto__:null,formatCaption:wg,formatDay:Sg,formatMonthCaption:Mg,formatWeekNumber:Cg,formatWeekdayName:Ng,formatYearCaption:Dg}),Tg=function(n,e,t){return bt(n,"do MMMM (EEEE)",t)},Og=function(){return"Month: "},Ag=function(){return"Go to next month"},Pg=function(){return"Go to previous month"},Rg=function(n,e){return bt(n,"cccc",e)},Ig=function(n){return"Week n. ".concat(n)},_g=function(){return"Year: "},Bg=Object.freeze({__proto__:null,labelDay:Tg,labelMonthDropdown:Og,labelNext:Ag,labelPrevious:Pg,labelWeekNumber:Ig,labelWeekday:Rg,labelYearDropdown:_g});function Fg(){var n="buttons",e=kg,t=Sl,r={},i={},o=1,s={},a=new Date;return{captionLayout:n,classNames:e,formatters:Eg,labels:Bg,locale:t,modifiersClassNames:r,modifiers:i,numberOfMonths:o,styles:s,today:a,mode:"default"}}function zg(n){var e=n.fromYear,t=n.toYear,r=n.fromMonth,i=n.toMonth,o=n.fromDate,s=n.toDate;return r?o=le(r):e&&(o=new Date(e,0,1)),i?s=Di(i):t&&(s=new Date(t,11,31)),{fromDate:o?It(o):void 0,toDate:s?It(s):void 0}}var Ol=A.createContext(void 0);function Lg(n){var e,t=n.initialProps,r=Fg(),i=zg(t),o=i.fromDate,s=i.toDate,a=(e=t.captionLayout)!==null&&e!==void 0?e:r.captionLayout;a!=="buttons"&&(!o||!s)&&(a="buttons");var l;(nr(t)||fn(t)||hn(t))&&(l=t.onSelect);var c=O(O(O({},r),t),{captionLayout:a,classNames:O(O({},r.classNames),t.classNames),components:O({},t.components),formatters:O(O({},r.formatters),t.formatters),fromDate:o,labels:O(O({},r.labels),t.labels),mode:t.mode||r.mode,modifiers:O(O({},r.modifiers),t.modifiers),modifiersClassNames:O(O({},r.modifiersClassNames),t.modifiersClassNames),onSelect:l,styles:O(O({},r.styles),t.styles),toDate:s});return b.jsx(Ol.Provider,{value:c,children:n.children})}function V(){var n=A.useContext(Ol);if(!n)throw new Error("useDayPicker must be used within a DayPickerProvider.");return n}function Al(n){var e=V(),t=e.locale,r=e.classNames,i=e.styles,o=e.formatters.formatCaption;return b.jsx("div",{className:r.caption_label,style:i.caption_label,"aria-live":"polite",role:"presentation",id:n.id,children:o(n.displayMonth,{locale:t})})}function jg(n){return b.jsx("svg",O({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},n,{children:b.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Pl(n){var e,t,r=n.onChange,i=n.value,o=n.children,s=n.caption,a=n.className,l=n.style,c=V(),u=(t=(e=c.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&t!==void 0?t:jg;return b.jsxs("div",{className:a,style:l,children:[b.jsx("span",{className:c.classNames.vhidden,children:n["aria-label"]}),b.jsx("select",{name:n.name,"aria-label":n["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:i,onChange:r,children:o}),b.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[s,b.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function Vg(n){var e,t=V(),r=t.fromDate,i=t.toDate,o=t.styles,s=t.locale,a=t.formatters.formatMonthCaption,l=t.classNames,c=t.components,u=t.labels.labelMonthDropdown;if(!r)return b.jsx(b.Fragment,{});if(!i)return b.jsx(b.Fragment,{});var d=[];if(xg(r,i))for(var f=le(r),h=r.getMonth();h<=i.getMonth();h++)d.push(Mr(f,h));else for(var f=le(new Date),h=0;h<=11;h++)d.push(Mr(f,h));var p=function(m){var y=Number(m.target.value),x=Mr(le(n.displayMonth),y);n.onChange(x)},g=(e=c?.Dropdown)!==null&&e!==void 0?e:Pl;return b.jsx(g,{name:"months","aria-label":u(),className:l.dropdown_month,style:o.dropdown_month,onChange:p,value:n.displayMonth.getMonth(),caption:a(n.displayMonth,{locale:s}),children:d.map(function(m){return b.jsx("option",{value:m.getMonth(),children:a(m,{locale:s})},m.getMonth())})})}function Wg(n){var e,t=n.displayMonth,r=V(),i=r.fromDate,o=r.toDate,s=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,d=r.labels.labelYearDropdown,f=[];if(!i)return b.jsx(b.Fragment,{});if(!o)return b.jsx(b.Fragment,{});for(var h=i.getFullYear(),p=o.getFullYear(),g=h;g<=p;g++)f.push(is(kl(new Date),g));var m=function(x){var w=is(le(t),Number(x.target.value));n.onChange(w)},y=(e=c?.Dropdown)!==null&&e!==void 0?e:Pl;return b.jsx(y,{name:"years","aria-label":d(),className:l.dropdown_year,style:a.dropdown_year,onChange:m,value:t.getFullYear(),caption:u(t,{locale:s}),children:f.map(function(x){return b.jsx("option",{value:x.getFullYear(),children:u(x,{locale:s})},x.getFullYear())})})}function $g(n,e){var t=A.useState(n),r=t[0],i=t[1],o=e===void 0?r:e;return[o,i]}function qg(n){var e=n.month,t=n.defaultMonth,r=n.today,i=e||t||r||new Date,o=n.toDate,s=n.fromDate,a=n.numberOfMonths,l=a===void 0?1:a;if(o&&an(o,i)<0){var c=-1*(l-1);i=xe(o,c)}return s&&an(i,s)<0&&(i=s),le(i)}function Hg(){var n=V(),e=qg(n),t=$g(e,n.month),r=t[0],i=t[1],o=function(s){var a;if(!n.disableNavigation){var l=le(s);i(l),(a=n.onMonthChange)===null||a===void 0||a.call(n,l)}};return[r,o]}function Jg(n,e){for(var t=e.reverseMonths,r=e.numberOfMonths,i=le(n),o=le(xe(i,r)),s=an(o,i),a=[],l=0;l<s;l++){var c=xe(i,l);a.push(c)}return t&&(a=a.reverse()),a}function Yg(n,e){if(!e.disableNavigation){var t=e.toDate,r=e.pagedNavigation,i=e.numberOfMonths,o=i===void 0?1:i,s=r?o:1,a=le(n);if(!t)return xe(a,s);var l=an(t,n);if(!(l<o))return xe(a,s)}}function Ug(n,e){if(!e.disableNavigation){var t=e.fromDate,r=e.pagedNavigation,i=e.numberOfMonths,o=i===void 0?1:i,s=r?o:1,a=le(n);if(!t)return xe(a,-s);var l=an(a,t);if(!(l<=0))return xe(a,-s)}}var Rl=A.createContext(void 0);function Kg(n){var e=V(),t=Hg(),r=t[0],i=t[1],o=Jg(r,e),s=Yg(r,e),a=Ug(r,e),l=function(d){return o.some(function(f){return Ti(d,f)})},c=function(d,f){l(d)||(f&&El(d,f)?i(xe(d,1+e.numberOfMonths*-1)):i(d))},u={currentMonth:r,displayMonths:o,goToMonth:i,goToDate:c,previousMonth:a,nextMonth:s,isDateDisplayed:l};return b.jsx(Rl.Provider,{value:u,children:n.children})}function pn(){var n=A.useContext(Rl);if(!n)throw new Error("useNavigation must be used within a NavigationProvider");return n}function ss(n){var e,t=V(),r=t.classNames,i=t.styles,o=t.components,s=pn().goToMonth,a=function(u){s(xe(u,n.displayIndex?-n.displayIndex:0))},l=(e=o?.CaptionLabel)!==null&&e!==void 0?e:Al,c=b.jsx(l,{id:n.id,displayMonth:n.displayMonth});return b.jsxs("div",{className:r.caption_dropdowns,style:i.caption_dropdowns,children:[b.jsx("div",{className:r.vhidden,children:c}),b.jsx(Vg,{onChange:a,displayMonth:n.displayMonth}),b.jsx(Wg,{onChange:a,displayMonth:n.displayMonth})]})}function Gg(n){return b.jsx("svg",O({width:"16px",height:"16px",viewBox:"0 0 120 120"},n,{children:b.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Xg(n){return b.jsx("svg",O({width:"16px",height:"16px",viewBox:"0 0 120 120"},n,{children:b.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Wn=A.forwardRef(function(n,e){var t=V(),r=t.classNames,i=t.styles,o=[r.button_reset,r.button];n.className&&o.push(n.className);var s=o.join(" "),a=O(O({},i.button_reset),i.button);return n.style&&Object.assign(a,n.style),b.jsx("button",O({},n,{ref:e,type:"button",className:s,style:a}))});function Qg(n){var e,t,r=V(),i=r.dir,o=r.locale,s=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,d=r.components;if(!n.nextMonth&&!n.previousMonth)return b.jsx(b.Fragment,{});var f=c(n.previousMonth,{locale:o}),h=[s.nav_button,s.nav_button_previous].join(" "),p=u(n.nextMonth,{locale:o}),g=[s.nav_button,s.nav_button_next].join(" "),m=(e=d?.IconRight)!==null&&e!==void 0?e:Xg,y=(t=d?.IconLeft)!==null&&t!==void 0?t:Gg;return b.jsxs("div",{className:s.nav,style:a.nav,children:[!n.hidePrevious&&b.jsx(Wn,{name:"previous-month","aria-label":f,className:h,style:a.nav_button_previous,disabled:!n.previousMonth,onClick:n.onPreviousClick,children:i==="rtl"?b.jsx(m,{className:s.nav_icon,style:a.nav_icon}):b.jsx(y,{className:s.nav_icon,style:a.nav_icon})}),!n.hideNext&&b.jsx(Wn,{name:"next-month","aria-label":p,className:g,style:a.nav_button_next,disabled:!n.nextMonth,onClick:n.onNextClick,children:i==="rtl"?b.jsx(y,{className:s.nav_icon,style:a.nav_icon}):b.jsx(m,{className:s.nav_icon,style:a.nav_icon})})]})}function as(n){var e=V().numberOfMonths,t=pn(),r=t.previousMonth,i=t.nextMonth,o=t.goToMonth,s=t.displayMonths,a=s.findIndex(function(p){return Ti(n.displayMonth,p)}),l=a===0,c=a===s.length-1,u=e>1&&(l||!c),d=e>1&&(c||!l),f=function(){r&&o(r)},h=function(){i&&o(i)};return b.jsx(Qg,{displayMonth:n.displayMonth,hideNext:u,hidePrevious:d,nextMonth:i,previousMonth:r,onPreviousClick:f,onNextClick:h})}function Zg(n){var e,t=V(),r=t.classNames,i=t.disableNavigation,o=t.styles,s=t.captionLayout,a=t.components,l=(e=a?.CaptionLabel)!==null&&e!==void 0?e:Al,c;return i?c=b.jsx(l,{id:n.id,displayMonth:n.displayMonth}):s==="dropdown"?c=b.jsx(ss,{displayMonth:n.displayMonth,id:n.id}):s==="dropdown-buttons"?c=b.jsxs(b.Fragment,{children:[b.jsx(ss,{displayMonth:n.displayMonth,displayIndex:n.displayIndex,id:n.id}),b.jsx(as,{displayMonth:n.displayMonth,displayIndex:n.displayIndex,id:n.id})]}):c=b.jsxs(b.Fragment,{children:[b.jsx(l,{id:n.id,displayMonth:n.displayMonth,displayIndex:n.displayIndex}),b.jsx(as,{displayMonth:n.displayMonth,id:n.id})]}),b.jsx("div",{className:r.caption,style:o.caption,children:c})}function ey(n){var e=V(),t=e.footer,r=e.styles,i=e.classNames.tfoot;return t?b.jsx("tfoot",{className:i,style:r.tfoot,children:b.jsx("tr",{children:b.jsx("td",{colSpan:8,children:t})})}):b.jsx(b.Fragment,{})}function ty(n,e,t){for(var r=t?mt(new Date):Ne(new Date,{locale:n,weekStartsOn:e}),i=[],o=0;o<7;o++){var s=ne(r,o);i.push(s)}return i}function ny(){var n=V(),e=n.classNames,t=n.styles,r=n.showWeekNumber,i=n.locale,o=n.weekStartsOn,s=n.ISOWeek,a=n.formatters.formatWeekdayName,l=n.labels.labelWeekday,c=ty(i,o,s);return b.jsxs("tr",{style:t.head_row,className:e.head_row,children:[r&&b.jsx("td",{style:t.head_cell,className:e.head_cell}),c.map(function(u,d){return b.jsx("th",{scope:"col",className:e.head_cell,style:t.head_cell,"aria-label":l(u,{locale:i}),children:a(u,{locale:i})},d)})]})}function ry(){var n,e=V(),t=e.classNames,r=e.styles,i=e.components,o=(n=i?.HeadRow)!==null&&n!==void 0?n:ny;return b.jsx("thead",{style:r.head,className:t.head,children:b.jsx(o,{})})}function iy(n){var e=V(),t=e.locale,r=e.formatters.formatDay;return b.jsx(b.Fragment,{children:r(n.date,{locale:t})})}var Oi=A.createContext(void 0);function oy(n){if(!fn(n.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return b.jsx(Oi.Provider,{value:e,children:n.children})}return b.jsx(sy,{initialProps:n.initialProps,children:n.children})}function sy(n){var e=n.initialProps,t=n.children,r=e.selected,i=e.min,o=e.max,s=function(c,u,d){var f,h;(f=e.onDayClick)===null||f===void 0||f.call(e,c,u,d);var p=!!(u.selected&&i&&r?.length===i);if(!p){var g=!!(!u.selected&&o&&r?.length===o);if(!g){var m=r?Tl([],r):[];if(u.selected){var y=m.findIndex(function(x){return se(c,x)});m.splice(y,1)}else m.push(c);(h=e.onSelect)===null||h===void 0||h.call(e,m,c,u,d)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=o&&r.length>o-1,d=r.some(function(f){return se(f,c)});return!!(u&&!d)});var l={selected:r,onDayClick:s,modifiers:a};return b.jsx(Oi.Provider,{value:l,children:t})}function Ai(){var n=A.useContext(Oi);if(!n)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return n}function ay(n,e){var t=e||{},r=t.from,i=t.to;return r&&i?se(i,n)&&se(r,n)?void 0:se(i,n)?{from:i,to:void 0}:se(r,n)?void 0:Kr(r,n)?{from:n,to:i}:{from:r,to:n}:i?Kr(n,i)?{from:i,to:n}:{from:n,to:i}:r?El(n,r)?{from:n,to:r}:{from:r,to:n}:{from:n,to:void 0}}var Pi=A.createContext(void 0);function ly(n){if(!hn(n.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return b.jsx(Pi.Provider,{value:e,children:n.children})}return b.jsx(cy,{initialProps:n.initialProps,children:n.children})}function cy(n){var e=n.initialProps,t=n.children,r=e.selected,i=r||{},o=i.from,s=i.to,a=e.min,l=e.max,c=function(h,p,g){var m,y;(m=e.onDayClick)===null||m===void 0||m.call(e,h,p,g);var x=ay(h,r);(y=e.onSelect)===null||y===void 0||y.call(e,x,h,p,g)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(u.range_start=[o],s?(u.range_end=[s],se(o,s)||(u.range_middle=[{after:o,before:s}])):u.range_end=[o]):s&&(u.range_start=[s],u.range_end=[s]),a&&(o&&!s&&u.disabled.push({after:Sr(o,a-1),before:ne(o,a-1)}),o&&s&&u.disabled.push({after:o,before:ne(o,a-1)}),!o&&s&&u.disabled.push({after:Sr(s,a-1),before:ne(s,a-1)})),l){if(o&&!s&&(u.disabled.push({before:ne(o,-l+1)}),u.disabled.push({after:ne(o,l-1)})),o&&s){var d=Se(s,o)+1,f=l-d;u.disabled.push({before:Sr(o,f)}),u.disabled.push({after:ne(s,f)})}!o&&s&&(u.disabled.push({before:ne(s,-l+1)}),u.disabled.push({after:ne(s,l-1)}))}return b.jsx(Pi.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:t})}function Ri(){var n=A.useContext(Pi);if(!n)throw new Error("useSelectRange must be used within a SelectRangeProvider");return n}function Nn(n){return Array.isArray(n)?Tl([],n):n!==void 0?[n]:[]}function uy(n){var e={};return Object.entries(n).forEach(function(t){var r=t[0],i=t[1];e[r]=Nn(i)}),e}var ve;(function(n){n.Outside="outside",n.Disabled="disabled",n.Selected="selected",n.Hidden="hidden",n.Today="today",n.RangeStart="range_start",n.RangeEnd="range_end",n.RangeMiddle="range_middle"})(ve||(ve={}));var dy=ve.Selected,Ae=ve.Disabled,fy=ve.Hidden,hy=ve.Today,Cr=ve.RangeEnd,Nr=ve.RangeMiddle,Dr=ve.RangeStart,py=ve.Outside;function my(n,e,t){var r,i=(r={},r[dy]=Nn(n.selected),r[Ae]=Nn(n.disabled),r[fy]=Nn(n.hidden),r[hy]=[n.today],r[Cr]=[],r[Nr]=[],r[Dr]=[],r[py]=[],r);return n.fromDate&&i[Ae].push({before:n.fromDate}),n.toDate&&i[Ae].push({after:n.toDate}),fn(n)?i[Ae]=i[Ae].concat(e.modifiers[Ae]):hn(n)&&(i[Ae]=i[Ae].concat(t.modifiers[Ae]),i[Dr]=t.modifiers[Dr],i[Nr]=t.modifiers[Nr],i[Cr]=t.modifiers[Cr]),i}var Il=A.createContext(void 0);function gy(n){var e=V(),t=Ai(),r=Ri(),i=my(e,t,r),o=uy(e.modifiers),s=O(O({},i),o);return b.jsx(Il.Provider,{value:s,children:n.children})}function _l(){var n=A.useContext(Il);if(!n)throw new Error("useModifiers must be used within a ModifiersProvider");return n}function yy(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function by(n){return!!(n&&typeof n=="object"&&"from"in n)}function xy(n){return!!(n&&typeof n=="object"&&"after"in n)}function vy(n){return!!(n&&typeof n=="object"&&"before"in n)}function ky(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function wy(n,e){var t,r=e.from,i=e.to;if(r&&i){var o=Se(i,r)<0;o&&(t=[i,r],r=t[0],i=t[1]);var s=Se(n,r)>=0&&Se(i,n)>=0;return s}return i?se(i,n):r?se(r,n):!1}function Sy(n){return Ni(n)}function My(n){return Array.isArray(n)&&n.every(Ni)}function Cy(n,e){return e.some(function(t){if(typeof t=="boolean")return t;if(Sy(t))return se(n,t);if(My(t))return t.includes(n);if(by(t))return wy(n,t);if(ky(t))return t.dayOfWeek.includes(n.getDay());if(yy(t)){var r=Se(t.before,n),i=Se(t.after,n),o=r>0,s=i<0,a=Kr(t.before,t.after);return a?s&&o:o||s}return xy(t)?Se(n,t.after)>0:vy(t)?Se(t.before,n)>0:typeof t=="function"?t(n):!1})}function Ii(n,e,t){var r=Object.keys(e).reduce(function(o,s){var a=e[s];return Cy(n,a)&&o.push(s),o},[]),i={};return r.forEach(function(o){return i[o]=!0}),t&&!Ti(n,t)&&(i.outside=!0),i}function Ny(n,e){for(var t=le(n[0]),r=Di(n[n.length-1]),i,o,s=t;s<=r;){var a=Ii(s,e),l=!a.disabled&&!a.hidden;if(!l){s=ne(s,1);continue}if(a.selected)return s;a.today&&!o&&(o=s),i||(i=s),s=ne(s,1)}return o||i}var Dy=365;function Bl(n,e){var t=e.moveBy,r=e.direction,i=e.context,o=e.modifiers,s=e.retry,a=s===void 0?{count:0,lastFocused:n}:s,l=i.weekStartsOn,c=i.fromDate,u=i.toDate,d=i.locale,f={day:ne,week:Ur,month:xe,year:mm,startOfWeek:function(m){return i.ISOWeek?mt(m):Ne(m,{locale:d,weekStartsOn:l})},endOfWeek:function(m){return i.ISOWeek?wl(m):Ei(m,{locale:d,weekStartsOn:l})}},h=f[t](n,r==="after"?1:-1);r==="before"&&c?h=gm([c,h]):r==="after"&&u&&(h=ym([u,h]));var p=!0;if(o){var g=Ii(h,o);p=!g.disabled&&!g.hidden}return p?h:a.count>Dy?a.lastFocused:Bl(h,{moveBy:t,direction:r,context:i,modifiers:o,retry:O(O({},a),{count:a.count+1})})}var Fl=A.createContext(void 0);function Ey(n){var e=pn(),t=_l(),r=A.useState(),i=r[0],o=r[1],s=A.useState(),a=s[0],l=s[1],c=Ny(e.displayMonths,t),u=i??(a&&e.isDateDisplayed(a))?a:c,d=function(){l(i),o(void 0)},f=function(m){o(m)},h=V(),p=function(m,y){if(i){var x=Bl(i,{moveBy:m,direction:y,context:h,modifiers:t});se(i,x)||(e.goToDate(x,i),f(x))}},g={focusedDay:i,focusTarget:u,blur:d,focus:f,focusDayAfter:function(){return p("day","after")},focusDayBefore:function(){return p("day","before")},focusWeekAfter:function(){return p("week","after")},focusWeekBefore:function(){return p("week","before")},focusMonthBefore:function(){return p("month","before")},focusMonthAfter:function(){return p("month","after")},focusYearBefore:function(){return p("year","before")},focusYearAfter:function(){return p("year","after")},focusStartOfWeek:function(){return p("startOfWeek","before")},focusEndOfWeek:function(){return p("endOfWeek","after")}};return b.jsx(Fl.Provider,{value:g,children:n.children})}function _i(){var n=A.useContext(Fl);if(!n)throw new Error("useFocusContext must be used within a FocusProvider");return n}function Ty(n,e){var t=_l(),r=Ii(n,t,e);return r}var Bi=A.createContext(void 0);function Oy(n){if(!nr(n.initialProps)){var e={selected:void 0};return b.jsx(Bi.Provider,{value:e,children:n.children})}return b.jsx(Ay,{initialProps:n.initialProps,children:n.children})}function Ay(n){var e=n.initialProps,t=n.children,r=function(o,s,a){var l,c,u;if((l=e.onDayClick)===null||l===void 0||l.call(e,o,s,a),s.selected&&!e.required){(c=e.onSelect)===null||c===void 0||c.call(e,void 0,o,s,a);return}(u=e.onSelect)===null||u===void 0||u.call(e,o,o,s,a)},i={selected:e.selected,onDayClick:r};return b.jsx(Bi.Provider,{value:i,children:t})}function zl(){var n=A.useContext(Bi);if(!n)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return n}function Py(n,e){var t=V(),r=zl(),i=Ai(),o=Ri(),s=_i(),a=s.focusDayAfter,l=s.focusDayBefore,c=s.focusWeekAfter,u=s.focusWeekBefore,d=s.blur,f=s.focus,h=s.focusMonthBefore,p=s.focusMonthAfter,g=s.focusYearBefore,m=s.focusYearAfter,y=s.focusStartOfWeek,x=s.focusEndOfWeek,w=function(T){var C,xt,vt,rr;nr(t)?(C=r.onDayClick)===null||C===void 0||C.call(r,n,e,T):fn(t)?(xt=i.onDayClick)===null||xt===void 0||xt.call(i,n,e,T):hn(t)?(vt=o.onDayClick)===null||vt===void 0||vt.call(o,n,e,T):(rr=t.onDayClick)===null||rr===void 0||rr.call(t,n,e,T)},N=function(T){var C;f(n),(C=t.onDayFocus)===null||C===void 0||C.call(t,n,e,T)},k=function(T){var C;d(),(C=t.onDayBlur)===null||C===void 0||C.call(t,n,e,T)},P=function(T){var C;(C=t.onDayMouseEnter)===null||C===void 0||C.call(t,n,e,T)},M=function(T){var C;(C=t.onDayMouseLeave)===null||C===void 0||C.call(t,n,e,T)},R=function(T){var C;(C=t.onDayPointerEnter)===null||C===void 0||C.call(t,n,e,T)},_=function(T){var C;(C=t.onDayPointerLeave)===null||C===void 0||C.call(t,n,e,T)},te=function(T){var C;(C=t.onDayTouchCancel)===null||C===void 0||C.call(t,n,e,T)},Ee=function(T){var C;(C=t.onDayTouchEnd)===null||C===void 0||C.call(t,n,e,T)},we=function(T){var C;(C=t.onDayTouchMove)===null||C===void 0||C.call(t,n,e,T)},Te=function(T){var C;(C=t.onDayTouchStart)===null||C===void 0||C.call(t,n,e,T)},oe=function(T){var C;(C=t.onDayKeyUp)===null||C===void 0||C.call(t,n,e,T)},q=function(T){var C;switch(T.key){case"ArrowLeft":T.preventDefault(),T.stopPropagation(),t.dir==="rtl"?a():l();break;case"ArrowRight":T.preventDefault(),T.stopPropagation(),t.dir==="rtl"?l():a();break;case"ArrowDown":T.preventDefault(),T.stopPropagation(),c();break;case"ArrowUp":T.preventDefault(),T.stopPropagation(),u();break;case"PageUp":T.preventDefault(),T.stopPropagation(),T.shiftKey?g():h();break;case"PageDown":T.preventDefault(),T.stopPropagation(),T.shiftKey?m():p();break;case"Home":T.preventDefault(),T.stopPropagation(),y();break;case"End":T.preventDefault(),T.stopPropagation(),x();break}(C=t.onDayKeyDown)===null||C===void 0||C.call(t,n,e,T)},Fe={onClick:w,onFocus:N,onBlur:k,onKeyDown:q,onKeyUp:oe,onMouseEnter:P,onMouseLeave:M,onPointerEnter:R,onPointerLeave:_,onTouchCancel:te,onTouchEnd:Ee,onTouchMove:we,onTouchStart:Te};return Fe}function Ry(){var n=V(),e=zl(),t=Ai(),r=Ri(),i=nr(n)?e.selected:fn(n)?t.selected:hn(n)?r.selected:void 0;return i}function Iy(n){return Object.values(ve).includes(n)}function _y(n,e){var t=[n.classNames.day];return Object.keys(e).forEach(function(r){var i=n.modifiersClassNames[r];if(i)t.push(i);else if(Iy(r)){var o=n.classNames["day_".concat(r)];o&&t.push(o)}}),t}function By(n,e){var t=O({},n.styles.day);return Object.keys(e).forEach(function(r){var i;t=O(O({},t),(i=n.modifiersStyles)===null||i===void 0?void 0:i[r])}),t}function Fy(n,e,t){var r,i,o,s=V(),a=_i(),l=Ty(n,e),c=Py(n,l),u=Ry(),d=!!(s.onDayClick||s.mode!=="default");A.useEffect(function(){var P;l.outside||a.focusedDay&&d&&se(a.focusedDay,n)&&((P=t.current)===null||P===void 0||P.focus())},[a.focusedDay,n,t,d,l.outside]);var f=_y(s,l).join(" "),h=By(s,l),p=!!(l.outside&&!s.showOutsideDays||l.hidden),g=(o=(i=s.components)===null||i===void 0?void 0:i.DayContent)!==null&&o!==void 0?o:iy,m=b.jsx(g,{date:n,displayMonth:e,activeModifiers:l}),y={style:h,className:f,children:m,role:"gridcell"},x=a.focusTarget&&se(a.focusTarget,n)&&!l.outside,w=a.focusedDay&&se(a.focusedDay,n),N=O(O(O({},y),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=w||x?0:-1,r)),c),k={isButton:d,isHidden:p,activeModifiers:l,selectedDays:u,buttonProps:N,divProps:y};return k}function zy(n){var e=A.useRef(null),t=Fy(n.date,n.displayMonth,e);return t.isHidden?b.jsx("div",{role:"gridcell"}):t.isButton?b.jsx(Wn,O({name:"day",ref:e},t.buttonProps)):b.jsx("div",O({},t.divProps))}function Ly(n){var e=n.number,t=n.dates,r=V(),i=r.onWeekNumberClick,o=r.styles,s=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(e),{locale:a});if(!i)return b.jsx("span",{className:s.weeknumber,style:o.weeknumber,children:u});var d=l(Number(e),{locale:a}),f=function(h){i(e,t,h)};return b.jsx(Wn,{name:"week-number","aria-label":d,className:s.weeknumber,style:o.weeknumber,onClick:f,children:u})}function jy(n){var e,t,r=V(),i=r.styles,o=r.classNames,s=r.showWeekNumber,a=r.components,l=(e=a?.Day)!==null&&e!==void 0?e:zy,c=(t=a?.WeekNumber)!==null&&t!==void 0?t:Ly,u;return s&&(u=b.jsx("td",{className:o.cell,style:i.cell,children:b.jsx(c,{number:n.weekNumber,dates:n.dates})})),b.jsxs("tr",{className:o.row,style:i.row,children:[u,n.dates.map(function(d){return b.jsx("td",{className:o.cell,style:i.cell,role:"presentation",children:b.jsx(l,{displayMonth:n.displayMonth,date:d})},gg(d))})]})}function ls(n,e,t){for(var r=t?.ISOWeek?wl(e):Ei(e,t),i=t?.ISOWeek?mt(n):Ne(n,t),o=Se(r,i),s=[],a=0;a<=o;a++)s.push(ne(i,a));var l=s.reduce(function(c,u){var d=t?.ISOWeek?Ml(u):Nl(u,t),f=c.find(function(h){return h.weekNumber===d});return f?(f.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function Vy(n,e){var t=ls(le(n),Di(n),e);if(e?.useFixedWeeks){var r=bg(n,e);if(r<6){var i=t[t.length-1],o=i.dates[i.dates.length-1],s=Ur(o,6-r),a=ls(Ur(o,1),s,e);t.push.apply(t,a)}}return t}function Wy(n){var e,t,r,i=V(),o=i.locale,s=i.classNames,a=i.styles,l=i.hideHead,c=i.fixedWeeks,u=i.components,d=i.weekStartsOn,f=i.firstWeekContainsDate,h=i.ISOWeek,p=Vy(n.displayMonth,{useFixedWeeks:!!c,ISOWeek:h,locale:o,weekStartsOn:d,firstWeekContainsDate:f}),g=(e=u?.Head)!==null&&e!==void 0?e:ry,m=(t=u?.Row)!==null&&t!==void 0?t:jy,y=(r=u?.Footer)!==null&&r!==void 0?r:ey;return b.jsxs("table",{id:n.id,className:s.table,style:a.table,role:"grid","aria-labelledby":n["aria-labelledby"],children:[!l&&b.jsx(g,{}),b.jsx("tbody",{className:s.tbody,style:a.tbody,children:p.map(function(x){return b.jsx(m,{displayMonth:n.displayMonth,dates:x.dates,weekNumber:x.weekNumber},x.weekNumber)})}),b.jsx(y,{displayMonth:n.displayMonth})]})}function $y(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var qy=$y()?A.useLayoutEffect:A.useEffect,Er=!1,Hy=0;function cs(){return"react-day-picker-".concat(++Hy)}function Jy(n){var e,t=n??(Er?cs():null),r=A.useState(t),i=r[0],o=r[1];return qy(function(){i===null&&o(cs())},[]),A.useEffect(function(){Er===!1&&(Er=!0)},[]),(e=n??i)!==null&&e!==void 0?e:void 0}function Yy(n){var e,t,r=V(),i=r.dir,o=r.classNames,s=r.styles,a=r.components,l=pn().displayMonths,c=Jy(r.id?"".concat(r.id,"-").concat(n.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(n.displayIndex):void 0,d=[o.month],f=s.month,h=n.displayIndex===0,p=n.displayIndex===l.length-1,g=!h&&!p;i==="rtl"&&(e=[h,p],p=e[0],h=e[1]),h&&(d.push(o.caption_start),f=O(O({},f),s.caption_start)),p&&(d.push(o.caption_end),f=O(O({},f),s.caption_end)),g&&(d.push(o.caption_between),f=O(O({},f),s.caption_between));var m=(t=a?.Caption)!==null&&t!==void 0?t:Zg;return b.jsxs("div",{className:d.join(" "),style:f,children:[b.jsx(m,{id:c,displayMonth:n.displayMonth,displayIndex:n.displayIndex}),b.jsx(Wy,{id:u,"aria-labelledby":c,displayMonth:n.displayMonth})]},n.displayIndex)}function Uy(n){var e=V(),t=e.classNames,r=e.styles;return b.jsx("div",{className:t.months,style:r.months,children:n.children})}function Ky(n){var e,t,r=n.initialProps,i=V(),o=_i(),s=pn(),a=A.useState(!1),l=a[0],c=a[1];A.useEffect(function(){i.initialFocus&&o.focusTarget&&(l||(o.focus(o.focusTarget),c(!0)))},[i.initialFocus,l,o.focus,o.focusTarget,o]);var u=[i.classNames.root,i.className];i.numberOfMonths>1&&u.push(i.classNames.multiple_months),i.showWeekNumber&&u.push(i.classNames.with_weeknumber);var d=O(O({},i.styles.root),i.style),f=Object.keys(r).filter(function(p){return p.startsWith("data-")}).reduce(function(p,g){var m;return O(O({},p),(m={},m[g]=r[g],m))},{}),h=(t=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&t!==void 0?t:Uy;return b.jsx("div",O({className:u.join(" "),style:d,dir:i.dir,id:i.id,nonce:r.nonce,title:r.title,lang:r.lang},f,{children:b.jsx(h,{children:s.displayMonths.map(function(p,g){return b.jsx(Yy,{displayIndex:g,displayMonth:p},g)})})}))}function Gy(n){var e=n.children,t=vg(n,["children"]);return b.jsx(Lg,{initialProps:t,children:b.jsx(Kg,{children:b.jsx(Oy,{initialProps:t,children:b.jsx(oy,{initialProps:t,children:b.jsx(ly,{initialProps:t,children:b.jsx(gy,{children:b.jsx(Ey,{children:e})})})})})})})}function Xy(n){return b.jsx(Gy,O({},n,{children:b.jsx(Ky,{initialProps:n})}))}function wb(n){const e=ds.c(20);let t,r,i,o;e[0]!==n?({className:t,classNames:r,showOutsideDays:o,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=i,e[4]=o):(t=e[1],r=e[2],i=e[3],o=e[4]);const s=o===void 0?!0:o;let a;e[5]!==t?(a=nt("p-3",t),e[5]=t,e[6]=a):a=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=nt(Fi({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),e[7]=l):l=e[7];const c=i.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md";let u;e[8]!==c?(u=nt("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",c),e[8]=c,e[9]=u):u=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=nt(Fi({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),e[10]=d):d=e[10];let f;e[11]!==r||e[12]!==u?(f={months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:l,nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:u,day:d,day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...r},e[11]=r,e[12]=u,e[13]=f):f=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h={IconLeft:Zy,IconRight:Qy},e[14]=h):h=e[14];let p;return e[15]!==i||e[16]!==s||e[17]!==a||e[18]!==f?(p=b.jsx(Xy,{showOutsideDays:s,className:a,classNames:f,components:h,...i}),e[15]=i,e[16]=s,e[17]=a,e[18]=f,e[19]=p):p=e[19],p}function Qy(n){const{className:e,...t}=n;return b.jsx(ql,{className:nt("size-4",e),...t})}function Zy(n){const{className:e,...t}=n;return b.jsx($l,{className:nt("size-4",e),...t})}export{ib as $,db as A,hb as B,wb as C,H as D,Si as E,v as F,fb as G,mb as H,Hf as I,ih as J,sb as K,Xa as L,kb as M,tp as N,th as O,Xe as P,Zh as Q,am as R,S,I as T,on as U,cb as V,lb as W,Y as X,ab as Y,sn as Z,Qh as _,ke as a,ob as a0,xb as b,um as c,Yp as d,De as e,Gp as f,cm as g,ye as h,vb as i,gb as j,tm as k,Ac as l,Qd as m,E as n,B as o,Pn as p,xi as q,L as r,D as s,Hl as t,bb as u,ub as v,pb as w,Ya as x,Ih as y,yb as z};