decocms 4.155.6 → 4.157.0

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 (227) hide show
  1. package/dist/client/assets/{AlertCircle-B5EzHQ3T.js → AlertCircle-BVRdcAr7.js} +1 -1
  2. package/dist/client/assets/{AreaChart-Cim5jZe2.js → AreaChart-BZd2BMDX.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-DP4--CRE.js → ArrowUp-CEnxQhJa.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-ClvhqYJg.js → ArrowUpRight-c4UbenX2.js} +1 -1
  5. package/dist/client/assets/{Check-B9fmDnkt.js → Check-PvwAFW5_.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-DEOdfySb.js → CheckCircle-tNfHHzqR.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-zcfJwool.js → ChevronDown-DhOhINAM.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-Da7RLvlz.js → ChevronRight-Dia-WW4B.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-D2nRl71d.js → ChevronUp-DYAPwS7D.js} +1 -1
  10. package/dist/client/assets/{Copy01-Br7jIcvA.js → Copy01-DxBV3dt3.js} +1 -1
  11. package/dist/client/assets/{CpuChip01-2vWRhh6j.js → CpuChip01-DnKRaqtj.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-Da2a3Dvx.js → DotsVertical-CKorlk4R.js} +1 -1
  13. package/dist/client/assets/{Eye-fXYyMTJq.js → Eye-Bc6OKV-y.js} +1 -1
  14. package/dist/client/assets/{FilterLines-BzZQGPEM.js → FilterLines-DxJRwle6.js} +1 -1
  15. package/dist/client/assets/{HardDrive-DzJwZFDi.js → HardDrive-BiWDyH7C.js} +1 -1
  16. package/dist/client/assets/{Key01-ST4vByf3.js → Key01-Bmye11fH.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft--DTq1lf3.js → LayoutLeft-Dn612JDh.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-ByF377Xd.js → LinkExternal01-BRfN9dRJ.js} +1 -1
  19. package/dist/client/assets/{LogOut01-DwUMYNzY.js → LogOut01-CHgz8ujG.js} +1 -1
  20. package/dist/client/assets/{Monitor01-DIl3Bjd2.js → Monitor01-8Zn_oQLH.js} +1 -1
  21. package/dist/client/assets/{Palette-BKSScrz_.js → Palette-CLRvU0eK.js} +1 -1
  22. package/dist/client/assets/{Play-DFvGhSpX.js → Play-GbRXM_X_.js} +1 -1
  23. package/dist/client/assets/{Plus-6GgajCWE.js → Plus-L2K4KGAP.js} +1 -1
  24. package/dist/client/assets/{SearchLg-BZRFwlcE.js → SearchLg-DD_M63q4.js} +1 -1
  25. package/dist/client/assets/{SearchMd-C-YQQRbK.js → SearchMd-DSheghKh.js} +1 -1
  26. package/dist/client/assets/{Settings02-T7YLgdWM.js → Settings02-CVwE6_LX.js} +1 -1
  27. package/dist/client/assets/{Shield01-CdlD5CJP.js → Shield01-BtLPYIWD.js} +1 -1
  28. package/dist/client/assets/{Star01-D8H53NVR.js → Star01-Bb-AArDe.js} +1 -1
  29. package/dist/client/assets/{Stars01-Re5gaAtU.js → Stars01-BabGpMQS.js} +1 -1
  30. package/dist/client/assets/{Stars02-CeRYgJCg.js → Stars02-CKPBAOIU.js} +1 -1
  31. package/dist/client/assets/{Sun-CwY5usNr.js → Sun-CvM5J-FW.js} +1 -1
  32. package/dist/client/assets/{SwitchHorizontal01-xbOALVe_.js → SwitchHorizontal01-n8F4B6uE.js} +1 -1
  33. package/dist/client/assets/{Tool01-Dsz9WT2F.js → Tool01-DN0PeFAX.js} +1 -1
  34. package/dist/client/assets/{Tool02-DKdShLft.js → Tool02-RPFrSRbs.js} +1 -1
  35. package/dist/client/assets/{Trash01-DdGCAmvH.js → Trash01-DwKFwhTe.js} +1 -1
  36. package/dist/client/assets/{TrendUp01-Rwx5WUW7.js → TrendUp01-5fmO9zBH.js} +1 -1
  37. package/dist/client/assets/{Upload01-DdCDL_BX.js → Upload01-CEZ0vqHA.js} +1 -1
  38. package/dist/client/assets/{User01-DuIeQfhs.js → User01-CMegumei.js} +1 -1
  39. package/dist/client/assets/{Users01-BDDInj3j.js → Users01-C2x7fgEw.js} +1 -1
  40. package/dist/client/assets/{Users03-DXxBN50i.js → Users03-B_aCu_uX.js} +1 -1
  41. package/dist/client/assets/{X-7b-sSD2v.js → X-C9xR6k_q.js} +1 -1
  42. package/dist/client/assets/{XCircle-Cqp6M2Ri.js → XCircle-qIYKCuWZ.js} +1 -1
  43. package/dist/client/assets/{XClose-dqg_FLeN.js → XClose-D6PNomGP.js} +1 -1
  44. package/dist/client/assets/{Zap-Ds0z8JF5.js → Zap-BCvJyZqp.js} +1 -1
  45. package/dist/client/assets/{ZapSquare-jro4IGFj.js → ZapSquare-B_xZPtA0.js} +1 -1
  46. package/dist/client/assets/{access-gate-5LVYTmNO.js → access-gate-CgBkF5HO.js} +1 -1
  47. package/dist/client/assets/{add-section-modal-T8XdNxIf.js → add-section-modal-Bgum13n2.js} +1 -1
  48. package/dist/client/assets/{agent-icon-CVwazKeT.js → agent-icon-CtiUyn5V.js} +1 -1
  49. package/dist/client/assets/{agents-list-Dx--dpMc.js → agents-list-DHwxl85B.js} +1 -1
  50. package/dist/client/assets/{ai-providers-CCJtOJBY.js → ai-providers-BAOWMEQx.js} +1 -1
  51. package/dist/client/assets/{alert-u5n4es2L.js → alert-CgJLRqED.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-CIsCwJLF.js → alert-dialog-Cy_KM5bI.js} +2 -2
  53. package/dist/client/assets/{app-editor-DJlRe5Qj.js → app-editor-BWRR4WKU.js} +1 -1
  54. package/dist/client/assets/{auth-CMEh2aKE.js → auth-B6wLv_ge.js} +1 -1
  55. package/dist/client/assets/{auth-catchall-DcLSwYza.js → auth-catchall-CK8jbGrb.js} +1 -1
  56. package/dist/client/assets/{auth-entry-B-hGbfhf.js → auth-entry-umz9GY8P.js} +1 -1
  57. package/dist/client/assets/{auth-split-layout-DIn01YeS.js → auth-split-layout-CFi1gMlG.js} +1 -1
  58. package/dist/client/assets/{authenticate-and-persist-oauth-Dc7nzZYd.js → authenticate-and-persist-oauth-UMzs9VZn.js} +1 -1
  59. package/dist/client/assets/{automation-list-row-CzBHL7O6.js → automation-list-row-CqpWerJJ.js} +1 -1
  60. package/dist/client/assets/{automation-runs-OIuxPUCu.js → automation-runs-D22hl0By.js} +72 -112
  61. package/dist/client/assets/{automations-C49OaMy2.js → automations-DEf3LLpY.js} +1 -1
  62. package/dist/client/assets/{avatar-BHLGt_46.js → avatar-DTq8LB7h.js} +1 -1
  63. package/dist/client/assets/{badge-Cd0M39Bu.js → badge-DCJPq-TC.js} +1 -1
  64. package/dist/client/assets/{block-document-Dd8M_1-u.js → block-document-DgfQnX34.js} +3 -3
  65. package/dist/client/assets/{brand-context-CYufvmAl.js → brand-context-JpMxWj1R.js} +1 -1
  66. package/dist/client/assets/{buckets-CbgCYstj.js → buckets-DaCkmXEf.js} +1 -1
  67. package/dist/client/assets/{bulk-category-panel-CPd8oKFt.js → bulk-category-panel-Brm62LQU.js} +1 -1
  68. package/dist/client/assets/calendar-DiPJMbZr.js +142 -0
  69. package/dist/client/assets/{capability-load-error-pyghqnbM.js → capability-load-error-wbvMQZ3s.js} +1 -1
  70. package/dist/client/assets/{card-u5PNQDUW.js → card-CrBmylnL.js} +1 -1
  71. package/dist/client/assets/category-editor-DHxskdpJ.js +1 -0
  72. package/dist/client/assets/{chat-context-DCzWZrLz.js → chat-context-DQXfzeZ1.js} +1 -1
  73. package/dist/client/assets/{checkbox-CY1yI_Qw.js → checkbox-CCkUa9zL.js} +1 -1
  74. package/dist/client/assets/{cli-auth-success-BVkwx5rw.js → cli-auth-success-C59WlVJX.js} +1 -1
  75. package/dist/client/assets/{collection-detail-C8WC100q.js → collection-detail-pmRAIQhn.js} +1 -1
  76. package/dist/client/assets/{collection-display-button-Dn_15bUR.js → collection-display-button-C3GUuD7t.js} +1 -1
  77. package/dist/client/assets/{collection-search-Cfa2VsMM.js → collection-search-CQ4hmVx6.js} +1 -1
  78. package/dist/client/assets/{collection-table-wrapper-BR0F1Z2a.js → collection-table-wrapper-DWQTzM0N.js} +1 -1
  79. package/dist/client/assets/{collection-tabs-A-FQ9ciC.js → collection-tabs-BGGP3Q4Q.js} +1 -1
  80. package/dist/client/assets/{command-BWFUwrRD.js → command-Bw3jNeoH.js} +1 -1
  81. package/dist/client/assets/{commerce-onboarding-m1N9zdZc.js → commerce-onboarding-DEK9436h.js} +1 -1
  82. package/dist/client/assets/{companions-core-Cx62iuxG.js → companions-core-Be1fT7Qa.js} +1 -1
  83. package/dist/client/assets/{connect-ChVHA_Cq.js → connect-CWFRWKGd.js} +1 -1
  84. package/dist/client/assets/{connection-HdW9nUoI.js → connection-DYDdJHYT.js} +1 -1
  85. package/dist/client/assets/{connection-card-5DsDh1pc.js → connection-card-rF4iZROi.js} +1 -1
  86. package/dist/client/assets/{connection-detail-DpzalBOD.js → connection-detail-B17jcN2-.js} +1 -1
  87. package/dist/client/assets/{connection-form-helpers-D-E-0wAM.js → connection-form-helpers-BZGXkBOU.js} +1 -1
  88. package/dist/client/assets/{connections-CddmRYnO.js → connections-BwDvvI81.js} +1 -1
  89. package/dist/client/assets/{decopilot-sse-pool-DQ-QHafM.js → decopilot-sse-pool-dCMollnS.js} +1 -1
  90. package/dist/client/assets/{dialog-C9Y0JFmm.js → dialog-BEE2ieIv.js} +1 -1
  91. package/dist/client/assets/{domain-settings-CSaQNWcT.js → domain-settings-DfyYMoAI.js} +1 -1
  92. package/dist/client/assets/{drawer-B87EWS0a.js → drawer-D_zlJSIa.js} +1 -1
  93. package/dist/client/assets/{dropdown-menu-DM50AQFT.js → dropdown-menu-CScom-4o.js} +1 -1
  94. package/dist/client/assets/{empty-state-CT8CVS2g.js → empty-state-BW9CnFTA.js} +1 -1
  95. package/dist/client/assets/{extract-connection-data-CXwOVGvM.js → extract-connection-data-CQ3H7X46.js} +1 -1
  96. package/dist/client/assets/{file-explorer-boGufn0U.js → file-explorer-DPUaYjU-.js} +2 -2
  97. package/dist/client/assets/{form-Dq7OxJjL.js → form-BBxBIdP7.js} +1 -1
  98. package/dist/client/assets/{general-97imiaC2.js → general-CtJ3KRAc.js} +1 -1
  99. package/dist/client/assets/{github-repo-picker-D8h3_SIG.js → github-repo-picker-_fOGWT5B.js} +1 -1
  100. package/dist/client/assets/{hooks-CdHw7kBQ.js → hooks-D2DXSkUb.js} +1 -1
  101. package/dist/client/assets/{index-DT0SFO0-.js → index-BYebWbkH.js} +1 -1
  102. package/dist/client/assets/index-CYhSS9zf.css +1 -0
  103. package/dist/client/assets/{index-Bkp-7etC.js → index-CZrBPeSF.js} +41 -41
  104. package/dist/client/assets/index-Ck4HNDeL.js +77 -0
  105. package/dist/client/assets/index-CwBzuD_m.js +663 -0
  106. package/dist/client/assets/{index-Davc1Spm.js → index-DTrEhN5C.js} +1 -1
  107. package/dist/client/assets/{index-_w4PVSAs.js → index-DrIBFZ81.js} +2 -2
  108. package/dist/client/assets/{index-ke5Y-j-X.js → index-FLb6-l5J.js} +1 -1
  109. package/dist/client/assets/{index-BelI0bV9.js → index-L22QcARJ.js} +1 -1
  110. package/dist/client/assets/{index-BrGCgrXI.js → index-NKgRHLP_.js} +1 -1
  111. package/dist/client/assets/{index-GoB4Xm4I.js → index-dQDZUsRB.js} +1 -1
  112. package/dist/client/assets/{index-redirect-G3ZHS5dR.js → index-redirect-B8BYdzj2.js} +1 -1
  113. package/dist/client/assets/{index-CCOn6TVf.js → index-u4kSn-Ka.js} +1 -1
  114. package/dist/client/assets/{input-BUlb65w4.js → input-DfW0n64T.js} +1 -1
  115. package/dist/client/assets/{integration-icon-BqeZ81Ki.js → integration-icon-BriL0gdd.js} +1 -1
  116. package/dist/client/assets/{invite-member-dialog-DRgdq1e6.js → invite-member-dialog-C1b9xa_q.js} +1 -1
  117. package/dist/client/assets/{label-Brue7KkY.js → label-u1FnGPif.js} +1 -1
  118. package/dist/client/assets/{layout-DomeuX52.js → layout-91MOct-x.js} +1 -1
  119. package/dist/client/assets/{login-C_NR0MWw.js → login-ComSuoop.js} +1 -1
  120. package/dist/client/assets/{mcp-oauth-BS8oJHLa.js → mcp-oauth-BNg8UA_R.js} +1 -1
  121. package/dist/client/assets/{members-BbLp1GTX.js → members-BVot0E3a.js} +1 -1
  122. package/dist/client/assets/{monaco-editor-DKGZY7KB.js → monaco-editor-Cq8a3e0Q.js} +4 -4
  123. package/dist/client/assets/{monitoring-stats-row-DAsEBsoX.js → monitoring-stats-row-7EEfSN_H.js} +1 -1
  124. package/dist/client/assets/{multi-select-BOJyCVSz.js → multi-select-B_LPMXUc.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-CYwQ0NJe.js → oauth-callback-BJNIPi5Z.js} +1 -1
  126. package/dist/client/assets/{oauth-callback-ai-provider-BdT7AP9B.js → oauth-callback-ai-provider-sBE6HXoD.js} +1 -1
  127. package/dist/client/assets/{onboarding-DdV1PqwL.js → onboarding-rMKgR3te.js} +1 -1
  128. package/dist/client/assets/{org-layout-DeM4TcX_.js → org-layout-FWtpNVPK.js} +1 -1
  129. package/dist/client/assets/{organization-choice-D_l6xRyU.js → organization-choice-Ds2qQKu8.js} +1 -1
  130. package/dist/client/assets/{orgs-DYeysyR3.js → orgs-CNBDLBm5.js} +1 -1
  131. package/dist/client/assets/{page-seo-form-CG3lFTHB.js → page-seo-form-BnD0FsnZ.js} +1 -1
  132. package/dist/client/assets/{popover-zo9vhm7M.js → popover-AjzmM7C7.js} +1 -1
  133. package/dist/client/assets/{post-editor-Bsog7W5j.js → post-editor-DVGbQJGA.js} +1 -1
  134. package/dist/client/assets/{primitives-B_eXmfpN.js → primitives-BORxjSOf.js} +1 -1
  135. package/dist/client/assets/{profile-BhfUXlIO.js → profile-B3tCocQY.js} +1 -1
  136. package/dist/client/assets/project-app-view-CboRisYT.js +1 -0
  137. package/dist/client/assets/record-editor-DKjGmqDW.js +1 -0
  138. package/dist/client/assets/{redirect-editor-Bqrb2WOt.js → redirect-editor-DQqTPtyS.js} +1 -1
  139. package/dist/client/assets/registry-BlxkoTJz.js +2 -0
  140. package/dist/client/assets/{registry-layout-CbxeqJM8.js → registry-layout-CQpVcGyd.js} +1 -1
  141. package/dist/client/assets/{reports-BUTkqxe8.js → reports-B7bHou75.js} +1 -1
  142. package/dist/client/assets/{require-capability-Bsvyei9e.js → require-capability-BWp_ugtq.js} +1 -1
  143. package/dist/client/assets/{required-auth-layout-H-bvovJA.js → required-auth-layout-CX-j8fcs.js} +1 -1
  144. package/dist/client/assets/{reset-password-ClLsmOeS.js → reset-password-B_mSf-fh.js} +1 -1
  145. package/dist/client/assets/{roles-By7p5If3.js → roles-CbO21DnZ.js} +1 -1
  146. package/dist/client/assets/{search-input-ChwfOLYJ.js → search-input-B6b2ZnBA.js} +1 -1
  147. package/dist/client/assets/{secrets-DjsgHCD1.js → secrets-DHRDRmvb.js} +1 -1
  148. package/dist/client/assets/{sections-editor-BblWdGv0.js → sections-editor-2UGRHd2L.js} +2 -2
  149. package/dist/client/assets/{select-model-CB-EK_HF.js → select-model-DLYysGmM.js} +1 -1
  150. package/dist/client/assets/{select-DxMLbuxt.js → select-n4tYtSWP.js} +1 -1
  151. package/dist/client/assets/{self-tool-result-CQ3n1tli.js → self-tool-result-9g5XXNrJ.js} +1 -1
  152. package/dist/client/assets/{seo-editor-Cq75T14m.js → seo-editor-Dp4dSKcE.js} +1 -1
  153. package/dist/client/assets/{settings-layout-DOno7DP_.js → settings-layout-DB_Q64RJ.js} +1 -1
  154. package/dist/client/assets/{settings-section-6sUHyPiZ.js → settings-section-B4sxMatG.js} +1 -1
  155. package/dist/client/assets/{shell-controls-DZYpPQkf.js → shell-controls-zZvgboKB.js} +1 -1
  156. package/dist/client/assets/{shell-layout-B5roAZO2.js → shell-layout-BLNXlEs8.js} +1 -1
  157. package/dist/client/assets/{sidebar-imulaJzp.js → sidebar-BTOMGewK.js} +1 -1
  158. package/dist/client/assets/{skeleton-QmnG1Nm5.js → skeleton-BSh29Pqn.js} +1 -1
  159. package/dist/client/assets/{spinner-nEloco4D.js → spinner-BruVqM08.js} +1 -1
  160. package/dist/client/assets/{sso-DUQtbRl2.js → sso-CkQZtYP5.js} +1 -1
  161. package/dist/client/assets/{store-9yvhohCQ.js → store-Dura68P-.js} +1 -1
  162. package/dist/client/assets/store-registry-Cpq2Y3v7.js +2 -0
  163. package/dist/client/assets/{studio-tools-DWNBPKxz.js → studio-tools-DZ4A4LK4.js} +1 -1
  164. package/dist/client/assets/{switch-HRiVgJhy.js → switch-Capnufwf.js} +1 -1
  165. package/dist/client/assets/{tab-id-oTaKG_NF.js → tab-id-TIvCa4AH.js} +1 -1
  166. package/dist/client/assets/{table-7XciIyJ8.js → table-BhXfGt_D.js} +1 -1
  167. package/dist/client/assets/{tabs-Dc7iBqjc.js → tabs-CmlSCOKE.js} +1 -1
  168. package/dist/client/assets/{textarea-BbqkJA0A.js → textarea-CzJQ4jof.js} +1 -1
  169. package/dist/client/assets/{toggle-group-CqDuHyMB.js → toggle-group-DJogx7Sw.js} +1 -1
  170. package/dist/client/assets/{toolbar-16OORO9B.js → toolbar-4Xs9gQqE.js} +1 -1
  171. package/dist/client/assets/{tooltip-CALKScQe.js → tooltip-DlGzqhnP.js} +1 -1
  172. package/dist/client/assets/{use-ai-providers-BRjohUtF.js → use-ai-providers-CIIrncdr.js} +1 -1
  173. package/dist/client/assets/{use-automations-CWBUKr70.js → use-automations-oR1lkik8.js} +1 -1
  174. package/dist/client/assets/{use-autosave-IYEJiv_p.js → use-autosave-B62TGEph.js} +1 -1
  175. package/dist/client/assets/{use-capability-Bn00p9kX.js → use-capability-D8lE65Qq.js} +1 -1
  176. package/dist/client/assets/{use-clock-tick-D-wa1z0F.js → use-clock-tick-CV-pJYBs.js} +1 -1
  177. package/dist/client/assets/{use-connection-C9DNXZf8.js → use-connection-BzoGO_rZ.js} +1 -1
  178. package/dist/client/assets/{use-copy-Dc0x9EjL.js → use-copy-CUMl3QMe.js} +1 -1
  179. package/dist/client/assets/{use-create-virtual-mcp-DLdO94ug.js → use-create-virtual-mcp-CtHfYunD.js} +1 -1
  180. package/dist/client/assets/{use-debounced-autosave-BZs3xF3G.js → use-debounced-autosave-6rt-rF4t.js} +1 -1
  181. package/dist/client/assets/{use-debounced-value-D8WagtLE.js → use-debounced-value-CXreFFvV.js} +1 -1
  182. package/dist/client/assets/{use-deco-credits-B5bl8N1q.js → use-deco-credits-CRRWJZpL.js} +1 -1
  183. package/dist/client/assets/{use-decopilot-events-DIUqvtu8.js → use-decopilot-events-BQ6ItOFo.js} +1 -1
  184. package/dist/client/assets/{use-delete-connection-CL0lmITt.js → use-delete-connection-D7g881JG.js} +1 -1
  185. package/dist/client/assets/{use-deployment-admin-CAbydMvM.js → use-deployment-admin-Cei02Kx3.js} +1 -1
  186. package/dist/client/assets/{use-file-configs-DzVPSKzj.js → use-file-configs-CfPB3s7t.js} +1 -1
  187. package/dist/client/assets/{use-infinite-scroll-Buw_04KT.js → use-infinite-scroll-BIsiRuqk.js} +1 -1
  188. package/dist/client/assets/{use-join-requests-DsC9NI-V.js → use-join-requests-Dv3eHJh5.js} +1 -1
  189. package/dist/client/assets/{use-mcp-auth-status-B6YMPvU5.js → use-mcp-auth-status-2CuEn9Ao.js} +1 -1
  190. package/dist/client/assets/{use-mcp-client-0Sy8SV6j.js → use-mcp-client-C-LnBBuJ.js} +2 -2
  191. package/dist/client/assets/{use-mcp-tools-DWFksO0x.js → use-mcp-tools-BxFrq8sY.js} +1 -1
  192. package/dist/client/assets/{use-members-er-r_ZhJ.js → use-members-6mtN34eU.js} +1 -1
  193. package/dist/client/assets/{use-mobile-eFYyqfBg.js → use-mobile-hjfr3xoA.js} +1 -1
  194. package/dist/client/assets/{use-navigate-to-agent-DJEYuQnn.js → use-navigate-to-agent-DLULuM6_.js} +1 -1
  195. package/dist/client/assets/{use-org-auth-client-UnJp9S-D.js → use-org-auth-client-Dd2A-3_W.js} +1 -1
  196. package/dist/client/assets/{use-org-sso-BXzPwxrA.js → use-org-sso-mDWe3mwz.js} +1 -1
  197. package/dist/client/assets/{use-organization-roles-gpEH8wFF.js → use-organization-roles-UFDl0kli.js} +1 -1
  198. package/dist/client/assets/{use-organization-settings-B9xB5uId.js → use-organization-settings-VTvhO8RM.js} +1 -1
  199. package/dist/client/assets/{use-registry-connections-eY-OZABr.js → use-registry-connections-6V_OOVJn.js} +1 -1
  200. package/dist/client/assets/{use-secrets-pesED1b4.js → use-secrets-C3APoSVc.js} +1 -1
  201. package/dist/client/assets/{use-status-sounds-B5j_4eaS.js → use-status-sounds-0NlGQGcq.js} +1 -1
  202. package/dist/client/assets/{use-tags-GyT5QweE.js → use-tags-CNwvMQjY.js} +1 -1
  203. package/dist/client/assets/{use-view-mode-59fH0Uy0.js → use-view-mode-DasG8IDi.js} +1 -1
  204. package/dist/client/assets/use-virtual-mcp-333MNW6F.js +1 -0
  205. package/dist/client/assets/useInfiniteQuery-jDP8kOiZ.js +1 -0
  206. package/dist/client/assets/{useQueries-C23P6xV0.js → useQueries-CJIQxjbc.js} +1 -1
  207. package/dist/client/assets/{useRouterState-BZABTJgG.js → useRouterState-k_6bFC93.js} +1 -1
  208. package/dist/client/assets/useSuspenseInfiniteQuery-BKk4QAmj.js +1 -0
  209. package/dist/client/assets/{users-DJ1RT6jP.js → users-Dx28SD_Z.js} +1 -1
  210. package/dist/client/assets/{variant-calendar-Cszv_F1h.js → variant-calendar-4-b9myOJ.js} +1 -1
  211. package/dist/client/assets/{view-mode-toggle-NMPZ55VF.js → view-mode-toggle-CwXiquMd.js} +1 -1
  212. package/dist/client/index.html +2 -2
  213. package/dist/server/cli.js +1 -1
  214. package/dist/server/server.js +1 -1
  215. package/package.json +1 -1
  216. package/dist/client/assets/calendar-D4pekYHk.js +0 -102
  217. package/dist/client/assets/category-editor-C_4PGhcn.js +0 -1
  218. package/dist/client/assets/index-B5jBvolo.css +0 -1
  219. package/dist/client/assets/index-DSLPSI9k.js +0 -663
  220. package/dist/client/assets/index-jX9vv4ej.js +0 -12
  221. package/dist/client/assets/project-app-view-Bdt0NsjQ.js +0 -1
  222. package/dist/client/assets/record-editor-BGx0Y6nL.js +0 -1
  223. package/dist/client/assets/registry-2nh66Nd_.js +0 -2
  224. package/dist/client/assets/store-registry-D6uAhMYw.js +0 -2
  225. package/dist/client/assets/use-virtual-mcp-DrdIacUa.js +0 -1
  226. package/dist/client/assets/useInfiniteQuery-BJleB0BU.js +0 -1
  227. package/dist/client/assets/useSuspenseInfiniteQuery-6fCBD_Yx.js +0 -1
