decocms 4.523.2 → 4.524.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (518) hide show
  1. package/dist/client/assets/{ActiveShapeUtils-BiggFcjT.js → ActiveShapeUtils-Bp4fmUBo.js} +1 -1
  2. package/dist/client/assets/{AlertCircle-DuL_FFHx.js → AlertCircle-Bq5T03B8.js} +1 -1
  3. package/dist/client/assets/{AreaChart-CwzHmgIC.js → AreaChart-CCyND0Jp.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-D94SnK45.js → ArrowLeft-Bwi_Jr7f.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-Dn7IgtbA.js → ArrowUp-CzX0fTk7.js} +1 -1
  6. package/dist/client/assets/{BarChart-cNHCiDCi.js → BarChart-wLDzzyOQ.js} +1 -1
  7. package/dist/client/assets/{Building02-BmRvdezs.js → Building02-A_MT9tNO.js} +1 -1
  8. package/dist/client/assets/{CartesianChart-iNB7Klro.js → CartesianChart-B0qX_dpC.js} +1 -1
  9. package/dist/client/assets/{CategoricalChart-C1fCYXI1.js → CategoricalChart-BDZ_2Tmn.js} +1 -1
  10. package/dist/client/assets/{CheckCircle-BCzuQhZn.js → CheckCircle-BE1i_X4b.js} +1 -1
  11. package/dist/client/assets/{ChevronSelectorVertical-CxqUMZg6.js → ChevronSelectorVertical-DNrt0MHW.js} +1 -1
  12. package/dist/client/assets/{ChevronUp-DWUYL4oz.js → ChevronUp-RlBkcpdd.js} +1 -1
  13. package/dist/client/assets/{Copy01-B5Qm_DvO.js → Copy01-B9x501ud.js} +1 -1
  14. package/dist/client/assets/{CreditCard01-8EhoJBRm.js → CreditCard01-Bu_qRR36.js} +1 -1
  15. package/dist/client/assets/{DotsVertical-BmVaGWAg.js → DotsVertical-D9231JAc.js} +1 -1
  16. package/dist/client/assets/{ErrorBarContext-7FUCCj8N.js → ErrorBarContext-PGp8cmoe.js} +1 -1
  17. package/dist/client/assets/{Globe04-KfEeo3Pn.js → Globe04-DQlP6Nhr.js} +1 -1
  18. package/dist/client/assets/{Image01-KdUybmWt.js → Image01-ClayPF_a.js} +1 -1
  19. package/dist/client/assets/{Key01-6z52NoNj.js → Key01-CxKYO-oQ.js} +1 -1
  20. package/dist/client/assets/{Link01-oKshySD_.js → Link01-B7BHRxIW.js} +1 -1
  21. package/dist/client/assets/{LinkBroken01-edPm2SIJ.js → LinkBroken01-XqJUgSE7.js} +1 -1
  22. package/dist/client/assets/{Minus-BvqQFZHP.js → Minus-Bh6ogRng.js} +1 -1
  23. package/dist/client/assets/{Monitor01-DZmeiH6p.js → Monitor01-BpzvJnXA.js} +1 -1
  24. package/dist/client/assets/{Play-3WH9Ikap.js → Play-w4omVTRa.js} +1 -1
  25. package/dist/client/assets/{Plus-D3sv1Vc5.js → Plus-CcJNnBya.js} +1 -1
  26. package/dist/client/assets/{ReferenceLine-D2o1nZW0.js → ReferenceLine-CI6ZmeJ0.js} +1 -1
  27. package/dist/client/assets/{SearchMd-DzFzOALq.js → SearchMd-5lGv5a5H.js} +1 -1
  28. package/dist/client/assets/{Sector-DlWxPN8J.js → Sector-gkUUnvA4.js} +1 -1
  29. package/dist/client/assets/{ShoppingBag01-B1nTczbE.js → ShoppingBag01-C82UeRR9.js} +1 -1
  30. package/dist/client/assets/{Sun-D5qn9wPg.js → Sun-IvvKZ51n.js} +1 -1
  31. package/dist/client/assets/{SwitchHorizontal01-DQQsmdwN.js → SwitchHorizontal01-B1MoYKPo.js} +1 -1
  32. package/dist/client/assets/{Tool01-Bhj-QHDu.js → Tool01-BvlRH5Ln.js} +1 -1
  33. package/dist/client/assets/{Trash01-DT07olaT.js → Trash01-C9E8l_mI.js} +1 -1
  34. package/dist/client/assets/{Upload01-BocTk920.js → Upload01-mlw10ZK-.js} +1 -1
  35. package/dist/client/assets/{UserSquare-zP4-JvXz.js → UserSquare-DwNuAluZ.js} +1 -1
  36. package/dist/client/assets/{Users01-DfLHZjoX.js → Users01-DcHPIKgH.js} +1 -1
  37. package/dist/client/assets/{XClose-1FEelrZ4.js → XClose-BBReaSBA.js} +1 -1
  38. package/dist/client/assets/{ZoomOut-DH4NDKgS.js → ZoomOut-CnbxUNSo.js} +1 -1
  39. package/dist/client/assets/access-gate-BNOWXoYR.js +1 -0
  40. package/dist/client/assets/{add-connection-dialog-B9X2bENr.js → add-connection-dialog-CEj8kbGq.js} +1 -1
  41. package/dist/client/assets/agent-analytics-DcqQcnI_.js +1 -0
  42. package/dist/client/assets/agent-app-BWM9EEcJ.js +1 -0
  43. package/dist/client/assets/agent-assets-CppO2yKd.js +1 -0
  44. package/dist/client/assets/agent-automation-BtSTyUKu.js +20 -0
  45. package/dist/client/assets/agent-automations-Bf-0_57T.js +1 -0
  46. package/dist/client/assets/agent-calendar-Bp6Y1tPy.js +1 -0
  47. package/dist/client/assets/agent-connect-sources-C_0x6Udu.js +1 -0
  48. package/dist/client/assets/agent-deck-BOaej8yV.js +1 -0
  49. package/dist/client/assets/agent-e2e-DokyQFgS.js +1 -0
  50. package/dist/client/assets/agent-experiments-7O17P9sC.js +1 -0
  51. package/dist/client/assets/agent-file-B5Z-mSXW.js +1 -0
  52. package/dist/client/assets/agent-hosting-v3_GHpmO.js +1 -0
  53. package/dist/client/assets/agent-icon-KvVT3fA8.js +1 -0
  54. package/dist/client/assets/agent-library-B3W6CGJl.js +1 -0
  55. package/dist/client/assets/agent-library-file-CHgoG2j3.js +1 -0
  56. package/dist/client/assets/agent-monitor-C9pMT5KA.js +1 -0
  57. package/dist/client/assets/agent-overview-9FhsI0nk.js +1 -0
  58. package/dist/client/assets/agent-releases-CRh6y5DW.js +2 -0
  59. package/dist/client/assets/agent-settings-CfNarIdW.js +1 -0
  60. package/dist/client/assets/{agent-site-editor-Ccqk13sk.js → agent-site-editor-BALtgla6.js} +2 -2
  61. package/dist/client/assets/agent-site-editor-code-D6BBbIl8.js +2 -0
  62. package/dist/client/assets/agent-site-editor-content-DAMOp9X5.js +1 -0
  63. package/dist/client/assets/agent-site-editor-preview-B0IbykqU.js +1 -0
  64. package/dist/client/assets/agent-view-B5q0EqmS.js +1 -0
  65. package/dist/client/assets/{agent-view-guard-BQQDslge.js → agent-view-guard-bPXLqLsK.js} +1 -1
  66. package/dist/client/assets/agents-list-DrT_0gVh.js +1 -0
  67. package/dist/client/assets/{ai-providers-DZoJeRvf.js → ai-providers-DorJXBZe.js} +2 -2
  68. package/dist/client/assets/{alert-SHlQi_f5.js → alert-DEw5BVAh.js} +1 -1
  69. package/dist/client/assets/analytics-sections-g9foqwY5.js +1 -0
  70. package/dist/client/assets/analytics-tab-D5KshkAH.js +2 -0
  71. package/dist/client/assets/api-keys-B-qwgNok.js +1 -0
  72. package/dist/client/assets/api-keys-CIPiPSYY.js +1 -0
  73. package/dist/client/assets/app-editor-ChUXEXt-.js +1 -0
  74. package/dist/client/assets/{asset-utils-B48ApnSg.js → asset-utils-DRJP317P.js} +1 -1
  75. package/dist/client/assets/{auth--QyNLTbP.js → auth-Dqt9menC.js} +1 -1
  76. package/dist/client/assets/{auth-catchall-9FBGni3X.js → auth-catchall-B5Em8iaq.js} +1 -1
  77. package/dist/client/assets/{auth-entry-Bb0XRefn.js → auth-entry-CNtzQsix.js} +1 -1
  78. package/dist/client/assets/{auth-split-layout-aJ5w9glJ.js → auth-split-layout-BoWG-no5.js} +1 -1
  79. package/dist/client/assets/{authenticate-and-persist-oauth-D2Ooe96m.js → authenticate-and-persist-oauth-BziZaG_M.js} +1 -1
  80. package/dist/client/assets/automation-list-row-BRtPLrxX.js +1 -0
  81. package/dist/client/assets/automation-runs-C0-BhIZn.js +1 -0
  82. package/dist/client/assets/automations-CXOQ5gKM.js +1 -0
  83. package/dist/client/assets/{autosend-CUttN5XY.js → autosend-BRUzWk70.js} +1 -1
  84. package/dist/client/assets/{badge-DVaine1x.js → badge-Ckz5LqgP.js} +1 -1
  85. package/dist/client/assets/{block-document-Dsg6Fb4A.js → block-document-BPaZQC5L.js} +3 -3
  86. package/dist/client/assets/{blocks-preview-workspace-context-DrgIe1RS.js → blocks-preview-workspace-context-C-uj3YG0.js} +1 -1
  87. package/dist/client/assets/blocks-tab-states-BcxrQPOR.js +1 -0
  88. package/dist/client/assets/blog-schema-Du7ILh7Q.js +1 -0
  89. package/dist/client/assets/buckets-CKZYh6Ij.js +1 -0
  90. package/dist/client/assets/build-improve-prompt-doc-DJhZN8lj.js +2 -0
  91. package/dist/client/assets/{calendar-CpwMOIuL.js → calendar-DkZz5VlH.js} +1 -1
  92. package/dist/client/assets/campaigns-view-Dc88Zs16.js +1 -0
  93. package/dist/client/assets/{capability-load-error-DvFhO1Pk.js → capability-load-error-CRB9otZt.js} +1 -1
  94. package/dist/client/assets/category-editor-CSPe0t_-.js +1 -0
  95. package/dist/client/assets/{cdn-tab-9Pvplnml.js → cdn-tab-KPAxnC3T.js} +1 -1
  96. package/dist/client/assets/{chart-DMJIFNic.js → chart-Bp6om7lj.js} +1 -1
  97. package/dist/client/assets/{chat-context-DwIrrO5r.js → chat-context-CIOqAIIy.js} +7 -7
  98. package/dist/client/assets/{chat-draft-stAhUvyw.js → chat-draft-OR83_S8w.js} +1 -1
  99. package/dist/client/assets/{checkbox-aTYJ3HOV.js → checkbox-BQ7Ebuar.js} +1 -1
  100. package/dist/client/assets/choose-editor-CspgtGFS.js +1 -0
  101. package/dist/client/assets/{cli-auth-success-CuJJaXpQ.js → cli-auth-success-CGyir_iF.js} +1 -1
  102. package/dist/client/assets/{client-icons-Du3qqcxN.js → client-icons-BOMFh2QS.js} +1 -1
  103. package/dist/client/assets/cms-settings-editor-DbU_3ksB.js +1 -0
  104. package/dist/client/assets/{collapsible-Btd20NT7.js → collapsible-BB8_usPT.js} +1 -1
  105. package/dist/client/assets/collection-detail-H-UqYky8.js +1 -0
  106. package/dist/client/assets/collection-display-button-CulG1s8m.js +1 -0
  107. package/dist/client/assets/{collection-search-C3Qx3Y9p.js → collection-search-Cf4li4kg.js} +1 -1
  108. package/dist/client/assets/{collection-table-wrapper-BzK9w_p-.js → collection-table-wrapper-DnZHa5Lt.js} +1 -1
  109. package/dist/client/assets/{collection-tabs-D5iCdwPv.js → collection-tabs-x8ccQUAC.js} +1 -1
  110. package/dist/client/assets/{column-rules-UU8JLygo.js → column-rules-C_DWUbCh.js} +2 -2
  111. package/dist/client/assets/{combobox-PWtcP6b2.js → combobox-BZoZToki.js} +1 -1
  112. package/dist/client/assets/{command-Dqne3j1N.js → command-MmMDew8i.js} +1 -1
  113. package/dist/client/assets/{companion-mcps-section-kvftD547.js → companion-mcps-section-By8_AO07.js} +1 -1
  114. package/dist/client/assets/{config-CJdQI2Ik.js → config-DBn3iCC3.js} +1 -1
  115. package/dist/client/assets/{connect-CaOmDTIh.js → connect-DbK_vN0J.js} +3 -3
  116. package/dist/client/assets/{connect-layout-Dx_3veD9.js → connect-layout-9tsE00M7.js} +1 -1
  117. package/dist/client/assets/connect-source-dialog-DqWilbbC.js +1 -0
  118. package/dist/client/assets/{connection-DJp1XqBL.js → connection-QGwhnKZn.js} +1 -1
  119. package/dist/client/assets/{connection-card-CwHoa3H_.js → connection-card-DEMVrMsW.js} +1 -1
  120. package/dist/client/assets/connection-detail-4PyaBO0_.js +1 -0
  121. package/dist/client/assets/{connection-form-helpers-BThulWcJ.js → connection-form-helpers-DCRY9s0M.js} +1 -1
  122. package/dist/client/assets/connections-CpcdB3jc.js +1 -0
  123. package/dist/client/assets/content-tab-YME7HMCb.js +22 -0
  124. package/dist/client/assets/{context-menu-Bsyqk_Km.js → context-menu-Cpvztbef.js} +1 -1
  125. package/dist/client/assets/context-oSwYvz9P.js +1 -0
  126. package/dist/client/assets/{context-shell-DFZc3RTT.js → context-shell-BVBpRdKB.js} +5 -5
  127. package/dist/client/assets/{core.esm-BRS9Ks9b.js → core.esm-B2cbbV3O.js} +1 -1
  128. package/dist/client/assets/create-organization-dialog-NLldLLor.js +1 -0
  129. package/dist/client/assets/{daily-pulse-BqDvmnPn.js → daily-pulse-ClSeB_Ta.js} +1 -1
  130. package/dist/client/assets/discover-DmBynuR0.js +1 -0
  131. package/dist/client/assets/{domain-settings-jCTqOxdl.js → domain-settings-Cu3Pj63v.js} +1 -1
  132. package/dist/client/assets/{drawer-DePU4o02.js → drawer-GssD8cb3.js} +1 -1
  133. package/dist/client/assets/{editor-wUI_HNkS.js → editor-BTovmEAS.js} +1 -1
  134. package/dist/client/assets/{editor-classes-B3UoGQQP.js → editor-classes-CcPgajKG.js} +1 -1
  135. package/dist/client/assets/{empty-state-cJTBr2cU.js → empty-state-D86P1Giw.js} +1 -1
  136. package/dist/client/assets/{empty-state-W9_vBymb.js → empty-state-DLNzdrwg.js} +1 -1
  137. package/dist/client/assets/experiments-tab-CjpJzYQ9.js +1 -0
  138. package/dist/client/assets/experiments-tab-choice-pVOiMOWe.js +1 -0
  139. package/dist/client/assets/{extract-connection-data-DFv9Bgl-.js → extract-connection-data-DwkOg2rJ.js} +1 -1
  140. package/dist/client/assets/{feature-gate-B4srxCCI.js → feature-gate-BIwsQPiQ.js} +1 -1
  141. package/dist/client/assets/{feature-paywall-CnDJ3rvy.js → feature-paywall-DpVlsq5a.js} +1 -1
  142. package/dist/client/assets/file-explorer-B9Wz0lPl.js +2 -0
  143. package/dist/client/assets/{file-preview-bA4ayYHL.js → file-preview-CX5xfaHR.js} +1 -1
  144. package/dist/client/assets/{file-share-button-BLIlQQod.js → file-share-button-Cx66riM5.js} +2 -2
  145. package/dist/client/assets/{file-type-icon-DTTBg-Cp.js → file-type-icon-tAeiI9_2.js} +1 -1
  146. package/dist/client/assets/{folder-icon-I00h66JN.js → folder-icon-C25vLo5g.js} +2 -2
  147. package/dist/client/assets/{form-KgHP-Hpi.js → form-CKF06Eu0.js} +1 -1
  148. package/dist/client/assets/general-CA7uhFzP.js +1 -0
  149. package/dist/client/assets/held-block-view-CU5t1B8c.js +20 -0
  150. package/dist/client/assets/home-BuPVKVzx.js +1 -0
  151. package/dist/client/assets/{icon-button-uPrtYnSE.js → icon-button-5JlhYc9R.js} +1 -1
  152. package/dist/client/assets/{index-Cbee4-AB.js → index-AY0yzUAx.js} +3 -3
  153. package/dist/client/assets/{index-XCP5r1I_.js → index-B0Hb2bUK.js} +1 -1
  154. package/dist/client/assets/{index-BfC50J0F.js → index-B8bCJ3Gm.js} +1 -1
  155. package/dist/client/assets/{index-BX1aT4SZ.js → index-BLRFIWph.js} +6 -6
  156. package/dist/client/assets/index-BerfNxBu.js +1 -0
  157. package/dist/client/assets/{index-D4ru75Fc.js → index-Bz0XRw1e.js} +1 -1
  158. package/dist/client/assets/index-C4tYnNih.js +253 -0
  159. package/dist/client/assets/{index-CDrRsU-I.js → index-CDfG-oXn.js} +1 -1
  160. package/dist/client/assets/{index-CvNALbEH.js → index-CJ8-jtJ3.js} +2 -2
  161. package/dist/client/assets/{index-DKUcI8bc.js → index-CMXP-HlZ.js} +1 -1
  162. package/dist/client/assets/index-CieIETkx.js +4 -0
  163. package/dist/client/assets/{index-DL_9Zurb.js → index-D8kI0oe2.js} +1 -1
  164. package/dist/client/assets/{index-WWkbzoL4.js → index-DG_Aoo8H.js} +1 -1
  165. package/dist/client/assets/{index-DqOQgVM6.js → index-DMcUJv3F.js} +1 -1
  166. package/dist/client/assets/{index-DdXWXy9i.js → index-DQ4MCRAi.js} +9 -9
  167. package/dist/client/assets/{index-redirect-BQkqIeGD.js → index-redirect-DSkhUiz1.js} +1 -1
  168. package/dist/client/assets/{infiniteQueryObserver-6MK6GS3o.js → infiniteQueryObserver-CyNcT3qz.js} +1 -1
  169. package/dist/client/assets/{infra-billing-3yuTy4Pj.js → infra-billing-OmwhvZsy.js} +1 -1
  170. package/dist/client/assets/{input-BY2tBiEb.js → input-C0IBlV9i.js} +7 -7
  171. package/dist/client/assets/{input-BUcDagSA.js → input-Drj3v1Rm.js} +1 -1
  172. package/dist/client/assets/{integration-icon-BwzO3Wq9.js → integration-icon-wG7mou98.js} +1 -1
  173. package/dist/client/assets/{jira-icon-g2GVH5bw.js → jira-icon-Ct9neMH3.js} +1 -1
  174. package/dist/client/assets/{label-CG_DMVpg.js → label-Kngegn1Y.js} +1 -1
  175. package/dist/client/assets/{layout-CsbDSI6l.js → layout-D1PXm8wr.js} +1 -1
  176. package/dist/client/assets/legacy-agents-deep-CqqR00U7.js +1 -0
  177. package/dist/client/assets/{legacy-main-redirect-CS4Abpwd.js → legacy-main-redirect-j5rWQTR7.js} +1 -1
  178. package/dist/client/assets/library-BB_eexuL.js +1 -0
  179. package/dist/client/assets/{login-DW5wI5H0.js → login-dCZC1OIS.js} +1 -1
  180. package/dist/client/assets/{markdown-D5ryQAkZ.js → markdown-C-J5-sTt.js} +1 -1
  181. package/dist/client/assets/{mcp-app-renderer-BYcHi_da.js → mcp-app-renderer-vHEVQIZL.js} +2 -2
  182. package/dist/client/assets/{mcp-oauth-Bn5p4oSU.js → mcp-oauth-5QMuPFQa.js} +1 -1
  183. package/dist/client/assets/{mcp-oauth-4UvGlLYO.js → mcp-oauth-CnB7EPe0.js} +1 -1
  184. package/dist/client/assets/members-D62Ns7xb.js +1 -0
  185. package/dist/client/assets/{memory-FU3t5-1z.js → memory-BRnI6IWM.js} +2 -2
  186. package/dist/client/assets/{mini-report-page-BBST8cjq.js → mini-report-page-RV5HcY13.js} +1 -1
  187. package/dist/client/assets/{mock-board-igDH_YVZ.js → mock-board-C5ljPU5m.js} +5 -5
  188. package/dist/client/assets/{monaco-editor-eDEJF7LD.js → monaco-editor-CG1RPml4.js} +2 -2
  189. package/dist/client/assets/monitoring-kGWQYp7Z.js +1 -0
  190. package/dist/client/assets/{monitoring-stats-row-D5LuoYp3.js → monitoring-stats-row-BpfaRq5_.js} +1 -1
  191. package/dist/client/assets/{multi-select-DYiX5KEM.js → multi-select-D79TIC6v.js} +1 -1
  192. package/dist/client/assets/mustache-BdHuXtQC.js +4 -0
  193. package/dist/client/assets/{named-rule-uses-BrQiTKM3.js → named-rule-uses-DDsPTKwP.js} +1 -1
  194. package/dist/client/assets/named-rule-view-CelDjugE.js +1 -0
  195. package/dist/client/assets/{new-project-dialog-B9qWs4Pr.js → new-project-dialog-DQPlctqf.js} +1 -1
  196. package/dist/client/assets/{oauth-callback-Dtw5ILTB.js → oauth-callback-ah6cR8xQ.js} +1 -1
  197. package/dist/client/assets/{oauth-callback-ai-provider-BSRRr6Yq.js → oauth-callback-ai-provider-C5jhPG9E.js} +1 -1
  198. package/dist/client/assets/onboarding-BPgxXbEy.js +1 -0
  199. package/dist/client/assets/openai-conversation-COLqoqqY.js +3 -0
  200. package/dist/client/assets/{optimistic-project-sidebar-views-CU6JI5UK.js → optimistic-project-sidebar-views-BXm7Dv06.js} +1 -1
  201. package/dist/client/assets/{order-monitor-day-D7HisKzI.js → order-monitor-day-DzTTlxAw.js} +1 -1
  202. package/dist/client/assets/organization-choice-CMYQUq77.js +1 -0
  203. package/dist/client/assets/orgs-Cb-j6SHO.js +1 -0
  204. package/dist/client/assets/page-seo-form-CCa1Xirx.js +1 -0
  205. package/dist/client/assets/{pair-9h1O_BO7.js → pair-CRFLUGB-.js} +8 -8
  206. package/dist/client/assets/parse-sections-CBOr5TcU.js +1 -0
  207. package/dist/client/assets/plan-CZiCKWsL.js +1 -0
  208. package/dist/client/assets/{plan-ladder-Dz8bCoAd.js → plan-ladder-Clu_D1dM.js} +1 -1
  209. package/dist/client/assets/{popover-Cdz7pgAQ.js → popover-7hw0_Cgu.js} +1 -1
  210. package/dist/client/assets/post-calendar-oSfCtk_Z.js +1 -0
  211. package/dist/client/assets/post-editor-DqdLoENq.js +2 -0
  212. package/dist/client/assets/{preview-content-BNxnqe7O.js → preview-content-tpqwn9DV.js} +1 -1
  213. package/dist/client/assets/{preview-dialog-tDLXXdPQ.js → preview-dialog-DDUA3zbn.js} +1 -1
  214. package/dist/client/assets/{preview-panel-D04CDEWQ.js → preview-panel-B7KDfk34.js} +1 -1
  215. package/dist/client/assets/preview-tab-CwHbL-uL.js +551 -0
  216. package/dist/client/assets/{product-picker-dialog-B9YEPxMK.js → product-picker-dialog-q_j-OMur.js} +1 -1
  217. package/dist/client/assets/profile--UpTdMEW.js +1 -0
  218. package/dist/client/assets/project-app-view-BDtUwetx.js +1 -0
  219. package/dist/client/assets/{project-apps-nQXtEtz0.js → project-apps-M24hPHW2.js} +1 -1
  220. package/dist/client/assets/project-feed-Dm5w30sM.js +1 -0
  221. package/dist/client/assets/{project-icon-BqAOVSaG.js → project-icon-BlULUcrw.js} +1 -1
  222. package/dist/client/assets/project-reports-BXESPzCU.js +1 -0
  223. package/dist/client/assets/project-tasks-CRajXa6Z.js +1 -0
  224. package/dist/client/assets/projects-C9fr3jni.js +1 -0
  225. package/dist/client/assets/{projects-empty-state-dd0PXzD2.js → projects-empty-state-DRas-7X9.js} +1 -1
  226. package/dist/client/assets/{prompts-C-zf2EeW.js → prompts-CiGgpCOz.js} +1 -1
  227. package/dist/client/assets/record-editor-Dw_A1nYV.js +1 -0
  228. package/dist/client/assets/redirect-editor-DbPiIIKk.js +1 -0
  229. package/dist/client/assets/releases-api-DA_Oz9WG.js +1 -0
  230. package/dist/client/assets/{reports-Dvk3psp8.js → reports-Czva0tSD.js} +1 -1
  231. package/dist/client/assets/reports-I3thcjRj.js +1 -0
  232. package/dist/client/assets/reports-onboarding-BsOWdPaY.js +1 -0
  233. package/dist/client/assets/reports-tab-C2STfD1k.js +2 -0
  234. package/dist/client/assets/repositories-B5BeE82u.js +1 -0
  235. package/dist/client/assets/repositories-Dp2o7kK8.js +1 -0
  236. package/dist/client/assets/repository-binding-C7GXruB1.js +1 -0
  237. package/dist/client/assets/{repository-import-picker-B0yxPI2j.js → repository-import-picker-BIFRKH2H.js} +1 -1
  238. package/dist/client/assets/repository-picker-D6fEwnOk.js +1 -0
  239. package/dist/client/assets/{require-capability-BFyuzPqV.js → require-capability-DSeRbn1u.js} +1 -1
  240. package/dist/client/assets/{required-auth-layout--9OrAOrr.js → required-auth-layout-D4yn4VOg.js} +1 -1
  241. package/dist/client/assets/{reset-password-C3K9ZZ2t.js → reset-password-CLlk4Qyg.js} +1 -1
  242. package/dist/client/assets/{resizable-BqY6-uYR.js → resizable-B3zVq59U.js} +1 -1
  243. package/dist/client/assets/{resolve-tab-icon-H3Wty7u7.js → resolve-tab-icon-NGCKQk4u.js} +1 -1
  244. package/dist/client/assets/review-settings-ChOJMpqj.js +1 -0
  245. package/dist/client/assets/roles-034YEIy0.js +1 -0
  246. package/dist/client/assets/route-B9sbaFmI.js +1 -0
  247. package/dist/client/assets/route-D3_kGiYP.js +1 -0
  248. package/dist/client/assets/route-DixoE7S2.js +1 -0
  249. package/dist/client/assets/{sandbox-lifecycle-context-CXn37zMt.js → sandbox-lifecycle-context-DS1zxfZb.js} +1 -1
  250. package/dist/client/assets/{schema-D2gJoNK3.js → schema-DIZqRcY2.js} +1 -1
  251. package/dist/client/assets/{schema-D5kxh02n.js → schema-DXQBt-Da.js} +1 -1
  252. package/dist/client/assets/{scroll-area-DvfamsPF.js → scroll-area-BYOXOcFm.js} +1 -1
  253. package/dist/client/assets/search-input-CM9T7koR.js +1 -0
  254. package/dist/client/assets/{search-toggle-CdGIHwQK.js → search-toggle-BA_oiAdj.js} +1 -1
  255. package/dist/client/assets/secret-picker-D2Cr-oRZ.js +1 -0
  256. package/dist/client/assets/secrets-BRbaixQo.js +1 -0
  257. package/dist/client/assets/section-array-field-TQFJqwVV.js +1 -0
  258. package/dist/client/assets/{sections-p-TiUqOZ.js → sections-05hBo9NL.js} +1 -1
  259. package/dist/client/assets/sections-editor-BR_A8Bqr.js +1 -0
  260. package/dist/client/assets/{select-DAagAjcm.js → select-BZ2tKCpr.js} +1 -1
  261. package/dist/client/assets/{select-model-DMBmIlHh.js → select-model-DskJe0jJ.js} +1 -1
  262. package/dist/client/assets/seo-editor-DWsRiK1b.js +1 -0
  263. package/dist/client/assets/{separator-Caw0JVLD.js → separator-DdBbm1xl.js} +1 -1
  264. package/dist/client/assets/settings-tab-5QV5D7iT.js +1 -0
  265. package/dist/client/assets/{sheet-BHsKOUfF.js → sheet-DYw2VD7L.js} +1 -1
  266. package/dist/client/assets/shell-layout-DQPoLlFW.js +1 -0
  267. package/dist/client/assets/site-draft-actions-dD4jyBUz.js +12 -0
  268. package/dist/client/assets/site-draft-view-Ds5aQAqU.js +2 -0
  269. package/dist/client/assets/site-editor-D8vmphjE.js +1 -0
  270. package/dist/client/assets/site-editor-toast-gO0geSY6.js +1 -0
  271. package/dist/client/assets/skills-BG0VOLIN.js +1 -0
  272. package/dist/client/assets/{slider-D9yxsjlo.js → slider-ApiojjsY.js} +1 -1
  273. package/dist/client/assets/{sortable.esm-B7h1ef6s.js → sortable.esm-DPfgkRcd.js} +1 -1
  274. package/dist/client/assets/sso-CfSDpa9Z.js +1 -0
  275. package/dist/client/assets/{suggestion-CMN-fEG6.js → suggestion-DTo0Z5su.js} +2 -2
  276. package/dist/client/assets/{switch-DpD3lo_J.js → switch-B3v6apDN.js} +1 -1
  277. package/dist/client/assets/{symbol-Hd-wRYbC.js → symbol-pDh9bf5z.js} +1 -1
  278. package/dist/client/assets/synced-repos-oiGV5Ihu.js +1 -0
  279. package/dist/client/assets/{tab-icon-glyph-XxQjDugr.js → tab-icon-glyph-BzFDI553.js} +1 -1
  280. package/dist/client/assets/{table-Cc4crfQ0.js → table-CANIhtsr.js} +1 -1
  281. package/dist/client/assets/{tabs-BpLvUwhr.js → tabs-B5O9VNwn.js} +1 -1
  282. package/dist/client/assets/task-assignee-avatar-BOAf_3H_.js +1 -0
  283. package/dist/client/assets/{task-board-M_bY8eys.js → task-board-CBBaN9ua.js} +1 -1
  284. package/dist/client/assets/{task-route-Cz8IMljw.js → task-route-1lojPQeZ.js} +1 -1
  285. package/dist/client/assets/{task-status-D4WkmdQN.js → task-status-DM1NBqlc.js} +1 -1
  286. package/dist/client/assets/taskboard-analytics-DK79qp1-.js +1 -0
  287. package/dist/client/assets/tasks--LaoDxg8.js +1 -0
  288. package/dist/client/assets/tasks-Czi5B_ZB.js +4 -0
  289. package/dist/client/assets/{textarea--yDYOLyf.js → textarea-CAZh8Kr5.js} +1 -1
  290. package/dist/client/assets/thread-analytics-K9PkKnHr.js +1 -0
  291. package/dist/client/assets/{thread-intent-DSZI851P.js → thread-intent-B9ceQWmI.js} +6 -6
  292. package/dist/client/assets/{thread-route-BLXCdzrT.js → thread-route-_-Jo9yAq.js} +1 -1
  293. package/dist/client/assets/thread-route-gmMlW4oz.js +1 -0
  294. package/dist/client/assets/thread-sheet-body-ClyiLZhS.js +1 -0
  295. package/dist/client/assets/{time-range-picker-C3BbzoOH.js → time-range-picker-m7OMfbU0.js} +1 -1
  296. package/dist/client/assets/toggle-group-8XrNtMoS.js +1 -0
  297. package/dist/client/assets/{tool-namespace-CzQWuXDV.js → tool-namespace-cn6zTT0m.js} +1 -1
  298. package/dist/client/assets/{toolbar-icon-button-7gQeG_XH.js → toolbar-icon-button-fBm5AosV.js} +1 -1
  299. package/dist/client/assets/{tooltip-rhtdmPcj.js → tooltip-B1eS9Khq.js} +1 -1
  300. package/dist/client/assets/{tooltipContext-Db2Lu1qi.js → tooltipContext-DMiC5t9-.js} +1 -1
  301. package/dist/client/assets/track-BcscPlt3.js +1 -0
  302. package/dist/client/assets/{types-s41XNAq6.js → types-C_LaIhQe.js} +9 -9
  303. package/dist/client/assets/{url-slug-DQ6KErQd.js → url-slug-BEmF9qH1.js} +1 -1
  304. package/dist/client/assets/{usage-stats-DBiTgJdn.js → usage-stats-DtO_zGwF.js} +7 -7
  305. package/dist/client/assets/{use-ai-providers-DeyDa8Td.js → use-ai-providers-C315xBlf.js} +1 -1
  306. package/dist/client/assets/use-apply-named-rule-9ihG8ELj.js +1 -0
  307. package/dist/client/assets/{use-automations-CAga8LHD.js → use-automations-BpSvam4M.js} +1 -1
  308. package/dist/client/assets/use-autosave-CRCl3eTr.js +1 -0
  309. package/dist/client/assets/{use-chat-layout-state-P4eOAh0Q.js → use-chat-layout-state-ByIICjWr.js} +1 -1
  310. package/dist/client/assets/{use-clock-tick-DKd3Khi0.js → use-clock-tick-QAJndZ00.js} +1 -1
  311. package/dist/client/assets/{use-connect-companion-CXaOPPYN.js → use-connect-companion-rEYy0Kcd.js} +1 -1
  312. package/dist/client/assets/use-connection-CBlLT-Gl.js +1 -0
  313. package/dist/client/assets/{use-content-sync-D83lTU1r.js → use-content-sync-TKItZ8SP.js} +1 -1
  314. package/dist/client/assets/{use-copy-D2ar5QXj.js → use-copy-C9NYM8DB.js} +1 -1
  315. package/dist/client/assets/{use-create-virtual-mcp-C5_jirS7.js → use-create-virtual-mcp-DFsMYI92.js} +1 -1
  316. package/dist/client/assets/use-date-fns-locale-bL-I5mOj.js +1 -0
  317. package/dist/client/assets/{use-debounced-autosave-QgHKWEfB.js → use-debounced-autosave-DfJudaYl.js} +1 -1
  318. package/dist/client/assets/{use-debounced-value-CNkh6EY5.js → use-debounced-value-DOPKXMfX.js} +1 -1
  319. package/dist/client/assets/use-deco-credits-DL_DG4I5.js +1 -0
  320. package/dist/client/assets/{use-decopilot-events-DGj-wEwB.js → use-decopilot-events-4yDcDH2I.js} +1 -1
  321. package/dist/client/assets/use-delete-connection-3ef0jZgj.js +1 -0
  322. package/dist/client/assets/{use-deployment-admin-CR9n1OEp.js → use-deployment-admin-C2GaZpz9.js} +1 -1
  323. package/dist/client/assets/{use-fast-preview-draft-url-DKL4b1dE.js → use-fast-preview-draft-url-CN-8cYCq.js} +1 -1
  324. package/dist/client/assets/{use-file-configs-D3Cv6-L2.js → use-file-configs-Dfr8whNN.js} +1 -1
  325. package/dist/client/assets/{use-inbox-feed-CVakZcHF.js → use-inbox-feed-UXhkZ9eS.js} +1 -1
  326. package/dist/client/assets/{use-infinite-scroll-DcjLDU4h.js → use-infinite-scroll-WEv8wBk9.js} +1 -1
  327. package/dist/client/assets/use-join-requests-Bf1nx4BW.js +1 -0
  328. package/dist/client/assets/use-main-panel-tabs-CnvhH3AB.js +1 -0
  329. package/dist/client/assets/{use-mcp-auth-status-DX7pkWco.js → use-mcp-auth-status-Dxn8Kcei.js} +1 -1
  330. package/dist/client/assets/{use-mcp-client-BYbk6jXo.js → use-mcp-client-BkBWhGyj.js} +10 -10
  331. package/dist/client/assets/{use-mcp-prompts-B78UkAZ_.js → use-mcp-prompts-DWjSk3XQ.js} +1 -1
  332. package/dist/client/assets/{use-mcp-tools-COs5QQOc.js → use-mcp-tools-Cq-ES3mk.js} +1 -1
  333. package/dist/client/assets/{use-mobile-19frZVl2.js → use-mobile-BADuLdb7.js} +1 -1
  334. package/dist/client/assets/use-move-blocks-Ds_0OJ4H.js +1 -0
  335. package/dist/client/assets/{use-navigate-to-agent-Bh4JZJoL.js → use-navigate-to-agent-B3bMlZK-.js} +1 -1
  336. package/dist/client/assets/{use-open-billing-url-CUDKmO6U.js → use-open-billing-url-Dfpg8Tio.js} +1 -1
  337. package/dist/client/assets/{use-org-fs-BFFpcHJy.js → use-org-fs-Dt6mQNyr.js} +1 -1
  338. package/dist/client/assets/{use-org-repo-syncs-C29Ouwht.js → use-org-repo-syncs-D2j2_BKY.js} +1 -1
  339. package/dist/client/assets/{use-org-sso-BlWFmoCA.js → use-org-sso-CWvWEDQk.js} +1 -1
  340. package/dist/client/assets/use-organization-roles-DsjUZx1i.js +1 -0
  341. package/dist/client/assets/{use-organization-settings-XPH6XBPi.js → use-organization-settings-DBQ6GIch.js} +1 -1
  342. package/dist/client/assets/{use-panel-navigate-BKTq-N_H.js → use-panel-navigate-DZO4-0o6.js} +1 -1
  343. package/dist/client/assets/{use-project-native-view-presence-aJpFnShz.js → use-project-native-view-presence-Y3Sopx8q.js} +1 -1
  344. package/dist/client/assets/{use-project-scope-hi480z1p.js → use-project-scope-CKNjz3VB.js} +1 -1
  345. package/dist/client/assets/{use-recent-apps-DII4SRHf.js → use-recent-apps-TrfPEwKE.js} +1 -1
  346. package/dist/client/assets/{use-releases-GaRydy_l.js → use-releases-DSFeRsP3.js} +1 -1
  347. package/dist/client/assets/use-reports-diagnostic-YBAEN0Wc.js +1 -0
  348. package/dist/client/assets/{use-sandbox-events-CsNrKmda.js → use-sandbox-events-C6ionJ0p.js} +2 -2
  349. package/dist/client/assets/{use-secrets-DJcOfixK.js → use-secrets-xwuuJgHg.js} +1 -1
  350. package/dist/client/assets/use-section-preview-base-BdMX2uY9.js +1 -0
  351. package/dist/client/assets/use-session-runtime-CtTWKH1c.js +1 -0
  352. package/dist/client/assets/{use-sidebar-collapsed-8USbBI0-.js → use-sidebar-collapsed-DXyrU3VA.js} +1 -1
  353. package/dist/client/assets/{use-tags-DvW8yrHX.js → use-tags-CwZHa3pE.js} +1 -1
  354. package/dist/client/assets/use-task-board-analytics-BzPvlYE9.js +1 -0
  355. package/dist/client/assets/{use-task-board-events-De3JY1Pe.js → use-task-board-events-qI_skUMm.js} +1 -1
  356. package/dist/client/assets/{use-task-board-item-prs-CXzTAmMM.js → use-task-board-item-prs-CiXpN6jW.js} +1 -1
  357. package/dist/client/assets/{use-task-metadata-9cyD8qGI.js → use-task-metadata-E8aNM85o.js} +1 -1
  358. package/dist/client/assets/{use-thread-analytics-DltmG-kv.js → use-thread-analytics-DKupwFaR.js} +1 -1
  359. package/dist/client/assets/{use-thread-outputs-BKCBvLqB.js → use-thread-outputs-Di1RSISN.js} +1 -1
  360. package/dist/client/assets/useInfiniteQuery-CtWUiDbh.js +1 -0
  361. package/dist/client/assets/useQueries-BOzKsoXi.js +1 -0
  362. package/dist/client/assets/useSuspenseInfiniteQuery-Diw12fEI.js +1 -0
  363. package/dist/client/assets/users-Cup6bGNw.js +1 -0
  364. package/dist/client/assets/{utils-BnP8cv1B.js → utils-wTX1Gyo-.js} +1 -1
  365. package/dist/client/assets/variant-calendar-Doi5lHFb.js +1 -0
  366. package/dist/client/assets/variant-matcher-override-LGFgaSJn.js +1 -0
  367. package/dist/client/assets/{virtual-mcp-B8cZ7VfA.js → virtual-mcp-DO56RLOP.js} +1 -1
  368. package/dist/client/assets/{watch-sse-pool-DYaS1vyu.js → watch-sse-pool-BBTCM7MS.js} +1 -1
  369. package/dist/client/index.html +1 -1
  370. package/dist/server/server.js +713 -713
  371. package/package.json +2 -2
  372. package/dist/client/assets/User01-BqHvPhUP.js +0 -1
  373. package/dist/client/assets/access-gate-DyUtzmE9.js +0 -1
  374. package/dist/client/assets/agent-analytics-vIfEsYvC.js +0 -1
  375. package/dist/client/assets/agent-app-BrsqSpps.js +0 -1
  376. package/dist/client/assets/agent-assets-Cmwamjo6.js +0 -1
  377. package/dist/client/assets/agent-automation-DTP-nUve.js +0 -20
  378. package/dist/client/assets/agent-automations-DMzq_O24.js +0 -1
  379. package/dist/client/assets/agent-calendar-XJ6NXM0R.js +0 -1
  380. package/dist/client/assets/agent-connect-sources-BcRlDvxt.js +0 -1
  381. package/dist/client/assets/agent-deck-DDf8uIAO.js +0 -1
  382. package/dist/client/assets/agent-e2e-C9yo2VIy.js +0 -1
  383. package/dist/client/assets/agent-experiments-CBXMu_zo.js +0 -1
  384. package/dist/client/assets/agent-file-NVbz9x8-.js +0 -1
  385. package/dist/client/assets/agent-hosting--zgA3Vth.js +0 -1
  386. package/dist/client/assets/agent-icon-B_vqhfDt.js +0 -1
  387. package/dist/client/assets/agent-library-DnuSkP9c.js +0 -1
  388. package/dist/client/assets/agent-library-file-BvLizRc3.js +0 -1
  389. package/dist/client/assets/agent-monitor-rNkT_MKe.js +0 -1
  390. package/dist/client/assets/agent-overview-5SBfPz9h.js +0 -1
  391. package/dist/client/assets/agent-releases-Ln3sIMtS.js +0 -2
  392. package/dist/client/assets/agent-settings-D6bOK1ga.js +0 -1
  393. package/dist/client/assets/agent-site-editor-code-0Vxgov65.js +0 -2
  394. package/dist/client/assets/agent-site-editor-content-CoS3vIfM.js +0 -1
  395. package/dist/client/assets/agent-site-editor-preview-7txrWBOo.js +0 -1
  396. package/dist/client/assets/agent-view-C8DZj3zZ.js +0 -1
  397. package/dist/client/assets/agents-list-CUtOSk6b.js +0 -1
  398. package/dist/client/assets/alert-dialog-Bjihy8X7.js +0 -7
  399. package/dist/client/assets/analytics-sections-B_qn34eY.js +0 -1
  400. package/dist/client/assets/analytics-tab-DluP6EHx.js +0 -2
  401. package/dist/client/assets/api-keys-B5pbeuIW.js +0 -1
  402. package/dist/client/assets/api-keys-DRbQ6j-D.js +0 -1
  403. package/dist/client/assets/app-editor-l5QnxgXk.js +0 -1
  404. package/dist/client/assets/automation-list-row-DfibF1_j.js +0 -1
  405. package/dist/client/assets/automation-runs-CzCUPkiw.js +0 -1
  406. package/dist/client/assets/automations-CEr5Md2h.js +0 -1
  407. package/dist/client/assets/avatar-C5-kxiV_.js +0 -1
  408. package/dist/client/assets/blocks-tab-states-DSvvcfKU.js +0 -1
  409. package/dist/client/assets/blog-schema-7PNm5SA8.js +0 -1
  410. package/dist/client/assets/buckets-B99EVfxO.js +0 -1
  411. package/dist/client/assets/build-improve-prompt-doc-Dx-5MdwQ.js +0 -2
  412. package/dist/client/assets/campaigns-view-_4Aj2Qex.js +0 -1
  413. package/dist/client/assets/category-editor-Bz5Ohuf6.js +0 -1
  414. package/dist/client/assets/choose-editor-BpBHfKld.js +0 -1
  415. package/dist/client/assets/cms-settings-editor-DgOpqRn9.js +0 -1
  416. package/dist/client/assets/collection-detail-B4JsebMy.js +0 -1
  417. package/dist/client/assets/collection-display-button-BFEeUD4b.js +0 -1
  418. package/dist/client/assets/connect-source-dialog-BucnBQV1.js +0 -1
  419. package/dist/client/assets/connection-detail-BUrc4tQa.js +0 -1
  420. package/dist/client/assets/connections-UgNbDD55.js +0 -1
  421. package/dist/client/assets/content-tab-BzJzqdaq.js +0 -22
  422. package/dist/client/assets/context-BQ17H5cY.js +0 -1
  423. package/dist/client/assets/create-organization-dialog-4e3oT20D.js +0 -1
  424. package/dist/client/assets/differenceInSeconds-C3x8sHUj.js +0 -1
  425. package/dist/client/assets/discover-Du9d6I7b.js +0 -1
  426. package/dist/client/assets/experiments-tab-BGSl9C7j.js +0 -1
  427. package/dist/client/assets/experiments-tab-choice-C5L5-OKs.js +0 -1
  428. package/dist/client/assets/file-explorer-CSFyTcCU.js +0 -2
  429. package/dist/client/assets/format-time-Cq80KKvY.js +0 -1
  430. package/dist/client/assets/general-DDniHgaA.js +0 -1
  431. package/dist/client/assets/home-BRa0QePQ.js +0 -1
  432. package/dist/client/assets/index-BSPqDg2b.js +0 -243
  433. package/dist/client/assets/index-BV9YjMM8.js +0 -4
  434. package/dist/client/assets/index-CoCFpkNq.js +0 -1
  435. package/dist/client/assets/legacy-agents-deep-D4dQPRbz.js +0 -1
  436. package/dist/client/assets/library-CvZRvu0t.js +0 -1
  437. package/dist/client/assets/members-DV5nm69j.js +0 -1
  438. package/dist/client/assets/monitoring-L8Ph-qIO.js +0 -1
  439. package/dist/client/assets/mustache-DcAMNVPe.js +0 -4
  440. package/dist/client/assets/named-rule-view-DPJVdujZ.js +0 -1
  441. package/dist/client/assets/onboarding-CJ1-Q27q.js +0 -1
  442. package/dist/client/assets/openai-conversation-rJmL2Chq.js +0 -3
  443. package/dist/client/assets/organization-choice-B3HKKRFg.js +0 -1
  444. package/dist/client/assets/orgs-BGahARMX.js +0 -1
  445. package/dist/client/assets/page-seo-form-BiLzLwOU.js +0 -1
  446. package/dist/client/assets/parse-sections-DS7cH63b.js +0 -1
  447. package/dist/client/assets/plan-TS8UDjIx.js +0 -1
  448. package/dist/client/assets/post-calendar-BVj47Msq.js +0 -1
  449. package/dist/client/assets/post-editor-C7Epq6Gf.js +0 -2
  450. package/dist/client/assets/preview-tab-CstRd2P8.js +0 -551
  451. package/dist/client/assets/profile-HCYVLr3x.js +0 -1
  452. package/dist/client/assets/project-app-view-CsgTKaq6.js +0 -1
  453. package/dist/client/assets/project-feed-CSKm059T.js +0 -1
  454. package/dist/client/assets/project-reports-N6Np5HVd.js +0 -1
  455. package/dist/client/assets/project-tasks-hQ8mdw3x.js +0 -1
  456. package/dist/client/assets/projects-BR95BuCh.js +0 -1
  457. package/dist/client/assets/record-editor-gFz45d56.js +0 -1
  458. package/dist/client/assets/redirect-editor-DPpKBLYS.js +0 -1
  459. package/dist/client/assets/releases-api-CSVCy8ox.js +0 -1
  460. package/dist/client/assets/reports-BVHdd1DX.js +0 -1
  461. package/dist/client/assets/reports-onboarding-UQrdSX_1.js +0 -1
  462. package/dist/client/assets/reports-tab-ppUXZsCY.js +0 -2
  463. package/dist/client/assets/repositories-5RxDBg9o.js +0 -1
  464. package/dist/client/assets/repositories-DZ7Jj2ky.js +0 -1
  465. package/dist/client/assets/repository-binding-BPraGDH6.js +0 -1
  466. package/dist/client/assets/repository-picker-C8ArkEMp.js +0 -1
  467. package/dist/client/assets/review-settings-CdVHPED2.js +0 -1
  468. package/dist/client/assets/roles-OamyC7La.js +0 -1
  469. package/dist/client/assets/route-C9Fxdgiw.js +0 -1
  470. package/dist/client/assets/route-CwPF8ORe.js +0 -1
  471. package/dist/client/assets/route-u0GAyBX0.js +0 -1
  472. package/dist/client/assets/runnable-block-editor-Bp72FsGX.js +0 -20
  473. package/dist/client/assets/search-input-5CsF8kzc.js +0 -1
  474. package/dist/client/assets/secret-ciphertext-DjJJ47rv.js +0 -1
  475. package/dist/client/assets/secret-picker-BO4uK8to.js +0 -1
  476. package/dist/client/assets/secrets-D1oNMOlx.js +0 -1
  477. package/dist/client/assets/sections-editor-DR2QTs_8.js +0 -4
  478. package/dist/client/assets/seo-editor-_CrgKo3u.js +0 -1
  479. package/dist/client/assets/settings-tab-CXub7dpW.js +0 -1
  480. package/dist/client/assets/shell-layout-CnFOD7IR.js +0 -1
  481. package/dist/client/assets/site-draft-actions-DahX0dKS.js +0 -12
  482. package/dist/client/assets/site-draft-view-D6OUnR3H.js +0 -2
  483. package/dist/client/assets/site-editor-FcBrQD_V.js +0 -1
  484. package/dist/client/assets/site-editor-toast-CrL8-myE.js +0 -1
  485. package/dist/client/assets/skills-dBhtb1Gn.js +0 -1
  486. package/dist/client/assets/sso-K3rjig-T.js +0 -1
  487. package/dist/client/assets/synced-repos-Dnzg3gpT.js +0 -1
  488. package/dist/client/assets/task-assignee-avatar-ZgHLf6ou.js +0 -1
  489. package/dist/client/assets/taskboard-analytics-BkUf4gRJ.js +0 -1
  490. package/dist/client/assets/tasks-CAS-CTER.js +0 -4
  491. package/dist/client/assets/tasks-qaZFyecx.js +0 -1
  492. package/dist/client/assets/thread-analytics-DUGo9IpI.js +0 -1
  493. package/dist/client/assets/thread-route-GuSmOAXN.js +0 -1
  494. package/dist/client/assets/thread-sheet-body-BFLCqyyQ.js +0 -1
  495. package/dist/client/assets/toggle-group-6nw88m-B.js +0 -1
  496. package/dist/client/assets/track-CZFERlEy.js +0 -1
  497. package/dist/client/assets/use-apply-named-rule-CTNrtoG8.js +0 -1
  498. package/dist/client/assets/use-autosave-BhBt5LM5.js +0 -1
  499. package/dist/client/assets/use-connection-CjozY_rG.js +0 -1
  500. package/dist/client/assets/use-date-fns-locale-QW50a7Gw.js +0 -1
  501. package/dist/client/assets/use-deco-credits-B57v3A_1.js +0 -1
  502. package/dist/client/assets/use-delete-connection-C8eU1V0w.js +0 -1
  503. package/dist/client/assets/use-join-requests-Cbj3PHUb.js +0 -1
  504. package/dist/client/assets/use-main-panel-tabs-CO8s8ZiU.js +0 -1
  505. package/dist/client/assets/use-members-Dyl3oSqD.js +0 -1
  506. package/dist/client/assets/use-move-blocks-DJK_Y1io.js +0 -1
  507. package/dist/client/assets/use-org-auth-client-Dw_o5R0I.js +0 -1
  508. package/dist/client/assets/use-organization-roles-DaU1N-it.js +0 -1
  509. package/dist/client/assets/use-reports-diagnostic-BCaZjPYS.js +0 -1
  510. package/dist/client/assets/use-section-preview-base-BqthfvXx.js +0 -1
  511. package/dist/client/assets/use-session-runtime-GSil35TM.js +0 -1
  512. package/dist/client/assets/use-task-board-analytics-CzI79mN4.js +0 -1
  513. package/dist/client/assets/useInfiniteQuery-BMw5-0ES.js +0 -1
  514. package/dist/client/assets/useQueries-MmC9BfTO.js +0 -1
  515. package/dist/client/assets/useSuspenseInfiniteQuery-BzZNrnpe.js +0 -1
  516. package/dist/client/assets/users-DwCtEgjJ.js +0 -1
  517. package/dist/client/assets/variant-calendar-2sbluJx7.js +0 -1
  518. package/dist/client/assets/variant-matcher-override-BuVYz4je.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as V,eE as Sc,eA as Yf,j as k,b3 as Xf,e1 as _t,eF as Qf,c as Yt,b as So,aE as Zf,h as eh,B as xl,aH as Sl,aG as th,aF as nh,v as rh,s as sh,I as ih,w as oh,q as lh,D as ah,l as er,af as ch,y as uh}from"./index-BSPqDg2b.js";import{d as dh,g as fh}from"./tool-namespace-CzQWuXDV.js";import{a as hh,F as ph,b as mh,c as gh,d as yh,f as bh}from"./form-KgHP-Hpi.js";import{t as Cl}from"./utils-CVEq3hMx.js";import{a as kh,M as xh}from"./markdown-D5ryQAkZ.js";import{u as Sh}from"./use-copy-D2ar5QXj.js";import{a as Ch}from"./Copy01-B5Qm_DvO.js";import{T as tr,a as nr,c as rr}from"./tooltip-rhtdmPcj.js";import{j as Mh}from"./agent-icon-B_vqhfDt.js";import{c as Ml}from"./format-time-Cq80KKvY.js";import{c as Co}from"./use-decopilot-events-DGj-wEwB.js";import{K as Mo}from"./chat-context-DwIrrO5r.js";var Tl=Object.defineProperty,Th=(n,e)=>{let t={};for(var r in n)Tl(t,r,{get:n[r],enumerable:!0});return Tl(t,Symbol.toStringTag,{value:"Module"}),t};function ae(n){this.content=n}ae.prototype={constructor:ae,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,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new ae(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ae(t)},addToStart:function(n,e){return new ae([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ae(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new ae(s)},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=ae.from(n),n.size?new ae(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ae.from(n),n.size?new ae(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ae.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}};ae.from=function(n){if(n instanceof ae)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ae(e)};function Cc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){let o=s.text,l=i.text,a=0;for(;o[a]==l[a];a++)t++;return a&&a<o.length&&a<l.length&&Ec(o.charCodeAt(a-1))&&Tc(o.charCodeAt(a))&&t--,t}if(s.content.size||i.content.size){let o=Cc(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Mc(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=o.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d<c.length&&Ec(c.charCodeAt(d-1))&&Tc(c.charCodeAt(d))&&(t++,r++),{a:t,b:r}}if(o.content.size||l.content.size){let c=Mc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}function Tc(n){return n>=56320&&n<57344}function Ec(n){return n>=55296&&n<56320}class S{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,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new S(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new S(r,s)}cutByIndex(e,t){return e==t?S.empty:e==0&&t==this.content.length?this:new S(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new S(s,i)}addToStart(e){return new S([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new S(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 s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Cc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Mc(this,e,t,r)}findIndex(e){if(e==0)return vr(0,e);if(e==this.size)return vr(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 s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?vr(t+1,i):vr(t,r);r=i}}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 S.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return S.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return S.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new S(t||e,r)}static from(e){if(!e)return S.empty;if(e instanceof S)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new S([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}S.empty=new S([],0);const ti={index:0,offset:0};function vr(n,e){return ti.index=n,ti.offset=e,ti}function Ur(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(!Ur(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Ur(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let F=class Di{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}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&&Ur(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 s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}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 Di.none;if(e instanceof Di)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};F.none=[];class sr extends Error{}class E{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=vc(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new E(r,this.openStart,this.openEnd)}removeBetween(e,t){return new E(wc(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 E.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new E(S.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new E(e,r,s)}}E.empty=new E(S.empty,0,0);function wc(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(wc(i.content,e-s-1,t-s-1)))}function vc(n,e,t,r,s,i){let{index:o,offset:l}=n.findIndex(e),a=n.maybeChild(o);if(l==e||a.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=vc(a.content,e-l-1,t,o==0?r-1:0,o==n.childCount-1?s-1:0,a);return c&&n.replaceChild(o,a.copy(c))}function Eh(n,e,t){if(t.openStart>n.depth)throw new sr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new sr("Inconsistent open depths");return Nc(n,e,t,0)}function Nc(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Nc(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Bt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=wh(t,n);return Bt(i,Oc(n,o,l,e,r))}else return Bt(i,qr(n,e,r))}function Ac(n,e){if(!e.type.compatibleContent(n.type))throw new sr("Cannot join "+e.type.name+" onto "+n.type.name)}function Ri(n,e,t){let r=n.node(t);return Ac(r,e.node(t)),r}function zt(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 Fn(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(zt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)zt(s.child(l),r);e&&e.depth==t&&e.textOffset&&zt(e.nodeBefore,r)}function Bt(n,e){if(!n.type.validContent(e))throw new sr("Invalid content for node "+n.type.name);return n.copy(e)}function Oc(n,e,t,r,s){let i=n.depth>s&&Ri(n,e,s+1),o=r.depth>s&&Ri(t,r,s+1),l=[];return Fn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Ac(i,o),zt(Bt(i,Oc(n,e,t,r,s+1)),l)):(i&&zt(Bt(i,qr(n,e,s+1)),l),Fn(e,t,s,l),o&&zt(Bt(o,qr(t,r,s+1)),l)),Fn(r,null,s,l),new S(l)}function qr(n,e,t){let r=[];if(Fn(null,n,t,r),n.depth>t){let s=Ri(n,e,t+1);zt(Bt(s,qr(n,e,t+1)),r)}return Fn(e,null,t,r),new S(r)}function wh(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(S.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class ir{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],s=e.child(t);return r?e.child(t).cut(r):s}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],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return F.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].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 Jr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let 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=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ir(t,r,i)}static resolveCached(e,t){let r=El.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else El.set(e,r=new vh);let s=r.elts[r.i]=ir.resolve(e,t);return r.i=(r.i+1)%Nh,s}}class vh{constructor(){this.elts=[],this.i=0}}const Nh=12,El=new WeakMap;class Jr{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 Ah=Object.create(null);let Ft=class Ii{constructor(e,t,r,s=F.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||S.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,s=0){this.content.nodesBetween(e,t,r,s,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,s){return this.content.textBetween(e,t,r,s)}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&&Ur(this.attrs,t||e.defaultAttrs||Ah)&&F.sameSet(this.marks,r||F.none)}copy(e=null){return e==this.content?this:new Ii(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ii(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 E.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new E(c,s.depth-o,i.depth-o)}replace(e,t,r){return Eh(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+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 s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return ir.resolveCached(this,e)}resolveNoCache(e){return ir.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),Dc(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=S.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=F.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(!F.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 s=S.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};Ft.prototype.text=void 0;class Gr extends Ft{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Dc(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 Gr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Gr(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 Dc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Ut{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Oh(e,t);if(r.next==null)return Ut.empty;let s=Rc(r);r.next&&r.err("Unexpected trailing text");let i=zh($h(s));return Bh(i,r),i}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 s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}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 s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return S.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(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 s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
1
+ import{r as V,f_ as Sc,fW as Yf,j as k,bP as Xf,fd as _t,f$ as Qf,c as Yt,b as So,aI as Zf,h as eh,B as xl,aL as Sl,aK as th,aJ as nh,x as rh,w as sh,I as ih,y as oh,v as lh,D as ah,l as er,ai as ch,C as uh,fI as Cl}from"./index-C4tYnNih.js";import{d as dh,g as fh}from"./tool-namespace-cn6zTT0m.js";import{a as hh,F as ph,b as mh,c as gh,d as yh,f as bh}from"./form-CKF06Eu0.js";import{t as Ml}from"./utils-CVEq3hMx.js";import{a as kh,M as xh}from"./markdown-C-J5-sTt.js";import{u as Sh}from"./use-copy-C9NYM8DB.js";import{a as Ch}from"./Copy01-B9x501ud.js";import{T as tr,a as nr,c as rr}from"./tooltip-B1eS9Khq.js";import{j as Mh}from"./agent-icon-KvVT3fA8.js";import{c as Co}from"./use-decopilot-events-4yDcDH2I.js";import{K as Mo}from"./chat-context-CIOqAIIy.js";var Tl=Object.defineProperty,Th=(n,e)=>{let t={};for(var r in n)Tl(t,r,{get:n[r],enumerable:!0});return Tl(t,Symbol.toStringTag,{value:"Module"}),t};function ae(n){this.content=n}ae.prototype={constructor:ae,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,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new ae(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ae(t)},addToStart:function(n,e){return new ae([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ae(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new ae(s)},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=ae.from(n),n.size?new ae(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ae.from(n),n.size?new ae(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ae.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}};ae.from=function(n){if(n instanceof ae)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ae(e)};function Cc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){let o=s.text,l=i.text,a=0;for(;o[a]==l[a];a++)t++;return a&&a<o.length&&a<l.length&&Ec(o.charCodeAt(a-1))&&Tc(o.charCodeAt(a))&&t--,t}if(s.content.size||i.content.size){let o=Cc(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Mc(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=o.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d<c.length&&Ec(c.charCodeAt(d-1))&&Tc(c.charCodeAt(d))&&(t++,r++),{a:t,b:r}}if(o.content.size||l.content.size){let c=Mc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}function Tc(n){return n>=56320&&n<57344}function Ec(n){return n>=55296&&n<56320}class S{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,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new S(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new S(r,s)}cutByIndex(e,t){return e==t?S.empty:e==0&&t==this.content.length?this:new S(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new S(s,i)}addToStart(e){return new S([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new S(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 s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Cc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Mc(this,e,t,r)}findIndex(e){if(e==0)return vr(0,e);if(e==this.size)return vr(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 s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?vr(t+1,i):vr(t,r);r=i}}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 S.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return S.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return S.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new S(t||e,r)}static from(e){if(!e)return S.empty;if(e instanceof S)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new S([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}S.empty=new S([],0);const ti={index:0,offset:0};function vr(n,e){return ti.index=n,ti.offset=e,ti}function Ur(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(!Ur(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Ur(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let F=class Di{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}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&&Ur(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 s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}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 Di.none;if(e instanceof Di)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};F.none=[];class sr extends Error{}class E{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=vc(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new E(r,this.openStart,this.openEnd)}removeBetween(e,t){return new E(wc(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 E.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new E(S.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new E(e,r,s)}}E.empty=new E(S.empty,0,0);function wc(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(wc(i.content,e-s-1,t-s-1)))}function vc(n,e,t,r,s,i){let{index:o,offset:l}=n.findIndex(e),a=n.maybeChild(o);if(l==e||a.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=vc(a.content,e-l-1,t,o==0?r-1:0,o==n.childCount-1?s-1:0,a);return c&&n.replaceChild(o,a.copy(c))}function Eh(n,e,t){if(t.openStart>n.depth)throw new sr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new sr("Inconsistent open depths");return Nc(n,e,t,0)}function Nc(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Nc(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Bt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=wh(t,n);return Bt(i,Oc(n,o,l,e,r))}else return Bt(i,qr(n,e,r))}function Ac(n,e){if(!e.type.compatibleContent(n.type))throw new sr("Cannot join "+e.type.name+" onto "+n.type.name)}function Ri(n,e,t){let r=n.node(t);return Ac(r,e.node(t)),r}function zt(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 Fn(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(zt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)zt(s.child(l),r);e&&e.depth==t&&e.textOffset&&zt(e.nodeBefore,r)}function Bt(n,e){if(!n.type.validContent(e))throw new sr("Invalid content for node "+n.type.name);return n.copy(e)}function Oc(n,e,t,r,s){let i=n.depth>s&&Ri(n,e,s+1),o=r.depth>s&&Ri(t,r,s+1),l=[];return Fn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Ac(i,o),zt(Bt(i,Oc(n,e,t,r,s+1)),l)):(i&&zt(Bt(i,qr(n,e,s+1)),l),Fn(e,t,s,l),o&&zt(Bt(o,qr(t,r,s+1)),l)),Fn(r,null,s,l),new S(l)}function qr(n,e,t){let r=[];if(Fn(null,n,t,r),n.depth>t){let s=Ri(n,e,t+1);zt(Bt(s,qr(n,e,t+1)),r)}return Fn(e,null,t,r),new S(r)}function wh(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(S.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class ir{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],s=e.child(t);return r?e.child(t).cut(r):s}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],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return F.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].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 Jr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let 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=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ir(t,r,i)}static resolveCached(e,t){let r=El.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else El.set(e,r=new vh);let s=r.elts[r.i]=ir.resolve(e,t);return r.i=(r.i+1)%Nh,s}}class vh{constructor(){this.elts=[],this.i=0}}const Nh=12,El=new WeakMap;class Jr{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 Ah=Object.create(null);let Ft=class Ii{constructor(e,t,r,s=F.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||S.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,s=0){this.content.nodesBetween(e,t,r,s,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,s){return this.content.textBetween(e,t,r,s)}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&&Ur(this.attrs,t||e.defaultAttrs||Ah)&&F.sameSet(this.marks,r||F.none)}copy(e=null){return e==this.content?this:new Ii(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ii(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 E.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new E(c,s.depth-o,i.depth-o)}replace(e,t,r){return Eh(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+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 s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return ir.resolveCached(this,e)}resolveNoCache(e){return ir.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),Dc(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=S.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=F.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(!F.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 s=S.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};Ft.prototype.text=void 0;class Gr extends Ft{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Dc(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 Gr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Gr(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 Dc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Ut{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Oh(e,t);if(r.next==null)return Ut.empty;let s=Rc(r);r.next&&r.err("Unexpected trailing text");let i=zh($h(s));return Bh(i,r),i}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 s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}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 s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return S.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(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 s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
2
2
  `)}}Ut.empty=new Ut(!0);class Oh{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 Rc(n){let e=[];do e.push(Dh(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Dh(n){let e=[];do e.push(Rh(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Rh(n){let e=Lh(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=Ih(n,e);else break;return e}function wl(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Ih(n,e){let t=wl(n),r=t;return n.eat(",")&&(n.next!="}"?r=wl(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Ph(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function Lh(n){if(n.eat("(")){let e=Rc(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=Ph(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 $h(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Ic(n,e){return e-n}function vl(n,e){let t=[];return r(e),t.sort(Ic);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&t.indexOf(a)==-1&&r(a)}}}function zh(n){let e=Object.create(null);return t(vl(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);vl(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Ut(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(Ic);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function Bh(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Pc(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 Lc(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function $c(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${r}`);for(let s in n)n[s].validate&&n[s].validate(e[s])}function zc(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new jh(n,r,e[r]);return t}let Nl=class Bc{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=zc(e,r.attrs),this.defaultAttrs=Pc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ut.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Lc(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ft(this,this.computeAttrs(e),S.from(t),F.setFrom(r))}createChecked(e=null,t,r){return t=S.from(t),this.checkContent(t),new Ft(this,this.computeAttrs(e),t,F.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=S.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(S.empty,!0);return i?new Ft(this,e,t.append(i),F.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){$c(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:F.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new Bc(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Fh(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class jh{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Fh(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Fs{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=zc(e,s.attrs),this.excluded=null;let i=Pc(this.attrs);this.instance=i?new F(this,i):null}create(e=null){return!e&&this.instance?this.instance:new F(this,Lc(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Fs(i,s++,t,o)),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){$c(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Fc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=ae.from(e.nodes),t.marks=ae.from(e.marks||{}),this.nodes=Nl.compile(this.spec.nodes,this),this.marks=Fs.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Ut.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Al(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:Al(this,o.split(" "))}this.nodeFromJSON=s=>Ft.fromJSON(this,s),this.markFromJSON=s=>F.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Nl){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,s)}text(e,t){let r=this.nodes.text;return new Gr(r,r.defaultAttrs,e,F.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 Al(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Hh(n){return n.tag!=null}function Vh(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(s=>{if(Hh(s))this.tags.push(s);else if(Vh(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Dl(this,t,!1);return r.addAll(e,F.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Dl(this,t,!0);return r.addAll(e,F.none,t.from,t.to),E.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(_h(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Rl(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Rl(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new He(e,He.schemaRules(e)))}}const jc={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Wh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Hc={ol:!0,ul:!0},or=1,Pi=2,jn=4;function Ol(n,e,t){return e!=null?(e?or:0)|(e==="full"?Pi:0):n&&n.whitespace=="pre"?or|Pi:t&~jn}class Nr{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=F.none,this.match=i||(o&jn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(S.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&or)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=S.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(S.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&&!jc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Dl{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=Ol(null,t.preserveWhitespace,0)|(r?jn:0);s?i=new Nr(s.type,s.attrs,F.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Nr(null,null,F.none,!0,null,o):i=new Nr(e.schema.topNodeType,null,F.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Pi?"full":this.localPreserveWS||(s.options&or)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Hc.hasOwnProperty(o)&&this.parser.normalizeLists&&Kh(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Wh.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(jc.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=F.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Il(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Ol(e,i,o.options);o.options&jn&&o.content.length==0&&(l|=jn);let a=F.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Il(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Nr(e,t,a,s,null,l)),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|=or)}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 s=r.length-1;s>=0;s--)e+=r[s].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 s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].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,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(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 Kh(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Hc.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function _h(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Rl(n){let e={};for(let t in n)e[t]=n[t];return e}function Il(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class rt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Ar(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){if(e.isText)return Ar(t).createTextNode(e.text);let{dom:r,contentDOM:s}=Hr(Ar(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Hr(Ar(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return typeof t=="string"?{dom:e.createTextNode(t)}:Hr(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new rt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Pl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Pl(e.marks)}}function Pl(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Ar(n){return n.document||window.document}const Ll=new WeakMap;function Uh(n){let e=Ll.get(n);return e===void 0&&Ll.set(n,e=qh(n)),e}function qh(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 s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Hr(n,e,t,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Uh(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(n.createTextNode(f));else{let{dom:h,contentDOM:p}=Hr(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Vc=65535,Wc=Math.pow(2,16);function Jh(n,e){return n+e*Wc}function $l(n){return n&Vc}function Gh(n){return(n-(n&Vc))/Wc}const Kc=1,_c=2,Vr=4,Uc=8;class Li{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Uc)>0}get deletedBefore(){return(this.delInfo&(Kc|Vr))>0}get deletedAfter(){return(this.delInfo&(_c|Vr))>0}get deletedAcross(){return(this.delInfo&Vr)>0}}class Me{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Me.empty)return Me.empty}recover(e){let t=0,r=$l(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+Gh(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 s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:Jh(l/3,e-a),g=e==a?_c:e==d?Kc:Vr;return(t<0?e!=a:e!=d)&&(g|=Uc),new Li(h,g,p)}s+=u-c}return r?e+s:new Li(e+s,0,null)}touches(e,t){let r=0,s=$l(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new Me(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Me.empty:new Me(e<0?[0,-e,0]:[0,0,e])}}Me.empty=new Me([]);class lr{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new lr(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 s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s: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 s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new lr;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 s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Li(e,s,null)}}const ni=Object.create(null);class pe{getMap(){return Me.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ni[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 ni)throw new RangeError("Duplicate use of step JSON ID "+e);return ni[e]=t,t.prototype.jsonID=e,t}}class Z{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Z(e,null)}static fail(e){return new Z(null,e)}static fromReplace(e,t,r,s){try{return Z.ok(e.replace(t,r,s))}catch(i){if(i instanceof sr)return Z.fail(i.message);throw i}}}function To(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(To(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return S.fromArray(r)}class mt extends pe{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),s=r.node(r.sharedDepth(this.to)),i=new E(To(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return Z.fromReplace(e,this.from,this.to,i)}invert(){return new Ie(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 mt(t.pos,r.pos,this.mark)}merge(e){return e instanceof mt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new mt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new mt(t.from,t.to,e.markFromJSON(t.mark))}}pe.jsonID("addMark",mt);class Ie extends pe{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 E(To(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return Z.fromReplace(e,this.from,this.to,r)}invert(){return new mt(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 Ie(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ie&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ie(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 Ie(t.from,t.to,e.markFromJSON(t.mark))}}pe.jsonID("removeMark",Ie);class gt extends pe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Z.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Z.fromReplace(e,this.pos,this.pos+1,new E(S.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 s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new gt(this.pos,t.marks[s]);return new gt(this.pos,this.mark)}}return new qt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new gt(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 gt(t.pos,e.markFromJSON(t.mark))}}pe.jsonID("addNodeMark",gt);class qt extends pe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Z.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Z.fromReplace(e,this.pos,this.pos+1,new E(S.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new gt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new qt(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 qt(t.pos,e.markFromJSON(t.mark))}}pe.jsonID("removeNodeMark",qt);class X extends pe{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&$i(e,this.from,this.to)?Z.fail("Structure replace would overwrite content"):Z.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Me([this.from,this.to-this.from,this.slice.size])}invert(e){return new X(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&&X.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new X(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof X)||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?E.empty:new E(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new X(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?E.empty:new E(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new X(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 X(t.from,t.to,E.fromJSON(e,t.slice),!!t.structure)}}X.MAP_BIAS=1;pe.jsonID("replace",X);class se extends pe{constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&($i(e,this.from,this.gapFrom)||$i(e,this.gapTo,this.to)))return Z.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Z.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Z.fromReplace(e,this.from,this.to,r):Z.fail("Content does not fit in gap")}getMap(){return new Me([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 se(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),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new se(t.pos,r.pos,s,i,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 se(t.from,t.to,t.gapFrom,t.gapTo,E.fromJSON(e,t.slice),t.insert,!!t.structure)}}pe.jsonID("replaceAround",se);function $i(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Yh(n,e,t,r){let s=[],i=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=h:s.push(o=new Ie(f,h,d[g])));l&&l.to==f?l.to=h:i.push(l=new mt(f,h,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function Xh(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof Fs){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let p=s[h];p.step==i-1&&d.eq(s[h].style)&&(f=p)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>n.step(new Ie(o.from,o.to,o.style)))}function Eo(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new X(l,u,E.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Ie(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new E(S.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new X(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(S.empty,!0);n.replace(l,l,new E(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function Qh(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function En(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(l,a,t))return r;if(r==0||o.type.spec.isolating||!Qh(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function Zh(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=S.empty,d=0;for(let p=i,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,u=S.from(r.node(p).copy(u)),d++):a--;let f=S.empty,h=0;for(let p=i,g=!1;p>t;p--)g||s.after(p+1)<s.end(p)?(g=!0,f=S.from(s.node(p).copy(f)),h++):c++;n.step(new se(a,c,o,l,new E(u.append(f),d,h),u.size-d,!0))}function wo(n,e,t=null,r=n){let s=ep(n,e),i=s&&tp(r,e);return i?s.map(zl).concat({type:e,attrs:t}).concat(i.map(zl)):null}function zl(n){return{type:n,attrs:null}}function ep(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function tp(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function np(n,e,t){let r=S.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=S.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new se(s,i,s,i,new E(r,0,0),t.length,!0))}function rp(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&sp(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Jc(n,o,l,i),Eo(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new se(d,f,d+1,f-1,new E(S.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&qc(n,o,l,i),!1}})}function qc(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Jc(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
@@ -7,9 +7,9 @@ import{r as V,eE as Sc,eA as Yf,j as k,b3 as Xf,e1 as _t,eF as Qf,c as Yt,b as S
7
7
  `),d&&p==h.nodeValue.length)for(let g=h,m;g;g=g.parentNode){if(m=g.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:ce(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(Oe&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(s=!0)}if(!(s||d&&he)&&Jt(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Jt(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!(d&&Oe)){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>t){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let l=r+i.border,a=o-i.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?It:Xl,e==l&&t==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Pe:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?It:Pe}r=o}this.dirty=It}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?It:Xl;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Eu extends kr{constructor(e,t,r,s){let i,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.hasAttribute("contenteditable")||(o.contentEditable="false"),o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==De&&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 cm extends kr{constructor(e,t,r,s){super(e,[],t,null),this.textDOM=r,this.text=s}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 kt extends kr{constructor(e,t,r,s,i){super(e,[],r,s),this.mark=t,this.spec=i}static create(e,t,r,s){let i=s.nodeViews[t.type.name],o=i&&i(t,s,r);return(!o||!o.dom)&&(o=rt.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new kt(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Pe||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Pe&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=De){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=De}}slice(e,t,r){let s=kt.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;t<o&&(i=Wi(i,t,o,r)),e>0&&(i=Wi(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class xt extends kr{constructor(e,t,r,s,i,o,l){super(e,[],i,o),this.node=t,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=l}static create(e,t,r,s,i,o){let l=i.nodeViews[t.type.name],a,c=l&&l(t,i,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,s),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}=rt.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=Au(u,r,t),c?a=new um(e,t,r,s,u,d||null,f,c):t.isText?new Ks(e,t,r,s,u,f):new xt(e,t,r,s,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let s=this.children[r];if(this.dom.contains(s.dom.parentNode)){t.contentElement=s.dom.parentNode;break}}if(!t.contentElement){let r=e&&e.find(s=>s.nodeType==1&&e.indexOf(s.parentNode)<0&&this.dom.contains(s));r?t.contentElement=r:t.getContent=()=>S.empty}}return t}matchesNode(e,t,r){return this.dirty==De&&e.eq(this.node)&&Yr(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,s=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new fm(this,o&&o.node,e);mm(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?F.none:this.node.child(u).marks,r,e,u),a.placeWidget(c,e,s)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e,f);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,s)||a.addNode(c,u,d,e,s),s+=c.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==It)&&(o&&this.protectLocalComposition(e,o),vu(this.contentDOM,this.children,e),xn&&gm(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof N)||r<t||s>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,l=ym(this.node.content,o,r-t,s-t);return l<0?null:{node:i,pos:l,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:s}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new cm(this,i,t,s);e.input.compositionNodes.push(o),this.children=Wi(this.children,r,r+s.length,e,o)}update(e,t,r,s){return this.dirty==Pe||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,s),!0)}updateInner(e,t,r,s){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=De}updateOuterDeco(e){if(Yr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Nu(this.dom,this.nodeDOM,Vi(this.outerDeco,this.node,t),Vi(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 Ql(n,e,t,r,s){Au(r,e,n);let i=new xt(void 0,n,e,t,r,r,r);return i.contentDOM&&i.updateChildren(s,0),i}class Ks extends xt{constructor(e,t,r,s,i,o){super(e,t,r,s,i,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,s){return this.dirty==Pe||this.dirty!=De&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=De||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=De,!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 s=this.node.cut(e,t),i=document.createTextNode(s.text);return new Ks(this.parent,s,this.outerDeco,this.innerDeco,i,i)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Pe)}get domAtom(){return!1}isText(e){return this.node.text==e}}class wu extends kr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==De&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class um extends xt{constructor(e,t,r,s,i,o,l,a){super(e,t,r,s,i,o,l),this.spec=a}update(e,t,r,s){if(this.dirty==Pe)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,s){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,s)}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 vu(n,e,t){let r=n.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],l=o.dom;if(l.parentNode==n){for(;l!=r;)r=Zl(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(l,r);if(o instanceof kt){let a=r?r.previousSibling:n.lastChild;vu(o.contentDOM,o.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=Zl(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const Hn=function(n){n&&(this.nodeName=n)};Hn.prototype=Object.create(null);const Pt=[new Hn];function Vi(n,e,t){if(n.length==0)return Pt;let r=t?Pt[0]:new Hn,s=[r];for(let i=0;i<n.length;i++){let o=n[i].type.attrs;if(o){o.nodeName&&s.push(r=new Hn(o.nodeName));for(let l in o){let a=o[l];a!=null&&(t&&s.length==1&&s.push(r=new Hn(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return s}function Nu(n,e,t,r){if(t==Pt&&r==Pt)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],l=t[i];if(i){let a;l&&l.nodeName==o.nodeName&&s!=n&&(a=s.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(s),l=Pt[0]),s=a}dm(s,l||Pt[0],o)}return s}function dm(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):[],s=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&n.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&n.classList.add(s[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)n.style.removeProperty(s[1])}t.style&&(n.style.cssText+=t.style)}}function Au(n,e,t){return Nu(n,n,Pt,Vi(e,t,n.nodeType!=1))}function Yr(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 Zl(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class fm{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=hm(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,s){let i=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;i<l&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=De,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;s<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){a=u;break}}if(a<0&&this.index<this.top.children.length){let u=this.top.children[this.index];u instanceof kt&&u.dirty!=Pe&&u.mark.type==e[o].type&&u.spec.update&&!this.isLocked(u.dom)&&u.spec.update(e[o])&&(u.mark=e[o],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=kt.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))i=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,s,i){let o=this.top.children[s];return o.dirty==Pe&&o.dom==o.contentDOM&&(o.dirty=It),o.update(e,t,r,i)?(this.destroyBetween(this.index,s),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 s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=t}}updateNextNode(e,t,r,s,i,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof xt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Pe&&Yr(t,a.outerDeco));if(!f&&a.update(e,t,r,s))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,t,r,s,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=It,d.updateChildren(s,o+1),d.dirty=De),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,s,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Yr(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let l=xt.create(this.top,t,r,s,i,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,s,i){let o=xt.create(this.top,e,t,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new Eu(this.top,e,t,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof kt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ks)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((he||de)&&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 s=new wu(this.top,[],r,null);t!=this.top?t.children.push(s):t.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function hm(n,e){let t=e,r=t.children.length,s=n.childCount,i=new Map,o=[];e:for(;s>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof kt)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(s-1))break;--s,i.set(l,s),o.push(l)}}return{index:s,matched:i,matches:o.reverse()}}function pm(n,e){return n.type.side-e.type.side}function mm(n,e,t,r){let s=e.locals(n),i=0;if(s.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,s,e.forChild(i,u),c),i+=u.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let u,d;for(;o<s.length&&s[o].to==i;){let m=s[o++];m.widget&&(u?(d||(d=[u])).push(m):u=m)}if(u)if(d){d.sort(pm);for(let m=0;m<d.length;m++)t(d[m],c,!!a)}else t(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<n.childCount)h=c,f=n.child(c++);else break;for(let m=0;m<l.length;m++)l[m].to<=i&&l.splice(m--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)l.push(s[o++]);let p=i+f.nodeSize;if(f.isText){let m=p;o<s.length&&s[o].from<m&&(m=s[o].from);for(let y=0;y<l.length;y++)l[y].to<m&&(m=l[y].to);m<p&&(a=f.cut(m-i),f=f.cut(0,m-i),p=m,h=-1)}else for(;o<s.length&&s[o].to<p;)o++;let g=f.isInline&&!f.isLeaf?l.filter(m=>!m.inline):l.slice();r(f,g,e.forChild(i,f),h),i=p}}function gm(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 ym(n,e,t,r){for(let s=0,i=0;s<n.childCount&&i<=r;){let o=n.child(s++),l=i;if(i+=o.nodeSize,!o.isText)continue;let a=o.text;for(;s<n.childCount;){let c=n.child(s++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=t){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Wi(n,e,t,r,s){let i=[];for(let o=0,l=0;o<n.length;o++){let a=n[o],c=l,u=l+=a.size;c>=t||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),s&&(i.push(s),s=void 0),u>t&&i.push(a.slice(t-c,a.size,r)))}return i}function Po(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),i=s&&s.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Ws(t)){for(a=o;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&w.isSelectable(d)&&s.parent&&!(d.isInline&&Kp(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;c=new w(o==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,f=o;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;[a,o]=f==n.state.selection.anchor?[f,d]:[d,f],l=r.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;c=Lo(n,u,l,d)}return c}function Ou(n){return n.editable?n.hasFocus():Ru(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function tt(n,e=!1){let t=n.state.selection;if(Du(n,t),!Ou(n))return;let r=n.input.mouseDown;if(!e&&de&&r){let s=n.domSelectionRange(),i=n.domObserver.currentSelection;if(s.anchorNode&&i.anchorNode&&Jt(s.anchorNode,s.anchorOffset,i.anchorNode,i.anchorOffset)&&r.delaySelUpdate()){n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)km(n);else{let{anchor:s,head:i}=t,o,l;ea&&!(t instanceof N)&&(t.$from.parent.inlineContent||(o=ta(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(l=ta(n,t.to))),n.docView.setSelection(s,i,n,e),ea&&(o&&na(o),l&&na(l)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&bm(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}const ea=he||de&&yu<63;function ta(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(he&&s&&s.contentEditable=="false")return ci(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return ci(s);if(i)return ci(i)}}function ci(n){return n.contentEditable="true",he&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function na(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function bm(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Ou(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function km(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,ce(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Se&&bt<=11&&(t.disabled=!0,t.disabled=!1)}function Du(n,e){if(e instanceof w){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(ra(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else ra(n)}function ra(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Lo(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||N.between(e,t,r)}function sa(n){return n.editable&&!n.hasFocus()?!1:Ru(n)}function Ru(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 xm(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Jt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Ki(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),i=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return i&&I.findFrom(i,e)}function dt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function ia(n,e,t){let r=n.state.selection;if(r instanceof N)if(t.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=n.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return dt(n,new N(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=Ki(n.state,e);return s&&s instanceof w?dt(n,s):!1}else if(!(ve&&t.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?w.isSelectable(i)?dt(n,new w(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):br?dt(n,new N(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof w&&r.node.isInline)return dt(n,new N(e>0?r.$to:r.$from));{let s=Ki(n.state,e);return s?dt(n,s):!1}}}function Xr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Vn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function rn(n,e){return e<0?Sm(n):Cm(n)}function Sm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(Oe&&t.nodeType==1&&r<Xr(t)&&Vn(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Vn(l,-1))s=t,i=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Iu(t))break;{let l=t.previousSibling;for(;l&&Vn(l,-1);)s=t.parentNode,i=ce(l),l=l.previousSibling;if(l)t=l,r=Xr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?_i(n,t,r):s&&_i(n,s,i)}function Cm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=Xr(t),i,o;for(;;)if(r<s){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Vn(l,1))i=t,o=++r;else break}else{if(Iu(t))break;{let l=t.nextSibling;for(;l&&Vn(l,1);)i=l.parentNode,o=ce(l)+1,l=l.nextSibling;if(l)t=l,r=0,s=Xr(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&_i(n,i,o)}function Iu(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Mm(n,e){for(;n&&e==n.childNodes.length&&!yr(n);)e=ce(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 Tm(n,e){for(;n&&!e&&!yr(n);)e=ce(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 _i(n,e,t){if(e.nodeType!=3){let i,o;(o=Mm(e,t))?(e=o,t=0):(i=Tm(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Ws(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&tt(n)},50)}function oa(n,e){let t=n.state.doc.resolve(e);if(!(de||bu)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function la(n,e,t){let r=n.state.selection;if(r instanceof N&&!r.empty||t.indexOf("s")>-1||ve&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Ki(n.state,e);if(o&&o instanceof w)return dt(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof xe?I.near(o,e):I.findFrom(o,e);return l?dt(n,l):!1}return!1}function aa(n,e){if(!(n.state.selection instanceof N))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let o=n.state.tr;return e<0?o.delete(t.pos-i.nodeSize,t.pos):o.delete(t.pos,t.pos+i.nodeSize),n.dispatch(o),!0}return!1}function ca(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Em(n){if(!he||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;ca(n,r,"true"),setTimeout(()=>ca(n,r,"false"),20)}return!1}function wm(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function vm(n,e){let t=e.keyCode,r=wm(e);if(t==8||ve&&t==72&&r=="c")return aa(n,-1)||rn(n,-1);if(t==46&&!e.shiftKey||ve&&t==68&&r=="c")return aa(n,1)||rn(n,1);if(t==13||t==27)return!0;if(t==37||ve&&t==66&&r=="c"){let s=t==37?oa(n,n.state.selection.from)=="ltr"?-1:1:-1;return ia(n,s,r)||rn(n,s)}else if(t==39||ve&&t==70&&r=="c"){let s=t==39?oa(n,n.state.selection.from)=="ltr"?1:-1:1;return ia(n,s,r)||rn(n,s)}else{if(t==38||ve&&t==80&&r=="c")return la(n,-1,r)||rn(n,-1);if(t==40||ve&&t==78&&r=="c")return Em(n)||la(n,1,r)||rn(n,1);if(r==(ve?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function $o(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=n.someProp("clipboardSerializer")||rt.fromSchema(n.state.schema),l=Fu(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Bu[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
8
8
 
9
9
  `);return{dom:a,text:f,slice:e}}function Pu(n,e,t,r,s){let i=s.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(r||i||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,i||r,n)}),i)return l=new E(S.from(n.state.schema.text(e.replace(/\r\n?/g,`
10
- `))),0,0),n.someProp("transformPasted",f=>{l=f(l,n,!0)}),l;let d=n.someProp("clipboardTextParser",f=>f(e,s,r,n));if(d)l=d;else{let f=s.marks(),{schema:h}=n.state,p=rt.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=Dm(t),br&&Rm(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||He.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Nm.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Im(ua(l,+u[1],+u[2]),u[4]);else if(l=E.maxOpen(Am(l.content,s),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=ua(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n,a)}),l}const Nm=/^(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 Am(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),i,o=[];if(n.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&i.length&&$u(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=zu(o[o.length-1],i.length));let u=Lu(l,a);o.push(u),s=s.matchType(u.type),i=a}}),o)return S.from(o)}return n}function Lu(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,S.from(n));return n}function $u(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=$u(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(S.from(Lu(t,n,s+1))))}}function zu(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,zu(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(S.empty,!0);return n.copy(t.append(r))}function Ui(n,e,t,r,s,i){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(i=0),s<r-1&&(l=Ui(l,e,t,r,s+1,i)),s>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(S.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function ua(n,e,t){return e<n.openStart&&(n=new E(Ui(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new E(Ui(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Bu={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function Fu(){return document.implementation.createHTMLDocument("title")}let Nn=null;function Om(n){let e=window.trustedTypes;if(!e)return n;if(!Nn){if(Nn=e.defaultPolicy)try{return Nn.createHTML(n)}catch{}Nn=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return Nn.createHTML(n)}function Dm(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Fu(),r=t.body,s=/<([a-z][^>\s]+)/i.exec(n),i;if((i=s&&Bu[s[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=Om(n),i)for(let o=0;o<i.length;o++)r=r.querySelector(i[o])||r;for(let o=0;o<t.styleSheets.length;o++){let l=t.styleSheets[o];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let u=r.querySelectorAll(c.selectorText);for(let d=0;d<u.length;d++)u[d].style.cssText+=c.style.cssText}}}return r}function Rm(n){let e=n.querySelectorAll(de?"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 Im(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:s,openStart:i,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;try{a.checkAttrs(r[l+1])}catch{break}s=S.from(a.create(r[l+1],s)),i++,o++}return new E(s,i,o)}const ge={},ye={},Pm={touchstart:!0,touchmove:!0};class Lm{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 $m(n){for(let e in ge){let t=ge[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Bm(n,r)&&!zo(n,r)&&(n.editable||!(r.type in ye))&&t(n,r)},Pm[e]?{passive:!0}:void 0)}he&&n.dom.addEventListener("input",()=>null),qi(n)}function Qe(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function zm(n){n.input.mouseDown&&n.input.mouseDown.done(),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 qi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>zo(n,r))})}function zo(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Bm(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 Fm(n,e){!zo(n,e)&&ge[e.type]&&(n.editable||!(e.type in ye))&&ge[e.type](n,e)}ye.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Wu(n)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Xe&&de&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),xn&&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",s=>s(n,Ot(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||vm(n,t)?t.preventDefault():Qe(n,"key")};ye.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};ye.keypress=(n,e)=>{let t=e;if(Wu(n)||!t.charCode||t.ctrlKey&&!t.altKey||ve&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof N)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function xr(n){return{left:n.clientX,top:n.clientY}}function jm(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Bo(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(n.someProp(e,l=>o>i.depth?l(n,t,i.nodeAfter,i.before(o),s,!0):l(n,t,i.node(o),i.before(o),s,!1)))return!0;return!1}function Sr(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 Hm(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&w.isSelectable(r)?(Sr(n,new w(t)),!0):!1}function Vm(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof w&&(r=t.node);let i=n.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(w.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(o);break}}return s!=null?(Sr(n,w.create(n.state.doc,s)),!0):!1}function Wm(n,e,t,r,s){return Bo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?Vm(n,t):Hm(n,t))}function Km(n,e,t,r){return Bo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function _m(n,e,t,r){return Bo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||Um(n,t,r)}function Um(n,e,t){if(t.button!=0)return!1;let r=ju(n,e,!0),s=n.state.doc;return r?(Sr(n,r),r instanceof N&&s.eq(n.state.doc)&&(n.input.mouseDown=new Jm(n,r)),!0):!1}function ju(n,e,t){let r=n.state.doc;if(e==-1)return r.inlineContent?N.create(r,0,r.content.size):null;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)return N.create(r,l+1,l+1+o.content.size);if(t&&w.isSelectable(o))return w.create(r,l)}return null}function Fo(n){return Qr(n)}const Hu=ve?"metaKey":"ctrlKey";ge.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Fo(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&jm(t,n.input.lastClick)&&!t[Hu]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button},n.input.mouseDown&&n.input.mouseDown.done();let o=n.posAtCoords(xr(t));o&&(i=="singleClick"?n.input.mouseDown=new qm(n,o,t,!!r):(i=="doubleClick"?Km:_m)(n,o.pos,o.inside,t)?t.preventDefault():Qe(n,"pointer"))};let Vu=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}};class qm extends Vu{constructor(e,t,r,s){super(e),this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[Hu],this.allowDefault=r.shiftKey;let i,o;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,o=u.depth?u.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof w&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Oe&&!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()),Qe(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||tt(this.view)})}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(xr(e))),this.updateAllowDefault(e),this.allowDefault||!t?Qe(this.view,"pointer"):Wm(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||he&&this.mightDrag&&!this.mightDrag.node.isAtom||de&&!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)?(Sr(this.view,I.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Qe(this.view,"pointer")}move(e){this.updateAllowDefault(e),Qe(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class Jm extends Vu{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),Qe(this.view,"pointer");let t=this.view.posAtCoords(xr(e)),r=t&&ju(this.view,t.inside,!1);if(!r)return;let{doc:s}=this.view.state,i=this.startSelection,[o,l]=r.from<i.from?[i.to,r.from]:[i.from,r.to];Sr(this.view,N.create(s,o,l))}}ge.touchstart=n=>{n.input.lastTouch=Date.now(),Fo(n),Qe(n,"pointer")};ge.touchmove=n=>{n.input.lastTouch=Date.now(),Qe(n,"pointer")};ge.contextmenu=n=>Fo(n);function Wu(n,e){return n.composing?!0:he&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Gm=Xe?5e3:-1;ye.compositionstart=ye.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof N&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||de&&bu&&Ym(n)))n.markCursor=n.state.storedMarks||t.marks(),Qr(n,!0),n.markCursor=null;else if(Qr(n,!e.selection.empty),Oe&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}Ku(n,Gm)};function Ym(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"}ye.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now(),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++,Ku(n,20))};function Ku(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Qr(n),e))}function _u(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Xm(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Vp(e.focusNode,e.focusOffset),r=Wp(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let s=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function Qr(n,e=!1){if(!(Xe&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),_u(n),e||n.docView&&n.docView.dirty){let t=Po(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 Qm(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(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const cr=Se&&bt<15||xn&&qp<604;ge.copy=ye.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=cr?null:t.clipboardData,o=r.content(),{dom:l,text:a}=$o(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):Qm(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Zm(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function eg(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 s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?ur(n,r.value,null,s,e):ur(n,r.textContent,r.innerHTML,s,e)},50)}function ur(n,e,t,r,s){let i=Pu(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,s,i||E.empty)))return!0;if(!i)return!1;let o=Zm(i),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Uu(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," "):""}ye.paste=(n,e)=>{let t=e;if(n.composing&&!Xe)return;let r=cr?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ur(n,Uu(r),r.getData("text/html"),s,t)?t.preventDefault():eg(n,t)};let qu=class{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}};const tg=ve?"altKey":"ctrlKey";function Ju(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[tg]}ge.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(xr(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof w?s.to-1:s.to))){if(r&&r.mightDrag)o=w.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&&(o=w.create(n.state.doc,d.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=$o(n,l);(!t.dataTransfer.files.length||!de||yu>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(cr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",cr||t.dataTransfer.setData("text/plain",c),n.dragging=new qu(u,Ju(n,t),o)};ge.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};ye.dragover=ye.dragenter=(n,e)=>e.preventDefault();ye.drop=(n,e)=>{try{ng(n,e,n.dragging)}finally{n.dragging=null}};function ng(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(xr(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=Pu(n,Uu(e.dataTransfer),cr?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&Ju(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||E.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?vo(n.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=n.state.tr;if(o){let{node:h}=t;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&w.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new w(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),a.setSelection(Lo(n,f,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}ge.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())&&tt(n)},20))};ge.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)};ge.beforeinput=(n,e)=>{if(Xe&&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",i=>i(n,Ot(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in ye)ge[n]=ye[n];function dr(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}let da=class Gu{constructor(e,t){this.toDOM=e,this.spec=t||jt,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new st(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Gu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&dr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Wn=class Ji{constructor(e,t){this.attrs=e,this.spec=t||jt}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new st(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Ji&&dr(this.attrs,e.attrs)&&dr(this.spec,e.spec)}static is(e){return e.type instanceof Ji}destroy(){}},rg=class Yu{constructor(e,t){this.attrs=e,this.spec=t||jt}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=i.pos?null:new st(i.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof Yu&&dr(this.attrs,e.attrs)&&dr(this.spec,e.spec)}destroy(){}},st=class Ln{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Ln(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 Ln(e,e,new da(t,r))}static inline(e,t,r,s){return new Ln(e,t,new Wn(r,s))}static node(e,t,r,s){return new Ln(e,t,new rg(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Wn}get widget(){return this.type instanceof da}};const an=[],jt={};let G=class ut{constructor(e,t){this.local=e.length?e:an,this.children=t.length?t:an}static create(e,t){return t.length?Zr(t,e,0,jt):fe}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,s+l,i)}}map(e,t,r){return this==fe||e.maps.length==0?this:this.mapInner(e,t,0,0,r||jt)}mapInner(e,t,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?sg(this.children,o||[],e,t,r,s,i):o?new ut(o.sort(Ht),an):fe}add(e,t){return t.length?this==fe?ut.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Zu(t,l,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,u,c+1):s.splice(i,0,a,a+l.nodeSize,Zr(u,l,c+1,jt)),i+=3}});let o=Qu(i?ed(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new ut(o.length?this.local.concat(o).sort(Ht):this.local,s||this.children)}remove(e){return e.length==0||this==fe?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+t,a=r[i+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,l+1);c!=fe?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,t)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new ut(s,r):fe}forChild(e,t){if(this==fe)return this;if(t.isLeaf)return ut.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof Wn){let c=Math.max(i,a.from)-i,u=Math.min(o,a.to)-i;c<u&&(s||(s=[])).push(a.copy(c,u))}}if(s){let l=new ut(s.sort(Ht),an);return r?new Xu([l,r]):l}return r||fe}eq(e){if(this==e)return!0;if(!(e instanceof ut)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let 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 jo(this.localsInner(e))}localsInner(e){if(this==fe)return an;if(e.inlineContent||!this.local.some(Wn.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Wn||t.push(this.local[r]);return t}forEachSet(e){e(this)}};G.empty=new G([],[]);G.removeOverlap=jo;const fe=G.empty;let Xu=class cn{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,jt));return cn.from(r)}forChild(e,t){if(t.isLeaf)return G.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=fe&&(i instanceof cn?r=r.concat(i.members):r.push(i))}return cn.from(r)}eq(e){if(!(e instanceof cn)||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 s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let o=0;o<i.length;o++)t.push(i[o])}}return t?jo(r?t:t.sort(Ht)):an}static from(e){switch(e.length){case 0:return fe;case 1:return e[0];default:return new cn(e.every(t=>t instanceof G)?e:e.reduce((t,r)=>t.concat(r instanceof G?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function sg(n,e,t,r,s,i,o){let l=n.slice();for(let c=0,u=i;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<l.length;y+=3){let b=l[y+1];if(b<0||f>b+u-d)continue;let x=l[y]+u-d;h>=x?l[y+1]=f<=x?-2:-1:f>=u&&m&&(l[y]+=m,l[y+1]+=m)}d+=m}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+i),d=u-s;if(d<0||d>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+i,-1),h=f-s,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=l[c+2].mapInner(t,m,u+1,n[c]+i+1,o);y!=fe?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=ig(l,n,e,t,s,i,o),u=Zr(c,r,0,o);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new G(e.sort(Ht),l)}function Qu(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new st(s.from+e,s.to+e,s.type))}return t}function ig(n,e,t,r,s,i,o){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,s,c);d?t.push(d):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function Zu(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,o;i<n.length;i++)(o=n[i])&&o.from>t&&o.to<r&&((s||(s=[])).push(o),n[i]=null);return s}function ed(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Zr(n,e,t,r){let s=[],i=!1;e.forEach((l,a)=>{let c=Zu(n,l,a+t);if(c){i=!0;let u=Zr(c,l,t+a+1,r);u!=fe&&s.push(a,a+l.nodeSize,u)}});let o=Qu(i?ed(n):n,-t).sort(Ht);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new G(o,s):fe}function Ht(n,e){return n.from-e.from||n.to-e.to}function jo(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),fa(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),fa(e,s,r.copy(i.from,r.to)));break}}}return e}function fa(n,e,t){for(;e<n.length&&Ht(t,n[e])>0;)e++;n.splice(e,0,t)}function ui(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=fe&&e.push(r)}),n.cursorWrapper&&e.push(G.create(n.state.doc,[n.cursorWrapper.deco])),Xu.from(e)}const og={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lg=Se&&bt<=11;class ag{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 cg{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ag,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);Se&&bt<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():he&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),lg&&(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,og)),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(sa(this.view)){if(this.suppressingSelectionUpdates)return tt(this.view);if(Se&&bt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Jt(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 i=e.focusNode;i;i=kn(i))t.add(i);for(let i=e.anchorNode;i;i=kn(i))if(t.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.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(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&sa(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u<t.length;u++){let d=this.registerMutation(t[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||de&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Oe&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||fg(e,d)!=h)&&f.remove()}}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ws(r)&&(c=Po(e))&&c.eq(I.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,tt(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),ug(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,hg(e,a)),this.handleDOMChange(i,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||tt(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 s=e.previousSibling,i=e.nextSibling;if(Se&&bt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let o=s&&s.parentNode==e.target?ce(s)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?ce(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ha=new WeakMap,pa=!1;function ug(n){if(!ha.has(n)&&(ha.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Oe,pa)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."),pa=!0}}function ma(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return Jt(o.node,o.offset,s,i)&&([t,r,s,i]=[s,i,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:i}}function dg(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return ma(n,s)}let t;function r(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?ma(n,t):null}function fg(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 hg(n,e){var t;let{focusNode:r,focusOffset:s}=n.domSelectionRange();for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&n.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function pg(n,e,t,r){let{node:s,fromOffset:i,toOffset:o,from:l,to:a}=n.docView.parseRange(e,t),c=n.domSelectionRange(),u,d=c.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],Ws(c)||u.push({node:c.focusNode,offset:c.focusOffset})),de&&n.input.lastKeyCode===8)for(let y=o;y>i;y--){let b=s.childNodes[y-1],x=b.pmViewDesc;if(b.nodeName=="BR"&&!x){o=y;break}if(!x||x.size)break}let f=n.state.doc,h=n.someProp("domParser")||He.fromSchema(n.state.schema),p=f.resolve(l),g=null,m=h.parse(s,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:mg(r),context:p});if(u&&u[0].pos!=null){let y=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=y),g={anchor:y+l,head:b+l}}return{doc:m,sel:g,from:l,to:a}}const mg=n=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(n);if(e.nodeName=="BR"&&e.parentNode){if(he&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||he&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},gg=/^(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 yg(n,e,t,r,s){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let v=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,D=Po(n,v);if(D&&!n.state.selection.eq(D)){if(de&&Xe&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",j=>j(n,Ot(13,"Enter"))))return;let R=n.state.tr.setSelection(D);v=="pointer"?R.setMeta("pointer",!0):v=="key"&&R.scrollIntoView(),i&&R.setMeta("composition",i),n.dispatch(R)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=pg(n,e,t,s),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=xg(d.content,c.doc.content,c.from,f,h);if(p&&n.input.domChangeCount++,(xn&&n.input.lastIOSEnter>Date.now()-225||Xe)&&s.some(v=>v.nodeType==1&&!gg.test(v.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",v=>v(n,Ot(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof N&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let v=ga(n,n.state.doc,c.sel);if(v&&!v.eq(n.state.selection)){let D=n.state.tr.setSelection(v);i&&D.setMeta("composition",i),n.dispatch(D)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof N&&(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)),Se&&bt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let g=c.doc.resolveNoCache(p.start-c.from),m=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),b=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=p.endA;if((xn&&n.input.lastIOSEnter>Date.now()-225&&(!b||s.some(v=>v.nodeName=="DIV"||v.nodeName=="P"))||!b&&g.pos<c.doc.content.size&&(!g.sameParent(m)||!g.parent.inlineContent)&&g.pos<m.pos&&!/\S/.test(c.doc.textBetween(g.pos,m.pos,"","")))&&n.someProp("handleKeyDown",v=>v(n,Ot(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&kg(u,p.start,p.endA,g,m)&&n.someProp("handleKeyDown",v=>v(n,Ot(8,"Backspace")))){Xe&&de&&n.domObserver.suppressSelectionUpdates();return}de&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Xe&&!b&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,m=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(v){return v(n,Ot(13,"Enter"))})},20));let x=p.start,C=p.endA,T=v=>{let D=v||n.state.tr.replace(x,C,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let R=ga(n,D.doc,c.sel);R&&!(de&&n.composing&&R.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(R.head==x||R.head==D.mapping.map(C)-1)||Se&&R.empty&&R.head==x)&&D.setSelection(R)}return i&&D.setMeta("composition",i),D.scrollIntoView()},A;if(b)if(g.pos==m.pos){Se&&bt<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>tt(n),20));let v=T(n.state.tr.delete(x,C)),D=u.resolve(p.start).marksAcross(u.resolve(p.endA));D&&v.ensureMarks(D),n.dispatch(v)}else if(p.endA==p.endB&&(A=bg(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let v=T(n.state.tr);A.type=="add"?v.addMark(x,C,A.mark):v.removeMark(x,C,A.mark),n.dispatch(v)}else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let v=g.parent.textBetween(g.parentOffset,m.parentOffset),D=()=>T(n.state.tr.insertText(v,x,C));n.someProp("handleTextInput",R=>R(n,x,C,v,D))||n.dispatch(D())}else n.dispatch(T());else n.dispatch(T())}function ga(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Lo(n,e.resolve(t.anchor),e.resolve(t.head))}function bg(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,s=t,i=r,o,l,a;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<t.length;u++)i=t[u].removeFromSet(i);if(s.length==1&&i.length==0)l=s[0],o="add",a=u=>u.mark(l.addToSet(u.marks));else if(s.length==0&&i.length==1)l=i[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(S.from(c).eq(n))return{mark:l,type:o}}function kg(n,e,t,r,s){if(t-e<=s.pos-r.pos||di(r,!0,!1)<s.pos)return!1;let i=n.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=n.resolve(di(i,!0,!0));return!o.parent.isTextblock||o.pos>t||di(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function di(n,e,t){let r=n.depth,s=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,s++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function xg(n,e,t,r,s){let i=n.findDiffStart(e,t),o=t+n.size,l=t+e.size;if(i==null)return null;let{a,b:c}=n.findDiffEnd(e,o,l);if(s=="end"){let u=Math.max(0,i-Math.min(a,c));r-=a+u-i}if(a<i&&o<l){let u=r<=i&&r>=a?i-r:0;i-=u,c=i+(c-a),a=i}else if(c<i){let u=r<=i&&r>=c?i-r:0;i-=u,a=i+(a-c),c=i}return{start:i,endA:a,endB:c}}class td{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 Lm,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Sa),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=ka(this),ba(this),this.nodeViews=xa(this),this.docView=Ql(this.state.doc,ya(this),ui(this),this.dom,this),this.domObserver=new cg(this,(r,s,i,o)=>yg(this,r,s,i,o)),this.domObserver.start(),$m(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&&qi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Sa),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 s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(_u(this),o=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=xa(this);Cg(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&qi(this),this.editable=ka(this),ba(this);let a=ui(this),c=ya(this),u=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(s.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Yp(this);if(o){this.domObserver.stop();let h=d&&(Se||de)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&Sg(s.selection,e.selection);if(d){let g=de?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Xm(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Ql(e.doc,c,a,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let p=this.input.mouseDown;h||!(p&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&xm(this)&&p.delaySelUpdate())?tt(this,h):(Du(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Xp(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 w){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&ql(this,t.getBoundingClientRect(),e)}else ql(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,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new qu(e.slice,e.move,s<0?void 0:w.create(this.state.doc,s))}someProp(e,t){let r=this._props&&this._props[e],s;if(r!=null&&(s=t?t(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(s=t?t(l):l))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let l=i[o].props[e];if(l!=null&&(s=t?t(l):l))return s}}hasFocus(){if(Se){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Qp(this.dom),tt(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 rm(this,e)}coordsAtPos(e,t=1){return Mu(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 s=this.docView.posFromDOM(e,t,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,t){return am(this,t||this.state,e)}pasteHTML(e,t){return ur(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ur(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return $o(this,e)}destroy(){this.docView&&(zm(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ui(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,jp())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Fm(this,e)}domSelectionRange(){let e=this.domSelection();return e?he&&this.root.nodeType===11&&_p(this.dom.ownerDocument)==this.dom&&dg(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}td.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function ya(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"),[st.node(0,n.state.doc.content.size,e)]}function ba(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:st.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ka(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Sg(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 xa(n){let e=Object.create(null);function t(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Cg(n,e){let t=0,r=0;for(let s in n){if(n[s]!=e[s])return!0;t++}for(let s in e)r++;return t!=r}function Sa(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 Ct={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},es={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Mg=typeof navigator<"u"&&/Mac/.test(navigator.platform),Tg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ue=0;ue<10;ue++)Ct[48+ue]=Ct[96+ue]=String(ue);for(var ue=1;ue<=24;ue++)Ct[ue+111]="F"+ue;for(var ue=65;ue<=90;ue++)Ct[ue]=String.fromCharCode(ue+32),es[ue]=String.fromCharCode(ue);for(var fi in Ct)es.hasOwnProperty(fi)||(es[fi]=Ct[fi]);function Eg(n){var e=Mg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Tg&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?es:Ct)[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 wg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),vg=typeof navigator<"u"&&/Win/.test(navigator.platform);function Ng(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))wg?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),o&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Ag(n){let e=Object.create(null);for(let t in n)e[Ng(t)]=n[t];return e}function hi(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 Og(n){return new W({props:{handleKeyDown:nd(n)}})}function nd(n){let e=Ag(n);return function(t,r){let s=Eg(r),i,o=e[hi(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[hi(s,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(vg&&r.ctrlKey&&r.altKey)&&(i=Ct[r.keyCode])&&i!=s){let l=e[hi(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}function _s(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:s}=t,{storedMarks:i}=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 i},get selection(){return r},get doc(){return s},get tr(){return r=t.selection,s=t.doc,i=t.storedMarks,t}}}var mn=class rd{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:s}=t,{tr:i}=r,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,l=[],a=!!e,c=e||i.tr,u=()=>(!a&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...g)=>{const m=this.buildProps(c,t),y=h(...g)(m);return l.push(y),d}])),run:u};return d}static createFakeChain(){const e=new Proxy({},{get:(t,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){const{rawCommands:t,state:r}=this,s=!1,i=e||r.tr,o=this.buildProps(i,s);return{...Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...c)=>a(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,s)}}static createFallbackCan(){const e=rd.createFakeChain();return new Proxy({chain:()=>e},{get:(t,r)=>{if(r!=="then")return r==="chain"?t.chain:()=>!1}})}buildProps(e,t=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,l={tr:e,editor:s,view:o,state:_s({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}};const Dg=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{if(!n.isDestroyed){var t;e.dom.blur(),(t=window)===null||t===void 0||(t=t.getSelection())===null||t===void 0||t.removeAllRanges()}}),!0),Rg=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Ig=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:s}=r;return t&&s.forEach(({$from:i,$to:o})=>{n.doc.nodesBetween(i.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=En(h);if(l.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},Pg=n=>e=>n(e),Lg=()=>({state:n,dispatch:e})=>fu(n,e),$g=(n,e)=>({editor:t,tr:r})=>{const{state:s}=t,i=s.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new N(r.doc.resolve(Math.max(o-1,0)))),!0},zg=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const s=n.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const o=s.before(i),l=s.after(i);n.delete(o,l).scrollIntoView()}return!0}return!1};function ne(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}const Bg=n=>({tr:e,state:t,dispatch:r})=>{const s=ne(n,t.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const l=i.before(o),a=i.after(o);e.delete(l,a).scrollIntoView()}return!0}return!1},Fg=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},jg=n=>n.content?/^text(\*|\+)/.test(n.content):!1,Ca=(n,e,t)=>{if(!n.parent.isInline||t==="left"&&n.pos>n.start()||t==="right"&&n.pos<n.end())return n.pos;const r=e.nodes[n.parent.type.name].spec;return jg(r)?t==="left"?n.start()-1:n.end()+1:n.pos},Hg=(n,e,t)=>({from:Ca(n,t,"left"),to:Ca(e,t,"right")}),Vg=()=>({state:n,dispatch:e})=>{if(n.selection.empty)return!1;if(e){const t=n.tr,{ranges:r}=n.selection,s=t.steps.length;r.forEach(i=>{const o=t.mapping.slice(s),l=t.doc.resolve(o.map(i.$from.pos)),a=t.doc.resolve(o.map(i.$to.pos)),{from:c,to:u}=Hg(l,a,n.schema);t.deleteRange(c,u)}),t.selection.empty||t.setSelection(N.near(t.doc.resolve(t.selection.from))),t.scrollIntoView(),e(t)}return!0},Wg=()=>({commands:n})=>n.keyboardShortcut("Enter"),Kg=()=>({state:n,dispatch:e})=>Ep(n,e);function Ho(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function ts(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:Ho(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function sd(n,e,t={}){return n.find(r=>r.type===e&&ts(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function Ma(n,e,t={}){return!!sd(n,e,t)}function Vo(n,e,t){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(a=>a.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(a=>a.type===e))return;if(!t){const a=r.node.marks.find(c=>c.type===e);a&&(t=a.attrs)}if(!sd([...r.node.marks],e,t))return;let s=r.index,i=n.start()+r.offset,o=s+1,l=i+r.node.nodeSize;for(;s>0&&Ma([...n.parent.child(s-1).marks],e,t);)s-=1,i-=n.parent.child(s).nodeSize;for(;o<n.parent.childCount&&Ma([...n.parent.child(o).marks],e,t);)l+=n.parent.child(o).nodeSize,o+=1;return{from:i,to:l}}function it(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}const _g=(n,e)=>({tr:t,state:r,dispatch:s})=>{const i=it(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:c,to:u}=l;if(s){const d=Vo(a,i,e);if(d&&d.from<=c&&d.to>=u){const f=N.create(o,d.from,d.to);t.setSelection(f)}}return!0},Ug=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 Wo(n){return n instanceof N}function Ze(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Gi(n,e=null){if(!e)return null;const t=I.atStart(n),r=I.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,i=r.to;return e==="all"?N.create(n,Ze(0,s,i),Ze(n.content.size,s,i)):N.create(n,Ze(e,s,i),Ze(e,s,i))}function Yi(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function fr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function qg(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const Jg=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(fr()||Yi())&&r.dom.focus(),qg()&&!fr()&&!Yi()&&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(i&&n===null&&!Wo(t.state.selection))return o(),!0;const l=Gi(s.doc,n)||t.state.selection,a=t.state.selection.eq(l);return i&&(a||s.setSelection(l),a&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},Gg=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),Yg=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),id=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&&id(r)}return n};function $n(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 id(t)}function od(n){return typeof n?.nodesBetween=="function"}function Sn(n,e,t){if(od(n))return n;const r=typeof n=="object"&&n!==null;t={slice:!0,parseOptions:{},...t};const s=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return S.fromArray(n.map(o=>e.nodeFromJSON(o)));const i=e.nodeFromJSON(n);return t.errorOnInvalidContent&&i.check(),i}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),Sn("",e,t)}if(s){if(t.errorOnInvalidContent){let o=!1,l="";const a=new Fc({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?He.fromSchema(a).parseSlice($n(n),t.parseOptions):He.fromSchema(a).parse($n(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=He.fromSchema(e);return t.slice?i.parseSlice($n(n),t.parseOptions).content:i.parse($n(n),t.parseOptions)}return Sn("",e,t)}function ld(n){return!("type"in n)}function ad(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof X||s instanceof se))return;const i=n.mapping.maps[r];let o=0;i.forEach((l,a,c,u)=>{o===0&&(o=u)}),n.setSelection(I.near(n.doc.resolve(o),t))}const Xg=(n,e,t)=>({tr:r,dispatch:s,editor:i})=>{if(s){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=m=>{i.emit("contentError",{editor:i,error:m,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Sn(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(m){a(m)}try{var o;l=Sn(e,i.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:i.options.enableContentCheck})}catch(m){return a(m),!1}let{from:u,to:d}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,h=!0;const p=ld(l)?l.content:[l];if(p.forEach(m=>{m.check(),f=f?m.isText&&m.marks.length===0:!1,h=h?m.isBlock:!1}),u===d&&h){const{parent:m}=r.doc.resolve(u);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(u-=1,d+=1)}let g;if(f)Array.isArray(e)?g=e.map(m=>m.text||"").join(""):od(e)?g=p.map(m=>{var y;return(y=m.text)!==null&&y!==void 0?y:""}).join(""):typeof e=="object"&&e&&e.text?g=e.text:g=e,r.insertText(g,u,d);else{g=S.from(p);const m=r.doc.resolve(u),y=m.node(),b=m.parentOffset===0,x=y.isText||y.isTextblock,C=y.content.size>0;b&&x&&C&&h&&(u=Math.max(0,u-1)),r.replaceWith(u,d,p)}t.updateSelection&&ad(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};function cd(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}const Qg=(n={})=>({tr:e,dispatch:t,editor:r})=>{const{pos:s,attrs:i,content:o,updateSelection:l=!0}=n;let a;typeof s=="number"?a=e.doc.resolve(s):s?a=s:a=e.selection.$from;const c=cd(a.parent.contentMatchAt(a.index()));if(!c)return!1;const u=Object.keys(c.spec.attrs||{}),d=i?Object.fromEntries(Object.entries(i).filter(([h])=>u.includes(h))):{};let f;if(o){const h=Sn(o,r.schema);f=c.createAndFill(d,h)}else f=c.createAndFill(d);return f?(t&&(e.insert(a.pos,f),l&&ad(e,e.steps.length-1,-1)),!0):!1},Zg=()=>({state:n,dispatch:e})=>Cp(n,e),ey=()=>({state:n,dispatch:e})=>Mp(n,e),ty=()=>({state:n,dispatch:e})=>iu(n,e),ny=()=>({state:n,dispatch:e})=>cu(n,e),ry=()=>({state:n,dispatch:e,tr:t})=>{try{const r=js(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},sy=()=>({state:n,dispatch:e,tr:t})=>{try{const r=js(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},iy=()=>({state:n,dispatch:e})=>xp(n,e),oy=()=>({state:n,dispatch:e})=>Sp(n,e);function ud(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function ly(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,s,i,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))fr()||ud()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(t=`Alt-${t}`),s&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}const ay=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const i=ly(n).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&s&&r.maybeStep(u)}),!0};function nt(n,e,t={}){const{from:r,to:s,empty:i}=n.selection,o=e?ne(e,n.schema):null,l=[];n.doc.nodesBetween(r,s,(u,d)=>{if(u.isText)return;const f=Math.max(r,d),h=Math.min(s,d+u.nodeSize);l.push({node:u,from:f,to:h})});const a=s-r,c=l.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>ts(u.node.attrs,t,{strict:!1}));return i?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=a}const cy=(n,e={})=>({state:t,dispatch:r})=>nt(t,ne(n,t.schema),e)?Tp(t,r):!1,uy=()=>({state:n,dispatch:e})=>hu(n,e),dy=n=>({state:e,dispatch:t})=>{const r=ne(n,e.schema);return $p(r)(e,t)},fy=()=>({state:n,dispatch:e})=>du(n,e);function Us(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Ta(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,s)=>(t.includes(s)||(r[s]=n[s]),r),{})}const hy=(n,e)=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const l=Us(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(i=ne(n,r.schema)),l==="mark"&&(o=it(n,r.schema));let a=!1;return t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{i&&i===u.type&&(a=!0,s&&t.setNodeMarkup(d,void 0,Ta(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&(a=!0,s&&t.addMark(d,d+u.nodeSize,o.create(Ta(f.attrs,e))))})})}),a},py=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),my=()=>({tr:n,dispatch:e})=>{if(e){const t=new xe(n.doc);n.setSelection(t)}return!0},gy=()=>({state:n,dispatch:e})=>lu(n,e),yy=()=>({state:n,dispatch:e})=>uu(n,e),by=()=>({state:n,dispatch:e})=>Np(n,e),ky=()=>({state:n,dispatch:e})=>Dp(n,e),xy=()=>({state:n,dispatch:e})=>Op(n,e);function Xi(n,e,t={},r={}){return Sn(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const Sy=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const c=Xi(n,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});if(o){const u=ld(c)?c.content:[c];i.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!t)}return!0}return o&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function dd(n,e){const t=it(e,n.schema),{from:r,to:s,empty:i}=n.selection,o=[];i?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,s,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function fd(n,e){const t=new eu(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function Cy(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,i)=>{t(s)&&r.push({node:s,pos:i})}),r}function My(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 qs(n){return e=>My(e.$from,n)}function O(n,e,t){return n.config[e]===void 0&&n.parent?O(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?O(n.parent,e,t):null}):n.config[e]}function Ko(n){return n.map(e=>{const t=O(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Ko(t())]:e}).flat(10)}function _o(n,e){const t=rt.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function hd(n){return typeof n=="function"}function $(n,e=void 0,...t){return hd(n)?e?n.bind(e)(...t):n(...t):n}function Ty(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Cn(n){return{baseExtensions:n.filter(e=>e.type==="extension"),nodeExtensions:n.filter(e=>e.type==="node"),markExtensions:n.filter(e=>e.type==="mark")}}function pd(n){const e=[],{nodeExtensions:t,markExtensions:r}=Cn(n),s=[...t,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=t.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...o,...l];return n.forEach(c=>{const u=O(c,"addGlobalAttributes",{name:c.name,options:c.options,storage:c.storage,extensions:s});u&&u().forEach(d=>{let f;Array.isArray(d.types)?f=d.types:d.types==="*"?f=a:d.types==="nodes"?f=o:d.types==="marks"?f=l:f=[],f.forEach(h=>{Object.entries(d.attributes).forEach(([p,g])=>{e.push({type:h,name:p,attribute:{...i,...g}})})})})}),s.forEach(c=>{const u=O(c,"addAttributes",{name:c.name,options:c.options,storage:c.storage});if(!u)return;const d=u();Object.entries(d).forEach(([f,h])=>{const p={...i,...h};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:c.name,name:f,attribute:p})})}),e}function Ey(n){const e=[];let t="",r=!1,s=!1,i=0;const o=n.length;for(let l=0;l<o;l+=1){const a=n[l];if(a==="'"&&!s){r=!r,t+=a;continue}if(a==='"'&&!r){s=!s,t+=a;continue}if(!r&&!s){if(a==="("){i+=1,t+=a;continue}if(a===")"&&i>0){i-=1,t+=a;continue}if(a===";"&&i===0){e.push(t),t="";continue}}t+=a}return t&&e.push(t),e}function Ea(n){const e=[],t=Ey(n||""),r=t.length;for(let s=0;s<r;s+=1){const i=t[s],o=i.indexOf(":");if(o===-1)continue;const l=i.slice(0,o).trim(),a=i.slice(o+1).trim();l&&a&&e.push([l,a])}return e}function ee(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([s,i])=>{if(s==="__proto__"){Object.defineProperty(r,s,{configurable:!0,enumerable:!0,value:i,writable:!0});return}if(!r[s]){r[s]=i;return}if(s==="class"){const o=i?String(i).split(" "):[],l=r[s]?r[s].split(" "):[],a=o.filter(c=>!l.includes(c));r[s]=[...l,...a].join(" ")}else if(s==="style"){const o=new Map([...Ea(r[s]),...Ea(i)]);r[s]=Array.from(o.entries()).map(([l,a])=>`${l}: ${a}`).join("; ")}else r[s]=i}),r},{})}function Mn(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)=>ee(t,r),{})}function wy(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function wa(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 s=e.reduce((i,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(t):wy(t.getAttribute(o.name));return l==null?i:{...i,[o.name]:l}},{});return{...r,...s}}}}function va(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Ty(t)?!1:t!=null))}function Na(n){var e,t;const r={};return!(!(n==null||(e=n.attribute)===null||e===void 0)&&e.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),(n==null||(t=n.attribute)===null||t===void 0?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function md(n,e){var t;const r=pd(n),{nodeExtensions:s,markExtensions:i}=Cn(n),o=(t=s.find(c=>O(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(s.map(c=>{const u=r.filter(m=>m.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=va({...n.reduce((m,y)=>{const b=O(y,"extendNodeSchema",d);return{...m,...b?b(c):{}}},{}),content:$(O(c,"content",d)),marks:$(O(c,"marks",d)),group:$(O(c,"group",d)),inline:$(O(c,"inline",d)),atom:$(O(c,"atom",d)),selectable:$(O(c,"selectable",d)),draggable:$(O(c,"draggable",d)),code:$(O(c,"code",d)),whitespace:$(O(c,"whitespace",d)),linebreakReplacement:$(O(c,"linebreakReplacement",d)),defining:$(O(c,"defining",d)),isolating:$(O(c,"isolating",d)),attrs:Object.fromEntries(u.map(Na))}),h=$(O(c,"parseHTML",d));h&&(f.parseDOM=h.map(m=>wa(m,u)));const p=O(c,"renderHTML",d);p&&(f.toDOM=m=>p({node:m,HTMLAttributes:Mn(m,u)}));const g=O(c,"renderText",d);return g&&(f.toText=g),[c.name,f]})),a=Object.fromEntries(i.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=va({...n.reduce((g,m)=>{const y=O(m,"extendMarkSchema",d);return{...g,...y?y(c):{}}},{}),inclusive:$(O(c,"inclusive",d)),excludes:$(O(c,"excludes",d)),group:$(O(c,"group",d)),spanning:$(O(c,"spanning",d)),code:$(O(c,"code",d)),attrs:Object.fromEntries(u.map(Na))}),h=$(O(c,"parseHTML",d));h&&(f.parseDOM=h.map(g=>wa(g,u)));const p=O(c,"renderHTML",d);return p&&(f.toDOM=g=>p({mark:g,HTMLAttributes:Mn(g,u)})),[c.name,f]}));return new Fc({topNode:o,nodes:l,marks:a})}function vy(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Kn(n){return n.sort((t,r)=>{const s=O(t,"priority")||100,i=O(r,"priority")||100;return s>i?-1:s<i?1:0})}function Uo(n){const e=Kn(Ko(n)),t=vy(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 Ny(n,e){return md(Uo(n),e)}function zS(n,e){const t=Ny(e),r=$n(n);return He.fromSchema(t).parse(r).toJSON()}function gd(n,e,t){const{from:r,to:s}=e,{blockSeparator:i=`
10
+ `))),0,0),n.someProp("transformPasted",f=>{l=f(l,n,!0)}),l;let d=n.someProp("clipboardTextParser",f=>f(e,s,r,n));if(d)l=d;else{let f=s.marks(),{schema:h}=n.state,p=rt.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=Dm(t),br&&Rm(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||He.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Nm.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Im(ua(l,+u[1],+u[2]),u[4]);else if(l=E.maxOpen(Am(l.content,s),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=ua(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n,a)}),l}const Nm=/^(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 Am(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),i,o=[];if(n.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&i.length&&$u(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=zu(o[o.length-1],i.length));let u=Lu(l,a);o.push(u),s=s.matchType(u.type),i=a}}),o)return S.from(o)}return n}function Lu(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,S.from(n));return n}function $u(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=$u(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(S.from(Lu(t,n,s+1))))}}function zu(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,zu(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(S.empty,!0);return n.copy(t.append(r))}function Ui(n,e,t,r,s,i){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(i=0),s<r-1&&(l=Ui(l,e,t,r,s+1,i)),s>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(S.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function ua(n,e,t){return e<n.openStart&&(n=new E(Ui(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new E(Ui(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Bu={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function Fu(){return document.implementation.createHTMLDocument("title")}let Nn=null;function Om(n){let e=window.trustedTypes;if(!e)return n;if(!Nn){if(Nn=e.defaultPolicy)try{return Nn.createHTML(n)}catch{}Nn=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return Nn.createHTML(n)}function Dm(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Fu(),r=t.body,s=/<([a-z][^>\s]+)/i.exec(n),i;if((i=s&&Bu[s[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=Om(n),i)for(let o=0;o<i.length;o++)r=r.querySelector(i[o])||r;for(let o=0;o<t.styleSheets.length;o++){let l=t.styleSheets[o];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let u=r.querySelectorAll(c.selectorText);for(let d=0;d<u.length;d++)u[d].style.cssText+=c.style.cssText}}}return r}function Rm(n){let e=n.querySelectorAll(de?"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 Im(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:s,openStart:i,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;try{a.checkAttrs(r[l+1])}catch{break}s=S.from(a.create(r[l+1],s)),i++,o++}return new E(s,i,o)}const ge={},ye={},Pm={touchstart:!0,touchmove:!0};class Lm{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 $m(n){for(let e in ge){let t=ge[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Bm(n,r)&&!zo(n,r)&&(n.editable||!(r.type in ye))&&t(n,r)},Pm[e]?{passive:!0}:void 0)}he&&n.dom.addEventListener("input",()=>null),qi(n)}function Qe(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function zm(n){n.input.mouseDown&&n.input.mouseDown.done(),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 qi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>zo(n,r))})}function zo(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Bm(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 Fm(n,e){!zo(n,e)&&ge[e.type]&&(n.editable||!(e.type in ye))&&ge[e.type](n,e)}ye.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Wu(n)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Xe&&de&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),xn&&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",s=>s(n,Ot(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||vm(n,t)?t.preventDefault():Qe(n,"key")};ye.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};ye.keypress=(n,e)=>{let t=e;if(Wu(n)||!t.charCode||t.ctrlKey&&!t.altKey||ve&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof N)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function xr(n){return{left:n.clientX,top:n.clientY}}function jm(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Bo(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(n.someProp(e,l=>o>i.depth?l(n,t,i.nodeAfter,i.before(o),s,!0):l(n,t,i.node(o),i.before(o),s,!1)))return!0;return!1}function Sr(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 Hm(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&w.isSelectable(r)?(Sr(n,new w(t)),!0):!1}function Vm(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof w&&(r=t.node);let i=n.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(w.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(o);break}}return s!=null?(Sr(n,w.create(n.state.doc,s)),!0):!1}function Wm(n,e,t,r,s){return Bo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?Vm(n,t):Hm(n,t))}function Km(n,e,t,r){return Bo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function _m(n,e,t,r){return Bo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||Um(n,t,r)}function Um(n,e,t){if(t.button!=0)return!1;let r=ju(n,e,!0),s=n.state.doc;return r?(Sr(n,r),r instanceof N&&s.eq(n.state.doc)&&(n.input.mouseDown=new Jm(n,r)),!0):!1}function ju(n,e,t){let r=n.state.doc;if(e==-1)return r.inlineContent?N.create(r,0,r.content.size):null;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)return N.create(r,l+1,l+1+o.content.size);if(t&&w.isSelectable(o))return w.create(r,l)}return null}function Fo(n){return Qr(n)}const Hu=ve?"metaKey":"ctrlKey";ge.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Fo(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&jm(t,n.input.lastClick)&&!t[Hu]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button},n.input.mouseDown&&n.input.mouseDown.done();let o=n.posAtCoords(xr(t));o&&(i=="singleClick"?n.input.mouseDown=new qm(n,o,t,!!r):(i=="doubleClick"?Km:_m)(n,o.pos,o.inside,t)?t.preventDefault():Qe(n,"pointer"))};let Vu=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}};class qm extends Vu{constructor(e,t,r,s){super(e),this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[Hu],this.allowDefault=r.shiftKey;let i,o;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,o=u.depth?u.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof w&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Oe&&!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()),Qe(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||tt(this.view)})}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(xr(e))),this.updateAllowDefault(e),this.allowDefault||!t?Qe(this.view,"pointer"):Wm(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||he&&this.mightDrag&&!this.mightDrag.node.isAtom||de&&!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)?(Sr(this.view,I.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Qe(this.view,"pointer")}move(e){this.updateAllowDefault(e),Qe(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class Jm extends Vu{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),Qe(this.view,"pointer");let t=this.view.posAtCoords(xr(e)),r=t&&ju(this.view,t.inside,!1);if(!r)return;let{doc:s}=this.view.state,i=this.startSelection,[o,l]=r.from<i.from?[i.to,r.from]:[i.from,r.to];Sr(this.view,N.create(s,o,l))}}ge.touchstart=n=>{n.input.lastTouch=Date.now(),Fo(n),Qe(n,"pointer")};ge.touchmove=n=>{n.input.lastTouch=Date.now(),Qe(n,"pointer")};ge.contextmenu=n=>Fo(n);function Wu(n,e){return n.composing?!0:he&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Gm=Xe?5e3:-1;ye.compositionstart=ye.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof N&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||de&&bu&&Ym(n)))n.markCursor=n.state.storedMarks||t.marks(),Qr(n,!0),n.markCursor=null;else if(Qr(n,!e.selection.empty),Oe&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}Ku(n,Gm)};function Ym(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"}ye.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now(),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++,Ku(n,20))};function Ku(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Qr(n),e))}function _u(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Xm(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Vp(e.focusNode,e.focusOffset),r=Wp(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let s=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function Qr(n,e=!1){if(!(Xe&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),_u(n),e||n.docView&&n.docView.dirty){let t=Po(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 Qm(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(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const cr=Se&&bt<15||xn&&qp<604;ge.copy=ye.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=cr?null:t.clipboardData,o=r.content(),{dom:l,text:a}=$o(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):Qm(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Zm(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function eg(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 s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?ur(n,r.value,null,s,e):ur(n,r.textContent,r.innerHTML,s,e)},50)}function ur(n,e,t,r,s){let i=Pu(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,s,i||E.empty)))return!0;if(!i)return!1;let o=Zm(i),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Uu(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," "):""}ye.paste=(n,e)=>{let t=e;if(n.composing&&!Xe)return;let r=cr?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ur(n,Uu(r),r.getData("text/html"),s,t)?t.preventDefault():eg(n,t)};let qu=class{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}};const tg=ve?"altKey":"ctrlKey";function Ju(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[tg]}ge.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(xr(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof w?s.to-1:s.to))){if(r&&r.mightDrag)o=w.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&&(o=w.create(n.state.doc,d.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=$o(n,l);(!t.dataTransfer.files.length||!de||yu>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(cr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",cr||t.dataTransfer.setData("text/plain",c),n.dragging=new qu(u,Ju(n,t),o)};ge.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};ye.dragover=ye.dragenter=(n,e)=>e.preventDefault();ye.drop=(n,e)=>{try{ng(n,e,n.dragging)}finally{n.dragging=null}};function ng(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(xr(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=Pu(n,Uu(e.dataTransfer),cr?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&Ju(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||E.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?vo(n.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=n.state.tr;if(o){let{node:h}=t;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&w.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new w(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),a.setSelection(Lo(n,f,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}ge.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())&&tt(n)},20))};ge.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)};ge.beforeinput=(n,e)=>{if(Xe&&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",i=>i(n,Ot(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in ye)ge[n]=ye[n];function dr(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}let da=class Gu{constructor(e,t){this.toDOM=e,this.spec=t||jt,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new st(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Gu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&dr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Wn=class Ji{constructor(e,t){this.attrs=e,this.spec=t||jt}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new st(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Ji&&dr(this.attrs,e.attrs)&&dr(this.spec,e.spec)}static is(e){return e.type instanceof Ji}destroy(){}},rg=class Yu{constructor(e,t){this.attrs=e,this.spec=t||jt}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=i.pos?null:new st(i.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof Yu&&dr(this.attrs,e.attrs)&&dr(this.spec,e.spec)}destroy(){}},st=class Ln{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Ln(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 Ln(e,e,new da(t,r))}static inline(e,t,r,s){return new Ln(e,t,new Wn(r,s))}static node(e,t,r,s){return new Ln(e,t,new rg(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Wn}get widget(){return this.type instanceof da}};const an=[],jt={};let G=class ut{constructor(e,t){this.local=e.length?e:an,this.children=t.length?t:an}static create(e,t){return t.length?Zr(t,e,0,jt):fe}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,s+l,i)}}map(e,t,r){return this==fe||e.maps.length==0?this:this.mapInner(e,t,0,0,r||jt)}mapInner(e,t,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?sg(this.children,o||[],e,t,r,s,i):o?new ut(o.sort(Ht),an):fe}add(e,t){return t.length?this==fe?ut.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Zu(t,l,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,u,c+1):s.splice(i,0,a,a+l.nodeSize,Zr(u,l,c+1,jt)),i+=3}});let o=Qu(i?ed(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new ut(o.length?this.local.concat(o).sort(Ht):this.local,s||this.children)}remove(e){return e.length==0||this==fe?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+t,a=r[i+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,l+1);c!=fe?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,t)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new ut(s,r):fe}forChild(e,t){if(this==fe)return this;if(t.isLeaf)return ut.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof Wn){let c=Math.max(i,a.from)-i,u=Math.min(o,a.to)-i;c<u&&(s||(s=[])).push(a.copy(c,u))}}if(s){let l=new ut(s.sort(Ht),an);return r?new Xu([l,r]):l}return r||fe}eq(e){if(this==e)return!0;if(!(e instanceof ut)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let 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 jo(this.localsInner(e))}localsInner(e){if(this==fe)return an;if(e.inlineContent||!this.local.some(Wn.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Wn||t.push(this.local[r]);return t}forEachSet(e){e(this)}};G.empty=new G([],[]);G.removeOverlap=jo;const fe=G.empty;let Xu=class cn{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,jt));return cn.from(r)}forChild(e,t){if(t.isLeaf)return G.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=fe&&(i instanceof cn?r=r.concat(i.members):r.push(i))}return cn.from(r)}eq(e){if(!(e instanceof cn)||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 s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let o=0;o<i.length;o++)t.push(i[o])}}return t?jo(r?t:t.sort(Ht)):an}static from(e){switch(e.length){case 0:return fe;case 1:return e[0];default:return new cn(e.every(t=>t instanceof G)?e:e.reduce((t,r)=>t.concat(r instanceof G?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function sg(n,e,t,r,s,i,o){let l=n.slice();for(let c=0,u=i;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<l.length;y+=3){let b=l[y+1];if(b<0||f>b+u-d)continue;let x=l[y]+u-d;h>=x?l[y+1]=f<=x?-2:-1:f>=u&&m&&(l[y]+=m,l[y+1]+=m)}d+=m}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+i),d=u-s;if(d<0||d>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+i,-1),h=f-s,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=l[c+2].mapInner(t,m,u+1,n[c]+i+1,o);y!=fe?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=ig(l,n,e,t,s,i,o),u=Zr(c,r,0,o);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new G(e.sort(Ht),l)}function Qu(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new st(s.from+e,s.to+e,s.type))}return t}function ig(n,e,t,r,s,i,o){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,s,c);d?t.push(d):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function Zu(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,o;i<n.length;i++)(o=n[i])&&o.from>t&&o.to<r&&((s||(s=[])).push(o),n[i]=null);return s}function ed(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Zr(n,e,t,r){let s=[],i=!1;e.forEach((l,a)=>{let c=Zu(n,l,a+t);if(c){i=!0;let u=Zr(c,l,t+a+1,r);u!=fe&&s.push(a,a+l.nodeSize,u)}});let o=Qu(i?ed(n):n,-t).sort(Ht);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new G(o,s):fe}function Ht(n,e){return n.from-e.from||n.to-e.to}function jo(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),fa(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),fa(e,s,r.copy(i.from,r.to)));break}}}return e}function fa(n,e,t){for(;e<n.length&&Ht(t,n[e])>0;)e++;n.splice(e,0,t)}function ui(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=fe&&e.push(r)}),n.cursorWrapper&&e.push(G.create(n.state.doc,[n.cursorWrapper.deco])),Xu.from(e)}const og={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lg=Se&&bt<=11;class ag{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 cg{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ag,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);Se&&bt<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():he&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),lg&&(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,og)),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(sa(this.view)){if(this.suppressingSelectionUpdates)return tt(this.view);if(Se&&bt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Jt(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 i=e.focusNode;i;i=kn(i))t.add(i);for(let i=e.anchorNode;i;i=kn(i))if(t.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.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(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&sa(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u<t.length;u++){let d=this.registerMutation(t[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||de&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Oe&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||fg(e,d)!=h)&&f.remove()}}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ws(r)&&(c=Po(e))&&c.eq(I.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,tt(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),ug(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,hg(e,a)),this.handleDOMChange(i,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||tt(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 s=e.previousSibling,i=e.nextSibling;if(Se&&bt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let o=s&&s.parentNode==e.target?ce(s)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?ce(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ha=new WeakMap,pa=!1;function ug(n){if(!ha.has(n)&&(ha.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Oe,pa)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."),pa=!0}}function ma(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return Jt(o.node,o.offset,s,i)&&([t,r,s,i]=[s,i,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:i}}function dg(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return ma(n,s)}let t;function r(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?ma(n,t):null}function fg(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 hg(n,e){var t;let{focusNode:r,focusOffset:s}=n.domSelectionRange();for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&n.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function pg(n,e,t,r){let{node:s,fromOffset:i,toOffset:o,from:l,to:a}=n.docView.parseRange(e,t),c=n.domSelectionRange(),u,d=c.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],Ws(c)||u.push({node:c.focusNode,offset:c.focusOffset})),de&&n.input.lastKeyCode===8)for(let y=o;y>i;y--){let b=s.childNodes[y-1],x=b.pmViewDesc;if(b.nodeName=="BR"&&!x){o=y;break}if(!x||x.size)break}let f=n.state.doc,h=n.someProp("domParser")||He.fromSchema(n.state.schema),p=f.resolve(l),g=null,m=h.parse(s,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:mg(r),context:p});if(u&&u[0].pos!=null){let y=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=y),g={anchor:y+l,head:b+l}}return{doc:m,sel:g,from:l,to:a}}const mg=n=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(n);if(e.nodeName=="BR"&&e.parentNode){if(he&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||he&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},gg=/^(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 yg(n,e,t,r,s){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let v=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,D=Po(n,v);if(D&&!n.state.selection.eq(D)){if(de&&Xe&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",j=>j(n,Ot(13,"Enter"))))return;let R=n.state.tr.setSelection(D);v=="pointer"?R.setMeta("pointer",!0):v=="key"&&R.scrollIntoView(),i&&R.setMeta("composition",i),n.dispatch(R)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=pg(n,e,t,s),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=xg(d.content,c.doc.content,c.from,f,h);if(p&&n.input.domChangeCount++,(xn&&n.input.lastIOSEnter>Date.now()-225||Xe)&&s.some(v=>v.nodeType==1&&!gg.test(v.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",v=>v(n,Ot(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof N&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let v=ga(n,n.state.doc,c.sel);if(v&&!v.eq(n.state.selection)){let D=n.state.tr.setSelection(v);i&&D.setMeta("composition",i),n.dispatch(D)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof N&&(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)),Se&&bt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let g=c.doc.resolveNoCache(p.start-c.from),m=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),b=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=p.endA;if((xn&&n.input.lastIOSEnter>Date.now()-225&&(!b||s.some(v=>v.nodeName=="DIV"||v.nodeName=="P"))||!b&&g.pos<c.doc.content.size&&(!g.sameParent(m)||!g.parent.inlineContent)&&g.pos<m.pos&&!/\S/.test(c.doc.textBetween(g.pos,m.pos,"","")))&&n.someProp("handleKeyDown",v=>v(n,Ot(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&kg(u,p.start,p.endA,g,m)&&n.someProp("handleKeyDown",v=>v(n,Ot(8,"Backspace")))){Xe&&de&&n.domObserver.suppressSelectionUpdates();return}de&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Xe&&!b&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,m=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(v){return v(n,Ot(13,"Enter"))})},20));let x=p.start,C=p.endA,T=v=>{let D=v||n.state.tr.replace(x,C,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let R=ga(n,D.doc,c.sel);R&&!(de&&n.composing&&R.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(R.head==x||R.head==D.mapping.map(C)-1)||Se&&R.empty&&R.head==x)&&D.setSelection(R)}return i&&D.setMeta("composition",i),D.scrollIntoView()},A;if(b)if(g.pos==m.pos){Se&&bt<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>tt(n),20));let v=T(n.state.tr.delete(x,C)),D=u.resolve(p.start).marksAcross(u.resolve(p.endA));D&&v.ensureMarks(D),n.dispatch(v)}else if(p.endA==p.endB&&(A=bg(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let v=T(n.state.tr);A.type=="add"?v.addMark(x,C,A.mark):v.removeMark(x,C,A.mark),n.dispatch(v)}else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let v=g.parent.textBetween(g.parentOffset,m.parentOffset),D=()=>T(n.state.tr.insertText(v,x,C));n.someProp("handleTextInput",R=>R(n,x,C,v,D))||n.dispatch(D())}else n.dispatch(T());else n.dispatch(T())}function ga(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Lo(n,e.resolve(t.anchor),e.resolve(t.head))}function bg(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,s=t,i=r,o,l,a;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<t.length;u++)i=t[u].removeFromSet(i);if(s.length==1&&i.length==0)l=s[0],o="add",a=u=>u.mark(l.addToSet(u.marks));else if(s.length==0&&i.length==1)l=i[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(S.from(c).eq(n))return{mark:l,type:o}}function kg(n,e,t,r,s){if(t-e<=s.pos-r.pos||di(r,!0,!1)<s.pos)return!1;let i=n.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=n.resolve(di(i,!0,!0));return!o.parent.isTextblock||o.pos>t||di(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function di(n,e,t){let r=n.depth,s=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,s++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function xg(n,e,t,r,s){let i=n.findDiffStart(e,t),o=t+n.size,l=t+e.size;if(i==null)return null;let{a,b:c}=n.findDiffEnd(e,o,l);if(s=="end"){let u=Math.max(0,i-Math.min(a,c));r-=a+u-i}if(a<i&&o<l){let u=r<=i&&r>=a?i-r:0;i-=u,c=i+(c-a),a=i}else if(c<i){let u=r<=i&&r>=c?i-r:0;i-=u,a=i+(a-c),c=i}return{start:i,endA:a,endB:c}}class td{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 Lm,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Sa),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=ka(this),ba(this),this.nodeViews=xa(this),this.docView=Ql(this.state.doc,ya(this),ui(this),this.dom,this),this.domObserver=new cg(this,(r,s,i,o)=>yg(this,r,s,i,o)),this.domObserver.start(),$m(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&&qi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Sa),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 s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(_u(this),o=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=xa(this);Cg(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&qi(this),this.editable=ka(this),ba(this);let a=ui(this),c=ya(this),u=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(s.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Yp(this);if(o){this.domObserver.stop();let h=d&&(Se||de)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&Sg(s.selection,e.selection);if(d){let g=de?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Xm(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Ql(e.doc,c,a,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let p=this.input.mouseDown;h||!(p&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&xm(this)&&p.delaySelUpdate())?tt(this,h):(Du(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Xp(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 w){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&ql(this,t.getBoundingClientRect(),e)}else ql(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,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new qu(e.slice,e.move,s<0?void 0:w.create(this.state.doc,s))}someProp(e,t){let r=this._props&&this._props[e],s;if(r!=null&&(s=t?t(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(s=t?t(l):l))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let l=i[o].props[e];if(l!=null&&(s=t?t(l):l))return s}}hasFocus(){if(Se){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Qp(this.dom),tt(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 rm(this,e)}coordsAtPos(e,t=1){return Mu(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 s=this.docView.posFromDOM(e,t,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,t){return am(this,t||this.state,e)}pasteHTML(e,t){return ur(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ur(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return $o(this,e)}destroy(){this.docView&&(zm(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ui(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,jp())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Fm(this,e)}domSelectionRange(){let e=this.domSelection();return e?he&&this.root.nodeType===11&&_p(this.dom.ownerDocument)==this.dom&&dg(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}td.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function ya(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"),[st.node(0,n.state.doc.content.size,e)]}function ba(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:st.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ka(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Sg(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 xa(n){let e=Object.create(null);function t(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Cg(n,e){let t=0,r=0;for(let s in n){if(n[s]!=e[s])return!0;t++}for(let s in e)r++;return t!=r}function Sa(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 Ct={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},es={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Mg=typeof navigator<"u"&&/Mac/.test(navigator.platform),Tg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ue=0;ue<10;ue++)Ct[48+ue]=Ct[96+ue]=String(ue);for(var ue=1;ue<=24;ue++)Ct[ue+111]="F"+ue;for(var ue=65;ue<=90;ue++)Ct[ue]=String.fromCharCode(ue+32),es[ue]=String.fromCharCode(ue);for(var fi in Ct)es.hasOwnProperty(fi)||(es[fi]=Ct[fi]);function Eg(n){var e=Mg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Tg&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?es:Ct)[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 wg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),vg=typeof navigator<"u"&&/Win/.test(navigator.platform);function Ng(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))wg?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),o&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Ag(n){let e=Object.create(null);for(let t in n)e[Ng(t)]=n[t];return e}function hi(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 Og(n){return new W({props:{handleKeyDown:nd(n)}})}function nd(n){let e=Ag(n);return function(t,r){let s=Eg(r),i,o=e[hi(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[hi(s,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(vg&&r.ctrlKey&&r.altKey)&&(i=Ct[r.keyCode])&&i!=s){let l=e[hi(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}function _s(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:s}=t,{storedMarks:i}=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 i},get selection(){return r},get doc(){return s},get tr(){return r=t.selection,s=t.doc,i=t.storedMarks,t}}}var mn=class rd{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:s}=t,{tr:i}=r,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,l=[],a=!!e,c=e||i.tr,u=()=>(!a&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...g)=>{const m=this.buildProps(c,t),y=h(...g)(m);return l.push(y),d}])),run:u};return d}static createFakeChain(){const e=new Proxy({},{get:(t,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){const{rawCommands:t,state:r}=this,s=!1,i=e||r.tr,o=this.buildProps(i,s);return{...Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...c)=>a(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,s)}}static createFallbackCan(){const e=rd.createFakeChain();return new Proxy({chain:()=>e},{get:(t,r)=>{if(r!=="then")return r==="chain"?t.chain:()=>!1}})}buildProps(e,t=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,l={tr:e,editor:s,view:o,state:_s({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}};const Dg=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{if(!n.isDestroyed){var t;e.dom.blur(),(t=window)===null||t===void 0||(t=t.getSelection())===null||t===void 0||t.removeAllRanges()}}),!0),Rg=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Ig=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:s}=r;return t&&s.forEach(({$from:i,$to:o})=>{n.doc.nodesBetween(i.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=En(h);if(l.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},Pg=n=>e=>n(e),Lg=()=>({state:n,dispatch:e})=>fu(n,e),$g=(n,e)=>({editor:t,tr:r})=>{const{state:s}=t,i=s.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new N(r.doc.resolve(Math.max(o-1,0)))),!0},zg=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const s=n.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const o=s.before(i),l=s.after(i);n.delete(o,l).scrollIntoView()}return!0}return!1};function ne(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}const Bg=n=>({tr:e,state:t,dispatch:r})=>{const s=ne(n,t.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const l=i.before(o),a=i.after(o);e.delete(l,a).scrollIntoView()}return!0}return!1},Fg=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},jg=n=>n.content?/^text(\*|\+)/.test(n.content):!1,Ca=(n,e,t)=>{if(!n.parent.isInline||t==="left"&&n.pos>n.start()||t==="right"&&n.pos<n.end())return n.pos;const r=e.nodes[n.parent.type.name].spec;return jg(r)?t==="left"?n.start()-1:n.end()+1:n.pos},Hg=(n,e,t)=>({from:Ca(n,t,"left"),to:Ca(e,t,"right")}),Vg=()=>({state:n,dispatch:e})=>{if(n.selection.empty)return!1;if(e){const t=n.tr,{ranges:r}=n.selection,s=t.steps.length;r.forEach(i=>{const o=t.mapping.slice(s),l=t.doc.resolve(o.map(i.$from.pos)),a=t.doc.resolve(o.map(i.$to.pos)),{from:c,to:u}=Hg(l,a,n.schema);t.deleteRange(c,u)}),t.selection.empty||t.setSelection(N.near(t.doc.resolve(t.selection.from))),t.scrollIntoView(),e(t)}return!0},Wg=()=>({commands:n})=>n.keyboardShortcut("Enter"),Kg=()=>({state:n,dispatch:e})=>Ep(n,e);function Ho(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function ts(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:Ho(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function sd(n,e,t={}){return n.find(r=>r.type===e&&ts(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function Ma(n,e,t={}){return!!sd(n,e,t)}function Vo(n,e,t){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(a=>a.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(a=>a.type===e))return;if(!t){const a=r.node.marks.find(c=>c.type===e);a&&(t=a.attrs)}if(!sd([...r.node.marks],e,t))return;let s=r.index,i=n.start()+r.offset,o=s+1,l=i+r.node.nodeSize;for(;s>0&&Ma([...n.parent.child(s-1).marks],e,t);)s-=1,i-=n.parent.child(s).nodeSize;for(;o<n.parent.childCount&&Ma([...n.parent.child(o).marks],e,t);)l+=n.parent.child(o).nodeSize,o+=1;return{from:i,to:l}}function it(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}const _g=(n,e)=>({tr:t,state:r,dispatch:s})=>{const i=it(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:c,to:u}=l;if(s){const d=Vo(a,i,e);if(d&&d.from<=c&&d.to>=u){const f=N.create(o,d.from,d.to);t.setSelection(f)}}return!0},Ug=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 Wo(n){return n instanceof N}function Ze(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Gi(n,e=null){if(!e)return null;const t=I.atStart(n),r=I.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,i=r.to;return e==="all"?N.create(n,Ze(0,s,i),Ze(n.content.size,s,i)):N.create(n,Ze(e,s,i),Ze(e,s,i))}function Yi(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function fr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function qg(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const Jg=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(fr()||Yi())&&r.dom.focus(),qg()&&!fr()&&!Yi()&&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(i&&n===null&&!Wo(t.state.selection))return o(),!0;const l=Gi(s.doc,n)||t.state.selection,a=t.state.selection.eq(l);return i&&(a||s.setSelection(l),a&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},Gg=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),Yg=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),id=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&&id(r)}return n};function $n(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 id(t)}function od(n){return typeof n?.nodesBetween=="function"}function Sn(n,e,t){if(od(n))return n;const r=typeof n=="object"&&n!==null;t={slice:!0,parseOptions:{},...t};const s=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return S.fromArray(n.map(o=>e.nodeFromJSON(o)));const i=e.nodeFromJSON(n);return t.errorOnInvalidContent&&i.check(),i}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),Sn("",e,t)}if(s){if(t.errorOnInvalidContent){let o=!1,l="";const a=new Fc({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?He.fromSchema(a).parseSlice($n(n),t.parseOptions):He.fromSchema(a).parse($n(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=He.fromSchema(e);return t.slice?i.parseSlice($n(n),t.parseOptions).content:i.parse($n(n),t.parseOptions)}return Sn("",e,t)}function ld(n){return!("type"in n)}function ad(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof X||s instanceof se))return;const i=n.mapping.maps[r];let o=0;i.forEach((l,a,c,u)=>{o===0&&(o=u)}),n.setSelection(I.near(n.doc.resolve(o),t))}const Xg=(n,e,t)=>({tr:r,dispatch:s,editor:i})=>{if(s){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=m=>{i.emit("contentError",{editor:i,error:m,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Sn(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(m){a(m)}try{var o;l=Sn(e,i.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:i.options.enableContentCheck})}catch(m){return a(m),!1}let{from:u,to:d}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,h=!0;const p=ld(l)?l.content:[l];if(p.forEach(m=>{m.check(),f=f?m.isText&&m.marks.length===0:!1,h=h?m.isBlock:!1}),u===d&&h){const{parent:m}=r.doc.resolve(u);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(u-=1,d+=1)}let g;if(f)Array.isArray(e)?g=e.map(m=>m.text||"").join(""):od(e)?g=p.map(m=>{var y;return(y=m.text)!==null&&y!==void 0?y:""}).join(""):typeof e=="object"&&e&&e.text?g=e.text:g=e,r.insertText(g,u,d);else{g=S.from(p);const m=r.doc.resolve(u),y=m.node(),b=m.parentOffset===0,x=y.isText||y.isTextblock,C=y.content.size>0;b&&x&&C&&h&&(u=Math.max(0,u-1)),r.replaceWith(u,d,p)}t.updateSelection&&ad(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};function cd(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}const Qg=(n={})=>({tr:e,dispatch:t,editor:r})=>{const{pos:s,attrs:i,content:o,updateSelection:l=!0}=n;let a;typeof s=="number"?a=e.doc.resolve(s):s?a=s:a=e.selection.$from;const c=cd(a.parent.contentMatchAt(a.index()));if(!c)return!1;const u=Object.keys(c.spec.attrs||{}),d=i?Object.fromEntries(Object.entries(i).filter(([h])=>u.includes(h))):{};let f;if(o){const h=Sn(o,r.schema);f=c.createAndFill(d,h)}else f=c.createAndFill(d);return f?(t&&(e.insert(a.pos,f),l&&ad(e,e.steps.length-1,-1)),!0):!1},Zg=()=>({state:n,dispatch:e})=>Cp(n,e),ey=()=>({state:n,dispatch:e})=>Mp(n,e),ty=()=>({state:n,dispatch:e})=>iu(n,e),ny=()=>({state:n,dispatch:e})=>cu(n,e),ry=()=>({state:n,dispatch:e,tr:t})=>{try{const r=js(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},sy=()=>({state:n,dispatch:e,tr:t})=>{try{const r=js(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},iy=()=>({state:n,dispatch:e})=>xp(n,e),oy=()=>({state:n,dispatch:e})=>Sp(n,e);function ud(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function ly(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,s,i,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))fr()||ud()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(t=`Alt-${t}`),s&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}const ay=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const i=ly(n).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&s&&r.maybeStep(u)}),!0};function nt(n,e,t={}){const{from:r,to:s,empty:i}=n.selection,o=e?ne(e,n.schema):null,l=[];n.doc.nodesBetween(r,s,(u,d)=>{if(u.isText)return;const f=Math.max(r,d),h=Math.min(s,d+u.nodeSize);l.push({node:u,from:f,to:h})});const a=s-r,c=l.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>ts(u.node.attrs,t,{strict:!1}));return i?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=a}const cy=(n,e={})=>({state:t,dispatch:r})=>nt(t,ne(n,t.schema),e)?Tp(t,r):!1,uy=()=>({state:n,dispatch:e})=>hu(n,e),dy=n=>({state:e,dispatch:t})=>{const r=ne(n,e.schema);return $p(r)(e,t)},fy=()=>({state:n,dispatch:e})=>du(n,e);function Us(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Ta(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,s)=>(t.includes(s)||(r[s]=n[s]),r),{})}const hy=(n,e)=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const l=Us(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(i=ne(n,r.schema)),l==="mark"&&(o=it(n,r.schema));let a=!1;return t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{i&&i===u.type&&(a=!0,s&&t.setNodeMarkup(d,void 0,Ta(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&(a=!0,s&&t.addMark(d,d+u.nodeSize,o.create(Ta(f.attrs,e))))})})}),a},py=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),my=()=>({tr:n,dispatch:e})=>{if(e){const t=new xe(n.doc);n.setSelection(t)}return!0},gy=()=>({state:n,dispatch:e})=>lu(n,e),yy=()=>({state:n,dispatch:e})=>uu(n,e),by=()=>({state:n,dispatch:e})=>Np(n,e),ky=()=>({state:n,dispatch:e})=>Dp(n,e),xy=()=>({state:n,dispatch:e})=>Op(n,e);function Xi(n,e,t={},r={}){return Sn(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const Sy=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const c=Xi(n,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});if(o){const u=ld(c)?c.content:[c];i.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!t)}return!0}return o&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function dd(n,e){const t=it(e,n.schema),{from:r,to:s,empty:i}=n.selection,o=[];i?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,s,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function fd(n,e){const t=new eu(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function Cy(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,i)=>{t(s)&&r.push({node:s,pos:i})}),r}function My(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 qs(n){return e=>My(e.$from,n)}function O(n,e,t){return n.config[e]===void 0&&n.parent?O(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?O(n.parent,e,t):null}):n.config[e]}function Ko(n){return n.map(e=>{const t=O(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Ko(t())]:e}).flat(10)}function _o(n,e){const t=rt.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function hd(n){return typeof n=="function"}function $(n,e=void 0,...t){return hd(n)?e?n.bind(e)(...t):n(...t):n}function Ty(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Cn(n){return{baseExtensions:n.filter(e=>e.type==="extension"),nodeExtensions:n.filter(e=>e.type==="node"),markExtensions:n.filter(e=>e.type==="mark")}}function pd(n){const e=[],{nodeExtensions:t,markExtensions:r}=Cn(n),s=[...t,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=t.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...o,...l];return n.forEach(c=>{const u=O(c,"addGlobalAttributes",{name:c.name,options:c.options,storage:c.storage,extensions:s});u&&u().forEach(d=>{let f;Array.isArray(d.types)?f=d.types:d.types==="*"?f=a:d.types==="nodes"?f=o:d.types==="marks"?f=l:f=[],f.forEach(h=>{Object.entries(d.attributes).forEach(([p,g])=>{e.push({type:h,name:p,attribute:{...i,...g}})})})})}),s.forEach(c=>{const u=O(c,"addAttributes",{name:c.name,options:c.options,storage:c.storage});if(!u)return;const d=u();Object.entries(d).forEach(([f,h])=>{const p={...i,...h};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:c.name,name:f,attribute:p})})}),e}function Ey(n){const e=[];let t="",r=!1,s=!1,i=0;const o=n.length;for(let l=0;l<o;l+=1){const a=n[l];if(a==="'"&&!s){r=!r,t+=a;continue}if(a==='"'&&!r){s=!s,t+=a;continue}if(!r&&!s){if(a==="("){i+=1,t+=a;continue}if(a===")"&&i>0){i-=1,t+=a;continue}if(a===";"&&i===0){e.push(t),t="";continue}}t+=a}return t&&e.push(t),e}function Ea(n){const e=[],t=Ey(n||""),r=t.length;for(let s=0;s<r;s+=1){const i=t[s],o=i.indexOf(":");if(o===-1)continue;const l=i.slice(0,o).trim(),a=i.slice(o+1).trim();l&&a&&e.push([l,a])}return e}function ee(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([s,i])=>{if(s==="__proto__"){Object.defineProperty(r,s,{configurable:!0,enumerable:!0,value:i,writable:!0});return}if(!r[s]){r[s]=i;return}if(s==="class"){const o=i?String(i).split(" "):[],l=r[s]?r[s].split(" "):[],a=o.filter(c=>!l.includes(c));r[s]=[...l,...a].join(" ")}else if(s==="style"){const o=new Map([...Ea(r[s]),...Ea(i)]);r[s]=Array.from(o.entries()).map(([l,a])=>`${l}: ${a}`).join("; ")}else r[s]=i}),r},{})}function Mn(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)=>ee(t,r),{})}function wy(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function wa(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 s=e.reduce((i,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(t):wy(t.getAttribute(o.name));return l==null?i:{...i,[o.name]:l}},{});return{...r,...s}}}}function va(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Ty(t)?!1:t!=null))}function Na(n){var e,t;const r={};return!(!(n==null||(e=n.attribute)===null||e===void 0)&&e.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),(n==null||(t=n.attribute)===null||t===void 0?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function md(n,e){var t;const r=pd(n),{nodeExtensions:s,markExtensions:i}=Cn(n),o=(t=s.find(c=>O(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(s.map(c=>{const u=r.filter(m=>m.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=va({...n.reduce((m,y)=>{const b=O(y,"extendNodeSchema",d);return{...m,...b?b(c):{}}},{}),content:$(O(c,"content",d)),marks:$(O(c,"marks",d)),group:$(O(c,"group",d)),inline:$(O(c,"inline",d)),atom:$(O(c,"atom",d)),selectable:$(O(c,"selectable",d)),draggable:$(O(c,"draggable",d)),code:$(O(c,"code",d)),whitespace:$(O(c,"whitespace",d)),linebreakReplacement:$(O(c,"linebreakReplacement",d)),defining:$(O(c,"defining",d)),isolating:$(O(c,"isolating",d)),attrs:Object.fromEntries(u.map(Na))}),h=$(O(c,"parseHTML",d));h&&(f.parseDOM=h.map(m=>wa(m,u)));const p=O(c,"renderHTML",d);p&&(f.toDOM=m=>p({node:m,HTMLAttributes:Mn(m,u)}));const g=O(c,"renderText",d);return g&&(f.toText=g),[c.name,f]})),a=Object.fromEntries(i.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=va({...n.reduce((g,m)=>{const y=O(m,"extendMarkSchema",d);return{...g,...y?y(c):{}}},{}),inclusive:$(O(c,"inclusive",d)),excludes:$(O(c,"excludes",d)),group:$(O(c,"group",d)),spanning:$(O(c,"spanning",d)),code:$(O(c,"code",d)),attrs:Object.fromEntries(u.map(Na))}),h=$(O(c,"parseHTML",d));h&&(f.parseDOM=h.map(g=>wa(g,u)));const p=O(c,"renderHTML",d);return p&&(f.toDOM=g=>p({mark:g,HTMLAttributes:Mn(g,u)})),[c.name,f]}));return new Fc({topNode:o,nodes:l,marks:a})}function vy(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Kn(n){return n.sort((t,r)=>{const s=O(t,"priority")||100,i=O(r,"priority")||100;return s>i?-1:s<i?1:0})}function Uo(n){const e=Kn(Ko(n)),t=vy(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 Ny(n,e){return md(Uo(n),e)}function $S(n,e){const t=Ny(e),r=$n(n);return He.fromSchema(t).parse(r).toJSON()}function gd(n,e,t){const{from:r,to:s}=e,{blockSeparator:i=`
11
11
 
12
- `,textSerializers:o={}}=t||{};let l="";return n.nodesBetween(r,s,(a,c,u,d)=>{a.isBlock&&c>r&&(l+=i);const f=o?.[a.type.name];if(f)return u&&(l+=f({node:a,pos:c,parent:u,index:d,range:e})),!1;if(a.isText){var h;l+=a==null||(h=a.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,s-c)}}),l}function Ay(n,e){return gd(n,{from:0,to:n.content.size},e)}function yd(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Oy(n,e){const t=ne(e,n.schema),{from:r,to:s}=n.selection,i=[];n.doc.nodesBetween(r,s,l=>{i.push(l)});const o=i.reverse().find(l=>l.type.name===t.name);return o?{...o.attrs}:{}}function bd(n,e){const t=Us(typeof e=="string"?e:e.name,n.schema);return t==="node"?Oy(n,e):t==="mark"?dd(n,e):{}}function Dy(n,e=JSON.stringify){const t={};return n.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(t,s)?!1:t[s]=!0})}function Ry(n){const e=Dy(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,i)=>i!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Js(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=t[i];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(i).map(l,-1),u=e.slice(i).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Ry(r)}function qo(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const i=Vo(t.resolve(n),s.type);i&&r.push({mark:s,...i})}):t.nodesBetween(n,e,(s,i)=>{!s||s?.nodeSize===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}const Iy=(n,e,t,r=20)=>{const s=n.doc.resolve(t);let i=r,o=null;for(;i>0&&o===null;){const l=s.node(i);l?.type.name===e?o=l:i-=1}return[o,i]},Py=n=>{const e=n.depth-1;if(e<0)return null;const t=n.index(e);return t===0?null:n.node(e).child(t-1)};function sn(n,e){return e.nodes[n]||e.marks[n]||null}function Wr(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const s=n.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}const Ly=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,l)=>{var a,c;const u=((a=(c=s.type.spec).toText)===null||a===void 0?void 0:a.call(c,{node:s,pos:i,parent:o,index:l}))||s.textContent||"%leaf%";t+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-i))}),t};function Qi(n,e,t={}){const{empty:r,ranges:s}=n.selection,i=e?it(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>ts(u.attrs,t,{strict:!1}));let o=0;const l=[];if(s.forEach(({$from:u,$to:d})=>{const f=u.pos,h=d.pos;n.doc.nodesBetween(f,h,(p,g)=>{if(i&&p.inlineContent&&!p.type.allowsMarkType(i))return!1;if(!p.isText&&!p.marks.length)return;const m=Math.max(f,g),y=Math.min(h,g+p.nodeSize),b=y-m;o+=b,l.push(...p.marks.map(x=>({mark:x,from:m,to:y})))})}),o===0)return!1;const a=l.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>ts(u.mark.attrs,t,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=l.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,d)=>u+d.to-d.from,0);return(a>0?a+c:a)>=o}function $y(n,e,t={}){if(!e)return nt(n,null,t)||Qi(n,null,t);const r=Us(e,n.schema);return r==="node"?nt(n,e,t):r==="mark"?Qi(n,e,t):!1}const zy=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const i=qs(l=>l.type.name===e)(n.selection);if(!i)return!1;const o=n.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},By=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Aa(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function pi(n,e){const{nodeExtensions:t}=Cn(e),r=t.find(i=>i.name===n);if(!r)return!1;const s=$(O(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof s!="string"?!1:s.split(" ").includes("list")}function Cr(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){if(t){if(n.type.name==="hardBreak")return!0;if(n.isText){var r;return!/\S/.test((r=n.text)!==null&&r!==void 0?r:"")}}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let s=!0;return n.content.forEach(i=>{s!==!1&&(Cr(i,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function kd(n){return n instanceof w}function Fy({selection:n,pos:e,nodeSize:t,selectedOnTextSelection:r=!1}){const{from:s,to:i}=n;return!!(s<=e&&i>=e+t||r&&Wo(n)&&s>e&&i<e+t)}var xd=class Sd{constructor(e){this.position=e}static fromJSON(e){return new Sd(e.position)}toJSON(){return{position:this.position}}};function jy(n,e){const t=e.mapping.mapResult(n.position);return{position:new xd(t.pos),mapResult:t}}function Hy(n){return new xd(n)}function BS(n,e,t){const s=n.state.doc.content.size,i=Ze(e,0,s),o=Ze(t,0,s),l=n.coordsAtPos(i),a=n.coordsAtPos(o,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),f=Math.max(l.right,a.right),h={top:c,bottom:u,left:d,right:f,width:f-d,height:u-c,x:d,y:c};return{...h,toJSON:()=>h}}function Vy(n,e,t){const{selection:r}=e;let s=null;if(Wo(r)&&(s=r.$cursor),s){var i;const l=(i=n.storedMarks)!==null&&i!==void 0?i:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(a=>a.type.excludes(t)))}const{ranges:o}=r;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.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})}const Wy=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=t,{empty:o,ranges:l}=i,a=it(n,r.schema);if(s)if(o){const c=dd(r,a);t.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),g=Math.min(h+f.nodeSize,d);f.marks.find(m=>m.type===a)?f.marks.forEach(m=>{a===m.type&&t.addMark(p,g,a.create({...m.attrs,...e}))}):t.addMark(p,g,a.create(e))})});return Vy(r,t,a)},Ky=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),_y=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const i=ne(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:l})=>Kl(i,{...o,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Kl(i,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Uy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=Ze(n,0,r.content.size),i=w.create(r,s);e.setSelection(i)}return!0},qy=(n,e)=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=i.from,l=i.to),s&&t.doc.nodesBetween(o,l,(a,c)=>{a.isText||t.setNodeMarkup(c,void 0,{...a.attrs,dir:n})}),!0},Jy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:i}=typeof n=="number"?{from:n,to:n}:n,o=N.atStart(r).from,l=N.atEnd(r).to,a=Ze(s,o,l),c=Ze(i,o,l),u=N.create(r,a,c);e.setSelection(u)}return!0},Gy=n=>({state:e,dispatch:t})=>{const r=ne(n,e.schema);return Fp(r)(e,t)};function Oa(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(s=>e?.includes(s.type.name));n.tr.ensureMarks(r)}}const Yy=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:l,$to:a}=i,c=s.extensionManager.attributes,u=Wr(c,l.node().type.name,l.node().attrs);if(i instanceof w&&i.node.isBlock)return!l.parentOffset||!et(o,l.pos)?!1:(r&&(n&&Oa(t,s.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:cd(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=et(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&et(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(i instanceof N&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),m=e.doc.resolve(g);l.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}n&&Oa(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return p},Xy=(n,e={})=>({tr:t,state:r,dispatch:s,editor:i})=>{const o=ne(n,r.schema),{$from:l,$to:a}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const u=l.node(-1);if(u.type!==o)return!1;const d=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(s){var f;let y=S.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let D=l.depth-b;D>=l.depth-3;D-=1)y=S.from(l.node(D).copy(y));const x=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,C={...Wr(d,l.node().type.name,l.node().attrs),...e},T=((f=o.contentMatch.defaultType)===null||f===void 0?void 0:f.createAndFill(C))||void 0;y=y.append(S.from(o.createAndFill(null,T)||void 0));const A=l.before(l.depth-(b-1));t.replace(A,l.after(-x),new E(y,4-b,0));let v=-1;t.doc.nodesBetween(A,t.doc.content.size,(D,R)=>{if(v>-1)return!1;D.isTextblock&&D.content.size===0&&(v=R+1)}),v>-1&&t.setSelection(N.near(t.doc.resolve(v))),t.scrollIntoView()}return!0}const h=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...Wr(d,u.type.name,u.attrs),...e},g={...Wr(d,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,a.pos);const m=h?[{type:o,attrs:p},{type:h,attrs:g}]:[{type:o,attrs:p}];if(!et(t.doc,l.pos,2))return!1;if(s){const{selection:y,storedMarks:b}=r,{splittableMarks:x}=i.extensionManager,C=b||y.$to.parentOffset&&y.$from.marks();if(t.split(l.pos,2,m).scrollIntoView(),!C||!s)return!0;const T=C.filter(A=>x.includes(A.type.name));t.ensureMarks(T)}return!0};function Da(n){return!n||n==="1"?null:n}function Cd(n,e){return Da(n)===Da(e)}const mi=(n,e)=>{const t=qs(i=>i.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 s=n.doc.nodeAt(r);return!(t.node.type===s?.type&&Tt(n.doc,t.pos))||!Cd(t.node.attrs.type,s?.attrs.type)||n.join(t.pos),!0},gi=(n,e)=>{const t=qs(i=>i.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 s=n.doc.nodeAt(r);return!(t.node.type===s?.type&&Tt(n.doc,r))||!Cd(t.node.attrs.type,s?.attrs.type)||n.join(r),!0};function Qy(n){const e=n.doc,t=e.firstChild;if(!t)return null;const r=e.resolve(1),s=e.resolve(t.nodeSize-1);return N.between(r,s)}const Zy=(n,e,t,r={})=>({editor:s,tr:i,state:o,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=s.extensionManager,h=ne(n,o.schema),p=ne(e,o.schema),{selection:g,storedMarks:m}=o,{$from:y,$to:b}=g,x=y.blockRange(b),C=m||g.$to.parentOffset&&g.$from.marks();if(!x)return!1;const T=qs(L=>pi(L.type.name,d))(g),A=g.from===0&&g.to===o.doc.content.size,v=o.doc.content.content,D=v.length===1?v[0]:null,R=A&&D&&pi(D.type.name,d)?{node:D,pos:0}:null,j=T??R,K=!!T&&x.depth>=1&&x.depth-T.depth<=1,U=!!R;if((K||U)&&j){if(j.node.type===h)return A&&U?a().command(({tr:L,dispatch:B})=>{const z=Qy(L);return z?(L.setSelection(z),B&&B(L),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(pi(j.node.type.name,d)&&h.validContent(j.node.content))return a().command(()=>(i.setNodeMarkup(j.pos,h),!0)).command(()=>mi(i,h)).command(()=>gi(i,h)).run()}return!t||!C||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>mi(i,h)).command(()=>gi(i,h)).run():a().command(()=>{const L=u().wrapInList(h,r),B=C.filter(z=>f.includes(z.type.name));return i.ensureMarks(B),L?!0:c.clearNodes()}).wrapInList(h,r).command(()=>mi(i,h)).command(()=>gi(i,h)).run()},e0=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=t,o=it(n,r.schema);return Qi(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},t0=(n,e,t={})=>({state:r,commands:s})=>{const i=ne(n,r.schema),o=ne(e,r.schema),l=nt(r,i,t);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?s.setNode(o,a):s.setNode(i,{...a,...t})},n0=(n,e={})=>({state:t,commands:r})=>{const s=ne(n,t.schema);return nt(t,s,e)?r.lift(s):r.wrapIn(s,e)},r0=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const s=t[r];let i;if(s.spec.isInputRules&&(i=s.getState(n))){if(e){const o=n.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else o.delete(i.from,i.to)}return!0}}return!1},s0=(n={})=>({tr:e,dispatch:t,editor:r})=>{const{ignoreClearable:s=!1}=n,{selection:i}=e,{empty:o,ranges:l}=i;if(o)return!0;const{nonClearableMarks:a}=r.extensionManager;if(t){const c=Object.values(r.schema.marks).filter(u=>s||!a.includes(u.name));l.forEach(u=>{for(const d of c)e.removeMark(u.$from.pos,u.$to.pos,d)})}return!0},i0=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:o}=t,l=it(n,r.schema),{$from:a,empty:c,ranges:u}=o;if(!s)return!0;if(c&&i){var d;let{from:f,to:h}=o;const p=Vo(a,l,(d=a.marks().find(g=>g.type===l))===null||d===void 0?void 0:d.attrs);p&&(f=p.from,h=p.to),t.removeMark(f,h,l)}else u.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},o0=n=>({tr:e,state:t,dispatch:r})=>{const{selection:s}=t;let i,o;return typeof n=="number"?(i=n,o=n):n&&"from"in n&&"to"in n?(i=n.from,o=n.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(l,a)=>{if(l.isText)return;const c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},l0=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const l=Us(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(i=ne(n,r.schema)),l==="mark"&&(o=it(n,r.schema));let a=!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)=>{i&&i===m.type&&(a=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m)}):r.doc.nodesBetween(u,d,(m,y)=>{y<u&&i&&i===m.type&&(a=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m),y>=u&&y<=d&&(i&&i===m.type&&(a=!0,s&&t.setNodeMarkup(y,void 0,{...m.attrs,...e})),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type&&(a=!0,s)){const x=Math.max(y,u),C=Math.min(y+m.nodeSize,d);t.addMark(x,C,o.create({...b.attrs,...e}))}}))}),h&&(f!==void 0&&s&&t.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&s&&t.addMark(p,g,o.create({...m.attrs,...e}))}))}),a},un=new te("__tiptap_decorations__"),a0=n=>({tr:e,dispatch:t})=>(t&&e.setMeta(un,{type:"force",name:n}),!0),c0=(n,e={})=>({state:t,dispatch:r})=>{const s=ne(n,t.schema);return Rp(s,e)(t,r)},u0=(n,e={})=>({state:t,dispatch:r})=>{const s=ne(n,t.schema);return Ip(s,e)(t,r)};var d0=Th({blur:()=>Dg,clearContent:()=>Rg,clearNodes:()=>Ig,command:()=>Pg,createParagraphNear:()=>Lg,cut:()=>$g,deleteCurrentNode:()=>zg,deleteNode:()=>Bg,deleteRange:()=>Fg,deleteSelection:()=>Vg,enter:()=>Wg,exitCode:()=>Kg,extendMarkRange:()=>_g,first:()=>Ug,focus:()=>Jg,forEach:()=>Gg,insertContent:()=>Yg,insertContentAt:()=>Xg,insertDefaultBlock:()=>Qg,joinBackward:()=>ty,joinDown:()=>ey,joinForward:()=>ny,joinItemBackward:()=>ry,joinItemForward:()=>sy,joinTextblockBackward:()=>iy,joinTextblockForward:()=>oy,joinUp:()=>Zg,keyboardShortcut:()=>ay,lift:()=>cy,liftEmptyBlock:()=>uy,liftListItem:()=>dy,newlineInCode:()=>fy,resetAttributes:()=>hy,scrollIntoView:()=>py,selectAll:()=>my,selectNodeBackward:()=>gy,selectNodeForward:()=>yy,selectParentNode:()=>by,selectTextblockEnd:()=>ky,selectTextblockStart:()=>xy,setContent:()=>Sy,setMark:()=>Wy,setMeta:()=>Ky,setNode:()=>_y,setNodeSelection:()=>Uy,setTextDirection:()=>qy,setTextSelection:()=>Jy,sinkListItem:()=>Gy,splitBlock:()=>Yy,splitListItem:()=>Xy,toggleList:()=>Zy,toggleMark:()=>e0,toggleNode:()=>t0,toggleWrap:()=>n0,undoInputRule:()=>r0,unsetAllMarks:()=>s0,unsetMark:()=>i0,unsetTextDirection:()=>o0,updateAttributes:()=>l0,updateDecorations:()=>a0,wrapIn:()=>c0,wrapInList:()=>u0});const An=new WeakMap;function f0(n,e){var t;An.set(n,((t=An.get(n))!==null&&t!==void 0?t:0)+1);try{return e()}finally{var r;const s=((r=An.get(n))!==null&&r!==void 0?r:1)-1;s>0?An.set(n,s):An.delete(n)}}var h0=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={}}};function p0(n){return n.kind==="widget"}function Md(n,e){const t=[],r=new Set;for(const s of n)s.kind==="widget"&&p0(s)&&r.add(s.key),t.push(s.toPMDecoration(e));return{decorations:t,widgetKeys:r}}function m0(n,e,t){const{decorations:r,widgetKeys:s}=Md(e,t);return{set:G.create(n,r),widgetKeys:s}}function Td({position:n,from:e,to:t,docSize:r}){return n<e?!1:n<t?!0:n===t&&t===r}function g0({decorations:n,from:e,to:t,docSize:r,extensionName:s,warnedExtensions:i}){return n.filter(o=>Td({position:o.anchor,from:e,to:t,docSize:r})?!0:(o.anchor===t||i.has(s)||(i.add(s),console.warn(`[tiptap warn]: Extension "${s}" returned a decoration outside the requested range [${e}, ${t}). It was ignored.`)),!1))}function y0(n){var e;const t=(e=n.spec)===null||e===void 0?void 0:e.key;return typeof t=="string"?t:void 0}function Ed(n){return n.jsonID==="attr"}function b0(n){let e=!1;if(n.getMap().forEach(()=>{e=!0}),e||Ed(n))return!0;const t=n;return typeof t.from=="number"&&typeof t.to=="number"}function k0(n,e){let t=null,r=0,s=0;for(let i=0;i<n.childCount&&!(s>e.to);i+=1){const o=s+n.child(i).nodeSize;o>=e.from&&(t===null&&(t=s),r=o),s=o}return t===null?null:{from:t,to:r}}function x0(n,e){if(n.steps.some(i=>!b0(i)))return{type:"full"};const t=Js(n).map(({newRange:i})=>i);n.steps.forEach((i,o)=>{if(!Ed(i))return;const l=n.mapping.slice(o);t.push({from:l.map(i.pos,-1),to:l.map(i.pos+1)})});const r=[];for(const i of t){const o=k0(e,i);o&&r.push(o)}r.sort((i,o)=>i.from-o.from);const s=[];for(const i of r){const o=s[s.length-1];o&&i.from<=o.to?o.to=Math.max(o.to,i.to):s.push({...i})}return{type:"ranges",ranges:s}}function wd(n,e,t,r){return n.map(e,t,{onRemove:s=>{const i=s?.key;typeof i=="string"&&r.delete(i)}})}function S0(n,e,t){var r,s;const i=(r=e.decorationSetsByExtension[n])!==null&&r!==void 0?r:G.empty,o=new Set((s=e.widgetKeysByExtension[n])!==null&&s!==void 0?s:[]);return{set:wd(i,t.mapping,t.doc,o),widgetKeys:o}}function Ra(n,e){const t=Object.values(e).flatMap(r=>r.find());return G.create(n,t)}function Ia(n){const e=new Set;for(const t of Object.values(n))for(const r of t)e.add(r);return e}function C0(n,e){var t;switch((t=e.update)!==null&&t!==void 0?t:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${n}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${n}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function M0(n,e,t){return t?!0:n.update==="manual"?!1:n.shouldUpdate?n.shouldUpdate(e):e.tr.docChanged}const T0=new Set;var E0=class{constructor(n){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const t=un.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=n.editor,this.entries=this.resolveEntries(n.entries),this.entries.forEach(({name:e,spec:t})=>C0(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var n,e;return(n=(e=un.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&n!==void 0?n:T0}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(n){const e=[];for(const{name:t,addDecorations:r}of n){const s=r();s&&e.push({name:t,spec:s})}return e}createPlugin(){const{editor:n,entries:e}=this;return new W({key:un,state:{init:(t,r)=>{const s={},i={};for(const{name:l,spec:a}of e){const{set:c,widgetKeys:u}=this.buildFullSet(l,a,r);s[l]=c,i[l]=u}const o={decorationSetsByExtension:s,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(r.doc,s),widgetKeys:Ia(i)};return this.warnDuplicateWidgetKeys(o),o},apply:(t,r,s,i)=>{const o=t.getMeta(un),l=o?.type==="force"&&!o.name,a=o?.type==="force"?o.name:void 0,c={},u={},d=new Set;return f0(n,()=>{for(const{name:f,spec:h}of e){const p=l||a===f;if(M0(h,{editor:n,tr:t,oldState:s,newState:i},p))if(h.update==="changedRanges"&&t.docChanged&&!p){const g=this.applyChangedRangesRecompute(f,h,r,t,i);c[f]=g.set,u[f]=g.widgetKeys,d.add(f)}else{const{set:g,widgetKeys:m}=this.buildFullSet(f,h,i);c[f]=g,u[f]=m,d.add(f)}else{const g=S0(f,r,t);c[f]=g.set,u[f]=g.widgetKeys}}}),d.size===0&&!t.docChanged?r:{decorationSetsByExtension:c,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:t,decorationSetsByExtension:c,recomputedNames:d}),widgetKeys:Ia(u)}}},props:{decorations(t){var r,s;return(r=(s=un.getState(t))===null||s===void 0?void 0:s.mergedDecorationSet)!==null&&r!==void 0?r:G.empty}}})}applyChangedRangesRecompute(n,e,t,r,s){const i=x0(r,s.doc);return i.type==="full"?this.buildFullSet(n,e,s):this.rebuildRanges(n,e,t,r,s,i.ranges)}rebuildRanges(n,e,t,r,s,i){var o,l;const a=(o=t.decorationSetsByExtension[n])!==null&&o!==void 0?o:G.empty,c=new Set((l=t.widgetKeysByExtension[n])!==null&&l!==void 0?l:[]);let u=wd(a,r.mapping,r.doc,c);const d=s.doc.content.size;for(const{from:f,to:h}of i){const p=u.find(f,h).filter(y=>Td({position:y.from,from:f,to:h,docSize:d}));for(const y of p){const b=y0(y);b&&c.delete(b)}u=u.remove(p);const{decorations:g,widgetKeys:m}=Md(g0({decorations:this.runCreate(n,"createInRange",()=>e.createInRange({editor:this.editor,state:s,view:this.mountedView,from:f,to:h})),from:f,to:h,docSize:d,extensionName:n,warnedExtensions:this.warnedOutOfRangeExtensions}),n);u=u.add(s.doc,g);for(const y of m)c.add(y)}return{set:u,widgetKeys:c}}buildFullSet(n,e,t){const r=this.runCreate(n,"create",()=>e.create({editor:this.editor,state:t,view:this.mountedView}));return m0(t.doc,r,n)}runCreate(n,e,t){try{return t()}catch(r){return console.error(`[tiptap error]: Extension "${n}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(n){}buildMergedSet(n,e){const t=Object.keys(e);return t.length===1?e[t[0]]:Ra(n,e)}mergeAfterApply({entries:n,previous:e,tr:t,decorationSetsByExtension:r,recomputedNames:s}){return n.length===1?r[n[0].name]:s.size===0?e.mergedDecorationSet.map(t.mapping,t.doc):Ra(t.doc,r)}};function w0(n,e){if(n===e)return!0;if(!n||!e)return!1;const t=Object.keys(n),r=Object.keys(e);return t.length!==r.length?!1:t.every(s=>Object.prototype.hasOwnProperty.call(e,s)&&Object.is(n[s],e[s]))}function v0(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof w){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}function N0(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(s),s}function FS(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function jS(n,e){const t=n.getAttribute("style");if(!t)return null;const r=t.split(";").map(i=>i.trim()).filter(Boolean),s=e.toLowerCase();for(let i=r.length-1;i>=0;i-=1){const o=r[i],l=o.indexOf(":");if(l!==-1&&o.slice(0,l).trim().toLowerCase()===s)return o.slice(l+1).trim()}return null}function HS(n){return n.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function VS(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A0(n){return typeof n=="number"}function O0(n){return Object.prototype.toString.call(n).slice(8,-1)}function Dr(n){return O0(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Pa(n,e,t){const r=n.split(`
12
+ `,textSerializers:o={}}=t||{};let l="";return n.nodesBetween(r,s,(a,c,u,d)=>{a.isBlock&&c>r&&(l+=i);const f=o?.[a.type.name];if(f)return u&&(l+=f({node:a,pos:c,parent:u,index:d,range:e})),!1;if(a.isText){var h;l+=a==null||(h=a.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,s-c)}}),l}function Ay(n,e){return gd(n,{from:0,to:n.content.size},e)}function yd(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Oy(n,e){const t=ne(e,n.schema),{from:r,to:s}=n.selection,i=[];n.doc.nodesBetween(r,s,l=>{i.push(l)});const o=i.reverse().find(l=>l.type.name===t.name);return o?{...o.attrs}:{}}function bd(n,e){const t=Us(typeof e=="string"?e:e.name,n.schema);return t==="node"?Oy(n,e):t==="mark"?dd(n,e):{}}function Dy(n,e=JSON.stringify){const t={};return n.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(t,s)?!1:t[s]=!0})}function Ry(n){const e=Dy(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,i)=>i!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Js(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=t[i];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(i).map(l,-1),u=e.slice(i).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Ry(r)}function qo(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const i=Vo(t.resolve(n),s.type);i&&r.push({mark:s,...i})}):t.nodesBetween(n,e,(s,i)=>{!s||s?.nodeSize===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}const Iy=(n,e,t,r=20)=>{const s=n.doc.resolve(t);let i=r,o=null;for(;i>0&&o===null;){const l=s.node(i);l?.type.name===e?o=l:i-=1}return[o,i]},Py=n=>{const e=n.depth-1;if(e<0)return null;const t=n.index(e);return t===0?null:n.node(e).child(t-1)};function sn(n,e){return e.nodes[n]||e.marks[n]||null}function Wr(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const s=n.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}const Ly=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,l)=>{var a,c;const u=((a=(c=s.type.spec).toText)===null||a===void 0?void 0:a.call(c,{node:s,pos:i,parent:o,index:l}))||s.textContent||"%leaf%";t+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-i))}),t};function Qi(n,e,t={}){const{empty:r,ranges:s}=n.selection,i=e?it(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>ts(u.attrs,t,{strict:!1}));let o=0;const l=[];if(s.forEach(({$from:u,$to:d})=>{const f=u.pos,h=d.pos;n.doc.nodesBetween(f,h,(p,g)=>{if(i&&p.inlineContent&&!p.type.allowsMarkType(i))return!1;if(!p.isText&&!p.marks.length)return;const m=Math.max(f,g),y=Math.min(h,g+p.nodeSize),b=y-m;o+=b,l.push(...p.marks.map(x=>({mark:x,from:m,to:y})))})}),o===0)return!1;const a=l.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>ts(u.mark.attrs,t,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=l.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,d)=>u+d.to-d.from,0);return(a>0?a+c:a)>=o}function $y(n,e,t={}){if(!e)return nt(n,null,t)||Qi(n,null,t);const r=Us(e,n.schema);return r==="node"?nt(n,e,t):r==="mark"?Qi(n,e,t):!1}const zy=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const i=qs(l=>l.type.name===e)(n.selection);if(!i)return!1;const o=n.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},By=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Aa(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function pi(n,e){const{nodeExtensions:t}=Cn(e),r=t.find(i=>i.name===n);if(!r)return!1;const s=$(O(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof s!="string"?!1:s.split(" ").includes("list")}function Cr(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){if(t){if(n.type.name==="hardBreak")return!0;if(n.isText){var r;return!/\S/.test((r=n.text)!==null&&r!==void 0?r:"")}}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let s=!0;return n.content.forEach(i=>{s!==!1&&(Cr(i,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function kd(n){return n instanceof w}function Fy({selection:n,pos:e,nodeSize:t,selectedOnTextSelection:r=!1}){const{from:s,to:i}=n;return!!(s<=e&&i>=e+t||r&&Wo(n)&&s>e&&i<e+t)}var xd=class Sd{constructor(e){this.position=e}static fromJSON(e){return new Sd(e.position)}toJSON(){return{position:this.position}}};function jy(n,e){const t=e.mapping.mapResult(n.position);return{position:new xd(t.pos),mapResult:t}}function Hy(n){return new xd(n)}function zS(n,e,t){const s=n.state.doc.content.size,i=Ze(e,0,s),o=Ze(t,0,s),l=n.coordsAtPos(i),a=n.coordsAtPos(o,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),f=Math.max(l.right,a.right),h={top:c,bottom:u,left:d,right:f,width:f-d,height:u-c,x:d,y:c};return{...h,toJSON:()=>h}}function Vy(n,e,t){const{selection:r}=e;let s=null;if(Wo(r)&&(s=r.$cursor),s){var i;const l=(i=n.storedMarks)!==null&&i!==void 0?i:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(a=>a.type.excludes(t)))}const{ranges:o}=r;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.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})}const Wy=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=t,{empty:o,ranges:l}=i,a=it(n,r.schema);if(s)if(o){const c=dd(r,a);t.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),g=Math.min(h+f.nodeSize,d);f.marks.find(m=>m.type===a)?f.marks.forEach(m=>{a===m.type&&t.addMark(p,g,a.create({...m.attrs,...e}))}):t.addMark(p,g,a.create(e))})});return Vy(r,t,a)},Ky=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),_y=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const i=ne(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:l})=>Kl(i,{...o,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Kl(i,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Uy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=Ze(n,0,r.content.size),i=w.create(r,s);e.setSelection(i)}return!0},qy=(n,e)=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=i.from,l=i.to),s&&t.doc.nodesBetween(o,l,(a,c)=>{a.isText||t.setNodeMarkup(c,void 0,{...a.attrs,dir:n})}),!0},Jy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:i}=typeof n=="number"?{from:n,to:n}:n,o=N.atStart(r).from,l=N.atEnd(r).to,a=Ze(s,o,l),c=Ze(i,o,l),u=N.create(r,a,c);e.setSelection(u)}return!0},Gy=n=>({state:e,dispatch:t})=>{const r=ne(n,e.schema);return Fp(r)(e,t)};function Oa(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(s=>e?.includes(s.type.name));n.tr.ensureMarks(r)}}const Yy=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:l,$to:a}=i,c=s.extensionManager.attributes,u=Wr(c,l.node().type.name,l.node().attrs);if(i instanceof w&&i.node.isBlock)return!l.parentOffset||!et(o,l.pos)?!1:(r&&(n&&Oa(t,s.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:cd(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=et(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&et(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(i instanceof N&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),m=e.doc.resolve(g);l.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}n&&Oa(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return p},Xy=(n,e={})=>({tr:t,state:r,dispatch:s,editor:i})=>{const o=ne(n,r.schema),{$from:l,$to:a}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const u=l.node(-1);if(u.type!==o)return!1;const d=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(s){var f;let y=S.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let D=l.depth-b;D>=l.depth-3;D-=1)y=S.from(l.node(D).copy(y));const x=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,C={...Wr(d,l.node().type.name,l.node().attrs),...e},T=((f=o.contentMatch.defaultType)===null||f===void 0?void 0:f.createAndFill(C))||void 0;y=y.append(S.from(o.createAndFill(null,T)||void 0));const A=l.before(l.depth-(b-1));t.replace(A,l.after(-x),new E(y,4-b,0));let v=-1;t.doc.nodesBetween(A,t.doc.content.size,(D,R)=>{if(v>-1)return!1;D.isTextblock&&D.content.size===0&&(v=R+1)}),v>-1&&t.setSelection(N.near(t.doc.resolve(v))),t.scrollIntoView()}return!0}const h=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...Wr(d,u.type.name,u.attrs),...e},g={...Wr(d,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,a.pos);const m=h?[{type:o,attrs:p},{type:h,attrs:g}]:[{type:o,attrs:p}];if(!et(t.doc,l.pos,2))return!1;if(s){const{selection:y,storedMarks:b}=r,{splittableMarks:x}=i.extensionManager,C=b||y.$to.parentOffset&&y.$from.marks();if(t.split(l.pos,2,m).scrollIntoView(),!C||!s)return!0;const T=C.filter(A=>x.includes(A.type.name));t.ensureMarks(T)}return!0};function Da(n){return!n||n==="1"?null:n}function Cd(n,e){return Da(n)===Da(e)}const mi=(n,e)=>{const t=qs(i=>i.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 s=n.doc.nodeAt(r);return!(t.node.type===s?.type&&Tt(n.doc,t.pos))||!Cd(t.node.attrs.type,s?.attrs.type)||n.join(t.pos),!0},gi=(n,e)=>{const t=qs(i=>i.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 s=n.doc.nodeAt(r);return!(t.node.type===s?.type&&Tt(n.doc,r))||!Cd(t.node.attrs.type,s?.attrs.type)||n.join(r),!0};function Qy(n){const e=n.doc,t=e.firstChild;if(!t)return null;const r=e.resolve(1),s=e.resolve(t.nodeSize-1);return N.between(r,s)}const Zy=(n,e,t,r={})=>({editor:s,tr:i,state:o,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=s.extensionManager,h=ne(n,o.schema),p=ne(e,o.schema),{selection:g,storedMarks:m}=o,{$from:y,$to:b}=g,x=y.blockRange(b),C=m||g.$to.parentOffset&&g.$from.marks();if(!x)return!1;const T=qs(L=>pi(L.type.name,d))(g),A=g.from===0&&g.to===o.doc.content.size,v=o.doc.content.content,D=v.length===1?v[0]:null,R=A&&D&&pi(D.type.name,d)?{node:D,pos:0}:null,j=T??R,K=!!T&&x.depth>=1&&x.depth-T.depth<=1,U=!!R;if((K||U)&&j){if(j.node.type===h)return A&&U?a().command(({tr:L,dispatch:B})=>{const z=Qy(L);return z?(L.setSelection(z),B&&B(L),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(pi(j.node.type.name,d)&&h.validContent(j.node.content))return a().command(()=>(i.setNodeMarkup(j.pos,h),!0)).command(()=>mi(i,h)).command(()=>gi(i,h)).run()}return!t||!C||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>mi(i,h)).command(()=>gi(i,h)).run():a().command(()=>{const L=u().wrapInList(h,r),B=C.filter(z=>f.includes(z.type.name));return i.ensureMarks(B),L?!0:c.clearNodes()}).wrapInList(h,r).command(()=>mi(i,h)).command(()=>gi(i,h)).run()},e0=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=t,o=it(n,r.schema);return Qi(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},t0=(n,e,t={})=>({state:r,commands:s})=>{const i=ne(n,r.schema),o=ne(e,r.schema),l=nt(r,i,t);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?s.setNode(o,a):s.setNode(i,{...a,...t})},n0=(n,e={})=>({state:t,commands:r})=>{const s=ne(n,t.schema);return nt(t,s,e)?r.lift(s):r.wrapIn(s,e)},r0=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const s=t[r];let i;if(s.spec.isInputRules&&(i=s.getState(n))){if(e){const o=n.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else o.delete(i.from,i.to)}return!0}}return!1},s0=(n={})=>({tr:e,dispatch:t,editor:r})=>{const{ignoreClearable:s=!1}=n,{selection:i}=e,{empty:o,ranges:l}=i;if(o)return!0;const{nonClearableMarks:a}=r.extensionManager;if(t){const c=Object.values(r.schema.marks).filter(u=>s||!a.includes(u.name));l.forEach(u=>{for(const d of c)e.removeMark(u.$from.pos,u.$to.pos,d)})}return!0},i0=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:o}=t,l=it(n,r.schema),{$from:a,empty:c,ranges:u}=o;if(!s)return!0;if(c&&i){var d;let{from:f,to:h}=o;const p=Vo(a,l,(d=a.marks().find(g=>g.type===l))===null||d===void 0?void 0:d.attrs);p&&(f=p.from,h=p.to),t.removeMark(f,h,l)}else u.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},o0=n=>({tr:e,state:t,dispatch:r})=>{const{selection:s}=t;let i,o;return typeof n=="number"?(i=n,o=n):n&&"from"in n&&"to"in n?(i=n.from,o=n.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(l,a)=>{if(l.isText)return;const c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},l0=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const l=Us(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(i=ne(n,r.schema)),l==="mark"&&(o=it(n,r.schema));let a=!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)=>{i&&i===m.type&&(a=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m)}):r.doc.nodesBetween(u,d,(m,y)=>{y<u&&i&&i===m.type&&(a=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m),y>=u&&y<=d&&(i&&i===m.type&&(a=!0,s&&t.setNodeMarkup(y,void 0,{...m.attrs,...e})),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type&&(a=!0,s)){const x=Math.max(y,u),C=Math.min(y+m.nodeSize,d);t.addMark(x,C,o.create({...b.attrs,...e}))}}))}),h&&(f!==void 0&&s&&t.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&s&&t.addMark(p,g,o.create({...m.attrs,...e}))}))}),a},un=new te("__tiptap_decorations__"),a0=n=>({tr:e,dispatch:t})=>(t&&e.setMeta(un,{type:"force",name:n}),!0),c0=(n,e={})=>({state:t,dispatch:r})=>{const s=ne(n,t.schema);return Rp(s,e)(t,r)},u0=(n,e={})=>({state:t,dispatch:r})=>{const s=ne(n,t.schema);return Ip(s,e)(t,r)};var d0=Th({blur:()=>Dg,clearContent:()=>Rg,clearNodes:()=>Ig,command:()=>Pg,createParagraphNear:()=>Lg,cut:()=>$g,deleteCurrentNode:()=>zg,deleteNode:()=>Bg,deleteRange:()=>Fg,deleteSelection:()=>Vg,enter:()=>Wg,exitCode:()=>Kg,extendMarkRange:()=>_g,first:()=>Ug,focus:()=>Jg,forEach:()=>Gg,insertContent:()=>Yg,insertContentAt:()=>Xg,insertDefaultBlock:()=>Qg,joinBackward:()=>ty,joinDown:()=>ey,joinForward:()=>ny,joinItemBackward:()=>ry,joinItemForward:()=>sy,joinTextblockBackward:()=>iy,joinTextblockForward:()=>oy,joinUp:()=>Zg,keyboardShortcut:()=>ay,lift:()=>cy,liftEmptyBlock:()=>uy,liftListItem:()=>dy,newlineInCode:()=>fy,resetAttributes:()=>hy,scrollIntoView:()=>py,selectAll:()=>my,selectNodeBackward:()=>gy,selectNodeForward:()=>yy,selectParentNode:()=>by,selectTextblockEnd:()=>ky,selectTextblockStart:()=>xy,setContent:()=>Sy,setMark:()=>Wy,setMeta:()=>Ky,setNode:()=>_y,setNodeSelection:()=>Uy,setTextDirection:()=>qy,setTextSelection:()=>Jy,sinkListItem:()=>Gy,splitBlock:()=>Yy,splitListItem:()=>Xy,toggleList:()=>Zy,toggleMark:()=>e0,toggleNode:()=>t0,toggleWrap:()=>n0,undoInputRule:()=>r0,unsetAllMarks:()=>s0,unsetMark:()=>i0,unsetTextDirection:()=>o0,updateAttributes:()=>l0,updateDecorations:()=>a0,wrapIn:()=>c0,wrapInList:()=>u0});const An=new WeakMap;function f0(n,e){var t;An.set(n,((t=An.get(n))!==null&&t!==void 0?t:0)+1);try{return e()}finally{var r;const s=((r=An.get(n))!==null&&r!==void 0?r:1)-1;s>0?An.set(n,s):An.delete(n)}}var h0=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={}}};function p0(n){return n.kind==="widget"}function Md(n,e){const t=[],r=new Set;for(const s of n)s.kind==="widget"&&p0(s)&&r.add(s.key),t.push(s.toPMDecoration(e));return{decorations:t,widgetKeys:r}}function m0(n,e,t){const{decorations:r,widgetKeys:s}=Md(e,t);return{set:G.create(n,r),widgetKeys:s}}function Td({position:n,from:e,to:t,docSize:r}){return n<e?!1:n<t?!0:n===t&&t===r}function g0({decorations:n,from:e,to:t,docSize:r,extensionName:s,warnedExtensions:i}){return n.filter(o=>Td({position:o.anchor,from:e,to:t,docSize:r})?!0:(o.anchor===t||i.has(s)||(i.add(s),console.warn(`[tiptap warn]: Extension "${s}" returned a decoration outside the requested range [${e}, ${t}). It was ignored.`)),!1))}function y0(n){var e;const t=(e=n.spec)===null||e===void 0?void 0:e.key;return typeof t=="string"?t:void 0}function Ed(n){return n.jsonID==="attr"}function b0(n){let e=!1;if(n.getMap().forEach(()=>{e=!0}),e||Ed(n))return!0;const t=n;return typeof t.from=="number"&&typeof t.to=="number"}function k0(n,e){let t=null,r=0,s=0;for(let i=0;i<n.childCount&&!(s>e.to);i+=1){const o=s+n.child(i).nodeSize;o>=e.from&&(t===null&&(t=s),r=o),s=o}return t===null?null:{from:t,to:r}}function x0(n,e){if(n.steps.some(i=>!b0(i)))return{type:"full"};const t=Js(n).map(({newRange:i})=>i);n.steps.forEach((i,o)=>{if(!Ed(i))return;const l=n.mapping.slice(o);t.push({from:l.map(i.pos,-1),to:l.map(i.pos+1)})});const r=[];for(const i of t){const o=k0(e,i);o&&r.push(o)}r.sort((i,o)=>i.from-o.from);const s=[];for(const i of r){const o=s[s.length-1];o&&i.from<=o.to?o.to=Math.max(o.to,i.to):s.push({...i})}return{type:"ranges",ranges:s}}function wd(n,e,t,r){return n.map(e,t,{onRemove:s=>{const i=s?.key;typeof i=="string"&&r.delete(i)}})}function S0(n,e,t){var r,s;const i=(r=e.decorationSetsByExtension[n])!==null&&r!==void 0?r:G.empty,o=new Set((s=e.widgetKeysByExtension[n])!==null&&s!==void 0?s:[]);return{set:wd(i,t.mapping,t.doc,o),widgetKeys:o}}function Ra(n,e){const t=Object.values(e).flatMap(r=>r.find());return G.create(n,t)}function Ia(n){const e=new Set;for(const t of Object.values(n))for(const r of t)e.add(r);return e}function C0(n,e){var t;switch((t=e.update)!==null&&t!==void 0?t:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${n}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${n}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function M0(n,e,t){return t?!0:n.update==="manual"?!1:n.shouldUpdate?n.shouldUpdate(e):e.tr.docChanged}const T0=new Set;var E0=class{constructor(n){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const t=un.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=n.editor,this.entries=this.resolveEntries(n.entries),this.entries.forEach(({name:e,spec:t})=>C0(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var n,e;return(n=(e=un.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&n!==void 0?n:T0}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(n){const e=[];for(const{name:t,addDecorations:r}of n){const s=r();s&&e.push({name:t,spec:s})}return e}createPlugin(){const{editor:n,entries:e}=this;return new W({key:un,state:{init:(t,r)=>{const s={},i={};for(const{name:l,spec:a}of e){const{set:c,widgetKeys:u}=this.buildFullSet(l,a,r);s[l]=c,i[l]=u}const o={decorationSetsByExtension:s,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(r.doc,s),widgetKeys:Ia(i)};return this.warnDuplicateWidgetKeys(o),o},apply:(t,r,s,i)=>{const o=t.getMeta(un),l=o?.type==="force"&&!o.name,a=o?.type==="force"?o.name:void 0,c={},u={},d=new Set;return f0(n,()=>{for(const{name:f,spec:h}of e){const p=l||a===f;if(M0(h,{editor:n,tr:t,oldState:s,newState:i},p))if(h.update==="changedRanges"&&t.docChanged&&!p){const g=this.applyChangedRangesRecompute(f,h,r,t,i);c[f]=g.set,u[f]=g.widgetKeys,d.add(f)}else{const{set:g,widgetKeys:m}=this.buildFullSet(f,h,i);c[f]=g,u[f]=m,d.add(f)}else{const g=S0(f,r,t);c[f]=g.set,u[f]=g.widgetKeys}}}),d.size===0&&!t.docChanged?r:{decorationSetsByExtension:c,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:t,decorationSetsByExtension:c,recomputedNames:d}),widgetKeys:Ia(u)}}},props:{decorations(t){var r,s;return(r=(s=un.getState(t))===null||s===void 0?void 0:s.mergedDecorationSet)!==null&&r!==void 0?r:G.empty}}})}applyChangedRangesRecompute(n,e,t,r,s){const i=x0(r,s.doc);return i.type==="full"?this.buildFullSet(n,e,s):this.rebuildRanges(n,e,t,r,s,i.ranges)}rebuildRanges(n,e,t,r,s,i){var o,l;const a=(o=t.decorationSetsByExtension[n])!==null&&o!==void 0?o:G.empty,c=new Set((l=t.widgetKeysByExtension[n])!==null&&l!==void 0?l:[]);let u=wd(a,r.mapping,r.doc,c);const d=s.doc.content.size;for(const{from:f,to:h}of i){const p=u.find(f,h).filter(y=>Td({position:y.from,from:f,to:h,docSize:d}));for(const y of p){const b=y0(y);b&&c.delete(b)}u=u.remove(p);const{decorations:g,widgetKeys:m}=Md(g0({decorations:this.runCreate(n,"createInRange",()=>e.createInRange({editor:this.editor,state:s,view:this.mountedView,from:f,to:h})),from:f,to:h,docSize:d,extensionName:n,warnedExtensions:this.warnedOutOfRangeExtensions}),n);u=u.add(s.doc,g);for(const y of m)c.add(y)}return{set:u,widgetKeys:c}}buildFullSet(n,e,t){const r=this.runCreate(n,"create",()=>e.create({editor:this.editor,state:t,view:this.mountedView}));return m0(t.doc,r,n)}runCreate(n,e,t){try{return t()}catch(r){return console.error(`[tiptap error]: Extension "${n}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(n){}buildMergedSet(n,e){const t=Object.keys(e);return t.length===1?e[t[0]]:Ra(n,e)}mergeAfterApply({entries:n,previous:e,tr:t,decorationSetsByExtension:r,recomputedNames:s}){return n.length===1?r[n[0].name]:s.size===0?e.mergedDecorationSet.map(t.mapping,t.doc):Ra(t.doc,r)}};function w0(n,e){if(n===e)return!0;if(!n||!e)return!1;const t=Object.keys(n),r=Object.keys(e);return t.length!==r.length?!1:t.every(s=>Object.prototype.hasOwnProperty.call(e,s)&&Object.is(n[s],e[s]))}function v0(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof w){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}function N0(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(s),s}function BS(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function FS(n,e){const t=n.getAttribute("style");if(!t)return null;const r=t.split(";").map(i=>i.trim()).filter(Boolean),s=e.toLowerCase();for(let i=r.length-1;i>=0;i-=1){const o=r[i],l=o.indexOf(":");if(l!==-1&&o.slice(0,l).trim().toLowerCase()===s)return o.slice(l+1).trim()}return null}function jS(n){return n.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function HS(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A0(n){return typeof n=="number"}function O0(n){return Object.prototype.toString.call(n).slice(8,-1)}function Dr(n){return O0(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Pa(n,e,t){const r=n.split(`
13
13
  `),s=[];let i="",o=0;const l=e.baseIndentSize||2;for(;o<r.length;){const u=r[o],d=u.match(e.itemPattern);if(!d){if(s.length>0)break;if(u.trim()===""){o+=1,i=`${i}${u}
14
14
  `;continue}else return}const f=e.extractItemData(d),{indentLevel:h,mainContent:p}=f;i=`${i}${u}
15
15
  `;const g=[p];for(o+=1;o<r.length;){var a;const x=r[o];if(x.trim()===""){var c;const C=r.slice(o+1).findIndex(T=>T.trim()!=="");if(C===-1)break;if((((c=r[o+1+C].match(/^(\s*)/))===null||c===void 0||(c=c[1])===null||c===void 0?void 0:c.length)||0)>h){g.push(x),i=`${i}${x}
@@ -20,7 +20,7 @@ import{r as V,eE as Sc,eA as Yf,j as k,b3 as Xf,e1 as _t,eF as Qf,c as Yt,b as S
20
20
  `);l+=a.type==="paragraph"?`
21
21
 
22
22
  ${h}`:`
23
- ${h}`}}),l}function La(n){return typeof n.type=="string"?n.type:n.type.name}function WS(n,e){if(n.length!==e.length)return!1;const t=Array.from({length:e.length},()=>!1);return n.every(r=>{const s=La(r),i=e.findIndex((o,l)=>!t[l]&&s===La(o)&&w0(r.attrs,o.attrs));return i===-1?!1:(t[i]=!0,!0)})}function Nd(n,e){const t={...n};return Dr(n)&&Dr(e)&&Object.keys(e).forEach(r=>{Dr(e[r])&&Dr(n[r])?t[r]=Nd(n[r],e[r]):t[r]=e[r]}),t}function D0(n,e,t={}){const{state:r}=e,{doc:s,tr:i}=r,o=n;s.descendants((l,a)=>{const c=i.mapping.map(a),u=i.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(t).forEach(h=>{t[h]!==d.attrs[h]&&(f=!0)}),f){const h=n.type.create({...n.attrs,...t});i.removeMark(c,u,n.type),i.addMark(c,u,h)}}),i.docChanged&&e.view.dispatch(i)}var Mr=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!==null&&e!==void 0?e:!0}};const R0=(n,e)=>{if(Ho(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 Rr(n){var e;const{editor:t,from:r,to:s,text:i,rules:o,plugin:l}=n,{view:a}=t;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Ly(c)+i;return o.forEach(f=>{if(u)return;const h=R0(d,f.find);if(!h)return;const p=h[0].length-i.length;if(p>0){const T=c.parentOffset-p;if(T<0||c.parent.textBetween(T,c.parentOffset)!==h[0].slice(0,p))return}const g=a.state.tr,m=_s({state:a.state,transaction:g}),y={from:r-(h[0].length-i.length),to:s},{commands:b,chain:x,can:C}=new mn({editor:t,state:m});f.handler({state:m,range:y,match:h,commands:b,chain:x,can:C})===null||!g.steps.length||(f.undoable&&g.setMeta(l,{transform:g,from:r,to:s,text:i}),a.dispatch(g),u=!0)}),u}function I0(n){const{editor:e,rules:t}=n,r=new W({state:{init(){return null},apply(s,i,o){const l=s.getMeta(r);if(l)return l;const a=s.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=_o(S.from(c),o.schema);const{from:u}=a,d=u+c.length;Rr({editor:e,from:u,to:d,text:c,rules:t,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,l){return Rr({editor:e,from:i,to:o,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&Rr({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?Rr({editor:e,from:o.pos,to:o.pos,text:`
23
+ ${h}`}}),l}function La(n){return typeof n.type=="string"?n.type:n.type.name}function VS(n,e){if(n.length!==e.length)return!1;const t=Array.from({length:e.length},()=>!1);return n.every(r=>{const s=La(r),i=e.findIndex((o,l)=>!t[l]&&s===La(o)&&w0(r.attrs,o.attrs));return i===-1?!1:(t[i]=!0,!0)})}function Nd(n,e){const t={...n};return Dr(n)&&Dr(e)&&Object.keys(e).forEach(r=>{Dr(e[r])&&Dr(n[r])?t[r]=Nd(n[r],e[r]):t[r]=e[r]}),t}function D0(n,e,t={}){const{state:r}=e,{doc:s,tr:i}=r,o=n;s.descendants((l,a)=>{const c=i.mapping.map(a),u=i.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(t).forEach(h=>{t[h]!==d.attrs[h]&&(f=!0)}),f){const h=n.type.create({...n.attrs,...t});i.removeMark(c,u,n.type),i.addMark(c,u,h)}}),i.docChanged&&e.view.dispatch(i)}var Mr=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!==null&&e!==void 0?e:!0}};const R0=(n,e)=>{if(Ho(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 Rr(n){var e;const{editor:t,from:r,to:s,text:i,rules:o,plugin:l}=n,{view:a}=t;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Ly(c)+i;return o.forEach(f=>{if(u)return;const h=R0(d,f.find);if(!h)return;const p=h[0].length-i.length;if(p>0){const T=c.parentOffset-p;if(T<0||c.parent.textBetween(T,c.parentOffset)!==h[0].slice(0,p))return}const g=a.state.tr,m=_s({state:a.state,transaction:g}),y={from:r-(h[0].length-i.length),to:s},{commands:b,chain:x,can:C}=new mn({editor:t,state:m});f.handler({state:m,range:y,match:h,commands:b,chain:x,can:C})===null||!g.steps.length||(f.undoable&&g.setMeta(l,{transform:g,from:r,to:s,text:i}),a.dispatch(g),u=!0)}),u}function I0(n){const{editor:e,rules:t}=n,r=new W({state:{init(){return null},apply(s,i,o){const l=s.getMeta(r);if(l)return l;const a=s.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=_o(S.from(c),o.schema);const{from:u}=a,d=u+c.length;Rr({editor:e,from:u,to:d,text:c,rules:t,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,l){return Rr({editor:e,from:i,to:o,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&Rr({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?Rr({editor:e,from:o.pos,to:o.pos,text:`
24
24
  `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}var Jo=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{...$(O(this,"addOptions",{name:this.name}))}}get storage(){return{...$(O(this,"addStorage",{name:this.name,options:this.options}))}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Nd(this.options,n)});return e.name=this.name,e.parent=this.parent,this.child=null,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}},Xt=class Ad extends Jo{constructor(...e){super(...e),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Ad(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const i=s.marks();if(!i.find(l=>l?.type.name===t.name))return!1;const o=i.find(l=>l?.type.name===t.name);return o&&r.removeStoredMark(o),r.insertText(" ",s.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)}},Od=class{constructor(n){this.find=n.find,this.handler=n.handler}};const P0=(n,e,t)=>{if(Ho(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=n,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function L0(n){const{editor:e,state:t,from:r,to:s,rule:i,pasteEvent:o,dropEvent:l}=n,{commands:a,chain:c,can:u}=new mn({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,s,(f,h)=>{var p,g,m,y;if(!((p=f.type)===null||p===void 0||(p=p.spec)===null||p===void 0)&&p.code||!(f.isText||f.isTextblock||f.isInline))return;const b=(g=(m=(y=f.content)===null||y===void 0?void 0:y.size)!==null&&m!==void 0?m:f.nodeSize)!==null&&g!==void 0?g:0,x=Math.max(r,h),C=Math.min(s,h+b);if(x>=C)return;const T=f.isText?f.text||"":f.textBetween(x-h,C-h,void 0,"");P0(T,i.find,o).forEach(A=>{if(A.index===void 0)return;const v=x+A.index+1,D=v+A[0].length,R={from:t.tr.mapping.map(v),to:t.tr.mapping.map(D)},j=i.handler({state:t,range:R,match:A,commands:a,chain:c,can:u,pasteEvent:o,dropEvent:l});d.push(j)})}),d.every(f=>f!==null)}let Ir=null;const $0=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function z0(n){const{editor:e,rules:t}=n;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:c,from:u,to:d,rule:f,pasteEvt:h})=>{const p=c.tr,g=_s({state:c,transaction:p});if(!(!L0({editor:e,state:g,from:Math.max(u-1,0),to:d.b-1,rule:f,pasteEvent:h,dropEvent:l})||!p.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,p}};return t.map(c=>new W({view(u){const d=h=>{var p;r=!((p=u.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?u.dom.parentElement:null,r&&(Ir=e)},f=()=>{Ir&&(Ir=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,d)=>{if(i=r===u.dom.parentElement,l=d,!i){const f=Ir;f?.isEditable&&setTimeout(()=>{const h=f.state.selection;h&&f.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(u,d)=>{var f;const h=(f=d.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return o=d,s=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(u,d,f)=>{const h=u[0],p=h.getMeta("uiEvent")==="paste"&&!s,g=h.getMeta("uiEvent")==="drop"&&!i,m=h.getMeta("applyPasteRules"),y=!!m;if(!p&&!g&&!y)return;if(y){let{text:C}=m;typeof C=="string"?C=C:C=_o(S.from(C),f.schema);const{from:T}=m,A=T+C.length,v=$0(C);return a({rule:c,state:f,from:T,to:{b:A},pasteEvt:v})}const b=d.doc.content.findDiffStart(f.doc.content),x=d.doc.content.findDiffEnd(f.doc.content);if(!(!A0(b)||!x||b===x.b))return a({rule:c,state:f,from:b,to:x,pasteEvt:o})}}))}var Gs=class{constructor(n,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=n,this.extensions=Uo(n),this.schema=md(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t=O(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:sn(e.name,this.schema)});return t?{...n,...t()}:n},{})}get plugins(){const{editor:n}=this,e=Kn([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:sn(r.name,this.schema)},i=[],o=O(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&O(r,"exitable",s)&&(l.ArrowRight=()=>Xt.handleExit({editor:n,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,p])=>[h,()=>p({editor:n})]));l={...l,...f}}const a=Og(l);i.push(a);const c=O(r,"addInputRules",s);if(Aa(r,n.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=I0({editor:n,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}const u=O(r,"addPasteRules",s);if(Aa(r,n.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=z0({editor:n,rules:f});i.push(...h)}}const d=O(r,"addProseMirrorPlugins",s);if(d){const f=d();i.push(...f)}return i}),t=this.createDecorationPlugin();return t&&e.push(t),e}createDecorationPlugin(){var n;const{editor:e}=this;(n=this.decorationManager)===null||n===void 0||n.destroy();const t=[];return this.extensions.forEach(r=>{const s=O(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:sn(r.name,this.schema)});s&&t.push({name:r.name,addDecorations:s})}),this.decorationManager=new E0({editor:e,entries:t}),this.decorationManager.plugin}get attributes(){return pd(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Cn(this.extensions);return Object.fromEntries(e.filter(t=>!!O(t,"addNodeView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),s=O(t,"addNodeView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:ne(t.name,this.schema)});if(!s)return[];const i=s();if(!i)return[];const o=(l,a,c,u,d)=>{const f=Mn(l,r);return i({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:n,extension:t,HTMLAttributes:f})};return[t.name,o]}))}dispatchTransaction(n){const{editor:e}=this;return Kn([...this.extensions].reverse()).reduceRight((t,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:sn(r.name,this.schema)},i=O(r,"dispatchTransaction",s);return i?o=>{i.call(s,{transaction:o,next:t})}:t},n)}transformPastedHTML(n){const{editor:e}=this;return Kn([...this.extensions]).reduce((t,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:sn(r.name,this.schema)},i=O(r,"transformPastedHTML",s);return i?(o,l)=>{const a=t(o,l);return i.call(s,a)}:t},n||(t=>t))}get markViews(){const{editor:n}=this,{markExtensions:e}=Cn(this.extensions);return Object.fromEntries(e.filter(t=>!!O(t,"addMarkView")).map(t=>{const r=this.attributes.filter(o=>o.type===t.name),s=O(t,"addMarkView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:it(t.name,this.schema)});if(!s)return[];const i=(o,l,a)=>{const c=Mn(o,r);return s()({mark:o,view:l,inline:a,editor:n,extension:t,HTMLAttributes:c,updateAttributes:u=>{D0(o,n,u)}})};return[t.name,i]}))}destroy(){var n;(n=this.decorationManager)===null||n===void 0||n.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){const r=t.parent;r.child===t&&(r.child=null),t=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:sn(e.name,this.schema)};if(e.type==="mark"){var r,s;(!((r=$(O(e,"keepOnSplit",t)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((s=$(O(e,"clearable",t)))!==null&&s!==void 0)||s||this.nonClearableMarks.push(e.name)}const i=O(e,"onBeforeCreate",t),o=O(e,"onCreate",t),l=O(e,"onUpdate",t),a=O(e,"onSelectionUpdate",t),c=O(e,"onTransaction",t),u=O(e,"onFocus",t),d=O(e,"onBlur",t),f=O(e,"onDestroy",t);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};Gs.resolve=Uo;Gs.sort=Kn;Gs.flatten=Ko;var Y=class Dd extends Jo{constructor(...e){super(...e),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Dd(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};const B0=Y.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new W({key:new te("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:s}=e,i=yd(t),{blockSeparator:o}=this.options,l={...o!==void 0?{blockSeparator:o}:{},textSerializers:i};return[...s.ranges].sort((a,c)=>a.$from.pos-c.$from.pos).map(({$from:a,$to:c})=>gd(r,{from:a.pos,to:c.pos},l)).join(o??`
25
25
 
26
26
  `)}}})]}}),F0=Y.create({name:"commands",addCommands(){return{...d0}}}),j0=Y.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r;const s=()=>{var i,o,l;if((i=(o=this.editor.options.coreExtensionOptions)===null||o===void 0||(o=o.delete)===null||o===void 0||(l=o.filterTransaction)===null||l===void 0?void 0:l.call(o,n))!==null&&i!==void 0?i:n.getMeta("y-sync$"))return;const a=fd(n.before,[n,...e]);Js(a).forEach(u=>{a.mapping.mapResult(u.oldRange.from).deletedAfter&&a.mapping.mapResult(u.oldRange.to).deletedBefore&&a.before.nodesBetween(u.oldRange.from,u.oldRange.to,(d,f)=>{const h=f+d.nodeSize-2,p=u.oldRange.from<=f&&h<=u.oldRange.to;this.editor.emit("delete",{type:"node",node:d,from:f,to:h,newFrom:a.mapping.map(f),newTo:a.mapping.map(h),deletedRange:u.oldRange,newRange:u.newRange,partial:!p,editor:this.editor,transaction:n,combinedTransform:a})})});const c=a.mapping;a.steps.forEach((u,d)=>{if(u instanceof Ie){var f,h;const p=c.slice(d).map(u.from,-1),g=c.slice(d).map(u.to),m=c.invert().map(p,-1),y=c.invert().map(g),b=p>0?(f=a.doc.nodeAt(p-1))===null||f===void 0?void 0:f.marks.some(C=>C.eq(u.mark)):!1,x=(h=a.doc.nodeAt(g))===null||h===void 0?void 0:h.marks.some(C=>C.eq(u.mark));this.editor.emit("delete",{type:"mark",mark:u.mark,from:u.from,to:u.to,deletedRange:{from:m,to:y},newRange:{from:p,to:g},partial:!!(x||b),editor:this.editor,transaction:n,combinedTransform:a})}})};!((t=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&t!==void 0)||t?setTimeout(s,0):s()}}),H0=Y.create({name:"drop",addProseMirrorPlugins(){return[new W({key:new te("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),V0=Y.create({name:"editable",addProseMirrorPlugins(){return[new W({key:new te("editable"),props:{editable:()=>this.editor.options.editable}})]}}),W0=new te("focusEvents"),K0=Y.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new W({key:W0,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}}}})]}}),_0=Y.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,m=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?m===d.pos:I.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...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 fr()||ud()?i:s},addProseMirrorPlugins(){return[new W({key:new te("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(h=>h.getMeta("composition")))return;const r=n.some(h=>h.docChanged)&&!e.doc.eq(t.doc),s=n.some(h=>h.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:l}=e.selection,a=I.atStart(e.doc).from,c=I.atEnd(e.doc).to;if(i||!(o===a&&l===c)||!Cr(t.doc))return;const u=t.tr,d=_s({state:t,transaction:u}),{commands:f}=new mn({editor:this.editor,state:d});if(f.clearNodes(),!!u.steps.length)return u}})]}}),U0=Y.create({name:"paste",addProseMirrorPlugins(){return[new W({key:new te("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),q0=Y.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new W({key:new te("tabindex"),props:{attributes:()=>{var n;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(n=this.options.value)!==null&&n!==void 0?n:"0"}}}})]}}),J0=Y.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Cn(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 W({key:new te("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}});let $a=!1;function G0(n){if($a)return;$a=!0;let e;try{e=X.fromJSON(n,{from:0,to:0}).slice.content}catch{return}e instanceof S||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var Y0=class zn{get name(){return this.node.type.name}constructor(e,t,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=s}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let 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 zn(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 zn(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 zn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const s=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,o=t.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!s&&!o&&a.depth<=this.depth)return;const c=new zn(a,this.editor,s,s||o?t:null);s&&(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,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(t).length>0){const i=s.node.attrs,o=Object.keys(t);for(let l=0;l<o.length;l+=1){const a=o[l];if(i[a]!==t[a])break}}else r=s;s=s.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(t);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(l=>t[l]===o.node.attrs[l])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,t,r))))}),s}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};const X0=`.ProseMirror {
@@ -95,7 +95,7 @@ img.ProseMirror-separator {
95
95
  display: block;
96
96
  }`;var Q0=class extends h0{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:jy,createMappablePosition:Hy},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:t,slice:r,moved:s})=>this.options.onDrop(t,r,s)),this.on("paste",({event:t,slice:r})=>this.options.onPaste(t,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const t=Gi(e,this.options.autofocus);this.editorState=Rt.create({doc:e,schema:this.schema,selection:t||void 0})}G0(this.schema),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){this.editorState=this.editorView.state;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?this.commandManager.chain():mn.createFakeChain()}can(){return this.commandManager?this.commandManager.can():mn.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=N0(X0,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=hd(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(s=>{const i=typeof s=="string"?`${s}$`:s.key;t=t.filter(o=>!o.key.startsWith(i))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const t=[...this.options.enableCoreExtensions?[V0,B0.configure({blockSeparator:(n=this.options.coreExtensionOptions)===null||n===void 0||(n=n.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),F0,K0,_0,q0.configure({value:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.tabindex)===null||e===void 0?void 0:e.value}),H0,U0,j0,J0.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new Gs(t,this)}createCommandManager(){this.commandManager=new mn({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=Xi(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;const t=Xi(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Rt.create({doc:t,schema:this.schema,selection:Gi(t,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return n}createView(n){const{editorProps:e,enableExtensionDispatchTransaction:t}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=t?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new td(n,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();const a=this.view.dom;a.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(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||u===void 0?void 0:u.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),s=t.includes(n),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!s)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 o=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=o?.getMeta("focus"),a=o?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),a&&this.emit("blur",{editor:this,event:a.event,transaction:o}),!(n.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return bd(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return $y(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return _o(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`
97
97
 
98
- `,textSerializers:t={}}=n||{};return Ay(this.state.doc,{blockSeparator:e,textSerializers:{...yd(this.schema),...t}})}get isEmpty(){return Cr(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var n,e;return(n=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&n!==void 0?n:!0}$node(n,e){var t;return((t=this.$doc)===null||t===void 0?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)===null||t===void 0?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n),t=n>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new Y0(e,this,!1,t)}get $doc(){return this.$pos(0)}};function Gt(n){return new Mr({find:n.find,handler:({state:e,range:t,match:r})=>{const s=$(n.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=t.from+l.indexOf(o),u=c+o.length;if(qo(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(h=>h===n.type&&h!==f.mark.type)).filter(f=>f.to>c).length)return null;u<t.to&&i.delete(u,t.to),c>t.from&&i.delete(t.from+a,c);const d=t.from+a+o.length;i.addMark(t.from+a,d,n.type.create(s||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function Z0(n){return new Mr({find:n.find,handler:({state:e,range:t,match:r})=>{const s=$(n.getAttributes,void 0,r)||{},{tr:i}=e,o=t.from;let l=t.to;const a=n.type.create(s);if(r[1]){let c=o+r[0].lastIndexOf(r[1]);c>l?c=l:l=c+r[1].length;const u=r[0][r[0].length-1];i.insertText(u,o+r[0].length-1),i.replaceWith(c,l,a)}else if(r[0]){const c=n.type.isInline?o:o-1;i.insert(c,n.type.create(s)).delete(i.mapping.map(o),i.mapping.map(l))}i.scrollIntoView()},undoable:n.undoable})}function Zi(n){return new Mr({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),i=$(n.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)},undoable:n.undoable})}function Tn(n){return new Mr({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const i=$(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),a=l&&wo(l,n.type,i);if(!a)return null;if(o.wrap(l,a),n.keepMarks&&n.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:f}=n.editor.extensionManager,h=d||u.$to.parentOffset&&u.$from.marks();if(h){const p=h.filter(g=>f.includes(g.type.name));o.ensureMarks(p)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(u,i).run()}const c=o.doc.resolve(t.from-1).nodeBefore;c&&c.type===n.type&&Tt(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,c))&&o.join(t.from-1)},undoable:n.undoable})}const e1=n=>"touches"in n;var KS=class{constructor(n){var e,t,r,s,i,o;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.clientX-this.startX,c=l.clientY-this.startY;this.handleResize(a,c)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)},this.node=n.node,this.editor=n.editor,this.element=n.element,this.element.draggable=!1,this.contentElement=n.contentElement,this.getPos=n.getPos,this.onResize=n.onResize,this.onCommit=n.onCommit,this.onUpdate=n.onUpdate,!((e=n.options)===null||e===void 0)&&e.min&&(this.minSize={...this.minSize,...n.options.min}),!((t=n.options)===null||t===void 0)&&t.max&&(this.maxSize=n.options.max),!(n==null||(r=n.options)===null||r===void 0)&&r.directions&&(this.directions=n.options.directions),!((s=n.options)===null||s===void 0)&&s.preserveAspectRatio&&(this.preserveAspectRatio=n.options.preserveAspectRatio),!((i=n.options)===null||i===void 0)&&i.className&&(this.classNames={container:n.options.className.container||"",wrapper:n.options.className.wrapper||"",handle:n.options.className.handle||"",resizing:n.options.className.resizing||""}),!((o=n.options)===null||o===void 0)&&o.createCustomHandle&&(this.createCustomHandle=n.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var n;return(n=this.contentElement)!==null&&n!==void 0?n:null}handleEditorUpdate(){const n=this.editor.isEditable;n!==this.lastEditableState&&(this.lastEditableState=n,n?n&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(n,e,t){return n.type!==this.node.type?!1:(this.node=n,this.onUpdate?this.onUpdate(n,e,t):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const n=document.createElement("div");return n.dataset.resizeContainer="",n.dataset.node=this.node.type.name,n.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(n.className=this.classNames.container),n.appendChild(this.wrapper),n}createWrapper(){const n=document.createElement("div");return n.style.position="relative",n.style.display="block",n.dataset.resizeWrapper="",this.classNames.wrapper&&(n.className=this.classNames.wrapper),n.appendChild(this.element),n}createHandle(n){const e=document.createElement("div");return e.dataset.resizeHandle=n,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(n,e){const t=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");t&&(n.style.top="0"),r&&(n.style.bottom="0"),s&&(n.style.left="0"),i&&(n.style.right="0"),(e==="top"||e==="bottom")&&(n.style.left="0",n.style.right="0"),(e==="left"||e==="right")&&(n.style.top="0",n.style.bottom="0")}attachHandles(){this.directions.forEach(n=>{let e;this.createCustomHandle?e=this.createCustomHandle(n):e=this.createHandle(n),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${n}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(n)),this.createCustomHandle||this.positionHandle(e,n),e.addEventListener("mousedown",t=>this.handleResizeStart(t,n)),e.addEventListener("touchstart",t=>this.handleResizeStart(t,n)),this.handleMap.set(n,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(n=>n.remove()),this.handleMap.clear()}applyInitialSize(){const n=this.node.attrs.width,e=this.node.attrs.height;n?(this.element.style.width=`${n}px`,this.initialWidth=n):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(n,e){n.preventDefault(),n.stopPropagation(),this.isResizing=!0,this.activeHandle=e,e1(n)?(this.startX=n.touches[0].clientX,this.startY=n.touches[0].clientY):(this.startX=n.clientX,this.startY=n.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(n,e){if(!this.activeHandle)return;const t=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,n,e),i=this.applyConstraints(r,s,t);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(n,e,t){let r=this.startWidth,s=this.startHeight;const i=n.includes("right"),o=n.includes("left"),l=n.includes("bottom"),a=n.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),l?s=this.startHeight+t:a&&(s=this.startHeight-t),(n==="right"||n==="left")&&(r=this.startWidth+(i?e:-e)),(n==="top"||n==="bottom")&&(s=this.startHeight+(l?t:-t)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,n):{width:r,height:s}}applyConstraints(n,e,t){var r,s;if(!t){var i,o;let c=Math.max(this.minSize.width,n),u=Math.max(this.minSize.height,e);return!((i=this.maxSize)===null||i===void 0)&&i.width&&(c=Math.min(this.maxSize.width,c)),!((o=this.maxSize)===null||o===void 0)&&o.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let l=n,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),!((r=this.maxSize)===null||r===void 0)&&r.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),!((s=this.maxSize)===null||s===void 0)&&s.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(n,e,t){const r=t==="left"||t==="right",s=t==="top"||t==="bottom";return r?{width:n,height:n/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:n,height:n/this.aspectRatio}}},be=class Rd extends Jo{constructor(...e){super(...e),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Rd(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},t1=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=()=>{try{return e.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(n){var e,t;const{view:r}=this.editor,s=n.target,i=s.nodeType===3?(e=s.parentElement)===null||e===void 0?void 0:e.closest("[data-drag-handle]"):s.closest("[data-drag-handle]");if(!this.dom||!((t=this.contentDOM)===null||t===void 0)&&t.contains(s)||!i)return;let o=0,l=0;if(this.dom!==i){var a,c,u,d;const b=this.dom.getBoundingClientRect(),x=i.getBoundingClientRect(),C=(a=n.offsetX)!==null&&a!==void 0?a:(c=n.nativeEvent)===null||c===void 0?void 0:c.offsetX,T=(u=n.offsetY)!==null&&u!==void 0?u:(d=n.nativeEvent)===null||d===void 0?void 0:d.offsetY;o=x.x-b.x+C,l=x.y-b.y+T}const f=this.dom.cloneNode(!0);try{const b=this.dom.getBoundingClientRect();f.style.width=`${Math.round(b.width)}px`,f.style.height=`${Math.round(b.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let h=null;try{var p;h=document.createElement("div"),h.style.position="absolute",h.style.top="-9999px",h.style.left="-9999px",h.style.pointerEvents="none",h.appendChild(f),document.body.appendChild(h),(p=n.dataTransfer)===null||p===void 0||p.setDragImage(f,o,l)}finally{h&&setTimeout(()=>{try{h?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const m=w.create(r.state.doc,g),y=r.state.tr.setSelection(m);r.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===void 0)&&e.contains(t))))return!1;const r=n.type.startsWith("drag"),s=n.type==="dragover"||n.type==="dragenter",i=n.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!i&&!r)return!0;const{isEditable:o}=this.editor,{isDragging:l}=this,a=!!this.node.type.spec.draggable,c=w.isSelectable(this.node),u=n.type==="copy",d=n.type==="paste",f=n.type==="cut",h=n.type==="mousedown";if(!a&&c&&r&&n.target===this.dom&&n.preventDefault(),a&&r&&!l&&n.target===this.dom)return n.preventDefault(),!1;if(a&&o&&!l&&h){const p=t.closest("[data-drag-handle]");p&&(this.dom===p||this.dom.contains(p))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||s||i||u||d||f||h&&c)}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"&&(fr()||Yi())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(e=>e.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 Mt(n){return new Od({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const i=$(n.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=t.to;if(l){const u=a.search(/\S/),d=t.from+a.indexOf(l),f=d+l.length;if(qo(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(p=>p===n.type&&p!==h.mark.type)).filter(h=>h.to>d).length)return null;f<t.to&&o.delete(f,t.to),d>t.from&&o.delete(t.from+u,d),c=t.from+u+l.length,o.addMark(t.from+u,c,n.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(n.type)}}})}const{getOwnPropertyNames:n1,getOwnPropertySymbols:r1}=Object,{hasOwnProperty:s1}=Object.prototype;function yi(n,e){return function(r,s,i){return n(r,s,i)&&e(r,s,i)}}function Pr(n){return function(t,r,s){if(!t||!r||typeof t!="object"||typeof r!="object")return n(t,r,s);const{cache:i}=s,o=i.get(t),l=i.get(r);if(o&&l)return o===r&&l===t;i.set(t,r),i.set(r,t);const a=n(t,r,s);return i.delete(t),i.delete(r),a}}function i1(n){return n?.[Symbol.toStringTag]}function za(n){return n1(n).concat(r1(n))}const o1=Object.hasOwn||((n,e)=>s1.call(n,e));function Qt(n,e){return n===e||!n&&!e&&n!==n&&e!==e}const l1="__v",a1="__o",c1="_owner",{getOwnPropertyDescriptor:Ba,keys:Fa}=Object;function u1(n,e){return n.byteLength===e.byteLength&&ns(new Uint8Array(n),new Uint8Array(e))}function d1(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 f1(n,e){return n.byteLength===e.byteLength&&ns(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function h1(n,e){return Qt(n.getTime(),e.getTime())}function p1(n,e){return n.name===e.name&&n.message===e.message&&n.cause===e.cause&&n.stack===e.stack}function m1(n,e){return n===e}function ja(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=n.entries();let o,l,a=0;for(;(o=i.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(s[d]){d++;continue}const f=o.value,h=l.value;if(t.equals(f[0],h[0],a,d,n,e,t)&&t.equals(f[1],h[1],f[0],h[0],n,e,t)){u=s[d]=!0;break}d++}if(!u)return!1;a++}return!0}const g1=Qt;function y1(n,e,t){const r=Fa(n);let s=r.length;if(Fa(e).length!==s)return!1;for(;s-- >0;)if(!Id(n,e,t,r[s]))return!1;return!0}function On(n,e,t){const r=za(n);let s=r.length;if(za(e).length!==s)return!1;let i,o,l;for(;s-- >0;)if(i=r[s],!Id(n,e,t,i)||(o=Ba(n,i),l=Ba(e,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function b1(n,e){return Qt(n.valueOf(),e.valueOf())}function k1(n,e){return n.source===e.source&&n.flags===e.flags}function Ha(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=n.values();let o,l;for(;(o=i.next())&&!o.done;){const a=e.values();let c=!1,u=0;for(;(l=a.next())&&!l.done;){if(!s[u]&&t.equals(o.value,l.value,o.value,l.value,n,e,t)){c=s[u]=!0;break}u++}if(!c)return!1}return!0}function ns(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 x1(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 Id(n,e,t,r){return(r===c1||r===a1||r===l1)&&(n.$$typeof||e.$$typeof)?!0:o1(e,r)&&t.equals(n[r],e[r],r,r,n,e,t)}const S1="[object ArrayBuffer]",C1="[object Arguments]",M1="[object Boolean]",T1="[object DataView]",E1="[object Date]",w1="[object Error]",v1="[object Map]",N1="[object Number]",A1="[object Object]",O1="[object RegExp]",D1="[object Set]",R1="[object String]",I1={"[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},P1="[object URL]",L1=Object.prototype.toString;function $1({areArrayBuffersEqual:n,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(m,y,b){if(m===y)return!0;if(m==null||y==null)return!1;const x=typeof m;if(x!==typeof y)return!1;if(x!=="object")return x==="number"?l(m,y,b):x==="function"?i(m,y,b):!1;const C=m.constructor;if(C!==y.constructor)return!1;if(C===Object)return a(m,y,b);if(Array.isArray(m))return e(m,y,b);if(C===Date)return r(m,y,b);if(C===RegExp)return u(m,y,b);if(C===Map)return o(m,y,b);if(C===Set)return d(m,y,b);const T=L1.call(m);if(T===E1)return r(m,y,b);if(T===O1)return u(m,y,b);if(T===v1)return o(m,y,b);if(T===D1)return d(m,y,b);if(T===A1)return typeof m.then!="function"&&typeof y.then!="function"&&a(m,y,b);if(T===P1)return h(m,y,b);if(T===w1)return s(m,y,b);if(T===C1)return a(m,y,b);if(I1[T])return f(m,y,b);if(T===S1)return n(m,y,b);if(T===T1)return t(m,y,b);if(T===M1||T===N1||T===R1)return c(m,y,b);if(p){let A=p[T];if(!A){const v=i1(m);v&&(A=p[v])}if(A)return A(m,y,b)}return!1}}function z1({circular:n,createCustomConfig:e,strict:t}){let r={areArrayBuffersEqual:u1,areArraysEqual:t?On:d1,areDataViewsEqual:f1,areDatesEqual:h1,areErrorsEqual:p1,areFunctionsEqual:m1,areMapsEqual:t?yi(ja,On):ja,areNumbersEqual:g1,areObjectsEqual:t?On:y1,arePrimitiveWrappersEqual:b1,areRegExpsEqual:k1,areSetsEqual:t?yi(Ha,On):Ha,areTypedArraysEqual:t?yi(ns,On):ns,areUrlsEqual:x1,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),n){const s=Pr(r.areArraysEqual),i=Pr(r.areMapsEqual),o=Pr(r.areObjectsEqual),l=Pr(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return r}function B1(n){return function(e,t,r,s,i,o,l){return n(e,t,l)}}function F1({circular:n,comparator:e,createState:t,equals:r,strict:s}){if(t)return function(l,a){const{cache:c=n?new WeakMap:void 0,meta:u}=t();return e(l,a,{cache:c,equals:r,meta:u,strict:s})};if(n)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,a){return e(l,a,i)}}const j1=wt();wt({strict:!0});wt({circular:!0});wt({circular:!0,strict:!0});wt({createInternalComparator:()=>Qt});wt({strict:!0,createInternalComparator:()=>Qt});wt({circular:!0,createInternalComparator:()=>Qt});wt({circular:!0,createInternalComparator:()=>Qt,strict:!0});function wt(n={}){const{circular:e=!1,createInternalComparator:t,createState:r,strict:s=!1}=n,i=z1(n),o=$1(i),l=t?t(o):B1(o);return F1({circular:e,comparator:o,createState:r,equals:l,strict:s})}const H1=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},V1=({contentComponent:n})=>{const e=Sc.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return k.jsx(k.Fragment,{children:Object.values(e)})};function W1(){const n=new Set;let e={},t=!1;const r=()=>{t||!n.size||(t=!0,queueMicrotask(()=>{t=!1,n.forEach(s=>s())}))};return{subscribe(s){return n.add(s),()=>{n.delete(s)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(s,i){e={...e,[s]:Qf.createPortal(i.reactElement,i.element,s)},r()},removeRenderer(s){const i={...e};delete i[s],e=i,r()}}}var K1=class extends _t.Component{constructor(n){super(n),this.editorContentRef=_t.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var n;const e=this.props.editor;if(e&&!e.isDestroyed&&(!((n=e.view.dom)===null||n===void 0)&&n.parentNode)){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=W1(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const n=this.props.editor;if(n){n.isEditorContentInitialized=!1,n.isDestroyed||n.view.setProps({nodeViews:{}}),n.contentComponent=null;try{var e;if(!(!((e=n.view.dom)===null||e===void 0)&&e.parentNode))return;const t=document.createElement("div");t.append(...n.view.dom.parentNode.childNodes),n.setOptions({element:t})}catch{}}}render(){const{editor:n,innerRef:e,...t}=this.props;return k.jsxs(k.Fragment,{children:[k.jsx("div",{ref:H1(e,this.editorContentRef),...t}),n?.contentComponent&&k.jsx(V1,{contentComponent:n.contentComponent})]})}};const _1=V.forwardRef((n,e)=>{const t=_t.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return _t.createElement(K1,{key:t,innerRef:e,...n})}),U1=_t.memo(_1),q1=typeof window<"u"?V.useLayoutEffect:V.useEffect;var J1=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){let e;const t=s=>{s?.transaction!==void 0&&s.transaction===e||(e=s?.transaction,this.transactionNumber+=1,this.subscribers.forEach(i=>i()))},r=this.editor;return r.on("transaction",t),r.on("update",t),()=>{r.off("transaction",t),r.off("update",t)}}}};function G1(n){var e;const[t]=V.useState(()=>new J1(n.editor)),r=Yf.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:j1);return q1(()=>t.watch(n.editor),[n.editor,t]),V.useDebugValue(r),r}const Y1=!1,Pd=typeof window>"u",X1=Pd||!!(typeof window<"u"&&window.next);var Q1=class Ld{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(){const e=this.options.current.immediatelyRender;let t=e??!0;return Pd?(t&&Y1&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),t=!1):X1&&e===void 0&&(t=!1),t?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...t)=>{var r,s;return(r=(s=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(s,...t)},onBlur:(...t)=>{var r,s;return(r=(s=this.options.current).onBlur)===null||r===void 0?void 0:r.call(s,...t)},onCreate:(...t)=>{var r,s;return(r=(s=this.options.current).onCreate)===null||r===void 0?void 0:r.call(s,...t)},onDestroy:(...t)=>{var r,s;return(r=(s=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(s,...t)},onFocus:(...t)=>{var r,s;return(r=(s=this.options.current).onFocus)===null||r===void 0?void 0:r.call(s,...t)},onSelectionUpdate:(...t)=>{var r,s;return(r=(s=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(s,...t)},onTransaction:(...t)=>{var r,s;return(r=(s=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(s,...t)},onUpdate:(...t)=>{var r,s;return(r=(s=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(s,...t)},onContentError:(...t)=>{var r,s;return(r=(s=this.options.current).onContentError)===null||r===void 0?void 0:r.call(s,...t)},onDrop:(...t)=>{var r,s;return(r=(s=this.options.current).onDrop)===null||r===void 0?void 0:r.call(s,...t)},onPaste:(...t)=>{var r,s;return(r=(s=this.options.current).onPaste)===null||r===void 0?void 0:r.call(s,...t)},onDelete:(...t)=>{var r,s;return(r=(s=this.options.current).onDelete)===null||r===void 0?void 0:r.call(s,...t)},onMount:(...t)=>{var r,s;return(r=(s=this.options.current).onMount)===null||r===void 0?void 0:r.call(s,...t)},onUnmount:(...t)=>{var r,s;return(r=(s=this.options.current).onUnmount)===null||r===void 0?void 0:r.call(s,...t)}};return new Q0(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((s,i)=>{var o;return s===((o=t.extensions)===null||o===void 0?void 0:o[i])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Ld.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((t,r)=>t===e[r]))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 _S(n={},e=[]){const t=V.useRef(n);t.current=n;const[r]=V.useState(()=>new Q1(t)),s=Sc.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return V.useDebugValue(s),V.useEffect(r.onRender(e)),G1({editor:s,selector:({transactionNumber:i})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&i===0?0:i+1}),s}const Go=V.createContext({editor:null});Go.Consumer;const US=()=>V.useContext(Go),$d=V.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Z1=()=>V.useContext($d),zd=_t.forwardRef((n,e)=>{const{onDragStart:t}=Z1(),r=n.as||"div";return k.jsx(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function Va(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function Wa(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.forward_ref)"||n.$$typeof.description==="react.forward_ref"))}function eb(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.memo)"||n.$$typeof.description==="react.memo"))}function tb(n){if(Va(n)||Wa(n))return!0;if(eb(n)){const e=n.type;if(e)return Va(e)||Wa(e)}return!1}function nb(){try{if(V.version)return parseInt(V.version.split(".")[0],10)>=19}catch{}return!1}var rb=class{constructor(n,{editor:e,props:t={},as:r="div",className:s=""}){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"),s&&this.element.classList.add(...s.split(" ")),this.editor.isEditorContentInitialized?Xf.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,s=nb(),i=tb(e),o={...t};o.ref&&!(s||i)&&delete o.ref,!o.ref&&(s||i)&&(o.ref=l=>{this.ref=l}),this.reactElement=k.jsx(e,{...o}),r==null||(n=r.contentComponent)===null||n===void 0||n.setRenderer(this.id,this)}updateProps(n={}){if(this.destroyed)return;let e=!1;const t=Object.keys(n);for(let r=0;r<t.length;r+=1){const s=t[r];if(n[s]!==this.props[s]){e=!0;break}}e&&(this.props={...this.props,...n},this.render())}destroy(){var n;this.destroyed=!0;const e=this.editor;e==null||(n=e.contentComponent)===null||n===void 0||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])})}};_t.createContext({markViewContentRef:()=>{}});function sb(n){var e;const t=n.getRootNode(),r=typeof t.getSelection=="function"?t.getSelection():(e=n.ownerDocument)===null||e===void 0||(e=e.defaultView)===null||e===void 0?void 0:e.getSelection();if(!r||r.rangeCount===0)return null;const{anchorNode:s,anchorOffset:i,focusNode:o,focusOffset:l}=r;return!s||!o||!n.contains(s)||!n.contains(o)?null:()=>{try{r.setBaseAndExtent(s,i,o,l)}catch{}}}var ib=class extends t1{constructor(n,e,t){if(super(n,e,t),this.selectionRafId=null,this.handlePositionUpdate=()=>{const r=this.getPos();typeof r!="number"||r===this.currentPos||(this.currentPos=r,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs=="function"&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");r?r.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const n=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(t,r,s){if(r==="storage"){var i;return(i=n.storage[e.name])!==null&&i!==void 0?i:{}}return Reflect.get(t,r,s)}})}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:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode(),ref:V.createRef()};if(!this.component.displayName){const a=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=a(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:a=>{if(a&&this.contentDOMElement&&a.firstChild!==this.contentDOMElement){a.hasAttribute("data-node-view-wrapper")&&a.removeAttribute("data-node-view-wrapper");const c=sb(this.contentDOMElement);a.appendChild(this.contentDOMElement),c?.()}}},s=this.component,i=V.memo(a=>k.jsx($d.Provider,{value:r,children:V.createElement(s,a)}));i.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new rb(i,{editor:this.editor,props:n,as:o,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var n;if(this.renderer.element.firstElementChild&&!(!((n=this.renderer.element.firstElementChild)===null||n===void 0)&&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(()=>{var n;this.selectionRafId=null;const e=(n=this.getPos())!==null&&n!==void 0?n:this.currentPos;if(typeof e=="number")if(Fy({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(n,e,t){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(n.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,l=this.decorations,a=this.innerDecorations;return this.node=n,this.decorations=e,this.innerDecorations=t,this.currentPos=this.getPos(),this.options.update({oldNode:o,oldDecorations:l,newNode:n,newDecorations:e,oldInnerDecorations:a,innerDecorations:t,updateProps:()=>r({node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage})})}if(n===this.node)return this.node=n,this.decorations=e,this.innerDecorations=t,!0;const s=this.getPos();this.node=n,this.decorations=e,this.innerDecorations=t,this.currentPos=s;const i={node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(i.getPos=()=>this.getPos()),r(i),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let n={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,t=Mn(this.node,e);n=this.options.attrs({node:this.node,HTMLAttributes:t})}else n=this.options.attrs;this.renderer.updateAttributes(n)}}};function Bd(n,e){return t=>t.editor.contentComponent?new ib(n,t,e):{dom:document.createElement("span"),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}}const Yo=V.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Yo.displayName="TiptapContext";const ob=()=>V.useContext(Yo);function Fd({children:n,...e}){const t="editor"in e?e.editor:e.instance;if(!t)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=V.useMemo(()=>({editor:t}),[t]),s=V.useMemo(()=>({editor:t}),[t]);return k.jsx(Go.Provider,{value:s,children:k.jsx(Yo.Provider,{value:r,children:n})})}Fd.displayName="Tiptap";function jd({...n}){const{editor:e}=ob();return k.jsx(U1,{editor:e,...n})}jd.displayName="Tiptap.Content";Object.assign(Fd,{Content:jd});const Hd=new WeakSet,Vd=new WeakSet;function Nt(n){const e=n;return Hd.add(e),e}function eo(n){return Array.isArray(n)&&Hd.has(n)}function Wd(n){return n.flatMap(e=>e==null?[]:Array.isArray(e)&&Vd.has(e)&&!eo(e)?Wd(e):[e])}function lb(n,e){if(n==="slot")return 0;if(n instanceof Function){const s=n(e);return Array.isArray(s)&&!eo(s)&&!Vd.has(s)?Nt(s):s}const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(t)){if(eo(t))return Nt([n,r,t]);if(t.length===0)return Nt([n,r]);const s=Wd(t);return s.length===0?Nt([n,r]):Nt([n,r,...s])}return t!=null?Nt([n,r,t]):Nt([n,r])}const rs=(n,e)=>lb(n,e),ab=(n,e)=>{var t;const{state:r}=n,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0)return!1;const o=i.depth-1;if(o<0)return!1;const l=i.node(o),a=i.index(o);if(a===0)return!1;if(l.type===e)return n.commands.lift(e.name);const c=l.child(a-1);if(c.type!==e||!(!((t=c.lastChild)===null||t===void 0)&&t.isTextblock))return!1;const u=i.before()-1-1;return n.commands.command(({tr:d,dispatch:f})=>{if(!f)return!0;const h=i.parent.content,p=new E(h,0,0);return d.replace(u,i.after(),p),d.setSelection(N.create(d.doc,u+h.size)),d.scrollIntoView(),f(d),!0})},cb=/^\s*>\s$/,ub=be.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return rs("blockquote",{...ee(this.options.HTMLAttributes,n),children:rs("slot",{})})},parseMarkdown:(n,e)=>{var t;const r=(t=e.parseBlockChildren)!==null&&t!==void 0?t:e.parseChildren;return e.createNode("blockquote",void 0,r(n.tokens||[]))},renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach((s,i)=>{var o,l;const a=((o=(l=e.renderChild)===null||l===void 0?void 0:l.call(e,s,i))!==null&&o!==void 0?o:e.renderChildren([s])).split(`
98
+ `,textSerializers:t={}}=n||{};return Ay(this.state.doc,{blockSeparator:e,textSerializers:{...yd(this.schema),...t}})}get isEmpty(){return Cr(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var n,e;return(n=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&n!==void 0?n:!0}$node(n,e){var t;return((t=this.$doc)===null||t===void 0?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)===null||t===void 0?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n),t=n>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new Y0(e,this,!1,t)}get $doc(){return this.$pos(0)}};function Gt(n){return new Mr({find:n.find,handler:({state:e,range:t,match:r})=>{const s=$(n.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=t.from+l.indexOf(o),u=c+o.length;if(qo(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(h=>h===n.type&&h!==f.mark.type)).filter(f=>f.to>c).length)return null;u<t.to&&i.delete(u,t.to),c>t.from&&i.delete(t.from+a,c);const d=t.from+a+o.length;i.addMark(t.from+a,d,n.type.create(s||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function Z0(n){return new Mr({find:n.find,handler:({state:e,range:t,match:r})=>{const s=$(n.getAttributes,void 0,r)||{},{tr:i}=e,o=t.from;let l=t.to;const a=n.type.create(s);if(r[1]){let c=o+r[0].lastIndexOf(r[1]);c>l?c=l:l=c+r[1].length;const u=r[0][r[0].length-1];i.insertText(u,o+r[0].length-1),i.replaceWith(c,l,a)}else if(r[0]){const c=n.type.isInline?o:o-1;i.insert(c,n.type.create(s)).delete(i.mapping.map(o),i.mapping.map(l))}i.scrollIntoView()},undoable:n.undoable})}function Zi(n){return new Mr({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),i=$(n.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)},undoable:n.undoable})}function Tn(n){return new Mr({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const i=$(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),a=l&&wo(l,n.type,i);if(!a)return null;if(o.wrap(l,a),n.keepMarks&&n.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:f}=n.editor.extensionManager,h=d||u.$to.parentOffset&&u.$from.marks();if(h){const p=h.filter(g=>f.includes(g.type.name));o.ensureMarks(p)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(u,i).run()}const c=o.doc.resolve(t.from-1).nodeBefore;c&&c.type===n.type&&Tt(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,c))&&o.join(t.from-1)},undoable:n.undoable})}const e1=n=>"touches"in n;var WS=class{constructor(n){var e,t,r,s,i,o;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.clientX-this.startX,c=l.clientY-this.startY;this.handleResize(a,c)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)},this.node=n.node,this.editor=n.editor,this.element=n.element,this.element.draggable=!1,this.contentElement=n.contentElement,this.getPos=n.getPos,this.onResize=n.onResize,this.onCommit=n.onCommit,this.onUpdate=n.onUpdate,!((e=n.options)===null||e===void 0)&&e.min&&(this.minSize={...this.minSize,...n.options.min}),!((t=n.options)===null||t===void 0)&&t.max&&(this.maxSize=n.options.max),!(n==null||(r=n.options)===null||r===void 0)&&r.directions&&(this.directions=n.options.directions),!((s=n.options)===null||s===void 0)&&s.preserveAspectRatio&&(this.preserveAspectRatio=n.options.preserveAspectRatio),!((i=n.options)===null||i===void 0)&&i.className&&(this.classNames={container:n.options.className.container||"",wrapper:n.options.className.wrapper||"",handle:n.options.className.handle||"",resizing:n.options.className.resizing||""}),!((o=n.options)===null||o===void 0)&&o.createCustomHandle&&(this.createCustomHandle=n.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var n;return(n=this.contentElement)!==null&&n!==void 0?n:null}handleEditorUpdate(){const n=this.editor.isEditable;n!==this.lastEditableState&&(this.lastEditableState=n,n?n&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(n,e,t){return n.type!==this.node.type?!1:(this.node=n,this.onUpdate?this.onUpdate(n,e,t):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const n=document.createElement("div");return n.dataset.resizeContainer="",n.dataset.node=this.node.type.name,n.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(n.className=this.classNames.container),n.appendChild(this.wrapper),n}createWrapper(){const n=document.createElement("div");return n.style.position="relative",n.style.display="block",n.dataset.resizeWrapper="",this.classNames.wrapper&&(n.className=this.classNames.wrapper),n.appendChild(this.element),n}createHandle(n){const e=document.createElement("div");return e.dataset.resizeHandle=n,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(n,e){const t=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");t&&(n.style.top="0"),r&&(n.style.bottom="0"),s&&(n.style.left="0"),i&&(n.style.right="0"),(e==="top"||e==="bottom")&&(n.style.left="0",n.style.right="0"),(e==="left"||e==="right")&&(n.style.top="0",n.style.bottom="0")}attachHandles(){this.directions.forEach(n=>{let e;this.createCustomHandle?e=this.createCustomHandle(n):e=this.createHandle(n),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${n}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(n)),this.createCustomHandle||this.positionHandle(e,n),e.addEventListener("mousedown",t=>this.handleResizeStart(t,n)),e.addEventListener("touchstart",t=>this.handleResizeStart(t,n)),this.handleMap.set(n,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(n=>n.remove()),this.handleMap.clear()}applyInitialSize(){const n=this.node.attrs.width,e=this.node.attrs.height;n?(this.element.style.width=`${n}px`,this.initialWidth=n):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(n,e){n.preventDefault(),n.stopPropagation(),this.isResizing=!0,this.activeHandle=e,e1(n)?(this.startX=n.touches[0].clientX,this.startY=n.touches[0].clientY):(this.startX=n.clientX,this.startY=n.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(n,e){if(!this.activeHandle)return;const t=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,n,e),i=this.applyConstraints(r,s,t);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(n,e,t){let r=this.startWidth,s=this.startHeight;const i=n.includes("right"),o=n.includes("left"),l=n.includes("bottom"),a=n.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),l?s=this.startHeight+t:a&&(s=this.startHeight-t),(n==="right"||n==="left")&&(r=this.startWidth+(i?e:-e)),(n==="top"||n==="bottom")&&(s=this.startHeight+(l?t:-t)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,n):{width:r,height:s}}applyConstraints(n,e,t){var r,s;if(!t){var i,o;let c=Math.max(this.minSize.width,n),u=Math.max(this.minSize.height,e);return!((i=this.maxSize)===null||i===void 0)&&i.width&&(c=Math.min(this.maxSize.width,c)),!((o=this.maxSize)===null||o===void 0)&&o.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let l=n,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),!((r=this.maxSize)===null||r===void 0)&&r.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),!((s=this.maxSize)===null||s===void 0)&&s.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(n,e,t){const r=t==="left"||t==="right",s=t==="top"||t==="bottom";return r?{width:n,height:n/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:n,height:n/this.aspectRatio}}},be=class Rd extends Jo{constructor(...e){super(...e),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Rd(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},t1=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=()=>{try{return e.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(n){var e,t;const{view:r}=this.editor,s=n.target,i=s.nodeType===3?(e=s.parentElement)===null||e===void 0?void 0:e.closest("[data-drag-handle]"):s.closest("[data-drag-handle]");if(!this.dom||!((t=this.contentDOM)===null||t===void 0)&&t.contains(s)||!i)return;let o=0,l=0;if(this.dom!==i){var a,c,u,d;const b=this.dom.getBoundingClientRect(),x=i.getBoundingClientRect(),C=(a=n.offsetX)!==null&&a!==void 0?a:(c=n.nativeEvent)===null||c===void 0?void 0:c.offsetX,T=(u=n.offsetY)!==null&&u!==void 0?u:(d=n.nativeEvent)===null||d===void 0?void 0:d.offsetY;o=x.x-b.x+C,l=x.y-b.y+T}const f=this.dom.cloneNode(!0);try{const b=this.dom.getBoundingClientRect();f.style.width=`${Math.round(b.width)}px`,f.style.height=`${Math.round(b.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let h=null;try{var p;h=document.createElement("div"),h.style.position="absolute",h.style.top="-9999px",h.style.left="-9999px",h.style.pointerEvents="none",h.appendChild(f),document.body.appendChild(h),(p=n.dataTransfer)===null||p===void 0||p.setDragImage(f,o,l)}finally{h&&setTimeout(()=>{try{h?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const m=w.create(r.state.doc,g),y=r.state.tr.setSelection(m);r.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===void 0)&&e.contains(t))))return!1;const r=n.type.startsWith("drag"),s=n.type==="dragover"||n.type==="dragenter",i=n.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!i&&!r)return!0;const{isEditable:o}=this.editor,{isDragging:l}=this,a=!!this.node.type.spec.draggable,c=w.isSelectable(this.node),u=n.type==="copy",d=n.type==="paste",f=n.type==="cut",h=n.type==="mousedown";if(!a&&c&&r&&n.target===this.dom&&n.preventDefault(),a&&r&&!l&&n.target===this.dom)return n.preventDefault(),!1;if(a&&o&&!l&&h){const p=t.closest("[data-drag-handle]");p&&(this.dom===p||this.dom.contains(p))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||s||i||u||d||f||h&&c)}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"&&(fr()||Yi())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(e=>e.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 Mt(n){return new Od({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const i=$(n.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=t.to;if(l){const u=a.search(/\S/),d=t.from+a.indexOf(l),f=d+l.length;if(qo(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(p=>p===n.type&&p!==h.mark.type)).filter(h=>h.to>d).length)return null;f<t.to&&o.delete(f,t.to),d>t.from&&o.delete(t.from+u,d),c=t.from+u+l.length,o.addMark(t.from+u,c,n.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(n.type)}}})}const{getOwnPropertyNames:n1,getOwnPropertySymbols:r1}=Object,{hasOwnProperty:s1}=Object.prototype;function yi(n,e){return function(r,s,i){return n(r,s,i)&&e(r,s,i)}}function Pr(n){return function(t,r,s){if(!t||!r||typeof t!="object"||typeof r!="object")return n(t,r,s);const{cache:i}=s,o=i.get(t),l=i.get(r);if(o&&l)return o===r&&l===t;i.set(t,r),i.set(r,t);const a=n(t,r,s);return i.delete(t),i.delete(r),a}}function i1(n){return n?.[Symbol.toStringTag]}function za(n){return n1(n).concat(r1(n))}const o1=Object.hasOwn||((n,e)=>s1.call(n,e));function Qt(n,e){return n===e||!n&&!e&&n!==n&&e!==e}const l1="__v",a1="__o",c1="_owner",{getOwnPropertyDescriptor:Ba,keys:Fa}=Object;function u1(n,e){return n.byteLength===e.byteLength&&ns(new Uint8Array(n),new Uint8Array(e))}function d1(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 f1(n,e){return n.byteLength===e.byteLength&&ns(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function h1(n,e){return Qt(n.getTime(),e.getTime())}function p1(n,e){return n.name===e.name&&n.message===e.message&&n.cause===e.cause&&n.stack===e.stack}function m1(n,e){return n===e}function ja(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=n.entries();let o,l,a=0;for(;(o=i.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(s[d]){d++;continue}const f=o.value,h=l.value;if(t.equals(f[0],h[0],a,d,n,e,t)&&t.equals(f[1],h[1],f[0],h[0],n,e,t)){u=s[d]=!0;break}d++}if(!u)return!1;a++}return!0}const g1=Qt;function y1(n,e,t){const r=Fa(n);let s=r.length;if(Fa(e).length!==s)return!1;for(;s-- >0;)if(!Id(n,e,t,r[s]))return!1;return!0}function On(n,e,t){const r=za(n);let s=r.length;if(za(e).length!==s)return!1;let i,o,l;for(;s-- >0;)if(i=r[s],!Id(n,e,t,i)||(o=Ba(n,i),l=Ba(e,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function b1(n,e){return Qt(n.valueOf(),e.valueOf())}function k1(n,e){return n.source===e.source&&n.flags===e.flags}function Ha(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=n.values();let o,l;for(;(o=i.next())&&!o.done;){const a=e.values();let c=!1,u=0;for(;(l=a.next())&&!l.done;){if(!s[u]&&t.equals(o.value,l.value,o.value,l.value,n,e,t)){c=s[u]=!0;break}u++}if(!c)return!1}return!0}function ns(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 x1(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 Id(n,e,t,r){return(r===c1||r===a1||r===l1)&&(n.$$typeof||e.$$typeof)?!0:o1(e,r)&&t.equals(n[r],e[r],r,r,n,e,t)}const S1="[object ArrayBuffer]",C1="[object Arguments]",M1="[object Boolean]",T1="[object DataView]",E1="[object Date]",w1="[object Error]",v1="[object Map]",N1="[object Number]",A1="[object Object]",O1="[object RegExp]",D1="[object Set]",R1="[object String]",I1={"[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},P1="[object URL]",L1=Object.prototype.toString;function $1({areArrayBuffersEqual:n,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(m,y,b){if(m===y)return!0;if(m==null||y==null)return!1;const x=typeof m;if(x!==typeof y)return!1;if(x!=="object")return x==="number"?l(m,y,b):x==="function"?i(m,y,b):!1;const C=m.constructor;if(C!==y.constructor)return!1;if(C===Object)return a(m,y,b);if(Array.isArray(m))return e(m,y,b);if(C===Date)return r(m,y,b);if(C===RegExp)return u(m,y,b);if(C===Map)return o(m,y,b);if(C===Set)return d(m,y,b);const T=L1.call(m);if(T===E1)return r(m,y,b);if(T===O1)return u(m,y,b);if(T===v1)return o(m,y,b);if(T===D1)return d(m,y,b);if(T===A1)return typeof m.then!="function"&&typeof y.then!="function"&&a(m,y,b);if(T===P1)return h(m,y,b);if(T===w1)return s(m,y,b);if(T===C1)return a(m,y,b);if(I1[T])return f(m,y,b);if(T===S1)return n(m,y,b);if(T===T1)return t(m,y,b);if(T===M1||T===N1||T===R1)return c(m,y,b);if(p){let A=p[T];if(!A){const v=i1(m);v&&(A=p[v])}if(A)return A(m,y,b)}return!1}}function z1({circular:n,createCustomConfig:e,strict:t}){let r={areArrayBuffersEqual:u1,areArraysEqual:t?On:d1,areDataViewsEqual:f1,areDatesEqual:h1,areErrorsEqual:p1,areFunctionsEqual:m1,areMapsEqual:t?yi(ja,On):ja,areNumbersEqual:g1,areObjectsEqual:t?On:y1,arePrimitiveWrappersEqual:b1,areRegExpsEqual:k1,areSetsEqual:t?yi(Ha,On):Ha,areTypedArraysEqual:t?yi(ns,On):ns,areUrlsEqual:x1,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),n){const s=Pr(r.areArraysEqual),i=Pr(r.areMapsEqual),o=Pr(r.areObjectsEqual),l=Pr(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return r}function B1(n){return function(e,t,r,s,i,o,l){return n(e,t,l)}}function F1({circular:n,comparator:e,createState:t,equals:r,strict:s}){if(t)return function(l,a){const{cache:c=n?new WeakMap:void 0,meta:u}=t();return e(l,a,{cache:c,equals:r,meta:u,strict:s})};if(n)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,a){return e(l,a,i)}}const j1=wt();wt({strict:!0});wt({circular:!0});wt({circular:!0,strict:!0});wt({createInternalComparator:()=>Qt});wt({strict:!0,createInternalComparator:()=>Qt});wt({circular:!0,createInternalComparator:()=>Qt});wt({circular:!0,createInternalComparator:()=>Qt,strict:!0});function wt(n={}){const{circular:e=!1,createInternalComparator:t,createState:r,strict:s=!1}=n,i=z1(n),o=$1(i),l=t?t(o):B1(o);return F1({circular:e,comparator:o,createState:r,equals:l,strict:s})}const H1=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},V1=({contentComponent:n})=>{const e=Sc.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return k.jsx(k.Fragment,{children:Object.values(e)})};function W1(){const n=new Set;let e={},t=!1;const r=()=>{t||!n.size||(t=!0,queueMicrotask(()=>{t=!1,n.forEach(s=>s())}))};return{subscribe(s){return n.add(s),()=>{n.delete(s)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(s,i){e={...e,[s]:Qf.createPortal(i.reactElement,i.element,s)},r()},removeRenderer(s){const i={...e};delete i[s],e=i,r()}}}var K1=class extends _t.Component{constructor(n){super(n),this.editorContentRef=_t.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var n;const e=this.props.editor;if(e&&!e.isDestroyed&&(!((n=e.view.dom)===null||n===void 0)&&n.parentNode)){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=W1(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const n=this.props.editor;if(n){n.isEditorContentInitialized=!1,n.isDestroyed||n.view.setProps({nodeViews:{}}),n.contentComponent=null;try{var e;if(!(!((e=n.view.dom)===null||e===void 0)&&e.parentNode))return;const t=document.createElement("div");t.append(...n.view.dom.parentNode.childNodes),n.setOptions({element:t})}catch{}}}render(){const{editor:n,innerRef:e,...t}=this.props;return k.jsxs(k.Fragment,{children:[k.jsx("div",{ref:H1(e,this.editorContentRef),...t}),n?.contentComponent&&k.jsx(V1,{contentComponent:n.contentComponent})]})}};const _1=V.forwardRef((n,e)=>{const t=_t.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return _t.createElement(K1,{key:t,innerRef:e,...n})}),U1=_t.memo(_1),q1=typeof window<"u"?V.useLayoutEffect:V.useEffect;var J1=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){let e;const t=s=>{s?.transaction!==void 0&&s.transaction===e||(e=s?.transaction,this.transactionNumber+=1,this.subscribers.forEach(i=>i()))},r=this.editor;return r.on("transaction",t),r.on("update",t),()=>{r.off("transaction",t),r.off("update",t)}}}};function G1(n){var e;const[t]=V.useState(()=>new J1(n.editor)),r=Yf.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:j1);return q1(()=>t.watch(n.editor),[n.editor,t]),V.useDebugValue(r),r}const Y1=!1,Pd=typeof window>"u",X1=Pd||!!(typeof window<"u"&&window.next);var Q1=class Ld{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(){const e=this.options.current.immediatelyRender;let t=e??!0;return Pd?(t&&Y1&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),t=!1):X1&&e===void 0&&(t=!1),t?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...t)=>{var r,s;return(r=(s=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(s,...t)},onBlur:(...t)=>{var r,s;return(r=(s=this.options.current).onBlur)===null||r===void 0?void 0:r.call(s,...t)},onCreate:(...t)=>{var r,s;return(r=(s=this.options.current).onCreate)===null||r===void 0?void 0:r.call(s,...t)},onDestroy:(...t)=>{var r,s;return(r=(s=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(s,...t)},onFocus:(...t)=>{var r,s;return(r=(s=this.options.current).onFocus)===null||r===void 0?void 0:r.call(s,...t)},onSelectionUpdate:(...t)=>{var r,s;return(r=(s=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(s,...t)},onTransaction:(...t)=>{var r,s;return(r=(s=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(s,...t)},onUpdate:(...t)=>{var r,s;return(r=(s=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(s,...t)},onContentError:(...t)=>{var r,s;return(r=(s=this.options.current).onContentError)===null||r===void 0?void 0:r.call(s,...t)},onDrop:(...t)=>{var r,s;return(r=(s=this.options.current).onDrop)===null||r===void 0?void 0:r.call(s,...t)},onPaste:(...t)=>{var r,s;return(r=(s=this.options.current).onPaste)===null||r===void 0?void 0:r.call(s,...t)},onDelete:(...t)=>{var r,s;return(r=(s=this.options.current).onDelete)===null||r===void 0?void 0:r.call(s,...t)},onMount:(...t)=>{var r,s;return(r=(s=this.options.current).onMount)===null||r===void 0?void 0:r.call(s,...t)},onUnmount:(...t)=>{var r,s;return(r=(s=this.options.current).onUnmount)===null||r===void 0?void 0:r.call(s,...t)}};return new Q0(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((s,i)=>{var o;return s===((o=t.extensions)===null||o===void 0?void 0:o[i])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Ld.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((t,r)=>t===e[r]))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 KS(n={},e=[]){const t=V.useRef(n);t.current=n;const[r]=V.useState(()=>new Q1(t)),s=Sc.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return V.useDebugValue(s),V.useEffect(r.onRender(e)),G1({editor:s,selector:({transactionNumber:i})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&i===0?0:i+1}),s}const Go=V.createContext({editor:null});Go.Consumer;const _S=()=>V.useContext(Go),$d=V.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Z1=()=>V.useContext($d),zd=_t.forwardRef((n,e)=>{const{onDragStart:t}=Z1(),r=n.as||"div";return k.jsx(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function Va(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function Wa(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.forward_ref)"||n.$$typeof.description==="react.forward_ref"))}function eb(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.memo)"||n.$$typeof.description==="react.memo"))}function tb(n){if(Va(n)||Wa(n))return!0;if(eb(n)){const e=n.type;if(e)return Va(e)||Wa(e)}return!1}function nb(){try{if(V.version)return parseInt(V.version.split(".")[0],10)>=19}catch{}return!1}var rb=class{constructor(n,{editor:e,props:t={},as:r="div",className:s=""}){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"),s&&this.element.classList.add(...s.split(" ")),this.editor.isEditorContentInitialized?Xf.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,s=nb(),i=tb(e),o={...t};o.ref&&!(s||i)&&delete o.ref,!o.ref&&(s||i)&&(o.ref=l=>{this.ref=l}),this.reactElement=k.jsx(e,{...o}),r==null||(n=r.contentComponent)===null||n===void 0||n.setRenderer(this.id,this)}updateProps(n={}){if(this.destroyed)return;let e=!1;const t=Object.keys(n);for(let r=0;r<t.length;r+=1){const s=t[r];if(n[s]!==this.props[s]){e=!0;break}}e&&(this.props={...this.props,...n},this.render())}destroy(){var n;this.destroyed=!0;const e=this.editor;e==null||(n=e.contentComponent)===null||n===void 0||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])})}};_t.createContext({markViewContentRef:()=>{}});function sb(n){var e;const t=n.getRootNode(),r=typeof t.getSelection=="function"?t.getSelection():(e=n.ownerDocument)===null||e===void 0||(e=e.defaultView)===null||e===void 0?void 0:e.getSelection();if(!r||r.rangeCount===0)return null;const{anchorNode:s,anchorOffset:i,focusNode:o,focusOffset:l}=r;return!s||!o||!n.contains(s)||!n.contains(o)?null:()=>{try{r.setBaseAndExtent(s,i,o,l)}catch{}}}var ib=class extends t1{constructor(n,e,t){if(super(n,e,t),this.selectionRafId=null,this.handlePositionUpdate=()=>{const r=this.getPos();typeof r!="number"||r===this.currentPos||(this.currentPos=r,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs=="function"&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");r?r.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const n=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(t,r,s){if(r==="storage"){var i;return(i=n.storage[e.name])!==null&&i!==void 0?i:{}}return Reflect.get(t,r,s)}})}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:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode(),ref:V.createRef()};if(!this.component.displayName){const a=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=a(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:a=>{if(a&&this.contentDOMElement&&a.firstChild!==this.contentDOMElement){a.hasAttribute("data-node-view-wrapper")&&a.removeAttribute("data-node-view-wrapper");const c=sb(this.contentDOMElement);a.appendChild(this.contentDOMElement),c?.()}}},s=this.component,i=V.memo(a=>k.jsx($d.Provider,{value:r,children:V.createElement(s,a)}));i.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new rb(i,{editor:this.editor,props:n,as:o,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var n;if(this.renderer.element.firstElementChild&&!(!((n=this.renderer.element.firstElementChild)===null||n===void 0)&&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(()=>{var n;this.selectionRafId=null;const e=(n=this.getPos())!==null&&n!==void 0?n:this.currentPos;if(typeof e=="number")if(Fy({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(n,e,t){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(n.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,l=this.decorations,a=this.innerDecorations;return this.node=n,this.decorations=e,this.innerDecorations=t,this.currentPos=this.getPos(),this.options.update({oldNode:o,oldDecorations:l,newNode:n,newDecorations:e,oldInnerDecorations:a,innerDecorations:t,updateProps:()=>r({node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage})})}if(n===this.node)return this.node=n,this.decorations=e,this.innerDecorations=t,!0;const s=this.getPos();this.node=n,this.decorations=e,this.innerDecorations=t,this.currentPos=s;const i={node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(i.getPos=()=>this.getPos()),r(i),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let n={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,t=Mn(this.node,e);n=this.options.attrs({node:this.node,HTMLAttributes:t})}else n=this.options.attrs;this.renderer.updateAttributes(n)}}};function Bd(n,e){return t=>t.editor.contentComponent?new ib(n,t,e):{dom:document.createElement("span"),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}}const Yo=V.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Yo.displayName="TiptapContext";const ob=()=>V.useContext(Yo);function Fd({children:n,...e}){const t="editor"in e?e.editor:e.instance;if(!t)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=V.useMemo(()=>({editor:t}),[t]),s=V.useMemo(()=>({editor:t}),[t]);return k.jsx(Go.Provider,{value:s,children:k.jsx(Yo.Provider,{value:r,children:n})})}Fd.displayName="Tiptap";function jd({...n}){const{editor:e}=ob();return k.jsx(U1,{editor:e,...n})}jd.displayName="Tiptap.Content";Object.assign(Fd,{Content:jd});const Hd=new WeakSet,Vd=new WeakSet;function Nt(n){const e=n;return Hd.add(e),e}function eo(n){return Array.isArray(n)&&Hd.has(n)}function Wd(n){return n.flatMap(e=>e==null?[]:Array.isArray(e)&&Vd.has(e)&&!eo(e)?Wd(e):[e])}function lb(n,e){if(n==="slot")return 0;if(n instanceof Function){const s=n(e);return Array.isArray(s)&&!eo(s)&&!Vd.has(s)?Nt(s):s}const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(t)){if(eo(t))return Nt([n,r,t]);if(t.length===0)return Nt([n,r]);const s=Wd(t);return s.length===0?Nt([n,r]):Nt([n,r,...s])}return t!=null?Nt([n,r,t]):Nt([n,r])}const rs=(n,e)=>lb(n,e),ab=(n,e)=>{var t;const{state:r}=n,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0)return!1;const o=i.depth-1;if(o<0)return!1;const l=i.node(o),a=i.index(o);if(a===0)return!1;if(l.type===e)return n.commands.lift(e.name);const c=l.child(a-1);if(c.type!==e||!(!((t=c.lastChild)===null||t===void 0)&&t.isTextblock))return!1;const u=i.before()-1-1;return n.commands.command(({tr:d,dispatch:f})=>{if(!f)return!0;const h=i.parent.content,p=new E(h,0,0);return d.replace(u,i.after(),p),d.setSelection(N.create(d.doc,u+h.size)),d.scrollIntoView(),f(d),!0})},cb=/^\s*>\s$/,ub=be.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return rs("blockquote",{...ee(this.options.HTMLAttributes,n),children:rs("slot",{})})},parseMarkdown:(n,e)=>{var t;const r=(t=e.parseBlockChildren)!==null&&t!==void 0?t:e.parseChildren;return e.createNode("blockquote",void 0,r(n.tokens||[]))},renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach((s,i)=>{var o,l;const a=((o=(l=e.renderChild)===null||l===void 0?void 0:l.call(e,s,i))!==null&&o!==void 0?o:e.renderChildren([s])).split(`
99
99
  `).map(c=>c.trim()===""?t:`${t} ${c}`);r.push(a.join(`
100
100
  `))}),r.join(`
101
101
  ${t}
@@ -124,7 +124,7 @@ ${t}
124
124
  `,zb="️",Bb="‍",Mi="";let Lr=null,$r=null;function Fb(n=[]){const e={};ke.groups=e;const t=new ke;Lr==null&&(Lr=Ua(Db)),$r==null&&($r=Ua(Rb)),M(t,"'",xs),M(t,"{",Un),M(t,"}",qn),M(t,"[",ss),M(t,"]",is),M(t,"(",ls),M(t,")",as),M(t,"<",cs),M(t,">",us),M(t,"(",ds),M(t,")",fs),M(t,"「",hs),M(t,"」",ps),M(t,"『",ms),M(t,"』",gs),M(t,"<",ys),M(t,">",bs),M(t,"&",ks),M(t,"*",Ss),M(t,"@",ft),M(t,"`",Ms),M(t,"^",Ts),M(t,":",$t),M(t,",",Zo),M(t,"$",Es),M(t,".",ze),M(t,"=",ws),M(t,"!",el),M(t,"-",we),M(t,"%",Jn),M(t,"|",vs),M(t,"+",Ns),M(t,"#",As),M(t,"?",Gn),M(t,'"',tl),M(t,"/",Be),M(t,";",nl),M(t,"~",Yn),M(t,"_",Os),M(t,"\\",Cs),M(t,"・",qd);const r=q(t,qe,Xo,{[to]:!0});q(r,qe,r);const s=q(r,Ue,_d,{[_n]:!0}),i=q(r,Dn,Ud,{[Bn]:!0}),o=q(t,Ue,Ge,{[no]:!0});q(o,qe,s),q(o,Ue,o),q(s,qe,s),q(s,Ue,s);const l=q(t,Dn,io,{[ro]:!0});q(l,Ue),q(l,qe,i),q(l,Dn,l),q(i,qe,i),q(i,Ue),q(i,Dn,i);const a=M(t,Ci,Qo,{[ki]:!0}),c=M(t,_a,ao,{[ki]:!0}),u=q(t,Si,ao,{[ki]:!0});M(t,Mi,u),M(c,Ci,a),M(c,Mi,u),q(c,Si,u),M(u,_a),M(u,Ci),q(u,Si,u),M(u,Mi,u);const d=q(t,xi,Jd,{[Kd]:!0});M(d,"#"),q(d,xi,d),M(d,zb,d);const f=M(d,Bb);M(f,"#"),q(f,xi,d);const h=[[Ue,o],[qe,s]],p=[[Ue,null],[Dn,l],[qe,i]];for(let g=0;g<Lr.length;g++)at(t,Lr[g],oo,Ge,h);for(let g=0;g<$r.length;g++)at(t,$r[g],lo,io,p);Lt(oo,{tld:!0,ascii:!0},e),Lt(lo,{utld:!0,alpha:!0},e),at(t,"file",Kr,Ge,h),at(t,"mailto",Kr,Ge,h),at(t,"http",dn,Ge,h),at(t,"https",dn,Ge,h),at(t,"ftp",dn,Ge,h),at(t,"ftps",dn,Ge,h),Lt(Kr,{scheme:!0,ascii:!0},e),Lt(dn,{slashscheme:!0,ascii:!0},e),n=n.sort((g,m)=>g[0]>m[0]?1:-1);for(let g=0;g<n.length;g++){const m=n[g][0],b=n[g][1]?{[Ib]:!0}:{[Pb]:!0};m.indexOf("-")>=0?b[so]=!0:Ue.test(m)?qe.test(m)?b[_n]=!0:b[no]=!0:b[to]=!0,Ka(t,m,m,b)}return Ka(t,"localhost",hr,{ascii:!0}),t.jd=new ke(Ds),{start:t,tokens:Object.assign({groups:e},Gd)}}function Yd(n,e){const t=jb(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,s=[];let i=0,o=0;for(;o<r;){let l=n,a=null,c=0,u=null,d=-1,f=-1;for(;o<r&&(a=l.go(t[o]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=t[o].length,f++),c+=t[o].length,i+=t[o].length,o++;i-=d,o-=f,c-=d,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function jb(n){const e=[],t=n.length;let r=0;for(;r<t;){let s=n.charCodeAt(r),i,o=s<55296||s>56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function at(n,e,t,r,s){let i;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];n.j[a]?i=n.j[a]:(i=new ke(r),i.jr=s.slice(),n.j[a]=i),n=i}return i=new ke(t),i.jr=s.slice(),n.j[e[o-1]]=i,i}function Ua(n){const e=[],t=[];let r=0,s="0123456789";for(;r<n.length;){let i=0;for(;s.indexOf(n[r+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+i),10);o>0;o--)t.pop();r+=i}else t.push(n[r]),r++}return e}const pr={defaultProtocol:"http",events:null,format:qa,formatHref:qa,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function rl(n,e=null){let t=Object.assign({},pr);n&&(t=Object.assign(t,n instanceof rl?n.o:n));const r=t.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=s}rl.prototype={o:pr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let s=this.o[n];return s&&(typeof s=="object"?(s=t.t in s?s[t.t]:pr[n],typeof s=="function"&&r&&(s=s(e,t))):typeof s=="function"&&r&&(s=s(e,t.t,t)),s)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function qa(n){return n}function Xd(n,e){this.t="token",this.v=n,this.tk=e}Xd.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=pr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),s=n.get("tagName",t,e),i=this.toFormattedString(n),o={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),d=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:s,attributes:o,content:i,eventListeners:d}}};function Ys(n,e){class t extends Xd{constructor(s,i){super(s,i),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const Hb=Ys("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ja=Ys("text"),Vb=Ys("nl"),zr=Ys("url",{isLink:!0,toHref(n=pr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==hr&&n[1].t===$t}}),Ee=n=>new ke(n);function Wb({groups:n}){const e=n.domain.concat([ks,Ss,ft,Cs,Ms,Ts,Es,ws,we,Xo,Jn,vs,Ns,As,Be,Ds,Yn,Os]),t=[xs,$t,Zo,ze,el,Jn,Gn,tl,nl,cs,us,Un,qn,is,ss,ls,as,ds,fs,hs,ps,ms,gs,ys,bs],r=[ks,xs,Ss,Cs,Ms,Ts,Es,ws,we,Un,qn,Jn,vs,Ns,As,Gn,Be,Ds,Yn,Os],s=Ee(),i=M(s,Yn);P(i,r,i),P(i,n.domain,i);const o=Ee(),l=Ee(),a=Ee();P(s,n.domain,o),P(s,n.scheme,l),P(s,n.slashscheme,a),P(o,r,i),P(o,n.domain,o);const c=M(o,ft);M(i,ft,c),M(l,ft,c),M(a,ft,c);const u=M(i,ze);P(u,r,i),P(u,n.domain,i);const d=Ee();P(c,n.domain,d),P(d,n.domain,d);const f=M(d,ze);P(f,n.domain,d);const h=Ee(Hb);P(f,n.tld,h),P(f,n.utld,h),M(c,hr,h);const p=M(d,we);M(p,we,p),P(p,n.domain,d),P(h,n.domain,d),M(h,ze,f),M(h,we,p);const g=M(o,we),m=M(o,ze);M(g,we,g),P(g,n.domain,o),P(m,r,i),P(m,n.domain,o);const y=Ee(zr);P(m,n.tld,y),P(m,n.utld,y),P(y,n.domain,o),P(y,r,i),M(y,ze,m),M(y,we,g),M(y,ft,c);const b=M(y,$t),x=Ee(zr);P(b,n.numeric,x);const C=Ee(zr),T=Ee();P(C,e,C),P(C,t,T),P(T,e,C),P(T,t,T),M(y,Be,C),M(x,Be,C);const A=M(l,$t),v=M(a,$t),D=M(v,Be),R=M(D,Be);P(l,n.domain,o),M(l,ze,m),M(l,we,g),P(a,n.domain,o),M(a,ze,m),M(a,we,g),P(A,n.domain,C),M(A,Be,C),M(A,Gn,C),P(R,n.domain,C),P(R,e,C),M(R,Be,C);const j=[[Un,qn],[ss,is],[ls,as],[cs,us],[ds,fs],[hs,ps],[ms,gs],[ys,bs]];for(let K=0;K<j.length;K++){const[U,L]=j[K],B=M(C,U);M(T,U,B);const z=Ee(zr);P(B,e,z);const _=Ee();P(B,t,_),M(B,L,C),P(z,e,z),P(z,t,_),P(_,e,z),P(_,t,_),M(z,L,C),M(_,L,C)}return M(s,hr,y),M(s,Qo,Vb),{start:s,tokens:Gd}}function Kb(n,e,t){let r=t.length,s=0,i=[],o=[];for(;s<r;){let l=n,a=null,c=null,u=0,d=null,f=-1;for(;s<r&&!(a=l.go(t[s].t));)o.push(t[s++]);for(;s<r&&(c=a||l.go(t[s].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,s++,u++;if(f<0)s-=u,s<r&&(o.push(t[s]),s++);else{o.length>0&&(i.push(Ti(Ja,e,o)),o=[]),s-=f,u-=f;const h=d.t,p=t.slice(s-u,s);i.push(Ti(h,e,p))}}return o.length>0&&i.push(Ti(Ja,e,o)),i}function Ti(n,e,t){const r=t[0].s,s=t[t.length-1].e,i=e.slice(r,s);return new n(i,t)}const _b=typeof console<"u"&&console&&console.warn||(()=>{}),Ub="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",H={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function qb(){return ke.groups={},H.scanner=null,H.parser=null,H.tokenQueue=[],H.pluginQueue=[],H.customSchemes=[],H.initialized=!1,H}function Ga(n,e=!1){if(H.initialized&&_b(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Ub}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
125
125
  1. Must only contain digits, lowercase ASCII letters or "-"
126
126
  2. Cannot start or end with "-"
127
- 3. "-" cannot repeat`);H.customSchemes.push([n,e])}function Jb(){H.scanner=Fb(H.customSchemes);for(let n=0;n<H.tokenQueue.length;n++)H.tokenQueue[n][1]({scanner:H.scanner});H.parser=Wb(H.scanner.tokens);for(let n=0;n<H.pluginQueue.length;n++)H.pluginQueue[n][1]({scanner:H.scanner,parser:H.parser});return H.initialized=!0,H}function sl(n){return H.initialized||Jb(),Kb(H.parser.start,n,Yd(H.scanner.start,n))}sl.scan=Yd;function Qd(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new rl(t),s=sl(n),i=[];for(let o=0;o<s.length;o++){const l=s[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}const il="[\0-   ᠎ -\u2029  ]",Gb=new RegExp(il),Yb=new RegExp(`${il}$`),Xb=new RegExp(il,"g");function Qb(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Zb(n){return new W({key:new te("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(a=>a.docChanged)&&!t.doc.eq(r.doc),i=e.some(a=>a.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,l=fd(t.doc,[...e]);if(Js(l).forEach(({newRange:a})=>{const c=Cy(r.doc,a,f=>f.isTextblock);let u,d;if(c.length>1)u=c[0],d=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(c.length){const f=r.doc.textBetween(a.from,a.to," "," ");if(!Yb.test(f))return;u=c[0],d=r.doc.textBetween(u.pos,a.to,void 0," ")}if(u&&d){const f=d.split(Gb).filter(Boolean);if(f.length<=0)return!1;const h=f[f.length-1],p=u.pos+d.lastIndexOf(h);if(!h)return!1;const g=sl(h).map(m=>m.toObject(n.defaultProtocol));if(!Qb(g))return!1;g.filter(m=>m.isLink).map(m=>({...m,from:p+m.start+1,to:p+m.end+1})).filter(m=>r.schema.marks.code?!r.doc.rangeHasMark(m.from,m.to,r.schema.marks.code):!0).filter(m=>n.validate(m.value)).filter(m=>n.shouldAutoLink(m.value)).forEach(m=>{qo(m.from,m.to,r.doc).some(y=>y.mark.type===n.type)||o.addMark(m.from,m.to,n.type.create({href:m.href}))})}}),!!o.steps.length)return o}})}function ek(n){return new W({key:new te("handleClickLink"),props:{handleClick:(e,t,r)=>{if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const a=r.target;if(!a)return!1;const c=n.editor.view.dom;s=a.closest("a"),s&&!c.contains(s)&&(s=null)}if(!s)return!1;let i=!1;if(n.enableClickSelection&&(i=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){var o,l;const a=bd(e.state,n.type.name),c=(o=s.href)!==null&&o!==void 0?o:a.href,u=(l=s.target)!==null&&l!==void 0?l:a.target;c&&(window.open(c,u),i=!0)}return i}}})}const tk=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,nk=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function Zd(n,e){let t=0;for(let r=e-1;r>=0&&n[r]==="\\";r-=1)t+=1;return t%2===1}function rk(n,e){let t=0,r=0;for(;r<e;){if(n[r]!=="`"){r+=1;continue}if(t===0&&Zd(n,r)){r+=1;continue}let s=0;for(;r<e&&n[r]==="`";)s+=1,r+=1;t===0?t=s:s===t&&(t=0)}return t>0}function ef(n,e,t){var r,s;const[,i,o]=e;return(e.index?n[e.index-1]:void 0)==="!"||Zd(n,(r=e.index)!==null&&r!==void 0?r:0)||rk(n,(s=e.index)!==null&&s!==void 0?s:0)?!1:!!i.trim()&&t(o)}function tf(n){var e,t;const[r,s,i,,o,l,a]=n,c=(e=o??l)!==null&&e!==void 0?e:a;return{index:(t=n.index)!==null&&t!==void 0?t:0,text:r,replaceWith:s,data:{href:i,title:c||null,markdown:!0}}}function sk(n,e){return n.index<e.index+e.text.length&&e.index<n.index+n.text.length}function nf(n){var e,t,r;return{href:(e=n.data)===null||e===void 0?void 0:e.href,title:(t=(r=n.data)===null||r===void 0?void 0:r.title)!==null&&t!==void 0?t:null}}function ik(n){const e=Gt({find:t=>{const r=tk.exec(t);return!r||!ef(t,r,n.isAllowedHref)?null:tf(r)},type:n.type,getAttributes:nf});return new Mr({find:e.find,handler:t=>{const r=e.handler(t);return r!==null&&t.state.tr.steps.length&&t.state.tr.setMeta("preventAutolink",!0),r}})}function ok(n){const e=Mt({find:t=>{var r,s;const i=[];for(const l of t.matchAll(nk))ef(t,l,n.isAllowedHref)&&i.push(tf(l));const o=((r=(s=n.findPlainUrls)===null||s===void 0?void 0:s.call(n,t))!==null&&r!==void 0?r:[]).filter(l=>!i.some(a=>sk(a,l)));return[...i,...o]},type:n.type,getAttributes:nf});return new Od({find:e.find,handler:t=>{var r;const s=e.handler(t);return s!==null&&t.state.tr.steps.length&&(!((r=t.match.data)===null||r===void 0)&&r.markdown)&&t.state.tr.setMeta("preventAutolink",!0),s}})}function lk(n){return new W({key:new te("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:s}=n,{state:i}=e,{selection:o}=i,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=Qd(a,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||s!==void 0&&!s(c.value)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function Je(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&t.push(s)}),!n||n.replace(Xb,"").match(new RegExp(`^(?:(?:${t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const rf=Xt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Ga(n);return}Ga(n.scheme,n.optionalSlashes)})},onDestroy(){qb()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Je(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const r=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var n,e,t;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(n=this.options.HTMLAttributes.target)!==null&&n!==void 0?n:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(t=this.options.HTMLAttributes.class)!==null&&t!==void 0?t:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Je(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Je(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ee(this.options.HTMLAttributes,n),0]:["a",ee(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,r,s,i;const o=(t=(r=n.attrs)===null||r===void 0?void 0:r.href)!==null&&t!==void 0?t:"",l=(s=(i=n.attrs)===null||i===void 0?void 0:i.title)!==null&&s!==void 0?s:"",a=e.renderChildren(n);return l?`[${a}](${o} "${l}")`:`[${a}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Je(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!Je(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[ik({type:this.type,isAllowedHref:n=>this.options.isAllowedUri(n,{defaultValidate:e=>!!Je(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const n=e=>{const t=[];if(e){const{protocols:r,defaultProtocol:s}=this.options;Qd(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!Je(o,r),protocols:r,defaultProtocol:s})).forEach(i=>{this.options.shouldAutoLink(i.value)&&t.push({text:i.value,data:{href:i.href},index:i.start})})}return t};return this.options.markdownLinks?[ok({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:t=>!!Je(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:n})]:[Mt({find:n,type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(Zb({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Je(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(ek({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(lk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}});var qS=rf;const ak="listItem",Ya="textStyle",Xa=/^\s*([-+*])\s$/,sf=be.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",ee(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
127
+ 3. "-" cannot repeat`);H.customSchemes.push([n,e])}function Jb(){H.scanner=Fb(H.customSchemes);for(let n=0;n<H.tokenQueue.length;n++)H.tokenQueue[n][1]({scanner:H.scanner});H.parser=Wb(H.scanner.tokens);for(let n=0;n<H.pluginQueue.length;n++)H.pluginQueue[n][1]({scanner:H.scanner,parser:H.parser});return H.initialized=!0,H}function sl(n){return H.initialized||Jb(),Kb(H.parser.start,n,Yd(H.scanner.start,n))}sl.scan=Yd;function Qd(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new rl(t),s=sl(n),i=[];for(let o=0;o<s.length;o++){const l=s[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}const il="[\0-   ᠎ -\u2029  ]",Gb=new RegExp(il),Yb=new RegExp(`${il}$`),Xb=new RegExp(il,"g");function Qb(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Zb(n){return new W({key:new te("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(a=>a.docChanged)&&!t.doc.eq(r.doc),i=e.some(a=>a.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,l=fd(t.doc,[...e]);if(Js(l).forEach(({newRange:a})=>{const c=Cy(r.doc,a,f=>f.isTextblock);let u,d;if(c.length>1)u=c[0],d=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(c.length){const f=r.doc.textBetween(a.from,a.to," "," ");if(!Yb.test(f))return;u=c[0],d=r.doc.textBetween(u.pos,a.to,void 0," ")}if(u&&d){const f=d.split(Gb).filter(Boolean);if(f.length<=0)return!1;const h=f[f.length-1],p=u.pos+d.lastIndexOf(h);if(!h)return!1;const g=sl(h).map(m=>m.toObject(n.defaultProtocol));if(!Qb(g))return!1;g.filter(m=>m.isLink).map(m=>({...m,from:p+m.start+1,to:p+m.end+1})).filter(m=>r.schema.marks.code?!r.doc.rangeHasMark(m.from,m.to,r.schema.marks.code):!0).filter(m=>n.validate(m.value)).filter(m=>n.shouldAutoLink(m.value)).forEach(m=>{qo(m.from,m.to,r.doc).some(y=>y.mark.type===n.type)||o.addMark(m.from,m.to,n.type.create({href:m.href}))})}}),!!o.steps.length)return o}})}function ek(n){return new W({key:new te("handleClickLink"),props:{handleClick:(e,t,r)=>{if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const a=r.target;if(!a)return!1;const c=n.editor.view.dom;s=a.closest("a"),s&&!c.contains(s)&&(s=null)}if(!s)return!1;let i=!1;if(n.enableClickSelection&&(i=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){var o,l;const a=bd(e.state,n.type.name),c=(o=s.href)!==null&&o!==void 0?o:a.href,u=(l=s.target)!==null&&l!==void 0?l:a.target;c&&(window.open(c,u),i=!0)}return i}}})}const tk=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,nk=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function Zd(n,e){let t=0;for(let r=e-1;r>=0&&n[r]==="\\";r-=1)t+=1;return t%2===1}function rk(n,e){let t=0,r=0;for(;r<e;){if(n[r]!=="`"){r+=1;continue}if(t===0&&Zd(n,r)){r+=1;continue}let s=0;for(;r<e&&n[r]==="`";)s+=1,r+=1;t===0?t=s:s===t&&(t=0)}return t>0}function ef(n,e,t){var r,s;const[,i,o]=e;return(e.index?n[e.index-1]:void 0)==="!"||Zd(n,(r=e.index)!==null&&r!==void 0?r:0)||rk(n,(s=e.index)!==null&&s!==void 0?s:0)?!1:!!i.trim()&&t(o)}function tf(n){var e,t;const[r,s,i,,o,l,a]=n,c=(e=o??l)!==null&&e!==void 0?e:a;return{index:(t=n.index)!==null&&t!==void 0?t:0,text:r,replaceWith:s,data:{href:i,title:c||null,markdown:!0}}}function sk(n,e){return n.index<e.index+e.text.length&&e.index<n.index+n.text.length}function nf(n){var e,t,r;return{href:(e=n.data)===null||e===void 0?void 0:e.href,title:(t=(r=n.data)===null||r===void 0?void 0:r.title)!==null&&t!==void 0?t:null}}function ik(n){const e=Gt({find:t=>{const r=tk.exec(t);return!r||!ef(t,r,n.isAllowedHref)?null:tf(r)},type:n.type,getAttributes:nf});return new Mr({find:e.find,handler:t=>{const r=e.handler(t);return r!==null&&t.state.tr.steps.length&&t.state.tr.setMeta("preventAutolink",!0),r}})}function ok(n){const e=Mt({find:t=>{var r,s;const i=[];for(const l of t.matchAll(nk))ef(t,l,n.isAllowedHref)&&i.push(tf(l));const o=((r=(s=n.findPlainUrls)===null||s===void 0?void 0:s.call(n,t))!==null&&r!==void 0?r:[]).filter(l=>!i.some(a=>sk(a,l)));return[...i,...o]},type:n.type,getAttributes:nf});return new Od({find:e.find,handler:t=>{var r;const s=e.handler(t);return s!==null&&t.state.tr.steps.length&&(!((r=t.match.data)===null||r===void 0)&&r.markdown)&&t.state.tr.setMeta("preventAutolink",!0),s}})}function lk(n){return new W({key:new te("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:s}=n,{state:i}=e,{selection:o}=i,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=Qd(a,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||s!==void 0&&!s(c.value)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function Je(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&t.push(s)}),!n||n.replace(Xb,"").match(new RegExp(`^(?:(?:${t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const rf=Xt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Ga(n);return}Ga(n.scheme,n.optionalSlashes)})},onDestroy(){qb()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Je(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const r=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var n,e,t;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(n=this.options.HTMLAttributes.target)!==null&&n!==void 0?n:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(t=this.options.HTMLAttributes.class)!==null&&t!==void 0?t:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Je(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Je(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ee(this.options.HTMLAttributes,n),0]:["a",ee(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,r,s,i;const o=(t=(r=n.attrs)===null||r===void 0?void 0:r.href)!==null&&t!==void 0?t:"",l=(s=(i=n.attrs)===null||i===void 0?void 0:i.title)!==null&&s!==void 0?s:"",a=e.renderChildren(n);return l?`[${a}](${o} "${l}")`:`[${a}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Je(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!Je(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[ik({type:this.type,isAllowedHref:n=>this.options.isAllowedUri(n,{defaultValidate:e=>!!Je(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const n=e=>{const t=[];if(e){const{protocols:r,defaultProtocol:s}=this.options;Qd(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!Je(o,r),protocols:r,defaultProtocol:s})).forEach(i=>{this.options.shouldAutoLink(i.value)&&t.push({text:i.value,data:{href:i.href},index:i.start})})}return t};return this.options.markdownLinks?[ok({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:t=>!!Je(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:n})]:[Mt({find:n,type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(Zb({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Je(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(ek({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(lk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}});var US=rf;const ak="listItem",Ya="textStyle",Xa=/^\s*([-+*])\s$/,sf=be.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",ee(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
128
128
  `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ak,this.editor.getAttributes(Ya)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Tn({find:Xa,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Tn({find:Xa,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ya),editor:this.editor})),[n]}}),ck=(n,e,t)=>{const{selection:r}=n;if(!r.empty)return null;const{$from:s}=r;if(!s.parent.isTextblock||s.parentOffset!==s.parent.content.size)return null;let i=-1;for(let h=s.depth;h>0;h-=1)if(s.node(h).type.name===e){i=h;break}if(i<0)return null;const o=s.node(i),l=s.index(i);if(l+1>=o.childCount)return null;const a=o.child(l+1);if(!t.includes(a.type.name))return null;const c=n.schema.nodes[e];let u=!1;if(a.forEach(h=>{h.type===c&&h.childCount>1&&(u=!0)}),!u)return null;const d=n.doc.resolve(s.after()).nodeAfter;if(!d||!t.includes(d.type.name))return null;const f=[];return d.forEach(h=>{f.push(h)}),f.length===0?null:{listItemDepth:i,nestedList:d,nestedListPos:s.after(),insertPos:s.after(i),items:f}},uk=(n,e,t,r)=>{const s=ck(n,t,r);if(!s)return!1;const{selection:i}=n,{nestedList:o,nestedListPos:l,insertPos:a,items:c}=s,u=n.tr;u.delete(l,l+o.nodeSize);const d=u.mapping.map(a);return u.insert(d,S.from(c)),u.setSelection(i.map(u.doc,u.mapping)),e&&e(u),!0},dk=(n,e,t)=>uk(n.state,n.view.dispatch,e,t),of=(n,e)=>Y.create({name:`${n}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>dk(this.editor,n,e);return{Delete:t,"Mod-Delete":t}}}),lf=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],Br="abcdefghijklmnopqrstuvwxyz",af=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function Xs(n){let e=n,t="";for(const[r,s]of lf)for(;e>=r;)t+=s,e-=r;return t}function ol(n){return Xs(n).toUpperCase()}function cf(n){const e=n.toLowerCase();let t=0,r=0;for(;t<e.length;){let s=!1;for(const[i,o]of lf)if(e.startsWith(o,t)){r+=i,t+=o.length,s=!0;break}if(!s)return 0}return r}function fk(n){if(!/^[ivxlcdmIVXLCDM]+$/.test(n))return!1;const e=cf(n);return e<=0?!1:(n===n.toLowerCase()?Xs(e):ol(e))===n}function hk(n){const e=n.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const t=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(t+1)*26+r+1}return 0}function Rs(n){if(n<=26)return Br[n-1];const e=Math.floor((n-1)/26)-1,t=(n-1)%26;return e<0?Br[t]:Br[e]+Br[t]}function Qs(n){if(!(!n||/^\d+$/.test(n))){if(fk(n))return n===n.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(n))return"a";if(/^[A-Z]{1,2}$/.test(n))return"A"}}function ll(n){if(/^\d+$/.test(n))return parseInt(n,10);const e=Qs(n);if(e==="i"||e==="I")return cf(n);if(e==="a"||e==="A"){const r=hk(n);return r>0?r:1}const t=parseInt(n,10);return Number.isNaN(t)?1:t}function pk(n,e){if(n==="numeric")return String(e);switch(n){case"a":return Rs(e);case"A":return Rs(e).toUpperCase();case"i":return Xs(e);case"I":return ol(e);default:return String(e)}}function mk(n){var e;if(n.length===0)return!1;const t=(e=Qs(n[0]))!==null&&e!==void 0?e:"numeric",r=ll(n[0]);if(r<1)return!1;for(let s=0;s<n.length;s++){const i=pk(t,r+s);if(n[s]!==i)return!1}return!0}function gk(n){return{type:Qs(n),start:ll(n)}}function yk(n){const{type:e,start:t}=gk(n),r={};return e&&(r.type=e),t!==1&&(r.start=t),r}function bk(n,e,t=". "){const r=e+1;if(!n||n==="1")return`${r}${t}`;switch(n){case"a":return`${Rs(r)}${t}`;case"A":return`${Rs(r).toUpperCase()}${t}`;case"i":return`${Xs(r)}${t}`;case"I":return`${ol(r)}${t}`;default:return`${r}${t}`}}function kk(n){var e,t;const r=(e=n.tokens)===null||e===void 0?void 0:e[0];return!!(n.text&&((t=n.tokens)===null||t===void 0?void 0:t.length)===1&&r?.type==="list"&&r.ordered&&r.raw===n.text)}function xk(n,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(n)):e.parseInline([{type:"text",raw:n,text:n}])}const uf=be.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ee(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{var t;if(n.type!=="list_item")return[];const r=(t=e.parseBlockChildren)!==null&&t!==void 0?t:e.parseChildren;let s=[];if(n.tokens&&n.tokens.length>0){if(kk(n))return{type:"listItem",content:[{type:"paragraph",content:xk(n.text||"",e)}]};if(n.tokens.some(i=>i.type==="paragraph"))s=r(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(i.tokens)}],n.tokens.length>1){const o=r(n.tokens.slice(1));s.push(...o)}}else s=r(n.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(n,e,t)=>vd(n,e,r=>{if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){var s,i;const o=((s=r.meta)===null||s===void 0||(s=s.parentAttrs)===null||s===void 0?void 0:s.start)||1;return bk((i=r.meta)===null||i===void 0||(i=i.parentAttrs)===null||i===void 0?void 0:i.type,o-1+(r.index||0),". ")}return"- "},t),addExtensions(){return[of(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),al=(n,e)=>{const{$from:t}=e.selection,r=ne(n,e.schema);let s=null,i=t.depth,o=t.pos,l=null;for(;i>0&&l===null;)s=t.node(i),s.type===r?l=i:(i-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},df=(n,e)=>{const t=al(n,e);if(!t)return!1;const[,r]=Iy(e,n,t.$pos.pos+4);return r},Sk=(n,e,t)=>{const{$anchor:r}=n.selection,s=Math.max(0,r.pos-2),i=n.doc.resolve(s).node();return!(!i||!t.includes(i.type.name))},Qa=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!nt(n.state,e)&&Sk(n.state,e,t)){const{$anchor:i}=n.state.selection,o=n.state.doc.resolve(i.before()-1),l=[];o.node().descendants((u,d)=>{u.type.name===e&&l.push({node:u,pos:d})});const a=l.at(-1);if(!a)return!1;const c=n.state.doc.resolve(o.start()+a.pos+1);return n.chain().cut({from:i.start()-1,to:i.end()+1},c.end()).joinForward().run()}if(!nt(n.state,e)||!By(n.state))return!1;const{$from:r}=n.state.selection,s=r.depth-1;return r.node(s).type!==n.schema.nodes[e]||r.index(s)!==0?!1:n.chain().liftListItem(e).run()},Ck=(n,e)=>{const t=df(n,e),r=al(n,e);return!r||!t?!1:t>r.depth},Mk=(n,e)=>{const t=df(n,e),r=al(n,e);return!r||!t?!1:t<r.depth},Za=(n,e)=>{if(!nt(n.state,e)||!zy(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:s}=t;return!t.empty&&r.sameParent(s)?!1:Ck(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Mk(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},Tk=(n,e,t)=>{const{state:r}=n,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0||!i.parent.isTextblock||nt(r,e))return!1;const o=Py(i);if(!o||!t.includes(o.type.name))return!1;const l=o.lastChild;if(!l||l.type.name!==e)return!1;const a=i.parent;if(!l.canReplace(l.childCount,l.childCount,S.from(a)))return!1;const c=i.before(),u=i.after(),d=c-2;return n.commands.command(({tr:f,dispatch:h})=>(h&&(f.delete(c,u).insert(d,S.from(a)),f.setSelection(N.create(f.doc,d+1)),f.scrollIntoView()),!0))},ff=Y.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Za(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Za(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Qa(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Qa(n,t,r)&&(e=!0)}),e},Tab:({editor:n})=>{for(const{itemName:e,wrapperNames:t}of this.options.listTypes)if(n.state.schema.nodes[e]!==void 0&&Tk(n,e,t))return!0;return!1}}}}),co=new RegExp(`^(\\s*)(${af})([.)])\\s+(.*)$`),Ek=/^\s/,fn={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function wk(n){return co.test(n.trimStart())}function vk(n){const e=n.trimStart();return fn.bulletItem.test(e)||wk(e)||fn.heading.test(e)||fn.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||fn.codeFence.test(e)||fn.blockMath.test(e)}function Nk(n){return Object.values(fn).some(e=>e.test(n))}function Ak(n){const e=[],t=[];let r=!1;return n.forEach(s=>{if(r){t.push(s);return}if(s.trim()===""){r=!0,t.push(s);return}if(e.length>0&&vk(s)){r=!0,t.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:t}}function Ok(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t],i=s.match(co);if(!i)break;const[,o,l,a,c]=i,u=o.length,d=parseInt(l,10),f=isNaN(d)?Qs(l):void 0,h=isNaN(d)?ll(l):d,p=[c];let g=t+1;const m=[s];let y=!1;for(;g<n.length;){const b=n[g];if(b.match(co))break;if(b.trim()==="")m.push(b),p.push(""),y=!0,g+=1;else if(b.match(Ek)){const x=b.length-b.trimStart().length,C=u+l.length+1;m.push(b),p.push(b.slice(Math.min(x,C))),g+=1}else{if(y||Nk(b))break;m.push(b),p.push(b),g+=1}}e.push({indent:u,number:h,type:f,content:p.join(`
129
129
  `).trim(),contentLines:p,raw:m.join(`
130
130
  `)}),r=g,t=g}return[e,r]}const Dk=new RegExp(`^(${af})([.)])\\s+(.+)$`);function Rk(n){const e=n.split(`
@@ -138,4 +138,4 @@ ${t}
138
138
  `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=i=>{const o=Pa(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},t);if(o){const l={type:"taskList",raw:o.raw,items:o.items},a=i.slice(o.raw.length);return a.trim()?[l,...t.blockTokens(a)]:[l]}return t.blockTokens(i)},s=Pa(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Y.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(sf.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(uf.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(ff.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(pf.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Bk.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Fk.configure(this.options.taskList)),n}});const Fr="&nbsp;",Ei=" ",jk=be.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ee(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const r=e.parseInline(t);return t.length===1&&t[0].type==="text"&&(t[0].raw===Fr||t[0].text===Fr||t[0].raw===Ei||t[0].text===Ei)&&r.length===1&&r[0].type==="text"&&(r[0].text===Fr||r[0].text===Ei)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(n,e,t)=>{if(!n)return"";const r=Array.isArray(n.content)?n.content:[];if(r.length===0){var s,i;const o=Array.isArray(t==null||(s=t.previousNode)===null||s===void 0?void 0:s.content)?t.previousNode.content:[];return(t==null||(i=t.previousNode)===null||i===void 0?void 0:i.type)==="paragraph"&&o.length===0?Fr:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Hk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Vk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Wk=Xt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",ee(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Gt({find:Hk,type:this.type})]},addPasteRules(){return[Mt({find:Vk,type:this.type})]}}),Kk=be.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),_k=Xt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ee(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!r)return;const s=r[2].trim();return{type:"underline",raw:r[0],text:s,tokens:t.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Uk(n={}){return new W({view(e){return new qk(e,n)}})}class qk{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let m=this.width/2*l;r={left:p.left,right:p.right,top:g-m,bottom:g+m}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!i){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=vo(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Zt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},mf=function(n,e,t,r){return t&&(rc(n,e,t,r,-1)||rc(n,e,t,r,1))},Jk=/^(img|br|input|textarea|hr)$/i;function rc(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:Is(n))){let o=n.parentNode;if(!o||o.nodeType!=1||cl(n)||Jk.test(n.nodeName)||n.contentEditable=="false")return!1;e=Zt(n)+(s<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else n=o,e=s<0?Is(n):0}else return!1}}function Is(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Gk(n,e,t){for(let r=e==0,s=e==Is(n);r||s;){if(n==t)return!0;let i=Zt(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==Is(n)}}function cl(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 gf=function(n){return n.focusNode&&mf(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function yf(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const We=typeof navigator<"u"?navigator:null,sc=typeof document<"u"?document:null,vt=We&&We.userAgent||"",uo=/Edge\/(\d+)/.exec(vt),bf=/MSIE \d/.exec(vt),fo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vt),Tr=!!(bf||fo||uo),kf=bf?document.documentMode:fo?+fo[1]:uo?+uo[1]:0,Zs=!Tr&&/gecko\/(\d+)/i.test(vt);Zs&&+(/Firefox\/(\d+)/.exec(vt)||[0,0])[1];const ho=!Tr&&/Chrome\/(\d+)/.exec(vt),ot=!!ho,xf=ho?+ho[1]:0,en=!Tr&&!!We&&/Apple Computer/.test(We.vendor),ul=en&&(/Mobile\/\w+/.test(vt)||!!We&&We.maxTouchPoints>2),Ne=ul||(We?/Mac/.test(We.platform):!1),Sf=We?/Win/.test(We.platform):!1,Er=/Android \d/.test(vt),dl=!!sc&&"webkitFontSmoothing"in sc.documentElement.style,Yk=dl?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Xk(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),i=s&&s.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(gf(t)){for(a=o;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&w.isSelectable(d)&&s.parent&&!(d.isInline&&Gk(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;c=new w(o==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,f=o;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;[a,o]=f==n.state.selection.anchor?[f,d]:[d,f],l=r.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;c=Mf(n,u,l,d)}return c}function Cf(n){return n.editable?n.hasFocus():tx(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function fl(n,e=!1){let t=n.state.selection;if(ex(n,t),!!Cf(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ot){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&mf(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Zk(n);else{let{anchor:r,head:s}=t,i,o;ic&&!(t instanceof N)&&(t.$from.parent.inlineContent||(i=oc(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=oc(n,t.to))),n.docView.setSelection(r,s,n,e),ic&&(i&&lc(i),o&&lc(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Qk(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ic=en||ot&&xf<63;function oc(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(en&&s&&s.contentEditable=="false")return wi(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return wi(s);if(i)return wi(i)}}function wi(n){return n.contentEditable="true",en&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function lc(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Qk(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Cf(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Zk(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Zt(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Tr&&kf<=11&&(t.disabled=!0,t.disabled=!1)}function ex(n,e){if(e instanceof w){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(ac(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else ac(n)}function ac(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Mf(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||N.between(e,t,r)}function tx(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 po(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),i=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return i&&I.findFrom(i,e)}function ht(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function cc(n,e,t){let r=n.state.selection;if(r instanceof N)if(t.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=n.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return ht(n,new N(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=po(n.state,e);return s&&s instanceof w?ht(n,s):!1}else if(!(Ne&&t.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?w.isSelectable(i)?ht(n,new w(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):dl?ht(n,new N(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof w&&r.node.isInline)return ht(n,new N(e>0?r.$to:r.$from));{let s=po(n.state,e);return s?ht(n,s):!1}}}function Ps(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Xn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function on(n,e){return e<0?nx(n):rx(n)}function nx(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(Zs&&t.nodeType==1&&r<Ps(t)&&Xn(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Xn(l,-1))s=t,i=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Tf(t))break;{let l=t.previousSibling;for(;l&&Xn(l,-1);)s=t.parentNode,i=Zt(l),l=l.previousSibling;if(l)t=l,r=Ps(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?mo(n,t,r):s&&mo(n,s,i)}function rx(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=Ps(t),i,o;for(;;)if(r<s){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Xn(l,1))i=t,o=++r;else break}else{if(Tf(t))break;{let l=t.nextSibling;for(;l&&Xn(l,1);)i=l.parentNode,o=Zt(l)+1,l=l.nextSibling;if(l)t=l,r=0,s=Ps(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&mo(n,i,o)}function Tf(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function sx(n,e){for(;n&&e==n.childNodes.length&&!cl(n);)e=Zt(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 ix(n,e){for(;n&&!e&&!cl(n);)e=Zt(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 mo(n,e,t){if(e.nodeType!=3){let i,o;(o=sx(e,t))?(e=o,t=0):(i=ix(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(gf(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&fl(n)},50)}function uc(n,e){let t=n.state.doc.resolve(e);if(!(ot||Sf)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function dc(n,e,t){let r=n.state.selection;if(r instanceof N&&!r.empty||t.indexOf("s")>-1||Ne&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=po(n.state,e);if(o&&o instanceof w)return ht(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof xe?I.near(o,e):I.findFrom(o,e);return l?ht(n,l):!1}return!1}function fc(n,e){if(!(n.state.selection instanceof N))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let o=n.state.tr;return e<0?o.delete(t.pos-i.nodeSize,t.pos):o.delete(t.pos,t.pos+i.nodeSize),n.dispatch(o),!0}return!1}function hc(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function ox(n){if(!en||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;hc(n,r,"true"),setTimeout(()=>hc(n,r,"false"),20)}return!1}function lx(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function ax(n,e){let t=e.keyCode,r=lx(e);if(t==8||Ne&&t==72&&r=="c")return fc(n,-1)||on(n,-1);if(t==46&&!e.shiftKey||Ne&&t==68&&r=="c")return fc(n,1)||on(n,1);if(t==13||t==27)return!0;if(t==37||Ne&&t==66&&r=="c"){let s=t==37?uc(n,n.state.selection.from)=="ltr"?-1:1:-1;return cc(n,s,r)||on(n,s)}else if(t==39||Ne&&t==70&&r=="c"){let s=t==39?uc(n,n.state.selection.from)=="ltr"?1:-1:1;return cc(n,s,r)||on(n,s)}else{if(t==38||Ne&&t==80&&r=="c")return dc(n,-1,r)||on(n,-1);if(t==40||Ne&&t==78&&r=="c")return ox(n)||dc(n,1,r)||on(n,1);if(r==(Ne?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Ef(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=n.someProp("clipboardSerializer")||rt.fromSchema(n.state.schema),l=Df(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Of[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
139
139
 
140
140
  `);return{dom:a,text:f,slice:e}}function wf(n,e,t,r,s){let i=s.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(r||i||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,i||r,n)}),i)return l=new E(S.from(n.state.schema.text(e.replace(/\r\n?/g,`
141
- `))),0,0),n.someProp("transformPasted",f=>{l=f(l,n,!0)}),l;let d=n.someProp("clipboardTextParser",f=>f(e,s,r,n));if(d)l=d;else{let f=s.marks(),{schema:h}=n.state,p=rt.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=fx(t),dl&&hx(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||He.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!cx.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=px(pc(l,+u[1],+u[2]),u[4]);else if(l=E.maxOpen(ux(l.content,s),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=pc(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n,a)}),l}const cx=/^(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 ux(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),i,o=[];if(n.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&i.length&&Nf(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Af(o[o.length-1],i.length));let u=vf(l,a);o.push(u),s=s.matchType(u.type),i=a}}),o)return S.from(o)}return n}function vf(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,S.from(n));return n}function Nf(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=Nf(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(S.from(vf(t,n,s+1))))}}function Af(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Af(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(S.empty,!0);return n.copy(t.append(r))}function go(n,e,t,r,s,i){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(i=0),s<r-1&&(l=go(l,e,t,r,s+1,i)),s>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(S.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function pc(n,e,t){return e<n.openStart&&(n=new E(go(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new E(go(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Of={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 mc=null;function Df(){return mc||(mc=document.implementation.createHTMLDocument("title"))}let vi=null;function dx(n){let e=window.trustedTypes;return e?(vi||(vi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),vi.createHTML(n)):n}function fx(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Df().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&Of[r[1].toLowerCase()])&&(n=s.map(i=>"<"+i+">").join("")+n+s.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=dx(n),s)for(let i=0;i<s.length;i++)t=t.querySelector(s[i])||t;return t}function hx(n){let e=n.querySelectorAll(ot?"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 px(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:s,openStart:i,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=S.from(a.create(r[l+1],s)),i++,o++}return new E(s,i,o)}const Le={},Te={};function yt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}Te.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!If(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Er&&ot&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),ul&&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",s=>s(n,yf(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||ax(n,t)?t.preventDefault():yt(n,"key")};Te.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Te.keypress=(n,e)=>{let t=e;if(If(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ne&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof N)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function ei(n){return{left:n.clientX,top:n.clientY}}function mx(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function hl(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(n.someProp(e,l=>o>i.depth?l(n,t,i.nodeAfter,i.before(o),s,!0):l(n,t,i.node(o),i.before(o),s,!1)))return!0;return!1}function gn(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 gx(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&w.isSelectable(r)?(gn(n,new w(t)),!0):!1}function yx(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof w&&(r=t.node);let i=n.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(w.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(o);break}}return s!=null?(gn(n,w.create(n.state.doc,s)),!0):!1}function bx(n,e,t,r,s){return hl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?yx(n,t):gx(n,t))}function kx(n,e,t,r){return hl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function xx(n,e,t,r){return hl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||Sx(n,t,r)}function Sx(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(gn(n,N.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)gn(n,N.create(r,l+1,l+1+o.content.size));else if(w.isSelectable(o))gn(n,w.create(r,l));else continue;return!0}}function pl(n){return Ls(n)}const Rf=Ne?"metaKey":"ctrlKey";Le.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=pl(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&mx(t,n.input.lastClick)&&!t[Rf]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button};let o=n.posAtCoords(ei(t));o&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Cx(n,o,t,!!r)):(i=="doubleClick"?kx:xx)(n,o.pos,o.inside,t)?t.preventDefault():yt(n,"pointer"))};class Cx{constructor(e,t,r,s){this.view=e,this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Rf],this.allowDefault=r.shiftKey;let i,o;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,o=u.depth?u.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof w&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Zs&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),yt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>fl(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(ei(e))),this.updateAllowDefault(e),this.allowDefault||!t?yt(this.view,"pointer"):bx(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||en&&this.mightDrag&&!this.mightDrag.node.isAtom||ot&&!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)?(gn(this.view,I.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):yt(this.view,"pointer")}move(e){this.updateAllowDefault(e),yt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Le.touchstart=n=>{n.input.lastTouch=Date.now(),pl(n),yt(n,"pointer")};Le.touchmove=n=>{n.input.lastTouch=Date.now(),yt(n,"pointer")};Le.contextmenu=n=>pl(n);function If(n,e){return n.composing?!0:en&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Mx=Er?5e3:-1;Te.compositionstart=Te.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof N&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ot&&Sf&&Tx(n)))n.markCursor=n.state.storedMarks||t.marks(),Ls(n,!0),n.markCursor=null;else if(Ls(n,!e.selection.empty),Zs&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}Pf(n,Mx)};function Tx(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"}Te.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++,Pf(n,20))};function Pf(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ls(n),e))}function Ex(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=wx());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function wx(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Ls(n,e=!1){if(!(Er&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Ex(n),e||n.docView&&n.docView.dirty){let t=Xk(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 vx(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(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const mr=Tr&&kf<15||ul&&Yk<604;Le.copy=Te.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=mr?null:t.clipboardData,o=r.content(),{dom:l,text:a}=Ef(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):vx(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Nx(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Ax(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 s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?yo(n,r.value,null,s,e):yo(n,r.textContent,r.innerHTML,s,e)},50)}function yo(n,e,t,r,s){let i=wf(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,s,i||E.empty)))return!0;if(!i)return!1;let o=Nx(i),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Lf(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," "):""}Te.paste=(n,e)=>{let t=e;if(n.composing&&!Er)return;let r=mr?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&yo(n,Lf(r),r.getData("text/html"),s,t)?t.preventDefault():Ax(n,t)};class Ox{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Dx=Ne?"altKey":"ctrlKey";function $f(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[Dx]}Le.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(ei(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof w?s.to-1:s.to))){if(r&&r.mightDrag)o=w.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&&(o=w.create(n.state.doc,d.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=Ef(n,l);(!t.dataTransfer.files.length||!ot||xf>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(mr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",mr||t.dataTransfer.setData("text/plain",c),n.dragging=new Ox(u,$f(n,t),o)};Le.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Te.dragover=Te.dragenter=(n,e)=>e.preventDefault();Te.drop=(n,e)=>{try{Rx(n,e,n.dragging)}finally{n.dragging=null}};function Rx(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(ei(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=wf(n,Lf(e.dataTransfer),mr?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&$f(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||E.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?vo(n.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=n.state.tr;if(o){let{node:h}=t;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&w.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new w(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),a.setSelection(Mf(n,f,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}Le.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())&&fl(n)},20))};Le.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)};Le.beforeinput=(n,e)=>{if(ot&&Er&&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",i=>i(n,yf(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in Te)Le[n]=Te[n];function gr(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 $s{constructor(e,t){this.toDOM=e,this.spec=t||Vt,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new je(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof $s&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&gr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class St{constructor(e,t){this.attrs=e,this.spec=t||Vt}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new je(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof St&&gr(this.attrs,e.attrs)&&gr(this.spec,e.spec)}static is(e){return e.type instanceof St}destroy(){}}class ml{constructor(e,t){this.attrs=e,this.spec=t||Vt}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=i.pos?null:new je(i.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof ml&&gr(this.attrs,e.attrs)&&gr(this.spec,e.spec)}destroy(){}}class je{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new je(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 je(e,e,new $s(t,r))}static inline(e,t,r,s){return new je(e,t,new St(r,s))}static node(e,t,r,s){return new je(e,t,new ml(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof St}get widget(){return this.type instanceof $s}}const hn=[],Vt={};class re{constructor(e,t){this.local=e.length?e:hn,this.children=t.length?t:hn}static create(e,t){return t.length?zs(t,e,0,Vt):me}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,s+l,i)}}map(e,t,r){return this==me||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Vt)}mapInner(e,t,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?Ix(this.children,o||[],e,t,r,s,i):o?new re(o.sort(Wt),hn):me}add(e,t){return t.length?this==me?re.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Bf(t,l,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,u,c+1):s.splice(i,0,a,a+l.nodeSize,zs(u,l,c+1,Vt)),i+=3}});let o=zf(i?Ff(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new re(o.length?this.local.concat(o).sort(Wt):this.local,s||this.children)}remove(e){return e.length==0||this==me?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+t,a=r[i+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,l+1);c!=me?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,t)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new re(s,r):me}forChild(e,t){if(this==me)return this;if(t.isLeaf)return re.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof St){let c=Math.max(i,a.from)-i,u=Math.min(o,a.to)-i;c<u&&(s||(s=[])).push(a.copy(c,u))}}if(s){let l=new re(s.sort(Wt),hn);return r?new Dt([l,r]):l}return r||me}eq(e){if(this==e)return!0;if(!(e instanceof re)||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 gl(this.localsInner(e))}localsInner(e){if(this==me)return hn;if(e.inlineContent||!this.local.some(St.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof St||t.push(this.local[r]);return t}forEachSet(e){e(this)}}re.empty=new re([],[]);re.removeOverlap=gl;const me=re.empty;class Dt{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,Vt));return Dt.from(r)}forChild(e,t){if(t.isLeaf)return re.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=me&&(i instanceof Dt?r=r.concat(i.members):r.push(i))}return Dt.from(r)}eq(e){if(!(e instanceof Dt)||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 s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let o=0;o<i.length;o++)t.push(i[o])}}return t?gl(r?t:t.sort(Wt)):hn}static from(e){switch(e.length){case 0:return me;case 1:return e[0];default:return new Dt(e.every(t=>t instanceof re)?e:e.reduce((t,r)=>t.concat(r instanceof re?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Ix(n,e,t,r,s,i,o){let l=n.slice();for(let c=0,u=i;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<l.length;y+=3){let b=l[y+1];if(b<0||f>b+u-d)continue;let x=l[y]+u-d;h>=x?l[y+1]=f<=x?-2:-1:f>=u&&m&&(l[y]+=m,l[y+1]+=m)}d+=m}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+i),d=u-s;if(d<0||d>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+i,-1),h=f-s,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=l[c+2].mapInner(t,m,u+1,n[c]+i+1,o);y!=me?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Px(l,n,e,t,s,i,o),u=zs(c,r,0,o);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new re(e.sort(Wt),l)}function zf(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new je(s.from+e,s.to+e,s.type))}return t}function Px(n,e,t,r,s,i,o){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,s,c);d?t.push(d):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function Bf(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,o;i<n.length;i++)(o=n[i])&&o.from>t&&o.to<r&&((s||(s=[])).push(o),n[i]=null);return s}function Ff(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function zs(n,e,t,r){let s=[],i=!1;e.forEach((l,a)=>{let c=Bf(n,l,a+t);if(c){i=!0;let u=zs(c,l,t+a+1,r);u!=me&&s.push(a,a+l.nodeSize,u)}});let o=zf(i?Ff(n):n,-t).sort(Wt);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new re(o,s):me}function Wt(n,e){return n.from-e.from||n.to-e.to}function gl(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),gc(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),gc(e,s,r.copy(i.from,r.to)));break}}}return e}function gc(n,e,t){for(;e<n.length&&Wt(t,n[e])>0;)e++;n.splice(e,0,t)}class J extends I{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return J.valid(r)?new J(r):I.near(r)}content(){return E.empty}eq(e){return e instanceof J&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new J(e.resolve(t.pos))}getBookmark(){return new yl(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Lx(e)||!$x(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&J.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=t;let a=e.doc.resolve(s);if(J.valid(a))return a}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!w.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*t),r=!1;continue e}break}i=o,s+=t;let l=e.doc.resolve(s);if(J.valid(l))return l}return null}}}J.prototype.visible=!1;J.findFrom=J.findGapCursorFrom;I.jsonID("gapcursor",J);class yl{constructor(e){this.pos=e}map(e){return new yl(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return J.valid(t)?new J(t):I.near(t)}}function jf(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Lx(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||jf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function $x(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||jf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function zx(){return new W({props:{decorations:Hx,createSelectionBetween(n,e,t){return e.pos==t.pos&&J.valid(t)?new J(t):null},handleClick:Fx,handleKeyDown:Bx,handleDOMEvents:{beforeinput:jx}}})}const Bx=nd({ArrowLeft:jr("horiz",-1),ArrowRight:jr("horiz",1),ArrowUp:jr("vert",-1),ArrowDown:jr("vert",1)});function jr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof N){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=J.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new J(c))),!0):!1}}function Fx(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!J.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&w.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new J(r))),!0)}function jx(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof J))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=S.empty;for(let o=r.length-1;o>=0;o--)s=S.from(r[o].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new E(s,0,0));return i.setSelection(N.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function Hx(n){if(!(n.selection instanceof J))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",re.create(n.doc,[je.widget(n.selection.head,e,{key:"gapcursor"})])}var Bs=200,ie=function(){};ie.prototype.append=function(e){return e.length?(e=ie.from(e),!this.length&&e||e.length<Bs&&this.leafAppend(e)||this.length<Bs&&e.leafPrepend(this)||this.appendInner(e)):this};ie.prototype.prepend=function(e){return e.length?ie.from(e).append(this):this};ie.prototype.appendInner=function(e){return new Vx(this,e)};ie.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ie.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ie.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ie.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};ie.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},t,r),s};ie.from=function(e){return e instanceof ie?e:e&&e.length?new Hf(e):ie.empty};var Hf=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Bs)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Bs)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(ie);ie.empty=new Hf([]);var Vx=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ie);const Wx=500;class Re{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;t&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new Fe(d.map));let h=d.step.map(s.slice(i)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new Fe(p,void 0,void 0,c.length+u.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(i)):d.selection,a=new Re(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,s){let i=[],o=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Fe(e.mapping.maps[u],d,t),h;(h=a&&a.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),t&&(o++,t=void 0),s||(a=f)}let c=o-r.depth;return c>_x&&(l=Kx(l,c),o-=c),new Re(l.append(i),o)}remapping(e,t){let r=new lr;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new Re(this.items.append(e.map(t=>new Fe(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=t;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=i.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),m=f.selection&&f.selection.map(i.slice(a+1,h));m&&l++,r.push(new Fe(p,g,m))}else r.push(new Fe(p))},s);let c=[];for(let f=t;f<o;f++)c.push(new Fe(i.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new Re(u,l);return d.emptyItemCount()>Wx&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=o.selection&&o.selection.map(t.slice(r));u&&i++;let d=new Fe(c.invert(),a,u),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else o.map&&r--},this.items.length,0),new Re(ie.from(s.reverse()),i)}}Re.empty=new Re(ie.empty,0);function Kx(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class Fe{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Fe(t.getMap().invert(),t,this.selection)}}}class pt{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const _x=20;function Ux(n,e,t,r){let s=t.getMeta(Kt),i;if(s)return s.historyState;t.getMeta(Gx)&&(n=new pt(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Kt))return o.getMeta(Kt).redo?new pt(n.done.addTransform(t,void 0,r,_r(e)),n.undone,yc(t.mapping.maps),n.prevTime,n.prevComposition):new pt(n.done,n.undone.addTransform(t,void 0,r,_r(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!qx(t,n.prevRanges)),c=o?Ni(n.prevRanges,t.mapping):yc(t.mapping.maps);return new pt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,_r(e)),Re.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new pt(n.done.rebased(t,i),n.undone.rebased(t,i),Ni(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new pt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ni(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function qx(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(t=!0)}),t}function yc(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,i,o)=>e.push(i,o));return e}function Ni(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),i=e.map(n[r+1],-1);s<=i&&t.push(s,i)}return t}function Jx(n,e,t){let r=_r(e),s=Kt.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),a=new pt(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(Kt,{redo:t,historyState:a})}let Ai=!1,bc=null;function _r(n){let e=n.plugins;if(bc!=e){Ai=!1,bc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ai=!0;break}}return Ai}const Kt=new te("history"),Gx=new te("closeHistory");function Yx(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new W({key:Kt,state:{init(){return new pt(Re.empty,Re.empty,null,0,-1)},apply(e,t,r){return Ux(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Wf:r=="historyRedo"?Kf:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function Vf(n,e){return(t,r)=>{let s=Kt.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=Jx(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Wf=Vf(!1,!0),Kf=Vf(!0,!0);Y.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const t=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(t)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new W({key:new te("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const l=o-s,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(a,c);return n=!0,u}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=o-(i-r),a=o;return e.deleteRange(l,a),!(this.storage.characters({node:e.doc})>r)}})]}});const Xx=Y.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Uk(this.options)]}});Y.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new W({key:new te("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!t||!r)return G.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(!a.isText){if(!(s>=c&&s<=c+a.nodeSize-1))return!1;o+=1}});let l=0;return n.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(st.node(c,c+a.nodeSize,{class:this.options.className}))}),G.create(n,i)}}})]}});const Qx=Y.create({name:"gapCursor",addProseMirrorPlugins(){return[zx()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=$(O(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),_f="placeholder",kc=new te("tiptap__placeholder");function Uf(n){const{editor:e,placeholder:t,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=n,u=[a];return o&&u.push(c),st.node(s,s+i.nodeSize,{class:u.join(" "),[r]:typeof t=="function"?t({editor:e,node:i,pos:s,hasAnchor:l}):t})}function qf(n,e){return typeof n=="function"?n(e):n}function Jf({editor:n,options:e,dataAttribute:t,doc:r,selection:s,from:i,to:o}){const{anchor:l}=s,a=[],c=n.isEmpty;return r.nodesBetween(i,o,(u,d)=>{const f=l>=d&&l<=d+u.nodeSize,h=!u.isLeaf&&Cr(u);return u.type.isTextblock&&(f||!e.showOnlyCurrent)&&h&&a.push(Uf({editor:n,isEmptyDoc:c,dataAttribute:t,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:qf(e.emptyNodeClass,{editor:n,node:u,pos:d,hasAnchor:f})},node:u,pos:d})),e.includeChildren}),a}function Gf({editor:n,options:e,dataAttribute:t,doc:r,selection:s}){if(!(n.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:i}=s,o=[],l=n.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const a=r.resolve(i),c=a.depth>0?a.node(1):a.nodeAfter,u=a.depth>0?a.before(1):i;if(c&&c.type.isTextblock&&Cr(c)){const d=i>=u&&i<=u+c.nodeSize;o.push(Uf({editor:n,isEmptyDoc:l,dataAttribute:t,hasAnchor:d,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:qf(e.emptyNodeClass,{editor:n,node:c,pos:u,hasAnchor:d})},node:c,pos:u}))}}else o.push(...Jf({editor:n,options:e,dataAttribute:t,doc:r,selection:s,from:0,to:r.content.size}));return G.create(r,o)}function Qn(n,e){const t=n.resolve(e);if(t.depth===0){var r;const i=(r=t.nodeAfter)!==null&&r!==void 0?r:t.nodeBefore;if(!i)return{from:e,to:e};const o=t.nodeAfter?e:e-i.nodeSize;return{from:o,to:o+i.nodeSize}}const s=t.before(1);return{from:s,to:s+t.node(1).nodeSize}}function Zn(n,e){return{from:Math.max(0,e.from-1),to:Math.min(n.content.size,e.to-1)}}function Zx(n,e,t){const r=[];return n.forEach((s,i)=>{const o=i,l=o+s.nodeSize,a=o+1,c=l+1;a<t&&c>e&&r.push({from:o,to:l})}),r}function eS(n){if(n.length===0)return[];const e=[...n].sort((r,s)=>r.from-s.from),t=[{...e[0]}];for(let r=1;r<e.length;r+=1){const s=t[t.length-1],i=e[r];i.from<=s.to?s.to=Math.max(s.to,i.to):t.push({...i})}return t}function tS(n,e){const t=Zx(n,e.from,e.to);return t.push(Zn(n,Qn(n,e.from))),e.to>e.from?t.push(Zn(n,Qn(n,Math.min(e.to,n.content.size+1)-1))):e.from<n.content.size+1&&t.push(Zn(n,Qn(n,Math.min(e.from+1,n.content.size)))),t}function nS(n,e,t){const r=[];if(n.docChanged){const s=Js(n);for(const i of s)r.push(...tS(t.doc,i.newRange))}return n.selectionSet&&(r.push(Zn(t.doc,Qn(t.doc,n.mapping.map(e.selection.anchor)))),r.push(Zn(t.doc,Qn(t.doc,t.selection.anchor)))),eS(r)}function rS(n,e,t){const r=Math.max(0,Math.min(n,t.content.size));return{from:r,to:Math.max(r,Math.min(e,t.content.size))}}function sS({decorations:n,ranges:e,editor:t,options:r,dataAttribute:s,doc:i,selection:o}){let l=n;for(const a of e){const{from:c,to:u}=rS(a.from,a.to,i),d=l.find(c,u).filter(h=>h.from>=c&&h.to<=u);d.length&&(l=l.remove(d));const f=Jf({editor:t,options:r,dataAttribute:s,doc:i,selection:o,from:c,to:u});f.length&&(l=l.add(i,f))}return l}function iS({editor:n,options:e,dataAttribute:t}){return{init(r,s){const i=Gf({editor:n,options:e,dataAttribute:t,doc:s.doc,selection:s.selection});return i??G.empty},apply(r,s,i,o){return!r.docChanged&&!r.selectionSet?s:sS({decorations:s.map(r.mapping,r.doc),ranges:nS(r,i,o),editor:n,options:e,dataAttribute:t,doc:o.doc,selection:o.selection})}}}function oS(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function lS({editor:n,options:e}){const t=e.dataAttribute?`data-${oS(e.dataAttribute)}`:`data-${_f}`,r=e.showOnlyCurrent&&!e.includeChildren;return new W({key:kc,...r?{}:{state:iS({editor:n,options:e,dataAttribute:t})},props:{decorations:r?({doc:s,selection:i})=>Gf({editor:n,options:e,dataAttribute:t,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!n.isEditable?G.empty:(i=kc.getState(s))!==null&&i!==void 0?i:G.empty}}})}const JS=Y.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:_f,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[lS({editor:this.editor,options:this.options})]}});function bo(n,e){return!n.selection.empty&&!kd(n.selection)&&e.isEditable}function aS(n,e){return bo(n,e)&&!e.isFocused&&!e.view.dragging}function cS(){var n;(n=window.getSelection())===null||n===void 0||n.removeAllRanges()}function uS(n){n.focus()}Y.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new W({key:new te("selection"),props:{decorations(t){return aS(t,n)?G.create(t.doc,[st.inline(t.selection.from,t.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(t){return bo(t.state,n)&&cS(),!1},focus(t){return bo(t.state,n)&&requestAnimationFrame(()=>{!n.isDestroyed&&t.hasFocus()&&uS(t)}),!1}}}})]}});function xc({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}const dS=Y.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new te(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)===null||n===void 0?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new W({key:e,appendTransaction:(s,i,o)=>{const{doc:l,tr:a,schema:c}=o,u=e.getState(o),d=l.content.size,f=c.nodes[t];if(!s.some(h=>h.getMeta("skipTrailingNode"))&&u)return a.insert(d,f.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!xc({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!xc({node:o,types:r})}}})]}}),fS=Y.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Wf(n,e),redo:()=>({state:n,dispatch:e})=>Kf(n,e)}},addProseMirrorPlugins(){return[Yx(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),hS=Y.create({name:"starterKit",addExtensions(){const n=[];if(this.options.bold!==!1&&n.push(mb.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(ub.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(sf.configure(this.options.bulletList)),this.options.code!==!1&&n.push(bb.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(Sb.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(Cb.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(Xx.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(Qx.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(Mb.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(Tb.configure(this.options.heading)),this.options.undoRedo!==!1&&n.push(fS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&n.push(Eb.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(Ob.configure(this.options.italic)),this.options.listItem!==!1&&n.push(uf.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;n.push(ff.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var t;n.push(rf.configure((t=this.options)===null||t===void 0?void 0:t.link))}if(this.options.orderedList!==!1&&n.push(pf.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(jk.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(Wk.configure(this.options.strike)),this.options.text!==!1&&n.push(Kk.configure(this.options.text)),this.options.underline!==!1){var r;n.push(_k.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;n.push(dS.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return n}});var GS=hS;function pS(n,e){const t={};for(const r of n?.arguments??[])t[r.name]=r.required?Sl().min(1,e):Sl();return th(t)}function mS(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function YS(n){const e=Yt.c(74),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=V.useId(),l=So();let a,c;if(e[0]!==t||e[1]!==l){const le=pS(t,l("chat.dialogPromptArguments.required"));c=nh,a=Zf(le),e[0]=t,e[1]=l,e[2]=a,e[3]=c}else a=e[2],c=e[3];let u;e[4]!==i||e[5]!==t?(u=t?mS(t,i):{},e[4]=i,e[5]=t,e[6]=u):u=e[6];let d;e[7]!==a||e[8]!==u?(d={resolver:a,defaultValues:u,mode:"onChange"},e[7]=a,e[8]=u,e[9]=d):d=e[9];const f=c(d);let h;e[10]!==t?.arguments?(h=t?.arguments??[],e[10]=t?.arguments,e[11]=h):h=e[11];const p=h;let g;e[12]!==f||e[13]!==s||e[14]!==r?(g=async le=>{await s(le),r(null),f.reset()},e[12]=f,e[13]=s,e[14]=r,e[15]=g):g=e[15];const m=g;let y;e[16]!==f||e[17]!==r?(y=le=>{le||(f.reset(),r(null))},e[16]=f,e[17]=r,e[18]=y):y=e[18];const b=y;if(!t)return null;let x;e[19]!==t._meta||e[20]!==t.name||e[21]!==t.title?(x=t.title||dh(t.name,fh(t._meta)),e[19]=t._meta,e[20]=t.name,e[21]=t.title,e[22]=x):x=e[22];let C;e[23]!==x?(C=k.jsx(rh,{children:k.jsx("span",{className:"capitalize",children:x})}),e[23]=x,e[24]=C):C=e[24];let T;e[25]!==t.description?(T=t.description&&k.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[25]=t.description,e[26]=T):T=e[26];let A;e[27]!==T||e[28]!==C?(A=k.jsxs(sh,{children:[C,T]}),e[27]=T,e[28]=C,e[29]=A):A=e[29];let v;e[30]!==f||e[31]!==m?(v=le=>{le.stopPropagation(),f.handleSubmit(m)(le)},e[30]=f,e[31]=m,e[32]=v):v=e[32];let D;if(e[33]!==p||e[34]!==f.control||e[35]!==f.formState.isSubmitting||e[36]!==l){let le;e[38]!==f.control||e[39]!==f.formState.isSubmitting||e[40]!==l?(le=$e=>k.jsx(ph,{control:f.control,name:$e.name,render:wn=>{const{field:Ke}=wn;return k.jsxs(mh,{children:[k.jsxs(gh,{className:"text-xs",children:[$e.name,$e.required?null:k.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ",l("chat.dialogPromptArguments.optional")]})]}),k.jsx(yh,{children:k.jsx(ih,{...Ke,value:Ke.value??"",required:$e.required,placeholder:$e.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),k.jsx(bh,{})]})}},$e.name),e[38]=f.control,e[39]=f.formState.isSubmitting,e[40]=l,e[41]=le):le=e[41],D=p.map(le),e[33]=p,e[34]=f.control,e[35]=f.formState.isSubmitting,e[36]=l,e[37]=D}else D=e[37];let R;e[42]!==b?(R=()=>b(!1),e[42]=b,e[43]=R):R=e[43];const j=f.formState.isSubmitting;let K;e[44]!==l?(K=l("chat.dialogPromptArguments.cancel"),e[44]=l,e[45]=K):K=e[45];let U;e[46]!==f.formState.isSubmitting||e[47]!==R||e[48]!==K?(U=k.jsx(xl,{type:"button",variant:"ghost",onClick:R,disabled:j,children:K}),e[46]=f.formState.isSubmitting,e[47]=R,e[48]=K,e[49]=U):U=e[49];let L;e[50]!==f.formState.isSubmitting||e[51]!==l?(L=f.formState.isSubmitting?k.jsxs("span",{className:"flex items-center gap-2",children:[k.jsx(eh,{size:"xs"}),l("chat.dialogPromptArguments.loading")]}):l("chat.dialogPromptArguments.usePrompt"),e[50]=f.formState.isSubmitting,e[51]=l,e[52]=L):L=e[52];let B;e[53]!==f.formState.isSubmitting||e[54]!==o||e[55]!==L?(B=k.jsx(xl,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:L}),e[53]=f.formState.isSubmitting,e[54]=o,e[55]=L,e[56]=B):B=e[56];let z;e[57]!==U||e[58]!==B?(z=k.jsxs(oh,{children:[U,B]}),e[57]=U,e[58]=B,e[59]=z):z=e[59];let _;e[60]!==o||e[61]!==v||e[62]!==D||e[63]!==z?(_=k.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:v,children:[D,z]}),e[60]=o,e[61]=v,e[62]=D,e[63]=z,e[64]=_):_=e[64];let Q;e[65]!==f||e[66]!==_?(Q=k.jsx(hh,{...f,children:_}),e[65]=f,e[66]=_,e[67]=Q):Q=e[67];let oe;e[68]!==A||e[69]!==Q?(oe=k.jsxs(lh,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[A,Q]}),e[68]=A,e[69]=Q,e[70]=oe):oe=e[70];let Ce;return e[71]!==b||e[72]!==oe?(Ce=k.jsx(ah,{open:!0,onOpenChange:b,children:oe}),e[71]=b,e[72]=oe,e[73]=Ce):Ce=e[73],Ce}function gS(n){if(typeof n!="object"||n===null)return null;const{volume:e,path:t}=n;return typeof e!="string"||e===""||typeof t!="string"||t===""?null:`${e}/${t}/SKILL.md`}function yS(n){return n.storage.mention}function XS(n,e,t){n.chain().focus().insertContentAt(e,[bS(t),{type:"text",text:" "}]).run()}function bS(n){return{type:"mention",attrs:n}}function QS(n,e,t){const r=n.state.doc.nodeAt(e);return r?.type.name==="mention"&&r.attrs.id===t}function kS(n){const e=Yt.c(43),{node:t,selected:r,view:s,editor:i,getPos:o}=n,{name:l,char:a,kind:c,id:u,args:d,metadata:f}=t.attrs,h=So(),p=V.useContext(kh),g=r&&s.editable,m=c==="task",y=a==="@",b=s.editable&&a==="/"&&(c==="prompt"||c===void 0);let x;e[0]!==c||e[1]!==f?(x=c==="skill"?gS(f):null,e[0]=c,e[1]=f,e[2]=x):x=e[2];const C=x,T=!!p&&!!C,A=b||T;let v;e[3]!==d||e[4]!==i||e[5]!==o||e[6]!==u||e[7]!==l?(v=()=>{const bl=yS(i)?.onEditChip;if(!bl||typeof o!="function")return;const kl=o();typeof kl=="number"&&bl({promptId:u,promptName:l,args:d??{},pos:kl})},e[3]=d,e[4]=i,e[5]=o,e[6]=u,e[7]=l,e[8]=v):v=e[8];const D=v;let R;e[9]!==p||e[10]!==T||e[11]!==C||e[12]!==D?(R=()=>{if(T&&C){p.open(C);return}D()},e[9]=p,e[10]=T,e[11]=C,e[12]=D,e[13]=R):R=e[13];const j=R;let K;e[14]!==j||e[15]!==A?(K=lt=>{A&&(lt.preventDefault(),lt.stopPropagation(),j())},e[14]=j,e[15]=A,e[16]=K):K=e[16];const U=K;let L;e[17]!==j||e[18]!==A?(L=lt=>{A&&(lt.key!=="Enter"&&lt.key!==" "||(lt.preventDefault(),lt.stopPropagation(),j()))},e[17]=j,e[18]=A,e[19]=L):L=e[19];const B=L,z=A?"button":void 0,_=A?0:void 0;let Q;e[20]!==A||e[21]!==l||e[22]!==T||e[23]!==h?(Q=A?h(T?"chat.mention.openSkill":"chat.mention.editPrompt",{name:l?Cl(l):""}):void 0,e[20]=A,e[21]=l,e[22]=T,e[23]=h,e[24]=Q):Q=e[24];const oe=A?"cursor-pointer":"cursor-default",Ce=y?"bg-brand-purple-tint text-brand-purple-dark dark:bg-brand-purple/20 dark:text-brand-purple":"bg-brand-yellow-tint text-brand-yellow-dark dark:bg-brand-yellow/20 dark:text-brand-yellow",le=g&&"outline-2 outline-ring outline-offset-0",$e=A&&"hover:brightness-95",wn=!m&&"capitalize";let Ke;e[25]!==le||e[26]!==$e||e[27]!==wn||e[28]!==oe||e[29]!==Ce?(Ke=er("px-1 py-1 rounded","inline-flex items-center gap-1",oe,"select-none","text-xs font-light",Ce,le,$e,wn),e[25]=le,e[26]=$e,e[27]=wn,e[28]=oe,e[29]=Ce,e[30]=Ke):Ke=e[30];let tn;e[31]!==m||e[32]!==l?(tn=m?k.jsx("span",{className:"inline-block max-w-[220px] truncate align-bottom",children:l??""}):l?Cl(l):"",e[31]=m,e[32]=l,e[33]=tn):tn=e[33];let wr;return e[34]!==a||e[35]!==U||e[36]!==B||e[37]!==Ke||e[38]!==tn||e[39]!==z||e[40]!==_||e[41]!==Q?(wr=k.jsxs(zd,{onClick:U,onKeyDown:B,role:z,tabIndex:_,"aria-label":Q,className:Ke,children:[a,tn]}),e[34]=a,e[35]=U,e[36]=B,e[37]=Ke,e[38]=tn,e[39]=z,e[40]=_,e[41]=Q,e[42]=wr):wr=e[42],wr}const ZS=be.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:void 0,parseHTML:n=>n.getAttribute("data-kind")||void 0,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",ee(n,{"data-type":"mention"})]},renderText({node:n}){const e=n.attrs.char??"@",t=n.attrs.name??"";return`${e}${t}`},addNodeView(){return Bd(kS)}});function eC(n){if(n.type!=="tool-suggest_task")return!1;if(n.state==="input-available")return!0;const e=n.output;return n.state==="output-available"&&typeof e?.accepted!="boolean"}function tC(n){const e=Yt.c(19),{id:t,part:r,copyable:s,extraActions:i,alwaysShowActions:o,animate:l}=n,a=s===void 0?!1:s,c=o===void 0?!1:o,u=l===void 0?!1:l,{handleCopy:d}=Sh(),f=So(),[h,p]=V.useState(!1);let g;e[0]!==d||e[1]!==t||e[2]!==r.text?(g=async()=>{uh("chat_message_copied",{message_id:t,chars:r.text.length}),await d(r.text),p(!0),setTimeout(()=>p(!1),2e3)},e[0]=d,e[1]=t,e[2]=r.text,e[3]=g):g=e[3];const m=g,y=a&&i,b=y||i;let x;e[4]!==u||e[5]!==t||e[6]!==r.text?(x=k.jsx(xh,{id:t,text:r.text,animate:u}),e[4]=u,e[5]=t,e[6]=r.text,e[7]=x):x=e[7];let C;e[8]!==c||e[9]!==i||e[10]!==m||e[11]!==h||e[12]!==b||e[13]!==y||e[14]!==f?(C=b&&k.jsxs("div",{className:er("flex w-full items-center gap-2 text-sm text-muted-foreground transition-all duration-200 mt-1 py-1",c?"opacity-100":"opacity-0 pointer-events-none group-hover/part:opacity-100 group-hover/part:pointer-events-auto"),children:[i,y&&i&&k.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),y&&k.jsx("button",{type:"button",onClick:m,className:"text-muted-foreground [@media(hover:hover)]:hover:text-foreground transition-colors active:scale-[0.97]","aria-label":f("chat.textPart.copyMessage"),children:h?k.jsx(ch,{className:"size-4"}):k.jsx(Ch,{className:"size-4"})})]}),e[8]=c,e[9]=i,e[10]=m,e[11]=h,e[12]=b,e[13]=y,e[14]=f,e[15]=C):C=e[15];let T;return e[16]!==x||e[17]!==C?(T=k.jsxs("div",{className:"group/part relative",children:[x,C]}),e[16]=x,e[17]=C,e[18]=T):T=e[18],T}function nC(n,e,t){n.chain().focus().insertContentAt(e,[xS(t),{type:"text",text:" "}]).run()}function xS(n){return{type:"file",attrs:n}}function SS(n){return(n??"").startsWith("image/")}function CS(n){const e=Yt.c(17),{node:t,selected:r,view:s}=n,{name:i,mimeType:o,data:l}=t.attrs,a=r&&s.editable;let c;e[0]!==o?(c=SS(o),e[0]=o,e[1]=c):c=e[1];const u=c,d=a&&"outline-2 outline-ring outline-offset-0";let f;e[2]!==d?(f=er("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",d),e[2]=d,e[3]=f):f=e[3];let h;e[4]!==i?(h=k.jsx(tr,{asChild:!0,children:k.jsx("span",{children:i})}),e[4]=i,e[5]=h):h=e[5];let p;e[6]!==l||e[7]!==u||e[8]!==o||e[9]!==i?(p=k.jsx(nr,{side:"top",className:"max-w-sm p-1.5",children:u?k.jsx("img",{src:`data:${o};base64,${l}`,alt:i,className:"max-w-full max-h-64 object-contain rounded"}):k.jsxs("div",{className:"text-xs",children:[k.jsx("div",{className:"font-medium",children:i}),k.jsx("div",{className:"text-muted-foreground mt-1",children:o})]})}),e[6]=l,e[7]=u,e[8]=o,e[9]=i,e[10]=p):p=e[10];let g;e[11]!==h||e[12]!==p?(g=k.jsxs(rr,{children:[h,p]}),e[11]=h,e[12]=p,e[13]=g):g=e[13];let m;return e[14]!==f||e[15]!==g?(m=k.jsx(zd,{className:f,children:g}),e[14]=f,e[15]=g,e[16]=m):m=e[16],m}const rC=be.create({name:"file",group:"inline",inline:!0,atom:!0,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}:{}},mimeType:{default:null,parseHTML:n=>n.getAttribute("data-mime-type")||null,renderHTML:n=>n.mimeType?{"data-mime-type":n.mimeType}:{}},size:{default:0,parseHTML:n=>{const e=n.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:n=>n.size?{"data-size":String(n.size)}:{}},data:{default:null,parseHTML:n=>n.getAttribute("data-data")||null,renderHTML:n=>n.data?{"data-data":n.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:n,HTMLAttributes:e}){const t={"data-type":"file"};return n.attrs.id&&(t["data-id"]=n.attrs.id),n.attrs.name&&(t["data-name"]=n.attrs.name),n.attrs.mimeType&&(t["data-mime-type"]=n.attrs.mimeType),n.attrs.size&&(t["data-size"]=String(n.attrs.size)),n.attrs.data&&(t["data-data"]=n.attrs.data),["span",{...e,...t}]},renderText({node:n}){return`[${n.attrs.name??""}]`},addNodeView(){return Bd(CS)}}),At=16,ko=2.5,xo=(At-ko)/2,Oi=2*Math.PI*xo;function sC(n){const e=Yt.c(29),{usage:t}=n,r=Co();if(!t)return null;const{totalTokens:s,inputTokens:i,outputTokens:o}=t,l=r?t.cost:0;if(!s&&!i&&!o)return null;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsx(Mh,{size:12}),e[0]=a):a=e[0];let c;e[1]!==l||e[2]!==s?(c=l>0?`$${l.toFixed(4)}`:s.toLocaleString(),e[1]=l,e[2]=s,e[3]=c):c=e[3];let u;e[4]!==c?(u=k.jsx(tr,{asChild:!0,children:k.jsxs("span",{className:"inline-flex items-center text-muted-foreground [@media(hover:hover)]:hover:text-foreground pl-1 h-6 gap-1 whitespace-nowrap shrink-0 cursor-default",children:[a,k.jsx("span",{className:"text-sm font-mono tabular-nums",children:c})]})}),e[4]=c,e[5]=u):u=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx("p",{className:"text-muted text-2xs mb-1",children:"tokens"}),e[6]=d):d=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=k.jsx("span",{className:"text-muted",children:"in"}),e[7]=f):f=e[7];let h;e[8]!==i?(h=i.toLocaleString(),e[8]=i,e[9]=h):h=e[9];let p;e[10]!==h?(p=k.jsx("span",{className:"text-right tabular-nums",children:h}),e[10]=h,e[11]=p):p=e[11];let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=k.jsx("span",{className:"text-muted",children:"out"}),e[12]=g):g=e[12];const m=o-(t.reasoningTokens??0);let y;e[13]!==m?(y=m.toLocaleString(),e[13]=m,e[14]=y):y=e[14];let b;e[15]!==y?(b=k.jsx("span",{className:"text-right tabular-nums",children:y}),e[15]=y,e[16]=b):b=e[16];let x;e[17]!==t?(x=(t.cacheReadTokens>0||t.cacheWriteTokens>0)&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"text-muted",children:"cache hit"}),k.jsx("span",{className:"text-right tabular-nums",children:`${(Mo(t)*100).toFixed(0)}%`})]}),e[17]=t,e[18]=x):x=e[18];let C;e[19]!==l?(C=l>0&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"text-muted",children:"cost"}),k.jsxs("span",{className:"text-right tabular-nums",children:["$",l.toFixed(4)]})]}),e[19]=l,e[20]=C):C=e[20];let T;e[21]!==b||e[22]!==x||e[23]!==C||e[24]!==p?(T=k.jsxs(nr,{side:"top",className:"font-mono text-2xs",children:[d,k.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[f,p,g,b,x,C]})]}),e[21]=b,e[22]=x,e[23]=C,e[24]=p,e[25]=T):T=e[25];let A;return e[26]!==T||e[27]!==u?(A=k.jsxs(rr,{children:[u,T]}),e[26]=T,e[27]=u,e[28]=A):A=e[28],A}function iC(n){const e=Yt.c(19),{usage:t,duration:r}=n,s=Co(),i=r!=null&&r>0,o=s&&t!=null&&(t.cost??0)>0,l=t!=null&&(t.totalTokens??0)>0;if(!i&&!o&&!l)return null;let a;e[0]!==r||e[1]!==i?(a=i?Ml(r/1e3):null,e[0]=r,e[1]=i,e[2]=a):a=e[2];const c=a;let u;e[3]!==r||e[4]!==c||e[5]!==t?(u=c&&k.jsxs(rr,{children:[k.jsx(tr,{asChild:!0,children:k.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:c})}),k.jsxs(nr,{side:"top",className:"font-mono text-2xs",children:[k.jsx("p",{className:"opacity-60 text-2xs mb-1",children:"thinking"}),k.jsx("span",{className:"tabular-nums",children:Ml(r/1e3)}),(t?.reasoningTokens??0)>0&&k.jsxs("span",{className:"ml-2 opacity-50",children:[t.reasoningTokens.toLocaleString()," tok"]})]})]}),e[3]=r,e[4]=c,e[5]=t,e[6]=u):u=e[6];let d;e[7]!==o||e[8]!==i||e[9]!==l?(d=i&&(o||l)&&k.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),e[7]=o,e[8]=i,e[9]=l,e[10]=d):d=e[10];let f;e[11]!==o||e[12]!==l||e[13]!==t?(f=(o||l)&&k.jsxs(rr,{children:[k.jsx(tr,{asChild:!0,children:k.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:o?`$${t.cost.toFixed(4)}`:`${t.totalTokens.toLocaleString()} tok`})}),k.jsxs(nr,{side:"top",className:"font-mono text-2xs",children:[k.jsx("p",{className:"opacity-60 text-2xs mb-1",children:"tokens"}),k.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[k.jsx("span",{className:"opacity-60",children:"in"}),k.jsx("span",{className:"text-right tabular-nums",children:(t.inputTokens??0).toLocaleString()}),k.jsx("span",{className:"opacity-60",children:"out"}),k.jsx("span",{className:"text-right tabular-nums",children:((t.outputTokens??0)-(t?.reasoningTokens??0)).toLocaleString()}),(t?.reasoningTokens??0)>0&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"opacity-60",children:"think"}),k.jsx("span",{className:"text-right tabular-nums",children:t.reasoningTokens.toLocaleString()})]}),((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"opacity-60",children:"cache hit"}),k.jsx("span",{className:"text-right tabular-nums",children:`${(Mo(t)*100).toFixed(0)}%`})]})]})]})]}),e[11]=o,e[12]=l,e[13]=t,e[14]=f):f=e[14];let h;return e[15]!==u||e[16]!==d||e[17]!==f?(h=k.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[u,d,f]}),e[15]=u,e[16]=d,e[17]=f,e[18]=h):h=e[18],h}function oC(n){const e=Yt.c(52),{usage:t,totalTokens:r,contextWindow:s,onOpenContextPanel:i}=n,o=Co(),l=Math.min(r/s*100,100),a=Oi-l/100*Oi,c=o?t?.cost??0:0,u=(t?.cost??0)>0,d=t?.inputTokens??0,f=t?.outputTokens??0;let h;e[0]!==l?(h=l.toFixed(0),e[0]=l,e[1]=h):h=e[1];let p;e[2]!==c?(p=c>0?`, $${c.toFixed(2)}`:"",e[2]=c,e[3]=p):p=e[3];const g=`Context usage: ${h}%${p}`,m=i?"cursor-pointer":"cursor-default";let y;e[4]!==m?(y=er("flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0",m),e[4]=m,e[5]=y):y=e[5];let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=k.jsx("circle",{cx:At/2,cy:At/2,r:xo,fill:"none",stroke:"currentColor",strokeWidth:ko,className:"opacity-15"}),e[6]=b):b=e[6];const x=l>90?"text-destructive":l>70?"text-warning":"text-muted-foreground";let C;e[7]!==x?(C=er(x),e[7]=x,e[8]=C):C=e[8];let T;e[9]!==a||e[10]!==C?(T=k.jsxs("svg",{width:At,height:At,className:"-rotate-90","aria-hidden":"true",children:[b,k.jsx("circle",{cx:At/2,cy:At/2,r:xo,fill:"none",stroke:"currentColor",strokeWidth:ko,strokeDasharray:Oi,strokeDashoffset:a,strokeLinecap:"round",className:C})]}),e[9]=a,e[10]=C,e[11]=T):T=e[11];let A;e[12]!==l?(A=l.toFixed(0),e[12]=l,e[13]=A):A=e[13];let v;e[14]!==c?(v=c>0?` · $${c.toFixed(2)}`:"",e[14]=c,e[15]=v):v=e[15];let D;e[16]!==A||e[17]!==v?(D=k.jsxs("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100 text-2xs font-mono tabular-nums",children:[A,"%",v]}),e[16]=A,e[17]=v,e[18]=D):D=e[18];let R;e[19]!==i||e[20]!==D||e[21]!==g||e[22]!==y||e[23]!==T?(R=k.jsx(tr,{asChild:!0,children:k.jsxs("button",{type:"button",onClick:i,"aria-label":g,className:y,children:[T,D]})}),e[19]=i,e[20]=D,e[21]=g,e[22]=y,e[23]=T,e[24]=R):R=e[24];let j;e[25]===Symbol.for("react.memo_cache_sentinel")?(j=k.jsx("span",{className:"text-muted",children:"context"}),e[25]=j):j=e[25];let K;e[26]!==r?(K=r.toLocaleString(),e[26]=r,e[27]=K):K=e[27];let U;e[28]!==s?(U=s.toLocaleString(),e[28]=s,e[29]=U):U=e[29];let L;e[30]!==l?(L=l.toFixed(1),e[30]=l,e[31]=L):L=e[31];let B;e[32]!==K||e[33]!==U||e[34]!==L?(B=k.jsxs("span",{className:"text-right tabular-nums",children:[K," / ",U," (",L,"%)"]}),e[32]=K,e[33]=U,e[34]=L,e[35]=B):B=e[35];let z;e[36]!==c?(z=c>0&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"text-muted",children:"cost"}),k.jsxs("span",{className:"text-right tabular-nums",children:["$",c.toFixed(4)]})]}),e[36]=c,e[37]=z):z=e[37];let _;e[38]!==u||e[39]!==d||e[40]!==f?(_=u&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"text-muted",children:"in"}),k.jsx("span",{className:"text-right tabular-nums",children:d.toLocaleString()}),k.jsx("span",{className:"text-muted",children:"out"}),k.jsx("span",{className:"text-right tabular-nums",children:f.toLocaleString()})]}),e[38]=u,e[39]=d,e[40]=f,e[41]=_):_=e[41];let Q;e[42]!==t?(Q=((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"text-muted",children:"cache hit"}),k.jsx("span",{className:"text-right tabular-nums",children:`${(Mo(t)*100).toFixed(0)}%`})]}),e[42]=t,e[43]=Q):Q=e[43];let oe;e[44]!==B||e[45]!==z||e[46]!==_||e[47]!==Q?(oe=k.jsx(nr,{side:"top",className:"font-mono text-2xs",children:k.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[j,B,z,_,Q]})}),e[44]=B,e[45]=z,e[46]=_,e[47]=Q,e[48]=oe):oe=e[48];let Ce;return e[49]!==R||e[50]!==oe?(Ce=k.jsxs(rr,{children:[R,oe]}),e[49]=R,e[50]=oe,e[51]=Ce):Ce=e[51],Ce}export{gp as $,Ko as A,$ as B,O as C,G as D,Y as E,rC as F,HS as G,WS as H,zS as I,Ny as J,VS as K,w0 as L,Xt as M,be as N,My as O,YS as P,zd as Q,Bd as R,oC as S,N as T,Z0 as U,KS as V,Mn as W,qS as X,Fk as Y,Bk as Z,nd as _,G1 as a,S as a0,E as a1,re as a2,je as a3,w as a4,eu as a5,BS as a6,Wo as a7,Ay as a8,yd as a9,U1 as b,bS as c,sC as d,tC as e,ZS as f,jS as g,iC as h,eC as i,US as j,XS as k,nC as l,ee as m,te as n,W as o,yS as p,QS as q,Go as r,GS as s,JS as t,_S as u,st as v,FS as w,I as x,d0 as y,Kn as z};
141
+ `))),0,0),n.someProp("transformPasted",f=>{l=f(l,n,!0)}),l;let d=n.someProp("clipboardTextParser",f=>f(e,s,r,n));if(d)l=d;else{let f=s.marks(),{schema:h}=n.state,p=rt.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=fx(t),dl&&hx(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||He.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!cx.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=px(pc(l,+u[1],+u[2]),u[4]);else if(l=E.maxOpen(ux(l.content,s),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=pc(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n,a)}),l}const cx=/^(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 ux(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),i,o=[];if(n.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&i.length&&Nf(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Af(o[o.length-1],i.length));let u=vf(l,a);o.push(u),s=s.matchType(u.type),i=a}}),o)return S.from(o)}return n}function vf(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,S.from(n));return n}function Nf(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=Nf(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(S.from(vf(t,n,s+1))))}}function Af(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Af(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(S.empty,!0);return n.copy(t.append(r))}function go(n,e,t,r,s,i){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(i=0),s<r-1&&(l=go(l,e,t,r,s+1,i)),s>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(S.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function pc(n,e,t){return e<n.openStart&&(n=new E(go(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new E(go(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Of={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 mc=null;function Df(){return mc||(mc=document.implementation.createHTMLDocument("title"))}let vi=null;function dx(n){let e=window.trustedTypes;return e?(vi||(vi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),vi.createHTML(n)):n}function fx(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Df().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&Of[r[1].toLowerCase()])&&(n=s.map(i=>"<"+i+">").join("")+n+s.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=dx(n),s)for(let i=0;i<s.length;i++)t=t.querySelector(s[i])||t;return t}function hx(n){let e=n.querySelectorAll(ot?"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 px(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:s,openStart:i,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=S.from(a.create(r[l+1],s)),i++,o++}return new E(s,i,o)}const Le={},Te={};function yt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}Te.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!If(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Er&&ot&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),ul&&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",s=>s(n,yf(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||ax(n,t)?t.preventDefault():yt(n,"key")};Te.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Te.keypress=(n,e)=>{let t=e;if(If(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ne&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof N)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function ei(n){return{left:n.clientX,top:n.clientY}}function mx(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function hl(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(n.someProp(e,l=>o>i.depth?l(n,t,i.nodeAfter,i.before(o),s,!0):l(n,t,i.node(o),i.before(o),s,!1)))return!0;return!1}function gn(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 gx(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&w.isSelectable(r)?(gn(n,new w(t)),!0):!1}function yx(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof w&&(r=t.node);let i=n.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(w.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(o);break}}return s!=null?(gn(n,w.create(n.state.doc,s)),!0):!1}function bx(n,e,t,r,s){return hl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?yx(n,t):gx(n,t))}function kx(n,e,t,r){return hl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function xx(n,e,t,r){return hl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||Sx(n,t,r)}function Sx(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(gn(n,N.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)gn(n,N.create(r,l+1,l+1+o.content.size));else if(w.isSelectable(o))gn(n,w.create(r,l));else continue;return!0}}function pl(n){return Ls(n)}const Rf=Ne?"metaKey":"ctrlKey";Le.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=pl(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&mx(t,n.input.lastClick)&&!t[Rf]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button};let o=n.posAtCoords(ei(t));o&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Cx(n,o,t,!!r)):(i=="doubleClick"?kx:xx)(n,o.pos,o.inside,t)?t.preventDefault():yt(n,"pointer"))};class Cx{constructor(e,t,r,s){this.view=e,this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Rf],this.allowDefault=r.shiftKey;let i,o;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,o=u.depth?u.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof w&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Zs&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),yt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>fl(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(ei(e))),this.updateAllowDefault(e),this.allowDefault||!t?yt(this.view,"pointer"):bx(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||en&&this.mightDrag&&!this.mightDrag.node.isAtom||ot&&!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)?(gn(this.view,I.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):yt(this.view,"pointer")}move(e){this.updateAllowDefault(e),yt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Le.touchstart=n=>{n.input.lastTouch=Date.now(),pl(n),yt(n,"pointer")};Le.touchmove=n=>{n.input.lastTouch=Date.now(),yt(n,"pointer")};Le.contextmenu=n=>pl(n);function If(n,e){return n.composing?!0:en&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Mx=Er?5e3:-1;Te.compositionstart=Te.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof N&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ot&&Sf&&Tx(n)))n.markCursor=n.state.storedMarks||t.marks(),Ls(n,!0),n.markCursor=null;else if(Ls(n,!e.selection.empty),Zs&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}Pf(n,Mx)};function Tx(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"}Te.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++,Pf(n,20))};function Pf(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ls(n),e))}function Ex(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=wx());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function wx(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Ls(n,e=!1){if(!(Er&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Ex(n),e||n.docView&&n.docView.dirty){let t=Xk(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 vx(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(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const mr=Tr&&kf<15||ul&&Yk<604;Le.copy=Te.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=mr?null:t.clipboardData,o=r.content(),{dom:l,text:a}=Ef(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):vx(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Nx(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Ax(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 s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?yo(n,r.value,null,s,e):yo(n,r.textContent,r.innerHTML,s,e)},50)}function yo(n,e,t,r,s){let i=wf(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,s,i||E.empty)))return!0;if(!i)return!1;let o=Nx(i),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Lf(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," "):""}Te.paste=(n,e)=>{let t=e;if(n.composing&&!Er)return;let r=mr?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&yo(n,Lf(r),r.getData("text/html"),s,t)?t.preventDefault():Ax(n,t)};class Ox{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Dx=Ne?"altKey":"ctrlKey";function $f(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[Dx]}Le.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(ei(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof w?s.to-1:s.to))){if(r&&r.mightDrag)o=w.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&&(o=w.create(n.state.doc,d.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=Ef(n,l);(!t.dataTransfer.files.length||!ot||xf>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(mr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",mr||t.dataTransfer.setData("text/plain",c),n.dragging=new Ox(u,$f(n,t),o)};Le.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Te.dragover=Te.dragenter=(n,e)=>e.preventDefault();Te.drop=(n,e)=>{try{Rx(n,e,n.dragging)}finally{n.dragging=null}};function Rx(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(ei(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=wf(n,Lf(e.dataTransfer),mr?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&$f(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||E.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?vo(n.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=n.state.tr;if(o){let{node:h}=t;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&w.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new w(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),a.setSelection(Mf(n,f,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}Le.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())&&fl(n)},20))};Le.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)};Le.beforeinput=(n,e)=>{if(ot&&Er&&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",i=>i(n,yf(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in Te)Le[n]=Te[n];function gr(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 $s{constructor(e,t){this.toDOM=e,this.spec=t||Vt,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new je(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof $s&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&gr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class St{constructor(e,t){this.attrs=e,this.spec=t||Vt}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new je(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof St&&gr(this.attrs,e.attrs)&&gr(this.spec,e.spec)}static is(e){return e.type instanceof St}destroy(){}}class ml{constructor(e,t){this.attrs=e,this.spec=t||Vt}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=i.pos?null:new je(i.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof ml&&gr(this.attrs,e.attrs)&&gr(this.spec,e.spec)}destroy(){}}class je{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new je(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 je(e,e,new $s(t,r))}static inline(e,t,r,s){return new je(e,t,new St(r,s))}static node(e,t,r,s){return new je(e,t,new ml(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof St}get widget(){return this.type instanceof $s}}const hn=[],Vt={};class re{constructor(e,t){this.local=e.length?e:hn,this.children=t.length?t:hn}static create(e,t){return t.length?zs(t,e,0,Vt):me}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,s+l,i)}}map(e,t,r){return this==me||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Vt)}mapInner(e,t,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?Ix(this.children,o||[],e,t,r,s,i):o?new re(o.sort(Wt),hn):me}add(e,t){return t.length?this==me?re.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Bf(t,l,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,u,c+1):s.splice(i,0,a,a+l.nodeSize,zs(u,l,c+1,Vt)),i+=3}});let o=zf(i?Ff(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new re(o.length?this.local.concat(o).sort(Wt):this.local,s||this.children)}remove(e){return e.length==0||this==me?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+t,a=r[i+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,l+1);c!=me?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,t)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new re(s,r):me}forChild(e,t){if(this==me)return this;if(t.isLeaf)return re.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof St){let c=Math.max(i,a.from)-i,u=Math.min(o,a.to)-i;c<u&&(s||(s=[])).push(a.copy(c,u))}}if(s){let l=new re(s.sort(Wt),hn);return r?new Dt([l,r]):l}return r||me}eq(e){if(this==e)return!0;if(!(e instanceof re)||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 gl(this.localsInner(e))}localsInner(e){if(this==me)return hn;if(e.inlineContent||!this.local.some(St.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof St||t.push(this.local[r]);return t}forEachSet(e){e(this)}}re.empty=new re([],[]);re.removeOverlap=gl;const me=re.empty;class Dt{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,Vt));return Dt.from(r)}forChild(e,t){if(t.isLeaf)return re.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=me&&(i instanceof Dt?r=r.concat(i.members):r.push(i))}return Dt.from(r)}eq(e){if(!(e instanceof Dt)||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 s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let o=0;o<i.length;o++)t.push(i[o])}}return t?gl(r?t:t.sort(Wt)):hn}static from(e){switch(e.length){case 0:return me;case 1:return e[0];default:return new Dt(e.every(t=>t instanceof re)?e:e.reduce((t,r)=>t.concat(r instanceof re?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Ix(n,e,t,r,s,i,o){let l=n.slice();for(let c=0,u=i;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<l.length;y+=3){let b=l[y+1];if(b<0||f>b+u-d)continue;let x=l[y]+u-d;h>=x?l[y+1]=f<=x?-2:-1:f>=u&&m&&(l[y]+=m,l[y+1]+=m)}d+=m}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+i),d=u-s;if(d<0||d>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+i,-1),h=f-s,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=l[c+2].mapInner(t,m,u+1,n[c]+i+1,o);y!=me?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Px(l,n,e,t,s,i,o),u=zs(c,r,0,o);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new re(e.sort(Wt),l)}function zf(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new je(s.from+e,s.to+e,s.type))}return t}function Px(n,e,t,r,s,i,o){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,s,c);d?t.push(d):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function Bf(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,o;i<n.length;i++)(o=n[i])&&o.from>t&&o.to<r&&((s||(s=[])).push(o),n[i]=null);return s}function Ff(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function zs(n,e,t,r){let s=[],i=!1;e.forEach((l,a)=>{let c=Bf(n,l,a+t);if(c){i=!0;let u=zs(c,l,t+a+1,r);u!=me&&s.push(a,a+l.nodeSize,u)}});let o=zf(i?Ff(n):n,-t).sort(Wt);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new re(o,s):me}function Wt(n,e){return n.from-e.from||n.to-e.to}function gl(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),gc(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),gc(e,s,r.copy(i.from,r.to)));break}}}return e}function gc(n,e,t){for(;e<n.length&&Wt(t,n[e])>0;)e++;n.splice(e,0,t)}class J extends I{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return J.valid(r)?new J(r):I.near(r)}content(){return E.empty}eq(e){return e instanceof J&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new J(e.resolve(t.pos))}getBookmark(){return new yl(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Lx(e)||!$x(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&J.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=t;let a=e.doc.resolve(s);if(J.valid(a))return a}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!w.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*t),r=!1;continue e}break}i=o,s+=t;let l=e.doc.resolve(s);if(J.valid(l))return l}return null}}}J.prototype.visible=!1;J.findFrom=J.findGapCursorFrom;I.jsonID("gapcursor",J);class yl{constructor(e){this.pos=e}map(e){return new yl(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return J.valid(t)?new J(t):I.near(t)}}function jf(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Lx(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||jf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function $x(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||jf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function zx(){return new W({props:{decorations:Hx,createSelectionBetween(n,e,t){return e.pos==t.pos&&J.valid(t)?new J(t):null},handleClick:Fx,handleKeyDown:Bx,handleDOMEvents:{beforeinput:jx}}})}const Bx=nd({ArrowLeft:jr("horiz",-1),ArrowRight:jr("horiz",1),ArrowUp:jr("vert",-1),ArrowDown:jr("vert",1)});function jr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof N){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=J.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new J(c))),!0):!1}}function Fx(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!J.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&w.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new J(r))),!0)}function jx(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof J))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=S.empty;for(let o=r.length-1;o>=0;o--)s=S.from(r[o].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new E(s,0,0));return i.setSelection(N.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function Hx(n){if(!(n.selection instanceof J))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",re.create(n.doc,[je.widget(n.selection.head,e,{key:"gapcursor"})])}var Bs=200,ie=function(){};ie.prototype.append=function(e){return e.length?(e=ie.from(e),!this.length&&e||e.length<Bs&&this.leafAppend(e)||this.length<Bs&&e.leafPrepend(this)||this.appendInner(e)):this};ie.prototype.prepend=function(e){return e.length?ie.from(e).append(this):this};ie.prototype.appendInner=function(e){return new Vx(this,e)};ie.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ie.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ie.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ie.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};ie.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},t,r),s};ie.from=function(e){return e instanceof ie?e:e&&e.length?new Hf(e):ie.empty};var Hf=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Bs)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Bs)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(ie);ie.empty=new Hf([]);var Vx=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ie);const Wx=500;class Re{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;t&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new Fe(d.map));let h=d.step.map(s.slice(i)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new Fe(p,void 0,void 0,c.length+u.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(i)):d.selection,a=new Re(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,s){let i=[],o=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Fe(e.mapping.maps[u],d,t),h;(h=a&&a.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),t&&(o++,t=void 0),s||(a=f)}let c=o-r.depth;return c>_x&&(l=Kx(l,c),o-=c),new Re(l.append(i),o)}remapping(e,t){let r=new lr;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new Re(this.items.append(e.map(t=>new Fe(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=t;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=i.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),m=f.selection&&f.selection.map(i.slice(a+1,h));m&&l++,r.push(new Fe(p,g,m))}else r.push(new Fe(p))},s);let c=[];for(let f=t;f<o;f++)c.push(new Fe(i.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new Re(u,l);return d.emptyItemCount()>Wx&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=o.selection&&o.selection.map(t.slice(r));u&&i++;let d=new Fe(c.invert(),a,u),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else o.map&&r--},this.items.length,0),new Re(ie.from(s.reverse()),i)}}Re.empty=new Re(ie.empty,0);function Kx(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class Fe{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Fe(t.getMap().invert(),t,this.selection)}}}class pt{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const _x=20;function Ux(n,e,t,r){let s=t.getMeta(Kt),i;if(s)return s.historyState;t.getMeta(Gx)&&(n=new pt(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Kt))return o.getMeta(Kt).redo?new pt(n.done.addTransform(t,void 0,r,_r(e)),n.undone,yc(t.mapping.maps),n.prevTime,n.prevComposition):new pt(n.done,n.undone.addTransform(t,void 0,r,_r(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!qx(t,n.prevRanges)),c=o?Ni(n.prevRanges,t.mapping):yc(t.mapping.maps);return new pt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,_r(e)),Re.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new pt(n.done.rebased(t,i),n.undone.rebased(t,i),Ni(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new pt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ni(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function qx(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(t=!0)}),t}function yc(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,i,o)=>e.push(i,o));return e}function Ni(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),i=e.map(n[r+1],-1);s<=i&&t.push(s,i)}return t}function Jx(n,e,t){let r=_r(e),s=Kt.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),a=new pt(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(Kt,{redo:t,historyState:a})}let Ai=!1,bc=null;function _r(n){let e=n.plugins;if(bc!=e){Ai=!1,bc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ai=!0;break}}return Ai}const Kt=new te("history"),Gx=new te("closeHistory");function Yx(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new W({key:Kt,state:{init(){return new pt(Re.empty,Re.empty,null,0,-1)},apply(e,t,r){return Ux(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Wf:r=="historyRedo"?Kf:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function Vf(n,e){return(t,r)=>{let s=Kt.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=Jx(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Wf=Vf(!1,!0),Kf=Vf(!0,!0);Y.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const t=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(t)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new W({key:new te("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const l=o-s,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(a,c);return n=!0,u}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=o-(i-r),a=o;return e.deleteRange(l,a),!(this.storage.characters({node:e.doc})>r)}})]}});const Xx=Y.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Uk(this.options)]}});Y.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new W({key:new te("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!t||!r)return G.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(!a.isText){if(!(s>=c&&s<=c+a.nodeSize-1))return!1;o+=1}});let l=0;return n.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(st.node(c,c+a.nodeSize,{class:this.options.className}))}),G.create(n,i)}}})]}});const Qx=Y.create({name:"gapCursor",addProseMirrorPlugins(){return[zx()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=$(O(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),_f="placeholder",kc=new te("tiptap__placeholder");function Uf(n){const{editor:e,placeholder:t,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=n,u=[a];return o&&u.push(c),st.node(s,s+i.nodeSize,{class:u.join(" "),[r]:typeof t=="function"?t({editor:e,node:i,pos:s,hasAnchor:l}):t})}function qf(n,e){return typeof n=="function"?n(e):n}function Jf({editor:n,options:e,dataAttribute:t,doc:r,selection:s,from:i,to:o}){const{anchor:l}=s,a=[],c=n.isEmpty;return r.nodesBetween(i,o,(u,d)=>{const f=l>=d&&l<=d+u.nodeSize,h=!u.isLeaf&&Cr(u);return u.type.isTextblock&&(f||!e.showOnlyCurrent)&&h&&a.push(Uf({editor:n,isEmptyDoc:c,dataAttribute:t,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:qf(e.emptyNodeClass,{editor:n,node:u,pos:d,hasAnchor:f})},node:u,pos:d})),e.includeChildren}),a}function Gf({editor:n,options:e,dataAttribute:t,doc:r,selection:s}){if(!(n.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:i}=s,o=[],l=n.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const a=r.resolve(i),c=a.depth>0?a.node(1):a.nodeAfter,u=a.depth>0?a.before(1):i;if(c&&c.type.isTextblock&&Cr(c)){const d=i>=u&&i<=u+c.nodeSize;o.push(Uf({editor:n,isEmptyDoc:l,dataAttribute:t,hasAnchor:d,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:qf(e.emptyNodeClass,{editor:n,node:c,pos:u,hasAnchor:d})},node:c,pos:u}))}}else o.push(...Jf({editor:n,options:e,dataAttribute:t,doc:r,selection:s,from:0,to:r.content.size}));return G.create(r,o)}function Qn(n,e){const t=n.resolve(e);if(t.depth===0){var r;const i=(r=t.nodeAfter)!==null&&r!==void 0?r:t.nodeBefore;if(!i)return{from:e,to:e};const o=t.nodeAfter?e:e-i.nodeSize;return{from:o,to:o+i.nodeSize}}const s=t.before(1);return{from:s,to:s+t.node(1).nodeSize}}function Zn(n,e){return{from:Math.max(0,e.from-1),to:Math.min(n.content.size,e.to-1)}}function Zx(n,e,t){const r=[];return n.forEach((s,i)=>{const o=i,l=o+s.nodeSize,a=o+1,c=l+1;a<t&&c>e&&r.push({from:o,to:l})}),r}function eS(n){if(n.length===0)return[];const e=[...n].sort((r,s)=>r.from-s.from),t=[{...e[0]}];for(let r=1;r<e.length;r+=1){const s=t[t.length-1],i=e[r];i.from<=s.to?s.to=Math.max(s.to,i.to):t.push({...i})}return t}function tS(n,e){const t=Zx(n,e.from,e.to);return t.push(Zn(n,Qn(n,e.from))),e.to>e.from?t.push(Zn(n,Qn(n,Math.min(e.to,n.content.size+1)-1))):e.from<n.content.size+1&&t.push(Zn(n,Qn(n,Math.min(e.from+1,n.content.size)))),t}function nS(n,e,t){const r=[];if(n.docChanged){const s=Js(n);for(const i of s)r.push(...tS(t.doc,i.newRange))}return n.selectionSet&&(r.push(Zn(t.doc,Qn(t.doc,n.mapping.map(e.selection.anchor)))),r.push(Zn(t.doc,Qn(t.doc,t.selection.anchor)))),eS(r)}function rS(n,e,t){const r=Math.max(0,Math.min(n,t.content.size));return{from:r,to:Math.max(r,Math.min(e,t.content.size))}}function sS({decorations:n,ranges:e,editor:t,options:r,dataAttribute:s,doc:i,selection:o}){let l=n;for(const a of e){const{from:c,to:u}=rS(a.from,a.to,i),d=l.find(c,u).filter(h=>h.from>=c&&h.to<=u);d.length&&(l=l.remove(d));const f=Jf({editor:t,options:r,dataAttribute:s,doc:i,selection:o,from:c,to:u});f.length&&(l=l.add(i,f))}return l}function iS({editor:n,options:e,dataAttribute:t}){return{init(r,s){const i=Gf({editor:n,options:e,dataAttribute:t,doc:s.doc,selection:s.selection});return i??G.empty},apply(r,s,i,o){return!r.docChanged&&!r.selectionSet?s:sS({decorations:s.map(r.mapping,r.doc),ranges:nS(r,i,o),editor:n,options:e,dataAttribute:t,doc:o.doc,selection:o.selection})}}}function oS(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function lS({editor:n,options:e}){const t=e.dataAttribute?`data-${oS(e.dataAttribute)}`:`data-${_f}`,r=e.showOnlyCurrent&&!e.includeChildren;return new W({key:kc,...r?{}:{state:iS({editor:n,options:e,dataAttribute:t})},props:{decorations:r?({doc:s,selection:i})=>Gf({editor:n,options:e,dataAttribute:t,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!n.isEditable?G.empty:(i=kc.getState(s))!==null&&i!==void 0?i:G.empty}}})}const qS=Y.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:_f,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[lS({editor:this.editor,options:this.options})]}});function bo(n,e){return!n.selection.empty&&!kd(n.selection)&&e.isEditable}function aS(n,e){return bo(n,e)&&!e.isFocused&&!e.view.dragging}function cS(){var n;(n=window.getSelection())===null||n===void 0||n.removeAllRanges()}function uS(n){n.focus()}Y.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new W({key:new te("selection"),props:{decorations(t){return aS(t,n)?G.create(t.doc,[st.inline(t.selection.from,t.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(t){return bo(t.state,n)&&cS(),!1},focus(t){return bo(t.state,n)&&requestAnimationFrame(()=>{!n.isDestroyed&&t.hasFocus()&&uS(t)}),!1}}}})]}});function xc({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}const dS=Y.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new te(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)===null||n===void 0?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new W({key:e,appendTransaction:(s,i,o)=>{const{doc:l,tr:a,schema:c}=o,u=e.getState(o),d=l.content.size,f=c.nodes[t];if(!s.some(h=>h.getMeta("skipTrailingNode"))&&u)return a.insert(d,f.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!xc({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!xc({node:o,types:r})}}})]}}),fS=Y.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Wf(n,e),redo:()=>({state:n,dispatch:e})=>Kf(n,e)}},addProseMirrorPlugins(){return[Yx(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),hS=Y.create({name:"starterKit",addExtensions(){const n=[];if(this.options.bold!==!1&&n.push(mb.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(ub.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(sf.configure(this.options.bulletList)),this.options.code!==!1&&n.push(bb.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(Sb.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(Cb.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(Xx.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(Qx.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(Mb.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(Tb.configure(this.options.heading)),this.options.undoRedo!==!1&&n.push(fS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&n.push(Eb.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(Ob.configure(this.options.italic)),this.options.listItem!==!1&&n.push(uf.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;n.push(ff.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var t;n.push(rf.configure((t=this.options)===null||t===void 0?void 0:t.link))}if(this.options.orderedList!==!1&&n.push(pf.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(jk.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(Wk.configure(this.options.strike)),this.options.text!==!1&&n.push(Kk.configure(this.options.text)),this.options.underline!==!1){var r;n.push(_k.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;n.push(dS.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return n}});var JS=hS;function pS(n,e){const t={};for(const r of n?.arguments??[])t[r.name]=r.required?Sl().min(1,e):Sl();return th(t)}function mS(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function GS(n){const e=Yt.c(74),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=V.useId(),l=So();let a,c;if(e[0]!==t||e[1]!==l){const le=pS(t,l("chat.dialogPromptArguments.required"));c=nh,a=Zf(le),e[0]=t,e[1]=l,e[2]=a,e[3]=c}else a=e[2],c=e[3];let u;e[4]!==i||e[5]!==t?(u=t?mS(t,i):{},e[4]=i,e[5]=t,e[6]=u):u=e[6];let d;e[7]!==a||e[8]!==u?(d={resolver:a,defaultValues:u,mode:"onChange"},e[7]=a,e[8]=u,e[9]=d):d=e[9];const f=c(d);let h;e[10]!==t?.arguments?(h=t?.arguments??[],e[10]=t?.arguments,e[11]=h):h=e[11];const p=h;let g;e[12]!==f||e[13]!==s||e[14]!==r?(g=async le=>{await s(le),r(null),f.reset()},e[12]=f,e[13]=s,e[14]=r,e[15]=g):g=e[15];const m=g;let y;e[16]!==f||e[17]!==r?(y=le=>{le||(f.reset(),r(null))},e[16]=f,e[17]=r,e[18]=y):y=e[18];const b=y;if(!t)return null;let x;e[19]!==t._meta||e[20]!==t.name||e[21]!==t.title?(x=t.title||dh(t.name,fh(t._meta)),e[19]=t._meta,e[20]=t.name,e[21]=t.title,e[22]=x):x=e[22];let C;e[23]!==x?(C=k.jsx(rh,{children:k.jsx("span",{className:"capitalize",children:x})}),e[23]=x,e[24]=C):C=e[24];let T;e[25]!==t.description?(T=t.description&&k.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[25]=t.description,e[26]=T):T=e[26];let A;e[27]!==T||e[28]!==C?(A=k.jsxs(sh,{children:[C,T]}),e[27]=T,e[28]=C,e[29]=A):A=e[29];let v;e[30]!==f||e[31]!==m?(v=le=>{le.stopPropagation(),f.handleSubmit(m)(le)},e[30]=f,e[31]=m,e[32]=v):v=e[32];let D;if(e[33]!==p||e[34]!==f.control||e[35]!==f.formState.isSubmitting||e[36]!==l){let le;e[38]!==f.control||e[39]!==f.formState.isSubmitting||e[40]!==l?(le=$e=>k.jsx(ph,{control:f.control,name:$e.name,render:wn=>{const{field:Ke}=wn;return k.jsxs(mh,{children:[k.jsxs(gh,{className:"text-xs",children:[$e.name,$e.required?null:k.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ",l("chat.dialogPromptArguments.optional")]})]}),k.jsx(yh,{children:k.jsx(ih,{...Ke,value:Ke.value??"",required:$e.required,placeholder:$e.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),k.jsx(bh,{})]})}},$e.name),e[38]=f.control,e[39]=f.formState.isSubmitting,e[40]=l,e[41]=le):le=e[41],D=p.map(le),e[33]=p,e[34]=f.control,e[35]=f.formState.isSubmitting,e[36]=l,e[37]=D}else D=e[37];let R;e[42]!==b?(R=()=>b(!1),e[42]=b,e[43]=R):R=e[43];const j=f.formState.isSubmitting;let K;e[44]!==l?(K=l("chat.dialogPromptArguments.cancel"),e[44]=l,e[45]=K):K=e[45];let U;e[46]!==f.formState.isSubmitting||e[47]!==R||e[48]!==K?(U=k.jsx(xl,{type:"button",variant:"ghost",onClick:R,disabled:j,children:K}),e[46]=f.formState.isSubmitting,e[47]=R,e[48]=K,e[49]=U):U=e[49];let L;e[50]!==f.formState.isSubmitting||e[51]!==l?(L=f.formState.isSubmitting?k.jsxs("span",{className:"flex items-center gap-2",children:[k.jsx(eh,{size:"xs"}),l("chat.dialogPromptArguments.loading")]}):l("chat.dialogPromptArguments.usePrompt"),e[50]=f.formState.isSubmitting,e[51]=l,e[52]=L):L=e[52];let B;e[53]!==f.formState.isSubmitting||e[54]!==o||e[55]!==L?(B=k.jsx(xl,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:L}),e[53]=f.formState.isSubmitting,e[54]=o,e[55]=L,e[56]=B):B=e[56];let z;e[57]!==U||e[58]!==B?(z=k.jsxs(oh,{children:[U,B]}),e[57]=U,e[58]=B,e[59]=z):z=e[59];let _;e[60]!==o||e[61]!==v||e[62]!==D||e[63]!==z?(_=k.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:v,children:[D,z]}),e[60]=o,e[61]=v,e[62]=D,e[63]=z,e[64]=_):_=e[64];let Q;e[65]!==f||e[66]!==_?(Q=k.jsx(hh,{...f,children:_}),e[65]=f,e[66]=_,e[67]=Q):Q=e[67];let oe;e[68]!==A||e[69]!==Q?(oe=k.jsxs(lh,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[A,Q]}),e[68]=A,e[69]=Q,e[70]=oe):oe=e[70];let Ce;return e[71]!==b||e[72]!==oe?(Ce=k.jsx(ah,{open:!0,onOpenChange:b,children:oe}),e[71]=b,e[72]=oe,e[73]=Ce):Ce=e[73],Ce}function gS(n){if(typeof n!="object"||n===null)return null;const{volume:e,path:t}=n;return typeof e!="string"||e===""||typeof t!="string"||t===""?null:`${e}/${t}/SKILL.md`}function yS(n){return n.storage.mention}function YS(n,e,t){n.chain().focus().insertContentAt(e,[bS(t),{type:"text",text:" "}]).run()}function bS(n){return{type:"mention",attrs:n}}function XS(n,e,t){const r=n.state.doc.nodeAt(e);return r?.type.name==="mention"&&r.attrs.id===t}function kS(n){const e=Yt.c(43),{node:t,selected:r,view:s,editor:i,getPos:o}=n,{name:l,char:a,kind:c,id:u,args:d,metadata:f}=t.attrs,h=So(),p=V.useContext(kh),g=r&&s.editable,m=c==="task",y=a==="@",b=s.editable&&a==="/"&&(c==="prompt"||c===void 0);let x;e[0]!==c||e[1]!==f?(x=c==="skill"?gS(f):null,e[0]=c,e[1]=f,e[2]=x):x=e[2];const C=x,T=!!p&&!!C,A=b||T;let v;e[3]!==d||e[4]!==i||e[5]!==o||e[6]!==u||e[7]!==l?(v=()=>{const bl=yS(i)?.onEditChip;if(!bl||typeof o!="function")return;const kl=o();typeof kl=="number"&&bl({promptId:u,promptName:l,args:d??{},pos:kl})},e[3]=d,e[4]=i,e[5]=o,e[6]=u,e[7]=l,e[8]=v):v=e[8];const D=v;let R;e[9]!==p||e[10]!==T||e[11]!==C||e[12]!==D?(R=()=>{if(T&&C){p.open(C);return}D()},e[9]=p,e[10]=T,e[11]=C,e[12]=D,e[13]=R):R=e[13];const j=R;let K;e[14]!==j||e[15]!==A?(K=lt=>{A&&(lt.preventDefault(),lt.stopPropagation(),j())},e[14]=j,e[15]=A,e[16]=K):K=e[16];const U=K;let L;e[17]!==j||e[18]!==A?(L=lt=>{A&&(lt.key!=="Enter"&&lt.key!==" "||(lt.preventDefault(),lt.stopPropagation(),j()))},e[17]=j,e[18]=A,e[19]=L):L=e[19];const B=L,z=A?"button":void 0,_=A?0:void 0;let Q;e[20]!==A||e[21]!==l||e[22]!==T||e[23]!==h?(Q=A?h(T?"chat.mention.openSkill":"chat.mention.editPrompt",{name:l?Ml(l):""}):void 0,e[20]=A,e[21]=l,e[22]=T,e[23]=h,e[24]=Q):Q=e[24];const oe=A?"cursor-pointer":"cursor-default",Ce=y?"bg-brand-purple-tint text-brand-purple-dark dark:bg-brand-purple/20 dark:text-brand-purple":"bg-brand-yellow-tint text-brand-yellow-dark dark:bg-brand-yellow/20 dark:text-brand-yellow",le=g&&"outline-2 outline-ring outline-offset-0",$e=A&&"hover:brightness-95",wn=!m&&"capitalize";let Ke;e[25]!==le||e[26]!==$e||e[27]!==wn||e[28]!==oe||e[29]!==Ce?(Ke=er("px-1 py-1 rounded","inline-flex items-center gap-1",oe,"select-none","text-xs font-light",Ce,le,$e,wn),e[25]=le,e[26]=$e,e[27]=wn,e[28]=oe,e[29]=Ce,e[30]=Ke):Ke=e[30];let tn;e[31]!==m||e[32]!==l?(tn=m?k.jsx("span",{className:"inline-block max-w-[220px] truncate align-bottom",children:l??""}):l?Ml(l):"",e[31]=m,e[32]=l,e[33]=tn):tn=e[33];let wr;return e[34]!==a||e[35]!==U||e[36]!==B||e[37]!==Ke||e[38]!==tn||e[39]!==z||e[40]!==_||e[41]!==Q?(wr=k.jsxs(zd,{onClick:U,onKeyDown:B,role:z,tabIndex:_,"aria-label":Q,className:Ke,children:[a,tn]}),e[34]=a,e[35]=U,e[36]=B,e[37]=Ke,e[38]=tn,e[39]=z,e[40]=_,e[41]=Q,e[42]=wr):wr=e[42],wr}const QS=be.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:void 0,parseHTML:n=>n.getAttribute("data-kind")||void 0,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",ee(n,{"data-type":"mention"})]},renderText({node:n}){const e=n.attrs.char??"@",t=n.attrs.name??"";return`${e}${t}`},addNodeView(){return Bd(kS)}});function ZS(n){if(n.type!=="tool-suggest_task")return!1;if(n.state==="input-available")return!0;const e=n.output;return n.state==="output-available"&&typeof e?.accepted!="boolean"}function eC(n){const e=Yt.c(19),{id:t,part:r,copyable:s,extraActions:i,alwaysShowActions:o,animate:l}=n,a=s===void 0?!1:s,c=o===void 0?!1:o,u=l===void 0?!1:l,{handleCopy:d}=Sh(),f=So(),[h,p]=V.useState(!1);let g;e[0]!==d||e[1]!==t||e[2]!==r.text?(g=async()=>{uh("chat_message_copied",{message_id:t,chars:r.text.length}),await d(r.text),p(!0),setTimeout(()=>p(!1),2e3)},e[0]=d,e[1]=t,e[2]=r.text,e[3]=g):g=e[3];const m=g,y=a&&i,b=y||i;let x;e[4]!==u||e[5]!==t||e[6]!==r.text?(x=k.jsx(xh,{id:t,text:r.text,animate:u}),e[4]=u,e[5]=t,e[6]=r.text,e[7]=x):x=e[7];let C;e[8]!==c||e[9]!==i||e[10]!==m||e[11]!==h||e[12]!==b||e[13]!==y||e[14]!==f?(C=b&&k.jsxs("div",{className:er("flex w-full items-center gap-2 text-sm text-muted-foreground transition-all duration-200 mt-1 py-1",c?"opacity-100":"opacity-0 pointer-events-none group-hover/part:opacity-100 group-hover/part:pointer-events-auto"),children:[i,y&&i&&k.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),y&&k.jsx("button",{type:"button",onClick:m,className:"text-muted-foreground [@media(hover:hover)]:hover:text-foreground transition-colors active:scale-[0.97]","aria-label":f("chat.textPart.copyMessage"),children:h?k.jsx(ch,{className:"size-4"}):k.jsx(Ch,{className:"size-4"})})]}),e[8]=c,e[9]=i,e[10]=m,e[11]=h,e[12]=b,e[13]=y,e[14]=f,e[15]=C):C=e[15];let T;return e[16]!==x||e[17]!==C?(T=k.jsxs("div",{className:"group/part relative",children:[x,C]}),e[16]=x,e[17]=C,e[18]=T):T=e[18],T}function tC(n,e,t){n.chain().focus().insertContentAt(e,[xS(t),{type:"text",text:" "}]).run()}function xS(n){return{type:"file",attrs:n}}function SS(n){return(n??"").startsWith("image/")}function CS(n){const e=Yt.c(17),{node:t,selected:r,view:s}=n,{name:i,mimeType:o,data:l}=t.attrs,a=r&&s.editable;let c;e[0]!==o?(c=SS(o),e[0]=o,e[1]=c):c=e[1];const u=c,d=a&&"outline-2 outline-ring outline-offset-0";let f;e[2]!==d?(f=er("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",d),e[2]=d,e[3]=f):f=e[3];let h;e[4]!==i?(h=k.jsx(tr,{asChild:!0,children:k.jsx("span",{children:i})}),e[4]=i,e[5]=h):h=e[5];let p;e[6]!==l||e[7]!==u||e[8]!==o||e[9]!==i?(p=k.jsx(nr,{side:"top",className:"max-w-sm p-1.5",children:u?k.jsx("img",{src:`data:${o};base64,${l}`,alt:i,className:"max-w-full max-h-64 object-contain rounded"}):k.jsxs("div",{className:"text-xs",children:[k.jsx("div",{className:"font-medium",children:i}),k.jsx("div",{className:"text-muted-foreground mt-1",children:o})]})}),e[6]=l,e[7]=u,e[8]=o,e[9]=i,e[10]=p):p=e[10];let g;e[11]!==h||e[12]!==p?(g=k.jsxs(rr,{children:[h,p]}),e[11]=h,e[12]=p,e[13]=g):g=e[13];let m;return e[14]!==f||e[15]!==g?(m=k.jsx(zd,{className:f,children:g}),e[14]=f,e[15]=g,e[16]=m):m=e[16],m}const nC=be.create({name:"file",group:"inline",inline:!0,atom:!0,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}:{}},mimeType:{default:null,parseHTML:n=>n.getAttribute("data-mime-type")||null,renderHTML:n=>n.mimeType?{"data-mime-type":n.mimeType}:{}},size:{default:0,parseHTML:n=>{const e=n.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:n=>n.size?{"data-size":String(n.size)}:{}},data:{default:null,parseHTML:n=>n.getAttribute("data-data")||null,renderHTML:n=>n.data?{"data-data":n.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:n,HTMLAttributes:e}){const t={"data-type":"file"};return n.attrs.id&&(t["data-id"]=n.attrs.id),n.attrs.name&&(t["data-name"]=n.attrs.name),n.attrs.mimeType&&(t["data-mime-type"]=n.attrs.mimeType),n.attrs.size&&(t["data-size"]=String(n.attrs.size)),n.attrs.data&&(t["data-data"]=n.attrs.data),["span",{...e,...t}]},renderText({node:n}){return`[${n.attrs.name??""}]`},addNodeView(){return Bd(CS)}}),At=16,ko=2.5,xo=(At-ko)/2,Oi=2*Math.PI*xo;function rC(n){const e=Yt.c(29),{usage:t}=n,r=Co();if(!t)return null;const{totalTokens:s,inputTokens:i,outputTokens:o}=t,l=r?t.cost:0;if(!s&&!i&&!o)return null;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsx(Mh,{size:12}),e[0]=a):a=e[0];let c;e[1]!==l||e[2]!==s?(c=l>0?`$${l.toFixed(4)}`:s.toLocaleString(),e[1]=l,e[2]=s,e[3]=c):c=e[3];let u;e[4]!==c?(u=k.jsx(tr,{asChild:!0,children:k.jsxs("span",{className:"inline-flex items-center text-muted-foreground [@media(hover:hover)]:hover:text-foreground pl-1 h-6 gap-1 whitespace-nowrap shrink-0 cursor-default",children:[a,k.jsx("span",{className:"text-sm font-mono tabular-nums",children:c})]})}),e[4]=c,e[5]=u):u=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx("p",{className:"text-muted text-2xs mb-1",children:"tokens"}),e[6]=d):d=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=k.jsx("span",{className:"text-muted",children:"in"}),e[7]=f):f=e[7];let h;e[8]!==i?(h=i.toLocaleString(),e[8]=i,e[9]=h):h=e[9];let p;e[10]!==h?(p=k.jsx("span",{className:"text-right tabular-nums",children:h}),e[10]=h,e[11]=p):p=e[11];let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=k.jsx("span",{className:"text-muted",children:"out"}),e[12]=g):g=e[12];const m=o-(t.reasoningTokens??0);let y;e[13]!==m?(y=m.toLocaleString(),e[13]=m,e[14]=y):y=e[14];let b;e[15]!==y?(b=k.jsx("span",{className:"text-right tabular-nums",children:y}),e[15]=y,e[16]=b):b=e[16];let x;e[17]!==t?(x=(t.cacheReadTokens>0||t.cacheWriteTokens>0)&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"text-muted",children:"cache hit"}),k.jsx("span",{className:"text-right tabular-nums",children:`${(Mo(t)*100).toFixed(0)}%`})]}),e[17]=t,e[18]=x):x=e[18];let C;e[19]!==l?(C=l>0&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"text-muted",children:"cost"}),k.jsxs("span",{className:"text-right tabular-nums",children:["$",l.toFixed(4)]})]}),e[19]=l,e[20]=C):C=e[20];let T;e[21]!==b||e[22]!==x||e[23]!==C||e[24]!==p?(T=k.jsxs(nr,{side:"top",className:"font-mono text-2xs",children:[d,k.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[f,p,g,b,x,C]})]}),e[21]=b,e[22]=x,e[23]=C,e[24]=p,e[25]=T):T=e[25];let A;return e[26]!==T||e[27]!==u?(A=k.jsxs(rr,{children:[u,T]}),e[26]=T,e[27]=u,e[28]=A):A=e[28],A}function sC(n){const e=Yt.c(19),{usage:t,duration:r}=n,s=Co(),i=r!=null&&r>0,o=s&&t!=null&&(t.cost??0)>0,l=t!=null&&(t.totalTokens??0)>0;if(!i&&!o&&!l)return null;let a;e[0]!==r||e[1]!==i?(a=i?Cl(r/1e3):null,e[0]=r,e[1]=i,e[2]=a):a=e[2];const c=a;let u;e[3]!==r||e[4]!==c||e[5]!==t?(u=c&&k.jsxs(rr,{children:[k.jsx(tr,{asChild:!0,children:k.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:c})}),k.jsxs(nr,{side:"top",className:"font-mono text-2xs",children:[k.jsx("p",{className:"opacity-60 text-2xs mb-1",children:"thinking"}),k.jsx("span",{className:"tabular-nums",children:Cl(r/1e3)}),(t?.reasoningTokens??0)>0&&k.jsxs("span",{className:"ml-2 opacity-50",children:[t.reasoningTokens.toLocaleString()," tok"]})]})]}),e[3]=r,e[4]=c,e[5]=t,e[6]=u):u=e[6];let d;e[7]!==o||e[8]!==i||e[9]!==l?(d=i&&(o||l)&&k.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),e[7]=o,e[8]=i,e[9]=l,e[10]=d):d=e[10];let f;e[11]!==o||e[12]!==l||e[13]!==t?(f=(o||l)&&k.jsxs(rr,{children:[k.jsx(tr,{asChild:!0,children:k.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:o?`$${t.cost.toFixed(4)}`:`${t.totalTokens.toLocaleString()} tok`})}),k.jsxs(nr,{side:"top",className:"font-mono text-2xs",children:[k.jsx("p",{className:"opacity-60 text-2xs mb-1",children:"tokens"}),k.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[k.jsx("span",{className:"opacity-60",children:"in"}),k.jsx("span",{className:"text-right tabular-nums",children:(t.inputTokens??0).toLocaleString()}),k.jsx("span",{className:"opacity-60",children:"out"}),k.jsx("span",{className:"text-right tabular-nums",children:((t.outputTokens??0)-(t?.reasoningTokens??0)).toLocaleString()}),(t?.reasoningTokens??0)>0&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"opacity-60",children:"think"}),k.jsx("span",{className:"text-right tabular-nums",children:t.reasoningTokens.toLocaleString()})]}),((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"opacity-60",children:"cache hit"}),k.jsx("span",{className:"text-right tabular-nums",children:`${(Mo(t)*100).toFixed(0)}%`})]})]})]})]}),e[11]=o,e[12]=l,e[13]=t,e[14]=f):f=e[14];let h;return e[15]!==u||e[16]!==d||e[17]!==f?(h=k.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[u,d,f]}),e[15]=u,e[16]=d,e[17]=f,e[18]=h):h=e[18],h}function iC(n){const e=Yt.c(52),{usage:t,totalTokens:r,contextWindow:s,onOpenContextPanel:i}=n,o=Co(),l=Math.min(r/s*100,100),a=Oi-l/100*Oi,c=o?t?.cost??0:0,u=(t?.cost??0)>0,d=t?.inputTokens??0,f=t?.outputTokens??0;let h;e[0]!==l?(h=l.toFixed(0),e[0]=l,e[1]=h):h=e[1];let p;e[2]!==c?(p=c>0?`, $${c.toFixed(2)}`:"",e[2]=c,e[3]=p):p=e[3];const g=`Context usage: ${h}%${p}`,m=i?"cursor-pointer":"cursor-default";let y;e[4]!==m?(y=er("flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0",m),e[4]=m,e[5]=y):y=e[5];let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=k.jsx("circle",{cx:At/2,cy:At/2,r:xo,fill:"none",stroke:"currentColor",strokeWidth:ko,className:"opacity-15"}),e[6]=b):b=e[6];const x=l>90?"text-destructive":l>70?"text-warning":"text-muted-foreground";let C;e[7]!==x?(C=er(x),e[7]=x,e[8]=C):C=e[8];let T;e[9]!==a||e[10]!==C?(T=k.jsxs("svg",{width:At,height:At,className:"-rotate-90","aria-hidden":"true",children:[b,k.jsx("circle",{cx:At/2,cy:At/2,r:xo,fill:"none",stroke:"currentColor",strokeWidth:ko,strokeDasharray:Oi,strokeDashoffset:a,strokeLinecap:"round",className:C})]}),e[9]=a,e[10]=C,e[11]=T):T=e[11];let A;e[12]!==l?(A=l.toFixed(0),e[12]=l,e[13]=A):A=e[13];let v;e[14]!==c?(v=c>0?` · $${c.toFixed(2)}`:"",e[14]=c,e[15]=v):v=e[15];let D;e[16]!==A||e[17]!==v?(D=k.jsxs("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100 text-2xs font-mono tabular-nums",children:[A,"%",v]}),e[16]=A,e[17]=v,e[18]=D):D=e[18];let R;e[19]!==i||e[20]!==D||e[21]!==g||e[22]!==y||e[23]!==T?(R=k.jsx(tr,{asChild:!0,children:k.jsxs("button",{type:"button",onClick:i,"aria-label":g,className:y,children:[T,D]})}),e[19]=i,e[20]=D,e[21]=g,e[22]=y,e[23]=T,e[24]=R):R=e[24];let j;e[25]===Symbol.for("react.memo_cache_sentinel")?(j=k.jsx("span",{className:"text-muted",children:"context"}),e[25]=j):j=e[25];let K;e[26]!==r?(K=r.toLocaleString(),e[26]=r,e[27]=K):K=e[27];let U;e[28]!==s?(U=s.toLocaleString(),e[28]=s,e[29]=U):U=e[29];let L;e[30]!==l?(L=l.toFixed(1),e[30]=l,e[31]=L):L=e[31];let B;e[32]!==K||e[33]!==U||e[34]!==L?(B=k.jsxs("span",{className:"text-right tabular-nums",children:[K," / ",U," (",L,"%)"]}),e[32]=K,e[33]=U,e[34]=L,e[35]=B):B=e[35];let z;e[36]!==c?(z=c>0&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"text-muted",children:"cost"}),k.jsxs("span",{className:"text-right tabular-nums",children:["$",c.toFixed(4)]})]}),e[36]=c,e[37]=z):z=e[37];let _;e[38]!==u||e[39]!==d||e[40]!==f?(_=u&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"text-muted",children:"in"}),k.jsx("span",{className:"text-right tabular-nums",children:d.toLocaleString()}),k.jsx("span",{className:"text-muted",children:"out"}),k.jsx("span",{className:"text-right tabular-nums",children:f.toLocaleString()})]}),e[38]=u,e[39]=d,e[40]=f,e[41]=_):_=e[41];let Q;e[42]!==t?(Q=((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"text-muted",children:"cache hit"}),k.jsx("span",{className:"text-right tabular-nums",children:`${(Mo(t)*100).toFixed(0)}%`})]}),e[42]=t,e[43]=Q):Q=e[43];let oe;e[44]!==B||e[45]!==z||e[46]!==_||e[47]!==Q?(oe=k.jsx(nr,{side:"top",className:"font-mono text-2xs",children:k.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[j,B,z,_,Q]})}),e[44]=B,e[45]=z,e[46]=_,e[47]=Q,e[48]=oe):oe=e[48];let Ce;return e[49]!==R||e[50]!==oe?(Ce=k.jsxs(rr,{children:[R,oe]}),e[49]=R,e[50]=oe,e[51]=Ce):Ce=e[51],Ce}export{gp as $,Ko as A,$ as B,O as C,G as D,Y as E,nC as F,jS as G,VS as H,$S as I,Ny as J,HS as K,w0 as L,Xt as M,be as N,My as O,GS as P,zd as Q,Bd as R,iC as S,N as T,Z0 as U,WS as V,Mn as W,US as X,Fk as Y,Bk as Z,nd as _,G1 as a,S as a0,E as a1,re as a2,je as a3,w as a4,eu as a5,zS as a6,Wo as a7,Ay as a8,yd as a9,U1 as b,bS as c,rC as d,eC as e,QS as f,FS as g,sC as h,ZS as i,_S as j,YS as k,tC as l,ee as m,te as n,W as o,yS as p,XS as q,Go as r,JS as s,qS as t,KS as u,st as v,BS as w,I as x,d0 as y,Kn as z};