@shapio/cms 0.5.8 → 0.5.10

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 (343) hide show
  1. package/dist/admin/assets/{AssetTile-BrMzsUZD.js → AssetTile-DecaDqjj.js} +2 -2
  2. package/dist/admin/assets/{AssetTile-BrMzsUZD.js.map → AssetTile-DecaDqjj.js.map} +1 -1
  3. package/dist/admin/assets/AssistError-rslPtgWB.js +2 -0
  4. package/dist/admin/assets/{AssistError-Cs-r9Ssc.js.map → AssistError-rslPtgWB.js.map} +1 -1
  5. package/dist/admin/assets/{BlockMenuItems-DsccXMc_.js → BlockMenuItems-JHFue7Qt.js} +2 -2
  6. package/dist/admin/assets/{BlockMenuItems-DsccXMc_.js.map → BlockMenuItems-JHFue7Qt.js.map} +1 -1
  7. package/dist/admin/assets/Body-7NgJl9Pi.js +2 -0
  8. package/dist/admin/assets/Body-7NgJl9Pi.js.map +1 -0
  9. package/dist/admin/assets/Builder-DmlYcgiP.js +2 -0
  10. package/dist/admin/assets/Builder-DmlYcgiP.js.map +1 -0
  11. package/dist/admin/assets/{CodeEditor-CBCR73Wd.js → CodeEditor-Dv1FtkvI.js} +2 -2
  12. package/dist/admin/assets/{CodeEditor-CBCR73Wd.js.map → CodeEditor-Dv1FtkvI.js.map} +1 -1
  13. package/dist/admin/assets/{CopyButton-CxFsBHfF.js → CopyButton-Brnpfqe0.js} +2 -2
  14. package/dist/admin/assets/{CopyButton-CxFsBHfF.js.map → CopyButton-Brnpfqe0.js.map} +1 -1
  15. package/dist/admin/assets/{CursorPager-BW2U3v6l.js → CursorPager-C7cAK5Qe.js} +2 -2
  16. package/dist/admin/assets/{CursorPager-BW2U3v6l.js.map → CursorPager-C7cAK5Qe.js.map} +1 -1
  17. package/dist/admin/assets/{ExternalLink-BITMgS1K.js → ExternalLink-D80sb5Jj.js} +2 -2
  18. package/dist/admin/assets/{ExternalLink-BITMgS1K.js.map → ExternalLink-D80sb5Jj.js.map} +1 -1
  19. package/dist/admin/assets/{FocalPoint-CpZTve1E.js → FocalPoint-Bhtb1gUa.js} +2 -2
  20. package/dist/admin/assets/{FocalPoint-CpZTve1E.js.map → FocalPoint-Bhtb1gUa.js.map} +1 -1
  21. package/dist/admin/assets/Form-Cf1ephPH.js +2 -0
  22. package/dist/admin/assets/Form-Cf1ephPH.js.map +1 -0
  23. package/dist/admin/assets/FormCheckboxGroup-BzVZFR3W.js +2 -0
  24. package/dist/admin/assets/FormCheckboxGroup-BzVZFR3W.js.map +1 -0
  25. package/dist/admin/assets/{FormRadioGroup-Cfx5pvzU.js → FormRadioGroup-BzmLzRnI.js} +2 -2
  26. package/dist/admin/assets/{FormRadioGroup-Cfx5pvzU.js.map → FormRadioGroup-BzmLzRnI.js.map} +1 -1
  27. package/dist/admin/assets/FormSelectField-Cl7EjXc3.js +2 -0
  28. package/dist/admin/assets/FormSelectField-Cl7EjXc3.js.map +1 -0
  29. package/dist/admin/assets/FormSheet-CLZpd_7B.js +2 -0
  30. package/dist/admin/assets/FormSheet-CLZpd_7B.js.map +1 -0
  31. package/dist/admin/assets/{FormSwitchField-BLOh7qei.js → FormSwitchField-BbqQ3tx_.js} +2 -2
  32. package/dist/admin/assets/{FormSwitchField-BLOh7qei.js.map → FormSwitchField-BbqQ3tx_.js.map} +1 -1
  33. package/dist/admin/assets/{FormTextareaField-CO115n_u.js → FormTextareaField-9RN5Pt3B.js} +2 -2
  34. package/dist/admin/assets/{FormTextareaField-CO115n_u.js.map → FormTextareaField-9RN5Pt3B.js.map} +1 -1
  35. package/dist/admin/assets/{HintedLabel-DzHnEdIK.js → HintedLabel-D9IVF0EE.js} +2 -2
  36. package/dist/admin/assets/{HintedLabel-DzHnEdIK.js.map → HintedLabel-D9IVF0EE.js.map} +1 -1
  37. package/dist/admin/assets/{InfoHint-CSEtcHjL.js → InfoHint-tlSeZB9U.js} +2 -2
  38. package/dist/admin/assets/{InfoHint-CSEtcHjL.js.map → InfoHint-tlSeZB9U.js.map} +1 -1
  39. package/dist/admin/assets/{InlineConfirm-yW-iUKFC.js → InlineConfirm-Kj9AOIFO.js} +2 -2
  40. package/dist/admin/assets/{InlineConfirm-yW-iUKFC.js.map → InlineConfirm-Kj9AOIFO.js.map} +1 -1
  41. package/dist/admin/assets/{InsertMenuItem-CCr9e0qY.js → InsertMenuItem-CHAp2tH7.js} +2 -2
  42. package/dist/admin/assets/{InsertMenuItem-CCr9e0qY.js.map → InsertMenuItem-CHAp2tH7.js.map} +1 -1
  43. package/dist/admin/assets/{LinkTabs-8SmS1vCd.js → LinkTabs-oQXsy1I3.js} +2 -2
  44. package/dist/admin/assets/{LinkTabs-8SmS1vCd.js.map → LinkTabs-oQXsy1I3.js.map} +1 -1
  45. package/dist/admin/assets/{Match-CcD9KxHH.js → Match-BfNRwPfR.js} +2 -2
  46. package/dist/admin/assets/{Match-CcD9KxHH.js.map → Match-BfNRwPfR.js.map} +1 -1
  47. package/dist/admin/assets/{NoAccess-C8RLPN0I.js → NoAccess-DnEpYj9l.js} +2 -2
  48. package/dist/admin/assets/{NoAccess-C8RLPN0I.js.map → NoAccess-DnEpYj9l.js.map} +1 -1
  49. package/dist/admin/assets/Panel-Bcl09TtM.js.map +1 -1
  50. package/dist/admin/assets/{QueryView-xMP_uJ_t.js → QueryView-B86NcRt5.js} +2 -2
  51. package/dist/admin/assets/{QueryView-xMP_uJ_t.js.map → QueryView-B86NcRt5.js.map} +1 -1
  52. package/dist/admin/assets/{RadioTile-DQFmni5A.js → RadioTile-Bwd2Pmlk.js} +2 -2
  53. package/dist/admin/assets/RadioTile-Bwd2Pmlk.js.map +1 -0
  54. package/dist/admin/assets/{RichTextField-CVHRIbnu.js → RichTextField-Dou79MHF.js} +4 -4
  55. package/dist/admin/assets/RichTextField-Dou79MHF.js.map +1 -0
  56. package/dist/admin/assets/{RowTitle-Bqt6evG9.js → RowTitle-DH9OZs3g.js} +2 -2
  57. package/dist/admin/assets/{RowTitle-Bqt6evG9.js.map → RowTitle-DH9OZs3g.js.map} +1 -1
  58. package/dist/admin/assets/{SecretReveal-Bm6nYg5J.js → SecretReveal-D95oACLj.js} +2 -2
  59. package/dist/admin/assets/{SecretReveal-Bm6nYg5J.js.map → SecretReveal-D95oACLj.js.map} +1 -1
  60. package/dist/admin/assets/{SharedGlyph-cUmTh0_C.js → SharedGlyph-Chwb1EIS.js} +2 -2
  61. package/dist/admin/assets/{SharedGlyph-cUmTh0_C.js.map → SharedGlyph-Chwb1EIS.js.map} +1 -1
  62. package/dist/admin/assets/StepList-D9iHsUZJ.js +2 -0
  63. package/dist/admin/assets/StepList-D9iHsUZJ.js.map +1 -0
  64. package/dist/admin/assets/Structure-CewJL1b3.js +2 -0
  65. package/dist/admin/assets/{Structure-D8csgrIt.js.map → Structure-CewJL1b3.js.map} +1 -1
  66. package/dist/admin/assets/{SubNavLink-CiCaVV8U.js → SubNavLink-7Cs1LqMv.js} +2 -2
  67. package/dist/admin/assets/SubNavLink-7Cs1LqMv.js.map +1 -0
  68. package/dist/admin/assets/{SuggestAltButton-CvIoirnz.js → SuggestAltButton-BK1uo4yC.js} +2 -2
  69. package/dist/admin/assets/{SuggestAltButton-CvIoirnz.js.map → SuggestAltButton-BK1uo4yC.js.map} +1 -1
  70. package/dist/admin/assets/{TextLink-HRn66VL1.js → TextLink-Dfs5wsc5.js} +2 -2
  71. package/dist/admin/assets/{TextLink-HRn66VL1.js.map → TextLink-Dfs5wsc5.js.map} +1 -1
  72. package/dist/admin/assets/{Thumbnail-DNj5TRBI.js → Thumbnail-C2A_Ub77.js} +2 -2
  73. package/dist/admin/assets/{Thumbnail-DNj5TRBI.js.map → Thumbnail-C2A_Ub77.js.map} +1 -1
  74. package/dist/admin/assets/Trans-CPoNNUK1.js +2 -0
  75. package/dist/admin/assets/Trans-CPoNNUK1.js.map +1 -0
  76. package/dist/admin/assets/{UnsavedChangesGuard-CUiuMklN.js → UnsavedChangesGuard-BsEyn9oH.js} +2 -2
  77. package/dist/admin/assets/{UnsavedChangesGuard-CUiuMklN.js.map → UnsavedChangesGuard-BsEyn9oH.js.map} +1 -1
  78. package/dist/admin/assets/{UserAvatar-p-jV-LoD.js → UserAvatar-CgGKOFfP.js} +2 -2
  79. package/dist/admin/assets/{UserAvatar-p-jV-LoD.js.map → UserAvatar-CgGKOFfP.js.map} +1 -1
  80. package/dist/admin/assets/auth-BFSvtV59.js +2 -0
  81. package/dist/admin/assets/{auth-CQO4MBUj.js.map → auth-BFSvtV59.js.map} +1 -1
  82. package/dist/admin/assets/{badge-CqKF1pwz.js → badge-DGqA_yr_.js} +2 -2
  83. package/dist/admin/assets/{badge-CqKF1pwz.js.map → badge-DGqA_yr_.js.map} +1 -1
  84. package/dist/admin/assets/baseExtensions-TVKN1UwW.js.map +1 -1
  85. package/dist/admin/assets/{boxes-CAygw8zF.js → boxes-_5klpWNM.js} +2 -2
  86. package/dist/admin/assets/{boxes-CAygw8zF.js.map → boxes-_5klpWNM.js.map} +1 -1
  87. package/dist/admin/assets/{calendar-clock-BZGtAvWR.js → calendar-clock-VXok22Xj.js} +2 -2
  88. package/dist/admin/assets/{calendar-clock-BZGtAvWR.js.map → calendar-clock-VXok22Xj.js.map} +1 -1
  89. package/dist/admin/assets/changeSets-B6HxCJ4A.js +2 -0
  90. package/dist/admin/assets/{changeSets-8EburmT0.js.map → changeSets-B6HxCJ4A.js.map} +1 -1
  91. package/dist/admin/assets/chevron-left-CkRxDtvO.js +2 -0
  92. package/dist/admin/assets/{chevron-left-DGU3HGYG.js.map → chevron-left-CkRxDtvO.js.map} +1 -1
  93. package/dist/admin/assets/{circle-check-C37MSJqX.js → circle-check-DtDq7QMo.js} +2 -2
  94. package/dist/admin/assets/{circle-check-C37MSJqX.js.map → circle-check-DtDq7QMo.js.map} +1 -1
  95. package/dist/admin/assets/{clock-2arjsgZ4.js → clock-BtvZR9KD.js} +2 -2
  96. package/dist/admin/assets/{clock-2arjsgZ4.js.map → clock-BtvZR9KD.js.map} +1 -1
  97. package/dist/admin/assets/cn-DVhJ55Mo.js.map +1 -1
  98. package/dist/admin/assets/{constants-a_15vqOh.js → constants-DY3YJAKH.js} +2 -2
  99. package/dist/admin/assets/{constants-a_15vqOh.js.map → constants-DY3YJAKH.js.map} +1 -1
  100. package/dist/admin/assets/content-BNZF26Ve.js +3 -0
  101. package/dist/admin/assets/content-BNZF26Ve.js.map +1 -0
  102. package/dist/admin/assets/{contentCounts-DP7YYeZZ.js → contentCounts-BzC7IQqP.js} +2 -2
  103. package/dist/admin/assets/{contentCounts-DP7YYeZZ.js.map → contentCounts-BzC7IQqP.js.map} +1 -1
  104. package/dist/admin/assets/{contentTypes-84uc0bjR.js → contentTypes-Bz2xpqGf.js} +2 -2
  105. package/dist/admin/assets/{contentTypes-84uc0bjR.js.map → contentTypes-Bz2xpqGf.js.map} +1 -1
  106. package/dist/admin/assets/{context-IKYdzQJ-.js → context-CEVKblBl.js} +2 -2
  107. package/dist/admin/assets/{context-IKYdzQJ-.js.map → context-CEVKblBl.js.map} +1 -1
  108. package/dist/admin/assets/{copy-CsSRHgKZ.js → copy-B7vIq8DS.js} +2 -2
  109. package/dist/admin/assets/{copy-CsSRHgKZ.js.map → copy-B7vIq8DS.js.map} +1 -1
  110. package/dist/admin/assets/createLucideIcon-BOsNKleB.js +2 -0
  111. package/dist/admin/assets/createLucideIcon-BOsNKleB.js.map +1 -0
  112. package/dist/admin/assets/develop-D6CtwuYj.js +11 -0
  113. package/dist/admin/assets/develop-D6CtwuYj.js.map +1 -0
  114. package/dist/admin/assets/{dropdown-menu-_xfaEp5C.js → dropdown-menu-Bz7CLcRK.js} +2 -2
  115. package/dist/admin/assets/{dropdown-menu-_xfaEp5C.js.map → dropdown-menu-Bz7CLcRK.js.map} +1 -1
  116. package/dist/admin/assets/{ellipsis-F91991on.js → ellipsis-Ci0rsbCJ.js} +2 -2
  117. package/dist/admin/assets/{ellipsis-F91991on.js.map → ellipsis-Ci0rsbCJ.js.map} +1 -1
  118. package/dist/admin/assets/{entryLink-CVB-TdIn.js → entryLink-B0hSb_dN.js} +2 -2
  119. package/dist/admin/assets/{entryLink-CVB-TdIn.js.map → entryLink-B0hSb_dN.js.map} +1 -1
  120. package/dist/admin/assets/es2015-Cv57ynE1.js +42 -0
  121. package/dist/admin/assets/es2015-Cv57ynE1.js.map +1 -0
  122. package/dist/admin/assets/{external-link-CdG6kHfA.js → external-link-Bs9YRzvY.js} +2 -2
  123. package/dist/admin/assets/{external-link-CdG6kHfA.js.map → external-link-Bs9YRzvY.js.map} +1 -1
  124. package/dist/admin/assets/{field-COOzRptX.js → field-D-xWW2E7.js} +2 -2
  125. package/dist/admin/assets/{field-COOzRptX.js.map → field-D-xWW2E7.js.map} +1 -1
  126. package/dist/admin/assets/{file-stack-28ZtO1xW.js → file-stack-X4OGmkLA.js} +2 -2
  127. package/dist/admin/assets/{file-stack-28ZtO1xW.js.map → file-stack-X4OGmkLA.js.map} +1 -1
  128. package/dist/admin/assets/{fileRoute-s7mCMYUJ.js → fileRoute-DMal-zYL.js} +2 -2
  129. package/dist/admin/assets/{fileRoute-s7mCMYUJ.js.map → fileRoute-DMal-zYL.js.map} +1 -1
  130. package/dist/admin/assets/{folder-plus-DIk0pWkP.js → folder-plus-De2GNvry.js} +2 -2
  131. package/dist/admin/assets/{folder-plus-DIk0pWkP.js.map → folder-plus-De2GNvry.js.map} +1 -1
  132. package/dist/admin/assets/followPlural-CsgeALTW.js +2 -0
  133. package/dist/admin/assets/followPlural-CsgeALTW.js.map +1 -0
  134. package/dist/admin/assets/{globe-DFr3Gd2w.js → globe-DBw84s8Z.js} +2 -2
  135. package/dist/admin/assets/{globe-DFr3Gd2w.js.map → globe-DBw84s8Z.js.map} +1 -1
  136. package/dist/admin/assets/{image-DT79QFa_.js → image-CX4mT-_R.js} +2 -2
  137. package/dist/admin/assets/{image-DT79QFa_.js.map → image-CX4mT-_R.js.map} +1 -1
  138. package/dist/admin/assets/{image-off-DFs5upyX.js → image-off-CVaH_qKf.js} +2 -2
  139. package/dist/admin/assets/{image-off-DFs5upyX.js.map → image-off-CVaH_qKf.js.map} +1 -1
  140. package/dist/admin/assets/inbox-C0PVc6UI.js +2 -0
  141. package/dist/admin/assets/inbox-C0PVc6UI.js.map +1 -0
  142. package/dist/admin/assets/{inbox-CySnQydm.js → inbox-D9SmWt5L.js} +2 -2
  143. package/dist/admin/assets/{inbox-CySnQydm.js.map → inbox-D9SmWt5L.js.map} +1 -1
  144. package/dist/admin/assets/index-BqtCXB0u.js +4 -0
  145. package/dist/admin/assets/index-BqtCXB0u.js.map +1 -0
  146. package/dist/admin/assets/index-DZsQq6fY.css +2 -0
  147. package/dist/admin/assets/{key-round-D36CePnN.js → key-round-C8sd9CLN.js} +2 -2
  148. package/dist/admin/assets/{key-round-D36CePnN.js.map → key-round-C8sd9CLN.js.map} +1 -1
  149. package/dist/admin/assets/{labels-DQckbLGW.js → labels-BtktCNGw.js} +2 -2
  150. package/dist/admin/assets/{labels-DQckbLGW.js.map → labels-BtktCNGw.js.map} +1 -1
  151. package/dist/admin/assets/{languages-CzbTaQv9.js → languages-DLjdz6gb.js} +2 -2
  152. package/dist/admin/assets/{languages-CzbTaQv9.js.map → languages-DLjdz6gb.js.map} +1 -1
  153. package/dist/admin/assets/{layers-BmcodiaH.js → layers-swLuw-3a.js} +2 -2
  154. package/dist/admin/assets/{layers-BmcodiaH.js.map → layers-swLuw-3a.js.map} +1 -1
  155. package/dist/admin/assets/{link-2-off-CoJNwrxm.js → link-2-off-CEsI5T8h.js} +2 -2
  156. package/dist/admin/assets/{link-2-off-CoJNwrxm.js.map → link-2-off-CEsI5T8h.js.map} +1 -1
  157. package/dist/admin/assets/{link-Pyr2Y35S.js → link-C98FG_p5.js} +2 -2
  158. package/dist/admin/assets/{link-Pyr2Y35S.js.map → link-C98FG_p5.js.map} +1 -1
  159. package/dist/admin/assets/locales-CkuC7TJ1.js +2 -0
  160. package/dist/admin/assets/{locales-Bg3htKo8.js.map → locales-CkuC7TJ1.js.map} +1 -1
  161. package/dist/admin/assets/media-CbGSd_Mw.js +2 -0
  162. package/dist/admin/assets/{media-BCnVhaDH.js.map → media-CbGSd_Mw.js.map} +1 -1
  163. package/dist/admin/assets/{media-CURizGns.js → media-CeZGDGh7.js} +2 -2
  164. package/dist/admin/assets/{media-CURizGns.js.map → media-CeZGDGh7.js.map} +1 -1
  165. package/dist/admin/assets/network-BflLSKFO.js +2 -0
  166. package/dist/admin/assets/network-BflLSKFO.js.map +1 -0
  167. package/dist/admin/assets/{plus-BoDtdLCo.js → plus-cr9ZfO6j.js} +2 -2
  168. package/dist/admin/assets/{plus-BoDtdLCo.js.map → plus-cr9ZfO6j.js.map} +1 -1
  169. package/dist/admin/assets/publishing-BkxBplUZ.js +2 -0
  170. package/dist/admin/assets/publishing-BkxBplUZ.js.map +1 -0
  171. package/dist/admin/assets/{radio-group-4ok5evXq.js → radio-group-CRuWQnuV.js} +2 -2
  172. package/dist/admin/assets/{radio-group-4ok5evXq.js.map → radio-group-CRuWQnuV.js.map} +1 -1
  173. package/dist/admin/assets/{rotate-ccw-DL6TzcZh.js → rotate-ccw-BP8Ba-mY.js} +2 -2
  174. package/dist/admin/assets/{rotate-ccw-DL6TzcZh.js.map → rotate-ccw-BP8Ba-mY.js.map} +1 -1
  175. package/dist/admin/assets/schedules-BIyBlsYZ.js +2 -0
  176. package/dist/admin/assets/{schedules-BmB9Y73z.js.map → schedules-BIyBlsYZ.js.map} +1 -1
  177. package/dist/admin/assets/schema-6eUoC8fJ.js +2 -0
  178. package/dist/admin/assets/schema-6eUoC8fJ.js.map +1 -0
  179. package/dist/admin/assets/{scroll-text-PqeZm472.js → scroll-text-B5vfi9fD.js} +2 -2
  180. package/dist/admin/assets/{scroll-text-PqeZm472.js.map → scroll-text-B5vfi9fD.js.map} +1 -1
  181. package/dist/admin/assets/{search-BdwIwOzC.js → search-wj7zbkx1.js} +2 -2
  182. package/dist/admin/assets/{search-BdwIwOzC.js.map → search-wj7zbkx1.js.map} +1 -1
  183. package/dist/admin/assets/{searchSchemas-CSScloG8.js → searchSchemas-DAnwh3I3.js} +2 -2
  184. package/dist/admin/assets/{searchSchemas-CSScloG8.js.map → searchSchemas-DAnwh3I3.js.map} +1 -1
  185. package/dist/admin/assets/{sections-DqBzSKMP.js → sections-CWL-XD6m.js} +2 -2
  186. package/dist/admin/assets/sections-CWL-XD6m.js.map +1 -0
  187. package/dist/admin/assets/{sections-BTS683ur.js → sections-DBQpB0uv.js} +2 -2
  188. package/dist/admin/assets/{sections-BTS683ur.js.map → sections-DBQpB0uv.js.map} +1 -1
  189. package/dist/admin/assets/{select-C0USI-Ox.js → select-DVrPV1b3.js} +2 -2
  190. package/dist/admin/assets/{select-C0USI-Ox.js.map → select-DVrPV1b3.js.map} +1 -1
  191. package/dist/admin/assets/{send-XPWo3m4u.js → send-CzFdgUc_.js} +2 -2
  192. package/dist/admin/assets/{send-XPWo3m4u.js.map → send-CzFdgUc_.js.map} +1 -1
  193. package/dist/admin/assets/seo-Bd0sWQMo.js +2 -0
  194. package/dist/admin/assets/{seo-CceGYTIX.js.map → seo-Bd0sWQMo.js.map} +1 -1
  195. package/dist/admin/assets/settings-CqnrPmzR.js +2 -0
  196. package/dist/admin/assets/{settings-B60vHpZd.js.map → settings-CqnrPmzR.js.map} +1 -1
  197. package/dist/admin/assets/shapes-ZAkMBB-Z.js +6 -0
  198. package/dist/admin/assets/shapes-ZAkMBB-Z.js.map +1 -0
  199. package/dist/admin/assets/{skeleton-B5MP72Kw.js → skeleton-CiX26LnL.js} +2 -2
  200. package/dist/admin/assets/{skeleton-B5MP72Kw.js.map → skeleton-CiX26LnL.js.map} +1 -1
  201. package/dist/admin/assets/{snapshots-DUI2t-qF.js → snapshots-DbFQNJgN.js} +2 -2
  202. package/dist/admin/assets/{snapshots-DUI2t-qF.js.map → snapshots-DbFQNJgN.js.map} +1 -1
  203. package/dist/admin/assets/{sparkles-CvT-jxrW.js → sparkles-D_kmZJVd.js} +2 -2
  204. package/dist/admin/assets/{sparkles-CvT-jxrW.js.map → sparkles-D_kmZJVd.js.map} +1 -1
  205. package/dist/admin/assets/src-CMor9izq.js +7 -0
  206. package/dist/admin/assets/src-CMor9izq.js.map +1 -0
  207. package/dist/admin/assets/{stableId-BrtQedPy.js → stableId-g1uxJGSz.js} +2 -2
  208. package/dist/admin/assets/{stableId-BrtQedPy.js.map → stableId-g1uxJGSz.js.map} +1 -1
  209. package/dist/admin/assets/{store-CdIFG90N.js → store-CznhNKEi.js} +2 -2
  210. package/dist/admin/assets/{store-CdIFG90N.js.map → store-CznhNKEi.js.map} +1 -1
  211. package/dist/admin/assets/{switch-Dp6WYNam.js → switch-CiVf05NF.js} +2 -2
  212. package/dist/admin/assets/{switch-Dp6WYNam.js.map → switch-CiVf05NF.js.map} +1 -1
  213. package/dist/admin/assets/{theme-65PB8uAu.js → theme-Cv-MfOv8.js} +2 -2
  214. package/dist/admin/assets/theme-Cv-MfOv8.js.map +1 -0
  215. package/dist/admin/assets/titles-DrQhW8z3.js +2 -0
  216. package/dist/admin/assets/titles-DrQhW8z3.js.map +1 -0
  217. package/dist/admin/assets/tokens-B1S81Epe.js +2 -0
  218. package/dist/admin/assets/{tokens-ixHjAkDK.js.map → tokens-B1S81Epe.js.map} +1 -1
  219. package/dist/admin/assets/{tooltip-BGP1DVBt.js → tooltip-Bqf3oyqC.js} +2 -2
  220. package/dist/admin/assets/{tooltip-BGP1DVBt.js.map → tooltip-Bqf3oyqC.js.map} +1 -1
  221. package/dist/admin/assets/{undo-2-BiTANHFz.js → undo-2-DpwwRQTf.js} +2 -2
  222. package/dist/admin/assets/{undo-2-BiTANHFz.js.map → undo-2-DpwwRQTf.js.map} +1 -1
  223. package/dist/admin/assets/useContentSchema-B_q1rMrG.js +2 -0
  224. package/dist/admin/assets/useContentSchema-B_q1rMrG.js.map +1 -0
  225. package/dist/admin/assets/useCursorPager-BHYqHb3M.js +2 -0
  226. package/dist/admin/assets/{useCursorPager-0zHjlm-7.js.map → useCursorPager-BHYqHb3M.js.map} +1 -1
  227. package/dist/admin/assets/{useDiscardGuard-BskWSlbT.js → useDiscardGuard-C4QTfiU4.js} +2 -2
  228. package/dist/admin/assets/{useDiscardGuard-BskWSlbT.js.map → useDiscardGuard-C4QTfiU4.js.map} +1 -1
  229. package/dist/admin/assets/{useMediaPickerDialog-CU-ekPqX.js → useMediaPickerDialog-BLrVV1Kn.js} +2 -2
  230. package/dist/admin/assets/{useMediaPickerDialog-CU-ekPqX.js.map → useMediaPickerDialog-BLrVV1Kn.js.map} +1 -1
  231. package/dist/admin/assets/{useMediaUploader-CBcq1ICg.js → useMediaUploader-CFy6lasO.js} +2 -2
  232. package/dist/admin/assets/useMediaUploader-CFy6lasO.js.map +1 -0
  233. package/dist/admin/assets/useModelIndex-NU-WlHQY.js +2 -0
  234. package/dist/admin/assets/useModelIndex-NU-WlHQY.js.map +1 -0
  235. package/dist/admin/assets/useNetworkPermission-DehDln-U.js +2 -0
  236. package/dist/admin/assets/{useNetworkPermission-Cts98h9d.js.map → useNetworkPermission-DehDln-U.js.map} +1 -1
  237. package/dist/admin/assets/{usePaletteItems-DtReWmkd.js → usePaletteItems-CFpNlSOs.js} +2 -2
  238. package/dist/admin/assets/{usePaletteItems-DtReWmkd.js.map → usePaletteItems-CFpNlSOs.js.map} +1 -1
  239. package/dist/admin/assets/usePlaces-BA4x6503.js +2 -0
  240. package/dist/admin/assets/usePlaces-BA4x6503.js.map +1 -0
  241. package/dist/admin/assets/useResolvedDefinitions-30lnwFQ1.js +2 -0
  242. package/dist/admin/assets/useResolvedDefinitions-30lnwFQ1.js.map +1 -0
  243. package/dist/admin/assets/{useResolvedScheme-C8vcQVko.js → useResolvedScheme-BVM4qLct.js} +2 -2
  244. package/dist/admin/assets/{useResolvedScheme-C8vcQVko.js.map → useResolvedScheme-BVM4qLct.js.map} +1 -1
  245. package/dist/admin/assets/useSaveShortcut-DQuNL1uJ.js +2 -0
  246. package/dist/admin/assets/useSaveShortcut-DQuNL1uJ.js.map +1 -0
  247. package/dist/admin/assets/{useSchemaScopeAccess-ByrxIdKM.js → useSchemaScopeAccess-JXOMx51q.js} +2 -2
  248. package/dist/admin/assets/{useSchemaScopeAccess-ByrxIdKM.js.map → useSchemaScopeAccess-JXOMx51q.js.map} +1 -1
  249. package/dist/admin/assets/users-38jLQ7zr.js +2 -0
  250. package/dist/admin/assets/users-38jLQ7zr.js.map +1 -0
  251. package/dist/admin/assets/{users-DM7CXUBJ.js → users-DYwcVDqp.js} +2 -2
  252. package/dist/admin/assets/{users-DM7CXUBJ.js.map → users-DYwcVDqp.js.map} +1 -1
  253. package/dist/admin/assets/{zod-Cry7YvLY.js → zod-ZaQjjiAq.js} +2 -2
  254. package/dist/admin/assets/{zod-Cry7YvLY.js.map → zod-ZaQjjiAq.js.map} +1 -1
  255. package/dist/admin/index.html +60 -58
  256. package/dist/cli.js +1 -1
  257. package/dist/{cliMain-papyXJDd.js → cliMain-CTntiVc2.js} +107 -30
  258. package/dist/cliMain-CTntiVc2.js.map +1 -0
  259. package/dist/config.d.ts +2 -2
  260. package/dist/config.js +1 -1
  261. package/dist/{contentDisposition-DOL2Xt0l.js → contentDisposition-DzhPhncr.js} +2 -2
  262. package/dist/{contentDisposition-DOL2Xt0l.js.map → contentDisposition-DzhPhncr.js.map} +1 -1
  263. package/dist/index.d.ts +43 -6
  264. package/dist/index.js +2 -2
  265. package/dist/{public-COKbHR-N.d.ts → public-CMFaGDyf.d.ts} +50 -8
  266. package/dist/{public-B57h4F7Y.js → public-sJCQaNaP.js} +2 -2
  267. package/dist/public-sJCQaNaP.js.map +1 -0
  268. package/dist/{s3Adapter-U01iEAcK.js → s3Adapter-CZcCl0sy.js} +2 -2
  269. package/dist/{s3Adapter-U01iEAcK.js.map → s3Adapter-CZcCl0sy.js.map} +1 -1
  270. package/dist/{worker-B-sC-eY2.js → worker-DHm2JwMZ.js} +3140 -1292
  271. package/dist/worker-DHm2JwMZ.js.map +1 -0
  272. package/package.json +5 -5
  273. package/dist/admin/assets/AssistError-Cs-r9Ssc.js +0 -2
  274. package/dist/admin/assets/Body-BzZD-TZT.js +0 -2
  275. package/dist/admin/assets/Body-BzZD-TZT.js.map +0 -1
  276. package/dist/admin/assets/Builder-DW-GJA_q.js +0 -2
  277. package/dist/admin/assets/Builder-DW-GJA_q.js.map +0 -1
  278. package/dist/admin/assets/Form-lNrRHc0I.js +0 -2
  279. package/dist/admin/assets/Form-lNrRHc0I.js.map +0 -1
  280. package/dist/admin/assets/FormCheckboxGroup-DeeaYnzB.js +0 -2
  281. package/dist/admin/assets/FormCheckboxGroup-DeeaYnzB.js.map +0 -1
  282. package/dist/admin/assets/FormSelectField-BzE9Lq9i.js +0 -2
  283. package/dist/admin/assets/FormSelectField-BzE9Lq9i.js.map +0 -1
  284. package/dist/admin/assets/RadioTile-DQFmni5A.js.map +0 -1
  285. package/dist/admin/assets/RichTextField-CVHRIbnu.js.map +0 -1
  286. package/dist/admin/assets/StepList-BXGYD9eJ.js +0 -2
  287. package/dist/admin/assets/StepList-BXGYD9eJ.js.map +0 -1
  288. package/dist/admin/assets/Structure-D8csgrIt.js +0 -2
  289. package/dist/admin/assets/SubNavLink-CiCaVV8U.js.map +0 -1
  290. package/dist/admin/assets/auth-CQO4MBUj.js +0 -2
  291. package/dist/admin/assets/changeSets-8EburmT0.js +0 -2
  292. package/dist/admin/assets/chevron-left-DGU3HGYG.js +0 -2
  293. package/dist/admin/assets/content-CAjkbZEY.js +0 -3
  294. package/dist/admin/assets/content-CAjkbZEY.js.map +0 -1
  295. package/dist/admin/assets/createLucideIcon-CLmh7Go-.js +0 -2
  296. package/dist/admin/assets/createLucideIcon-CLmh7Go-.js.map +0 -1
  297. package/dist/admin/assets/develop-BOqvnlgt.js +0 -11
  298. package/dist/admin/assets/develop-BOqvnlgt.js.map +0 -1
  299. package/dist/admin/assets/es2015-BHmI7wjK.js +0 -42
  300. package/dist/admin/assets/es2015-BHmI7wjK.js.map +0 -1
  301. package/dist/admin/assets/followPlural-Cm7v_Udv.js +0 -2
  302. package/dist/admin/assets/followPlural-Cm7v_Udv.js.map +0 -1
  303. package/dist/admin/assets/inbox-DGO2D8fa.js +0 -2
  304. package/dist/admin/assets/inbox-DGO2D8fa.js.map +0 -1
  305. package/dist/admin/assets/index-BIIU9ZI6.js +0 -4
  306. package/dist/admin/assets/index-BIIU9ZI6.js.map +0 -1
  307. package/dist/admin/assets/index-lxe7WimO.css +0 -2
  308. package/dist/admin/assets/locales-Bg3htKo8.js +0 -2
  309. package/dist/admin/assets/media-BCnVhaDH.js +0 -2
  310. package/dist/admin/assets/network-BixABr0o.js +0 -2
  311. package/dist/admin/assets/network-BixABr0o.js.map +0 -1
  312. package/dist/admin/assets/publishing-Dke9bSKp.js +0 -2
  313. package/dist/admin/assets/publishing-Dke9bSKp.js.map +0 -1
  314. package/dist/admin/assets/schedules-BmB9Y73z.js +0 -2
  315. package/dist/admin/assets/schema-D-qo7XSF.js +0 -2
  316. package/dist/admin/assets/schema-D-qo7XSF.js.map +0 -1
  317. package/dist/admin/assets/sections-DqBzSKMP.js.map +0 -1
  318. package/dist/admin/assets/seo-CceGYTIX.js +0 -2
  319. package/dist/admin/assets/settings-B60vHpZd.js +0 -2
  320. package/dist/admin/assets/shapes-B5twqZcp.js +0 -6
  321. package/dist/admin/assets/shapes-B5twqZcp.js.map +0 -1
  322. package/dist/admin/assets/src-ndgTSYLX.js +0 -7
  323. package/dist/admin/assets/src-ndgTSYLX.js.map +0 -1
  324. package/dist/admin/assets/theme-65PB8uAu.js.map +0 -1
  325. package/dist/admin/assets/titles-CQiqqDw-.js +0 -2
  326. package/dist/admin/assets/titles-CQiqqDw-.js.map +0 -1
  327. package/dist/admin/assets/tokens-ixHjAkDK.js +0 -2
  328. package/dist/admin/assets/useContentSchema-DtYfhsd2.js +0 -2
  329. package/dist/admin/assets/useContentSchema-DtYfhsd2.js.map +0 -1
  330. package/dist/admin/assets/useCursorPager-0zHjlm-7.js +0 -2
  331. package/dist/admin/assets/useMediaUploader-CBcq1ICg.js.map +0 -1
  332. package/dist/admin/assets/useNetworkPermission-Cts98h9d.js +0 -2
  333. package/dist/admin/assets/usePlaces-DC47wVeU.js +0 -2
  334. package/dist/admin/assets/usePlaces-DC47wVeU.js.map +0 -1
  335. package/dist/admin/assets/useQueries-CirW3Mvp.js +0 -2
  336. package/dist/admin/assets/useQueries-CirW3Mvp.js.map +0 -1
  337. package/dist/admin/assets/useSaveShortcut-rKtp1qK7.js +0 -2
  338. package/dist/admin/assets/useSaveShortcut-rKtp1qK7.js.map +0 -1
  339. package/dist/admin/assets/users-2iJYwlJb.js +0 -2
  340. package/dist/admin/assets/users-2iJYwlJb.js.map +0 -1
  341. package/dist/cliMain-papyXJDd.js.map +0 -1
  342. package/dist/public-B57h4F7Y.js.map +0 -1
  343. package/dist/worker-B-sC-eY2.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./react-dom-pEVw9mjF.js";import{t as r}from"./jsx-runtime-DREnUpxT.js";import{Bt as i,H as a}from"./src-ndgTSYLX.js";import{i as o}from"./media-BCnVhaDH.js";import{n as s,t as c,v as l}from"./createLucideIcon-CLmh7Go-.js";import{C as u,E as d,_ as f,a as p,b as m,d as h,f as g,g as _,h as v,i as y,m as b,n as x,p as S,r as ee,v as te,w as ne,y as re}from"./InfoHint-CSEtcHjL.js";import{i as C,n as ie,r as ae,t as oe}from"./skeleton-B5MP72Kw.js";import{a as se,i as ce,n as le,r as ue,t as de}from"./select-C0USI-Ox.js";import{_ as fe,l as pe,v as me}from"./field-COOzRptX.js";import{A as he,B as ge,C as _e,D as ve,E as ye,F as be,I as xe,L as Se,M as w,O as T,R as Ce,S as we,T as Te,_ as Ee,a as De,b as Oe,c as E,d as D,f as ke,g as Ae,h as je,i as Me,j as Ne,k as Pe,l as O,m as Fe,n as Ie,o as Le,p as k,r as Re,s as ze,t as Be,u as A,v as Ve,w as He,x as Ue,y as We,z as Ge}from"./BlockMenuItems-DsccXMc_.js";import{n as Ke,t as qe}from"./link-Pyr2Y35S.js";import{n as Je}from"./stableId-BrtQedPy.js";import{t as Ye}from"./image-off-DFs5upyX.js";import{t as Xe}from"./image-DT79QFa_.js";import{a as Ze,l as Qe,m as $e,p as et,r as tt,t as nt}from"./dropdown-menu-_xfaEp5C.js";import{t as rt}from"./plus-BoDtdLCo.js";import{t as it}from"./sparkles-CvT-jxrW.js";import{t as at}from"./undo-2-BiTANHFz.js";import{t as ot}from"./cn-DVhJ55Mo.js";import{i as st,n as ct,t as lt}from"./tooltip-BGP1DVBt.js";import{t as ut}from"./HintedLabel-DzHnEdIK.js";import{n as dt,o as ft}from"./context-IKYdzQJ-.js";import{h as pt,i as mt,l as ht,m as gt,r as _t,t as vt}from"./AssistError-Cs-r9Ssc.js";import{t as yt}from"./SuggestAltButton-CvIoirnz.js";import{c as bt,n as xt,o as St,s as Ct}from"./InsertMenuItem-CCr9e0qY.js";import{t as wt}from"./textarea-BBjqMF-Y.js";import{n as Tt,t as Et}from"./w3c-keyname-BOAvb0qz.js";var Dt={name:`bold`,size:24,node:[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]};Dt.node;var Ot=c(Dt),kt={name:`italic`,size:24,node:[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]};kt.node;var At=c(kt),jt={name:`redo-2`,size:24,node:[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]};jt.node;var Mt=c(jt),j=e(t(),1),Nt=e(n(),1),Pt=l(),Ft=Object.defineProperty,It=(e,t)=>{let n={};for(var r in e)Ft(n,r,{get:e[r],enumerable:!0});return t||Ft(n,Symbol.toStringTag,{value:`Module`}),n},Lt=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Rt(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var zt=(e,t,n)=>{let r=Rt(e,n);if(!r)return!1;let i=Gt(r);if(!i){let n=r.blockRange(),i=n&&He(n);return i!=null&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(un(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Ut(a,`end`)||E.isSelectable(a)))for(let n=r.depth;;n--){let o=Te(e.doc,r.before(n),r.after(n),w.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(Ut(a,`end`)?D.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):E.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Bt=(e,t,n)=>{let r=Rt(e,n);if(!r)return!1;let i=Gt(r);return i?Ht(e,i,t):!1},Vt=(e,t,n)=>{let r=Kt(e,n);if(!r)return!1;let i=Yt(r);return i?Ht(e,i,t):!1};function Ht(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Te(e.doc,i,o,w.empty);if(!s||s.from!=i||s instanceof Ee&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(k.create(t.doc,i)),n(t.scrollIntoView())}return!0}function Ut(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Wt=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=Gt(r)}let o=a&&a.nodeBefore;return!o||!E.isSelectable(o)?!1:(t&&t(e.tr.setSelection(E.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Gt(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Kt(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var qt=(e,t,n)=>{let r=Kt(e,n);if(!r)return!1;let i=Yt(r);if(!i)return!1;let a=i.nodeAfter;if(un(e,i,t,1))return!0;if(r.parent.content.size==0&&(Ut(a,`start`)||E.isSelectable(a))){let n=Te(e.doc,r.before(),r.after(),w.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Ut(a,`start`)?D.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):E.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},Jt=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=Yt(r)}let o=a&&a.nodeAfter;return!o||!E.isSelectable(o)?!1:(t&&t(e.tr.setSelection(E.create(e.doc,a.pos)).scrollIntoView()),!0)};function Yt(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var Xt=(e,t)=>{let n=e.selection,r=n instanceof E,i;if(r){if(n.node.isTextblock||!We(e.doc,n.from))return!1;i=n.from}else if(i=_e(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(E.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},Zt=(e,t)=>{let n=e.selection,r;if(n instanceof E){if(n.node.isTextblock||!We(e.doc,n.to))return!1;r=n.to}else if(r=_e(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},Qt=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&He(i);return a!=null&&(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},$t=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