@@ -0,0 +1,142 @@
1
+ import{r as P,bQ as Rl,bR as _d,j as v,af as Bd,aw as _t,bS as zd,c as Pl,b as Fd,m as Tt,bT as Wo}from"./index-CZrBPeSF.js";import{x as jd}from"./agent-icon-CtiUyn5V.js";import{i as Hd}from"./ChevronRight-Dia-WW4B.js";function Vo(t){return t?t.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function R1(t,e){return t==="output-error"||t==="output-denied"?"error":t==="approval-requested"?"approval":t==="input-streaming"||t==="input-available"||t==="output-available"&&e===!0?"loading":"idle"}function P1(t){if(t==null||typeof t!="object")return;const e=t;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const n=e.content[0];if(n?.type==="text"&&typeof n.text=="string")try{return JSON.parse(n.text)}catch{return}return}return t}function oe(t){this.content=t}oe.prototype={constructor:oe,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new oe(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new oe(n)},addToStart:function(t,e){return new oe([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new oe(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new oe(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=oe.from(t),t.size?new oe(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=oe.from(t),t.size?new oe(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=oe.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};oe.from=function(t){if(t instanceof oe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new oe(e)};function Il(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Il(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Ll(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=Ll(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class k{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new k(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new k(r,i)}cutByIndex(e,n){return e==n?k.empty:e==0&&n==this.content.length?this:new k(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new k(i,s)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Il(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Ll(this,e,n,r)}findIndex(e){if(e==0)return ir(0,e);if(e==this.size)return ir(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?ir(n+1,s):ir(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return k.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new k(n||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const Ni={index:0,offset:0};function ir(t,e){return Ni.index=t,Ni.offset=e,Ni}function xr(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!xr(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!xr(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let $=class cs{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&xr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return cs.none;if(e instanceof cs)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};$.none=[];class wr extends Error{}class M{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Bl(this.content,e+this.openStart,n);return r&&new M(r,this.openStart,this.openEnd)}removeBetween(e,n){return new M(_l(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return M.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new M(k.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new M(e,r,i)}}M.empty=new M(k.empty,0,0);function _l(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(_l(s.content,e-i-1,n-i-1)))}function Bl(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Bl(o.content,e-s-1,n,o);return a&&t.replaceChild(i,o.copy(a))}function $d(t,e,n){if(n.openStart>t.depth)throw new wr("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new wr("Inconsistent open depths");return zl(t,e,n,0)}function zl(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=zl(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return Rt(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Wd(n,t);return Rt(s,jl(t,o,a,e,r))}else return Rt(s,Sr(t,e,r))}function Fl(t,e){if(!e.type.compatibleContent(t.type))throw new wr("Cannot join "+e.type.name+" onto "+t.type.name)}function us(t,e,n){let r=t.node(n);return Fl(r,e.node(n)),r}function At(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Tn(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(At(t.nodeAfter,r),s++));for(let a=s;a<o;a++)At(i.child(a),r);e&&e.depth==n&&e.textOffset&&At(e.nodeBefore,r)}function Rt(t,e){return t.type.checkContent(e),t.copy(e)}function jl(t,e,n,r,i){let s=t.depth>i&&us(t,e,i+1),o=r.depth>i&&us(n,r,i+1),a=[];return Tn(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(Fl(s,o),At(Rt(s,jl(t,e,n,r,i+1)),a)):(s&&At(Rt(s,Sr(t,e,i+1)),a),Tn(e,n,i,a),o&&At(Rt(o,Sr(n,r,i+1)),a)),Tn(r,null,i,a),new k(a)}function Sr(t,e,n){let r=[];if(Tn(null,t,n,r),t.depth>n){let i=us(t,e,n+1);At(Rt(i,Sr(t,e,n+1)),r)}return Tn(e,null,n,r),new k(r)}function Wd(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(k.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class zn{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return $.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Mr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new zn(n,r,s)}static resolveCached(e,n){let r=qo.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else qo.set(e,r=new Vd);let i=r.elts[r.i]=zn.resolve(e,n);return r.i=(r.i+1)%qd,i}}class Vd{constructor(){this.elts=[],this.i=0}}const qd=12,qo=new WeakMap;class Mr{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Ud=Object.create(null);class Be{constructor(e,n,r,i=$.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||k.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&xr(this.attrs,n||e.defaultAttrs||Ud)&&$.sameSet(this.marks,r||$.none)}copy(e=null){return e==this.content?this:new Be(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Be(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return M.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new M(c,i.depth-o,s.depth-o)}replace(e,n,r){return $d(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return zn.resolveCached(this,e)}resolveNoCache(e){return zn.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Hl(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=k.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=$.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!$.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=k.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}Be.prototype.text=void 0;class Cr extends Be{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Hl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Cr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Cr(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Hl(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Bt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Kd(e,n);if(r.next==null)return Bt.empty;let i=$l(r);r.next&&r.err("Unexpected trailing text");let s=ef(Zd(i));return tf(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return k.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,a.concat(u));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
2
+ `)}}Bt.empty=new Bt(!0);class Kd{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function $l(t){let e=[];do e.push(Yd(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Yd(t){let e=[];do e.push(Jd(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Jd(t){let e=Qd(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Gd(t,e);else break;return e}function Uo(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Gd(t,e){let n=Uo(t),r=n;return t.eat(",")&&(t.next!="}"?r=Uo(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Xd(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function Qd(t){if(t.eat("(")){let e=$l(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Xd(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Zd(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),i(s(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Wl(t,e){return e-t}function Ko(t,e){let n=[];return r(e),n.sort(Wl);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&n.indexOf(l)==-1&&r(l)}}}function ef(t){let e=Object.create(null);return n(Ko(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);Ko(t,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new Bt(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Wl);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function tf(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Vl(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function ql(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Ul(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function Kl(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new rf(t,r,e[r]);return n}let Yo=class Yl{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Kl(e,r.attrs),this.defaultAttrs=Vl(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==Bt.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:ql(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Be(this,this.computeAttrs(e),k.from(n),$.setFrom(r))}createChecked(e=null,n,r){return n=k.from(n),this.checkContent(n),new Be(this,this.computeAttrs(e),n,$.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=k.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(k.empty,!0);return s?new Be(this,e,n.append(s),$.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ul(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:$.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Yl(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function nf(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class rf{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?nf(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class di{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Kl(e,i.attrs),this.excluded=null;let s=Vl(this.attrs);this.instance=s?new $(this,s):null}create(e=null){return!e&&this.instance?this.instance:new $(this,ql(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new di(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Ul(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Jl{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=oe.from(e.nodes),n.marks=oe.from(e.marks||{}),this.nodes=Yo.compile(this.spec.nodes,this),this.marks=di.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Bt.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Jo(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Jo(this,o.split(" "))}this.nodeFromJSON=i=>Be.fromJSON(this,i),this.markFromJSON=i=>$.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Yo){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Cr(r,r.defaultAttrs,e,$.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Jo(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function sf(t){return t.tag!=null}function of(t){return t.style!=null}class tt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(sf(i))this.tags.push(i);else if(of(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new Xo(this,n,!1);return r.addAll(e,$.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Xo(this,n,!0);return r.addAll(e,$.none,n.from,n.to),M.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(cf(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Qo(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Qo(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new tt(e,tt.schemaRules(e)))}}const Gl={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},af={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Xl={ol:!0,ul:!0},Fn=1,ds=2,Nn=4;function Go(t,e,n){return e!=null?(e?Fn:0)|(e==="full"?ds:0):t&&t.whitespace=="pre"?Fn|ds:n&~Nn}class sr{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=$.none,this.match=s||(o&Nn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(k.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Fn)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=k.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Gl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Xo{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=Go(null,n.preserveWhitespace,0)|(r?Nn:0);i?s=new sr(i.type,i.attrs,$.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new sr(null,null,$.none,!0,null,o):s=new sr(e.schema.topNodeType,null,$.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&ds?"full":this.localPreserveWS||(i.options&Fn)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
3
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;Xl.hasOwnProperty(o)&&this.parser.normalizeLists&&lf(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:af.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(Gl.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=$.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Zo(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Go(e,s,o.options);o.options&Nn&&o.content.length==0&&(a|=Nn);let l=$.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Zo(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new sr(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Fn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function lf(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Xl.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function cf(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Qo(t){let e={};for(let n in t)e[n]=t[n];return e}function Zo(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class Wt{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Oi(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=mr(Oi(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&mr(Oi(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return mr(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Wt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=ea(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return ea(e.marks)}}function ea(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Oi(t){return t.document||window.document}const ta=new WeakMap;function uf(t){let e=ta.get(t);return e===void 0&&ta.set(t,e=df(t)),e}function df(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function mr(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=uf(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=mr(t,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const Ql=65535,Zl=Math.pow(2,16);function ff(t,e){return t+e*Zl}function na(t){return t&Ql}function hf(t){return(t-(t&Ql))/Zl}const ec=1,tc=2,gr=4,nc=8;class fs{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&nc)>0}get deletedBefore(){return(this.delInfo&(ec|gr))>0}get deletedAfter(){return(this.delInfo&(tc|gr))>0}get deletedAcross(){return(this.delInfo&gr)>0}}class Me{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Me.empty)return Me.empty}recover(e){let n=0,r=na(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+hf(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,h=l+i+(f<0?0:u);if(r)return h;let p=e==(n<0?l:d)?null:ff(a/3,e-l),g=e==l?tc:e==d?ec:gr;return(n<0?e!=l:e!=d)&&(g|=nc),new fs(h,g,p)}i+=u-c}return r?e+i:new fs(e+i,0,null)}touches(e,n){let r=0,i=na(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+n],u=this.ranges[i+r];e(a,a+c,l,l+u),s+=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 jn{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new jn(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new jn;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new fs(e,i,null)}}const Di=Object.create(null);class fe{getMap(){return Me.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Di[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Di)throw new RangeError("Duplicate use of step JSON ID "+e);return Di[e]=n,n.prototype.jsonID=e,n}}class Z{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Z(e,null)}static fail(e){return new Z(null,e)}static fromReplace(e,n,r,i){try{return Z.ok(e.replace(n,r,i))}catch(s){if(s instanceof wr)return Z.fail(s.message);throw s}}}function $s(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy($s(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return k.fromArray(r)}class ht extends fe{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new M($s(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Z.fromReplace(e,this.from,this.to,s)}invert(){return new _e(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ht(n.pos,r.pos,this.mark)}merge(e){return e instanceof ht&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ht(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ht(n.from,n.to,e.markFromJSON(n.mark))}}fe.jsonID("addMark",ht);class _e extends fe{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new M($s(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Z.fromReplace(e,this.from,this.to,r)}invert(){return new ht(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new _e(n.pos,r.pos,this.mark)}merge(e){return e instanceof _e&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _e(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new _e(n.from,n.to,e.markFromJSON(n.mark))}}fe.jsonID("removeMark",_e);class pt extends fe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Z.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Z.fromReplace(e,this.pos,this.pos+1,new M(k.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new pt(this.pos,n.marks[i]);return new pt(this.pos,this.mark)}}return new zt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new pt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new pt(n.pos,e.markFromJSON(n.mark))}}fe.jsonID("addNodeMark",pt);class zt extends fe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Z.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Z.fromReplace(e,this.pos,this.pos+1,new M(k.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new pt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new zt(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new zt(n.pos,e.markFromJSON(n.mark))}}fe.jsonID("removeNodeMark",zt);class Q extends fe{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&hs(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 Q(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Q.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Q(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Q)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Q(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Q(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Q(n.from,n.to,M.fromJSON(e,n.slice),!!n.structure)}}Q.MAP_BIAS=1;fe.jsonID("replace",Q);class ie extends fe{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(hs(e,this.from,this.gapFrom)||hs(e,this.gapTo,this.to)))return Z.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Z.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.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 n=this.gapTo-this.gapFrom;return new ie(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new ie(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ie(n.from,n.to,n.gapFrom,n.gapTo,M.fromJSON(e,n.slice),n.insert,!!n.structure)}}fe.jsonID("replaceAround",ie);function hs(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function pf(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=h:i.push(o=new _e(f,h,d[g])));a&&a.to==f?a.to=h:s.push(a=new ht(f,h,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function mf(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof di){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=s):i.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>t.step(new _e(o.from,o.to,o.style)))}function Ws(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new Q(a,u,M.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new _e(a,u,c.marks[f]));if(i&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new M(k.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new Q(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(k.empty,!0);t.replace(a,a,new M(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function gf(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function pn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!gf(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function yf(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,u=k.empty,d=0;for(let p=s,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=k.from(r.node(p).copy(u)),d++):l--;let f=k.empty,h=0;for(let p=s,g=!1;p>n;p--)g||i.after(p+1)<i.end(p)?(g=!0,f=k.from(i.node(p).copy(f)),h++):c++;t.step(new ie(l,c,o,a,new M(u.append(f),d,h),u.size-d,!0))}function Vs(t,e,n=null,r=t){let i=bf(t,e),s=i&&vf(r,e);return s?i.map(ra).concat({type:e,attrs:n}).concat(s.map(ra)):null}function ra(t){return{type:t,attrs:null}}function bf(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function vf(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function kf(t,e,n){let r=k.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=k.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new ie(i,s,i,s,new M(r,0,0),n.length,!0))}function xf(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&wf(t.doc,t.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&ic(t,o,a,s),Ws(t,t.mapping.slice(s).map(a,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(a,1),f=u.map(a+o.nodeSize,1);return t.step(new ie(d,f,d+1,f-1,new M(k.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&rc(t,o,a,s),!1}})}function rc(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function ic(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
5
+ `))}})}function wf(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Sf(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ie(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new M(k.from(o),0,0),1,!0))}function nt(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>s;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Mf(t,e,n=1,r){let i=t.doc.resolve(e),s=k.empty,o=k.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){s=k.from(i.node(a).copy(s));let u=r&&r[c];o=k.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}t.step(new Q(e,e,new M(s.append(o),n,n),!0))}function xt(t,e){let n=t.resolve(e),r=n.index();return sc(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Cf(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function sc(t,e){return!!(t&&e&&!t.isLeaf&&Cf(t,e))}function fi(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&sc(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Ef(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);ic(t,u.node(),u.before(),a)}o.inlineContent&&Ws(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new Q(c,l.map(e+n,-1),M.empty,!0)),r===!0){let u=t.doc.resolve(c);rc(t,u.node(),u.before(),t.steps.length)}return t}function Tf(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function oc(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function hi(t,e,n=e,r=M.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return ac(i,s,r)?new Q(e,n,r):new Nf(i,s,r).fit()}function ac(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Nf{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=k.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=k.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new M(s,o,a);return e>-1?new ie(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Q(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Ai(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(k.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ai(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new M(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ai(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new M(xn(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new M(xn(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));d=d.matchFragment(i)}let h=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let g=a.child(c),m=d.matchType(g.type);if(!m)break;c++,(c>1||l==0||g.content.size)&&(d=m,u.push(lc(g.mark(f.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=wn(this.placed,n,k.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=a;g<h;g++){let y=m.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),m=y.content}this.unplaced=p?e==0?M.empty:new M(xn(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new M(xn(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ri(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Ri(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Ri(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=wn(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=wn(this.placed,this.depth,k.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(k.empty,!0);n.childCount&&(this.placed=wn(this.placed,this.frontier.length,n))}}function xn(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(xn(t.firstChild.content,e-1,n)))}function wn(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(wn(t.lastChild.content,e-1,n)))}function Ai(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function lc(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,lc(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(k.empty,!0)))),t.copy(r)}function Ri(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Of(n,s.content,o)?a:null}function Of(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Df(t){return t.spec.defining||t.spec.definingForContent}function Af(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(ac(i,s,r))return t.step(new Q(e,n,r));let o=uc(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(a),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=Df(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(a)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let g=0;g<o.length;g++){let m=o[(g+l)%o.length],y=!0;m<0&&(y=!1,m=-m);let b=i.node(m-1),S=i.index(m-1);if(b.canReplaceWith(S,S,p.type,p.marks))return t.replace(i.before(m),y?s.after(m):n,new M(cc(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),n=s.after(h))}}function cc(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(cc(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(k.empty,!0))}return t}function Rf(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Tf(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new M(k.from(r),0,0))}function Pf(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&n==i.start(l);l--)n=i.before(l);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=uc(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function uc(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class nn extends fe{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Z.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Z.fromReplace(e,this.pos,this.pos+1,new M(k.from(i),0,n.isLeaf?0:1))}getMap(){return Me.empty}invert(e){return new nn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new nn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new nn(n.pos,n.attr,n.value)}}fe.jsonID("attr",nn);class Hn extends fe{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Z.ok(r)}getMap(){return Me.empty}invert(e){return new Hn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Hn(n.attr,n.value)}}fe.jsonID("docAttr",Hn);let sn=class extends Error{};sn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};sn.prototype=Object.create(Error.prototype);sn.prototype.constructor=sn;sn.prototype.name="TransformError";class dc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new jn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new sn(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=M.empty){let i=hi(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new M(k.from(r),0,0))}delete(e,n){return this.replace(e,n,M.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Af(this,e,n,r),this}replaceRangeWith(e,n,r){return Rf(this,e,n,r),this}deleteRange(e,n){return Pf(this,e,n),this}lift(e,n){return yf(this,e,n),this}join(e,n=1){return Ef(this,e,n),this}wrap(e,n){return kf(this,e,n),this}setBlockType(e,n=e,r,i=null){return xf(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Sf(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new nn(e,n,r)),this}setDocAttribute(e,n){return this.step(new Hn(e,n)),this}addNodeMark(e,n){return this.step(new pt(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof $)n.isInSet(r.marks)&&this.step(new zt(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new zt(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return Mf(this,e,n,r),this}addMark(e,n,r){return pf(this,e,n,r),this}removeMark(e,n,r){return mf(this,e,n,r),this}clearIncompatible(e,n,r){return Ws(this,e,n,r),this}}const Pi=Object.create(null);class B{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new If(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=M.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?M.empty:n),a==0&&oa(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),oa(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new I(e):Qt(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Qt(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Qt(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ce(e.node(0))}static atStart(e){return Qt(e,e,0,0,1)||new Ce(e)}static atEnd(e){return Qt(e,e,e.content.size,e.childCount,-1)||new Ce(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Pi[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Pi)throw new RangeError("Duplicate use of selection JSON ID "+e);return Pi[e]=n,n.prototype.jsonID=e,n}getBookmark(){return I.between(this.$anchor,this.$head).getBookmark()}}B.prototype.visible=!0;class If{constructor(e,n){this.$from=e,this.$to=n}}let ia=!1;function sa(t){!ia&&!t.parent.inlineContent&&(ia=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class I extends B{constructor(e,n=e){sa(e),sa(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return B.near(r);let i=e.resolve(n.map(this.anchor));return new I(i.parent.inlineContent?i:r,r)}replace(e,n=M.empty){if(super.replace(e,n),n==M.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof I&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new pi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new I(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=B.findFrom(n,r,!0)||B.findFrom(n,-r,!0);if(s)n=s.$head;else return B.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(B.findFrom(e,-r,!0)||B.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new I(e,n)}}B.jsonID("text",I);class pi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new pi(e.map(this.anchor),e.map(this.head))}resolve(e){return I.between(e.resolve(this.anchor),e.resolve(this.head))}}class A extends B{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?B.near(s):new A(s)}content(){return new M(k.from(this.node),0,0)}eq(e){return e instanceof A&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new qs(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new A(e.resolve(n.anchor))}static create(e,n){return new A(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}A.prototype.visible=!1;B.jsonID("node",A);class qs{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new pi(r,r):new qs(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&A.isSelectable(r)?new A(n):B.near(n)}}class Ce extends B{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=M.empty){if(n==M.empty){e.delete(0,e.doc.content.size);let r=B.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ce(e)}map(e){return new Ce(e)}eq(e){return e instanceof Ce}getBookmark(){return Lf}}B.jsonID("all",Ce);const Lf={map(){return this},resolve(t){return new Ce(t)}};function Qt(t,e,n,r,i,s=!1){if(e.inlineContent)return I.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&A.isSelectable(a))return A.create(t,n-(i<0?a.nodeSize:0))}else{let l=Qt(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function oa(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Q||i instanceof ie))return;let s=t.mapping.maps[r],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(B.near(t.doc.resolve(o),n))}const aa=1,or=2,la=4;class _f extends dc{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|aa)&~or,this.storedMarks=null,this}get selectionSet(){return(this.updated&aa)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=or,this}ensureMarks(e){return $.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&or)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~or,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||$.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(B.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=la,this}get scrolledIntoView(){return(this.updated&la)>0}}function ca(t,e){return!e||!t?t:t.bind(e)}class Sn{constructor(e,n,r){this.name=e,this.init=ca(n.init,r),this.apply=ca(n.apply,r)}}const Bf=[new Sn("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Sn("selection",{init(t,e){return t.selection||B.atStart(e.doc)},apply(t){return t.selection}}),new Sn("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Sn("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ii{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Bf.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Sn(r.key,r.spec.state,r))})}}class tn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new tn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new _f(this)}static create(e){let n=new Ii(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new tn(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Ii(this.schema,e.plugins),r=n.fields,i=new tn(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ii(e.schema,e.plugins),s=new tn(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Be.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=B.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=c.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function fc(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=fc(i,e,{})),n[r]=i}return n}class K{constructor(e){this.spec=e,this.props={},e.props&&fc(e.props,this,this.props),this.key=e.key?e.key.key:hc("plugin")}getState(e){return e[this.key]}}const Li=Object.create(null);function hc(t){return t in Li?t+"$"+ ++Li[t]:(Li[t]=0,t+"$")}class ne{constructor(e="key"){this.key=hc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Us=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function pc(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const mc=(t,e,n)=>{let r=pc(t,n);if(!r)return!1;let i=Ks(r);if(!i){let o=r.blockRange(),a=o&&pn(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(Mc(t,i,e,-1))return!0;if(r.parent.content.size==0&&(on(s,"end")||A.isSelectable(s)))for(let o=r.depth;;o--){let a=hi(t.doc,r.before(o),r.after(o),M.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(on(s,"end")?B.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):A.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},zf=(t,e,n)=>{let r=pc(t,n);if(!r)return!1;let i=Ks(r);return i?gc(t,i,e):!1},Ff=(t,e,n)=>{let r=bc(t,n);if(!r)return!1;let i=Ys(r);return i?gc(t,i,e):!1};function gc(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=hi(t.doc,s,l,M.empty);if(!c||c.from!=s||c instanceof Q&&c.slice.size>=l-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(I.create(u.doc,s)),n(u.scrollIntoView())}return!0}function on(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const yc=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Ks(r)}let o=s&&s.nodeBefore;return!o||!A.isSelectable(o)?!1:(e&&e(t.tr.setSelection(A.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Ks(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function bc(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const vc=(t,e,n)=>{let r=bc(t,n);if(!r)return!1;let i=Ys(r);if(!i)return!1;let s=i.nodeAfter;if(Mc(t,i,e,1))return!0;if(r.parent.content.size==0&&(on(s,"start")||A.isSelectable(s))){let o=hi(t.doc,r.before(),r.after(),M.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(on(s,"start")?B.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):A.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},kc=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Ys(r)}let o=s&&s.nodeAfter;return!o||!A.isSelectable(o)?!1:(e&&e(t.tr.setSelection(A.create(t.doc,s.pos)).scrollIntoView()),!0)};function Ys(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const jf=(t,e)=>{let n=t.selection,r=n instanceof A,i;if(r){if(n.node.isTextblock||!xt(t.doc,n.from))return!1;i=n.from}else if(i=fi(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(A.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Hf=(t,e)=>{let n=t.selection,r;if(n instanceof A){if(n.node.isTextblock||!xt(t.doc,n.to))return!1;r=n.to}else if(r=fi(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},$f=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&pn(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},xc=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
6
+ `).scrollIntoView()),!0)};function Js(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Wf=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=Js(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(B.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},wc=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Ce||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Js(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(I.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Sc=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(nt(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&pn(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function Vf(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof A&&e.selection.node.isBlock)return!r.parentOffset||!nt(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=Js(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(l&&a?{type:a}:null),o=h;break}else{if(h==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof I||e.selection instanceof Ce)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=nt(u.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=nt(u.doc,d,s.length,s)),!f)return!1;if(u.split(d,s.length,s),!l&&c&&r.node(o).type!=a){let h=u.mapping.map(r.before(o)),p=u.doc.resolve(h);a&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(o)),a)}return n&&n(u.scrollIntoView()),!0}}const qf=Vf(),Uf=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(A.create(t.doc,i))),!0)};function Kf(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||xt(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Mc(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&Kf(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=k.empty;for(let y=o.length-1;y>=0;y--)p=k.from(o[y].create(null,p));p=k.from(i.copy(p));let g=t.tr.step(new ie(e.pos-1,h,e.pos,h,new M(p,1,0),o.length,!0)),m=g.doc.resolve(h+2*o.length);m.nodeAfter&&m.nodeAfter.type==i.type&&xt(g.doc,m.pos)&&g.join(m.pos),n(g.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&l?null:B.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&pn(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&on(s,"start",!0)&&on(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=s,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=k.empty;for(let S=p.length-1;S>=0;S--)y=k.from(p[S].copy(y));let b=t.tr.step(new ie(e.pos-p.length,e.pos+s.nodeSize,e.pos+m,e.pos+s.nodeSize-m,new M(y,p.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function Cc(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(I.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const Yf=Cc(-1),Jf=Cc(1);function Gf(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&Vs(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function ua(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let u=n.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}function Gs(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Gs(Us,mc,yc);Gs(Us,vc,kc);Gs(xc,wc,Sc,qf);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Xf(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let a=r?n.tr:null;return Qf(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Qf(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new Mr(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Mr(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Vs(s,n,r,e);return a?(t&&Zf(t,e,a,i,n),!0):!1}function Zf(t,e,n,r,i){let s=k.empty;for(let u=n.length-1;u>=0;u--)s=k.from(n[u].type.create(n[u].attrs,s));t.step(new ie(e.start-(r?2:0),e.end,e.start,e.end,new M(s,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==i&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&nt(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function eh(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?th(e,n,t,s):nh(e,n,s):!0:!1}}function th(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new ie(s-1,o,s,o,new M(k.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Mr(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=pn(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return xt(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function nh(t,e,n){let r=t.tr,i=n.parent;for(let h=n.end,p=n.endIndex-1,g=n.startIndex;p>g;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?k.empty:k.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new ie(d-(a?1:0),f+(l?1:0),d+1,f-1,new M((a?k.empty:k.from(i.copy(k.empty))).append(l?k.empty:k.from(i.copy(k.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function rh(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=k.from(c?t.create():null),d=new M(k.from(t.create(null,k.from(a.type.create(null,u)))),c?3:1,0),f=s.start,h=s.end;n(e.tr.step(new ie(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const ae=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},an=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ps=null;const Qe=function(t,e,n){let r=ps||(ps=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},ih=function(){ps=null},Ft=function(t,e,n,r){return n&&(da(t,e,n,r,-1)||da(t,e,n,r,1))},sh=/^(img|br|input|textarea|hr)$/i;function da(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Re(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Gn(t)||sh.test(t.nodeName)||t.contentEditable=="false")return!1;e=ae(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Re(t):0}else return!1}}function Re(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function oh(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Re(t)}else if(t.parentNode&&!Gn(t))e=ae(t),t=t.parentNode;else return null}}function ah(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Gn(t))e=ae(t)+1,t=t.parentNode;else return null}}function lh(t,e,n){for(let r=e==0,i=e==Re(t);r||i;){if(t==n)return!0;let s=ae(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Re(t)}}function Gn(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const mi=function(t){return t.focusNode&&Ft(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Et(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function ch(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function uh(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Re(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Re(r.startContainer),r.startOffset)}}}const Ve=typeof navigator<"u"?navigator:null,fa=typeof document<"u"?document:null,wt=Ve&&Ve.userAgent||"",ms=/Edge\/(\d+)/.exec(wt),Ec=/MSIE \d/.exec(wt),gs=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wt),xe=!!(Ec||gs||ms),gt=Ec?document.documentMode:gs?+gs[1]:ms?+ms[1]:0,Pe=!xe&&/gecko\/(\d+)/i.test(wt);Pe&&+(/Firefox\/(\d+)/.exec(wt)||[0,0])[1];const ys=!xe&&/Chrome\/(\d+)/.exec(wt),ce=!!ys,Tc=ys?+ys[1]:0,de=!xe&&!!Ve&&/Apple Computer/.test(Ve.vendor),ln=de&&(/Mobile\/\w+/.test(wt)||!!Ve&&Ve.maxTouchPoints>2),Ae=ln||(Ve?/Mac/.test(Ve.platform):!1),Nc=Ve?/Win/.test(Ve.platform):!1,Ze=/Android \d/.test(wt),Xn=!!fa&&"webkitFontSmoothing"in fa.documentElement.style,dh=Xn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function fh(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ke(t,e){return typeof t=="number"?t:t[e]}function hh(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function ha(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=an(o);continue}let a=o,l=a==s.body,c=l?fh(s):hh(a),u=0,d=0;if(e.top<c.top+Ke(r,"top")?d=-(c.top-e.top+Ke(i,"top")):e.bottom>c.bottom-Ke(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Ke(i,"top")-c.top:e.bottom-c.bottom+Ke(i,"bottom")),e.left<c.left+Ke(r,"left")?u=-(c.left-e.left+Ke(i,"left")):e.right>c.right-Ke(r,"right")&&(u=e.right-c.right+Ke(i,"right")),u||d)if(l)s.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-h,m=a.scrollTop-p;e={left:e.left-g,top:e.top-m,right:e.right-g,bottom:e.bottom-m}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:an(o)}}function ph(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Oc(t.dom)}}function Oc(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=an(r));return e}function mh({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Dc(n,r==0?0:r-e)}function Dc(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Jt=null;function gh(t){if(t.setActive)return t.setActive();if(Jt)return t.focus(Jt);let e=Oc(t);t.focus(Jt==null?{get preventScroll(){return Jt={preventScroll:!0},!0}}:void 0),Jt||(Jt=!1,Dc(e,0))}function Ac(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Qe(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){n=u,r=g,i=g&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&g&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?yh(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:Ac(n,i)}function yh(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=at(r,1);if(o.top!=o.bottom&&Xs(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function Xs(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function bh(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function vh(t,e,n){let{node:r,offset:i}=Ac(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function kh(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Rc(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Xs(e,c))return Rc(o,e,c)}}if((s=(s+1)%r)==i)break}return t}function xh(t,e){let n=t.dom.ownerDocument,r,i=0,s=uh(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!Xs(e,c)||(o=Rc(t.dom,e,c),!o))return null}if(de)for(let c=o;r&&c;c=an(c))c.draggable&&(r=void 0);if(o=bh(o,e),r){if(Pe&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;Xn&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=kh(t,r,i,e))}a==null&&(a=vh(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function pa(t){return t.top<t.bottom||t.left<t.right}function at(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(pa(r))return r}return Array.prototype.find.call(n,pa)||t.getBoundingClientRect()}const wh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Pc(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Xn||Pe;if(r.nodeType==3)if(o&&(wh.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=at(Qe(r,i,i),n);if(Pe&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=at(Qe(r,i-1,i-1),-1);if(c.top==l.top){let u=at(Qe(r,i,i+1),-1);if(u.top!=l.top)return mn(u,u.left<c.left)}}return l}else{let l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,mn(at(Qe(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Re(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return _i(l.getBoundingClientRect(),!1)}if(s==null&&i<Re(r)){let l=r.childNodes[i];if(l.nodeType==1)return _i(l.getBoundingClientRect(),!0)}return _i(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Re(r))){let l=r.childNodes[i-1],c=l.nodeType==3?Qe(l,Re(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return mn(at(c,1),!1)}if(s==null&&i<Re(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Qe(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return mn(at(c,-1),!0)}return mn(at(r.nodeType==3?Qe(r):r,-n),n>=0)}function mn(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function _i(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Ic(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function Sh(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Ic(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=Pc(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Qe(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const Mh=/[\u0590-\u08ac]/;function Ch(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!Mh.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:Ic(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),m=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),m}):r.pos==r.start()||r.pos==r.end()}let ma=null,ga=null,ya=!1;function Eh(t,e,n){return ma==e&&ga==n?ya:(ma=e,ga=n,ya=n=="up"||n=="down"?Sh(t,e,n):Ch(t,e,n))}const Ie=0,ba=1,Nt=2,qe=3;class Qn{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Ie,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>ae(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof _c){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Lc&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?ae(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?ae(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=ae(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=ae(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let g=this.children[h],m=p+g.size;if(s>p&&o<m)return g.setSelection(e-p-g.border,n-p-g.border,r,i);p=m}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Pe||de)&&e==n){let{node:h,offset:p}=a;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
7
+ `),d&&p==h.nodeValue.length)for(let g=h,m;g;g=g.parentNode){if(m=g.nextSibling){m.nodeName=="BR"&&(a=l={node:m.parentNode,offset:ae(m)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=h.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Pe&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&de)&&Ft(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Ft(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Pe)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Nt:ba,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=qe:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Nt:qe}r=o}this.dirty=Nt}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Nt:ba;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Lc extends Qn{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Ie&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Th extends Qn{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class jt extends Qn{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=Wt.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new jt(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&qe||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=qe&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ie){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ie}}slice(e,n,r){let i=jt.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=vs(s,n,o,r)),e>0&&(s=vs(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class yt extends Qn{constructor(e,n,r,i,s,o,a,l,c){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],l,c=a&&a(n,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Wt.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Fc(u,r,n),c?l=new Nh(e,n,r,i,u,d||null,f,c,s,o+1):n.isText?new gi(e,n,r,i,u,f,s):new yt(e,n,r,i,u,d||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>k.empty)}return e}matchesNode(e,n,r){return this.dirty==Ie&&e.eq(this.node)&&Er(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new Dh(this,o&&o.node,e);Ph(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?$.none:this.node.child(u).marks,r,e,u),l.placeWidget(c,e,i)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e,f);let h;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,d,h,e)||l.updateNextNode(c,u,d,e,f,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Nt)&&(o&&this.protectLocalComposition(e,o),Bc(this.contentDOM,this.children,e),ln&&Ih(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof I)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=Lh(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Th(this,s,n,i);e.input.compositionNodes.push(o),this.children=vs(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==qe||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Ie}updateOuterDeco(e){if(Er(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=zc(this.dom,this.nodeDOM,bs(this.outerDeco,this.node,n),bs(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function va(t,e,n,r,i){Fc(r,e,t);let s=new yt(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class gi extends yt{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==qe||this.dirty!=Ie&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ie||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Ie,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new gi(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=qe)}get domAtom(){return!1}isText(e){return this.node.text==e}}class _c extends Qn{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ie&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Nh extends yt{constructor(e,n,r,i,s,o,a,l,c,u){super(e,n,r,i,s,o,a,c,u),this.spec=l}update(e,n,r,i){if(this.dirty==qe)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Bc(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=ka(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof jt){let l=r?r.previousSibling:t.lastChild;Bc(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=ka(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const On=function(t){t&&(this.nodeName=t)};On.prototype=Object.create(null);const Ot=[new On];function bs(t,e,n){if(t.length==0)return Ot;let r=n?Ot[0]:new On,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new On(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&i.length==1&&i.push(r=new On(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function zc(t,e,n,r){if(n==Ot&&r==Ot)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Ot[0]),i=l}Oh(i,a||Ot[0],o)}return i}function Oh(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Fc(t,e,n){return zc(t,t,Ot,bs(e,n,t.nodeType!=1))}function Er(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function ka(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Dh{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Ah(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Ie,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=jt.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==qe&&o.dom==o.contentDOM&&(o.dirty=Nt),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof yt){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=qe&&Er(n,l.outerDeco));if(!f&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,n,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Nt,d.updateChildren(i,o+1),d.dirty=Ie),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Er(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=yt.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=yt.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Lc(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof jt;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof gi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((de||ce)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new _c(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Ah(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof jt)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function Rh(t,e){return t.type.side-e.type.side}function Ph(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<i.length&&i[o].to==s;){let m=i[o++];m.widget&&(u?(d||(d=[u])).push(m):u=m)}if(u)if(d){d.sort(Rh);for(let m=0;m<d.length;m++)n(d[m],c,!!l)}else n(u,c,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let m=0;m<a.length;m++)a[m].to<=s&&a.splice(m--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let m=p;o<i.length&&i[o].from<m&&(m=i[o].from);for(let y=0;y<a.length;y++)a[y].to<m&&(m=a[y].to);m<p&&(l=f.cut(m-s),f=f.cut(0,m-s),p=m,h=-1)}else for(;o<i.length&&i[o].to<p;)o++;let g=f.isInline&&!f.isLeaf?a.filter(m=>!m.inline):a.slice();r(f,g,e.forChild(s,f),h),s=p}}function Ih(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Lh(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function vs(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),u>n&&s.push(l.slice(n-c,l.size,r)))}return s}function Qs(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(mi(n)){for(l=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&A.isSelectable(d)&&i.parent&&!(d.isInline&&lh(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new A(o==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,o]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;c=Zs(t,u,a,d)}return c}function jc(t){return t.editable?t.hasFocus():$c(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function rt(t,e=!1){let n=t.state.selection;if(Hc(t,n),!!jc(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ce){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Ft(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Bh(t);else{let{anchor:r,head:i}=n,s,o;xa&&!(n instanceof I)&&(n.$from.parent.inlineContent||(s=wa(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=wa(t,n.to))),t.docView.setSelection(r,i,t,e),xa&&(s&&Sa(s),o&&Sa(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&_h(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const xa=de||ce&&Tc<63;function wa(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(de&&i&&i.contentEditable=="false")return Bi(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Bi(i);if(s)return Bi(s)}}function Bi(t){return t.contentEditable="true",de&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Sa(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function _h(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!jc(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Bh(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ae(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&xe&&gt<=11&&(n.disabled=!0,n.disabled=!1)}function Hc(t,e){if(e instanceof A){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Ma(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Ma(t)}function Ma(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Zs(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||I.between(e,n,r)}function Ca(t){return t.editable&&!t.hasFocus()?!1:$c(t)}function $c(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function zh(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ft(e.node,e.offset,n.anchorNode,n.anchorOffset)}function ks(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&B.findFrom(s,e)}function lt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Ea(t,e,n){let r=t.state.selection;if(r instanceof I)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return lt(t,new I(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=ks(t.state,e);return i&&i instanceof A?lt(t,i):!1}else if(!(Ae&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?A.isSelectable(s)?lt(t,new A(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Xn?lt(t,new I(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof A&&r.node.isInline)return lt(t,new I(e>0?r.$to:r.$from));{let i=ks(t.state,e);return i?lt(t,i):!1}}}function Tr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Dn(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Gt(t,e){return e<0?Fh(t):jh(t)}function Fh(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Pe&&n.nodeType==1&&r<Tr(n)&&Dn(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Dn(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Wc(n))break;{let a=n.previousSibling;for(;a&&Dn(a,-1);)i=n.parentNode,s=ae(a),a=a.previousSibling;if(a)n=a,r=Tr(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?xs(t,n,r):i&&xs(t,i,s)}function jh(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Tr(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Dn(a,1))s=n,o=++r;else break}else{if(Wc(n))break;{let a=n.nextSibling;for(;a&&Dn(a,1);)s=a.parentNode,o=ae(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=Tr(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&xs(t,s,o)}function Wc(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Hh(t,e){for(;t&&e==t.childNodes.length&&!Gn(t);)e=ae(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function $h(t,e){for(;t&&!e&&!Gn(t);)e=ae(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function xs(t,e,n){if(e.nodeType!=3){let s,o;(o=Hh(e,n))?(e=o,n=0):(s=$h(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(mi(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&rt(t)},50)}function Ta(t,e){let n=t.state.doc.resolve(e);if(!(ce||Nc)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Na(t,e,n){let r=t.state.selection;if(r instanceof I&&!r.empty||n.indexOf("s")>-1||Ae&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=ks(t.state,e);if(o&&o instanceof A)return lt(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Ce?B.near(o,e):B.findFrom(o,e);return a?lt(t,a):!1}return!1}function Oa(t,e){if(!(t.state.selection instanceof I))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Da(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Wh(t){if(!de||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Da(t,r,"true"),setTimeout(()=>Da(t,r,"false"),20)}return!1}function Vh(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function qh(t,e){let n=e.keyCode,r=Vh(e);if(n==8||Ae&&n==72&&r=="c")return Oa(t,-1)||Gt(t,-1);if(n==46&&!e.shiftKey||Ae&&n==68&&r=="c")return Oa(t,1)||Gt(t,1);if(n==13||n==27)return!0;if(n==37||Ae&&n==66&&r=="c"){let i=n==37?Ta(t,t.state.selection.from)=="ltr"?-1:1:-1;return Ea(t,i,r)||Gt(t,i)}else if(n==39||Ae&&n==70&&r=="c"){let i=n==39?Ta(t,t.state.selection.from)=="ltr"?1:-1:1;return Ea(t,i,r)||Gt(t,i)}else{if(n==38||Ae&&n==80&&r=="c")return Na(t,-1,r)||Gt(t,-1);if(n==40||Ae&&n==78&&r=="c")return Wh(t)||Na(t,1,r)||Gt(t,1);if(r==(Ae?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function eo(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||Wt.fromSchema(t.state.schema),a=Jc(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Yc[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=a.createElement(u[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
8
+
9
+ `);return{dom:l,text:f,slice:e}}function Vc(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return a=new M(k.from(t.state.schema.text(e.replace(/\r\n?/g,`
10
+ `))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)a=d;else{let f=i.marks(),{schema:h}=t.state,p=Wt.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=Jh(n),Xn&&Gh(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(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||tt.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Uh.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Xh(Aa(a,+u[1],+u[2]),u[4]);else if(a=M.maxOpen(Kh(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=Aa(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const Uh=/^(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 Kh(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&Uc(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Kc(o[o.length-1],s.length));let u=qc(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return k.from(o)}return t}function qc(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,k.from(t));return t}function Uc(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Uc(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(k.from(qc(n,t,i+1))))}}function Kc(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Kc(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(k.empty,!0);return t.copy(n.append(r))}function ws(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=ws(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(k.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function Aa(t,e,n){return e<t.openStart&&(t=new M(ws(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new M(ws(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Yc={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 Ra=null;function Jc(){return Ra||(Ra=document.implementation.createHTMLDocument("title"))}let zi=null;function Yh(t){let e=window.trustedTypes;return e?(zi||(zi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),zi.createHTML(t)):t}function Jh(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Jc().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Yc[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=Yh(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function Gh(t){let e=t.querySelectorAll(ce?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Xh(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=k.from(l.create(r[a+1],i)),s++,o++}return new M(i,s,o)}const ge={},ye={},Qh={touchstart:!0,touchmove:!0};class Zh{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 ep(t){for(let e in ge){let n=ge[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{np(t,r)&&!to(t,r)&&(t.editable||!(r.type in ye))&&n(t,r)},Qh[e]?{passive:!0}:void 0)}de&&t.dom.addEventListener("input",()=>null),Ss(t)}function mt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function tp(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ss(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>to(t,r))})}function to(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function np(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function rp(t,e){!to(t,e)&&ge[e.type]&&(t.editable||!(e.type in ye))&&ge[e.type](t,e)}ye.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Xc(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ze&&ce&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ln&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Et(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||qh(t,n)?n.preventDefault():mt(t,"key")};ye.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ye.keypress=(t,e)=>{let n=e;if(Xc(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ae&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof I)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function yi(t){return{left:t.clientX,top:t.clientY}}function ip(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function no(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function rn(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function sp(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&A.isSelectable(r)?(rn(t,new A(n)),!0):!1}function op(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof A&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(A.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(rn(t,A.create(t.state.doc,i)),!0):!1}function ap(t,e,n,r,i){return no(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?op(t,n):sp(t,n))}function lp(t,e,n,r){return no(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function cp(t,e,n,r){return no(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||up(t,n,r)}function up(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(rn(t,I.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)rn(t,I.create(r,a+1,a+1+o.content.size));else if(A.isSelectable(o))rn(t,A.create(r,a));else continue;return!0}}function ro(t){return Nr(t)}const Gc=Ae?"metaKey":"ctrlKey";ge.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ro(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&ip(n,t.input.lastClick)&&!n[Gc]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(yi(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new dp(t,o,n,!!r)):(s=="doubleClick"?lp:cp)(t,o.pos,o.inside,n)?n.preventDefault():mt(t,"pointer"))};class dp{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Gc],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof A&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Pe&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),mt(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(()=>rt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(yi(e))),this.updateAllowDefault(e),this.allowDefault||!n?mt(this.view,"pointer"):ap(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||de&&this.mightDrag&&!this.mightDrag.node.isAtom||ce&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(rn(this.view,B.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):mt(this.view,"pointer")}move(e){this.updateAllowDefault(e),mt(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)}}ge.touchstart=t=>{t.input.lastTouch=Date.now(),ro(t),mt(t,"pointer")};ge.touchmove=t=>{t.input.lastTouch=Date.now(),mt(t,"pointer")};ge.contextmenu=t=>ro(t);function Xc(t,e){return t.composing?!0:de&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const fp=Ze?5e3:-1;ye.compositionstart=ye.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof I&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ce&&Nc&&hp(t)))t.markCursor=t.state.storedMarks||n.marks(),Nr(t,!0),t.markCursor=null;else if(Nr(t,!e.selection.empty),Pe&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}Qc(t,fp)};function hp(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}ye.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Qc(t,20))};function Qc(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Nr(t),e))}function Zc(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=mp());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function pp(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=oh(e.focusNode,e.focusOffset),r=ah(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function mp(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Nr(t,e=!1){if(!(Ze&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Zc(t),e||t.docView&&t.docView.dirty){let n=Qs(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function gp(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const $n=xe&&gt<15||ln&&dh<604;ge.copy=ye.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=$n?null:n.clipboardData,o=r.content(),{dom:a,text:l}=eo(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):gp(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function yp(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function bp(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Wn(t,r.value,null,i,e):Wn(t,r.textContent,r.innerHTML,i,e)},50)}function Wn(t,e,n,r,i){let s=Vc(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||M.empty)))return!0;if(!s)return!1;let o=yp(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function eu(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ye.paste=(t,e)=>{let n=e;if(t.composing&&!Ze)return;let r=$n?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Wn(t,eu(r),r.getData("text/html"),i,n)?n.preventDefault():bp(t,n)};class tu{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const vp=Ae?"altKey":"ctrlKey";function nu(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[vp]}ge.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(yi(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof A?i.to-1:i.to))){if(r&&r.mightDrag)o=A.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=A.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:u}=eo(t,a);(!n.dataTransfer.files.length||!ce||Tc>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData($n?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",$n||n.dataTransfer.setData("text/plain",c),t.dragging=new tu(u,nu(t,n),o)};ge.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ye.dragover=ye.dragenter=(t,e)=>e.preventDefault();ye.drop=(t,e)=>{try{kp(t,e,t.dragging)}finally{t.dragging=null}};function kp(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(yi(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",h=>{s=h(s,t,!1)}):s=Vc(t,eu(e.dataTransfer),$n?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&nu(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||M.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?oc(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=t.state.tr;if(o){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(d))return;let f=l.doc.resolve(c);if(u&&A.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new A(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),l.setSelection(Zs(t,f,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}ge.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&rt(t)},20))};ge.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};ge.beforeinput=(t,e)=>{if(ce&&Ze&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Et(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in ye)ge[t]=ye[t];function Vn(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Or{constructor(e,n){this.toDOM=e,this.spec=n||Pt,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new me(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Or&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Vn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class bt{constructor(e,n){this.attrs=e,this.spec=n||Pt}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new me(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof bt&&Vn(this.attrs,e.attrs)&&Vn(this.spec,e.spec)}static is(e){return e.type instanceof bt}destroy(){}}class io{constructor(e,n){this.attrs=e,this.spec=n||Pt}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new me(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof io&&Vn(this.attrs,e.attrs)&&Vn(this.spec,e.spec)}destroy(){}}class me{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new me(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new me(e,e,new Or(n,r))}static inline(e,n,r,i){return new me(e,n,new bt(r,i))}static node(e,n,r,i){return new me(e,n,new io(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof bt}get widget(){return this.type instanceof Or}}const Zt=[],Pt={};class U{constructor(e,n){this.local=e.length?e:Zt,this.children=n.length?n:Zt}static create(e,n){return n.length?Dr(n,e,0,Pt):ue}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==ue||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Pt)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?xp(this.children,o||[],e,n,r,i,s):o?new U(o.sort(It),Zt):ue}add(e,n){return n.length?this==ue?U.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,u;if(u=iu(n,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,Dr(u,a,c+1,Pt)),s+=3}});let o=ru(s?su(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new U(o.length?this.local.concat(o).sort(It):this.local,i||this.children)}remove(e){return e.length==0||this==ue?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,l=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=ue?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new U(i,r):ue}forChild(e,n){if(this==ue)return this;if(n.isLeaf)return U.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof bt){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new U(i.sort(It),Zt);return r?new dt([a,r]):a}return r||ue}eq(e){if(this==e)return!0;if(!(e instanceof U)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return so(this.localsInner(e))}localsInner(e){if(this==ue)return Zt;if(e.inlineContent||!this.local.some(bt.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof bt||n.push(this.local[r]);return n}forEachSet(e){e(this)}}U.empty=new U([],[]);U.removeOverlap=so;const ue=U.empty;class dt{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Pt));return dt.from(r)}forChild(e,n){if(n.isLeaf)return U.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=ue&&(s instanceof dt?r=r.concat(s.members):r.push(s))}return dt.from(r)}eq(e){if(!(e instanceof dt)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?so(r?n:n.sort(It)):Zt}static from(e){switch(e.length){case 0:return ue;case 1:return e[0];default:return new dt(e.every(n=>n instanceof U)?e:e.reduce((n,r)=>n.concat(r instanceof U?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function xp(t,e,n,r,i,s,o){let a=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,g)=>{let m=g-p-(h-f);for(let y=0;y<a.length;y+=3){let b=a[y+1];if(b<0||f>b+u-d)continue;let S=a[y]+u-d;h>=S?a[y+1]=f<=S?-2:-1:f>=u&&m&&(a[y]+=m,a[y+1]+=m)}d+=m}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-i;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+s,-1),h=f-i,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=a[c+2].mapInner(n,m,u+1,t[c]+s+1,o);y!=ue?(a[c]=d,a[c+1]=h,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=wp(a,t,e,n,i,s,o),u=Dr(c,r,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new U(e.sort(It),a)}function ru(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new me(i.from+e,i.to+e,i.type))}return n}function wp(t,e,n,r,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,i,c);d?n.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function iu(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function su(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Dr(t,e,n,r){let i=[],s=!1;e.forEach((a,l)=>{let c=iu(t,a,l+n);if(c){s=!0;let u=Dr(c,a,n+l+1,r);u!=ue&&i.push(l,l+a.nodeSize,u)}});let o=ru(s?su(t):t,-n).sort(It);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new U(o,i):ue}function It(t,e){return t.from-e.from||t.to-e.to}function so(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Pa(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Pa(e,i,r.copy(s.from,r.to)));break}}}return e}function Pa(t,e,n){for(;e<t.length&&It(n,t[e])>0;)e++;t.splice(e,0,n)}function Fi(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ue&&e.push(r)}),t.cursorWrapper&&e.push(U.create(t.state.doc,[t.cursorWrapper.deco])),dt.from(e)}const Sp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Mp=xe&&gt<=11;class Cp{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 Ep{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Cp,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);xe&&gt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():de&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Mp&&(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,Sp)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ca(this.view)){if(this.suppressingSelectionUpdates)return rt(this.view);if(xe&&gt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ft(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=an(s))n.add(s);for(let s=e.anchorNode;s;s=an(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ca(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Pe&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||Op(e,d)!=h)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&mi(r)&&(c=Qs(e))&&c.eq(B.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,rt(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Tp(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Dp(e,l)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||rt(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(xe&&gt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?ae(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?ae(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ia=new WeakMap,La=!1;function Tp(t){if(!Ia.has(t)&&(Ia.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Pe,La)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."),La=!0}}function _a(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Ft(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Np(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return _a(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?_a(t,n):null}function Op(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Dp(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(s,a.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function Ap(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],mi(l)||c.push({node:l.focusNode,offset:l.focusOffset})),ce&&t.input.lastKeyCode===8)for(let m=s;m>i;m--){let y=r.childNodes[m-1],b=y.pmViewDesc;if(y.nodeName=="BR"&&!b){s=m;break}if(!b||b.size)break}let d=t.state.doc,f=t.someProp("domParser")||tt.fromSchema(t.state.schema),h=d.resolve(o),p=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Rp,context:h});if(c&&c[0].pos!=null){let m=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=m),p={anchor:m+o,head:y+o}}return{doc:g,sel:p,from:o,to:a}}function Rp(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(de&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||de&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Pp=/^(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 Ip(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,L=Qs(t,C);if(L&&!t.state.selection.eq(L)){if(ce&&Ze&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",te=>te(t,Et(13,"Enter"))))return;let z=t.state.tr.setSelection(L);C=="pointer"?z.setMeta("pointer",!0):C=="key"&&z.scrollIntoView(),s&&z.setMeta("composition",s),t.dispatch(z)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=Ap(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=Bp(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(ln&&t.input.lastIOSEnter>Date.now()-225||Ze)&&i.some(C=>C.nodeType==1&&!Pp.test(C.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",C=>C(t,Et(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof I&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let C=Ba(t,t.state.doc,c.sel);if(C&&!C.eq(t.state.selection)){let L=t.state.tr.setSelection(C);s&&L.setMeta("composition",s),t.dispatch(L)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof I&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),xe&&gt<=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((ln&&t.input.lastIOSEnter>Date.now()-225&&(!b||i.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!b&&g.pos<c.doc.content.size&&(!g.sameParent(m)||!g.parent.inlineContent)&&g.pos<m.pos&&!/\S/.test(c.doc.textBetween(g.pos,m.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,Et(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&_p(u,p.start,p.endA,g,m)&&t.someProp("handleKeyDown",C=>C(t,Et(8,"Backspace")))){Ze&&ce&&t.domObserver.suppressSelectionUpdates();return}ce&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Ze&&!b&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,m=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,Et(13,"Enter"))})},20));let S=p.start,E=p.endA,w=C=>{let L=C||t.state.tr.replace(S,E,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let z=Ba(t,L.doc,c.sel);z&&!(ce&&t.composing&&z.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(z.head==S||z.head==L.mapping.map(E)-1)||xe&&z.empty&&z.head==S)&&L.setSelection(z)}return s&&L.setMeta("composition",s),L.scrollIntoView()},T;if(b)if(g.pos==m.pos){xe&&gt<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>rt(t),20));let C=w(t.state.tr.delete(S,E)),L=u.resolve(p.start).marksAcross(u.resolve(p.endA));L&&C.ensureMarks(L),t.dispatch(C)}else if(p.endA==p.endB&&(T=Lp(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let C=w(t.state.tr);T.type=="add"?C.addMark(S,E,T.mark):C.removeMark(S,E,T.mark),t.dispatch(C)}else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let C=g.parent.textBetween(g.parentOffset,m.parentOffset),L=()=>w(t.state.tr.insertText(C,S,E));t.someProp("handleTextInput",z=>z(t,S,E,C,L))||t.dispatch(L())}else t.dispatch(w());else t.dispatch(w())}function Ba(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Zs(t,e.resolve(n.anchor),e.resolve(n.head))}function Lp(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(k.from(c).eq(t))return{mark:a,type:o}}function _p(t,e,n,r,i){if(n-e<=i.pos-r.pos||ji(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(ji(s,!0,!0));return!o.parent.isTextblock||o.pos>n||ji(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function ji(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Bp(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&za(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&za(t.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function za(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class ou{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Zh,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Wa),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=Ha(this),ja(this),this.nodeViews=$a(this),this.docView=va(this.state.doc,Fa(this),Fi(this),this.dom,this),this.domObserver=new Ep(this,(r,i,s,o)=>Ip(this,r,i,s,o)),this.domObserver.start(),ep(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ss(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Wa),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Zc(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=$a(this);Fp(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ss(this),this.editable=Ha(this),ja(this);let l=Fi(this),c=Fa(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&ph(this);if(o){this.domObserver.stop();let h=d&&(xe||ce)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&zp(i.selection,e.selection);if(d){let p=ce?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=pp(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=va(e.doc,c,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&zh(this))?rt(this,h):(Hc(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&mh(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof A){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&ha(this,n.getBoundingClientRect(),e)}else ha(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new tu(e.slice,e.move,i<0?void 0:A.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(xe){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&&gh(this.dom),rt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return xh(this,e)}coordsAtPos(e,n=1){return Pc(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Eh(this,n||this.state,e)}pasteHTML(e,n){return Wn(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Wn(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return eo(this,e)}destroy(){this.docView&&(tp(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Fi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ih())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return rp(this,e)}domSelectionRange(){let e=this.domSelection();return e?de&&this.root.nodeType===11&&ch(this.dom.ownerDocument)==this.dom&&Np(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}ou.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Fa(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[me.node(0,t.state.doc.content.size,e)]}function ja(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:me.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Ha(t){return!t.someProp("editable",e=>e(t.state)===!1)}function zp(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function $a(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Fp(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Wa(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var vt={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:"'"},Ar={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},jp=typeof navigator<"u"&&/Mac/.test(navigator.platform),Hp=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var le=0;le<10;le++)vt[48+le]=vt[96+le]=String(le);for(var le=1;le<=24;le++)vt[le+111]="F"+le;for(var le=65;le<=90;le++)vt[le]=String.fromCharCode(le+32),Ar[le]=String.fromCharCode(le);for(var Hi in vt)Ar.hasOwnProperty(Hi)||(Ar[Hi]=vt[Hi]);function $p(t){var e=jp&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Hp&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Ar:vt)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Wp=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Vp=typeof navigator<"u"&&/Win/.test(navigator.platform);function qp(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Wp?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function Up(t){let e=Object.create(null);for(let n in t)e[qp(n)]=t[n];return e}function $i(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Kp(t){return new K({props:{handleKeyDown:au(t)}})}function au(t){let e=Up(t);return function(n,r){let i=$p(r),s,o=e[$i(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[$i(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Vp&&r.ctrlKey&&r.altKey)&&(s=vt[r.keyCode])&&s!=i){let a=e[$i(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var Yp=Object.defineProperty,oo=(t,e)=>{for(var n in e)Yp(t,n,{get:e[n],enumerable:!0})};function bi(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var vi=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([o,a])=>[o,(...c)=>{const u=a(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o=[],a=!!t,l=t||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const g=this.buildProps(l,e),m=f(...p)(g);return o.push(m),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o={tr:t,editor:r,view:s,state:bi({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},lu={};oo(lu,{blur:()=>Jp,clearContent:()=>Gp,clearNodes:()=>Xp,command:()=>Qp,createParagraphNear:()=>Zp,cut:()=>em,deleteCurrentNode:()=>tm,deleteNode:()=>nm,deleteRange:()=>rm,deleteSelection:()=>im,enter:()=>sm,exitCode:()=>om,extendMarkRange:()=>am,first:()=>lm,focus:()=>um,forEach:()=>dm,insertContent:()=>fm,insertContentAt:()=>mm,joinBackward:()=>bm,joinDown:()=>ym,joinForward:()=>vm,joinItemBackward:()=>km,joinItemForward:()=>xm,joinTextblockBackward:()=>wm,joinTextblockForward:()=>Sm,joinUp:()=>gm,keyboardShortcut:()=>Cm,lift:()=>Em,liftEmptyBlock:()=>Tm,liftListItem:()=>Nm,newlineInCode:()=>Om,resetAttributes:()=>Dm,scrollIntoView:()=>Am,selectAll:()=>Rm,selectNodeBackward:()=>Pm,selectNodeForward:()=>Im,selectParentNode:()=>Lm,selectTextblockEnd:()=>_m,selectTextblockStart:()=>Bm,setContent:()=>zm,setMark:()=>sg,setMeta:()=>og,setNode:()=>ag,setNodeSelection:()=>lg,setTextDirection:()=>cg,setTextSelection:()=>ug,sinkListItem:()=>dg,splitBlock:()=>fg,splitListItem:()=>hg,toggleList:()=>pg,toggleMark:()=>mg,toggleNode:()=>gg,toggleWrap:()=>yg,undoInputRule:()=>bg,unsetAllMarks:()=>vg,unsetMark:()=>kg,unsetTextDirection:()=>xg,updateAttributes:()=>wg,wrapIn:()=>Sg,wrapInList:()=>Mg});var Jp=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),Gp=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Xp=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=pn(h);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},Qp=t=>e=>t(e),Zp=()=>({state:t,dispatch:e})=>wc(t,e),em=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new I(r.doc.resolve(Math.max(o-1,0)))),!0},tm=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);t.delete(a,l).scrollIntoView()}return!0}return!1};function ee(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var nm=t=>({tr:e,state:n,dispatch:r})=>{const i=ee(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},rm=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},im=()=>({state:t,dispatch:e})=>Us(t,e),sm=()=>({commands:t})=>t.keyboardShortcut("Enter"),om=()=>({state:t,dispatch:e})=>Wf(t,e);function ao(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Rr(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:ao(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function cu(t,e,n={}){return t.find(r=>r.type===e&&Rr(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Va(t,e,n={}){return!!cu(t,e,n)}function lo(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!cu([...i.node.marks],e,n)))return;let o=i.index,a=t.start()+i.offset,l=o+1,c=a+i.node.nodeSize;for(;o>0&&Va([...t.parent.child(o-1).marks],e,n);)o-=1,a-=t.parent.child(o).nodeSize;for(;l<t.parent.childCount&&Va([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function it(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var am=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=it(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:u}=a;if(i){const d=lo(l,s,e);if(d&&d.from<=c&&d.to>=u){const f=I.create(o,d.from,d.to);n.setSelection(f)}}return!0},lm=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function uu(t){return t instanceof I}function et(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function du(t,e=null){if(!e)return null;const n=B.atStart(t),r=B.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?I.create(t,et(0,i,s),et(t.content.size,i,s)):I.create(t,et(e,i,s),et(e,i,s))}function Ms(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function qn(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function cm(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var um=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(qn()||Ms())&&r.dom.focus(),cm()&&!qn()&&!Ms()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!uu(n.state.selection))return o(),!0;const a=du(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},dm=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),fm=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),fu=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&fu(r)}return t};function Mn(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return fu(n)}function Un(t,e,n){if(t instanceof Be||t instanceof k)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return k.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Un("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,a="";const l=new Jl({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,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?tt.fromSchema(l).parseSlice(Mn(t),n.parseOptions):tt.fromSchema(l).parse(Mn(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=tt.fromSchema(e);return n.slice?s.parseSlice(Mn(t),n.parseOptions).content:s.parse(Mn(t),n.parseOptions)}return Un("",e,n)}function hm(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Q||i instanceof ie))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,l,c,u)=>{o===0&&(o=u)}),t.setSelection(B.near(t.doc.resolve(o),n))}var pm=t=>!("type"in t),mm=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=m=>{s.emit("contentError",{editor:s,error:m,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Un(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(m){l(m)}try{a=Un(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(m){return l(m),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((pm(a)?a:[a]).forEach(m=>{m.check(),f=f?m.isText&&m.marks.length===0:!1,h=h?m.isBlock:!1}),u===d&&h){const{parent:m}=r.doc.resolve(u);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(u-=1,d+=1)}let g;if(f){if(Array.isArray(e))g=e.map(m=>m.text||"").join("");else if(e instanceof k){let m="";e.forEach(y=>{y.text&&(m+=y.text)}),g=m}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,d)}else{g=a;const m=r.doc.resolve(u),y=m.node(),b=m.parentOffset===0,S=y.isText||y.isTextblock,E=y.content.size>0;b&&S&&E&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}n.updateSelection&&hm(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},gm=()=>({state:t,dispatch:e})=>jf(t,e),ym=()=>({state:t,dispatch:e})=>Hf(t,e),bm=()=>({state:t,dispatch:e})=>mc(t,e),vm=()=>({state:t,dispatch:e})=>vc(t,e),km=()=>({state:t,dispatch:e,tr:n})=>{try{const r=fi(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},xm=()=>({state:t,dispatch:e,tr:n})=>{try{const r=fi(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},wm=()=>({state:t,dispatch:e})=>zf(t,e),Sm=()=>({state:t,dispatch:e})=>Ff(t,e);function hu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Mm(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))qn()||hu()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var Cm=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=Mm(t).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l?.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function kt(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?ee(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(i,f+d.nodeSize);a.push({node:d,from:h,to:p})});const l=i-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Rr(d.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var Em=(t,e={})=>({state:n,dispatch:r})=>{const i=ee(t,n.schema);return kt(n,i,e)?$f(n,r):!1},Tm=()=>({state:t,dispatch:e})=>Sc(t,e),Nm=t=>({state:e,dispatch:n})=>{const r=ee(t,e.schema);return eh(r)(e,n)},Om=()=>({state:t,dispatch:e})=>xc(t,e);function ki(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function qa(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var Dm=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ki(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=ee(t,r.schema)),a==="mark"&&(o=it(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{s&&s===u.type&&(l=!0,i&&n.setNodeMarkup(d,void 0,qa(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&(l=!0,i&&n.addMark(d,d+u.nodeSize,o.create(qa(f.attrs,e))))})})}),l},Am=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Rm=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ce(t.doc);t.setSelection(n)}return!0},Pm=()=>({state:t,dispatch:e})=>yc(t,e),Im=()=>({state:t,dispatch:e})=>kc(t,e),Lm=()=>({state:t,dispatch:e})=>Uf(t,e),_m=()=>({state:t,dispatch:e})=>Jf(t,e),Bm=()=>({state:t,dispatch:e})=>Yf(t,e);function Cs(t,e,n={},r={}){return Un(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var zm=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const c=Cs(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return o&&s.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function pu(t,e){const n=it(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function mu(t,e){const n=new dc(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function Fm(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function jm(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function Hm(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function xi(t){return e=>Hm(e.$from,t)}function D(t,e,n){return t.config[e]===void 0&&t.parent?D(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?D(t.parent,e,n):null}):t.config[e]}function co(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=D(e,"addExtensions",n);return r?[e,...co(r())]:e}).flat(10)}function uo(t,e){const n=Wt.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function gu(t){return typeof t=="function"}function j(t,e=void 0,...n){return gu(t)?e?t.bind(e)(...n):t(...n):t}function $m(t={}){return Object.keys(t).length===0&&t.constructor===Object}function cn(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function yu(t){const e=[],{nodeExtensions:n,markExtensions:r}=cn(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...o,...a];return t.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage,extensions:i},d=D(c,"addGlobalAttributes",u);if(!d)return;d().forEach(h=>{let p;Array.isArray(h.types)?p=h.types:h.types==="*"?p=l:h.types==="nodes"?p=o:h.types==="marks"?p=a:p=[],p.forEach(g=>{Object.entries(h.attributes).forEach(([m,y])=>{e.push({type:g,name:m,attribute:{...s,...y}})})})})}),i.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},d=D(c,"addAttributes",u);if(!d)return;const f=d();Object.entries(f).forEach(([h,p])=>{const g={...s,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:c.name,name:h,attribute:g})})}),e}function Wm(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let a=0;a<o;a+=1){const l=t[a];if(l==="'"&&!i){r=!r,n+=l;continue}if(l==='"'&&!r){i=!i,n+=l;continue}if(!r&&!i){if(l==="("){s+=1,n+=l;continue}if(l===")"&&s>0){s-=1,n+=l;continue}if(l===";"&&s===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function Ua(t){const e=[],n=Wm(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],o=s.indexOf(":");if(o===-1)continue;const a=s.slice(0,o).trim(),l=s.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function G(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=new Map([...Ua(r[i]),...Ua(s)]);r[i]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[i]=s}),r},{})}function un(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>G(n,r),{})}function Vm(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Ka(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):Vm(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function Ya(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&$m(n)?!1:n!=null))}function Ja(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function bu(t,e){var n;const r=yu(t),{nodeExtensions:i,markExtensions:s}=cn(t),o=(n=i.find(c=>D(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((y,b)=>{const S=D(b,"extendNodeSchema",d);return{...y,...S?S(c):{}}},{}),h=Ya({...f,content:j(D(c,"content",d)),marks:j(D(c,"marks",d)),group:j(D(c,"group",d)),inline:j(D(c,"inline",d)),atom:j(D(c,"atom",d)),selectable:j(D(c,"selectable",d)),draggable:j(D(c,"draggable",d)),code:j(D(c,"code",d)),whitespace:j(D(c,"whitespace",d)),linebreakReplacement:j(D(c,"linebreakReplacement",d)),defining:j(D(c,"defining",d)),isolating:j(D(c,"isolating",d)),attrs:Object.fromEntries(u.map(Ja))}),p=j(D(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>Ka(y,u)));const g=D(c,"renderHTML",d);g&&(h.toDOM=y=>g({node:y,HTMLAttributes:un(y,u)}));const m=D(c,"renderText",d);return m&&(h.toText=m),[c.name,h]})),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=t.reduce((m,y)=>{const b=D(y,"extendMarkSchema",d);return{...m,...b?b(c):{}}},{}),h=Ya({...f,inclusive:j(D(c,"inclusive",d)),excludes:j(D(c,"excludes",d)),group:j(D(c,"group",d)),spanning:j(D(c,"spanning",d)),code:j(D(c,"code",d)),attrs:Object.fromEntries(u.map(Ja))}),p=j(D(c,"parseHTML",d));p&&(h.parseDOM=p.map(m=>Ka(m,u)));const g=D(c,"renderHTML",d);return g&&(h.toDOM=m=>g({mark:m,HTMLAttributes:un(m,u)})),[c.name,h]}));return new Jl({topNode:o,nodes:a,marks:l})}function qm(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function An(t){return t.sort((n,r)=>{const i=D(n,"priority")||100,s=D(r,"priority")||100;return i>s?-1:i<s?1:0})}function fo(t){const e=An(co(t)),n=qm(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Um(t,e){const n=fo(t);return bu(n,e)}function I1(t,e){const n=Um(e),r=Mn(t);return tt.fromSchema(n).parse(r).toJSON()}function vu(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
11
+
12
+ `,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=s);const h=o?.[l.type.name];if(h)return u&&(a+=h({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l?.text)==null?void 0:f.slice(Math.max(r,c)-c,i-c))}),a}function Km(t,e){const n={from:0,to:t.content.size};return vu(t,n,e)}function ku(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Ym(t,e){const n=ee(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function xu(t,e){const n=ki(typeof e=="string"?e:e.name,t.schema);return n==="node"?Ym(t,e):n==="mark"?pu(t,e):{}}function Jm(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function Gm(t){const e=Jm(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function wu(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),u=e.slice(s).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Gm(r)}function ho(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=lo(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var Xm=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,o=null;for(;s>0&&o===null;){const a=i.node(s);a?.type.name===e?o=a:s-=1}return[o,s]};function gn(t,e){return e.nodes[t]||e.marks[t]||null}function yr(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var Qm=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-s))}),n};function Es(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?it(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Rr(d.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(g,m)=>{if(s&&g.inlineContent&&!g.type.allowsMarkType(s))return!1;if(!g.isText&&!g.marks.length)return;const y=Math.max(h,m),b=Math.min(p,m+g.nodeSize),S=b-y;o+=S,a.push(...g.marks.map(E=>({mark:E,from:y,to:b})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Rr(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=o}function Zm(t,e,n={}){if(!e)return kt(t,null,n)||Es(t,null,n);const r=ki(e,t.schema);return r==="node"?kt(t,e,n):r==="mark"?Es(t,e,n):!1}var eg=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=xi(a=>a.type.name===e)(t.selection);if(!s)return!1;const o=t.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},tg=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Ga(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Xa(t,e){const{nodeExtensions:n}=cn(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=j(D(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function wi(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(wi(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function Su(t){return t instanceof A}var Mu=class Cu{constructor(e){this.position=e}static fromJSON(e){return new Cu(e.position)}toJSON(){return{position:this.position}}};function ng(t,e){const n=e.mapping.mapResult(t.position);return{position:new Mu(n.pos),mapResult:n}}function rg(t){return new Mu(t)}function L1(t,e,n){const i=t.state.doc.content.size,s=et(e,0,i),o=et(n,0,i),a=t.coordsAtPos(s),l=t.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),f=Math.max(a.right,l.right),h=f-d,p=u-c,y={top:c,bottom:u,left:d,right:f,width:h,height:p,x:d,y:c};return{...y,toJSON:()=>y}}function ig(t,e,n){var r;const{selection:i}=e;let s=null;if(uu(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=h&&p}return!c}),c})}var sg=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=it(t,r.schema);if(i)if(o){const c=pu(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),g=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&n.addMark(p,g,l.create({...y.attrs,...e}))}):n.addMark(p,g,l.create(e))})});return ig(r,n,l)},og=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),ag=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=ee(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>ua(s,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>ua(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},lg=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=et(t,0,r.content.size),s=A.create(r,i);e.setSelection(s)}return!0},cg=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&n.doc.nodesBetween(o,a,(l,c)=>{l.isText||n.setNodeMarkup(c,void 0,{...l.attrs,dir:t})}),!0},ug=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=I.atStart(r).from,a=I.atEnd(r).to,l=et(i,o,a),c=et(s,o,a),u=I.create(r,l,c);e.setSelection(u)}return!0},dg=t=>({state:e,dispatch:n})=>{const r=ee(t,e.schema);return rh(r)(e,n)};function Qa(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var fg=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=yr(c,a.node().type.name,a.node().attrs);if(s instanceof A&&s.node.isBlock)return!a.parentOffset||!nt(o,a.pos)?!1:(r&&(t&&Qa(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:Fm(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=nt(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&nt(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(s instanceof I&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),m=e.doc.resolve(g);a.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&Qa(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},hg=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const a=ee(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let y=k.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let L=l.depth-b;L>=l.depth-3;L-=1)y=k.from(l.node(L).copy(y));const S=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,E={...yr(f,l.node().type.name,l.node().attrs),...e},w=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(E))||void 0;y=y.append(k.from(a.createAndFill(null,w)||void 0));const T=l.before(l.depth-(b-1));n.replace(T,l.after(-S),new M(y,4-b,0));let C=-1;n.doc.nodesBetween(T,n.doc.content.size,(L,z)=>{if(C>-1)return!1;L.isTextblock&&L.content.size===0&&(C=z+1)}),C>-1&&n.setSelection(I.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...yr(f,d.type.name,d.attrs),...e},g={...yr(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const m=h?[{type:a,attrs:p},{type:h,attrs:g}]:[{type:a,attrs:p}];if(!nt(n.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:b}=r,{splittableMarks:S}=s.extensionManager,E=b||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,m).scrollIntoView(),!E||!i)return!0;const w=E.filter(T=>S.includes(T.type.name));n.ensureMarks(w)}return!0},Wi=(t,e)=>{const n=xi(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&xt(t.doc,n.pos)&&t.join(n.pos),!0},Vi=(t,e)=>{const n=xi(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&xt(t.doc,r)&&t.join(r),!0},pg=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=ee(t,o.schema),p=ee(e,o.schema),{selection:g,storedMarks:m}=o,{$from:y,$to:b}=g,S=y.blockRange(b),E=m||g.$to.parentOffset&&g.$from.marks();if(!S)return!1;const w=xi(T=>Xa(T.type.name,d))(g);if(S.depth>=1&&w&&S.depth-w.depth<=1){if(w.node.type===h)return c.liftListItem(p);if(Xa(w.node.type.name,d)&&h.validContent(w.node.content)&&a)return l().command(()=>(s.setNodeMarkup(w.pos,h),!0)).command(()=>Wi(s,h)).command(()=>Vi(s,h)).run()}return!n||!E||!a?l().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Wi(s,h)).command(()=>Vi(s,h)).run():l().command(()=>{const T=u().wrapInList(h,r),C=E.filter(L=>f.includes(L.type.name));return s.ensureMarks(C),T?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Wi(s,h)).command(()=>Vi(s,h)).run()},mg=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=it(t,r.schema);return Es(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},gg=(t,e,n={})=>({state:r,commands:i})=>{const s=ee(t,r.schema),o=ee(e,r.schema),a=kt(r,s,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...n})},yg=(t,e={})=>({state:n,commands:r})=>{const i=ee(t,n.schema);return kt(n,i,e)?r.lift(i):r.wrapIn(i,e)},bg=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},vg=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},kg=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=it(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&o){let{from:f,to:h}=a;const p=(s=c.marks().find(m=>m.type===l))==null?void 0:s.attrs,g=lo(c,l,p);g&&(f=g.from,h=g.to),n.removeMark(f,h,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},xg=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},wg=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ki(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=ee(t,r.schema)),a==="mark"&&(o=it(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let f,h,p,g;n.selection.empty?r.doc.nodesBetween(u,d,(m,y)=>{s&&s===m.type&&(l=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m)}):r.doc.nodesBetween(u,d,(m,y)=>{y<u&&s&&s===m.type&&(l=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m),y>=u&&y<=d&&(s&&s===m.type&&(l=!0,i&&n.setNodeMarkup(y,void 0,{...m.attrs,...e})),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type&&(l=!0,i)){const S=Math.max(y,u),E=Math.min(y+m.nodeSize,d);n.addMark(S,E,o.create({...b.attrs,...e}))}}))}),h&&(f!==void 0&&i&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&i&&n.addMark(p,g,o.create({...m.attrs,...e}))}))}),l},Sg=(t,e={})=>({state:n,dispatch:r})=>{const i=ee(t,n.schema);return Gf(i,e)(n,r)},Mg=(t,e={})=>({state:n,dispatch:r})=>{const i=ee(t,n.schema);return Xf(i,e)(n,r)},Cg=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Si=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Eg=(t,e)=>{if(ao(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function ar(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Qm(c)+s;return o.forEach(f=>{if(u)return;const h=Eg(d,f.find);if(!h)return;const p=l.state.tr,g=bi({state:l.state,transaction:p}),m={from:r-(h[0].length-s.length),to:i},{commands:y,chain:b,can:S}=new vi({editor:n,state:g});f.handler({state:g,range:m,match:h,commands:y,chain:b,can:S})===null||!p.steps.length||(f.undoable&&p.setMeta(a,{transform:p,from:r,to:i,text:s}),l.dispatch(p),u=!0)}),u}function Tg(t){const{editor:e,rules:n}=t,r=new K({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=uo(k.from(u),o.schema);const{from:d}=l,f=d+u.length;ar({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return ar({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&ar({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?ar({editor:e,from:o.pos,to:o.pos,text:`
13
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Ng(t){return Object.prototype.toString.call(t).slice(8,-1)}function lr(t){return Ng(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Eu(t,e){const n={...t};return lr(t)&&lr(e)&&Object.keys(e).forEach(r=>{lr(e[r])&&lr(t[r])?n[r]=Eu(t[r],e[r]):n[r]=e[r]}),n}var po=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...j(D(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...j(D(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Eu(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Vt=class Tu extends po{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new Tu(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>c?.type.name===n.name))return!1;const l=o.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Og(t){return typeof t=="number"}var Dg=class{constructor(t){this.find=t.find,this.handler=t.handler}},Ag=(t,e,n)=>{if(ao(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Rg(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:u}=new vi({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(h,p)=>{var g,m,y,b,S;if((m=(g=h.type)==null?void 0:g.spec)!=null&&m.code||!(h.isText||h.isTextblock||h.isInline))return;const E=(S=(b=(y=h.content)==null?void 0:y.size)!=null?b:h.nodeSize)!=null?S:0,w=Math.max(r,p),T=Math.min(i,p+E);if(w>=T)return;const C=h.isText?h.text||"":h.textBetween(w-p,T-p,void 0,"");Ag(C,s.find,o).forEach(z=>{if(z.index===void 0)return;const te=w+z.index+1,Te=te+z[0].length,be={from:n.tr.mapping.map(te),to:n.tr.mapping.map(Te)},Ne=s.handler({state:n,range:be,match:z,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(Ne)})}),d.every(h=>h!==null)}var cr=null,Pg=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function Ig(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const g=u.tr,m=bi({state:u,transaction:g});if(!(!Rg({editor:e,state:m,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(u=>new K({view(d){const f=p=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(p.target)?d.dom.parentElement:null,r&&(cr=e)},h=()=>{cr&&(cr=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(s=r===d.dom.parentElement,a=f,!s){const h=cr;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return o=f,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!i,m=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),b=!!y;if(!g&&!m&&!b)return;if(b){let{text:w}=y;typeof w=="string"?w=w:w=uo(k.from(w),h.schema);const{from:T}=y,C=T+w.length,L=Pg(w);return l({rule:u,state:h,from:T,to:{b:C},pasteEvt:L})}const S=f.doc.content.findDiffStart(h.doc.content),E=f.doc.content.findDiffEnd(h.doc.content);if(!(!Og(S)||!E||S===E.b))return l({rule:u,state:h,from:S,to:E,pasteEvt:o})}}))}var Mi=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=fo(t),this.schema=bu(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:gn(e.name,this.schema)},r=D(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return An([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:gn(r.name,this.schema)},s=[],o=D(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&D(r,"exitable",i)&&(a.ArrowRight=()=>Vt.handleExit({editor:t,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,p])=>[h,()=>p({editor:t})]));a={...a,...f}}const l=Kp(a);s.push(l);const c=D(r,"addInputRules",i);if(Ga(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=Tg({editor:t,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const u=D(r,"addPasteRules",i);if(Ga(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=Ig({editor:t,rules:f});s.push(...h)}}const d=D(r,"addProseMirrorPlugins",i);if(d){const f=d();s.push(...f)}return s})}get attributes(){return yu(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=cn(this.extensions);return Object.fromEntries(e.filter(n=>!!D(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ee(n.name,this.schema)},s=D(n,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(l,c,u,d,f)=>{const h=un(l,r);return o({node:l,view:c,getPos:u,decorations:d,innerDecorations:f,editor:t,extension:n,HTMLAttributes:h})};return[n.name,a]}))}dispatchTransaction(t){const{editor:e}=this;return An([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:gn(i.name,this.schema)},o=D(i,"dispatchTransaction",s);return o?a=>{o.call(s,{transaction:a,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return An([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:gn(i.name,this.schema)},o=D(i,"transformPastedHTML",s);return o?(a,l)=>{const c=r(a,l);return o.call(s,c)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=cn(this.extensions);return Object.fromEntries(e.filter(n=>!!D(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:it(n.name,this.schema)},s=D(n,"addMarkView",i);if(!s)return[];const o=(a,l,c)=>{const u=un(a,r);return s()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{Jg(a,t,d)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:gn(e.name,this.schema)};e.type==="mark"&&((n=j(D(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=D(e,"onBeforeCreate",r),s=D(e,"onCreate",r),o=D(e,"onUpdate",r),a=D(e,"onSelectionUpdate",r),l=D(e,"onTransaction",r),c=D(e,"onFocus",r),u=D(e,"onBlur",r),d=D(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Mi.resolve=fo;Mi.sort=An;Mi.flatten=co;var Lg={};oo(Lg,{ClipboardTextSerializer:()=>Ou,Commands:()=>Du,Delete:()=>Au,Drop:()=>Ru,Editable:()=>Pu,FocusEvents:()=>Lu,Keymap:()=>_u,Paste:()=>Bu,Tabindex:()=>zu,TextDirection:()=>Fu,focusEventsPluginKey:()=>Iu});var X=class Nu extends po{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Nu(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Ou=X.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new K({key:new ne("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=ku(n);return vu(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Du=X.create({name:"commands",addCommands(){return{...lu}}}),Au=X.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const u=mu(t.before,[t,...e]);wu(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,g)=>{const m=g+p.nodeSize-2,y=h.oldRange.from<=g&&m<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:g,to:m,newFrom:u.mapping.map(g),newTo:u.mapping.map(m),deletedRange:h.oldRange,newRange:h.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var g,m;if(h instanceof _e){const y=f.slice(p).map(h.from,-1),b=f.slice(p).map(h.to),S=f.invert().map(y,-1),E=f.invert().map(b),w=(g=u.doc.nodeAt(y-1))==null?void 0:g.marks.some(C=>C.eq(h.mark)),T=(m=u.doc.nodeAt(b))==null?void 0:m.marks.some(C=>C.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:S,to:E},newRange:{from:y,to:b},partial:!!(T||w),editor:this.editor,transaction:t,combinedTransform:u})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Ru=X.create({name:"drop",addProseMirrorPlugins(){return[new K({key:new ne("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),Pu=X.create({name:"editable",addProseMirrorPlugins(){return[new K({key:new ne("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Iu=new ne("focusEvents"),Lu=X.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new K({key:Iu,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),_u=X.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,m=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?m===d.pos:B.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return qn()||hu()?s:i},addProseMirrorPlugins(){return[new K({key:new ne("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),i=t.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=B.atStart(e.doc).from,c=B.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!wi(n.doc))return;const f=n.tr,h=bi({state:n,transaction:f}),{commands:p}=new vi({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),Bu=X.create({name:"paste",addProseMirrorPlugins(){return[new K({key:new ne("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),zu=X.create({name:"tabindex",addProseMirrorPlugins(){return[new K({key:new ne("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Fu=X.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=cn(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new K({key:new ne("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),_g=class Cn{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Cn(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Cn(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 Cn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,a=this.pos+r+(s?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!i&&!o&&l.depth<=this.depth)return;const c=new Cn(l,this.editor,i,i||o?n:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},Bg=`.ProseMirror {
14
+ position: relative;
15
+ }
16
+
17
+ .ProseMirror {
18
+ word-wrap: break-word;
19
+ white-space: pre-wrap;
20
+ white-space: break-spaces;
21
+ -webkit-font-variant-ligatures: none;
22
+ font-variant-ligatures: none;
23
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
24
+ }
25
+
26
+ .ProseMirror [contenteditable="false"] {
27
+ white-space: normal;
28
+ }
29
+
30
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
31
+ white-space: pre-wrap;
32
+ }
33
+
34
+ .ProseMirror pre {
35
+ white-space: pre-wrap;
36
+ }
37
+
38
+ img.ProseMirror-separator {
39
+ display: inline !important;
40
+ border: none !important;
41
+ margin: 0 !important;
42
+ width: 0 !important;
43
+ height: 0 !important;
44
+ }
45
+
46
+ .ProseMirror-gapcursor {
47
+ display: none;
48
+ pointer-events: none;
49
+ position: absolute;
50
+ margin: 0;
51
+ }
52
+
53
+ .ProseMirror-gapcursor:after {
54
+ content: "";
55
+ display: block;
56
+ position: absolute;
57
+ top: -2px;
58
+ width: 20px;
59
+ border-top: 1px solid black;
60
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
61
+ }
62
+
63
+ @keyframes ProseMirror-cursor-blink {
64
+ to {
65
+ visibility: hidden;
66
+ }
67
+ }
68
+
69
+ .ProseMirror-hideselection *::selection {
70
+ background: transparent;
71
+ }
72
+
73
+ .ProseMirror-hideselection *::-moz-selection {
74
+ background: transparent;
75
+ }
76
+
77
+ .ProseMirror-hideselection * {
78
+ caret-color: transparent;
79
+ }
80
+
81
+ .ProseMirror-focused .ProseMirror-gapcursor {
82
+ display: block;
83
+ }`;function zg(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var Fg=class extends Cg{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:ng,createMappablePosition:rg},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=du(e,this.options.autofocus);this.editorState=tn.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=zg(Bg,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=gu(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[Pu,Ou.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Du,Lu,_u,zu,Ru,Bu,Au,Fu.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new Mi(r,this)}createCommandManager(){this.commandManager=new vi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Cs(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Cs(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new ou(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return xu(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return Zm(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return uo(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
84
+
85
+ `,textSerializers:n={}}=t||{};return Km(this.state.doc,{blockSeparator:e,textSerializers:{...ku(this.schema),...n}})}get isEmpty(){return wi(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new _g(e,this)}get $doc(){return this.$pos(0)}};function dn(t){return new Si({find:t.find,handler:({state:e,range:n,match:r})=>{const i=j(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),u=c+o.length;if(ho(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===t.type&&g!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+l,c);const f=n.from+l+o.length;s.addMark(n.from+l,f,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function jg(t){return new Si({find:t.find,handler:({state:e,range:n,match:r})=>{const i=j(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(u,a,l)}else if(r[0]){const c=t.type.isInline?o:o-1;s.insert(c,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()},undoable:t.undoable})}function Ts(t){return new Si({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=j(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function fn(t){return new Si({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=j(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),c=l&&Vs(l,t.type,s);if(!c)return null;if(o.wrap(l,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const g=p.filter(m=>h.includes(m.type.name));o.ensureMarks(g)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&xt(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)},undoable:t.undoable})}var Hg=t=>"touches"in t,_1=class{constructor(t){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=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.clientX-this.startX,c=a.clientY-this.startY;this.handleResize(l,c)},this.handleTouchMove=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.touches[0];if(!l)return;const c=l.clientX-this.startX,u=l.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const a=this.element.offsetWidth,l=this.element.offsetHeight;this.onCommit(a,l),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=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,i,s,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t?.options)!=null&&r.directions&&(this.directions=t.options.directions),(i=t.options)!=null&&i.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(s=t.options)!=null&&s.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),i=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(t.style.left="0"),s&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,Hg(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,i,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,i=this.startHeight;const s=t.includes("right"),o=t.includes("left"),a=t.includes("bottom"),l=t.includes("top");return s?r=this.startWidth+e:o&&(r=this.startWidth-e),a?i=this.startHeight+n:l&&(i=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(s?e:-e)),(t==="top"||t==="bottom")&&(i=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,t):{width:r,height:i}}applyConstraints(t,e,n){var r,i,s,o;if(!n){let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(c=Math.min(this.maxSize.width,c)),(i=this.maxSize)!=null&&i.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let a=t,l=e;return a<this.minSize.width&&(a=this.minSize.width,l=a/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,a=l*this.aspectRatio),(s=this.maxSize)!=null&&s.width&&a>this.maxSize.width&&(a=this.maxSize.width,l=a/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&l>this.maxSize.height&&(l=this.maxSize.height,a=l*this.aspectRatio),{width:a,height:l}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",i=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:i?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function $g(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof A){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function B1(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var Wg={};oo(Wg,{createAtomBlockMarkdownSpec:()=>Vg,createBlockMarkdownSpec:()=>qg,createInlineMarkdownSpec:()=>Yg,parseAttributes:()=>mo,parseIndentedBlocks:()=>Ns,renderNestedMarkdownContent:()=>yo,serializeAttributes:()=>go});function mo(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(u=>u.trim().slice(1));e.class=c.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[c]=h.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function go(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function Vg(t){const{nodeName:e,name:n,parseAttributes:r=mo,serializeAttributes:i=go,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=t,l=n||e,c=u=>{if(!a)return u;const d={};return a.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...s,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const g=p[1]||"",m=r(g);if(!o.find(b=>!(b in m)))return{type:e,raw:p[0],attributes:m}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=i(d),h=f?` {${f}}`:"";return`:::${l}${h} :::`}}}function qg(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=mo,serializeAttributes:s=go,defaultAttributes:o={},content:a="block",allowedAttributes:l}=t,c=n||e,u=d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const g=r(d);h=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...o,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),m=d.match(g);if(!m)return;const[y,b=""]=m,S=i(b);let E=1;const w=y.length;let T="";const C=/^:::([\w-]*)(\s.*)?/gm,L=d.slice(w);for(C.lastIndex=0;;){const z=C.exec(L);if(z===null)break;const te=z.index,Te=z[1];if(!((p=z[2])!=null&&p.endsWith(":::"))){if(Te)E+=1;else if(E-=1,E===0){const be=L.slice(0,te);T=be.trim();const Ne=d.slice(0,w+te+z[0].length);let re=[];if(T)if(a==="block")for(re=h.blockTokens(be),re.forEach(q=>{q.text&&(!q.tokens||q.tokens.length===0)&&(q.tokens=h.inlineTokens(q.text))});re.length>0;){const q=re[re.length-1];if(q.type==="paragraph"&&(!q.text||q.text.trim()===""))re.pop();else break}else re=h.inlineTokens(T);return{type:e,raw:Ne,attributes:S,content:T,tokens:re}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=s(h),g=p?` {${p}}`:"",m=f.renderChildren(d.content||[],`
86
+
87
+ `);return`:::${c}${g}
88
+
89
+ ${m}
90
+
91
+ :::`}}}function Ug(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=n.exec(t)}return e}function Kg(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function Yg(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=Ug,serializeAttributes:s=Kg,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,u=f=>{if(!l)return f;const h={};return l.forEach(p=>{const g=typeof p=="string"?p:p.name,m=typeof p=="string"?void 0:p.skipIfDefault;if(g in f){const y=f[g];if(m!==void 0&&y===m)return;h[g]=y}}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...o,...f.attributes};if(a)return h.createNode(e,p);const g=r?r(f):f.content||"";return g?h.createNode(e,p,[h.createTextNode(g)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),g=p?.index;return g!==void 0?g:-1},tokenize(f,h,p){const g=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),m=f.match(g);if(!m)return;let y="",b="";if(a){const[,E]=m;b=E}else{const[,E,w]=m;b=E,y=w||""}const S=i(b.trim());return{type:e,raw:m[0],content:y.trim(),attributes:S}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const p=u(f.attrs||{}),g=s(p),m=g?` ${g}`:"";return a?`[${c}${m}]`:`[${c}${m}]${h}[/${c}]`}}}function Ns(t,e,n){var r,i,s,o;const a=t.split(`
92
+ `),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const f=a[u],h=f.match(e.itemPattern);if(!h){if(l.length>0)break;if(f.trim()===""){u+=1,c=`${c}${f}
93
+ `;continue}else return}const p=e.extractItemData(h),{indentLevel:g,mainContent:m}=p;c=`${c}${f}
94
+ `;const y=[m];for(u+=1;u<a.length;){const w=a[u];if(w.trim()===""){const C=a.slice(u+1).findIndex(te=>te.trim()!=="");if(C===-1)break;if((((i=(r=a[u+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>g){y.push(w),c=`${c}${w}
95
+ `,u+=1;continue}else break}if((((o=(s=w.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>g)y.push(w),c=`${c}${w}
96
+ `,u+=1;else break}let b;const S=y.slice(1);if(S.length>0){const w=S.map(T=>T.slice(g+d)).join(`
97
+ `);w.trim()&&(e.customNestedParser?b=e.customNestedParser(w):b=n.blockTokens(w))}const E=e.createToken(p,b);l.push(E)}if(l.length!==0)return{items:l,raw:c}}function yo(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content,a=e.renderChildren([s]);let l=`${i}${a}`;return o&&o.length>0&&o.forEach((c,u)=>{var d,f;const h=(f=(d=e.renderChild)==null?void 0:d.call(e,c,u+1))!=null?f:e.renderChildren([c]);if(h!=null){const p=h.split(`
98
+ `).map(g=>g?e.indent(g):e.indent("")).join(`
99
+ `);l+=c.type==="paragraph"?`
100
+
101
+ ${p}`:`
102
+ ${p}`}}),l}function Jg(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((a,l)=>{const c=s.mapping.map(l),u=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});s.removeMark(c,u,t.type),s.addMark(c,u,h)}}),s.docChanged&&e.view.dispatch(s)}var Se=class ju extends po{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new ju(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Gg=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,i,s,o,a;const{view:l}=this.editor,c=t.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,f=0;if(this.dom!==u){const b=this.dom.getBoundingClientRect(),S=u.getBoundingClientRect(),E=(i=t.offsetX)!=null?i:(r=t.nativeEvent)==null?void 0:r.offsetX,w=(o=t.offsetY)!=null?o:(s=t.nativeEvent)==null?void 0:s.offsetY;d=S.x-b.x+E,f=S.y-b.y+w}const h=this.dom.cloneNode(!0);try{const b=this.dom.getBoundingClientRect();h.style.width=`${Math.round(b.width)}px`,h.style.height=`${Math.round(b.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(h),document.body.appendChild(p),(a=t.dataTransfer)==null||a.setDragImage(h,d,f)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const m=A.create(l.state.doc,g),y=l.state.tr.setSelection(m);l.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const i=t.type.startsWith("drag"),s=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s&&!i)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=A.isSelectable(this.node),d=t.type==="copy",f=t.type==="paste",h=t.type==="cut",p=t.type==="mousedown";if(!c&&u&&i&&t.target===this.dom&&t.preventDefault(),c&&i&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(c&&a&&!l&&p){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||s||d||f||h||p&&u)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(qn()||Ms())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function Ht(t){return new Dg({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=j(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(ho(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===t.type&&m!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&o.delete(f,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:Xg,getOwnPropertySymbols:Qg}=Object,{hasOwnProperty:Zg}=Object.prototype;function qi(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function ur(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,o=s.get(n),a=s.get(r);if(o&&a)return o===r&&a===n;s.set(n,r),s.set(r,n);const l=t(n,r,i);return s.delete(n),s.delete(r),l}}function ey(t){return t?.[Symbol.toStringTag]}function Za(t){return Xg(t).concat(Qg(t))}const ty=Object.hasOwn||((t,e)=>Zg.call(t,e));function qt(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const ny="__v",ry="__o",iy="_owner",{getOwnPropertyDescriptor:el,keys:tl}=Object;function sy(t,e){return t.byteLength===e.byteLength&&Pr(new Uint8Array(t),new Uint8Array(e))}function oy(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function ay(t,e){return t.byteLength===e.byteLength&&Pr(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function ly(t,e){return qt(t.getTime(),e.getTime())}function cy(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function uy(t,e){return t===e}function nl(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let o,a,l=0;for(;(o=s.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(i[d]){d++;continue}const f=o.value,h=a.value;if(n.equals(f[0],h[0],l,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){u=i[d]=!0;break}d++}if(!u)return!1;l++}return!0}const dy=qt;function fy(t,e,n){const r=tl(t);let i=r.length;if(tl(e).length!==i)return!1;for(;i-- >0;)if(!Hu(t,e,n,r[i]))return!1;return!0}function yn(t,e,n){const r=Za(t);let i=r.length;if(Za(e).length!==i)return!1;let s,o,a;for(;i-- >0;)if(s=r[i],!Hu(t,e,n,s)||(o=el(t,s),a=el(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function hy(t,e){return qt(t.valueOf(),e.valueOf())}function py(t,e){return t.source===e.source&&t.flags===e.flags}function rl(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let o,a;for(;(o=s.next())&&!o.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!i[u]&&n.equals(o.value,a.value,o.value,a.value,t,e,n)){c=i[u]=!0;break}u++}if(!c)return!1}return!0}function Pr(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function my(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Hu(t,e,n,r){return(r===iy||r===ry||r===ny)&&(t.$$typeof||e.$$typeof)?!0:ty(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const gy="[object ArrayBuffer]",yy="[object Arguments]",by="[object Boolean]",vy="[object DataView]",ky="[object Date]",xy="[object Error]",wy="[object Map]",Sy="[object Number]",My="[object Object]",Cy="[object RegExp]",Ey="[object Set]",Ty="[object String]",Ny={"[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},Oy="[object URL]",Dy=Object.prototype.toString;function Ay({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(m,y,b){if(m===y)return!0;if(m==null||y==null)return!1;const S=typeof m;if(S!==typeof y)return!1;if(S!=="object")return S==="number"?a(m,y,b):S==="function"?s(m,y,b):!1;const E=m.constructor;if(E!==y.constructor)return!1;if(E===Object)return l(m,y,b);if(Array.isArray(m))return e(m,y,b);if(E===Date)return r(m,y,b);if(E===RegExp)return u(m,y,b);if(E===Map)return o(m,y,b);if(E===Set)return d(m,y,b);const w=Dy.call(m);if(w===ky)return r(m,y,b);if(w===Cy)return u(m,y,b);if(w===wy)return o(m,y,b);if(w===Ey)return d(m,y,b);if(w===My)return typeof m.then!="function"&&typeof y.then!="function"&&l(m,y,b);if(w===Oy)return h(m,y,b);if(w===xy)return i(m,y,b);if(w===yy)return l(m,y,b);if(Ny[w])return f(m,y,b);if(w===gy)return t(m,y,b);if(w===vy)return n(m,y,b);if(w===by||w===Sy||w===Ty)return c(m,y,b);if(p){let T=p[w];if(!T){const C=ey(m);C&&(T=p[C])}if(T)return T(m,y,b)}return!1}}function Ry({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:sy,areArraysEqual:n?yn:oy,areDataViewsEqual:ay,areDatesEqual:ly,areErrorsEqual:cy,areFunctionsEqual:uy,areMapsEqual:n?qi(nl,yn):nl,areNumbersEqual:dy,areObjectsEqual:n?yn:fy,arePrimitiveWrappersEqual:hy,areRegExpsEqual:py,areSetsEqual:n?qi(rl,yn):rl,areTypedArraysEqual:n?qi(Pr,yn):Pr,areUrlsEqual:my,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=ur(r.areArraysEqual),s=ur(r.areMapsEqual),o=ur(r.areObjectsEqual),a=ur(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:a})}return r}function Py(t){return function(e,n,r,i,s,o,a){return t(e,n,a)}}function Iy({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(a,l){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(a,l,{cache:c,equals:r,meta:u,strict:i})};if(t)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(a,l){return e(a,l,s)}}const Ly=St();St({strict:!0});St({circular:!0});St({circular:!0,strict:!0});St({createInternalComparator:()=>qt});St({strict:!0,createInternalComparator:()=>qt});St({circular:!0,createInternalComparator:()=>qt});St({circular:!0,createInternalComparator:()=>qt,strict:!0});function St(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=Ry(t),o=Ay(s),a=n?n(o):Py(o);return Iy({circular:e,comparator:o,createState:r,equals:a,strict:i})}var _y=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},By=({contentComponent:t})=>{const e=Rl.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return v.jsx(v.Fragment,{children:Object.values(e)})};function zy(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:zd.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var Fy=class extends _t.Component{constructor(t){var e;super(t),this.editorContentRef=_t.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=zy(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return v.jsxs(v.Fragment,{children:[v.jsx("div",{ref:_y(e,this.editorContentRef),...n}),t?.contentComponent&&v.jsx(By,{contentComponent:t.contentComponent})]})}},jy=P.forwardRef((t,e)=>{const n=_t.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return _t.createElement(Fy,{key:n,innerRef:e,...t})}),Hy=_t.memo(jy),$y=typeof window<"u"?P.useLayoutEffect:P.useEffect,Wy=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function Vy(t){var e;const[n]=P.useState(()=>new Wy(t.editor)),r=_d.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:Ly);return $y(()=>n.watch(t.editor),[t.editor,n]),P.useDebugValue(r),r}var qy=!1,Os=typeof window>"u",Uy=Os||!!(typeof window<"u"&&window.next),Ky=class $u{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Os||Uy?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)}};return new Fg(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=n.extensions)==null?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?$u.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function z1(t={},e=[]){const n=P.useRef(t);n.current=t;const[r]=P.useState(()=>new Ky(n)),i=Rl.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return P.useDebugValue(i),P.useEffect(r.onRender(e)),Vy({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}var bo=P.createContext({editor:null});bo.Consumer;var F1=()=>P.useContext(bo),Wu=P.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Yy=()=>P.useContext(Wu),Jy=_t.forwardRef((t,e)=>{const{onDragStart:n}=Yy(),r=t.as||"div";return v.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function il(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function sl(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function Gy(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function Xy(t){if(il(t)||sl(t))return!0;if(Gy(t)){const e=t.type;if(e)return il(e)||sl(e)}return!1}function Qy(){try{if(P.version)return parseInt(P.version.split(".")[0],10)>=19}catch{}return!1}var Zy=class{constructor(t,{editor:e,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?Bd.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,i=Qy(),s=Xy(e),o={...n};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=a=>{this.ref=a}),this.reactElement=v.jsx(e,{...o}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};_t.createContext({markViewContentRef:()=>{}});var e0=class extends Gg{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,i){var s;return r==="storage"?(s=t.storage[e.name])!=null?s:{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:P.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},i=this.component,s=P.memo(l=>v.jsx(Wu.Provider,{value:r,children:P.createElement(i,l)}));s.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new Zy(s,{editor:this.editor,props:t,as:o,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,o=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:s,newNode:t,newDecorations:e,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=un(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function t0(t,e){return n=>n.editor.contentComponent?new e0(t,n,e):{}}var vo=P.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});vo.displayName="TiptapContext";var n0=()=>P.useContext(vo);function Vu({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=P.useMemo(()=>({editor:r}),[r]),s=P.useMemo(()=>({editor:r}),[r]);return v.jsx(bo.Provider,{value:s,children:v.jsx(vo.Provider,{value:i,children:n})})}Vu.displayName="Tiptap";function qu({...t}){const{editor:e}=n0();return v.jsx(Hy,{editor:e,...t})}qu.displayName="Tiptap.Content";Object.assign(Vu,{Content:qu});function r0(t){return t.storage.mention}function j1(t,e,n){t.chain().focus().insertContentAt(e,[i0(n),{type:"text",text:" "}]).run()}function i0(t){return{type:"mention",attrs:t}}function H1(t,e,n){const r=t.state.doc.nodeAt(e);return r?.type.name==="mention"&&r.attrs.id===n}function s0(t){const e=Pl.c(34),{node:n,selected:r,view:i,editor:s,getPos:o}=t,{name:a,char:l,kind:c,id:u,args:d}=n.attrs,f=Fd(),h=r&&i.editable,p=c==="task",g=l==="@",m=i.editable&&l==="/"&&(c==="prompt"||c===void 0);let y;e[0]!==d||e[1]!==s||e[2]!==o||e[3]!==u||e[4]!==a?(y=()=>{const Kt=r0(s)?.onEditChip;if(!Kt||typeof o!="function")return;const Yt=o();typeof Yt=="number"&&Kt({promptId:u,promptName:a,args:d??{},pos:Yt})},e[0]=d,e[1]=s,e[2]=o,e[3]=u,e[4]=a,e[5]=y):y=e[5];const b=y;let S;e[6]!==m||e[7]!==b?(S=N=>{m&&(N.preventDefault(),N.stopPropagation(),b())},e[6]=m,e[7]=b,e[8]=S):S=e[8];const E=S;let w;e[9]!==m||e[10]!==b?(w=N=>{m&&(N.key!=="Enter"&&N.key!==" "||(N.preventDefault(),N.stopPropagation(),b()))},e[9]=m,e[10]=b,e[11]=w):w=e[11];const T=w,C=m?"button":void 0,L=m?0:void 0;let z;e[12]!==m||e[13]!==a||e[14]!==f?(z=m?f("chat.mention.editPrompt",{name:a?Vo(a):""}):void 0,e[12]=m,e[13]=a,e[14]=f,e[15]=z):z=e[15];const te=m?"cursor-pointer":"cursor-default",Te=g?"bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",be=h&&"outline-2 outline-blue-300 outline-offset-0",Ne=m&&"hover:brightness-95",re=!p&&"capitalize";let q;e[16]!==re||e[17]!==te||e[18]!==Te||e[19]!==be||e[20]!==Ne?(q=Tt("px-1 py-1 rounded","inline-flex items-center gap-1",te,"select-none","text-xs font-light",Te,be,Ne,re),e[16]=re,e[17]=te,e[18]=Te,e[19]=be,e[20]=Ne,e[21]=q):q=e[21];let he;e[22]!==p||e[23]!==a?(he=p?v.jsx("span",{className:"inline-block max-w-[220px] truncate align-bottom",children:a??""}):a?Vo(a):"",e[22]=p,e[23]=a,e[24]=he):he=e[24];let O;return e[25]!==l||e[26]!==E||e[27]!==T||e[28]!==q||e[29]!==he||e[30]!==C||e[31]!==L||e[32]!==z?(O=v.jsxs(Jy,{onClick:E,onKeyDown:T,role:C,tabIndex:L,"aria-label":z,className:q,children:[l,he]}),e[25]=l,e[26]=E,e[27]=T,e[28]=q,e[29]=he,e[30]=C,e[31]=L,e[32]=z,e[33]=O):O=e[33],O}const $1=Se.create({name:"mention",group:"inline",inline:!0,atom:!0,addStorage(){return{onEditChip:null}},addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},char:{default:"/",parseHTML:t=>t.getAttribute("data-char")||"/",renderHTML:t=>t.char?{"data-char":t.char}:{}},metadata:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:t=>t.metadata?{"data-metadata":JSON.stringify(t.metadata)}:{}},kind:{default:void 0,parseHTML:t=>t.getAttribute("data-kind")||void 0,renderHTML:t=>t.kind?{"data-kind":t.kind}:{}},args:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-args")||"null")}catch{return null}},renderHTML:t=>t.args?{"data-args":JSON.stringify(t.args)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({HTMLAttributes:t}){return["span",G(t,{"data-type":"mention"})]},renderText({node:t}){const e=t.attrs.char??"@",n=t.attrs.name??"";return`${e}${n}`},addNodeView(){return t0(s0)}});function o0(t={}){return new K({view(e){return new a0(e,t)}})}class a0{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let m=this.width/2*a;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 l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*h}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=oc(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}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)}}class J extends B{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return J.valid(r)?new J(r):B.near(r)}content(){return M.empty}eq(e){return e instanceof J&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new J(e.resolve(n.pos))}getBookmark(){return new ko(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!l0(e)||!c0(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&J.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let l=e.doc.resolve(i);if(J.valid(l))return l}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!A.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let a=e.doc.resolve(i);if(J.valid(a))return a}return null}}}J.prototype.visible=!1;J.findFrom=J.findGapCursorFrom;B.jsonID("gapcursor",J);class ko{constructor(e){this.pos=e}map(e){return new ko(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return J.valid(n)?new J(n):B.near(n)}}function Uu(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function l0(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Uu(i.type))return!0;if(i.inlineContent)return!1}}return!0}function c0(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Uu(i.type))return!0;if(i.inlineContent)return!1}}return!0}function u0(){return new K({props:{decorations:p0,createSelectionBetween(t,e,n){return e.pos==n.pos&&J.valid(n)?new J(n):null},handleClick:f0,handleKeyDown:d0,handleDOMEvents:{beforeinput:h0}}})}const d0=au({ArrowLeft:dr("horiz",-1),ArrowRight:dr("horiz",1),ArrowUp:dr("vert",-1),ArrowDown:dr("vert",1)});function dr(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof I){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=J.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new J(c))),!0):!1}}function f0(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!J.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&A.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new J(r))),!0)}function h0(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof J))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=k.empty;for(let o=r.length-1;o>=0;o--)i=k.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new M(i,0,0));return s.setSelection(I.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function p0(t){if(!(t.selection instanceof J))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",U.create(t.doc,[me.widget(t.selection.head,e,{key:"gapcursor"})])}var Ir=200,se=function(){};se.prototype.append=function(e){return e.length?(e=se.from(e),!this.length&&e||e.length<Ir&&this.leafAppend(e)||this.length<Ir&&e.leafPrepend(this)||this.appendInner(e)):this};se.prototype.prepend=function(e){return e.length?se.from(e).append(this):this};se.prototype.appendInner=function(e){return new m0(this,e)};se.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?se.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};se.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};se.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};se.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};se.from=function(e){return e instanceof se?e:e&&e.length?new Ku(e):se.empty};var Ku=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ir)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ir)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(se);se.empty=new Ku([]);var m0=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(se);const g0=500;class Le{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new je(d.map));let h=d.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new je(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new Le(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new je(e.mapping.maps[u],d,n),h;(h=l&&l.merge(f))&&(f=h,u?s.pop():a=a.slice(0,a.length-1)),s.push(f),n&&(o++,n=void 0),i||(l=f)}let c=o-r.depth;return c>b0&&(a=y0(a,c),o-=c),new Le(a.append(s),o)}remapping(e,n){let r=new jn;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Le(this.items.append(e.map(n=>new je(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=n;this.items.forEach(f=>{let h=s.getMirror(--l);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),m=f.selection&&f.selection.map(s.slice(l+1,h));m&&a++,r.push(new je(p,g,m))}else r.push(new je(p))},i);let c=[];for(let f=n;f<o;f++)c.push(new je(s.maps[f]));let u=this.items.slice(0,i).append(c).append(r),d=new Le(u,a);return d.emptyItemCount()>g0&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let d=new je(c.invert(),l,u),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&r--},this.items.length,0),new Le(se.from(i.reverse()),s)}}Le.empty=new Le(se.empty,0);function y0(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class je{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new je(n.getMap().invert(),n,this.selection)}}}class ct{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const b0=20;function v0(t,e,n,r){let i=n.getMeta(Lt),s;if(i)return i.historyState;n.getMeta(w0)&&(t=new ct(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Lt))return o.getMeta(Lt).redo?new ct(t.done.addTransform(n,void 0,r,br(e)),t.undone,ol(n.mapping.maps),t.prevTime,t.prevComposition):new ct(t.done,t.undone.addTransform(n,void 0,r,br(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!k0(n,t.prevRanges)),c=o?Ui(t.prevRanges,n.mapping):ol(n.mapping.maps);return new ct(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,br(e)),Le.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new ct(t.done.rebased(n,s),t.undone.rebased(n,s),Ui(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ct(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Ui(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function k0(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function ol(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function Ui(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function x0(t,e,n){let r=br(e),i=Lt.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new ct(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(Lt,{redo:n,historyState:l})}let Ki=!1,al=null;function br(t){let e=t.plugins;if(al!=e){Ki=!1,al=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ki=!0;break}}return Ki}const Lt=new ne("history"),w0=new ne("closeHistory");function S0(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new K({key:Lt,state:{init(){return new ct(Le.empty,Le.empty,null,0,-1)},apply(e,n,r){return v0(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Ju:r=="historyRedo"?Gu:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function Yu(t,e){return(n,r)=>{let i=Lt.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=x0(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const Ju=Yu(!1,!0),Gu=Yu(!0,!0);X.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new K({key:new ne("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-r,c=a-l,u=a;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var M0=X.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[o0(this.options)]}});X.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new K({key:new ne("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return U.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;o+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(me.node(c,c+l.nodeSize,{class:this.options.className}))}),U.create(t,s)}}})]}});var C0=X.create({name:"gapCursor",addProseMirrorPlugins(){return[u0()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=j(D(t,"allowGapCursor",n)))!=null?e:null}}}),ll="placeholder";function E0(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var W1=X.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:ll,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${E0(this.options.dataAttribute)}`:`data-${ll}`;return[new K({key:new ne("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,s=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((a,l)=>{const c=i>=l&&i<=l+a.nodeSize,u=!a.isLeaf&&wi(a);if((c||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const f=me.node(l,l+a.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:l,hasAnchor:c}):this.options.placeholder});s.push(f)}return this.options.includeChildren}),U.create(e,s)}}})]}});X.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new K({key:new ne("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Su(n.selection)||t.view.dragging?null:U.create(n.doc,[me.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function cl({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var T0=X.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ne(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new K({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:c}=o,u=e.getState(o),d=a.content.size,f=c.nodes[n];if(u)return l.insert(d,f.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!cl({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!cl({node:o,types:r})}}})]}}),N0=X.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Ju(t,e),redo:()=>({state:t,dispatch:e})=>Gu(t,e)}},addProseMirrorPlugins(){return[S0(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()}}}),Lr=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},O0=/^\s*>\s$/,D0=Se.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Lr("blockquote",{...G(this.options.HTMLAttributes,t),children:Lr("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((i,s)=>{var o,a;const u=((a=(o=e.renderChild)==null?void 0:o.call(e,i,s))!=null?a:e.renderChildren([i])).split(`
103
+ `).map(d=>d.trim()===""?n:`${n} ${d}`);r.push(u.join(`
104
+ `))}),r.join(`
105
+ ${n}
106
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[fn({find:O0,type:this.type})]}}),A0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,R0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,P0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,I0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,L0=Vt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Lr("strong",{...G(this.options.HTMLAttributes,t),children:Lr("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[dn({find:A0,type:this.type}),dn({find:P0,type:this.type})]},addPasteRules(){return[Ht({find:R0,type:this.type}),Ht({find:I0,type:this.type})]}}),_0=/(^|[^`])`([^`]+)`(?!`)$/,B0=/(^|[^`])`([^`]+)`(?!`)/g,z0=Vt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",G(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[dn({find:_0,type:this.type})]},addPasteRules(){return[Ht({find:B0,type:this.type})]}}),Yi=4,F0=/^```([a-z]+)?[\s\n]$/,j0=/^~~~([a-z]+)?[\s\n]$/,H0=Se.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Yi,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",G(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
107
+ `):r=`\`\`\`${i}
108
+
109
+ \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Yi,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(n);return o?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:c,to:u}=i,h=r.doc.textBetween(c,u,`
110
+ `,`
111
+ `).split(`
112
+ `).map(p=>a+p).join(`
113
+ `);return l.replaceWith(c,u,r.schema.text(h)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Yi,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?t.commands.command(({tr:a})=>{var l;const{pos:c}=s,u=s.start(),d=s.end(),h=r.doc.textBetween(u,d,`
114
+ `,`
115
+ `).split(`
116
+ `);let p=0,g=0;const m=c-u;for(let T=0;T<h.length;T+=1){if(g+h[T].length>=m){p=T;break}g+=h[T].length+1}const b=((l=h[p].match(/^ */))==null?void 0:l[0])||"",S=Math.min(b.length,n);if(S===0)return!0;let E=u;for(let T=0;T<p;T+=1)E+=h[T].length+1;return a.delete(E,E+S),c-E<=S&&a.setSelection(I.create(a.doc,E)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:c}=i,f=r.doc.textBetween(l,c,`
117
+ `,`
118
+ `).split(`
119
+ `).map(h=>{var p;const g=((p=h.match(/^ */))==null?void 0:p[0])||"",m=Math.min(g.length,n);return h.slice(m)}).join(`
120
+ `);return a.replaceWith(l,c,r.schema.text(f)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
121
+
122
+ `);return!s||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(B.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ts({find:F0,type:this.type,getAttributes:t=>({language:t[1]})}),Ts({find:j0,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new K({key:new ne("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!n||!s)return!1;const{tr:o,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
123
+ `));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(I.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),$0=Se.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
124
+
125
+ `):""}),W0=Se.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",G(this.options.HTMLAttributes,t)]},renderText(){return`
126
+ `},renderMarkdown:()=>`
127
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),V0=Se.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,G(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Ts({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),q0=Se.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",G(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!$g(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return Su(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(I.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(A.create(o.doc,l.pos)):o.setSelection(I.create(o.doc,l.pos));else{const u=s.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=u?.create();d&&(o.insert(c,d),o.setSelection(I.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[jg({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),U0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,K0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Y0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,J0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,G0=Vt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",G(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[dn({find:U0,type:this.type}),dn({find:Y0,type:this.type})]},addPasteRules(){return[Ht({find:K0,type:this.type}),Ht({find:J0,type:this.type})]}});const X0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Q0="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Ds="numeric",As="ascii",Rs="alpha",Rn="asciinumeric",En="alphanumeric",Ps="domain",Xu="emoji",Z0="scheme",eb="slashscheme",Ji="whitespace";function tb(t,e){return t in e||(e[t]=[]),e[t]}function Dt(t,e,n){e[Ds]&&(e[Rn]=!0,e[En]=!0),e[As]&&(e[Rn]=!0,e[Rs]=!0),e[Rn]&&(e[En]=!0),e[Rs]&&(e[En]=!0),e[En]&&(e[Ps]=!0),e[Xu]&&(e[Ps]=!0);for(const r in e){const i=tb(r,n);i.indexOf(t)<0&&i.push(t)}}function nb(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function ve(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}ve.groups={};ve.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||ve.groups;let i;return e&&e.j?i=e:(i=new ve(e),n&&r&&Dt(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||ve.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,a=i.go(t);if(a?(o=new ve,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new ve,s){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(nb(o.t,r),n);Dt(s,l,r)}else n&&Dt(s,n,r);o.t=s}return i.j[t]=o,o}};const _=(t,e,n,r,i)=>t.ta(e,n,r,i),Y=(t,e,n,r,i)=>t.tr(e,n,r,i),ul=(t,e,n,r,i)=>t.ts(e,n,r,i),x=(t,e,n,r,i)=>t.tt(e,n,r,i),Xe="WORD",Is="UWORD",Qu="ASCIINUMERICAL",Zu="ALPHANUMERICAL",Kn="LOCALHOST",Ls="TLD",_s="UTLD",vr="SCHEME",en="SLASH_SCHEME",xo="NUM",Bs="WS",wo="NL",Pn="OPENBRACE",In="CLOSEBRACE",_r="OPENBRACKET",Br="CLOSEBRACKET",zr="OPENPAREN",Fr="CLOSEPAREN",jr="OPENANGLEBRACKET",Hr="CLOSEANGLEBRACKET",$r="FULLWIDTHLEFTPAREN",Wr="FULLWIDTHRIGHTPAREN",Vr="LEFTCORNERBRACKET",qr="RIGHTCORNERBRACKET",Ur="LEFTWHITECORNERBRACKET",Kr="RIGHTWHITECORNERBRACKET",Yr="FULLWIDTHLESSTHAN",Jr="FULLWIDTHGREATERTHAN",Gr="AMPERSAND",Xr="APOSTROPHE",Qr="ASTERISK",ut="AT",Zr="BACKSLASH",ei="BACKTICK",ti="CARET",ft="COLON",So="COMMA",ni="DOLLAR",He="DOT",ri="EQUALS",Mo="EXCLAMATION",De="HYPHEN",Ln="PERCENT",ii="PIPE",si="PLUS",oi="POUND",_n="QUERY",Co="QUOTE",ed="FULLWIDTHMIDDLEDOT",Eo="SEMI",$e="SLASH",Bn="TILDE",ai="UNDERSCORE",td="EMOJI",li="SYM";var nd=Object.freeze({__proto__:null,ALPHANUMERICAL:Zu,AMPERSAND:Gr,APOSTROPHE:Xr,ASCIINUMERICAL:Qu,ASTERISK:Qr,AT:ut,BACKSLASH:Zr,BACKTICK:ei,CARET:ti,CLOSEANGLEBRACKET:Hr,CLOSEBRACE:In,CLOSEBRACKET:Br,CLOSEPAREN:Fr,COLON:ft,COMMA:So,DOLLAR:ni,DOT:He,EMOJI:td,EQUALS:ri,EXCLAMATION:Mo,FULLWIDTHGREATERTHAN:Jr,FULLWIDTHLEFTPAREN:$r,FULLWIDTHLESSTHAN:Yr,FULLWIDTHMIDDLEDOT:ed,FULLWIDTHRIGHTPAREN:Wr,HYPHEN:De,LEFTCORNERBRACKET:Vr,LEFTWHITECORNERBRACKET:Ur,LOCALHOST:Kn,NL:wo,NUM:xo,OPENANGLEBRACKET:jr,OPENBRACE:Pn,OPENBRACKET:_r,OPENPAREN:zr,PERCENT:Ln,PIPE:ii,PLUS:si,POUND:oi,QUERY:_n,QUOTE:Co,RIGHTCORNERBRACKET:qr,RIGHTWHITECORNERBRACKET:Kr,SCHEME:vr,SEMI:Eo,SLASH:$e,SLASH_SCHEME:en,SYM:li,TILDE:Bn,TLD:Ls,UNDERSCORE:ai,UTLD:_s,UWORD:Is,WORD:Xe,WS:Bs});const Ye=/[a-z]/,bn=new RegExp("\\p{L}","u"),Gi=new RegExp("\\p{Emoji}","u"),Je=/\d/,Xi=/\s/,dl="\r",Qi=`
128
+ `,rb="️",ib="‍",Zi="";let fr=null,hr=null;function sb(t=[]){const e={};ve.groups=e;const n=new ve;fr==null&&(fr=fl(X0)),hr==null&&(hr=fl(Q0)),x(n,"'",Xr),x(n,"{",Pn),x(n,"}",In),x(n,"[",_r),x(n,"]",Br),x(n,"(",zr),x(n,")",Fr),x(n,"<",jr),x(n,">",Hr),x(n,"(",$r),x(n,")",Wr),x(n,"「",Vr),x(n,"」",qr),x(n,"『",Ur),x(n,"』",Kr),x(n,"<",Yr),x(n,">",Jr),x(n,"&",Gr),x(n,"*",Qr),x(n,"@",ut),x(n,"`",ei),x(n,"^",ti),x(n,":",ft),x(n,",",So),x(n,"$",ni),x(n,".",He),x(n,"=",ri),x(n,"!",Mo),x(n,"-",De),x(n,"%",Ln),x(n,"|",ii),x(n,"+",si),x(n,"#",oi),x(n,"?",_n),x(n,'"',Co),x(n,"/",$e),x(n,";",Eo),x(n,"~",Bn),x(n,"_",ai),x(n,"\\",Zr),x(n,"・",ed);const r=Y(n,Je,xo,{[Ds]:!0});Y(r,Je,r);const i=Y(r,Ye,Qu,{[Rn]:!0}),s=Y(r,bn,Zu,{[En]:!0}),o=Y(n,Ye,Xe,{[As]:!0});Y(o,Je,i),Y(o,Ye,o),Y(i,Je,i),Y(i,Ye,i);const a=Y(n,bn,Is,{[Rs]:!0});Y(a,Ye),Y(a,Je,s),Y(a,bn,a),Y(s,Je,s),Y(s,Ye),Y(s,bn,s);const l=x(n,Qi,wo,{[Ji]:!0}),c=x(n,dl,Bs,{[Ji]:!0}),u=Y(n,Xi,Bs,{[Ji]:!0});x(n,Zi,u),x(c,Qi,l),x(c,Zi,u),Y(c,Xi,u),x(u,dl),x(u,Qi),Y(u,Xi,u),x(u,Zi,u);const d=Y(n,Gi,td,{[Xu]:!0});x(d,"#"),Y(d,Gi,d),x(d,rb,d);const f=x(d,ib);x(f,"#"),Y(f,Gi,d);const h=[[Ye,o],[Je,i]],p=[[Ye,null],[bn,a],[Je,s]];for(let g=0;g<fr.length;g++)st(n,fr[g],Ls,Xe,h);for(let g=0;g<hr.length;g++)st(n,hr[g],_s,Is,p);Dt(Ls,{tld:!0,ascii:!0},e),Dt(_s,{utld:!0,alpha:!0},e),st(n,"file",vr,Xe,h),st(n,"mailto",vr,Xe,h),st(n,"http",en,Xe,h),st(n,"https",en,Xe,h),st(n,"ftp",en,Xe,h),st(n,"ftps",en,Xe,h),Dt(vr,{scheme:!0,ascii:!0},e),Dt(en,{slashscheme:!0,ascii:!0},e),t=t.sort((g,m)=>g[0]>m[0]?1:-1);for(let g=0;g<t.length;g++){const m=t[g][0],b=t[g][1]?{[Z0]:!0}:{[eb]:!0};m.indexOf("-")>=0?b[Ps]=!0:Ye.test(m)?Je.test(m)?b[Rn]=!0:b[As]=!0:b[Ds]=!0,ul(n,m,m,b)}return ul(n,"localhost",Kn,{ascii:!0}),n.jd=new ve(li),{start:n,tokens:Object.assign({groups:e},nd)}}function rd(t,e){const n=ob(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let a=t,l=null,c=0,u=null,d=-1,f=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=n[o].length,f++),c+=n[o].length,s+=n[o].length,o++;s-=d,o-=f,c-=d,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function ob(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function st(t,e,n,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?s=t.j[l]:(s=new ve(r),s.jr=i.slice(),t.j[l]=s),t=s}return s=new ve(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function fl(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const Yn={defaultProtocol:"http",events:null,format:hl,formatHref:hl,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function To(t,e=null){let n=Object.assign({},Yn);t&&(n=Object.assign(n,t instanceof To?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}To.prototype={o:Yn,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:Yn[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function hl(t){return t}function id(t,e){this.t="token",this.v=t,this.tk=e}id.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Yn.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:i,attributes:o,content:s,eventListeners:d}}};function Ci(t,e){class n extends id{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const pl=Ci("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ml=Ci("text"),ab=Ci("nl"),pr=Ci("url",{isLink:!0,toHref(t=Yn.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Kn&&t[1].t===ft}}),Oe=t=>new ve(t);function lb({groups:t}){const e=t.domain.concat([Gr,Qr,ut,Zr,ei,ti,ni,ri,De,xo,Ln,ii,si,oi,$e,li,Bn,ai]),n=[Xr,ft,So,He,Mo,Ln,_n,Co,Eo,jr,Hr,Pn,In,Br,_r,zr,Fr,$r,Wr,Vr,qr,Ur,Kr,Yr,Jr],r=[Gr,Xr,Qr,Zr,ei,ti,ni,ri,De,Pn,In,Ln,ii,si,oi,_n,$e,li,Bn,ai],i=Oe(),s=x(i,Bn);_(s,r,s),_(s,t.domain,s);const o=Oe(),a=Oe(),l=Oe();_(i,t.domain,o),_(i,t.scheme,a),_(i,t.slashscheme,l),_(o,r,s),_(o,t.domain,o);const c=x(o,ut);x(s,ut,c),x(a,ut,c),x(l,ut,c);const u=x(s,He);_(u,r,s),_(u,t.domain,s);const d=Oe();_(c,t.domain,d),_(d,t.domain,d);const f=x(d,He);_(f,t.domain,d);const h=Oe(pl);_(f,t.tld,h),_(f,t.utld,h),x(c,Kn,h);const p=x(d,De);x(p,De,p),_(p,t.domain,d),_(h,t.domain,d),x(h,He,f),x(h,De,p);const g=x(h,ft);_(g,t.numeric,pl);const m=x(o,De),y=x(o,He);x(m,De,m),_(m,t.domain,o),_(y,r,s),_(y,t.domain,o);const b=Oe(pr);_(y,t.tld,b),_(y,t.utld,b),_(b,t.domain,o),_(b,r,s),x(b,He,y),x(b,De,m),x(b,ut,c);const S=x(b,ft),E=Oe(pr);_(S,t.numeric,E);const w=Oe(pr),T=Oe();_(w,e,w),_(w,n,T),_(T,e,w),_(T,n,T),x(b,$e,w),x(E,$e,w);const C=x(a,ft),L=x(l,ft),z=x(L,$e),te=x(z,$e);_(a,t.domain,o),x(a,He,y),x(a,De,m),_(l,t.domain,o),x(l,He,y),x(l,De,m),_(C,t.domain,w),x(C,$e,w),x(C,_n,w),_(te,t.domain,w),_(te,e,w),x(te,$e,w);const Te=[[Pn,In],[_r,Br],[zr,Fr],[jr,Hr],[$r,Wr],[Vr,qr],[Ur,Kr],[Yr,Jr]];for(let be=0;be<Te.length;be++){const[Ne,re]=Te[be],q=x(w,Ne);x(T,Ne,q),x(q,re,w);const he=Oe(pr);_(q,e,he);const O=Oe();_(q,n),_(he,e,he),_(he,n,O),_(O,e,he),_(O,n,O),x(he,re,w),x(O,re,w)}return x(i,Kn,b),x(i,wo,ab),{start:i,tokens:nd}}function cb(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let a=t,l=null,c=null,u=0,d=null,f=-1;for(;i<r&&!(l=a.go(n[i].t));)o.push(n[i++]);for(;i<r&&(c=l||a.go(n[i].t));)l=null,a=c,a.accepts()?(f=0,d=a):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(es(ml,e,o)),o=[]),i-=f,u-=f;const h=d.t,p=n.slice(i-u,i);s.push(es(h,e,p))}}return o.length>0&&s.push(es(ml,e,o)),s}function es(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const ub=typeof console<"u"&&console&&console.warn||(()=>{}),db="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",V={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function fb(){return ve.groups={},V.scanner=null,V.parser=null,V.tokenQueue=[],V.pluginQueue=[],V.customSchemes=[],V.initialized=!1,V}function gl(t,e=!1){if(V.initialized&&ub(`linkifyjs: already initialized - will not register custom scheme "${t}" ${db}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
129
+ 1. Must only contain digits, lowercase ASCII letters or "-"
130
+ 2. Cannot start or end with "-"
131
+ 3. "-" cannot repeat`);V.customSchemes.push([t,e])}function hb(){V.scanner=sb(V.customSchemes);for(let t=0;t<V.tokenQueue.length;t++)V.tokenQueue[t][1]({scanner:V.scanner});V.parser=lb(V.scanner.tokens);for(let t=0;t<V.pluginQueue.length;t++)V.pluginQueue[t][1]({scanner:V.scanner,parser:V.parser});return V.initialized=!0,V}function No(t){return V.initialized||hb(),cb(V.parser.start,t,rd(V.scanner.start,t))}No.scan=rd;function sd(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new To(n),i=No(t),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var Oo="[\0-   ᠎ -\u2029  ]",pb=new RegExp(Oo),mb=new RegExp(`${Oo}$`),gb=new RegExp(Oo,"g");function yb(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function bb(t){return new K({key:new ne("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=mu(n.doc,[...e]);if(wu(a).forEach(({newRange:c})=>{const u=jm(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!mb.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(pb).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],g=d.pos+f.lastIndexOf(p);if(!p)return!1;const m=No(p).map(y=>y.toObject(t.defaultProtocol));if(!yb(m))return!1;m.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{ho(y.from,y.to,r.doc).some(b=>b.mark.type===t.type)||o.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function vb(t){return new K({key:new ne("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const l=r.target;if(!l)return!1;const c=t.editor.view.dom;o=l.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=xu(e.state,t.type.name),c=(i=o.href)!=null?i:l.href,u=(s=o.target)!=null?s:l.target;c&&(window.open(c,u),a=!0)}return a}}})}function kb(t){return new K({key:new ne("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=sd(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||i!==void 0&&!i(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function Mt(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(gb,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var od=Vt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){gl(t);return}gl(t.scheme,t.optionalSlashes)})},onDestroy(){fb()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Mt(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Mt(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Mt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",G(this.options.HTMLAttributes,t),0]:["a",G(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,s;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",a=(s=(i=t.attrs)==null?void 0:i.title)!=null?s:"",l=e.renderChildren(t);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Mt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Mt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Ht({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=sd(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Mt(o,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(bb({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Mt(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(vb({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(kb({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),V1=od,xb=Object.defineProperty,wb=(t,e)=>{for(var n in e)xb(t,n,{get:e[n],enumerable:!0})},Sb="listItem",yl="textStyle",bl=/^\s*([-+*])\s$/,ad=Se.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",G(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
132
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Sb,this.editor.getAttributes(yl)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=fn({find:bl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=fn({find:bl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(yl),editor:this.editor})),[t]}}),ld=Se.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",G(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let i=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(o=>o.type==="paragraph"))i=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const l=t.tokens.slice(1),c=r(l);i.push(...c)}}else i=r(t.tokens)}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>yo(t,e,r=>{var i,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Mb={};wb(Mb,{findListItemPos:()=>Zn,getNextListDepth:()=>Do,handleBackspace:()=>zs,handleDelete:()=>Fs,hasListBefore:()=>cd,hasListItemAfter:()=>Cb,hasListItemBefore:()=>ud,listItemHasSubList:()=>dd,nextListIsDeeper:()=>fd,nextListIsHigher:()=>hd});var Zn=(t,e)=>{const{$from:n}=e.selection,r=ee(t,e.schema);let i=null,s=n.depth,o=n.pos,a=null;for(;s>0&&a===null;)i=n.node(s),i.type===r?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},Do=(t,e)=>{const n=Zn(t,e);if(!n)return!1;const[,r]=Xm(e,t,n.$pos.pos+4);return r},cd=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},ud=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},dd=(t,e,n)=>{if(!n)return!1;const r=ee(t,e.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},zs=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!kt(t.state,e)&&cd(t.state,e,n)){const{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),c=[];l.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const u=c.at(-1);if(!u)return!1;const d=t.state.doc.resolve(l.start()+u.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!kt(t.state,e)||!tg(t.state))return!1;const r=Zn(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=dd(e,t.state,s);return ud(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},fd=(t,e)=>{const n=Do(t,e),r=Zn(t,e);return!r||!n?!1:n>r.depth},hd=(t,e)=>{const n=Do(t,e),r=Zn(t,e);return!r||!n?!1:n<r.depth},Fs=(t,e)=>{if(!kt(t.state,e)||!eg(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:fd(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():hd(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Cb=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},pd=X.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Fs(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Fs(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&zs(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&zs(t,n,r)&&(e=!0)}),e}}}}),vl=/^(\s*)(\d+)\.\s+(.*)$/,Eb=/^\s/;function Tb(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(vl);if(!s)break;const[,o,a,l]=s,c=o.length;let u=l,d=n+1;const f=[i];for(;d<t.length;){const h=t[d];if(h.match(vl))break;if(h.trim()==="")f.push(h),u+=`
133
+ `,d+=1;else if(h.match(Eb))f.push(h),u+=`
134
+ ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:f.join(`
135
+ `)}),r=d,n=d}return[e,r]}function md(t,e,n){var r;const i=[];let s=0;for(;s<t.length;){const o=t[s];if(o.indent===e){const a=o.content.split(`
136
+ `),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const u=a.slice(1).join(`
137
+ `).trim();if(u){const h=n.blockTokens(u);c.push(...h)}let d=s+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const h=Math.min(...f.map(g=>g.indent)),p=md(f,h,n);c.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(g=>g.raw).join(`
138
+ `)})}i.push({type:"list_item",raw:o.raw,tokens:c}),s=d}else s+=1}return i}function Nb(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var Ob="listItem",kl="textStyle",xl=/^(\d+)\.\s$/,gd=Se.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",G(this.options.HTMLAttributes,n),0]:["ol",G(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?Nb(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
139
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const i=t.split(`
140
+ `),[s,o]=Tb(i);if(s.length===0)return;const a=md(s,0,n);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:a,raw:i.slice(0,o).join(`
141
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ob,this.editor.getAttributes(kl)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=fn({find:xl,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=fn({find:xl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(kl)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Db=/^\s*(\[([( |x])?\])\s$/,Ab=Se.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",G(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return yo(t,e,i)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=d=>{var f,h;a.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,d,a.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(t),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=n();if(typeof p!="number")return!1;const g=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...g?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{i.setAttribute(d,f)}),i.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([d,f])=>{i.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:i,contentDOM:l,update:d=>{if(d.type!==this.type)return!1;i.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d);const f=r.extensionManager.attributes,h=un(d,f),p=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return u.forEach(m=>{p.has(m)||(m in g?i.setAttribute(m,g[m]):i.removeAttribute(m))}),Object.entries(h).forEach(([m,y])=>{y==null?m in g?i.setAttribute(m,g[m]):i.removeAttribute(m):i.setAttribute(m,y)}),u=p,!0}}}},addInputRules(){return[fn({find:Db,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Rb=Se.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",G(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
142
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const o=Ns(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(s)},i=Ns(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});X.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(ad.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(ld.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(pd.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(gd.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Ab.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Rb.configure(this.options.taskList)),t}});var wl="&nbsp;",Pb=" ",Ib=Se.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",G(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===wl||r[0].text===Pb)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,i;if(!t)return"";const s=Array.isArray(t.content)?t.content:[];if(s.length===0){const o=Array.isArray((r=n?.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((i=n?.previousNode)==null?void 0:i.type)==="paragraph"&&o.length===0?wl:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Lb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,_b=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Bb=Vt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",G(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[dn({find:Lb,type:this.type})]},addPasteRules(){return[Ht({find:_b,type:this.type})]}}),zb=Se.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Fb=Vt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",G(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),jb=X.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(L0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(D0.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(ad.configure(this.options.bulletList)),this.options.code!==!1&&i.push(z0.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(H0.configure(this.options.codeBlock)),this.options.document!==!1&&i.push($0.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(M0.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(C0.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(W0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(V0.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(N0.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(q0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(G0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(ld.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(pd.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(od.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(gd.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(Ib.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(Bb.configure(this.options.strike)),this.options.text!==!1&&i.push(zb.configure(this.options.text)),this.options.underline!==!1&&i.push(Fb.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(T0.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),q1=jb;function F(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function Ee(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function pe(t,e){const n=F(t);return isNaN(e)?Ee(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function ze(t,e){const n=F(t);if(isNaN(e))return Ee(t,NaN);if(!e)return n;const r=n.getDate(),i=Ee(t,n.getTime());i.setMonth(n.getMonth()+e+1,0);const s=i.getDate();return r>=s?i:(n.setFullYear(i.getFullYear(),i.getMonth(),r),n)}const Ao=6048e5,Hb=864e5;let $b={};function er(){return $b}function Ue(t,e){const n=er(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=F(t),s=i.getDay(),o=(s<r?7:0)+s-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function $t(t){return Ue(t,{weekStartsOn:1})}function yd(t){const e=F(t),n=e.getFullYear(),r=Ee(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const i=$t(r),s=Ee(t,0);s.setFullYear(n,0,4),s.setHours(0,0,0,0);const o=$t(s);return e.getTime()>=i.getTime()?n+1:e.getTime()>=o.getTime()?n:n-1}function hn(t){const e=F(t);return e.setHours(0,0,0,0),e}function ci(t){const e=F(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function We(t,e){const n=hn(t),r=hn(e),i=+n-ci(n),s=+r-ci(r);return Math.round((i-s)/Hb)}function Wb(t){const e=yd(t),n=Ee(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),$t(n)}function js(t,e){const n=e*7;return pe(t,n)}function Vb(t,e){return ze(t,e*12)}function qb(t){let e;return t.forEach(function(n){const r=F(n);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function Ub(t){let e;return t.forEach(n=>{const r=F(n);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function ke(t,e){const n=hn(t),r=hn(e);return+n==+r}function Ro(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Kb(t){if(!Ro(t)&&typeof t!="number")return!1;const e=F(t);return!isNaN(Number(e))}function Jn(t,e){const n=F(t),r=F(e),i=n.getFullYear()-r.getFullYear(),s=n.getMonth()-r.getMonth();return i*12+s}function Yb(t,e,n){const r=Ue(t,n),i=Ue(e,n),s=+r-ci(r),o=+i-ci(i);return Math.round((s-o)/Ao)}function Po(t){const e=F(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function we(t){const e=F(t);return e.setDate(1),e.setHours(0,0,0,0),e}function bd(t){const e=F(t),n=Ee(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Io(t,e){const n=er(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=F(t),s=i.getDay(),o=(s<r?-7:0)+6-(s-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function vd(t){return Io(t,{weekStartsOn:1})}const Jb={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Gb=(t,e,n)=>{let r;const i=Jb[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function ts(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const Xb={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Qb={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Zb={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ev={date:ts({formats:Xb,defaultWidth:"full"}),time:ts({formats:Qb,defaultWidth:"full"}),dateTime:ts({formats:Zb,defaultWidth:"full"})},tv={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},nv=(t,e,n,r)=>tv[t];function vn(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let i;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,a=n?.width?String(n.width):o;i=t.formattingValues[a]||t.formattingValues[o]}else{const o=t.defaultWidth,a=n?.width?String(n.width):t.defaultWidth;i=t.values[a]||t.values[o]}const s=t.argumentCallback?t.argumentCallback(e):e;return i[s]}}const rv={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},iv={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},sv={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ov={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},av={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},lv={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},cv=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},uv={ordinalNumber:cv,era:vn({values:rv,defaultWidth:"wide"}),quarter:vn({values:iv,defaultWidth:"wide",argumentCallback:t=>t-1}),month:vn({values:sv,defaultWidth:"wide"}),day:vn({values:ov,defaultWidth:"wide"}),dayPeriod:vn({values:av,defaultWidth:"wide",formattingValues:lv,defaultFormattingWidth:"wide"})};function kn(t){return(e,n={})=>{const r=n.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],s=e.match(i);if(!s)return null;const o=s[0],a=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?fv(a,d=>d.test(o)):dv(a,d=>d.test(o));let c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=e.slice(o.length);return{value:c,rest:u}}}function dv(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function fv(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function hv(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const i=r[0],s=e.match(t.parsePattern);if(!s)return null;let o=t.valueCallback?t.valueCallback(s[0]):s[0];o=n.valueCallback?n.valueCallback(o):o;const a=e.slice(i.length);return{value:o,rest:a}}}const pv=/^(\d+)(th|st|nd|rd)?/i,mv=/\d+/i,gv={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},yv={any:[/^b/i,/^(a|c)/i]},bv={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},vv={any:[/1/i,/2/i,/3/i,/4/i]},kv={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},xv={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},wv={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Sv={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Mv={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Cv={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Ev={ordinalNumber:hv({matchPattern:pv,parsePattern:mv,valueCallback:t=>parseInt(t,10)}),era:kn({matchPatterns:gv,defaultMatchWidth:"wide",parsePatterns:yv,defaultParseWidth:"any"}),quarter:kn({matchPatterns:bv,defaultMatchWidth:"wide",parsePatterns:vv,defaultParseWidth:"any",valueCallback:t=>t+1}),month:kn({matchPatterns:kv,defaultMatchWidth:"wide",parsePatterns:xv,defaultParseWidth:"any"}),day:kn({matchPatterns:wv,defaultMatchWidth:"wide",parsePatterns:Sv,defaultParseWidth:"any"}),dayPeriod:kn({matchPatterns:Mv,defaultMatchWidth:"any",parsePatterns:Cv,defaultParseWidth:"any"})},kd={code:"en-US",formatDistance:Gb,formatLong:ev,formatRelative:nv,localize:uv,match:Ev,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Tv(t){const e=F(t);return We(e,bd(e))+1}function xd(t){const e=F(t),n=+$t(e)-+Wb(e);return Math.round(n/Ao)+1}function wd(t,e){const n=F(t),r=n.getFullYear(),i=er(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Ee(t,0);o.setFullYear(r+1,0,s),o.setHours(0,0,0,0);const a=Ue(o,e),l=Ee(t,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const c=Ue(l,e);return n.getTime()>=a.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function Nv(t,e){const n=er(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=wd(t,e),s=Ee(t,0);return s.setFullYear(i,0,r),s.setHours(0,0,0,0),Ue(s,e)}function Sd(t,e){const n=F(t),r=+Ue(n,e)-+Nv(n,e);return Math.round(r/Ao)+1}function H(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const ot={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return H(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):H(n+1,2)},d(t,e){return H(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return H(t.getHours()%12||12,e.length)},H(t,e){return H(t.getHours(),e.length)},m(t,e){return H(t.getMinutes(),e.length)},s(t,e){return H(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return H(i,e.length)}},Xt={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Sl={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return ot.y(t,e)},Y:function(t,e,n,r){const i=wd(t,r),s=i>0?i:1-i;if(e==="YY"){const o=s%100;return H(o,2)}return e==="Yo"?n.ordinalNumber(s,{unit:"year"}):H(s,e.length)},R:function(t,e){const n=yd(t);return H(n,e.length)},u:function(t,e){const n=t.getFullYear();return H(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return H(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return H(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return ot.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return H(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const i=Sd(t,r);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):H(i,e.length)},I:function(t,e,n){const r=xd(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):H(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):ot.d(t,e)},D:function(t,e,n){const r=Tv(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):H(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const i=t.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return H(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const i=t.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return H(s,e.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return H(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let i;switch(r===12?i=Xt.noon:r===0?i=Xt.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let i;switch(r>=17?i=Xt.evening:r>=12?i=Xt.afternoon:r>=4?i=Xt.morning:i=Xt.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return ot.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):ot.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):H(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):H(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):ot.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):ot.s(t,e)},S:function(t,e){return ot.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return Cl(r);case"XXXX":case"XX":return Ct(r);default:return Ct(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return Cl(r);case"xxxx":case"xx":return Ct(r);default:return Ct(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ml(r,":");default:return"GMT"+Ct(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ml(r,":");default:return"GMT"+Ct(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return H(r,e.length)},T:function(t,e,n){const r=t.getTime();return H(r,e.length)}};function Ml(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Math.trunc(r/60),s=r%60;return s===0?n+String(i):n+String(i)+e+H(s,2)}function Cl(t,e){return t%60===0?(t>0?"-":"+")+H(Math.abs(t)/60,2):Ct(t,e)}function Ct(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=H(Math.trunc(r/60),2),s=H(r%60,2);return n+i+e+s}const El=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Md=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},Ov=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return El(t,e);let s;switch(r){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",El(r,e)).replace("{{time}}",Md(i,e))},Dv={p:Md,P:Ov},Av=/^D+$/,Rv=/^Y+$/,Pv=["D","DD","YY","YYYY"];function Iv(t){return Av.test(t)}function Lv(t){return Rv.test(t)}function _v(t,e,n){const r=Bv(t,e,n);if(console.warn(r),Pv.includes(t))throw new RangeError(r)}function Bv(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const zv=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Fv=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,jv=/^'([^]*?)'?$/,Hv=/''/g,$v=/[a-zA-Z]/;function Ut(t,e,n){const r=er(),i=n?.locale??r.locale??kd,s=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=F(t);if(!Kb(a))throw new RangeError("Invalid time value");let l=e.match(Fv).map(u=>{const d=u[0];if(d==="p"||d==="P"){const f=Dv[d];return f(u,i.formatLong)}return u}).join("").match(zv).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:Wv(u)};if(Sl[d])return{isToken:!0,value:u};if(d.match($v))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:s,weekStartsOn:o,locale:i};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!n?.useAdditionalWeekYearTokens&&Lv(d)||!n?.useAdditionalDayOfYearTokens&&Iv(d))&&_v(d,e,String(t));const f=Sl[d[0]];return f(a,d,i.localize,c)}).join("")}function Wv(t){const e=t.match(jv);return e?e[1].replace(Hv,"'"):t}function Vv(t){const e=F(t),n=e.getFullYear(),r=e.getMonth(),i=Ee(t,0);return i.setFullYear(n,r+1,0),i.setHours(0,0,0,0),i.getDate()}function qv(t){return Math.trunc(+F(t)/1e3)}function Uv(t){const e=F(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(0,0,0,0),e}function Kv(t,e){return Yb(Uv(t),we(t),e)+1}function Hs(t,e){const n=F(t),r=F(e);return n.getTime()>r.getTime()}function Cd(t,e){const n=F(t),r=F(e);return+n<+r}function Lo(t,e){const n=F(t),r=F(e);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function Yv(t,e){const n=F(t),r=F(e);return n.getFullYear()===r.getFullYear()}function ns(t,e){return pe(t,-e)}function rs(t,e){const n=F(t),r=n.getFullYear(),i=n.getDate(),s=Ee(t,0);s.setFullYear(r,e,15),s.setHours(0,0,0,0);const o=Vv(s);return n.setMonth(e,Math.min(i,o)),n}function Tl(t,e){const n=F(t);return isNaN(+n)?Ee(t,NaN):(n.setFullYear(e),n)}var R=function(){return R=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},R.apply(this,arguments)};function Jv(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Ed(t,e,n){for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}function tr(t){return t.mode==="multiple"}function nr(t){return t.mode==="range"}function Ei(t){return t.mode==="single"}var Gv={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function Xv(t,e){return Ut(t,"LLLL y",e)}function Qv(t,e){return Ut(t,"d",e)}function Zv(t,e){return Ut(t,"LLLL",e)}function ek(t){return"".concat(t)}function tk(t,e){return Ut(t,"cccccc",e)}function nk(t,e){return Ut(t,"yyyy",e)}var rk=Object.freeze({__proto__:null,formatCaption:Xv,formatDay:Qv,formatMonthCaption:Zv,formatWeekNumber:ek,formatWeekdayName:tk,formatYearCaption:nk}),ik=function(t,e,n){return Ut(t,"do MMMM (EEEE)",n)},sk=function(){return"Month: "},ok=function(){return"Go to next month"},ak=function(){return"Go to previous month"},lk=function(t,e){return Ut(t,"cccc",e)},ck=function(t){return"Week n. ".concat(t)},uk=function(){return"Year: "},dk=Object.freeze({__proto__:null,labelDay:ik,labelMonthDropdown:sk,labelNext:ok,labelPrevious:ak,labelWeekNumber:ck,labelWeekday:lk,labelYearDropdown:uk});function fk(){var t="buttons",e=Gv,n=kd,r={},i={},s=1,o={},a=new Date;return{captionLayout:t,classNames:e,formatters:rk,labels:dk,locale:n,modifiersClassNames:r,modifiers:i,numberOfMonths:s,styles:o,today:a,mode:"default"}}function hk(t){var e=t.fromYear,n=t.toYear,r=t.fromMonth,i=t.toMonth,s=t.fromDate,o=t.toDate;return r?s=we(r):e&&(s=new Date(e,0,1)),i?o=Po(i):n&&(o=new Date(n,11,31)),{fromDate:s?hn(s):void 0,toDate:o?hn(o):void 0}}var Td=P.createContext(void 0);function pk(t){var e,n=t.initialProps,r=fk(),i=hk(n),s=i.fromDate,o=i.toDate,a=(e=n.captionLayout)!==null&&e!==void 0?e:r.captionLayout;a!=="buttons"&&(!s||!o)&&(a="buttons");var l;(Ei(n)||tr(n)||nr(n))&&(l=n.onSelect);var c=R(R(R({},r),n),{captionLayout:a,classNames:R(R({},r.classNames),n.classNames),components:R({},n.components),formatters:R(R({},r.formatters),n.formatters),fromDate:s,labels:R(R({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:R(R({},r.modifiers),n.modifiers),modifiersClassNames:R(R({},r.modifiersClassNames),n.modifiersClassNames),onSelect:l,styles:R(R({},r.styles),n.styles),toDate:o});return v.jsx(Td.Provider,{value:c,children:t.children})}function W(){var t=P.useContext(Td);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function Nd(t){var e=W(),n=e.locale,r=e.classNames,i=e.styles,s=e.formatters.formatCaption;return v.jsx("div",{className:r.caption_label,style:i.caption_label,"aria-live":"polite",role:"presentation",id:t.id,children:s(t.displayMonth,{locale:n})})}function mk(t){return v.jsx("svg",R({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},t,{children:v.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Od(t){var e,n,r=t.onChange,i=t.value,s=t.children,o=t.caption,a=t.className,l=t.style,c=W(),u=(n=(e=c.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&n!==void 0?n:mk;return v.jsxs("div",{className:a,style:l,children:[v.jsx("span",{className:c.classNames.vhidden,children:t["aria-label"]}),v.jsx("select",{name:t.name,"aria-label":t["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:i,onChange:r,children:s}),v.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[o,v.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function gk(t){var e,n=W(),r=n.fromDate,i=n.toDate,s=n.styles,o=n.locale,a=n.formatters.formatMonthCaption,l=n.classNames,c=n.components,u=n.labels.labelMonthDropdown;if(!r)return v.jsx(v.Fragment,{});if(!i)return v.jsx(v.Fragment,{});var d=[];if(Yv(r,i))for(var f=we(r),h=r.getMonth();h<=i.getMonth();h++)d.push(rs(f,h));else for(var f=we(new Date),h=0;h<=11;h++)d.push(rs(f,h));var p=function(m){var y=Number(m.target.value),b=rs(we(t.displayMonth),y);t.onChange(b)},g=(e=c?.Dropdown)!==null&&e!==void 0?e:Od;return v.jsx(g,{name:"months","aria-label":u(),className:l.dropdown_month,style:s.dropdown_month,onChange:p,value:t.displayMonth.getMonth(),caption:a(t.displayMonth,{locale:o}),children:d.map(function(m){return v.jsx("option",{value:m.getMonth(),children:a(m,{locale:o})},m.getMonth())})})}function yk(t){var e,n=t.displayMonth,r=W(),i=r.fromDate,s=r.toDate,o=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,d=r.labels.labelYearDropdown,f=[];if(!i)return v.jsx(v.Fragment,{});if(!s)return v.jsx(v.Fragment,{});for(var h=i.getFullYear(),p=s.getFullYear(),g=h;g<=p;g++)f.push(Tl(bd(new Date),g));var m=function(b){var S=Tl(we(n),Number(b.target.value));t.onChange(S)},y=(e=c?.Dropdown)!==null&&e!==void 0?e:Od;return v.jsx(y,{name:"years","aria-label":d(),className:l.dropdown_year,style:a.dropdown_year,onChange:m,value:n.getFullYear(),caption:u(n,{locale:o}),children:f.map(function(b){return v.jsx("option",{value:b.getFullYear(),children:u(b,{locale:o})},b.getFullYear())})})}function bk(t,e){var n=P.useState(t),r=n[0],i=n[1],s=e===void 0?r:e;return[s,i]}function vk(t){var e=t.month,n=t.defaultMonth,r=t.today,i=e||n||r||new Date,s=t.toDate,o=t.fromDate,a=t.numberOfMonths,l=a===void 0?1:a;if(s&&Jn(s,i)<0){var c=-1*(l-1);i=ze(s,c)}return o&&Jn(i,o)<0&&(i=o),we(i)}function kk(){var t=W(),e=vk(t),n=bk(e,t.month),r=n[0],i=n[1],s=function(o){var a;if(!t.disableNavigation){var l=we(o);i(l),(a=t.onMonthChange)===null||a===void 0||a.call(t,l)}};return[r,s]}function xk(t,e){for(var n=e.reverseMonths,r=e.numberOfMonths,i=we(t),s=we(ze(i,r)),o=Jn(s,i),a=[],l=0;l<o;l++){var c=ze(i,l);a.push(c)}return n&&(a=a.reverse()),a}function wk(t,e){if(!e.disableNavigation){var n=e.toDate,r=e.pagedNavigation,i=e.numberOfMonths,s=i===void 0?1:i,o=r?s:1,a=we(t);if(!n)return ze(a,o);var l=Jn(n,t);if(!(l<s))return ze(a,o)}}function Sk(t,e){if(!e.disableNavigation){var n=e.fromDate,r=e.pagedNavigation,i=e.numberOfMonths,s=i===void 0?1:i,o=r?s:1,a=we(t);if(!n)return ze(a,-o);var l=Jn(a,n);if(!(l<=0))return ze(a,-o)}}var Dd=P.createContext(void 0);function Mk(t){var e=W(),n=kk(),r=n[0],i=n[1],s=xk(r,e),o=wk(r,e),a=Sk(r,e),l=function(d){return s.some(function(f){return Lo(d,f)})},c=function(d,f){l(d)||(f&&Cd(d,f)?i(ze(d,1+e.numberOfMonths*-1)):i(d))},u={currentMonth:r,displayMonths:s,goToMonth:i,goToDate:c,previousMonth:a,nextMonth:o,isDateDisplayed:l};return v.jsx(Dd.Provider,{value:u,children:t.children})}function rr(){var t=P.useContext(Dd);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function Nl(t){var e,n=W(),r=n.classNames,i=n.styles,s=n.components,o=rr().goToMonth,a=function(u){o(ze(u,t.displayIndex?-t.displayIndex:0))},l=(e=s?.CaptionLabel)!==null&&e!==void 0?e:Nd,c=v.jsx(l,{id:t.id,displayMonth:t.displayMonth});return v.jsxs("div",{className:r.caption_dropdowns,style:i.caption_dropdowns,children:[v.jsx("div",{className:r.vhidden,children:c}),v.jsx(gk,{onChange:a,displayMonth:t.displayMonth}),v.jsx(yk,{onChange:a,displayMonth:t.displayMonth})]})}function Ck(t){return v.jsx("svg",R({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:v.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Ek(t){return v.jsx("svg",R({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:v.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var ui=P.forwardRef(function(t,e){var n=W(),r=n.classNames,i=n.styles,s=[r.button_reset,r.button];t.className&&s.push(t.className);var o=s.join(" "),a=R(R({},i.button_reset),i.button);return t.style&&Object.assign(a,t.style),v.jsx("button",R({},t,{ref:e,type:"button",className:o,style:a}))});function Tk(t){var e,n,r=W(),i=r.dir,s=r.locale,o=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,d=r.components;if(!t.nextMonth&&!t.previousMonth)return v.jsx(v.Fragment,{});var f=c(t.previousMonth,{locale:s}),h=[o.nav_button,o.nav_button_previous].join(" "),p=u(t.nextMonth,{locale:s}),g=[o.nav_button,o.nav_button_next].join(" "),m=(e=d?.IconRight)!==null&&e!==void 0?e:Ek,y=(n=d?.IconLeft)!==null&&n!==void 0?n:Ck;return v.jsxs("div",{className:o.nav,style:a.nav,children:[!t.hidePrevious&&v.jsx(ui,{name:"previous-month","aria-label":f,className:h,style:a.nav_button_previous,disabled:!t.previousMonth,onClick:t.onPreviousClick,children:i==="rtl"?v.jsx(m,{className:o.nav_icon,style:a.nav_icon}):v.jsx(y,{className:o.nav_icon,style:a.nav_icon})}),!t.hideNext&&v.jsx(ui,{name:"next-month","aria-label":p,className:g,style:a.nav_button_next,disabled:!t.nextMonth,onClick:t.onNextClick,children:i==="rtl"?v.jsx(y,{className:o.nav_icon,style:a.nav_icon}):v.jsx(m,{className:o.nav_icon,style:a.nav_icon})})]})}function Ol(t){var e=W().numberOfMonths,n=rr(),r=n.previousMonth,i=n.nextMonth,s=n.goToMonth,o=n.displayMonths,a=o.findIndex(function(p){return Lo(t.displayMonth,p)}),l=a===0,c=a===o.length-1,u=e>1&&(l||!c),d=e>1&&(c||!l),f=function(){r&&s(r)},h=function(){i&&s(i)};return v.jsx(Tk,{displayMonth:t.displayMonth,hideNext:u,hidePrevious:d,nextMonth:i,previousMonth:r,onPreviousClick:f,onNextClick:h})}function Nk(t){var e,n=W(),r=n.classNames,i=n.disableNavigation,s=n.styles,o=n.captionLayout,a=n.components,l=(e=a?.CaptionLabel)!==null&&e!==void 0?e:Nd,c;return i?c=v.jsx(l,{id:t.id,displayMonth:t.displayMonth}):o==="dropdown"?c=v.jsx(Nl,{displayMonth:t.displayMonth,id:t.id}):o==="dropdown-buttons"?c=v.jsxs(v.Fragment,{children:[v.jsx(Nl,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),v.jsx(Ol,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):c=v.jsxs(v.Fragment,{children:[v.jsx(l,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),v.jsx(Ol,{displayMonth:t.displayMonth,id:t.id})]}),v.jsx("div",{className:r.caption,style:s.caption,children:c})}function Ok(t){var e=W(),n=e.footer,r=e.styles,i=e.classNames.tfoot;return n?v.jsx("tfoot",{className:i,style:r.tfoot,children:v.jsx("tr",{children:v.jsx("td",{colSpan:8,children:n})})}):v.jsx(v.Fragment,{})}function Dk(t,e,n){for(var r=n?$t(new Date):Ue(new Date,{locale:t,weekStartsOn:e}),i=[],s=0;s<7;s++){var o=pe(r,s);i.push(o)}return i}function Ak(){var t=W(),e=t.classNames,n=t.styles,r=t.showWeekNumber,i=t.locale,s=t.weekStartsOn,o=t.ISOWeek,a=t.formatters.formatWeekdayName,l=t.labels.labelWeekday,c=Dk(i,s,o);return v.jsxs("tr",{style:n.head_row,className:e.head_row,children:[r&&v.jsx("td",{style:n.head_cell,className:e.head_cell}),c.map(function(u,d){return v.jsx("th",{scope:"col",className:e.head_cell,style:n.head_cell,"aria-label":l(u,{locale:i}),children:a(u,{locale:i})},d)})]})}function Rk(){var t,e=W(),n=e.classNames,r=e.styles,i=e.components,s=(t=i?.HeadRow)!==null&&t!==void 0?t:Ak;return v.jsx("thead",{style:r.head,className:n.head,children:v.jsx(s,{})})}function Pk(t){var e=W(),n=e.locale,r=e.formatters.formatDay;return v.jsx(v.Fragment,{children:r(t.date,{locale:n})})}var _o=P.createContext(void 0);function Ik(t){if(!tr(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return v.jsx(_o.Provider,{value:e,children:t.children})}return v.jsx(Lk,{initialProps:t.initialProps,children:t.children})}function Lk(t){var e=t.initialProps,n=t.children,r=e.selected,i=e.min,s=e.max,o=function(c,u,d){var f,h;(f=e.onDayClick)===null||f===void 0||f.call(e,c,u,d);var p=!!(u.selected&&i&&r?.length===i);if(!p){var g=!!(!u.selected&&s&&r?.length===s);if(!g){var m=r?Ed([],r):[];if(u.selected){var y=m.findIndex(function(b){return ke(c,b)});m.splice(y,1)}else m.push(c);(h=e.onSelect)===null||h===void 0||h.call(e,m,c,u,d)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=s&&r.length>s-1,d=r.some(function(f){return ke(f,c)});return!!(u&&!d)});var l={selected:r,onDayClick:o,modifiers:a};return v.jsx(_o.Provider,{value:l,children:n})}function Bo(){var t=P.useContext(_o);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function _k(t,e){var n=e||{},r=n.from,i=n.to;return r&&i?ke(i,t)&&ke(r,t)?void 0:ke(i,t)?{from:i,to:void 0}:ke(r,t)?void 0:Hs(r,t)?{from:t,to:i}:{from:r,to:t}:i?Hs(t,i)?{from:i,to:t}:{from:t,to:i}:r?Cd(t,r)?{from:t,to:r}:{from:r,to:t}:{from:t,to:void 0}}var zo=P.createContext(void 0);function Bk(t){if(!nr(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return v.jsx(zo.Provider,{value:e,children:t.children})}return v.jsx(zk,{initialProps:t.initialProps,children:t.children})}function zk(t){var e=t.initialProps,n=t.children,r=e.selected,i=r||{},s=i.from,o=i.to,a=e.min,l=e.max,c=function(h,p,g){var m,y;(m=e.onDayClick)===null||m===void 0||m.call(e,h,p,g);var b=_k(h,r);(y=e.onSelect)===null||y===void 0||y.call(e,b,h,p,g)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(s?(u.range_start=[s],o?(u.range_end=[o],ke(s,o)||(u.range_middle=[{after:s,before:o}])):u.range_end=[s]):o&&(u.range_start=[o],u.range_end=[o]),a&&(s&&!o&&u.disabled.push({after:ns(s,a-1),before:pe(s,a-1)}),s&&o&&u.disabled.push({after:s,before:pe(s,a-1)}),!s&&o&&u.disabled.push({after:ns(o,a-1),before:pe(o,a-1)})),l){if(s&&!o&&(u.disabled.push({before:pe(s,-l+1)}),u.disabled.push({after:pe(s,l-1)})),s&&o){var d=We(o,s)+1,f=l-d;u.disabled.push({before:ns(s,f)}),u.disabled.push({after:pe(o,f)})}!s&&o&&(u.disabled.push({before:pe(o,-l+1)}),u.disabled.push({after:pe(o,l-1)}))}return v.jsx(zo.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:n})}function Fo(){var t=P.useContext(zo);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function kr(t){return Array.isArray(t)?Ed([],t):t!==void 0?[t]:[]}function Fk(t){var e={};return Object.entries(t).forEach(function(n){var r=n[0],i=n[1];e[r]=kr(i)}),e}var Fe;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(Fe||(Fe={}));var jk=Fe.Selected,Ge=Fe.Disabled,Hk=Fe.Hidden,$k=Fe.Today,is=Fe.RangeEnd,ss=Fe.RangeMiddle,as=Fe.RangeStart,Wk=Fe.Outside;function Vk(t,e,n){var r,i=(r={},r[jk]=kr(t.selected),r[Ge]=kr(t.disabled),r[Hk]=kr(t.hidden),r[$k]=[t.today],r[is]=[],r[ss]=[],r[as]=[],r[Wk]=[],r);return t.fromDate&&i[Ge].push({before:t.fromDate}),t.toDate&&i[Ge].push({after:t.toDate}),tr(t)?i[Ge]=i[Ge].concat(e.modifiers[Ge]):nr(t)&&(i[Ge]=i[Ge].concat(n.modifiers[Ge]),i[as]=n.modifiers[as],i[ss]=n.modifiers[ss],i[is]=n.modifiers[is]),i}var Ad=P.createContext(void 0);function qk(t){var e=W(),n=Bo(),r=Fo(),i=Vk(e,n,r),s=Fk(e.modifiers),o=R(R({},i),s);return v.jsx(Ad.Provider,{value:o,children:t.children})}function Rd(){var t=P.useContext(Ad);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function Uk(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function Kk(t){return!!(t&&typeof t=="object"&&"from"in t)}function Yk(t){return!!(t&&typeof t=="object"&&"after"in t)}function Jk(t){return!!(t&&typeof t=="object"&&"before"in t)}function Gk(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Xk(t,e){var n,r=e.from,i=e.to;if(r&&i){var s=We(i,r)<0;s&&(n=[i,r],r=n[0],i=n[1]);var o=We(t,r)>=0&&We(i,t)>=0;return o}return i?ke(i,t):r?ke(r,t):!1}function Qk(t){return Ro(t)}function Zk(t){return Array.isArray(t)&&t.every(Ro)}function e1(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(Qk(n))return ke(t,n);if(Zk(n))return n.includes(t);if(Kk(n))return Xk(t,n);if(Gk(n))return n.dayOfWeek.includes(t.getDay());if(Uk(n)){var r=We(n.before,t),i=We(n.after,t),s=r>0,o=i<0,a=Hs(n.before,n.after);return a?o&&s:s||o}return Yk(n)?We(t,n.after)>0:Jk(n)?We(n.before,t)>0:typeof n=="function"?n(t):!1})}function jo(t,e,n){var r=Object.keys(e).reduce(function(s,o){var a=e[o];return e1(t,a)&&s.push(o),s},[]),i={};return r.forEach(function(s){return i[s]=!0}),n&&!Lo(t,n)&&(i.outside=!0),i}function t1(t,e){for(var n=we(t[0]),r=Po(t[t.length-1]),i,s,o=n;o<=r;){var a=jo(o,e),l=!a.disabled&&!a.hidden;if(!l){o=pe(o,1);continue}if(a.selected)return o;a.today&&!s&&(s=o),i||(i=o),o=pe(o,1)}return s||i}var n1=365;function Pd(t,e){var n=e.moveBy,r=e.direction,i=e.context,s=e.modifiers,o=e.retry,a=o===void 0?{count:0,lastFocused:t}:o,l=i.weekStartsOn,c=i.fromDate,u=i.toDate,d=i.locale,f={day:pe,week:js,month:ze,year:Vb,startOfWeek:function(m){return i.ISOWeek?$t(m):Ue(m,{locale:d,weekStartsOn:l})},endOfWeek:function(m){return i.ISOWeek?vd(m):Io(m,{locale:d,weekStartsOn:l})}},h=f[n](t,r==="after"?1:-1);r==="before"&&c?h=qb([c,h]):r==="after"&&u&&(h=Ub([u,h]));var p=!0;if(s){var g=jo(h,s);p=!g.disabled&&!g.hidden}return p?h:a.count>n1?a.lastFocused:Pd(h,{moveBy:n,direction:r,context:i,modifiers:s,retry:R(R({},a),{count:a.count+1})})}var Id=P.createContext(void 0);function r1(t){var e=rr(),n=Rd(),r=P.useState(),i=r[0],s=r[1],o=P.useState(),a=o[0],l=o[1],c=t1(e.displayMonths,n),u=i??(a&&e.isDateDisplayed(a))?a:c,d=function(){l(i),s(void 0)},f=function(m){s(m)},h=W(),p=function(m,y){if(i){var b=Pd(i,{moveBy:m,direction:y,context:h,modifiers:n});ke(i,b)||(e.goToDate(b,i),f(b))}},g={focusedDay:i,focusTarget:u,blur:d,focus:f,focusDayAfter:function(){return p("day","after")},focusDayBefore:function(){return p("day","before")},focusWeekAfter:function(){return p("week","after")},focusWeekBefore:function(){return p("week","before")},focusMonthBefore:function(){return p("month","before")},focusMonthAfter:function(){return p("month","after")},focusYearBefore:function(){return p("year","before")},focusYearAfter:function(){return p("year","after")},focusStartOfWeek:function(){return p("startOfWeek","before")},focusEndOfWeek:function(){return p("endOfWeek","after")}};return v.jsx(Id.Provider,{value:g,children:t.children})}function Ho(){var t=P.useContext(Id);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function i1(t,e){var n=Rd(),r=jo(t,n,e);return r}var $o=P.createContext(void 0);function s1(t){if(!Ei(t.initialProps)){var e={selected:void 0};return v.jsx($o.Provider,{value:e,children:t.children})}return v.jsx(o1,{initialProps:t.initialProps,children:t.children})}function o1(t){var e=t.initialProps,n=t.children,r=function(s,o,a){var l,c,u;if((l=e.onDayClick)===null||l===void 0||l.call(e,s,o,a),o.selected&&!e.required){(c=e.onSelect)===null||c===void 0||c.call(e,void 0,s,o,a);return}(u=e.onSelect)===null||u===void 0||u.call(e,s,s,o,a)},i={selected:e.selected,onDayClick:r};return v.jsx($o.Provider,{value:i,children:n})}function Ld(){var t=P.useContext($o);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function a1(t,e){var n=W(),r=Ld(),i=Bo(),s=Fo(),o=Ho(),a=o.focusDayAfter,l=o.focusDayBefore,c=o.focusWeekAfter,u=o.focusWeekBefore,d=o.blur,f=o.focus,h=o.focusMonthBefore,p=o.focusMonthAfter,g=o.focusYearBefore,m=o.focusYearAfter,y=o.focusStartOfWeek,b=o.focusEndOfWeek,S=function(O){var N,Kt,Yt,Ti;Ei(n)?(N=r.onDayClick)===null||N===void 0||N.call(r,t,e,O):tr(n)?(Kt=i.onDayClick)===null||Kt===void 0||Kt.call(i,t,e,O):nr(n)?(Yt=s.onDayClick)===null||Yt===void 0||Yt.call(s,t,e,O):(Ti=n.onDayClick)===null||Ti===void 0||Ti.call(n,t,e,O)},E=function(O){var N;f(t),(N=n.onDayFocus)===null||N===void 0||N.call(n,t,e,O)},w=function(O){var N;d(),(N=n.onDayBlur)===null||N===void 0||N.call(n,t,e,O)},T=function(O){var N;(N=n.onDayMouseEnter)===null||N===void 0||N.call(n,t,e,O)},C=function(O){var N;(N=n.onDayMouseLeave)===null||N===void 0||N.call(n,t,e,O)},L=function(O){var N;(N=n.onDayPointerEnter)===null||N===void 0||N.call(n,t,e,O)},z=function(O){var N;(N=n.onDayPointerLeave)===null||N===void 0||N.call(n,t,e,O)},te=function(O){var N;(N=n.onDayTouchCancel)===null||N===void 0||N.call(n,t,e,O)},Te=function(O){var N;(N=n.onDayTouchEnd)===null||N===void 0||N.call(n,t,e,O)},be=function(O){var N;(N=n.onDayTouchMove)===null||N===void 0||N.call(n,t,e,O)},Ne=function(O){var N;(N=n.onDayTouchStart)===null||N===void 0||N.call(n,t,e,O)},re=function(O){var N;(N=n.onDayKeyUp)===null||N===void 0||N.call(n,t,e,O)},q=function(O){var N;switch(O.key){case"ArrowLeft":O.preventDefault(),O.stopPropagation(),n.dir==="rtl"?a():l();break;case"ArrowRight":O.preventDefault(),O.stopPropagation(),n.dir==="rtl"?l():a();break;case"ArrowDown":O.preventDefault(),O.stopPropagation(),c();break;case"ArrowUp":O.preventDefault(),O.stopPropagation(),u();break;case"PageUp":O.preventDefault(),O.stopPropagation(),O.shiftKey?g():h();break;case"PageDown":O.preventDefault(),O.stopPropagation(),O.shiftKey?m():p();break;case"Home":O.preventDefault(),O.stopPropagation(),y();break;case"End":O.preventDefault(),O.stopPropagation(),b();break}(N=n.onDayKeyDown)===null||N===void 0||N.call(n,t,e,O)},he={onClick:S,onFocus:E,onBlur:w,onKeyDown:q,onKeyUp:re,onMouseEnter:T,onMouseLeave:C,onPointerEnter:L,onPointerLeave:z,onTouchCancel:te,onTouchEnd:Te,onTouchMove:be,onTouchStart:Ne};return he}function l1(){var t=W(),e=Ld(),n=Bo(),r=Fo(),i=Ei(t)?e.selected:tr(t)?n.selected:nr(t)?r.selected:void 0;return i}function c1(t){return Object.values(Fe).includes(t)}function u1(t,e){var n=[t.classNames.day];return Object.keys(e).forEach(function(r){var i=t.modifiersClassNames[r];if(i)n.push(i);else if(c1(r)){var s=t.classNames["day_".concat(r)];s&&n.push(s)}}),n}function d1(t,e){var n=R({},t.styles.day);return Object.keys(e).forEach(function(r){var i;n=R(R({},n),(i=t.modifiersStyles)===null||i===void 0?void 0:i[r])}),n}function f1(t,e,n){var r,i,s,o=W(),a=Ho(),l=i1(t,e),c=a1(t,l),u=l1(),d=!!(o.onDayClick||o.mode!=="default");P.useEffect(function(){var T;l.outside||a.focusedDay&&d&&ke(a.focusedDay,t)&&((T=n.current)===null||T===void 0||T.focus())},[a.focusedDay,t,n,d,l.outside]);var f=u1(o,l).join(" "),h=d1(o,l),p=!!(l.outside&&!o.showOutsideDays||l.hidden),g=(s=(i=o.components)===null||i===void 0?void 0:i.DayContent)!==null&&s!==void 0?s:Pk,m=v.jsx(g,{date:t,displayMonth:e,activeModifiers:l}),y={style:h,className:f,children:m,role:"gridcell"},b=a.focusTarget&&ke(a.focusTarget,t)&&!l.outside,S=a.focusedDay&&ke(a.focusedDay,t),E=R(R(R({},y),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=S||b?0:-1,r)),c),w={isButton:d,isHidden:p,activeModifiers:l,selectedDays:u,buttonProps:E,divProps:y};return w}function h1(t){var e=P.useRef(null),n=f1(t.date,t.displayMonth,e);return n.isHidden?v.jsx("div",{role:"gridcell"}):n.isButton?v.jsx(ui,R({name:"day",ref:e},n.buttonProps)):v.jsx("div",R({},n.divProps))}function p1(t){var e=t.number,n=t.dates,r=W(),i=r.onWeekNumberClick,s=r.styles,o=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(e),{locale:a});if(!i)return v.jsx("span",{className:o.weeknumber,style:s.weeknumber,children:u});var d=l(Number(e),{locale:a}),f=function(h){i(e,n,h)};return v.jsx(ui,{name:"week-number","aria-label":d,className:o.weeknumber,style:s.weeknumber,onClick:f,children:u})}function m1(t){var e,n,r=W(),i=r.styles,s=r.classNames,o=r.showWeekNumber,a=r.components,l=(e=a?.Day)!==null&&e!==void 0?e:h1,c=(n=a?.WeekNumber)!==null&&n!==void 0?n:p1,u;return o&&(u=v.jsx("td",{className:s.cell,style:i.cell,children:v.jsx(c,{number:t.weekNumber,dates:t.dates})})),v.jsxs("tr",{className:s.row,style:i.row,children:[u,t.dates.map(function(d){return v.jsx("td",{className:s.cell,style:i.cell,role:"presentation",children:v.jsx(l,{displayMonth:t.displayMonth,date:d})},qv(d))})]})}function Dl(t,e,n){for(var r=n?.ISOWeek?vd(e):Io(e,n),i=n?.ISOWeek?$t(t):Ue(t,n),s=We(r,i),o=[],a=0;a<=s;a++)o.push(pe(i,a));var l=o.reduce(function(c,u){var d=n?.ISOWeek?xd(u):Sd(u,n),f=c.find(function(h){return h.weekNumber===d});return f?(f.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function g1(t,e){var n=Dl(we(t),Po(t),e);if(e?.useFixedWeeks){var r=Kv(t,e);if(r<6){var i=n[n.length-1],s=i.dates[i.dates.length-1],o=js(s,6-r),a=Dl(js(s,1),o,e);n.push.apply(n,a)}}return n}function y1(t){var e,n,r,i=W(),s=i.locale,o=i.classNames,a=i.styles,l=i.hideHead,c=i.fixedWeeks,u=i.components,d=i.weekStartsOn,f=i.firstWeekContainsDate,h=i.ISOWeek,p=g1(t.displayMonth,{useFixedWeeks:!!c,ISOWeek:h,locale:s,weekStartsOn:d,firstWeekContainsDate:f}),g=(e=u?.Head)!==null&&e!==void 0?e:Rk,m=(n=u?.Row)!==null&&n!==void 0?n:m1,y=(r=u?.Footer)!==null&&r!==void 0?r:Ok;return v.jsxs("table",{id:t.id,className:o.table,style:a.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!l&&v.jsx(g,{}),v.jsx("tbody",{className:o.tbody,style:a.tbody,children:p.map(function(b){return v.jsx(m,{displayMonth:t.displayMonth,dates:b.dates,weekNumber:b.weekNumber},b.weekNumber)})}),v.jsx(y,{displayMonth:t.displayMonth})]})}function b1(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var v1=b1()?P.useLayoutEffect:P.useEffect,ls=!1,k1=0;function Al(){return"react-day-picker-".concat(++k1)}function x1(t){var e,n=t??(ls?Al():null),r=P.useState(n),i=r[0],s=r[1];return v1(function(){i===null&&s(Al())},[]),P.useEffect(function(){ls===!1&&(ls=!0)},[]),(e=t??i)!==null&&e!==void 0?e:void 0}function w1(t){var e,n,r=W(),i=r.dir,s=r.classNames,o=r.styles,a=r.components,l=rr().displayMonths,c=x1(r.id?"".concat(r.id,"-").concat(t.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(t.displayIndex):void 0,d=[s.month],f=o.month,h=t.displayIndex===0,p=t.displayIndex===l.length-1,g=!h&&!p;i==="rtl"&&(e=[h,p],p=e[0],h=e[1]),h&&(d.push(s.caption_start),f=R(R({},f),o.caption_start)),p&&(d.push(s.caption_end),f=R(R({},f),o.caption_end)),g&&(d.push(s.caption_between),f=R(R({},f),o.caption_between));var m=(n=a?.Caption)!==null&&n!==void 0?n:Nk;return v.jsxs("div",{className:d.join(" "),style:f,children:[v.jsx(m,{id:c,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),v.jsx(y1,{id:u,"aria-labelledby":c,displayMonth:t.displayMonth})]},t.displayIndex)}function S1(t){var e=W(),n=e.classNames,r=e.styles;return v.jsx("div",{className:n.months,style:r.months,children:t.children})}function M1(t){var e,n,r=t.initialProps,i=W(),s=Ho(),o=rr(),a=P.useState(!1),l=a[0],c=a[1];P.useEffect(function(){i.initialFocus&&s.focusTarget&&(l||(s.focus(s.focusTarget),c(!0)))},[i.initialFocus,l,s.focus,s.focusTarget,s]);var u=[i.classNames.root,i.className];i.numberOfMonths>1&&u.push(i.classNames.multiple_months),i.showWeekNumber&&u.push(i.classNames.with_weeknumber);var d=R(R({},i.styles.root),i.style),f=Object.keys(r).filter(function(p){return p.startsWith("data-")}).reduce(function(p,g){var m;return R(R({},p),(m={},m[g]=r[g],m))},{}),h=(n=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:S1;return v.jsx("div",R({className:u.join(" "),style:d,dir:i.dir,id:i.id,nonce:r.nonce,title:r.title,lang:r.lang},f,{children:v.jsx(h,{children:o.displayMonths.map(function(p,g){return v.jsx(w1,{displayIndex:g,displayMonth:p},g)})})}))}function C1(t){var e=t.children,n=Jv(t,["children"]);return v.jsx(pk,{initialProps:n,children:v.jsx(Mk,{children:v.jsx(s1,{initialProps:n,children:v.jsx(Ik,{initialProps:n,children:v.jsx(Bk,{initialProps:n,children:v.jsx(qk,{children:v.jsx(r1,{children:e})})})})})})})}function E1(t){return v.jsx(C1,R({},t,{children:v.jsx(M1,{initialProps:t})}))}function U1(t){const e=Pl.c(20);let n,r,i,s;e[0]!==t?({className:n,classNames:r,showOutsideDays:s,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=s):(n=e[1],r=e[2],i=e[3],s=e[4]);const o=s===void 0?!0:s;let a;e[5]!==n?(a=Tt("p-3",n),e[5]=n,e[6]=a):a=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=Tt(Wo({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),e[7]=l):l=e[7];const c=i.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md";let u;e[8]!==c?(u=Tt("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",c),e[8]=c,e[9]=u):u=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=Tt(Wo({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),e[10]=d):d=e[10];let f;e[11]!==r||e[12]!==u?(f={months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:l,nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:u,day:d,day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...r},e[11]=r,e[12]=u,e[13]=f):f=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h={IconLeft:N1,IconRight:T1},e[14]=h):h=e[14];let p;return e[15]!==i||e[16]!==o||e[17]!==a||e[18]!==f?(p=v.jsx(E1,{showOutsideDays:o,className:a,classNames:f,components:h,...i}),e[15]=i,e[16]=o,e[17]=a,e[18]=f,e[19]=p):p=e[19],p}function T1(t){const{className:e,...n}=t;return v.jsx(Hd,{className:Tt("size-4",e),...n})}function N1(t){const{className:e,...n}=t;return v.jsx(jd,{className:Tt("size-4",e),...n})}export{D as A,I1 as B,U1 as C,U as D,bo as E,k as F,Se as G,Jy as H,jg as I,_1 as J,V1 as K,R1 as L,$1 as M,A as N,P1 as O,ne as P,t0 as R,B as S,I as T,K as a,H1 as b,i0 as c,F1 as d,q1 as e,Hy as f,r0 as g,X as h,j1 as i,Vt as j,Vy as k,W1 as l,G as m,me as n,B1 as o,If as p,M as q,au as r,uu as s,Vo as t,z1 as u,L1 as v,Km as w,ku as x,lu as y,co as z};