2
- `).scrollIntoView()),!0)};function en(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var tn=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=en(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(D.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},nn=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Le||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=en(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(k.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},rn=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Oe(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&He(r);return i!=null&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function an(e){return(t,n)=>{if(t.selection instanceof E&&t.selection.node.isBlock){let{$from:e}=t.selection;return!e.parentOffset||!Oe(t.doc,e.pos)?!1:(n&&n(t.tr.split(e.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let r=t.tr;!t.selection.empty&&(t.selection instanceof k||t.selection instanceof Le)&&r.deleteSelection();let{$from:i}=r.selection,a=r.steps.length,o=[],s,c,l=!1,u=!1;for(let t=i.depth;;t--)if(i.node(t).isBlock){l=i.end(t)==i.pos+(i.depth-t),u=i.start(t)==i.pos-(i.depth-t),c=en(i.node(t-1).contentMatchAt(i.indexAfter(t-1)));let n=e&&e(i.parent,l,i);o.unshift(n||(l&&c?{type:c}:null)),s=t;break}else{if(t==1)return!1;o.unshift(null)}let d=i.pos,f=Oe(r.doc,d,o.length,o);if(f||=(o[0]=c?{type:c}:null,Oe(r.doc,d,o.length,o)),!f)return!1;if(r.split(d,o.length,o),!l&&u&&i.node(s).type!=c){let e=r.mapping.slice(a),t=e.map(i.before(s)),n=r.doc.resolve(t);c&&i.node(s-1).canReplaceWith(n.index(),n.index()+1,c)&&r.setNodeMarkup(e.map(i.before(s)),c)}return n&&n(r.scrollIntoView()),!0}}var on=an(),sn=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a!=0&&(i=n.before(a),t&&t(e.tr.setSelection(E.create(e.doc,i))),!0)},cn=(e,t)=>(t&&t(e.tr.setSelection(new Le(e.doc))),!0);function ln(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||We(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function un(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&ln(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=T.empty;for(let e=o.length-1;e>=0;e--)s=T.from(o[e].create(null,s));s=T.from(i.copy(s));let c=e.tr.step(new Ae(t.pos-1,r,t.pos,r,new w(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&We(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:D.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&He(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&Ut(a,`start`,!0)&&Ut(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=T.empty;for(let e=o.length-1;e>=0;e--)r=T.from(o[e].copy(r));n(e.tr.step(new Ae(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new w(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function dn(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(k.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var fn=dn(-1),pn=dn(1);function mn(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&we(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function hn(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(e,t)){if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function gn(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var _n=gn(Lt,zt,Wt),vn=gn(Lt,qt,Jt),yn={Enter:gn($t,nn,rn,on),"Mod-Enter":tn,Backspace:_n,"Mod-Backspace":_n,"Shift-Backspace":_n,Delete:vn,"Mod-Delete":vn,"Mod-a":cn},bn={"Ctrl-h":yn.Backspace,"Alt-Backspace":yn[`Mod-Backspace`],"Ctrl-d":yn.Delete,"Ctrl-Alt-Backspace":yn[`Mod-Delete`],"Alt-Delete":yn[`Mod-Delete`],"Alt-d":yn[`Mod-Delete`],"Ctrl-a":fn,"Ctrl-e":pn};for(let e in yn)bn[e]=yn[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function xn(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return Sn(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function Sn(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new he(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new he(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=we(a,n,r,t);return s?(e&&Cn(e,t,s,i,n),!0):!1}function Cn(e,t,n,r,i){let a=T.empty;for(let e=n.length-1;e>=0;e--)a=T.from(n[e].type.create(n[e].attrs,a));e.step(new Ae(t.start-(r?2:0),t.end,t.start,t.end,new w(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&Oe(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function wn(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?Tn(t,n,e,a):En(t,n,a):!0:!1}}function Tn(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new Ae(a-1,o,a,o,new w(T.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new he(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=He(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return We(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function En(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?T.empty:T.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new Ae(d-+!!s,f+ +!!c,d+1,f-1,new w((s?T.empty:T.from(i.copy(T.empty))).append(c?T.empty:T.from(i.copy(T.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function Dn(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=T.from(r?e.create():null),o=new w(T.from(e.create(null,T.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new Ae(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var M=e(r(),1),On=i(),N=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},kn=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},An=null,jn=function(e,t,n){let r=An||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Mn=function(){An=null},Nn=function(e,t,n,r){return n&&(Fn(e,t,n,r,-1)||Fn(e,t,n,r,1))},Pn=/^(img|br|input|textarea|hr)$/i;function Fn(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:P(e))){let n=e.parentNode;if(!n||!F(n)||Bn(e)||Pn.test(e.nodeName)||e.contentEditable==`false`)return!1;t=N(e)+(i<0?0:1),e=n}else if(F(e)){let n=e.childNodes[t+(i<0?-1:0)];if(F(n)&&n.contentEditable==`false`){if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1}else e=n,t=i<0?P(e):0}else return!1}}function P(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function F(e){return e.nodeType==1}function I(e){return e.nodeType==3}function In(e,t){return t?e.contains(F(t)?t:t.parentNode):!1}function Ln(e,t){for(;;){if(I(e)&&t)return e;if(F(e)&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=P(e)}else if(e.parentNode&&!Bn(e))t=N(e),e=e.parentNode;else return null}}function Rn(e,t){for(;;){if(I(e)&&t<e.nodeValue.length)return e;if(F(e)&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Bn(e))t=N(e)+1,e=e.parentNode;else return null}}function zn(e,t,n){for(let r=t==0,i=t==P(e);r||i;){if(e==n)return!0;let t=N(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==P(e)}}function Bn(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Vn=function(e){return e.focusNode&&Nn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Hn(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function Un(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Wn(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(P(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(P(r.startContainer),r.startOffset)}}}var Gn=typeof navigator<`u`?navigator:null,Kn=typeof document<`u`?document:null,qn=Gn&&Gn.userAgent||``,Jn=/Edge\/(\d+)/.exec(qn),Yn=/MSIE \d/.exec(qn),Xn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(qn),Zn=!!(Yn||Xn||Jn),Qn=Yn?document.documentMode:Xn?+Xn[1]:Jn?+Jn[1]:0,$n=!Zn&&/gecko\/(\d+)/i.test(qn);$n&&+(/Firefox\/(\d+)/.exec(qn)||[0,0])[1];var er=!Zn&&/Chrome\/(\d+)/.exec(qn),L=!!er,tr=er?+er[1]:0,R=!Zn&&!!Gn&&/Apple Computer/.test(Gn.vendor),nr=R&&(/Mobile\/\w+/.test(qn)||!!Gn&&Gn.maxTouchPoints>2),rr=nr||(Gn?/Mac/.test(Gn.platform):!1),ir=Gn?/Win/.test(Gn.platform):!1,ar=/Android \d/.test(qn),or=!!Kn&&`webkitFontSmoothing`in Kn.documentElement.style,sr=or?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cr(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function lr(e,t){return typeof e==`number`?e:e[t]}function ur(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function dr(e,t,n){if(!Er(t)&&t.left==0)return;let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(!F(o)){o=kn(o);continue}let e=o==a.body,n=e?cr(a):ur(o),s=0,c=0;if(t.top<n.top+lr(r,`top`)?c=-(n.top-t.top+lr(i,`top`)):t.bottom>n.bottom-lr(r,`bottom`)&&(c=t.bottom-t.top>n.bottom-n.top?t.top+lr(i,`top`)-n.top:t.bottom-n.bottom+lr(i,`bottom`)),t.left<n.left+lr(r,`left`)?s=-(n.left-t.left+lr(i,`left`)):t.right>n.right-lr(r,`right`)&&(s=t.right-n.right+lr(i,`right`)),s||c){if(e)a.defaultView.scrollBy(s,c);else{let e=o.scrollLeft,n=o.scrollTop;c&&(o.scrollTop+=c),s&&(o.scrollLeft+=s);let r=o.scrollLeft-e,i=o.scrollTop-n;t={left:t.left-r,top:t.top-i,right:t.right-r,bottom:t.bottom-i}}}let l=e?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(l))break;o=l==`absolute`?o.offsetParent:kn(o)}}function fr(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:pr(e.dom)}}function pr(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=kn(r));return t}function mr({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;hr(n,r==0?0:r-t)}function hr(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var gr=null;function _r(e){if(e.setActive)return e.setActive();if(gr)return e.focus(gr);let t=pr(e);e.focus(gr==null?{get preventScroll(){return gr={preventScroll:!0},!0}}:void 0),gr||(gr=!1,hr(t,0))}function vr(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(F(u))e=u.getClientRects();else if(I(u))e=jn(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&I(n)?{left:p.right<t.left?p.right:p.left,top:t.top}:t,F(u)&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&I(n)?yr(n,i):!n||r?{node:e,offset:a}:vr(n,i)}function yr(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=Dr(r,1);if(n.top!=n.bottom&&br(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function br(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function xr(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Sr(e,t,n){let{node:r,offset:i}=vr(t,n),a=-1;if(F(r)&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Cr(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(F(t.dom)&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function wr(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(F(n)){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(br(t,i))return wr(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Tr(e,t){let n=e.dom.ownerDocument,r,i=0,a=Wn(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o)){let n=e.dom.getBoundingClientRect();if(!br(t,n)||(o=wr(e.dom,t,n),!o))return null}if(R)for(let e=o;r&&e;e=kn(e))e.draggable&&(r=void 0);if(o=xr(o,t),r){if($n&&F(r)&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;or&&i&&F(r)&&F(n=r.childNodes[i-1])&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&F(r.lastChild)&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||!F(r)||r.childNodes[i-1].nodeName!=`BR`)&&(s=Cr(e,r,i,t))}s??=Sr(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Er(e){return e.top<e.bottom||e.left<e.right}function Dr(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Er(e))return e}return Array.prototype.find.call(n,Er)||e.getBoundingClientRect()}var Or=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function kr(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=or||$n;if(I(r)){if(o&&(Or.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Dr(jn(r,i,i),n);if($n&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Dr(jn(r,i-1,i-1),-1);if(t.top==e.top){let n=Dr(jn(r,i,i+1),-1);if(n.top!=e.top)return Ar(n,n.left<t.left)}}return e}{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,Ar(Dr(jn(r,e,t),a),a<0)}}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==P(r))){let e=r.childNodes[i-1];if(F(e))return jr(e.getBoundingClientRect(),!1)}if(a==null&&i<P(r)){let e=r.childNodes[i];if(F(e))return jr(e.getBoundingClientRect(),!0)}return jr(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==P(r))){let e=r.childNodes[i-1],t=I(e)?jn(e,P(e)-+!o):F(e)&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Ar(Dr(t,1),!1)}if(a==null&&i<P(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?I(e)?jn(e,0,+!o):F(e)?e:null:null;if(t)return Ar(Dr(t,-1),!0)}return Ar(Dr(I(r)?jn(r):r,-n),n>=0)}function Ar(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function jr(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Mr(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function Nr(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Mr(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=kr(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(F(e))t=e.getClientRects();else if(I(e))t=jn(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Pr=/[\u0590-\u08ac]/;function Fr(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Pr.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Mr(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!In(l,u)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Ir=null,Lr=null,Rr=!1;function zr(e,t,n){return Ir==t&&Lr==n?Rr:(Ir=t,Lr=n,Rr=n==`up`||n==`down`?Nr(e,t,n):Fr(e,t,n))}var Br=0,Vr=1,Hr=2,Ur=3,Wr=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Br,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&In(this.contentDOM,e)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>N(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=!!(e.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node)){if(n&&(a=i.nodeDOM)&&!(F(a)?In(a,e):a==e))n=!1;else return i}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(;n>0;n--){let e=this.children[n-1];if(e.size||!(e instanceof Zr||e instanceof Gr&&e.side>=0))break}if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?N(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?N(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=N(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=N(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(!F(t)||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if(($n||R)&&e==t){let{node:e,offset:t}=o;if(I(e)){if(u=!!(t&&e.nodeValue[t-1]==`
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./react-dom-pEVw9mjF.js";import{t as r}from"./jsx-runtime-DREnUpxT.js";import{J as i,Kt as a}from"./src-CMor9izq.js";import{i as o}from"./media-CbGSd_Mw.js";import{n as s,t as c,v as l}from"./createLucideIcon-BOsNKleB.js";import{C as u,E as d,_ as f,a as p,b as m,d as h,f as g,g as _,h as v,i as y,m as b,n as x,p as S,r as ee,v as te,w as ne,y as re}from"./InfoHint-tlSeZB9U.js";import{i as C,n as ie,r as ae,t as oe}from"./skeleton-CiX26LnL.js";import{a as se,i as ce,n as le,r as ue,t as de}from"./select-DVrPV1b3.js";import{_ as fe,l as pe,v as me}from"./field-D-xWW2E7.js";import{A as he,B as ge,C as _e,D as ve,E as ye,F as be,I as xe,L as Se,M as w,O as T,R as Ce,S as we,T as Te,_ as Ee,a as De,b as Oe,c as E,d as D,f as ke,g as Ae,h as je,i as Me,j as Ne,k as Pe,l as O,m as Fe,n as Ie,o as Le,p as k,r as Re,s as ze,t as Be,u as A,v as Ve,w as He,x as Ue,y as We,z as Ge}from"./BlockMenuItems-JHFue7Qt.js";import{n as Ke,t as qe}from"./link-C98FG_p5.js";import{n as Je}from"./stableId-g1uxJGSz.js";import{t as Ye}from"./image-off-CVaH_qKf.js";import{t as Xe}from"./image-CX4mT-_R.js";import{a as Ze,l as Qe,m as $e,p as et,r as tt,t as nt}from"./dropdown-menu-Bz7CLcRK.js";import{t as rt}from"./plus-cr9ZfO6j.js";import{t as it}from"./sparkles-D_kmZJVd.js";import{t as at}from"./undo-2-DpwwRQTf.js";import{t as ot}from"./cn-DVhJ55Mo.js";import{i as st,n as ct,t as lt}from"./tooltip-Bqf3oyqC.js";import{t as ut}from"./HintedLabel-D9IVF0EE.js";import{n as dt,o as ft}from"./context-CEVKblBl.js";import{h as pt,i as mt,l as ht,m as gt,r as _t,t as vt}from"./AssistError-rslPtgWB.js";import{t as yt}from"./SuggestAltButton-BK1uo4yC.js";import{c as bt,n as xt,o as St,s as Ct}from"./InsertMenuItem-CHAp2tH7.js";import{t as wt}from"./textarea-BBjqMF-Y.js";import{n as Tt,t as Et}from"./w3c-keyname-BOAvb0qz.js";var Dt={name:`bold`,size:24,node:[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]};Dt.node;var Ot=c(Dt),kt={name:`italic`,size:24,node:[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]};kt.node;var At=c(kt),jt={name:`redo-2`,size:24,node:[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]};jt.node;var Mt=c(jt),j=e(t(),1),Nt=e(n(),1),Pt=l(),Ft=Object.defineProperty,It=(e,t)=>{let n={};for(var r in e)Ft(n,r,{get:e[r],enumerable:!0});return t||Ft(n,Symbol.toStringTag,{value:`Module`}),n},Lt=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Rt(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var zt=(e,t,n)=>{let r=Rt(e,n);if(!r)return!1;let i=Gt(r);if(!i){let n=r.blockRange(),i=n&&He(n);return i!=null&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(un(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Ut(a,`end`)||E.isSelectable(a)))for(let n=r.depth;;n--){let o=Te(e.doc,r.before(n),r.after(n),w.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(Ut(a,`end`)?D.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):E.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Bt=(e,t,n)=>{let r=Rt(e,n);if(!r)return!1;let i=Gt(r);return i?Ht(e,i,t):!1},Vt=(e,t,n)=>{let r=Kt(e,n);if(!r)return!1;let i=Yt(r);return i?Ht(e,i,t):!1};function Ht(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Te(e.doc,i,o,w.empty);if(!s||s.from!=i||s instanceof Ee&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(k.create(t.doc,i)),n(t.scrollIntoView())}return!0}function Ut(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Wt=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=Gt(r)}let o=a&&a.nodeBefore;return!o||!E.isSelectable(o)?!1:(t&&t(e.tr.setSelection(E.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Gt(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Kt(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var qt=(e,t,n)=>{let r=Kt(e,n);if(!r)return!1;let i=Yt(r);if(!i)return!1;let a=i.nodeAfter;if(un(e,i,t,1))return!0;if(r.parent.content.size==0&&(Ut(a,`start`)||E.isSelectable(a))){let n=Te(e.doc,r.before(),r.after(),w.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Ut(a,`start`)?D.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):E.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},Jt=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=Yt(r)}let o=a&&a.nodeAfter;return!o||!E.isSelectable(o)?!1:(t&&t(e.tr.setSelection(E.create(e.doc,a.pos)).scrollIntoView()),!0)};function Yt(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var Xt=(e,t)=>{let n=e.selection,r=n instanceof E,i;if(r){if(n.node.isTextblock||!We(e.doc,n.from))return!1;i=n.from}else if(i=_e(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(E.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},Zt=(e,t)=>{let n=e.selection,r;if(n instanceof E){if(n.node.isTextblock||!We(e.doc,n.to))return!1;r=n.to}else if(r=_e(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},Qt=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&He(i);return a!=null&&(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},$t=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
2
+ `).scrollIntoView()),!0)};function en(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var tn=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=en(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(D.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},nn=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Le||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=en(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(k.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},rn=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Oe(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&He(r);return i!=null&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function an(e){return(t,n)=>{if(t.selection instanceof E&&t.selection.node.isBlock){let{$from:e}=t.selection;return!e.parentOffset||!Oe(t.doc,e.pos)?!1:(n&&n(t.tr.split(e.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let r=t.tr;!t.selection.empty&&(t.selection instanceof k||t.selection instanceof Le)&&r.deleteSelection();let{$from:i}=r.selection,a=r.steps.length,o=[],s,c,l=!1,u=!1;for(let t=i.depth;;t--)if(i.node(t).isBlock){l=i.end(t)==i.pos+(i.depth-t),u=i.start(t)==i.pos-(i.depth-t),c=en(i.node(t-1).contentMatchAt(i.indexAfter(t-1)));let n=e&&e(i.parent,l,i);o.unshift(n||(l&&c?{type:c}:null)),s=t;break}else{if(t==1)return!1;o.unshift(null)}let d=i.pos,f=Oe(r.doc,d,o.length,o);if(f||=(o[0]=c?{type:c}:null,Oe(r.doc,d,o.length,o)),!f)return!1;if(r.split(d,o.length,o),!l&&u&&i.node(s).type!=c){let e=r.mapping.slice(a),t=e.map(i.before(s)),n=r.doc.resolve(t);c&&i.node(s-1).canReplaceWith(n.index(),n.index()+1,c)&&r.setNodeMarkup(e.map(i.before(s)),c)}return n&&n(r.scrollIntoView()),!0}}var on=an(),sn=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a!=0&&(i=n.before(a),t&&t(e.tr.setSelection(E.create(e.doc,i))),!0)},cn=(e,t)=>(t&&t(e.tr.setSelection(new Le(e.doc))),!0);function ln(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||We(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function un(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&ln(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=T.empty;for(let e=o.length-1;e>=0;e--)s=T.from(o[e].create(null,s));s=T.from(i.copy(s));let c=e.tr.step(new Ae(t.pos-1,r,t.pos,r,new w(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&We(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:D.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&He(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&Ut(a,`start`,!0)&&Ut(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=T.empty;for(let e=o.length-1;e>=0;e--)r=T.from(o[e].copy(r));n(e.tr.step(new Ae(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new w(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function dn(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(k.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var fn=dn(-1),pn=dn(1);function mn(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&we(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function hn(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(e,t)){if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function gn(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var _n=gn(Lt,zt,Wt),vn=gn(Lt,qt,Jt),yn={Enter:gn($t,nn,rn,on),"Mod-Enter":tn,Backspace:_n,"Mod-Backspace":_n,"Shift-Backspace":_n,Delete:vn,"Mod-Delete":vn,"Mod-a":cn},bn={"Ctrl-h":yn.Backspace,"Alt-Backspace":yn[`Mod-Backspace`],"Ctrl-d":yn.Delete,"Ctrl-Alt-Backspace":yn[`Mod-Delete`],"Alt-Delete":yn[`Mod-Delete`],"Alt-d":yn[`Mod-Delete`],"Ctrl-a":fn,"Ctrl-e":pn};for(let e in yn)bn[e]=yn[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function xn(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return Sn(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function Sn(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new he(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new he(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=we(a,n,r,t);return s?(e&&Cn(e,t,s,i,n),!0):!1}function Cn(e,t,n,r,i){let a=T.empty;for(let e=n.length-1;e>=0;e--)a=T.from(n[e].type.create(n[e].attrs,a));e.step(new Ae(t.start-(r?2:0),t.end,t.start,t.end,new w(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&Oe(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function wn(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?Tn(t,n,e,a):En(t,n,a):!0:!1}}function Tn(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new Ae(a-1,o,a,o,new w(T.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new he(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=He(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return We(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function En(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?T.empty:T.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new Ae(d-+!!s,f+ +!!c,d+1,f-1,new w((s?T.empty:T.from(i.copy(T.empty))).append(c?T.empty:T.from(i.copy(T.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function Dn(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=T.from(r?e.create():null),o=new w(T.from(e.create(null,T.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new Ae(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var M=e(r(),1),On=a(),N=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},kn=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},An=null,jn=function(e,t,n){let r=An||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Mn=function(){An=null},Nn=function(e,t,n,r){return n&&(Fn(e,t,n,r,-1)||Fn(e,t,n,r,1))},Pn=/^(img|br|input|textarea|hr)$/i;function Fn(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:P(e))){let n=e.parentNode;if(!n||!F(n)||Bn(e)||Pn.test(e.nodeName)||e.contentEditable==`false`)return!1;t=N(e)+(i<0?0:1),e=n}else if(F(e)){let n=e.childNodes[t+(i<0?-1:0)];if(F(n)&&n.contentEditable==`false`){if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1}else e=n,t=i<0?P(e):0}else return!1}}function P(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function F(e){return e.nodeType==1}function I(e){return e.nodeType==3}function In(e,t){return t?e.contains(F(t)?t:t.parentNode):!1}function Ln(e,t){for(;;){if(I(e)&&t)return e;if(F(e)&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=P(e)}else if(e.parentNode&&!Bn(e))t=N(e),e=e.parentNode;else return null}}function Rn(e,t){for(;;){if(I(e)&&t<e.nodeValue.length)return e;if(F(e)&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Bn(e))t=N(e)+1,e=e.parentNode;else return null}}function zn(e,t,n){for(let r=t==0,i=t==P(e);r||i;){if(e==n)return!0;let t=N(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==P(e)}}function Bn(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Vn=function(e){return e.focusNode&&Nn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Hn(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function Un(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Wn(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(P(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(P(r.startContainer),r.startOffset)}}}var Gn=typeof navigator<`u`?navigator:null,Kn=typeof document<`u`?document:null,qn=Gn&&Gn.userAgent||``,Jn=/Edge\/(\d+)/.exec(qn),Yn=/MSIE \d/.exec(qn),Xn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(qn),Zn=!!(Yn||Xn||Jn),Qn=Yn?document.documentMode:Xn?+Xn[1]:Jn?+Jn[1]:0,$n=!Zn&&/gecko\/(\d+)/i.test(qn);$n&&+(/Firefox\/(\d+)/.exec(qn)||[0,0])[1];var er=!Zn&&/Chrome\/(\d+)/.exec(qn),L=!!er,tr=er?+er[1]:0,R=!Zn&&!!Gn&&/Apple Computer/.test(Gn.vendor),nr=R&&(/Mobile\/\w+/.test(qn)||!!Gn&&Gn.maxTouchPoints>2),rr=nr||(Gn?/Mac/.test(Gn.platform):!1),ir=Gn?/Win/.test(Gn.platform):!1,ar=/Android \d/.test(qn),or=!!Kn&&`webkitFontSmoothing`in Kn.documentElement.style,sr=or?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cr(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function lr(e,t){return typeof e==`number`?e:e[t]}function ur(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function dr(e,t,n){if(!Er(t)&&t.left==0)return;let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(!F(o)){o=kn(o);continue}let e=o==a.body,n=e?cr(a):ur(o),s=0,c=0;if(t.top<n.top+lr(r,`top`)?c=-(n.top-t.top+lr(i,`top`)):t.bottom>n.bottom-lr(r,`bottom`)&&(c=t.bottom-t.top>n.bottom-n.top?t.top+lr(i,`top`)-n.top:t.bottom-n.bottom+lr(i,`bottom`)),t.left<n.left+lr(r,`left`)?s=-(n.left-t.left+lr(i,`left`)):t.right>n.right-lr(r,`right`)&&(s=t.right-n.right+lr(i,`right`)),s||c){if(e)a.defaultView.scrollBy(s,c);else{let e=o.scrollLeft,n=o.scrollTop;c&&(o.scrollTop+=c),s&&(o.scrollLeft+=s);let r=o.scrollLeft-e,i=o.scrollTop-n;t={left:t.left-r,top:t.top-i,right:t.right-r,bottom:t.bottom-i}}}let l=e?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(l))break;o=l==`absolute`?o.offsetParent:kn(o)}}function fr(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:pr(e.dom)}}function pr(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=kn(r));return t}function mr({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;hr(n,r==0?0:r-t)}function hr(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var gr=null;function _r(e){if(e.setActive)return e.setActive();if(gr)return e.focus(gr);let t=pr(e);e.focus(gr==null?{get preventScroll(){return gr={preventScroll:!0},!0}}:void 0),gr||(gr=!1,hr(t,0))}function vr(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(F(u))e=u.getClientRects();else if(I(u))e=jn(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&I(n)?{left:p.right<t.left?p.right:p.left,top:t.top}:t,F(u)&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&I(n)?yr(n,i):!n||r?{node:e,offset:a}:vr(n,i)}function yr(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=Dr(r,1);if(n.top!=n.bottom&&br(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function br(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function xr(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Sr(e,t,n){let{node:r,offset:i}=vr(t,n),a=-1;if(F(r)&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Cr(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(F(t.dom)&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function wr(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(F(n)){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(br(t,i))return wr(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Tr(e,t){let n=e.dom.ownerDocument,r,i=0,a=Wn(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o)){let n=e.dom.getBoundingClientRect();if(!br(t,n)||(o=wr(e.dom,t,n),!o))return null}if(R)for(let e=o;r&&e;e=kn(e))e.draggable&&(r=void 0);if(o=xr(o,t),r){if($n&&F(r)&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;or&&i&&F(r)&&F(n=r.childNodes[i-1])&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&F(r.lastChild)&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||!F(r)||r.childNodes[i-1].nodeName!=`BR`)&&(s=Cr(e,r,i,t))}s??=Sr(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Er(e){return e.top<e.bottom||e.left<e.right}function Dr(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Er(e))return e}return Array.prototype.find.call(n,Er)||e.getBoundingClientRect()}var Or=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function kr(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=or||$n;if(I(r)){if(o&&(Or.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Dr(jn(r,i,i),n);if($n&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Dr(jn(r,i-1,i-1),-1);if(t.top==e.top){let n=Dr(jn(r,i,i+1),-1);if(n.top!=e.top)return Ar(n,n.left<t.left)}}return e}{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,Ar(Dr(jn(r,e,t),a),a<0)}}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==P(r))){let e=r.childNodes[i-1];if(F(e))return jr(e.getBoundingClientRect(),!1)}if(a==null&&i<P(r)){let e=r.childNodes[i];if(F(e))return jr(e.getBoundingClientRect(),!0)}return jr(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==P(r))){let e=r.childNodes[i-1],t=I(e)?jn(e,P(e)-+!o):F(e)&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Ar(Dr(t,1),!1)}if(a==null&&i<P(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?I(e)?jn(e,0,+!o):F(e)?e:null:null;if(t)return Ar(Dr(t,-1),!0)}return Ar(Dr(I(r)?jn(r):r,-n),n>=0)}function Ar(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function jr(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Mr(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function Nr(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Mr(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=kr(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(F(e))t=e.getClientRects();else if(I(e))t=jn(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Pr=/[\u0590-\u08ac]/;function Fr(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Pr.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Mr(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!In(l,u)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Ir=null,Lr=null,Rr=!1;function zr(e,t,n){return Ir==t&&Lr==n?Rr:(Ir=t,Lr=n,Rr=n==`up`||n==`down`?Nr(e,t,n):Fr(e,t,n))}var Br=0,Vr=1,Hr=2,Ur=3,Wr=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Br,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&In(this.contentDOM,e)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>N(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=!!(e.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node)){if(n&&(a=i.nodeDOM)&&!(F(a)?In(a,e):a==e))n=!1;else return i}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(;n>0;n--){let e=this.children[n-1];if(e.size||!(e instanceof Zr||e instanceof Gr&&e.side>=0))break}if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?N(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?N(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=N(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=N(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(!F(t)||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if(($n||R)&&e==t){let{node:e,offset:t}=o;if(I(e)){if(u=!!(t&&e.nodeValue[t-1]==`
3
3
  `),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:N(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if($n&&l.focusNode&&l.focusNode!=s.node&&F(l.focusNode)){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&R)&&Nn(o.node,o.offset,l.anchorNode,l.anchorOffset)&&Nn(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&$n)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Hr:Vr,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ur:i.markDirty(e-r,t-r);return}i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Hr:Ur}n=a}this.dirty=Hr}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Hr:Vr;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Gr=class extends Wr{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){let e=F(a)?a:document.createElement(`span`);e!=a&&e.appendChild(a),e.hasAttribute(`contenteditable`)||(e.contentEditable=`false`),e.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Br&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},Kr=class extends Wr{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},qr=class e extends Wr{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=ve.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ur||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ur&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Br){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Br}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=mi(a,n,o,r)),t>0&&(a=mi(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Jr=class e extends Wr{constructor(e,t,n,r,i,a,o){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(!I(u))throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=ve.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=ai(u,r,n),l?c=new Qr(t,n,r,i,u,d||null,f,l):n.isText?new Xr(t,n,r,i,u,f):new e(t,n,r,i,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(t.preserveWhitespace=`full`),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>F(t)&&e.indexOf(t.parentNode)<0&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>T.empty}}return t}matchesNode(e,t,n){return this.dirty==Br&&e.eq(this.node)&&oi(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new ci(this,a&&a.node,e),c=this.node.inlineContent,l=c&&this.node.isBlock;di(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?Pe.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,u,d)=>{s.syncToMarks(t.marks,n,e,d),l&&t.isAtom&&!t.isText&&s.addHackNode(`IMG`,s.top);let f;s.findNodeMatch(t,a,u,d)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(f=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,u,f,e)||s.updateNextNode(t,a,u,e,d,r)||s.addNode(t,a,u,e,r),r+=t.nodeSize,c&&(l=t.isAtom&&!t.isText)}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Hr)&&(a&&this.protectLocalComposition(e,a),$r(this.contentDOM,this.children,e),nr&&fi(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof k)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=pi(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let a=new Kr(this,i,t,r);e.input.compositionNodes.push(a),this.children=mi(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Ur||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Br}updateOuterDeco(e){if(oi(e,this.outerDeco))return;let t=!F(this.nodeDOM),n=this.dom;this.dom=ri(this.dom,this.nodeDOM,ni(this.outerDeco,this.node,t),ni(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){F(this.nodeDOM)&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){F(this.nodeDOM)&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function Yr(e,t,n,r,i){ai(r,t,e);let a=new Jr(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}var Xr=class e extends Jr{constructor(e,t,n,r,i,a){super(e,t,n,r,i,null,a)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Ur||this.dirty!=Br&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Br||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Br,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Ur)}get domAtom(){return!1}isText(e){return this.node.text==e}},Zr=class extends Wr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Br&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},Qr=class extends Jr{constructor(e,t,n,r,i,a,o,s){super(e,t,n,r,i,a,o),this.spec=s}update(e,t,n,r){if(this.dirty==Ur)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}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 $r(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=si(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof qr){let t=r?r.previousSibling:e.lastChild;$r(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=si(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var ei=function(e){e&&(this.nodeName=e)};ei.prototype=Object.create(null);var ti=[new ei];function ni(e,t,n){if(e.length==0)return ti;let r=n?ti[0]:new ei,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new ei(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new ei(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function ri(e,t,n,r){if(n==ti&&r==ti)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=ti[0],i=t)}ii(i,o||ti[0],a)}return i}function ii(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function ai(e,t,n){return ri(e,e,ti,ni(t,n,!F(e)))}function oi(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function si(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var ci=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=li(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Br,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof qr&&t.dirty!=Ur&&t.mark.type==e[a].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[a])&&(t.mark=e[a],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=qr.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Ur&&a.dom==a.contentDOM&&(a.dirty=Hr),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof Jr){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Ur&&oi(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Hr,u.updateChildren(r,a+1),u.dirty=Br),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!oi(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=Jr.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=Jr.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new Gr(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof qr;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Xr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((R||L)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new Zr(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||F(e)&&e.contains(this.lock.parentNode))}};function li(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof qr)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function ui(e,t){return e.type.side-t.type.side}function di(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u){if(d){d.sort(ui);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c)}let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function fi(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function pi(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function mi(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function hi(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Vn(n)){for(c=o;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&E.isSelectable(i.node)&&i.parent&&!(i.node.isInline&&zn(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new E(o==e?s:r.resolve(e))}else if($n&&t==`key`&&o>e.state.selection.to&&F(n.focusNode)&&n.focusOffset==n.focusNode.childNodes.length&&i&&i.posAtStart>e.state.selection.to)for(let e=n.focusNode;;e=e.parentNode){if(getComputedStyle(e).overflow!=`visible`){l=D.findFrom(r.resolve(i.posAtStart),1);break}if(e==i.dom||e.nextSibling||!e.parentNode||!F(e.parentNode))break}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=Ei(e,u,s,n)}return l}function gi(e){return e.editable?e.hasFocus():Oi(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function _i(e,t=!1){let n=e.state.selection;if(wi(e,n),!gi(e))return;let r=e.input.mouseDown;if(!t&&L&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Nn(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)Ci(e);else{let{anchor:r,head:i}=n,a,o;vi&&!(n instanceof k)&&(n.$from.parent.inlineContent||(a=yi(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=yi(e,n.to))),e.docView.setSelection(r,i,e,t),vi&&(a&&xi(a),o&&xi(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&Si(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var vi=R||L&&tr<63;function yi(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(R&&i&&i.contentEditable==`false`)return bi(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return bi(i);if(a)return bi(a)}}function bi(e){return e.contentEditable=`true`,R&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function xi(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function Si(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!gi(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function Ci(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,N(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Zn&&Qn<=11&&(n.disabled=!0,n.disabled=!1)}function wi(e,t){if(t instanceof E){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Ti(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Ti(e)}function Ti(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function Ei(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||k.between(t,n,r)}function Di(e){return e.editable&&!e.hasFocus()?!1:Oi(e)}function Oi(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return In(e.dom,t.anchorNode)&&(e.editable||In(e.dom,t.focusNode))}catch{return!1}}function ki(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Nn(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Ai(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&D.findFrom(a,t)}function ji(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Mi(e,t,n){let r=e.state.selection;if(r instanceof k){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return ji(e,new k(r.$anchor,a))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=Ai(e.state,t);return n&&n instanceof E?ji(e,n):!1}if(!(rr&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?E.isSelectable(i)?ji(e,new E(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):ji(e,new k(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1}}else if(r instanceof E&&r.node.isInline)return ji(e,new k(t>0?r.$to:r.$from));else{let n=Ai(e.state,t);return n?ji(e,n):!1}}function Ni(e,t){let n=e.pmViewDesc;return n?n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`):F(e)&&e.contentEditable==`false`}function Pi(e,t){return t<0?Fi(e):Ii(e)}function Fi(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for($n&&F(n)&&r<P(n)&&Ni(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!F(n))break;let e=n.childNodes[r-1];if(Ni(e,-1))i=n,a=--r;else if(I(e))n=e,r=n.nodeValue.length;else break}else if(Li(n))break;else{let t=n.previousSibling;for(;t&&Ni(t,-1);)i=n.parentNode,a=N(t),t=t.previousSibling;if(t)n=t,r=P(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?Bi(e,n,r):i&&Bi(e,i,a)}function Ii(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=P(n),a,o;for(;;)if(r<i){if(!F(n))break;let e=n.childNodes[r];if(Ni(e,1))a=n,o=++r;else break}else if(Li(n))break;else{let t=n.nextSibling;for(;t&&Ni(t,1);)a=t.parentNode,o=N(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=P(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&Bi(e,a,o)}function Li(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ri(e,t){for(;e&&t==e.childNodes.length&&!Bn(e);)t=N(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(I(n))return n;if(F(n)&&n.contentEditable==`false`)break;e=n,t=0}}function zi(e,t){for(;e&&!t&&!Bn(e);)t=N(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(I(n))return n;if(F(n)&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function Bi(e,t,n){if(!I(t)){let e,r;(r=Ri(t,n))?(t=r,n=0):(e=zi(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Vn(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&_i(e)},50)}function Vi(e,t){let n=e.state.doc.resolve(t);if(!(L||ir)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function Hi(e,t,n){let r=e.state.selection;if(r instanceof k&&!r.empty||n.indexOf(`s`)>-1||rr&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=Ai(e.state,t);if(n&&n instanceof E)return ji(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof Le?D.near(n,t):D.findFrom(n,t);return o?ji(e,o):!1}return!1}function Ui(e,t){if(!(e.state.selection instanceof k))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function Wi(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Gi(e){if(!R||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&F(t)&&n==0&&t.firstChild&&F(t.firstChild)&&t.firstChild.contentEditable==`false`){let n=t.firstChild;Wi(e,n,`true`),setTimeout(()=>Wi(e,n,`false`),20)}return!1}function Ki(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function qi(e,t){let n=t.keyCode,r=Ki(t);if(n==8||rr&&n==72&&r==`c`)return Ui(e,-1)||Pi(e,-1);if(n==46&&!t.shiftKey||rr&&n==68&&r==`c`)return Ui(e,1)||Pi(e,1);if(n==13||n==27)return!0;if(n==37||rr&&n==66&&r==`c`){let t=n==37?Vi(e,e.state.selection.from)==`ltr`?-1:1:-1;return Mi(e,t,r)||Pi(e,t)}if(n==39||rr&&n==70&&r==`c`){let t=n==39?Vi(e,e.state.selection.from)==`ltr`?1:-1:1;return Mi(e,t,r)||Pi(e,t)}return n==38||rr&&n==80&&r==`c`?Hi(e,-1,r)||Pi(e,-1):n==40||rr&&n==78&&r==`c`?Gi(e)||Hi(e,1,r)||Pi(e,1):!(r!=(rr?`m`:`c`)||n!=66&&n!=73&&n!=89&&n!=90)}function Ji(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||ve.fromSchema(e.state.schema),s=ia(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&F(l)&&(u=ra[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&F(l)&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
4
4
 
5
5
  `),slice:t}}function Yi(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new w(T.from(e.state.schema.text(t.replace(/\r\n?/g,`
@@ -88,7 +88,7 @@ img.ProseMirror-separator {
88
88
 
89
89
  `,wp=(e,{from:t,to:n})=>e.textBetween(t,n,Cp,``),Tp=e=>{let{from:t,to:n,empty:r}=e.selection;if(r)return null;let i=wp(e.doc,{from:t,to:n});return i.trim()===``?null:{from:t,to:n,text:i}},Ep=(e,t)=>t.to<=e.content.size&&wp(e,t)===t.text,Dp=e=>e.split(`
90
90
  `).flatMap((e,t)=>[...t>0?[{type:`hardBreak`}]:[],...e===``?[]:[{type:`text`,text:e}]]),Op=e=>{let t=e.replace(/\r\n?/g,`
91
- `).trim().split(/\n{2,}/).filter(e=>e.trim()!==``);return t.length<=1?Dp(t[0]??``):t.map(e=>({type:`paragraph`,content:Dp(e)}))},kp=e=>{let[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(!1),d=ht(),f=()=>{o(null),c(``),u(!1),d.reset()},p=()=>{let t=Tp(e.state);t&&(f(),i(t),n(!0))},m=()=>{n(!1),f()};return{open:t,captured:r,tooLong:(r?.text.length??0)>gt,result:a,draft:s,setDraft:c,stale:l,pending:d.isPending,error:d.error,start:p,close:m,run:e=>{r&&e.trim()!==``&&(u(!1),d.mutate({text:r.text,instruction:e.trim()},{onSuccess:e=>{o(e),c(e.text)}}))},apply:()=>{if(r&&s.trim()!==``){if(!Ep(e.state.doc,r)){u(!0);return}e.chain().focus().insertContentAt({from:r.from,to:r.to},Op(s)).run(),m()}},discard:f}},Ap={type:`doc`,content:[{type:`paragraph`}]},jp={},Mp=e=>({type:`doc`,content:e.split(/\n{2,}/).map(e=>e.trim()).filter(Boolean).map(e=>({type:`paragraph`,content:[{type:`text`,text:e}]}))}),Np=e=>Ct(e)&&e.type===`doc`,Pp=e=>{if(St(e))return{status:`ok`,doc:Ap};if(typeof e==`string`)return{status:`ok`,doc:Mp(e)};if(!Ct(e)||e.format!==`shapio-richtext`||!Np(e.doc)||typeof e.version!=`number`)return{status:`unreadable`,doc:Ap};if(e.version>1)return{status:`newer`,doc:e.doc,version:e.version};let t=e.doc;for(let n=e.version;n<1;n+=1){let e=jp[n];if(!e)return{status:`unreadable`,doc:Ap};t=e(t)}return{status:`ok`,doc:t}},Fp=e=>{let t={format:a,version:1,doc:e};return St(t)?null:t},Ip=/^(https?:\/\/|mailto:|tel:|\/(?!\/)|#)/i,Lp=e=>{let t=e.trim();return t===``?null:Ip.test(t)?t:/^[a-z][a-z0-9+.-]*:/i.test(t)?null:`https://${t}`},Rp=e=>e.replace(/<!--[\s\S]*?-->/g,``).replace(/<(script|style|template|iframe|object|noscript)[\s\S]*?<\/\1\s*>/gi,``).replace(/<\/?(meta|link|base|o:p|xml)[^>]*>/gi,``),zp=e=>(e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey&&e.key.toLowerCase()===`k`,Bp=({props:e,extensions:t,contentClasses:n,onLinkShortcut:r,refuseFileDrops:i})=>{let{inputId:a,labelId:o,describedBy:s,value:c,onChange:l,onBlur:u,readOnly:d,disabled:f,validation:p}=e,[m]=(0,j.useState)(()=>Pp(c)),h=(0,j.useRef)(c),g=(0,j.useRef)({onChange:l,onBlur:u,onLinkShortcut:r});(0,j.useEffect)(()=>{g.current={onChange:l,onBlur:u,onLinkShortcut:r}});let _=!d&&!f&&m.status===`ok`,v=Qf({extensions:t,content:m.doc,editable:_,immediatelyRender:!0,shouldRerenderOnTransaction:!1,editorProps:{attributes:{id:a,role:`textbox`,"aria-multiline":`true`,"aria-labelledby":o,...s?{"aria-describedby":s}:{},...p.invalid?{"aria-invalid":`true`}:{},..._?{}:{"aria-readonly":`true`},class:n},transformPastedHTML:Rp,handleKeyDown:(e,t)=>zp(t)?(t.preventDefault(),g.current.onLinkShortcut(),!0):!1,handleDrop:(e,t)=>i&&(t.dataTransfer?.files.length??0)>0?(t.preventDefault(),!0):!1},onUpdate:({editor:e})=>{let t=Fp(e.getJSON());h.current=t,g.current.onChange(t)},onBlur:()=>g.current.onBlur()});return(0,j.useEffect)(()=>{bt(c,h.current)||(h.current=c,v.commands.setContent(Pp(c).doc,{emitUpdate:!1}))},[c,v]),(0,j.useEffect)(()=>v.setEditable(_),[v,_]),{editor:v,initial:m,editable:_}},Vp=(e,t)=>({current:{getBoundingClientRect:()=>{let{from:n,to:r}=t??e.state.selection,i=e.state.doc.content.size,a=e.view.coordsAtPos(Math.min(n,i)),o=e.view.coordsAtPos(Math.min(r,i));return new DOMRect(a.left,a.top,Math.max(o.right-a.left,1),o.bottom-a.top)}}}),Hp=({editor:e,active:t,disabled:n,open:r,onOpenChange:i,anchorToSelection:a=!1})=>{let{t:o}=s(),c=(0,j.useId)(),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(!1),m=o(`content.richText.link`),h=t=>{if(t){let t=e.getAttributes(`link`).href;u(typeof t==`string`?t:``),f(!1)}i(t)},g=()=>{let t=Lp(l);if(l.trim()!==``&&!t){f(!0);return}let n=e.chain().focus().extendMarkRange(`link`);(t?n.setLink({href:t}):n.unsetLink()).run(),i(!1)};return(0,M.jsxs)(x,{open:r,onOpenChange:h,children:[a?(0,M.jsx)(ee,{virtualRef:Vp(e)}):(0,M.jsxs)(lt,{children:[(0,M.jsx)(st,{asChild:!0,children:(0,M.jsx)(p,{asChild:!0,children:(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":m,"aria-pressed":t,disabled:n,className:`aria-pressed:bg-accent aria-pressed:text-accent-foreground`,children:(0,M.jsx)(qe,{"aria-hidden":`true`})})})}),(0,M.jsx)(ct,{children:o(`content.richText.shortcut`,{action:m,keys:`Mod+Shift+K`})})]}),(0,M.jsx)(y,{align:`start`,className:`w-80 font-sans`,onCloseAutoFocus:t=>{t.preventDefault(),e.commands.focus()},children:(0,M.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),g()},children:[(0,M.jsx)(ae,{htmlFor:c,children:o(`content.richText.linkUrl`)}),(0,M.jsx)(ie,{id:c,value:l,autoFocus:!0,inputMode:`url`,placeholder:o(`content.richText.linkPlaceholder`),"aria-invalid":d||void 0,"aria-describedby":d?`${c}-error`:void 0,onChange:e=>{u(e.target.value),f(!1)}}),d?(0,M.jsx)(`p`,{id:`${c}-error`,className:`text-meta text-destructive`,children:o(`content.richText.linkInvalid`)}):null,(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[t?(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{e.chain().focus().extendMarkRange(`link`).unsetLink().run(),i(!1)},children:o(`content.richText.removeLink`)}):null,(0,M.jsx)(C,{type:`submit`,size:`sm`,children:o(`content.richText.applyLink`)})]})]})})]})},Up=({editor:e,initial:t,maxLength:n})=>{let{t:r}=s(),i=Jf({editor:e,selector:({editor:e})=>e.state.doc.textContent.length});return(0,M.jsxs)(M.Fragment,{children:[t.status===`newer`?(0,M.jsx)(`p`,{className:`font-sans text-meta text-muted-foreground`,children:r(`content.richText.newerVersion`,{version:t.version})}):null,t.status===`unreadable`?(0,M.jsx)(`p`,{className:`font-sans text-meta text-destructive`,children:r(`content.richText.unreadable`)}):null,n?(0,M.jsx)(`p`,{className:`text-right font-sans text-meta text-muted-foreground tabular-nums`,children:r(`content.fields.characterCount`,{count:i,max:n})}):null]})},Wp=(e,t)=>{if(e.childCount===0)return;let n=e.resolve(Math.min(Math.max(t,0),e.content.size)),r=n.depth===0?Math.min(n.index(0),e.childCount-1):n.index(0),i=e.maybeChild(r);if(!i)return;let a=0;for(let t=0;t<r;t+=1)a+=e.child(t).nodeSize;return{node:i,pos:a,index:r}},Gp=(e,t,n)=>{let{doc:r,selection:i}=e,a=Wp(r,i.from);if(!a)return!1;let o=t===`up`?a.index-1:a.index+1,s=r.maybeChild(o);if(!s)return!1;if(n){let r=i.from-a.pos,o=t===`up`?a.pos-s.nodeSize:a.pos+s.nodeSize,c=e.tr.delete(a.pos,a.pos+a.node.nodeSize);c.insert(o,a.node);let l=c.doc.resolve(Math.min(o+r,c.doc.content.size));c.setSelection(i instanceof E?E.create(c.doc,o):k.near(l)),n(c.scrollIntoView())}return!0},Kp=(e,t,n)=>{let r=E.create(e.state.doc,t);if(e.dispatch(e.state.tr.setSelection(r)),e.dragging={slice:r.content(),move:!0},n.dataTransfer){n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setData(`text/plain`,r.node.textContent);let i=e.nodeDOM(t);i instanceof HTMLElement&&n.dataTransfer.setDragImage(i,0,0)}},qp=G.create({name:`blockMoveKeys`,addKeyboardShortcuts(){return{"Alt-ArrowUp":({editor:e})=>Gp(e.state,`up`,e.view.dispatch),"Alt-ArrowDown":({editor:e})=>Gp(e.state,`down`,e.view.dispatch)}}}),Jp=({editor:e,block:t,onInsert:n,onMenuOpenChange:r})=>{let{t:i}=s(),[a,o]=(0,j.useState)(!1),c=xt(),l=e.state.doc.nodeAt(t.pos);if(!l)return null;let u=t.pos+l.nodeSize;return(0,M.jsxs)(`div`,{className:`absolute top-(--handle-top) -left-16 hidden w-14 items-center justify-end gap-0.5 font-sans lg:flex`,style:{"--handle-top":`${t.top}px`},"data-block-handle":!0,children:[(0,M.jsxs)(nt,{open:a,onOpenChange:e=>{o(e),r(e)},children:[(0,M.jsxs)(lt,{children:[(0,M.jsx)(st,{asChild:!0,children:(0,M.jsx)(et,{asChild:!0,children:(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`text-muted-foreground`,"aria-label":i(`entry.blocks.addAfter`),children:(0,M.jsx)(rt,{"aria-hidden":`true`})})})}),(0,M.jsx)(ct,{children:i(`entry.blocks.addAfter`)})]}),(0,M.jsx)(tt,{align:`start`,className:`w-72`,onCloseAutoFocus:c.onCloseAutoFocus,children:(0,M.jsx)(Be,{onSelect:e=>c.defer(()=>n(e,u))})})]}),(0,M.jsxs)(lt,{children:[(0,M.jsx)(st,{asChild:!0,children:(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-xs`,draggable:!0,className:`cursor-grab text-muted-foreground active:cursor-grabbing`,"aria-label":i(`entry.blocks.drag`),onClick:()=>{e.view.dispatch(e.state.tr.setSelection(E.create(e.state.doc,t.pos))),e.view.focus()},onDragStart:n=>Kp(e.view,t.pos,n.nativeEvent),children:(0,M.jsx)(Je,{"aria-hidden":`true`})})}),(0,M.jsx)(ct,{children:i(`entry.blocks.dragHint`)})]})]})},Yp,Xp;if(typeof WeakMap<`u`){let e=new WeakMap;Yp=t=>e.get(t),Xp=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;Yp=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},Xp=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var q=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return Yp(e)||Xp(e,Zp(e))}};function Zp(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=Qp(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new q(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&$p(s,o,e),s}function Qp(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function $p(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=em(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function em(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function tm(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var nm=new A(`selectingCells`);function rm(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function im(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function am(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function om(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=rm(t.$head)||sm(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function sm(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function cm(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function lm(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function um(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function dm(e,t,n){let r=e.node(-1),i=q.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function fm(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function pm(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function mm(e,t,n){let r=tm(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var J=class e extends D{constructor(e,t=e){let n=e.node(-1),r=q.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new ke(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(cm(r)&&cm(i)&&um(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return k.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=q.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=fm(e,0,l)),u>0&&(e=fm(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(T.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new w(T.from(o),1,1)}replace(e,t=w.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?w.empty:t)}let i=D.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new w(T.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=q.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=q.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=q.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=q.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new hm(this.$anchorCell.pos,this.$headCell.pos)}};J.prototype.visible=!1,D.jsonID(`cell`,J);var hm=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&um(t,n)?new J(t,n):D.near(n,1)}};function gm(e){if(!(e.selection instanceof J))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(io.node(n,n+e.nodeSize,{class:`selectedCell`}))}),z.create(e.doc,t)}function _m({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function vm({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function ym(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof E&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=J.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=J.rowSelection(e,e)}else if(!n){let e=q.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=J.create(i,t+1,n)}}else r instanceof k&&_m(r)?a=k.create(i,r.from):r instanceof k&&vm(r)&&(a=k.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var bm=new A(`fix-tables`);function xm(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?xm(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function Sm(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=Cm(e,t,r,n))};return t?t.doc!=e.doc&&xm(t.doc,e.doc,0,r):e.doc.descendants(r),n}function Cm(e,t,n,r){let i=q.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,fm(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=tm(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(bm,{fixTables:!0})}function wm(e){let t=e.selection,n=om(e),r=n.node(-1),i=n.start(-1),a=q.get(r);return{...t instanceof J?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function Tm(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;mm(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,pm(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?tm(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function Em(e,t){if(!am(e))return!1;if(t){let n=wm(e);t(Tm(e.tr,n,n.left))}return!0}function Dm(e,t){if(!am(e))return!1;if(t){let n=wm(e);t(Tm(e.tr,n,n.right))}return!0}function Om(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,fm(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function km(e,t){if(!am(e))return!1;if(t){let n=wm(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;Om(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=q.get(e)}t(r)}return!0}function Am(e,t,n){let r=tm(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function jm(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;Am(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?tm(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,tm(r.type.schema).row.create(null,o)),e}function Mm(e,t){if(!am(e))return!1;if(t){let n=wm(e);t(jm(e.tr,n,n.top))}return!0}function Nm(e,t){if(!am(e))return!1;if(t){let n=wm(e);t(jm(e.tr,n,n.bottom))}return!0}function Pm(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function Fm(e,t){if(!am(e))return!1;if(t){let n=wm(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;Pm(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=q.get(n.table)}t(r)}return!0}function Im(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function Lm({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function Rm(e,t){let n=e.selection;if(!(n instanceof J)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=wm(e),{map:i}=r;if(Lm(i,r))return!1;if(t){let n=e.tr,a={},o=T.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!a[l]&&u){if(a[l]=!0,s==null)s=l,c=u;else{Im(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...pm(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=Im(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new J(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function zm(e,t){let n=tm(e.schema);return Bm(({node:e})=>n[e.type.spec.tableRole])(e,t)}function Bm(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof J){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=im(r.$from),!i)return!1;a=rm(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=wm(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)(r!=l.left||t!=l.top)&&u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof J&&u.setSelection(new J(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function Vm(e,t){return function(n,r){if(!am(n))return!1;let i=om(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof J?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function Hm(e){return function(t,n){if(!am(t))return!1;if(n){let r=tm(t.schema),i=wm(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Um(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Wm(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Hm(e):function(t,n){if(!am(t))return!1;if(n){let r=tm(t.schema),i=wm(t),a=t.tr,o=Um(`row`,i,r),s=Um(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}Wm(`row`,{useDeprecatedLogic:!0}),Wm(`column`,{useDeprecatedLogic:!0});var Gm=Wm(`cell`,{useDeprecatedLogic:!0});function Km(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function qm(e){return function(t,n){if(!am(t))return!1;let r=Km(om(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(k.between(e,lm(e))).scrollIntoView())}return!0}}function Jm(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Ym(e,t){let n=e.selection;if(!(n instanceof J))return!1;if(t){let r=e.tr,i=tm(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new w(i,0,0))}),r.docChanged&&t(r)}return!0}function Xm(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=Qm(tm(o).row,new w(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?Qm(tm(o).row,new w(t,n,r)).content:t);else return null;return Zm(o,s)}function Zm(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(T.empty),n[i]<r){let a=tm(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(T.from(o))}return{height:t.length,width:r,rows:t}}function Qm(e,t){let n=e.createAndFill();return new Ve(n).replace(0,n.content.size,t).doc}function $m({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(fm(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(T.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(T.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function eh(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=tm(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,T.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function th(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function nh(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,fm(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(fm(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function rh(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=q.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=q.get(a),f=d.mapping.maps.length}eh(d,o,a,n,l,u,f)&&p(),th(d,o,a,n,c,l,s,f)&&p(),th(d,o,a,n,c,l,u,f)&&p(),nh(d,o,a,n,s,u,c,f)&&p(),nh(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new w(i.rows[e-s],0,0))}p(),d.setSelection(new J(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var ih=ts({ArrowLeft:oh(`horiz`,-1),ArrowRight:oh(`horiz`,1),ArrowUp:oh(`vert`,-1),ArrowDown:oh(`vert`,1),"Shift-ArrowLeft":sh(`horiz`,-1),"Shift-ArrowRight":sh(`horiz`,1),"Shift-ArrowUp":sh(`vert`,-1),"Shift-ArrowDown":sh(`vert`,1),Backspace:Ym,"Mod-Backspace":Ym,Delete:Ym,"Mod-Delete":Ym});function ah(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function oh(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof J)return ah(n,r,D.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=dh(i,e,t);if(o==null)return!1;if(e==`horiz`)return ah(n,r,D.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=dm(i,e,t),s;return s=a?D.near(a,1):t<0?D.near(n.doc.resolve(i.before(-1)),-1):D.near(n.doc.resolve(i.after(-1)),1),ah(n,r,s)}}}function sh(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof J)o=a;else{let r=dh(i,e,t);if(r==null)return!1;o=new J(n.doc.resolve(r))}let s=dm(o.$headCell,e,t);return s?ah(n,r,new J(o.$anchorCell,s)):!1}}function ch(e,t){let n=e.state.doc,r=rm(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new J(r))),!0):!1}function lh(e,t,n){if(!am(e.state))return!1;let r=Xm(n),i=e.state.selection;if(i instanceof J){r||={width:1,height:1,rows:[T.from(Qm(tm(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=q.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=$m(r,o.right-o.left,o.bottom-o.top),rh(e.state,e.dispatch,a,o,r),!0}if(r){let t=om(e.state),n=t.start(-1);return rh(e.state,e.dispatch,n,q.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function uh(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=fh(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof J)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=rm(e.state.selection.$anchor))!=null&&ph(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=ph(e,n),i=nm.getState(e.state)==null;if(!r||!um(t,r)){if(i)r=t;else return}let a=new J(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(nm,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),nm.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(nm,-1))}function o(r){let o=r,s=nm.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(fh(e,o.target)!=n&&(c=ph(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function dh(e,t,n){if(!(e.state.selection instanceof k))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function fh(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function ph(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&rm(e.state.doc.resolve(r))||rm(e.state.doc.resolve(i))}var mh=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),hh(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type&&(this.node=e,hh(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function hh(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var gh=new A(`tableColumnResizing`);function _h({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=mh,lastColumnResizable:i=!0}={}){let a=new O({key:gh,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=tm(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new vh(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=gh.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{yh(t,n,e,i)},mouseleave:e=>{bh(e)},mousedown:(e,r)=>{xh(e,r,t,n)}},decorations:e=>{let t=gh.getState(e);if(t&&t.activeHandle>-1)return Ah(e,t.activeHandle)},nodeViews:{}}});return a}var vh=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(gh);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return cm(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function yh(e,t,n,r){if(!e.editable)return;let i=gh.getState(e.state);if(i&&!i.dragging){let a=Ch(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=wh(e,t,`left`,n):i-t.clientX<=n&&(o=wh(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=q.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}Eh(e,o)}}}function bh(e){if(!e.editable)return;let t=gh.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Eh(e,-1)}function xh(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=gh.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=Sh(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(gh,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=gh.getState(e.state);r?.dragging&&(Dh(e,r.activeHandle,Th(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(gh,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=gh.getState(e.state);if(i&&i.dragging){let a=Th(i.dragging,t,n);Oh(e,i.activeHandle,a,r)}}return Oh(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function Sh(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function Ch(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function wh(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=rm(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=q.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function Th(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function Eh(e,t){e.dispatch(e.state.tr.setMeta(gh,{setHandle:t}))}function Dh(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=q.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():kh(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function Oh(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=q.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&hh(a,c.firstChild,c,r,s,n)}function kh(e){return Array(e).fill(0)}function Ah(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return z.empty;let a=q.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,gh.getState(e)?.dragging&&n.push(io.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(io.widget(s,c))}}return z.create(e.doc,n)}function jh({allowTableNodeSelection:e=!1}={}){return new O({key:nm,state:{init(){return null},apply(e,t){let n=e.getMeta(nm);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:gm,handleDOMEvents:{mousedown:uh},createSelectionBetween(e){return nm.getState(e.state)==null?null:e.state.selection},handleTripleClick:ch,handleKeyDown:ih,handlePaste:lh},appendTransaction(t,n,r){return ym(r,Sm(r,n),e)}})}function Mh(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var Nh=class{get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(v(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(re(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(te(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(h(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(m(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(g(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(_(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(f(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){var e;let{selection:t}=this.editor.state,n=this.getReferencedVirtualElement?.call(this);if(n)return n;if(!((e=this.view)!=null&&(e=e.dom)!=null&&e.parentNode))return;let r=zl(this.view,t.from,t.to),i={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(t instanceof E){let e=this.view.nodeDOM(t.from),n=e.dataset.nodeViewWrapper?e:e.querySelector(`[data-node-view-wrapper]`);n&&(e=n),e&&(i={getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>[e.getBoundingClientRect()]})}if(t instanceof J){let{$anchorCell:e,$headCell:n}=t,r=e?e.pos:n.pos,a=n?n.pos:e.pos,o=this.view.nodeDOM(r),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():Mh(o.getBoundingClientRect(),s.getBoundingClientRect());i={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return i}constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&$s(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);(n||r)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&b(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(this.isVisible&&!this.editor.isDestroyed&&this.element.isConnected){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Ph=e=>new O({key:typeof e.pluginKey==`string`?new A(e.pluginKey):e.pluginKey,view:t=>new Nh({view:t,...e})});G.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Ph({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Fh=class{getTextContent(e){return hl(e,{textSerializers:gl(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(v(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(re(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(te(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(h(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(m(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(g(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(_(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(f(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e;if(!((e=this.view)!=null&&(e=e.dom)!=null&&e.parentNode))return;let{selection:t}=this.editor.state,n=zl(this.view,t.from,t.to);b({getBoundingClientRect:()=>n,getClientRects:()=>[n]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Ih=e=>new O({key:typeof e.pluginKey==`string`?new A(e.pluginKey):e.pluginKey,view:t=>new Fh({view:t,...e})});G.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[Ih({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Lh(e,t){return e??new A(t)}var Rh=typeof window<`u`?j.useLayoutEffect:j.useEffect,zh=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),Bh=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),Vh=new Set([`children`,`className`,`style`]),Hh=new Set([`tabIndex`]),Uh=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),Wh={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function Gh(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function Kh(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function qh(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||Uh.has(e)}function Jh(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Yh(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:Wh[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function Xh(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function Zh(e){return Hh.has(e)}function Qh(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function $h(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function eg(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||Bh.has(e)?String(t):`${t}px`}function tg(e,t){zh.has(t)||e.style.removeProperty(Jh(t))}function ng(e,t,n){zh.has(t)||e.style.setProperty(Jh(t),eg(t,n))}function rg(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(Vh.has(r)||!qh(r)||Gh(r,t[r])||Gh(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=Kh(r);if(a==null||a===!1){Zh(r)&&$h(e,r),e.removeAttribute(o);return}if(a===!0){Zh(r)&&Qh(e,r,!0),e.setAttribute(o,``);return}if(Zh(r)){Qh(e,r,a);return}e.setAttribute(o,String(a))})}function ig(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function ag(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){tg(e,t);return}ng(e,t,a)}})}function og(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!Gh(t,n))return;let{eventName:i,options:a}=Yh(t),o=t=>{n(Xh(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function sg(e,t){let n=(0,j.useRef)({}),r=(0,j.useRef)([]);Rh(()=>{let i=n.current;return ig(e,i.className,t.className),ag(e,i.style,t.style),rg(e,i,t),r.current=og(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var cg=j.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,j.useRef)(document.createElement(`div`)),f=(0,j.useRef)(Lh(e,`bubbleMenu`)).current;sg(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=ep(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,j.useRef)(h);g.current=h;let[_,v]=(0,j.useState)(!1),y=(0,j.useRef)(!0);return(0,j.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=Ph({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,j.useEffect)(()=>{if(_&&m&&!m.isDestroyed){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,Nt.createPortal)(c,d.current)});j.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,j.useRef)(document.createElement(`div`)),d=(0,j.useRef)(Lh(e,`floatingMenu`)).current;sg(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=ep(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,j.useRef)(m);h.current=m;let[g,_]=(0,j.useState)(!1),v=(0,j.useRef)(!0);return(0,j.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=Ih({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,j.useEffect)(()=>{if(g&&p&&!p.isDestroyed){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,Nt.createPortal)(s,u.current)});var Y=({icon:e,label:t,keys:n,pressed:r,disabled:i,onClick:a})=>{let{t:o}=s();return(0,M.jsxs)(lt,{children:[(0,M.jsx)(st,{asChild:!0,children:(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":t,"aria-pressed":r,disabled:i,className:`aria-pressed:bg-accent aria-pressed:text-accent-foreground`,onClick:a,children:(0,M.jsx)(e,{"aria-hidden":`true`})})}),(0,M.jsx)(ct,{children:n?o(`content.richText.shortcut`,{action:t,keys:n}):t})]})},lg=({editor:e})=>{let{selection:t}=e.state;return e.isEditable&&!t.empty&&!(t instanceof E)&&!e.isActive(`codeBlock`)},ug=({editor:e,onLink:t,onRewrite:n})=>{let{t:r}=s(),i=Jf({editor:e,selector:({editor:e})=>({bold:e.isActive(`bold`),italic:e.isActive(`italic`),code:e.isActive(`code`),link:e.isActive(`link`),heading2:e.isActive(`heading`,{level:2}),heading3:e.isActive(`heading`,{level:3}),blockquote:e.isActive(`blockquote`),bulletList:e.isActive(`bulletList`)})}),a=()=>e.chain().focus();return(0,M.jsx)(cg,{editor:e,shouldShow:lg,options:{placement:`top`},children:(0,M.jsxs)(`div`,{role:`toolbar`,"aria-label":r(`content.richText.toolbar`),className:`flex items-center gap-0.5 rounded-xl border bg-popover p-1 font-sans text-popover-foreground shadow-md`,children:[(0,M.jsx)(Y,{icon:Ot,label:r(`content.richText.bold`),keys:`Mod+B`,pressed:i.bold,disabled:!1,onClick:()=>a().toggleBold().run()}),(0,M.jsx)(Y,{icon:At,label:r(`content.richText.italic`),keys:`Mod+I`,pressed:i.italic,disabled:!1,onClick:()=>a().toggleItalic().run()}),(0,M.jsx)(Y,{icon:Ke,label:r(`content.richText.code`),keys:`Mod+E`,pressed:i.code,disabled:!1,onClick:()=>a().toggleCode().run()}),(0,M.jsx)(Y,{icon:qe,label:r(`content.richText.link`),keys:`Mod+Shift+K`,pressed:i.link,disabled:!1,onClick:t}),(0,M.jsx)(pe,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:ge,label:r(`entry.blocks.heading`),pressed:i.heading2,disabled:!1,onClick:()=>a().toggleHeading({level:2}).run()}),(0,M.jsx)(Y,{icon:Ge,label:r(`entry.blocks.subheading`),pressed:i.heading3,disabled:!1,onClick:()=>a().toggleHeading({level:3}).run()}),(0,M.jsx)(Y,{icon:Se,label:r(`content.richText.blockquote`),keys:`Mod+Shift+B`,pressed:i.blockquote,disabled:!1,onClick:()=>a().toggleBlockquote().run()}),(0,M.jsx)(Y,{icon:$e,label:r(`content.richText.bulletList`),keys:`Mod+Shift+8`,pressed:i.bulletList,disabled:!1,onClick:()=>a().toggleBulletList().run()}),n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(pe,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:it,label:r(`assist.rewrite.open`),disabled:!1,onClick:n})]}):null]})})},dg=({key:e,editor:t,onPaste:n,onDrop:r,allowedMimeTypes:i,consumePasteEvent:a})=>new O({key:e||new A(`fileHandler`),props:{handleDrop(e,n){if(!r||n.dataTransfer?.types.includes(`application/x-prosemirror-slice`)||!n.dataTransfer?.files.length)return!1;let a=e.posAtCoords({left:n.clientX,top:n.clientY}),o=Array.from(n.dataTransfer.files);return i&&(o=o.filter(e=>i.includes(e.type))),o.length!==0&&(n.preventDefault(),n.stopPropagation(),r(t,o,a?.pos||0),!0)},handlePaste(e,r){if(!n||!r.clipboardData?.files.length)return!1;let o=Array.from(r.clipboardData.files),s=r.clipboardData.getData(`text/html`);return i&&(o=o.filter(e=>i.includes(e.type))),!(o.length===0||(r.preventDefault(),r.stopPropagation(),n(t,o,s),s.length>0&&!a))}}}),fg=G.create({name:`fileHandler`,addOptions(){return{onPaste:void 0,onDrop:void 0,allowedMimeTypes:void 0,consumePasteEvent:!1}},addProseMirrorPlugins(){return[dg({key:new A(this.name),editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onDrop:this.options.onDrop,onPaste:this.options.onPaste,consumePasteEvent:this.options.consumePasteEvent})]}}),pg=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,mg=`ελ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`,hg=`numeric`,gg=`ascii`,_g=`alpha`,vg=`asciinumeric`,yg=`alphanumeric`,bg=`domain`,xg=`emoji`,Sg=`scheme`,Cg=`slashscheme`,wg=`whitespace`;function Tg(e,t){return e in t||(t[e]=[]),t[e]}function Eg(e,t,n){t[hg]&&(t[vg]=!0,t[yg]=!0),t[gg]&&(t[vg]=!0,t[_g]=!0),t[vg]&&(t[yg]=!0),t[_g]&&(t[yg]=!0),t[yg]&&(t[bg]=!0),t[xg]&&(t[bg]=!0);for(let r in t){let t=Tg(r,n);t.indexOf(e)<0&&t.push(e)}}function Dg(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function Og(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Og.groups={},Og.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=Og.groups;let i;return t&&t.j?i=t:(i=new Og(t),n&&r&&Eg(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=Og.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new Og,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new Og,a&&(r&&(o.t&&typeof o.t==`string`?Eg(a,Object.assign(Dg(o.t,r),n),r):n&&Eg(a,n,r)),o.t=a),i.j[e]=o,o}};var X=(e,t,n,r,i)=>e.ta(t,n,r,i),Z=(e,t,n,r,i)=>e.tr(t,n,r,i),kg=(e,t,n,r,i)=>e.ts(t,n,r,i),Q=(e,t,n,r,i)=>e.tt(t,n,r,i),Ag=`WORD`,jg=`UWORD`,Mg=`ASCIINUMERICAL`,Ng=`ALPHANUMERICAL`,Pg=`LOCALHOST`,Fg=`TLD`,Ig=`UTLD`,Lg=`SCHEME`,Rg=`SLASH_SCHEME`,zg=`NUM`,Bg=`WS`,Vg=`NL`,Hg=`OPENBRACE`,Ug=`CLOSEBRACE`,Wg=`OPENBRACKET`,Gg=`CLOSEBRACKET`,Kg=`OPENPAREN`,qg=`CLOSEPAREN`,Jg=`OPENANGLEBRACKET`,Yg=`CLOSEANGLEBRACKET`,Xg=`FULLWIDTHLEFTPAREN`,Zg=`FULLWIDTHRIGHTPAREN`,Qg=`LEFTCORNERBRACKET`,$g=`RIGHTCORNERBRACKET`,e_=`LEFTWHITECORNERBRACKET`,t_=`RIGHTWHITECORNERBRACKET`,n_=`FULLWIDTHLESSTHAN`,r_=`FULLWIDTHGREATERTHAN`,i_=`AMPERSAND`,a_=`APOSTROPHE`,o_=`ASTERISK`,s_=`AT`,c_=`BACKSLASH`,l_=`BACKTICK`,u_=`CARET`,d_=`COLON`,f_=`COMMA`,p_=`DOLLAR`,m_=`DOT`,h_=`EQUALS`,g_=`EXCLAMATION`,__=`HYPHEN`,v_=`PERCENT`,y_=`PIPE`,b_=`PLUS`,x_=`POUND`,S_=`QUERY`,C_=`QUOTE`,w_=`FULLWIDTHMIDDLEDOT`,T_=`SEMI`,E_=`SLASH`,D_=`TILDE`,O_=`UNDERSCORE`,k_=`EMOJI`,A_=`SYM`,j_=Object.freeze({__proto__:null,ALPHANUMERICAL:Ng,AMPERSAND:i_,APOSTROPHE:a_,ASCIINUMERICAL:Mg,ASTERISK:o_,AT:s_,BACKSLASH:c_,BACKTICK:l_,CARET:u_,CLOSEANGLEBRACKET:Yg,CLOSEBRACE:Ug,CLOSEBRACKET:Gg,CLOSEPAREN:qg,COLON:d_,COMMA:f_,DOLLAR:p_,DOT:m_,EMOJI:k_,EQUALS:h_,EXCLAMATION:g_,FULLWIDTHGREATERTHAN:r_,FULLWIDTHLEFTPAREN:Xg,FULLWIDTHLESSTHAN:n_,FULLWIDTHMIDDLEDOT:w_,FULLWIDTHRIGHTPAREN:Zg,HYPHEN:__,LEFTCORNERBRACKET:Qg,LEFTWHITECORNERBRACKET:e_,LOCALHOST:Pg,NL:Vg,NUM:zg,OPENANGLEBRACKET:Jg,OPENBRACE:Hg,OPENBRACKET:Wg,OPENPAREN:Kg,PERCENT:v_,PIPE:y_,PLUS:b_,POUND:x_,QUERY:S_,QUOTE:C_,RIGHTCORNERBRACKET:$g,RIGHTWHITECORNERBRACKET:t_,SCHEME:Lg,SEMI:T_,SLASH:E_,SLASH_SCHEME:Rg,SYM:A_,TILDE:D_,TLD:Fg,UNDERSCORE:O_,UTLD:Ig,UWORD:jg,WORD:Ag,WS:Bg}),M_=/[a-z]/,N_=/\p{L}/u,P_=/\p{Emoji}/u,F_=/\d/,I_=/\s/,L_=`\r`,R_=`
91
+ `).trim().split(/\n{2,}/).filter(e=>e.trim()!==``);return t.length<=1?Dp(t[0]??``):t.map(e=>({type:`paragraph`,content:Dp(e)}))},kp=e=>{let[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(!1),d=ht(),f=()=>{o(null),c(``),u(!1),d.reset()},p=()=>{let t=Tp(e.state);t&&(f(),i(t),n(!0))},m=()=>{n(!1),f()};return{open:t,captured:r,tooLong:(r?.text.length??0)>gt,result:a,draft:s,setDraft:c,stale:l,pending:d.isPending,error:d.error,start:p,close:m,run:e=>{r&&e.trim()!==``&&(u(!1),d.mutate({text:r.text,instruction:e.trim()},{onSuccess:e=>{o(e),c(e.text)}}))},apply:()=>{if(r&&s.trim()!==``){if(!Ep(e.state.doc,r)){u(!0);return}e.chain().focus().insertContentAt({from:r.from,to:r.to},Op(s)).run(),m()}},discard:f}},Ap={type:`doc`,content:[{type:`paragraph`}]},jp={},Mp=e=>({type:`doc`,content:e.split(/\n{2,}/).map(e=>e.trim()).filter(Boolean).map(e=>({type:`paragraph`,content:[{type:`text`,text:e}]}))}),Np=e=>Ct(e)&&e.type===`doc`,Pp=e=>{if(St(e))return{status:`ok`,doc:Ap};if(typeof e==`string`)return{status:`ok`,doc:Mp(e)};if(!Ct(e)||e.format!==`shapio-richtext`||!Np(e.doc)||typeof e.version!=`number`)return{status:`unreadable`,doc:Ap};if(e.version>1)return{status:`newer`,doc:e.doc,version:e.version};let t=e.doc;for(let n=e.version;n<1;n+=1){let e=jp[n];if(!e)return{status:`unreadable`,doc:Ap};t=e(t)}return{status:`ok`,doc:t}},Fp=e=>{let t={format:i,version:1,doc:e};return St(t)?null:t},Ip=/^(https?:\/\/|mailto:|tel:|\/(?!\/)|#)/i,Lp=e=>{let t=e.trim();return t===``?null:Ip.test(t)?t:/^[a-z][a-z0-9+.-]*:/i.test(t)?null:`https://${t}`},Rp=e=>e.replace(/<!--[\s\S]*?-->/g,``).replace(/<(script|style|template|iframe|object|noscript)[\s\S]*?<\/\1\s*>/gi,``).replace(/<\/?(meta|link|base|o:p|xml)[^>]*>/gi,``),zp=e=>(e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey&&e.key.toLowerCase()===`k`,Bp=({props:e,extensions:t,contentClasses:n,onLinkShortcut:r,refuseFileDrops:i})=>{let{inputId:a,labelId:o,describedBy:s,value:c,onChange:l,onBlur:u,readOnly:d,disabled:f,validation:p}=e,[m]=(0,j.useState)(()=>Pp(c)),h=(0,j.useRef)(c),g=(0,j.useRef)({onChange:l,onBlur:u,onLinkShortcut:r});(0,j.useEffect)(()=>{g.current={onChange:l,onBlur:u,onLinkShortcut:r}});let _=!d&&!f&&m.status===`ok`,v=Qf({extensions:t,content:m.doc,editable:_,immediatelyRender:!0,shouldRerenderOnTransaction:!1,editorProps:{attributes:{id:a,role:`textbox`,"aria-multiline":`true`,"aria-labelledby":o,...s?{"aria-describedby":s}:{},...p.invalid?{"aria-invalid":`true`}:{},..._?{}:{"aria-readonly":`true`},class:n},transformPastedHTML:Rp,handleKeyDown:(e,t)=>zp(t)?(t.preventDefault(),g.current.onLinkShortcut(),!0):!1,handleDrop:(e,t)=>i&&(t.dataTransfer?.files.length??0)>0?(t.preventDefault(),!0):!1},onUpdate:({editor:e})=>{let t=Fp(e.getJSON());h.current=t,g.current.onChange(t)},onBlur:()=>g.current.onBlur()});return(0,j.useEffect)(()=>{bt(c,h.current)||(h.current=c,v.commands.setContent(Pp(c).doc,{emitUpdate:!1}))},[c,v]),(0,j.useEffect)(()=>v.setEditable(_),[v,_]),{editor:v,initial:m,editable:_}},Vp=(e,t)=>({current:{getBoundingClientRect:()=>{let{from:n,to:r}=t??e.state.selection,i=e.state.doc.content.size,a=e.view.coordsAtPos(Math.min(n,i)),o=e.view.coordsAtPos(Math.min(r,i));return new DOMRect(a.left,a.top,Math.max(o.right-a.left,1),o.bottom-a.top)}}}),Hp=({editor:e,active:t,disabled:n,open:r,onOpenChange:i,anchorToSelection:a=!1})=>{let{t:o}=s(),c=(0,j.useId)(),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(!1),m=o(`content.richText.link`),h=t=>{if(t){let t=e.getAttributes(`link`).href;u(typeof t==`string`?t:``),f(!1)}i(t)},g=()=>{let t=Lp(l);if(l.trim()!==``&&!t){f(!0);return}let n=e.chain().focus().extendMarkRange(`link`);(t?n.setLink({href:t}):n.unsetLink()).run(),i(!1)};return(0,M.jsxs)(x,{open:r,onOpenChange:h,children:[a?(0,M.jsx)(ee,{virtualRef:Vp(e)}):(0,M.jsxs)(lt,{children:[(0,M.jsx)(st,{asChild:!0,children:(0,M.jsx)(p,{asChild:!0,children:(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":m,"aria-pressed":t,disabled:n,className:`aria-pressed:bg-accent aria-pressed:text-accent-foreground`,children:(0,M.jsx)(qe,{"aria-hidden":`true`})})})}),(0,M.jsx)(ct,{children:o(`content.richText.shortcut`,{action:m,keys:`Mod+Shift+K`})})]}),(0,M.jsx)(y,{align:`start`,className:`w-80 font-sans`,onCloseAutoFocus:t=>{t.preventDefault(),e.commands.focus()},children:(0,M.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),g()},children:[(0,M.jsx)(ae,{htmlFor:c,children:o(`content.richText.linkUrl`)}),(0,M.jsx)(ie,{id:c,value:l,autoFocus:!0,inputMode:`url`,placeholder:o(`content.richText.linkPlaceholder`),"aria-invalid":d||void 0,"aria-describedby":d?`${c}-error`:void 0,onChange:e=>{u(e.target.value),f(!1)}}),d?(0,M.jsx)(`p`,{id:`${c}-error`,className:`text-meta text-destructive`,children:o(`content.richText.linkInvalid`)}):null,(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[t?(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{e.chain().focus().extendMarkRange(`link`).unsetLink().run(),i(!1)},children:o(`content.richText.removeLink`)}):null,(0,M.jsx)(C,{type:`submit`,size:`sm`,children:o(`content.richText.applyLink`)})]})]})})]})},Up=({editor:e,initial:t,maxLength:n})=>{let{t:r}=s(),i=Jf({editor:e,selector:({editor:e})=>e.state.doc.textContent.length});return(0,M.jsxs)(M.Fragment,{children:[t.status===`newer`?(0,M.jsx)(`p`,{className:`font-sans text-meta text-muted-foreground`,children:r(`content.richText.newerVersion`,{version:t.version})}):null,t.status===`unreadable`?(0,M.jsx)(`p`,{className:`font-sans text-meta text-destructive`,children:r(`content.richText.unreadable`)}):null,n?(0,M.jsx)(`p`,{className:`text-right font-sans text-meta text-muted-foreground tabular-nums`,children:r(`content.fields.characterCount`,{count:i,max:n})}):null]})},Wp=(e,t)=>{if(e.childCount===0)return;let n=e.resolve(Math.min(Math.max(t,0),e.content.size)),r=n.depth===0?Math.min(n.index(0),e.childCount-1):n.index(0),i=e.maybeChild(r);if(!i)return;let a=0;for(let t=0;t<r;t+=1)a+=e.child(t).nodeSize;return{node:i,pos:a,index:r}},Gp=(e,t,n)=>{let{doc:r,selection:i}=e,a=Wp(r,i.from);if(!a)return!1;let o=t===`up`?a.index-1:a.index+1,s=r.maybeChild(o);if(!s)return!1;if(n){let r=i.from-a.pos,o=t===`up`?a.pos-s.nodeSize:a.pos+s.nodeSize,c=e.tr.delete(a.pos,a.pos+a.node.nodeSize);c.insert(o,a.node);let l=c.doc.resolve(Math.min(o+r,c.doc.content.size));c.setSelection(i instanceof E?E.create(c.doc,o):k.near(l)),n(c.scrollIntoView())}return!0},Kp=(e,t,n)=>{let r=E.create(e.state.doc,t);if(e.dispatch(e.state.tr.setSelection(r)),e.dragging={slice:r.content(),move:!0},n.dataTransfer){n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setData(`text/plain`,r.node.textContent);let i=e.nodeDOM(t);i instanceof HTMLElement&&n.dataTransfer.setDragImage(i,0,0)}},qp=G.create({name:`blockMoveKeys`,addKeyboardShortcuts(){return{"Alt-ArrowUp":({editor:e})=>Gp(e.state,`up`,e.view.dispatch),"Alt-ArrowDown":({editor:e})=>Gp(e.state,`down`,e.view.dispatch)}}}),Jp=({editor:e,block:t,onInsert:n,onMenuOpenChange:r})=>{let{t:i}=s(),[a,o]=(0,j.useState)(!1),c=xt(),l=e.state.doc.nodeAt(t.pos);if(!l)return null;let u=t.pos+l.nodeSize;return(0,M.jsxs)(`div`,{className:`absolute top-(--handle-top) -left-16 hidden w-14 items-center justify-end gap-0.5 font-sans lg:flex`,style:{"--handle-top":`${t.top}px`},"data-block-handle":!0,children:[(0,M.jsxs)(nt,{open:a,onOpenChange:e=>{o(e),r(e)},children:[(0,M.jsxs)(lt,{children:[(0,M.jsx)(st,{asChild:!0,children:(0,M.jsx)(et,{asChild:!0,children:(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`text-muted-foreground`,"aria-label":i(`entry.blocks.addAfter`),children:(0,M.jsx)(rt,{"aria-hidden":`true`})})})}),(0,M.jsx)(ct,{children:i(`entry.blocks.addAfter`)})]}),(0,M.jsx)(tt,{align:`start`,className:`w-72`,onCloseAutoFocus:c.onCloseAutoFocus,children:(0,M.jsx)(Be,{onSelect:e=>c.defer(()=>n(e,u))})})]}),(0,M.jsxs)(lt,{children:[(0,M.jsx)(st,{asChild:!0,children:(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-xs`,draggable:!0,className:`cursor-grab text-muted-foreground active:cursor-grabbing`,"aria-label":i(`entry.blocks.drag`),onClick:()=>{e.view.dispatch(e.state.tr.setSelection(E.create(e.state.doc,t.pos))),e.view.focus()},onDragStart:n=>Kp(e.view,t.pos,n.nativeEvent),children:(0,M.jsx)(Je,{"aria-hidden":`true`})})}),(0,M.jsx)(ct,{children:i(`entry.blocks.dragHint`)})]})]})},Yp,Xp;if(typeof WeakMap<`u`){let e=new WeakMap;Yp=t=>e.get(t),Xp=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;Yp=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},Xp=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var q=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return Yp(e)||Xp(e,Zp(e))}};function Zp(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=Qp(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new q(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&$p(s,o,e),s}function Qp(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function $p(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=em(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function em(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function tm(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var nm=new A(`selectingCells`);function rm(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function im(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function am(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function om(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=rm(t.$head)||sm(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function sm(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function cm(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function lm(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function um(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function dm(e,t,n){let r=e.node(-1),i=q.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function fm(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function pm(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function mm(e,t,n){let r=tm(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var J=class e extends D{constructor(e,t=e){let n=e.node(-1),r=q.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new ke(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(cm(r)&&cm(i)&&um(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return k.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=q.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=fm(e,0,l)),u>0&&(e=fm(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(T.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new w(T.from(o),1,1)}replace(e,t=w.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?w.empty:t)}let i=D.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new w(T.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=q.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=q.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=q.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=q.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new hm(this.$anchorCell.pos,this.$headCell.pos)}};J.prototype.visible=!1,D.jsonID(`cell`,J);var hm=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&um(t,n)?new J(t,n):D.near(n,1)}};function gm(e){if(!(e.selection instanceof J))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(io.node(n,n+e.nodeSize,{class:`selectedCell`}))}),z.create(e.doc,t)}function _m({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function vm({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function ym(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof E&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=J.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=J.rowSelection(e,e)}else if(!n){let e=q.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=J.create(i,t+1,n)}}else r instanceof k&&_m(r)?a=k.create(i,r.from):r instanceof k&&vm(r)&&(a=k.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var bm=new A(`fix-tables`);function xm(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?xm(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function Sm(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=Cm(e,t,r,n))};return t?t.doc!=e.doc&&xm(t.doc,e.doc,0,r):e.doc.descendants(r),n}function Cm(e,t,n,r){let i=q.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,fm(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=tm(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(bm,{fixTables:!0})}function wm(e){let t=e.selection,n=om(e),r=n.node(-1),i=n.start(-1),a=q.get(r);return{...t instanceof J?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function Tm(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;mm(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,pm(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?tm(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function Em(e,t){if(!am(e))return!1;if(t){let n=wm(e);t(Tm(e.tr,n,n.left))}return!0}function Dm(e,t){if(!am(e))return!1;if(t){let n=wm(e);t(Tm(e.tr,n,n.right))}return!0}function Om(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,fm(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function km(e,t){if(!am(e))return!1;if(t){let n=wm(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;Om(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=q.get(e)}t(r)}return!0}function Am(e,t,n){let r=tm(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function jm(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;Am(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?tm(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,tm(r.type.schema).row.create(null,o)),e}function Mm(e,t){if(!am(e))return!1;if(t){let n=wm(e);t(jm(e.tr,n,n.top))}return!0}function Nm(e,t){if(!am(e))return!1;if(t){let n=wm(e);t(jm(e.tr,n,n.bottom))}return!0}function Pm(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function Fm(e,t){if(!am(e))return!1;if(t){let n=wm(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;Pm(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=q.get(n.table)}t(r)}return!0}function Im(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function Lm({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function Rm(e,t){let n=e.selection;if(!(n instanceof J)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=wm(e),{map:i}=r;if(Lm(i,r))return!1;if(t){let n=e.tr,a={},o=T.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!a[l]&&u){if(a[l]=!0,s==null)s=l,c=u;else{Im(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...pm(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=Im(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new J(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function zm(e,t){let n=tm(e.schema);return Bm(({node:e})=>n[e.type.spec.tableRole])(e,t)}function Bm(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof J){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=im(r.$from),!i)return!1;a=rm(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=wm(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)(r!=l.left||t!=l.top)&&u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof J&&u.setSelection(new J(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function Vm(e,t){return function(n,r){if(!am(n))return!1;let i=om(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof J?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function Hm(e){return function(t,n){if(!am(t))return!1;if(n){let r=tm(t.schema),i=wm(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Um(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Wm(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Hm(e):function(t,n){if(!am(t))return!1;if(n){let r=tm(t.schema),i=wm(t),a=t.tr,o=Um(`row`,i,r),s=Um(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}Wm(`row`,{useDeprecatedLogic:!0}),Wm(`column`,{useDeprecatedLogic:!0});var Gm=Wm(`cell`,{useDeprecatedLogic:!0});function Km(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function qm(e){return function(t,n){if(!am(t))return!1;let r=Km(om(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(k.between(e,lm(e))).scrollIntoView())}return!0}}function Jm(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Ym(e,t){let n=e.selection;if(!(n instanceof J))return!1;if(t){let r=e.tr,i=tm(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new w(i,0,0))}),r.docChanged&&t(r)}return!0}function Xm(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=Qm(tm(o).row,new w(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?Qm(tm(o).row,new w(t,n,r)).content:t);else return null;return Zm(o,s)}function Zm(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(T.empty),n[i]<r){let a=tm(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(T.from(o))}return{height:t.length,width:r,rows:t}}function Qm(e,t){let n=e.createAndFill();return new Ve(n).replace(0,n.content.size,t).doc}function $m({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(fm(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(T.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(T.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function eh(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=tm(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,T.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function th(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function nh(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,fm(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(fm(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function rh(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=q.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=q.get(a),f=d.mapping.maps.length}eh(d,o,a,n,l,u,f)&&p(),th(d,o,a,n,c,l,s,f)&&p(),th(d,o,a,n,c,l,u,f)&&p(),nh(d,o,a,n,s,u,c,f)&&p(),nh(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new w(i.rows[e-s],0,0))}p(),d.setSelection(new J(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var ih=ts({ArrowLeft:oh(`horiz`,-1),ArrowRight:oh(`horiz`,1),ArrowUp:oh(`vert`,-1),ArrowDown:oh(`vert`,1),"Shift-ArrowLeft":sh(`horiz`,-1),"Shift-ArrowRight":sh(`horiz`,1),"Shift-ArrowUp":sh(`vert`,-1),"Shift-ArrowDown":sh(`vert`,1),Backspace:Ym,"Mod-Backspace":Ym,Delete:Ym,"Mod-Delete":Ym});function ah(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function oh(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof J)return ah(n,r,D.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=dh(i,e,t);if(o==null)return!1;if(e==`horiz`)return ah(n,r,D.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=dm(i,e,t),s;return s=a?D.near(a,1):t<0?D.near(n.doc.resolve(i.before(-1)),-1):D.near(n.doc.resolve(i.after(-1)),1),ah(n,r,s)}}}function sh(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof J)o=a;else{let r=dh(i,e,t);if(r==null)return!1;o=new J(n.doc.resolve(r))}let s=dm(o.$headCell,e,t);return s?ah(n,r,new J(o.$anchorCell,s)):!1}}function ch(e,t){let n=e.state.doc,r=rm(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new J(r))),!0):!1}function lh(e,t,n){if(!am(e.state))return!1;let r=Xm(n),i=e.state.selection;if(i instanceof J){r||={width:1,height:1,rows:[T.from(Qm(tm(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=q.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=$m(r,o.right-o.left,o.bottom-o.top),rh(e.state,e.dispatch,a,o,r),!0}if(r){let t=om(e.state),n=t.start(-1);return rh(e.state,e.dispatch,n,q.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function uh(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=fh(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof J)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=rm(e.state.selection.$anchor))!=null&&ph(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=ph(e,n),i=nm.getState(e.state)==null;if(!r||!um(t,r)){if(i)r=t;else return}let a=new J(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(nm,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),nm.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(nm,-1))}function o(r){let o=r,s=nm.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(fh(e,o.target)!=n&&(c=ph(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function dh(e,t,n){if(!(e.state.selection instanceof k))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function fh(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function ph(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&rm(e.state.doc.resolve(r))||rm(e.state.doc.resolve(i))}var mh=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),hh(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type&&(this.node=e,hh(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function hh(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var gh=new A(`tableColumnResizing`);function _h({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=mh,lastColumnResizable:i=!0}={}){let a=new O({key:gh,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=tm(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new vh(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=gh.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{yh(t,n,e,i)},mouseleave:e=>{bh(e)},mousedown:(e,r)=>{xh(e,r,t,n)}},decorations:e=>{let t=gh.getState(e);if(t&&t.activeHandle>-1)return Ah(e,t.activeHandle)},nodeViews:{}}});return a}var vh=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(gh);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return cm(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function yh(e,t,n,r){if(!e.editable)return;let i=gh.getState(e.state);if(i&&!i.dragging){let a=Ch(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=wh(e,t,`left`,n):i-t.clientX<=n&&(o=wh(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=q.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}Eh(e,o)}}}function bh(e){if(!e.editable)return;let t=gh.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Eh(e,-1)}function xh(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=gh.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=Sh(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(gh,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=gh.getState(e.state);r?.dragging&&(Dh(e,r.activeHandle,Th(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(gh,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=gh.getState(e.state);if(i&&i.dragging){let a=Th(i.dragging,t,n);Oh(e,i.activeHandle,a,r)}}return Oh(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function Sh(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function Ch(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function wh(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=rm(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=q.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function Th(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function Eh(e,t){e.dispatch(e.state.tr.setMeta(gh,{setHandle:t}))}function Dh(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=q.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():kh(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function Oh(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=q.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&hh(a,c.firstChild,c,r,s,n)}function kh(e){return Array(e).fill(0)}function Ah(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return z.empty;let a=q.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,gh.getState(e)?.dragging&&n.push(io.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(io.widget(s,c))}}return z.create(e.doc,n)}function jh({allowTableNodeSelection:e=!1}={}){return new O({key:nm,state:{init(){return null},apply(e,t){let n=e.getMeta(nm);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:gm,handleDOMEvents:{mousedown:uh},createSelectionBetween(e){return nm.getState(e.state)==null?null:e.state.selection},handleTripleClick:ch,handleKeyDown:ih,handlePaste:lh},appendTransaction(t,n,r){return ym(r,Sm(r,n),e)}})}function Mh(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var Nh=class{get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(v(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(re(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(te(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(h(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(m(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(g(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(_(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(f(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){var e;let{selection:t}=this.editor.state,n=this.getReferencedVirtualElement?.call(this);if(n)return n;if(!((e=this.view)!=null&&(e=e.dom)!=null&&e.parentNode))return;let r=zl(this.view,t.from,t.to),i={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(t instanceof E){let e=this.view.nodeDOM(t.from),n=e.dataset.nodeViewWrapper?e:e.querySelector(`[data-node-view-wrapper]`);n&&(e=n),e&&(i={getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>[e.getBoundingClientRect()]})}if(t instanceof J){let{$anchorCell:e,$headCell:n}=t,r=e?e.pos:n.pos,a=n?n.pos:e.pos,o=this.view.nodeDOM(r),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():Mh(o.getBoundingClientRect(),s.getBoundingClientRect());i={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return i}constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&$s(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);(n||r)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&b(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(this.isVisible&&!this.editor.isDestroyed&&this.element.isConnected){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Ph=e=>new O({key:typeof e.pluginKey==`string`?new A(e.pluginKey):e.pluginKey,view:t=>new Nh({view:t,...e})});G.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Ph({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Fh=class{getTextContent(e){return hl(e,{textSerializers:gl(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(v(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(re(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(te(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(h(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(m(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(g(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(_(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(f(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e;if(!((e=this.view)!=null&&(e=e.dom)!=null&&e.parentNode))return;let{selection:t}=this.editor.state,n=zl(this.view,t.from,t.to);b({getBoundingClientRect:()=>n,getClientRects:()=>[n]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Ih=e=>new O({key:typeof e.pluginKey==`string`?new A(e.pluginKey):e.pluginKey,view:t=>new Fh({view:t,...e})});G.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[Ih({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Lh(e,t){return e??new A(t)}var Rh=typeof window<`u`?j.useLayoutEffect:j.useEffect,zh=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),Bh=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),Vh=new Set([`children`,`className`,`style`]),Hh=new Set([`tabIndex`]),Uh=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),Wh={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function Gh(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function Kh(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function qh(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||Uh.has(e)}function Jh(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Yh(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:Wh[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function Xh(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function Zh(e){return Hh.has(e)}function Qh(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function $h(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function eg(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||Bh.has(e)?String(t):`${t}px`}function tg(e,t){zh.has(t)||e.style.removeProperty(Jh(t))}function ng(e,t,n){zh.has(t)||e.style.setProperty(Jh(t),eg(t,n))}function rg(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(Vh.has(r)||!qh(r)||Gh(r,t[r])||Gh(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=Kh(r);if(a==null||a===!1){Zh(r)&&$h(e,r),e.removeAttribute(o);return}if(a===!0){Zh(r)&&Qh(e,r,!0),e.setAttribute(o,``);return}if(Zh(r)){Qh(e,r,a);return}e.setAttribute(o,String(a))})}function ig(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function ag(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){tg(e,t);return}ng(e,t,a)}})}function og(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!Gh(t,n))return;let{eventName:i,options:a}=Yh(t),o=t=>{n(Xh(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function sg(e,t){let n=(0,j.useRef)({}),r=(0,j.useRef)([]);Rh(()=>{let i=n.current;return ig(e,i.className,t.className),ag(e,i.style,t.style),rg(e,i,t),r.current=og(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var cg=j.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,j.useRef)(document.createElement(`div`)),f=(0,j.useRef)(Lh(e,`bubbleMenu`)).current;sg(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=ep(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,j.useRef)(h);g.current=h;let[_,v]=(0,j.useState)(!1),y=(0,j.useRef)(!0);return(0,j.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=Ph({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,j.useEffect)(()=>{if(_&&m&&!m.isDestroyed){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,Nt.createPortal)(c,d.current)});j.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,j.useRef)(document.createElement(`div`)),d=(0,j.useRef)(Lh(e,`floatingMenu`)).current;sg(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=ep(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,j.useRef)(m);h.current=m;let[g,_]=(0,j.useState)(!1),v=(0,j.useRef)(!0);return(0,j.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=Ih({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,j.useEffect)(()=>{if(g&&p&&!p.isDestroyed){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,Nt.createPortal)(s,u.current)});var Y=({icon:e,label:t,keys:n,pressed:r,disabled:i,onClick:a})=>{let{t:o}=s();return(0,M.jsxs)(lt,{children:[(0,M.jsx)(st,{asChild:!0,children:(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":t,"aria-pressed":r,disabled:i,className:`aria-pressed:bg-accent aria-pressed:text-accent-foreground`,onClick:a,children:(0,M.jsx)(e,{"aria-hidden":`true`})})}),(0,M.jsx)(ct,{children:n?o(`content.richText.shortcut`,{action:t,keys:n}):t})]})},lg=({editor:e})=>{let{selection:t}=e.state;return e.isEditable&&!t.empty&&!(t instanceof E)&&!e.isActive(`codeBlock`)},ug=({editor:e,onLink:t,onRewrite:n})=>{let{t:r}=s(),i=Jf({editor:e,selector:({editor:e})=>({bold:e.isActive(`bold`),italic:e.isActive(`italic`),code:e.isActive(`code`),link:e.isActive(`link`),heading2:e.isActive(`heading`,{level:2}),heading3:e.isActive(`heading`,{level:3}),blockquote:e.isActive(`blockquote`),bulletList:e.isActive(`bulletList`)})}),a=()=>e.chain().focus();return(0,M.jsx)(cg,{editor:e,shouldShow:lg,options:{placement:`top`},children:(0,M.jsxs)(`div`,{role:`toolbar`,"aria-label":r(`content.richText.toolbar`),className:`flex items-center gap-0.5 rounded-xl border bg-popover p-1 font-sans text-popover-foreground shadow-md`,children:[(0,M.jsx)(Y,{icon:Ot,label:r(`content.richText.bold`),keys:`Mod+B`,pressed:i.bold,disabled:!1,onClick:()=>a().toggleBold().run()}),(0,M.jsx)(Y,{icon:At,label:r(`content.richText.italic`),keys:`Mod+I`,pressed:i.italic,disabled:!1,onClick:()=>a().toggleItalic().run()}),(0,M.jsx)(Y,{icon:Ke,label:r(`content.richText.code`),keys:`Mod+E`,pressed:i.code,disabled:!1,onClick:()=>a().toggleCode().run()}),(0,M.jsx)(Y,{icon:qe,label:r(`content.richText.link`),keys:`Mod+Shift+K`,pressed:i.link,disabled:!1,onClick:t}),(0,M.jsx)(pe,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:ge,label:r(`entry.blocks.heading`),pressed:i.heading2,disabled:!1,onClick:()=>a().toggleHeading({level:2}).run()}),(0,M.jsx)(Y,{icon:Ge,label:r(`entry.blocks.subheading`),pressed:i.heading3,disabled:!1,onClick:()=>a().toggleHeading({level:3}).run()}),(0,M.jsx)(Y,{icon:Se,label:r(`content.richText.blockquote`),keys:`Mod+Shift+B`,pressed:i.blockquote,disabled:!1,onClick:()=>a().toggleBlockquote().run()}),(0,M.jsx)(Y,{icon:$e,label:r(`content.richText.bulletList`),keys:`Mod+Shift+8`,pressed:i.bulletList,disabled:!1,onClick:()=>a().toggleBulletList().run()}),n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(pe,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:it,label:r(`assist.rewrite.open`),disabled:!1,onClick:n})]}):null]})})},dg=({key:e,editor:t,onPaste:n,onDrop:r,allowedMimeTypes:i,consumePasteEvent:a})=>new O({key:e||new A(`fileHandler`),props:{handleDrop(e,n){if(!r||n.dataTransfer?.types.includes(`application/x-prosemirror-slice`)||!n.dataTransfer?.files.length)return!1;let a=e.posAtCoords({left:n.clientX,top:n.clientY}),o=Array.from(n.dataTransfer.files);return i&&(o=o.filter(e=>i.includes(e.type))),o.length!==0&&(n.preventDefault(),n.stopPropagation(),r(t,o,a?.pos||0),!0)},handlePaste(e,r){if(!n||!r.clipboardData?.files.length)return!1;let o=Array.from(r.clipboardData.files),s=r.clipboardData.getData(`text/html`);return i&&(o=o.filter(e=>i.includes(e.type))),!(o.length===0||(r.preventDefault(),r.stopPropagation(),n(t,o,s),s.length>0&&!a))}}}),fg=G.create({name:`fileHandler`,addOptions(){return{onPaste:void 0,onDrop:void 0,allowedMimeTypes:void 0,consumePasteEvent:!1}},addProseMirrorPlugins(){return[dg({key:new A(this.name),editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onDrop:this.options.onDrop,onPaste:this.options.onPaste,consumePasteEvent:this.options.consumePasteEvent})]}}),pg=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,mg=`ελ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`,hg=`numeric`,gg=`ascii`,_g=`alpha`,vg=`asciinumeric`,yg=`alphanumeric`,bg=`domain`,xg=`emoji`,Sg=`scheme`,Cg=`slashscheme`,wg=`whitespace`;function Tg(e,t){return e in t||(t[e]=[]),t[e]}function Eg(e,t,n){t[hg]&&(t[vg]=!0,t[yg]=!0),t[gg]&&(t[vg]=!0,t[_g]=!0),t[vg]&&(t[yg]=!0),t[_g]&&(t[yg]=!0),t[yg]&&(t[bg]=!0),t[xg]&&(t[bg]=!0);for(let r in t){let t=Tg(r,n);t.indexOf(e)<0&&t.push(e)}}function Dg(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function Og(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Og.groups={},Og.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=Og.groups;let i;return t&&t.j?i=t:(i=new Og(t),n&&r&&Eg(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=Og.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new Og,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new Og,a&&(r&&(o.t&&typeof o.t==`string`?Eg(a,Object.assign(Dg(o.t,r),n),r):n&&Eg(a,n,r)),o.t=a),i.j[e]=o,o}};var X=(e,t,n,r,i)=>e.ta(t,n,r,i),Z=(e,t,n,r,i)=>e.tr(t,n,r,i),kg=(e,t,n,r,i)=>e.ts(t,n,r,i),Q=(e,t,n,r,i)=>e.tt(t,n,r,i),Ag=`WORD`,jg=`UWORD`,Mg=`ASCIINUMERICAL`,Ng=`ALPHANUMERICAL`,Pg=`LOCALHOST`,Fg=`TLD`,Ig=`UTLD`,Lg=`SCHEME`,Rg=`SLASH_SCHEME`,zg=`NUM`,Bg=`WS`,Vg=`NL`,Hg=`OPENBRACE`,Ug=`CLOSEBRACE`,Wg=`OPENBRACKET`,Gg=`CLOSEBRACKET`,Kg=`OPENPAREN`,qg=`CLOSEPAREN`,Jg=`OPENANGLEBRACKET`,Yg=`CLOSEANGLEBRACKET`,Xg=`FULLWIDTHLEFTPAREN`,Zg=`FULLWIDTHRIGHTPAREN`,Qg=`LEFTCORNERBRACKET`,$g=`RIGHTCORNERBRACKET`,e_=`LEFTWHITECORNERBRACKET`,t_=`RIGHTWHITECORNERBRACKET`,n_=`FULLWIDTHLESSTHAN`,r_=`FULLWIDTHGREATERTHAN`,i_=`AMPERSAND`,a_=`APOSTROPHE`,o_=`ASTERISK`,s_=`AT`,c_=`BACKSLASH`,l_=`BACKTICK`,u_=`CARET`,d_=`COLON`,f_=`COMMA`,p_=`DOLLAR`,m_=`DOT`,h_=`EQUALS`,g_=`EXCLAMATION`,__=`HYPHEN`,v_=`PERCENT`,y_=`PIPE`,b_=`PLUS`,x_=`POUND`,S_=`QUERY`,C_=`QUOTE`,w_=`FULLWIDTHMIDDLEDOT`,T_=`SEMI`,E_=`SLASH`,D_=`TILDE`,O_=`UNDERSCORE`,k_=`EMOJI`,A_=`SYM`,j_=Object.freeze({__proto__:null,ALPHANUMERICAL:Ng,AMPERSAND:i_,APOSTROPHE:a_,ASCIINUMERICAL:Mg,ASTERISK:o_,AT:s_,BACKSLASH:c_,BACKTICK:l_,CARET:u_,CLOSEANGLEBRACKET:Yg,CLOSEBRACE:Ug,CLOSEBRACKET:Gg,CLOSEPAREN:qg,COLON:d_,COMMA:f_,DOLLAR:p_,DOT:m_,EMOJI:k_,EQUALS:h_,EXCLAMATION:g_,FULLWIDTHGREATERTHAN:r_,FULLWIDTHLEFTPAREN:Xg,FULLWIDTHLESSTHAN:n_,FULLWIDTHMIDDLEDOT:w_,FULLWIDTHRIGHTPAREN:Zg,HYPHEN:__,LEFTCORNERBRACKET:Qg,LEFTWHITECORNERBRACKET:e_,LOCALHOST:Pg,NL:Vg,NUM:zg,OPENANGLEBRACKET:Jg,OPENBRACE:Hg,OPENBRACKET:Wg,OPENPAREN:Kg,PERCENT:v_,PIPE:y_,PLUS:b_,POUND:x_,QUERY:S_,QUOTE:C_,RIGHTCORNERBRACKET:$g,RIGHTWHITECORNERBRACKET:t_,SCHEME:Lg,SEMI:T_,SLASH:E_,SLASH_SCHEME:Rg,SYM:A_,TILDE:D_,TLD:Fg,UNDERSCORE:O_,UTLD:Ig,UWORD:jg,WORD:Ag,WS:Bg}),M_=/[a-z]/,N_=/\p{L}/u,P_=/\p{Emoji}/u,F_=/\d/,I_=/\s/,L_=`\r`,R_=`
92
92
  `,z_=`️`,B_=`‍`,V_=``,H_=null,U_=null;function W_(e=[]){let t={};Og.groups=t;let n=new Og;H_??=J_(pg),U_??=J_(mg),Q(n,`'`,a_),Q(n,`{`,Hg),Q(n,`}`,Ug),Q(n,`[`,Wg),Q(n,`]`,Gg),Q(n,`(`,Kg),Q(n,`)`,qg),Q(n,`<`,Jg),Q(n,`>`,Yg),Q(n,`(`,Xg),Q(n,`)`,Zg),Q(n,`「`,Qg),Q(n,`」`,$g),Q(n,`『`,e_),Q(n,`』`,t_),Q(n,`<`,n_),Q(n,`>`,r_),Q(n,`&`,i_),Q(n,`*`,o_),Q(n,`@`,s_),Q(n,"`",l_),Q(n,`^`,u_),Q(n,`:`,d_),Q(n,`,`,f_),Q(n,`$`,p_),Q(n,`.`,m_),Q(n,`=`,h_),Q(n,`!`,g_),Q(n,`-`,__),Q(n,`%`,v_),Q(n,`|`,y_),Q(n,`+`,b_),Q(n,`#`,x_),Q(n,`?`,S_),Q(n,`"`,C_),Q(n,`/`,E_),Q(n,`;`,T_),Q(n,`~`,D_),Q(n,`_`,O_),Q(n,`\\`,c_),Q(n,`・`,w_);let r=Z(n,F_,zg,{[hg]:!0});Z(r,F_,r);let i=Z(r,M_,Mg,{[vg]:!0}),a=Z(r,N_,Ng,{[yg]:!0}),o=Z(n,M_,Ag,{[gg]:!0});Z(o,F_,i),Z(o,M_,o),Z(i,F_,i),Z(i,M_,i);let s=Z(n,N_,jg,{[_g]:!0});Z(s,M_),Z(s,F_,a),Z(s,N_,s),Z(a,F_,a),Z(a,M_),Z(a,N_,a);let c=Q(n,R_,Vg,{[wg]:!0}),l=Q(n,L_,Bg,{[wg]:!0}),u=Z(n,I_,Bg,{[wg]:!0});Q(n,V_,u),Q(l,R_,c),Q(l,V_,u),Z(l,I_,u),Q(u,L_),Q(u,R_),Z(u,I_,u),Q(u,V_,u);let d=Z(n,P_,k_,{[xg]:!0});Q(d,`#`),Z(d,P_,d),Q(d,z_,d);let f=Q(d,B_);Q(f,`#`),Z(f,P_,d);let p=[[M_,o],[F_,i]],m=[[M_,null],[N_,s],[F_,a]];for(let e=0;e<H_.length;e++)q_(n,H_[e],Fg,Ag,p);for(let e=0;e<U_.length;e++)q_(n,U_[e],Ig,jg,m);Eg(Fg,{tld:!0,ascii:!0},t),Eg(Ig,{utld:!0,alpha:!0},t),q_(n,`file`,Lg,Ag,p),q_(n,`mailto`,Lg,Ag,p),q_(n,`http`,Rg,Ag,p),q_(n,`https`,Rg,Ag,p),q_(n,`ftp`,Rg,Ag,p),q_(n,`ftps`,Rg,Ag,p),Eg(Lg,{scheme:!0,ascii:!0},t),Eg(Rg,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[Sg]:!0}:{[Cg]:!0};r.indexOf(`-`)>=0?i[bg]=!0:M_.test(r)?F_.test(r)?i[vg]=!0:i[gg]=!0:i[hg]=!0,kg(n,r,r,i)}return kg(n,`localhost`,Pg,{ascii:!0}),n.jd=new Og(A_),{start:n,tokens:Object.assign({groups:t},j_)}}function G_(e,t){let n=K_(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function K_(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function q_(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new Og(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new Og(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function J_(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var Y_={defaultProtocol:`http`,events:null,format:Z_,formatHref:Z_,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function X_(e,t=null){let n=Object.assign({},Y_);e&&(n=Object.assign(n,e instanceof X_?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}X_.prototype={o:Y_,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:Y_[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function Z_(e){return e}function Q_(e,t){this.t=`token`,this.v=e,this.tk=t}Q_.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Y_.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function $_(e,t){class n extends Q_{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var ev=$_(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),tv=$_(`text`),nv=$_(`nl`),rv=$_(`url`,{isLink:!0,toHref(e=Y_.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==Pg&&e[1].t===d_}}),iv=e=>new Og(e);function av({groups:e}){let t=e.domain.concat([i_,o_,s_,c_,l_,u_,p_,h_,__,zg,v_,y_,b_,x_,E_,A_,D_,O_]),n=[a_,d_,f_,m_,g_,v_,S_,C_,T_,Jg,Yg,Hg,Ug,Gg,Wg,Kg,qg,Xg,Zg,Qg,$g,e_,t_,n_,r_],r=[i_,a_,o_,c_,l_,u_,p_,h_,__,Hg,Ug,v_,y_,b_,x_,S_,E_,A_,D_,O_],i=iv(),a=Q(i,D_);X(a,r,a),X(a,e.domain,a);let o=iv(),s=iv(),c=iv();X(i,e.domain,o),X(i,e.scheme,s),X(i,e.slashscheme,c),X(o,r,a),X(o,e.domain,o);let l=Q(o,s_);Q(a,s_,l),Q(s,s_,l),Q(c,s_,l);let u=Q(a,m_);X(u,r,a),X(u,e.domain,a);let d=iv();X(l,e.domain,d),X(d,e.domain,d);let f=Q(d,m_);X(f,e.domain,d);let p=iv(ev);X(f,e.tld,p),X(f,e.utld,p),Q(l,Pg,p);let m=Q(d,__);Q(m,__,m),X(m,e.domain,d),X(p,e.domain,d),Q(p,m_,f),Q(p,__,m);let h=Q(o,__),g=Q(o,m_);Q(h,__,h),X(h,e.domain,o),X(g,r,a),X(g,e.domain,o);let _=iv(rv);X(g,e.tld,_),X(g,e.utld,_),X(_,e.domain,o),X(_,r,a),Q(_,m_,g),Q(_,__,h),Q(_,s_,l);let v=Q(_,d_),y=iv(rv);X(v,e.numeric,y);let b=iv(rv),x=iv();X(b,t,b),X(b,n,x),X(x,t,b),X(x,n,x),Q(_,E_,b),Q(y,E_,b);let S=Q(s,d_),ee=Q(Q(Q(c,d_),E_),E_);X(s,e.domain,o),Q(s,m_,g),Q(s,__,h),X(c,e.domain,o),Q(c,m_,g),Q(c,__,h),X(S,e.domain,b),Q(S,E_,b),Q(S,S_,b),X(ee,e.domain,b),X(ee,t,b),Q(ee,E_,b);let te=[[Hg,Ug],[Wg,Gg],[Kg,qg],[Jg,Yg],[Xg,Zg],[Qg,$g],[e_,t_],[n_,r_]];for(let e=0;e<te.length;e++){let[r,i]=te[e],a=Q(b,r);Q(x,r,a);let o=iv(rv);X(a,t,o);let s=iv();X(a,n,s),Q(a,i,b),X(o,t,o),X(o,n,s),X(s,t,o),X(s,n,s),Q(o,i,b),Q(s,i,b)}return Q(i,Pg,_),Q(i,Vg,nv),{start:i,tokens:j_}}function ov(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(sv(tv,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(sv(e,t,r))}}return o.length>0&&a.push(sv(tv,t,o)),a}function sv(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var cv=typeof console<`u`&&console&&console.warn||(()=>{}),lv=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,$={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function uv(){return Og.groups={},$.scanner=null,$.parser=null,$.tokenQueue=[],$.pluginQueue=[],$.customSchemes=[],$.initialized=!1,$}function dv(e,t=!1){if($.initialized&&cv(`linkifyjs: already initialized - will not register custom scheme "${e}" ${lv}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
93
93
  1. Must only contain digits, lowercase ASCII letters or "-"
94
94
  2. Cannot start or end with "-"
@@ -141,4 +141,4 @@ img.ProseMirror-separator {
141
141
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Nx,this.editor.getAttributes(Px)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new O({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=Dx(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=Pd({find:Fx,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Pd({find:Fx,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Px)}),joinPredicate:e,editor:this.editor})),[t]}}),Rx=/^\s*(\[([( |x])?\])\s$/,zx=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,Bx=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},Vx=K.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:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,W(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>Xu(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[Ub(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=zx;let l=e=>{let t=Bx(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=al(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[Pd({find:Rx,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Hx=K.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:e}){return[`ul`,W(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
142
142
  `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=qu(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=qu(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});G.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(zb.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(cx.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(_x.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Lx.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Vx.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Hx.configure(this.options.taskList)),e}});var Ux=`&nbsp;`,Wx=`\xA0`,Gx=K.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,W(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===Ux||n[0].text===Ux||n[0].raw===Wx||n[0].text===Wx)&&r.length===1&&r[0].type===`text`&&(r[0].text===Ux||r[0].text===Wx)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?Ux:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Kx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,qx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Jx=sd.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,W(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[jd({find:Kx,type:this.type})]},addPasteRules(){return[Id({find:qx,type:this.type})]}}),Yx=K.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Xx=sd.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,W(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Zx=G.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(vb.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(pb.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(zb.configure(this.options.bulletList)),this.options.code!==!1&&e.push(Sb.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(Eb.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(Db.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(jy.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(My.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(Ob.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(kb.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(rb.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(Ab.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(Fb.configure(this.options.italic)),this.options.listItem!==!1&&e.push(cx.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(_x.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(Iv.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(Lx.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Gx.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(Jx.configure(this.options.strike)),this.options.text!==!1&&e.push(Yx.configure(this.options.text)),this.options.underline!==!1&&e.push(Xx.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(nb.configure(this.options?.trailingNode)),e}}),Qx=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,$x=K.create({name:`image`,group:`block`,atom:!0,draggable:!0,selectable:!0,addAttributes(){return{mediaId:{default:null,parseHTML:e=>e.getAttribute(`data-media-id`)},alt:{default:null,parseHTML:e=>e.getAttribute(`alt`)||null},title:{default:null,parseHTML:e=>e.getAttribute(`title`)||null}}},parseHTML(){return[{tag:`img[data-media-id]`,getAttrs:e=>Qx.test(e.getAttribute(`data-media-id`)??``)?null:!1}]},renderHTML({node:e,HTMLAttributes:t}){return[`img`,W({"data-media-id":e.attrs.mediaId},{alt:t.alt,title:t.title})]},addCommands(){return{insertMediaImage:({mediaId:e,alt:t=null})=>({commands:n})=>n.insertContent({type:this.name,attrs:{mediaId:e,alt:t||null,title:null}})}}}),eS=Iv.extend({addAttributes(){let{title:e,...t}=this.parent?.()??{};return t}}).configure({openOnClick:!1,autolink:!0,linkOnPaste:!0,defaultProtocol:`https`,HTMLAttributes:{target:null,rel:null,class:null},isAllowedUri:e=>Ip.test(e.trim())}),tS=e=>e.extend({addAttributes(){let{align:e,...t}=this.parent?.()??{};return t}}),nS=({placeholder:e,imageView:t}={})=>[Zx.configure({strike:!1,underline:!1,link:!1,heading:{levels:[1,2,3,4,5,6]}}),eS,_y.configure({table:{resizable:!0,allowTableNodeSelection:!0},tableCell:!1,tableHeader:!1}),tS(qv),tS(Jv),t?$x.extend({addNodeView:()=>t}):$x,...e?[Xy.configure({placeholder:e})]:[]],rS=[`w1280`,`w640`],iS=e=>typeof e==`string`?e:``,aS=({node:e,updateAttributes:t,deleteNode:n,selected:r,editor:i,appearance:a=`form`})=>{let{t:c}=s(),l=typeof e.attrs.mediaId==`string`?e.attrs.mediaId:void 0,u=iS(e.attrs.alt),d=iS(e.attrs.title),f=o(l),p=rS.map(e=>f.data?.variants.find(t=>t.name===e&&t.url)?.url).find(Boolean)??f.data?.url,m=i.isEditable,h=(0,j.useId)(),g=(0,j.useId)(),_=a===`canvas`,v=(0,j.useContext)(dt)?.locale,y=(e,n)=>t({[e]:n===``?null:n});return(0,M.jsxs)(rp,{as:`figure`,"data-drag-handle":!0,"data-media-id":l,className:ot(`not-prose my-4 space-y-2`,_?`font-sans`:`rounded-lg border bg-card p-2`,r&&`rounded-lg ring-2 ring-ring ring-offset-2 ring-offset-background`),children:[f.isPending?(0,M.jsx)(oe,{className:ot(`w-full rounded-md`,_?`h-72 rounded-xl`:`h-48`)}):p?(0,M.jsx)(`img`,{src:p,alt:u,className:ot(`w-full object-contain`,_?`max-h-[32rem] rounded-xl`:`max-h-96 rounded-md`)}):(0,M.jsxs)(`div`,{className:`flex h-32 items-center justify-center gap-2 rounded-md bg-muted text-sm text-muted-foreground`,children:[(0,M.jsx)(Ye,{"aria-hidden":`true`,className:`size-4`}),c(`content.richText.imageMissing`)]}),_?(0,M.jsxs)(`figcaption`,{className:`space-y-1`,children:[(0,M.jsx)(`label`,{htmlFor:g,className:`sr-only`,children:c(`entry.image.caption`)}),(0,M.jsx)(`input`,{id:g,value:d,readOnly:!m,placeholder:f.data?.caption||c(`entry.image.captionPlaceholder`),onChange:e=>y(`title`,e.target.value),className:`w-full rounded-md bg-transparent px-1 text-meta text-muted-foreground outline-none placeholder:text-muted-foreground/70 focus-visible:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}):null,(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`label`,{htmlFor:h,className:`shrink-0 text-meta font-semibold text-muted-foreground`,children:c(`content.richText.altLabel`)}),(0,M.jsx)(ie,{id:h,value:u,readOnly:!m,placeholder:f.data?.alt||c(`content.richText.altPlaceholder`),inputSize:`sm`,"data-alt-input":!0,onChange:e=>y(`alt`,e.target.value)}),m?(0,M.jsx)(yt,{assetId:l,mimeType:f.data?.mimeType,locale:v,onSuggest:e=>y(`alt`,e),className:`shrink-0`}):null,m?(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":c(`content.richText.removeImage`),onClick:n,children:(0,M.jsx)(fe,{"aria-hidden":`true`})}):null]})]})},oS=e=>(0,M.jsx)(aS,{...e,appearance:`canvas`});function sS(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=Hu(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function cS(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
143
143
  `);return/\s/.test(n)}):!1}function lS(e){return()=>{let t=e.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=e.view.coordsAtPos(t);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}}}function uS(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:lS(e)}function dS({match:e,dismissedRange:t,state:n,transaction:r,editor:i,shouldResetDismissed:a,effectiveAllowSpaces:o}){return a?.({editor:i,state:n,range:t,match:e,transaction:r,allowSpaces:o})?!1:o?e.range.from===t.from:e.range.from===t.from&&!cS(r)}function fS({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function pS({pluginKey:e,decorationTag:t,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:a,dispatchExit:o}){return{handleKeyDown(t,n){var r;let i=e.getState(t.state);if(!i.active)return!1;if(n.key===`Escape`||n.key===`Esc`){var s;return a==null||(s=a.onKeyDown)==null||s.call(a,{view:t,event:n,range:i.range}),o(t),!0}return(a==null||(r=a.onKeyDown)==null?void 0:r.call(a,{view:t,event:n,range:i.range}))||!1},decorations(a){let{active:o,range:s,decorationId:c,query:l}=e.getState(a);if(!o)return null;let u=!l?.length,d=[n];return u&&d.push(i),z.create(a.doc,[io.inline(s.from,s.to,{nodeName:t,class:d.join(` `),"data-decoration-id":c||void 0,"data-decoration-content":r})])}}}function mS({editor:e,char:t,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,findSuggestionMatch:o,allow:s,shouldShow:c,shouldKeepDismissed:l,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(d,f,p,m){let{isEditable:h}=e,{composing:g}=e.view,{selection:_}=d,{empty:v,from:y}=_,b={...f},x=d.getMeta(u);if(x&&x.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=f.active?{...f.range}:f.dismissedRange,b;if(b.composing=g,d.docChanged&&b.dismissedRange!==null&&(b.dismissedRange={from:d.mapping.map(b.dismissedRange.from),to:d.mapping.map(b.dismissedRange.to)}),h&&(v||e.view.composing)){(y<f.range.from||y>f.range.to)&&!g&&!f.composing&&(b.active=!1);let u=o({char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:_.$from}),p=`id_${Math.floor(Math.random()*4294967295)}`;u&&s({editor:e,state:m,range:u.range,isActive:f.active})&&(!c||c({editor:e,range:u.range,query:u.query,text:u.text,transaction:d}))?(b.dismissedRange!==null&&!l({match:u,dismissedRange:b.dismissedRange,state:m,transaction:d})&&(b.dismissedRange=null),b.dismissedRange===null?(b.active=!0,b.decorationId=f.decorationId||p,b.range=u.range,b.query=u.query,b.text=u.text):b.active=!1):(u||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}function hS({editor:e,items:t}){let n=null,r=null,i=null,a=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},o=e=>new Promise(t=>{i=t,r=setTimeout(()=>{r=null;let e=i;i=null,e?.()},e)}),s=()=>{n?.abort(),a(),n=null};return{abort:s,fetch:async(r,i)=>{s(),n=new AbortController;let a=n;if(i>0&&await o(i),n!==a||a.signal.aborted)return{status:`aborted`};try{let i=await t({editor:e,query:r,signal:a.signal});return n!==a||a.signal.aborted?{status:`aborted`}:{status:`resolved`,items:i}}catch{return n!==a||a.signal.aborted?{status:`aborted`}:{status:`error`}}}}}function gS({placement:e,offset:t,flip:n,floatingUi:r}){var i;let a=[te({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n&&a.push(v()),r!=null&&(i=r.middleware)!=null&&i.length&&a.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:a}}function _S(e){if(e instanceof HTMLElement)return e;if(typeof e==`string`)try{let t=document.querySelector(e);if(t)return t}catch{return document.body}return document.body}function vS({getReferenceRect:e,contextElement:t,config:n,container:r,dismissOnOutsideClick:i,dismiss:a}){return(o,s={})=>{let c={getBoundingClientRect:()=>e()??new DOMRect,contextElement:t},l=!1,u=!o.isConnected;u&&_S(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`);let d=S(c,o,()=>{b(c,o,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:e,y:t,placement:n,strategy:r})=>{if(s.onPosition){s.onPosition({x:e,y:t,placement:n,strategy:r});return}Object.assign(o.style,{position:r,left:`${e}px`,top:`${t}px`}),l||(l=!0,o.style.visibility=``)})},s.autoUpdate),f;return i&&(f=e=>{let n=e.target;!(n instanceof Node)||o.contains(n)||t.contains(n)||a()},document.addEventListener(`pointerdown`,f,!0)),()=>{d(),f&&document.removeEventListener(`pointerdown`,f,!0),u&&o.remove()}}}function yS({editor:e,pluginKey:t,items:n,renderer:r,minQueryLength:i,debounce:a,initialItems:o,placement:s,offset:c,container:l,flip:u,floatingUi:d,dismissOnOutsideClick:f,command:p,clientRectFor:m,dispatchExit:h}){let g,_=hS({editor:e,items:n}),v=gS({placement:s,offset:c,flip:u,floatingUi:d});function y(e,t){switch(e){case`started`:var n;r==null||(n=r.onStart)==null||n.call(r,t);break;case`updated`:var i;r==null||(i=r.onUpdate)==null||i.call(r,t);break;case`stopped`:var a;r==null||(a=r.onExit)==null||a.call(r,t)}}return{update:async(n,d)=>{let b=t.getState(d),x=t.getState(n.state);if(!b||!x)return;let S=null,ee=b.query!==x.query,te=b.text!==x.text,ne=b.range.from!==x.range.from||b.range.to!==x.range.to,re=ee||te||ne;if(!b.active&&x.active)S=`started`;else if(b.active&&!x.active)S=`stopped`;else if(x.active&&re)S=`updated`;else return;let C=S===`stopped`?b:x,ie=n.dom.querySelector(`[data-decoration-id="${C.decorationId}"]`),ae=m(n,ie),oe=i===0||(C.query?C.query.length>=i:!1),se=(S===`started`||S===`updated`)&&oe;if(g={editor:e,range:C.range,query:C.query||``,text:C.text||``,items:o??[],command:t=>p({editor:e,range:C.range,props:t}),decorationNode:ie,clientRect:ae,loading:se,placement:s,offset:{mainAxis:c.mainAxis??4,crossAxis:c.crossAxis??0},container:l,flip:u,floatingUi:v,mount:vS({getReferenceRect:ae,contextElement:n.dom,config:v,container:l,dismissOnOutsideClick:f,dismiss:()=>h(e.view)})},S===`started`){var ce;r==null||(ce=r.onBeforeStart)==null||ce.call(r,g)}if(S===`updated`){var le;r==null||(le=r.onBeforeUpdate)==null||le.call(r,g)}if(S===`started`&&y(S,g),S===`started`||S===`updated`){if(!se)_.abort(),g={...g,items:o??[],loading:!1};else{g={...g,items:o??[],loading:!0},S=`updated`,y(S,g);let e=await _.fetch(C.query||``,a);if(e.status===`aborted`)return;if(!t.getState(n.state)?.active){_.abort();return}g=e.status===`resolved`?{...g,items:e.items,loading:!1}:{...g,loading:!1}}}if(S===`stopped`){_.abort(),y(S,g),g=void 0;return}S===`updated`&&y(S,g)},destroy:()=>{var e;_.abort(),g&&(r==null||(e=r.onExit)==null||e.call(r,g))}}}var bS=new A(`suggestion`);function xS({pluginKey:e=bS,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],minQueryLength:p=0,debounce:m=0,initialItems:h,placement:g=`bottom-start`,offset:_={},container:v,flip:y=!0,floatingUi:b,dismissOnOutsideClick:x=!0,render:S=()=>({}),allow:ee=()=>!0,findSuggestionMatch:te=sS,shouldShow:ne,shouldResetDismissed:re}){let C=S?.(),ie=r&&!i,ae=(n,r)=>uS(t,n,r,e);function oe(e){return dS({...e,editor:t,shouldResetDismissed:re,effectiveAllowSpaces:ie})}let se=t=>fS({view:t,pluginKeyRef:e});return new O({key:e,view:()=>yS({editor:t,pluginKey:e,items:f,renderer:C,minQueryLength:p,debounce:m,initialItems:h,placement:g,offset:_,container:v,flip:y,floatingUi:b,dismissOnOutsideClick:x,command:d,clientRectFor:ae,dispatchExit:se}),state:mS({editor:t,char:n,effectiveAllowSpaces:ie,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,findSuggestionMatch:te,allow:ee,shouldShow:ne,shouldKeepDismissed:oe,pluginKey:e}),props:pS({pluginKey:e,decorationTag:s,decorationClass:c,decorationContent:l,decorationEmptyClass:u,renderer:C,dispatchExit:se})})}function SS(e,t=bS){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}var CS=()=>({onChange:Sp(()=>void 0),onKeyDown:Sp(()=>!1)}),wS=new A(`slashCommand`),TS=e=>SS(e,wS),ES=()=>null,DS=G.create({name:`slashCommand`,addOptions(){return{bridge:CS()}},addProseMirrorPlugins(){let{bridge:e}=this.options,t=t=>e.onChange.call({query:t.query,range:t.range,rect:t.clientRect??ES});return[xS({editor:this.editor,pluginKey:wS,char:`/`,dismissOnOutsideClick:!1,allow:({state:e,range:t})=>!e.doc.resolve(t.from).parent.type.spec.code,items:()=>[],command:()=>void 0,render:()=>({onStart:t,onUpdate:t,onKeyDown:({event:t})=>t.key===`Escape`?(e.onChange.call(null),!0):e.onKeyDown.call(t),onExit:()=>e.onChange.call(null)})})]}}),OS=e=>e?.id,kS=new A(`uploadPlaceholder`),AS=e=>{let t=document.createElement(`div`);t.className=`my-4 flex h-40 items-center justify-center gap-2 rounded-xl border border-dashed bg-muted/40 font-sans text-sm text-muted-foreground`,t.setAttribute(`role`,`status`),t.setAttribute(`data-upload-placeholder`,``);let n=document.createElement(`span`);n.className=`size-4 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`span`);return r.textContent=e,t.append(n,r),t},jS=G.create({name:`uploadPlaceholder`,addOptions(){return{label:e=>e}},addProseMirrorPlugins(){let{label:e}=this.options;return[new O({key:kS,state:{init:()=>z.empty,apply:(t,n)=>{let r=n.map(t.mapping,t.doc),i=t.getMeta(kS);if(i&&`add`in i){let n=io.widget(i.add.pos,()=>AS(e(i.name??``)),{id:i.add.id,side:-1});r=r.add(t.doc,[n])}else i&&`remove`in i&&(r=r.remove(r.find(void 0,void 0,e=>OS(e)===i.remove.id)));return r}},props:{decorations:e=>kS.getState(e)}})]}}),MS=(e,t,n,r)=>e.setMeta(kS,{add:{id:t,pos:n},name:r}),NS=(e,t)=>e.setMeta(kS,{remove:{id:t}}),PS=(e,t)=>kS.getState(e)?.find(void 0,void 0,e=>OS(e)===t)[0]?.from,FS=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/avif`,`image/svg+xml`],IS=(e,t,n,r,i)=>Promise.all(t.map(async t=>{let a=crypto.randomUUID();e.view.dispatch(MS(e.state.tr,a,n,t.name));try{let n=await r(t);if(e.isDestroyed)return;let i=PS(e.state,a);e.view.dispatch(NS(e.state.tr,a)),i!==void 0&&e.chain().insertContentAt(i,{type:`image`,attrs:{mediaId:n.id,alt:n.alt,title:null}}).run()}catch(n){e.isDestroyed||e.view.dispatch(NS(e.state.tr,a)),i(t,n)}})),LS=({placeholder:e,uploadingLabel:t,slash:n,onFiles:r})=>[...nS({placeholder:e,imageView:_p(oS)}),qp,DS.configure({bridge:n}),jS.configure({label:t}),...r?[fg.configure({allowedMimeTypes:FS,consumePasteEvent:!0,onDrop:(e,t,n)=>r(e,t,n),onPaste:(e,t)=>r(e,t,e.state.selection.to)})]:[]],RS=({editor:e,rewrite:t})=>{let{t:n}=s(),r=(0,j.useId)(),[i,a]=(0,j.useState)(``),{captured:o,result:c}=t,l=t.pending;return(0,M.jsxs)(x,{open:t.open,onOpenChange:e=>{e||(t.close(),a(``))},children:[o?(0,M.jsx)(ee,{virtualRef:Vp(e,o)}):null,(0,M.jsx)(y,{align:`start`,className:`w-[min(26rem,calc(100vw-2rem))] space-y-3 font-sans`,"aria-label":n(`assist.rewrite.title`),onCloseAutoFocus:t=>{t.preventDefault(),e.commands.focus()},children:c?(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(ut,{htmlFor:`${r}-result`,label:n(`assist.rewrite.proposal`,{model:c.model}),hint:n(`assist.rewrite.marksHint`)}),(0,M.jsx)(wt,{id:`${r}-result`,value:t.draft,autoFocus:!0,rows:5,className:`max-h-72`,onChange:e=>t.setDraft(e.target.value)}),c.truncated?(0,M.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:n(`assist.truncated`)}):null,t.stale?(0,M.jsx)(`p`,{role:`alert`,className:`text-meta text-destructive`,children:n(`assist.rewrite.stale`)}):null,(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,onClick:t.discard,children:n(`assist.discard`)}),(0,M.jsx)(C,{type:`button`,size:`sm`,disabled:t.draft.trim()===``||t.stale,onClick:t.apply,children:n(`assist.rewrite.replace`)})]})]}):(0,M.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.run(i)},children:[(0,M.jsx)(ut,{htmlFor:`${r}-instruction`,label:n(`assist.rewrite.instruction`),hint:n(`assist.rewrite.marksHint`)}),(0,M.jsx)(ie,{id:`${r}-instruction`,value:i,autoFocus:!0,maxLength:500,placeholder:n(`assist.rewrite.instructionPlaceholder`),disabled:l||t.tooLong,onChange:e=>a(e.target.value)}),t.tooLong?(0,M.jsx)(`p`,{role:`alert`,className:`text-meta text-destructive`,children:n(`assist.rewrite.tooLong`,{max:gt.toLocaleString()})}):null,(0,M.jsx)(vt,{error:t.error}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,M.jsx)(C,{type:`button`,variant:`outline`,size:`sm`,disabled:l||t.tooLong,onClick:()=>t.run(pt.shorten),children:n(`assist.rewrite.shorten`)}),(0,M.jsx)(C,{type:`button`,variant:`outline`,size:`sm`,disabled:l||t.tooLong,onClick:()=>t.run(pt.expand),children:n(`assist.rewrite.expand`)}),(0,M.jsx)(_t,{variant:`default`,pending:l,pendingLabel:n(`assist.working`),disabled:i.trim()===``||t.tooLong,onClick:()=>t.run(i),children:n(`assist.rewrite.run`)})]})]})})]})},zS={ArrowDown:1,ArrowUp:-1},BS=({editor:e,bridge:t,onChoose:n})=>{let{t:r}=s(),i=(0,j.useId)(),[a,o]=(0,j.useState)(null),[c,l]=(0,j.useState)(0),u=e=>r(e.labelKey),d=a?Re(a.query,u):[],f=d[Math.min(c,d.length-1)],p=e=>{e&&a&&n(e.type,a)};(0,j.useEffect)(()=>{t.onChange.set(e=>{o(e),e?.query!==a?.query&&l(0)}),t.onKeyDown.set(e=>{if(!a||d.length===0)return!1;let t=zS[e.key];return t===void 0?e.key===`Enter`||e.key===`Tab`?(p(f),!0):!1:(l(e=>(e+t+d.length)%d.length),!0)})}),(0,j.useEffect)(()=>()=>{t.onChange.reset(),t.onKeyDown.reset()},[t]);let m=a!==null&&d.length>0;return(0,M.jsxs)(x,{open:m,onOpenChange:t=>{t||TS(e.view)},children:[(0,M.jsx)(ee,{virtualRef:{current:{getBoundingClientRect:()=>a?.rect()??new DOMRect}}}),(0,M.jsx)(y,{align:`start`,className:`w-72 p-1 font-sans`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),children:(0,M.jsx)(`ul`,{role:`listbox`,id:i,"aria-label":r(`entry.blocks.menu`),className:`max-h-80 overflow-y-auto`,children:d.map((e,t)=>(0,M.jsxs)(`li`,{role:`option`,"aria-selected":e===f,className:ot(`flex cursor-pointer items-center gap-3 rounded-md px-2 py-1.5 text-sm`,e===f&&`bg-accent text-accent-foreground`),onMouseEnter:()=>l(t),onMouseDown:t=>{t.preventDefault(),p(e)},children:[(0,M.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground [&_svg]:size-4`,children:(0,M.jsx)(e.icon,{"aria-hidden":`true`})}),u(e)]},e.type))})})]})},VS=[`min-h-16 font-serif text-canvas text-foreground outline-none`,`-mx-3 rounded-lg px-3 py-1 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`[&_h1]:mt-10 [&_h1]:mb-3 [&_h1]:font-sans [&_h1]:text-3xl [&_h1]:font-bold [&_h1]:tracking-tight`,`[&_h2]:mt-10 [&_h2]:mb-3 [&_h2]:font-sans [&_h2]:text-2xl [&_h2]:font-semibold [&_h2]:tracking-tight`,`[&_h3]:mt-8 [&_h3]:mb-2 [&_h3]:font-sans [&_h3]:text-xl [&_h3]:font-semibold`,`[&_h4]:mt-6 [&_h4]:font-sans [&_h4]:text-lg [&_h4]:font-semibold [&_h5]:mt-4 [&_h5]:font-sans [&_h5]:font-semibold [&_h6]:mt-4 [&_h6]:font-sans [&_h6]:font-semibold`,`[&_p]:my-3 [&_a]:text-link [&_a]:underline [&_a]:underline-offset-2`,`[&_ul]:my-3 [&_ul]:list-disc [&_ul]:pl-7 [&_ol]:my-3 [&_ol]:list-decimal [&_ol]:pl-7 [&_li_p]:my-1`,`[&_blockquote]:my-5 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-5 [&_blockquote]:text-muted-foreground [&_blockquote]:italic`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]`,`[&_pre]:my-5 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-4 [&_pre]:text-sm [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_hr]:my-8 [&_hr]:border-border`,`[&_.tableWrapper]:my-5 [&_.tableWrapper]:overflow-x-auto [&_table]:w-full [&_table]:table-fixed [&_table]:border-collapse [&_table]:font-sans [&_table]:text-sm`,`[&_td]:relative [&_td]:border [&_td]:border-border [&_td]:p-2 [&_td]:align-top`,`[&_th]:relative [&_th]:border [&_th]:border-border [&_th]:bg-muted [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold`,`[&_.selectedCell]:bg-accent`,`[&_.column-resize-handle]:pointer-events-none [&_.column-resize-handle]:absolute [&_.column-resize-handle]:top-0 [&_.column-resize-handle]:-right-0.5 [&_.column-resize-handle]:bottom-0 [&_.column-resize-handle]:w-1 [&_.column-resize-handle]:bg-primary`,`[&.resize-cursor]:cursor-col-resize`,`[&_.is-empty]:before:pointer-events-none [&_.is-empty]:before:float-left [&_.is-empty]:before:h-0 [&_.is-empty]:before:text-muted-foreground [&_.is-empty]:before:content-[attr(data-placeholder)]`].join(` `),HS=(e,t,n)=>{let r=e.view.dom.getBoundingClientRect(),i=e.view.posAtCoords({left:r.left+8,top:n});if(!i)return null;let a=Wp(e.state.doc,i.inside>=0?i.inside:i.pos),o=a?e.view.nodeDOM(a.pos):null;return!a||!(o instanceof HTMLElement)?null:{pos:a.pos,top:o.getBoundingClientRect().top-t.getBoundingClientRect().top}},US=e=>{let{t}=s(),{uploadMedia:n}=ft(),{context:r,definition:i,field:a,path:o}=e,[c,l]=(0,j.useState)(!1),[f,p]=(0,j.useState)(null),[m,h]=(0,j.useState)(!1),[g]=(0,j.useState)(CS),_=(0,j.useRef)(null),[v]=(0,j.useState)(()=>Sp(()=>void 0)),y=n!==void 0,b=typeof a.options.placeholder==`string`?a.options.placeholder:void 0,x=(0,j.useMemo)(()=>LS({placeholder:b??t(`entry.canvas.placeholder`),uploadingLabel:e=>t(`entry.upload.uploading`,{name:e}),slash:g,onFiles:y?v.call:void 0}),[b,t,g,y,v]);(0,j.useEffect)(()=>{v.set((e,r,i)=>{n&&IS(e,r,i,n,(e,n)=>{u(n,`uploading ${e.name} into rich text`),d.error(t(`entry.upload.failed`,{name:e.name}))})})});let{editor:S,initial:ee,editable:te}=Bp({props:e,extensions:x,contentClasses:VS,onLinkShortcut:()=>l(!0),refuseFileDrops:!y}),re=mt(),C=kp(S),ie=(0,j.useCallback)(async()=>{try{return(await r.pickMedia({multiple:!0,allowedKinds:[`image`]})??[]).map(e=>({mediaId:e.id,alt:e.alt||null}))}catch(e){return ne(e,`picking images`),[]}},[r]),ae=(0,j.useCallback)((e,t)=>Me(S,e,t,ie),[S,ie]),oe=(0,j.useMemo)(()=>({insertBlock:(e,t)=>ae(e,Ie(S,t))}),[ae,S]);be(o,te?oe:void 0);let se=e=>{!m&&_.current&&te&&p(HS(S,_.current,e.clientY))},ce=i.type===`richtext`?i.settings.maxLength:void 0;return(0,M.jsxs)(`div`,{ref:_,className:`relative`,onMouseMove:se,onMouseLeave:()=>m?void 0:p(null),"data-rich-text-canvas":!0,children:[te&&f?(0,M.jsx)(Jp,{editor:S,block:f,onInsert:(e,t)=>void ae(e,t),onMenuOpenChange:h}):null,(0,M.jsx)(Gf,{editor:S}),te?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(ug,{editor:S,onLink:()=>l(!0),onRewrite:re?C.start:void 0}),re?(0,M.jsx)(RS,{editor:S,rewrite:C}):null,(0,M.jsx)(Hp,{editor:S,active:S.isActive(`link`),disabled:!1,open:c,onOpenChange:l,anchorToSelection:!0}),(0,M.jsx)(BS,{editor:S,bridge:g,onChoose:(e,t)=>void De(S,e,t.range,ie)})]}):null,(0,M.jsx)(Up,{editor:S,initial:ee,maxLength:ce})]})},WS={rows:3,cols:3,withHeaderRow:!0},GS=({editor:e,inTable:t,disabled:n})=>{let{t:r}=s(),i=t=>t(e.chain().focus()).run();return(0,M.jsxs)(nt,{children:[(0,M.jsx)(et,{asChild:!0,disabled:n,children:(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":r(`content.richText.table`),"aria-pressed":t,className:`aria-pressed:bg-accent aria-pressed:text-accent-foreground`,children:(0,M.jsx)(xe,{"aria-hidden":`true`})})}),(0,M.jsxs)(tt,{align:`start`,onCloseAutoFocus:t=>{t.preventDefault(),e.commands.focus()},children:[(0,M.jsx)(Ze,{disabled:t,onSelect:()=>i(e=>e.command(({tr:e})=>(e.selection instanceof E&&e.setSelection(k.near(e.doc.resolve(e.selection.to))),!0)).insertTable(WS)),children:r(`content.richText.insertTable`)}),(0,M.jsx)(Qe,{}),(0,M.jsx)(Ze,{disabled:!t,onSelect:()=>i(e=>e.addRowAfter()),children:r(`content.richText.addRow`)}),(0,M.jsx)(Ze,{disabled:!t,onSelect:()=>i(e=>e.addColumnAfter()),children:r(`content.richText.addColumn`)}),(0,M.jsx)(Ze,{disabled:!t,onSelect:()=>i(e=>e.toggleHeaderRow()),children:r(`content.richText.toggleHeaderRow`)}),(0,M.jsx)(Ze,{disabled:!t,onSelect:()=>i(e=>e.deleteRow()),children:r(`content.richText.deleteRow`)}),(0,M.jsx)(Ze,{disabled:!t,onSelect:()=>i(e=>e.deleteColumn()),children:r(`content.richText.deleteColumn`)}),(0,M.jsx)(Qe,{}),(0,M.jsx)(Ze,{disabled:!t,variant:`destructive`,onSelect:()=>i(e=>e.deleteTable()),children:r(`content.richText.deleteTable`)})]})]})},KS=[1,2,3,4,5,6],qS={paragraph:`content.richText.paragraph`,h1:`content.richText.heading1`,h2:`content.richText.heading2`,h3:`content.richText.heading3`,h4:`content.richText.heading4`,h5:`content.richText.heading5`,h6:`content.richText.heading6`,codeBlock:`content.richText.codeBlock`},JS=e=>{if(e.isActive(`codeBlock`))return`codeBlock`;let t=KS.find(t=>e.isActive(`heading`,{level:t}));return t?`h${t}`:`paragraph`},YS=(e,t)=>{let n=e.chain().focus();t===`paragraph`?n.setParagraph().run():t===`codeBlock`?n.toggleCodeBlock().run():n.setHeading({level:Number(t.slice(1))}).run()},XS=({editor:e,minimal:t,disabled:n,linkOpen:r,onLinkOpenChange:i,onInsertImage:a})=>{let{t:o}=s(),c=Jf({editor:e,selector:({editor:e})=>({block:JS(e),bold:e.isActive(`bold`),italic:e.isActive(`italic`),code:e.isActive(`code`),link:e.isActive(`link`),bulletList:e.isActive(`bulletList`),orderedList:e.isActive(`orderedList`),blockquote:e.isActive(`blockquote`),table:e.isActive(`table`),canUndo:e.can().undo(),canRedo:e.can().redo()})}),l=()=>e.chain().focus();return(0,M.jsxs)(`div`,{role:`toolbar`,"aria-label":o(`content.richText.toolbar`),className:`flex min-h-9 flex-wrap items-center gap-0.5 border-b bg-muted/40 px-1`,children:[t?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(de,{value:c.block,disabled:n,onValueChange:t=>YS(e,t),children:[(0,M.jsx)(ce,{size:`sm`,"aria-label":o(`content.richText.blockType`),className:`w-36 border-transparent bg-transparent shadow-none dark:bg-transparent`,children:(0,M.jsx)(se,{})}),(0,M.jsx)(le,{children:Object.keys(qS).map(e=>(0,M.jsx)(ue,{value:e,children:o(qS[e])},e))})]}),(0,M.jsx)(pe,{orientation:`vertical`,className:`mx-1 h-5`})]}),(0,M.jsx)(Y,{icon:Ot,label:o(`content.richText.bold`),keys:`Mod+B`,pressed:c.bold,disabled:n,onClick:()=>l().toggleBold().run()}),(0,M.jsx)(Y,{icon:At,label:o(`content.richText.italic`),keys:`Mod+I`,pressed:c.italic,disabled:n,onClick:()=>l().toggleItalic().run()}),t?null:(0,M.jsx)(Y,{icon:Ke,label:o(`content.richText.code`),keys:`Mod+E`,pressed:c.code,disabled:n,onClick:()=>l().toggleCode().run()}),(0,M.jsx)(Hp,{editor:e,active:c.link,disabled:n,open:r,onOpenChange:i}),(0,M.jsx)(pe,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:$e,label:o(`content.richText.bulletList`),keys:`Mod+Shift+8`,pressed:c.bulletList,disabled:n,onClick:()=>l().toggleBulletList().run()}),(0,M.jsx)(Y,{icon:Ce,label:o(`content.richText.orderedList`),keys:`Mod+Shift+7`,pressed:c.orderedList,disabled:n,onClick:()=>l().toggleOrderedList().run()}),t?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Y,{icon:Se,label:o(`content.richText.blockquote`),keys:`Mod+Shift+B`,pressed:c.blockquote,disabled:n,onClick:()=>l().toggleBlockquote().run()}),(0,M.jsx)(pe,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:Xe,label:o(`content.richText.image`),disabled:n,onClick:a}),(0,M.jsx)(GS,{editor:e,inTable:c.table,disabled:n}),(0,M.jsx)(Y,{icon:me,label:o(`content.richText.horizontalRule`),disabled:n,onClick:()=>l().setHorizontalRule().run()})]}),(0,M.jsxs)(`span`,{className:`ml-auto flex`,children:[(0,M.jsx)(Y,{icon:at,label:o(`content.richText.undo`),keys:`Mod+Z`,disabled:n||!c.canUndo,onClick:()=>l().undo().run()}),(0,M.jsx)(Y,{icon:Mt,label:o(`content.richText.redo`),keys:`Mod+Shift+Z`,disabled:n||!c.canRedo,onClick:()=>l().redo().run()})]})]})},ZS=[`min-h-48 px-4 py-3 text-sm leading-relaxed outline-none`,`[&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:text-3xl [&_h1]:font-extrabold [&_h1]:tracking-tight`,`[&_h2]:mt-4 [&_h2]:mb-2 [&_h2]:text-2xl [&_h2]:font-bold`,`[&_h3]:mt-3 [&_h3]:mb-1.5 [&_h3]:text-xl [&_h3]:font-bold`,`[&_h4]:mt-3 [&_h4]:mb-1 [&_h4]:text-lg [&_h4]:font-semibold`,`[&_h5]:mt-2 [&_h5]:font-semibold [&_h6]:mt-2 [&_h6]:font-semibold [&_h6]:text-muted-foreground`,`[&_p]:my-2 [&_a]:text-link [&_a]:underline [&_a]:underline-offset-2`,`[&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-6 [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-6`,`[&_blockquote]:my-3 [&_blockquote]:border-l-4 [&_blockquote]:border-border dark:[&_blockquote]:border-link [&_blockquote]:pl-4 [&_blockquote]:text-muted-foreground`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]`,`[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_hr]:my-4 [&_hr]:border-border`,`[&_.tableWrapper]:my-3 [&_.tableWrapper]:overflow-x-auto`,`[&_table]:w-full [&_table]:table-fixed [&_table]:border-collapse`,`[&_td]:relative [&_td]:border [&_td]:border-border [&_td]:p-2 [&_td]:align-top`,`[&_th]:relative [&_th]:border [&_th]:border-border [&_th]:bg-muted [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold`,`[&_.selectedCell]:bg-accent`,`[&_.column-resize-handle]:pointer-events-none [&_.column-resize-handle]:absolute [&_.column-resize-handle]:top-0 [&_.column-resize-handle]:-right-0.5 [&_.column-resize-handle]:bottom-0 [&_.column-resize-handle]:w-1 [&_.column-resize-handle]:bg-primary`,`[&.resize-cursor]:cursor-col-resize`,`[&_p.is-editor-empty:first-child]:before:pointer-events-none [&_p.is-editor-empty:first-child]:before:float-left [&_p.is-editor-empty:first-child]:before:h-0 [&_p.is-editor-empty:first-child]:before:text-muted-foreground [&_p.is-editor-empty:first-child]:before:content-[attr(data-placeholder)]`].join(` `),QS=e=>e.appearance===`canvas`?(0,M.jsx)(US,{...e}):(0,M.jsx)($S,{...e}),$S=e=>{let{t}=s(),{field:n,context:r,validation:i,definition:a}=e,[o,c]=(0,j.useState)(!1),l=typeof n.options.placeholder==`string`?n.options.placeholder:void 0,{editor:u,initial:d,editable:f}=Bp({props:e,extensions:(0,j.useMemo)(()=>nS({placeholder:l??t(`content.richText.placeholder`),imageView:_p(aS)}),[l,t]),contentClasses:ZS,onLinkShortcut:()=>c(!0),refuseFileDrops:!0}),p=a.type===`richtext`?a.settings.maxLength:void 0,m=async()=>{try{let e=await r.pickMedia({multiple:!0,allowedKinds:[`image`]});for(let t of e??[])u.chain().focus().insertMediaImage({mediaId:t.id,alt:t.alt||null}).run()}catch(e){ne(e,`inserting an image`)}};return(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsxs)(`div`,{className:ot(`overflow-hidden rounded-lg border border-input bg-card focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50 dark:bg-input/20`,i.invalid&&`border-destructive`),children:[f?(0,M.jsx)(XS,{editor:u,minimal:n.options.toolbar===`minimal`,disabled:!f,linkOpen:o,onLinkOpenChange:c,onInsertImage:()=>void m()}):null,(0,M.jsx)(Gf,{editor:u})]}),(0,M.jsx)(Up,{editor:u,initial:d,maxLength:p})]})};export{QS as RichTextField};
144
- //# sourceMappingURL=RichTextField-CVHRIbnu.js.map
144
+ //# sourceMappingURL=RichTextField-Dou79MHF.js.map