@juki-team/base-ui 1.4.131 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (748) hide show
  1. package/dist/esm/ArrowForwardIcon-B6qJaqxW.js +1 -0
  2. package/dist/esm/BarChart-DGvfKEbJ.js +1 -0
  3. package/dist/esm/CartesianChart-BLpd_e8l.js +47 -0
  4. package/dist/esm/ChangePasswordModal-8aYa6mTN.js +1 -0
  5. package/dist/esm/CodeEditor-BKMFVmPO.js +1 -0
  6. package/dist/esm/CodeViewer-DqO18gks.js +1 -0
  7. package/dist/esm/Collapse-DMLYcciz.js +1 -0
  8. package/dist/esm/DataGrid-C-Gco96b.js +272 -0
  9. package/dist/esm/DataViewer-DIROui4g.js +1 -0
  10. package/dist/esm/DrawerView-Be_ckf6D.js +1 -0
  11. package/dist/esm/ExcalidrawButton-DWRJMohJ.js +1 -0
  12. package/dist/esm/GraphvizViewer-DUIJSiDq.js +1 -0
  13. package/dist/esm/ImageLoaderCropper-O3UDeKd5.js +1 -0
  14. package/dist/esm/InputCellPhoneNumber-ByG_R6dr.js +1 -0
  15. package/dist/esm/InputColor-C_JNgwYl.js +14 -0
  16. package/dist/esm/LineChart-BkCo4cnj.js +1 -0
  17. package/dist/esm/LoaderLayer-D9O7WqFD.js +1 -0
  18. package/dist/esm/MdMath-C38RmN3O.js +1 -0
  19. package/dist/esm/MdMathEditor-C7surRiM.js +28 -0
  20. package/dist/esm/{Popover-Dd5soClw.js → Popover-BaP7hJ0J.js} +2 -2
  21. package/dist/esm/ReplyIcon-CPGYEALJ.js +1 -0
  22. package/dist/esm/SettingsIcon-Dk27Vz1G.js +1 -0
  23. package/dist/esm/SlideDeck-CpWGHFVE.js +1 -0
  24. package/dist/esm/TableEyeIcon-D74isCSR.js +1 -0
  25. package/dist/esm/TableOfContents-888D-B0V.js +1 -0
  26. package/dist/esm/Tooltip-CNWDFJKv.js +13 -0
  27. package/dist/esm/UserCodeEditor-C0MyUL5-.js +28 -0
  28. package/dist/esm/VirtualizedRowsFixed-CYPaWB5L.js +1 -0
  29. package/dist/esm/WorksheetAsSlides-BNOZBoQY.js +1 -0
  30. package/dist/esm/WorksheetBodies-CHTN-wn9.js +1 -0
  31. package/dist/esm/WorksheetContents-IN63vuWT.js +1 -0
  32. package/dist/esm/WorksheetEditor-Hs_sWk7j.js +1 -0
  33. package/dist/esm/WorksheetNode-DGuKOPTt.js +1 -0
  34. package/dist/esm/WorksheetViewer-Bt_jqHdh.js +1 -0
  35. package/dist/esm/_baseIteratee-DJNkOVK7.js +1 -0
  36. package/dist/esm/_baseUniq-BJKKUJ6e.js +1 -0
  37. package/dist/esm/arc-BqJSq9Se.js +1 -0
  38. package/dist/esm/architecture-YZFGNWBL-BExtdnEH.js +1 -0
  39. package/dist/esm/architectureDiagram-Q4EWVU46-CUhUPzlC.js +1 -0
  40. package/dist/esm/{band-sgKLmfhd.js → band-D2afako6.js} +1 -1
  41. package/dist/esm/basic-setup-UGhpl5jF.js +1 -0
  42. package/dist/esm/blockDiagram-DXYQGD6D-DwW8YrKx.js +1 -0
  43. package/dist/esm/c4Diagram-AHTNJAMY-DUUpakLg.js +1 -0
  44. package/dist/esm/channel-a8NrvAcc.js +1 -0
  45. package/dist/esm/{chunk-4BX2VUAB-CEdoBw7_.js → chunk-4BX2VUAB-BwFNstmG.js} +1 -1
  46. package/dist/esm/chunk-4TB4RGXK-DV5sTBnv.js +1 -0
  47. package/dist/esm/chunk-55IACEB6-BPJEY6mM.js +1 -0
  48. package/dist/esm/chunk-EDXVE4YY-9L7nz82K.js +1 -0
  49. package/dist/esm/{chunk-FMBD7UC4-a15wpTbq.js → chunk-FMBD7UC4-BZMcHvFk.js} +1 -1
  50. package/dist/esm/chunk-OYMX7WX6-COWCWylB.js +1 -0
  51. package/dist/esm/{chunk-QZHKN3VN-BQxiWiUu.js → chunk-QZHKN3VN-D2pIW1ss.js} +1 -1
  52. package/dist/esm/chunk-YZCP3GAM-D9GadUwL.js +1 -0
  53. package/dist/esm/classDiagram-6PBFFD2Q-Cr8ipQ5w.js +1 -0
  54. package/dist/esm/classDiagram-v2-HSJHXN6E-Cr8ipQ5w.js +1 -0
  55. package/dist/esm/clone-1ULLnhdV.js +1 -0
  56. package/dist/esm/commons-B_OozOv-.js +1 -0
  57. package/dist/esm/constants.js +1 -1
  58. package/dist/esm/cose-bilkent-S5V4N54A-Dg1f2q8q.js +1 -0
  59. package/dist/esm/cytoscape.esm-D5qQrGhU.js +9 -0
  60. package/dist/esm/dagre-KV5264BT-Drwedjf_.js +1 -0
  61. package/dist/esm/{defaultLocale-BAKTrQtR.js → defaultLocale-HOdfsG1x.js} +1 -1
  62. package/dist/esm/diagram-5BDNPKRD-BUvinU3I.js +1 -0
  63. package/dist/esm/diagram-G4DWMVQ6-D60Wox58.js +1 -0
  64. package/dist/esm/diagram-MMDJMWI5-C60GB5LZ.js +1 -0
  65. package/dist/esm/diagram-TYMM5635-CMF-zVic.js +1 -0
  66. package/dist/esm/erDiagram-SMLLAGMA-BmCfxmBR.js +1 -0
  67. package/dist/esm/{floating-ui.dom-D1Wb0QDy.js → floating-ui.dom-BKnkJW47.js} +1 -1
  68. package/dist/esm/flowDiagram-DWJPFMVM-CVOjnh-h.js +1 -0
  69. package/dist/esm/ganttDiagram-T4ZO3ILL-Cay-LcBr.js +1 -0
  70. package/dist/esm/gitGraph-7Q5UKJZL-BIhofRTU.js +1 -0
  71. package/dist/esm/gitGraphDiagram-UUTBAWPF-BN1EkaA3.js +1 -0
  72. package/dist/esm/graph-XFLEVMvo.js +1 -0
  73. package/dist/esm/helpers.js +1 -1
  74. package/dist/esm/index--PWk-3Ol.js +1 -0
  75. package/dist/esm/index-A0sdG_JC.js +1 -0
  76. package/dist/esm/index-B3fb7Ita.js +1 -0
  77. package/dist/esm/index-BR16hIbn.js +1 -0
  78. package/dist/esm/index-Bp7rYslS.js +1 -0
  79. package/dist/esm/index-Bw2EofiE.js +1 -0
  80. package/dist/esm/index-BzjjAmh3.js +1 -0
  81. package/dist/esm/{index-XKEYn2Wr.js → index-C9_5xd3V.js} +1 -1
  82. package/dist/esm/index-CB1_GL3t.js +1 -0
  83. package/dist/esm/index-CODLgwqm.js +1 -0
  84. package/dist/esm/index-CQbc3KUq.js +1 -0
  85. package/dist/esm/index-CRfRlH9U.js +1 -0
  86. package/dist/esm/index-Ccq-5wm6.js +1 -0
  87. package/dist/esm/index-Cj5SSv5l.js +1 -0
  88. package/dist/esm/index-Ck9BxS1f.js +1 -0
  89. package/dist/esm/index-CpRfyO85.js +1 -0
  90. package/dist/esm/index-CtTbnbzM.js +1 -0
  91. package/dist/esm/index-CtWPxOcn.js +1 -0
  92. package/dist/esm/index-D2mDsVm5.js +1 -0
  93. package/dist/esm/index-D4D24Np7.js +1 -0
  94. package/dist/esm/index-D5NvcxPc.js +1 -0
  95. package/dist/esm/index-D8zPYs0m.js +1 -0
  96. package/dist/esm/index-DAJdettS.js +1 -0
  97. package/dist/esm/index-DSGuayJy.js +1 -0
  98. package/dist/esm/index-DVFv6Eth.js +1 -0
  99. package/dist/esm/index-D_AOS7Yx.js +1 -0
  100. package/dist/esm/index-EPJhFLhN.js +1 -0
  101. package/dist/esm/index-GoUUn3QE.js +1 -0
  102. package/dist/esm/index-QhLowdpF.js +1 -0
  103. package/dist/esm/index-Y09lLL_e.js +1 -0
  104. package/dist/esm/index-xaEdDd13.js +1 -0
  105. package/dist/esm/info-OMHHGYJF-DMKJgJ3s.js +1 -0
  106. package/dist/esm/infoDiagram-42DDH7IO-kAZbkK9S.js +1 -0
  107. package/dist/esm/{init-DWDD0M30.js → init-DLRA0X12.js} +1 -1
  108. package/dist/esm/isSymbol-CATEdeai.js +1 -0
  109. package/dist/esm/isUndefined-DgmxjSXK.js +1 -0
  110. package/dist/esm/ishikawaDiagram-UXIWVN3A-MtQmxrIE.js +1 -0
  111. package/dist/esm/journeyDiagram-VCZTEJTY-BuKFXeHL.js +1 -0
  112. package/dist/esm/kanban-definition-6JOO6SKY-pGcXhhi7.js +1 -0
  113. package/dist/esm/layout-D9uGd7GO.js +1 -0
  114. package/dist/esm/{lib-mG56Y3Rb.js → lib-DdKR2uQv.js} +1 -1
  115. package/dist/esm/{linear-L30X52KW.js → linear-BnXjbO66.js} +1 -1
  116. package/dist/esm/{lua-BvgfYBhq.js → lua-8DXOpKDz.js} +1 -1
  117. package/dist/esm/main.js +1 -1
  118. package/dist/esm/map-BvlAjF4J.js +1 -0
  119. package/dist/esm/memoize-CPUrcYQl.js +1 -0
  120. package/dist/esm/mermaid-parser.core-Crc-QLCi.js +1 -0
  121. package/dist/esm/mermaid.core-C2hrg85i.js +1 -0
  122. package/dist/esm/min-Dc9VrJ6M.js +1 -0
  123. package/dist/esm/mindmap-definition-QFDTVHPH-CtfxHH9N.js +1 -0
  124. package/dist/esm/{ordinal-UuA5o140.js → ordinal-zwWoQKz9.js} +1 -1
  125. package/dist/esm/packet-4T2RLAQJ-BD2Ad6jE.js +1 -0
  126. package/dist/esm/pie-ZZUOXDRM-Bf017PqT.js +1 -0
  127. package/dist/esm/pieDiagram-DEJITSTG-ChBbMYd8.js +1 -0
  128. package/dist/esm/purify.es-DBOWJxv3.js +2 -0
  129. package/dist/esm/quadrantDiagram-34T5L4WZ-BNmMB-pp.js +1 -0
  130. package/dist/esm/radar-PYXPWWZC-DvvZel7z.js +1 -0
  131. package/dist/esm/requirementDiagram-MS252O5E-B1RjmS2l.js +1 -0
  132. package/dist/esm/sankeyDiagram-XADWPNL6-DSuRDDHI.js +1 -0
  133. package/dist/esm/sequenceDiagram-FGHM5R23-ByfYuCTD.js +1 -0
  134. package/dist/esm/server.js +1 -1
  135. package/dist/esm/settings-BIQ7IqJl.js +1 -0
  136. package/dist/esm/settings.js +1 -1
  137. package/dist/esm/stateDiagram-FHFEXIEX-CMjgjvak.js +1 -0
  138. package/dist/esm/stateDiagram-v2-QKLJ7IA2-htYMk5r5.js +1 -0
  139. package/dist/esm/{string-CQk_HvWX.js → string-LeDn2fkG.js} +1 -1
  140. package/dist/esm/throttle-BsCMUG1-.js +1 -0
  141. package/dist/esm/time-PiK_t_Re.js +1 -0
  142. package/dist/esm/timeline-definition-GMOUNBTQ-COFLk0ve.js +1 -0
  143. package/dist/esm/toNumber-Bh_HTlSx.js +1 -0
  144. package/dist/esm/treeView-SZITEDCU-Ck6yPSxL.js +1 -0
  145. package/dist/esm/treemap-W4RFUUIX-ErJXCLFJ.js +1 -0
  146. package/dist/esm/types-rkDjePoL.js +1 -0
  147. package/dist/esm/vennDiagram-DHZGUBPP-xxvi147V.js +1 -0
  148. package/dist/esm/viz-CFEjElvl.js +9 -0
  149. package/dist/esm/wardley-RL74JXVD-B3jC7s0b.js +1 -0
  150. package/dist/esm/wardleyDiagram-NUSXRM2D-CIYzWE9T.js +1 -0
  151. package/dist/esm/websocket-CxbYBjHT.js +1 -0
  152. package/dist/esm/worksheet-CQgex79V.js +1 -0
  153. package/dist/esm/xychartDiagram-5P7HB3ND-CHfEshBW.js +1 -0
  154. package/dist/module-types/src/components/atoms/Button/Button.d.ts +3 -3
  155. package/dist/module-types/src/components/atoms/Client/types.d.ts +1 -1
  156. package/dist/module-types/src/components/atoms/CopyToClipboard/types.d.ts +2 -2
  157. package/dist/module-types/src/components/atoms/{server/DateLiteral → DateLiteral}/types.d.ts +2 -2
  158. package/dist/module-types/src/components/atoms/DetectRequestAnimationFrame/DetectRequestAnimationFrame.d.ts +1 -1
  159. package/dist/module-types/src/components/atoms/Div/Div.d.ts +1 -1
  160. package/dist/module-types/src/components/atoms/Div/types.d.ts +1 -1
  161. package/dist/module-types/src/components/atoms/Input/Input.d.ts +6 -8
  162. package/dist/module-types/src/components/atoms/Input/types.d.ts +4 -4
  163. package/dist/module-types/src/components/atoms/Modal/types.d.ts +3 -3
  164. package/dist/module-types/src/components/atoms/Portal/Portal.d.ts +1 -1
  165. package/dist/module-types/src/components/atoms/Portal/types.d.ts +1 -1
  166. package/dist/module-types/src/components/atoms/T/types.d.ts +1 -12
  167. package/dist/module-types/src/components/atoms/TextArea/TextArea.d.ts +4 -4
  168. package/dist/module-types/src/components/atoms/_lazy_/Collapse/types.d.ts +2 -2
  169. package/dist/module-types/src/components/atoms/_lazy_/InputCellPhoneNumber/types.d.ts +1 -1
  170. package/dist/module-types/src/components/atoms/_lazy_/Popover/types.d.ts +2 -2
  171. package/dist/module-types/src/components/atoms/_lazy_/VirtualizedRowsFixed/types.d.ts +1 -1
  172. package/dist/module-types/src/components/atoms/index.d.ts +6 -6
  173. package/dist/module-types/src/components/atoms/server/icons/SpinIcon/Spin.d.ts +1 -1
  174. package/dist/module-types/src/components/atoms/server/icons/SpinIcon/types.d.ts +2 -2
  175. package/dist/module-types/src/components/atoms/server/icons/google/_group.d.ts +1 -1
  176. package/dist/module-types/src/components/atoms/server/icons/google/index.d.ts +1 -1
  177. package/dist/module-types/src/components/atoms/server/icons/index.d.ts +1 -1
  178. package/dist/module-types/src/components/atoms/server/icons/specials/BalloonIcon/index.d.ts +1 -1
  179. package/dist/module-types/src/components/atoms/server/icons/specials/BalloonIcon/types.d.ts +2 -2
  180. package/dist/module-types/src/components/atoms/server/icons/specials/FacebookIcon/types.d.ts +2 -2
  181. package/dist/module-types/src/components/atoms/server/icons/specials/GmailIcon/types.d.ts +2 -2
  182. package/dist/module-types/src/components/atoms/server/icons/specials/SortIcon/types.d.ts +2 -2
  183. package/dist/module-types/src/components/atoms/server/icons/specials/TelegramIcon/types.d.ts +2 -2
  184. package/dist/module-types/src/components/atoms/server/icons/specials/types.d.ts +6 -5
  185. package/dist/module-types/src/components/atoms/server/icons/types.d.ts +16 -16
  186. package/dist/module-types/src/components/atoms/server/icons/utils/CircleFilledFrame.d.ts +1 -1
  187. package/dist/module-types/src/components/atoms/server/icons/utils/CirclePath.d.ts +1 -1
  188. package/dist/module-types/src/components/atoms/server/icons/utils/functions.d.ts +3 -3
  189. package/dist/module-types/src/components/atoms/server/icons/utils/index.d.ts +2 -2
  190. package/dist/module-types/src/components/atoms/server/icons/utils/renderBasicIcon.d.ts +1 -1
  191. package/dist/module-types/src/components/atoms/server/icons/utils/renderSignIcon.d.ts +2 -2
  192. package/dist/module-types/src/components/atoms/server/index.d.ts +0 -2
  193. package/dist/module-types/src/components/atoms/server/loaders/LoaderLayer.d.ts +2 -2
  194. package/dist/module-types/src/components/atoms/server/loaders/index.d.ts +1 -1
  195. package/dist/module-types/src/components/atoms/server/loaders/line-loader/LineLoader.d.ts +1 -1
  196. package/dist/module-types/src/components/atoms/types.d.ts +11 -10
  197. package/dist/module-types/src/components/helpers/commons.d.ts +4 -4
  198. package/dist/module-types/src/components/helpers/contest.d.ts +1 -1
  199. package/dist/module-types/src/components/helpers/date.d.ts +4 -3
  200. package/dist/module-types/src/components/helpers/fetch.d.ts +7 -7
  201. package/dist/module-types/src/components/helpers/layout.d.ts +2 -2
  202. package/dist/module-types/src/components/helpers/problem.d.ts +4 -15
  203. package/dist/module-types/src/components/helpers/render.d.ts +1 -1
  204. package/dist/module-types/src/components/helpers/router.d.ts +1 -1
  205. package/dist/module-types/src/components/helpers/submission.d.ts +2 -2
  206. package/dist/module-types/src/components/helpers/time.d.ts +1 -1
  207. package/dist/module-types/src/components/helpers/websocket.d.ts +40 -2
  208. package/dist/module-types/src/components/hooks/useClickOutside.d.ts +1 -1
  209. package/dist/module-types/src/components/hooks/useDataViewerRequester.d.ts +3 -3
  210. package/dist/module-types/src/components/hooks/useFetcher.d.ts +4 -4
  211. package/dist/module-types/src/components/hooks/useHandleState.d.ts +1 -1
  212. package/dist/module-types/src/components/hooks/useInjectTheme.d.ts +1 -1
  213. package/dist/module-types/src/components/hooks/useJudge.d.ts +3 -4
  214. package/dist/module-types/src/components/hooks/useJukiNotification.d.ts +1 -1
  215. package/dist/module-types/src/components/hooks/useJukiUser.d.ts +10 -12
  216. package/dist/module-types/src/components/hooks/useLoaderStatusSync.d.ts +1 -1
  217. package/dist/module-types/src/components/hooks/useOverflowDetector.d.ts +1 -1
  218. package/dist/module-types/src/components/hooks/useSubscribe.d.ts +2 -2
  219. package/dist/module-types/src/components/hooks/useSyncedState.d.ts +1 -1
  220. package/dist/module-types/src/components/hooks/useTrackCursor.d.ts +1 -1
  221. package/dist/module-types/src/components/index.d.ts +1 -1
  222. package/dist/module-types/src/components/mockup/MockupJukiProvider.d.ts +1 -1
  223. package/dist/module-types/src/components/mockup/index.d.ts +4 -0
  224. package/dist/module-types/src/components/molecules/Breadcrumbs/types.d.ts +1 -1
  225. package/dist/module-types/src/components/molecules/ButtonLoader/types.d.ts +1 -1
  226. package/dist/module-types/src/components/molecules/CheckboxList/types.d.ts +1 -1
  227. package/dist/module-types/src/components/molecules/{server/CircularProgress → CircularProgress}/CircularProgress.d.ts +1 -1
  228. package/dist/module-types/src/components/molecules/DatePicker/DatePicker.d.ts +1 -4
  229. package/dist/module-types/src/components/molecules/DatePicker/types.d.ts +17 -17
  230. package/dist/module-types/src/components/molecules/Drawer/types.d.ts +1 -1
  231. package/dist/module-types/src/components/molecules/FetcherLayer/FetcherLayer.d.ts +2 -2
  232. package/dist/module-types/src/components/molecules/FetcherLayer/types.d.ts +8 -8
  233. package/dist/module-types/src/components/molecules/FirstLoginWrapper/types.d.ts +1 -1
  234. package/dist/module-types/src/components/molecules/FloatToolbar/types.d.ts +2 -2
  235. package/dist/module-types/src/components/molecules/HomeLink/types.d.ts +2 -0
  236. package/dist/module-types/src/components/molecules/InformationPopover/FrozenInformation.d.ts +1 -1
  237. package/dist/module-types/src/components/molecules/InformationPopover/InformationPopover.d.ts +2 -2
  238. package/dist/module-types/src/components/molecules/InformationPopover/NewlineInfo.d.ts +3 -0
  239. package/dist/module-types/src/components/molecules/InformationPopover/QuietInformation.d.ts +1 -1
  240. package/dist/module-types/src/components/molecules/InformationPopover/UpsolvingInformation.d.ts +1 -1
  241. package/dist/module-types/src/components/molecules/InformationPopover/types.d.ts +1 -1
  242. package/dist/module-types/src/components/molecules/LinkLastPath/types.d.ts +2 -2
  243. package/dist/module-types/src/components/molecules/MultiSelectSearchable/types.d.ts +1 -1
  244. package/dist/module-types/src/components/molecules/Pagination/Pagination.d.ts +1 -1
  245. package/dist/module-types/src/components/molecules/ProgressMultiBar/types.d.ts +5 -1
  246. package/dist/module-types/src/components/molecules/ProgressSlide/ProgressSlide.d.ts +1 -1
  247. package/dist/module-types/src/components/molecules/SplitModal/types.d.ts +1 -1
  248. package/dist/module-types/src/components/molecules/SplitPane/types.d.ts +1 -1
  249. package/dist/module-types/src/components/molecules/Tabs/types.d.ts +1 -1
  250. package/dist/module-types/src/components/molecules/TabsInline/TabsInline.deprecated.d.ts +2 -0
  251. package/dist/module-types/src/components/molecules/TabsInline/TabsInlineButton.d.ts +1 -1
  252. package/dist/module-types/src/components/molecules/TabsInline/TabsInlineButtonLoader.d.ts +1 -1
  253. package/dist/module-types/src/components/molecules/TabsInlineBody/TabsInlineBody.deprecated.d.ts +2 -0
  254. package/dist/module-types/src/components/molecules/ThemeColorPalette/types.d.ts +2 -0
  255. package/dist/module-types/src/components/molecules/{server/TimerDisplay → Timer}/TimerDisplay.d.ts +1 -1
  256. package/dist/module-types/src/components/molecules/Timer/types.d.ts +13 -2
  257. package/dist/module-types/src/components/molecules/TimerLabeled/types.d.ts +2 -2
  258. package/dist/module-types/src/components/molecules/TwoActionModal/types.d.ts +1 -1
  259. package/dist/module-types/src/components/molecules/TwoContentSection/types.d.ts +1 -1
  260. package/dist/module-types/src/components/molecules/_lazy_/BarChart/types.d.ts +3 -3
  261. package/dist/module-types/src/components/molecules/_lazy_/CodeEditor/CodeEditor.d.ts +1 -1
  262. package/dist/module-types/src/components/molecules/_lazy_/CodeEditor/codemirror/ReactCodeMirror.d.ts +2 -8
  263. package/dist/module-types/src/components/molecules/_lazy_/CodeEditor/codemirror/extensions/basic-setup.d.ts +1 -1
  264. package/dist/module-types/src/components/molecules/_lazy_/CodeEditor/codemirror/timeoutLatch.d.ts +1 -1
  265. package/dist/module-types/src/components/molecules/_lazy_/CodeEditor/codemirror/types.d.ts +1 -1
  266. package/dist/module-types/src/components/molecules/_lazy_/CodeEditor/codemirror/useCodeMirror.d.ts +1 -1
  267. package/dist/module-types/src/components/molecules/_lazy_/CodeEditor/index.d.ts +1 -1
  268. package/dist/module-types/src/components/molecules/_lazy_/CodeEditor/types.d.ts +1 -1
  269. package/dist/module-types/src/components/molecules/_lazy_/CodeViewer/types.d.ts +2 -2
  270. package/dist/module-types/src/components/molecules/_lazy_/DataGrid/DataGrid.d.ts +1 -1
  271. package/dist/module-types/src/components/molecules/_lazy_/DrawerView/DrawerView.d.ts +1 -1
  272. package/dist/module-types/src/components/molecules/_lazy_/DrawerView/types.d.ts +1 -1
  273. package/dist/module-types/src/components/molecules/_lazy_/ImageLoaderCropper/canvasPreview.d.ts +1 -1
  274. package/dist/module-types/src/components/molecules/_lazy_/InputColor/types.d.ts +1 -1
  275. package/dist/module-types/src/components/molecules/_lazy_/LineChart/types.d.ts +4 -4
  276. package/dist/module-types/src/components/molecules/_lazy_/SlideDeck/pdfexport.d.ts +1 -1
  277. package/dist/module-types/src/components/molecules/_lazy_/SlideDeck/types.d.ts +2 -2
  278. package/dist/module-types/src/components/molecules/_lazy_/SortableItems/SortableItems.d.ts +1 -1
  279. package/dist/module-types/src/components/molecules/_lazy_/SortableItems/types.d.ts +5 -5
  280. package/dist/module-types/src/components/molecules/index.d.ts +22 -17
  281. package/dist/module-types/src/components/molecules/layouts/types.d.ts +1 -1
  282. package/dist/module-types/src/components/molecules/types.d.ts +14 -12
  283. package/dist/module-types/src/components/organisms/AiChatPanel/types.d.ts +2 -2
  284. package/dist/module-types/src/components/organisms/CardNotification/types.d.ts +2 -2
  285. package/dist/module-types/src/components/organisms/CheckUnsavedChanges/types.d.ts +1 -1
  286. package/dist/module-types/src/components/organisms/HorizontalMenu/types.d.ts +1 -1
  287. package/dist/module-types/src/components/organisms/LoginUser/types.d.ts +1 -1
  288. package/dist/module-types/src/components/organisms/MdMathViewer/MemoMdMathViewer.deprecated.d.ts +1 -1
  289. package/dist/module-types/src/components/organisms/MdMathViewer/types.d.ts +2 -2
  290. package/dist/module-types/src/components/organisms/PageNotFound/types.d.ts +1 -1
  291. package/dist/module-types/src/components/organisms/PresentationToolButtons/PresentationToolButtons.d.ts +1 -1
  292. package/dist/module-types/src/components/organisms/PresentationToolButtons/buttons/Pencil.deprecated.d.ts +0 -0
  293. package/dist/module-types/src/components/organisms/PresentationToolButtons/types.d.ts +2 -0
  294. package/dist/module-types/src/components/organisms/ProblemSelector/ProblemSelector.d.ts +1 -1
  295. package/dist/module-types/src/components/organisms/ProblemSelector/types.d.ts +2 -2
  296. package/dist/module-types/src/components/organisms/ProblemVerdictTag/types.d.ts +1 -1
  297. package/dist/module-types/src/components/organisms/SubmitView/SubmitView.d.ts +1 -1
  298. package/dist/module-types/src/components/organisms/SubmitView/commons/SubmissionGroupInfo.d.ts +1 -2
  299. package/dist/module-types/src/components/organisms/SubmitView/commons/SubmissionListenerVerdict.d.ts +1 -1
  300. package/dist/module-types/src/components/organisms/{server/SubmissionMemory → SubmitView/commons}/SubmissionMemory.d.ts +1 -1
  301. package/dist/module-types/src/components/organisms/{server/SubmissionTime → SubmitView/commons}/SubmissionTime.d.ts +1 -1
  302. package/dist/module-types/src/components/organisms/SubmitView/commons/SubmissionVerdict.d.ts +1 -2
  303. package/dist/module-types/src/components/organisms/SubmitView/commons/SubmitViewContent.d.ts +1 -1
  304. package/dist/module-types/src/components/organisms/SubmitView/types.d.ts +1 -1
  305. package/dist/module-types/src/components/organisms/{server/TextHeadCell → TextHeadCell}/TextHeadCell.d.ts +1 -1
  306. package/dist/module-types/src/components/organisms/UserChip/UserChip.d.ts +2 -5
  307. package/dist/module-types/src/components/organisms/UserChip/types.d.ts +3 -3
  308. package/dist/module-types/src/components/organisms/UserNicknameLink/UserNicknameLink.d.ts +1 -1
  309. package/dist/module-types/src/components/organisms/UsersSelector/types.d.ts +2 -2
  310. package/dist/module-types/src/components/organisms/VerticalMenu/types.d.ts +1 -1
  311. package/dist/module-types/src/components/organisms/_layz_/ChangePasswordModal/index.d.ts +1 -1
  312. package/dist/module-types/src/components/organisms/_layz_/ChangePasswordModal/types.d.ts +1 -1
  313. package/dist/module-types/src/components/organisms/_layz_/DataViewer/CardList/types.d.ts +1 -1
  314. package/dist/module-types/src/components/organisms/_layz_/DataViewer/JkContestTableTest/MockJkContestTable.d.ts +1 -1
  315. package/dist/module-types/src/components/organisms/_layz_/DataViewer/JkProblemTableTest/MockJkProblemTable.d.ts +1 -1
  316. package/dist/module-types/src/components/organisms/_layz_/DataViewer/JkSubmissionsTableTest/MockJkSubmissionTable.d.ts +1 -1
  317. package/dist/module-types/src/components/organisms/_layz_/DataViewer/JkUserTableTest/MockJkUserTable.d.ts +1 -1
  318. package/dist/module-types/src/components/organisms/_layz_/DataViewer/RowList/TableHead/Filter.d.ts +1 -1
  319. package/dist/module-types/src/components/organisms/_layz_/DataViewer/RowList/TableHead/TableHeadFilterDate.d.ts +1 -1
  320. package/dist/module-types/src/components/organisms/_layz_/DataViewer/RowList/TableHead/TableHeadFilterDateRange.d.ts +1 -1
  321. package/dist/module-types/src/components/organisms/_layz_/DataViewer/RowList/TableHead/TableHeadFilterText.d.ts +1 -1
  322. package/dist/module-types/src/components/organisms/_layz_/DataViewer/RowList/TableHead/index.d.ts +2 -2
  323. package/dist/module-types/src/components/organisms/_layz_/DataViewer/RowList/TableHead/types.d.ts +2 -2
  324. package/dist/module-types/src/components/organisms/_layz_/DataViewer/RowList/ViewContainerRows.d.ts +1 -1
  325. package/dist/module-types/src/components/organisms/_layz_/DataViewer/commons/DisplayDataViewer.d.ts +1 -1
  326. package/dist/module-types/src/components/organisms/_layz_/DataViewer/commons/utils.d.ts +6 -5
  327. package/dist/module-types/src/components/organisms/_layz_/DataViewer/types.d.ts +11 -10
  328. package/dist/module-types/src/components/organisms/_layz_/GraphvizViewer/GraphvizViewer.d.ts +1 -1
  329. package/dist/module-types/src/components/organisms/_layz_/GraphvizViewer/index.d.ts +1 -1
  330. package/dist/module-types/src/components/organisms/_layz_/MdMath/MdMath.d.ts +1 -1
  331. package/dist/module-types/src/components/organisms/_layz_/MdMath/index.d.ts +1 -1
  332. package/dist/module-types/src/components/organisms/_layz_/MdMath/types.d.ts +1 -1
  333. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/MdMathEditor.d.ts +1 -4
  334. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/MdMathEditor.deprecated.d.ts +1 -1
  335. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/MdMathEditor.tiptap.deprecated.d.ts +0 -0
  336. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/MilkdownEditorContent/MilkdownEditorContent.d.ts +4 -5
  337. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/index.d.ts +2 -5
  338. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/tip-tap.deprecated/TiptapEditorContent.d.ts +0 -0
  339. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/tip-tap.deprecated/extensions/BlockImage.d.ts +0 -0
  340. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/tip-tap.deprecated/extensions/ClearMarksOnEnter.d.ts +0 -0
  341. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/tip-tap.deprecated/extensions/CurrentNodeHighlighter.d.ts +0 -0
  342. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/tip-tap.deprecated/extensions/CustomCodeBlockLowlight.d.ts +0 -0
  343. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/tip-tap.deprecated/extensions/CustomLink.d.ts +0 -0
  344. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/tip-tap.deprecated/extensions/SmartHeadingBackspace.d.ts +0 -0
  345. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/tip-tap.deprecated/extensions/SmartPasteMarkdown.d.ts +0 -0
  346. package/dist/module-types/src/components/organisms/_layz_/MdMathEditor/tip-tap.deprecated/extensions/index.d.ts +0 -0
  347. package/dist/module-types/src/components/organisms/_layz_/UserCodeEditor/CodeRunnerEditor/CodeRunnerEditor.d.ts +1 -1
  348. package/dist/module-types/src/components/organisms/_layz_/UserCodeEditor/CodeRunnerEditor/FileTreePanel/types.d.ts +2 -2
  349. package/dist/module-types/src/components/organisms/_layz_/UserCodeEditor/CodeRunnerEditor/FirstPane.d.ts +3 -4
  350. package/dist/module-types/src/components/organisms/_layz_/UserCodeEditor/CodeRunnerEditor/Header/RunCodeButton.d.ts +3 -3
  351. package/dist/module-types/src/components/organisms/_layz_/UserCodeEditor/CodeRunnerEditor/MermaidViewer/MermaidViewer.d.ts +1 -1
  352. package/dist/module-types/src/components/organisms/_layz_/UserCodeEditor/CodeRunnerEditor/SettingsModal/index.d.ts +1 -1
  353. package/dist/module-types/src/components/organisms/_layz_/UserCodeEditor/CodeRunnerEditor/types.d.ts +8 -9
  354. package/dist/module-types/src/components/organisms/_layz_/UserCodeEditor/UserCodeEditor.d.ts +4 -5
  355. package/dist/module-types/src/components/organisms/_layz_/UserCodeEditor/code-editor-file.d.ts +7 -0
  356. package/dist/module-types/src/components/organisms/_layz_/UserCodeEditor/index.d.ts +2 -4
  357. package/dist/module-types/src/components/organisms/_layz_/UserCodeEditor/types.d.ts +4 -4
  358. package/dist/module-types/src/components/organisms/_layz_/WorksheetAsSlides/index.d.ts +1 -1
  359. package/dist/module-types/src/components/organisms/_layz_/WorksheetAsSlides/types.d.ts +1 -1
  360. package/dist/module-types/src/components/organisms/_layz_/WorksheetContents/index.d.ts +1 -1
  361. package/dist/module-types/src/components/organisms/_layz_/WorksheetContents/types.d.ts +2 -2
  362. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/index.d.ts +1 -1
  363. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/AddNewChild.d.ts +3 -3
  364. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/ChunkTitle.d.ts +1 -1
  365. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/CodeEditorSheetSection/CodeEditorSheetSection.d.ts +2 -2
  366. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/CodeEditorSheetSection/CodeEditorSheetSectionEditor.d.ts +2 -2
  367. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/CodeEditorSheetSection/CodeEditorSheetSectionEditorModal.d.ts +10 -0
  368. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/CodeEditorSheetSection/CodeEditorSheetSectionView.d.ts +2 -2
  369. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/EditSheetModal.d.ts +2 -2
  370. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/GraphSheetSection/GraphSheetSection.d.ts +2 -2
  371. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/GraphSheetSection/GraphSheetSectionEditor.d.ts +2 -2
  372. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/GraphSheetSection/GraphSheetSectionEditorModal.d.ts +10 -0
  373. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/GraphSheetSection/GraphSheetSectionView.d.ts +2 -2
  374. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/JkmdSheetSection/JkmdSheetSection.d.ts +2 -2
  375. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/JkmdSheetSection/JkmdSheetSection.old.d.ts +6 -0
  376. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/JkmdSheetSection/JkmdSheetSectionEditor.d.ts +2 -2
  377. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/JkmdSheetSection/JkmdSheetSectionEditorModal.d.ts +10 -0
  378. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/ListSheetSection/ListSheetRecursiveSection.d.ts +9 -0
  379. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/ListSheetSection/ListSheetSection.d.ts +7 -0
  380. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/ListSheetSection/index.d.ts +1 -0
  381. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/QuizOptionsSheetSection/QuizOptionsSheetSection.d.ts +2 -2
  382. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/QuizOptionsSheetSection/QuizOptionsSheetSectionEditor.d.ts +1 -1
  383. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/QuizOptionsSheetSection/QuizOptionsSheetSectionEditorModal.d.ts +10 -0
  384. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/QuizOptionsSheetSection/QuizOptionsSheetSectionView.d.ts +2 -2
  385. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/QuizProblemSheetSection/QuizProblemSheetSection.d.ts +2 -2
  386. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/QuizProblemSheetSection/QuizProblemSheetSectionEditor.d.ts +2 -2
  387. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/QuizProblemSheetSection/QuizProblemSheetSectionEditorModal.d.ts +10 -0
  388. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/QuizProblemSheetSection/QuizProblemSheetSectionEditorModal.old.d.ts +0 -0
  389. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/QuizProblemSheetSection/QuizProblemSheetSectionView.d.ts +1 -1
  390. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/QuizProblemSheetSection/QuizProblemSheetSectionView.old.d.ts +0 -0
  391. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/ResultHeader.d.ts +2 -2
  392. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/TableOfContents.d.ts +2 -2
  393. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/TableOfContentsModal.d.ts +3 -3
  394. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/UpRemoveDownButtons.d.ts +7 -0
  395. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/WorksheetBody.d.ts +4 -5
  396. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/WorksheetNode.d.ts +1 -1
  397. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/getActionButtons.d.ts +5 -6
  398. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/logos.d.ts +4 -4
  399. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/types.d.ts +2 -2
  400. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/upRemoveDownActions.d.ts +2 -2
  401. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/types.d.ts +3 -3
  402. package/dist/module-types/src/components/organisms/_layz_/WorksheetViewer/WorksheetViewer.d.ts +1 -1
  403. package/dist/module-types/src/components/organisms/_layz_/WorksheetViewer/types.d.ts +2 -2
  404. package/dist/module-types/src/components/organisms/index.d.ts +14 -13
  405. package/dist/module-types/src/components/organisms/modals/ImageUploaderModal/PublicImagesTab/PublicImages.d.ts +3 -3
  406. package/dist/module-types/src/components/organisms/modals/ImageUploaderModal/PublicImagesTab/index.d.ts +2 -2
  407. package/dist/module-types/src/components/organisms/modals/ImageUploaderModal/UploadNewImageTab/index.d.ts +2 -2
  408. package/dist/module-types/src/components/organisms/modals/ImageUploaderModal/types.d.ts +5 -5
  409. package/dist/module-types/src/components/organisms/modals/LoginModal/LoginModal.d.ts +2 -2
  410. package/dist/module-types/src/components/organisms/modals/LoginModal/LoginModalTemplate/ForgotPassword/types.d.ts +1 -1
  411. package/dist/module-types/src/components/organisms/modals/LoginModal/LoginModalTemplate/index.d.ts +1 -1
  412. package/dist/module-types/src/components/organisms/modals/LoginModal/LoginModalTemplate/types.d.ts +4 -4
  413. package/dist/module-types/src/components/organisms/modals/LoginModal/types.d.ts +2 -2
  414. package/dist/module-types/src/components/organisms/modals/SignUpModal/SignUpModalTemplate/types.d.ts +2 -2
  415. package/dist/module-types/src/components/organisms/modals/UserPreviewModal/UserPreviewContentModal.d.ts +4 -4
  416. package/dist/module-types/src/components/organisms/modals/UserPreviewModal/types.d.ts +2 -0
  417. package/dist/module-types/src/components/organisms/modals/WelcomeModal/types.d.ts +1 -1
  418. package/dist/module-types/src/components/organisms/modals/index.d.ts +1 -1
  419. package/dist/module-types/src/components/organisms/types.d.ts +10 -9
  420. package/dist/module-types/src/components/providers/JukiAblyInitializer/JukiAblyInitializer.d.ts +1 -1
  421. package/dist/module-types/src/components/providers/JukiI18nInitializer/JukiI18nInitializer.d.ts +1 -0
  422. package/dist/module-types/src/components/providers/JukiI18nInitializer/index.d.ts +1 -0
  423. package/dist/module-types/src/components/providers/JukiLastPathInitializer/types.d.ts +1 -1
  424. package/dist/module-types/src/components/providers/JukiPageInitializer/useMouseInsidePage.d.ts +1 -0
  425. package/dist/module-types/src/components/providers/JukiProviders.d.ts +2 -2
  426. package/dist/module-types/src/components/providers/JukiRouterInitializer/JukiRouterInitializer.d.ts +1 -1
  427. package/dist/module-types/src/components/providers/JukiRouterInitializer/types.d.ts +2 -2
  428. package/dist/module-types/src/components/providers/{server/Image → JukiUIProvider}/Image.d.ts +1 -1
  429. package/dist/module-types/src/components/providers/JukiUIProvider/JukiUIProvider.d.ts +1 -1
  430. package/dist/module-types/src/components/providers/JukiUIProvider/Link.d.ts +1 -1
  431. package/dist/module-types/src/components/providers/JukiUIProvider/types.d.ts +24 -6
  432. package/dist/module-types/src/components/providers/JukiUserProvider/types.d.ts +9 -8
  433. package/dist/module-types/src/components/providers/NotificationProvider/NotificationProvider.d.ts +1 -1
  434. package/dist/module-types/src/components/providers/index.d.ts +1 -1
  435. package/dist/module-types/src/components/providers/types.d.ts +3 -2
  436. package/dist/module-types/src/components/server/index.d.ts +0 -4
  437. package/dist/module-types/src/components/server/types.d.ts +0 -4
  438. package/dist/module-types/src/components/templates/ContestNameLinkField/types.d.ts +2 -2
  439. package/dist/module-types/src/components/templates/EditProfileModal/ImageProfileModal.d.ts +1 -1
  440. package/dist/module-types/src/components/templates/EditProfileModal/types.d.ts +4 -5
  441. package/dist/module-types/src/components/templates/EntityCreateLayout/types.d.ts +1 -1
  442. package/dist/module-types/src/components/templates/EntityUpdateLayout/types.d.ts +1 -1
  443. package/dist/module-types/src/components/templates/ErrorBoundary/types.d.ts +1 -1
  444. package/dist/module-types/src/components/templates/HelpSection/types.d.ts +2 -0
  445. package/dist/module-types/src/components/templates/MainMenu/DrawerViewMenuMobile/DrawerViewMenuMobile.d.ts +2 -2
  446. package/dist/module-types/src/components/templates/MainMenu/DrawerViewMenuMobile/index.d.ts +1 -0
  447. package/dist/module-types/src/components/templates/MainMenu/SettingsSection/index.d.ts +1 -1
  448. package/dist/module-types/src/components/templates/MainMenu/types.d.ts +5 -5
  449. package/dist/module-types/src/components/templates/ProblemView/ProblemInfo.d.ts +1 -1
  450. package/dist/module-types/src/components/templates/ProblemView/ProblemView.d.ts +1 -1
  451. package/dist/module-types/src/components/templates/ProblemView/commons/ProblemCodeEditor.d.ts +2 -2
  452. package/dist/module-types/src/components/templates/ProblemView/commons/SampleTest.d.ts +1 -1
  453. package/dist/module-types/src/components/templates/ProblemView/types.d.ts +4 -4
  454. package/dist/module-types/src/components/templates/ResetPasswordModal/ResetPasswordModal.d.ts +1 -1
  455. package/dist/module-types/src/components/templates/ResetPasswordModal/types.d.ts +2 -2
  456. package/dist/module-types/src/components/templates/UserActiveSessions/UserMyActiveSessions.d.ts +2 -1
  457. package/dist/module-types/src/components/templates/UserActiveSessions/types.d.ts +2 -0
  458. package/dist/module-types/src/components/templates/UserProfile/types.d.ts +1 -1
  459. package/dist/module-types/src/components/templates/UserProfileSettings/types.d.ts +1 -1
  460. package/dist/module-types/src/components/templates/UserViewLayout/ProfileSubmissions.d.ts +2 -1
  461. package/dist/module-types/src/components/templates/UserViewLayout/types.d.ts +5 -3
  462. package/dist/module-types/src/components/templates/columns/contest-columns/getContestContestantsHeader.d.ts +3 -0
  463. package/dist/module-types/src/components/templates/columns/contest-columns/getContestDateHeader.d.ts +3 -0
  464. package/dist/module-types/src/components/templates/columns/contest-columns/getContestNameHeader.d.ts +1 -1
  465. package/dist/module-types/src/components/templates/columns/contest-columns/getContestStatusHeader.d.ts +1 -1
  466. package/dist/module-types/src/components/templates/columns/contest-columns/getContestTagsHeader.d.ts +1 -1
  467. package/dist/module-types/src/components/templates/columns/contest-columns/index.d.ts +2 -2
  468. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemAdminActionsHeader.d.ts +1 -1
  469. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemKeyHeader.d.ts +1 -1
  470. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemModeHeader.d.ts +1 -1
  471. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemNameHeader.d.ts +1 -1
  472. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemOwnerHeader.d.ts +1 -1
  473. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemTagsHeader.d.ts +1 -1
  474. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemTypeHeader.d.ts +1 -1
  475. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionContestHeader.d.ts +1 -1
  476. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionContestProblemHeader.d.ts +1 -1
  477. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionDateHeader.d.ts +1 -1
  478. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionLanguageHeader.d.ts +1 -2
  479. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionMemoryHeader.d.ts +1 -1
  480. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionNicknameHeader.d.ts +2 -2
  481. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionProblemHeader.d.ts +1 -1
  482. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionRejudgeHeader.d.ts +1 -1
  483. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionTimeHeader.d.ts +1 -1
  484. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionVerdictHeader.d.ts +1 -1
  485. package/dist/module-types/src/components/templates/index.d.ts +17 -14
  486. package/dist/module-types/src/components/templates/members/DocumentMembersButton.d.ts +1 -1
  487. package/dist/module-types/src/components/templates/members/DocumentMembersModal/DocumentMembersModal.d.ts +1 -1
  488. package/dist/module-types/src/components/templates/members/types.d.ts +5 -6
  489. package/dist/module-types/src/components/templates/problem/ProblemCrawlerField.d.ts +1 -1
  490. package/dist/module-types/src/components/templates/problem/ProblemModeField.d.ts +1 -1
  491. package/dist/module-types/src/components/templates/problem/ProblemOwnerField.d.ts +1 -1
  492. package/dist/module-types/src/components/templates/problem/ProblemTypeField.d.ts +1 -1
  493. package/dist/module-types/src/components/templates/{server/problem → problem}/TagsField.d.ts +1 -1
  494. package/dist/module-types/src/components/templates/problem/types.d.ts +8 -2
  495. package/dist/module-types/src/components/templates/{server/submission → submission}/SubmissionDateField.d.ts +1 -1
  496. package/dist/module-types/src/components/templates/submission/SubmissionLanguageField.d.ts +1 -1
  497. package/dist/module-types/src/components/templates/submission/SubmissionNicknameField.d.ts +1 -1
  498. package/dist/module-types/src/components/templates/submission/types.d.ts +2 -2
  499. package/dist/module-types/src/components/templates/types.d.ts +15 -12
  500. package/dist/module-types/src/components/types/index.d.ts +10 -12
  501. package/dist/module-types/src/constants/index.d.ts +3 -3
  502. package/dist/module-types/src/constants/settings.d.ts +1 -1
  503. package/dist/module-types/src/constants/worksheet.d.ts +1 -1
  504. package/dist/module-types/src/helpers/index.d.ts +1 -1
  505. package/dist/module-types/src/hooks/index.d.ts +13 -12
  506. package/dist/module-types/src/settings/ApiManager.d.ts +245 -370
  507. package/dist/module-types/src/settings/AppRoutes.d.ts +4 -4
  508. package/dist/module-types/src/stores/ably/useAblyStore.d.ts +2 -2
  509. package/dist/module-types/src/stores/i18n/i18n.d.ts +2 -0
  510. package/dist/module-types/src/stores/i18n/i18nConfig.d.ts +7 -0
  511. package/dist/module-types/src/stores/i18n/useI18nStore.d.ts +8 -0
  512. package/dist/module-types/src/stores/lastPath/useLastPath.d.ts +1 -1
  513. package/dist/module-types/src/stores/router/useRouterStore.d.ts +2 -2
  514. package/dist/module-types/src/stores/sound/useSoundStore.d.ts +1 -1
  515. package/dist/module-types/src/stores/ui/useUIStore.d.ts +2 -2
  516. package/dist/module-types/src/stores/user/useUserStore.d.ts +2 -2
  517. package/dist/module-types/src/stores/websocket/types.d.ts +2 -2
  518. package/dist/module-types/src/stores/websocket/useWebsocketStore.d.ts +1 -1
  519. package/dist/module-types/src/types/index.d.ts +1 -1
  520. package/package.json +70 -76
  521. package/src/styles/components/atoms/_button.scss +7 -7
  522. package/src/styles/components/atoms/_data-viewer.scss +3 -3
  523. package/src/styles/components/atoms/_modal.scss +0 -9
  524. package/src/vendor/@milkdown/crepe/lib/theme/common/code-mirror.css +0 -14
  525. package/src/vendor/@milkdown/crepe/lib/theme/common/style.css +0 -2
  526. package/src/vendor/@milkdown/crepe/src/theme/common/code-mirror.css +0 -14
  527. package/src/vendor/@milkdown/crepe/src/theme/common/style.css +0 -2
  528. package/src/vendor/fumadocs-ui/css/generated/docs.css +281 -3
  529. package/src/vendor/fumadocs-ui/css/generated/flux.css +264 -2
  530. package/src/vendor/fumadocs-ui/css/generated/home.css +161 -1
  531. package/src/vendor/fumadocs-ui/css/generated/notebook.css +288 -6
  532. package/src/vendor/fumadocs-ui/css/generated/shared.css +103 -80
  533. package/src/vendor/fumadocs-ui/css/lib/base.css +1 -78
  534. package/src/vendor/fumadocs-ui/css/lib/shiki.css +2 -2
  535. package/src/vendor/fumadocs-ui/css/preset.css +80 -0
  536. package/src/vendor/fumadocs-ui/dist/style.css +47 -63
  537. package/src/vendor/handsontable/styles/handsontable.css +82 -335
  538. package/src/vendor/handsontable/styles/handsontable.min.css +3 -4
  539. package/src/vendor/handsontable/styles/ht-icons-horizon.css +3 -11
  540. package/src/vendor/handsontable/styles/ht-icons-horizon.min.css +3 -4
  541. package/src/vendor/handsontable/styles/ht-icons-main.css +3 -11
  542. package/src/vendor/handsontable/styles/ht-icons-main.min.css +3 -4
  543. package/src/vendor/handsontable/styles/ht-theme-classic-no-icons.css +2 -21
  544. package/src/vendor/handsontable/styles/ht-theme-classic-no-icons.min.css +3 -4
  545. package/src/vendor/handsontable/styles/ht-theme-classic.css +5 -32
  546. package/src/vendor/handsontable/styles/ht-theme-classic.min.css +3 -4
  547. package/src/vendor/handsontable/styles/ht-theme-horizon-no-icons.css +1 -20
  548. package/src/vendor/handsontable/styles/ht-theme-horizon-no-icons.min.css +3 -4
  549. package/src/vendor/handsontable/styles/ht-theme-horizon.css +4 -31
  550. package/src/vendor/handsontable/styles/ht-theme-horizon.min.css +3 -4
  551. package/src/vendor/handsontable/styles/ht-theme-main-no-icons.css +2 -21
  552. package/src/vendor/handsontable/styles/ht-theme-main-no-icons.min.css +3 -4
  553. package/src/vendor/handsontable/styles/ht-theme-main.css +5 -32
  554. package/src/vendor/handsontable/styles/ht-theme-main.min.css +3 -4
  555. package/src/vendor/katex/dist/katex-swap.css +2 -5
  556. package/src/vendor/katex/dist/katex-swap.min.css +1 -1
  557. package/src/vendor/katex/dist/katex.css +2 -5
  558. package/src/vendor/katex/dist/katex.min.css +1 -1
  559. package/src/vendor/katex/src/styles/katex.scss +1 -3
  560. package/dist/esm/ArrowForwardIcon-IN9agpuQ.js +0 -1
  561. package/dist/esm/BarChart-BrncFZqv.js +0 -1
  562. package/dist/esm/CartesianChart-DiEsv39t.js +0 -47
  563. package/dist/esm/ChangePasswordModal-CvWtkjrN.js +0 -1
  564. package/dist/esm/CodeEditor-DACpjrsU.js +0 -1
  565. package/dist/esm/DataGrid-JAYAjywD.js +0 -277
  566. package/dist/esm/DataViewer-Dlia2oSB.js +0 -1
  567. package/dist/esm/DrawerView-BblFUJEi.js +0 -1
  568. package/dist/esm/ExcalidrawButton-Bd8SBhas.js +0 -1
  569. package/dist/esm/GraphvizViewer-C1mAE7rX.js +0 -1
  570. package/dist/esm/ImageLoaderCropper-C3Cx6O53.js +0 -1
  571. package/dist/esm/InputCellPhoneNumber-CKYa10bN.js +0 -1
  572. package/dist/esm/InputColor-Z0jOOs3H.js +0 -14
  573. package/dist/esm/LineChart-EhYBGR13.js +0 -1
  574. package/dist/esm/MdMath-nccHUbMO.js +0 -1
  575. package/dist/esm/MdMathEditor-CqVpGAmF.js +0 -28
  576. package/dist/esm/ReplyIcon-DrZrr78M.js +0 -1
  577. package/dist/esm/SettingsIcon-DM1F7UIb.js +0 -1
  578. package/dist/esm/SlideDeck-ls4Av4B6.js +0 -1
  579. package/dist/esm/TableOfContents-s2uXSPqs.js +0 -1
  580. package/dist/esm/TextHeadCell-CtlRYJ1U.js +0 -1
  581. package/dist/esm/Tooltip-DkuB7dhH.js +0 -7
  582. package/dist/esm/UserCodeEditor-ouwZZtsS.js +0 -30
  583. package/dist/esm/ViewModuleIcon-CBJGd2NB.js +0 -1
  584. package/dist/esm/VirtualizedRowsFixed-B2F4OHWB.js +0 -1
  585. package/dist/esm/WorksheetAsSlides-DERDrU2H.js +0 -1
  586. package/dist/esm/WorksheetBodies-CV7eAr61.js +0 -1
  587. package/dist/esm/WorksheetContents-Lm-_CdZ2.js +0 -1
  588. package/dist/esm/WorksheetEditor-bWlxdb29.js +0 -1
  589. package/dist/esm/WorksheetNode-DEOXUEQe.js +0 -1
  590. package/dist/esm/WorksheetViewer-lBAniTnA.js +0 -1
  591. package/dist/esm/arc-BalHlvik.js +0 -1
  592. package/dist/esm/architectureDiagram-3BPJPVTR-CTb5ayIp.js +0 -1
  593. package/dist/esm/blockDiagram-GPEHLZMM-D4uFUU-G.js +0 -1
  594. package/dist/esm/c4Diagram-AAUBKEIU-CAZLWuPq.js +0 -1
  595. package/dist/esm/channel-D5EOmDMD.js +0 -1
  596. package/dist/esm/chunk-2J33WTMH-HhOFj0bf.js +0 -1
  597. package/dist/esm/chunk-55IACEB6-aJ-Std67.js +0 -1
  598. package/dist/esm/chunk-727SXJPM-CR7TtBVZ.js +0 -1
  599. package/dist/esm/chunk-AQP2D5EJ-K2Leo-fb.js +0 -1
  600. package/dist/esm/chunk-ND2GUHAM-3yBxVPAC.js +0 -1
  601. package/dist/esm/classDiagram-4FO5ZUOK-Bp3azMO2.js +0 -1
  602. package/dist/esm/classDiagram-v2-Q7XG4LA2-Bp3azMO2.js +0 -1
  603. package/dist/esm/contest-D0dFHHYS.js +0 -1
  604. package/dist/esm/cose-bilkent-S5V4N54A-CF9x8P1X.js +0 -1
  605. package/dist/esm/cytoscape.esm-ym4YJMee.js +0 -9
  606. package/dist/esm/dagre-BM42HDAG-oa0J1DaE.js +0 -1
  607. package/dist/esm/date-D28INXpp.js +0 -1
  608. package/dist/esm/diagram-2AECGRRQ-BuuG-RoB.js +0 -1
  609. package/dist/esm/diagram-5GNKFQAL-CZujtOen.js +0 -1
  610. package/dist/esm/diagram-KO2AKTUF-0KbELqZI.js +0 -1
  611. package/dist/esm/diagram-LMA3HP47-DVhy52x2.js +0 -1
  612. package/dist/esm/diagram-OG6HWLK6-BBVpceTq.js +0 -1
  613. package/dist/esm/erDiagram-TEJ5UH35-BHbfbqIk.js +0 -1
  614. package/dist/esm/flowDiagram-I6XJVG4X-BaMVJs2u.js +0 -1
  615. package/dist/esm/ganttDiagram-6RSMTGT7-DOUe8voF.js +0 -1
  616. package/dist/esm/gitGraphDiagram-PVQCEYII-Dyj0XEJk.js +0 -1
  617. package/dist/esm/graph-ByvXLzfz.js +0 -1
  618. package/dist/esm/index-3RT03X12.js +0 -1
  619. package/dist/esm/index-4xl-oI83.js +0 -1
  620. package/dist/esm/index-8NOL5jJy.js +0 -1
  621. package/dist/esm/index-B8r5j97Z.js +0 -1
  622. package/dist/esm/index-BCzXl-MX.js +0 -1
  623. package/dist/esm/index-BozcvZKO.js +0 -1
  624. package/dist/esm/index-C7UTkWm2.js +0 -1
  625. package/dist/esm/index-CCC14puG.js +0 -1
  626. package/dist/esm/index-CHdwVvPu.js +0 -1
  627. package/dist/esm/index-CQTsT8Zj.js +0 -1
  628. package/dist/esm/index-CU5b90xS.js +0 -1
  629. package/dist/esm/index-CWWVtFL-.js +0 -1
  630. package/dist/esm/index-CYal7RVq.js +0 -1
  631. package/dist/esm/index-CZHb8PSE.js +0 -1
  632. package/dist/esm/index-C_iDYl6D.js +0 -1
  633. package/dist/esm/index-Ci0TIrsP.js +0 -1
  634. package/dist/esm/index-CncjGRa9.js +0 -1
  635. package/dist/esm/index-CoD0BG11.js +0 -1
  636. package/dist/esm/index-CroDROK5.js +0 -1
  637. package/dist/esm/index-D2MvgUx2.js +0 -1
  638. package/dist/esm/index-DGfNHv1x.js +0 -2
  639. package/dist/esm/index-DI4w9v5q.js +0 -1
  640. package/dist/esm/index-DO5jS6VE.js +0 -1
  641. package/dist/esm/index-DPqNWk5z.js +0 -1
  642. package/dist/esm/index-DQ_RDg2x.js +0 -1
  643. package/dist/esm/index-DklIqAi8.js +0 -1
  644. package/dist/esm/index-Dwi3ag-n.js +0 -1
  645. package/dist/esm/index-P3Cb0cjc.js +0 -1
  646. package/dist/esm/index-mPuca8dy.js +0 -1
  647. package/dist/esm/index-uScqGt-h.js +0 -1
  648. package/dist/esm/index-wgkxcuUd.js +0 -1
  649. package/dist/esm/infoDiagram-5YYISTIA-Boua4Tr8.js +0 -1
  650. package/dist/esm/isSymbol-BuOnvf7n.js +0 -1
  651. package/dist/esm/isUndefined-DFy0_ZQT.js +0 -1
  652. package/dist/esm/ishikawaDiagram-YF4QCWOH-BS_A_XBz.js +0 -1
  653. package/dist/esm/journeyDiagram-JHISSGLW-YyjHX0yV.js +0 -1
  654. package/dist/esm/kanban-definition-UN3LZRKU-CcKCIal8.js +0 -1
  655. package/dist/esm/layout-C8ygm6VF.js +0 -1
  656. package/dist/esm/light-CK5396YO.js +0 -1
  657. package/dist/esm/map-CkaOHTqG.js +0 -1
  658. package/dist/esm/mermaid.core-QpTfboNw.js +0 -1
  659. package/dist/esm/mindmap-definition-RKZ34NQL-DjxxY08j.js +0 -1
  660. package/dist/esm/pieDiagram-4H26LBE5-Bu-BmZ8n.js +0 -1
  661. package/dist/esm/purify.es-J-_UhghA.js +0 -2
  662. package/dist/esm/quadrantDiagram-W4KKPZXB-fK1bxThQ.js +0 -1
  663. package/dist/esm/requirementDiagram-4Y6WPE33-D-96v_3q.js +0 -1
  664. package/dist/esm/sankeyDiagram-5OEKKPKP-ZTvdQYzE.js +0 -1
  665. package/dist/esm/sequenceDiagram-3UESZ5HK-BFEtohrX.js +0 -1
  666. package/dist/esm/settings-DgLs6IK_.js +0 -1
  667. package/dist/esm/stateDiagram-AJRCARHV-DWxVmIWt.js +0 -1
  668. package/dist/esm/stateDiagram-v2-BHNVJYJU-DnOatqpE.js +0 -1
  669. package/dist/esm/throttle-_MCmQvyw.js +0 -1
  670. package/dist/esm/time-BHcZPeyw.js +0 -1
  671. package/dist/esm/time-BJsLnFy1.js +0 -1
  672. package/dist/esm/timeline-definition-PNZ67QCA-FvMo_PxT.js +0 -1
  673. package/dist/esm/toNumber-DP6YK8S3.js +0 -1
  674. package/dist/esm/types-DG_vw3We.js +0 -1
  675. package/dist/esm/vennDiagram-CIIHVFJN-DzI_A9Cl.js +0 -1
  676. package/dist/esm/viz-BjPw9uNj.js +0 -9
  677. package/dist/esm/wardley-L42UT6IY-Bn2xZ99U.js +0 -15
  678. package/dist/esm/wardleyDiagram-YWT4CUSO-ClMyoKY9.js +0 -1
  679. package/dist/esm/worksheet-BBAH_yZC.js +0 -1
  680. package/dist/esm/worksheet-DTRmzBjG.js +0 -1
  681. package/dist/esm/worksheet-GN3yGKYw.js +0 -1
  682. package/dist/esm/xychartDiagram-2RQKCTM6-Cy92WO7L.js +0 -1
  683. package/dist/module-types/node_modules/.pnpm/@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3/node_modules/@milkdown/kit/lib/component/diff.d.ts +0 -1
  684. package/dist/module-types/node_modules/.pnpm/@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3/node_modules/@milkdown/kit/lib/exception.d.ts +0 -1
  685. package/dist/module-types/node_modules/.pnpm/@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3/node_modules/@milkdown/kit/lib/plugin/diff.d.ts +0 -1
  686. package/dist/module-types/node_modules/.pnpm/@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3/node_modules/@milkdown/kit/lib/plugin/streaming.d.ts +0 -1
  687. package/dist/module-types/src/components/atoms/T/T.server.d.ts +0 -2
  688. package/dist/module-types/src/components/atoms/T/cache.d.ts +0 -4
  689. package/dist/module-types/src/components/atoms/T/client.d.ts +0 -7
  690. package/dist/module-types/src/components/atoms/T/server.d.ts +0 -12
  691. package/dist/module-types/src/components/atoms/T/shared.d.ts +0 -2
  692. package/dist/module-types/src/components/atoms/server/T/index.d.ts +0 -3
  693. package/dist/module-types/src/components/molecules/server/CircularProgress/types.d.ts +0 -4
  694. package/dist/module-types/src/components/molecules/server/NewlineInfo/NewlineInfo.d.ts +0 -2
  695. package/dist/module-types/src/components/molecules/server/NewlineInfo/types.d.ts +0 -3
  696. package/dist/module-types/src/components/molecules/server/TimerDisplay/types.d.ts +0 -13
  697. package/dist/module-types/src/components/molecules/server/index.d.ts +0 -5
  698. package/dist/module-types/src/components/molecules/server/types.d.ts +0 -3
  699. package/dist/module-types/src/components/organisms/server/index.d.ts +0 -3
  700. package/dist/module-types/src/components/organisms/server/types.d.ts +0 -1
  701. package/dist/module-types/src/components/providers/JukiI18nBridge/JukiI18nBridge.d.ts +0 -23
  702. package/dist/module-types/src/components/providers/JukiI18nBridge/index.d.ts +0 -1
  703. package/dist/module-types/src/components/providers/server/Image/types.d.ts +0 -20
  704. package/dist/module-types/src/components/providers/server/index.d.ts +0 -1
  705. package/dist/module-types/src/components/providers/server/types.d.ts +0 -1
  706. package/dist/module-types/src/components/templates/server/ProblemStatus/types.d.ts +0 -6
  707. package/dist/module-types/src/components/templates/server/columns/contest-columns/getContestContestantsHeader.d.ts +0 -3
  708. package/dist/module-types/src/components/templates/server/columns/contest-columns/getContestDateHeader.d.ts +0 -3
  709. package/dist/module-types/src/components/templates/server/index.d.ts +0 -5
  710. package/dist/module-types/src/components/templates/server/types.d.ts +0 -1
  711. package/src/vendor/@milkdown/crepe/lib/theme/common/ai.css +0 -446
  712. package/src/vendor/@milkdown/crepe/lib/theme/common/diff.css +0 -177
  713. package/src/vendor/@milkdown/crepe/src/theme/common/ai.css +0 -430
  714. package/src/vendor/@milkdown/crepe/src/theme/common/diff.css +0 -196
  715. package/src/vendor/fumadocs-ui/css/preset-legacy.css +0 -38
  716. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/component/code-block.d.ts +0 -0
  717. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/component/image-block.d.ts +0 -0
  718. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/component/image-inline.d.ts +0 -0
  719. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/component/index.d.ts +0 -0
  720. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/component/link-tooltip.d.ts +0 -0
  721. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/component/list-item-block.d.ts +0 -0
  722. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/component/table-block.d.ts +0 -0
  723. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/core.d.ts +0 -0
  724. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/ctx.d.ts +0 -0
  725. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/plugin/block.d.ts +0 -0
  726. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/plugin/clipboard.d.ts +0 -0
  727. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/plugin/cursor.d.ts +0 -0
  728. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/plugin/history.d.ts +0 -0
  729. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/plugin/indent.d.ts +0 -0
  730. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/plugin/listener.d.ts +0 -0
  731. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/plugin/slash.d.ts +0 -0
  732. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/plugin/tooltip.d.ts +0 -0
  733. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/plugin/trailing.d.ts +0 -0
  734. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/plugin/upload.d.ts +0 -0
  735. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/preset/commonmark.d.ts +0 -0
  736. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/preset/gfm.d.ts +0 -0
  737. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/prose/history.d.ts +0 -0
  738. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/prose/index.d.ts +0 -0
  739. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/prose/inputrules.d.ts +0 -0
  740. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/prose/keymap.d.ts +0 -0
  741. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/prose/model.d.ts +0 -0
  742. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/prose/state.d.ts +0 -0
  743. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/prose/view.d.ts +0 -0
  744. /package/dist/module-types/node_modules/.pnpm/{@milkdown+kit@7.21.1_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.43.0_typescript@6.0.3 → @milkdown+kit@7.20.0_@codemirror+language@6.12.3_@codemirror+state@6.6.0_@codemirror+view@6.41.1_typescript@6.0.3}/node_modules/@milkdown/kit/lib/utils.d.ts +0 -0
  745. /package/dist/module-types/src/components/atoms/{server/DateLiteral → DateLiteral}/DateLiteral.d.ts +0 -0
  746. /package/dist/module-types/src/components/molecules/{server/ThemeColorPalette → ThemeColorPalette}/ThemeColorPalette.d.ts +0 -0
  747. /package/dist/module-types/src/components/molecules/{server/layouts → layouts}/ApplicationLoaderLayout.d.ts +0 -0
  748. /package/dist/module-types/src/components/templates/{server/ProblemStatus → problem}/ProblemStatus.d.ts +0 -0
@@ -0,0 +1,28 @@
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{P as n,S as o,ah as r,G as i,T as s,C as a,v as l}from"./settings-BIQ7IqJl.js";import{W as c,X as d,g as u,L as p,Y as h,Z as f,E as m,G as g,_ as v,z as y,$ as w,a0 as b,a1 as k,a2 as C,a3 as x,a4 as N,a5 as S,a6 as O,a7 as E,a8 as M,a9 as _,U as T,aa as D,ab as I,ac as A,ad as R,ae as P,af as L,ag as V,ah as j,ai as $,aj as B,ak as H,Q as F,K as z,M as q}from"./basic-setup-UGhpl5jF.js";import{f as W,e as U,g as K,h as G,p as J,z as Z,i as X,u as Y,r as Q,v as ee,S as te,j as ne,d as oe,k as re,c as ie,C as se}from"./types-rkDjePoL.js";import ae,{useRef as le,useState as ce,useMemo as de,createContext as ue,useContext as pe,useCallback as he,useLayoutEffect as fe,useEffect as me,forwardRef as ge,useImperativeHandle as ve,memo as ye}from"react";import{a as we,S as be,e as ke,l as Ce,T as xe,ad as Ne,a2 as Se,ae as Oe}from"./index-EPJhFLhN.js";import{c as Ee,d as Me}from"./commons-B_OozOv-.js";import"./enums.js";import"./constants.js";import{L as _e,s as Te,m as De,f as Ie}from"./LoaderLayer-D9O7WqFD.js";import"motion/react";import"react-dom";import"swr";import{c as Ae}from"./clsx-BeLtu-UY.js";import{p as Re}from"./purify.es-DBOWJxv3.js";import{c as Pe,f as Le,o as Ve,m as je,s as $e}from"./floating-ui.dom-BKnkJW47.js";import{t as Be,d as He}from"./throttle-BsCMUG1-.js";import{d as Fe,P as ze,Q as qe,x as We,R as Ue}from"./memoize-CPUrcYQl.js";import{i as Ke}from"./viz-CFEjElvl.js";import{au as Ge}from"./mermaid.core-C2hrg85i.js";import{y as Je}from"./websocket-CxbYBjHT.js";import"./index-CODLgwqm.js";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"ably/react";import"@ably/spaces/dist/mjs/react";import"./toNumber-Bh_HTlSx.js";import"./isSymbol-CATEdeai.js";import"./string-LeDn2fkG.js";const Ze={}.hasOwnProperty;function Xe(e,t){let n,o=-1;if(t.extensions)for(;++o<t.extensions.length;)Xe(e,t.extensions[o]);for(n in t)if(Ze.call(t,n))switch(n){case"extensions":break;case"unsafe":case"join":Ye(e[n],t[n]);break;case"handlers":Qe(e[n],t[n]);break;default:e.options[n]=t[n]}return e}function Ye(e,t){t&&e.push(...t)}function Qe(e,t){t&&Object.assign(e,t)}const et=[function(e,t,n,o){if("code"===t.type&&W(t,o)&&("list"===e.type||e.type===t.type&&W(e,o)))return!1;if("spread"in n&&"boolean"==typeof n.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&U(t,o)))return;return n.spread?1:0}}];const tt=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],nt=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:tt},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:tt},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:tt},{atBreak:!0,character:"+",after:"(?:[ \t\r\n])"},{atBreak:!0,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:tt},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:tt},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:tt},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:tt},{atBreak:!0,character:"~"}];function ot(e){return e.label||!e.identifier?e.label||"":K(e.identifier)}function rt(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function it(e,t,n,o){let r=o.join.length;for(;r--;){const i=o.join[r](e,t,n,o);if(!0===i||1===i)break;if("number"==typeof i)return"\n".repeat(1+i);if(!1===i)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const st=/\r?\n|\r/g;function at(e,t){const n=[];let o,r=0,i=0;for(;o=st.exec(e);)s(e.slice(r,o.index)),n.push(o[0]),r=o.index+o[0].length,i++;return s(e.slice(r)),n.join("");function s(e){n.push(t(e,i,!e))}}function lt(e,t){return e-t}function ct(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,o=[],r=[],i=e+t;let s,a=-1,l=0;for(;s=n.exec(i);)o.push(s.index);for(;++a<o.length;)l!==o[a]&&r.push(e.slice(l,o[a])),r.push("\\"),l=o[a];return r.push(e.slice(l)),r.join("")}function dt(e){const t=e||{},n=t.now||{};let o=t.lineShift||0,r=n.line||1,i=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),s=n[n.length-1];return r+=n.length-1,i=1===n.length?i+s.length:1+s.length+o,t},current:function(){return{now:{line:r,column:i},lineShift:o}},shift:function(e){o+=e}}}function ut(e,t){const n={associationId:ot,containerPhrasing:mt,containerFlow:gt,createTracker:dt,compilePattern:rt,enter:function(e){return n.stack.push(e),function(){n.stack.pop()}},handlers:{...X},handle:void 0,indentLines:at,indexStack:[],join:[...et],options:{},safe:vt,stack:[],unsafe:[...nt]};Xe(n,t||{}),n.options.tightDefinitions&&n.join.push(ft),n.handle=Z("type",{invalid:pt,unknown:ht,handlers:n.handlers});let o=n.handle(e,void 0,n,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return o&&10!==o.charCodeAt(o.length-1)&&13!==o.charCodeAt(o.length-1)&&(o+="\n"),o}function pt(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function ht(e){throw new Error("Cannot handle unknown node `"+e.type+"`")}function ft(e,t){if("definition"===e.type&&e.type===t.type)return 0}function mt(e,t){return function(e,t,n){const o=t.indexStack,r=e.children||[],i=[];let s,a=-1,l=n.before;o.push(-1);let c=t.createTracker(n);for(;++a<r.length;){const d=r[a];let u;if(o[o.length-1]=a,a+1<r.length){let n=t.handle.handlers[r[a+1].type];n&&n.peek&&(n=n.peek),u=n?n(r[a+1],e,t,{before:"",after:"",...c.current()}).charAt(0):""}else u=n.after;i.length>0&&("\r"===l||"\n"===l)&&"html"===d.type&&(i[i.length-1]=i[i.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=t.createTracker(n),c.move(i.join("")));let p=t.handle(d,e,t,{...c.current(),after:u,before:l});s&&s===p.slice(0,1)&&(p=G(s.charCodeAt(0))+p.slice(1));const h=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,s=void 0,h&&(i.length>0&&h.before&&l===i[i.length-1].slice(-1)&&(i[i.length-1]=i[i.length-1].slice(0,-1)+G(l.charCodeAt(0))),h.after&&(s=u)),c.move(p),i.push(p),l=p.slice(-1)}return o.pop(),i.join("")}(e,this,t)}function gt(e,t){return function(e,t,n){const o=t.indexStack,r=e.children||[],i=t.createTracker(n),s=[];let a=-1;for(o.push(-1);++a<r.length;){const n=r[a];o[o.length-1]=a,s.push(i.move(t.handle(n,e,t,{before:"\n",after:"\n",...i.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<r.length-1&&s.push(i.move(it(n,r[a+1],e,t)))}return o.pop(),s.join("")}(e,this,t)}function vt(e,t){return function(e,t,n){const o=(n.before||"")+(t||"")+(n.after||""),r=[],i=[],s={};let a=-1;for(;++a<e.unsafe.length;){const t=e.unsafe[a];if(!J(e.stack,t))continue;const n=e.compilePattern(t);let i;for(;i=n.exec(o);){const e="before"in t||Boolean(t.atBreak),n="after"in t,o=i.index+(e?i[1].length:0);r.includes(o)?(s[o].before&&!e&&(s[o].before=!1),s[o].after&&!n&&(s[o].after=!1)):(r.push(o),s[o]={before:e,after:n})}}r.sort(lt);let l=n.before?n.before.length:0;const c=o.length-(n.after?n.after.length:0);for(a=-1;++a<r.length;){const e=r[a];e<l||e>=c||e+1<c&&r[a+1]===e+1&&s[e].after&&!s[e+1].before&&!s[e+1].after||r[a-1]===e-1&&s[e].before&&!s[e-1].before&&!s[e-1].after||(l!==e&&i.push(ct(o.slice(l,e),"\\")),l=e,!/[!-/:-@[-`{-~]/.test(o.charAt(e))||n.encode&&n.encode.includes(o.charAt(e))?(i.push(G(o.charCodeAt(e))),l++):i.push("\\"))}return i.push(ct(o.slice(l,c),n.after)),i.join("")}(this,e,t)}var yt=function(e){return e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e}({}),wt=class extends Error{constructor(e,t){super(t),this.name="MilkdownError",this.code=e}},bt=(e,t)=>"function"==typeof t?"[Function]":t,kt=e=>JSON.stringify(e,bt);function Ct(){return new wt(yt.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function xt(){return new wt(yt.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function Nt(e){return new wt(yt.expectDomTypeError,`Expect to be a dom, but get: ${kt(e)}.`)}function St(){return new wt(yt.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function Ot(e){return new wt(yt.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}var Et=class{constructor(){this.sliceMap=new Map,this.get=e=>{const t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);if(!t)throw n="string"==typeof e?e:e.name,new wt(yt.contextNotFound,`Context "${n}" not found, do you forget to inject it?`);var n;return t},this.remove=e=>{const t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>"string"==typeof e?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}},Mt=class{#e=[];#t;#n=()=>{this.#e.forEach(e=>e(this.#t))};constructor(e,t,n){this.set=e=>{this.#t=e,this.#n()},this.get=()=>this.#t,this.update=e=>{this.#t=e(this.#t),this.#n()},this.type=n,this.#t=t,e.set(n.id,this)}on(e){return this.#e.push(e),()=>{this.#e=this.#e.filter(t=>t!==e)}}once(e){const t=this.on(n=>{e(n),t()});return t}off(e){this.#e=this.#e.filter(t=>t!==e)}offAll(){this.#e=[]}},_t=class{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw Ct()}}create(e,t=this._defaultValue){return new Mt(e,t,this)}},Tt=(e,t)=>new _t(e,t),Dt=class{#o;#r;#i;#s=new Set;#a=new Set;#l=new Map;#c=new Map;constructor(e,t,n){this.read=()=>({metadata:this.#o,injectedSlices:[...this.#s].map(e=>({name:"string"==typeof e?e:e.name,value:this.#d(e)})),consumedSlices:[...this.#a].map(e=>({name:"string"==typeof e?e:e.name,value:this.#d(e)})),recordedTimers:[...this.#l].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#u(e)})),waitTimers:[...this.#c].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#u(e)}))}),this.onRecord=e=>{this.#l.set(e,{start:Date.now(),duration:0})},this.onClear=e=>{this.#l.delete(e)},this.onDone=e=>{const t=this.#l.get(e);t&&(t.duration=Date.now()-t.start)},this.onWait=(e,t)=>{const n=Date.now();t.finally(()=>{this.#c.set(e,{duration:Date.now()-n})}).catch(console.error)},this.onInject=e=>{this.#s.add(e)},this.onRemove=e=>{this.#s.delete(e)},this.onUse=e=>{this.#a.add(e)},this.#r=e,this.#i=t,this.#o=n}#d=e=>this.#r.get(e).get();#u=e=>this.#i.get(e).status},It=class e{#r;#i;#o;#p;constructor(t,n,o){this.produce=t=>t&&Object.keys(t).length?new e(this.#r,this.#i,{...t}):this,this.inject=(e,t)=>{const n=e.create(this.#r.sliceMap);return null!=t&&n.set(t),this.#p?.onInject(e),this},this.remove=e=>(this.#r.remove(e),this.#p?.onRemove(e),this),this.record=e=>(e.create(this.#i.store),this.#p?.onRecord(e),this),this.clearTimer=e=>(this.#i.remove(e),this.#p?.onClear(e),this),this.isInjected=e=>this.#r.has(e),this.isRecorded=e=>this.#i.has(e),this.use=e=>(this.#p?.onUse(e),this.#r.get(e)),this.get=e=>this.use(e).get(),this.set=(e,t)=>this.use(e).set(t),this.update=(e,t)=>this.use(e).update(t),this.timer=e=>this.#i.get(e),this.done=e=>{this.timer(e).done(),this.#p?.onDone(e)},this.wait=e=>{const t=this.timer(e).start();return this.#p?.onWait(e,t),t},this.waitTimers=async e=>{await Promise.all(this.get(e).map(e=>this.wait(e)))},this.#r=t,this.#i=n,this.#o=o,o&&(this.#p=new Dt(t,n,o))}get meta(){return this.#o}get inspector(){return this.#p}},At=class{constructor(){this.store=new Map,this.get=e=>{const t=this.store.get(e.id);if(!t)throw n=e.name,new wt(yt.timerNotFound,`Timer "${n}" not found, do you forget to record it?`);var n;return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}},Rt=class{#h=null;#f=null;#m;#g="pending";constructor(e,t){this.start=()=>(this.#h??=new Promise((e,t)=>{this.#f=t=>{t instanceof CustomEvent&&t.detail.id===this.#m&&(this.#g="resolved",this.#v(),t.stopImmediatePropagation(),e())},this.#y(()=>{"pending"===this.#g&&(this.#g="rejected"),this.#v(),t(new Error(`Timing ${this.type.name} timeout.`))}),this.#g="pending",addEventListener(this.type.name,this.#f)}),this.#h),this.done=()=>{const e=new CustomEvent(this.type.name,{detail:{id:this.#m}});dispatchEvent(e)},this.#m=Symbol(t.name),this.type=t,e.set(t.id,this)}get status(){return this.#g}#v=()=>{this.#f&&removeEventListener(this.type.name,this.#f)};#y=e=>{setTimeout(()=>{e()},this.type.timeout)}},Pt=class{constructor(e,t=3e3){this.create=e=>new Rt(e,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}},Lt=(e,t=3e3)=>new Pt(e,t);function Vt(e){const t=this;t.compiler=function(n){return ut(n,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})}}function jt(e){this.content=e}function $t(e,t,n){for(let o=0;;o++){if(o==e.childCount||o==t.childCount)return e.childCount==t.childCount?null:n;let r=e.child(o),i=t.child(o);if(r!=i){if(!r.sameMarkup(i))return n;if(r.isText&&r.text!=i.text){for(let e=0;r.text[e]==i.text[e];e++)n++;return n}if(r.content.size||i.content.size){let e=$t(r.content,i.content,n+1);if(null!=e)return e}n+=r.nodeSize}else n+=r.nodeSize}}function Bt(e,t,n,o){for(let r=e.childCount,i=t.childCount;;){if(0==r||0==i)return r==i?null:{a:n,b:o};let s=e.child(--r),a=t.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:o};if(s.isText&&s.text!=a.text){let e=0,t=Math.min(s.text.length,a.text.length);for(;e<t&&s.text[s.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,o--;return{a:n,b:o}}if(s.content.size||a.content.size){let e=Bt(s.content,a.content,n-1,o-1);if(e)return e}n-=l,o-=l}else n-=l,o-=l}}jt.prototype={constructor:jt,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var o=n&&n!=e?this.remove(n):this,r=o.find(e),i=o.content.slice();return-1==r?i.push(n||e,t):(i[r+1]=t,n&&(i[r]=n)),new jt(i)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new jt(n)},addToStart:function(e,t){return new jt([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new jt(n)},addBefore:function(e,t,n){var o=this.remove(t),r=o.content.slice(),i=o.find(e);return r.splice(-1==i?r.length:i,0,t,n),new jt(r)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=jt.from(e)).size?new jt(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=jt.from(e)).size?new jt(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=jt.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},jt.from=function(e){if(e instanceof jt)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new jt(t)};let Ht=class e{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,o=0,r){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,o+s,r||null,i)&&a.content.size){let r=s+1;a.nodesBetween(Math.max(0,e-r),Math.min(a.content.size,t-r),n,o+r)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,o){let r="",i=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?o?"function"==typeof o?o(s):o:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:r+=n),r+=l},0),r}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,o=t.firstChild,r=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(o)&&(r[r.length-1]=n.withText(n.text+o.text),i=1);i<t.content.length;i++)r.push(t.content[i]);return new e(r,this.size+t.size)}cut(t,n=this.size){if(0==t&&n==this.size)return this;let o=[],r=0;if(n>t)for(let e=0,i=0;i<n;e++){let s=this.content[e],a=i+s.nodeSize;a>t&&((i<t||a>n)&&(s=s.isText?s.cut(Math.max(0,t-i),Math.min(s.text.length,n-i)):s.cut(Math.max(0,t-i-1),Math.min(s.content.size,n-i-1))),o.push(s),r+=s.nodeSize),i=a}return new e(o,r)}cutByIndex(t,n){return t==n?e.empty:0==t&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let o=this.content[t];if(o==n)return this;let r=this.content.slice(),i=this.size+n.nodeSize-o.nodeSize;return r[t]=n,new e(r,i)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let o=this.content[t];e(o,n,t),n+=o.nodeSize}}findDiffStart(e,t=0){return $t(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Bt(this,e,t,n)}findIndex(e){if(0==e)return zt(0,e);if(e==this.size)return zt(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let o=n+this.child(t).nodeSize;if(o>=e)return o==e?zt(t+1,o):zt(t,n);n=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,o=0;for(let e=0;e<t.length;e++){let r=t[e];o+=r.nodeSize,e&&r.isText&&t[e-1].sameMarkup(r)?(n||(n=t.slice(0,e)),n[n.length-1]=r.withText(n[n.length-1].text+r.text)):n&&n.push(r)}return new e(n||t,o)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Ht.empty=new Ht([],0);const Ft={index:0,offset:0};function zt(e,t){return Ft.index=e,Ft.offset=t,Ft}function qt(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!qt(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!qt(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class Wt{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let o=0;o<e.length;o++){let r=e[o];if(this.eq(r))return e;if(this.type.excludes(r.type))t||(t=e.slice(0,o));else{if(r.type.excludes(this.type))return e;!n&&r.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),n=!0),t&&t.push(r)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&qt(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let o=n.create(t.attrs);return n.checkAttrs(o.attrs),o}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return Wt.none;if(e instanceof Wt)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}Wt.none=[];class Ut extends Error{}class Kt{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Jt(this.content,e+this.openStart,t);return n&&new Kt(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Kt(Gt(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Kt.empty;let n=t.openStart||0,o=t.openEnd||0;if("number"!=typeof n||"number"!=typeof o)throw new RangeError("Invalid input for Slice.fromJSON");return new Kt(Ht.fromJSON(e,t.content),n,o)}static maxOpen(e,t=!0){let n=0,o=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)o++;return new Kt(e,n,o)}}function Gt(e,t,n){let{index:o,offset:r}=e.findIndex(t),i=e.maybeChild(o),{index:s,offset:a}=e.findIndex(n);if(r==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(o,i.copy(Gt(i.content,t-r-1,n-r-1)))}function Jt(e,t,n,o){let{index:r,offset:i}=e.findIndex(t),s=e.maybeChild(r);if(i==t||s.isText)return o&&!o.canReplace(r,r,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=Jt(s.content,t-i-1,n,s);return a&&e.replaceChild(r,s.copy(a))}function Zt(e,t,n){if(n.openStart>e.depth)throw new Ut("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ut("Inconsistent open depths");return Xt(e,t,n,0)}function Xt(e,t,n,o){let r=e.index(o),i=e.node(o);if(r==t.index(o)&&o<e.depth-n.openStart){let s=Xt(e,t,n,o+1);return i.copy(i.content.replaceChild(r,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=o||t.depth!=o){let{start:r,end:s}=function(e,t){let n=t.depth-e.openStart,o=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)o=t.node(e).copy(Ht.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}(n,e);return nn(i,on(e,r,s,t,o))}{let o=e.parent,r=o.content;return nn(o,r.cut(0,e.parentOffset).append(n.content).append(r.cut(t.parentOffset)))}}return nn(i,rn(e,t,o))}function Yt(e,t){if(!t.type.compatibleContent(e.type))throw new Ut("Cannot join "+t.type.name+" onto "+e.type.name)}function Qt(e,t,n){let o=e.node(n);return Yt(o,t.node(n)),o}function en(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function tn(e,t,n,o){let r=(t||e).node(n),i=0,s=t?t.index(n):r.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(en(e.nodeAfter,o),i++));for(let e=i;e<s;e++)en(r.child(e),o);t&&t.depth==n&&t.textOffset&&en(t.nodeBefore,o)}function nn(e,t){return e.type.checkContent(t),e.copy(t)}function on(e,t,n,o,r){let i=e.depth>r&&Qt(e,t,r+1),s=o.depth>r&&Qt(n,o,r+1),a=[];return tn(null,e,r,a),i&&s&&t.index(r)==n.index(r)?(Yt(i,s),en(nn(i,on(e,t,n,o,r+1)),a)):(i&&en(nn(i,rn(e,t,r+1)),a),tn(t,n,r,a),s&&en(nn(s,rn(n,o,r+1)),a)),tn(o,null,r,a),new Ht(a)}function rn(e,t,n){let o=[];if(tn(null,e,n,o),e.depth>n){en(nn(Qt(e,t,n+1),rn(e,t,n+1)),o)}return tn(t,null,n,o),new Ht(o)}Kt.empty=new Kt(Ht.empty,0,0);class sn{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],o=e.child(t);return n?e.child(t).cut(n):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],o=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)o+=n.child(t).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Wt.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),o=e.maybeChild(t);if(!n){let e=n;n=o,o=e}let r=n.marks;for(var i=0;i<r.length;i++)!1!==r[i].type.spec.inclusive||o&&r[i].isInSet(o.marks)||(r=r[i--].removeFromSet(r));return r}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,o=e.parent.maybeChild(e.index());for(var r=0;r<n.length;r++)!1!==n[r].type.spec.inclusive||o&&n[r].isInSet(o.marks)||(n=n[r--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new dn(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],o=0,r=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(r),s=r-i;if(n.push(t,e,o+i),!s)break;if(t=t.child(e),t.isText)break;r=s-1,o+=i+1}return new sn(t,n,r)}static resolveCached(e,t){let n=cn.get(e);if(n)for(let e=0;e<n.elts.length;e++){let o=n.elts[e];if(o.pos==t)return o}else cn.set(e,n=new an);let o=n.elts[n.i]=sn.resolve(e,t);return n.i=(n.i+1)%ln,o}}class an{constructor(){this.elts=[],this.i=0}}const ln=12,cn=new WeakMap;class dn{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const un=Object.create(null);class pn{constructor(e,t,n,o=Wt.none){this.type=e,this.attrs=t,this.marks=o,this.content=n||Ht.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,o=0){this.content.nodesBetween(e,t,n,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,o){return this.content.textBetween(e,t,n,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&qt(this.attrs,t||e.defaultAttrs||un)&&Wt.sameSet(this.marks,n||Wt.none)}copy(e=null){return e==this.content?this:new pn(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new pn(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Kt.empty;let o=this.resolve(e),r=this.resolve(t),i=n?0:o.sharedDepth(t),s=o.start(i),a=o.node(i).content.cut(o.pos-s,r.pos-s);return new Kt(a,o.depth-i,r.depth-i)}replace(e,t,n){return Zt(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let o=this.content.child(t-1);return{node:o,index:t-1,offset:n-o.nodeSize}}resolve(e){return sn.resolveCached(this,e)}resolveNoCache(e){return sn.resolve(this,e)}rangeHasMark(e,t,n){let o=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),fn(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Ht.empty,o=0,r=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,o,r),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=o;e<r;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,o){if(o&&!this.type.allowsMarks(o))return!1;let r=this.contentMatchAt(e).matchType(n),i=r&&r.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Wt.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Wt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let o=Ht.fromJSON(e,t.content),r=e.nodeType(t.type).create(t.attrs,o,n);return r.type.checkAttrs(r.attrs),r}}pn.prototype.text=void 0;class hn extends pn{constructor(e,t,n,o){if(super(e,t,null,o),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):fn(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new hn(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new hn(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function fn(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class mn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new gn(e,t);if(null==n.next)return mn.empty;let o=vn(n);n.next&&n.err("Unexpected trailing text");let r=function(e){let t=Object.create(null);return n(xn(e,0));function n(o){let r=[];o.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let o;for(let e=0;e<r.length;e++)r[e][0]==t&&(o=r[e][1]);xn(e,n).forEach(e=>{o||r.push([t,o=[]]),-1==o.indexOf(e)&&o.push(e)})})});let i=t[o.join(",")]=new mn(o.indexOf(e.length-1)>-1);for(let e=0;e<r.length;e++){let o=r[e][1].sort(Cn);i.next.push({type:r[e][0],next:t[o.join(",")]||n(o)})}return i}}(function(e){let t=[[]];return r(i(e,0),n()),t;function n(){return t.push([])-1}function o(e,n,o){let r={term:o,to:n};return t[e].push(r),r}function r(e,t){e.forEach(e=>e.to=t)}function i(e,t){if("choice"==e.type)return e.exprs.reduce((e,n)=>e.concat(i(n,t)),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return o(t,s),r(i(e.expr,s),s),[o(s)]}if("plus"==e.type){let s=n();return r(i(e.expr,t),s),r(i(e.expr,s),s),[o(s)]}if("opt"==e.type)return[o(t)].concat(i(e.expr,t));if("range"==e.type){let s=t;for(let t=0;t<e.min;t++){let t=n();r(i(e.expr,s),t),s=t}if(-1==e.max)r(i(e.expr,s),s);else for(let t=e.min;t<e.max;t++){let t=n();o(s,t),r(i(e.expr,s),t),s=t}return[o(s)]}if("name"==e.type)return[o(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let o=0;;o++){let s=i(e.exprs[o],t);if(o==e.exprs.length-1)return s;r(s,t=n())}}}(o));return function(e,t){for(let n=0,o=[e];n<o.length;n++){let e=o[n],r=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!r||n.isText||n.hasRequiredAttrs()||(r=!1),-1==o.indexOf(s)&&o.push(s)}r&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(r,n),r}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let o=this;for(let r=t;o&&r<n;r++)o=o.matchType(e.child(r).type);return o}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let o=[this];return function r(i,s){let a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return Ht.from(s.map(e=>e.createAndFill()));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==o.indexOf(n)){o.push(n);let e=r(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let o=n.shift(),r=o.match;if(r.matchType(e)){let e=[];for(let t=o;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<r.next.length;e++){let{type:i,next:s}=r.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||o.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:o}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let o=0;o<n.next.length;o++)-1==e.indexOf(n.next[o].next)&&t(n.next[o].next)}(this),e.map((t,n)=>{let o=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)o+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return o}).join("\n")}}mn.empty=new mn(!0);class gn{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function vn(e){let t=[];do{t.push(yn(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function yn(e){let t=[];do{t.push(wn(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function wn(e){let t=function(e){if(e.eat("(")){let t=vn(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,o=n[t];if(o)return[o];let r=[];for(let e in n){let o=n[e];o.isInGroup(t)&&r.push(o)}0==r.length&&e.err("No node type or group '"+t+"' found");return r}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=kn(e,t)}return t}function bn(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function kn(e,t){let n=bn(e),o=n;return e.eat(",")&&(o="}"!=e.next?bn(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:t}}function Cn(e,t){return t-e}function xn(e,t){let n=[];return function t(o){let r=e[o];if(1==r.length&&!r[0].term)return t(r[0].to);n.push(o);for(let e=0;e<r.length;e++){let{term:o,to:i}=r[e];o||-1!=n.indexOf(i)||t(i)}}(t),n.sort(Cn)}function Nn(e){let t=Object.create(null);for(let n in e){let o=e[n];if(!o.hasDefault)return null;t[n]=o.default}return t}function Sn(e,t){let n=Object.create(null);for(let o in e){let r=t&&t[o];if(void 0===r){let t=e[o];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+o);r=t.default}n[o]=r}return n}function On(e,t,n,o){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let n in e){let o=e[n];o.validate&&o.validate(t[n])}}function En(e,t){let n=Object.create(null);if(t)for(let o in t)n[o]=new _n(e,o,t[o]);return n}let Mn=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=En(e,n.attrs),this.defaultAttrs=Nn(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==mn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Sn(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new pn(this,this.computeAttrs(e),Ht.from(t),Wt.setFrom(n))}createChecked(e=null,t,n){return t=Ht.from(t),this.checkContent(t),new pn(this,this.computeAttrs(e),t,Wt.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Ht.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let o=this.contentMatch.matchFragment(t),r=o&&o.fillBefore(Ht.empty,!0);return r?new pn(this,e,t.append(r),Wt.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){On(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Wt.none:e}static compile(t,n){let o=Object.create(null);t.forEach((t,r)=>o[t]=new e(t,n,r));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let e in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};class _n{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let o=n.split("|");return n=>{let r=null===n?"null":typeof n;if(o.indexOf(r)<0)throw new RangeError(`Expected value of type ${o} for attribute ${t} on type ${e}, got ${r}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Tn{constructor(e,t,n,o){this.name=e,this.rank=t,this.schema=n,this.spec=o,this.attrs=En(e,o.attrs),this.excluded=null;let r=Nn(this.attrs);this.instance=r?new Wt(this,r):null}create(e=null){return!e&&this.instance?this.instance:new Wt(this,Sn(this.attrs,e))}static compile(e,t){let n=Object.create(null),o=0;return e.forEach((e,r)=>n[e]=new Tn(e,o++,t,r)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){On(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Dn{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=jt.from(e.nodes),t.marks=jt.from(e.marks||{}),this.nodes=Mn.compile(this.spec.nodes,this),this.marks=Tn.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],o=t.spec.content||"",r=t.spec.marks;if(t.contentMatch=n[o]||(n[o]=mn.parse(o,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==r?null:r?In(this,r.split(" ")):""!=r&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:In(this,n.split(" "))}this.nodeFromJSON=e=>pn.fromJSON(this,e),this.markFromJSON=e=>Wt.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,o){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Mn))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,o)}text(e,t){let n=this.nodes.text;return new hn(n,n.defaultAttrs,e,Wt.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function In(e,t){let n=[];for(let o=0;o<t.length;o++){let r=t[o],i=e.marks[r],s=i;if(i)n.push(i);else for(let t in e.marks){let o=e.marks[t];("_"==r||o.spec.group&&o.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=o)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[o]+"'")}return n}class An{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new $n(this,t,!1);return n.addAll(e,Wt.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new $n(this,t,!0);return n.addAll(e,Wt.none,t.from,t.to),Kt.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){let n=this.tags[o];if(Bn(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,o){for(let r=o?this.styles.indexOf(o)+1:0;r<this.styles.length;r++){let o=this.styles[r],i=o.style;if(!(0!=i.indexOf(e)||o.context&&!n.matchesContext(o.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(o.getAttrs){let e=o.getAttrs(t);if(!1===e)continue;o.attrs=e||void 0}return o}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,o=0;for(;o<t.length;o++){let e=t[o];if((null==e.priority?50:e.priority)<n)break}t.splice(o,0,e)}for(let t in e.marks){let o=e.marks[t].spec.parseDOM;o&&o.forEach(e=>{n(e=Hn(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let o=e.nodes[t].spec.parseDOM;o&&o.forEach(e=>{n(e=Hn(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new An(e,An.schemaRules(e)))}}const Rn={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Pn={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ln={ol:!0,ul:!0};function Vn(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class jn{constructor(e,t,n,o,r,i){this.type=e,this.attrs=t,this.marks=n,this.solid=o,this.options=i,this.content=[],this.activeMarks=Wt.none,this.match=r||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Ht.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Ht.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Ht.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Rn.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class $n{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let o,r=t.topNode,i=Vn(null,t.preserveWhitespace,0)|(n?4:0);o=r?new jn(r.type,r.attrs,Wt.none,!0,t.topMatch||r.type.contentMatch,i):new jn(n?null:e.schema.topNodeType,null,Wt.none,!0,null,i),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,o=this.top,r=2&o.options?"full":this.localPreserveWS||(1&o.options)>0,{schema:i}=this.parser;if("full"===r||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r)if("full"===r)n=n.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(i.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(i.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=o.content[o.content.length-1],r=e.previousSibling;(!t||r&&"BR"==r.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let o=this.localPreserveWS,r=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=e.nodeName.toLowerCase();Ln.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&Ln.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(a?a.ignore:Pn.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,o=this.needsBlock;if(Rn.hasOwnProperty(s))r.content.length&&r.content[0].isInline&&this.open&&(this.open--,r=this.top),n=!0,r.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=a&&a.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(r),this.needsBlock=o}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?i:void 0)}this.localPreserveWS=o}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let o=this.parser.matchedStyles[e],r=n.getPropertyValue(o);if(r)for(let e;;){let n=this.parser.matchStyle(o,r,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;e=n}}return t}addElementByRule(e,t,n,o){let r,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(r=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(o)this.addElement(e,n,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let o=e;"string"==typeof t.contentElement?o=e.querySelector(t.contentElement):"function"==typeof t.contentElement?o=t.contentElement(e):t.contentElement&&(o=t.contentElement),this.findAround(e,o,!0),this.addAll(o,n),this.findAround(e,o,!1)}r&&this.sync(s)&&this.open--}addAll(e,t,n,o){let r=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=null==o?null:e.childNodes[o];i!=s;i=i.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(i,t);this.findAtPoint(e,r)}findPlace(e,t,n){let o,r;for(let t=this.open,i=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!o||o.length>a.length+i)&&(o=a,r=s,!a.length))break;if(s.solid){if(n)break;i+=2}}if(!o)return null;this.sync(r);for(let e=0;e<o.length;e++)t=this.enterInner(o[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let o=this.findPlace(e,t,n);if(o){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=Wt.none;for(let r of o.concat(e.marks))(t.type?t.type.allowsMarkType(r.type):Fn(r.type,e.type))&&(n=r.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,o){let r=this.findPlace(e.create(t),n,!1);return r&&(r=this.enterInner(e,t,n,!0,o)),r}enterInner(e,t,n,o=!1,r){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=Vn(e,r,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=Wt.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):Fn(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new jn(e,t,a,o,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)if(null==this.find[o].pos&&1==e.nodeType&&e.contains(this.find[o].node)){t.compareDocumentPosition(this.find[o].node)&(n?2:4)&&(this.find[o].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,o=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),r=-(n?n.depth+1:0)+(o?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=r;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&o?this.nodes[s].type:n&&s>=r?n.node(s-r).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function Bn(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Hn(e){let t={};for(let n in e)t[n]=e[n];return t}function Fn(e,t){let n=t.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:o,next:r}=e.edge(n);if(o==t)return!0;if(i.indexOf(r)<0&&s(r))return!0}};if(s(r.contentMatch))return!0}}class zn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Wn(t).createDocumentFragment());let o=n,r=[];return e.forEach(e=>{if(r.length||e.marks.length){let n=0,i=0;for(;n<r.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(r[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<r.length;)o=r.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(r.push([n,o]),o.appendChild(s.dom),o=s.contentDOM||s.dom)}}o.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:o}=Gn(Wn(t),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let r=this.serializeMark(e.marks[o],e.isInline,t);r&&((r.contentDOM||r.dom).appendChild(n),n=r.dom)}return n}serializeMark(e,t,n={}){let o=this.marks[e.type.name];return o&&Gn(Wn(n),o(e,t),null,e.attrs)}static renderSpec(e,t,n=null,o){return Gn(e,t,n,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new zn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=qn(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return qn(e.marks)}}function qn(e){let t={};for(let n in e){let o=e[n].spec.toDOM;o&&(t[n]=o)}return t}function Wn(e){return e.document||window.document}const Un=new WeakMap;function Kn(e){let t=Un.get(e);return void 0===t&&Un.set(e,t=function(e){let t=null;function n(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}(e)),t}function Gn(e,t,n,o){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let r,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(o&&(r=Kn(o))&&r.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l=n?e.createElementNS(n,i):e.createElement(i),c=t[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&l.style?l.style.cssText=c[e]:l.setAttribute(e,c[e])}}for(let r=d;r<t.length;r++){let i=t[r];if(0===i){if(r<t.length-1||r>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:t,contentDOM:r}=Gn(e,i,n,o);if(l.appendChild(t),r){if(s)throw new RangeError("Multiple content holes");s=r}}}return{dom:l,contentDOM:s}}const Jn=Math.pow(2,16);function Zn(e,t){return e+t*Jn}function Xn(e){return 65535&e}class Yn{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class Qn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Qn.empty)return Qn.empty}recover(e){let t=0,n=Xn(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Jn}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let o=0,r=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?o:0);if(a>e)break;let l=this.ranges[s+r],c=this.ranges[s+i],d=a+l;if(e<=d){let r=a+o+((l?e==a?-1:e==d?1:t:t)<0?0:c);if(n)return r;let i=e==(t<0?a:d)?null:Zn(s/3,e-a),u=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(u|=8),new Yn(r,u,i)}o+=c-l}return n?e+o:new Yn(e+o,0,null)}touches(e,t){let n=0,o=Xn(t),r=this.inverted?2:1,i=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+r];if(e<=s+a&&t==3*o)return!0;n+=this.ranges[t+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let o=0,r=0;o<this.ranges.length;o+=3){let i=this.ranges[o],s=i-(this.inverted?r:0),a=i+(this.inverted?0:r),l=this.ranges[o+t],c=this.ranges[o+n];e(s,s+l,a,a+c),r+=c-l}}invert(){return new Qn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?Qn.empty:new Qn(e<0?[0,-e,0]:[0,0,e])}}Qn.empty=new Qn([]);class eo{constructor(e,t,n=0,o=(e?e.length:0)){this.mirror=t,this.from=n,this.to=o,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new eo(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let o=e.getMirror(t);this.appendMap(e._maps[t],null!=o&&o<t?n+o:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=o&&o>t?n-o-1:void 0)}}invert(){let e=new eo;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let o=0;for(let n=this.from;n<this.to;n++){let r=this._maps[n].mapResult(e,t);if(null!=r.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(r.recover);continue}}o|=r.delInfo,e=r.pos}return n?e:new Yn(e,o,null)}}const to=Object.create(null);class no{getMap(){return Qn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=to[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in to)throw new RangeError("Duplicate use of step JSON ID "+e);return to[e]=t,t.prototype.jsonID=e,t}}class oo{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new oo(e,null)}static fail(e){return new oo(null,e)}static fromReplace(e,t,n,o){try{return oo.ok(e.replace(t,n,o))}catch(e){if(e instanceof Ut)return oo.fail(e.message);throw e}}}function ro(e,t,n){let o=[];for(let r=0;r<e.childCount;r++){let i=e.child(r);i.content.size&&(i=i.copy(ro(i.content,t,i))),i.isInline&&(i=t(i,n,r)),o.push(i)}return Ht.fromArray(o)}class io extends no{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),o=n.node(n.sharedDepth(this.to)),r=new Kt(ro(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,o),t.openStart,t.openEnd);return oo.fromReplace(e,this.from,this.to,r)}invert(){return new so(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new io(t.pos,n.pos,this.mark)}merge(e){return e instanceof io&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new io(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new io(t.from,t.to,e.markFromJSON(t.mark))}}no.jsonID("addMark",io);class so extends no{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Kt(ro(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return oo.fromReplace(e,this.from,this.to,n)}invert(){return new io(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new so(t.pos,n.pos,this.mark)}merge(e){return e instanceof so&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new so(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new so(t.from,t.to,e.markFromJSON(t.mark))}}no.jsonID("removeMark",so);class ao extends no{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return oo.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return oo.fromReplace(e,this.pos,this.pos+1,new Kt(Ht.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new ao(this.pos,t.marks[n]);return new ao(this.pos,this.mark)}}return new lo(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ao(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ao(t.pos,e.markFromJSON(t.mark))}}no.jsonID("addNodeMark",ao);class lo extends no{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return oo.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return oo.fromReplace(e,this.pos,this.pos+1,new Kt(Ht.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new ao(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new lo(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new lo(t.pos,e.markFromJSON(t.mark))}}no.jsonID("removeNodeMark",lo);class co extends no{constructor(e,t,n,o=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=o}apply(e){return this.structure&&po(e,this.from,this.to)?oo.fail("Structure replace would overwrite content"):oo.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Qn([this.from,this.to-this.from,this.slice.size])}invert(e){return new co(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&co.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new co(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof co)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?Kt.empty:new Kt(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new co(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?Kt.empty:new Kt(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new co(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new co(t.from,t.to,Kt.fromJSON(e,t.slice),!!t.structure)}}co.MAP_BIAS=1,no.jsonID("replace",co);class uo extends no{constructor(e,t,n,o,r,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=o,this.slice=r,this.insert=i,this.structure=s}apply(e){if(this.structure&&(po(e,this.from,this.gapFrom)||po(e,this.gapTo,this.to)))return oo.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return oo.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?oo.fromReplace(e,this.from,this.to,n):oo.fail("Content does not fit in gap")}getMap(){return new Qn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new uo(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),r=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||o<t.pos||r>n.pos?null:new uo(t.pos,n.pos,o,r,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new uo(t.from,t.to,t.gapFrom,t.gapTo,Kt.fromJSON(e,t.slice),t.insert,!!t.structure)}}function po(e,t,n){let o=e.resolve(t),r=n-t,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let e=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,r--}}return!1}function ho(e,t,n,o=n.contentMatch,r=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<i.childCount;t++){let l=i.child(t),c=a+l.nodeSize,d=o.matchType(l.type);if(d){o=d;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new so(a,c,l.marks[t]));if(r&&l.isText&&"pre"!=n.whitespace){let e,t,o=/\r?\n|\r/g;for(;e=o.exec(l.text);)t||(t=new Kt(Ht.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new co(a+e.index,a+e.index+e[0].length,t))}}else s.push(new co(a,c,Kt.empty));a=c}if(!o.validEnd){let t=o.fillBefore(Ht.empty,!0);e.replace(a,a,new Kt(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function fo(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function mo(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,o=0,r=0;;--n){let i=e.$from.node(n),s=e.$from.index(n)+o,a=e.$to.indexAfter(n)-r;if(n<e.depth&&i.canReplace(s,a,t))return n;if(0==n||i.type.spec.isolating||!fo(i,s,a))break;s&&(o=1),a<i.childCount&&(r=1)}return null}function go(e,t,n=null,o=e){let r=function(e,t){let{parent:n,startIndex:o,endIndex:r}=e,i=n.contentMatchAt(o).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(o,r,s)?i:null}(e,t),i=r&&function(e,t){let{parent:n,startIndex:o,endIndex:r}=e,i=n.child(o),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=o;a&&e<r;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(o,t);return i?r.map(vo).concat({type:t,attrs:n}).concat(i.map(vo)):null}function vo(e){return{type:e,attrs:null}}function yo(e,t,n,o){t.forEach((r,i)=>{if(r.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(r.text);){let r=e.mapping.slice(o).map(n+1+i+s.index);e.replaceWith(r,r+1,t.type.schema.linebreakReplacement.create())}}})}function wo(e,t,n,o){t.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let r=e.mapping.slice(o).map(n+1+i);e.replaceWith(r,r+1,t.type.schema.text("\n"))}})}function bo(e,t,n=1,o){let r=e.resolve(t),i=r.depth-n,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let e=r.depth-1,t=n-2;e>i;e--,t--){let n=r.node(e),i=r.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=o&&o[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=o&&o[t]||n;if(!n.canReplace(i+1,n.childCount)||!l.type.validContent(s))return!1}let a=r.indexAfter(i),l=o&&o[0];return r.node(i).canReplaceWith(a,a,l?l.type:r.node(i+1).type)}function ko(e,t){let n=e.resolve(t),o=n.index();return r=n.nodeBefore,i=n.nodeAfter,!(!r||!i||r.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:o}=e.type.schema;for(let r=0;r<t.childCount;r++){let i=t.child(r),s=i.type==o?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(r,i))&&n.parent.canReplace(o,o+1);var r,i}function Co(e,t,n=t,o=Kt.empty){if(t==n&&!o.size)return null;let r=e.resolve(t),i=e.resolve(n);return xo(r,i,o)?new co(t,n,o):new No(r,i,o).fit()}function xo(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}no.jsonID("replaceAround",uo);class No{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Ht.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=Ht.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,o=this.close(e<0?this.$to:n.doc.resolve(e));if(!o)return null;let r=this.placed,i=n.depth,s=o.depth;for(;i&&s&&1==r.childCount;)r=r.firstChild.content,i--,s--;let a=new Kt(r,i,s);return e>-1?new uo(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new co(n.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,o=this.unplaced.openEnd;n<e;n++){let r=t.firstChild;if(t.childCount>1&&(o=0),r.type.spec.isolating&&o<=n){e=n;break}t=r.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,o=null;n?(o=Eo(this.unplaced.content,n-1).firstChild,e=o.content):e=this.unplaced.content;let r=e.firstChild;for(let e=this.depth;e>=0;e--){let i,{type:s,match:a}=this.frontier[e],l=null;if(1==t&&(r?a.matchType(r.type)||(l=a.fillBefore(Ht.from(r),!1)):o&&s.compatibleContent(o.type)))return{sliceDepth:n,frontierDepth:e,parent:o,inject:l};if(2==t&&r&&(i=a.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:e,parent:o,wrap:i};if(o&&a.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=Eo(e,t);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new Kt(e,t+1,Math.max(n,o.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=Eo(e,t);if(o.childCount<=1&&t>0){let r=e.size-t<=t+o.size;this.unplaced=new Kt(So(e,t-1,1),t-1,r?t-1:n)}else this.unplaced=new Kt(So(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:o,wrap:r}){for(;this.depth>t;)this.closeFrontierNode();if(r)for(let e=0;e<r.length;e++)this.openFrontierNode(r[e]);let i=this.unplaced,s=n?n.content:i.content,a=i.openStart-e,l=0,c=[],{match:d,type:u}=this.frontier[t];if(o){for(let e=0;e<o.childCount;e++)c.push(o.child(e));d=d.matchFragment(o)}let p=s.size+e-(i.content.size-i.openEnd);for(;l<s.childCount;){let e=s.child(l),t=d.matchType(e.type);if(!t)break;l++,(l>1||0==a||e.content.size)&&(d=t,c.push(Mo(e.mark(u.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?p:-1)))}let h=l==s.childCount;h||(p=-1),this.placed=Oo(this.placed,t,Ht.from(c)),this.frontier[t].match=d,h&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<p;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=h?0==e?Kt.empty:new Kt(So(i.content,e-1,1),e-1,p<0?i.openEnd:e-1):new Kt(So(i.content,e,l),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!_o(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,o=this.$to.after(n);for(;n>1&&o==this.$to.end(--n);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:o}=this.frontier[t],r=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=_o(e,t,o,n,r);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:o}=this.frontier[n],r=_o(e,n,o,t,!0);if(!r||r.childCount)continue e}return{depth:t,fit:i,move:r?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Oo(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),o=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,o)}return e}openFrontierNode(e,t=null,n){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Oo(this.placed,this.depth,Ht.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Ht.empty,!0);e.childCount&&(this.placed=Oo(this.placed,this.frontier.length,e))}}function So(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(So(e.firstChild.content,t-1,n)))}function Oo(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Oo(e.lastChild.content,t-1,n)))}function Eo(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Mo(e,t,n){if(t<=0)return e;let o=e.content;return t>1&&(o=o.replaceChild(0,Mo(o.firstChild,t-1,1==o.childCount?n-1:0))),t>0&&(o=e.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(e.type.contentMatch.matchFragment(o).fillBefore(Ht.empty,!0)))),e.copy(o)}function _o(e,t,n,o,r){let i=e.node(t),s=r?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=o.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let o=n;o<t.childCount;o++)if(!e.allowsMarks(t.child(o).marks))return!0;return!1}(n,i.content,s)?a:null}function To(e){return e.spec.defining||e.spec.definingForContent}function Do(e,t,n,o,r){if(t<n){let r=e.firstChild;e=e.replaceChild(0,r.copy(Do(r.content,t+1,n,o,r)))}if(t>o){let t=r.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Ht.empty,!0))}return e}function Io(e,t){let n=[];for(let o=Math.min(e.depth,t.depth);o>=0;o--){let r=e.start(o);if(r<e.pos-(e.depth-o)||t.end(o)>t.pos+(t.depth-o)||e.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(r==t.start(o)||o==e.depth&&o==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==r-1)&&n.push(o)}return n}class Ao extends no{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return oo.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let o=t.type.create(n,null,t.marks);return oo.fromReplace(e,this.pos,this.pos+1,new Kt(Ht.from(o),0,t.isLeaf?0:1))}getMap(){return Qn.empty}invert(e){return new Ao(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ao(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ao(t.pos,t.attr,t.value)}}no.jsonID("attr",Ao);class Ro extends no{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return oo.ok(n)}getMap(){return Qn.empty}invert(e){return new Ro(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ro(t.attr,t.value)}}no.jsonID("docAttr",Ro);let Po=class extends Error{};Po=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(Po.prototype=Object.create(Error.prototype)).constructor=Po,Po.prototype.name="TransformError";class Lo{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new eo}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Po(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let o=this.mapping.maps[n];n&&(e=o.map(e,1),t=o.map(t,-1)),o.forEach((n,o,r,i)=>{e=Math.min(e,r),t=Math.max(t,i)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=Kt.empty){let o=Co(this.doc,e,t,n);return o&&this.step(o),this}replaceWith(e,t,n){return this.replace(e,t,new Kt(Ht.from(n),0,0))}delete(e,t){return this.replace(e,t,Kt.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,o){if(!o.size)return e.deleteRange(t,n);let r=e.doc.resolve(t),i=e.doc.resolve(n);if(xo(r,i,o))return e.step(new co(t,n,o));let s=Io(r,i);0==s[s.length-1]&&s.pop();let a=-(r.depth+1);s.unshift(a);for(let e=r.depth,t=r.pos-1;e>0;e--,t--){let n=r.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:r.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),c=[],d=o.openStart;for(let e=o.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==o.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){let t=c[e],n=To(t.type);if(n&&!t.sameMarkup(r.node(Math.abs(a)-1)))d=e;else if(n||!t.type.isTextblock)break}for(let t=o.openStart;t>=0;t--){let a=(t+d+1)%(o.openStart+1),u=c[a];if(u)for(let t=0;t<s.length;t++){let c=s[(t+l)%s.length],d=!0;c<0&&(d=!1,c=-c);let p=r.node(c-1),h=r.index(c-1);if(p.canReplaceWith(h,h,u.type,u.marks))return e.replace(r.before(c),d?i.after(c):n,new Kt(Do(o.content,0,o.openStart,a),a,o.openEnd))}}let u=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,o),!(e.steps.length>u));a--){let e=s[a];e<0||(t=r.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,o){if(!o.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let r=function(e,t,n){let o=e.resolve(t);if(o.parent.canReplaceWith(o.index(),o.index(),n))return t;if(0==o.parentOffset)for(let e=o.depth-1;e>=0;e--){let t=o.index(e);if(o.node(e).canReplaceWith(t,t,n))return o.before(e+1);if(t>0)return null}if(o.parentOffset==o.parent.content.size)for(let e=o.depth-1;e>=0;e--){let t=o.indexAfter(e);if(o.node(e).canReplaceWith(t,t,n))return o.after(e+1);if(t<o.node(e).childCount)return null}return null}(e.doc,t,o.type);null!=r&&(t=n=r)}e.replaceRange(t,n,new Kt(Ht.from(o),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let o=e.doc.resolve(t),r=e.doc.resolve(n);if(o.parent.isTextblock&&r.parent.isTextblock&&o.start()!=r.start()&&0==o.parentOffset&&0==r.parentOffset){let i=o.sharedDepth(n),s=!1;for(let e=o.depth;e>i;e--)o.node(e).type.spec.isolating&&(s=!0);for(let e=r.depth;e>i;e--)r.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=o.depth;e>0&&t==o.start(e);e--)t=o.before(e);for(let e=r.depth;e>0&&n==r.start(e);e--)n=r.before(e);o=e.doc.resolve(t),r=e.doc.resolve(n)}}let i=Io(o,r);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||o.node(n).type.contentMatch.validEnd)return e.delete(o.start(n),r.end(n));if(n>0&&(s||o.node(n-1).canReplace(o.index(n-1),r.indexAfter(n-1))))return e.delete(o.before(n),r.after(n))}for(let i=1;i<=o.depth&&i<=r.depth;i++)if(t-o.start(i)==o.depth-i&&n>o.end(i)&&r.end(i)-n!=r.depth-i&&o.start(i-1)==r.start(i-1)&&o.node(i-1).canReplace(o.index(i-1),r.index(i-1)))return e.delete(o.before(i),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:o,$to:r,depth:i}=t,s=o.before(i+1),a=r.after(i+1),l=s,c=a,d=Ht.empty,u=0;for(let e=i,t=!1;e>n;e--)t||o.index(e)>0?(t=!0,d=Ht.from(o.node(e).copy(d)),u++):l--;let p=Ht.empty,h=0;for(let e=i,t=!1;e>n;e--)t||r.after(e+1)<r.end(e)?(t=!0,p=Ht.from(r.node(e).copy(p)),h++):c++;e.step(new uo(l,c,s,a,new Kt(d.append(p),u,h),d.size-u,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let o=null,{linebreakReplacement:r}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(r&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(r);e&&!t?o=!1:!e&&t&&(o=!0)}let a=e.steps.length;if(!1===o){let o=e.doc.resolve(t+n);wo(e,o.node(),o.before(),a)}s.inlineContent&&ho(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==o);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new co(c,l.map(t+n,-1),Kt.empty,!0)),!0===o){let t=e.doc.resolve(c);yo(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let o=Ht.empty;for(let e=n.length-1;e>=0;e--){if(o.size){let t=n[e].type.contentMatch.matchFragment(o);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=Ht.from(n[e].type.create(n[e].attrs,o))}let r=t.start,i=t.end;e.step(new uo(r,i,r,i,new Kt(o,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,o=null){return function(e,t,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let s="function"==typeof r?r(t):r;if(t.isTextblock&&!t.hasMarkup(o,s)&&function(e,t,n){let o=e.resolve(t),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}(e.doc,e.mapping.slice(i).map(n),o)){let r=null;if(o.schema.linebreakReplacement){let e="pre"==o.whitespace,t=!!o.contentMatch.matchType(o.schema.linebreakReplacement);e&&!t?r=!1:!e&&t&&(r=!0)}!1===r&&wo(e,t,n,i),ho(e,e.mapping.slice(i).map(n,1),o,void 0,null===r);let a=e.mapping.slice(i),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new uo(l,c,l+1,c-1,new Kt(Ht.from(o.create(s,null,t.marks)),0,0),1,!0)),!0===r&&yo(e,t,n,i),!1}})}(this,e,t,n,o),this}setNodeMarkup(e,t,n=null,o){return function(e,t,n,o,r){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(o,null,r||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new uo(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new Kt(Ht.from(s),0,0),1,!0))}(this,e,t,n,o),this}setNodeAttribute(e,t,n){return this.step(new Ao(e,t,n)),this}setDocAttribute(e,t){return this.step(new Ro(e,t)),this}addNodeMark(e,t){return this.step(new ao(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Wt)t.isInSet(n.marks)&&this.step(new lo(e,t));else{let o,r=n.marks,i=[];for(;o=t.isInSet(r);)i.push(new lo(e,o)),r=o.removeFromSet(r);for(let e=i.length-1;e>=0;e--)this.step(i[e])}return this}split(e,t=1,n){return function(e,t,n=1,o){let r=e.doc.resolve(t),i=Ht.empty,s=Ht.empty;for(let e=r.depth,t=r.depth-n,a=n-1;e>t;e--,a--){i=Ht.from(r.node(e).copy(i));let t=o&&o[a];s=Ht.from(t?t.type.create(t.attrs,s):r.node(e).copy(s))}e.step(new co(t,t,new Kt(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,o){let r,i,s=[],a=[];e.doc.nodesBetween(t,n,(e,l,c)=>{if(!e.isInline)return;let d=e.marks;if(!o.isInSet(d)&&c.type.allowsMarkType(o.type)){let c=Math.max(l,t),u=Math.min(l+e.nodeSize,n),p=o.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(p)||(r&&r.to==c&&r.mark.eq(d[e])?r.to=u:s.push(r=new so(c,u,d[e])));i&&i.to==c?i.to=u:a.push(i=new io(c,u,o))}}),s.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,o){let r=[],i=0;e.doc.nodesBetween(t,n,(e,s)=>{if(!e.isInline)return;i++;let a=null;if(o instanceof Tn){let t,n=e.marks;for(;t=o.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else o?o.isInSet(e.marks)&&(a=[o]):a=e.marks;if(a&&a.length){let o=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<r.length;e++){let t=r[e];t.step==i-1&&l.eq(r[e].style)&&(n=t)}n?(n.to=o,n.step=i):r.push({style:l,from:Math.max(s,t),to:o,step:i})}}}),r.forEach(t=>e.step(new so(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return ho(this,e,t,n),this}}const Vo=Object.create(null);class jo{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new $o(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Kt.empty){let n=t.content.lastChild,o=null;for(let e=0;e<t.openEnd;e++)o=n,n=n.lastChild;let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(r);e.replaceRange(c.map(a.pos),c.map(l.pos),s?Kt.empty:t),0==s&&Jo(e,r,(n?n.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,o=this.ranges;for(let r=0;r<o.length;r++){let{$from:i,$to:s}=o[r],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);r?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),Jo(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let o=e.parent.inlineContent?new Fo(e):Go(e.node(0),e.parent,e.pos,e.index(),t,n);if(o)return o;for(let o=e.depth-1;o>=0;o--){let r=t<0?Go(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):Go(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(r)return r}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Uo(e.node(0))}static atStart(e){return Go(e,e,0,0,1)||new Uo(e)}static atEnd(e){return Go(e,e,e.content.size,e.childCount,-1)||new Uo(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Vo[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Vo)throw new RangeError("Duplicate use of selection JSON ID "+e);return Vo[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Fo.between(this.$anchor,this.$head).getBookmark()}}jo.prototype.visible=!0;class $o{constructor(e,t){this.$from=e,this.$to=t}}let Bo=!1;function Ho(e){Bo||e.parent.inlineContent||(Bo=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Fo extends jo{constructor(e,t=e){Ho(e),Ho(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return jo.near(n);let o=e.resolve(t.map(this.anchor));return new Fo(o.parent.inlineContent?o:n,n)}replace(e,t=Kt.empty){if(super.replace(e,t),t==Kt.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Fo&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new zo(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Fo(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let o=e.resolve(t);return new this(o,n==t?o:e.resolve(n))}static between(e,t,n){let o=e.pos-t.pos;if(n&&!o||(n=o>=0?1:-1),!t.parent.inlineContent){let e=jo.findFrom(t,n,!0)||jo.findFrom(t,-n,!0);if(!e)return jo.near(t,n);t=e.$head}return e.parent.inlineContent||(0==o||(e=(jo.findFrom(e,-n,!0)||jo.findFrom(e,n,!0)).$anchor).pos<t.pos!=o<0)&&(e=t),new Fo(e,t)}}jo.jsonID("text",Fo);class zo{constructor(e,t){this.anchor=e,this.head=t}map(e){return new zo(e.map(this.anchor),e.map(this.head))}resolve(e){return Fo.between(e.resolve(this.anchor),e.resolve(this.head))}}class qo extends jo{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:o}=t.mapResult(this.anchor),r=e.resolve(o);return n?jo.near(r):new qo(r)}content(){return new Kt(Ht.from(this.node),0,0)}eq(e){return e instanceof qo&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Wo(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new qo(e.resolve(t.anchor))}static create(e,t){return new qo(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}qo.prototype.visible=!1,jo.jsonID("node",qo);class Wo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new zo(n,n):new Wo(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&qo.isSelectable(n)?new qo(t):jo.near(t)}}class Uo extends jo{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Kt.empty){if(t==Kt.empty){e.delete(0,e.doc.content.size);let t=jo.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Uo(e)}map(e){return new Uo(e)}eq(e){return e instanceof Uo}getBookmark(){return Ko}}jo.jsonID("all",Uo);const Ko={map(){return this},resolve:e=>new Uo(e)};function Go(e,t,n,o,r,i=!1){if(t.inlineContent)return Fo.create(e,n);for(let s=o-(r>0?0:1);r>0?s<t.childCount:s>=0;s+=r){let o=t.child(s);if(o.isAtom){if(!i&&qo.isSelectable(o))return qo.create(e,n-(r<0?o.nodeSize:0))}else{let t=Go(e,o,n+r,r<0?o.childCount:0,r,i);if(t)return t}n+=o.nodeSize*r}return null}function Jo(e,t,n){let o=e.steps.length-1;if(o<t)return;let r,i=e.steps[o];(i instanceof co||i instanceof uo)&&(e.mapping.maps[o].forEach((e,t,n,o)=>{null==r&&(r=o)}),e.setSelection(jo.near(e.doc.resolve(r),n)))}class Zo extends Lo{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Wt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Wt.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let o=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let r=this.storedMarks;if(!r){let e=this.doc.resolve(t);r=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,o.text(e,r)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(jo.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function Xo(e,t){return t&&e?e.bind(t):e}class Yo{constructor(e,t,n){this.name=e,this.init=Xo(t.init,n),this.apply=Xo(t.apply,n)}}const Qo=[new Yo("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new Yo("selection",{init:(e,t)=>e.selection||jo.atStart(t.doc),apply:e=>e.selection}),new Yo("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,o)=>o.selection.$cursor?e.storedMarks:null}),new Yo("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class er{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Qo.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Yo(e.key,e.spec.state,e))})}}class tr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),o=null;for(;;){let r=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=o?o[i].n:0,l=o?o[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!o){o=[];for(let e=0;e<this.config.plugins.length;e++)o.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),r=!0}o&&(o[i]={state:n,n:t.length})}}if(!r)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new tr(this.config),n=this.config.fields;for(let o=0;o<n.length;o++){let r=n[o];t[r.name]=r.apply(e,this[r.name],this,t)}return t}get tr(){return new Zo(this)}static create(e){let t=new er(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new tr(t);for(let o=0;o<t.fields.length;o++)n[t.fields[o].name]=t.fields[o].init(e,n);return n}reconfigure(e){let t=new er(this.schema,e.plugins),n=t.fields,o=new tr(t);for(let t=0;t<n.length;t++){let r=n[t].name;o[r]=this.hasOwnProperty(r)?this[r]:n[t].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[n],r=o.spec.state;r&&r.toJSON&&(t[n]=r.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new er(e.schema,e.plugins),r=new tr(o);return o.fields.forEach(o=>{if("doc"==o.name)r.doc=pn.fromJSON(e.schema,t.doc);else if("selection"==o.name)r.selection=jo.fromJSON(r.doc,t.selection);else if("storedMarks"==o.name)t.storedMarks&&(r.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],a=s.spec.state;if(s.key==o.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(r[o.name]=a.fromJSON.call(s,e,t[i],r))}r[o.name]=o.init(e,r)}}),r}}function nr(e,t,n){for(let o in e){let r=e[o];r instanceof Function?r=r.bind(t):"handleDOMEvents"==o&&(r=nr(r,t,{})),n[o]=r}return n}class or{constructor(e){this.spec=e,this.props={},e.props&&nr(e.props,this,this.props),this.key=e.key?e.key.key:ir("plugin")}getState(e){return e[this.key]}}const rr=Object.create(null);function ir(e){return e in rr?e+"$"+ ++rr[e]:(rr[e]=0,e+"$")}class sr{constructor(e="key"){this.key=ir(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ar=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function lr(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const cr=(e,t,n)=>{let o=lr(e,n);if(!o)return!1;let r=hr(o);if(!r){let n=o.blockRange(),r=n&&mo(n);return null!=r&&(t&&t(e.tr.lift(n,r).scrollIntoView()),!0)}let i=r.nodeBefore;if(yr(e,r,t,-1))return!0;if(0==o.parent.content.size&&(ur(i,"end")||qo.isSelectable(i)))for(let n=o.depth;;n--){let s=Co(e.doc,o.before(n),o.after(n),Kt.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(ur(i,"end")?jo.findFrom(n.doc.resolve(n.mapping.map(r.pos,-1)),-1):qo.create(n.doc,r.pos-i.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||o.node(n-1).childCount>1)break}return!(!i.isAtom||r.depth!=o.depth-1)&&(t&&t(e.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0)},dr=(e,t,n)=>{let o=lr(e,n);if(!o)return!1;let r=hr(o);return!!r&&function(e,t,n){let o=t.nodeBefore,r=o,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 s=t.nodeAfter,a=s,l=t.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let c=Co(e.doc,i,l,Kt.empty);if(!c||c.from!=i||c instanceof co&&c.slice.size>=l-i)return!1;if(n){let t=e.tr.step(c);t.setSelection(Fo.create(t.doc,i)),n(t.scrollIntoView())}return!0}(e,r,t)};function ur(e,t,n=!1){for(let o=e;o;o="start"==t?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&1!=o.childCount)return!1}return!1}const pr=(e,t,n)=>{let{$head:o,empty:r}=e.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):o.parentOffset>0)return!1;i=hr(o)}let s=i&&i.nodeBefore;return!(!s||!qo.isSelectable(s))&&(t&&t(e.tr.setSelection(qo.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function hr(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 fr(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}function mr(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const gr=(e,t)=>{let{$head:n,$anchor:o}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),i=n.indexAfter(-1),s=mr(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(t){let o=n.after(),r=e.tr.replaceWith(o,o,s.createAndFill());r.setSelection(jo.near(r.doc.resolve(o),1)),t(r.scrollIntoView())}return!0};const vr=(e,t)=>{let{$from:n,$to:o}=e.selection;if(e.selection instanceof qo&&e.selection.node.isBlock)return!(!n.parentOffset||!bo(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let r,i,s=[],a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),i=mr(n.node(e-1).contentMatchAt(n.indexAfter(e-1))),s.unshift(a&&i?{type:i}:null),r=e;break}if(1==e)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof Fo||e.selection instanceof Uo)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=bo(c.doc,d,s.length,s);if(u||(s[0]=i?{type:i}:null,u=bo(c.doc,d,s.length,s)),!u)return!1;if(c.split(d,s.length,s),!a&&l&&n.node(r).type!=i){let e=c.mapping.map(n.before(r)),t=c.doc.resolve(e);i&&n.node(r-1).canReplaceWith(t.index(),t.index()+1,i)&&c.setNodeMarkup(c.mapping.map(n.before(r)),i)}return t&&t(c.scrollIntoView()),!0};function yr(e,t,n,o){let r,i,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(e,t,n){let o=t.nodeBefore,r=t.nodeAfter,i=t.index();return!(!(o&&r&&o.type.compatibleContent(r.type))||(!o.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!r.isTextblock&&!ko(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(r=(i=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&i.matchType(r[0]||a.type).validEnd){if(n){let o=t.pos+a.nodeSize,i=Ht.empty;for(let e=r.length-1;e>=0;e--)i=Ht.from(r[e].create(null,i));i=Ht.from(s.copy(i));let l=e.tr.step(new uo(t.pos-1,o,t.pos,o,new Kt(i,1,0),r.length,!0)),c=l.doc.resolve(o+2*r.length);c.nodeAfter&&c.nodeAfter.type==s.type&&ko(l.doc,c.pos)&&l.join(c.pos),n(l.scrollIntoView())}return!0}let d=a.type.spec.isolating||o>0&&l?null:jo.findFrom(t,1),u=d&&d.$from.blockRange(d.$to),p=u&&mo(u);if(null!=p&&p>=t.depth)return n&&n(e.tr.lift(u,p).scrollIntoView()),!0;if(c&&ur(a,"start",!0)&&ur(s,"end")){let o=s,r=[];for(;r.push(o),!o.isTextblock;)o=o.lastChild;let i=a,l=1;for(;!i.isTextblock;i=i.firstChild)l++;if(o.canReplace(o.childCount,o.childCount,i.content)){if(n){let o=Ht.empty;for(let e=r.length-1;e>=0;e--)o=Ht.from(r[e].copy(o));n(e.tr.step(new uo(t.pos-r.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new Kt(o,r.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function wr(e){return function(t,n){let o=t.selection,r=e<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return!!r.node(i).isTextblock&&(n&&n(t.tr.setSelection(Fo.create(t.doc,e<0?r.start(i):r.end(i)))),!0)}}const br=wr(-1),kr=wr(1);function Cr(e,t=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),a=s&&go(s,e,t);return!!a&&(o&&o(n.tr.wrap(s,a).scrollIntoView()),!0)}}function xr(e,t=null){return function(n,o){let r=!1;for(let o=0;o<n.selection.ranges.length&&!r;o++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[o];n.doc.nodesBetween(i,s,(o,i)=>{if(r)return!1;if(o.isTextblock&&!o.hasMarkup(e,t))if(o.type==e)r=!0;else{let t=n.doc.resolve(i),o=t.index();r=t.parent.canReplaceWith(o,o+1,e)}})}if(!r)return!1;if(o){let r=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[o];r.setBlockType(i,s,e,t)}o(r.scrollIntoView())}return!0}}function Nr(e,t=null,n){return function(n,o){let{empty:r,$cursor:i,ranges:s}=n.selection;if(r&&!i||!function(e,t,n){for(let o=0;o<t.length;o++){let{$from:r,$to:i}=t[o],s=0==r.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(r.pos,i.pos,(e,t)=>{if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)}),s)return!0}return!1}(n.doc,s,e))return!1;if(o)if(i)e.isInSet(n.storedMarks||i.marks())?o(n.tr.removeStoredMark(e)):o(n.tr.addStoredMark(e.create(t)));else{let r,i=n.tr;r=!s.some(t=>n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e));for(let n=0;n<s.length;n++){let{$from:o,$to:a}=s[n];if(r){let n=o.pos,r=a.pos,s=o.nodeAfter,l=a.nodeBefore,c=s&&s.isText?/^\s*/.exec(s.text)[0].length:0,d=l&&l.isText?/\s*$/.exec(l.text)[0].length:0;n+c<r&&(n+=c,r-=d),i.addMark(n,r,e.create(t))}else i.removeMark(o.pos,a.pos,e)}o(i.scrollIntoView())}return!0}}function Sr(...e){return function(t,n,o){for(let r=0;r<e.length;r++)if(e[r](t,n,o))return!0;return!1}}let Or=Sr(ar,cr,pr),Er=Sr(ar,(e,t,n)=>{let o=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}(e,n);if(!o)return!1;let r=fr(o);if(!r)return!1;let i=r.nodeAfter;if(yr(e,r,t,1))return!0;if(0==o.parent.content.size&&(ur(i,"start")||qo.isSelectable(i))){let n=Co(e.doc,o.before(),o.after(),Kt.empty);if(n&&n.slice.size<n.to-n.from){if(t){let o=e.tr.step(n);o.setSelection(ur(i,"start")?jo.findFrom(o.doc.resolve(o.mapping.map(r.pos)),1):qo.create(o.doc,o.mapping.map(r.pos))),t(o.scrollIntoView())}return!0}}return!(!i.isAtom||r.depth!=o.depth-1)&&(t&&t(e.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0)},(e,t,n)=>{let{$head:o,empty:r}=e.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):o.parentOffset<o.parent.content.size)return!1;i=fr(o)}let s=i&&i.nodeAfter;return!(!s||!qo.isSelectable(s))&&(t&&t(e.tr.setSelection(qo.create(e.doc,i.pos)).scrollIntoView()),!0)});const Mr={Enter:Sr((e,t)=>{let{$head:n,$anchor:o}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(o))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)},(e,t)=>{let n=e.selection,{$from:o,$to:r}=n;if(n instanceof Uo||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=mr(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(Fo.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},(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 o=n.before();if(bo(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let o=n.blockRange(),r=o&&mo(o);return null!=r&&(t&&t(e.tr.lift(o,r).scrollIntoView()),!0)},vr),"Mod-Enter":gr,Backspace:Or,"Mod-Backspace":Or,"Shift-Backspace":Or,Delete:Er,"Mod-Delete":Er,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new Uo(e.doc))),!0)},_r={"Ctrl-h":Mr.Backspace,"Alt-Backspace":Mr["Mod-Backspace"],"Ctrl-d":Mr.Delete,"Ctrl-Alt-Backspace":Mr["Mod-Delete"],"Alt-Delete":Mr["Mod-Delete"],"Alt-d":Mr["Mod-Delete"],"Ctrl-a":br,"Ctrl-e":kr};for(let e in Mr)_r[e]=Mr[e];const Tr=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&"darwin"==os.platform())?_r:Mr;class Dr{constructor(e,t,n={}){var o;this.match=e,this.match=e,this.handler="string"==typeof t?(o=t,function(e,t,n,r){let i=o;if(t[1]){let e=t[0].lastIndexOf(t[1]);i+=t[0].slice(e+t[1].length);let o=(n+=e)-r;o>0&&(i=t[0].slice(e-o,e)+i,n=r)}return e.tr.insertText(i,n,r)}):t,this.undoable=!1!==n.undoable,this.inCode=n.inCode||!1,this.inCodeMark=!1!==n.inCodeMark}}const Ir=(e,t)=>{let n=e.plugins;for(let o=0;o<n.length;o++){let r,i=n[o];if(i.spec.isInputRules&&(r=i.getState(e))){if(t){let n=e.tr,o=r.transform;for(let e=o.steps.length-1;e>=0;e--)n.step(o.steps[e].invert(o.docs[e]));if(r.text){let t=n.doc.resolve(r.from).marks();n.replaceWith(r.from,r.to,e.schema.text(r.text,t))}else n.delete(r.from,r.to);t(n)}return!0}}return!1};function Ar(e,t,n=null,o){return new Dr(e,(e,r,i,s)=>{let a=n instanceof Function?n(r):n,l=e.tr.delete(i,s),c=l.doc.resolve(i).blockRange(),d=c&&go(c,t,a);if(!d)return null;l.wrap(c,d);let u=l.doc.resolve(i-1).nodeBefore;return u&&u.type==t&&ko(l.doc,i-1)&&(!o||o(r,u))&&l.join(i-1),l})}function Rr(e,t,n=null){return new Dr(e,(e,o,r,i)=>{let s=e.doc.resolve(r),a=n instanceof Function?n(o):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t)?e.tr.delete(r,i).setBlockType(r,r,t,a):null})}new Dr(/--$/,"—",{inCodeMark:!1}),new Dr(/\.\.\.$/,"…",{inCodeMark:!1}),new Dr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1}),new Dr(/"$/,"”",{inCodeMark:!1}),new Dr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1}),new Dr(/'$/,"’",{inCodeMark:!1});const Pr="undefined"!=typeof navigator?navigator:null,Lr="undefined"!=typeof document?document:null,Vr=Pr&&Pr.userAgent||"",jr=/Edge\/(\d+)/.exec(Vr),$r=/MSIE \d/.exec(Vr),Br=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vr),Hr=!!($r||Br||jr),Fr=$r?document.documentMode:Br?+Br[1]:jr?+jr[1]:0,zr=!Hr&&/gecko\/(\d+)/i.test(Vr),qr=zr&&+(/Firefox\/(\d+)/.exec(Vr)||[0,0])[1],Wr=!Hr&&/Chrome\/(\d+)/.exec(Vr),Ur=!!Wr,Kr=Wr?+Wr[1]:0,Gr=!Hr&&!!Pr&&/Apple Computer/.test(Pr.vendor),Jr=Gr&&(/Mobile\/\w+/.test(Vr)||!!Pr&&Pr.maxTouchPoints>2),Zr=Jr||!!Pr&&/Mac/.test(Pr.platform),Xr=/Android \d/.test(Vr),Yr=!!Lr&&"webkitFontSmoothing"in Lr.documentElement.style,Qr=Yr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var ei=Object.freeze({__proto__:null,android:Xr,chrome:Ur,chrome_version:Kr,gecko:zr,gecko_version:qr,ie:Hr,ie_version:Fr,ios:Jr,mac:Zr,safari:Gr,webkit:Yr,webkit_version:Qr});function ti(e,t,n,o,r,i){if(e.composing)return!1;const s=e.state,a=s.doc.resolve(t);if(a.parent.type.spec.code)return!1;const l=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+o;for(let a of r){const r=a,c=r.match.exec(l),d=c&&c[0]&&r.handler(s,c,t-(c[0].length-o.length),n);if(d)return!1!==r.undoable&&d.setMeta(i,{transform:d,from:t,to:n,text:o}),e.dispatch(d),!0}return!1}const ni=new sr("MILKDOWN_CUSTOM_INPUTRULES");function oi({rules:e}){const t=new or({key:ni,isInputRules:!0,state:{init:()=>null,apply(e,t){const n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,o,r,i)=>ti(n,o,r,i,e,t),handleDOMEvents:{compositionend:n=>(setTimeout(()=>{const{$cursor:o}=n.state.selection;o&&ti(n,o.pos,o.pos,"",e,t)}),!1),keydown:(e,t)=>!(!Xr||!Ur||"Enter"!==t.key)&&(!e.composing&&(!!e.someProp("handleKeyDown",n=>n(e,t))&&(t.preventDefault(),!0)))},handleKeyDown(n,o){if("Enter"!==o.key)return!1;const{$cursor:r}=n.state.selection;return!!r&&ti(n,r.pos,r.pos,"\n",e,t)}}});return t}function ri(e,t,n={}){return new Dr(e,(e,o,r,i)=>{var s,a,l,c;const{tr:d}=e;let u,p=o[o.length-1],h=o[0],f=[];const m={group:p,fullMatch:h,start:r,end:i},g=null==(s=n.updateCaptured)?void 0:s.call(n,m);if(Object.assign(m,g),({group:p,fullMatch:h,start:r,end:i}=m),null===h)return null;if(""===(null==p?void 0:p.trim()))return null;if(p){const e=h.search(/\S/),s=r+h.indexOf(p),m=s+p.length;f=null!=(a=d.storedMarks)?a:[],m<i&&d.delete(m,i),s>r&&d.delete(r+e,s),u=r+e+p.length;const g=null==(l=n.getAttr)?void 0:l.call(n,o);d.addMark(r,u,t.create(g)),d.setStoredMarks(f),null==(c=n.beforeDispatch)||c.call(n,{match:o,start:r,end:i,tr:d})}return d})}var ii=Object.defineProperty,si=Object.defineProperties,ai=Object.getOwnPropertyDescriptors,li=Object.getOwnPropertySymbols,ci=Object.prototype.hasOwnProperty,di=Object.prototype.propertyIsEnumerable,ui=(e,t,n)=>t in e?ii(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function pi(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function hi(e,t,n){const o=e.state.doc.content.size,r=pi(t,0,o),i=pi(n,0,o),s=e.coordsAtPos(r),a=e.coordsAtPos(i,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),d=Math.min(s.left,a.left),u=Math.max(s.right,a.right),p={top:l,bottom:c,left:d,right:u,width:u-d,height:c-l,x:d,y:l};return h=((e,t)=>{for(var n in t||(t={}))ci.call(t,n)&&ui(e,n,t[n]);if(li)for(var n of li(t))di.call(t,n)&&ui(e,n,t[n]);return e})({},p),si(h,ai({toJSON:()=>p}));var h}function fi(e){return Object.assign(Object.create(e),e).setTime(Date.now())}function mi(e){if(1===e.content.childCount){const t=e.content.firstChild;if("text"===(null==t?void 0:t.type.name)&&0===t.marks.length)return t;if("paragraph"===(null==t?void 0:t.type.name)&&1===t.childCount){const e=t.firstChild;if("text"===(null==e?void 0:e.type.name)&&0===e.marks.length)return e}}return!1}function gi(e){return t=>{for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o)){return{from:t.before(n),to:t.after(n),node:o}}}}}function vi(e,t){const n=t.nodes[e];if(!n)throw function(e,t){return new wt(yt.getAtomFromSchemaFail,`Cannot get ${e}: ${t} from schema.`)}("node",e);return n}function yi(e){return t=>{for(let n=t.depth;n>0;n--){const o=t.node(n);if(e(o))return{pos:t.before(n),start:t.start(n),depth:n,node:o}}}}function wi(e,t){if(!(e instanceof qo))return;const{node:n,$from:o}=e;return function(e,t){return Array.isArray(e)&&e.includes(t.type)||t.type===e}(t,n)?{node:n,pos:o.pos,start:o.start(o.depth),depth:o.depth}:void 0}const bi=(e,t)=>{const{selection:n,doc:o}=e;if(n instanceof qo)return{hasNode:n.node.type===t,pos:n.from,target:n.node};const{from:r,to:i}=n;let s=!1,a=-1,l=null;return o.nodesBetween(r,i,(e,n)=>!l&&(e.type!==t||(s=!0,a=n,l=e,!1))),{hasNode:s,pos:a,target:l}},ki="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Ci="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function xi(e){let t,n,o,r,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))r=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))o=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);ki?r=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),r&&(s="Meta-"+s),o&&(s="Shift-"+s),s}function Ni(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function Si(e){return new or({props:{handleKeyDown:Oi(e)}})}function Oi(e){let t=function(e){let t=Object.create(null);for(let n in e)t[xi(n)]=e[n];return t}(e);return function(e,n){let o,r=c(n),i=t[Ni(r,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==r.length&&" "!=r){if(n.shiftKey){let o=t[Ni(r,n,!1)];if(o&&o(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Ci&&n.ctrlKey&&n.altKey)&&(o=d[n.keyCode])&&o!=r){let r=t[Ni(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var Ei=class{},Mi=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{const e=this.elements.pop();if(!e)throw xt();return e}}},_i=class e extends Ei{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(t,n,o){return new e(t,n,o)}},Ti=class extends Mi{#w=Wt.none;static{this.create=(e,t)=>{const n=new this(e);return e=>(n.run(t,e),n.toDoc())}}constructor(e){super(),this.injectRoot=(e,t,n)=>(this.openNode(t,n),this.next(e.children),this),this.openNode=(e,t)=>(this.open(_i.create(e,[],t)),this),this.closeNode=()=>{try{this.#b()}catch(e){console.error(e)}return this},this.addNode=(e,t,n)=>{try{this.#k(e,t,n)}catch(e){console.error(e)}return this},this.openMark=(e,t)=>(this.#w=e.create(t).addToSet(this.#w),this),this.closeMark=e=>(this.#w=e.removeFromSet(this.#w),this),this.addText=e=>{try{const t=this.top();if(!t)throw xt();const n=t.pop(),o=this.schema.text(e,this.#w);if(!n)return t.push(o),this;const r=this.#C(n,o);return r?(t.push(r),this):(t.push(n,o),this)}catch(e){return console.error(e),this}},this.build=()=>{let e;do{e=this.#b()}while(this.size());return e},this.next=(e=[])=>([e].flat().forEach(e=>this.#x(e)),this),this.toDoc=()=>this.build(),this.run=(e,t)=>{const n=e.runSync(e.parse(t),t);return this.next(n),this},this.schema=e}#N=e=>e.isText;#C=(e,t)=>{if(this.#N(e)&&this.#N(t)&&Wt.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)};#S=e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.parseMarkdown.match(e));if(!t)throw function(e){return new wt(yt.parserMatchError,`Cannot match target parser for node: ${kt(e)}.`)}(e);return t};#x=e=>{const t=this.#S(e);t.spec.parseMarkdown.runner(this,e,t)};#b=()=>{this.#w=Wt.none;const e=this.close();return this.#k(e.type,e.attrs,e.content)};#k=(e,t,n)=>{const o=e.createAndFill(t,n,this.#w);if(!o)throw function(e,t,n){const o=`Cannot create node for ${"name"in e?e.name:e}`,r=e=>{if(null==e)return"null";if(Array.isArray(e))return`[${e.map(r).join(", ")}]`;if("object"==typeof e)return"toJSON"in e&&"function"==typeof e.toJSON?JSON.stringify(e.toJSON()):"spec"in e?JSON.stringify(e.spec):JSON.stringify(e);if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("function"==typeof e)return`[Function: ${e.name||"anonymous"}]`;try{return String(e)}catch{return"[Unserializable]"}},i=[["[Description]",o],["[Attributes]",t],["[Content]",(n??[]).map(e=>e?"object"==typeof e&&"type"in e?`${e}`:r(e):"null")]].reduce((e,[t,n])=>{const o=`${t}: ${r(n)}.`;return e.concat(o)},[]);return new wt(yt.createNodeInParserFail,i.join("\n"))}(e,t,n);return this.push(o),o}},Di=class e extends Ei{constructor(e,t,n,o={}){super(),this.type=e,this.children=t,this.value=n,this.props=o,this.push=(e,...t)=>{this.children||(this.children=[]),this.children.push(e,...t)},this.pop=()=>this.children?.pop()}static{this.create=(t,n,o,r={})=>new e(t,n,o,r)}},Ii=class extends Mi{#w=Wt.none;static{this.create=(e,t)=>{const n=new this(e);return e=>(n.run(e),n.toString(t))}}constructor(e){super(),this.openNode=(e,t,n)=>(this.open(Di.create(e,void 0,t,n)),this),this.closeNode=()=>(this.#b(),this),this.addNode=(e,t,n,o)=>(this.#k(e,t,n,o),this),this.withMark=(e,t,n,o)=>(this.#O(e,t,n,o),this),this.closeMark=e=>(this.#E(e),this),this.build=()=>{let e=null;do{e=this.#b()}while(this.size());return e},this.next=e=>{return t=e,Object.prototype.hasOwnProperty.call(t,"size")?(e.forEach(e=>{this.#x(e)}),this):(this.#x(e),this);var t},this.toString=e=>e.stringify(this.build()),this.run=e=>(this.next(e),this),this.schema=e}#S=e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.toMarkdown.match(e));if(!t)throw function(e){return new wt(yt.serializerMatchError,`Cannot match target serializer for node: ${kt(e)}.`)}(e.type);return t};#M=e=>this.#S(e).spec.toMarkdown.runner(this,e);#_=(e,t)=>this.#S(e).spec.toMarkdown.runner(this,e,t);#x=e=>{const{marks:t}=e,n=e=>e.type.spec.priority??50;[...t].sort((e,t)=>n(e)-n(t)).every(t=>!this.#_(t,e))&&this.#M(e),t.forEach(e=>this.#E(e))};#T=(e,t)=>{if(e.type===t)return e;if(1!==e.children?.length)return e;const n=e=>{if(e.type===t)return null!=e.value?null:e;if(1!==e.children?.length)return null;const[o]=e.children;return o?n(o):null},o=n(e);if(!o)return e;const r=o.children?[...o.children]:void 0,i={...e,children:r};return i.children=r,o.children=[i],o};#D=e=>{const{children:t}=e;return t?(e.children=t.reduce((e,t,n)=>{if(0===n)return[t];const o=e.at(-1);if(o&&o.isMark&&t.isMark){t=this.#T(t,o.type);const{children:n,...r}=t,{children:i,...s}=o;if(t.type===o.type&&n&&i&&JSON.stringify(r)===JSON.stringify(s)){const t={...s,children:[...i,...n]};return e.slice(0,-1).concat(this.#D(t))}}return e.concat(t)},[]),e):e};#I=e=>{const t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t};#A=(e,t)=>{let n="",o="";const r=e.children;let i=-1,s=-1;if(r){(a=r)&&a.forEach((e,t)=>{"text"===e.type&&e.value&&(i<0&&(i=t),s=t)});const e=r?.[s],t=r?.[i];if(e&&e.value.endsWith(" ")){const t=e.value,n=t.trimEnd();o=t.slice(n.length),e.value=n}if(t&&t.value.startsWith(" ")){const e=t.value,o=e.trimStart();n=e.slice(0,e.length-o.length),t.value=o}}var a;n.length&&this.#k("text",void 0,n);const l=t();return o.length&&this.#k("text",void 0,o),l};#b=(e=!1)=>{const t=this.close(),n=()=>this.#k(t.type,t.children,t.value,t.props);return e?this.#A(t,n):n()};#k=(e,t,n,o)=>{const r=Di.create(e,t,n,o),i=this.#D(this.#I(r));return this.push(i),i};#O=(e,t,n,o)=>e.isInSet(this.#w)?this:(this.#w=e.addToSet(this.#w),this.openNode(t,n,{...o,isMark:!0}));#E=e=>{e.isInSet(this.#w)&&(this.#w=e.type.removeFromSet(this.#w),this.#b(!0))}};const Ai=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Ri=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Pi=null;const Li=function(e,t,n){let o=Pi||(Pi=document.createRange());return o.setEnd(e,null==n?e.nodeValue.length:n),o.setStart(e,t||0),o},Vi=function(e,t,n,o){return n&&($i(e,t,n,o,-1)||$i(e,t,n,o,1))},ji=/^(img|br|input|textarea|hr)$/i;function $i(e,t,n,o,r){for(var i;;){if(e==n&&t==o)return!0;if(t==(r<0?0:Bi(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Hi(e)||ji.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Ai(e)+(r<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(r<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=r}else e=n,t=r<0?Bi(e):0}}}}function Bi(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Hi(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)}const Fi=function(e){return e.focusNode&&Vi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function zi(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const qi="undefined"!=typeof navigator?navigator:null,Wi="undefined"!=typeof document?document:null,Ui=qi&&qi.userAgent||"",Ki=/Edge\/(\d+)/.exec(Ui),Gi=/MSIE \d/.exec(Ui),Ji=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ui),Zi=!!(Gi||Ji||Ki),Xi=Gi?document.documentMode:Ji?+Ji[1]:Ki?+Ki[1]:0,Yi=!Zi&&/gecko\/(\d+)/i.test(Ui);Yi&&(/Firefox\/(\d+)/.exec(Ui)||[0,0])[1];const Qi=!Zi&&/Chrome\/(\d+)/.exec(Ui),es=!!Qi,ts=Qi?+Qi[1]:0,ns=!Zi&&!!qi&&/Apple Computer/.test(qi.vendor),rs=ns&&(/Mobile\/\w+/.test(Ui)||!!qi&&qi.maxTouchPoints>2),is=rs||!!qi&&/Mac/.test(qi.platform),ss=!!qi&&/Win/.test(qi.platform),as=/Android \d/.test(Ui),ls=!!Wi&&"webkitFontSmoothing"in Wi.documentElement.style,cs=ls?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ds(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 us(e,t){return"number"==typeof e?e:e[t]}function ps(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,o=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*o}}function hs(e,t,n){let o=e.someProp("scrollThreshold")||0,r=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=Ri(s);continue}let e=s,n=e==i.body,a=n?ds(i):ps(e),l=0,c=0;if(t.top<a.top+us(o,"top")?c=-(a.top-t.top+us(r,"top")):t.bottom>a.bottom-us(o,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+us(r,"top")-a.top:t.bottom-a.bottom+us(r,"bottom")),t.left<a.left+us(o,"left")?l=-(a.left-t.left+us(r,"left")):t.right>a.right-us(o,"right")&&(l=t.right-a.right+us(r,"right")),l||c)if(n)i.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,o=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let r=e.scrollLeft-n,i=e.scrollTop-o;t={left:t.left-r,top:t.top-i,right:t.right-r,bottom:t.bottom-i}}let d=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s="absolute"==d?s.offsetParent:Ri(s)}}function fs(e){let t=[],n=e.ownerDocument;for(let o=e;o&&(t.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),e!=n);o=Ri(o));return t}function ms(e,t){for(let n=0;n<e.length;n++){let{dom:o,top:r,left:i}=e[n];o.scrollTop!=r+t&&(o.scrollTop=r+t),o.scrollLeft!=i&&(o.scrollLeft=i)}}let gs=null;function vs(e,t){let n,o,r,i,s=2e8,a=0,l=t.top,c=t.top;for(let d=e.firstChild,u=0;d;d=d.nextSibling,u++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=Li(d).getClientRects()}for(let p=0;p<e.length;p++){let h=e[p];if(h.top<=l&&h.bottom>=c){l=Math.max(h.bottom,l),c=Math.min(h.top,c);let e=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(e<s){n=d,s=e,o=e&&3==n.nodeType?{left:h.right<t.left?h.right:h.left,top:t.top}:t,1==d.nodeType&&e&&(a=u+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!r&&h.left<=t.left&&h.right>=t.left&&(r=d,i={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(a=u+1)}}return!n&&r&&(n=r,o=i,s=0),n&&3==n.nodeType?function(e,t){let n,o=e.nodeValue.length,r=document.createRange();for(let i=0;i<o;i++){r.setEnd(e,i+1),r.setStart(e,i);let o=Cs(r,1);if(o.top!=o.bottom&&ys(t,o)){n={node:e,offset:i+(t.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),n||{node:e,offset:0}}(n,o):!n||s&&1==n.nodeType?{node:e,offset:a}:vs(n,o)}function ys(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function ws(e,t,n){let o=e.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(t.top-n.top)/(n.bottom-n.top))-2)),i=r;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let o=0;o<e.length;o++){let r=e[o];if(ys(t,r))return ws(n,t,r)}}if((i=(i+1)%o)==r)break}return e}function bs(e,t){let n,o=e.dom.ownerDocument,r=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let o=e.caretPositionFromPoint(t,n);if(o)return{node:o.offsetNode,offset:Math.min(Bi(o.offsetNode),o.offset)}}catch(e){}if(e.caretRangeFromPoint){let o=e.caretRangeFromPoint(t,n);if(o)return{node:o.startContainer,offset:Math.min(Bi(o.startContainer),o.startOffset)}}}(o,t.left,t.top);i&&({node:n,offset:r}=i);let s,a=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!ys(t,n))return null;if(a=ws(e.dom,t,n),!a)return null}if(ns)for(let e=a;n&&e;e=Ri(e))e.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(Yi&&1==n.nodeType&&(r=Math.min(r,n.childNodes.length),r<n.childNodes.length)){let e,o=n.childNodes[r];"IMG"==o.nodeName&&(e=o.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&r++}let o;ls&&r&&1==n.nodeType&&1==(o=n.childNodes[r-1]).nodeType&&"false"==o.contentEditable&&o.getBoundingClientRect().top>=t.top&&r--,n==e.dom&&r==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=r&&1==n.nodeType&&"BR"==n.childNodes[r-1].nodeName||(s=function(e,t,n,o){let r=-1;for(let n=t,i=!1;n!=e.dom;){let t,s=e.docView.nearestDesc(n,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((t=s.dom.getBoundingClientRect()).width||t.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!i&&t.left>o.left||t.top>o.top?r=s.posBefore:(!i&&t.right<o.left||t.bottom<o.top)&&(r=s.posAfter),i=!0),!s.contentDOM&&r<0&&!s.node.isText))return(s.node.isBlock?o.top<(t.top+t.bottom)/2:o.left<(t.left+t.right)/2)?s.posBefore:s.posAfter;n=s.dom.parentNode}return r>-1?r:e.docView.posFromDOM(t,n,-1)}(e,n,r,t))}null==s&&(s=function(e,t,n){let{node:o,offset:r}=vs(t,n),i=-1;if(1==o.nodeType&&!o.firstChild){let e=o.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(o,r,i)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function ks(e){return e.top<e.bottom||e.left<e.right}function Cs(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(ks(e))return e}return Array.prototype.find.call(n,ks)||e.getBoundingClientRect()}const xs=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ns(e,t,n){let{node:o,offset:r,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=ls||Yi;if(3==o.nodeType){if(!s||!xs.test(o.nodeValue)&&(n<0?r:r!=o.nodeValue.length)){let e=r,t=r,i=n<0?1:-1;return n<0&&!r?(t++,i=-1):n>=0&&r==o.nodeValue.length?(e--,i=1):n<0?e--:t++,Ss(Cs(Li(o,e,t),i),i<0)}{let e=Cs(Li(o,r,r),n);if(Yi&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let t=Cs(Li(o,r-1,r-1),-1);if(t.top==e.top){let n=Cs(Li(o,r,r+1),-1);if(n.top!=e.top)return Ss(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&r&&(n<0||r==Bi(o))){let e=o.childNodes[r-1];if(1==e.nodeType)return Os(e.getBoundingClientRect(),!1)}if(null==i&&r<Bi(o)){let e=o.childNodes[r];if(1==e.nodeType)return Os(e.getBoundingClientRect(),!0)}return Os(o.getBoundingClientRect(),n>=0)}if(null==i&&r&&(n<0||r==Bi(o))){let e=o.childNodes[r-1],t=3==e.nodeType?Li(e,Bi(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Ss(Cs(t,1),!1)}if(null==i&&r<Bi(o)){let e=o.childNodes[r];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Li(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Ss(Cs(t,-1),!0)}return Ss(Cs(3==o.nodeType?Li(o):o,-n),n>=0)}function Ss(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Os(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Es(e,t,n){let o=e.state,r=e.root.activeElement;o!=t&&e.updateState(t),r!=e.dom&&e.focus();try{return n()}finally{o!=t&&e.updateState(o),r!=e.dom&&r&&r.focus()}}const Ms=/[\u0590-\u08ac]/;let _s=null,Ts=null,Ds=!1;function Is(e,t,n){return _s==t&&Ts==n?Ds:(_s=t,Ts=n,Ds="up"==n||"down"==n?function(e,t,n){let o=t.selection,r="up"==n?o.$from:o.$to;return Es(e,t,()=>{let{node:t}=e.docView.domFromPos(r.pos,"up"==n?-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 o=Ns(e,r.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Li(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let r=t[e];if(r.bottom>r.top+1&&("up"==n?o.top-r.top>2*(r.bottom-o.top):r.bottom-o.bottom>2*(o.bottom-r.top)))return!1}}return!0})}(e,t,n):function(e,t,n){let{$head:o}=t.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,a=e.domSelection();return a?Ms.test(o.parent.textContent)&&a.modify?Es(e,t,()=>{let{focusNode:t,focusOffset:r,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=o.depth?e.docView.domAfterPos(o.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),p=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&r==u;try{a.collapse(i,s),t&&(t!=i||r!=s)&&a.extend&&a.extend(t,r)}catch(e){}return null!=l&&(a.caretBidiLevel=l),p}):"left"==n||"backward"==n?i:s:o.pos==o.start()||o.pos==o.end()}(e,t,n))}class As{constructor(e,t,n,o){this.parent=e,this.children=t,this.dom=n,this.contentDOM=o,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let o=this.children[t];if(o==e)return n;n+=o.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&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,o;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(o=n.pmViewDesc)||o.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(o)+o.size:this.posAtStart}{let n,o;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(o=n.pmViewDesc)||o.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(o):this.posAtEnd}}let o;if(e==this.dom&&this.contentDOM)o=t>Ai(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){o=!1;break}if(t.previousSibling)break}if(null==o&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){o=!0;break}if(t.nextSibling)break}}return(null==o?n>0:o)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,o=e;o;o=o.parentNode){let r,i=this.getDesc(o);if(i&&(!t||i.node)){if(!n||!(r=i.nodeDOM)||(1==r.nodeType?r.contains(1==e.nodeType?e:e.parentNode):r==e))return i;n=!1}}}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 o=e;o;o=o.parentNode){let r=this.getDesc(o);if(r)return r.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let o=this.children[t],r=n+o.size;if(n==e&&r!=n){for(;!o.border&&o.children.length;)for(let e=0;e<o.children.length;e++){let t=o.children[e];if(t.size){o=t;break}}return o}if(e<r)return o.descAt(e-n-o.border);n=r}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,o=0;for(let t=0;n<this.children.length;n++){let r=this.children[n],i=t+r.size;if(i>e||r instanceof Bs){o=e-t;break}t=i}if(o)return this.children[n].domFromPos(o-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Rs&&e.side>=0;n--);if(t<=0){let e,o=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,o=!1);return e&&t&&o&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Ai(e.dom)+1:0}}{let e,o=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,o=!1);return e&&o&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Ai(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,r=-1;for(let i=n,s=0;;s++){let n=this.children[s],a=i+n.size;if(-1==o&&e<=a){let r=i+n.border;if(e>=r&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,r);e=i;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){o=Ai(n.dom)+1;break}e-=n.size}-1==o&&(o=0)}if(o>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){r=Ai(n.dom);break}t+=n.size}-1==r&&(r=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:r}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,o=!1){let r=Math.min(e,t),i=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(r>a&&i<c)return l.setSelection(e-a-l.border,t-a-l.border,n,o);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((Yi||ns)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(d=!(!t||"\n"!=e.nodeValue[t-1]),d&&t==e.nodeValue.length)for(let t,n=e;n;n=n.parentNode){if(t=n.nextSibling){"BR"==t.nodeName&&(s=a={node:t.parentNode,offset:Ai(t)+1});break}let e=n.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(Yi&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(o=!0)}if(!(o||d&&ns)&&Vi(s.node,s.offset,c.anchorNode,c.anchorOffset)&&Vi(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==t)&&(!d||!Yi)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,o=0;o<this.children.length;o++){let r=this.children[o],i=n+r.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let o=n+r.border,s=i-r.border;if(e>=o&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=o||t!=s||!r.contentLost&&r.dom.parentNode==this.contentDOM?r.markDirty(e-o,t-o):r.dirty=3);r.dirty=r.dom!=r.contentDOM||r.dom.parentNode!=this.contentDOM||r.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Rs extends As{constructor(e,t,n,o){let r,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,()=>r?r.parent?r.parent.posBeforeChild(r):void 0:o)),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,r=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Ps extends As{constructor(e,t,n,o){super(e,[],t,null),this.textDOM=n,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Ls extends As{constructor(e,t,n,o,r){super(e,[],n,o),this.mark=t,this.spec=r}static create(e,t,n,o){let r=o.nodeViews[t.type.name],i=r&&r(t,o,n);return i&&i.dom||(i=zn.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Ls(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let o=Ls.create(this.parent,this.mark,!0,n),r=this.children,i=this.size;t<i&&(r=Qs(r,t,i,n)),e>0&&(r=Qs(r,0,e,n));for(let e=0;e<r.length;e++)r[e].parent=o;return o.children=r,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Vs extends As{constructor(e,t,n,o,r,i,s,a,l){super(e,[],r,i),this.node=t,this.outerDeco=n,this.innerDeco=o,this.nodeDOM=s}static create(e,t,n,o,r,i){let s,a=r.nodeViews[t.type.name],l=a&&a(t,r,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i,n,o),c=l&&l.dom,d=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=zn.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return c=Gs(c,n,t),l?s=new Hs(e,t,n,o,c,d||null,u,l,r,i+1):t.isText?new $s(e,t,n,o,c,u,r):new Vs(e,t,n,o,c,d||null,u,r,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Ht.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Js(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,o=t,r=e.composing?this.localCompositionInfo(e,t):null,i=r&&r.pos>-1?r:null,s=r&&r.pos<0,a=new Xs(this,i&&i.node,e);!function(e,t,n,o){let r=t.locals(e),i=0;if(0==r.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);o(s,r,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let d,u,p,h;for(;s<r.length&&r[s].to==i;){let e=r[s++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(Ys);for(let e=0;e<u.length;e++)n(u[e],c,!!l)}else n(d,c,!!l);if(l)h=-1,p=l,l=null;else{if(!(c<e.childCount))break;h=c,p=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)a.push(r[s++]);let f=i+p.nodeSize;if(p.isText){let e=f;s<r.length&&r[s].from<e&&(e=r[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=p.cut(e-i),p=p.cut(0,e-i),f=e,h=-1)}else for(;s<r.length&&r[s].to<f;)s++;o(p,p.isInline&&!p.isLeaf?a.filter(e=>!e.inline):a.slice(),t.forChild(i,p),h),i=f}}(this.node,this.innerDeco,(t,r,i)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,r):t.type.side>=0&&!i&&a.syncToMarks(r==this.node.childCount?Wt.none:this.node.child(r).marks,n,e,r),a.placeWidget(t,e,o)},(t,i,l,c)=>{let d;a.syncToMarks(t.marks,n,e,c),a.findNodeMatch(t,i,l,c)||s&&e.state.selection.from>o&&e.state.selection.to<o+t.nodeSize&&(d=a.findIndexWithChild(r.node))>-1&&a.updateNodeAt(t,i,l,d,e)||a.updateNextNode(t,i,l,e,c,o)||a.addNode(t,i,l,e,o),o+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),Fs(this.contentDOM,this.children,e),rs&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:o}=e.state.selection;if(!(e.state.selection instanceof Fo)||n<t||o>t+this.node.content.size)return null;let r=e.input.compositionNode;if(!r||!this.dom.contains(r.parentNode))return null;if(this.node.inlineContent){let e=r.nodeValue,i=function(e,t,n,o){for(let r=0,i=0;r<e.childCount&&i<=o;){let s=e.child(r++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;r<e.childCount;){let t=e.child(r++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){if(i>=o&&l.slice(o-t.length-a,o-a)==t)return o-t.length;let e=a<o?l.lastIndexOf(t,o-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==o&&l.length>=o+t.length-a&&l.slice(o-a,o-a+t.length)==t)return o}}return-1}(this.node.content,e,n-t,o-t);return i<0?null:{node:r,pos:i,text:e}}return{node:r,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:o}){if(this.getDesc(t))return;let r=t;for(;r.parentNode!=this.contentDOM;r=r.parentNode){for(;r.previousSibling;)r.parentNode.removeChild(r.previousSibling);for(;r.nextSibling;)r.parentNode.removeChild(r.nextSibling);r.pmViewDesc&&(r.pmViewDesc=void 0)}let i=new Ps(this,r,t,o);e.input.compositionNodes.push(i),this.children=Qs(this.children,n,n+o.length,e,i)}update(e,t,n,o){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,o),!0)}updateInner(e,t,n,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(Js(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Us(this.dom,this.nodeDOM,Ws(this.outerDeco,this.node,t),Ws(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function js(e,t,n,o,r){Gs(o,t,e);let i=new Vs(void 0,e,t,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class $s extends Vs{constructor(e,t,n,o,r,i,s){super(e,t,n,o,r,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,o){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=0,!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"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let o=this.node.cut(e,t),r=document.createTextNode(o.text);return new $s(this.parent,o,this.outerDeco,this.innerDeco,r,r,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Bs extends As{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Hs extends Vs{constructor(e,t,n,o,r,i,s,a,l,c){super(e,t,n,o,r,i,s,l,c),this.spec=a}update(e,t,n,o){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let r=this.spec.update(e,t,n);return r&&this.updateInner(e,t,n,o),r}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,o){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Fs(e,t,n){let o=e.firstChild,r=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=o;)o=Zs(o),r=!0;o=o.nextSibling}else r=!0,e.insertBefore(a,o);if(s instanceof Ls){let t=o?o.previousSibling:e.lastChild;Fs(s.contentDOM,s.children,n),o=t?t.nextSibling:e.firstChild}}for(;o;)o=Zs(o),r=!0;r&&n.trackWrites==e&&(n.trackWrites=null)}const zs=function(e){e&&(this.nodeName=e)};zs.prototype=Object.create(null);const qs=[new zs];function Ws(e,t,n){if(0==e.length)return qs;let o=n?qs[0]:new zs,r=[o];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&r.push(o=new zs(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==r.length&&r.push(o=new zs(t.isInline?"span":"div")),"class"==e?o.class=(o.class?o.class+" ":"")+i:"style"==e?o.style=(o.style?o.style+";":"")+i:"nodeName"!=e&&(o[e]=i))}}}return r}function Us(e,t,n,o){if(n==qs&&o==qs)return t;let r=t;for(let t=0;t<o.length;t++){let i=o[t],s=n[t];if(t){let t;s&&s.nodeName==i.nodeName&&r!=e&&(t=r.parentNode)&&t.nodeName.toLowerCase()==i.nodeName||(t=document.createElement(i.nodeName),t.pmIsDeco=!0,t.appendChild(r),s=qs[0]),r=t}Ks(r,s||qs[0],i)}return r}function Ks(e,t,n){for(let o in t)"class"==o||"style"==o||"nodeName"==o||o in n||e.removeAttribute(o);for(let o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=t[o]&&e.setAttribute(o,n[o]);if(t.class!=n.class){let o=t.class?t.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.remove(o[t]);for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.add(r[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=o.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function Gs(e,t,n){return Us(e,e,qs,Ws(t,n,1!=e.nodeType))}function Js(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 Zs(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Xs{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,o=n.children.length,r=e.childCount,i=new Map,s=[];e:for(;r>0;){let a;for(;;)if(o){let e=n.children[o-1];if(!(e instanceof Ls)){a=e,o--;break}n=e,o=e.children.length}else{if(n==t)break e;o=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(r-1))break;--r,i.set(a,r),s.push(a)}}return{index:r,matched:i,matches:s.reverse()}}(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,o){let r=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;r<s&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let r=-1,s=this.top.children.length;o<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let o=Ls.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,o),this.top=o,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,o){let r,i=-1;if(o>=this.preMatch.index&&(r=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&r.matchesNode(e,t,n))i=this.top.children.indexOf(r,this.index);else for(let o=this.index,r=Math.min(this.top.children.length,o+5);o<r;o++){let r=this.top.children[o];if(r.matchesNode(e,t,n)&&!this.preMatch.matched.has(r)){i=o;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,o,r){let i=this.top.children[o];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,r)&&(this.destroyBetween(this.index,o),this.index++,!0)}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,o,r,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof Vs){let l=this.preMatch.matched.get(a);if(null!=l&&l!=r)return!1;let c,d=a.dom,u=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&Js(t,a.outerDeco));if(!u&&a.update(e,t,n,o))return this.destroyBetween(this.index,s),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(a,e,t,n,o,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(o,i+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,o,r,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Js(n,e.outerDeco)||!o.eq(e.innerDeco))return null;let s=Vs.create(this.top,t,n,o,r,i);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,o,r){let i=Vs.create(this.top,e,t,n,o,r);i.contentDOM&&i.updateChildren(o,r+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(!o||!o.matchesWidget(e)||e!=o.widget&&o.widget.type.toDOM.parentNode){let o=new Rs(this.top,e,t,n);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Ls;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof $s)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ns||es)&&e&&"false"==e.dom.contentEditable&&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);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let o=new Bs(this.top,[],n,null);t!=this.top?t.children.push(o):t.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function Ys(e,t){return e.type.side-t.type.side}function Qs(e,t,n,o,r){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,d=a+=l.size;c>=n||d<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,o)),r&&(i.push(r),r=void 0),d>n&&i.push(l.slice(n-c,l.size,o)))}return i}function ea(e,t=null){let n=e.domSelectionRange(),o=e.state.doc;if(!n.focusNode)return null;let r=e.docView.nearestDesc(n.focusNode),i=r&&0==r.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=o.resolve(s);if(Fi(n)){for(a=s;r&&!r.node;)r=r.parent;let e=r.node;if(r&&e.isAtom&&qo.isSelectable(e)&&r.parent&&(!e.isInline||!function(e,t,n){for(let o=0==t,r=t==Bi(e);o||r;){if(e==n)return!0;let t=Ai(e);if(!(e=e.parentNode))return!1;o=o&&0==t,r=r&&t==Bi(e)}}(n.focusNode,n.focusOffset,r.dom))){let e=r.posBefore;l=new qo(s==e?c:o.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,r=s;for(let o=0;o<n.rangeCount;o++){let i=n.getRangeAt(o);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),r=Math.max(r,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[a,s]=r==e.state.selection.anchor?[r,t]:[t,r],c=o.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=o.resolve(a);if(!l){l=ca(e,d,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)}return l}function ta(e){return e.editable?e.hasFocus():ua(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function na(e,t=!1){let n=e.state.selection;if(aa(e,n),ta(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&es){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Vi(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,o="IMG"==n.nodeName;o?t.collapse(n.parentNode,Ai(n)+1):t.collapse(n,0);!o&&!e.state.selection.visible&&Zi&&Xi<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let o,r,{anchor:i,head:s}=n;!oa||n instanceof Fo||(n.$from.parent.inlineContent||(o=ra(e,n.from)),n.empty||n.$from.parent.inlineContent||(r=ra(e,n.to))),e.docView.setSelection(i,s,e,t),oa&&(o&&sa(o),r&&sa(r)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==o&&n.anchorOffset==r||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{ta(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const oa=ns||es&&ts<63;function ra(e,t){let{node:n,offset:o}=e.docView.domFromPos(t,0),r=o<n.childNodes.length?n.childNodes[o]:null,i=o?n.childNodes[o-1]:null;if(ns&&r&&"false"==r.contentEditable)return ia(r);if(!(r&&"false"!=r.contentEditable||i&&"false"!=i.contentEditable)){if(r)return ia(r);if(i)return ia(i)}}function ia(e){return e.contentEditable="true",ns&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function sa(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function aa(e,t){if(t instanceof qo){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(la(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else la(e)}function la(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function ca(e,t,n,o){return e.someProp("createSelectionBetween",o=>o(e,t,n))||Fo.between(t,n,o)}function da(e){return!(e.editable&&!e.hasFocus())&&ua(e)}function ua(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function pa(e,t){let{$anchor:n,$head:o}=e.selection,r=t>0?n.max(o):n.min(o),i=r.parent.inlineContent?r.depth?e.doc.resolve(t>0?r.after():r.before()):null:r;return i&&jo.findFrom(i,t)}function ha(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function fa(e,t,n){let o=e.state.selection;if(!(o instanceof Fo)){if(o instanceof qo&&o.node.isInline)return ha(e,new Fo(t>0?o.$to:o.$from));{let n=pa(e.state,t);return!!n&&ha(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=o,r=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!r||r.isText||!r.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+r.nodeSize*(t<0?-1:1));return ha(e,new Fo(o.$anchor,i))}if(!o.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=pa(e.state,t);return!!(n&&n instanceof qo)&&ha(e,n)}if(!(is&&n.indexOf("m")>-1)){let n,r=o.$head,i=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText)return!1;let s=t<0?r.pos-i.nodeSize:r.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(qo.isSelectable(i)?ha(e,new qo(t<0?e.state.doc.resolve(r.pos-i.nodeSize):r)):!!ls&&ha(e,new Fo(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function ma(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function ga(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function va(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,o=t.focusOffset;if(!n)return;let r,i,s=!1;Yi&&1==n.nodeType&&o<ma(n)&&ga(n.childNodes[o],-1)&&(s=!0);for(;;)if(o>0){if(1!=n.nodeType)break;{let e=n.childNodes[o-1];if(ga(e,-1))r=n,i=--o;else{if(3!=e.nodeType)break;n=e,o=n.nodeValue.length}}}else{if(ya(n))break;{let t=n.previousSibling;for(;t&&ga(t,-1);)r=n.parentNode,i=Ai(t),t=t.previousSibling;if(t)n=t,o=ma(n);else{if(n=n.parentNode,n==e.dom)break;o=0}}}s?wa(e,n,o):r&&wa(e,r,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,o=t.focusOffset;if(!n)return;let r,i,s=ma(n);for(;;)if(o<s){if(1!=n.nodeType)break;if(!ga(n.childNodes[o],1))break;r=n,i=++o}else{if(ya(n))break;{let t=n.nextSibling;for(;t&&ga(t,1);)r=t.parentNode,i=Ai(t)+1,t=t.nextSibling;if(t)n=t,o=0,s=ma(n);else{if(n=n.parentNode,n==e.dom)break;o=s=0}}}r&&wa(e,r,i)}(e)}function ya(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function wa(e,t,n){if(3!=t.nodeType){let e,o;(o=function(e,t){for(;e&&t==e.childNodes.length&&!Hi(e);)t=Ai(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=o,n=0):(e=function(e,t){for(;e&&!t&&!Hi(e);)t=Ai(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let o=e.domSelection();if(!o)return;if(Fi(o)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),o.removeAllRanges(),o.addRange(e)}else o.extend&&o.extend(t,n);e.domObserver.setCurSelection();let{state:r}=e;setTimeout(()=>{e.state==r&&na(e)},50)}function ba(e,t){let n=e.state.doc.resolve(t);if(!es&&!ss&&n.parent.inlineContent){let o=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),r=(n.top+n.bottom)/2;if(r>o.top&&r<o.bottom&&Math.abs(n.left-o.left)>1)return n.left<o.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),r=(n.top+n.bottom)/2;if(r>o.top&&r<o.bottom&&Math.abs(n.left-o.left)>1)return n.left>o.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function ka(e,t,n){let o=e.state.selection;if(o instanceof Fo&&!o.empty||n.indexOf("s")>-1)return!1;if(is&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=pa(e.state,t);if(n&&n instanceof qo)return ha(e,n)}if(!r.parent.inlineContent){let n=t<0?r:i,s=o instanceof Uo?jo.near(n,t):jo.findFrom(n,t);return!!s&&ha(e,s)}return!1}function Ca(e,t){if(!(e.state.selection instanceof Fo))return!0;let{$head:n,$anchor:o,empty:r}=e.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=e.state.tr;return t<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),e.dispatch(o),!0}return!1}function xa(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Na(e,t){let n=t.keyCode,o=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||is&&72==n&&"c"==o)return Ca(e,-1)||va(e,-1);if(46==n&&!t.shiftKey||is&&68==n&&"c"==o)return Ca(e,1)||va(e,1);if(13==n||27==n)return!0;if(37==n||is&&66==n&&"c"==o){let t=37==n?"ltr"==ba(e,e.state.selection.from)?-1:1:-1;return fa(e,t,o)||va(e,t)}if(39==n||is&&70==n&&"c"==o){let t=39==n?"ltr"==ba(e,e.state.selection.from)?1:-1:1;return fa(e,t,o)||va(e,t)}return 38==n||is&&80==n&&"c"==o?ka(e,-1,o)||va(e,-1):40==n||is&&78==n&&"c"==o?function(e){if(!ns||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;xa(e,n,"true"),setTimeout(()=>xa(e,n,"false"),20)}return!1}(e)||ka(e,1,o)||va(e,1):o==(is?"m":"c")&&(66==n||73==n||89==n||90==n)}function Sa(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:o,openStart:r,openEnd:i}=t;for(;r>1&&i>1&&1==o.childCount&&1==o.firstChild.childCount;){r--,i--;let e=o.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),o=e.content}let s=e.someProp("clipboardSerializer")||zn.fromSchema(e.state.schema),a=Pa(),l=a.createElement("div");l.appendChild(s.serializeFragment(o,{document:a}));let c,d=l.firstChild,u=0;for(;d&&1==d.nodeType&&(c=Aa[d.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),u++}d=l.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${r} ${i}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function Oa(e,t,n,o,r){let i,s,a=r.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(o||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||o,e)}),a)return s=new Kt(Ht.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,r,o,e));if(n)s=n;else{let n=r.marks(),{schema:o}=e.state,s=zn.fromSchema(o);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(o.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,o=Pa().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e);(n=r&&Aa[r[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join(""));if(o.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;La||(La=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return La.createHTML(e)}(e),n)for(let e=0;e<n.length;e++)o=o.querySelector(n[e])||o;return o}(n),ls&&function(e){let t=e.querySelectorAll(es?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let o=t[n];1==o.childNodes.length&&" "==o.textContent&&o.parentNode&&o.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),o)}}(i);let c=i&&i.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=i.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||An.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!l&&!d),context:r,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Ea.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)s=function(e,t){if(!e.size)return e;let n,o=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:r,openStart:i,openEnd:s}=e;for(let e=n.length-2;e>=0;e-=2){let t=o.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;r=Ht.from(t.create(n[e+1],r)),i++,s++}return new Kt(r,i,s)}(Ia(s,+d[1],+d[2]),d[4]);else if(s=Kt.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let o,r=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach(e=>{if(!i)return;let t,n=r.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&o.length&&_a(n,o,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=Ta(i[i.length-1],o.length));let t=Ma(e,n);i.push(t),r=r.matchType(t.type),o=n}}),i)return Ht.from(i)}return e}(s.content,r),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=Ia(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}const Ea=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ma(e,t,n=0){for(let o=t.length-1;o>=n;o--)e=t[o].create(null,Ht.from(e));return e}function _a(e,t,n,o,r){if(r<e.length&&r<t.length&&e[r]==t[r]){let i=_a(e,t,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==e.length-1?n.type:e[r+1]))return o.copy(o.content.append(Ht.from(Ma(n,e,r+1))))}}function Ta(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Ta(e.lastChild,t-1)),o=e.contentMatchAt(e.childCount).fillBefore(Ht.empty,!0);return e.copy(n.append(o))}function Da(e,t,n,o,r,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),r<o-1&&(a=Da(a,t,n,o,r+1,i)),r>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=r).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Ht.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function Ia(e,t,n){return t<e.openStart&&(e=new Kt(Da(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Kt(Da(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Aa={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Ra=null;function Pa(){return Ra||(Ra=document.implementation.createHTMLDocument("title"))}let La=null;const Va={},ja={},$a={touchstart:!0,touchmove:!0};class Ba{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Ha(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Fa(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>za(e,t))})}function za(e,t){return e.someProp("handleDOMEvents",n=>{let o=n[t.type];return!!o&&(o(e,t)||t.defaultPrevented)})}function qa(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Wa(e){return{left:e.clientX,top:e.clientY}}function Ua(e,t,n,o,r){if(-1==o)return!1;let i=e.state.doc.resolve(o);for(let o=i.depth+1;o>0;o--)if(e.someProp(t,t=>o>i.depth?t(e,n,i.nodeAfter,i.before(o),r,!0):t(e,n,i.node(o),i.before(o),r,!1)))return!0;return!1}function Ka(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let o=e.state.tr.setSelection(t);o.setMeta("pointer",!0),e.dispatch(o)}function Ga(e,t,n,o,r){return Ua(e,"handleClickOn",t,n,o)||e.someProp("handleClick",n=>n(e,t,o))||(r?function(e,t){if(-1==t)return!1;let n,o,r=e.state.selection;r instanceof qo&&(n=r.node);let i=e.state.doc.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e);if(qo.isSelectable(t)){o=n&&r.$from.depth>0&&e>=r.$from.depth&&i.before(r.$from.depth+1)==r.$from.pos?i.before(r.$from.depth):i.before(e);break}}return null!=o&&(Ka(e,qo.create(e.state.doc,o)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),o=n.nodeAfter;return!!(o&&o.isAtom&&qo.isSelectable(o))&&(Ka(e,new qo(n)),!0)}(e,n))}function Ja(e,t,n,o){return Ua(e,"handleDoubleClickOn",t,n,o)||e.someProp("handleDoubleClick",n=>n(e,t,o))}function Za(e,t,n,o){return Ua(e,"handleTripleClickOn",t,n,o)||e.someProp("handleTripleClick",n=>n(e,t,o))||function(e,t,n){if(0!=n.button)return!1;let o=e.state.doc;if(-1==t)return!!o.inlineContent&&(Ka(e,Fo.create(o,0,o.content.size)),!0);let r=o.resolve(t);for(let t=r.depth+1;t>0;t--){let n=t>r.depth?r.nodeAfter:r.node(t),i=r.before(t);if(n.inlineContent)Ka(e,Fo.create(o,i+1,i+1+n.content.size));else{if(!qo.isSelectable(n))continue;Ka(e,qo.create(o,i))}return!0}}(e,n,o)}function Xa(e){return il(e)}ja.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!el(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!as||!es||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!rs||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||Na(e,n)?n.preventDefault():Ha(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,zi(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},ja.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},ja.keypress=(e,t)=>{let n=t;if(el(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||is&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let o=e.state.selection;if(!(o instanceof Fo&&o.$from.sameParent(o.$to))){let t=String.fromCharCode(n.charCode),r=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,o.$from.pos,o.$to.pos,t,r))||e.dispatch(r()),n.preventDefault()}};const Ya=is?"metaKey":"ctrlKey";Va.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let o=Xa(e),r=Date.now(),i="singleClick";r-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,o=t.y-e.clientY;return n*n+o*o<100}(n,e.input.lastClick)&&!n[Ya]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=e.posAtCoords(Wa(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Qa(e,s,n,!!o)):("doubleClick"==i?Ja:Za)(e,s.pos,s.inside,n)?n.preventDefault():Ha(e,"pointer"))};class Qa{constructor(e,t,n,o){let r,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Ya],this.allowDefault=n.shiftKey,t.inside>-1)r=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);r=n.parent,i=n.depth?n.before():0}const s=o?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;0==n.button&&(r.type.spec.draggable&&!1!==r.type.spec.selectable||l instanceof qo&&l.from<=i&&l.to>i)&&(this.mightDrag={node:r,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Yi||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ha(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>na(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Wa(e))),this.updateAllowDefault(e),this.allowDefault||!t?Ha(this.view,"pointer"):Ga(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||ns&&this.mightDrag&&!this.mightDrag.node.isAtom||es&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Ka(this.view,jo.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Ha(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ha(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function el(e,t){return!!e.composing||!!(ns&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Va.touchstart=e=>{e.input.lastTouch=Date.now(),Xa(e),Ha(e,"pointer")},Va.touchmove=e=>{e.input.lastTouch=Date.now(),Ha(e,"pointer")},Va.contextmenu=e=>Xa(e);const tl=as?5e3:-1;function nl(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>il(e),t))}function ol(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function rl(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Bi(e=e.childNodes[t-1])}else{if(!e.parentNode||Hi(e))return null;t=Ai(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),o=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Hi(e))return null;t=Ai(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&o&&n!=o){let t=o.pmViewDesc,r=e.domObserver.lastChangedTextNode;if(n==r||o==r)return r;if(!t||!t.isText(o.nodeValue))return o;if(e.input.compositionNode==o){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return o}}return n||o}function il(e,t=!1){if(!(as&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),ol(e),t||e.docView&&e.docView.dirty){let n=ea(e),o=e.state.selection;return n&&!n.eq(o)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}ja.compositionstart=ja.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Fo&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||es&&ss&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let o=t.childNodes[n];return 1==o.nodeType&&"false"==o.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),il(e,!0),e.markCursor=null;else if(il(e,!t.selection.empty),Yi&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,o=t.focusOffset;n&&1==n.nodeType&&0!=o;){let t=o<0?n.lastChild:n.childNodes[o-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,o=-1}}e.input.composing=!0}nl(e,tl)},ja.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,nl(e,20))};const sl=Zi&&Xi<15||rs&&cs<604;function al(e,t,n,o,r){let i=Oa(e,t,n,o,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,r,i||Kt.empty)))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,o):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ll(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Va.copy=ja.cut=(e,t)=>{let n=t,o=e.state.selection,r="cut"==n.type;if(o.empty)return;let i=sl?null:n.clipboardData,s=o.content(),{dom:a,text:l}=Sa(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(t),e.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,a),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},ja.paste=(e,t)=>{let n=t;if(e.composing&&!as)return;let o=sl?null:n.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;o&&al(e,ll(o),o.getData("text/html"),r,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,o=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),o.parentNode&&o.parentNode.removeChild(o),n?al(e,o.value,null,r,t):al(e,o.textContent,o.innerHTML,r,t)},50)}(e,n)};class cl{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const dl=is?"altKey":"ctrlKey";function ul(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[dl]}Va.dragstart=(e,t)=>{let n=t,o=e.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r,i=e.state.selection,s=i.empty?null:e.posAtCoords(Wa(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof qo?i.to-1:i.to));else if(o&&o.mightDrag)r=qo.create(e.state.doc,o.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(r=qo.create(e.state.doc,t.posBefore))}let a=(r||e.state.selection).content(),{dom:l,text:c,slice:d}=Sa(e,a);(!n.dataTransfer.files.length||!es||ts>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(sl?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",sl||n.dataTransfer.setData("text/plain",c),e.dragging=new cl(d,ul(e,n),r)},Va.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},ja.dragover=ja.dragenter=(e,t)=>t.preventDefault(),ja.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let o=e.posAtCoords(Wa(t));if(!o)return;let r=e.state.doc.resolve(o.pos),i=n&&n.slice;i?e.someProp("transformPasted",t=>{i=t(i,e,!1)}):i=Oa(e,ll(t.dataTransfer),sl?null:t.dataTransfer.getData("text/html"),!1,r);let s=!(!n||!ul(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||Kt.empty,s)))return void t.preventDefault();if(!i)return;t.preventDefault();let a=i?function(e,t,n){let o=e.resolve(t);if(!n.content.size)return t;let r=n.content;for(let e=0;e<n.openStart;e++)r=r.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=o.depth;t>=0;t--){let n=t==o.depth?0:o.pos<=(o.start(t+1)+o.end(t+1))/2?-1:1,i=o.index(t)+(n>0?1:0),s=o.node(t),a=!1;if(1==e)a=s.canReplace(i,i,r);else{let e=s.contentMatchAt(i).findWrapping(r.firstChild.type);a=e&&s.canReplaceWith(i,i,e[0])}if(a)return 0==n?o.pos:n<0?o.before(t+1):o.after(t+1)}return null}(e.state.doc,r.pos,i):r.pos;null==a&&(a=r.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,u=l.doc;d?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i);if(l.doc.eq(u))return;let p=l.doc.resolve(c);if(d&&qo.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new qo(p));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,o,r)=>t=r),l.setSelection(ca(e,p,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},Va.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&na(e)},20))},Va.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Va.beforeinput=(e,t)=>{if(es&&as&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,zi(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in ja)Va[e]=ja[e];function pl(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class hl{constructor(e,t){this.toDOM=e,this.spec=t||yl,this.side=this.spec.side||0}map(e,t,n,o){let{pos:r,deleted:i}=e.mapResult(t.from+o,this.side<0?-1:1);return i?null:new gl(r-n,r-n,this)}valid(){return!0}eq(e){return this==e||e instanceof hl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&pl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class fl{constructor(e,t){this.attrs=e,this.spec=t||yl}map(e,t,n,o){let r=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-n;return r>=i?null:new gl(r,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof fl&&pl(this.attrs,e.attrs)&&pl(this.spec,e.spec)}static is(e){return e.type instanceof fl}destroy(){}}class ml{constructor(e,t){this.attrs=e,this.spec=t||yl}map(e,t,n,o){let r=e.mapResult(t.from+o,1);if(r.deleted)return null;let i=e.mapResult(t.to+o,-1);return i.deleted||i.pos<=r.pos?null:new gl(r.pos-n,i.pos-n,this)}valid(e,t){let n,{index:o,offset:r}=e.content.findIndex(t.from);return r==t.from&&!(n=e.child(o)).isText&&r+n.nodeSize==t.to}eq(e){return this==e||e instanceof ml&&pl(this.attrs,e.attrs)&&pl(this.spec,e.spec)}destroy(){}}class gl{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new gl(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new gl(e,e,new hl(t,n))}static inline(e,t,n,o){return new gl(e,t,new fl(n,o))}static node(e,t,n,o){return new gl(e,t,new ml(n,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof fl}get widget(){return this.type instanceof hl}}const vl=[],yl={};class wl{constructor(e,t){this.local=e.length?e:vl,this.children=t.length?t:vl}static create(e,t){return t.length?Sl(t,e,0,yl):bl}find(e,t,n){let o=[];return this.findInner(null==e?0:e,null==t?1e9:t,o,0,n),o}findInner(e,t,n,o,r){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!r||r(s.spec))&&n.push(s.copy(s.from+o,s.to+o))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,o+s,r)}}map(e,t,n){return this==bl||0==e.maps.length?this:this.mapInner(e,t,0,0,n||yl)}mapInner(e,t,n,o,r){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,o);a&&a.type.valid(t,a)?(i||(i=[])).push(a):r.onRemove&&r.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,o,r,i,s){let a=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let o=0;n.maps[e].forEach((e,n,r,i)=>{let s=i-r-(n-e);for(let r=0;r<a.length;r+=3){let i=a[r+1];if(i<0||e>i+t-o)continue;let l=a[r]+t-o;n>=l?a[r+1]=e<=l?-2:-1:e>=t&&s&&(a[r]+=s,a[r+1]+=s)}o+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+i),d=c-r;if(d<0||d>=o.content.size){l=!0;continue}let u=n.map(e[t+1]+i,-1)-r,{index:p,offset:h}=o.content.findIndex(d),f=o.maybeChild(p);if(f&&h==d&&h+f.nodeSize==u){let o=a[t+2].mapInner(n,f,c+1,e[t]+i+1,s);o!=bl?(a[t]=d,a[t+1]=u,a[t+2]=o):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,o,r,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(o,r,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+i+1);return n}(a,e,t,n,r,i,s),c=Sl(l,o,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new wl(t.sort(Ol),a)}(this.children,i||[],e,t,n,o,r):i?new wl(i.sort(Ol),vl):bl}add(e,t){return t.length?this==bl?wl.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let o,r=0;e.forEach((e,i)=>{let s,a=i+n;if(s=xl(t,e,a)){for(o||(o=this.children.slice());r<o.length&&o[r]<i;)r+=3;o[r]==i?o[r+2]=o[r+2].addInner(e,s,a+1):o.splice(r,0,i,i+e.nodeSize,Sl(s,e,a+1,yl)),r+=3}});let i=Cl(r?Nl(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new wl(i.length?this.local.concat(i).sort(Ol):this.local,o||this.children)}remove(e){return 0==e.length||this==bl?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,o=this.local;for(let o=0;o<n.length;o+=3){let r,i=n[o]+t,s=n[o+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(r||(r=[])).push(t));if(!r)continue;n==this.children&&(n=this.children.slice());let a=n[o+2].removeInner(r,i+1);a!=bl?n[o+2]=a:(n.splice(o,3),o-=3)}if(o.length)for(let n,r=0;r<e.length;r++)if(n=e[r])for(let e=0;e<o.length;e++)o[e].eq(n,t)&&(o==this.local&&(o=this.local.slice()),o.splice(e--,1));return n==this.children&&o==this.local?this:o.length||n.length?new wl(o,n):bl}forChild(e,t){if(this==bl)return this;if(t.isLeaf)return wl.empty;let n,o;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let r=e+1,i=r+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>r&&t.type instanceof fl){let e=Math.max(r,t.from)-r,n=Math.min(i,t.to)-r;e<n&&(o||(o=[])).push(t.copy(e,n))}}if(o){let e=new wl(o.sort(Ol),vl);return n?new kl([e,n]):e}return n||bl}eq(e){if(this==e)return!0;if(!(e instanceof wl)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return El(this.localsInner(e))}localsInner(e){if(this==bl)return vl;if(e.inlineContent||!this.local.some(fl.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof fl||t.push(this.local[e]);return t}forEachSet(e){e(this)}}wl.empty=new wl([],[]),wl.removeOverlap=El;const bl=wl.empty;class kl{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,yl));return kl.from(n)}forChild(e,t){if(t.isLeaf)return wl.empty;let n=[];for(let o=0;o<this.members.length;o++){let r=this.members[o].forChild(e,t);r!=bl&&(r instanceof kl?n=n.concat(r.members):n.push(r))}return kl.from(n)}eq(e){if(!(e instanceof kl)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let o=0;o<this.members.length;o++){let r=this.members[o].localsInner(e);if(r.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<r.length;e++)t.push(r[e])}else t=r}return t?El(n?t:t.sort(Ol)):vl}static from(e){switch(e.length){case 0:return bl;case 1:return e[0];default:return new kl(e.every(e=>e instanceof wl)?e:e.reduce((e,t)=>e.concat(t instanceof wl?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Cl(e,t){if(!t||!e.length)return e;let n=[];for(let o=0;o<e.length;o++){let r=e[o];n.push(new gl(r.from+t,r.to+t,r.type))}return n}function xl(e,t,n){if(t.isLeaf)return null;let o=n+t.nodeSize,r=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<o&&((r||(r=[])).push(t),e[i]=null);return r}function Nl(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Sl(e,t,n,o){let r=[],i=!1;t.forEach((t,s)=>{let a=xl(e,t,s+n);if(a){i=!0;let e=Sl(a,t,n+s+1,o);e!=bl&&r.push(s,s+t.nodeSize,e)}});let s=Cl(i?Nl(e):e,-n).sort(Ol);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(o.onRemove&&o.onRemove(s[e].spec),s.splice(e--,1));return s.length||r.length?new wl(s,r):bl}function Ol(e,t){return e.from-t.from||e.to-t.to}function El(e){let t=e;for(let n=0;n<t.length-1;n++){let o=t[n];if(o.from!=o.to)for(let r=n+1;r<t.length;r++){let i=t[r];if(i.from!=o.from){i.from<o.to&&(t==e&&(t=e.slice()),t[n]=o.copy(o.from,i.from),Ml(t,r,o.copy(i.from,o.to)));break}i.to!=o.to&&(t==e&&(t=e.slice()),t[r]=i.copy(i.from,o.to),Ml(t,r+1,i.copy(o.to,i.to)))}}return t}function Ml(e,t,n){for(;t<e.length&&Ol(n,e[t])>0;)t++;e.splice(t,0,n)}function _l(e){let t=[];return e.someProp("decorations",n=>{let o=n(e.state);o&&o!=bl&&t.push(o)}),e.cursorWrapper&&t.push(wl.create(e.state.doc,[e.cursorWrapper.deco])),kl.from(t)}const Tl={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Dl=Zi&&Xi<=11;class Il{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Al{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Il,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);Zi&&Xi<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():ns&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Dl&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Tl)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(da(this.view)){if(this.suppressingSelectionUpdates)return na(this.view);if(Zi&&Xi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Vi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let t=e.focusNode;t;t=Ri(t))n.add(t);for(let o=e.anchorNode;o;o=Ri(o))if(n.has(o)){t=o;break}let o=t&&this.view.docView.nearestDesc(t);return o&&o.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&da(e)&&!this.ignoreSelectionChange(n),r=-1,i=-1,s=!1,a=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],a);n&&(r=r<0?n.from:Math.min(n.from,r),i=i<0?n.to:Math.max(n.to,i),n.typeOver&&(s=!0))}if(!a.some(e=>"BR"==e.nodeName)||8!=e.input.lastKeyCode&&46!=e.input.lastKeyCode){if(Yi&&a.length){let t=a.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let o of t){let t=o.parentNode;!t||"LI"!=t.nodeName||n&&Vl(e,n)==t||o.remove()}}}}else for(let e of a)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}let l=null;r<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Fi(n)&&(l=ea(e))&&l.eq(jo.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,na(e),this.currentSelection.set(n),e.scrollToSelection()):(r>-1||o)&&(r>-1&&(e.docView.markDirty(r,i),function(e){if(Rl.has(e))return;if(Rl.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=Yi,Pl)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Pl=!0}}(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:o,focusOffset:r}=e.domSelectionRange();for(let i of t)if("TR"==(null===(n=i.parentNode)||void 0===n?void 0:n.nodeName)){let t=i.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(i,n.firstChild),o==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}(e,a)),this.handleDOMChange(r,i,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||na(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let o=e.addedNodes[n];t.push(o),3==o.nodeType&&(this.lastChangedTextNode=o)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let o=e.previousSibling,r=e.nextSibling;if(Zi&&Xi<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(o=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(r=i)}let i=o&&o.parentNode==e.target?Ai(o)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=r&&r.parentNode==e.target?Ai(r):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Rl=new WeakMap,Pl=!1;function Ll(e,t){let n=t.startContainer,o=t.startOffset,r=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Vi(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function Vl(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function jl(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(ns&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||ns&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const $l=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Bl(e,t,n,o,r){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=ea(e,t);if(n&&!e.state.selection.eq(n)){if(es&&as&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,zi(13,"Enter"))))return;let o=e.state.tr.setSelection(n);"pointer"==t?o.setMeta("pointer",!0):"key"==t&&o.scrollIntoView(),i&&o.setMeta("composition",i),e.dispatch(o)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l,c,d=e.state.selection,u=function(e,t,n){let o,{node:r,fromOffset:i,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(o=[{node:d,offset:c.anchorOffset}],Fi(c)||o.push({node:c.focusNode,offset:c.focusOffset})),es&&8===e.input.lastKeyCode)for(let e=s;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let u=e.state.doc,p=e.someProp("domParser")||An.fromSchema(e.state.schema),h=u.resolve(a),f=null,m=p.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=h.parent.type.whitespace||"full",findPositions:o,ruleFromNode:jl,context:h});if(o&&null!=o[0].pos){let e=o[0].pos,t=o[1]&&o[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),p=e.state.doc,h=p.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let f=function(e,t,n,o,r){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==r){o-=s+Math.max(0,i-Math.min(s,a))-i}if(s<i&&e.size<t.size){let e=o<=i&&o>=s?i-o:0;i-=e,i&&i<t.size&&zl(t.textBetween(i-1,i+1))&&(i+=e?1:-1),a=i+(a-s),s=i}else if(a<i){let t=o<=i&&o>=a?i-o:0;i-=t,i&&i<e.size&&zl(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}(h.content,u.doc.content,u.from,l,c);if(f&&e.input.domChangeCount++,(rs&&e.input.lastIOSEnter>Date.now()-225||as)&&r.some(e=>1==e.nodeType&&!$l.test(e.nodeName))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",t=>t(e,zi(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!f){if(!(o&&d instanceof Fo&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||u.sel&&u.sel.anchor!=u.sel.head){if(u.sel){let t=Hl(e,e.state.doc,u.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}f={start:d.from,endA:d.to,endB:d.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Fo&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),Zi&&Xi<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>u.from&&"  "==u.doc.textBetween(f.start-u.from-1,f.start-u.from+1)&&(f.start--,f.endA--,f.endB--);let m=u.doc.resolveNoCache(f.start-u.from),g=u.doc.resolveNoCache(f.endB-u.from),v=p.resolve(f.start),y=m.sameParent(g)&&m.parent.inlineContent&&v.end()>=f.endA;if((rs&&e.input.lastIOSEnter>Date.now()-225&&(!y||r.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!y&&m.pos<u.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(u.doc.textBetween(m.pos,g.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,zi(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,o,r){if(n-t<=r.pos-o.pos||Fl(o,!0,!1)<r.pos)return!1;let i=e.resolve(t);if(!o.parent.isTextblock){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(Fl(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||Fl(s,!0,!1)<n)&&o.parent.content.cut(o.parentOffset).eq(s.parent.content)}(p,f.start,f.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,zi(8,"Backspace"))))return void(as&&es&&e.domObserver.suppressSelectionUpdates());es&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),as&&!y&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==f.endA&&(f.endB-=2,g=u.doc.resolveNoCache(f.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,zi(13,"Enter"))})},20));let w,b=f.start,k=f.endA,C=t=>{let n=t||e.state.tr.replace(b,k,u.doc.slice(f.start-u.from,f.endB-u.from));if(u.sel){let t=Hl(e,n.doc,u.sel);t&&!(es&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==b||t.head==n.mapping.map(k)-1)||Zi&&t.empty&&t.head==b)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(y)if(m.pos==g.pos){Zi&&Xi<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>na(e),20));let t=C(e.state.tr.delete(b,k)),n=p.resolve(f.start).marksAcross(p.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(w=function(e,t){let n,o,r,i=e.firstChild.marks,s=t.firstChild.marks,a=i,l=s;for(let e=0;e<s.length;e++)a=s[e].removeFromSet(a);for(let e=0;e<i.length;e++)l=i[e].removeFromSet(l);if(1==a.length&&0==l.length)o=a[0],n="add",r=e=>e.mark(o.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;o=l[0],n="remove",r=e=>e.mark(o.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(r(t.child(e)));if(Ht.from(c).eq(e))return{mark:o,type:n}}(m.parent.content.cut(m.parentOffset,g.parentOffset),v.parent.content.cut(v.parentOffset,f.endA-v.start())))){let t=C(e.state.tr);"add"==w.type?t.addMark(b,k,w.mark):t.removeMark(b,k,w.mark),e.dispatch(t)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let t=m.parent.textBetween(m.parentOffset,g.parentOffset),n=()=>C(e.state.tr.insertText(t,b,k));e.someProp("handleTextInput",o=>o(e,b,k,t,n))||e.dispatch(n())}else e.dispatch(C());else e.dispatch(C())}function Hl(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:ca(e,t.resolve(n.anchor),t.resolve(n.head))}function Fl(e,t,n){let o=e.depth,r=t?e.end():e.pos;for(;o>0&&(t||e.indexAfter(o)==e.node(o).childCount);)o--,r++,t=!1;if(n){let t=e.node(o).maybeChild(e.indexAfter(o));for(;t&&!t.isLeaf;)t=t.firstChild,r++}return r}function zl(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class ql{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Ba,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Jl),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Kl(this),Ul(this),this.nodeViews=Gl(this),this.docView=js(this.state.doc,Wl(this),_l(this),this.dom,this),this.domObserver=new Al(this,(e,t,n,o)=>Bl(this,e,t,n,o)),this.domObserver.start(),function(e){for(let t in Va){let n=Va[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!qa(e,t)||za(e,t)||!e.editable&&t.type in ja||n(e,t)},$a[t]?{passive:!0}:void 0)}ns&&e.dom.addEventListener("input",()=>null),Fa(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Fa(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Jl),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let o=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(ol(this),i=!0),this.state=e;let s=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Gl(this);(function(e,t){let n=0,o=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let e in t)o++;return n!=o})(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Fa(this),this.editable=Kl(this),Ul(this);let a=_l(this),l=Wl(this),c=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",d=r||!this.docView.matchesNode(e.doc,l,a);!d&&e.selection.eq(o.selection)||(i=!0);let u="preserve"==c&&i&&null==this.dom.style.overflowAnchor&&function(e){let t,n,o=e.dom.getBoundingClientRect(),r=Math.max(0,o.top);for(let i=(o.left+o.right)/2,s=r+1;s<Math.min(innerHeight,o.bottom);s+=5){let o=e.root.elementFromPoint(i,s);if(!o||o==e.dom||!e.dom.contains(o))continue;let a=o.getBoundingClientRect();if(a.top>=r-20){t=o,n=a.top;break}}return{refDOM:t,refTop:n,stack:fs(e.dom)}}(this);if(i){this.domObserver.stop();let t=d&&(Zi||es)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(o.selection,e.selection);if(d){let n=es?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=rl(this)),!r&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=js(e.doc,l,a,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Vi(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?na(this,t):(aa(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():u&&function({refDOM:e,refTop:t,stack:n}){let o=e?e.getBoundingClientRect().top:0;ms(n,0==o?0:o-t)}(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof qo){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&hs(this,t.getBoundingClientRect(),e)}else hs(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,o=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)o=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(o=e)}this.dragging=new cl(e.slice,e.move,o<0?void 0:qo.create(this.state.doc,o))}someProp(e,t){let n,o=this._props&&this._props[e];if(null!=o&&(n=t?t(o):o))return n;for(let o=0;o<this.directPlugins.length;o++){let r=this.directPlugins[o].props[e];if(null!=r&&(n=t?t(r):r))return n}let r=this.state.plugins;if(r)for(let o=0;o<r.length;o++){let i=r[o].props[e];if(null!=i&&(n=t?t(i):i))return n}}hasFocus(){if(Zi){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(gs)return e.focus(gs);let t=fs(e);e.focus(null==gs?{get preventScroll(){return gs={preventScroll:!0},!0}}:void 0),gs||(gs=!1,ms(t,0))}(this.dom),na(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return bs(this,e)}coordsAtPos(e,t=1){return Ns(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let o=this.docView.posFromDOM(e,t,n);if(null==o)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return Is(this,t||this.state,e)}pasteHTML(e,t){return al(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return al(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Sa(this,e)}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],_l(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Pi=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){za(e,t)||!Va[t.type]||!e.editable&&t.type in ja||Va[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?ns&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Ll(e,n)}let n;function o(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",o,!0),n?Ll(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Wl(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[gl.node(0,e.state.doc.content.size,t)]}function Ul(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:gl.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Kl(e){return!e.someProp("editable",t=>!1===t(e.state))}function Gl(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function Jl(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function Zl(e,t){return e.meta={package:"@milkdown/core",group:"System",...t},e}ql.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};var Xl={text:(e,t,n,o)=>{const r=e.value;return/^[^*_\\]*\s+$/.test(r)?r:n.safe(r,{...o,encode:[]})},strong:(e,t,n,o)=>{const r=e.marker||n.options.strong||"*",i=n.enter("strong"),s=n.createTracker(o);let a=s.move(r+r);return a+=s.move(n.containerPhrasing(e,{before:a,after:r,...s.current()})),a+=s.move(r+r),i(),a},emphasis:(e,t,n,o)=>{const r=e.marker||n.options.emphasis||"*",i=n.enter("emphasis"),s=n.createTracker(o);let a=s.move(r);return a+=s.move(n.containerPhrasing(e,{before:a,after:r,...s.current()})),a+=s.move(r),i(),a}},Yl=Tt({},"editorView"),Ql=Tt({},"editorState"),ec=Tt([],"initTimer"),tc=Tt({},"editor"),nc=Tt([],"inputRules"),oc=Tt([],"prosePlugins"),rc=Tt([],"remarkPlugins"),ic=Tt([],"nodeView"),sc=Tt([],"markView"),ac=Tt(Y().use(Q).use(Vt),"remark"),lc=Tt({handlers:Xl,encode:[]},"remarkStringifyOptions"),cc=Lt("ConfigReady");var dc=Lt("InitReady");function uc(e){const t=t=>(t.inject(tc,e).inject(oc,[]).inject(rc,[]).inject(nc,[]).inject(ic,[]).inject(sc,[]).inject(lc,{handlers:Xl,encode:[]}).inject(ac,Y().use(Q).use(Vt)).inject(ec,[cc]).record(dc),async()=>{await t.waitTimers(ec);const e=t.get(lc);return t.set(ac,Y().use(Q).use(Vt,e)),t.done(dc),()=>{t.remove(tc).remove(oc).remove(rc).remove(nc).remove(ic).remove(sc).remove(lc).remove(ac).remove(ec).clearTimer(dc)}});return Zl(t,{displayName:"Init"}),t}var pc=Lt("SchemaReady"),hc=Tt([],"schemaTimer"),fc=Tt({},"schema"),mc=Tt([],"nodes"),gc=Tt([],"marks");function vc(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}var yc=e=>(e.inject(fc,{}).inject(mc,[]).inject(gc,[]).inject(hc,[dc]).record(pc),async()=>{await e.waitTimers(hc);const t=e.get(ac),n=e.get(rc).reduce((e,t)=>e.use(t.plugin,t.options),t);e.set(ac,n);const o=new Dn({nodes:Object.fromEntries(e.get(mc).map(([e,t])=>[e,vc(t)])),marks:Object.fromEntries(e.get(gc).map(([e,t])=>[e,vc(t)]))});return e.set(fc,o),e.done(pc),()=>{e.remove(fc).remove(mc).remove(gc).remove(hc).clearTimer(pc)}});Zl(yc,{displayName:"Schema"});var wc=class{constructor(){this.setCtx=e=>{this.#R=e},this.chain=()=>{if(null==this.#R)throw St();const e=this.#R,t=[],n=this.get.bind(this),o={run:()=>{const n=Sr(...t),o=e.get(Yl);return n(o.state,o.dispatch,o)},inline:e=>(t.push(e),o),pipe:function(e,r){const i=n(e);return t.push(i(r)),o}.bind(this)};return o}}#r=new Et;#R=null;get ctx(){return this.#R}create(e,t){const n=e.create(this.#r.sliceMap);return n.set(t),n}get(e){return this.#r.get(e).get()}remove(e){return this.#r.remove(e)}call(e,t){if(null==this.#R)throw St();const n=this.get(e)(t),o=this.#R.get(Yl);return n(o.state,o.dispatch,o)}inline(e){if(null==this.#R)throw St();const t=this.#R.get(Yl);return e(t.state,t.dispatch,t)}};var bc=Tt(new wc,"commands"),kc=Tt([pc],"commandsTimer"),Cc=Lt("CommandsReady"),xc=e=>{const t=new wc;return t.setCtx(e),e.inject(bc,t).inject(kc,[pc]).record(Cc),async()=>(await e.waitTimers(kc),e.done(Cc),()=>{e.remove(bc).remove(kc).clearTimer(Cc)})};Zl(xc,{displayName:"Commands"});var Nc=class{constructor(){this.setCtx=e=>{this.#R=e},this.add=e=>(this.#P.push(e),()=>{this.#P=this.#P.filter(t=>t!==e)}),this.addObjectKeymap=e=>{const t=[];return Object.entries(e).forEach(([e,n])=>{if("function"==typeof n){const o={key:e,onRun:()=>n};this.#P.push(o),t.push(()=>{this.#P=this.#P.filter(e=>e!==o)})}else this.#P.push(n),t.push(()=>{this.#P=this.#P.filter(e=>e!==n)})}),()=>{t.forEach(e=>e())}},this.addBaseKeymap=()=>{const e=function(e){return e.Backspace=Sr(Ir,ar,dr,pr),e}(Tr);return this.addObjectKeymap(e)},this.build=()=>{const e={};return this.#P.forEach(t=>{e[t.key]=[...e[t.key]||[],t]}),Object.fromEntries(Object.entries(e).map(([e,t])=>{const n=t.sort((e,t)=>(t.priority??50)-(e.priority??50));return[e,(e,t,o)=>{const r=this.#R;if(null==r)throw Ct();return Sr(...n.map(e=>e.onRun(r)))(e,t,o)}]}))}}#R=null;#P=[];get ctx(){return this.#R}},Sc=Tt(new Nc,"keymap"),Oc=Tt([pc],"keymapTimer"),Ec=Lt("KeymapReady"),Mc=e=>{const t=new Nc;return t.setCtx(e),e.inject(Sc,t).inject(Oc,[pc]).record(Ec),async()=>(await e.waitTimers(Oc),e.done(Ec),()=>{e.remove(Sc).remove(Oc).clearTimer(Ec)})},_c=Lt("ParserReady"),Tc=()=>{throw Ct()},Dc=Tt(Tc,"parser"),Ic=Tt([],"parserTimer"),Ac=e=>(e.inject(Dc,Tc).inject(Ic,[pc]).record(_c),async()=>{await e.waitTimers(Ic);const t=e.get(ac),n=e.get(fc);return e.set(Dc,Ti.create(n,t)),e.done(_c),()=>{e.remove(Dc).remove(Ic).clearTimer(_c)}});Zl(Ac,{displayName:"Parser"});var Rc=Lt("SerializerReady"),Pc=Tt([],"serializerTimer"),Lc=()=>{throw Ct()},Vc=Tt(Lc,"serializer"),jc=e=>(e.inject(Vc,Lc).inject(Pc,[pc]).record(Rc),async()=>{await e.waitTimers(Pc);const t=e.get(ac),n=e.get(fc);return e.set(Vc,Ii.create(n,t)),e.done(Rc),()=>{e.remove(Vc).remove(Pc).clearTimer(Rc)}});Zl(jc,{displayName:"Serializer"});var $c=Tt("","defaultValue"),Bc=Tt(e=>e,"stateOptions"),Hc=Tt([],"editorStateTimer"),Fc=Lt("EditorStateReady");function zc(e,t,n){if("string"==typeof e)return t(e);if("html"===e.type)return An.fromSchema(n).parse(e.dom);if("json"===e.type)return pn.fromJSON(n,e.value);throw o=e,new wt(yt.docTypeError,`Doc type error, unsupported type: ${kt(o)}`);var o}var qc=new sr("MILKDOWN_STATE_TRACKER"),Wc=e=>(e.inject($c,"").inject(Ql,{}).inject(Bc,e=>e).inject(Hc,[_c,Rc,Cc,Ec]).record(Fc),async()=>{await e.waitTimers(Hc);const t=e.get(fc),n=e.get(Dc),o=e.get(nc),r=e.get(Bc),i=e.get(oc),s=zc(e.get($c),n,t),a=e.get(Sc),l=a.addBaseKeymap(),c=[...i,new or({key:qc,state:{init:()=>{},apply:(t,n,o,r)=>{e.set(Ql,r)}}}),oi({rules:o}),Si(a.build())];e.set(oc,c);const d=r({schema:t,doc:s,plugins:c}),u=tr.create(d);return e.set(Ql,u),e.done(Fc),()=>{l(),e.remove($c).remove(Ql).remove(Bc).remove(Hc).clearTimer(Fc)}});Zl(Wc,{displayName:"EditorState"});var Uc=Tt([],"pasteRule"),Kc=Tt([pc],"pasteRuleTimer"),Gc=Lt("PasteRuleReady"),Jc=e=>(e.inject(Uc,[]).inject(Kc,[pc]).record(Gc),async()=>(await e.waitTimers(Kc),e.done(Gc),()=>{e.remove(Uc).remove(Kc).clearTimer(Gc)}));Zl(Jc,{displayName:"PasteRule"});var Zc=Lt("EditorViewReady"),Xc=Tt([],"editorViewTimer"),Yc=Tt({},"editorViewOptions"),Qc=Tt(null,"root"),ed=Tt(null,"rootDOM"),td=Tt({},"rootAttrs");var nd=new sr("MILKDOWN_VIEW_CLEAR"),od=e=>(e.inject(Qc,document.body).inject(Yl,{}).inject(Yc,{}).inject(ed,null).inject(td,{}).inject(Xc,[Fc,Gc]).record(Zc),async()=>{await e.wait(dc);const t=e.get(Qc)||document.body,n="string"==typeof t?document.querySelector(t):t;e.update(oc,t=>[new or({key:nd,view:t=>{const o=n?function(e,t){const n=document.createElement("div");n.className="milkdown",e.appendChild(n),t.set(ed,n);const o=t.get(td);return Object.entries(o).forEach(([e,t])=>n.setAttribute(e,t)),n}(n,e):void 0;return(()=>{if(o&&n){const e=t.dom;n.replaceChild(o,e),o.appendChild(e)}})(),{destroy:()=>{o?.parentNode&&o?.parentNode.replaceChild(t.dom,o),o?.remove()}}}}),...t]),await e.waitTimers(Xc);const o=e.get(Ql),r=e.get(Yc),i=new ql(n,{state:o,nodeViews:Object.fromEntries(e.get(ic)),markViews:Object.fromEntries(e.get(sc)),transformPasted:(t,n,o)=>(e.get(Uc).sort((e,t)=>(t.priority??50)-(e.priority??50)).map(e=>e.run).forEach(e=>{t=e(t,n,o)}),t),...r});var s;return(s=i.dom).classList.add("editor"),s.setAttribute("role","textbox"),e.set(Yl,i),e.done(Zc),()=>{i?.destroy(),e.remove(Qc).remove(Yl).remove(Yc).remove(ed).remove(td).remove(Xc).clearTimer(Zc)}});Zl(od,{displayName:"EditorView"});var rd=function(e){return e.Idle="Idle",e.OnCreate="OnCreate",e.Created="Created",e.OnDestroy="OnDestroy",e.Destroyed="Destroyed",e}({}),id=class e{constructor(){this.enableInspector=(e=!0)=>(this.#L=e,this),this.onStatusChange=e=>(this.#V=e,this),this.config=e=>(this.#j.push(e),this),this.removeConfig=e=>(this.#j=this.#j.filter(t=>t!==e),this),this.use=e=>{const t=[e].flat();return t.flat().forEach(e=>{this.#$.set(e,{ctx:void 0,handler:void 0,cleanup:void 0})}),this.#g===rd.Created&&this.#B(t,this.#$),this},this.remove=async e=>this.#g===rd.OnCreate?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await this.#H([e].flat(),!0),this),this.create=async()=>(this.#g===rd.OnCreate||(this.#g===rd.Created&&await this.destroy(),this.#F(rd.OnCreate),this.#z(),this.#B([...this.#$.keys()],this.#$),await Promise.all([this.#q(this.#W),this.#q(this.#$)].flat()),this.#F(rd.Created)),this),this.destroy=async(e=!1)=>this.#g===rd.Destroyed||this.#g===rd.OnDestroy?this:this.#g===rd.OnCreate?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&(this.#j=[]),this.#F(rd.OnDestroy),await this.#H([...this.#$.keys()],e),await this.#U(),this.#F(rd.Destroyed),this),this.action=e=>e(this.#R),this.inspect=()=>this.#L?[...this.#W.values(),...this.#$.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>Boolean(e)):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new e}#L=!1;#g=rd.Idle;#j=[];#V=()=>{};#r=new Et;#i=new At;#$=new Map;#W=new Map;#R=new It(this.#r,this.#i);#z=()=>{const e=function(e){const t=t=>(t.record(cc),async()=>(await e(t),t.done(cc),()=>{t.clearTimer(cc)}));return Zl(t,{displayName:"Config"}),t}(async e=>{await Promise.all(this.#j.map(t=>Promise.resolve(t(e))))}),t=[yc,Ac,jc,xc,Mc,Jc,Wc,od,uc(this),e];this.#B(t,this.#W)};#B=(e,t)=>{e.forEach(e=>{const n=this.#R.produce(this.#L?e.meta:void 0),o=e(n);t.set(e,{ctx:n,handler:o,cleanup:void 0})})};#H=(e,t=!1)=>Promise.all([e].flat().map(async e=>{const n=this.#$.get(e)?.cleanup;return t?this.#$.delete(e):this.#$.set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),"function"==typeof n?n():n}));#U=async()=>{await Promise.all([...this.#W.entries()].map(async([e,{cleanup:t}])=>"function"==typeof t?t():t)),this.#W.clear()};#F=e=>{this.#g=e,this.#V(e)};#q=e=>[...e.entries()].map(async([t,n])=>{const{ctx:o,handler:r}=n;if(!r)return;const i=await r();e.set(t,{ctx:o,handler:r,cleanup:i})});get ctx(){return this.#R}get status(){return this.#g}};let sd=e=>crypto.getRandomValues(new Uint8Array(e)),ad=(e,t=21)=>((e,t,n)=>{let o=(2<<Math.log2(e.length-1))-1,r=-~(1.6*o*t/e.length);return(i=t)=>{let s="";for(;;){let t=n(r),a=0|r;for(;a--;)if(s+=e[t[a]&o]||"",s.length>=i)return s}}})(e,0|t,sd);function ld(e,t){const n=function(e="cmdKey"){return Tt(()=>()=>!1,e)}(e),o=r=>async()=>{o.key=n,await r.wait(Cc);const i=t(r);return r.get(bc).create(n,i),o.run=t=>r.get(bc).call(e,t),()=>{r.get(bc).remove(n)}};return o}function cd(e){const t=n=>async()=>{await n.wait(pc);const o=e(n);return n.update(nc,e=>[...e,o]),t.inputRule=o,()=>{n.update(nc,e=>e.filter(e=>e!==o))}};return t}function dd(e,t){const n=o=>async()=>{const r=t(o);return o.update(gc,t=>[...t.filter(t=>t[0]!==e),[e,r]]),n.id=e,n.schema=r,()=>{o.update(gc,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{const n=t.get(fc).marks[e];if(!n)throw o=e,new wt(yt.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${o}" in schema.`);var o;return n},n}function ud(e,t){const n=o=>async()=>{const r=t(o);return o.update(mc,t=>[...t.filter(t=>t[0]!==e),[e,r]]),n.id=e,n.schema=r,()=>{o.update(mc,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{const n=t.get(fc).nodes[e];if(!n)throw Ot(e);return n},n}function pd(e){let t;const n=n=>async()=>(await n.wait(pc),t=e(n),n.update(oc,e=>[...e,t]),()=>{n.update(oc,e=>e.filter(e=>e!==t))});return n.plugin=()=>t,n.key=()=>t.spec.key,n}function hd(e){const t=n=>async()=>{await n.wait(Ec);const o=n.get(Sc),r=e(n),i=o.addObjectKeymap(r);return t.keymap=r,()=>{i()}};return t}function fd(e,t){const n=o=>async()=>{await o.wait(pc);const r=t(o);return e.type(o)instanceof Mn?o.update(ic,t=>[...t,[e.id,r]]):o.update(sc,t=>[...t,[e.id,r]]),n.view=r,n.type=e,()=>{e.type(o)instanceof Mn?o.update(ic,t=>t.filter(t=>t[0]!==e.id)):o.update(sc,t=>t.filter(t=>t[0]!==e.id))}};return n}function md(e,t){const n=Tt(e,t),o=e=>(e.inject(n),()=>()=>{e.remove(n)});return o.key=n,o}function gd(e,t){const n=md(t,e),o=ud(e,e=>e.get(n.key)(e)),r=[n,o];return r.id=o.id,r.node=o,r.type=e=>o.type(e),r.ctx=n,r.key=n.key,r.extendSchema=n=>gd(e,n(t)),r}function vd(e,t){const n=md(t,e),o=dd(e,e=>e.get(n.key)(e)),r=[n,o];return r.id=o.id,r.mark=o,r.type=e=>o.type(e),r.ctx=n,r.key=n.key,r.extendSchema=n=>vd(e,n(t)),r}function yd(e,t){const n=md(Object.fromEntries(Object.entries(t).map(([e,{shortcuts:t,priority:n}])=>[e,{shortcuts:t,priority:n}])),`${e}Keymap`),o=hd(e=>{const o=e.get(n.key),r=Object.entries(t).flatMap(([e,{command:t}])=>{const n=o[e],r=[n.shortcuts].flat(),i=n.priority;return r.map(e=>[e,{key:e,onRun:t,priority:i}])});return Object.fromEntries(r)}),r=[n,o];return r.ctx=n,r.shortcuts=o,r.key=n.key,r.keymap=o.keymap,r}ad("abcedfghicklmn",10);var wd=(e,t=()=>({}))=>md(t,`${e}Attr`),bd=(e,t=()=>({}))=>md(t,`${e}Attr`);function kd(e,t,n){const o=md({},e),r=e=>async()=>{await e.wait(dc);const n={plugin:t(e),options:e.get(o.key)};return e.update(rc,e=>[...e,n]),()=>{e.update(rc,e=>e.filter(e=>e!==n))}},i=[o,r];return i.id=e,i.plugin=r,i.options=o,i}function Cd(e){return e=>{const t=e.get(Yl);e.get(fc);return e.get(Vc)(t.state.doc)}}var xd=ue({});var Nd=()=>{const e=function(){const{dom:e,editor:t,setLoading:n,editorFactory:o}=pe(xd),r=le(null);return me(()=>{const i=r.current;if(!o)return;if(!i)return;e.current=i;const s=o(i);return s?(n(!0),s.create().then(e=>{t.current=e}).finally(()=>{n(!1)}).catch(console.error),()=>{s.destroy().catch(console.error)}):void 0},[e,t,o,n]),r}();return ae.createElement("div",{"data-milkdown-root":!0,ref:e})},Sd=({children:e})=>{const t=le(void 0),[n,o]=ce(void 0),r=le(void 0),[i,s]=ce(!0),a=de(()=>({loading:i,dom:t,editor:r,setLoading:s,editorFactory:n,setEditorFactory:o}),[i,n]);return ae.createElement(xd.Provider,{value:a},e)};function Od(){const e=pe(xd),t=he(()=>e.editor.current,[e.editor]);return[e.loading,t]}function Ed(e){return new p(h.define(e))}function Md(e){return import("./index-Ck9BxS1f.js").then(t=>t.sql({dialect:t[e]}))}const _d=[u.of({name:"C",extensions:["c","h","ino"],load:()=>import("./index-CtTbnbzM.js").then(e=>e.cpp())}),u.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:()=>import("./index-CtTbnbzM.js").then(e=>e.cpp())}),u.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load:()=>Md("Cassandra")}),u.of({name:"CSS",extensions:["css"],load:()=>import("./index-CB1_GL3t.js").then(e=>e.css())}),u.of({name:"Go",extensions:["go"],load:()=>import("./index-C9_5xd3V.js").then(e=>e.go())}),u.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load:()=>import("./index-xaEdDd13.js").then(e=>e.html())}),u.of({name:"Java",extensions:["java"],load:()=>import("./index-CRfRlH9U.js").then(e=>e.java())}),u.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load:()=>import("./index-DSGuayJy.js").then(e=>e.javascript())}),u.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load:()=>import("./index-BR16hIbn.js").then(e=>e.jinja())}),u.of({name:"JSON",alias:["json5"],extensions:["json","map"],load:()=>import("./index-QhLowdpF.js").then(e=>e.json())}),u.of({name:"JSX",extensions:["jsx"],load:()=>import("./index-DSGuayJy.js").then(e=>e.javascript({jsx:!0}))}),u.of({name:"LESS",extensions:["less"],load:()=>import("./index-Ccq-5wm6.js").then(e=>e.less())}),u.of({name:"Liquid",extensions:["liquid"],load:()=>import("./index--PWk-3Ol.js").then(e=>e.liquid())}),u.of({name:"MariaDB SQL",load:()=>Md("MariaSQL")}),u.of({name:"Markdown",extensions:["md","markdown","mkd"],load:()=>import("./index-Bw2EofiE.js").then(e=>e.markdown())}),u.of({name:"MS SQL",load:()=>Md("MSSQL")}),u.of({name:"MySQL",load:()=>Md("MySQL")}),u.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load:()=>import("./index-DAJdettS.js").then(e=>e.php())}),u.of({name:"PLSQL",extensions:["pls"],load:()=>Md("PLSQL")}),u.of({name:"PostgreSQL",load:()=>Md("PostgreSQL")}),u.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load:()=>import("./index-B3fb7Ita.js").then(e=>e.python())}),u.of({name:"Rust",extensions:["rs"],load:()=>import("./index-D5NvcxPc.js").then(e=>e.rust())}),u.of({name:"Sass",extensions:["sass"],load:()=>import("./index-D8zPYs0m.js").then(e=>e.sass({indented:!0}))}),u.of({name:"SCSS",extensions:["scss"],load:()=>import("./index-D8zPYs0m.js").then(e=>e.sass())}),u.of({name:"SQL",extensions:["sql"],load:()=>Md("StandardSQL")}),u.of({name:"SQLite",load:()=>Md("SQLite")}),u.of({name:"TSX",extensions:["tsx"],load:()=>import("./index-DSGuayJy.js").then(e=>e.javascript({jsx:!0,typescript:!0}))}),u.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load:()=>import("./index-DSGuayJy.js").then(e=>e.javascript({typescript:!0}))}),u.of({name:"WebAssembly",extensions:["wat","wast"],load:()=>import("./index-CQbc3KUq.js").then(e=>e.wast())}),u.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load:()=>import("./index-GoUUn3QE.js").then(e=>e.xml())}),u.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load:()=>import("./index-CpRfyO85.js").then(e=>e.yaml())}),u.of({name:"APL",extensions:["dyalog","apl"],load:()=>import("./apl-CXdQSnD-.js").then(e=>Ed(e.apl))}),u.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load:()=>import("./asciiarmor-D5V0T9Cu.js").then(e=>Ed(e.asciiArmor))}),u.of({name:"ASN.1",extensions:["asn","asn1"],load:()=>import("./asn1-DWPaVWf6.js").then(e=>Ed(e.asn1({})))}),u.of({name:"Asterisk",filename:/^extensions\.conf$/i,load:()=>import("./asterisk-B46aRdXb.js").then(e=>Ed(e.asterisk))}),u.of({name:"Brainfuck",extensions:["b","bf"],load:()=>import("./brainfuck-CtZaYBKt.js").then(e=>Ed(e.brainfuck))}),u.of({name:"Cobol",extensions:["cob","cpy"],load:()=>import("./cobol-stawOqaz.js").then(e=>Ed(e.cobol))}),u.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.csharp))}),u.of({name:"Clojure",extensions:["clj","cljc","cljx"],load:()=>import("./clojure-DiuoqK-z.js").then(e=>Ed(e.clojure))}),u.of({name:"ClojureScript",extensions:["cljs"],load:()=>import("./clojure-DiuoqK-z.js").then(e=>Ed(e.clojure))}),u.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load:()=>import("./css-C4GSMmGA.js").then(e=>Ed(e.gss))}),u.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:()=>import("./cmake-DXn5xaP-.js").then(e=>Ed(e.cmake))}),u.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load:()=>import("./coffeescript-BTDxI-eT.js").then(e=>Ed(e.coffeeScript))}),u.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load:()=>import("./commonlisp-vq6DHwts.js").then(e=>Ed(e.commonLisp))}),u.of({name:"Cypher",extensions:["cyp","cypher"],load:()=>import("./cypher-gJDei3ni.js").then(e=>Ed(e.cypher))}),u.of({name:"Cython",extensions:["pyx","pxd","pxi"],load:()=>import("./python-On6Xi21R.js").then(e=>Ed(e.cython))}),u.of({name:"Crystal",extensions:["cr"],load:()=>import("./crystal-CRzZ78HM.js").then(e=>Ed(e.crystal))}),u.of({name:"D",extensions:["d"],load:()=>import("./d-BShv7fp-.js").then(e=>Ed(e.d))}),u.of({name:"Dart",extensions:["dart"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.dart))}),u.of({name:"diff",extensions:["diff","patch"],load:()=>import("./diff-UJJ5BM9S.js").then(e=>Ed(e.diff))}),u.of({name:"Dockerfile",filename:/^Dockerfile$/,load:()=>import("./dockerfile-DVQ9Q8O9.js").then(e=>Ed(e.dockerFile))}),u.of({name:"DTD",extensions:["dtd"],load:()=>import("./dtd-DI9Herc-.js").then(e=>Ed(e.dtd))}),u.of({name:"Dylan",extensions:["dylan","dyl","intr"],load:()=>import("./dylan-DkEP81N9.js").then(e=>Ed(e.dylan))}),u.of({name:"EBNF",load:()=>import("./ebnf-B-Df8AvO.js").then(e=>Ed(e.ebnf))}),u.of({name:"ECL",extensions:["ecl"],load:()=>import("./ecl-DPFc0Uaf.js").then(e=>Ed(e.ecl))}),u.of({name:"edn",extensions:["edn"],load:()=>import("./clojure-DiuoqK-z.js").then(e=>Ed(e.clojure))}),u.of({name:"Eiffel",extensions:["e"],load:()=>import("./eiffel-DR5c0IrL.js").then(e=>Ed(e.eiffel))}),u.of({name:"Elm",extensions:["elm"],load:()=>import("./elm-DompmV0j.js").then(e=>Ed(e.elm))}),u.of({name:"Erlang",extensions:["erl"],load:()=>import("./erlang-BuqgqA5h.js").then(e=>Ed(e.erlang))}),u.of({name:"Esper",load:()=>import("./sql-ByLYq2fX.js").then(e=>Ed(e.esper))}),u.of({name:"Factor",extensions:["factor"],load:()=>import("./factor-Bk9_H-XT.js").then(e=>Ed(e.factor))}),u.of({name:"FCL",load:()=>import("./fcl-CVaBTCzQ.js").then(e=>Ed(e.fcl))}),u.of({name:"Forth",extensions:["forth","fth","4th"],load:()=>import("./forth-POgR1ypr.js").then(e=>Ed(e.forth))}),u.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load:()=>import("./fortran-DL7KluxX.js").then(e=>Ed(e.fortran))}),u.of({name:"F#",alias:["fsharp"],extensions:["fs"],load:()=>import("./mllike-3c2dg9RT.js").then(e=>Ed(e.fSharp))}),u.of({name:"Gas",extensions:["s"],load:()=>import("./gas-8mz5Q3qN.js").then(e=>Ed(e.gas))}),u.of({name:"Gherkin",extensions:["feature"],load:()=>import("./gherkin-B6X1vGSW.js").then(e=>Ed(e.gherkin))}),u.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:()=>import("./groovy-DnIzCrpZ.js").then(e=>Ed(e.groovy))}),u.of({name:"Haskell",extensions:["hs"],load:()=>import("./haskell-CLQs6EAM.js").then(e=>Ed(e.haskell))}),u.of({name:"Haxe",extensions:["hx"],load:()=>import("./haxe-D25e-2l-.js").then(e=>Ed(e.haxe))}),u.of({name:"HXML",extensions:["hxml"],load:()=>import("./haxe-D25e-2l-.js").then(e=>Ed(e.hxml))}),u.of({name:"HTTP",load:()=>import("./http-BKJkqRj4.js").then(e=>Ed(e.http))}),u.of({name:"IDL",extensions:["pro"],load:()=>import("./idl-pcmmZuaN.js").then(e=>Ed(e.idl))}),u.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load:()=>import("./javascript-BVaBnk3P.js").then(e=>Ed(e.jsonld))}),u.of({name:"Julia",extensions:["jl"],load:()=>import("./julia-DjdwvFuI.js").then(e=>Ed(e.julia))}),u.of({name:"Kotlin",extensions:["kt","kts"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.kotlin))}),u.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load:()=>import("./livescript-HO6ttBFx.js").then(e=>Ed(e.liveScript))}),u.of({name:"Lua",extensions:["lua"],load:()=>import("./lua-8DXOpKDz.js").then(e=>Ed(e.lua))}),u.of({name:"mIRC",extensions:["mrc"],load:()=>import("./mirc-DkvFAiy5.js").then(e=>Ed(e.mirc))}),u.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load:()=>import("./mathematica-IIbmv7SK.js").then(e=>Ed(e.mathematica))}),u.of({name:"Modelica",extensions:["mo"],load:()=>import("./modelica-DSrSSXCg.js").then(e=>Ed(e.modelica))}),u.of({name:"MUMPS",extensions:["mps"],load:()=>import("./mumps-zvxmGV4l.js").then(e=>Ed(e.mumps))}),u.of({name:"Mbox",extensions:["mbox"],load:()=>import("./mbox-z_N2Mo3d.js").then(e=>Ed(e.mbox))}),u.of({name:"Nginx",filename:/nginx.*\.conf$/i,load:()=>import("./nginx-B4hAVlXN.js").then(e=>Ed(e.nginx))}),u.of({name:"NSIS",extensions:["nsh","nsi"],load:()=>import("./nsis-Cx8FAvMN.js").then(e=>Ed(e.nsis))}),u.of({name:"NTriples",extensions:["nt","nq"],load:()=>import("./ntriples-BSwWqoLa.js").then(e=>Ed(e.ntriples))}),u.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.objectiveC))}),u.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.objectiveCpp))}),u.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load:()=>import("./mllike-3c2dg9RT.js").then(e=>Ed(e.oCaml))}),u.of({name:"Octave",extensions:["m"],load:()=>import("./octave-C4hdQ5Hf.js").then(e=>Ed(e.octave))}),u.of({name:"Oz",extensions:["oz"],load:()=>import("./oz-qQq7irPq.js").then(e=>Ed(e.oz))}),u.of({name:"Pascal",extensions:["p","pas"],load:()=>import("./pascal-CafrKXZF.js").then(e=>Ed(e.pascal))}),u.of({name:"Perl",extensions:["pl","pm"],load:()=>import("./perl-tdMlh9QA.js").then(e=>Ed(e.perl))}),u.of({name:"Pig",extensions:["pig"],load:()=>import("./pig-CwGJVRC4.js").then(e=>Ed(e.pig))}),u.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load:()=>import("./powershell-D1ly3AHC.js").then(e=>Ed(e.powerShell))}),u.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load:()=>import("./properties-_nPj978X.js").then(e=>Ed(e.properties))}),u.of({name:"ProtoBuf",extensions:["proto"],load:()=>import("./protobuf-B4y9do6W.js").then(e=>Ed(e.protobuf))}),u.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load:()=>import("./pug-Dlfivyh-.js").then(e=>Ed(e.pug))}),u.of({name:"Puppet",extensions:["pp"],load:()=>import("./puppet-Bc-yJKzi.js").then(e=>Ed(e.puppet))}),u.of({name:"Q",extensions:["q"],load:()=>import("./q-mUfi2b_o.js").then(e=>Ed(e.q))}),u.of({name:"R",alias:["rscript"],extensions:["r","R"],load:()=>import("./r-BA4EbLKE.js").then(e=>Ed(e.r))}),u.of({name:"RPM Changes",load:()=>import("./rpm-DI_rRufH.js").then(e=>Ed(e.rpmChanges))}),u.of({name:"RPM Spec",extensions:["spec"],load:()=>import("./rpm-DI_rRufH.js").then(e=>Ed(e.rpmSpec))}),u.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load:()=>import("./ruby-CR-u2WLS.js").then(e=>Ed(e.ruby))}),u.of({name:"SAS",extensions:["sas"],load:()=>import("./sas-Bqaci40L.js").then(e=>Ed(e.sas))}),u.of({name:"Scala",extensions:["scala"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.scala))}),u.of({name:"Scheme",extensions:["scm","ss"],load:()=>import("./scheme-qjP0V5Ag.js").then(e=>Ed(e.scheme))}),u.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:()=>import("./shell-BLav31RL.js").then(e=>Ed(e.shell))}),u.of({name:"Sieve",extensions:["siv","sieve"],load:()=>import("./sieve-r025o_jW.js").then(e=>Ed(e.sieve))}),u.of({name:"Smalltalk",extensions:["st"],load:()=>import("./smalltalk-C7J3IyEP.js").then(e=>Ed(e.smalltalk))}),u.of({name:"Solr",load:()=>import("./solr-78MBEUkU.js").then(e=>Ed(e.solr))}),u.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load:()=>import("./mllike-3c2dg9RT.js").then(e=>Ed(e.sml))}),u.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load:()=>import("./sparql-BRLJFz69.js").then(e=>Ed(e.sparql))}),u.of({name:"Spreadsheet",alias:["excel","formula"],load:()=>import("./spreadsheet-CGlWr0eM.js").then(e=>Ed(e.spreadsheet))}),u.of({name:"Squirrel",extensions:["nut"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.squirrel))}),u.of({name:"Stylus",extensions:["styl"],load:()=>import("./stylus-Bdo_Aemu.js").then(e=>Ed(e.stylus))}),u.of({name:"Swift",extensions:["swift"],load:()=>import("./swift-B_XXVlXX.js").then(e=>Ed(e.swift))}),u.of({name:"sTeX",load:()=>Promise.resolve().then(function(){return Id}).then(e=>Ed(e.stex))}),u.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load:()=>Promise.resolve().then(function(){return Id}).then(e=>Ed(e.stex))}),u.of({name:"SystemVerilog",extensions:["v","sv","svh"],load:()=>import("./verilog-C8nH2N0M.js").then(e=>Ed(e.verilog))}),u.of({name:"Tcl",extensions:["tcl"],load:()=>import("./tcl-B2fODqDH.js").then(e=>Ed(e.tcl))}),u.of({name:"Textile",extensions:["textile"],load:()=>import("./textile-BuVhTOzU.js").then(e=>Ed(e.textile))}),u.of({name:"TiddlyWiki",load:()=>import("./tiddlywiki-BgR6AEZu.js").then(e=>Ed(e.tiddlyWiki))}),u.of({name:"Tiki wiki",load:()=>import("./tiki-CI-ztowC.js").then(e=>Ed(e.tiki))}),u.of({name:"TOML",extensions:["toml"],load:()=>import("./toml-BVJm5Fzd.js").then(e=>Ed(e.toml))}),u.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load:()=>import("./troff-Ce85hlLp.js").then(e=>Ed(e.troff))}),u.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load:()=>import("./ttcn-BxnYHtq8.js").then(e=>Ed(e.ttcn))}),u.of({name:"TTCN_CFG",extensions:["cfg"],load:()=>import("./ttcn-cfg-CKJxb-l2.js").then(e=>Ed(e.ttcnCfg))}),u.of({name:"Turtle",extensions:["ttl"],load:()=>import("./turtle-BkSuIpt-.js").then(e=>Ed(e.turtle))}),u.of({name:"Web IDL",extensions:["webidl"],load:()=>import("./webidl-CGwyPRYs.js").then(e=>Ed(e.webIDL))}),u.of({name:"VB.NET",extensions:["vb"],load:()=>import("./vb-BHgjm0DN.js").then(e=>Ed(e.vb))}),u.of({name:"VBScript",extensions:["vbs"],load:()=>import("./vbscript-VzWlGt02.js").then(e=>Ed(e.vbScript))}),u.of({name:"Velocity",extensions:["vtl"],load:()=>import("./velocity-BdD_26Jv.js").then(e=>Ed(e.velocity))}),u.of({name:"Verilog",extensions:["v"],load:()=>import("./verilog-C8nH2N0M.js").then(e=>Ed(e.verilog))}),u.of({name:"VHDL",extensions:["vhd","vhdl"],load:()=>import("./vhdl-CWWH2SUo.js").then(e=>Ed(e.vhdl))}),u.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load:()=>import("./xquery-CVDBqZPY.js").then(e=>Ed(e.xQuery))}),u.of({name:"Yacas",extensions:["ys"],load:()=>import("./yacas-I8QjZlxf.js").then(e=>Ed(e.yacas))}),u.of({name:"Z80",extensions:["z80"],load:()=>import("./z80-DMVFMNEx.js").then(e=>Ed(e.z80))}),u.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load:()=>import("./mscgen-B2igx18G.js").then(e=>Ed(e.mscgen))}),u.of({name:"Xù",extensions:["xu"],load:()=>import("./mscgen-B2igx18G.js").then(e=>Ed(e.xu))}),u.of({name:"MsGenny",extensions:["msgenny"],load:()=>import("./mscgen-B2igx18G.js").then(e=>Ed(e.msgenny))}),u.of({name:"Vue",extensions:["vue"],load:()=>import("./index-Y09lLL_e.js").then(e=>e.vue())}),u.of({name:"Angular Template",load:()=>import("./index-D_AOS7Yx.js").then(e=>e.angular())})];function Td(e){function t(e,t){e.cmdState.push(t)}function n(e){return e.cmdState.length>0?e.cmdState[e.cmdState.length-1]:null}function o(e,t,n){return function(){this.name=e,this.bracketNo=0,this.style=t,this.styles=n,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var r={};function i(e,t){e.f=t}function s(e,o){var s;if(e.match(/^\\[a-zA-Z@\xc0-\u1fff\u2060-\uffff]+/)){var c=e.current().slice(1);return t(o,s=new(s=r.hasOwnProperty(c)?r[c]:r.DEFAULT)),i(o,l),s.style}if(e.match(/^\\[$&%#{}_]/))return"tag";if(e.match(/^\\[,;!\/\\]/))return"tag";if(e.match("\\["))return i(o,function(e,t){return a(e,t,"\\]")}),"keyword";if(e.match("\\("))return i(o,function(e,t){return a(e,t,"\\)")}),"keyword";if(e.match("$$"))return i(o,function(e,t){return a(e,t,"$$")}),"keyword";if(e.match("$"))return i(o,function(e,t){return a(e,t,"$")}),"keyword";var d=e.next();return"%"==d?(e.skipToEnd(),"comment"):"}"==d||"]"==d?(s=n(o))?(s.closeBracket(d),i(o,l),"bracket"):"error":"{"==d||"["==d?(t(o,s=new(s=r.DEFAULT)),"bracket"):/\d/.test(d)?(e.eatWhile(/[\w.%]/),"atom"):(e.eatWhile(/[\w\-_]/),s=function(e){for(var t=e.cmdState,n=t.length-1;n>=0;n--){var o=t[n];if("DEFAULT"!=o.name)return o}return{styleIdentifier:function(){return null}}}(o),"begin"==s.name&&(s.argument=e.current()),s.styleIdentifier())}function a(e,t,n){if(e.eatSpace())return null;if(n&&e.match(n))return i(t,s),"keyword";if(e.match(/^\\[a-zA-Z@]+/))return"tag";if(e.match(/^[a-zA-Z]+/))return"variableName.special";if(e.match(/^\\[$&%#{}_]/))return"tag";if(e.match(/^\\[,;!\/]/))return"tag";if(e.match(/^[\^_&]/))return"tag";if(e.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(e.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var o=e.next();return"{"==o||"}"==o||"["==o||"]"==o||"("==o||")"==o?"bracket":"%"==o?(e.skipToEnd(),"comment"):"error"}function l(e,t){var o=e.peek();return"{"==o||"["==o?(n(t).openBracket(o),e.eat(o),i(t,s),"bracket"):/[ \t\r]/.test(o)?(e.eat(o),null):(i(t,s),function(e){var t=e.cmdState.pop();t&&t.closeBracket()}(t),s(e,t))}return r.importmodule=o("importmodule","tag",["string","builtin"]),r.documentclass=o("documentclass","tag",["","atom"]),r.usepackage=o("usepackage","tag",["atom"]),r.begin=o("begin","tag",["atom"]),r.end=o("end","tag",["atom"]),r.label=o("label","tag",["atom"]),r.ref=o("ref","tag",["atom"]),r.eqref=o("eqref","tag",["atom"]),r.cite=o("cite","tag",["atom"]),r.bibitem=o("bibitem","tag",["atom"]),r.Bibitem=o("Bibitem","tag",["atom"]),r.RBibitem=o("RBibitem","tag",["atom"]),r.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}},{name:"stex",startState:function(){return{cmdState:[],f:e?function(e,t){return a(e,t)}:s}},copyState:function(e){return{cmdState:e.cmdState.slice(),f:e.f}},token:function(e,t){return t.f(e,t)},blankLine:function(e){e.f=s,e.cmdState.length=0},languageData:{commentTokens:{line:"%"}}}}const Dd=Td(!1);Td(!0);var Id=Object.freeze({__proto__:null,stex:Dd});function Ad(e){return function(t,n){let{$from:o,$to:r}=t.selection,i=o.blockRange(r,t=>t.childCount>0&&t.firstChild.type==e);return!!i&&(!n||(o.node(i.depth-1).type==e?function(e,t,n,o){let r=e.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new uo(i-1,s,i,s,new Kt(Ht.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new dn(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const a=mo(o);if(null==a)return!1;r.lift(o,a);let l=r.doc.resolve(r.mapping.map(i,-1)-1);ko(r.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&r.join(l.pos);return t(r.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let o=e.tr,r=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=r.child(t).nodeSize,o.delete(e-1,e+1);let i=o.doc.resolve(n.start),s=i.nodeAfter;if(o.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==r.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(a?0:1),d+1,s.content.append(l?Ht.empty:Ht.from(r))))return!1;let u=i.pos,p=u+s.nodeSize;return o.step(new uo(u-(a?1:0),p+(l?1:0),u+1,p-1,new Kt((a?Ht.empty:Ht.from(r.copy(Ht.empty))).append(l?Ht.empty:Ht.from(r.copy(Ht.empty))),a?0:1,l?0:1),a?0:1)),t(o.scrollIntoView()),!0}(t,n,i)))}}function Rd(e){return String(e||"").toUpperCase()}function Pd(){return function(e){const t=function(e){const t=new Map;if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return ee(e,"definition",function(e){const n=Rd(e.identifier);n&&!t.get(n)&&t.set(n,e)}),function(e){const n=Rd(e);return t.get(n)}}(e);ee(e,function(e,n,o){if("definition"===e.type&&void 0!==o&&"number"==typeof n)return o.children.splice(n,1),[te,n];if("imageReference"===e.type||"linkReference"===e.type){const r=t(e.identifier);if(r&&o&&"number"==typeof n)return o.children[n]="imageReference"===e.type?{type:"image",url:r.url,title:r.title,alt:e.alt}:{type:"link",url:r.url,title:r.title,children:e.children},[te,n]}})}}function Ld(e,t){if(!(t.childCount>=1&&"hardbreak"===t.lastChild?.type.name))return void e.next(t.content);const n=[];t.content.forEach((e,o,r)=>{r!==t.childCount-1&&n.push(e)}),e.next(Ht.fromArray(n))}function Vd(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}var jd=bd("emphasis");Vd(jd,{displayName:"Attr<emphasis>",group:"Emphasis"});var $d=vd("emphasis",e=>({attrs:{marker:{default:e.get(lc).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>"italic"===e}],toDOM:t=>["em",e.get(jd.key)(t)],parseMarkdown:{match:e=>"emphasis"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"emphasis"===e.type.name,runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));Vd($d.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"}),Vd($d.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var Bd=ld("ToggleEmphasis",e=>()=>Nr($d.type(e)));Vd(Bd,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var Hd=cd(e=>ri(/(?:^|[^*])\*([^*]+)\*$/,$d.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));Vd(Hd,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var Fd=cd(e=>ri(/\b_(?![_\s])(.*?[^_\s])_\b/,$d.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));Vd(Fd,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var zd=yd("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{const t=e.get(bc);return()=>t.call(Bd.key)}}});Vd(zd.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"}),Vd(zd.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var qd=bd("strong");Vd(qd,{displayName:"Attr<strong>",group:"Strong"});var Wd=vd("strong",e=>({attrs:{marker:{default:e.get(lc).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>"normal"!=e.style.fontWeight&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>"bold"===e},{style:"font-weight=400",clearMark:e=>"strong"==e.type.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:t=>["strong",e.get(qd.key)(t)],parseMarkdown:{match:e=>"strong"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strong"===e.type.name,runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));Vd(Wd.mark,{displayName:"MarkSchema<strong>",group:"Strong"}),Vd(Wd.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var Ud=ld("ToggleStrong",e=>()=>Nr(Wd.type(e)));Vd(Ud,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var Kd=cd(e=>ri(/(?<![\w:/])(?:\*\*|__)([^*_]+?)(?:\*\*|__)(?![\w/])$/,Wd.type(e),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));Vd(Kd,{displayName:"InputRule<strong>",group:"Strong"});var Gd=yd("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{const t=e.get(bc);return()=>t.call(Ud.key)}}});Vd(Gd.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"}),Vd(Gd.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var Jd=bd("inlineCode");Vd(Jd,{displayName:"Attr<inlineCode>",group:"InlineCode"});var Zd=vd("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(Jd.key)(t)],parseMarkdown:{match:e=>"inlineCode"===e.type,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>"inlineCode"===e.type.name,runner:(e,t,n)=>(e.withMark(t,"inlineCode",n.text||""),!0)}}));Vd(Zd.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"}),Vd(Zd.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var Xd=ld("ToggleInlineCode",e=>()=>(t,n)=>{const{selection:o,tr:r}=t;if(o.empty)return!1;const{from:i,to:s}=o;return t.doc.rangeHasMark(i,s,Zd.type(e))?(n?.(r.removeMark(i,s,Zd.type(e))),!0):(Object.keys(t.schema.marks).filter(e=>e!==Zd.type.name).map(e=>t.schema.marks[e]).forEach(e=>{r.removeMark(i,s,e)}),n?.(r.addMark(i,s,Zd.type(e).create())),!0)});Vd(Xd,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var Yd=cd(e=>ri(/(?:`)([^`]+)(?:`)$/,Zd.type(e)));Vd(Yd,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var Qd=yd("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{const t=e.get(bc);return()=>t.call(Xd.key)}}});Vd(Qd.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"}),Vd(Qd.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var eu=bd("link");Vd(eu,{displayName:"Attr<link>",group:"Link"});var tu=vd("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Nt(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(eu.key)(t),...t.attrs}],parseMarkdown:{match:e=>"link"===e.type,runner:(e,t,n)=>{const o=t.url,r=t.title;e.openMark(n,{href:o,title:r}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"link"===e.type.name,runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));Vd(tu.mark,{displayName:"MarkSchema<link>",group:"Link"});var nu=ld("ToggleLink",e=>(t={})=>Nr(tu.type(e),t));Vd(nu,{displayName:"Command<toggleLinkCommand>",group:"Link"});var ou=ld("UpdateLink",e=>(t={})=>(n,o)=>{if(!o)return!1;let r,i=-1;const{selection:s}=n,{from:a,to:l}=s;if(n.doc.nodesBetween(a,a===l?l+1:l,(t,n)=>{if(tu.type(e).isInSet(t.marks))return r=t,i=n,!1}),!r)return!1;const c=r.marks.find(({type:t})=>t===tu.type(e));if(!c)return!1;const d=i,u=i+r.nodeSize,{tr:p}=n,h=tu.type(e).create({...c.attrs,...t});return!!h&&(o(p.removeMark(d,u,c).addMark(d,u,h).setSelection(new Fo(p.selection.$anchor)).scrollIntoView()),!0)});Vd(ou,{displayName:"Command<updateLinkCommand>",group:"Link"});var ru=ud("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>"root"===e,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>"doc"===e.type.name,runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));function iu(e){return ne(e,e=>"html"===e.type&&["<br />","<br>","<br >","<br/>"].includes(e.value?.trim()),(e,t)=>{if(!t.length)return;const n=t[t.length-1];if(!n)return;const o=n.children.indexOf(e);-1!==o&&n.children.splice(o,1)},!0)}Vd(ru,{displayName:"NodeSchema<doc>",group:"Doc"});var su=kd("remark-preserve-empty-line",()=>()=>iu);Vd(su.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"}),Vd(su.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var au=wd("paragraph");Vd(au,{displayName:"Attr<paragraph>",group:"Paragraph"});var lu=gd("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(au.key)(t),0],parseMarkdown:{match:e=>"paragraph"===e.type,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>"paragraph"===e.type.name,runner:(t,n)=>{const o=e.get(Yl).state?.doc.lastChild;t.openNode("paragraph"),n.content&&0!==n.content.size||n===o||!function(e){let t=!1;try{e.get(su.id),t=!0}catch{t=!1}return t}(e)?Ld(t,n):t.addNode("html",void 0,"<br />"),t.closeNode()}}}));Vd(lu.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"}),Vd(lu.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var cu=ld("TurnIntoText",e=>()=>xr(lu.type(e)));Vd(cu,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var du=yd("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{const t=e.get(bc);return()=>t.call(cu.key)}}});Vd(du.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"}),Vd(du.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var uu=Array(6).fill(0).map((e,t)=>t+1);var pu=md(function(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")},"headingIdGenerator");Vd(pu,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var hu=wd("heading");Vd(hu,{displayName:"Attr<heading>",group:"Heading"});var fu=gd("heading",e=>{const t=e.get(pu.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:uu.map(e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw Nt(t);return{level:e,id:t.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(hu.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>"heading"===e,runner:(e,t,n)=>{const o=t.depth;e.openNode(n,{level:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"heading"===e.type.name,runner:(e,t)=>{e.openNode("heading",void 0,{depth:t.attrs.level}),Ld(e,t),e.closeNode()}}}});Vd(fu.node,{displayName:"NodeSchema<heading>",group:"Heading"}),Vd(fu.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var mu=cd(e=>Rr(/^(?<hashes>#+)\s$/,fu.type(e),t=>{const n=t.groups?.hashes?.length||0,{$from:o}=e.get(Yl).state.selection,r=o.node();if("heading"===r.type.name){let e=Number(r.attrs.level)+Number(n);return e>6&&(e=6),{level:e}}return{level:n}}));Vd(mu,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var gu=ld("WrapInHeading",e=>t=>(t??=1,t<1?xr(lu.type(e)):xr(fu.type(e),{level:t})));Vd(gu,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var vu=ld("DowngradeHeading",e=>()=>(t,n,o)=>{const{$from:r}=t.selection,i=r.node();if(i.type!==fu.type(e)||!t.selection.empty||0!==r.parentOffset)return!1;const s=i.attrs.level-1;return s?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...i.attrs,level:s})),!0):xr(lu.type(e))(t,n,o)});Vd(vu,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var yu=yd("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{const t=e.get(bc);return()=>t.call(gu.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{const t=e.get(bc);return()=>t.call(gu.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{const t=e.get(bc);return()=>t.call(gu.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{const t=e.get(bc);return()=>t.call(gu.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{const t=e.get(bc);return()=>t.call(gu.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{const t=e.get(bc);return()=>t.call(gu.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{const t=e.get(bc);return()=>t.call(vu.key)}}});Vd(yu.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"}),Vd(yu.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var wu=wd("blockquote");Vd(wu,{displayName:"Attr<blockquote>",group:"Blockquote"});var bu=gd("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(wu.key)(t),0],parseMarkdown:{match:({type:e})=>"blockquote"===e,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>"blockquote"===e.type.name,runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));Vd(bu.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"}),Vd(bu.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var ku=cd(e=>Ar(/^\s*>\s$/,bu.type(e)));Vd(ku,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var Cu=ld("WrapInBlockquote",e=>()=>Cr(bu.type(e)));Vd(Cu,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var xu=yd("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{const t=e.get(bc);return()=>t.call(Cu.key)}}});Vd(xu.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"}),Vd(xu.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var Nu=wd("codeBlock",()=>({pre:{},code:{}}));Vd(Nu,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var Su=gd("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Nt(e);return{language:e.dataset.language}}}],toDOM:t=>{const n=e.get(Nu.key)(t),o=t.attrs.language,r=o&&o.length>0?{"data-language":o}:void 0;return["pre",{...n.pre,...r},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>"code"===e,runner:(e,t,n)=>{const o=t.lang??"",r=t.value;e.openNode(n,{language:o}),r&&e.addText(r),e.closeNode()}},toMarkdown:{match:e=>"code_block"===e.type.name,runner:(e,t)=>{e.addNode("code",void 0,t.content.firstChild?.text||"",{lang:t.attrs.language})}}}));Vd(Su.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"}),Vd(Su.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var Ou=cd(e=>Rr(/^```(?<language>[a-z]*)?[\s\n]$/,Su.type(e),e=>({language:e.groups?.language??""})));Vd(Ou,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var Eu=ld("CreateCodeBlock",e=>(t="")=>xr(Su.type(e),{language:t}));Vd(Eu,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"}),Vd(ld("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(n,o)=>e>=0&&(o?.(n.tr.setNodeAttribute(e,"language",t)),!0)),{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var Mu=yd("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{const t=e.get(bc);return()=>t.call(Eu.key)}}});Vd(Mu.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"}),Vd(Mu.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var _u=wd("image");Vd(_u,{displayName:"Attr<image>",group:"Image"});var Tu=gd("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Nt(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(_u.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>"image"===e,runner:(e,t,n)=>{const o=t.url,r=t.alt,i=t.title;e.addNode(n,{src:o,alt:r,title:i})}},toMarkdown:{match:e=>"image"===e.type.name,runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));Vd(Tu.node,{displayName:"NodeSchema<image>",group:"Image"}),Vd(Tu.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var Du=ld("InsertImage",e=>(t={})=>(n,o)=>{if(!o)return!0;const{src:r="",alt:i="",title:s=""}=t,a=Tu.type(e).create({src:r,alt:i,title:s});return!a||(o(n.tr.replaceSelectionWith(a).scrollIntoView()),!0)});Vd(Du,{displayName:"Command<insertImageCommand>",group:"Image"});var Iu=ld("UpdateImage",e=>(t={})=>(n,o)=>{const r=wi(n.selection,Tu.type(e));if(!r)return!1;const{node:i,pos:s}=r,a={...i.attrs},{src:l,alt:c,title:d}=t;return void 0!==l&&(a.src=l),void 0!==c&&(a.alt=c),void 0!==d&&(a.title=d),o?.(n.tr.setNodeMarkup(s,void 0,a).scrollIntoView()),!0});Vd(Iu,{displayName:"Command<updateImageCommand>",group:"Image"}),Vd(cd(e=>new Dr(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,o,r)=>{const[i,s,a="",l]=n;return i?t.tr.replaceWith(o,r,Tu.type(e).create({src:a,alt:s,title:l})):null})),{displayName:"InputRule<insertImageInputRule>",group:"Image"});var Au=wd("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));Vd(Au,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var Ru=gd("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(Au.key)(t)," "]:["br",e.get(Au.key)(t)],parseMarkdown:{match:({type:e})=>"break"===e,runner:(e,t,n)=>{e.addNode(n,{isInline:Boolean(t.data?.isInline)})}},leafText:()=>"\n",toMarkdown:{match:e=>"hardbreak"===e.type.name,runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,"\n"):e.addNode("break")}}}));Vd(Ru.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"}),Vd(Ru.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var Pu=ld("InsertHardbreak",e=>()=>(t,n)=>{const{selection:o,tr:r}=t;if(!(o instanceof Fo))return!1;if(o.empty){const e=o.$from.node();if(e.childCount>0&&"hardbreak"===e.lastChild?.type.name)return n?.(r.replaceRangeWith(o.to-1,o.to,t.schema.node("paragraph")).setSelection(jo.near(r.doc.resolve(o.to))).scrollIntoView()),!0}return n?.(r.setMeta("hardbreak",!0).replaceSelectionWith(Ru.type(e).create()).scrollIntoView()),!0});Vd(Pu,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var Lu=yd("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{const t=e.get(bc);return()=>t.call(Pu.key)}}});Vd(Lu.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"}),Vd(Lu.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var Vu=wd("hr");Vd(Vu,{displayName:"Attr<hr>",group:"Hr"});var ju=gd("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(Vu.key)(t)],parseMarkdown:{match:({type:e})=>"thematicBreak"===e,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>"hr"===e.type.name,runner:e=>{e.addNode("thematicBreak")}}}));Vd(ju.node,{displayName:"NodeSchema<hr>",group:"Hr"}),Vd(ju.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var $u=cd(e=>new Dr(/^(?:---|___\s|\*\*\*\s)$/,(t,n,o,r)=>{const{tr:i}=t;return n[0]&&i.replaceWith(o-1,r,ju.type(e).create()),i}));Vd($u,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var Bu=ld("InsertHr",e=>()=>(t,n)=>{if(!n)return!0;const o=lu.node.type(e).create(),{tr:r,selection:i}=t,{from:s}=i,a=ju.type(e).create();if(!a)return!0;const l=r.replaceSelectionWith(a).insert(s,o),c=jo.findFrom(l.doc.resolve(s),1,!0);return!c||(n(l.setSelection(c).scrollIntoView()),!0)});Vd(Bu,{displayName:"Command<insertHrCommand>",group:"Hr"});var Hu=wd("bulletList");Vd(Hu,{displayName:"Attr<bulletList>",group:"BulletList"});var Fu=gd("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Nt(e);return{spread:"true"===e.dataset.spread}}}],toDOM:t=>["ul",{...e.get(Hu.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!t,runner:(e,t,n)=>{const o=null!=t.spread?`${t.spread}`:"false";e.openNode(n,{spread:o}).next(t.children).closeNode()}},toMarkdown:{match:e=>"bullet_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));Vd(Fu.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"}),Vd(Fu.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var zu=cd(e=>Ar(/^\s*([-+*])\s$/,Fu.type(e)));Vd(zu,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var qu=ld("WrapInBulletList",e=>()=>Cr(Fu.type(e)));Vd(qu,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var Wu=yd("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{const t=e.get(bc);return()=>t.call(qu.key)}}});Vd(Wu.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"}),Vd(Wu.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var Uu=wd("orderedList");Vd(Uu,{displayName:"Attr<orderedList>",group:"OrderedList"});var Ku=gd("ordered_list",e=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Nt(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(Uu.key)(t),...1===t.attrs.order?{}:{start:t.attrs.order},"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!!t,runner:(e,t,n)=>{const o=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{spread:o,order:t.start??1}).next(t.children).closeNode()}},toMarkdown:{match:e=>"ordered_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:t.attrs.order??1,spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}}));Vd(Ku.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"}),Vd(Ku.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var Gu=cd(e=>Ar(/^\s*(\d+)\.\s$/,Ku.type(e),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));Vd(Gu,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var Ju=ld("WrapInOrderedList",e=>()=>Cr(Ku.type(e)));Vd(Ju,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var Zu=yd("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{const t=e.get(bc);return()=>t.call(Ju.key)}}});Vd(Zu.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"}),Vd(Zu.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var Xu=wd("listItem");Vd(Xu,{displayName:"Attr<listItem>",group:"ListItem"});var Yu=gd("list_item",e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Nt(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:"true"===e.dataset.spread}}}],toDOM:t=>["li",{...e.get(Xu.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,n)=>{const o=null!=t.label?`${t.label}.`:"•",r=null!=t.label?"ordered":"bullet",i=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{label:o,listType:r,spread:i}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{e.openNode("listItem",void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));Vd(Yu.node,{displayName:"NodeSchema<listItem>",group:"ListItem"}),Vd(Yu.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var Qu=ld("SinkListItem",e=>()=>{return t=Yu.type(e),function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,e=>e.childCount>0&&e.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let o=l.lastChild&&l.lastChild.type==a.type,r=Ht.from(o?t.create():null),s=new Kt(Ht.from(t.create(null,Ht.from(a.type.create(null,r)))),o?3:1,0),c=i.start,d=i.end;n(e.tr.step(new uo(c-(o?3:1),d,c,d,s,1,!0)).scrollIntoView())}return!0};var t});Vd(Qu,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var ep=ld("LiftListItem",e=>()=>Ad(Yu.type(e)));Vd(ep,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var tp=ld("SplitListItem",e=>()=>{return t=Yu.type(e),function(e,n){let{$from:o,$to:r,node:i}=e.selection;if(i&&i.isBlock||o.depth<2||!o.sameParent(r))return!1;let s=o.node(-1);if(s.type!=t)return!1;if(0==o.parent.content.size&&o.node(-1).childCount==o.indexAfter(-1)){if(3==o.depth||o.node(-3).type!=t||o.index(-2)!=o.node(-2).childCount-1)return!1;if(n){let r=Ht.empty,i=o.index(-1)?1:o.index(-2)?2:3;for(let e=o.depth-i;e>=o.depth-3;e--)r=Ht.from(o.node(e).copy(r));let s=o.indexAfter(-1)<o.node(-2).childCount?1:o.indexAfter(-2)<o.node(-3).childCount?2:3;r=r.append(Ht.from(t.createAndFill()));let a=o.before(o.depth-(i-1)),l=e.tr.replace(a,o.after(-s),new Kt(r,4-i,0)),c=-1;l.doc.nodesBetween(a,l.doc.content.size,(e,t)=>{if(c>-1)return!1;e.isTextblock&&0==e.content.size&&(c=t+1)}),c>-1&&l.setSelection(jo.near(l.doc.resolve(c))),n(l.scrollIntoView())}return!0}let a=r.pos==o.end()?s.contentMatchAt(0).defaultType:null,l=e.tr.delete(o.pos,r.pos),c=a?[null,{type:a}]:void 0;return!!bo(l.doc,o.pos,2,c)&&(n&&n(l.split(o.pos,2,c).scrollIntoView()),!0)};var t});Vd(tp,{displayName:"Command<splitListItemCommand>",group:"ListItem"});var np=ld("LiftFirstListItem",e=>()=>function(e){return(t,n,o)=>{const{selection:r}=t;if(!(r instanceof Fo))return!1;const{empty:i,$from:s}=r;return!(!i||0!==s.parentOffset)&&s.node(-1).type===Yu.type(e)&&cr(t,n,o)}}(e));Vd(np,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var op=yd("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{const t=e.get(bc);return()=>t.call(tp.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{const t=e.get(bc);return()=>t.call(Qu.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{const t=e.get(bc);return()=>t.call(ep.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{const t=e.get(bc);return()=>t.call(np.key)}}});Vd(op.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"}),Vd(op.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var rp=ud("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>"text"===e,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>"text"===e.type.name,runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));Vd(rp,{displayName:"NodeSchema<text>",group:"Text"});var ip=wd("html");Vd(ip,{displayName:"Attr<html>",group:"Html"});var sp=gd("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{const n=document.createElement("span"),o={...e.get(ip.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",o,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>Boolean("html"===e),runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>"html"===e.type.name,runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}}));Vd(sp.node,{displayName:"NodeSchema<html>",group:"Html"}),Vd(sp.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var ap=[ru,au,lu,pu,hu,fu,Au,Ru,wu,bu,Nu,Su,Vu,ju,_u,Tu,Hu,Fu,Uu,Ku,Xu,Yu,jd,$d,qd,Wd,Jd,Zd,eu,tu,ip,sp,rp].flat(),lp=[ku,zu,Gu,Ou,$u,mu].flat(),cp=[Hd,Fd,Yd,Kd],dp=ld("IsMarkSelected",()=>e=>t=>{if(!e)return!1;const{doc:n,selection:o}=t;return n.rangeHasMark(o.from,o.to,e)}),up=ld("IsNoteSelected",()=>e=>t=>!!e&&bi(t,e).hasNode),pp=ld("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let n=e.tr;const{$from:o,$to:r}=n.selection,{pos:i}=o,{pos:s}=r,a=i-o.node().content.size;return!(a<0)&&(n=n.deleteRange(a,s),t?.(n),!0)}),hp=ld("SetBlockType",()=>e=>(t,n)=>{const{nodeType:o,attrs:r=null}=e??{};if(!o)return!1;const i=t.tr,{from:s,to:a}=i.selection;try{i.setBlockType(s,a,o,r)}catch{return!1}return n?.(i),!0}),fp=ld("WrapInBlockType",()=>e=>(t,n)=>{const{nodeType:o,attrs:r=null}=e??{};if(!o)return!1;let i=t.tr;try{const{$from:e,$to:t}=i.selection,n=e.blockRange(t),s=n&&go(n,o,r);if(!s)return!1;i=i.wrap(n,s)}catch{return!1}return n?.(i),!0}),mp=ld("AddBlockType",()=>e=>(t,n)=>{const{nodeType:o,attrs:r=null}=e??{};if(!o)return!1;const i=t.tr;try{const e=o instanceof pn?o:o.createAndFill(r);if(!e)return!1;i.replaceSelectionWith(e)}catch{return!1}return n?.(i),!0}),gp=ld("SelectTextNearPos",()=>e=>(t,n)=>{const{pos:o}=e??{};if(null==o)return!1;const r=t.tr;try{const e=t.doc.resolve((i=o,s=0,a=t.doc.content.size,Math.min(Math.max(i,s),a)));r.setSelection(Fo.near(e))}catch{return!1}var i,s,a;return n?.(r.scrollIntoView()),!0}),vp=[cu,Cu,gu,vu,Eu,Pu,Bu,Du,Iu,Ju,qu,Qu,tp,ep,np,Bd,Xd,Ud,nu,ou,dp,up,pp,hp,fp,mp,gp],yp=[xu,Mu,Lu,yu,op,Zu,Wu,du,zd,Qd,Gd].flat(),wp=kd("remarkAddOrderInList",()=>()=>e=>{ee(e,"list",e=>{if(e.ordered){const t=e.start??1;e.children.forEach((e,n)=>{e.label=n+t})}})});Vd(wp.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"}),Vd(wp.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var bp=kd("remarkLineBreak",()=>()=>e=>{const t=/[\t ]*(?:\r?\n|\r)/g;ee(e,"text",(e,n,o)=>{if(!e.value||"string"!=typeof e.value)return;const r=[];let i=0;t.lastIndex=0;let s=t.exec(e.value);for(;s;){const n=s.index;i!==n&&r.push({type:"text",value:e.value.slice(i,n)}),r.push({type:"break",data:{isInline:!0}}),i=n+s[0].length,s=t.exec(e.value)}return r.length>0&&o&&"number"==typeof n?(i<e.value.length&&r.push({type:"text",value:e.value.slice(i)}),o.children.splice(n,1,...r),n+r.length):void 0})});Vd(bp.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"}),Vd(bp.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var kp=kd("remarkInlineLink",()=>Pd);Vd(kp.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"}),Vd(kp.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var Cp=["root","blockquote","listItem"],xp=kd("remarkHTMLTransformer",()=>()=>e=>{var t;t=(e,t,n)=>(e=>"html"===e.type)(e)?(n&&Cp.includes(n.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e],function e(n,o,r){if((e=>!!e.children)(n)){const t=[];for(let o=0,r=n.children.length;o<r;o++){const r=n.children[o];if(r){const i=e(r,o,n);if(i)for(let e=0,n=i.length;e<n;e++){const n=i[e];n&&t.push(n)}}}n.children=t}return t(n,o,r)}(e,0,null)[0]});Vd(xp.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"}),Vd(xp.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var Np=kd("remarkMarker",()=>()=>(e,t)=>{ee(e,e=>["strong","emphasis"].includes(e.type),e=>{e.marker=(e=>t.value.charAt(e.position.start.offset))(e)})});Vd(Np.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"}),Vd(Np.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var Sp=pd(()=>{let e=!1;const t=new or({key:new sr("MILKDOWN_INLINE_NODES_CURSOR"),state:{init:()=>!1,apply(e){if(!e.selection.empty)return!1;const t=e.selection.$from,n=t.nodeBefore,o=t.nodeAfter;return!(!(n&&o&&n.isInline&&!n.isText&&o.isInline)||o.isText)}},props:{handleDOMEvents:{compositionend:(n,o)=>!!e&&(e=!1,requestAnimationFrame(()=>{if(t.getState(n.state)){const e=n.state.selection.from;o.preventDefault(),n.dispatch(n.state.tr.insertText(o.data||"",e))}}),!0),compositionstart:n=>(t.getState(n.state)&&(e=!0),!1),beforeinput:(n,o)=>{if(t.getState(n.state)&&o instanceof InputEvent&&o.data&&!e){const e=n.state.selection.from;return o.preventDefault(),n.dispatch(n.state.tr.insertText(o.data||"",e)),!0}return!1}},decorations(e){if(t.getState(e)){const t=e.selection.$from.pos,n=document.createElement("span"),o=gl.widget(t,n,{side:-1}),r=document.createElement("span"),i=gl.widget(t,r);return setTimeout(()=>{n.contentEditable="true",r.contentEditable="true"}),wl.create(e.doc,[o,i])}return wl.empty}}});return t});Vd(Sp,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var Op=pd(e=>new or({key:new sr("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,n,o)=>{if(!t.length)return;const[r]=t;if(!r)return;const[i]=r.steps;if(r.getMeta("hardbreak")){if(!(i instanceof co))return;const{from:t}=i;return o.tr.setNodeMarkup(t,Ru.type(e),void 0,[])}if(i instanceof io){let t=o.tr;const{from:n,to:r}=i;return o.doc.nodesBetween(n,r,(n,o)=>{n.type===Ru.type(e)&&(t=t.setNodeMarkup(o,Ru.type(e),void 0,[]))}),t}}}));Vd(Op,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var Ep=md(["table","code_block"],"hardbreakFilterNodes");Vd(Ep,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var Mp=pd(e=>{const t=e.get(Ep.key);return new or({key:new sr("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(e,n)=>{const o=e.getMeta("hardbreak"),[r]=e.steps;if(o&&r){const{from:e}=r,o=n.doc.resolve(e);let i=o.depth,s=!0;for(;i>0;)t.includes(o.node(i).type.name)&&(s=!1),i--;return s}return!0}})});Vd(Mp,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var _p=pd(e=>{const t=new sr("MILKDOWN_HEADING_ID"),n=n=>{if(n.composing)return;const o=e.get(pu.key),r=n.state.tr.setMeta("addToHistory",!1);let i=!1;const s={};n.state.doc.descendants((n,a)=>{if(n.type===fu.type(e)){if(0===n.textContent.trim().length)return;const e=n.attrs;let l=o(n);s[l]?(s[l]+=1,l+=`-#${s[l]}`):s[l]=1,e.id!==l&&(i=!0,r.setMeta(t,!0).setNodeMarkup(a,void 0,{...e,id:l}))}}),i&&n.dispatch(r)};return new or({key:t,view:e=>(n(e),{update:(e,t)=>{e.state.doc.eq(t.doc)||n(e)}})})});Vd(_p,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var Tp=pd(e=>new or({key:new sr("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:(t,n,o)=>{if(!o.selection||t.some(e=>!1===e.getMeta("addToHistory")||!e.isGeneric))return null;const r=Ku.type(e),i=Fu.type(e),s=Yu.type(e),a=(e,t,n=1)=>{let o=!1;const r=`${t+n}.`;return e.label!==r&&(e.label=r,o=!0),o};let l=o.tr,c=!1;return o.doc.descendants((e,t,n,o)=>{if(e.type===i){const n=e.maybeChild(0);n?.type===s&&"ordered"===n.attrs.listType&&(c=!0,l.setNodeMarkup(t,r,{spread:"true"}),e.descendants((e,t,n,o)=>{if(e.type===s){const n={...e.attrs};a(n,o)&&(l=l.setNodeMarkup(t,void 0,n))}return!1}))}else if(e.type===s&&n?.type===r){const r={...e.attrs};let i=!1;"ordered"!==r.listType&&(r.listType="ordered",i=!0),n?.maybeChild(0)&&(i=a(r,o,n?.attrs.order??1)),i&&(l=l.setNodeMarkup(t,void 0,r),c=!0)}}),c?l.setMeta("addToHistory",!1):null}}));Vd(Tp,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var Dp=[ap,lp,cp,vp,yp,[Op,Ep,Mp,Sp,wp,kp,bp,xp,Np,su,_p,Tp].flat()].flat(),Ip=200,Ap=function(){};Ap.prototype.append=function(e){return e.length?(e=Ap.from(e),!this.length&&e||e.length<Ip&&this.leafAppend(e)||this.length<Ip&&e.leafPrepend(this)||this.appendInner(e)):this},Ap.prototype.prepend=function(e){return e.length?Ap.from(e).append(this):this},Ap.prototype.appendInner=function(e){return new Pp(this,e)},Ap.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Ap.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ap.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ap.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Ap.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var o=[];return this.forEach(function(t,n){return o.push(e(t,n))},t,n),o},Ap.from=function(e){return e instanceof Ap?e:e&&e.length?new Rp(e):Ap.empty};var Rp=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,o){for(var r=t;r<n;r++)if(!1===e(this.values[r],o+r))return!1},t.prototype.forEachInvertedInner=function(e,t,n,o){for(var r=t-1;r>=n;r--)if(!1===e(this.values[r],o+r))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=Ip)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Ip)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Ap);Ap.empty=new Rp([]);var Pp=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,o){var r=this.left.length;return!(t<r&&!1===this.left.forEachInner(e,t,Math.min(n,r),o))&&(!(n>r&&!1===this.right.forEachInner(e,Math.max(t-r,0),Math.min(this.length,n)-r,o+r))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,o){var r=this.left.length;return!(t>r&&!1===this.right.forEachInvertedInner(e,t-r,Math.max(n,r)-r,o+r))&&(!(n<r&&!1===this.left.forEachInvertedInner(e,Math.min(t,r),n,o))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Ap);class Lp{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,o,r=this.items.length;for(;;r--){if(this.items.get(r-1).selection){--r;break}}t&&(n=this.remapping(r,this.items.length),o=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(r,t+1),o=n.maps.length),o--,void c.push(e);if(n){c.push(new Vp(e.map));let t,r=e.step.map(n.slice(o));r&&a.maybeStep(r).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new Vp(t,void 0,void 0,l.length+c.length))),o--,t&&n.appendMap(t,o)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(o)):e.selection,s=new Lp(this.items.slice(0,r).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,o){let r=[],i=this.eventCount,s=this.items,a=!o&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,c=e.steps[n].invert(e.docs[n]),d=new Vp(e.mapping.maps[n],c,t);(l=a&&a.merge(d))&&(d=l,n?r.pop():s=s.slice(0,s.length-1)),r.push(d),t&&(i++,t=void 0),o||(a=d)}let l=i-n.depth;return l>$p&&(s=function(e,t){let n;return e.forEach((e,o)=>{if(e.selection&&0==t--)return n=o,!1}),e.slice(n)}(s,l),i-=l),new Lp(s.append(r),i)}remapping(e,t){let n=new eo;return this.items.forEach((t,o)=>{let r=null!=t.mirrorOffset&&o-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,r)},e,t),n}addMaps(e){return 0==this.eventCount?this:new Lp(this.items.append(e.map(e=>new Vp(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],o=Math.max(0,this.items.length-t),r=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},o);let a=t;this.items.forEach(t=>{let o=r.getMirror(--a);if(null==o)return;i=Math.min(i,o);let l=r.maps[o];if(t.step){let i=e.steps[o].invert(e.docs[o]),c=t.selection&&t.selection.map(r.slice(a+1,o));c&&s++,n.push(new Vp(l,i,c))}else n.push(new Vp(l))},o);let l=[];for(let e=t;e<i;e++)l.push(new Vp(r.maps[e]));let c=this.items.slice(0,o).append(l).append(n),d=new Lp(c,s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,o=[],r=0;return this.items.forEach((i,s)=>{if(s>=e)o.push(i),i.selection&&r++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&r++;let l,c=new Vp(s.invert(),e,a),d=o.length-1;(l=o.length&&o[d].merge(c))?o[d]=l:o.push(c)}}else i.map&&n--},this.items.length,0),new Lp(Ap.from(o.reverse()),r)}}Lp.empty=new Lp(Ap.empty,0);class Vp{constructor(e,t,n,o){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Vp(t.getMap().invert(),t,this.selection)}}}class jp{constructor(e,t,n,o,r){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=o,this.prevComposition=r}}const $p=20;function Bp(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,o,r)=>t.push(o,r));return t}function Hp(e,t){if(!e)return null;let n=[];for(let o=0;o<e.length;o+=2){let r=t.map(e[o],1),i=t.map(e[o+1],-1);r<=i&&n.push(r,i)}return n}let Fp=!1,zp=null;function qp(e){let t=e.plugins;if(zp!=t){Fp=!1,zp=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Fp=!0;break}}return Fp}const Wp=new sr("history"),Up=new sr("closeHistory");function Kp(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new or({key:Wp,state:{init:()=>new jp(Lp.empty,Lp.empty,null,0,-1),apply:(t,n,o)=>function(e,t,n,o){let r,i=n.getMeta(Wp);if(i)return i.historyState;n.getMeta(Up)&&(e=new jp(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(Wp))return s.getMeta(Wp).redo?new jp(e.done.addTransform(n,void 0,o,qp(t)),e.undone,Bp(n.mapping.maps),e.prevTime,e.prevComposition):new jp(e.done,e.undone.addTransform(n,void 0,o,qp(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(r=n.getMeta("rebased"))?new jp(e.done.rebased(n,r),e.undone.rebased(n,r),Hp(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new jp(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Hp(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let r=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=r&&(e.prevTime<(n.time||0)-o.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,o)=>{for(let r=0;r<t.length;r+=2)e<=t[r+1]&&o>=t[r]&&(n=!0)}),n}(n,e.prevRanges)),a=s?Hp(e.prevRanges,n.mapping):Bp(n.mapping.maps);return new jp(e.done.addTransform(n,i?t.selection.getBookmark():void 0,o,qp(t)),Lp.empty,a,n.time,null==r?e.prevComposition:r)}}(n,o,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,o="historyUndo"==n?Jp:"historyRedo"==n?Zp:null;return!(!o||!e.editable)&&(t.preventDefault(),o(e.state,e.dispatch))}}}})}function Gp(e,t){return(n,o)=>{let r=Wp.getState(n);if(!r||0==(e?r.undone:r.done).eventCount)return!1;if(o){let i=function(e,t,n){let o=qp(t),r=Wp.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,o);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),r,o),l=new jp(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Wp,{redo:n,historyState:l})}(r,n,e);i&&o(t?i.scrollIntoView():i)}return!0}}const Jp=Gp(!1,!0),Zp=Gp(!0,!0);
2
+ /**
3
+ * @vue/shared v3.5.32
4
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
+ * @license MIT
6
+ **/
7
+ function Xp(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return e=>e in t}const Yp="production"!==process.env.NODE_ENV?Object.freeze({}):{},Qp="production"!==process.env.NODE_ENV?Object.freeze([]):[],eh=()=>{},th=()=>!1,nh=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),oh=e=>e.startsWith("onUpdate:"),rh=Object.assign,ih=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},sh=Object.prototype.hasOwnProperty,ah=(e,t)=>sh.call(e,t),lh=Array.isArray,ch=e=>"[object Map]"===vh(e),dh=e=>"[object Date]"===vh(e),uh=e=>"function"==typeof e,ph=e=>"string"==typeof e,hh=e=>"symbol"==typeof e,fh=e=>null!==e&&"object"==typeof e,mh=e=>(fh(e)||uh(e))&&uh(e.then)&&uh(e.catch),gh=Object.prototype.toString,vh=e=>gh.call(e),yh=e=>vh(e).slice(8,-1),wh=e=>ph(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,bh=Xp(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),kh=Xp("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),Ch=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},xh=/-\w/g,Nh=Ch(e=>e.replace(xh,e=>e.slice(1).toUpperCase())),Sh=/\B([A-Z])/g,Oh=Ch(e=>e.replace(Sh,"-$1").toLowerCase()),Eh=Ch(e=>e.charAt(0).toUpperCase()+e.slice(1)),Mh=Ch(e=>e?`on${Eh(e)}`:""),_h=(e,t)=>!Object.is(e,t),Th=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Dh=(e,t,n,o=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:o,value:n})},Ih=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let Ah;const Rh=()=>Ah||(Ah="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});function Ph(e){if(lh(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],r=ph(o)?$h(o):Ph(o);if(r)for(const e in r)t[e]=r[e]}return t}if(ph(e)||fh(e))return e}const Lh=/;(?![^(]*\))/g,Vh=/:([^]+)/,jh=/\/\*[^]*?\*\//g;function $h(e){const t={};return e.replace(jh,"").split(Lh).forEach(e=>{if(e){const n=e.split(Vh);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function Bh(e){let t="";if(ph(e))t=e;else if(lh(e))for(let n=0;n<e.length;n++){const o=Bh(e[n]);o&&(t+=o+" ")}else if(fh(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Hh=Xp("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"),Fh=Xp("svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"),zh=Xp("annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"),qh=Xp("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function Wh(e){return!!e||""===e}function Uh(e,t){if(e===t)return!0;let n=dh(e),o=dh(t);if(n||o)return!(!n||!o)&&e.getTime()===t.getTime();if(n=hh(e),o=hh(t),n||o)return e===t;if(n=lh(e),o=lh(t),n||o)return!(!n||!o)&&function(e,t){if(e.length!==t.length)return!1;let n=!0;for(let o=0;n&&o<e.length;o++)n=Uh(e[o],t[o]);return n}(e,t);if(n=fh(e),o=fh(t),n||o){if(!n||!o)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e){const o=e.hasOwnProperty(n),r=t.hasOwnProperty(n);if(o&&!r||!o&&r||!Uh(e[n],t[n]))return!1}}return String(e)===String(t)}
8
+ /**
9
+ * @vue/reactivity v3.5.32
10
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
11
+ * @license MIT
12
+ **/function Kh(e,...t){console.warn(`[Vue warn] ${e}`,...t)}let Gh,Jh;class Zh{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=Gh,!e&&Gh&&(this.index=(Gh.scopes||(Gh.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){let e,t;if(this._isPaused=!0,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){let e,t;if(this._isPaused=!1,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=Gh;try{return Gh=this,e()}finally{Gh=t}}else"production"!==process.env.NODE_ENV&&Kh("cannot run an inactive effect scope.")}on(){1===++this._on&&(this.prevScope=Gh,Gh=this)}off(){this._on>0&&0===--this._on&&(Gh=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){let t,n;for(this._active=!1,t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}}const Xh=new WeakSet;class Yh{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Gh&&Gh.active&&Gh.effects.push(this)}pause(){this.flags|=64}resume(){64&this.flags&&(this.flags&=-65,Xh.has(this)&&(Xh.delete(this),this.trigger()))}notify(){2&this.flags&&!(32&this.flags)||8&this.flags||nf(this)}run(){if(!(1&this.flags))return this.fn();this.flags|=2,gf(this),sf(this);const e=Jh,t=pf;Jh=this,pf=!0;try{return this.fn()}finally{"production"!==process.env.NODE_ENV&&Jh!==this&&Kh("Active effect was not restored correctly - this is likely a Vue internal bug."),af(this),Jh=e,pf=t,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)df(e);this.deps=this.depsTail=void 0,gf(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){64&this.flags?Xh.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){lf(this)&&this.run()}get dirty(){return lf(this)}}let Qh,ef,tf=0;function nf(e,t=!1){if(e.flags|=8,t)return e.next=ef,void(ef=e);e.next=Qh,Qh=e}function of(){tf++}function rf(){if(--tf>0)return;if(ef){let e=ef;for(ef=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Qh;){let t=Qh;for(Qh=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,1&t.flags)try{t.trigger()}catch(t){e||(e=t)}t=n}}if(e)throw e}function sf(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function af(e){let t,n=e.depsTail,o=n;for(;o;){const e=o.prevDep;-1===o.version?(o===n&&(n=e),df(o),uf(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=e}e.deps=t,e.depsTail=n}function lf(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(cf(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function cf(e){if(4&e.flags&&!(16&e.flags))return;if(e.flags&=-17,e.globalVersion===vf)return;if(e.globalVersion=vf,!e.isSSR&&128&e.flags&&(!e.deps&&!e._dirty||!lf(e)))return;e.flags|=2;const t=e.dep,n=Jh,o=pf;Jh=e,pf=!0;try{sf(e);const n=e.fn(e._value);(0===t.version||_h(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Jh=n,pf=o,af(e),e.flags&=-3}}function df(e,t=!1){const{dep:n,prevSub:o,nextSub:r}=e;if(o&&(o.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=o,e.nextSub=void 0),"production"!==process.env.NODE_ENV&&n.subsHead===e&&(n.subsHead=r),n.subs===e&&(n.subs=o,!o&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)df(e,!0)}t||--n.sc||!n.map||n.map.delete(n.key)}function uf(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let pf=!0;const hf=[];function ff(){hf.push(pf),pf=!1}function mf(){const e=hf.pop();pf=void 0===e||e}function gf(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const e=Jh;Jh=void 0;try{t()}finally{Jh=e}}}let vf=0;class yf{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class wf{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,"production"!==process.env.NODE_ENV&&(this.subsHead=void 0)}track(e){if(!Jh||!pf||Jh===this.computed)return;let t=this.activeLink;if(void 0===t||t.sub!==Jh)t=this.activeLink=new yf(Jh,this),Jh.deps?(t.prevDep=Jh.depsTail,Jh.depsTail.nextDep=t,Jh.depsTail=t):Jh.deps=Jh.depsTail=t,bf(t);else if(-1===t.version&&(t.version=this.version,t.nextDep)){const e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Jh.depsTail,t.nextDep=void 0,Jh.depsTail.nextDep=t,Jh.depsTail=t,Jh.deps===t&&(Jh.deps=e)}return"production"!==process.env.NODE_ENV&&Jh.onTrack&&Jh.onTrack(rh({effect:Jh},e)),t}trigger(e){this.version++,vf++,this.notify(e)}notify(e){of();try{if("production"!==process.env.NODE_ENV)for(let t=this.subsHead;t;t=t.nextSub)!t.sub.onTrigger||8&t.sub.flags||t.sub.onTrigger(rh({effect:t.sub},e));for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{rf()}}}function bf(e){if(e.dep.sc++,4&e.sub.flags){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)bf(e)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),"production"!==process.env.NODE_ENV&&void 0===e.dep.subsHead&&(e.dep.subsHead=e),e.dep.subs=e}}const kf=new WeakMap,Cf=Symbol("production"!==process.env.NODE_ENV?"Object iterate":""),xf=Symbol("production"!==process.env.NODE_ENV?"Map keys iterate":""),Nf=Symbol("production"!==process.env.NODE_ENV?"Array iterate":"");function Sf(e,t,n){if(pf&&Jh){let o=kf.get(e);o||kf.set(e,o=new Map);let r=o.get(n);r||(o.set(n,r=new wf),r.map=o,r.key=n),"production"!==process.env.NODE_ENV?r.track({target:e,type:t,key:n}):r.track()}}function Of(e,t,n,o,r,i){const s=kf.get(e);if(!s)return void vf++;const a=s=>{s&&("production"!==process.env.NODE_ENV?s.trigger({target:e,type:t,key:n,newValue:o,oldValue:r,oldTarget:i}):s.trigger())};if(of(),"clear"===t)s.forEach(a);else{const r=lh(e),i=r&&wh(n);if(r&&"length"===n){const e=Number(o);s.forEach((t,n)=>{("length"===n||n===Nf||!hh(n)&&n>=e)&&a(t)})}else switch((void 0!==n||s.has(void 0))&&a(s.get(n)),i&&a(s.get(Nf)),t){case"add":r?i&&a(s.get("length")):(a(s.get(Cf)),ch(e)&&a(s.get(xf)));break;case"delete":r||(a(s.get(Cf)),ch(e)&&a(s.get(xf)));break;case"set":ch(e)&&a(s.get(Cf))}}rf()}function Ef(e){const t=mm(e);return t===e?t:(Sf(t,"iterate",Nf),hm(e)?t:t.map(gm))}function Mf(e){return Sf(e=mm(e),"iterate",Nf),e}function _f(e,t){return pm(e)?um(e)?vm(gm(t)):vm(t):gm(t)}const Tf={__proto__:null,[Symbol.iterator](){return Df(this,Symbol.iterator,e=>_f(this,e))},concat(...e){return Ef(this).concat(...e.map(e=>lh(e)?Ef(e):e))},entries(){return Df(this,"entries",e=>(e[1]=_f(this,e[1]),e))},every(e,t){return Af(this,"every",e,t,void 0,arguments)},filter(e,t){return Af(this,"filter",e,t,e=>e.map(e=>_f(this,e)),arguments)},find(e,t){return Af(this,"find",e,t,e=>_f(this,e),arguments)},findIndex(e,t){return Af(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Af(this,"findLast",e,t,e=>_f(this,e),arguments)},findLastIndex(e,t){return Af(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Af(this,"forEach",e,t,void 0,arguments)},includes(...e){return Pf(this,"includes",e)},indexOf(...e){return Pf(this,"indexOf",e)},join(e){return Ef(this).join(e)},lastIndexOf(...e){return Pf(this,"lastIndexOf",e)},map(e,t){return Af(this,"map",e,t,void 0,arguments)},pop(){return Lf(this,"pop")},push(...e){return Lf(this,"push",e)},reduce(e,...t){return Rf(this,"reduce",e,t)},reduceRight(e,...t){return Rf(this,"reduceRight",e,t)},shift(){return Lf(this,"shift")},some(e,t){return Af(this,"some",e,t,void 0,arguments)},splice(...e){return Lf(this,"splice",e)},toReversed(){return Ef(this).toReversed()},toSorted(e){return Ef(this).toSorted(e)},toSpliced(...e){return Ef(this).toSpliced(...e)},unshift(...e){return Lf(this,"unshift",e)},values(){return Df(this,"values",e=>_f(this,e))}};function Df(e,t,n){const o=Mf(e),r=o[t]();return o===e||hm(e)||(r._next=r.next,r.next=()=>{const e=r._next();return e.done||(e.value=n(e.value)),e}),r}const If=Array.prototype;function Af(e,t,n,o,r,i){const s=Mf(e),a=s!==e&&!hm(e),l=s[t];if(l!==If[t]){const t=l.apply(e,i);return a?gm(t):t}let c=n;s!==e&&(a?c=function(t,o){return n.call(this,_f(e,t),o,e)}:n.length>2&&(c=function(t,o){return n.call(this,t,o,e)}));const d=l.call(s,c,o);return a&&r?r(d):d}function Rf(e,t,n,o){const r=Mf(e),i=r!==e&&!hm(e);let s=n,a=!1;r!==e&&(i?(a=0===o.length,s=function(t,o,r){return a&&(a=!1,t=_f(e,t)),n.call(this,t,_f(e,o),r,e)}):n.length>3&&(s=function(t,o,r){return n.call(this,t,o,r,e)}));const l=r[t](s,...o);return a?_f(e,l):l}function Pf(e,t,n){const o=mm(e);Sf(o,"iterate",Nf);const r=o[t](...n);return-1!==r&&!1!==r||!fm(n[0])?r:(n[0]=mm(n[0]),o[t](...n))}function Lf(e,t,n=[]){ff(),of();const o=mm(e)[t].apply(e,n);return rf(),mf(),o}const Vf=Xp("__proto__,__v_isRef,__isVue"),jf=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(hh));function $f(e){hh(e)||(e=String(e));const t=mm(this);return Sf(t,"has",e),t.hasOwnProperty(e)}class Bf{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if("__v_skip"===t)return e.__v_skip;const o=this._isReadonly,r=this._isShallow;if("__v_isReactive"===t)return!o;if("__v_isReadonly"===t)return o;if("__v_isShallow"===t)return r;if("__v_raw"===t)return n===(o?r?sm:im:r?rm:om).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=lh(e);if(!o){let e;if(i&&(e=Tf[t]))return e;if("hasOwnProperty"===t)return $f}const s=Reflect.get(e,t,ym(e)?e:n);if(hh(t)?jf.has(t):Vf(t))return s;if(o||Sf(e,"get",t),r)return s;if(ym(s)){const e=i&&wh(t)?s:s.value;return o&&fh(e)?lm(e):e}return fh(s)?o?lm(s):am(s):s}}class Hf extends Bf{constructor(e=!1){super(!1,e)}set(e,t,n,o){let r=e[t];const i=lh(e)&&wh(t);if(!this._isShallow){const o=pm(r);if(hm(n)||pm(n)||(r=mm(r),n=mm(n)),!i&&ym(r)&&!ym(n))return o?("production"!==process.env.NODE_ENV&&Kh(`Set operation on key "${String(t)}" failed: target is readonly.`,e[t]),!0):(r.value=n,!0)}const s=i?Number(t)<e.length:ah(e,t),a=Reflect.set(e,t,n,ym(e)?e:o);return e===mm(o)&&(s?_h(n,r)&&Of(e,"set",t,n,r):Of(e,"add",t,n)),a}deleteProperty(e,t){const n=ah(e,t),o=e[t],r=Reflect.deleteProperty(e,t);return r&&n&&Of(e,"delete",t,void 0,o),r}has(e,t){const n=Reflect.has(e,t);return hh(t)&&jf.has(t)||Sf(e,"has",t),n}ownKeys(e){return Sf(e,"iterate",lh(e)?"length":Cf),Reflect.ownKeys(e)}}class Ff extends Bf{constructor(e=!1){super(!0,e)}set(e,t){return"production"!==process.env.NODE_ENV&&Kh(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return"production"!==process.env.NODE_ENV&&Kh(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const zf=new Hf,qf=new Ff,Wf=new Hf(!0),Uf=new Ff(!0),Kf=e=>e,Gf=e=>Reflect.getPrototypeOf(e);function Jf(e){return function(...t){if("production"!==process.env.NODE_ENV){const n=t[0]?`on key "${t[0]}" `:"";Kh(`${Eh(e)} operation ${n}failed: target is readonly.`,mm(this))}return"delete"!==e&&("clear"===e?void 0:this)}}function Zf(e,t){const n={get(n){const o=this.__v_raw,r=mm(o),i=mm(n);e||(_h(n,i)&&Sf(r,"get",n),Sf(r,"get",i));const{has:s}=Gf(r),a=t?Kf:e?vm:gm;return s.call(r,n)?a(o.get(n)):s.call(r,i)?a(o.get(i)):void(o!==r&&o.get(n))},get size(){const t=this.__v_raw;return!e&&Sf(mm(t),"iterate",Cf),t.size},has(t){const n=this.__v_raw,o=mm(n),r=mm(t);return e||(_h(t,r)&&Sf(o,"has",t),Sf(o,"has",r)),t===r?n.has(t):n.has(t)||n.has(r)},forEach(n,o){const r=this,i=r.__v_raw,s=mm(i),a=t?Kf:e?vm:gm;return!e&&Sf(s,"iterate",Cf),i.forEach((e,t)=>n.call(o,a(e),a(t),r))}};rh(n,e?{add:Jf("add"),set:Jf("set"),delete:Jf("delete"),clear:Jf("clear")}:{add(e){const n=mm(this),o=Gf(n),r=mm(e),i=t||hm(e)||pm(e)?e:r;return o.has.call(n,i)||_h(e,i)&&o.has.call(n,e)||_h(r,i)&&o.has.call(n,r)||(n.add(i),Of(n,"add",i,i)),this},set(e,n){t||hm(n)||pm(n)||(n=mm(n));const o=mm(this),{has:r,get:i}=Gf(o);let s=r.call(o,e);s?"production"!==process.env.NODE_ENV&&nm(o,r,e):(e=mm(e),s=r.call(o,e));const a=i.call(o,e);return o.set(e,n),s?_h(n,a)&&Of(o,"set",e,n,a):Of(o,"add",e,n),this},delete(e){const t=mm(this),{has:n,get:o}=Gf(t);let r=n.call(t,e);r?"production"!==process.env.NODE_ENV&&nm(t,n,e):(e=mm(e),r=n.call(t,e));const i=o?o.call(t,e):void 0,s=t.delete(e);return r&&Of(t,"delete",e,void 0,i),s},clear(){const e=mm(this),t=0!==e.size,n="production"!==process.env.NODE_ENV?ch(e)?new Map(e):new Set(e):void 0,o=e.clear();return t&&Of(e,"clear",void 0,void 0,n),o}});return["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=function(e,t,n){return function(...o){const r=this.__v_raw,i=mm(r),s=ch(i),a="entries"===e||e===Symbol.iterator&&s,l="keys"===e&&s,c=r[e](...o),d=n?Kf:t?vm:gm;return!t&&Sf(i,"iterate",l?xf:Cf),rh(Object.create(c),{next(){const{value:e,done:t}=c.next();return t?{value:e,done:t}:{value:a?[d(e[0]),d(e[1])]:d(e),done:t}}})}}(o,e,t)}),n}function Xf(e,t){const n=Zf(e,t);return(t,o,r)=>"__v_isReactive"===o?!e:"__v_isReadonly"===o?e:"__v_raw"===o?t:Reflect.get(ah(n,o)&&o in t?n:t,o,r)}const Yf={get:Xf(!1,!1)},Qf={get:Xf(!1,!0)},em={get:Xf(!0,!1)},tm={get:Xf(!0,!0)};function nm(e,t,n){const o=mm(n);if(o!==n&&t.call(e,o)){const t=yh(e);Kh(`Reactive ${t} contains both the raw and reactive versions of the same object${"Map"===t?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const om=new WeakMap,rm=new WeakMap,im=new WeakMap,sm=new WeakMap;function am(e){return pm(e)?e:dm(e,!1,zf,Yf,om)}function lm(e){return dm(e,!0,qf,em,im)}function cm(e){return dm(e,!0,Uf,tm,sm)}function dm(e,t,n,o,r){if(!fh(e))return"production"!==process.env.NODE_ENV&&Kh(`value cannot be made ${t?"readonly":"reactive"}: ${String(e)}`),e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const i=(s=e).__v_skip||!Object.isExtensible(s)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(yh(s));var s;if(0===i)return e;const a=r.get(e);if(a)return a;const l=new Proxy(e,2===i?o:n);return r.set(e,l),l}function um(e){return pm(e)?um(e.__v_raw):!(!e||!e.__v_isReactive)}function pm(e){return!(!e||!e.__v_isReadonly)}function hm(e){return!(!e||!e.__v_isShallow)}function fm(e){return!!e&&!!e.__v_raw}function mm(e){const t=e&&e.__v_raw;return t?mm(t):e}const gm=e=>fh(e)?am(e):e,vm=e=>fh(e)?lm(e):e;function ym(e){return!!e&&!0===e.__v_isRef}function wm(e){return km(e,!1)}function bm(e){return km(e,!0)}function km(e,t){return ym(e)?e:new Cm(e,t)}class Cm{constructor(e,t){this.dep=new wf,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:mm(e),this._value=t?e:gm(e),this.__v_isShallow=t}get value(){return"production"!==process.env.NODE_ENV?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||hm(e)||pm(e);e=n?e:mm(e),_h(e,t)&&(this._rawValue=e,this._value=n?e:gm(e),"production"!==process.env.NODE_ENV?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}const xm={get:(e,t,n)=>{return"__v_raw"===t?e:ym(o=Reflect.get(e,t,n))?o.value:o;var o},set:(e,t,n,o)=>{const r=e[t];return ym(r)&&!ym(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function Nm(e){return um(e)?e:new Proxy(e,xm)}class Sm{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new wf(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=vf-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(8&this.flags||Jh===this))return nf(this,!0),!0;process.env.NODE_ENV}get value(){const e="production"!==process.env.NODE_ENV?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return cf(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):"production"!==process.env.NODE_ENV&&Kh("Write operation failed: computed value is readonly")}}const Om={},Em=new WeakMap;let Mm;function _m(e,t,n=Yp){const{immediate:o,deep:r,once:i,scheduler:s,augmentJob:a,call:l}=n,c=e=>{(n.onWarn||Kh)("Invalid watch source: ",e,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},d=e=>r?e:hm(e)||!1===r||0===r?Tm(e,1):Tm(e);let u,p,h,f,m=!1,g=!1;if(ym(e)?(p=()=>e.value,m=hm(e)):um(e)?(p=()=>d(e),m=!0):lh(e)?(g=!0,m=e.some(e=>um(e)||hm(e)),p=()=>e.map(e=>ym(e)?e.value:um(e)?d(e):uh(e)?l?l(e,2):e():void("production"!==process.env.NODE_ENV&&c(e)))):uh(e)?p=t?l?()=>l(e,2):e:()=>{if(h){ff();try{h()}finally{mf()}}const t=Mm;Mm=u;try{return l?l(e,3,[f]):e(f)}finally{Mm=t}}:(p=eh,"production"!==process.env.NODE_ENV&&c(e)),t&&r){const e=p,t=!0===r?1/0:r;p=()=>Tm(e(),t)}const v=Gh,y=()=>{u.stop(),v&&v.active&&ih(v.effects,u)};if(i&&t){const e=t;t=(...t)=>{e(...t),y()}}let w=g?new Array(e.length).fill(Om):Om;const b=e=>{if(1&u.flags&&(u.dirty||e))if(t){const e=u.run();if(r||m||(g?e.some((e,t)=>_h(e,w[t])):_h(e,w))){h&&h();const n=Mm;Mm=u;try{const n=[e,w===Om?void 0:g&&w[0]===Om?[]:w,f];w=e,l?l(t,3,n):t(...n)}finally{Mm=n}}}else u.run()};return a&&a(b),u=new Yh(p),u.scheduler=s?()=>s(b,!1):b,f=e=>function(e,t=!1,n=Mm){if(n){let t=Em.get(n);t||Em.set(n,t=[]),t.push(e)}else"production"===process.env.NODE_ENV||t||Kh("onWatcherCleanup() was called when there was no active watcher to associate with.")}(e,!1,u),h=u.onStop=()=>{const e=Em.get(u);if(e){if(l)l(e,4);else for(const t of e)t();Em.delete(u)}},"production"!==process.env.NODE_ENV&&(u.onTrack=n.onTrack,u.onTrigger=n.onTrigger),t?o?b(!0):w=u.run():s?s(b.bind(null,!0),!0):u.run(),y.pause=u.pause.bind(u),y.resume=u.resume.bind(u),y.stop=y,y}function Tm(e,t=1/0,n){if(t<=0||!fh(e)||e.__v_skip)return e;if(((n=n||new Map).get(e)||0)>=t)return e;if(n.set(e,t),t--,ym(e))Tm(e.value,t,n);else if(lh(e))for(let o=0;o<e.length;o++)Tm(e[o],t,n);else if("[object Set]"===vh(e)||ch(e))e.forEach(e=>{Tm(e,t,n)});else if((e=>"[object Object]"===vh(e))(e)){for(const o in e)Tm(e[o],t,n);for(const o of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,o)&&Tm(e[o],t,n)}return e}
13
+ /**
14
+ * @vue/runtime-core v3.5.32
15
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
+ * @license MIT
17
+ **/const Dm=[];function Im(e){Dm.push(e)}function Am(){Dm.pop()}let Rm=!1;function Pm(e,...t){if(Rm)return;Rm=!0,ff();const n=Dm.length?Dm[Dm.length-1].component:null,o=n&&n.appContext.config.warnHandler,r=function(){let e=Dm[Dm.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const o=e.component&&e.component.parent;e=o&&o.vnode}return t}();if(o)$m(o,n,11,[e+t.map(e=>{var t,n;return null!=(n=null==(t=e.toString)?void 0:t.call(e))?n:JSON.stringify(e)}).join(""),n&&n.proxy,r.map(({vnode:e})=>`at <${uw(n,e.type)}>`).join("\n"),r]);else{const n=[`[Vue warn]: ${e}`,...t];r.length&&n.push("\n",...function(e){const t=[];return e.forEach((e,n)=>{t.push(...0===n?[]:["\n"],...function({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",o=!!e.component&&null==e.component.parent,r=` at <${uw(e.component,e.type,o)}`,i=">"+n;return e.props?[r,...Lm(e.props),i]:[r+i]}(e))}),t}(r)),console.warn(...n)}mf(),Rm=!1}function Lm(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(n=>{t.push(...Vm(n,e[n]))}),n.length>3&&t.push(" ..."),t}function Vm(e,t,n){return ph(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):"number"==typeof t||"boolean"==typeof t||null==t?n?t:[`${e}=${t}`]:ym(t)?(t=Vm(e,mm(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):uh(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=mm(t),n?t:[`${e}=`,t])}const jm={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function $m(e,t,n,o){try{return o?e(...o):e()}catch(e){Hm(e,t,n)}}function Bm(e,t,n,o){if(uh(e)){const r=$m(e,t,n,o);return r&&mh(r)&&r.catch(e=>{Hm(e,t,n)}),r}if(lh(e)){const r=[];for(let i=0;i<e.length;i++)r.push(Bm(e[i],t,n,o));return r}"production"!==process.env.NODE_ENV&&Pm("Invalid value type passed to callWithAsyncErrorHandling(): "+typeof e)}function Hm(e,t,n,o=!0){const r=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Yp;if(t){let o=t.parent;const r=t.proxy,s="production"!==process.env.NODE_ENV?jm[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;o;){const t=o.ec;if(t)for(let n=0;n<t.length;n++)if(!1===t[n](e,r,s))return;o=o.parent}if(i)return ff(),$m(i,null,10,[e,r,s]),void mf()}!function(e,t,n,o=!0,r=!1){if("production"!==process.env.NODE_ENV){const r=jm[t];if(n&&Im(n),Pm("Unhandled error"+(r?` during execution of ${r}`:"")),n&&Am(),o)throw e;console.error(e)}else{if(r)throw e;console.error(e)}}(e,n,r,o,s)}const Fm=[];let zm=-1;const qm=[];let Wm=null,Um=0;const Km=Promise.resolve();let Gm=null;function Jm(e){const t=Gm||Km;return e?t.then(this?e.bind(this):e):t}function Zm(e){if(!(1&e.flags)){const t=tg(e),n=Fm[Fm.length-1];!n||!(2&e.flags)&&t>=tg(n)?Fm.push(e):Fm.splice(function(e){let t=zm+1,n=Fm.length;for(;t<n;){const o=t+n>>>1,r=Fm[o],i=tg(r);i<e||i===e&&2&r.flags?t=o+1:n=o}return t}(t),0,e),e.flags|=1,Xm()}}function Xm(){Gm||(Gm=Km.then(ng))}function Ym(e){lh(e)?qm.push(...e):Wm&&-1===e.id?Wm.splice(Um+1,0,e):1&e.flags||(qm.push(e),e.flags|=1),Xm()}function Qm(e,t,n=zm+1){for("production"!==process.env.NODE_ENV&&(t=t||new Map);n<Fm.length;n++){const o=Fm[n];if(o&&2&o.flags){if(e&&o.id!==e.uid)continue;if("production"!==process.env.NODE_ENV&&og(t,o))continue;Fm.splice(n,1),n--,4&o.flags&&(o.flags&=-2),o(),4&o.flags||(o.flags&=-2)}}}function eg(e){if(qm.length){const t=[...new Set(qm)].sort((e,t)=>tg(e)-tg(t));if(qm.length=0,Wm)return void Wm.push(...t);for(Wm=t,"production"!==process.env.NODE_ENV&&(e=e||new Map),Um=0;Um<Wm.length;Um++){const t=Wm[Um];"production"!==process.env.NODE_ENV&&og(e,t)||(4&t.flags&&(t.flags&=-2),8&t.flags||t(),t.flags&=-2)}Wm=null,Um=0}}const tg=e=>null==e.id?2&e.flags?-1:1/0:e.id;function ng(e){"production"!==process.env.NODE_ENV&&(e=e||new Map);const t="production"!==process.env.NODE_ENV?t=>og(e,t):eh;try{for(zm=0;zm<Fm.length;zm++){const e=Fm[zm];if(e&&!(8&e.flags)){if("production"!==process.env.NODE_ENV&&t(e))continue;4&e.flags&&(e.flags&=-2),$m(e,e.i,e.i?15:14),4&e.flags||(e.flags&=-2)}}}finally{for(;zm<Fm.length;zm++){const e=Fm[zm];e&&(e.flags&=-2)}zm=-1,Fm.length=0,eg(e),Gm=null,(Fm.length||qm.length)&&ng(e)}}function og(e,t){const n=e.get(t)||0;if(n>100){const e=t.i,n=e&&dw(e.type);return Hm(`Maximum recursive updates exceeded${n?` in component <${n}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return e.set(t,n+1),!1}let rg=!1;const ig=e=>{try{return rg}finally{rg=e}},sg=new Map;"production"!==process.env.NODE_ENV&&(Rh().__VUE_HMR_RUNTIME__={createRecord:ug(lg),rerender:ug(function(e,t){const n=ag.get(e);if(!n)return;n.initialDef.render=t,[...n.instances].forEach(e=>{t&&(e.render=t,cg(e.type).render=t),e.renderCache=[],rg=!0,8&e.job.flags||e.update(),rg=!1})}),reload:ug(function(e,t){const n=ag.get(e);if(!n)return;t=cg(t),dg(n.initialDef,t);const o=[...n.instances];for(let e=0;e<o.length;e++){const r=o[e],i=cg(r.type);let s=sg.get(i);s||(i!==n.initialDef&&dg(i,t),sg.set(i,s=new Set)),s.add(r),r.appContext.propsCache.delete(r.type),r.appContext.emitsCache.delete(r.type),r.appContext.optionsCache.delete(r.type),r.ceReload?(s.add(r),r.ceReload(t.styles),s.delete(r)):r.parent?Zm(()=>{8&r.job.flags||(rg=!0,r.parent.update(),rg=!1,s.delete(r))}):r.appContext.reload?r.appContext.reload():"undefined"!=typeof window?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),r.root.ce&&r!==r.root&&r.root.ce._removeChildStyle(i)}Ym(()=>{sg.clear()})})});const ag=new Map;function lg(e,t){return!ag.has(e)&&(ag.set(e,{initialDef:cg(t),instances:new Set}),!0)}function cg(e){return pw(e)?e.__vccOpts:e}function dg(e,t){rh(e,t);for(const n in e)"__file"===n||n in t||delete e[n]}function ug(e){return(t,n)=>{try{return e(t,n)}catch(e){console.error(e),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let pg,hg=[],fg=!1;function mg(e,...t){pg?pg.emit(e,...t):fg||hg.push({event:e,args:t})}function gg(e,t){var n,o;if(pg=e,pg)pg.enabled=!0,hg.forEach(({event:e,args:t})=>pg.emit(e,...t)),hg=[];else if("undefined"!=typeof window&&window.HTMLElement&&!(null==(o=null==(n=window.navigator)?void 0:n.userAgent)?void 0:o.includes("jsdom"))){(t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(e=>{gg(e,t)}),setTimeout(()=>{pg||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,fg=!0,hg=[])},3e3)}else fg=!0,hg=[]}const vg=bg("component:added"),yg=bg("component:updated"),wg=bg("component:removed");function bg(e){return t=>{mg(e,t.appContext.app,t.uid,t.parent?t.parent.uid:void 0,t)}}const kg=xg("perf:start"),Cg=xg("perf:end");function xg(e){return(t,n,o)=>{mg(e,t.appContext.app,t.uid,t,n,o)}}let Ng=null,Sg=null;function Og(e){const t=Ng;return Ng=e,Sg=e&&e.type.__scopeId||null,t}function Eg(e){kh(e)&&Pm("Do not use built-in directive ids as custom directive id: "+e)}function Mg(e,t,n,o){const r=e.dirs,i=t&&t.dirs;for(let s=0;s<r.length;s++){const a=r[s];i&&(a.oldValue=i[s].value);let l=a.dir[o];l&&(ff(),Bm(l,n,8,[e.el,a,e,t]),mf())}}function _g(e,t,n=!1){const o=Gy();if(o||Iv){let r=Iv?Iv._context.provides:o?null==o.parent||o.ce?o.vnode.appContext&&o.vnode.appContext.provides:o.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return n&&uh(t)?t.call(o&&o.proxy):t;"production"!==process.env.NODE_ENV&&Pm(`injection "${String(e)}" not found.`)}else"production"!==process.env.NODE_ENV&&Pm("inject() can only be used inside setup() or functional components.")}const Tg=Symbol.for("v-scx");function Dg(e,t){return Ag(e,null,t)}function Ig(e,t,n){return"production"===process.env.NODE_ENV||uh(t)||Pm("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),Ag(e,t,n)}function Ag(e,t,n=Yp){const{immediate:o,deep:r,flush:i,once:s}=n;"production"===process.env.NODE_ENV||t||(void 0!==o&&Pm('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==r&&Pm('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==s&&Pm('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const a=rh({},n);"production"!==process.env.NODE_ENV&&(a.onWarn=Pm);const l=t&&o||!t&&"post"!==i;let c;if(nw)if("sync"===i){const e=(()=>{{const e=_g(Tg);return e||"production"!==process.env.NODE_ENV&&Pm("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),e}})();c=e.__watcherHandles||(e.__watcherHandles=[])}else if(!l){const e=()=>{};return e.stop=eh,e.resume=eh,e.pause=eh,e}const d=Ky;a.call=(e,t,n)=>Bm(e,d,t,n);let u=!1;"post"===i?a.scheduler=e=>{wy(e,d&&d.suspense)}:"sync"!==i&&(u=!0,a.scheduler=(e,t)=>{t?e():Zm(e)}),a.augmentJob=e=>{t&&(e.flags|=4),u&&(e.flags|=2,d&&(e.id=d.uid,e.i=d))};const p=_m(e,t,a);return nw&&(c?c.push(p):l&&p()),p}function Rg(e,t,n){const o=this.proxy,r=ph(e)?e.includes(".")?Pg(o,e):()=>o[e]:e.bind(o,o);let i;uh(t)?i=t:(i=t.handler,n=t);const s=Xy(this),a=Ag(r,i.bind(o),n);return s(),a}function Pg(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}const Lg=Symbol("_vte"),Vg=Symbol("_leaveCb");function jg(e,t){6&e.shapeFlag&&e.component?(e.transition=t,jg(e.component.subTree,t)):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function $g(e,t){return uh(e)?(()=>rh({name:e.name},t,{setup:e}))():e}function Bg(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}const Hg=new WeakSet;function Fg(e,t){let n;return!(!(n=Object.getOwnPropertyDescriptor(e,t))||n.configurable)}const zg=new WeakMap;function qg(e,t,n,o,r=!1){if(lh(e))return void e.forEach((e,i)=>qg(e,t&&(lh(t)?t[i]:t),n,o,r));if(Ug(o)&&!r)return void(512&o.shapeFlag&&o.type.__asyncResolved&&o.component.subTree.component&&qg(e,t,n,o.component.subTree));const i=4&o.shapeFlag?aw(o.component):o.el,s=r?null:i,{i:a,r:l}=e;if("production"!==process.env.NODE_ENV&&!a)return void Pm("Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.");const c=t&&t.r,d=a.refs===Yp?a.refs={}:a.refs,u=a.setupState,p=mm(u),h=u===Yp?th:e=>("production"===process.env.NODE_ENV||(ah(p,e)&&!ym(p[e])&&Pm(`Template ref "${e}" used on a non-ref value. It will not work in the production build.`),!Hg.has(p[e])))&&(!Fg(d,e)&&ah(p,e)),f=(e,t)=>("production"===process.env.NODE_ENV||!Hg.has(e))&&(!t||!Fg(d,t));if(null!=c&&c!==l)if(Wg(t),ph(c))d[c]=null,h(c)&&(u[c]=null);else if(ym(c)){const e=t;f(c,e.k)&&(c.value=null),e.k&&(d[e.k]=null)}if(uh(l))$m(l,a,12,[s,d]);else{const t=ph(l),o=ym(l);if(t||o){const a=()=>{if(e.f){const n=t?h(l)?u[l]:d[l]:f(l)||!e.k?l.value:d[e.k];if(r)lh(n)&&ih(n,i);else if(lh(n))n.includes(i)||n.push(i);else if(t)d[l]=[i],h(l)&&(u[l]=d[l]);else{const t=[i];f(l,e.k)&&(l.value=t),e.k&&(d[e.k]=t)}}else t?(d[l]=s,h(l)&&(u[l]=s)):o?(f(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s)):"production"!==process.env.NODE_ENV&&Pm("Invalid template ref type:",l,`(${typeof l})`)};if(s){const t=()=>{a(),zg.delete(e)};t.id=-1,zg.set(e,t),wy(t,n)}else Wg(e),a()}else"production"!==process.env.NODE_ENV&&Pm("Invalid template ref type:",l,`(${typeof l})`)}}function Wg(e){const t=zg.get(e);t&&(t.flags|=8,zg.delete(e))}Rh().requestIdleCallback,Rh().cancelIdleCallback;const Ug=e=>!!e.type.__asyncLoader,Kg=e=>e.type.__isKeepAlive;function Gg(e,t){Zg(e,"a",t)}function Jg(e,t){Zg(e,"da",t)}function Zg(e,t,n=Ky){const o=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(Yg(t,o,n),n){let e=n.parent;for(;e&&e.parent;)Kg(e.parent.vnode)&&Xg(o,t,n,e),e=e.parent}}function Xg(e,t,n,o){const r=Yg(t,e,o,!0);iv(()=>{ih(o[t],r)},n)}function Yg(e,t,n=Ky,o=!1){if(n){const r=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...o)=>{ff();const r=Xy(n),i=Bm(t,n,e,o);return r(),mf(),i});return o?r.unshift(i):r.push(i),i}if("production"!==process.env.NODE_ENV){Pm(`${Mh(jm[e].replace(/ hook$/,""))} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}}const Qg=e=>(t,n=Ky)=>{nw&&"sp"!==e||Yg(e,(...e)=>t(...e),n)},ev=Qg("bm"),tv=Qg("m"),nv=Qg("bu"),ov=Qg("u"),rv=Qg("bum"),iv=Qg("um"),sv=Qg("sp"),av=Qg("rtg"),lv=Qg("rtc");function cv(e,t=Ky){Yg("ec",e,t)}const dv=Symbol.for("v-ndc"),uv=e=>e?tw(e)?aw(e):uv(e.parent):null,pv=rh(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>"production"!==process.env.NODE_ENV?cm(e.props):e.props,$attrs:e=>"production"!==process.env.NODE_ENV?cm(e.attrs):e.attrs,$slots:e=>"production"!==process.env.NODE_ENV?cm(e.slots):e.slots,$refs:e=>"production"!==process.env.NODE_ENV?cm(e.refs):e.refs,$parent:e=>uv(e.parent),$root:e=>uv(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>__VUE_OPTIONS_API__?kv(e):e.type,$forceUpdate:e=>e.f||(e.f=()=>{Zm(e.update)}),$nextTick:e=>e.n||(e.n=Jm.bind(e.proxy)),$watch:e=>__VUE_OPTIONS_API__?Rg.bind(e):eh}),hv=e=>"_"===e||"$"===e,fv=(e,t)=>e!==Yp&&!e.__isScriptSetup&&ah(e,t),mv={get({_:e},t){if("__v_skip"===t)return!0;const{ctx:n,setupState:o,data:r,props:i,accessCache:s,type:a,appContext:l}=e;if("production"!==process.env.NODE_ENV&&"__isVue"===t)return!0;if("$"!==t[0]){const e=s[t];if(void 0!==e)switch(e){case 1:return o[t];case 2:return r[t];case 4:return n[t];case 3:return i[t]}else{if(fv(o,t))return s[t]=1,o[t];if(__VUE_OPTIONS_API__&&r!==Yp&&ah(r,t))return s[t]=2,r[t];if(ah(i,t))return s[t]=3,i[t];if(n!==Yp&&ah(n,t))return s[t]=4,n[t];__VUE_OPTIONS_API__&&!vv||(s[t]=0)}}const c=pv[t];let d,u;return c?("$attrs"===t?(Sf(e.attrs,"get",""),"production"!==process.env.NODE_ENV&&jv()):"production"!==process.env.NODE_ENV&&"$slots"===t&&Sf(e,"get",t),c(e)):(d=a.__cssModules)&&(d=d[t])?d:n!==Yp&&ah(n,t)?(s[t]=4,n[t]):(u=l.config.globalProperties,ah(u,t)?u[t]:void("production"===process.env.NODE_ENV||!Ng||ph(t)&&0===t.indexOf("__v")||(r!==Yp&&hv(t[0])&&ah(r,t)?Pm(`Property ${JSON.stringify(t)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):e===Ng&&Pm(`Property ${JSON.stringify(t)} was accessed during render but is not defined on instance.`))))},set({_:e},t,n){const{data:o,setupState:r,ctx:i}=e;return fv(r,t)?(r[t]=n,!0):"production"!==process.env.NODE_ENV&&r.__isScriptSetup&&ah(r,t)?(Pm(`Cannot mutate <script setup> binding "${t}" from Options API.`),!1):__VUE_OPTIONS_API__&&o!==Yp&&ah(o,t)?(o[t]=n,!0):ah(e.props,t)?("production"!==process.env.NODE_ENV&&Pm(`Attempting to mutate prop "${t}". Props are readonly.`),!1):"$"===t[0]&&t.slice(1)in e?("production"!==process.env.NODE_ENV&&Pm(`Attempting to mutate public property "${t}". Properties starting with $ are reserved and readonly.`),!1):("production"!==process.env.NODE_ENV&&t in e.appContext.config.globalProperties?Object.defineProperty(i,t,{enumerable:!0,configurable:!0,value:n}):i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:r,props:i,type:s}},a){let l;return!!(n[a]||__VUE_OPTIONS_API__&&e!==Yp&&"$"!==a[0]&&ah(e,a)||fv(t,a)||ah(i,a)||ah(o,a)||ah(pv,a)||ah(r.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:ah(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function gv(e){return lh(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}"production"!==process.env.NODE_ENV&&(mv.ownKeys=e=>(Pm("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(e)));let vv=!0;function yv(e){const t=kv(e),n=e.proxy,o=e.ctx;vv=!1,t.beforeCreate&&wv(t.beforeCreate,e,"bc");const{data:r,computed:i,methods:s,watch:a,provide:l,inject:c,created:d,beforeMount:u,mounted:p,beforeUpdate:h,updated:f,activated:m,deactivated:g,beforeDestroy:v,beforeUnmount:y,destroyed:w,unmounted:b,render:k,renderTracked:C,renderTriggered:x,errorCaptured:N,serverPrefetch:S,expose:O,inheritAttrs:E,components:M,directives:_,filters:T}=t,D="production"!==process.env.NODE_ENV?function(){const e=Object.create(null);return(t,n)=>{e[n]?Pm(`${t} property "${n}" is already defined in ${e[n]}.`):e[n]=t}}():null;if("production"!==process.env.NODE_ENV){const[t]=e.propsOptions;if(t)for(const e in t)D("Props",e)}if(c&&function(e,t,n=eh){lh(e)&&(e=Sv(e));for(const o in e){const r=e[o];let i;i=fh(r)?"default"in r?_g(r.from||o,r.default,!0):_g(r.from||o):_g(r),ym(i)?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[o]=i,"production"!==process.env.NODE_ENV&&n("Inject",o)}}(c,o,D),s)for(const e in s){const t=s[e];uh(t)?("production"!==process.env.NODE_ENV?Object.defineProperty(o,e,{value:t.bind(n),configurable:!0,enumerable:!0,writable:!0}):o[e]=t.bind(n),"production"!==process.env.NODE_ENV&&D("Methods",e)):"production"!==process.env.NODE_ENV&&Pm(`Method "${e}" has type "${typeof t}" in the component definition. Did you reference the function correctly?`)}if(r){"production"===process.env.NODE_ENV||uh(r)||Pm("The data option must be a function. Plain object usage is no longer supported.");const t=r.call(n,n);if("production"!==process.env.NODE_ENV&&mh(t)&&Pm("data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>."),fh(t)){if(e.data=am(t),"production"!==process.env.NODE_ENV)for(const e in t)D("Data",e),hv(e[0])||Object.defineProperty(o,e,{configurable:!0,enumerable:!0,get:()=>t[e],set:eh})}else"production"!==process.env.NODE_ENV&&Pm("data() should return an object.")}if(vv=!0,i)for(const e in i){const t=i[e],r=uh(t)?t.bind(n,n):uh(t.get)?t.get.bind(n,n):eh;"production"!==process.env.NODE_ENV&&r===eh&&Pm(`Computed property "${e}" has no getter.`);const s=!uh(t)&&uh(t.set)?t.set.bind(n):"production"!==process.env.NODE_ENV?()=>{Pm(`Write operation failed: computed property "${e}" is readonly.`)}:eh,a=hw({get:r,set:s});Object.defineProperty(o,e,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e}),"production"!==process.env.NODE_ENV&&D("Computed",e)}if(a)for(const e in a)bv(a[e],o,n,e);if(l){const e=uh(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{!function(e,t){if("production"!==process.env.NODE_ENV&&(Ky&&!Ky.isMounted||Pm("provide() can only be used inside setup().")),Ky){let n=Ky.provides;const o=Ky.parent&&Ky.parent.provides;o===n&&(n=Ky.provides=Object.create(o)),n[e]=t}}(t,e[t])})}function I(e,t){lh(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(d&&wv(d,e,"c"),I(ev,u),I(tv,p),I(nv,h),I(ov,f),I(Gg,m),I(Jg,g),I(cv,N),I(lv,C),I(av,x),I(rv,y),I(iv,b),I(sv,S),lh(O))if(O.length){const t=e.exposed||(e.exposed={});O.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||(e.exposed={});k&&e.render===eh&&(e.render=k),null!=E&&(e.inheritAttrs=E),M&&(e.components=M),_&&(e.directives=_),S&&Bg(e)}function wv(e,t,n){Bm(lh(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function bv(e,t,n,o){let r=o.includes(".")?Pg(n,o):()=>n[o];if(ph(e)){const n=t[e];uh(n)?Ig(r,n):"production"!==process.env.NODE_ENV&&Pm(`Invalid watch handler specified by key "${e}"`,n)}else if(uh(e))Ig(r,e.bind(n));else if(fh(e))if(lh(e))e.forEach(e=>bv(e,t,n,o));else{const o=uh(e.handler)?e.handler.bind(n):t[e.handler];uh(o)?Ig(r,o,e):"production"!==process.env.NODE_ENV&&Pm(`Invalid watch handler specified by key "${e.handler}"`,o)}else"production"!==process.env.NODE_ENV&&Pm(`Invalid watch option: "${o}"`,e)}function kv(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:i,config:{optionMergeStrategies:s}}=e.appContext,a=i.get(t);let l;return a?l=a:r.length||n||o?(l={},r.length&&r.forEach(e=>Cv(l,e,s,!0)),Cv(l,t,s)):l=t,fh(t)&&i.set(t,l),l}function Cv(e,t,n,o=!1){const{mixins:r,extends:i}=t;i&&Cv(e,i,n,!0),r&&r.forEach(t=>Cv(e,t,n,!0));for(const r in t)if(o&&"expose"===r)"production"!==process.env.NODE_ENV&&Pm('"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.');else{const o=xv[r]||n&&n[r];e[r]=o?o(e[r],t[r]):t[r]}return e}const xv={data:Nv,props:Mv,emits:Mv,methods:Ev,computed:Ev,beforeCreate:Ov,created:Ov,beforeMount:Ov,mounted:Ov,beforeUpdate:Ov,updated:Ov,beforeDestroy:Ov,beforeUnmount:Ov,destroyed:Ov,unmounted:Ov,activated:Ov,deactivated:Ov,errorCaptured:Ov,serverPrefetch:Ov,components:Ev,directives:Ev,watch:function(e,t){if(!e)return t;if(!t)return e;const n=rh(Object.create(null),e);for(const o in t)n[o]=Ov(e[o],t[o]);return n},provide:Nv,inject:function(e,t){return Ev(Sv(e),Sv(t))}};function Nv(e,t){return t?e?function(){return rh(uh(e)?e.call(this,this):e,uh(t)?t.call(this,this):t)}:t:e}function Sv(e){if(lh(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Ov(e,t){return e?[...new Set([].concat(e,t))]:t}function Ev(e,t){return e?rh(Object.create(null),e,t):t}function Mv(e,t){return e?lh(e)&&lh(t)?[...new Set([...e,...t])]:rh(Object.create(null),gv(e),gv(null!=t?t:{})):t}function _v(){return{app:null,config:{isNativeTag:th,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Tv=0;function Dv(e,t){return function(t,n=null){uh(t)||(t=rh({},t)),null==n||fh(n)||("production"!==process.env.NODE_ENV&&Pm("root props passed to app.mount() must be an object."),n=null);const o=_v(),r=new WeakSet,i=[];let s=!1;const a=o.app={_uid:Tv++,_component:t,_props:n,_container:null,_context:o,_instance:null,version:mw,get config(){return o.config},set config(e){"production"!==process.env.NODE_ENV&&Pm("app.config cannot be replaced. Modify individual options instead.")},use:(e,...t)=>(r.has(e)?"production"!==process.env.NODE_ENV&&Pm("Plugin has already been applied to target app."):e&&uh(e.install)?(r.add(e),e.install(a,...t)):uh(e)?(r.add(e),e(a,...t)):"production"!==process.env.NODE_ENV&&Pm('A plugin must either be a function or an object with an "install" function.'),a),mixin:e=>(__VUE_OPTIONS_API__?o.mixins.includes(e)?"production"!==process.env.NODE_ENV&&Pm("Mixin has already been applied to target app"+(e.name?`: ${e.name}`:"")):o.mixins.push(e):"production"!==process.env.NODE_ENV&&Pm("Mixins are only available in builds supporting Options API"),a),component:(e,t)=>("production"!==process.env.NODE_ENV&&ew(e,o.config),t?("production"!==process.env.NODE_ENV&&o.components[e]&&Pm(`Component "${e}" has already been registered in target app.`),o.components[e]=t,a):o.components[e]),directive:(e,t)=>("production"!==process.env.NODE_ENV&&Eg(e),t?("production"!==process.env.NODE_ENV&&o.directives[e]&&Pm(`Directive "${e}" has already been registered in target app.`),o.directives[e]=t,a):o.directives[e]),mount(r,i,l){if(!s){"production"!==process.env.NODE_ENV&&r.__vue_app__&&Pm("There is already an app instance mounted on the host container.\n If you want to mount another app on the same host container, you need to unmount the previous app by calling `app.unmount()` first.");const i=a._ceVNode||Ly(t,n);return i.appContext=o,!0===l?l="svg":!1===l&&(l=void 0),"production"!==process.env.NODE_ENV&&(o.reload=()=>{const t=jy(i);t.el=null,e(t,r,l)}),e(i,r,l),s=!0,a._container=r,r.__vue_app__=a,("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(a._instance=i.component,function(e,t){mg("app:init",e,t,{Fragment:My,Text:_y,Comment:Ty,Static:Dy})}(a,mw)),aw(i.component)}"production"!==process.env.NODE_ENV&&Pm("App has already been mounted.\nIf you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. `const createMyApp = () => createApp(App)`")},onUnmount(e){"production"!==process.env.NODE_ENV&&"function"!=typeof e&&Pm("Expected function as first argument to app.onUnmount(), but got "+typeof e),i.push(e)},unmount(){s?(Bm(i,a._instance,16),e(null,a._container),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(a._instance=null,function(e){mg("app:unmount",e)}(a)),delete a._container.__vue_app__):"production"!==process.env.NODE_ENV&&Pm("Cannot unmount an app that is not mounted.")},provide:(e,t)=>("production"!==process.env.NODE_ENV&&e in o.provides&&(ah(o.provides,e)?Pm(`App already provides property with key "${String(e)}". It will be overwritten with the new value.`):Pm(`App already provides property with key "${String(e)}" inherited from its parent element. It will be overwritten with the new value.`)),o.provides[e]=t,a),runWithContext(e){const t=Iv;Iv=a;try{return e()}finally{Iv=t}}};return a}}let Iv=null;function Av(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||Yp;if("production"!==process.env.NODE_ENV){const{emitsOptions:o,propsOptions:[r]}=e;if(o)if(t in o){const e=o[t];if(uh(e)){e(...n)||Pm(`Invalid event arguments: event validation failed for event "${t}".`)}}else r&&Mh(Nh(t))in r||Pm(`Component emitted event "${t}" but it is neither declared in the emits option nor as an "${Mh(Nh(t))}" prop.`)}let r=n;const i=t.startsWith("update:"),s=i&&((e,t)=>"modelValue"===t||"model-value"===t?e.modelModifiers:e[`${t}Modifiers`]||e[`${Nh(t)}Modifiers`]||e[`${Oh(t)}Modifiers`])(o,t.slice(7));if(s&&(s.trim&&(r=n.map(e=>ph(e)?e.trim():e)),s.number&&(r=n.map(Ih))),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&function(e,t,n){mg("component:emit",e.appContext.app,e,t,n)}(e,t,r),"production"!==process.env.NODE_ENV){const n=t.toLowerCase();n!==t&&o[Mh(n)]&&Pm(`Event "${n}" is emitted in component ${uw(e,e.type)} but the handler is registered for "${t}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${Oh(t)}" instead of "${t}".`)}let a,l=o[a=Mh(t)]||o[a=Mh(Nh(t))];!l&&i&&(l=o[a=Mh(Oh(t))]),l&&Bm(l,e,6,r);const c=o[a+"Once"];if(c){if(e.emitted){if(e.emitted[a])return}else e.emitted={};e.emitted[a]=!0,Bm(c,e,6,r)}}const Rv=new WeakMap;function Pv(e,t,n=!1){const o=__VUE_OPTIONS_API__&&n?Rv:t.emitsCache,r=o.get(e);if(void 0!==r)return r;const i=e.emits;let s={},a=!1;if(__VUE_OPTIONS_API__&&!uh(e)){const o=e=>{const n=Pv(e,t,!0);n&&(a=!0,rh(s,n))};!n&&t.mixins.length&&t.mixins.forEach(o),e.extends&&o(e.extends),e.mixins&&e.mixins.forEach(o)}return i||a?(lh(i)?i.forEach(e=>s[e]=null):rh(s,i),fh(e)&&o.set(e,s),s):(fh(e)&&o.set(e,null),null)}function Lv(e,t){return!(!e||!nh(t))&&(t=t.slice(2).replace(/Once$/,""),ah(e,t[0].toLowerCase()+t.slice(1))||ah(e,Oh(t))||ah(e,t))}let Vv=!1;function jv(){Vv=!0}function $v(e){const{type:t,vnode:n,proxy:o,withProxy:r,propsOptions:[i],slots:s,attrs:a,emit:l,render:c,renderCache:d,props:u,data:p,setupState:h,ctx:f,inheritAttrs:m}=e,g=Og(e);let v,y;"production"!==process.env.NODE_ENV&&(Vv=!1);try{if(4&n.shapeFlag){const e=r||o,t="production"!==process.env.NODE_ENV&&h.__isScriptSetup?new Proxy(e,{get:(e,t,n)=>(Pm(`Property '${String(t)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(e,t,n))}):e;v=Hy(c.call(t,e,d,"production"!==process.env.NODE_ENV?cm(u):u,h,p,f)),y=a}else{const e=t;"production"!==process.env.NODE_ENV&&a===u&&jv(),v=Hy(e.length>1?e("production"!==process.env.NODE_ENV?cm(u):u,"production"!==process.env.NODE_ENV?{get attrs(){return jv(),cm(a)},slots:s,emit:l}:{attrs:a,slots:s,emit:l}):e("production"!==process.env.NODE_ENV?cm(u):u,null)),y=t.props?a:Fv(a)}}catch(t){Hm(t,e,1),v=Ly(Ty)}let w,b=v;if("production"!==process.env.NODE_ENV&&v.patchFlag>0&&2048&v.patchFlag&&([b,w]=Bv(v)),y&&!1!==m){const e=Object.keys(y),{shapeFlag:t}=b;if(e.length)if(7&t)i&&e.some(oh)&&(y=zv(y,i)),b=jy(b,y,!1,!0);else if("production"!==process.env.NODE_ENV&&!Vv&&b.type!==Ty){const e=Object.keys(a),t=[],n=[];for(let o=0,r=e.length;o<r;o++){const r=e[o];nh(r)?oh(r)||t.push(r[2].toLowerCase()+r.slice(3)):n.push(r)}n.length&&Pm(`Extraneous non-props attributes (${n.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`),t.length&&Pm(`Extraneous non-emits event listeners (${t.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`)}}return n.dirs&&("production"===process.env.NODE_ENV||qv(b)||Pm("Runtime directive used on component with non-element root node. The directives will not function as intended."),b=jy(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&("production"===process.env.NODE_ENV||qv(b)||Pm("Component inside <Transition> renders non-element root node that cannot be animated."),jg(b,n.transition)),"production"!==process.env.NODE_ENV&&w?w(b):v=b,Og(g),v}const Bv=e=>{const t=e.children,n=e.dynamicChildren,o=Hv(t,!1);if(!o)return[e,void 0];if("production"!==process.env.NODE_ENV&&o.patchFlag>0&&2048&o.patchFlag)return Bv(o);const r=t.indexOf(o),i=n?n.indexOf(o):-1;return[Hy(o),o=>{t[r]=o,n&&(i>-1?n[i]=o:o.patchFlag>0&&(e.dynamicChildren=[...n,o]))}]};function Hv(e,t=!0){let n;for(let o=0;o<e.length;o++){const r=e[o];if(!Iy(r))return;if(r.type!==Ty||"v-if"===r.children){if(n)return;if(n=r,"production"!==process.env.NODE_ENV&&t&&n.patchFlag>0&&2048&n.patchFlag)return Hv(n.children)}}return n}const Fv=e=>{let t;for(const n in e)("class"===n||"style"===n||nh(n))&&((t||(t={}))[n]=e[n]);return t},zv=(e,t)=>{const n={};for(const o in e)oh(o)&&o.slice(9)in t||(n[o]=e[o]);return n},qv=e=>7&e.shapeFlag||e.type===Ty;function Wv(e,t,n){const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!0;for(let r=0;r<o.length;r++){const i=o[r];if(Uv(t,e,i)&&!Lv(n,i))return!0}return!1}function Uv(e,t,n){const o=e[n],r=t[n];return"style"===n&&fh(o)&&fh(r)?!Uh(o,r):o!==r}const Kv={},Gv=()=>Object.create(Kv),Jv=e=>Object.getPrototypeOf(e)===Kv;function Zv(e,t,n,o=!1){const r={},i=Gv();e.propsDefaults=Object.create(null),Xv(e,t,r,i);for(const t in e.propsOptions[0])t in r||(r[t]=void 0);"production"!==process.env.NODE_ENV&&ny(t||{},r,e),n?e.props=o?r:dm(r,!1,Wf,Qf,rm):e.type.props?e.props=r:e.props=i,e.attrs=i}function Xv(e,t,n,o){const[r,i]=e.propsOptions;let s,a=!1;if(t)for(let l in t){if(bh(l))continue;const c=t[l];let d;r&&ah(r,d=Nh(l))?i&&i.includes(d)?(s||(s={}))[d]=c:n[d]=c:Lv(e.emitsOptions,l)||l in o&&c===o[l]||(o[l]=c,a=!0)}if(i){const t=mm(n),o=s||Yp;for(let s=0;s<i.length;s++){const a=i[s];n[a]=Yv(r,t,a,o[a],e,!ah(o,a))}}return a}function Yv(e,t,n,o,r,i){const s=e[n];if(null!=s){const e=ah(s,"default");if(e&&void 0===o){const e=s.default;if(s.type!==Function&&!s.skipFactory&&uh(e)){const{propsDefaults:i}=r;if(n in i)o=i[n];else{const s=Xy(r);o=i[n]=e.call(null,t),s()}}else o=e;r.ce&&r.ce._setProp(n,o)}s[0]&&(i&&!e?o=!1:!s[1]||""!==o&&o!==Oh(n)||(o=!0))}return o}const Qv=new WeakMap;function ey(e,t,n=!1){const o=__VUE_OPTIONS_API__&&n?Qv:t.propsCache,r=o.get(e);if(r)return r;const i=e.props,s={},a=[];let l=!1;if(__VUE_OPTIONS_API__&&!uh(e)){const o=e=>{l=!0;const[n,o]=ey(e,t,!0);rh(s,n),o&&a.push(...o)};!n&&t.mixins.length&&t.mixins.forEach(o),e.extends&&o(e.extends),e.mixins&&e.mixins.forEach(o)}if(!i&&!l)return fh(e)&&o.set(e,Qp),Qp;if(lh(i))for(let e=0;e<i.length;e++){"production"===process.env.NODE_ENV||ph(i[e])||Pm("props must be strings when using array syntax.",i[e]);const t=Nh(i[e]);ty(t)&&(s[t]=Yp)}else if(i){"production"===process.env.NODE_ENV||fh(i)||Pm("invalid props options",i);for(const e in i){const t=Nh(e);if(ty(t)){const n=i[e],o=s[t]=lh(n)||uh(n)?{type:n}:rh({},n),r=o.type;let l=!1,c=!0;if(lh(r))for(let e=0;e<r.length;++e){const t=r[e],n=uh(t)&&t.name;if("Boolean"===n){l=!0;break}"String"===n&&(c=!1)}else l=uh(r)&&"Boolean"===r.name;o[0]=l,o[1]=c,(l||ah(o,"default"))&&a.push(t)}}}const c=[s,a];return fh(e)&&o.set(e,c),c}function ty(e){return"$"!==e[0]&&!bh(e)||("production"!==process.env.NODE_ENV&&Pm(`Invalid prop name: "${e}" is a reserved property.`),!1)}function ny(e,t,n){const o=mm(t),r=n.propsOptions[0],i=Object.keys(e).map(e=>Nh(e));for(const e in r){let t=r[e];null!=t&&oy(e,o[e],t,"production"!==process.env.NODE_ENV?cm(o):o,!i.includes(e))}}function oy(e,t,n,o,r){const{type:i,required:s,validator:a,skipCheck:l}=n;if(s&&r)Pm('Missing required prop: "'+e+'"');else if(null!=t||s){if(null!=i&&!0!==i&&!l){let n=!1;const o=lh(i)?i:[i],r=[];for(let e=0;e<o.length&&!n;e++){const{valid:i,expectedType:s}=iy(t,o[e]);r.push(s||""),n=i}if(!n)return void Pm(function(e,t,n){if(0===n.length)return`Prop type [] for prop "${e}" won't match anything. Did you mean to use type Array instead?`;let o=`Invalid prop: type check failed for prop "${e}". Expected ${n.map(Eh).join(" | ")}`;const r=n[0],i=yh(t),s=sy(t,r),a=sy(t,i);1===n.length&&ay(r)&&!function(...e){return e.some(e=>"boolean"===e.toLowerCase())}(r,i)&&(o+=` with value ${s}`);o+=`, got ${i} `,ay(i)&&(o+=`with value ${a}.`);return o}(e,t,r))}a&&!a(t,o)&&Pm('Invalid prop: custom validator check failed for prop "'+e+'".')}}const ry=Xp("String,Number,Boolean,Function,Symbol,BigInt");function iy(e,t){let n;const o=function(e){if(null===e)return"null";if("function"==typeof e)return e.name||"";if("object"==typeof e)return e.constructor&&e.constructor.name||"";return""}(t);if("null"===o)n=null===e;else if(ry(o)){const r=typeof e;n=r===o.toLowerCase(),n||"object"!==r||(n=e instanceof t)}else n="Object"===o?fh(e):"Array"===o?lh(e):e instanceof t;return{valid:n,expectedType:o}}function sy(e,t){return"String"===t?`"${e}"`:"Number"===t?`${Number(e)}`:`${e}`}function ay(e){return["string","number","boolean"].some(t=>e.toLowerCase()===t)}const ly=e=>"_"===e||"_ctx"===e||"$stable"===e,cy=e=>lh(e)?e.map(Hy):[Hy(e)],dy=(e,t,n)=>{if(t._n)return t;const o=function(e,t=Ng){if(!t)return e;if(e._n)return e;const n=(...o)=>{n._d;const r=Og(t);let i;try{i=e(...o)}finally{Og(r),n._d}return("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&yg(t),i};return n._n=!0,n._c=!0,n._d=!0,n}((...o)=>("production"===process.env.NODE_ENV||!Ky||null===n&&Ng||n&&n.root!==Ky.root||Pm(`Slot "${e}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`),cy(t(...o))),n);return o._c=!1,o},uy=(e,t,n)=>{const o=e._ctx;for(const n in e){if(ly(n))continue;const r=e[n];if(uh(r))t[n]=dy(n,r,o);else if(null!=r){"production"!==process.env.NODE_ENV&&Pm(`Non-function value encountered for slot "${n}". Prefer function slots for better performance.`);const e=cy(r);t[n]=()=>e}}},py=(e,t)=>{"production"===process.env.NODE_ENV||Kg(e.vnode)||Pm("Non-function value encountered for default slot. Prefer function slots for better performance.");const n=cy(t);e.slots.default=()=>n},hy=(e,t,n)=>{for(const o in t)!n&&ly(o)||(e[o]=t[o])};let fy,my;function gy(e,t){e.appContext.config.performance&&yy()&&my.mark(`vue-${t}-${e.uid}`),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&kg(e,t,yy()?my.now():Date.now())}function vy(e,t){if(e.appContext.config.performance&&yy()){const n=`vue-${t}-${e.uid}`,o=n+":end",r=`<${uw(e,e.type)}> ${t}`;my.mark(o),my.measure(r,n,o),my.clearMeasures(r),my.clearMarks(n),my.clearMarks(o)}("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&Cg(e,t,yy()?my.now():Date.now())}function yy(){return void 0!==fy||("undefined"!=typeof window&&window.performance?(fy=!0,my=window.performance):fy=!1),fy}const wy=function(e,t){t&&t.pendingBranch?lh(e)?t.effects.push(...e):t.effects.push(e):Ym(e)};function by(e){return function(e){!function(){const e=[];if("boolean"!=typeof __VUE_OPTIONS_API__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_OPTIONS_API__"),Rh().__VUE_OPTIONS_API__=!0),"boolean"!=typeof __VUE_PROD_DEVTOOLS__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_PROD_DEVTOOLS__"),Rh().__VUE_PROD_DEVTOOLS__=!1),"boolean"!=typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_PROD_HYDRATION_MISMATCH_DETAILS__"),Rh().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=!1),"production"!==process.env.NODE_ENV&&e.length){const t=e.length>1;console.warn(`Feature flag${t?"s":""} ${e.join(", ")} ${t?"are":"is"} not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.\n\nFor more details, see https://link.vuejs.org/feature-flags.`)}}();const t=Rh();t.__VUE__=!0,"production"===process.env.NODE_ENV&&!__VUE_PROD_DEVTOOLS__||gg(t.__VUE_DEVTOOLS_GLOBAL_HOOK__,t);const{insert:n,remove:o,patchProp:r,createElement:i,createText:s,createComment:a,setText:l,setElementText:c,parentNode:d,nextSibling:u,setScopeId:p=eh,insertStaticContent:h}=e,f=(e,t,n,o=null,r=null,i=null,s=void 0,a=null,l=("production"===process.env.NODE_ENV||!rg)&&!!t.dynamicChildren)=>{if(e===t)return;e&&!Ay(e,t)&&(o=z(e),j(e,r,i,!0),e=null),-2===t.patchFlag&&(l=!1,t.dynamicChildren=null);const{type:c,ref:d,shapeFlag:u}=t;switch(c){case _y:m(e,t,n,o);break;case Ty:g(e,t,n,o);break;case Dy:null==e?v(t,n,o,s):"production"!==process.env.NODE_ENV&&y(e,t,n,s);break;case My:M(e,t,n,o,r,i,s,a,l);break;default:1&u?k(e,t,n,o,r,i,s,a,l):6&u?_(e,t,n,o,r,i,s,a,l):64&u||128&u?c.process(e,t,n,o,r,i,s,a,l,U):"production"!==process.env.NODE_ENV&&Pm("Invalid VNode type:",c,`(${typeof c})`)}null!=d&&r?qg(d,e&&e.ref,i,t||e,!t):null==d&&e&&null!=e.ref&&qg(e.ref,null,i,e,!0)},m=(e,t,o,r)=>{if(null==e)n(t.el=s(t.children),o,r);else{const n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},g=(e,t,o,r)=>{null==e?n(t.el=a(t.children||""),o,r):t.el=e.el},v=(e,t,n,o)=>{[e.el,e.anchor]=h(e.children,t,n,o,e.el,e.anchor)},y=(e,t,n,o)=>{if(t.children!==e.children){const r=u(e.anchor);b(e),[t.el,t.anchor]=h(t.children,n,r,o)}else t.el=e.el,t.anchor=e.anchor},w=({el:e,anchor:t},o,r)=>{let i;for(;e&&e!==t;)i=u(e),n(e,o,r),e=i;n(t,o,r)},b=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=u(e),o(e),e=n;o(t)},k=(e,t,n,o,r,i,s,a,l)=>{if("svg"===t.type?s="svg":"math"===t.type&&(s="mathml"),null==e)C(t,n,o,r,i,s,a,l);else{const n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),S(e,t,r,i,s,a,l)}finally{n&&n._endPatch()}}},C=(e,t,o,s,a,l,d,u)=>{let p,h;const{props:f,shapeFlag:m,transition:g,dirs:v}=e;if(p=e.el=i(e.type,l,f&&f.is,f),8&m?c(p,e.children):16&m&&N(e.children,p,null,s,a,ky(e,l),d,u),v&&Mg(e,null,s,"created"),x(p,e,e.scopeId,d,s),f){for(const e in f)"value"===e||bh(e)||r(p,e,null,f[e],l,s);"value"in f&&r(p,"value",null,f.value,l),(h=f.onVnodeBeforeMount)&&qy(h,s,e)}("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(Dh(p,"__vnode",e,!0),Dh(p,"__vueParentComponent",s,!0)),v&&Mg(e,null,s,"beforeMount");const y=function(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}(a,g);if(y&&g.beforeEnter(p),n(p,t,o),(h=f&&f.onVnodeMounted)||y||v){const t=!("production"===process.env.NODE_ENV)&&rg;wy(()=>{let n;"production"!==process.env.NODE_ENV&&(n=ig(t));try{h&&qy(h,s,e),y&&g.enter(p),v&&Mg(e,null,s,"mounted")}finally{"production"!==process.env.NODE_ENV&&ig(n)}},a)}},x=(e,t,n,o,r)=>{if(n&&p(e,n),o)for(let t=0;t<o.length;t++)p(e,o[t]);if(r){let n=r.subTree;if("production"!==process.env.NODE_ENV&&n.patchFlag>0&&2048&n.patchFlag&&(n=Hv(n.children)||n),t===n||Ey(n.type)&&(n.ssContent===t||n.ssFallback===t)){const t=r.vnode;x(e,t,t.scopeId,t.slotScopeIds,r.parent)}}},N=(e,t,n,o,r,i,s,a,l=0)=>{for(let c=l;c<e.length;c++){const l=e[c]=a?Fy(e[c]):Hy(e[c]);f(null,l,t,n,o,r,i,s,a)}},S=(e,t,n,o,i,s,a)=>{const l=t.el=e.el;("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(l.__vnode=t);let{patchFlag:d,dynamicChildren:u,dirs:p}=t;d|=16&e.patchFlag;const h=e.props||Yp,f=t.props||Yp;let m;if(n&&Cy(n,!1),(m=f.onVnodeBeforeUpdate)&&qy(m,n,t,e),p&&Mg(t,e,n,"beforeUpdate"),n&&Cy(n,!0),"production"!==process.env.NODE_ENV&&rg&&(d=0,a=!1,u=null),(h.innerHTML&&null==f.innerHTML||h.textContent&&null==f.textContent)&&c(l,""),u?(O(e.dynamicChildren,u,l,n,o,ky(t,i),s),"production"!==process.env.NODE_ENV&&xy(e,t)):a||R(e,t,l,null,n,o,ky(t,i),s,!1),d>0){if(16&d)E(l,h,f,n,i);else if(2&d&&h.class!==f.class&&r(l,"class",null,f.class,i),4&d&&r(l,"style",h.style,f.style,i),8&d){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const o=e[t],s=h[o],a=f[o];a===s&&"value"!==o||r(l,o,s,a,i,n)}}1&d&&e.children!==t.children&&c(l,t.children)}else a||null!=u||E(l,h,f,n,i);((m=f.onVnodeUpdated)||p)&&wy(()=>{m&&qy(m,n,t,e),p&&Mg(t,e,n,"updated")},o)},O=(e,t,n,o,r,i,s)=>{for(let a=0;a<t.length;a++){const l=e[a],c=t[a],u=l.el&&(l.type===My||!Ay(l,c)||198&l.shapeFlag)?d(l.el):n;f(l,c,u,null,o,r,i,s,!0)}},E=(e,t,n,o,i)=>{if(t!==n){if(t!==Yp)for(const s in t)bh(s)||s in n||r(e,s,t[s],null,i,o);for(const s in n){if(bh(s))continue;const a=n[s],l=t[s];a!==l&&"value"!==s&&r(e,s,l,a,i,o)}"value"in n&&r(e,"value",t.value,n.value,i)}},M=(e,t,o,r,i,a,l,c,d)=>{const u=t.el=e?e.el:s(""),p=t.anchor=e?e.anchor:s("");let{patchFlag:h,dynamicChildren:f,slotScopeIds:m}=t;"production"!==process.env.NODE_ENV&&(rg||2048&h)&&(h=0,d=!1,f=null),m&&(c=c?c.concat(m):m),null==e?(n(u,o,r),n(p,o,r),N(t.children||[],o,p,i,a,l,c,d)):h>0&&64&h&&f&&e.dynamicChildren&&e.dynamicChildren.length===f.length?(O(e.dynamicChildren,f,o,i,a,l,c),"production"!==process.env.NODE_ENV?xy(e,t):(null!=t.key||i&&t===i.subTree)&&xy(e,t,!0)):R(e,t,o,p,i,a,l,c,d)},_=(e,t,n,o,r,i,s,a,l)=>{t.slotScopeIds=a,null==e?512&t.shapeFlag?r.ctx.activate(t,n,o,s,l):T(t,n,o,r,i,s,l):D(e,t,l)},T=(e,t,n,o,r,i,s)=>{const a=e.component=function(e,t,n){const o=e.type,r=(t?t.appContext:e.appContext)||Wy,i={uid:Uy++,vnode:e,type:o,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Zh(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:ey(o,r),emitsOptions:Pv(o,r),emit:null,emitted:null,propsDefaults:Yp,inheritAttrs:o.inheritAttrs,ctx:Yp,data:Yp,props:Yp,attrs:Yp,slots:Yp,refs:Yp,setupState:Yp,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};"production"!==process.env.NODE_ENV?i.ctx=function(e){const t={};return Object.defineProperty(t,"_",{configurable:!0,enumerable:!1,get:()=>e}),Object.keys(pv).forEach(n=>{Object.defineProperty(t,n,{configurable:!0,enumerable:!1,get:()=>pv[n](e),set:eh})}),t}(i):i.ctx={_:i};i.root=t?t.root:i,i.emit=Av.bind(null,i),e.ce&&e.ce(i);return i}(e,o,r);if("production"!==process.env.NODE_ENV&&a.type.__hmrId&&function(e){const t=e.type.__hmrId;let n=ag.get(t);n||(lg(t,e.type),n=ag.get(t)),n.instances.add(e)}(a),"production"!==process.env.NODE_ENV&&(Im(e),gy(a,"mount")),Kg(e)&&(a.ctx.renderer=U),"production"!==process.env.NODE_ENV&&gy(a,"init"),function(e,t=!1,n=!1){t&&Zy(t);const{props:o,children:r}=e.vnode,i=tw(e);Zv(e,o,i,t),((e,t,n)=>{const o=e.slots=Gv();if(32&e.vnode.shapeFlag){const e=t._;e?(hy(o,t,n),n&&Dh(o,"_",e,!0)):uy(t,o)}else t&&py(e,t)})(e,r,n||t);const s=i?function(e,t){const n=e.type;if("production"!==process.env.NODE_ENV){if(n.name&&ew(n.name,e.appContext.config),n.components){const t=Object.keys(n.components);for(let n=0;n<t.length;n++)ew(t[n],e.appContext.config)}if(n.directives){const e=Object.keys(n.directives);for(let t=0;t<e.length;t++)Eg(e[t])}n.compilerOptions&&rw()&&Pm('"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.')}e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,mv),"production"===process.env.NODE_ENV||function(e){const{ctx:t,propsOptions:[n]}=e;n&&Object.keys(n).forEach(n=>{Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>e.props[n],set:eh})})}(e);const{setup:o}=n;if(o){ff();const r=e.setupContext=o.length>1?function(e){const t=t=>{if("production"!==process.env.NODE_ENV&&(e.exposed&&Pm("expose() should be called only once per setup()."),null!=t)){let e=typeof t;"object"===e&&(lh(t)?e="array":ym(t)&&(e="ref")),"object"!==e&&Pm(`expose() should be passed a plain object, received ${e}.`)}e.exposed=t||{}};if("production"!==process.env.NODE_ENV){let n,o;return Object.freeze({get attrs(){return n||(n=new Proxy(e.attrs,sw))},get slots(){return o||(o=function(e){return new Proxy(e.slots,{get:(t,n)=>(Sf(e,"get","$slots"),t[n])})}(e))},get emit(){return(t,...n)=>e.emit(t,...n)},expose:t})}return{attrs:new Proxy(e.attrs,sw),slots:e.slots,emit:e.emit,expose:t}}(e):null,i=Xy(e),s=$m(o,e,0,["production"!==process.env.NODE_ENV?cm(e.props):e.props,r]),a=mh(s);if(mf(),i(),!a&&!e.sp||Ug(e)||Bg(e),a){if(s.then(Yy,Yy),t)return s.then(n=>{ow(e,n,t)}).catch(t=>{Hm(t,e,0)});if(e.asyncDep=s,"production"!==process.env.NODE_ENV&&!e.suspense){Pm(`Component <${uw(e,n)}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`)}}else ow(e,s,t)}else iw(e,t)}(e,t):void 0;t&&Zy(!1)}(a,!1,s),"production"!==process.env.NODE_ENV&&vy(a,"init"),"production"!==process.env.NODE_ENV&&rg&&(e.el=null),a.asyncDep){if(r&&r.registerDep(a,I,s),!e.el){const o=a.subTree=Ly(Ty);g(null,o,t,n),e.placeholder=o.el}}else I(a,e,t,n,r,i,s);"production"!==process.env.NODE_ENV&&(Am(),vy(a,"mount"))},D=(e,t,n)=>{const o=t.component=e.component;if(function(e,t,n){const{props:o,children:r,component:i}=e,{props:s,children:a,patchFlag:l}=t,c=i.emitsOptions;if("production"!==process.env.NODE_ENV&&(r||a)&&rg)return!0;if(t.dirs||t.transition)return!0;if(!(n&&l>=0))return!(!r&&!a||a&&a.$stable)||o!==s&&(o?!s||Wv(o,s,c):!!s);if(1024&l)return!0;if(16&l)return o?Wv(o,s,c):!!s;if(8&l){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const n=e[t];if(Uv(s,o,n)&&!Lv(c,n))return!0}}return!1}(e,t,n)){if(o.asyncDep&&!o.asyncResolved)return"production"!==process.env.NODE_ENV&&Im(t),A(o,t,n),void("production"!==process.env.NODE_ENV&&Am());o.next=t,o.update()}else t.el=e.el,o.vnode=t},I=(e,t,n,o,r,i,s)=>{const a=()=>{if(e.isMounted){let{next:t,bu:n,u:o,parent:a,vnode:l}=e;{const n=Ny(e);if(n)return t&&(t.el=l.el,A(e,t,s)),void n.asyncDep.then(()=>{wy(()=>{e.isUnmounted||c()},r)})}let u,p=t;"production"!==process.env.NODE_ENV&&Im(t||e.vnode),Cy(e,!1),t?(t.el=l.el,A(e,t,s)):t=l,n&&Th(n),(u=t.props&&t.props.onVnodeBeforeUpdate)&&qy(u,a,t,l),Cy(e,!0),"production"!==process.env.NODE_ENV&&gy(e,"render");const h=$v(e);"production"!==process.env.NODE_ENV&&vy(e,"render");const m=e.subTree;e.subTree=h,"production"!==process.env.NODE_ENV&&gy(e,"patch"),f(m,h,d(m.el),z(m),e,r,i),"production"!==process.env.NODE_ENV&&vy(e,"patch"),t.el=h.el,null===p&&function({vnode:e,parent:t,suspense:n},o){for(;t;){const n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=o,e=n),n!==e)break;(e=t.vnode).el=o,t=t.parent}n&&n.activeBranch===e&&(n.vnode.el=o)}(e,h.el),o&&wy(o,r),(u=t.props&&t.props.onVnodeUpdated)&&wy(()=>qy(u,a,t,l),r),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&yg(e),"production"!==process.env.NODE_ENV&&Am()}else{let s;const{el:a,props:l}=t,{bm:c,m:d,parent:u,root:p,type:h}=e,m=Ug(t);Cy(e,!1),c&&Th(c),!m&&(s=l&&l.onVnodeBeforeMount)&&qy(s,u,t),Cy(e,!0);{p.ce&&p.ce._hasShadowRoot()&&p.ce._injectChildStyle(h,e.parent?e.parent.type:void 0),"production"!==process.env.NODE_ENV&&gy(e,"render");const s=e.subTree=$v(e);"production"!==process.env.NODE_ENV&&vy(e,"render"),"production"!==process.env.NODE_ENV&&gy(e,"patch"),f(null,s,n,o,e,r,i),"production"!==process.env.NODE_ENV&&vy(e,"patch"),t.el=s.el}if(d&&wy(d,r),!m&&(s=l&&l.onVnodeMounted)){const e=t;wy(()=>qy(s,u,e),r)}(256&t.shapeFlag||u&&Ug(u.vnode)&&256&u.vnode.shapeFlag)&&e.a&&wy(e.a,r),e.isMounted=!0,("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&vg(e),t=n=o=null}};e.scope.on();const l=e.effect=new Yh(a);e.scope.off();const c=e.update=l.run.bind(l),u=e.job=l.runIfDirty.bind(l);u.i=e,u.id=e.uid,l.scheduler=()=>Zm(u),Cy(e,!0),"production"!==process.env.NODE_ENV&&(l.onTrack=e.rtc?t=>Th(e.rtc,t):void 0,l.onTrigger=e.rtg?t=>Th(e.rtg,t):void 0),c()},A=(e,t,n)=>{t.component=e;const o=e.vnode.props;e.vnode=t,e.next=null,function(e,t,n,o){const{props:r,attrs:i,vnode:{patchFlag:s}}=e,a=mm(r),[l]=e.propsOptions;let c=!1;if("production"!==process.env.NODE_ENV&&function(e){for(;e;){if(e.type.__hmrId)return!0;e=e.parent}}(e)||!(o||s>0)||16&s){let o;Xv(e,t,r,i)&&(c=!0);for(const i in a)t&&(ah(t,i)||(o=Oh(i))!==i&&ah(t,o))||(l?!n||void 0===n[i]&&void 0===n[o]||(r[i]=Yv(l,a,i,void 0,e,!0)):delete r[i]);if(i!==a)for(const e in i)t&&ah(t,e)||(delete i[e],c=!0)}else if(8&s){const n=e.vnode.dynamicProps;for(let o=0;o<n.length;o++){let s=n[o];if(Lv(e.emitsOptions,s))continue;const d=t[s];if(l)if(ah(i,s))d!==i[s]&&(i[s]=d,c=!0);else{const t=Nh(s);r[t]=Yv(l,a,t,d,e,!1)}else d!==i[s]&&(i[s]=d,c=!0)}}c&&Of(e.attrs,"set",""),"production"!==process.env.NODE_ENV&&ny(t||{},r,e)}(e,t.props,o,n),((e,t,n)=>{const{vnode:o,slots:r}=e;let i=!0,s=Yp;if(32&o.shapeFlag){const o=t._;o?"production"!==process.env.NODE_ENV&&rg?(hy(r,t,n),Of(e,"set","$slots")):n&&1===o?i=!1:hy(r,t,n):(i=!t.$stable,uy(t,r)),s=t}else t&&(py(e,t),s={default:1});if(i)for(const e in r)ly(e)||null!=s[e]||delete r[e]})(e,t.children,n),ff(),Qm(e),mf()},R=(e,t,n,o,r,i,s,a,l=!1)=>{const d=e&&e.children,u=e?e.shapeFlag:0,p=t.children,{patchFlag:h,shapeFlag:f}=t;if(h>0){if(128&h)return void L(d,p,n,o,r,i,s,a,l);if(256&h)return void P(d,p,n,o,r,i,s,a,l)}8&f?(16&u&&F(d,r,i),p!==d&&c(n,p)):16&u?16&f?L(d,p,n,o,r,i,s,a,l):F(d,r,i,!0):(8&u&&c(n,""),16&f&&N(p,n,o,r,i,s,a,l))},P=(e,t,n,o,r,i,s,a,l)=>{t=t||Qp;const c=(e=e||Qp).length,d=t.length,u=Math.min(c,d);let p;for(p=0;p<u;p++){const o=t[p]=l?Fy(t[p]):Hy(t[p]);f(e[p],o,n,null,r,i,s,a,l)}c>d?F(e,r,i,!0,!1,u):N(t,n,o,r,i,s,a,l,u)},L=(e,t,n,o,r,i,s,a,l)=>{let c=0;const d=t.length;let u=e.length-1,p=d-1;for(;c<=u&&c<=p;){const o=e[c],d=t[c]=l?Fy(t[c]):Hy(t[c]);if(!Ay(o,d))break;f(o,d,n,null,r,i,s,a,l),c++}for(;c<=u&&c<=p;){const o=e[u],c=t[p]=l?Fy(t[p]):Hy(t[p]);if(!Ay(o,c))break;f(o,c,n,null,r,i,s,a,l),u--,p--}if(c>u){if(c<=p){const e=p+1,u=e<d?t[e].el:o;for(;c<=p;)f(null,t[c]=l?Fy(t[c]):Hy(t[c]),n,u,r,i,s,a,l),c++}}else if(c>p)for(;c<=u;)j(e[c],r,i,!0),c++;else{const h=c,m=c,g=new Map;for(c=m;c<=p;c++){const e=t[c]=l?Fy(t[c]):Hy(t[c]);null!=e.key&&("production"!==process.env.NODE_ENV&&g.has(e.key)&&Pm("Duplicate keys found during update:",JSON.stringify(e.key),"Make sure keys are unique."),g.set(e.key,c))}let v,y=0;const w=p-m+1;let b=!1,k=0;const C=new Array(w);for(c=0;c<w;c++)C[c]=0;for(c=h;c<=u;c++){const o=e[c];if(y>=w){j(o,r,i,!0);continue}let d;if(null!=o.key)d=g.get(o.key);else for(v=m;v<=p;v++)if(0===C[v-m]&&Ay(o,t[v])){d=v;break}void 0===d?j(o,r,i,!0):(C[d-m]=c+1,d>=k?k=d:b=!0,f(o,t[d],n,null,r,i,s,a,l),y++)}const x=b?function(e){const t=e.slice(),n=[0];let o,r,i,s,a;const l=e.length;for(o=0;o<l;o++){const l=e[o];if(0!==l){if(r=n[n.length-1],e[r]<l){t[o]=r,n.push(o);continue}for(i=0,s=n.length-1;i<s;)a=i+s>>1,e[n[a]]<l?i=a+1:s=a;l<e[n[i]]&&(i>0&&(t[o]=n[i-1]),n[i]=o)}}i=n.length,s=n[i-1];for(;i-- >0;)n[i]=s,s=t[s];return n}(C):Qp;for(v=x.length-1,c=w-1;c>=0;c--){const e=m+c,u=t[e],p=t[e+1],h=e+1<d?p.el||Oy(p):o;0===C[c]?f(null,u,n,h,r,i,s,a,l):b&&(v<0||c!==x[v]?V(u,n,h,2):v--)}}},V=(e,t,r,i,s=null)=>{const{el:a,type:l,transition:c,children:d,shapeFlag:u}=e;if(6&u)return void V(e.component.subTree,t,r,i);if(128&u)return void e.suspense.move(t,r,i);if(64&u)return void l.move(e,t,r,U);if(l===My){n(a,t,r);for(let e=0;e<d.length;e++)V(d[e],t,r,i);return void n(e.anchor,t,r)}if(l===Dy)return void w(e,t,r);if(2!==i&&1&u&&c)if(0===i)c.beforeEnter(a),n(a,t,r),wy(()=>c.enter(a),s);else{const{leave:i,delayLeave:s,afterLeave:l}=c,d=()=>{e.ctx.isUnmounted?o(a):n(a,t,r)},u=()=>{a._isLeaving&&a[Vg](!0),i(a,()=>{d(),l&&l()})};s?s(a,d,u):u()}else n(a,t,r)},j=(e,t,n,o=!1,r=!1)=>{const{type:i,props:s,ref:a,children:l,dynamicChildren:c,shapeFlag:d,patchFlag:u,dirs:p,cacheIndex:h,memo:f}=e;if(-2===u&&(r=!1),null!=a&&(ff(),qg(a,null,n,e,!0),mf()),null!=h&&(t.renderCache[h]=void 0),256&d)return void t.ctx.deactivate(e);const m=1&d&&p,g=!Ug(e);let v;if(g&&(v=s&&s.onVnodeBeforeUnmount)&&qy(v,t,e),6&d)H(e.component,n,o);else{if(128&d)return void e.suspense.unmount(n,o);m&&Mg(e,null,t,"beforeUnmount"),64&d?e.type.remove(e,t,n,U,o):c&&!c.hasOnce&&(i!==My||u>0&&64&u)?F(c,t,n,!1,!0):(i===My&&384&u||!r&&16&d)&&F(l,t,n),o&&$(e)}const y=null!=f&&null==h;(g&&(v=s&&s.onVnodeUnmounted)||m||y)&&wy(()=>{v&&qy(v,t,e),m&&Mg(e,null,t,"unmounted"),y&&(e.el=null)},n)},$=e=>{const{type:t,el:n,anchor:r,transition:i}=e;if(t===My)return void("production"!==process.env.NODE_ENV&&e.patchFlag>0&&2048&e.patchFlag&&i&&!i.persisted?e.children.forEach(e=>{e.type===Ty?o(e.el):$(e)}):B(n,r));if(t===Dy)return void b(e);const s=()=>{o(n),i&&!i.persisted&&i.afterLeave&&i.afterLeave()};if(1&e.shapeFlag&&i&&!i.persisted){const{leave:t,delayLeave:o}=i,r=()=>t(n,s);o?o(e.el,s,r):r()}else s()},B=(e,t)=>{let n;for(;e!==t;)n=u(e),o(e),e=n;o(t)},H=(e,t,n)=>{"production"!==process.env.NODE_ENV&&e.type.__hmrId&&function(e){ag.get(e.type.__hmrId).instances.delete(e)}(e);const{bum:o,scope:r,job:i,subTree:s,um:a,m:l,a:c}=e;var d;Sy(l),Sy(c),o&&Th(o),r.stop(),i&&(i.flags|=8,j(s,e,t,n)),a&&wy(a,t),wy(()=>{e.isUnmounted=!0},t),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(d=e,pg&&"function"==typeof pg.cleanupBuffer&&!pg.cleanupBuffer(d)&&wg(d))},F=(e,t,n,o=!1,r=!1,i=0)=>{for(let s=i;s<e.length;s++)j(e[s],t,n,o,r)},z=e=>{if(6&e.shapeFlag)return z(e.component.subTree);if(128&e.shapeFlag)return e.suspense.next();const t=u(e.anchor||e.el),n=t&&t[Lg];return n?u(n):t};let q=!1;const W=(e,t,n)=>{let o;null==e?t._vnode&&(j(t._vnode,null,null,!0),o=t._vnode.component):f(t._vnode||null,e,t,null,null,null,n),t._vnode=e,q||(q=!0,Qm(o),eg(),q=!1)},U={p:f,um:j,m:V,r:$,mt:T,mc:N,pc:R,pbc:O,n:z,o:e};let K;return{render:W,hydrate:K,createApp:Dv(W)}}(e)}function ky({type:e,props:t},n){return"svg"===n&&"foreignObject"===e||"mathml"===n&&"annotation-xml"===e&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Cy({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function xy(e,t,n=!1){const o=e.children,r=t.children;if(lh(o)&&lh(r))for(let e=0;e<o.length;e++){const t=o[e];let i=r[e];1&i.shapeFlag&&!i.dynamicChildren&&((i.patchFlag<=0||32===i.patchFlag)&&(i=r[e]=Fy(r[e]),i.el=t.el),n||-2===i.patchFlag||xy(t,i)),i.type===_y&&(-1===i.patchFlag&&(i=r[e]=Fy(i)),i.el=t.el),i.type!==Ty||i.el||(i.el=t.el),"production"!==process.env.NODE_ENV&&i.el&&(i.el.__vnode=i)}}function Ny(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Ny(t)}function Sy(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Oy(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Oy(t.subTree):null}const Ey=e=>e.__isSuspense;const My=Symbol.for("v-fgt"),_y=Symbol.for("v-txt"),Ty=Symbol.for("v-cmt"),Dy=Symbol.for("v-stc");function Iy(e){return!!e&&!0===e.__v_isVNode}function Ay(e,t){if("production"!==process.env.NODE_ENV&&6&t.shapeFlag&&e.component){const n=sg.get(t.type);if(n&&n.has(e.component))return e.shapeFlag&=-257,t.shapeFlag&=-513,!1}return e.type===t.type&&e.key===t.key}const Ry=({key:e})=>null!=e?e:null,Py=({ref:e,ref_key:t,ref_for:n})=>("number"==typeof e&&(e=""+e),null!=e?ph(e)||ym(e)||uh(e)?{i:Ng,r:e,k:t,f:!!n}:e:null);const Ly="production"!==process.env.NODE_ENV?(...e)=>Vy(...e):Vy;function Vy(e,t=null,n=null,o=0,r=null,i=!1){if(e&&e!==dv||("production"===process.env.NODE_ENV||e||Pm(`Invalid vnode type when creating vnode: ${e}.`),e=Ty),Iy(e)){const o=jy(e,t,!0);return n&&zy(o,n),o.patchFlag=-2,o}if(pw(e)&&(e=e.__vccOpts),t){t=function(e){return e?fm(e)||Jv(e)?rh({},e):e:null}(t);let{class:e,style:n}=t;e&&!ph(e)&&(t.class=Bh(e)),fh(n)&&(fm(n)&&!lh(n)&&(n=rh({},n)),t.style=Ph(n))}const s=ph(e)?1:Ey(e)?128:(e=>e.__isTeleport)(e)?64:fh(e)?4:uh(e)?2:0;return"production"!==process.env.NODE_ENV&&4&s&&fm(e)&&Pm("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.","\nComponent that was made reactive: ",e=mm(e)),function(e,t=null,n=null,o=0,r=null,i=(e===My?0:1),s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ry(t),ref:t&&Py(t),scopeId:Sg,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:o,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Ng};return a?(zy(l,n),128&i&&e.normalize(l)):n&&(l.shapeFlag|=ph(n)?8:16),"production"!==process.env.NODE_ENV&&l.key!=l.key&&Pm("VNode created with invalid key (NaN). VNode type:",l.type),l}(e,t,n,o,r,s,i,!0)}function jy(e,t,n=!1,o=!1){const{props:r,ref:i,patchFlag:s,children:a,transition:l}=e,c=t?function(...e){const t={};for(let n=0;n<e.length;n++){const o=e[n];for(const e in o)if("class"===e)t.class!==o.class&&(t.class=Bh([t.class,o.class]));else if("style"===e)t.style=Ph([t.style,o.style]);else if(nh(e)){const n=t[e],r=o[e];!r||n===r||lh(n)&&n.includes(r)?null!=r||null!=n||oh(e)||(t[e]=r):t[e]=n?[].concat(n,r):r}else""!==e&&(t[e]=o[e])}return t}(r||{},t):r,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Ry(c),ref:t&&t.ref?n&&i?lh(i)?i.concat(Py(t)):[i,Py(t)]:Py(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:"production"!==process.env.NODE_ENV&&-1===s&&lh(a)?a.map($y):a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==My?-1===s?16:16|s:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&jy(e.ssContent),ssFallback:e.ssFallback&&jy(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&o&&jg(d,l.clone(d)),d}function $y(e){const t=jy(e);return lh(e.children)&&(t.children=e.children.map($y)),t}function By(e=" ",t=0){return Ly(_y,null,e,t)}function Hy(e){return null==e||"boolean"==typeof e?Ly(Ty):lh(e)?Ly(My,null,e.slice()):Iy(e)?Fy(e):Ly(_y,null,String(e))}function Fy(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:jy(e)}function zy(e,t){let n=0;const{shapeFlag:o}=e;if(null==t)t=null;else if(lh(t))n=16;else if("object"==typeof t){if(65&o){const n=t.default;return void(n&&(n._c&&(n._d=!1),zy(e,n()),n._c&&(n._d=!0)))}{n=32;const o=t._;o||Jv(t)?3===o&&Ng&&(1===Ng.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=Ng}}else uh(t)?(t={default:t,_ctx:Ng},n=32):(t=String(t),64&o?(n=16,t=[By(t)]):n=8);e.children=t,e.shapeFlag|=n}function qy(e,t,n,o=null){Bm(e,t,7,[n,o])}const Wy=_v();let Uy=0;let Ky=null;const Gy=()=>Ky||Ng;let Jy,Zy;{const e=Rh(),t=(t,n)=>{let o;return(o=e[t])||(o=e[t]=[]),o.push(n),e=>{o.length>1?o.forEach(t=>t(e)):o[0](e)}};Jy=t("__VUE_INSTANCE_SETTERS__",e=>Ky=e),Zy=t("__VUE_SSR_SETTERS__",e=>nw=e)}const Xy=e=>{const t=Ky;return Jy(e),e.scope.on(),()=>{e.scope.off(),Jy(t)}},Yy=()=>{Ky&&Ky.scope.off(),Jy(null)},Qy=Xp("slot,component");function ew(e,{isNativeTag:t}){(Qy(e)||t(e))&&Pm("Do not use built-in or reserved HTML elements as component id: "+e)}function tw(e){return 4&e.vnode.shapeFlag}let nw=!1;function ow(e,t,n){uh(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:fh(t)?("production"!==process.env.NODE_ENV&&Iy(t)&&Pm("setup() should not return VNodes directly - return a render function instead."),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(e.devtoolsRawSetupState=t),e.setupState=Nm(t),"production"!==process.env.NODE_ENV&&function(e){const{ctx:t,setupState:n}=e;Object.keys(mm(n)).forEach(e=>{if(!n.__isScriptSetup){if(hv(e[0]))return void Pm(`setup() return property ${JSON.stringify(e)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`);Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>n[e],set:eh})}})}(e)):"production"!==process.env.NODE_ENV&&void 0!==t&&Pm("setup() should return an object. Received: "+(null===t?"null":typeof t)),iw(e,n)}const rw=()=>!0;function iw(e,t,n){const o=e.type;if(e.render||(e.render=o.render||eh),__VUE_OPTIONS_API__){const t=Xy(e);ff();try{yv(e)}finally{mf(),t()}}"production"===process.env.NODE_ENV||o.render||e.render!==eh||t||(o.template?Pm('Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".'):Pm("Component is missing template or render function: ",o))}const sw="production"!==process.env.NODE_ENV?{get:(e,t)=>(jv(),Sf(e,"get",""),e[t]),set:()=>(Pm("setupContext.attrs is readonly."),!1),deleteProperty:()=>(Pm("setupContext.attrs is readonly."),!1)}:{get:(e,t)=>(Sf(e,"get",""),e[t])};function aw(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Nm((t=e.exposed,!ah(t,"__v_skip")&&Object.isExtensible(t)&&Dh(t,"__v_skip",!0),t)),{get:(t,n)=>n in t?t[n]:n in pv?pv[n](e):void 0,has:(e,t)=>t in e||t in pv})):e.proxy;var t}const lw=/(?:^|[-_])\w/g,cw=e=>e.replace(lw,e=>e.toUpperCase()).replace(/[-_]/g,"");function dw(e,t=!0){return uh(e)?e.displayName||e.name:e.name||t&&e.__name}function uw(e,t,n=!1){let o=dw(t);if(!o&&t.__file){const e=t.__file.match(/([^/\\]+)\.\w+$/);e&&(o=e[1])}if(!o&&e){const n=e=>{for(const n in e)if(e[n]===t)return n};o=n(e.components)||e.parent&&n(e.parent.type.components)||n(e.appContext.components)}return o?cw(o):n?"App":"Anonymous"}function pw(e){return uh(e)&&"__vccOpts"in e}const hw=(e,t)=>{const n=function(e,t,n=!1){let o,r;uh(e)?o=e:(o=e.get,r=e.set);const i=new Sm(o,r,n);return process.env.NODE_ENV,i}(e,0,nw);if("production"!==process.env.NODE_ENV){const e=Gy();e&&e.appContext.config.warnRecursiveComputed&&(n._warnRecursive=!0)}return n};function fw(e,t,n){try{const o=arguments.length;return 2===o?fh(t)&&!lh(t)?Iy(t)?Ly(e,null,[t]):Ly(e,t):Ly(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):3===o&&Iy(n)&&(n=[n]),Ly(e,t,n))}finally{}}const mw="3.5.32",gw="production"!==process.env.NODE_ENV?Pm:eh;
18
+ /**
19
+ * @vue/runtime-dom v3.5.32
20
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
21
+ * @license MIT
22
+ **/
23
+ let vw;process.env.NODE_ENV,process.env.NODE_ENV;const yw="undefined"!=typeof window&&window.trustedTypes;if(yw)try{vw=yw.createPolicy("vue",{createHTML:e=>e})}catch(e){"production"!==process.env.NODE_ENV&&gw(`Error creating trusted types policy: ${e}`)}const ww=vw?e=>vw.createHTML(e):e=>e,bw="undefined"!=typeof document?document:null,kw=bw&&bw.createElement("template"),Cw={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,o)=>{const r="svg"===t?bw.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?bw.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?bw.createElement(e,{is:n}):bw.createElement(e);return"select"===e&&o&&null!=o.multiple&&r.setAttribute("multiple",o.multiple),r},createText:e=>bw.createTextNode(e),createComment:e=>bw.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>bw.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,r,i){const s=n?n.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),r!==i&&(r=r.nextSibling););else{kw.innerHTML=ww("svg"===o?`<svg>${e}</svg>`:"mathml"===o?`<math>${e}</math>`:e);const r=kw.content;if("svg"===o||"mathml"===o){const e=r.firstChild;for(;e.firstChild;)r.appendChild(e.firstChild);r.removeChild(e)}t.insertBefore(r,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},xw=Symbol("_vtc");const Nw=Symbol("_vod"),Sw=Symbol("_vsh"),Ow=Symbol("production"!==process.env.NODE_ENV?"CSS_VAR_TEXT":""),Ew=/(?:^|;)\s*display\s*:/;const Mw=/[^\\];\s*$/,_w=/\s*!important$/;function Tw(e,t,n){if(lh(n))n.forEach(n=>Tw(e,t,n));else if(null==n&&(n=""),"production"!==process.env.NODE_ENV&&Mw.test(n)&&gw(`Unexpected semicolon at the end of '${t}' style value: '${n}'`),t.startsWith("--"))e.setProperty(t,n);else{const o=function(e,t){const n=Iw[t];if(n)return n;let o=Nh(t);if("filter"!==o&&o in e)return Iw[t]=o;o=Eh(o);for(let n=0;n<Dw.length;n++){const r=Dw[n]+o;if(r in e)return Iw[t]=r}return t}(e,t);_w.test(n)?e.setProperty(Oh(o),n.replace(_w,""),"important"):e[o]=n}}const Dw=["Webkit","Moz","ms"],Iw={};const Aw="http://www.w3.org/1999/xlink";function Rw(e,t,n,o,r,i=qh(t)){o&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(Aw,t.slice(6,t.length)):e.setAttributeNS(Aw,t,n):null==n||i&&!Wh(n)?e.removeAttribute(t):e.setAttribute(t,i?"":hh(n)?String(n):n)}function Pw(e,t,n,o,r){if("innerHTML"===t||"textContent"===t)return void(null!=n&&(e[t]="innerHTML"===t?ww(n):n));const i=e.tagName;if("value"===t&&"PROGRESS"!==i&&!i.includes("-")){const o="OPTION"===i?e.getAttribute("value")||"":e.value,r=null==n?"checkbox"===e.type?"on":"":String(n);return o===r&&"_value"in e||(e.value=r),null==n&&e.removeAttribute(t),void(e._value=n)}let s=!1;if(""===n||null==n){const o=typeof e[t];"boolean"===o?n=Wh(n):null==n&&"string"===o?(n="",s=!0):"number"===o&&(n=0,s=!0)}try{e[t]=n}catch(e){"production"===process.env.NODE_ENV||s||gw(`Failed setting prop "${t}" on <${i.toLowerCase()}>: value ${n} is invalid.`,e)}s&&e.removeAttribute(r||t)}const Lw=Symbol("_vei");function Vw(e,t,n,o,r=null){const i=e[Lw]||(e[Lw]={}),s=i[t];if(o&&s)s.value="production"!==process.env.NODE_ENV?Fw(o,t):o;else{const[n,a]=function(e){let t;if(jw.test(e)){let n;for(t={};n=e.match(jw);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}const n=":"===e[2]?e.slice(3):Oh(e.slice(2));return[n,t]}(t);if(o){const s=i[t]=function(e,t){const n=e=>{if(e._vts){if(e._vts<=n.attached)return}else e._vts=Date.now();Bm(function(e,t){if(lh(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}return t}(e,n.value),t,5,[e])};return n.value=e,n.attached=Hw(),n}("production"!==process.env.NODE_ENV?Fw(o,t):o,r);!function(e,t,n,o){e.addEventListener(t,n,o)}(e,n,s,a)}else s&&(!function(e,t,n,o){e.removeEventListener(t,n,o)}(e,n,s,a),i[t]=void 0)}}const jw=/(?:Once|Passive|Capture)$/;let $w=0;const Bw=Promise.resolve(),Hw=()=>$w||(Bw.then(()=>$w=0),$w=Date.now());function Fw(e,t){return uh(e)||lh(e)?e:(gw(`Wrong type passed as event handler to ${t} - did you forget @ or : in front of your prop?\nExpected function or array of functions, received type ${typeof e}.`),eh)}const zw=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123;const qw=rh({patchProp:(e,t,n,o,r,i)=>{const s="svg"===r;"class"===t?function(e,t,n){const o=e[xw];o&&(t=(t?[t,...o]:[...o]).join(" ")),null==t?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}(e,o,s):"style"===t?function(e,t,n){const o=e.style,r=ph(n);let i=!1;if(n&&!r){if(t)if(ph(t))for(const e of t.split(";")){const t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&Tw(o,t,"")}else for(const e in t)null==n[e]&&Tw(o,e,"");for(const e in n)"display"===e&&(i=!0),Tw(o,e,n[e])}else if(r){if(t!==n){const e=o[Ow];e&&(n+=";"+e),o.cssText=n,i=Ew.test(n)}}else t&&e.removeAttribute("style");Nw in e&&(e[Nw]=i?o.display:"",e[Sw]&&(o.display="none"))}(e,n,o):nh(t)?oh(t)||Vw(e,t,0,o,i):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):function(e,t,n,o){if(o)return"innerHTML"===t||"textContent"===t||!!(t in e&&zw(t)&&uh(n));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t)return!1;if("sandbox"===t&&"IFRAME"===e.tagName)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){const t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}if(zw(t)&&ph(n))return!1;return t in e}(e,t,o,s))?(Pw(e,t,o),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||Rw(e,t,o,s,0,"value"!==t)):e._isVueCE&&(function(e,t){const n=e._def.props;if(!n)return!1;const o=Nh(t);return Array.isArray(n)?n.some(e=>Nh(e)===o):Object.keys(n).some(e=>Nh(e)===o)}(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!ph(o)))?Pw(e,Nh(t),o,0,t):("true-value"===t?e._trueValue=o:"false-value"===t&&(e._falseValue=o),Rw(e,t,o,s))}},Cw);let Ww;const Uw=(...e)=>{const t=(Ww||(Ww=by(qw))).createApp(...e);"production"!==process.env.NODE_ENV&&(function(e){Object.defineProperty(e.config,"isNativeTag",{value:e=>Hh(e)||Fh(e)||zh(e),writable:!1})}(t),function(e){{const t=e.config.isCustomElement;Object.defineProperty(e.config,"isCustomElement",{get:()=>t,set(){gw("The `isCustomElement` config option is deprecated. Use `compilerOptions.isCustomElement` instead.")}});const n=e.config.compilerOptions,o='The `compilerOptions` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, `compilerOptions` must be passed to `@vue/compiler-dom` in the build setup instead.\n- For vue-loader: pass it via vue-loader\'s `compilerOptions` loader option.\n- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader\n- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc';Object.defineProperty(e.config,"compilerOptions",{get:()=>(gw(o),n),set(){gw(o)}})}}(t));const{mount:n}=t;return t.mount=e=>{const o=function(e){if(ph(e)){const t=document.querySelector(e);return"production"===process.env.NODE_ENV||t||gw(`Failed to mount app: mount target selector "${e}" returned null.`),t}"production"!==process.env.NODE_ENV&&window.ShadowRoot&&e instanceof window.ShadowRoot&&"closed"===e.mode&&gw('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs');return e}
24
+ /**
25
+ * vue v3.5.32
26
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
27
+ * @license MIT
28
+ **/(e);if(!o)return;const r=t._component;uh(r)||r.render||r.template||(r.template=o.innerHTML),1===o.nodeType&&(o.textContent="");const i=n(o,!1,function(e){if(e instanceof SVGElement)return"svg";if("function"==typeof MathMLElement&&e instanceof MathMLElement)return"mathml"}(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),i},t};"production"!==process.env.NODE_ENV&&function(){if("production"===process.env.NODE_ENV||"undefined"==typeof window)return;const e={style:"color:#3ba776"},t={style:"color:#1677ff"},n={style:"color:#f5222d"},o={style:"color:#eb2f96"},r={__vue_custom_formatter:!0,header(t){if(!fh(t))return null;if(t.__isVue)return["div",e,"VueInstance"];if(ym(t)){ff();const n=t.value;return mf(),["div",{},["span",e,d(t)],"<",a(n),">"]}return um(t)?["div",{},["span",e,hm(t)?"ShallowReactive":"Reactive"],"<",a(t),">"+(pm(t)?" (readonly)":"")]:pm(t)?["div",{},["span",e,hm(t)?"ShallowReadonly":"Readonly"],"<",a(t),">"]:null},hasBody:e=>e&&e.__isVue,body(e){if(e&&e.__isVue)return["div",{},...i(e.$)]}};function i(e){const t=[];e.type.props&&e.props&&t.push(s("props",mm(e.props))),e.setupState!==Yp&&t.push(s("setup",e.setupState)),e.data!==Yp&&t.push(s("data",mm(e.data)));const n=l(e,"computed");n&&t.push(s("computed",n));const r=l(e,"inject");return r&&t.push(s("injected",r)),t.push(["div",{},["span",{style:o.style+";opacity:0.66"},"$ (internal): "],["object",{object:e}]]),t}function s(e,t){return t=rh({},t),Object.keys(t).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},e],["div",{style:"padding-left:1.25em"},...Object.keys(t).map(e=>["div",{},["span",o,e+": "],a(t[e],!1)])]]:["span",{}]}function a(e,r=!0){return"number"==typeof e?["span",t,e]:"string"==typeof e?["span",n,JSON.stringify(e)]:"boolean"==typeof e?["span",o,e]:fh(e)?["object",{object:r?mm(e):e}]:["span",n,String(e)]}function l(e,t){const n=e.type;if(uh(n))return;const o={};for(const r in e.ctx)c(n,r,t)&&(o[r]=e.ctx[r]);return o}function c(e,t,n){const o=e[n];return!!(lh(o)&&o.includes(t)||fh(o)&&t in o)||!(!e.extends||!c(e.extends,t,n))||!(!e.mixins||!e.mixins.some(e=>c(e,t,n)))||void 0}function d(e){return hm(e)?"ShallowRef":e.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(r):window.devtoolsFormatters=[r]}();var Kw=Object.defineProperty,Gw=Object.getOwnPropertySymbols,Jw=Object.prototype.hasOwnProperty,Zw=Object.prototype.propertyIsEnumerable,Xw=(e,t,n)=>t in e?Kw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yw=(e,t)=>{for(var n in t||(t={}))Jw.call(t,n)&&Xw(e,n,t[n]);if(Gw)for(var n of Gw(t))Zw.call(t,n)&&Xw(e,n,t[n]);return e};function Qw(e,t){return Object.assign(e,{meta:Yw({package:"@milkdown/components"},t)}),e}const eb=md({extensions:[],languages:[],expandIcon:"⬇",searchIcon:"🔍",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"📋",onCopy:()=>{},renderLanguage:e=>e,renderPreview:()=>null,previewToggleButton:e=>e?"Edit":"Hide",previewLabel:"Preview",previewLoading:"Loading..."},"codeBlockConfigCtx");Qw(eb,{displayName:"Config<code-block>",group:"CodeBlock"});class tb{constructor(e){this.languages=e,this.map={},e.forEach(e=>{e.alias.forEach(t=>{this.map[t]=e})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){const t=this.map[e.toLowerCase()];return t?t.support?Promise.resolve(t.support):t.load():Promise.resolve(void 0)}}function nb({icon:e,class:t,onClick:n}){return fw("span",{class:Ae("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}nb.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function ob(e){return t=this,n=null,o=function*(){try{return navigator.clipboard.writeText(e)}catch(t){const n=document.createElement("textarea"),o=document.activeElement;n.value=e,n.setAttribute("readonly",""),n.style.contain="strict",n.style.position="absolute",n.style.left="-9999px",n.style.fontSize="12pt";const r=document.getSelection(),i=r?r.rangeCount>0&&r.getRangeAt(0):null;document.body.appendChild(n),n.select(),n.selectionStart=0,n.selectionEnd=e.length,document.execCommand("copy"),document.body.removeChild(n),i&&(r.removeAllRanges(),r.addRange(i)),o&&o.focus()}},new Promise((e,r)=>{var i=e=>{try{a(o.next(e))}catch(e){r(e)}},s=e=>{try{a(o.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,s);a((o=o.apply(t,n)).next())});var t,n,o}const rb=$g({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(e){const t=()=>{ob(e.text).then(()=>e.onCopy(e.text)).catch(console.error)};return()=>fw(My,null,fw("button",{type:"button",class:"copy-button",onClick:t},fw(nb,{icon:e.copyIcon}),e.copyText))}}),ib=$g({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:e,config:t,setLanguage:n,getAllLanguages:o,getReadOnly:r}){const i=wm(),s=wm(!1),a=wm(),l=wm(),c=wm("");Ig([s,i,l],()=>{c.value="";const e=i.value,t=l.value;e&&t&&Pe(e,t,{placement:"bottom-start"}).then(({x:e,y:n})=>{Object.assign(t.style,{left:`${e}px`,top:`${n}px`})}).catch(console.error)});const d=e=>{if(e.preventDefault(),e.stopPropagation(),r())return;const t=!s.value;s.value=t,t&&setTimeout(()=>{var e;return null==(e=a.value)?void 0:e.focus()},0)},u=e=>{const t=e.target;c.value=t.value},p=e=>{"Escape"===e.key&&(c.value="")},h=hw(()=>{var t;if(!s.value)return[];const n=null!=(t=o())?t:[],r=n.find(t=>t.name.toLowerCase()===e.value.toLowerCase()),i=n.filter(e=>{const t=c.value.toLowerCase();return(e.name.toLowerCase().includes(t)||e.alias.some(e=>e.toLowerCase().includes(t)))&&e!==r});return 0===i.length?[]:r?[r,...i]:i}),f=e=>{const t=e.target;if(i.value&&i.value.contains(t))return;const n=l.value,o=i.value;o&&n&&"true"===o.dataset.expanded&&(n.contains(t)||(s.value=!1))};return tv(()=>{window.addEventListener("click",f)}),iv(()=>{window.removeEventListener("click",f)}),()=>fw(My,null,fw("button",{type:"button",ref:i,class:"language-button",onClick:d,"data-expanded":String(s.value)},e.value||"Text",fw("div",{class:"expand-icon"},fw(nb,{icon:t.expandIcon}))),fw("div",{ref:l,class:"language-picker"},s.value?fw("div",{class:"list-wrapper"},fw("div",{class:"search-box"},fw("div",{class:"search-icon"},fw(nb,{icon:t.searchIcon})),fw("input",{ref:a,class:"search-input",placeholder:t.searchPlaceholder,value:c.value,onInput:u,onKeydown:p}),fw("div",{class:Ae("clear-icon",0===c.value.length&&"hidden"),onMousedown:e=>{e.preventDefault(),c.value=""}},fw(nb,{icon:t.clearSearchIcon}))),fw("ul",{class:"language-list",role:"listbox",onKeydown:e=>{if("Enter"===e.key){const e=document.activeElement;e instanceof HTMLElement&&e.dataset.language&&n(e.dataset.language)}}},h.value.length?h.value.map(o=>fw("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":o.name.toLowerCase()===e.value.toLowerCase(),"data-language":o.name,onClick:()=>{n(o.name),s.value=!1}},t.renderLanguage(o.name,o.name.toLowerCase()===e.value.toLowerCase()))):fw("li",{class:"language-list-item no-result"},t.noResultText))):null))}}),sb=$g({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(e){const{previewOnlyMode:t,config:n,preview:o}=e,r=wm();return Dg(()=>{const e=r.value;if(!e)return;for(;e.firstChild;)e.removeChild(e.firstChild);const t=o.value;("string"==typeof t||t instanceof Element)&&(e.innerHTML=Re.sanitize(t))}),()=>o.value?fw("div",{class:"preview-panel"},!t.value&&fw(My,null,fw("div",{class:"preview-divider"}),fw("div",{class:"preview-label"},n.previewLabel)),fw("div",{ref:r,class:"preview"})):null}}),ab=$g({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){var t;const n=wm(null!=(t=e.config.previewOnlyByDefault)?t:e.getReadOnly()),o=wm(),r=wm(null);tv(()=>{for(var t;null==(t=o.value)?void 0:t.firstChild;)o.value.removeChild(o.value.firstChild);o.value&&o.value.appendChild(e.codemirror.dom)}),Ig(()=>[e.text.value,e.language.value],()=>{const t=e.config.renderPreview(e.language.value,e.text.value,e=>r.value=e);t&&(r.value=t);void 0===t&&!r.value&&(r.value=Re.sanitize(e.config.previewLoading)),null===t&&(r.value=null)},{immediate:!0});const i=()=>{};return()=>{var t;return fw(My,null,fw("div",{class:"tools"},fw(ib,{language:e.language,config:e.config,setLanguage:e.setLanguage,getAllLanguages:e.getAllLanguages,getReadOnly:e.getReadOnly}),fw("div",{class:"tools-button-group"},fw(rb,{copyIcon:e.config.copyIcon,copyText:e.config.copyText,onCopy:null!=(t=e.config.onCopy)?t:i,text:e.text.value}),r.value?fw("button",{class:"preview-toggle-button",onClick:()=>n.value=!n.value},fw(nb,{icon:e.config.previewToggleButton(n.value)})):null)),fw("div",{ref:o,class:Ae("codemirror-host",r.value&&n.value&&"hidden")}),fw(sb,{text:e.text,language:e.language,config:e.config,previewOnlyMode:n,preview:r}))}}});class lb{constructor(e,t,n,o,r){this.node=e,this.view=t,this.getPos=n,this.loader=o,this.config=r,this.selected=wm(!1),this.language=wm(""),this.text=wm(""),this.updating=!1,this.languageName="",this.forwardUpdate=e=>{var t;if(this.updating||!this.cm.hasFocus)return;let n=(null!=(t=this.getPos())?t:0)+1;const{main:o}=e.state.selection,r=n+o.from,i=n+o.to,s=this.view.state.selection;if(e.docChanged||s.from!==r||s.to!==i){const t=this.view.state.tr;e.changes.iterChanges((e,o,r,i,s)=>{s.length?t.replaceWith(n+e,n+o,this.view.state.schema.text(s.toString())):t.delete(n+e,n+o),n+=i-r-(o-e)}),t.setSelection(Fo.create(t.doc,r,i)),this.view.dispatch(t)}},this.createApp=()=>Uw(ab,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{const e=this.view;return[{key:"ArrowUp",run:()=>this.maybeEscape("line",-1)},{key:"ArrowLeft",run:()=>this.maybeEscape("char",-1)},{key:"ArrowDown",run:()=>this.maybeEscape("line",1)},{key:"ArrowRight",run:()=>this.maybeEscape("char",1)},{key:"Mod-Enter",run:()=>!!gr(e.state,e.dispatch)&&(e.focus(),!0)},{key:"Mod-z",run:()=>Jp(e.state,e.dispatch)},{key:"Shift-Mod-z",run:()=>Zp(e.state,e.dispatch)},{key:"Mod-y",run:()=>Zp(e.state,e.dispatch)},{key:"Backspace",run:()=>{var e;const t=this.cm.state.selection.ranges;if(t.length>1)return!1;const n=t[0];if(n&&(!n.empty||n.anchor>0))return!1;if(this.cm.state.doc.lines>=2)return!1;const o=this.view.state,r=null!=(e=this.getPos())?e:0,i=o.tr.replaceWith(r,r+this.node.nodeSize,o.schema.nodes.paragraph.createChecked({},this.node.content));return i.setSelection(Fo.near(i.doc.resolve(r))),this.view.dispatch(i),this.view.focus(),!0}}]},this.maybeEscape=(e,t)=>{var n;const{state:o}=this.cm;let r=o.selection.main;if(!r.empty)return!1;if("line"===e&&(r=o.doc.lineAt(r.head)),t<0?r.from>0:r.to<o.doc.length)return!1;const i=(null!=(n=this.getPos())?n:0)+(t<0?0:this.node.nodeSize),s=Fo.near(this.view.state.doc.resolve(i),t),a=this.view.state.tr.setSelection(s).scrollIntoView();return this.view.dispatch(a),this.view.focus(),!0},this.setLanguage=e=>{var t;this.view.dispatch(this.view.state.tr.setNodeAttribute(null!=(t=this.getPos())?t:0,"language",e))},this.getAllLanguages=()=>this.loader.getAll(),this.languageConf=new f,this.readOnlyConf=new f,this.cm=new m({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(g.readOnly.of(!this.view.editable)),v(),y.of(this.codeMirrorKeymap()),this.languageConf.of([]),g.changeFilter.of(()=>this.view.editable),...r.extensions,m.updateListener.of(this.forwardUpdate)]}),this.app=this.createApp(),this.dom=this.createDom(this.app),this.disposeSelectedWatcher=Dg(()=>{this.selected.value?this.dom.classList.add("selected"):this.dom.classList.remove("selected")}),this.updateLanguage()}createDom(e){const t=document.createElement("div");return t.className="milkdown-code-block",this.text.value=this.node.textContent,e.mount(t),t}updateLanguage(){const e=this.node.attrs.language;if(e===this.languageName)return;this.language.value=e;this.loader.load(null!=e?e:"").then(t=>{t&&(this.cm.dispatch({effects:this.languageConf.reconfigure(t)}),this.languageName=e)}).catch(console.error)}setSelection(e,t){this.cm.dom.isConnected&&(this.cm.focus(),this.updating=!0,this.cm.dispatch({selection:{anchor:e,head:t}}),this.updating=!1)}update(e){if(e.type!==this.node.type)return!1;if(this.updating)return!0;this.node=e,this.text.value=e.textContent,this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(g.readOnly.of(!this.view.editable))});const t=function(e,t){if(e===t)return null;let n=0,o=e.length,r=t.length;for(;n<o&&e.charCodeAt(n)===t.charCodeAt(n);)++n;for(;o>n&&r>n&&e.charCodeAt(o-1)===t.charCodeAt(r-1);)o--,r--;return{from:n,to:o,text:t.slice(n,r)}}(this.cm.state.doc.toString(),e.textContent);return t&&(this.updating=!0,this.cm.dispatch({changes:{from:t.from,to:t.to,insert:t.text},scrollIntoView:!0}),this.updating=!1),!0}selectNode(){this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){this.app.unmount(),this.cm.destroy(),this.disposeSelectedWatcher()}}const cb=fd(Su.node,e=>{const t=e.get(eb.key),n=new tb(t.languages);return(e,o,r)=>new lb(e,o,r,n,t)});Qw(cb,{displayName:"NodeView<code-block>",group:"CodeBlock"});const db=[cb,eb];function ub(e,t,n,o,r,i){return Fe(e)&&Fe(t)&&(i.set(t,e),ze(e,t,void 0,ub,i),i.delete(t)),e}var pb=qe(function(e,t,n,o){ze(e,t,n,o)}),hb=We(function(e){return e.push(void 0,ub),Ue(pb,void 0,e)});function fb(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-block",...t}}),e}var mb=md({filterNodes:e=>!gi(e=>"table"===e.type.name)(e)},"blockConfig");fb(mb,{displayName:"Ctx<blockConfig>"});var gb=ei.ie&&ei.ie_version<15||ei.ios&&ei.webkit_version<604,vb=class{constructor(){this.bind=(e,t)=>{this.#R=e,this.#K=t},this.addEvent=e=>{e.addEventListener("mousedown",this.#G),e.addEventListener("mouseup",this.#J),e.addEventListener("dragstart",this.#Z),e.addEventListener("dragend",this.#X)},this.removeEvent=e=>{e.removeEventListener("mousedown",this.#G),e.removeEventListener("mouseup",this.#J),e.removeEventListener("dragstart",this.#Z),e.removeEventListener("dragend",this.#X)},this.unBind=()=>{this.#K=void 0},this.keydownCallback=e=>(this.#Y(),this.#Q=!1,e.dom.dataset.dragging="false",!1),this.mousemoveCallback=(e,t)=>(e.composing||!e.editable||this.#ee(e,t),!1),this.dragoverCallback=(e,t)=>{if(this.#Q){const n=this.#te?.dom.parentElement;if(!n)return!1;const o=n.scrollHeight>n.clientHeight,r=n.getBoundingClientRect();if(o){if(n.scrollTop>0&&Math.abs(t.y-r.y)<20)return n.scrollTop=n.scrollTop>10?n.scrollTop-10:0,!1;const o=Math.round(e.dom.getBoundingClientRect().height);if(Math.round(n.scrollTop+r.height)<o&&Math.abs(t.y-(r.height+r.y))<20)return n.scrollTop=n.scrollTop+10,!1}}return!1},this.dragenterCallback=e=>{e.dragging&&(this.#Q=!0,e.dom.dataset.dragging="true")},this.dragleaveCallback=(e,t)=>{const n=t.clientX,o=t.clientY;(n<0||o<0||n>window.innerWidth||o>window.innerHeight)&&(this.#ne=null,this.#oe(e))},this.dropCallback=e=>(this.#oe(e),!1),this.dragendCallback=e=>{this.#oe(e)}}#R;#re=()=>{if(!this.#ne)return null;const e=this.#ne,t=this.#te;if(t&&qo.isSelectable(e.node)){const n=qo.create(t.state.doc,e.$pos.pos);return t.dispatch(t.state.tr.setSelection(n)),t.focus(),this.#ie=n,n}return null};#ie=null;#ne=null;#se=void 0;#Q=!1;get#ae(){try{return this.#R?.get(mb.key).filterNodes}catch{return}}get#te(){return this.#R?.get(Yl)}#K;#Y=()=>{this.#K?.({type:"hide"}),this.#ne=null};#le=e=>{this.#ne=e,this.#K?.({type:"show",active:e})};#G=()=>{this.#se=this.#ne?.el.getBoundingClientRect(),this.#re()};#J=()=>{this.#Q?(this.#Q=!1,this.#ie=null):requestAnimationFrame(()=>{this.#se&&this.#te?.focus()})};#Z=e=>{this.#Q=!0;const t=this.#te;if(!t)return;t.dom.dataset.dragging="true";const n=this.#ie;if(e.dataTransfer&&n){const o=n.content();e.dataTransfer.effectAllowed="copyMove";const{dom:r,text:i}=t.serializeForClipboard(o);e.dataTransfer.clearData(),e.dataTransfer.setData(gb?"Text":"text/html",r.innerHTML),gb||e.dataTransfer.setData("text/plain",i);const s=this.#ne?.el;s&&e.dataTransfer.setDragImage(s,0,0),t.dragging={slice:o,move:!0}}};#X=()=>{this.#te&&this.#oe(this.#te)};#ee=Be((e,t)=>{if(!e.editable)return;const n=e.dom.getBoundingClientRect(),o=n.left+n.width/2;if(!(e.root.elementFromPoint(o,t.clientY)instanceof Element))return void this.#Y();const r=this.#ae;if(!r)return;const i=function(e,t,n){if(!e.dom.parentElement)return null;try{const o=e.posAtCoords({left:t.x,top:t.y})?.inside;if(null==o||o<0)return null;let r=e.state.doc.resolve(o),i=e.state.doc.nodeAt(o),s=e.nodeDOM(o);const a=t=>{const o=r.depth>=1&&0===r.index(r.depth);if(!t&&!o)return;const l=r.before(r.depth);i=e.state.doc.nodeAt(l),s=e.nodeDOM(l),r=e.state.doc.resolve(l),n(r,i)||a(!0)};return a(!n(r,i)),s&&i?{node:i,$pos:r,el:s}:null}catch{return null}}(e,{x:o,y:t.clientY},r);i?this.#le(i):this.#Y()},200);#oe=e=>{this.#Q=!1,e.dom.dataset.dragging="false"}},yb=md(()=>new vb,"blockService"),wb=md({},"blockServiceInstance");fb(yb,{displayName:"Ctx<blockService>"}),fb(wb,{displayName:"Ctx<blockServiceInstance>"});var bb=md({},"blockSpec");fb(bb,{displayName:"Ctx<blockSpec>"});var kb=pd(e=>{const t=new sr("MILKDOWN_BLOCK"),n=e.get(yb.key)();e.set(wb.key,n);const o=e.get(bb.key);return new or({key:t,...o,props:{...o.props,handleDOMEvents:{drop:e=>n.dropCallback(e),pointermove:(e,t)=>n.mousemoveCallback(e,t),keydown:e=>n.keydownCallback(e),dragover:(e,t)=>n.dragoverCallback(e,t),dragleave:(e,t)=>n.dragleaveCallback(e,t),dragenter:e=>n.dragenterCallback(e),dragend:e=>n.dragendCallback(e)}}})});fb(kb,{displayName:"Prose<block>"});var Cb=class{#ce;#R;#de;#ue=null;#pe;#he=!1;#fe;#me;#ge;#ve;#ye;get active(){return this.#ue}constructor(e){this.update=()=>{requestAnimationFrame(()=>{if(!this.#he)try{this.#we(),this.#he=!0}catch{}})},this.destroy=()=>{this.#de?.unBind(),this.#de?.removeEvent(this.#ce),this.#ce.remove()},this.show=e=>{const t=e.el,n=this.#R.get(Yl).dom,o={ctx:this.#R,active:e,editorDom:n,blockDom:this.#ce},r={contextElement:t,getBoundingClientRect:()=>this.#ve?this.#ve(o):t.getBoundingClientRect()},i=[Le()];if(this.#ge){const e=Ve(this.#ge(o));i.push(e)}Pe(r,this.#ce,{placement:this.#ye?this.#ye(o):"left",middleware:[...i,...this.#fe],...this.#me}).then(({x:e,y:t})=>{Object.assign(this.#ce.style,{left:`${e}px`,top:`${t}px`}),this.#ce.dataset.show="true"}).catch(console.error)},this.hide=()=>{this.#ce.dataset.show="false"},this.#R=e.ctx,this.#ce=e.content,this.#ge=e.getOffset,this.#ve=e.getPosition,this.#ye=e.getPlacement,this.#fe=e.middleware??[],this.#me=e.floatingUIOptions??{},this.#pe=e.root,this.hide()}#we(){const e=this.#R.get(Yl);(this.#pe??e.dom.parentElement??document.body).appendChild(this.#ce);const t=this.#R.get(wb.key);t.bind(this.#R,e=>{"hide"===e.type?(this.hide(),this.#ue=null):"show"===e.type&&(this.show(e.active),this.#ue=e.active)}),this.#de=t,this.#de.addEvent(this.#ce),this.#ce.draggable=!0}},xb=[bb,mb,yb,wb,kb];xb.key=bb.key,xb.pluginKey=kb.key;var Nb=class{#he=!1;#fe;#me;#pe;#be;#ke;#Ce;#xe;#Ne;constructor(e){this.onShow=()=>{},this.onHide=()=>{},this.update=(e,t)=>{this.#xe(e,t)},this.getContent=(e,t=e=>"paragraph"===e.type.name)=>{const{selection:n}=e.state,{empty:o,$from:r}=n,i=e.state.selection instanceof Fo;if("undefined"==typeof document)return;const s=this.element.contains(document.activeElement),a=!e.hasFocus()&&!s,l=!e.editable,c=!(d=t,e=>yi(d)(e.$from))(e.state.selection);var d;return a||l||!o||!i||c?void 0:r.parent.textBetween(Math.max(0,r.parentOffset-500),r.parentOffset,void 0,"")},this.destroy=()=>{this.#xe.cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=e.content,this.#be=e.debounce??200,this.#Ce=e.shouldShow??this.#Se,this.#ke=e.trigger??"/",this.#Ne=e.offset,this.#fe=e.middleware??[],this.#me=e.floatingUIOptions??{},this.#pe=e.root,this.#xe=He(this.#Oe,this.#be)}#Oe=(e,t)=>{const{state:n,composing:o}=e,{selection:r,doc:i}=n,{ranges:s}=r,a=Math.min(...s.map(e=>e.$from.pos)),l=Math.max(...s.map(e=>e.$to.pos)),c=t&&t.doc.eq(i)&&t.selection.eq(r);this.#he||((this.#pe??e.dom.parentElement??document.body).appendChild(this.element),this.#he=!0),o||c||(this.#Ce(e,t)?(Pe({getBoundingClientRect:()=>hi(e,a,l)},this.element,{placement:"bottom-start",middleware:[Le(),Ve(this.#Ne),...this.#fe],...this.#me}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error),this.show()):this.hide())};#Se=e=>{const t=this.getContent(e);if(!t)return!1;const n=t.at(-1);return!!n&&(Array.isArray(this.#ke)?this.#ke.includes(n):this.#ke===n)}};function Sb({icon:e,class:t,onClick:n}){return fw("span",{class:Ae("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}Sb.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var Ob=Object.defineProperty,Eb=Object.getOwnPropertySymbols,Mb=Object.prototype.hasOwnProperty,_b=Object.prototype.propertyIsEnumerable,Tb=(e,t,n)=>t in e?Ob(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Db=(e,t)=>{for(var n in t||(t={}))Mb.call(t,n)&&Tb(e,n,t[n]);if(Eb)for(var n of Eb(t))_b.call(t,n)&&Tb(e,n,t[n]);return e};function Ib(e,t){return Object.assign(e,{meta:Db({package:"@milkdown/components"},t)}),e}const Ab=md({imageIcon:"🌌",captionIcon:"💬",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"imageBlockConfigCtx");function Rb(e){return ee(e,"paragraph",(e,t,n)=>{var o,r;if(1!==(null==(o=e.children)?void 0:o.length))return;const i=null==(r=e.children)?void 0:r[0];if(!i||"image"!==i.type)return;const{url:s,alt:a,title:l}=i,c={type:"image-block",url:s,alt:a,title:l};n.children.splice(t,1,c)})}Ib(Ab,{displayName:"Config<image-block>",group:"ImageBlock"});const Pb=kd("remark-image-block",()=>()=>Rb);Ib(Pb.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"}),Ib(Pb.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var Lb=Object.defineProperty,Vb=Object.getOwnPropertySymbols,jb=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable,Bb=(e,t,n)=>t in e?Lb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hb=(e,t)=>{for(var n in t||(t={}))jb.call(t,n)&&Bb(e,n,t[n]);if(Vb)for(var n of Vb(t))$b.call(t,n)&&Bb(e,n,t[n]);return e};const Fb="image-block",zb=gd("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:"",validate:"string"},caption:{default:"",validate:"string"},ratio:{default:1,validate:"number"}},parseDOM:[{tag:`img[data-type="${Fb}"]`,getAttrs:e=>{var t;if(!(e instanceof HTMLElement))throw Nt(e);return{src:e.getAttribute("src")||"",caption:e.getAttribute("caption")||"",ratio:Number(null!=(t=e.getAttribute("ratio"))?t:1)}}}],toDOM:e=>["img",Hb({"data-type":Fb},e.attrs)],parseMarkdown:{match:({type:e})=>"image-block"===e,runner:(e,t,n)=>{const o=t.url,r=t.title;let i=Number(t.alt||1);(Number.isNaN(i)||0===i)&&(i=1),e.addNode(n,{src:o,caption:r,ratio:i})}},toMarkdown:{match:e=>"image-block"===e.type.name,runner:(e,t)=>{e.openNode("paragraph"),e.addNode("image",void 0,void 0,{title:t.attrs.caption,url:t.attrs.src,alt:`${Number.parseFloat(t.attrs.ratio).toFixed(2)}`}),e.closeNode()}}}));function qb({icon:e,class:t,onClick:n}){return fw("span",{class:Ae("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}Ib(zb.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"}),qb.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const Wb=ad("abcdefg",8),Ub=$g({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:e,src:t,setLink:n,onUpload:o,imageIcon:r,uploadButton:i,confirmButton:s,uploadPlaceholderText:a,className:l,onImageLoadError:c}){var d,u;const p=wm(!1),h=wm(),f=wm(null!=(d=t.value)?d:""),m=wm(Wb()),g=wm(0!==(null==(u=t.value)?void 0:u.length)),v=e=>{const t=e.target.value;g.value=0!==t.length,f.value=t},y=e=>{var t,o;"Enter"===e.key&&n(null!=(o=null==(t=h.value)?void 0:t.value)?o:"")},w=e=>{var t;const r=null==(t=e.target.files)?void 0:t[0];r&&o(r).then(e=>{e&&(n(e),g.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>fw("div",{class:Ae("image-edit",l)},fw(qb,{icon:r,class:"image-icon"}),fw("div",{class:Ae("link-importer",p.value&&"focus")},fw("input",{ref:h,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:f.value,onInput:v,onKeydown:y,onFocus:()=>p.value=!0,onBlur:()=>p.value=!1}),!g.value&&fw("div",{class:"placeholder"},fw("input",{disabled:e.value,class:"hidden",id:m.value,type:"file",accept:"image/*",onChange:w}),fw("label",{class:"uploader",for:m.value},fw(qb,{icon:i})),fw("span",{class:"text",onClick:()=>{var e;return null==(e=h.value)?void 0:e.focus()}},a))),f.value&&fw(Fragment,null,fw("div",{class:"image-preview"},fw("img",{src:f.value,alt:"",onError:e=>Promise.resolve(null==c?void 0:c(e)).catch(()=>{})})),fw("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=h.value)?void 0:e.value)?t:"")}},fw(qb,{icon:s}))))}}),Kb=$g({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:e,caption:t,ratio:n,readonly:o,setAttr:r,config:i}){var s;const a=wm(),l=wm(),c=wm(Boolean(null==(s=t.value)?void 0:s.length)),d=wm(0),u=()=>{var e;const t=a.value;if(!t)return;const o=t.closest(".milkdown-image-block");if(!o)return;let r=o.getBoundingClientRect().width;if(!r)return;i.maxWidth&&i.maxWidth<r&&(r=i.maxWidth);const s=t.naturalHeight,l=t.naturalWidth;let c=l<r?s:r*(s/l);i.maxHeight&&c>i.maxHeight&&(c=i.maxHeight);const d=(c*(null!=(e=n.value)?e:1)).toFixed(2);t.dataset.origin=c.toFixed(2),t.dataset.height=d,t.style.height=`${d}px`,i.maxWidth&&(t.style.maxWidth=`${i.maxWidth}px`)},p=e=>{e.preventDefault(),e.stopPropagation(),o.value||(c.value=!c.value)},h=e=>{const t=e.target.value;d.value&&window.clearTimeout(d.value),d.value=window.setTimeout(()=>{r("caption",t)},1e3)},f=e=>{const t=e.target.value;d.value&&(window.clearTimeout(d.value),d.value=0),r("caption",t)},m=e=>{e.preventDefault();const t=a.value;if(!t)return;const n=t.getBoundingClientRect().top;let o=e.clientY-n;o<100&&(o=100),i.maxHeight&&o>i.maxHeight&&(o=i.maxHeight);const r=Number(o).toFixed(2);t.dataset.height=r,t.style.height=`${r}px`},g=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",g);const e=a.value;if(!e)return;const t=Number(e.dataset.origin),n=Number(e.dataset.height),o=Number.parseFloat(Number(n/t).toFixed(2));Number.isNaN(o)||r("ratio",o)},v=e=>{o.value||(e.preventDefault(),e.stopPropagation(),window.addEventListener("pointermove",m),window.addEventListener("pointerup",g))};return()=>fw(My,null,fw("div",{class:"image-wrapper"},fw("div",{class:"operation"},fw("div",{class:"operation-item",onPointerdown:p},fw(qb,{icon:i.captionIcon}))),fw("img",{ref:a,"data-type":Fb,onLoad:u,src:e.value,alt:t.value,onError:e=>{var t;return Promise.resolve(null==(t=i.onImageLoadError)?void 0:t.call(i,e)).catch(()=>{})}}),fw("div",{ref:l,class:"image-resize-handle",onPointerdown:v})),c.value&&fw("input",{draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},class:"caption-input",placeholder:null==i?void 0:i.captionPlaceholderText,onInput:h,onBlur:f,value:t.value}))}});var Gb=Object.defineProperty,Jb=Object.getOwnPropertySymbols,Zb=Object.prototype.hasOwnProperty,Xb=Object.prototype.propertyIsEnumerable,Yb=(e,t,n)=>t in e?Gb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const Qb=$g({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){const{src:t}=e;return()=>{var n;return(null==(n=t.value)?void 0:n.length)?fw(Kb,((e,t)=>{for(var n in t||(t={}))Zb.call(t,n)&&Yb(e,n,t[n]);if(Jb)for(var n of Jb(t))Xb.call(t,n)&&Yb(e,n,t[n]);return e})({},e)):fw(Ub,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,onImageLoadError:e.config.onImageLoadError})}}}),ek=fd(zb.node,e=>(t,n,o)=>{const r=wm(t.attrs.src),i=wm(t.attrs.caption),s=wm(t.attrs.ratio),a=wm(!1),l=wm(!n.editable),c=e.get(Ab.key),d=Uw(Qb,{src:r,caption:i,ratio:s,selected:a,readonly:l,setAttr:(e,t)=>{if(!n.editable)return;const r=o();null!=r&&n.dispatch(n.state.tr.setNodeAttribute(r,e,"src"===e?Re.sanitize(t):t))},config:c}),u=document.createElement("div");u.className="milkdown-image-block";const p=Dg(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),h=c.proxyDomURL,f=e=>{if(h){const t=h(e.attrs.src);"string"==typeof t?r.value=t:t.then(e=>{r.value=e}).catch(console.error)}else r.value=e.attrs.src;s.value=e.attrs.ratio,i.value=e.attrs.caption,l.value=!n.editable};return f(t),d.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{p(),d.unmount(),u.remove()}}});Ib(ek,{displayName:"NodeView<image-block>",group:"ImageBlock"});const tk=[Pb,zb,ek,Ab].flat();let nk,ok;if("undefined"!=typeof WeakMap){let e=new WeakMap;nk=t=>e.get(t),ok=(t,n)=>(e.set(t,n),n)}else{const e=[],t=10;let n=0;nk=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},ok=(o,r)=>(n==t&&(n=0),e[n++]=o,e[n++]=r)}var rk=class{constructor(e,t,n,o){this.width=e,this.height=t,this.map=n,this.problems=o}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const o=t%this.width,r=t/this.width|0;let i=o+1,s=r+1;for(let e=1;i<this.width&&this.map[t+e]==n;e++)i++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:o,top:r,right:i,bottom:s}}throw new 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 new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:o,right:r,top:i,bottom:s}=this.findCell(e);return"horiz"==t?(n<0?0==o:r==this.width)?null:this.map[i*this.width+(n<0?o-1:r)]:(n<0?0==i:s==this.height)?null:this.map[o+this.width*(n<0?i-1:s)]}rectBetween(e,t){const{left:n,right:o,top:r,bottom:i}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(r,l),right:Math.max(o,a),bottom:Math.max(i,c)}}cellsInRect(e){const t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let r=e.left;r<e.right;r++){const i=o*this.width+r,s=this.map[i];n[s]||(n[s]=!0,r==e.left&&r&&this.map[i-1]==s||o==e.top&&o&&this.map[i-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let o=0,r=0;;o++){const i=r+n.child(o).nodeSize;if(o==e){let n=t+e*this.width;const o=(e+1)*this.width;for(;n<o&&this.map[n]<r;)n++;return n==o?i-1:this.map[n]}r=i}}static get(e){return nk(e)||ok(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);const t=function(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){const r=e.child(o);let i=0;if(n)for(let t=0;t<o;t++){const n=e.child(t);for(let e=0;e<n.childCount;e++){const r=n.child(e);t+r.attrs.rowspan>o&&(i+=r.attrs.colspan)}}for(let e=0;e<r.childCount;e++){const t=r.child(e);i+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=i:t!=i&&(t=Math.max(t,i))}return t}(e),n=e.childCount,o=[];let r=0,i=null;const s=[];for(let e=0,r=t*n;e<r;e++)o[e]=0;for(let a=0,l=0;a<n;a++){const c=e.child(a);l++;for(let e=0;;e++){for(;r<o.length&&0!=o[r];)r++;if(e==c.childCount)break;const d=c.child(e),{colspan:u,rowspan:p,colwidth:h}=d.attrs;for(let e=0;e<p;e++){if(e+a>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:l,n:p-e});break}const c=r+e*t;for(let e=0;e<u;e++){0==o[c+e]?o[c+e]=l:(i||(i=[])).push({type:"collision",row:a,pos:l,n:u-e});const n=h&&h[e];if(n){const o=(c+e)%t*2,r=s[o];null==r||r!=n&&1==s[o+1]?(s[o]=n,s[o+1]=1):r==n&&s[o+1]++}}}r+=u,l+=d.nodeSize}const d=(a+1)*t;let u=0;for(;r<d;)0==o[r++]&&u++;u&&(i||(i=[])).push({type:"missing",row:a,n:u}),l++}0!==t&&0!==n||(i||(i=[])).push({type:"zero_sized"});const a=new rk(t,n,o,i);let l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(l=!0);l&&function(e,t,n){e.problems||(e.problems=[]);const o={};for(let r=0;r<e.map.length;r++){const i=e.map[r];if(o[i])continue;o[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=s.attrs;for(let n=0;n<l.colspan;n++){const o=t[(r+n)%e.width*2];null==o||l.colwidth&&l.colwidth[n]==o||((a||(a=ik(l)))[n]=o)}a&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}(a,s,e);return a}(e))}};function ik(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function sk(e,t){if("string"==typeof e)return{};const n=e.getAttribute("data-colwidth"),o=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(e=>Number(e)):null,r=Number(e.getAttribute("colspan")||1),i={colspan:r,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:o&&o.length==r?o:null};for(const n in t){const o=t[n].getFromDOM,r=o&&o(e);null!=r&&(i[n]=r)}return i}function ak(e,t){const n={};1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(const o in t){const r=t[o].setDOMAttr;r&&r(e.attrs[o],n)}return n}function lk(e){if(null!==e){if(!Array.isArray(e))throw new TypeError("colwidth must be null or an array");for(const t of e)if("number"!=typeof t)throw new TypeError("colwidth must be null or an array of numbers")}}function ck(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const o=e.nodes[n],r=o.spec.tableRole;r&&(t[r]=o)}}return t}const dk=new sr("selectingCells");function uk(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function pk(e){const t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function hk(e){const 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&&"cell"==t.node.type.spec.tableRole)return t.$anchor;const n=uk(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const o=t.type.spec.tableRole;if("cell"==o||"header_cell"==o)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const o=t.type.spec.tableRole;if("cell"==o||"header_cell"==o)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function fk(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function mk(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function gk(e,t,n){const o=e.node(-1),r=rk.get(o),i=e.start(-1),s=r.nextCell(e.pos-i,t,n);return null==s?null:e.node(0).resolve(i+s)}function vk(e,t,n=1){const o={...e,colspan:e.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(t,n),o.colwidth.some(e=>e>0)||(o.colwidth=null)),o}function yk(e,t,n=1){const o={...e,colspan:e.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let e=0;e<n;e++)o.colwidth.splice(t,0,0)}return o}var wk=class e extends jo{constructor(e,t=e){const n=e.node(-1),o=rk.get(n),r=e.start(-1),i=o.rectBetween(e.pos-r,t.pos-r),s=e.node(0),a=o.cellsInRect(i).filter(e=>e!=t.pos-r);a.unshift(t.pos-r);const l=a.map(e=>{const t=n.nodeAt(e);if(!t)throw new RangeError(`No cell with offset ${e} found`);const o=r+e+1;return new $o(s.resolve(o),s.resolve(o+t.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=t}map(t,n){const o=t.resolve(n.map(this.$anchorCell.pos)),r=t.resolve(n.map(this.$headCell.pos));if(fk(o)&&fk(r)&&mk(o,r)){const t=this.$anchorCell.node(-1)!=o.node(-1);return t&&this.isRowSelection()?e.rowSelection(o,r):t&&this.isColSelection()?e.colSelection(o,r):new e(o,r)}return Fo.between(o,r)}content(){const e=this.$anchorCell.node(-1),t=rk.get(e),n=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),r={},i=[];for(let n=o.top;n<o.bottom;n++){const s=[];for(let i=n*t.width+o.left,a=o.left;a<o.right;a++,i++){const n=t.map[i];if(r[n])continue;r[n]=!0;const a=t.findCell(n);let l=e.nodeAt(n);if(!l)throw new RangeError(`No cell with offset ${n} found`);const c=o.left-a.left,d=a.right-o.right;if(c>0||d>0){let e=l.attrs;if(c>0&&(e=vk(e,0,c)),d>0&&(e=vk(e,e.colspan-d,d)),a.left<o.left){if(l=l.type.createAndFill(e),!l)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(a.top<o.top||a.bottom>o.bottom){const e={...l.attrs,rowspan:Math.min(a.bottom,o.bottom)-Math.max(a.top,o.top)};l=a.top<o.top?l.type.createAndFill(e):l.type.create(e,l.content)}s.push(l)}i.push(e.child(n).copy(Ht.from(s)))}const s=this.isColSelection()&&this.isRowSelection()?e:i;return new Kt(Ht.from(s),1,1)}replace(e,t=Kt.empty){const n=e.steps.length,o=this.ranges;for(let r=0;r<o.length;r++){const{$from:i,$to:s}=o[r],a=e.mapping.slice(n);e.replace(a.map(i.pos),a.map(s.pos),r?Kt.empty:t)}const r=jo.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);r&&e.setSelection(r)}replaceWith(e,t){this.replace(e,new Kt(Ht.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=rk.get(t),o=this.$anchorCell.start(-1),r=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let n=0;n<r.length;n++)e(t.nodeAt(r[n]),o+r[n])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,o)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const o=t.node(-1),r=rk.get(o),i=t.start(-1),s=r.findCell(t.pos-i),a=r.findCell(n.pos-i),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(i+r.map[s.left])),a.bottom<r.height&&(n=l.resolve(i+r.map[r.width*(r.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(i+r.map[a.left])),s.bottom<r.height&&(t=l.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new e(t,n)}isRowSelection(){const e=this.$anchorCell.node(-1),t=rk.get(e),n=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-n),r=t.colCount(this.$headCell.pos-n);if(Math.min(o,r)>0)return!1;const i=o+this.$anchorCell.nodeAfter.attrs.colspan,s=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,s)==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){const o=t.node(-1),r=rk.get(o),i=t.start(-1),s=r.findCell(t.pos-i),a=r.findCell(n.pos-i),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(i+r.map[s.top*r.width])),a.right<r.width&&(n=l.resolve(i+r.map[r.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(i+r.map[a.top*r.width])),s.right<r.width&&(t=l.resolve(i+r.map[r.width*(s.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,o=n){return new e(t.resolve(n),t.resolve(o))}getBookmark(){return new bk(this.$anchorCell.pos,this.$headCell.pos)}};wk.prototype.visible=!1,jo.jsonID("cell",wk);var bk=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){const t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&mk(t,n)?new wk(t,n):jo.near(n,1)}};function kk(e){if(!(e.selection instanceof wk))return null;const t=[];return e.selection.forEachCell((e,n)=>{t.push(gl.node(n,n+e.nodeSize,{class:"selectedCell"}))}),wl.create(e.doc,t)}const Ck=new sr("fix-tables");function xk(e,t,n,o){const r=e.childCount,i=t.childCount;e:for(let s=0,a=0;s<i;s++){const i=t.child(s);for(let t=a,o=Math.min(r,s+3);t<o;t++)if(e.child(t)==i){a=t+1,n+=i.nodeSize;continue e}o(i,n),a<r&&e.child(a).sameMarkup(i)?xk(e.child(a),i,n+1,o):i.nodesBetween(0,i.content.size,o,n+1),n+=i.nodeSize}}function Nk(e,t){let n;const o=(t,o)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,o){const r=rk.get(t);if(!r.problems)return o;o||(o=e.tr);const i=[];for(let e=0;e<r.height;e++)i.push(0);for(let e=0;e<r.problems.length;e++){const s=r.problems[e];if("collision"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;const r=e.attrs;for(let e=0;e<r.rowspan;e++)i[s.row+e]+=s.n;o.setNodeMarkup(o.mapping.map(n+1+s.pos),null,vk(r,r.colspan-s.n,s.n))}else if("missing"==s.type)i[s.row]+=s.n;else if("overlong_rowspan"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;o.setNodeMarkup(o.mapping.map(n+1+s.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-s.n})}else if("colwidth mismatch"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;o.setNodeMarkup(o.mapping.map(n+1+s.pos),null,{...e.attrs,colwidth:s.colwidth})}else if("zero_sized"==s.type){const e=o.mapping.map(n);o.delete(e,e+t.nodeSize)}}let s,a;for(let e=0;e<i.length;e++)i[e]&&(null==s&&(s=e),a=e);for(let l=0,c=n+1;l<r.height;l++){const n=t.child(l),r=c+n.nodeSize,d=i[l];if(d>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);const i=[];for(let n=0;n<d;n++){const n=ck(e.schema)[t].createAndFill();n&&i.push(n)}const u=0!=l&&s!=l-1||a!=l?r-1:c+1;o.insert(o.mapping.map(u),i)}c=r}return o.setMeta(Ck,{fixTables:!0})}(e,t,o,n))};return t?t.doc!=e.doc&&xk(t.doc,e.doc,0,o):e.doc.descendants(o),n}function Sk(e){const t=rk.get(e),n=[],o=t.height,r=t.width;for(let i=0;i<o;i++){const o=[];for(let n=0;n<r;n++){const s=i*r+n,a=t.map[s];if(i>0){const e=s-r;if(a===t.map[e]){o.push(null);continue}}if(n>0){const e=s-1;if(a===t.map[e]){o.push(null);continue}}o.push(e.nodeAt(a))}n.push(o)}return n}function Ok(e,t){const n=[],o=rk.get(e),r=o.height,i=o.width;for(let s=0;s<r;s++){const r=e.child(s),a=[];for(let n=0;n<i;n++){const r=t[s][n];if(!r)continue;const i=o.map[s*o.width+n],l=e.nodeAt(i);if(!l)continue;const c=l.type.createChecked(r.attrs,r.content,r.marks);a.push(c)}const l=r.type.createChecked(r.attrs,a,r.marks);n.push(l)}return e.type.createChecked(e.attrs,n,e.marks)}function Ek(e,t,n,o){const r=t[0]>n[0]?-1:1,i=e.splice(t[0],t.length),s=i.length%2==0?1:0;let a;return a=-1===r?n[0]:n[n.length-1]-s,e.splice(a,0,...i),e}function Mk(e){return function(e,t){for(let n=t.depth;n>=0;n-=1){const o=t.node(n);if(e(o))return{node:o,pos:0===n?0:t.before(n),start:t.start(n),depth:n}}return null}(e=>"table"===e.type.spec.tableRole,e)}function _k(e,t){const n=Mk(t.$from);if(!n)return;const o=rk.get(n.node);return e<0||e>o.width-1?void 0:o.cellsInRect({left:e,right:e+1,top:0,bottom:o.height}).map(e=>{const t=n.node.nodeAt(e),o=e+n.start;return{pos:o,start:o+1,node:t,depth:n.depth+2}})}function Tk(e,t){const n=Mk(t.$from);if(!n)return;const o=rk.get(n.node);return e<0||e>o.height-1?void 0:o.cellsInRect({left:0,right:o.width,top:e,bottom:e+1}).map(e=>{const t=n.node.nodeAt(e),o=e+n.start;return{pos:o,start:o+1,node:t,depth:n.depth+2}})}function Dk(e,t,n=t){let o=t,r=n;for(let n=t;n>=0;n--){const t=_k(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.colspan+n-1;t>=o&&(o=n),t>r&&(r=t)})}for(let n=t;n<=r;n++){const t=_k(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>r&&(r=t)})}const i=[];for(let t=o;t<=r;t++){const n=_k(t,e.selection);n&&n.length>0&&i.push(t)}o=i[0],r=i[i.length-1];const s=_k(o,e.selection),a=Tk(0,e.selection);if(!s||!a)return;const l=e.doc.resolve(s[s.length-1].pos);let c;for(let t=r;t>=o;t--){const n=_k(t,e.selection);if(n&&n.length>0){for(let e=a.length-1;e>=0;e--)if(a[e].pos===n[0].pos){c=n[0];break}if(c)break}}return c?{$anchor:l,$head:e.doc.resolve(c.pos),indexes:i}:void 0}function Ik(e,t,n=t){let o=t,r=n;for(let n=t;n>=0;n--){const t=Tk(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.rowspan+n-1;t>=o&&(o=n),t>r&&(r=t)})}for(let n=t;n<=r;n++){const t=Tk(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>r&&(r=t)})}const i=[];for(let t=o;t<=r;t++){const n=Tk(t,e.selection);n&&n.length>0&&i.push(t)}o=i[0],r=i[i.length-1];const s=Tk(o,e.selection),a=_k(0,e.selection);if(!s||!a)return;const l=e.doc.resolve(s[s.length-1].pos);let c;for(let t=r;t>=o;t--){const n=Tk(t,e.selection);if(n&&n.length>0){for(let e=a.length-1;e>=0;e--)if(a[e].pos===n[0].pos){c=n[0];break}if(c)break}}return c?{$anchor:l,$head:e.doc.resolve(c.pos),indexes:i}:void 0}function Ak(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function Rk(e){var t,n;const{tr:o,originIndex:r,targetIndex:i,select:s,pos:a}=e,l=Mk(o.doc.resolve(a));if(!l)return!1;const c=null===(t=Dk(o,r))||void 0===t?void 0:t.indexes,d=null===(n=Dk(o,i))||void 0===n?void 0:n.indexes;if(!c||!d)return!1;if(c.includes(i))return!1;const u=function(e,t,n){let o=Ak(Sk(e));return o=Ek(o,t,n),o=Ak(o),Ok(e,o)}(l.node,c,d);if(o.replaceWith(l.pos,l.pos+l.node.nodeSize,u),!s)return!0;const p=rk.get(u),h=l.start,f=i,m=p.positionAt(p.height-1,f,u),g=o.doc.resolve(h+m),v=p.positionAt(0,f,u),y=o.doc.resolve(h+v);return o.setSelection(wk.colSelection(g,y)),!0}function Pk(e){var t,n;const{tr:o,originIndex:r,targetIndex:i,select:s,pos:a}=e,l=Mk(o.doc.resolve(a));if(!l)return!1;const c=null===(t=Ik(o,r))||void 0===t?void 0:t.indexes,d=null===(n=Ik(o,i))||void 0===n?void 0:n.indexes;if(!c||!d)return!1;if(c.includes(i))return!1;const u=function(e,t,n){let o=Sk(e);return o=Ek(o,t,n),Ok(e,o)}(l.node,c,d);if(o.replaceWith(l.pos,l.pos+l.node.nodeSize,u),!s)return!0;const p=rk.get(u),h=l.start,f=i,m=p.positionAt(f,p.width-1,u),g=o.doc.resolve(h+m),v=p.positionAt(f,0,u),y=o.doc.resolve(h+v);return o.setSelection(wk.rowSelection(g,y)),!0}function Lk(e){const t=e.selection,n=hk(e),o=n.node(-1),r=n.start(-1),i=rk.get(o);return{...t instanceof wk?i.rectBetween(t.$anchorCell.pos-r,t.$headCell.pos-r):i.findCell(n.pos-r),tableStart:r,map:i,table:o}}function Vk(e,{map:t,tableStart:n,table:o},r){let i=r>0?-1:0;(function(e,t,n){const o=ck(t.type.schema).header_cell;for(let r=0;r<e.height;r++)if(t.nodeAt(e.map[n+r*e.width]).type!=o)return!1;return!0})(t,o,r+i)&&(i=0==r||r==t.width?null:0);for(let s=0;s<t.height;s++){const a=s*t.width+r;if(r>0&&r<t.width&&t.map[a-1]==t.map[a]){const i=t.map[a],l=o.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,yk(l.attrs,r-t.colCount(i))),s+=l.attrs.rowspan-1}else{const l=null==i?ck(o.type.schema).cell:o.nodeAt(t.map[a+i]).type,c=t.positionAt(s,r,o);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function jk(e,t){if(!pk(e))return!1;if(t){const n=Lk(e);t(Vk(e.tr,n,n.left))}return!0}function $k(e,t){if(!pk(e))return!1;if(t){const n=Lk(e);t(Vk(e.tr,n,n.right))}return!0}function Bk(e,{map:t,table:n,tableStart:o},r){const i=e.mapping.maps.length;for(let s=0;s<t.height;){const a=s*t.width+r,l=t.map[a],c=n.nodeAt(l),d=c.attrs;if(r>0&&t.map[a-1]==l||r<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(i).map(o+l),null,vk(d,r-t.colCount(l)));else{const t=e.mapping.slice(i).map(o+l);e.delete(t,t+c.nodeSize)}s+=d.rowspan}}function Hk(e,{map:t,table:n,tableStart:o},r){let i=0;for(let e=0;e<r;e++)i+=n.child(e).nodeSize;const s=i+n.child(r).nodeSize,a=e.mapping.maps.length;e.delete(i+o,s+o);const l=new Set;for(let i=0,s=r*t.width;i<t.width;i++,s++){const c=t.map[s];if(!l.has(c))if(l.add(c),r>0&&c==t.map[s-t.width]){const t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(a).map(c+o),null,{...t,rowspan:t.rowspan-1}),i+=t.colspan-1}else if(r<t.height&&c==t.map[s+t.width]){const s=n.nodeAt(c),l=s.attrs,d=s.type.create({...l,rowspan:s.attrs.rowspan-1},s.content),u=t.positionAt(r+1,i,n);e.insert(e.mapping.slice(a).map(o+u),d),i+=l.colspan-1}}}function Fk(e,t,n){const o=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<o.length;e++){const r=t.table.nodeAt(o[e]);if(r&&r.type!==n.header_cell)return!1}return!0}function zk(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!pk(t))return!1;if(n){const o=ck(t.schema),r=Lk(t),i=t.tr,s=r.map.cellsInRect("column"==e?{left:r.left,top:0,right:r.right,bottom:r.map.height}:"row"==e?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),a=s.map(e=>r.table.nodeAt(e));for(let e=0;e<s.length;e++)a[e].type==o.header_cell&&i.setNodeMarkup(r.tableStart+s[e],o.cell,a[e].attrs);if(0===i.steps.length)for(let e=0;e<s.length;e++)i.setNodeMarkup(r.tableStart+s[e],o.header_cell,a[e].attrs);n(i)}return!0}}(e):function(t,n){if(!pk(t))return!1;if(n){const o=ck(t.schema),r=Lk(t),i=t.tr,s=Fk("row",r,o),a=Fk("column",r,o),l=("column"===e?s:"row"===e&&a)?1:0,c="column"==e?{left:0,top:l,right:1,bottom:r.map.height}:"row"==e?{left:l,top:0,right:r.map.width,bottom:1}:r,d="column"==e?a?o.cell:o.header_cell:"row"==e?s?o.cell:o.header_cell:o.cell;r.map.cellsInRect(c).forEach(e=>{const t=e+r.tableStart,n=i.doc.nodeAt(t);n&&i.setNodeMarkup(t,d,n.attrs)}),n(i)}return!0}}function qk(e){return function(t,n){if(!pk(t))return!1;const o=function(e,t){if(t<0){const t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){const o=e.node(-1).child(t),r=o.lastChild;if(r)return n-1-r.nodeSize;n-=o.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const t=e.node(-1);for(let n=e.indexAfter(-1),o=e.after();n<t.childCount;n++){const e=t.child(n);if(e.childCount)return o+1;o+=e.nodeSize}}return null}(hk(t),e);if(null==o)return!1;if(n){const e=t.doc.resolve(o);n(t.tr.setSelection(Fo.between(e,(r=e,r.node(0).resolve(r.pos+r.nodeAfter.nodeSize)))).scrollIntoView())}var r;return!0}}function Wk(e,t){const n=e.selection;if(!(n instanceof wk))return!1;if(t){const o=e.tr,r=ck(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(r)||o.replace(o.mapping.map(t+1),o.mapping.map(t+e.nodeSize-1),new Kt(r,0,0))}),o.docChanged&&t(o)}return!0}function Uk(e){if(0===e.size)return null;let{content:t,openStart:n,openEnd:o}=e;for(;1==t.childCount&&(n>0&&o>0||"table"==t.child(0).type.spec.tableRole);)n--,o--,t=t.child(0).content;const r=t.child(0),i=r.type.spec.tableRole,s=r.type.schema,a=[];if("row"==i)for(let e=0;e<t.childCount;e++){let r=t.child(e).content;const i=e?0:Math.max(0,n-1),l=e<t.childCount-1?0:Math.max(0,o-1);(i||l)&&(r=Kk(ck(s).row,new Kt(r,i,l)).content),a.push(r)}else{if("cell"!=i&&"header_cell"!=i)return null;a.push(n||o?Kk(ck(s).row,new Kt(t,n,o)).content:t)}return function(e,t){const n=[];for(let e=0;e<t.length;e++){const o=t[e];for(let t=o.childCount-1;t>=0;t--){const{rowspan:r,colspan:i}=o.child(t).attrs;for(let t=e;t<e+r;t++)n[t]=(n[t]||0)+i}}let o=0;for(let e=0;e<n.length;e++)o=Math.max(o,n[e]);for(let r=0;r<n.length;r++)if(r>=t.length&&t.push(Ht.empty),n[r]<o){const i=ck(e).cell.createAndFill(),s=[];for(let e=n[r];e<o;e++)s.push(i);t[r]=t[r].append(Ht.from(s))}return{height:t.length,width:o,rows:t}}(s,a)}function Kk(e,t){const n=e.createAndFill();return new Lo(n).replace(0,n.content.size,t).doc}function Gk(e,t,n,o,r,i,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=r;c<i;c++){const r=s*t.width+c,i=t.map[r];if(t.map[r-t.width]==i){l=!0;const r=n.nodeAt(i),{top:d,left:u}=t.findCell(i);e.setNodeMarkup(e.mapping.slice(a).map(i+o),null,{...r.attrs,rowspan:s-d}),e.insert(e.mapping.slice(a).map(t.positionAt(s,u,n)),r.type.createAndFill({...r.attrs,rowspan:d+r.attrs.rowspan-s})),c+=r.attrs.colspan-1}}return l}function Jk(e,t,n,o,r,i,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=r;c<i;c++){const r=c*t.width+s,i=t.map[r];if(t.map[r-1]==i){l=!0;const r=n.nodeAt(i),d=t.colCount(i),u=e.mapping.slice(a).map(i+o);e.setNodeMarkup(u,null,vk(r.attrs,s-d,r.attrs.colspan-(s-d))),e.insert(u+r.nodeSize,r.type.createAndFill(vk(r.attrs,0,s-d))),c+=r.attrs.rowspan-1}}return l}function Zk(e,t,n,o,r){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let s=rk.get(i);const{top:a,left:l}=o,c=l+r.width,d=a+r.height,u=e.tr;let p=0;function h(){if(i=n?u.doc.nodeAt(n-1):u.doc,!i)throw new Error("No table found");s=rk.get(i),p=u.mapping.maps.length}(function(e,t,n,o,r,i,s){const a=ck(e.doc.type.schema);let l,c;if(r>t.width)for(let i=0,d=0;i<t.height;i++){const u=n.child(i);d+=u.nodeSize;const p=[];let h;h=null==u.lastChild||u.lastChild.type==a.cell?l||(l=a.cell.createAndFill()):c||(c=a.header_cell.createAndFill());for(let e=t.width;e<r;e++)p.push(h);e.insert(e.mapping.slice(s).map(d-1+o),p)}if(i>t.height){const d=[];for(let e=0,o=(t.height-1)*t.width;e<Math.max(t.width,r);e++){const r=!(e>=t.width)&&n.nodeAt(t.map[o+e]).type==a.header_cell;d.push(r?c||(c=a.header_cell.createAndFill()):l||(l=a.cell.createAndFill()))}const u=a.row.create(null,Ht.from(d)),p=[];for(let e=t.height;e<i;e++)p.push(u);e.insert(e.mapping.slice(s).map(o+n.nodeSize-2),p)}return!(!l&&!c)})(u,s,i,n,c,d,p)&&h(),Gk(u,s,i,n,l,c,a,p)&&h(),Gk(u,s,i,n,l,c,d,p)&&h(),Jk(u,s,i,n,a,d,l,p)&&h(),Jk(u,s,i,n,a,d,c,p)&&h();for(let e=a;e<d;e++){const t=s.positionAt(e,l,i),o=s.positionAt(e,c,i);u.replace(u.mapping.slice(p).map(t+n),u.mapping.slice(p).map(o+n),new Kt(r.rows[e-a],0,0))}h(),u.setSelection(new wk(u.doc.resolve(n+s.positionAt(a,l,i)),u.doc.resolve(n+s.positionAt(d-1,c-1,i)))),t(u)}zk("row",{useDeprecatedLogic:!0}),zk("column",{useDeprecatedLogic:!0}),zk("cell",{useDeprecatedLogic:!0});const Xk=Oi({ArrowLeft:Qk("horiz",-1),ArrowRight:Qk("horiz",1),ArrowUp:Qk("vert",-1),ArrowDown:Qk("vert",1),"Shift-ArrowLeft":eC("horiz",-1),"Shift-ArrowRight":eC("horiz",1),"Shift-ArrowUp":eC("vert",-1),"Shift-ArrowDown":eC("vert",1),Backspace:Wk,"Mod-Backspace":Wk,Delete:Wk,"Mod-Delete":Wk});function Yk(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Qk(e,t){return(n,o,r)=>{if(!r)return!1;const i=n.selection;if(i instanceof wk)return Yk(n,o,jo.near(i.$headCell,t));if("horiz"!=e&&!i.empty)return!1;const s=rC(r,e,t);if(null==s)return!1;if("horiz"==e)return Yk(n,o,jo.near(n.doc.resolve(i.head+t),t));{const r=n.doc.resolve(s),i=gk(r,e,t);let a;return a=i?jo.near(i,1):t<0?jo.near(n.doc.resolve(r.before(-1)),-1):jo.near(n.doc.resolve(r.after(-1)),1),Yk(n,o,a)}}}function eC(e,t){return(n,o,r)=>{if(!r)return!1;const i=n.selection;let s;if(i instanceof wk)s=i;else{const o=rC(r,e,t);if(null==o)return!1;s=new wk(n.doc.resolve(o))}const a=gk(s.$headCell,e,t);return!!a&&Yk(n,o,new wk(s.$anchorCell,a))}}function tC(e,t){const n=uk(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new wk(n))),!0)}function nC(e,t,n){if(!pk(e.state))return!1;let o=Uk(n);const r=e.state.selection;if(r instanceof wk){o||(o={width:1,height:1,rows:[Ht.from(Kk(ck(e.state.schema).cell,n))]});const t=r.$anchorCell.node(-1),i=r.$anchorCell.start(-1),s=rk.get(t).rectBetween(r.$anchorCell.pos-i,r.$headCell.pos-i);return o=function({width:e,height:t,rows:n},o,r){if(e!=o){const t=[],r=[];for(let e=0;e<n.length;e++){const i=n[e],s=[];for(let n=t[e]||0,r=0;n<o;r++){let a=i.child(r%i.childCount);n+a.attrs.colspan>o&&(a=a.type.createChecked(vk(a.attrs,a.attrs.colspan,n+a.attrs.colspan-o),a.content)),s.push(a),n+=a.attrs.colspan;for(let n=1;n<a.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+a.attrs.colspan}r.push(Ht.from(s))}n=r,e=o}if(t!=r){const e=[];for(let o=0,i=0;o<r;o++,i++){const s=[],a=n[i%t];for(let e=0;e<a.childCount;e++){let t=a.child(e);o+t.attrs.rowspan>r&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,r-t.attrs.rowspan)},t.content)),s.push(t)}e.push(Ht.from(s))}n=e,t=r}return{width:e,height:t,rows:n}}(o,s.right-s.left,s.bottom-s.top),Zk(e.state,e.dispatch,i,s,o),!0}if(o){const t=hk(e.state),n=t.start(-1);return Zk(e.state,e.dispatch,n,rk.get(t.node(-1)).findCell(t.pos-n),o),!0}return!1}function oC(e,t){var n;if(0!=t.button)return;if(t.ctrlKey||t.metaKey)return;const o=iC(e,t.target);let r;if(t.shiftKey&&e.state.selection instanceof wk)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&null!=(r=uk(e.state.selection.$anchor))&&(null===(n=sC(e,t))||void 0===n?void 0:n.pos)!=r.pos)i(r,t),t.preventDefault();else if(!o)return;function i(t,n){let o=sC(e,n);const r=null==dk.getState(e.state);if(!o||!mk(t,o)){if(!r)return;o=t}const i=new wk(t,o);if(r||!e.state.selection.eq(i)){const n=e.state.tr.setSelection(i);r&&n.setMeta(dk,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=dk.getState(e.state)&&e.dispatch(e.state.tr.setMeta(dk,-1))}function a(n){const r=n,a=dk.getState(e.state);let l;if(null!=a)l=e.state.doc.resolve(a);else if(iC(e,r.target)!=o&&(l=sC(e,t),!l))return s();l&&i(l,r)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function rC(e,t,n){if(!(e.state.selection instanceof Fo))return null;const{$head:o}=e.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((n<0?o.index(r):o.indexAfter(r))!=(n<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){const i=o.before(r),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?i:null}}return null}function iC(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function sC(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:r}=n;return o>=0&&uk(e.state.doc.resolve(o))||uk(e.state.doc.resolve(r))}var aC=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")),lC(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,lC(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function lC(e,t,n,o,r,i){let s=0,a=!0,l=t.firstChild;const c=e.firstChild;if(c){for(let e=0,n=0;e<c.childCount;e++){const{colspan:d,colwidth:u}=c.child(e).attrs;for(let e=0;e<d;e++,n++){const c=r==n?i:u&&u[e],d=c?c+"px":"";if(s+=c||o,c||(a=!1),l)l.style.width!=d&&(l.style.width=d),l=l.nextSibling;else{const e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;l;){var d;const e=l.nextSibling;null===(d=l.parentNode)||void 0===d||d.removeChild(l),l=e}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const cC=new sr("tableColumnResizing");function dC({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=aC,lastColumnResizable:r=!0}={}){const i=new or({key:cC,state:{init(e,t){var r;const s=null===(r=i.spec)||void 0===r||null===(r=r.props)||void 0===r?void 0:r.nodeViews,a=ck(t.schema).table.name;return o&&s&&(s[a]=(e,t)=>new o(e,n,t)),new uC(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{const t=cC.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,o){if(!e.editable)return;const r=cC.getState(e.state);if(!r)return;if(!r.dragging){const i=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target);let s=-1;if(i){const{left:o,right:r}=i.getBoundingClientRect();t.clientX-o<=n?s=pC(e,t,"left",n):r-t.clientX<=n&&(s=pC(e,t,"right",n))}if(s!=r.activeHandle){if(!o&&-1!==s){const t=e.state.doc.resolve(s),n=t.node(-1),o=rk.get(n),r=t.start(-1);if(o.colCount(t.pos-r)+t.nodeAfter.attrs.colspan-1==o.width-1)return}fC(e,s)}}}(t,n,e,r)},mouseleave:e=>{!function(e){if(!e.editable)return;const t=cC.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&fC(e,-1)}(e)},mousedown:(e,o)=>{!function(e,t,n,o){var r;if(!e.editable)return!1;const i=null!==(r=e.dom.ownerDocument.defaultView)&&void 0!==r?r:window,s=cC.getState(e.state);if(!s||-1==s.activeHandle||s.dragging)return!1;const a=e.state.doc.nodeAt(s.activeHandle),l=function(e,t,{colspan:n,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=e.domAtPos(t);let s=i.node.childNodes[i.offset].offsetWidth,a=n;if(o)for(let e=0;e<n;e++)o[e]&&(s-=o[e],a--);return s/a}(e,s.activeHandle,a.attrs);function c(t){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);const o=cC.getState(e.state);(null==o?void 0:o.dragging)&&(!function(e,t,n){const o=e.state.doc.resolve(t),r=o.node(-1),i=rk.get(r),s=o.start(-1),a=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<i.height;e++){const t=e*i.width+a;if(e&&i.map[t]==i.map[t-i.width])continue;const o=i.map[t],c=r.nodeAt(o).attrs,d=1==c.colspan?0:a-i.colCount(o);if(c.colwidth&&c.colwidth[d]==n)continue;const u=c.colwidth?c.colwidth.slice():gC(c.colspan);u[d]=n,l.setNodeMarkup(s+o,null,{...c,colwidth:u})}l.docChanged&&e.dispatch(l)}(e,o.activeHandle,hC(o.dragging,t,n)),e.dispatch(e.state.tr.setMeta(cC,{setDragging:null})))}function d(t){if(!t.which)return c(t);const r=cC.getState(e.state);if(r&&r.dragging){const i=hC(r.dragging,t,n);mC(e,r.activeHandle,i,o)}}e.dispatch(e.state.tr.setMeta(cC,{setDragging:{startX:t.clientX,startWidth:l}})),mC(e,s.activeHandle,l,o),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),t.preventDefault()}(e,o,t,n)}},decorations:e=>{const t=cC.getState(e);if(t&&t.activeHandle>-1)return function(e,t){const n=[],o=e.doc.resolve(t),r=o.node(-1);if(!r)return wl.empty;const i=rk.get(r),s=o.start(-1),a=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let t=0;t<i.height;t++){const o=a+t*i.width;if(!(a!=i.width-1&&i.map[o]==i.map[o+1]||0!=t&&i.map[o]==i.map[o-i.width])){var l;const t=i.map[o],a=s+t+r.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null===(l=cC.getState(e))||void 0===l?void 0:l.dragging)&&n.push(gl.node(s+t,s+t+r.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push(gl.widget(a,c))}}return wl.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return i}var uC=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){const n=this,o=t.getMeta(cC);if(o&&null!=o.setHandle)return new e(o.setHandle,!1);if(o&&void 0!==o.setDragging)return new e(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let o=t.mapping.map(n.activeHandle,-1);return fk(t.doc.resolve(o))||(o=-1),new e(o,n.dragging)}return n}};function pC(e,t,n,o){const r="right"==n?-o:o,i=e.posAtCoords({left:t.clientX+r,top:t.clientY});if(!i)return-1;const{pos:s}=i,a=uk(e.state.doc.resolve(s));if(!a)return-1;if("right"==n)return a.pos;const l=rk.get(a.node(-1)),c=a.start(-1),d=l.map.indexOf(a.pos-c);return d%l.width==0?-1:c+l.map[d-1]}function hC(e,t,n){const o=t.clientX-e.startX;return Math.max(n,e.startWidth+o)}function fC(e,t){e.dispatch(e.state.tr.setMeta(cC,{setHandle:t}))}function mC(e,t,n,o){const r=e.state.doc.resolve(t),i=r.node(-1),s=r.start(-1),a=rk.get(i).colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;let l=e.domAtPos(r.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&lC(i,l.firstChild,l,o,a,n)}function gC(e){return Array(e).fill(0)}function vC({allowTableNodeSelection:e=!1}={}){return new or({key:dk,state:{init:()=>null,apply(e,t){const n=e.getMeta(dk);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;const{deleted:o,pos:r}=e.mapping.mapResult(t);return o?null:r}},props:{decorations:kk,handleDOMEvents:{mousedown:oC},createSelectionBetween:e=>null!=dk.getState(e.state)?e.state.selection:null,handleTripleClick:tC,handleKeyDown:Xk,handlePaste:nC},appendTransaction:(t,n,o)=>function(e,t,n){const o=(t||e).selection,r=(t||e).doc;let i,s;if(o instanceof qo&&(s=o.node.type.spec.tableRole)){if("cell"==s||"header_cell"==s)i=wk.create(r,o.from);else if("row"==s){const e=r.resolve(o.from+1);i=wk.rowSelection(e,e)}else if(!n){const e=rk.get(o.node),t=o.from+1,n=t+e.map[e.width*e.height-1];i=wk.create(r,t+1,n)}}else o instanceof Fo&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,o=t.pos,r=e.depth;for(;r>=0&&!(e.after(r+1)<e.end(r));r--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,o--);return n==o&&/row|table/.test(e.node(r).type.spec.tableRole)}(o)?i=Fo.create(r,o.from):o instanceof Fo&&function({$from:e,$to:t}){let n,o;for(let t=e.depth;t>0;t--){const o=e.node(t);if("cell"===o.type.spec.tableRole||"header_cell"===o.type.spec.tableRole){n=o;break}}for(let e=t.depth;e>0;e--){const n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){o=n;break}}return n!==o&&0===t.parentOffset}(o)&&(i=Fo.create(r,o.$from.start(),o.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}(o,Nk(o,n),e)})}var yC="undefined"!=typeof navigator?navigator:null,wC=yC&&yC.userAgent||"",bC=/Edge\/(\d+)/.exec(wC),kC=/MSIE \d/.exec(wC),CC=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wC),xC=!!!(kC||CC||bC)&&!!yC&&/Apple Computer/.test(yC.vendor),NC=new sr("safari-ime-span"),SC=!1;function OC(e){const t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var EC=new or(xC?{key:NC,props:{decorations:function(e){const{$from:t,$to:n,to:o}=e.selection;if(SC&&t.sameParent(n)){const t=gl.widget(o,OC,{ignoreSelection:!0,key:"safari-ime-span"});return wl.create(e.doc,[t])}},handleDOMEvents:{compositionstart:()=>{SC=!0},compositionend:()=>{SC=!1}}}}:{key:NC});function MC(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e}var _C=bd("strike_through");MC(_C,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var TC=vd("strike_through",e=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>"line-through"===e}],toDOM:t=>["del",e.get(_C.key)(t)],parseMarkdown:{match:e=>"delete"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strike_through"===e.type.name,runner:(e,t)=>{e.withMark(t,"delete")}}}));MC(TC.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"}),MC(TC.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var DC=ld("ToggleStrikeThrough",e=>()=>Nr(TC.type(e)));MC(DC,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var IC=cd(e=>ri(/(?<![\w:/])(~{1,2})(.+?)\1(?!\w|\/)/,TC.type(e)));MC(IC,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var AC=yd("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{const t=e.get(bc);return()=>t.call(DC.key)}}});MC(AC.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"}),MC(AC.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var RC=function(e){const t=e.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:lk}};for(const e in t)n[e]={default:t[e].default,validate:t[e].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:e=>sk(e,t)}],toDOM:e=>["td",ak(e,t),0]},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:e=>sk(e,t)}],toDOM:e=>["th",ak(e,t),0]}}}({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),PC=gd("table",()=>({...RC.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:e=>"table"===e.type,runner:(e,t,n)=>{const o=t.align,r=t.children.map((e,t)=>({...e,align:o,isHeader:0===t}));e.openNode(n),e.next(r),e.closeNode()}},toMarkdown:{match:e=>"table"===e.type.name,runner:(e,t)=>{const n=t.content.firstChild?.content;if(!n)return;const o=[];n.forEach(e=>{o.push(e.attrs.alignment)}),e.openNode("table",void 0,{align:o}),e.next(t.content),e.closeNode()}}}));MC(PC.node,{displayName:"NodeSchema<table>",group:"Table"}),MC(PC.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var LC=gd("table_header_row",()=>({...RC.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:e=>e instanceof HTMLElement&&(!!e.querySelector("th")&&{})}],toDOM:()=>["tr",{"data-is-header":!0},0],parseMarkdown:{match:e=>Boolean("tableRow"===e.type&&e.isHeader),runner:(e,t,n)=>{const o=t.align,r=t.children.map((e,n)=>({...e,align:o[n],isHeader:t.isHeader}));e.openNode(n),e.next(r),e.closeNode()}},toMarkdown:{match:e=>"table_header_row"===e.type.name,runner:(e,t)=>{0!==t.content.size&&(e.openNode("tableRow",void 0,{isHeader:!0}),e.next(t.content),e.closeNode())}}}));MC(LC.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"}),MC(LC.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var VC=gd("table_row",()=>({...RC.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:e=>"tableRow"===e.type,runner:(e,t,n)=>{const o=t.align,r=t.children.map((e,t)=>({...e,align:o[t]}));e.openNode(n),e.next(r),e.closeNode()}},toMarkdown:{match:e=>"table_row"===e.type.name,runner:(e,t)=>{0!==t.content.size&&(e.openNode("tableRow"),e.next(t.content),e.closeNode())}}}));MC(VC.node,{displayName:"NodeSchema<tableRow>",group:"Table"}),MC(VC.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var jC=gd("table_cell",()=>({...RC.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!e.isHeader,runner:(e,t,n)=>{const o=t.align;e.openNode(n,{alignment:o}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>"table_cell"===e.type.name,runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}}));MC(jC.node,{displayName:"NodeSchema<tableCell>",group:"Table"}),MC(jC.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var $C=gd("table_header",()=>({...RC.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!!e.isHeader,runner:(e,t,n)=>{const o=t.align;e.openNode(n,{alignment:o}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>"table_header"===e.type.name,runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}}));function BC(e,t=3,n=3){const o=Array(n).fill(0).map(()=>jC.type(e).createAndFill()),r=Array(n).fill(0).map(()=>$C.type(e).createAndFill()),i=Array(t).fill(0).map((t,n)=>0===n?LC.type(e).create(null,r):VC.type(e).create(null,o));return PC.type(e).create(null,i)}function HC(e){return(t,n)=>o=>{n=n??o.selection.from;const r=o.doc.resolve(n),i=yi(e=>"table"===e.type.name)(r),s=i?{node:i.node,from:i.start}:void 0,a="row"===e;if(s){const e=rk.get(s.node);if(t>=0&&t<(a?e.height:e.width)){const n=e.positionAt(a?t:e.height-1,a?e.width-1:t,s.node),r=o.doc.resolve(s.from+n),i=a?wk.rowSelection:wk.colSelection,l=e.positionAt(a?t:0,a?0:t,s.node),c=o.doc.resolve(s.from+l);return fi(o.setSelection(i(r,c)))}}return o}}MC($C.node,{displayName:"NodeSchema<tableHeader>",group:"Table"}),MC($C.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});var FC=HC("row"),zC=HC("col");function qC(e,t,{map:n,tableStart:o,table:r},i){const s=Array(i).fill(0).reduce((e,t,n)=>e+r.child(n).nodeSize,o),a=Array(n.width).fill(0).map((t,o)=>{const i=r.nodeAt(n.map[o]);return jC.type(e).createAndFill({alignment:i?.attrs.alignment})});return t.insert(s,VC.type(e).create(null,a)),t}function WC(e){const t=function(e){const t=Mk(e.$from);if(!t)return;const n=rk.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(e=>{const n=t.node.nodeAt(e),o=e+t.start;return{pos:o,start:o+1,node:n}})}(e.selection);if(t&&t[0]){const n=e.doc.resolve(t[0].pos),o=t[t.length-1];if(o){const t=e.doc.resolve(o.pos);return fi(e.setSelection(new wk(t,n)))}}return e}var UC=ld("GoToPrevTableCell",()=>()=>qk(-1));MC(UC,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var KC=ld("GoToNextTableCell",()=>()=>qk(1));MC(KC,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var GC=ld("ExitTable",e=>()=>(t,n)=>{if(!pk(t))return!1;const{$head:o}=t.selection,r=(i=o,s=PC.type(e),gi(e=>e.type===s)(i));var i,s;if(!r)return!1;const{to:a}=r,l=t.tr.replaceWith(a,a,lu.type(e).createAndFill());return l.setSelection(jo.near(l.doc.resolve(a),1)).scrollIntoView(),n?.(l),!0});MC(GC,{displayName:"Command<breakTableCommand>",group:"Table"});var JC=ld("InsertTable",e=>({row:t,col:n}={})=>(o,r)=>{const{selection:i,tr:s}=o,{from:a}=i,l=BC(e,t,n),c=s.replaceSelectionWith(l),d=jo.findFrom(c.doc.resolve(a),1,!0);return d&&c.setSelection(d),r?.(c),!0});MC(JC,{displayName:"Command<insertTableCommand>",group:"Table"});var ZC=ld("MoveRow",()=>({from:e,to:t,pos:n}={})=>{return o={from:e??0,to:t??0,pos:n},(e,t)=>{const{from:n,to:r,select:i=!0,pos:s=e.selection.from}=o,a=e.tr;return!!Pk({tr:a,originIndex:n,targetIndex:r,select:i,pos:s})&&(null==t||t(a),!0)};var o});MC(ZC,{displayName:"Command<moveRowCommand>",group:"Table"});var XC=ld("MoveCol",()=>({from:e,to:t,pos:n}={})=>{return o={from:e??0,to:t??0,pos:n},(e,t)=>{const{from:n,to:r,select:i=!0,pos:s=e.selection.from}=o,a=e.tr;return!!Rk({tr:a,originIndex:n,targetIndex:r,select:i,pos:s})&&(null==t||t(a),!0)};var o});MC(XC,{displayName:"Command<moveColCommand>",group:"Table"});var YC=ld("SelectRow",()=>(e={index:0})=>(t,n)=>{const{tr:o}=t,r=n?.(FC(e.index,e.pos)(o));return Boolean(r)});MC(YC,{displayName:"Command<selectRowCommand>",group:"Table"});var QC=ld("SelectCol",()=>(e={index:0})=>(t,n)=>{const{tr:o}=t,r=n?.(zC(e.index,e.pos)(o));return Boolean(r)});MC(QC,{displayName:"Command<selectColCommand>",group:"Table"});var ex=ld("SelectTable",()=>()=>(e,t)=>{const{tr:n}=e,o=t?.(WC(n));return Boolean(o)});MC(ex,{displayName:"Command<selectTableCommand>",group:"Table"});var tx=ld("DeleteSelectedCells",()=>()=>(e,t)=>{const{selection:n}=e;if(!(n instanceof wk))return!1;const o=n.isRowSelection(),r=n.isColSelection();return o&&r?function(e,t){const n=e.selection.$anchor;for(let o=n.depth;o>0;o--)if("table"==n.node(o).type.spec.tableRole)return t&&t(e.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}(e,t):r?function(e,t){if(!pk(e))return!1;if(t){const n=Lk(e),o=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;Bk(o,n,e),e!=n.left;e--){const e=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!e)throw new RangeError("No table found");n.table=e,n.map=rk.get(e)}t(o)}return!0}(e,t):function(e,t){if(!pk(e))return!1;if(t){const n=Lk(e),o=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;Hk(o,n,e),e!=n.top;e--){const e=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!e)throw new RangeError("No table found");n.table=e,n.map=rk.get(n.table)}t(o)}return!0}(e,t)});MC(tx,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var nx=ld("AddColBefore",()=>()=>jk);MC(nx,{displayName:"Command<addColBeforeCommand>",group:"Table"});var ox=ld("AddColAfter",()=>()=>$k);MC(ox,{displayName:"Command<addColAfterCommand>",group:"Table"});var rx=ld("AddRowBefore",e=>()=>(t,n)=>{if(!pk(t))return!1;if(n){const o=Lk(t);n(qC(e,t.tr,o,o.top))}return!0});MC(rx,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var ix=ld("AddRowAfter",e=>()=>(t,n)=>{if(!pk(t))return!1;if(n){const o=Lk(t);n(qC(e,t.tr,o,o.bottom))}return!0});MC(ix,{displayName:"Command<addRowAfterCommand>",group:"Table"});var sx=ld("SetAlign",()=>(e="left")=>{return t="alignment",n=e,function(e,o){if(!pk(e))return!1;const r=hk(e);if(r.nodeAfter.attrs[t]===n)return!1;if(o){const i=e.tr;e.selection instanceof wk?e.selection.forEachCell((e,o)=>{e.attrs[t]!==n&&i.setNodeMarkup(o,null,{...e.attrs,[t]:n})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[t]:n}),o(i)}return!0};var t,n});MC(sx,{displayName:"Command<setAlignCommand>",group:"Table"});var ax=cd(e=>new Dr(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(t,n,o,r)=>{const i=t.doc.resolve(o);if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),PC.type(e)))return null;const s=BC(e,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),a=t.tr.replaceRangeWith(o,r,s);return a.setSelection(Fo.create(a.doc,o+3)).scrollIntoView()}));MC(ax,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var lx=function(e){const t=n=>async()=>{await n.wait(pc);const o=e(n);return n.update(Uc,e=>[...e,o]),t.pasteRule=o,()=>{n.update(Uc,e=>e.filter(e=>e!==o))}};return t}(e=>({run:(t,n,o)=>{if(o)return t;function r(t){const n=t.childCount,o=t.lastChild?.childCount??0;if(0===n||0===o)return lu.type(e).create();const r=t.firstChild;if(!(o>0&&r&&0===r.childCount))return t;if(n>=3){const o=t.child(1),i=[];for(let t=0;t<o.childCount;t++){const n=o.child(t);i.push($C.type(e).create(n.attrs,n.content,n.marks))}const s=r.type.create(r.attrs,i),a=[];for(let e=2;e<n;e++)a.push(t.child(e));return t.type.create(t.attrs,[s,...a])}const i=Array(o).fill(0).map(()=>$C.type(e).createAndFill()),s=new Kt(Ht.from(i),0,0),a=r.replace(0,0,s);return t.replace(0,r.nodeSize,new Kt(Ht.from(a),0,0))}let i=function t(n){let o=function(t){const n=VC.type(e),o=[];let i=[],s=!1;function a(){if(0===i.length)return;const t=LC.type(e).createAndFill(),n=PC.type(e).create(null,[t,...i]);o.push(r(n)),i=[]}return t.forEach(e=>{e.type===n?(s=!0,i.push(e)):(a(),o.push(e))}),a(),s?Ht.from(o):t}(n),i=o!==n;const s=[];return o.forEach(n=>{if(n.type===PC.type(e)){const e=r(n);e!==n&&(i=!0),s.push(e)}else if(n.childCount>0){const e=t(n.content);e!==n.content?(i=!0,s.push(n.copy(e))):s.push(n)}else s.push(n)}),i?Ht.from(s):n}(t.content);return i=function(t){const n=[],o=[];t.forEach(e=>o.push(e));for(let t=0;t<o.length;t++){const r=o[t],i=o[t+1];r.type===lu.type(e)&&0===r.content.size&&i&&i.type===PC.type(e)||n.push(r)}return n.length<o.length?Ht.from(n):t}(i),new Kt(Ht.from(i),t.openStart,t.openEnd)}}));MC(lx,{displayName:"PasteRule<table>",group:"Table"});var cx=yd("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:e=>{const t=e.get(bc);return()=>t.call(KC.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{const t=e.get(bc);return()=>t.call(UC.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:e=>{const t=e.get(bc);return()=>t.call(GC.key)}}});MC(cx.ctx,{displayName:"KeymapCtx<table>",group:"Table"}),MC(cx.shortcuts,{displayName:"Keymap<table>",group:"Table"});var dx="footnote_definition",ux="footnoteDefinition",px=gd("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${dx}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw Nt(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{const t=e.attrs.label;return["dl",{"data-label":t,"data-type":dx},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===ux,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===dx,runner:(e,t)=>{e.openNode(ux,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));MC(px.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"}),MC(px.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var hx="footnote_reference",fx=gd("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${hx}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw Nt(e);return{label:e.dataset.label}}}],toDOM:e=>{const t=e.attrs.label;return["sup",{"data-label":t,"data-type":hx},t]},parseMarkdown:{match:({type:e})=>"footnoteReference"===e,runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===hx,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));MC(fx.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"}),MC(fx.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var mx=Yu.extendSchema(e=>t=>{const n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:e=>{if(!(e instanceof HTMLElement))throw Nt(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread,checked:e.dataset.checked?"true"===e.dataset.checked:null}}},...n?.parseDOM||[]],toDOM:e=>n.toDOM&&null==e.attrs.checked?n.toDOM(e):["li",{"data-item-type":"task","data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread,"data-checked":e.attrs.checked},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,o)=>{if(null==t.checked)return void n.parseMarkdown.runner(e,t,o);const r=null!=t.label?`${t.label}.`:"•",i=null!=t.checked?Boolean(t.checked):null,s=null!=t.label?"ordered":"bullet",a=null!=t.spread?`${t.spread}`:"true";e.openNode(o,{label:r,listType:s,spread:a,checked:i}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{if(null==t.attrs.checked)return void n.toMarkdown.runner(e,t);const o=t.attrs.label,r=t.attrs.listType,i="true"===t.attrs.spread,s=t.attrs.checked;e.openNode("listItem",void 0,{label:o,listType:r,spread:i,checked:s}),e.next(t.content),e.closeNode()}}}});MC(mx.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"}),MC(mx.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var gx=cd(()=>new Dr(/^\[(?<checked>\s|x)\]\s$/,(e,t,n,o)=>{const r=e.doc.resolve(n);let i=0,s=r.node(i);for(;s&&"list_item"!==s.type.name;)i--,s=r.node(i);if(!s||null!=s.attrs.checked)return null;const a=Boolean("x"===t.groups?.checked),l=r.before(i),c=e.tr;return c.deleteRange(n,o).setNodeMarkup(l,void 0,{...s.attrs,checked:a}),c}));MC(gx,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var vx=[AC,cx].flat(),yx=[ax,gx],wx=[IC],bx=[lx],kx=pd(()=>EC);MC(kx,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"}),MC(pd(()=>dC({})),{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var Cx=pd(()=>vC({allowTableNodeSelection:!0}));MC(Cx,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var xx=kd("remarkGFM",()=>oe);MC(xx.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"}),MC(xx.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var Nx=new sr("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");var Sx=pd(()=>new or({key:Nx,appendTransaction:(e,t,n)=>{let o;return t.doc!==n.doc&&n.doc.descendants((e,t)=>{if(o||(o=n.tr),"table_cell"!==e.type.name)return;const r=n.doc.resolve(t),i=r.node(r.depth),s=r.node(r.depth-1).firstChild;if(!s)return;const a=function(e,t){let n=0;return t.forEach((t,o,r)=>{t===e&&(n=r)}),n}(e,i),l=s.maybeChild(a);if(!l)return;const c=l.attrs.alignment;c!==e.attrs.alignment&&o.setNodeMarkup(t,void 0,{...e.attrs,alignment:c})}),o}}));MC(Sx,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var Ox=[Sx,kx,xx,Cx].flat(),Ex=[[mx,PC,LC,VC,$C,jC,px,fx,_C,TC].flat(),yx,bx,wx,vx,[KC,UC,GC,JC,ZC,XC,YC,QC,ex,tx,rx,ix,nx,ox,sx,DC],Ox].flat();const Mx=(()=>[w(),b(),k(),C(),x(),v(),N(),g.allowMultipleSelections.of(!0),S(),O(E,{fallback:!0}),M(),_(),T(),D(),I(),A(),R(),y.of([...P,...L,...V,...j,...$,...B,...H])])();function _x(e){return function(e){return 1===e.nodeType}(e)&&"http://www.w3.org/1999/xhtml"===e.namespaceURI}function Tx(e,t){let n,o,r=[];const i=()=>{const t=e.dom.getBoundingClientRect(),i=e.state.doc;return r&&n&&o&&t.width===o.width&&t.height===o.height&&t.x===o.x&&t.y===o.y&&n.eq(i)||(o=t,n=i,r=function(e){let t=[[-1,e.state.doc]],n=[];for(;t.length>0;){const[o,r]=t.pop();if(o>=0){let t=e.nodeDOM(o);if(t&&_x(t)){let{top:e,bottom:i,left:s,right:a}=t.getBoundingClientRect();n.push([o,[s,e,a,e]],[o+r.nodeSize,[s,i,a,i]])}}if(r.isBlock&&!r.isTextblock){let e=o+1;for(let n of r.children)t.push([e,n]),e+=n.nodeSize}}return n}(e)),r},s=(n,o)=>{if(!e.editable||e.isDestroyed)return;let r=i();r.sort((e,t)=>{const[o,r]=e,[i,s]=t;return Ix(n,r)-Ix(n,s)||o-i}),r=r.slice(0,8);const s=r.find(n=>!1!==t?.({view:e,pos:n[0],event:o}));return s&&function(e,t){const n=e.dragging;if(!n)return;const{move:o}=n;if(!o)return;const r=e.state.selection;if(!(r instanceof qo))return;const{from:i,to:s}=r;return i<=t&&t<=s}(e,s[0])?void 0:s};let a,l;return(e,t)=>{return a&&(o=e,(n=a)[0]===o[0]&&n[1]===o[1])||(a=e,l=s(e,t)),l;var n,o}}function Dx(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function Ix(e,t){return Math.min(Dx(e,[t[0],t[1]]),Dx(e,[t[2],t[3]]))}function Ax(e){let t;return new or({key:new sr("prosekit-drop-indicator"),view:n=>(t=Tx(n,e.onDrag),function(e,t,n){let o,r,i,s=e.dom,a=!1;const l=()=>{o&&clearTimeout(o),a=!1,o=setTimeout(()=>{a||n.onHide?.()},30)},c=o=>{a=!0;const{clientX:s,clientY:c}=o;if(r===s&&i===c)return;r=s,i=c;let d=t([s,c],o);if(d){const[t,[o,r,i,s]]=d,a={p1:{x:o,y:r},p2:{x:i,y:s}};n.onShow?.({view:e,pos:t,line:a})}else l()};s.addEventListener("dragover",c),s.addEventListener("dragend",l),s.addEventListener("drop",l),s.addEventListener("dragleave",l);return{destroy:()=>{s.removeEventListener("dragover",c),s.removeEventListener("dragend",l),s.removeEventListener("drop",l),s.removeEventListener("dragleave",l)}}}(n,t,e)),props:{handleDrop(e,n,o,r){if(!t)return!1;const i=t([n.clientX,n.clientY],n);if(!i)return!1;n.preventDefault();let s=i[0],a=e.state.tr;if(r){let{node:t}=e.dragging||{};t?t.replace(a):a.deleteSelection()}let l=a.mapping.map(s),c=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,d=a.doc;if(c?a.replaceRangeWith(l,l,o.content.firstChild):a.replaceRange(l,l,o),a.doc.eq(d))return!0;let u=a.doc.resolve(l);if(c&&qo.isSelectable(o.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(o.content.firstChild))a.setSelection(new qo(u));else{let t=a.mapping.map(s);a.mapping.maps[a.mapping.maps.length-1].forEach((e,n,o,r)=>t=r),a.setSelection(function(e,t,n,o){return e.someProp("createSelectionBetween",o=>o(e,t,n))||Fo.between(t,n,o)}(e,u,a.doc.resolve(t)))}return e.focus(),e.dispatch(a.setMeta("uiEvent","drop")),!0}}})}class Rx extends jo{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Rx.valid(n)?new Rx(n):jo.near(n)}content(){return Kt.empty}eq(e){return e instanceof Rx&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new Rx(e.resolve(t.pos))}getBookmark(){return new Px(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),o=e.node(t);if(0!=n)for(let e=o.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||Lx(e.type))return!0;if(e.inlineContent)return!1}else if(o.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),o=e.node(t);if(n!=o.childCount)for(let e=o.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||Lx(e.type))return!0;if(e.inlineContent)return!1}else if(o.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&Rx.valid(e))return e;let o=e.pos,r=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){r=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;o+=t;let s=e.doc.resolve(o);if(Rx.valid(s))return s}for(;;){let i=t>0?r.firstChild:r.lastChild;if(!i){if(r.isAtom&&!r.isText&&!qo.isSelectable(r)){e=e.doc.resolve(o+r.nodeSize*t),n=!1;continue e}break}r=i,o+=t;let s=e.doc.resolve(o);if(Rx.valid(s))return s}return null}}}Rx.prototype.visible=!1,Rx.findFrom=Rx.findGapCursorFrom,jo.jsonID("gapcursor",Rx);class Px{constructor(e){this.pos=e}map(e){return new Px(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Rx.valid(t)?new Rx(t):jo.near(t)}}function Lx(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const Vx=Oi({ArrowLeft:jx("horiz",-1),ArrowRight:jx("horiz",1),ArrowUp:jx("vert",-1),ArrowDown:jx("vert",1)});function jx(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,o,r){let i=e.selection,s=t>0?i.$to:i.$from,a=i.empty;if(i instanceof Fo){if(!r.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=Rx.findGapCursorFrom(s,t,a);return!!l&&(o&&o(e.tr.setSelection(new Rx(l))),!0)}}function $x(e,t,n){if(!e||!e.editable)return!1;let o=e.state.doc.resolve(t);if(!Rx.valid(o))return!1;let r=e.posAtCoords({left:n.clientX,top:n.clientY});return!(r&&r.inside>-1&&qo.isSelectable(e.state.doc.nodeAt(r.inside)))&&(e.dispatch(e.state.tr.setSelection(new Rx(o))),!0)}function Bx(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof Rx))return!1;let{$from:n}=e.state.selection,o=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!o)return!1;let r=Ht.empty;for(let e=o.length-1;e>=0;e--)r=Ht.from(o[e].createAndFill(null,r));let i=e.state.tr.replace(n.pos,n.pos,new Kt(r,0,0));return i.setSelection(Fo.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Hx(e){if(!(e.selection instanceof Rx))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",wl.create(e.doc,[gl.widget(e.selection.head,t,{key:"gapcursor"})])}function Fx(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-cursor",...t}}),e}var zx=md(null,"dropIndicatorState");Fx(zx,{displayName:"Ctx<dropIndicatorState>"});var qx=md({width:2,color:!1,class:"milkdown-drop-indicator"},"dropIndicatorConfig");Fx(qx,{displayName:"Ctx<dropIndicatorConfig>"});var Wx=new sr("MILKDOWN_DROP_INDICATOR_DOM"),Ux=pd(e=>new or({key:Wx,view:t=>{const n=e.get(qx.key),o=document.createElement("div");Object.assign(o.style,{position:"fixed",pointerEvents:"none",display:"none",backgroundColor:n.color,top:"0",left:"0"}),o.classList.add(n.class),o.classList.add("milkdown-drop-indicator"),t.dom.parentNode?.appendChild(o);const r=e.use(zx.key),i=e=>{!function(e,t,n){if(!t)return void Object.assign(e.style,{display:"none"});const{line:o}=t,{width:r}=n,{p1:{x:i,y:s},p2:{x:a,y:l}}=o;let c,d,u=s,p=i;s===l?(c=a-i,d=r,u-=r/2):(c=r,d=l-s,p-=r/2);u=Math.round(u),p=Math.round(p),Object.assign(e.style,{display:"block",width:`${c}px`,height:`${d}px`,transform:`translate(${p}px, ${u}px)`})}(o,e,n)};return r.on(i),{destroy:()=>{r.off(i),o.remove()}}}}));Fx(Ux,{displayName:"Prose<dropIndicatorDOM>"});var Kx=pd(e=>Ax({onShow:t=>{e.set(zx.key,t)},onHide:()=>{e.set(zx.key,null)},onDrag:()=>!0}));Fx(Kx,{displayName:"Prose<dropIndicator>"});var Gx=pd(()=>new or({props:{decorations:Hx,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&Rx.valid(n)?new Rx(n):null,handleClick:$x,handleKeyDown:Vx,handleDOMEvents:{beforeinput:Bx}}}));Fx(Gx,{displayName:"Prose<gapCursor>"});var Jx=[Gx,qx,zx,Ux,Kx].flat();function Zx(e){const t=null!=void 0&&void 0;let n="undefined"==typeof document?null:document.createElement("div");return new or({key:Xx,view:e=>{!0!==t&&function(e,t){for(const[n,o]of Object.entries(e.marks))!1!==o.spec.inclusive||t.includes(n)||console.warn(`[prosemirror-virtual-cursor] Virtual cursor does not work well with marks that have inclusive set to false. Please consider removing the inclusive option from the "${n}" mark or adding it to the "skipWarning" option.`)}(e.state.schema,t||[]);const o=e.dom.ownerDocument;n=n||document.createElement("div");const r=n,i=()=>{!function(e,t){if(!e||!e.dom||e.isDestroyed||!t)return;const{state:n,dom:o}=e,{selection:r}=n;if(!Qx(r))return;const i=function(e,t){var n;const o=window.getSelection();if(!o||!o.rangeCount)return null;const r=null==(n=null==o?void 0:o.getRangeAt(0))?void 0:n.cloneRange();if(!r)return null;r.collapse(t);const i=r.getClientRects(),s=(null==i?void 0:i.length)?i[i.length-1]:null;return(null==s?void 0:s.height)?s:e.coordsAtPos(e.state.selection.head)}(e,r.$head===r.$from);if(!i)return t;const s=o.getBoundingClientRect();let a="prosemirror-virtual-cursor";const l=n.selection.$head,[c,d]=Yx(l),u=n.storedMarks||l.marks();r.$cursor&&c&&d&&u&&!Wt.sameSet(c,d)&&(Wt.sameSet(c,u)?a+=" prosemirror-virtual-cursor-left":Wt.sameSet(d,u)&&(a+=" prosemirror-virtual-cursor-right"));t.className=a,function(e,t){e.classList.remove(t),e.offsetWidth,e.classList.add(t)}(t,"prosemirror-virtual-cursor-animation"),t.style.height=i.bottom-i.top+"px",t.style.left=i.left-s.left+"px",t.style.top=i.top-s.top+"px"}(e,r)};let s;return window.ResizeObserver&&(s=new window.ResizeObserver(()=>i()),s.observe(e.dom)),o.addEventListener("selectionchange",i),{update:()=>{i()},destroy:()=>{o.removeEventListener("selectionchange",i),s&&s.unobserve(e.dom)}}},props:{handleKeyDown:(e,t)=>{var n;const{selection:o}=e.state;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||t.isComposing||!["ArrowLeft","ArrowRight"].includes(t.key)||!Qx(o)||!o.empty)return!1;const r=o.$head,[i,s]=Yx(r),a=e.state.storedMarks||r.marks();if(i&&s&&!Wt.sameSet(i,s)){if("ArrowLeft"===t.key&&!Wt.sameSet(i,a))return e.dispatch(e.state.tr.setStoredMarks(i)),!0;if("ArrowRight"===t.key&&!Wt.sameSet(s,a))return e.dispatch(e.state.tr.setStoredMarks(s)),!0}return"ArrowLeft"===t.key&&1===r.textOffset?(e.dispatch(e.state.tr.setSelection(Fo.create(e.state.doc,r.pos-1)).setStoredMarks(r.marks())),!0):"ArrowRight"===t.key&&r.textOffset+1===(null==(n=r.parent.maybeChild(r.index()))?void 0:n.nodeSize)&&(e.dispatch(e.state.tr.setSelection(Fo.create(e.state.doc,r.pos+1)).setStoredMarks(r.marks())),!0)},decorations:e=>{if(n&&Qx(e.selection)&&e.selection.empty)return wl.create(e.doc,[gl.widget(0,n,{key:"prosemirror-virtual-cursor"})])},attributes:{class:"virtual-cursor-enabled"}}})}var Xx=new sr("prosemirror-virtual-cursor");function Yx(e){const t=e.index(),n=e.parent.maybeChild(t);let o=e.textOffset?n:null;return!o&&t>0&&(o=e.parent.maybeChild(t-1)),[null==o?void 0:o.marks,null==n?void 0:n.marks]}function Qx(e){return e&&"object"==typeof e&&"$cursor"in e}var eN=Object.defineProperty,tN=Object.getOwnPropertySymbols,nN=Object.prototype.hasOwnProperty,oN=Object.prototype.propertyIsEnumerable,rN=(e,t,n)=>t in e?eN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iN=(e,t)=>{for(var n in t||(t={}))nN.call(t,n)&&rN(e,n,t[n]);if(tN)for(var n of tN(t))oN.call(t,n)&&rN(e,n,t[n]);return e};function sN(e,t){return Object.assign(e,{meta:iN({package:"@milkdown/components"},t)}),e}const aN=md({imageIcon:"🌌",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"inlineImageConfigCtx");function lN({icon:e,class:t,onClick:n}){return fw("span",{class:Ae("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}sN(aN,{displayName:"Config<image-inline>",group:"ImageInline"}),lN.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const cN=ad("abcdefg",8),dN=$g({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:e,src:t,setLink:n,onUpload:o,imageIcon:r,uploadButton:i,confirmButton:s,uploadPlaceholderText:a,className:l,onImageLoadError:c}){var d,u;const p=wm(!1),h=wm(),f=wm(null!=(d=t.value)?d:""),m=wm(cN()),g=wm(0!==(null==(u=t.value)?void 0:u.length)),v=e=>{const t=e.target.value;g.value=0!==t.length,f.value=t},y=e=>{var t,o;"Enter"===e.key&&n(null!=(o=null==(t=h.value)?void 0:t.value)?o:"")},w=e=>{var t;const r=null==(t=e.target.files)?void 0:t[0];r&&o(r).then(e=>{e&&(n(e),g.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>fw("div",{class:Ae("image-edit",l)},fw(lN,{icon:r,class:"image-icon"}),fw("div",{class:Ae("link-importer",p.value&&"focus")},fw("input",{ref:h,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:f.value,onInput:v,onKeydown:y,onFocus:()=>p.value=!0,onBlur:()=>p.value=!1}),!g.value&&fw("div",{class:"placeholder"},fw("input",{disabled:e.value,class:"hidden",id:m.value,type:"file",accept:"image/*",onChange:w}),fw("label",{class:"uploader",for:m.value},fw(lN,{icon:i})),fw("span",{class:"text",onClick:()=>{var e;return null==(e=h.value)?void 0:e.focus()}},a))),f.value&&fw(Fragment,null,fw("div",{class:"image-preview"},fw("img",{src:f.value,alt:"",onError:e=>Promise.resolve(null==c?void 0:c(e)).catch(()=>{})})),fw("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=h.value)?void 0:e.value)?t:"")}},fw(lN,{icon:s}))))}}),uN=$g({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){const{src:t,alt:n,title:o}=e;return()=>{var r;return(null==(r=t.value)?void 0:r.length)?fw("img",{class:"image-inline",src:t.value,alt:n.value,title:o.value}):fw(dN,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,className:"empty-image-inline"})}}}),pN=fd(Tu.node,e=>(t,n,o)=>{const r=wm(t.attrs.src),i=wm(t.attrs.alt),s=wm(t.attrs.title),a=wm(!1),l=wm(!n.editable),c=e.get(aN.key),d=Uw(uN,{src:r,alt:i,title:s,selected:a,readonly:l,setAttr:(e,t)=>{if(!n.editable)return;const r=o();null!=r&&n.dispatch(n.state.tr.setNodeAttribute(r,e,"src"===e?Re.sanitize(t):t))},config:c}),u=document.createElement("span");u.className="milkdown-image-inline";const p=Dg(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),h=c.proxyDomURL,f=e=>{if(h){const t=h(e.attrs.src);"string"==typeof t?r.value=t:t.then(e=>{r.value=e}).catch(console.error)}else r.value=e.attrs.src;i.value=e.attrs.alt,s.value=e.attrs.title};return f(t),d.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{p(),d.unmount(),u.remove()}}});sN(pN,{displayName:"NodeView<image-inline>",group:"ImageInline"});const hN=[aN,pN];var fN=class{#be;#Ce;#fe;#me;#pe;#he=!1;#Ee;#Ne;#Me;#xe;constructor(e){this.onShow=()=>{},this.onHide=()=>{},this.update=(e,t)=>{this.#xe(e,t)},this.destroy=()=>{this.#Ee?.(),this.#xe.cancel()},this.show=(e,t)=>{if(this.element.dataset.show="true",e){this.#Ee?.(),this.#Ee=void 0;const n={...e,contextElement:t?.dom};t&&this.#_e(t)?this.#Ee=je(n,this.element,()=>this.#Te(n)):this.#Te(n)}this.onShow()},this.hide=()=>{"false"!==this.element.dataset.show&&(this.element.dataset.show="false",this.onHide())},this.element=e.content,this.#be=e.debounce??200,this.#Ce=e.shouldShow??this.#Se,this.#Ne=e.offset,this.#Me=e.shift,this.#fe=e.middleware??[],this.#me=e.floatingUIOptions??{},this.#pe=e.root,this.element.dataset.show="false",this.#xe=Be(this.#Oe,this.#be)}#Te=e=>{Pe(e,this.element,{placement:this.#me.placement??"top",middleware:[Le(),Ve(this.#Ne),$e(this.#Me),...this.#fe],...this.#me}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error)};#_e=e=>this.#pe!==e.dom.parentElement;#Oe=(e,t)=>{const{state:n,composing:o}=e,{selection:r,doc:i}=n,{ranges:s}=r,a=Math.min(...s.map(e=>e.$from.pos)),l=Math.max(...s.map(e=>e.$to.pos)),c=t&&t.doc.eq(i)&&t.selection.eq(r);if(this.#he||((this.#pe??e.dom.parentElement??document.body).appendChild(this.element),this.#he=!0),o||c)return;if(this.#Ee?.(),this.#Ee=void 0,!this.#Ce(e,t))return void this.hide();const d={getBoundingClientRect:()=>hi(e,a,l),contextElement:e.dom};this.#_e(e)?this.#Ee=je(d,this.element,()=>this.#Te(d)):this.#Te(d),this.show()};#Se=e=>{const{doc:t,selection:n}=e.state,{empty:o,from:r,to:i}=n,s=!t.textBetween(r,i).length&&e.state.selection instanceof Fo,a=this.element.contains(document.activeElement),l=!e.hasFocus()&&!a,c=!e.editable;return!(l||o||s||c)}};function mN(e){const t=md({},`${e}_TOOLTIP_SPEC`),n=pd(n=>{const o=n.get(t.key);return new or({key:new sr(`${e}_TOOLTIP`),...o})}),o=[t,n];return o.key=t.key,o.pluginKey=n.key,t.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${e}`},n.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${e}`},o}var gN=Object.defineProperty,vN=Object.getOwnPropertySymbols,yN=Object.prototype.hasOwnProperty,wN=Object.prototype.propertyIsEnumerable,bN=(e,t,n)=>t in e?gN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kN=(e,t)=>{for(var n in t||(t={}))yN.call(t,n)&&bN(e,n,t[n]);if(vN)for(var n of vN(t))wN.call(t,n)&&bN(e,n,t[n]);return e};function CN(e,t){return Object.assign(e,{meta:kN({package:"@milkdown/components"},t)}),e}var xN=Object.defineProperty,NN=Object.getOwnPropertySymbols,SN=Object.prototype.hasOwnProperty,ON=Object.prototype.propertyIsEnumerable,EN=(e,t,n)=>t in e?xN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,MN=(e,t)=>{for(var n in t||(t={}))SN.call(t,n)&&EN(e,n,t[n]);if(NN)for(var n of NN(t))ON.call(t,n)&&EN(e,n,t[n]);return e};const _N=md(MN({},{mode:"preview"}),"linkTooltipStateCtx");CN(_N,{displayName:"State<link-tooltip>",group:"LinkTooltip"});const TN=md(MN({},{addLink:()=>{},editLink:()=>{},removeLink:()=>{}}),"linkTooltipAPICtx");CN(_N,{displayName:"API<link-tooltip>",group:"LinkTooltip"});const DN=md(MN({},{linkIcon:"🔗",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."}),"linkTooltipConfigCtx");CN(_N,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});const IN=ld("ToggleLink",e=>()=>t=>{const{doc:n,selection:o}=t,r=tu.type(e);return n.rangeHasMark(o.from,o.to,r)?(e.get(TN.key).removeLink(o.from,o.to),!0):(e.get(TN.key).addLink(o.from,o.to),!0)}),AN=mN("LINK_PREVIEW");CN(AN[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"}),CN(AN[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});const RN=mN("LINK_EDIT");function PN({icon:e,class:t,onClick:n}){return fw("span",{class:Ae("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}CN(RN[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"}),CN(RN[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"}),PN.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const LN=$g({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:e,src:t,onConfirm:n,onCancel:o}){const r=wm(t);Ig(t,e=>{r.value=e});const i=()=>{n(r.value)},s=e=>{e.stopPropagation(),"Enter"===e.key&&(e.preventDefault(),i()),"Escape"===e.key&&(e.preventDefault(),o())};return()=>fw("div",{class:"link-edit"},fw("input",{class:"input-area",placeholder:e.value.inputPlaceholder,onKeydown:s,onInput:e=>{r.value=e.target.value},value:r.value}),r.value?fw(PN,{class:"button confirm",icon:e.value.confirmButton,onClick:i}):null)}});var VN,jN,$N,BN,HN,FN,zN,qN,WN,UN=Object.defineProperty,KN=Object.defineProperties,GN=Object.getOwnPropertyDescriptors,JN=Object.getOwnPropertySymbols,ZN=Object.prototype.hasOwnProperty,XN=Object.prototype.propertyIsEnumerable,YN=e=>{throw TypeError(e)},QN=(e,t,n)=>t in e?UN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eS=(e,t)=>{for(var n in t||(t={}))ZN.call(t,n)&&QN(e,n,t[n]);if(JN)for(var n of JN(t))XN.call(t,n)&&QN(e,n,t[n]);return e},tS=(e,t)=>KN(e,GN(t)),nS=(e,t,n)=>t.has(e)||YN("Cannot "+n),oS=(e,t,n)=>(nS(e,t,"read from private field"),n?n.call(e):t.get(e)),rS=(e,t,n)=>t.has(e)?YN("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),iS=(e,t,n,o)=>(nS(e,t,"write to private field"),t.set(e,n),n);const sS={from:-1,to:-1,mark:null};class aS{constructor(e,t){this.ctx=e,rS(this,VN),rS(this,jN),rS(this,$N,eS({},sS)),rS(this,BN),rS(this,HN),rS(this,FN,wm("")),rS(this,zN,()=>{oS(this,jN).hide(),this.ctx.update(_N.key,e=>tS(eS({},e),{mode:"preview"})),iS(this,$N,eS({},sS))}),rS(this,qN,e=>{const t=this.ctx.get(Yl),{from:n,to:o,mark:r}=oS(this,$N),i=tu.type(this.ctx),s=Re.sanitize(e);if(r&&r.attrs.href===s)return void oS(this,zN).call(this);const a=t.state.tr;r&&a.removeMark(n,o,r),a.addMark(n,o,i.create({href:s})),t.dispatch(a),oS(this,zN).call(this)}),rS(this,WN,(e,t,n)=>{const o=this.ctx.get(DN.key);oS(this,HN).value=o,oS(this,FN).value=e,this.ctx.update(_N.key,e=>tS(eS({},e),{mode:"edit"}));const r=this.ctx.get(Yl);r.dispatch(r.state.tr.setSelection(Fo.create(r.state.doc,t,n))),oS(this,jN).show({getBoundingClientRect:()=>hi(r,t,n)},r),requestAnimationFrame(()=>{var e;null==(e=oS(this,VN).querySelector("input"))||e.focus()})}),this.update=e=>{const{state:t}=e,{selection:n}=t;if(!(n instanceof Fo))return;const{from:o,to:r}=n;o===oS(this,$N).from&&r===oS(this,$N).to||oS(this,zN).call(this)},this.destroy=()=>{oS(this,BN).unmount(),oS(this,jN).destroy(),oS(this,VN).remove()},this.addLink=(e,t)=>{iS(this,$N,{from:e,to:t,mark:null}),oS(this,WN).call(this,"",e,t)},this.editLink=(e,t,n)=>{iS(this,$N,{from:t,to:n,mark:e}),oS(this,WN).call(this,e.attrs.href,t,n)},this.removeLink=(e,t)=>{const n=this.ctx.get(Yl),o=n.state.tr;o.removeMark(e,t,tu.type(this.ctx)),n.dispatch(o),oS(this,zN).call(this)},iS(this,HN,wm(this.ctx.get(DN.key)));const n=document.createElement("div");n.className="milkdown-link-edit";const o=Uw(LN,{config:oS(this,HN),src:oS(this,FN),onConfirm:oS(this,qN),onCancel:oS(this,zN)});o.mount(n),iS(this,BN,o),iS(this,VN,n),iS(this,jN,new fN({content:n,debounce:0,shouldShow:()=>!1})),oS(this,jN).onHide=()=>{requestAnimationFrame(()=>{t.dom.focus({preventScroll:!0})})},oS(this,jN).update(t)}}VN=new WeakMap,jN=new WeakMap,$N=new WeakMap,BN=new WeakMap,HN=new WeakMap,FN=new WeakMap,zN=new WeakMap,qN=new WeakMap,WN=new WeakMap;var lS=Object.defineProperty,cS=Object.defineProperties,dS=Object.getOwnPropertyDescriptors,uS=Object.getOwnPropertySymbols,pS=Object.prototype.hasOwnProperty,hS=Object.prototype.propertyIsEnumerable,fS=(e,t,n)=>t in e?lS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function mS(e){let t;e.update(TN.key,e=>{return n=((e,t)=>{for(var n in t||(t={}))pS.call(t,n)&&fS(e,n,t[n]);if(uS)for(var n of uS(t))hS.call(t,n)&&fS(e,n,t[n]);return e})({},e),cS(n,dS({addLink:(e,n)=>{null==t||t.addLink(e,n)},editLink:(e,n,o)=>{null==t||t.editLink(e,n,o)},removeLink:(e,n)=>{null==t||t.removeLink(e,n)}}));var n}),e.set(RN.key,{view:n=>(t=new aS(e,n),t)})}const gS=$g({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:e,src:t,onEdit:n,onRemove:o}){const r=e=>{e.preventDefault(),e.stopPropagation(),n.value()},i=e=>{e.preventDefault(),e.stopPropagation(),o.value()},s=n=>{n.preventDefault();const o=t.value;navigator.clipboard&&o&&navigator.clipboard.writeText(o).then(()=>{e.value.onCopyLink(o)}).catch(e=>console.error(e))};return()=>fw("div",{class:"link-preview"},fw(PN,{class:"button link-icon",icon:e.value.linkIcon,onClick:s}),fw("a",{href:t.value,target:"_blank",class:"link-display"},t.value),fw(PN,{class:"button link-edit-button",icon:e.value.editButton,onClick:r}),fw(PN,{class:"button link-remove-button",icon:e.value.removeButton,onClick:i}))}});var vS,yS,wS,bS,kS,CS,xS,NS,SS,OS,ES,MS,_S,TS,DS=e=>{throw TypeError(e)},IS=(e,t,n)=>t.has(e)||DS("Cannot "+n),AS=(e,t,n)=>(IS(e,t,"read from private field"),n?n.call(e):t.get(e)),RS=(e,t,n)=>t.has(e)?DS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),PS=(e,t,n,o)=>(IS(e,t,"write to private field"),t.set(e,n),n);class LS{constructor(e,t){this.ctx=e,RS(this,vS),RS(this,yS),RS(this,wS),RS(this,bS),RS(this,kS,wm("")),RS(this,CS,wm(()=>{})),RS(this,xS,wm(()=>{})),RS(this,NS),RS(this,SS),RS(this,OS,!1),RS(this,ES,({mode:e})=>{"edit"===e&&AS(this,TS).call(this)}),RS(this,MS,()=>{PS(this,OS,!0)}),RS(this,_S,()=>{PS(this,OS,!1)}),RS(this,TS,()=>{AS(this,yS).hide(),AS(this,yS).element.removeEventListener("mouseenter",AS(this,MS)),AS(this,yS).element.removeEventListener("mouseleave",AS(this,_S))}),this.show=(e,t,n,o)=>{AS(this,bS).value=this.ctx.get(DN.key),AS(this,kS).value=e.attrs.href,AS(this,CS).value=()=>{this.ctx.get(TN.key).editLink(e,t,n)},AS(this,xS).value=()=>{this.ctx.get(TN.key).removeLink(t,n),AS(this,TS).call(this)},AS(this,yS).show({getBoundingClientRect:()=>o},AS(this,SS)),AS(this,yS).element.addEventListener("mouseenter",AS(this,MS)),AS(this,yS).element.addEventListener("mouseleave",AS(this,_S))},this.hide=()=>{AS(this,OS)||AS(this,TS).call(this)},this.update=()=>{},this.destroy=()=>{AS(this,NS).unmount(),AS(this,wS).off(AS(this,ES)),AS(this,yS).destroy(),AS(this,vS).remove()},PS(this,SS,t),PS(this,bS,wm(this.ctx.get(DN.key))),PS(this,NS,Uw(gS,{config:AS(this,bS),src:AS(this,kS),onEdit:AS(this,CS),onRemove:AS(this,xS)})),PS(this,vS,document.createElement("div")),AS(this,vS).className="milkdown-link-preview",AS(this,NS).mount(AS(this,vS)),PS(this,yS,new fN({debounce:0,content:AS(this,vS),shouldShow:()=>!1})),AS(this,yS).update(t),PS(this,wS,e.use(_N.key)),AS(this,wS).on(AS(this,ES))}}function VS(e){let t;const n=He((n,o)=>{if(!t)return;if(!n.hasFocus())return;if("edit"===e.get(_N.key).mode)return;const r=function(e,t,n){const o=t.posAtCoords({left:n.clientX,top:n.clientY});if(!o)return;const{pos:r}=o,i=t.state.doc.nodeAt(r);if(!i)return;const s=i.marks.find(t=>t.type===tu.mark.type(e));if(!s)return;return AN.pluginKey()?{show:!0,pos:r,node:i,mark:s}:void 0}(e,n,o);if(r){const e=n.state.doc.resolve(r.pos),o=function(e,t,n,o,r){let i={start:-1,end:-1};return n.nodesBetween(o,r,(n,o)=>{if(i.start>-1)return!1;-1===i.start&&e.isInSet(n.marks)&&t===n&&(i={start:o,end:o+Math.max(n.textContent.length,1)})}),i}(r.mark,r.node,n.state.doc,e.before(),e.after()),i=o.start,s=o.end;return void t.show(r.mark,i,s,hi(n,i,s))}t.hide()},50);e.set(AN.key,{props:{handleDOMEvents:{mousemove:n,mouseleave:()=>{setTimeout(()=>{null==t||t.hide()},50)}}},view:n=>(t=new LS(e,n),t)})}function jS(e){VS(e),mS(e)}vS=new WeakMap,yS=new WeakMap,wS=new WeakMap,bS=new WeakMap,kS=new WeakMap,CS=new WeakMap,xS=new WeakMap,NS=new WeakMap,SS=new WeakMap,OS=new WeakMap,ES=new WeakMap,MS=new WeakMap,_S=new WeakMap,TS=new WeakMap;const $S=[_N,TN,DN,AN,RN,IN].flat();var BS=Object.defineProperty,HS=Object.getOwnPropertySymbols,FS=Object.prototype.hasOwnProperty,zS=Object.prototype.propertyIsEnumerable,qS=(e,t,n)=>t in e?BS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WS=(e,t)=>{for(var n in t||(t={}))FS.call(t,n)&&qS(e,n,t[n]);if(HS)for(var n of HS(t))zS.call(t,n)&&qS(e,n,t[n]);return e};function US(e,t){return Object.assign(e,{meta:WS({package:"@milkdown/components"},t)}),e}const KS=md({renderLabel:({label:e,listType:t,checked:n})=>null==n?"bullet"===t?"⦿":e:n?"☑":"□"},"listItemBlockConfigCtx");function GS({icon:e,class:t,onClick:n}){return fw("span",{class:Ae("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}US(KS,{displayName:"Config<list-item-block>",group:"ListItemBlock"}),GS.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const JS=$g({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:e,checked:t,listType:n,config:o,readonly:r,setAttr:i,onMount:s,selected:a}){const l=e=>{null!=e&&e instanceof Element&&s(e)},c=e=>{e.stopPropagation(),e.preventDefault(),null!=t.value&&i("checked",!t.value)},d=hw(()=>o.renderLabel({label:e.value,listType:n.value,checked:t.value,readonly:r.value})),u=hw(()=>null==t.value?"bullet"===n.value?"bullet":"ordered":t.value?"checked":"unchecked");return()=>fw("li",{class:Ae("list-item",a.value&&"ProseMirror-selectednode")},fw("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},fw(GS,{class:Ae("label",r.value&&"readonly",u.value),icon:d.value})),fw("div",{class:"children",ref:l}))}}),ZS=fd(Yu.node,e=>(t,n,o)=>{const r=document.createElement("div");r.className="milkdown-list-item-block";const i=document.createElement("div");i.setAttribute("data-content-dom","true"),i.classList.add("content-dom");const s=wm(t.attrs.label),a=wm(t.attrs.checked),l=wm(t.attrs.listType),c=wm(!n.editable),d=e.get(KS.key),u=wm(!1),p=Dg(()=>{u.value?r.classList.add("selected"):r.classList.remove("selected")});let h=0;const f=Uw(JS,{label:s,checked:a,listType:l,readonly:c,config:d,selected:u,setAttr:(e,t)=>{if(!n.editable)return;const r=o();null!=r&&(n.hasFocus()||n.focus(),n.dispatch(n.state.tr.setNodeAttribute(r,e,t)))},onMount:e=>{const{anchor:t,head:o}=n.state.selection;e.appendChild(i);const r=n.state.doc.resolve(t),s=n.state.doc.resolve(o);h=requestAnimationFrame(()=>{if(cancelAnimationFrame(h),!r.doc.eq(n.state.doc))return;const e=new Fo(r,s);n.dispatch(n.state.tr.setSelection(e))})}});f.mount(r);const m=e=>{l.value=e.attrs.listType,s.value=e.attrs.label,a.value=e.attrs.checked,c.value=!n.editable};m(t);let g=t;return{dom:r,contentDOM:i,update:e=>e.type===t.type&&(e.sameMarkup(g)&&e.content.eq(g.content)||(g=e,m(e)),!0),ignoreMutation:e=>!r||!i||"selection"!==e.type&&(i===e.target&&"attributes"===e.type||!i.contains(e.target)),selectNode:()=>{u.value=!0},deselectNode:()=>{u.value=!1},destroy:()=>{p(),f.unmount(),r.remove(),i.remove()}}});US(ZS,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});const XS=[KS,ZS];var YS=Object.defineProperty,QS=Object.getOwnPropertySymbols,eO=Object.prototype.hasOwnProperty,tO=Object.prototype.propertyIsEnumerable,nO=(e,t,n)=>t in e?YS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oO=(e,t)=>{for(var n in t||(t={}))eO.call(t,n)&&nO(e,n,t[n]);if(QS)for(var n of QS(t))tO.call(t,n)&&nO(e,n,t[n]);return e};function rO(e,t){return Object.assign(e,{meta:oO({package:"@milkdown/components"},t)}),e}var iO=Object.defineProperty,sO=Object.getOwnPropertySymbols,aO=Object.prototype.hasOwnProperty,lO=Object.prototype.propertyIsEnumerable,cO=(e,t,n)=>t in e?iO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const dO=md(((e,t)=>{for(var n in t||(t={}))aO.call(t,n)&&cO(e,n,t[n]);if(sO)for(var n of sO(t))lO.call(t,n)&&cO(e,n,t[n]);return e})({},{renderButton:e=>{switch(e){case"add_row":case"add_col":return"+";case"delete_row":case"delete_col":return"-";case"align_col_left":return"left";case"align_col_center":return"center";case"align_col_right":return"right";case"col_drag_handle":case"row_drag_handle":return"="}}}),"tableBlockConfigCtx");function uO({icon:e,class:t,onClick:n}){return fw("span",{class:Ae("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}function pO(e){const{dragPreviewRef:t,tableWrapperRef:n,contentWrapperRef:o,yLineHandleRef:r,xLineHandleRef:i,colHandleRef:s,rowHandleRef:a}=e,l=t.value;if(!l)return;const c=n.value;if(!c)return;const d=o.value;if(!d)return;const u=d.querySelector("tbody");if(!u)return;const p=l.querySelector("tbody");if(!p)return;const h=r.value;if(!h)return;const f=i.value;if(!f)return;const m=s.value;if(!m)return;const g=a.value;if(!g)return;return{preview:l,wrapper:c,content:d,contentRoot:u,previewRoot:p,yHandle:h,xHandle:f,colHandle:m,rowHandle:g}}function hO(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function fO(e,t,n,o,r){const{width:i,height:s}=o.querySelector("tbody").getBoundingClientRect();if("y"===e){const e=o.querySelectorAll("tr")[r];if(!e)return;n.appendChild(e.cloneNode(!0));const s=e.getBoundingClientRect().height;return Object.assign(t.style,{width:`${i}px`,height:`${s}px`}),void(t.dataset.show="true")}if("x"===e){const e=o.querySelectorAll("tr");let i;return Array.from(e).forEach(e=>{const t=e.children[r];if(!t)return;void 0===i&&(i=t.getBoundingClientRect().width);const o=t.parentElement.cloneNode(!1),s=t.cloneNode(!0);o.appendChild(s),n.appendChild(o)}),Object.assign(t.style,{width:`${i}px`,height:`${s}px`}),void(t.dataset.show="true")}}function mO(e,t,n,o){const{xHandle:r,yHandle:i,colHandle:s,rowHandle:a,preview:l}=n;r.dataset.displayType="y"===e?"indicator":"none",i.dataset.displayType="x"===e?"indicator":"none","y"===e?(s.dataset.show="false",vO(a)):(a.dataset.show="false",vO(s));const{hoverIndex:c,dragInfo:d}=o,[u,p]=c.value;d.value={startCoords:[t.clientX,t.clientY],startIndex:"y"===e?u:p,endIndex:"y"===e?u:p,type:"y"===e?"row":"col"},l.dataset.direction="y"===e?"vertical":"horizontal"}function gO(e,t,n,o){const r=null==n?void 0:n.get(Yl);if(!(null==r?void 0:r.editable))return;t.stopPropagation(),t.dataTransfer&&(t.dataTransfer.effectAllowed="move");const i=pO(e);i&&requestAnimationFrame(()=>{o(i)})}function vO(e){var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","false")}function yO(e,t){for(let n=0;n<e.childCount;n++)if(e.child(n)===t)return n;return-1}function wO(e,[t,n]){const o=e.value;if(!o)return;const r=o.querySelectorAll("tr"),i=r[t];if(!i)return;const s=r[0];if(!s)return;const a=s.children[n];if(!a)return;const l=i.children[n];return l?{row:i,col:l,headerCol:a}:void 0}function bO({refs:e,index:t,before:n,after:o}){const{contentWrapperRef:r,colHandleRef:i,hoverIndex:s}=e,a=i.value;if(!a)return;s.value=t;const l=wO(r,t);if(!l)return;const{headerCol:c}=l;a.dataset.show="true",n&&n(a),Pe(c,a,{placement:"top"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),o&&o(a)}).catch(console.error)}function kO({refs:e,index:t,before:n,after:o}){const{contentWrapperRef:r,rowHandleRef:i,hoverIndex:s}=e,a=i.value;if(!a)return;s.value=t;const l=wO(r,t);if(!l)return;const{row:c}=l;a.dataset.show="true",n&&n(a),Pe(c,a,{placement:"left"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),o&&o(a)}).catch(console.error)}function CO(e,t,n){const o="x"===n?"left":"top",r="x"===n?"right":"bottom",i=e.length-1,s=e.findIndex((e,n)=>{const s=e.getBoundingClientRect(),a=s[o],l=s[r];return a<=t&&t<=l||(n===i&&t>l||0===n&&t<a)}),a=e[s];return a?[a,s]:void 0}function xO(e){return Be(t=>{const n=pO(e);if(!n)return;const{preview:o,content:r,contentRoot:i,xHandle:s,yHandle:a}=n,{dragInfo:l,hoverIndex:c}=e;if("false"===o.dataset.show)return;const d=wO(e.contentWrapperRef,c.value);if(!d)return;if(!i.querySelector("tr"))return;const u=l.value;if(!u)return;if(!i.offsetParent)return;const p=i.offsetParent.offsetTop,h=i.offsetParent.offsetLeft;if("col"===u.type){const e=d.col.getBoundingClientRect().width,{left:n,width:s}=i.getBoundingClientRect(),l=h-n,c=t.clientX+l-e/2,[f]=u.startCoords,m=f<t.clientX?"right":"left";o.style.top=`${p}px`;const g=c<n+l-20?n+l-20:c>n+s+l-e+20?n+s+l-e+20:c;o.style.left=`${g}px`;const v=function(e,t){const n=e.querySelector("tr");if(!n)return;return CO(Array.from(n.children),t,"x")}(i,t.clientX);if(v){const[e,t]=v,n=a.getBoundingClientRect().width,o=r.getBoundingClientRect();u.endIndex=t,Pe(e,a,{placement:"left"===m?"left":"right",middleware:[Ve("left"===m?-1*n:0)]}).then(({x:e})=>{a.dataset.show="true",Object.assign(a.style,{height:`${o.height}px`,left:`${e}px`,top:`${p}px`})}).catch(console.error)}}else if("row"===u.type){const e=d.row.getBoundingClientRect().height,{top:n,height:a}=i.getBoundingClientRect(),l=p-n,c=t.clientY+l-e/2,[f,m]=u.startCoords,g=m<t.clientY?"down":"up",v=c<n+l-20?n+l-20:c>n+a+l-e+20?n+a+l-e+20:c;o.style.top=`${v}px`,o.style.left=`${h}px`;const y=function(e,t){return CO(Array.from(e.querySelectorAll("tr")),t,"y")}(i,t.clientY);if(y){const[e,t]=y,n=s.getBoundingClientRect().height,o=r.getBoundingClientRect();u.endIndex=t,Pe(e,s,{placement:"up"===g?"top":"bottom",middleware:[Ve("up"===g?-1*n:0)]}).then(({y:e})=>{s.dataset.show="true",Object.assign(s.style,{width:`${o.width}px`,top:`${e}px`})}).catch(console.error)}}},20)}function NO(e,t,n){const{dragPreviewRef:o,yLineHandleRef:r,xLineHandleRef:i,dragInfo:s}=e,a=function(e,t){return n=>{gO(e,n,t,t=>{mO("y",n,t,e);const{preview:o,content:r,previewRoot:i}=t;hO(i);const{hoverIndex:s}=e,[a]=s.value;fO("y",o,i,r,a)})}}(e,t),l=function(e,t){return n=>{gO(e,n,t,t=>{mO("x",n,t,e);const{preview:o,content:r,previewRoot:i}=t,{hoverIndex:s}=e,[a,l]=s.value;hO(i),fO("x",o,i,r,l)})}}(e,t),c=()=>{const e=o.value;if(!e)return;if("false"===e.dataset.show)return;const t=null==e?void 0:e.querySelector("tbody");for(;null==t?void 0:t.firstChild;)null==t||t.removeChild(t.firstChild);e&&(e.dataset.show="false")},d=()=>{var a;const l=o.value;if(!l)return;const c=r.value;if(!c)return;const d=i.value;if(!d)return;const u=s.value;if(!u)return;if(!t)return;if("false"===l.dataset.show)return;if(!e.colHandleRef.value)return;if(!e.rowHandleRef.value)return;if(c.dataset.show="false",d.dataset.show="false",u.startIndex===u.endIndex)return;const p=t.get(bc),h={from:u.startIndex,to:u.endIndex,pos:(null!=(a=null==n?void 0:n())?a:0)+1};if("col"===u.type){p.call(QC.key,{pos:h.pos,index:u.startIndex}),p.call(XC.key,h);const t=[0,u.endIndex];bO({refs:e,index:t})}else{p.call(YC.key,{pos:h.pos,index:u.startIndex}),p.call(ZC.key,h);const t=[u.endIndex,0];kO({refs:e,index:t})}requestAnimationFrame(()=>{t.get(Yl).focus()})},u=xO(e);return tv(()=>{window.addEventListener("dragover",u),window.addEventListener("dragend",c),window.addEventListener("drop",d)}),iv(()=>{window.removeEventListener("dragover",u),window.removeEventListener("dragend",c),window.removeEventListener("drop",d)}),{dragRow:a,dragCol:l}}function SO(e,t){return Be(n=>{if(!(null==t?void 0:t.editable))return;const{contentWrapperRef:o,yLineHandleRef:r,xLineHandleRef:i,colHandleRef:s,rowHandleRef:a,hoverIndex:l,lineHoverIndex:c}=e,d=r.value;if(!d)return;const u=i.value;if(!u)return;const p=o.value;if(!p)return;const h=a.value;if(!h)return;const f=s.value;if(!f)return;const m=function(e,t){var n,o,r;if(t)try{const i=t.posAtCoords({left:e.clientX,top:e.clientY});if(!i)return;const s=null==i?void 0:i.inside;if(null==s||s<0)return;const a=t.state.doc.resolve(s),l=t.state.doc.nodeAt(s);if(!l)return;const c=["table_cell","table_header"],d=["table_row","table_header_row"],u=c.includes(l.type.name)?l:null==(n=gi(e=>c.includes(e.type.name))(a))?void 0:n.node,p=null==(o=gi(e=>d.includes(e.type.name))(a))?void 0:o.node,h=null==(r=gi(e=>"table"===e.type.name)(a))?void 0:r.node;if(!u||!p||!h)return;const f=yO(p,u);return[yO(h,p),f]}catch(e){return}}(n,t);if(!m)return;const g=wO(o,m);if(!g)return;const[v,y]=m,w=g.col.getBoundingClientRect(),b=Math.abs(n.clientX-w.left)<8,k=Math.abs(w.right-n.clientX)<8,C=Math.abs(n.clientY-w.top)<8,x=Math.abs(w.bottom-n.clientY)<8,N=b||k||C||x,S=h.querySelector(".button-group"),O=f.querySelector(".button-group");if(S&&(S.dataset.show="false"),O&&(O.dataset.show="false"),N){const e=p.getBoundingClientRect();h.dataset.show="false",f.dataset.show="false",u.dataset.displayType="tool",d.dataset.displayType="tool";const t=d.getBoundingClientRect().width,n=u.getBoundingClientRect().height;return b||k?(c.value[1]=b?y:y+1,Pe(g.col,d,{placement:b?"left":"right",middleware:[Ve(b?-1*t:0)]}).then(({x:t})=>{d.dataset.show="true",Object.assign(d.style,{height:`${e.height}px`,left:`${t}px`})}).catch(console.error)):d.dataset.show="false",void(0!==m[0]&&(C||x)?(c.value[0]=C?v:v+1,Pe(g.row,u,{placement:C?"top":"bottom",middleware:[Ve(C?-1*n:0)]}).then(({y:t})=>{u.dataset.show="true",Object.assign(u.style,{width:`${e.width}px`,top:`${t}px`})}).catch(console.error)):u.dataset.show="false")}c.value=[-1,-1],d.dataset.show="false",u.dataset.show="false",h.dataset.show="true",f.dataset.show="true",kO({refs:e,index:m}),bO({refs:e,index:m}),l.value=m},20)}function OO(e,t){const n=SO(e,t),o=function(e){return()=>{const{rowHandleRef:t,colHandleRef:n,yLineHandleRef:o,xLineHandleRef:r}=e;setTimeout(()=>{const e=t.value;if(!e)return;const i=n.value;if(!i)return;const s=o.value;if(!s)return;const a=r.value;a&&(e.dataset.show="false",i.dataset.show="false",s.dataset.show="false",a.dataset.show="false")},200)}}(e);return{pointerMove:n,pointerLeave:o}}rO(dO,{displayName:"Config<table-block>",group:"TableBlock"}),uO.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const EO=$g({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:e,node:t,ctx:n,getPos:o,config:r,onMount:i}){const s=wm(),a=e=>{null!=e&&(e instanceof HTMLElement?(s.value=e,i(e)):s.value=void 0)},l=wm(),c=wm(),d=wm(),u=wm(),p=wm(),h=wm(),f=wm([0,0]),m=wm([-1,-1]),g=wm(),v={dragPreviewRef:h,tableWrapperRef:p,contentWrapperRef:s,yLineHandleRef:u,xLineHandleRef:d,colHandleRef:l,rowHandleRef:c,hoverIndex:f,lineHoverIndex:m,dragInfo:g},{pointerLeave:y,pointerMove:w}=OO(v,e),{dragRow:b,dragCol:k}=NO(v,n,o),{onAddRow:C,onAddCol:x,selectCol:N,selectRow:S,deleteSelected:O,onAlign:E}=function(e,t,n){const{xLineHandleRef:o,contentWrapperRef:r,colHandleRef:i,rowHandleRef:s,hoverIndex:a,lineHoverIndex:l}=e;return{onAddRow:()=>{var e,i,s;if(!t)return;const a=o.value;if(!a)return;const[c]=l.value;if(c<0)return;if(!t.get(Yl).editable)return;const d=Array.from(null!=(i=null==(e=r.value)?void 0:e.querySelectorAll("tr"))?i:[]),u=t.get(bc),p=(null!=(s=null==n?void 0:n())?s:0)+1;d.length===c?(u.call(YC.key,{pos:p,index:c-1}),u.call(ix.key)):(u.call(YC.key,{pos:p,index:c}),u.call(rx.key)),u.call(YC.key,{pos:p,index:c}),a.dataset.show="false"},onAddCol:()=>{var e,i,s,a;if(!t)return;if(!o.value)return;const[c,d]=l.value;if(d<0)return;if(!t.get(Yl).editable)return;const u=Array.from(null!=(s=null==(i=null==(e=r.value)?void 0:e.querySelector("tr"))?void 0:i.children)?s:[]),p=t.get(bc),h=(null!=(a=null==n?void 0:n())?a:0)+1;u.length===d?(p.call(QC.key,{pos:h,index:d-1}),p.call(ox.key)):(p.call(QC.key,{pos:h,index:d}),p.call(nx.key)),p.call(QC.key,{pos:h,index:d})},selectCol:()=>{var e,o;if(!t)return;const[r,s]=a.value,l=t.get(bc),c=(null!=(e=null==n?void 0:n())?e:0)+1;l.call(QC.key,{pos:c,index:s});const d=null==(o=i.value)?void 0:o.querySelector(".button-group");d&&(d.dataset.show="true"===d.dataset.show?"false":"true")},selectRow:()=>{var e,o;if(!t)return;const[r,i]=a.value,l=t.get(bc),c=(null!=(e=null==n?void 0:n())?e:0)+1;l.call(YC.key,{pos:c,index:r});const d=null==(o=s.value)?void 0:o.querySelector(".button-group");d&&r>0&&(d.dataset.show="true"===d.dataset.show?"false":"true")},deleteSelected:e=>{t&&t.get(Yl).editable&&(e.preventDefault(),e.stopPropagation(),t.get(bc).call(tx.key),requestAnimationFrame(()=>{t.get(Yl).focus()}))},onAlign:e=>n=>{t&&t.get(Yl).editable&&(n.preventDefault(),n.stopPropagation(),t.get(bc).call(sx.key,e),requestAnimationFrame(()=>{t.get(Yl).focus()}))}}}(v,n,o);return tv(()=>{requestAnimationFrame(()=>{e.editable&&function(e,t,n){if(!n)return;if(!t)return;const{selection:o}=t.state;if(!(o instanceof wk))return;const{$from:r}=o,i=Mk(r);if(i&&i.node===n){if(o.isColSelection()){const{$head:t}=o;return void bO({refs:e,index:[0,t.index(t.depth-1)],before:e=>{var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true")}})}if(o.isRowSelection()){const{$head:t}=o,n=gi(e=>"table_row"===e.type.name||"table_header_row"===e.type.name)(t);if(!n)return;const r=yO(i.node,n.node);kO({refs:e,index:[r,0],before:e=>{var t;r>0&&(null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true"))}})}}}(v,e,t.value)})}),()=>fw("div",{onDragstart:e=>e.preventDefault(),onDragover:e=>e.preventDefault(),onDragleave:e=>e.preventDefault(),onPointermove:w,onPointerleave:y},fw("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:k,onClick:N,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:l},fw(uO,{icon:r.renderButton("col_drag_handle")}),fw("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},fw("button",{type:"button",onPointerdown:E("left")},fw(uO,{icon:r.renderButton("align_col_left")})),fw("button",{type:"button",onPointerdown:E("center")},fw(uO,{icon:r.renderButton("align_col_center")})),fw("button",{type:"button",onPointerdown:E("right")},fw(uO,{icon:r.renderButton("align_col_right")})),fw("button",{type:"button",onPointerdown:O},fw(uO,{icon:r.renderButton("delete_col")})))),fw("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:b,onClick:S,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:c},fw(uO,{icon:r.renderButton("row_drag_handle")}),fw("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},fw("button",{type:"button",onPointerdown:O},fw(uO,{icon:r.renderButton("delete_row")})))),fw("div",{class:"table-wrapper",ref:p},fw("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:h},fw("table",null,fw("tbody",null))),fw("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:d},fw("button",{type:"button",onClick:C,class:"add-button"},fw(uO,{icon:r.renderButton("add_row")}))),fw("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:u},fw("button",{type:"button",onClick:x,class:"add-button"},fw(uO,{icon:r.renderButton("add_col")}))),fw("table",{ref:a,class:"children"})))}});var MO,_O,TO=e=>{throw TypeError(e)},DO=(e,t,n)=>(((e,t,n)=>{t.has(e)||TO("Cannot "+n)})(e,t,"access private method"),n);class IO{constructor(e,t,n,o){var r,i,s;this.ctx=e,this.node=t,this.view=n,this.getPos=o,r=this,(i=MO).has(r)?TO("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(r):i.set(r,s);const a=document.createElement("div");a.className="milkdown-table-block";const l=document.createElement("tbody");this.contentDOM=l,l.setAttribute("data-content-dom","true"),l.classList.add("content-dom"),this.nodeRef=bm(t);const c=Uw(EO,{view:n,ctx:e,getPos:o,config:e.get(dO.key),onMount:e=>{e.appendChild(l)},node:this.nodeRef});c.mount(a),this.app=c,this.dom=a}update(e){return e.type===this.node.type&&((!e.sameMarkup(this.node)||!e.content.eq(this.node.content))&&(this.node=e,this.nodeRef.value=e,!0))}stopEvent(e){if("drop"===e.type||e.type.startsWith("drag"))return!0;if("mousedown"===e.type||"pointerdown"===e.type){if(e.target instanceof Element&&e.target.closest("button"))return!0;const t=e.target;if(t instanceof HTMLElement&&(t.closest("th")||t.closest("td"))){const t=e;return DO(this,MO,_O).call(this,t)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM||"selection"!==e.type&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target))}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}MO=new WeakSet,_O=function(e){const t=this.view;if(!t.editable)return!1;const{state:n,dispatch:o}=t,r=t.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return!1;const i=n.doc.resolve(r.inside),s=gi(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(i);if(!s)return!1;if(n.selection instanceof Fo){const e=gi(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(n.selection.$from);if((null==e?void 0:e.node)===s.node)return!1}const{from:a}=s,l=qo.create(n.doc,a+1);return!n.selection.eq(l)&&(n.selection instanceof wk?setTimeout(()=>{o(n.tr.setSelection(l).scrollIntoView())},20):requestAnimationFrame(()=>{o(n.tr.setSelection(l).scrollIntoView())}),!0)};const AO=fd(PC.node,e=>(t,n,o)=>new IO(e,t,n,o));rO(AO,{displayName:"NodeView<table-block>",group:"TableBlock"});const RO=[dO,AO];function PO(e){if(!e)return!1;if(Array.isArray(e))return!(e.length>1)&&PO(e[0]);const t=e.content;return t?PO(t):"text"===e.type}function LO(e,t){const n=mi(t);if(n)return e.dispatch(e.state.tr.replaceSelectionWith(n,!0)),!0;try{return e.dispatch(e.state.tr.replaceSelection(t)),!0}catch{return!1}}var VO,jO,$O=pd(e=>{const t=e.get(fc);return e.update(Yc,e=>({...e,editable:e.editable??(()=>!0),transformPastedHTML:(t,n)=>{const o=e.transformPastedHTML;return o&&(t=o(t,n)),t.includes("docs-internal-guid")&&(t=(t=t.replace(/<b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/,"$1")).replace(/<div[^>]*>(<table[\s\S]*?<\/table>)<\/div>/g,"$1")),t}})),new or({key:new sr("MILKDOWN_CLIPBOARD"),props:{handlePaste:(n,o,r)=>{const i=e.get(Dc),s=n.props.editable?.(n.state),{clipboardData:a}=o;if(!s||!a)return!1;if(n.state.selection.$from.node().type.spec.code)return!1;const l=a.getData("text/plain"),c=a.getData("vscode-editor-data");if(c){const e=JSON.parse(c)?.mode;if(l&&e){const{tr:o}=n.state,r=vi("code_block",t);return o.replaceSelectionWith(r.create({language:e})).setSelection(Fo.near(o.doc.resolve(Math.max(0,o.selection.from-2)))).insertText(l.replace(/\r\n?/g,"\n")),n.dispatch(o),!0}}const d=a.getData("text/html");if(0===d.length&&0===l.length)return!1;if(d.length>0&&r)return LO(n,r);const u=An.fromSchema(t);let p;if(0===d.length){const e=i(l);if(!e||"string"==typeof e)return!1;p=zn.fromSchema(t).serializeFragment(e.content)}else{const e=document.createElement("template");e.innerHTML=d,p=e.content.cloneNode(!0),e.remove()}return LO(n,u.parseSlice(p))},clipboardTextSerializer:n=>{const o=e.get(Vc);if(PO(n.content.toJSON()))return n.content.textBetween(0,n.content.size,"\n\n");const r=t.topNodeType.createAndFill(void 0,n.content);return r?o(r):""}}})});function BO(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-history",...t}}),e}VO=$O,jO={displayName:"Prose<clipboard>"},Object.assign(VO,{meta:{package:"@milkdown/plugin-clipboard",...jO}});var HO=ld("Undo",()=>()=>Jp);BO(HO,{displayName:"Command<undo>"});var FO=ld("Redo",()=>()=>Zp);BO(FO,{displayName:"Command<redo>"});var zO=md({},"historyProviderConfig");BO(zO,{displayName:"Ctx<historyProviderConfig>"});var qO=pd(e=>Kp(e.get(zO.key)));BO(qO,{displayName:"Ctx<historyProviderPlugin>"});var WO=yd("historyKeymap",{Undo:{shortcuts:"Mod-z",command:e=>{const t=e.get(bc);return()=>t.call(HO.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:e=>{const t=e.get(bc);return()=>t.call(FO.key)}}});BO(WO.ctx,{displayName:"KeymapCtx<history>"}),BO(WO.shortcuts,{displayName:"Keymap<history>"});var UO=[zO,qO,WO,HO,FO].flat();var KO=md({type:"space",size:2},"indentConfig");KO.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};var GO=hd(e=>({Tab:(t,n)=>{const o=e.get(KO.key),{tr:r}=t,i=function(e,t){const{doc:n,selection:o}=e;if(!n||!o)return e;if(!(o instanceof Fo||o instanceof Uo))return e;const{to:r}=o,i="space"===t.type?Array(t.size).fill(" ").join(""):"\t";return e.insertText(i,r)}(r,o);return!!i.docChanged&&(n?.(i),!0)}}));GO.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};var JO=[KO,GO],ZO=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),this.updated=e=>(this.updatedListeners.push(e),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}},XO=Tt(new ZO,"listener"),YO=new sr("MILKDOWN_LISTENER"),QO=e=>(e.inject(XO,new ZO),async()=>{await e.wait(dc);const{listeners:t}=e.get(XO);t.beforeMount.forEach(t=>t(e)),await e.wait(Rc);const n=e.get(Vc);let o=null,r=null,i=null,s=null;const a=He(()=>{if(!s)return;const{doc:i}=s;if(t.updated.length>0&&o&&!o.eq(i)&&t.updated.forEach(t=>{t(e,i,o)}),t.markdownUpdated.length>0&&o&&!o.eq(i)){const o=n(i);t.markdownUpdated.forEach(t=>{t(e,o,r)}),r=o}o=i,s=null},200),l=new or({key:YO,view:()=>({destroy:()=>{t.destroy.forEach(t=>t(e))}}),props:{handleDOMEvents:{focus:()=>(t.focus.forEach(t=>t(e)),!1),blur:()=>(t.blur.forEach(t=>t(e)),!1)}},state:{init:(e,t)=>{o=t.doc,r=n(t.doc)},apply:n=>{const o=n.selection;(!i&&o||i&&!o.eq(i))&&(t.selectionUpdated.forEach(t=>{t(e,o,i)}),i=o),(n.docChanged||n.storedMarksSet)&&!1!==n.getMeta("addToHistory")&&(s=n,a())}}});e.update(oc,e=>e.concat(l)),await e.wait(Zc),t.mounted.forEach(t=>t(e))});QO.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};var eE=md({shouldAppend:e=>!!e&&!["heading","paragraph"].includes(e.type.name),getNode:e=>e.schema.nodes.paragraph.create()},"trailingConfig");eE.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};var tE=pd(e=>{const t=new sr("MILKDOWN_TRAILING"),{shouldAppend:n,getNode:o}=e.get(eE.key),r=new or({key:t,state:{init:(e,t)=>{const o=t.tr.doc.lastChild;return n(o,t)},apply:(e,t,o,r)=>{if(!e.docChanged)return t;const i=e.doc.lastChild;return n(i,r)}},appendTransaction:(e,t,n)=>{const{doc:i,tr:s}=n,a=o?.(n),l=r.getState(n),c=i.content.size;if(l&&a)return s.insert(c,a)}});return r});tE.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};var nE=[eE,tE];var oE=md({uploader:async(e,t)=>{const n=[];for(let t=0;t<e.length;t++){const o=e.item(t);o&&(o.type.includes("image")&&n.push(o))}const{image:o}=t.nodes;if(!o)throw Ot("image");return(await Promise.all(n.map(e=>{return t=e,new Promise(e=>{const n=new FileReader;n.addEventListener("load",()=>{e({alt:t.name,src:n.result})},!1),n.readAsDataURL(t)});var t}))).map(({alt:e,src:t})=>o.createAndFill({src:t,alt:e}))},enableHtmlFileUploader:!1,uploadWidgetFactory:(e,t)=>{const n=document.createElement("span");return n.textContent="Upload in progress...",gl.widget(e,n,t)}},"uploadConfig");oE.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};var rE=pd(e=>{const t=new sr("MILKDOWN_UPLOAD"),n=(n,o,r)=>{if(!r||r.length<=0)return!1;const i=Symbol("upload symbol"),s=e.get(fc),{uploader:a,getInsertPos:l}=e.get(oE.key),{tr:c}=n.state,d=o instanceof DragEvent?n.posAtCoords({left:o.clientX,top:o.clientY})?.pos??c.selection.from:c.selection.from,u="function"==typeof l?l(o,e,d):d;return n.dispatch(c.setMeta(t,{add:{id:i,pos:u}})),a(r,s,e,u).then(e=>{const o=((e,n)=>{const o=t.getState(e);if(!o)return-1;const r=o.find(void 0,void 0,e=>e.id===n);return r.length?r[0]?.from??-1:-1})(n.state,i);o<0||n.dispatch(n.state.tr.replaceWith(o,o,e).setMeta(t,{remove:{id:i}}))}).catch(e=>{console.error(e)}),!0};return new or({key:t,state:{init:()=>wl.empty,apply(t,n){const o=n.map(t.mapping,t.doc),r=t.getMeta(this);if(!r)return o;if(r.add){const{uploadWidgetFactory:n}=e.get(oE.key),i=n(r.add.pos,{id:r.add.id});return o.add(t.doc,[i])}if(r.remove){const e=o.find(void 0,void 0,e=>e.id===r.remove.id);return o.remove(e)}return o}},props:{decorations(e){return this.getState(e)},handlePaste:(t,o)=>{const{enableHtmlFileUploader:r}=e.get(oE.key);return o instanceof ClipboardEvent&&(!(!r&&o.clipboardData?.getData("text/html"))&&n(t,o,o.clipboardData?.files))},handleDrop:(e,t)=>t instanceof DragEvent&&n(e,t,t.dataTransfer?.files)}})});rE.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};var iE=[oE,rE],sE=(e=>(e.CodeMirror="code-mirror",e.ListItem="list-item",e.LinkTooltip="link-tooltip",e.Cursor="cursor",e.ImageBlock="image-block",e.BlockEdit="block-edit",e.Toolbar="toolbar",e.Placeholder="placeholder",e.Table="table",e.Latex="latex",e.TopBar="top-bar",e))(sE||{});const aE={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0,"top-bar":!1},lE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M8.85758 18.625C8.4358 18.625 8.07715 18.4772 7.78163 18.1817C7.48613 17.8862 7.33838 17.5275 7.33838 17.1058V6.8942C7.33838 6.47242 7.48613 6.11377 7.78163 5.81825C8.07715 5.52275 8.4358 5.375 8.85758 5.375H12.1999C13.2191 5.375 14.1406 5.69231 14.9643 6.32693C15.788 6.96154 16.1999 7.81603 16.1999 8.89038C16.1999 9.63779 16.0194 10.2471 15.6585 10.7183C15.2976 11.1894 14.9088 11.5314 14.4922 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3157 16.6614 14.0192 16.6614 14.9038C16.6614 16.182 16.1902 17.1217 15.2479 17.723C14.3056 18.3243 13.3563 18.625 12.3999 18.625H8.85758ZM9.4883 16.6327H12.3191C13.1063 16.6327 13.6627 16.4141 13.9884 15.9769C14.314 15.5397 14.4768 15.1205 14.4768 14.7192C14.4768 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8057 12.273 12.8057H9.4883V16.6327ZM9.4883 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5278 10.3539C13.8836 10.0064 14.0615 9.59037 14.0615 9.10575C14.0615 8.59035 13.8733 8.16918 13.497 7.84225C13.1207 7.51533 12.6595 7.35188 12.1133 7.35188H9.4883V10.875Z"\n />\n </svg>\n',cE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8070)">\n <path\n d="M4 10.5C3.17 10.5 2.5 11.17 2.5 12C2.5 12.83 3.17 13.5 4 13.5C4.83 13.5 5.5 12.83 5.5 12C5.5 11.17 4.83 10.5 4 10.5ZM4 4.5C3.17 4.5 2.5 5.17 2.5 6C2.5 6.83 3.17 7.5 4 7.5C4.83 7.5 5.5 6.83 5.5 6C5.5 5.17 4.83 4.5 4 4.5ZM4 16.5C3.17 16.5 2.5 17.18 2.5 18C2.5 18.82 3.18 19.5 4 19.5C4.82 19.5 5.5 18.82 5.5 18C5.5 17.18 4.83 16.5 4 16.5ZM8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19ZM8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13ZM7 6C7 6.55 7.45 7 8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8070">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',dE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n fill="none"\n viewBox="0 0 24 24"\n stroke-width="1.5"\n stroke="currentColor"\n class="w-6 h-6"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n d="M19.5 8.25l-7.5 7.5-7.5-7.5"\n />\n </svg>\n',uE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1098_15553)">\n <path\n d="M18.3007 5.70973C17.9107 5.31973 17.2807 5.31973 16.8907 5.70973L12.0007 10.5897L7.1107 5.69973C6.7207 5.30973 6.0907 5.30973 5.7007 5.69973C5.3107 6.08973 5.3107 6.71973 5.7007 7.10973L10.5907 11.9997L5.7007 16.8897C5.3107 17.2797 5.3107 17.9097 5.7007 18.2997C6.0907 18.6897 6.7207 18.6897 7.1107 18.2997L12.0007 13.4097L16.8907 18.2997C17.2807 18.6897 17.9107 18.6897 18.3007 18.2997C18.6907 17.9097 18.6907 17.2797 18.3007 16.8897L13.4107 11.9997L18.3007 7.10973C18.6807 6.72973 18.6807 6.08973 18.3007 5.70973Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1098_15553">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',pE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8081)">\n <path\n d="M9.4 16.6L4.8 12L9.4 7.4L8 6L2 12L8 18L9.4 16.6ZM14.6 16.6L19.2 12L14.6 7.4L16 6L22 12L16 18L14.6 16.6Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8081">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',hE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n fill="none"\n >\n <g clip-path="url(#clip0_1013_1606)">\n <path\n d="M9.00012 16.1998L5.50012 12.6998C5.11012 12.3098 4.49012 12.3098 4.10012 12.6998C3.71012 13.0898 3.71012 13.7098 4.10012 14.0998L8.29012 18.2898C8.68012 18.6798 9.31012 18.6798 9.70012 18.2898L20.3001 7.69982C20.6901 7.30982 20.6901 6.68982 20.3001 6.29982C19.9101 5.90982 19.2901 5.90982 18.9001 6.29982L9.00012 16.1998Z"\n fill="#817567"\n />\n </g>\n <defs>\n <clipPath id="clip0_1013_1606">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',fE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n fill="none"\n >\n <path\n d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"\n />\n </svg>\n',mE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7900)">\n <path\n fill-rule="evenodd"\n clip-rule="evenodd"\n d="M19 13H5C4.45 13 4 12.55 4 12C4 11.45 4.45 11 5 11H19C19.55 11 20 11.45 20 12C20 12.55 19.55 13 19 13Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7900">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',gE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="16"\n height="16"\n viewBox="0 0 16 16"\n >\n <path\n d="M3.5 9.83366C3.35833 9.83366 3.23961 9.78571 3.14383 9.68983C3.04794 9.59394 3 9.47516 3 9.33349C3 9.19171 3.04794 9.07299 3.14383 8.97733C3.23961 8.88155 3.35833 8.83366 3.5 8.83366H12.5C12.6417 8.83366 12.7604 8.8816 12.8562 8.97749C12.9521 9.07338 13 9.19216 13 9.33383C13 9.4756 12.9521 9.59433 12.8562 9.68999C12.7604 9.78577 12.6417 9.83366 12.5 9.83366H3.5ZM3.5 7.16699C3.35833 7.16699 3.23961 7.11905 3.14383 7.02316C3.04794 6.92727 3 6.80849 3 6.66683C3 6.52505 3.04794 6.40633 3.14383 6.31066C3.23961 6.21488 3.35833 6.16699 3.5 6.16699H12.5C12.6417 6.16699 12.7604 6.21494 12.8562 6.31083C12.9521 6.40671 13 6.52549 13 6.66716C13 6.80894 12.9521 6.92766 12.8562 7.02333C12.7604 7.1191 12.6417 7.16699 12.5 7.16699H3.5Z"\n />\n </svg>\n',vE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1013_1585)">\n <path\n d="M14.06 9.02L14.98 9.94L5.92 19H5V18.08L14.06 9.02ZM17.66 3C17.41 3 17.15 3.1 16.96 3.29L15.13 5.12L18.88 8.87L20.71 7.04C21.1 6.65 21.1 6.02 20.71 5.63L18.37 3.29C18.17 3.09 17.92 3 17.66 3ZM14.06 6.19L3 17.25V21H6.75L17.81 9.94L14.06 6.19Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1013_1585">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',yE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8075)">\n <path\n d="M19 5V19H5V5H19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM14.14 11.86L11.14 15.73L9 13.14L6 17H18L14.14 11.86Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8075">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',wE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M6.29811 18.625C6.04505 18.625 5.83115 18.5375 5.65641 18.3626C5.48166 18.1877 5.39429 17.9736 5.39429 17.7203C5.39429 17.467 5.48166 17.2532 5.65641 17.0788C5.83115 16.9045 6.04505 16.8173 6.29811 16.8173H9.21159L12.452 7.18265H9.53851C9.28545 7.18265 9.07155 7.0952 8.89681 6.9203C8.72206 6.7454 8.63469 6.5313 8.63469 6.278C8.63469 6.02472 8.72206 5.81089 8.89681 5.63652C9.07155 5.46217 9.28545 5.375 9.53851 5.375H16.8847C17.1377 5.375 17.3516 5.46245 17.5264 5.63735C17.7011 5.81225 17.7885 6.02634 17.7885 6.27962C17.7885 6.53293 17.7011 6.74676 17.5264 6.92113C17.3516 7.09548 17.1377 7.18265 16.8847 7.18265H14.2789L11.0385 16.8173H13.6443C13.8973 16.8173 14.1112 16.9048 14.286 17.0797C14.4607 17.2546 14.5481 17.4687 14.5481 17.722C14.5481 17.9752 14.4607 18.1891 14.286 18.3634C14.1112 18.5378 13.8973 18.625 13.6443 18.625H6.29811Z"\n />\n </svg>\n',bE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z"\n />\n </svg>\n',kE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8067)">\n <path\n d="M8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6C7 6.55 7.45 7 8 7ZM20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17ZM20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11ZM4.5 16H2.5C2.22 16 2 16.22 2 16.5C2 16.78 2.22 17 2.5 17H4V17.5H3.5C3.22 17.5 3 17.72 3 18C3 18.28 3.22 18.5 3.5 18.5H4V19H2.5C2.22 19 2 19.22 2 19.5C2 19.78 2.22 20 2.5 20H4.5C4.78 20 5 19.78 5 19.5V16.5C5 16.22 4.78 16 4.5 16ZM2.5 5H3V7.5C3 7.78 3.22 8 3.5 8C3.78 8 4 7.78 4 7.5V4.5C4 4.22 3.78 4 3.5 4H2.5C2.22 4 2 4.22 2 4.5C2 4.78 2.22 5 2.5 5ZM4.5 10H2.5C2.22 10 2 10.22 2 10.5C2 10.78 2.22 11 2.5 11H3.8L2.12 12.96C2.04 13.05 2 13.17 2 13.28V13.5C2 13.78 2.22 14 2.5 14H4.5C4.78 14 5 13.78 5 13.5C5 13.22 4.78 13 4.5 13H3.2L4.88 11.04C4.96 10.95 5 10.83 5 10.72V10.5C5 10.22 4.78 10 4.5 10Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8067">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',CE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_971_7676)">\n <path\n d="M18 13H13V18C13 18.55 12.55 19 12 19C11.45 19 11 18.55 11 18V13H6C5.45 13 5 12.55 5 12C5 11.45 5.45 11 6 11H11V6C11 5.45 11.45 5 12 5C12.55 5 13 5.45 13 6V11H18C18.55 11 19 11.45 19 12C19 12.55 18.55 13 18 13Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_971_7676">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',xE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7897)">\n <path\n d="M7.17 17C7.68 17 8.15 16.71 8.37 16.26L9.79 13.42C9.93 13.14 10 12.84 10 12.53V8C10 7.45 9.55 7 9 7H5C4.45 7 4 7.45 4 8V12C4 12.55 4.45 13 5 13H7L5.97 15.06C5.52 15.95 6.17 17 7.17 17ZM17.17 17C17.68 17 18.15 16.71 18.37 16.26L19.79 13.42C19.93 13.14 20 12.84 20 12.53V8C20 7.45 19.55 7 19 7H15C14.45 7 14 7.45 14 8V12C14 12.55 14.45 13 15 13H17L15.97 15.06C15.52 15.95 16.17 17 17.17 17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7897">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',NE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z"\n />\n </svg>\n',SE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n fill="none"\n viewBox="0 0 24 24"\n stroke-width="1.5"\n stroke="currentColor"\n class="w-6 h-6"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"\n />\n </svg>\n',OE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M3.25 13.7404C3.0375 13.7404 2.85938 13.6684 2.71563 13.5246C2.57188 13.3808 2.5 13.2026 2.5 12.99C2.5 12.7774 2.57188 12.5993 2.71563 12.4558C2.85938 12.3122 3.0375 12.2404 3.25 12.2404H20.75C20.9625 12.2404 21.1406 12.3123 21.2843 12.4561C21.4281 12.5999 21.5 12.7781 21.5 12.9907C21.5 13.2033 21.4281 13.3814 21.2843 13.525C21.1406 13.6686 20.9625 13.7404 20.75 13.7404H3.25ZM10.9423 10.2596V6.62495H6.5673C6.2735 6.62495 6.02377 6.52201 5.8181 6.31613C5.61245 6.11026 5.50963 5.86027 5.50963 5.56615C5.50963 5.27205 5.61245 5.02083 5.8181 4.8125C6.02377 4.60417 6.2735 4.5 6.5673 4.5H17.4423C17.7361 4.5 17.9858 4.60294 18.1915 4.80883C18.3971 5.01471 18.5 5.2647 18.5 5.5588C18.5 5.85292 18.3971 6.10413 18.1915 6.31245C17.9858 6.52078 17.7361 6.62495 17.4423 6.62495H13.0673V10.2596H10.9423ZM10.9423 15.7211H13.0673V18.4423C13.0673 18.7361 12.9643 18.9858 12.7584 19.1915C12.5526 19.3971 12.3026 19.5 12.0085 19.5C11.7144 19.5 11.4631 19.3962 11.2548 19.1887C11.0465 18.9811 10.9423 18.7291 10.9423 18.4327V15.7211Z"\n />\n </svg>\n',EE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8078)">\n <path\n d="M20 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3ZM20 5V8H5V5H20ZM15 19H10V10H15V19ZM5 10H8V19H5V10ZM17 19V10H20V19H17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8078">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',ME='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M5.66936 16.3389L9.39244 12.6158C9.54115 12.4671 9.71679 12.3937 9.91936 12.3957C10.1219 12.3976 10.2975 12.4761 10.4463 12.6312C10.5847 12.7823 10.654 12.9585 10.654 13.1599C10.654 13.3613 10.5847 13.5363 10.4463 13.6851L6.32704 17.8197C6.14627 18.0004 5.93538 18.0908 5.69436 18.0908C5.45333 18.0908 5.24243 18.0004 5.06166 17.8197L3.01744 15.7754C2.87899 15.637 2.81136 15.4629 2.81456 15.2533C2.81776 15.0437 2.88859 14.8697 3.02706 14.7312C3.16551 14.5928 3.34008 14.5235 3.55076 14.5235C3.76144 14.5235 3.93494 14.5928 4.07126 14.7312L5.66936 16.3389ZM5.66936 8.72359L9.39244 5.00049C9.54115 4.85177 9.71679 4.77838 9.91936 4.78031C10.1219 4.78223 10.2975 4.86075 10.4463 5.01586C10.5847 5.16691 10.654 5.34314 10.654 5.54454C10.654 5.74592 10.5847 5.92097 10.4463 6.06969L6.32704 10.2043C6.14627 10.3851 5.93538 10.4755 5.69436 10.4755C5.45333 10.4755 5.24243 10.3851 5.06166 10.2043L3.01744 8.16009C2.87899 8.02162 2.81136 7.84759 2.81456 7.63799C2.81776 7.42837 2.88859 7.25433 3.02706 7.11586C3.16551 6.97741 3.34008 6.90819 3.55076 6.90819C3.76144 6.90819 3.93494 6.97741 4.07126 7.11586L5.66936 8.72359ZM13.7597 16.5581C13.5472 16.5581 13.3691 16.4862 13.2253 16.3424C13.0816 16.1986 13.0097 16.0204 13.0097 15.8078C13.0097 15.5952 13.0816 15.4171 13.2253 15.2735C13.3691 15.13 13.5472 15.0582 13.7597 15.0582H20.7597C20.9722 15.0582 21.1503 15.1301 21.2941 15.2739C21.4378 15.4177 21.5097 15.5959 21.5097 15.8085C21.5097 16.0211 21.4378 16.1992 21.2941 16.3427C21.1503 16.4863 20.9722 16.5581 20.7597 16.5581H13.7597ZM13.7597 8.94276C13.5472 8.94276 13.3691 8.87085 13.2253 8.72704C13.0816 8.58324 13.0097 8.40504 13.0097 8.19244C13.0097 7.97985 13.0816 7.80177 13.2253 7.65819C13.3691 7.5146 13.5472 7.44281 13.7597 7.44281H20.7597C20.9722 7.44281 21.1503 7.51471 21.2941 7.65851C21.4378 7.80233 21.5097 7.98053 21.5097 8.19311C21.5097 8.40571 21.4378 8.5838 21.2941 8.72739C21.1503 8.87097 20.9722 8.94276 20.7597 8.94276H13.7597Z"\n />\n </svg>\n',_E='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="32"\n height="32"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M7 19v-.808L13.096 12L7 5.808V5h10v1.25H9.102L14.727 12l-5.625 5.77H17V19z"\n />\n </svg>\n',TE='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n >\n <path\n d="m644-428-58-58q9-47-27-88t-93-32l-58-58q17-8 34.5-12t37.5-4q75 0 127.5 52.5T660-500q0 20-4 37.5T644-428Zm128 126-58-56q38-29 67.5-63.5T832-500q-50-101-143.5-160.5T480-720q-29 0-57 4t-55 12l-62-62q41-17 84-25.5t90-8.5q151 0 269 83.5T920-500q-23 59-60.5 109.5T772-302Zm20 246L624-222q-35 11-70.5 16.5T480-200q-151 0-269-83.5T40-500q21-53 53-98.5t73-81.5L56-792l56-56 736 736-56 56ZM222-624q-29 26-53 57t-41 67q50 101 143.5 160.5T480-280q20 0 39-2.5t39-5.5l-36-38q-11 3-21 4.5t-21 1.5q-75 0-127.5-52.5T300-500q0-11 1.5-21t4.5-21l-84-82Zm319 93Zm-151 75Z"\n />\n </svg>\n',DE={[sE.CodeMirror]:{theme:F,languages:_d,expandIcon:dE,searchIcon:SE,clearSearchIcon:uE,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:e=>e?vE:TE}},IE=Tt([],"FeaturesCtx"),AE=Tt({},"CrepeCtx");function RE(e){return e.use("FeaturesCtx")}function PE(e){return t=>{RE(t).update(t=>t.includes(e)?t:[...t,e])}}function LE(e){return"code_block"===e.$from.parent.type.name}function VE(e){var t;const n=null==(t=e.$from.node(e.$from.depth-1))?void 0:t.type;return"list_item"===(null==n?void 0:n.name)}var jE,$E,BE=e=>{throw TypeError(e)},HE=(e,t,n)=>t.has(e)||BE("Cannot "+n),FE=(e,t,n)=>(HE(e,t,"read from private field"),n?n.call(e):t.get(e)),zE=(e,t,n)=>t.has(e)?BE("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);class qE{constructor(){zE(this,jE,[]),this.clear=()=>{var e,t,n;return n=[],HE(e=this,t=jE,"write to private field"),t.set(e,n),this},zE(this,$E,e=>{const t={group:e,addItem:(n,o)=>{const r={...o,key:n};return e.items.push(r),t},clear:()=>(e.items=[],t)};return t}),this.addGroup=(e,t)=>{const n={key:e,label:t,items:[]};return FE(this,jE).push(n),FE(this,$E).call(this,n)},this.getGroup=e=>{const t=FE(this,jE).find(t=>t.key===e);if(!t)throw new Error(`Group with key ${e} not found`);return FE(this,$E).call(this,t)},this.build=()=>FE(this,jE)}}jE=new WeakMap,$E=new WeakMap;const WE=$g({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:e,show:t,filter:n,hide:o,config:r}){const i=wm(),s=hw(()=>function(e,t,n){var o,r,i,s,a,l,c,d,u,p,h,f,m,g,v,y,w,b,k,C,x,N,S,O,E,M,_,T,D,I,A,R,P,L,V,j,$,B,H,F,z,q,W,U,K,G,J,Z,X,Y,Q,ee,te,ne,oe,re,ie,se,ae,le,ce,de,ue,pe,he,fe,me,ge,ve,ye,we,be,ke,Ce,xe,Ne,Se,Oe,Ee,Me,_e,Te,De,Ie,Ae,Re,Pe,Le,Ve,je,$e,Be,He,Fe,ze,qe,We,Ue,Ke,Ge,Je,Ze,Xe,Ye,Qe,et,tt,nt,ot,rt,it,st,at,lt,ct,dt,ut,pt,ht;const ft=n&&RE(n).get(),mt=null==ft?void 0:ft.includes(sE.Latex),gt=null==ft?void 0:ft.includes(sE.ImageBlock),vt=null==ft?void 0:ft.includes(sE.Table),yt=new qE;if(null!==(null==t?void 0:t.textGroup)){const e=yt.addGroup("text",null!=(r=null==(o=null==t?void 0:t.textGroup)?void 0:o.label)?r:"Text");null!==(null==(i=null==t?void 0:t.textGroup)?void 0:i.text)&&e.addItem("text",{label:null!=(l=null==(a=null==(s=null==t?void 0:t.textGroup)?void 0:s.text)?void 0:a.label)?l:"Text",icon:null!=(u=null==(d=null==(c=null==t?void 0:t.textGroup)?void 0:c.text)?void 0:d.icon)?u:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5547)">\n <path\n d="M5 5.5C5 6.33 5.67 7 6.5 7H10.5V17.5C10.5 18.33 11.17 19 12 19C12.83 19 13.5 18.33 13.5 17.5V7H17.5C18.33 7 19 6.33 19 5.5C19 4.67 18.33 4 17.5 4H6.5C5.67 4 5 4.67 5 5.5Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5547">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(bc),n=lu.type(e);t.call(pp.key),t.call(hp.key,{nodeType:n})}}),null!==(null==(p=null==t?void 0:t.textGroup)?void 0:p.h1)&&e.addItem("h1",{label:null!=(m=null==(f=null==(h=null==t?void 0:t.textGroup)?void 0:h.h1)?void 0:f.label)?m:"Heading 1",icon:null!=(y=null==(v=null==(g=null==t?void 0:t.textGroup)?void 0:g.h1)?void 0:v.icon)?y:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5553)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM12 17H14V7H10V9H12V17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5553">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(bc),n=fu.type(e);t.call(pp.key),t.call(hp.key,{nodeType:n,attrs:{level:1}})}}),null!==(null==(w=null==t?void 0:t.textGroup)?void 0:w.h2)&&e.addItem("h2",{label:null!=(C=null==(k=null==(b=null==t?void 0:t.textGroup)?void 0:b.h2)?void 0:k.label)?C:"Heading 2",icon:null!=(S=null==(N=null==(x=null==t?void 0:t.textGroup)?void 0:x.h2)?void 0:N.icon)?S:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5559)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15H11V13H13C14.1 13 15 12.11 15 11V9C15 7.89 14.1 7 13 7H9V9H13V11H11C9.9 11 9 11.89 9 13V17H15V15Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5559">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(bc),n=fu.type(e);t.call(pp.key),t.call(hp.key,{nodeType:n,attrs:{level:2}})}}),null!==(null==(O=null==t?void 0:t.textGroup)?void 0:O.h3)&&e.addItem("h3",{label:null!=(_=null==(M=null==(E=null==t?void 0:t.textGroup)?void 0:E.h3)?void 0:M.label)?_:"Heading 3",icon:null!=(I=null==(D=null==(T=null==t?void 0:t.textGroup)?void 0:T.h3)?void 0:D.icon)?I:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5565)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13.5C15 12.67 14.33 12 13.5 12C14.33 12 15 11.33 15 10.5V9C15 7.89 14.1 7 13 7H9V9H13V11H11V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5565">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(bc),n=fu.type(e);t.call(pp.key),t.call(hp.key,{nodeType:n,attrs:{level:3}})}}),null!==(null==(A=null==t?void 0:t.textGroup)?void 0:A.h4)&&e.addItem("h4",{label:null!=(L=null==(P=null==(R=null==t?void 0:t.textGroup)?void 0:R.h4)?void 0:P.label)?L:"Heading 4",icon:null!=($=null==(j=null==(V=null==t?void 0:t.textGroup)?void 0:V.h4)?void 0:j.icon)?$:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7757)">\n <path\n d="M19.04 3H5.04004C3.94004 3 3.04004 3.9 3.04004 5V19C3.04004 20.1 3.94004 21 5.04004 21H19.04C20.14 21 21.04 20.1 21.04 19V5C21.04 3.9 20.14 3 19.04 3ZM19.04 19H5.04004V5H19.04V19ZM13.04 17H15.04V7H13.04V11H11.04V7H9.04004V13H13.04V17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7757">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(bc),n=fu.type(e);t.call(pp.key),t.call(hp.key,{nodeType:n,attrs:{level:4}})}}),null!==(null==(B=null==t?void 0:t.textGroup)?void 0:B.h5)&&e.addItem("h5",{label:null!=(z=null==(F=null==(H=null==t?void 0:t.textGroup)?void 0:H.h5)?void 0:F.label)?z:"Heading 5",icon:null!=(U=null==(W=null==(q=null==t?void 0:t.textGroup)?void 0:q.h5)?void 0:W.icon)?U:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7760)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H9V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7760">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(bc),n=fu.type(e);t.call(pp.key),t.call(hp.key,{nodeType:n,attrs:{level:5}})}}),null!==(null==(K=null==t?void 0:t.textGroup)?void 0:K.h6)&&e.addItem("h6",{label:null!=(Z=null==(J=null==(G=null==t?void 0:t.textGroup)?void 0:G.h6)?void 0:J.label)?Z:"Heading 6",icon:null!=(Q=null==(Y=null==(X=null==t?void 0:t.textGroup)?void 0:X.h6)?void 0:Y.icon)?Q:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7763)">\n <path\n d="M11 17H13C14.1 17 15 16.11 15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H11C9.9 7 9 7.89 9 9V15C9 16.11 9.9 17 11 17ZM11 13H13V15H11V13ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7763">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(bc),n=fu.type(e);t.call(pp.key),t.call(hp.key,{nodeType:n,attrs:{level:6}})}}),null!==(null==(ee=null==t?void 0:t.textGroup)?void 0:ee.quote)&&e.addItem("quote",{label:null!=(oe=null==(ne=null==(te=null==t?void 0:t.textGroup)?void 0:te.quote)?void 0:ne.label)?oe:"Quote",icon:null!=(se=null==(ie=null==(re=null==t?void 0:t.textGroup)?void 0:re.quote)?void 0:ie.icon)?se:xE,onRun:e=>{const t=e.get(bc),n=bu.type(e);t.call(pp.key),t.call(fp.key,{nodeType:n})}}),null!==(null==(ae=null==t?void 0:t.textGroup)?void 0:ae.divider)&&e.addItem("divider",{label:null!=(de=null==(ce=null==(le=null==t?void 0:t.textGroup)?void 0:le.divider)?void 0:ce.label)?de:"Divider",icon:null!=(he=null==(pe=null==(ue=null==t?void 0:t.textGroup)?void 0:ue.divider)?void 0:pe.icon)?he:mE,onRun:e=>{const t=e.get(bc),n=ju.type(e);t.call(pp.key),t.call(mp.key,{nodeType:n})}})}if(null!==(null==t?void 0:t.listGroup)){const e=yt.addGroup("list",null!=(me=null==(fe=null==t?void 0:t.listGroup)?void 0:fe.label)?me:"List");null!==(null==(ge=null==t?void 0:t.listGroup)?void 0:ge.bulletList)&&e.addItem("bullet-list",{label:null!=(we=null==(ye=null==(ve=null==t?void 0:t.listGroup)?void 0:ve.bulletList)?void 0:ye.label)?we:"Bullet List",icon:null!=(Ce=null==(ke=null==(be=null==t?void 0:t.listGroup)?void 0:be.bulletList)?void 0:ke.icon)?Ce:cE,onRun:e=>{const t=e.get(bc),n=Fu.type(e);t.call(pp.key),t.call(fp.key,{nodeType:n})}}),null!==(null==(xe=null==t?void 0:t.listGroup)?void 0:xe.orderedList)&&e.addItem("ordered-list",{label:null!=(Oe=null==(Se=null==(Ne=null==t?void 0:t.listGroup)?void 0:Ne.orderedList)?void 0:Se.label)?Oe:"Ordered List",icon:null!=(_e=null==(Me=null==(Ee=null==t?void 0:t.listGroup)?void 0:Ee.orderedList)?void 0:Me.icon)?_e:kE,onRun:e=>{const t=e.get(bc),n=Ku.type(e);t.call(pp.key),t.call(fp.key,{nodeType:n})}}),null!==(null==(Te=null==t?void 0:t.listGroup)?void 0:Te.taskList)&&e.addItem("task-list",{label:null!=(Ae=null==(Ie=null==(De=null==t?void 0:t.listGroup)?void 0:De.taskList)?void 0:Ie.label)?Ae:"Task List",icon:null!=(Le=null==(Pe=null==(Re=null==t?void 0:t.listGroup)?void 0:Re.taskList)?void 0:Pe.icon)?Le:ME,onRun:e=>{const t=e.get(bc),n=Yu.type(e);t.call(pp.key),t.call(fp.key,{nodeType:n,attrs:{checked:!1}})}})}if(null!==(null==t?void 0:t.advancedGroup)){const e=yt.addGroup("advanced",null!=(je=null==(Ve=null==t?void 0:t.advancedGroup)?void 0:Ve.label)?je:"Advanced");null!==(null==($e=null==t?void 0:t.advancedGroup)?void 0:$e.image)&&gt&&e.addItem("image",{label:null!=(Fe=null==(He=null==(Be=null==t?void 0:t.advancedGroup)?void 0:Be.image)?void 0:He.label)?Fe:"Image",icon:null!=(We=null==(qe=null==(ze=null==t?void 0:t.advancedGroup)?void 0:ze.image)?void 0:qe.icon)?We:yE,onRun:e=>{const t=e.get(bc),n=zb.type(e);t.call(pp.key),t.call(mp.key,{nodeType:n})}}),null!==(null==(Ue=null==t?void 0:t.advancedGroup)?void 0:Ue.codeBlock)&&e.addItem("code",{label:null!=(Je=null==(Ge=null==(Ke=null==t?void 0:t.advancedGroup)?void 0:Ke.codeBlock)?void 0:Ge.label)?Je:"Code",icon:null!=(Ye=null==(Xe=null==(Ze=null==t?void 0:t.advancedGroup)?void 0:Ze.codeBlock)?void 0:Xe.icon)?Ye:pE,onRun:e=>{const t=e.get(bc),n=Su.type(e);t.call(pp.key),t.call(hp.key,{nodeType:n})}}),null!==(null==(Qe=null==t?void 0:t.advancedGroup)?void 0:Qe.table)&&vt&&e.addItem("table",{label:null!=(nt=null==(tt=null==(et=null==t?void 0:t.advancedGroup)?void 0:et.table)?void 0:tt.label)?nt:"Table",icon:null!=(it=null==(rt=null==(ot=null==t?void 0:t.advancedGroup)?void 0:ot.table)?void 0:rt.icon)?it:EE,onRun:e=>{const t=e.get(bc),n=e.get(Yl);t.call(pp.key);const{from:o}=n.state.selection;t.call(mp.key,{nodeType:BC(e,3,3)}),t.call(gp.key,{pos:o})}}),null!==(null==(st=null==t?void 0:t.advancedGroup)?void 0:st.math)&&mt&&e.addItem("math",{label:null!=(ct=null==(lt=null==(at=null==t?void 0:t.advancedGroup)?void 0:at.math)?void 0:lt.label)?ct:"Math",icon:null!=(pt=null==(ut=null==(dt=null==t?void 0:t.advancedGroup)?void 0:dt.math)?void 0:ut.icon)?pt:_E,onRun:e=>{const t=e.get(bc),n=Su.type(e);t.call(pp.key),t.call(mp.key,{nodeType:n,attrs:{language:"LaTeX"}})}})}null==(ht=null==t?void 0:t.buildMenu)||ht.call(t,yt);let wt=yt.build();e&&(wt=wt.map(t=>{const n=t.items.filter(t=>t.label.toLowerCase().includes(e.toLowerCase()));return{...t,items:n}}).filter(e=>e.items.length>0));const bt=wt.flatMap(e=>e.items);return bt.forEach((e,t)=>{Object.assign(e,{index:t})}),wt.reduce((e,t)=>{const n=e+t.items.length;return Object.assign(t,{range:[e,n]}),n},0),{groups:wt,size:bt.length}}(n.value,r,e)),a=wm(0),l=wm({x:-999,y:-999}),c=e=>{const{x:t,y:n}=e;l.value={x:t,y:n}};Ig([s,t],()=>{const{size:e}=s.value;0===e&&t.value?o():a.value>=e&&(a.value=0)});const d=(e,t)=>{const n=a.value,o="function"==typeof e?e(n):e;null==t||t(o),a.value=o},u=e=>{var t,n;const o=null==(t=i.value)?void 0:t.querySelector(`[data-index="${e}"]`),r=null==(n=i.value)?void 0:n.querySelector(".menu-groups");o&&r&&(r.scrollTop=o.offsetTop-r.offsetTop)},p=t=>{const n=s.value.groups.flatMap(e=>e.items).at(t);(null==n?void 0:n.onRun)&&e&&n.onRun(e),o()},h=e=>{const{size:t,groups:n}=s.value;return"Escape"===e.key?(e.preventDefault(),void(null==o||o())):"ArrowDown"===e.key?(e.preventDefault(),d(e=>e<t-1?e+1:e,u)):"ArrowUp"===e.key?(e.preventDefault(),d(e=>e<=0?e:e-1,u)):"ArrowLeft"===e.key?(e.preventDefault(),d(e=>{const t=n.find(t=>t.range[0]<=e&&t.range[1]>e);if(!t)return e;const o=n[n.indexOf(t)-1];return o?o.range[1]-1:e},u)):"ArrowRight"===e.key?(e.preventDefault(),d(e=>{const t=n.find(t=>t.range[0]<=e&&t.range[1]>e);if(!t)return e;const o=n[n.indexOf(t)+1];return o?o.range[0]:e},u)):void("Enter"===e.key&&(e.preventDefault(),p(a.value)))};return Dg(()=>{t.value?window.addEventListener("keydown",h,{capture:!0}):window.removeEventListener("keydown",h,{capture:!0})}),iv(()=>{window.removeEventListener("keydown",h,{capture:!0})}),()=>fw("div",{ref:i,onPointerdown:e=>e.preventDefault()},fw("nav",{class:"tab-group"},fw("ul",null,s.value.groups.map(e=>fw("li",{key:e.key,onPointerdown:()=>d(e.range[0],u),class:a.value>=e.range[0]&&a.value<e.range[1]?"selected":""},e.label)))),fw("div",{class:"menu-groups",onPointermove:c},s.value.groups.map(e=>fw("div",{key:e.key,class:"menu-group"},fw("h6",null,e.label),fw("ul",null,e.items.map(e=>{return fw("li",{key:e.key,"data-index":e.index,class:a.value===e.index?"hover":"",onPointerenter:(t=e.index,e=>{const n=l.value;if(!n)return;const{x:o,y:r}=e;o===n.x&&r===n.y||d(t)}),onPointerdown:()=>{var t,n;null==(n=null==(t=i.value)?void 0:t.querySelector(`[data-index="${e.index}"]`))||n.classList.add("active")},onPointerup:()=>{var t,n;null==(n=null==(t=i.value)?void 0:t.querySelector(`[data-index="${e.index}"]`))||n.classList.remove("active"),p(e.index)}},fw(Sb,{icon:e.icon}),fw("span",null,e.label));var t}))))))}});var UE,KE,GE,JE,ZE,XE=e=>{throw TypeError(e)},YE=(e,t,n)=>t.has(e)||XE("Cannot "+n),QE=(e,t,n)=>(YE(e,t,"read from private field"),n?n.call(e):t.get(e)),eM=(e,t,n)=>t.has(e)?XE("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),tM=(e,t,n,o)=>(YE(e,t,"write to private field"),t.set(e,n),n);const nM=function(e){const t=md({},`${e}_SLASH_SPEC`),n=pd(n=>{const o=n.get(t.key);return new or({key:new sr(`${e}_SLASH`),...o})}),o=[t,n];return o.key=t.key,o.pluginKey=n.key,t.meta={package:"@milkdown/plugin-slash",displayName:`Ctx<slashSpec>|${e}`},n.meta={package:"@milkdown/plugin-slash",displayName:`Prose<slash>|${e}`},o}("CREPE_MENU"),oM=md({show:()=>{},hide:()=>{}},"menuAPICtx");class rM{constructor(e,t,n){eM(this,UE),eM(this,KE),eM(this,GE),eM(this,JE),eM(this,ZE,null),this.update=e=>{QE(this,JE).update(e)},this.show=e=>{tM(this,ZE,e),QE(this,GE).value="",QE(this,JE).show()},this.hide=()=>{tM(this,ZE,null),QE(this,JE).hide()},this.destroy=()=>{QE(this,JE).destroy(),QE(this,KE).unmount(),QE(this,UE).remove()};const o=document.createElement("div");o.classList.add("milkdown-slash-menu");const r=wm(!1),i=wm("");tM(this,GE,i);const s=this.hide,a=Uw(WE,{ctx:e,config:n,show:r,filter:i,hide:s});tM(this,KE,a),a.mount(o),tM(this,UE,o);const l=this;tM(this,JE,new Nb({content:QE(this,UE),debounce:20,shouldShow(e){if(LE(e.state.selection)||VE(e.state.selection))return!1;const t=this.getContent(e,e=>["paragraph","heading"].includes(e.type.name));if(null==t)return!1;if(!function(e){if(!(e instanceof Fo))return!1;const{$head:t}=e,n=t.parent,o=t.parentOffset;return o===n.content.size}(e.state.selection))return!1;const n=QE(l,ZE);if(i.value=t.startsWith("/")?t.slice(1):t,"number"==typeof n){const t=e.state.doc.nodeSize-2,o=Math.min(n,t);return e.state.doc.resolve(o).node()===e.state.doc.resolve(e.state.selection.from).node()||(tM(l,ZE,null),!1)}return!!t.startsWith("/")},offset:10})),QE(this,JE).onShow=()=>{r.value=!0},QE(this,JE).onHide=()=>{r.value=!1},this.update(t),e.set(oM.key,{show:e=>this.show(e),hide:()=>this.hide()})}}UE=new WeakMap,KE=new WeakMap,GE=new WeakMap,JE=new WeakMap,ZE=new WeakMap;const iM=$g({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(e){const t=wm();return()=>fw(My,null,fw("div",{ref:t,class:"operation-item",onPointerdown:e=>{var n;e.preventDefault(),e.stopPropagation(),null==(n=t.value)||n.classList.add("active")},onPointerup:n=>{var o;n.preventDefault(),n.stopPropagation(),null==(o=t.value)||o.classList.remove("active"),e.onAdd()}},fw(Sb,{icon:e.addIcon})),fw("div",{class:"operation-item"},fw(Sb,{icon:e.handleIcon})))}});var sM,aM,lM,cM,dM=e=>{throw TypeError(e)},uM=(e,t,n)=>t.has(e)||dM("Cannot "+n),pM=(e,t,n)=>(uM(e,t,"read from private field"),n?n.call(e):t.get(e)),hM=(e,t,n)=>t.has(e)?dM("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),fM=(e,t,n,o)=>(uM(e,t,"write to private field"),t.set(e,n),n);class mM{constructor(e,t){var n,o,r;hM(this,sM),hM(this,aM),hM(this,lM),hM(this,cM),this.update=()=>{pM(this,aM).update()},this.destroy=()=>{pM(this,aM).destroy(),pM(this,sM).remove(),pM(this,lM).unmount()},this.onAdd=()=>{const e=pM(this,cM),t=e.get(Yl);t.hasFocus()||t.focus();const{state:n,dispatch:o}=t,r=pM(this,aM).active;if(!r)return;const i=r.$pos.pos+r.node.nodeSize;let s=n.tr.insert(i,lu.type(e).create());s=s.setSelection(Fo.near(s.doc.resolve(i))),o(s.scrollIntoView()),pM(this,aM).hide(),e.get(oM.key).show(s.selection.from)},fM(this,cM,e);const i=document.createElement("div");i.classList.add("milkdown-block-handle");const s=Uw(iM,{onAdd:this.onAdd,addIcon:null!=(n=null==t?void 0:t.handleAddIcon)?n:CE,handleIcon:null!=(o=null==t?void 0:t.handleDragIcon)?o:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_971_7680)">\n <path\n d="M11 18C11 19.1 10.1 20 9 20C7.9 20 7 19.1 7 18C7 16.9 7.9 16 9 16C10.1 16 11 16.9 11 18ZM9 10C7.9 10 7 10.9 7 12C7 13.1 7.9 14 9 14C10.1 14 11 13.1 11 12C11 10.9 10.1 10 9 10ZM9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM15 8C16.1 8 17 7.1 17 6C17 4.9 16.1 4 15 4C13.9 4 13 4.9 13 6C13 7.1 13.9 8 15 8ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM15 16C13.9 16 13 16.9 13 18C13 19.1 13.9 20 15 20C16.1 20 17 19.1 17 18C17 16.9 16.1 16 15 16Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_971_7680">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n'});s.mount(i),fM(this,lM,s),fM(this,sM,i);const a=null!=(r=null==t?void 0:t.blockHandle)?r:{};fM(this,aM,new Cb({ctx:e,content:i,getOffset:()=>16,getPlacement:({active:e,blockDom:t})=>{if("heading"===e.node.type.name)return"left";let n=0;e.node.descendants(e=>{n+=e.childCount});const o=e.el,r=o.getBoundingClientRect(),i=t.getBoundingClientRect(),s=window.getComputedStyle(o),a=Number.parseInt(s.paddingTop,10)||0,l=Number.parseInt(s.paddingBottom,10)||0,c=r.height-a-l,d=i.height;return n>2||d<c?"left-start":"left"},...a})),this.update()}}sM=new WeakMap,aM=new WeakMap,lM=new WeakMap,cM=new WeakMap;const gM=(e,t)=>{e.config(PE(sE.BlockEdit)).config(e=>function(e,t){e.set(mb.key,{filterNodes:e=>!gi(e=>["table","blockquote","math_inline"].includes(e.type.name))(e)}),e.set(xb.key,{view:()=>new mM(e,t)})}(e,t)).config(e=>function(e,t){e.set(nM.key,{view:n=>new rM(e,n,t)})}(e,t)).use(oM).use(xb).use(nM)},vM=Su.extendSchema(e=>t=>{const n=e(t);return{...n,toMarkdown:{match:n.toMarkdown.match,runner:(e,t)=>{var o,r;if("latex"!==(null!=(o=t.attrs.language)?o:"").toLowerCase())return n.toMarkdown.runner(e,t);e.addNode("math",void 0,(null==(r=t.content.firstChild)?void 0:r.text)||"")}}}}),yM="math_inline",wM=gd(yM,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${yM}"]`,getAttrs:e=>{var t;return{value:null!=(t=e.dataset.value)?t:""}}}],toDOM:e=>{const t=e.attrs.value,n=document.createElement("span");return n.dataset.type=yM,n.dataset.value=t,re.render(t,n,{throwOnError:!1}),n},parseMarkdown:{match:e=>"inlineMath"===e.type,runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>e.type.name===yM,runner:(e,t)=>{e.addNode("inlineMath",void 0,t.attrs.value)}}})),bM=ld("ToggleLatex",e=>()=>(t,n)=>{const{hasNode:o,pos:r,target:i}=bi(t,wM.type(e)),{selection:s,doc:a,tr:l}=t;if(!o){const t=a.textBetween(s.from,s.to);let o=l.replaceSelectionWith(wM.type(e).create({value:t}));return n&&n(o.setSelection(qo.create(o.doc,s.from))),!0}const{from:c,to:d}=s;if(!i||r<0)return!1;let u=l.delete(r,r+1);const p=i.attrs.value;return u=u.insertText(p,r),n&&n(u.setSelection(Fo.create(u.doc,c,d+p.length-1))),!0}),kM=mN("INLINE_LATEX"),CM=$g({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(e){const t=t=>{if(t&&t instanceof HTMLElement){for(;t.firstChild;)t.removeChild(t.firstChild);e.innerView.value&&t.appendChild(e.innerView.value.dom)}},n=t=>{t.preventDefault(),e.updateValue.value()};return()=>fw("div",{class:"container"},e.innerView&&fw("div",{ref:t}),fw("button",{type:"button",onPointerdown:n},fw(Sb,{icon:e.config.inlineEditConfirm})))}});var xM,NM,SM,OM,EM,MM,_M,TM,DM=e=>{throw TypeError(e)},IM=(e,t,n)=>t.has(e)||DM("Cannot "+n),AM=(e,t,n)=>(IM(e,t,"read from private field"),n?n.call(e):t.get(e)),RM=(e,t,n)=>t.has(e)?DM("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),PM=(e,t,n,o)=>(IM(e,t,"write to private field"),t.set(e,n),n);class LM{constructor(e,t,n){this.ctx=e,RM(this,xM),RM(this,NM),RM(this,SM),RM(this,OM,bm(null)),RM(this,EM,bm(()=>{})),RM(this,MM),RM(this,_M,()=>{AM(this,OM).value&&(AM(this,OM).value.destroy(),AM(this,OM).value=null)}),RM(this,TM,e=>{const t=(()=>{const{selection:t,schema:n}=e.state;if(t.empty)return!1;if(!(t instanceof qo))return!1;const o=t.node;if(o.type.name!==yM)return!1;const r=t.from,i=n.nodes.paragraph.create(null,n.text(o.attrs.value)),s=new ql(AM(this,SM),{state:tr.create({doc:i,schema:new Dn({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:()=>["p",0]},text:{group:"inline"}}}),plugins:[Si({"Mod-z":Jp,"Mod-Z":Zp,"Mod-y":Zp,Enter:()=>(AM(this,EM).value(),!0)})]})});return AM(this,OM).value=s,AM(this,EM).value=()=>{const{tr:t}=e.state;t.setNodeAttribute(r,"value",s.state.doc.textContent),e.dispatch(t),requestAnimationFrame(()=>{e.focus()})},!0})();return t||AM(this,_M).call(this),t}),this.update=(e,t)=>{AM(this,NM).update(e,t)},this.destroy=()=>{AM(this,MM).unmount(),AM(this,NM).destroy(),AM(this,xM).remove()};const o=document.createElement("div");o.className="milkdown-latex-inline-edit",PM(this,xM,o),PM(this,MM,Uw(CM,{config:n,innerView:AM(this,OM),updateValue:AM(this,EM)})),AM(this,MM).mount(o),PM(this,NM,new fN({debounce:0,content:AM(this,xM),shouldShow:AM(this,TM),offset:10,floatingUIOptions:{placement:"bottom"}})),AM(this,NM).update(t),PM(this,SM,document.createElement("div"))}}xM=new WeakMap,NM=new WeakMap,SM=new WeakMap,OM=new WeakMap,EM=new WeakMap,MM=new WeakMap,_M=new WeakMap,TM=new WeakMap;const VM=cd(e=>function(e,t,n={}){return new Dr(e,(e,o,r,i)=>{var s,a,l;const{tr:c}=e;let d=o[1],u=o[0];const p={group:d,fullMatch:u,start:r,end:i},h=null==(s=n.updateCaptured)?void 0:s.call(n,p);if(Object.assign(p,h),({group:d,fullMatch:u,start:r,end:i}=p),null===u)return null;if(!d||""===d.trim())return null;const f=null==(a=n.getAttr)?void 0:a.call(n,o),m=t.createAndFill(f);return m&&(c.replaceRangeWith(t.isBlock?c.doc.resolve(r).before():r,i,m),null==(l=n.beforeDispatch)||l.call(n,{match:[u,d],start:r,end:i,tr:c})),c})}(/(?:\$)([^$]+)(?:\$)$/,wM.type(e),{getAttr:e=>{var t;return{value:null!=(t=e[1])?t:""}}})),jM=cd(e=>Rr(/^\$\$[\s\n]$/,Su.type(e),()=>({language:"LaTeX"}))),$M=kd("remarkMath",()=>ie);function BM(e){return ee(e,"math",(e,t,n)=>{const{value:o}=e,r={type:"code",lang:"LaTeX",value:o};n.children.splice(t,1,r)})}const HM=kd("remarkMathBlock",()=>()=>BM),FM=(e,t)=>{e.config(PE(sE.Latex)).config(e=>{if(!RE(e).get().includes(sE.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");e.update(eb.key,e=>({...e,renderPreview:(n,o,r)=>{if("latex"===n.toLowerCase()&&o.length>0)return function(e,t){const n=re.renderToString(e,{...t,throwOnError:!1,displayMode:!0});return n}(o,null==t?void 0:t.katexOptions);return(0,e.renderPreview)(n,o,r)}})),e.set(kM.key,{view:n=>{var o;return new LM(e,n,{inlineEditConfirm:null!=(o=null==t?void 0:t.inlineEditConfirm)?o:hE,...t})}})}).use($M).use(HM).use(wM).use(kM).use(VM).use(jM).use(vM).use(bM)};const zM=(e,t)=>{e.config(PE(sE.ListItem)).config(e=>function(e,t){e.set(KS.key,{renderLabel:({label:e,listType:n,checked:o})=>{var r,i,s;return null==o?"bullet"===n?null!=(r=null==t?void 0:t.bulletIcon)?r:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_952_6527)">\n <circle cx="12" cy="12" r="3" />\n </g>\n <defs>\n <clipPath id="clip0_952_6527">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n':e:o?null!=(i=null==t?void 0:t.checkBoxCheckedIcon)?i:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1803_1151)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM10.71 16.29C10.32 16.68 9.69 16.68 9.3 16.29L5.71 12.7C5.32 12.31 5.32 11.68 5.71 11.29C6.1 10.9 6.73 10.9 7.12 11.29L10 14.17L16.88 7.29C17.27 6.9 17.9 6.9 18.29 7.29C18.68 7.68 18.68 8.31 18.29 8.7L10.71 16.29Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1803_1151">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n':null!=(s=null==t?void 0:t.checkBoxUncheckedIcon)?s:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1803_535)">\n <path\n d="M18 19H6C5.45 19 5 18.55 5 18V6C5 5.45 5.45 5 6 5H18C18.55 5 19 5.45 19 6V18C19 18.55 18.55 19 18 19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1803_535">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n'}})}(e,t)).use(XS)};const qM=md({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),WM=pd(e=>new or({key:new sr("CREPE_PLACEHOLDER"),props:{decorations:t=>{var n;const o=function(e){return e.get("CrepeCtx")}(e);if(o.readonly)return null;const r=e.get(qM.key);if("doc"===r.mode&&!function(e){var t;return e.childCount<=1&&!(null==(t=e.firstChild)?void 0:t.content.size)}(t.doc))return null;if(LE(t.selection)||VE(t.selection))return null;const i=function(e,t){const{selection:n}=e;if(!n.empty)return null;const o=n.$anchor,r=o.parent;if(r.content.size>0)return null;if(gi(e=>"table"===e.type.name)(o))return null;const i=o.before();return gl.node(i,i+r.nodeSize,{class:"crepe-placeholder","data-placeholder":t})}(t,null!=(n=r.text)?n:"Please enter...");return i?wl.create(t.doc,[i]):null}}}));const UM=$g({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(e){const{ctx:t,config:n}=e;function o(n){e.selection.value;return t.get(tc).status===rd.Created&&n(t)}const r=hw(()=>function(e,t){var n,o,r,i,s,a,l;const c=new qE;c.addGroup("formatting","Formatting").addItem("bold",{icon:null!=(n=null==e?void 0:e.boldIcon)?n:lE,active:e=>e.get(bc).call(dp.key,Wd.type(e)),onRun:e=>{e.get(bc).call(Ud.key)}}).addItem("italic",{icon:null!=(o=null==e?void 0:e.italicIcon)?o:wE,active:e=>e.get(bc).call(dp.key,$d.type(e)),onRun:e=>{e.get(bc).call(Bd.key)}}).addItem("strikethrough",{icon:null!=(r=null==e?void 0:e.strikethroughIcon)?r:OE,active:e=>e.get(bc).call(dp.key,TC.type(e)),onRun:e=>{e.get(bc).call(DC.key)}});const d=c.addGroup("function","Function");d.addItem("code",{icon:null!=(i=null==e?void 0:e.codeIcon)?i:pE,active:e=>e.get(bc).call(dp.key,Zd.type(e)),onRun:e=>{e.get(bc).call(Xd.key)}});const u=t&&RE(t).get();return(null==u?void 0:u.includes(sE.Latex))&&d.addItem("latex",{icon:null!=(s=null==e?void 0:e.latexIcon)?s:_E,active:e=>e.get(bc).call(up.key,wM.type(e)),onRun:e=>{e.get(bc).call(bM.key)}}),d.addItem("link",{icon:null!=(a=null==e?void 0:e.linkIcon)?a:bE,active:e=>e.get(bc).call(dp.key,tu.type(e)),onRun:e=>{e.get(bc).call(IN.key)}}),null==(l=null==e?void 0:e.buildToolbar)||l.call(e,c),c.build()}(n,t));return()=>fw(My,null,r.value.map(e=>e.items.map(e=>{return fw("button",{type:"button",class:Ae("toolbar-item",t&&o(e.active)&&"active"),onPointerdown:(n=e.onRun,e=>{e.preventDefault(),t&&(null==n||n(t))})},fw(Sb,{icon:e.icon}));var n})).reduce((e,t,n)=>(0===n?e.push(...t):e.push(fw("div",{class:"divider"}),...t),e),[]))}});var KM,GM,JM,ZM,XM,YM=e=>{throw TypeError(e)},QM=(e,t,n)=>t.has(e)||YM("Cannot "+n),e_=(e,t,n)=>(QM(e,t,"read from private field"),n?n.call(e):t.get(e)),t_=(e,t,n)=>t.has(e)?YM("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),n_=(e,t,n,o)=>(QM(e,t,"write to private field"),t.set(e,n),n);const o_=mN("CREPE_TOOLBAR");class r_{constructor(e,t,n){t_(this,KM),t_(this,GM),t_(this,JM),t_(this,ZM),t_(this,XM,wm(!1)),this.update=(e,t)=>{e_(this,KM).update(e,t),e_(this,ZM).value=e.state.selection},this.destroy=()=>{e_(this,KM).destroy(),e_(this,JM).unmount(),e_(this,GM).remove()},this.hide=()=>{e_(this,KM).hide()};const o=document.createElement("div");o.className="milkdown-toolbar",n_(this,ZM,bm(t.state.selection));const r=Uw(UM,{ctx:e,hide:this.hide,config:n,selection:e_(this,ZM),show:e_(this,XM)});r.mount(o),n_(this,GM,o),n_(this,JM,r),n_(this,KM,new fN({content:e_(this,GM),debounce:20,offset:10,shouldShow(e){const{doc:t,selection:n}=e.state,{empty:r,from:i,to:s}=n,a=!t.textBetween(i,s).length&&n instanceof Fo,l=!(n instanceof Fo),c=e.dom.getRootNode().activeElement,d=o.contains(c),u=!e.hasFocus()&&!d,p=!e.editable;return!(u||l||r||a||p)}})),e_(this,KM).onShow=()=>{e_(this,XM).value=!0},e_(this,KM).onHide=()=>{e_(this,XM).value=!1},this.update(t)}}KM=new WeakMap,GM=new WeakMap,JM=new WeakMap,ZM=new WeakMap,XM=new WeakMap;const i_=[{label:"Paragraph",level:null},{label:"Heading 1",level:1},{label:"Heading 2",level:2},{label:"Heading 3",level:3},{label:"Heading 4",level:4},{label:"Heading 5",level:5},{label:"Heading 6",level:6}];function s_(e,t){if(e.get(bc).call(dp.key,t))return!0;const n=e.get(Yl),{state:o}=n;if(o.storedMarks)return o.storedMarks.some(e=>e.type===t);if(o.selection instanceof Fo){const{$cursor:e}=o.selection;if(e)return e.marks().some(e=>e.type===t)}return!1}function a_(e,t){const n=null!=e?e:i_;return{icon:"",active:()=>!1,selector:{chevronIcon:null!=t?t:dE,activeLabel:e=>function(e,t){var n,o;const r=null!=t?t:i_,i=e.get(Yl),{$from:s}=i.state.selection,a=s.parent,l=null!=(n=r.find(e=>null===e.level))?n:r[0];if(a.type===fu.type(e)){const e=a.attrs.level;return null!=(o=r.find(t=>t.level===e))?o:l}return l}(e,n).label,options:n.map(e=>({label:e.label,onSelect:t=>function(e,t){const n=e.get(bc);if(null==t){const t=lu.type(e);n.call(hp.key,{nodeType:t})}else{const o=fu.type(e);n.call(hp.key,{nodeType:o,attrs:{level:t}})}}(t,e.level)}))}}}const l_=$g({props:{ctx:{type:Object,required:!0},version:{type:Object,required:!0},config:{type:Object,required:!1}},setup(e){const{ctx:t,config:n}=e,o=wm(null);function r(){return t.get(tc).status===rd.Created}function i(){e.version.value}const s=e=>{e.target.closest(".top-bar-heading-selector")||(o.value=null)};tv(()=>{window.addEventListener("pointerdown",s)}),iv(()=>{window.removeEventListener("pointerdown",s)});const a=hw(()=>function(e,t){var n,o,r,i,s,a,l,c,d,u,p,h,f,m,g;const v=t&&RE(t).get(),y=null==v?void 0:v.includes(sE.Latex),w=null==v?void 0:v.includes(sE.ImageBlock),b=null==v?void 0:v.includes(sE.Table),k=new qE;k.addGroup("heading","Heading").addItem("heading-selector",{...a_(null==e?void 0:e.headingOptions,null==e?void 0:e.chevronDownIcon)}),k.addGroup("formatting","Formatting").addItem("bold",{icon:null!=(n=null==e?void 0:e.boldIcon)?n:lE,active:e=>s_(e,Wd.type(e)),onRun:e=>{e.get(bc).call(Ud.key)}}).addItem("italic",{icon:null!=(o=null==e?void 0:e.italicIcon)?o:wE,active:e=>s_(e,$d.type(e)),onRun:e=>{e.get(bc).call(Bd.key)}}).addItem("strikethrough",{icon:null!=(r=null==e?void 0:e.strikethroughIcon)?r:OE,active:e=>s_(e,TC.type(e)),onRun:e=>{e.get(bc).call(DC.key)}}).addItem("code",{icon:null!=(i=null==e?void 0:e.codeIcon)?i:pE,active:e=>s_(e,Zd.type(e)),onRun:e=>{const t=e.get(Yl),{state:n}=t;if(n.selection.empty){const o=Zd.type(e);s_(e,o)?t.dispatch(n.tr.removeStoredMark(o)):t.dispatch(n.tr.addStoredMark(o.create()))}else e.get(bc).call(Xd.key)}}),k.addGroup("list","List").addItem("bullet-list",{icon:null!=(s=null==e?void 0:e.bulletListIcon)?s:cE,active:()=>!1,onRun:e=>{const t=e.get(bc),n=Fu.type(e);t.call(fp.key,{nodeType:n})}}).addItem("ordered-list",{icon:null!=(a=null==e?void 0:e.orderedListIcon)?a:kE,active:()=>!1,onRun:e=>{const t=e.get(bc),n=Ku.type(e);t.call(fp.key,{nodeType:n})}}).addItem("task-list",{icon:null!=(l=null==e?void 0:e.taskListIcon)?l:ME,active:()=>!1,onRun:e=>{const t=e.get(bc),n=Yu.type(e);t.call(fp.key,{nodeType:n,attrs:{checked:!1}})}});const C=k.addGroup("insert","Insert");C.addItem("link",{icon:null!=(c=null==e?void 0:e.linkIcon)?c:bE,active:e=>s_(e,tu.type(e)),onRun:e=>{const t=e.get(Yl),{state:n}=t,o=tu.type(e);n.selection.empty&&s_(e,o)?t.dispatch(n.tr.removeStoredMark(o)):e.get(bc).call(IN.key)}}),w&&C.addItem("image",{icon:null!=(d=null==e?void 0:e.imageIcon)?d:yE,active:()=>!1,onRun:e=>{const t=e.get(bc),n=zb.type(e);t.call(mp.key,{nodeType:n})}}),b&&C.addItem("table",{icon:null!=(u=null==e?void 0:e.tableIcon)?u:EE,active:()=>!1,onRun:e=>{const t=e.get(bc),n=e.get(Yl),{from:o}=n.state.selection;t.call(mp.key,{nodeType:BC(e,3,3)}),t.call(gp.key,{pos:o})}});const x=k.addGroup("block","Block");return x.addItem("code-block",{icon:null!=(p=null==e?void 0:e.codeBlockIcon)?p:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm1 2v14h16V5H4zm8 10h6v2h-6v-2zm-3.333-3L5.838 9.172l1.415-1.415L11.495 12l-4.242 4.243-1.415-1.415L8.667 12z"\n />\n </svg>\n',active:()=>!1,onRun:e=>{const t=e.get(bc),n=Su.type(e);t.call(hp.key,{nodeType:n})}}),y&&x.addItem("math",{icon:null!=(h=null==e?void 0:e.mathIcon)?h:_E,active:()=>!1,onRun:e=>{const t=e.get(bc),n=Su.type(e);t.call(mp.key,{nodeType:n,attrs:{language:"LaTeX"}})}}),k.addGroup("more","More").addItem("quote",{icon:null!=(f=null==e?void 0:e.quoteIcon)?f:xE,active:()=>!1,onRun:e=>{const t=e.get(bc),n=bu.type(e);t.call(fp.key,{nodeType:n})}}).addItem("hr",{icon:null!=(m=null==e?void 0:e.hrIcon)?m:mE,active:()=>!1,onRun:e=>{const t=e.get(bc),n=ju.type(e);t.call(mp.key,{nodeType:n})}}),null==(g=null==e?void 0:e.buildTopBar)||g.call(e,k),k.build()}(n,t));function l(e,n){const s=o.value===e,a=function(e){var n,o;return i(),r()?e.activeLabel(t):null!=(o=null==(n=e.options[0])?void 0:n.label)?o:""}(n);return fw("div",{key:e,class:"top-bar-heading-selector"},fw("button",{type:"button",class:"top-bar-heading-button",onPointerdown:t=>function(e,t){t.preventDefault(),t.stopPropagation(),o.value=o.value===e?null:e}(e,t)},fw("span",{class:"top-bar-heading-label"},a),n.chevronIcon&&fw("span",{class:"top-bar-chevron"},fw(Sb,{icon:n.chevronIcon}))),s&&fw("div",{class:"top-bar-heading-dropdown"},n.options.map((n,r)=>fw("button",{key:`${e}-${r}`,type:"button",class:Ae("top-bar-heading-option",a===n.label&&"active"),onPointerdown:e=>{e.preventDefault(),e.stopPropagation(),o.value=null,n.onSelect(t)}},n.label))))}return()=>{const e=r()?t.get(Yl):null;return!!e&&!e.editable?null:fw("div",{class:"top-bar-inner"},a.value.map(e=>e.items.map(e=>e.selector?l(e.key,e.selector):e.onRun?function(e){return fw("button",{key:e.key,type:"button",class:Ae("top-bar-item",(o=e.active,i(),!!r()&&o(t)&&"active")),onPointerdown:(n=e.onRun,e=>{e.preventDefault(),t&&n(t)})},fw(Sb,{icon:e.icon}));var n,o}(e):null)).reduce((e,t,n)=>{var o,r;if(0===n)e.push(...t);else{const i=null!=(r=null==(o=a.value[n])?void 0:o.key)?r:n;e.push(fw("div",{key:`divider-${i}`,class:"top-bar-divider"}),...t)}return e},[]))}}});var c_,d_,u_,p_=e=>{throw TypeError(e)},h_=(e,t,n)=>t.has(e)||p_("Cannot "+n),f_=(e,t,n)=>(h_(e,t,"read from private field"),n?n.call(e):t.get(e)),m_=(e,t,n)=>t.has(e)?p_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),g_=(e,t,n,o)=>(h_(e,t,"write to private field"),t.set(e,n),n);const v_=new sr("CREPE_TOP_BAR");class y_{constructor(e,t,n){m_(this,c_),m_(this,d_),m_(this,u_),this.update=(e,t)=>{f_(this,c_).style.display=e.editable?"":"none",f_(this,u_).value++},this.destroy=()=>{f_(this,d_).unmount(),f_(this,c_).remove()},g_(this,u_,wm(0));const o=document.createElement("div");o.className="milkdown-top-bar";const r=Uw(l_,{ctx:e,config:n,version:f_(this,u_)});r.mount(o),g_(this,c_,o),g_(this,d_,r);const i=t.dom.parentElement;i&&i.insertBefore(o,i.firstChild),this.update(t)}}c_=new WeakMap,d_=new WeakMap,u_=new WeakMap;const w_=md({view:()=>({update:()=>{},destroy:()=>{}})},"topBarConfig"),b_=pd(e=>{const t=e.get(w_.key);return new or({key:v_,view:t.view})});function k_(e,t,n){switch(e){case sE.CodeMirror:return((e,t={})=>{e.config(PE(sE.CodeMirror)).config(e=>{const{languages:n=[],theme:o}=t,r=[y.of(L.concat(z)),Mx];o&&r.push(o),t.extensions&&r.push(...t.extensions),e.update(eb.key,e=>{var o;return{extensions:r,languages:n,expandIcon:t.expandIcon||dE,searchIcon:t.searchIcon||SE,clearSearchIcon:t.clearSearchIcon||uE,searchPlaceholder:t.searchPlaceholder||"Search language",copyText:t.copyText||"Copy",copyIcon:t.copyIcon||fE,onCopy:t.onCopy||(()=>{}),noResultText:t.noResultText||"No result",renderLanguage:t.renderLanguage||e.renderLanguage,renderPreview:t.renderPreview||e.renderPreview,previewToggleButton:e=>{var n,o;return[(null==(n=t.previewToggleIcon)?void 0:n.call(t,e))||(e?vE:TE),(null==(o=t.previewToggleText)?void 0:o.call(t,e))||(e?"Edit":"Hide")].map(e=>e.trim()).join(" ")},previewLabel:t.previewLabel||e.previewLabel,previewLoading:t.previewLoading||e.previewLoading,previewOnlyByDefault:null!=(o=t.previewOnlyByDefault)?o:e.previewOnlyByDefault}})}).use(db)})(t,n);case sE.ListItem:return zM(t,n);case sE.LinkTooltip:return((e,t)=>{e.config(PE(sE.LinkTooltip)).config(jS).config(e=>{e.update(DN.key,e=>{var n,o,r,i,s,a;return{...e,linkIcon:null!=(n=null==t?void 0:t.linkIcon)?n:fE,editButton:null!=(o=null==t?void 0:t.editButton)?o:vE,removeButton:null!=(r=null==t?void 0:t.removeButton)?r:NE,confirmButton:null!=(i=null==t?void 0:t.confirmButton)?i:hE,inputPlaceholder:null!=(s=null==t?void 0:t.inputPlaceholder)?s:"Paste link...",onCopyLink:null!=(a=null==t?void 0:t.onCopyLink)?a:()=>{}}})}).use($S)})(t,n);case sE.ImageBlock:return((e,t)=>{e.config(PE(sE.ImageBlock)).config(e=>{e.update(aN.key,e=>{var n,o,r,i,s,a;return{uploadButton:null!=(n=null==t?void 0:t.inlineUploadButton)?n:"Upload",imageIcon:null!=(o=null==t?void 0:t.inlineImageIcon)?o:yE,confirmButton:null!=(r=null==t?void 0:t.inlineConfirmButton)?r:hE,uploadPlaceholderText:null!=(i=null==t?void 0:t.inlineUploadPlaceholderText)?i:"or paste link",onUpload:null!=(a=null!=(s=null==t?void 0:t.inlineOnUpload)?s:null==t?void 0:t.onUpload)?a:e.onUpload,proxyDomURL:null==t?void 0:t.proxyDomURL}}),e.update(Ab.key,e=>{var n,o,r,i,s,a,l,c,d;return{uploadButton:null!=(n=null==t?void 0:t.blockUploadButton)?n:"Upload file",imageIcon:null!=(o=null==t?void 0:t.blockImageIcon)?o:yE,captionIcon:null!=(r=null==t?void 0:t.blockCaptionIcon)?r:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="32"\n height="32"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M9 22a1 1 0 0 1-1-1v-3H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6.1l-3.7 3.71c-.2.19-.45.29-.7.29zm1-6v3.08L13.08 16H20V4H4v12z"\n />\n </svg>\n',confirmButton:null!=(i=null==t?void 0:t.blockConfirmButton)?i:"Confirm",captionPlaceholderText:null!=(s=null==t?void 0:t.blockCaptionPlaceholderText)?s:"Write Image Caption",uploadPlaceholderText:null!=(a=null==t?void 0:t.blockUploadPlaceholderText)?a:"or paste link",onUpload:null!=(c=null!=(l=null==t?void 0:t.blockOnUpload)?l:null==t?void 0:t.onUpload)?c:e.onUpload,proxyDomURL:null==t?void 0:t.proxyDomURL,onImageLoadError:null!=(d=null==t?void 0:t.onImageLoadError)?d:e.onImageLoadError,maxWidth:null==t?void 0:t.maxWidth,maxHeight:null==t?void 0:t.maxHeight}})}).use(tk).use(hN)})(t,n);case sE.Cursor:return((e,t)=>{if(e.config(PE(sE.Cursor)).config(e=>{e.update(qx.key,()=>{var e,n;return{class:"crepe-drop-cursor",width:null!=(e=null==t?void 0:t.width)?e:4,color:null!=(n=null==t?void 0:t.color)&&n}})}).use(Jx),!1===(null==t?void 0:t.virtual))return;const n=Zx();e.use(pd(()=>n))})(t,n);case sE.BlockEdit:return gM(t,n);case sE.Placeholder:return((e,t)=>{e.config(PE(sE.Placeholder)).config(e=>{t&&e.update(qM.key,e=>({...e,...t}))}).use(WM).use(qM)})(t,n);case sE.Toolbar:return((e,t)=>{e.config(PE(sE.Toolbar)).config(e=>{e.set(o_.key,{view:n=>new r_(e,n,t)})}).use(o_)})(t,n);case sE.Table:return((e,t)=>{e.config(PE(sE.Table)).config(e=>{e.update(dO.key,e=>({...e,renderButton:e=>{var n,o,r,i,s,a,l,c,d;switch(e){case"add_row":return null!=(n=null==t?void 0:t.addRowIcon)?n:CE;case"add_col":return null!=(o=null==t?void 0:t.addColIcon)?o:CE;case"delete_row":return null!=(r=null==t?void 0:t.deleteRowIcon)?r:NE;case"delete_col":return null!=(i=null==t?void 0:t.deleteColIcon)?i:NE;case"align_col_left":return null!=(s=null==t?void 0:t.alignLeftIcon)?s:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM4.25 16.625C4.0375 16.625 3.85942 16.5531 3.71575 16.4093C3.57192 16.2654 3.5 16.0872 3.5 15.8748C3.5 15.6621 3.57192 15.484 3.71575 15.3405C3.85942 15.1968 4.0375 15.125 4.25 15.125H13.75C13.9625 15.125 14.1406 15.1969 14.2843 15.3408C14.4281 15.4846 14.5 15.6628 14.5 15.8753C14.5 16.0879 14.4281 16.266 14.2843 16.4095C14.1406 16.5532 13.9625 16.625 13.75 16.625H4.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM4.25 8.875C4.0375 8.875 3.85942 8.80308 3.71575 8.65925C3.57192 8.51542 3.5 8.33725 3.5 8.12475C3.5 7.91208 3.57192 7.734 3.71575 7.5905C3.85942 7.44683 4.0375 7.375 4.25 7.375H13.75C13.9625 7.375 14.1406 7.44692 14.2843 7.59075C14.4281 7.73458 14.5 7.91275 14.5 8.12525C14.5 8.33792 14.4281 8.516 14.2843 8.6595C14.1406 8.80317 13.9625 8.875 13.75 8.875H4.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"\n />\n </svg>\n';case"align_col_center":return null!=(a=null==t?void 0:t.alignCenterIcon)?a:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM8.25 16.625C8.0375 16.625 7.85942 16.5531 7.71575 16.4093C7.57192 16.2654 7.5 16.0872 7.5 15.8748C7.5 15.6621 7.57192 15.484 7.71575 15.3405C7.85942 15.1968 8.0375 15.125 8.25 15.125H15.75C15.9625 15.125 16.1406 15.1969 16.2843 15.3408C16.4281 15.4846 16.5 15.6628 16.5 15.8753C16.5 16.0879 16.4281 16.266 16.2843 16.4095C16.1406 16.5532 15.9625 16.625 15.75 16.625H8.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM8.25 8.875C8.0375 8.875 7.85942 8.80308 7.71575 8.65925C7.57192 8.51542 7.5 8.33725 7.5 8.12475C7.5 7.91208 7.57192 7.734 7.71575 7.5905C7.85942 7.44683 8.0375 7.375 8.25 7.375H15.75C15.9625 7.375 16.1406 7.44692 16.2843 7.59075C16.4281 7.73458 16.5 7.91275 16.5 8.12525C16.5 8.33792 16.4281 8.516 16.2843 8.6595C16.1406 8.80317 15.9625 8.875 15.75 8.875H8.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"\n />\n </svg>\n';case"align_col_right":return null!=(l=null==t?void 0:t.alignRightIcon)?l:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25ZM10.25 8.875C10.0375 8.875 9.85942 8.80308 9.71575 8.65925C9.57192 8.51542 9.5 8.33725 9.5 8.12475C9.5 7.91208 9.57192 7.734 9.71575 7.5905C9.85942 7.44683 10.0375 7.375 10.25 7.375H19.75C19.9625 7.375 20.1406 7.44692 20.2843 7.59075C20.4281 7.73458 20.5 7.91275 20.5 8.12525C20.5 8.33792 20.4281 8.516 20.2843 8.6595C20.1406 8.80317 19.9625 8.875 19.75 8.875H10.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM10.25 16.625C10.0375 16.625 9.85942 16.5531 9.71575 16.4093C9.57192 16.2654 9.5 16.0872 9.5 15.8748C9.5 15.6621 9.57192 15.484 9.71575 15.3405C9.85942 15.1968 10.0375 15.125 10.25 15.125H19.75C19.9625 15.125 20.1406 15.1969 20.2843 15.3408C20.4281 15.4846 20.5 15.6628 20.5 15.8753C20.5 16.0879 20.4281 16.266 20.2843 16.4095C20.1406 16.5532 19.9625 16.625 19.75 16.625H10.25ZM4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25Z"\n />\n </svg>\n';case"col_drag_handle":return null!=(c=null==t?void 0:t.colDragHandleIcon)?c:gE;case"row_drag_handle":return null!=(d=null==t?void 0:t.rowDragHandleIcon)?d:gE}}}))}).use(RO)})(t,n);case sE.Latex:return FM(t,n);case sE.TopBar:return((e,t)=>{e.config(PE(sE.TopBar)).config(e=>{e.set(w_.key,{view:n=>new y_(e,n,t)})}).use(w_).use(b_)})(t,n)}}var C_,x_,N_,S_=e=>{throw TypeError(e)},O_=(e,t,n)=>t.has(e)||S_("Cannot "+n),E_=(e,t,n)=>(O_(e,t,"read from private field"),n?n.call(e):t.get(e)),M_=(e,t,n)=>t.has(e)?S_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),__=(e,t,n,o)=>(O_(e,t,"write to private field"),t.set(e,n),n);class T_{constructor({root:e,defaultValue:t=""}={}){var n;M_(this,C_),M_(this,x_),M_(this,N_,!0),this.addFeature=(e,t)=>(e(E_(this,C_),t),this),this.create=()=>E_(this,C_).create(),this.destroy=()=>E_(this,C_).destroy(),this.setReadonly=e=>(__(this,N_,!e),E_(this,C_).action(t=>{if(E_(this,C_).status===rd.Created){t.get(Yl).setProps({editable:()=>!e})}}),this),this.getMarkdown=()=>E_(this,C_).action(Cd()),this.on=e=>E_(this,C_).status!==rd.Created?(E_(this,C_).config(t=>{const n=t.get(XO);e(n)}),this):(E_(this,C_).action(t=>{const n=t.get(XO);e(n)}),this),__(this,x_,null!=(n="string"==typeof e?document.querySelector(e):e)?n:document.body),__(this,C_,id.make().config(e=>{e.inject(AE,this),e.inject(IE,[])}).config(e=>{e.set(Qc,E_(this,x_)),e.set($c,t),e.set(Yc,{editable:()=>E_(this,N_)}),e.update(KO.key,e=>({...e,size:4})),e.update(oE.key,e=>({...e,uploader:async(e,t,n)=>{const o=RE(n).get().includes(sE.ImageBlock),r=o?t.nodes["image-block"]:t.nodes.image;if(!r)return[];const i=o?n.get(Ab.key).onUpload:void 0,s=[];for(let t=0;t<e.length;t++){const n=e.item(t);n&&n.type.includes("image")&&s.push(n)}return await Promise.all(s.map(async e=>{const t=i?await i(e):URL.createObjectURL(e);return r.createAndFill({src:t})}))}}))}).use(Dp).use(QO).use(UO).use(JO).use(nE).use($O).use(iE).use(Ex))}get editor(){return E_(this,C_)}get readonly(){return!E_(this,N_)}}C_=new WeakMap,x_=new WeakMap,N_=new WeakMap;class D_ extends T_{constructor({features:e={},featureConfigs:t={},...n}={}){super(n);const o=hb(t,DE);Object.entries({...aE,...e}).filter(([,e])=>e).map(([e])=>e).forEach(e=>{const t=o[e];k_(e,this.editor,t)})}}D_.Feature=sE;const I_=new sr("nodeHighlight"),A_=new or({key:I_,state:{init:()=>wl.empty,apply(e,t){const n=e.getMeta(I_);if(n){if("clear"in n)return wl.empty;const t=n.ranges.map(({from:e,to:t})=>gl.node(e,t,{class:n.className}));return wl.create(e.doc,t)}return t.map(e.mapping,e.doc)}},props:{decorations:e=>I_.getState(e)}}),R_=m.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),P_=(t,n)=>async(i,s)=>{const a=[];for(let e=0;e<i.length;e++){const t=i.item(e);t&&(t.type.includes("image/")&&a.push(t))}t(o.LOADING);const l=await Promise.all(a.map(async t=>{const{status:i,message:a,content:l}=await Je(t,!1);return i===o.SUCCESS&&s?.nodes?.image?(n({type:r.SUCCESS,message:e(xe,{children:a})}),s.nodes.image.createAndFill({src:l.imageUrl,alt:t.name})):(n({type:r.ERROR,message:e(xe,{children:a})}),null)}));return t(o.SUCCESS),l},L_=h.define({token:e=>(e.skipToEnd(),null)}),V_=new p(L_),j_=[u.of({..._d.find(e=>"C"===e.name),name:a.C.toLowerCase(),load:()=>import("./index-CtTbnbzM.js").then(e=>e.cpp())}),u.of({..._d.find(e=>"C"===e.name),name:a.C.toLowerCase()+`/${se.EDITOR}`,load:()=>import("./index-CtTbnbzM.js").then(e=>e.cpp())}),u.of({..._d.find(e=>"C++"===e.name),name:a.CPP.toLowerCase(),load:()=>import("./index-CtTbnbzM.js").then(e=>e.cpp())}),u.of({..._d.find(e=>"C++"===e.name),name:a.CPP.toLowerCase()+`/${se.EDITOR}`,load:()=>import("./index-CtTbnbzM.js").then(e=>e.cpp())}),u.of({..._d.find(e=>"Java"===e.name),name:a.JAVA.toLowerCase(),load:()=>import("./index-CRfRlH9U.js").then(e=>e.java())}),u.of({..._d.find(e=>"Java"===e.name),name:a.JAVA.toLowerCase()+`/${se.EDITOR}`,load:()=>import("./index-CRfRlH9U.js").then(e=>e.java())}),u.of({..._d.find(e=>"Python"===e.name),name:a.PYTHON.toLowerCase(),load:()=>import("./index-B3fb7Ita.js").then(e=>e.python())}),u.of({..._d.find(e=>"Python"===e.name),name:a.PYTHON.toLowerCase()+`/${se.EDITOR}`,load:()=>import("./index-B3fb7Ita.js").then(e=>e.python())}),u.of({..._d.find(e=>"JavaScript"===e.name),name:a.JAVASCRIPT.toLowerCase(),load:()=>import("./index-DSGuayJy.js").then(e=>e.javascript())}),u.of({..._d.find(e=>"JavaScript"===e.name),name:a.JAVASCRIPT.toLowerCase()+`/${se.EDITOR}`,load:()=>import("./index-DSGuayJy.js").then(e=>e.javascript())}),u.of({..._d.find(e=>"TypeScript"===e.name),name:a.TYPESCRIPT.toLowerCase(),load:()=>import("./index-DSGuayJy.js").then(e=>e.javascript({typescript:!0}))}),u.of({..._d.find(e=>"JSX"===e.name),name:a.JSX.toLowerCase(),load:()=>import("./index-DSGuayJy.js").then(e=>e.javascript({jsx:!0}))}),u.of({name:a.MDX.toLowerCase(),alias:["mdx"],extensions:["mdx"],load:()=>Promise.all([import("./index-Bw2EofiE.js"),import("./index-DSGuayJy.js")]).then(([{markdown:e},{javascript:t}])=>e({codeLanguages:[u.of({name:"javascript",load:async()=>t({jsx:!0})})]}))}),u.of({..._d.find(e=>"TSX"===e.name),name:a.TSX.toLowerCase(),load:()=>import("./index-DSGuayJy.js").then(e=>e.javascript({typescript:!0,jsx:!0}))}),u.of({..._d.find(e=>"HTML"===e.name),name:a.HTML.toLowerCase(),load:()=>import("./index-xaEdDd13.js").then(e=>e.html())}),u.of({..._d.find(e=>"JSON"===e.name),name:a.JSON.toLowerCase(),load:()=>import("./index-QhLowdpF.js").then(e=>e.json())}),u.of({..._d.find(e=>"Markdown"===e.name),name:a.MARKDOWN.toLowerCase(),load:()=>import("./index-Bw2EofiE.js").then(e=>e.markdown())}),u.of({..._d.find(e=>"LaTeX"===e.name),name:a.LATEX.toLowerCase(),support:new p(h.define(Dd))}),u.of({name:a.DOT.toLowerCase(),alias:["dot"],extensions:["dot"],load:()=>import("./index-BzjjAmh3.js").then(e=>e.dot())}),u.of({name:a.DOT.toLowerCase()+`/${se.IMAGE}`,alias:["dot"],extensions:["dot"],load:()=>import("./index-BzjjAmh3.js").then(e=>e.dot())}),u.of({name:a.MERMAID.toLowerCase(),alias:["mmd"],extensions:["mmd"],load:()=>import("./index-A0sdG_JC.js").then(e=>e.mermaid())}),u.of({name:a.MERMAID.toLowerCase()+`/${se.IMAGE}`,alias:["mmd"],extensions:["mmd"],load:()=>import("./index-A0sdG_JC.js").then(e=>e.mermaid())}),u.of({name:a.BASH.toLowerCase(),alias:["bash","sh","shell"],extensions:["sh","bash"],load:()=>import("./shell-BLav31RL.js").then(e=>new p(h.define(e.shell)))}),u.of({name:a.TEXT.toLowerCase(),alias:["plaintext"],extensions:["txt","text"],support:V_})];function $_(e){let t=e.replace(/\n{3,}/g,"\n\n");return t=t.replace(/&#x20;/gi," "),t.replace(/\n+$/g,"")+"\n"}const B_=ge(function({value:t,onChange:a,setLoader:c},d){const u=we(a),{addNotification:p}=be(),h=ke(e=>e.user.settings[n.THEME]),f=le(t),m=de(()=>t===f.current?0:Date.now(),[t]),g=Ce(e=>e.i18n.t),{get:v}=function(e,t=[]){const n=pe(xd),o=he(e,t);return fe(()=>{n.setEditorFactory(()=>o)},[n,o]),{loading:n.loading,get:()=>n.editor.current}}(n=>new D_({root:n,defaultValue:t,featureConfigs:{[D_.Feature.BlockEdit]:{blockHandle:{floatingUIOptions:{strategy:"fixed"}}},[D_.Feature.CodeMirror]:{renderLanguage(e,t){const[n,o]=e.split("/");return(t?"✔ ":"")+(i[n.toUpperCase()]?.label??n)+g(o===se.EDITOR?" (render as code editor)":o===se.IMAGE?" (render as image)":"")},searchPlaceholder:"Find a language...",noResultText:"No language found"},[D_.Feature.ImageBlock]:{async onUpload(t){c(o.LOADING);const{status:n,message:i,content:s}=await Je(t,!1);return n===o.SUCCESS?(p({type:r.SUCCESS,message:e(xe,{children:i})}),c(o.SUCCESS),s.imageUrl):(p({type:r.ERROR,message:e(xe,{children:i})}),c(o.ERROR),"")},inlineUploadPlaceholderText:"???"}}}).editor.use(QO).use(iE).use(Jx).use(nE).config(e=>{e.get(XO).markdownUpdated((e,t,n)=>{const o=$_(t);o!==$_(n)&&(u.current?.(o),f.current=o)}),e.update(oE.key,e=>({...e,uploader:P_(c,p),uploadWidgetFactory:(e,t)=>{const n=document.createElement("span");return gl.widget(e,n,t)}})),e.update(eb.key,e=>({...e,languages:j_,extensions:[q(),...h===s.DARK?[F]:[R_]],previewToggleButton:()=>"edit",renderPreview:(e,t)=>{const[n,o]=e.split("/");return"latex"===n?.toLowerCase()&&t.length>0?function(e){return re.renderToString(e,{throwOnError:!1,displayMode:!0})}(t):"mermaid"===n?.toLowerCase()&&o===se.IMAGE&&t.length>0?function(e){if("undefined"!=typeof document){const t=document.createElement("div");return t.className="mermaid",t.innerHTML=e,setTimeout(()=>Ge.run({querySelector:".mermaid"}),0),t}return null}(t):o===se.IMAGE&&t.length>0?function(e,t){if("undefined"!=typeof document){const n=document.createElement("div"),o=l();n.id=o;const r=document.createElement("div");return r.textContent=t("loading graph"),r.style.fontStyle="italic",n.appendChild(r),Ke().then(n=>{try{const t=document.getElementById(o);t&&(t.innerHTML="",e.split("---").map(e=>{const o=n.renderSVGElement(e,{});t.appendChild(o)}))}catch(e){const n=document.getElementById(o);if(n){n.innerHTML="";const o=document.createElement("div");o.textContent=`${t("error rendering graph")}: ${e?.message||e}`,o.style.color="red",o.style.whiteSpace="pre-wrap",n.appendChild(o)}}}).catch(e=>{const n=document.getElementById(o);if(n){n.innerHTML="";const o=document.createElement("div");o.textContent=`${t("error initializing Viz.js")}: ${e?.message||e}`,o.style.color="red",n.appendChild(o)}}),n}return null}(t,g):null}})),e.set(lc,{bullet:"-",rule:"-"}),e.update(eE.key,e=>({...e,shouldAppend:()=>!1})),e.update(oc,e=>[...e,A_])}),[m,h,g]);return ve(d,()=>({getSelectionMarkdown:()=>{const e=v();return e?e.action(e=>{const t=e.get(Yl),n=e.get(Vc),o=e.get(fc),{from:r,to:i,empty:s}=t.state.selection;if(s)return"";const a=t.state.doc.resolve(r),l=t.state.doc.resolve(i),c=a.depth>=1?a.before(1):0,d=l.depth>=1?l.after(1):t.state.doc.content.size,u=t.state.doc.slice(c,d);return n(o.node("doc",null,u.content))})??"":""},replaceSelectionWithMarkdown:e=>{const t=v();t&&t.action(t=>{const n=t.get(Yl),o=t.get(Dc),{from:r,to:i}=n.state.selection,s=n.state.doc.resolve(r),a=n.state.doc.resolve(i),l=s.depth>=1?s.before(1):0,c=a.depth>=1?a.after(1):n.state.doc.content.size,d=o(e);n.dispatch(n.state.tr.replaceWith(l,c,d.content))})},highlightSelectionNodes:e=>{const t=v();t&&t.action(t=>{const n=t.get(Yl),{from:o,to:r,empty:i}=n.state.selection;if(i)return;const s=n.state.doc.resolve(o),a=n.state.doc.resolve(r),l=s.depth>=1?s.before(1):0,c=a.depth>=1?a.after(1):n.state.doc.content.size,d=[];n.state.doc.nodesBetween(l,c,(e,t,o)=>o!==n.state.doc||(d.push({from:t,to:t+e.nodeSize}),!1));const u={ranges:d,className:e};n.dispatch(n.state.tr.setMeta(I_,u))})},clearHighlight:()=>{const e=v();e&&e.action(e=>{const t=e.get(Yl);t.dispatch(t.state.tr.setMeta(I_,{clear:!0}))})}}),[v]),e("div",{className:"jk-md-math-milkdown-editor jk-md-math wh-100 pn-re jk-br-ie",children:e(Nd,{})})});function H_(t){const{value:n,onChange:i,setLoader:s,enableImageUpload:a}=t,l=le(null),{addNotification:c}=be();return e("div",{className:"jk-br-ie",onPaste:a?async t=>{const n=t.clipboardData?.items;if(n){const a=[];for(const e of n)if("file"===e.kind){const t=e.getAsFile();t&&t.type.startsWith("image/")&&a.push(t)}if(a.length>0){t.stopPropagation(),t.preventDefault();let n="";s(o.LOADING);for(const t of a){const{status:i,message:s,content:a}=await Je(t,!1);i===o.SUCCESS?(c({type:r.SUCCESS,message:e(xe,{children:s})}),n+=(n?"\n\n":"")+`![image alt](${a.imageUrl})`):c({type:r.ERROR,message:e(xe,{children:s})})}s(o.NONE),(e=>{const t=l.current;if(!t)return;const n=t.selectionStart,o=t.selectionEnd,r=l.current?.value??"",s=r.substring(0,n)+e+r.substring(o);i?.(s),setTimeout(()=>{t.selectionStart=t.selectionEnd=n+e.length},0)})(n)}}}:void 0,children:e(Ne,{ref:l,value:n,onChange:e=>{i?.(e)}})})}var F_;!function(e){e.WYSIWYG="WYSIWYG",e.TEXT_PLAIN="TEXT_PLAIN"}(F_||(F_={}));const z_=ye(function({enableDownload:t,enableTextPlain:n,setMode:o,mode:r}){const[,i]=Od(),s=de(()=>[...n?[{icon:r===F_.TEXT_PLAIN?e(Te,{size:"tiny",onClick:()=>o(F_.WYSIWYG),"data-tooltip-id":"jk-tooltip","data-tooltip-content":"WYSIWYG","data-tooltip-place":"left"}):e(De,{size:"tiny",onClick:()=>o(F_.TEXT_PLAIN),"data-tooltip-id":"jk-tooltip","data-tooltip-content":"view as text plain","data-tooltip-place":"left"})}]:[],...t?[{icon:e(Ie,{size:"tiny"}),buttons:[{icon:e(Ie,{size:"tiny"}),label:e(xe,{children:"md"}),onClick:()=>Me(new Blob([i()?.action(Cd())??""],{type:"text/plain"}),"file.md")}]}]:[]],[t,n,i,r,o]);return e(Se,{actionButtons:s,offset:4})});function q_({mode:t}){const[n,o]=Od(),[r,i]=ce(!1);return e(Oe,{isOpen:r,onClose:()=>i(!1),copyButtons:!0,onPickImageUrl:({imageUrl:e})=>{if(t===F_.TEXT_PLAIN);else if(t===F_.WYSIWYG){if(n)return;const t=o();if(!t)return;t.action(function(e,t=!1){return n=>{const o=n.get(Yl),r=n.get(Dc)(e);if(!r)return;if(!t){const e=o.state.selection.content();return o.dispatch(o.state.tr.replaceSelection(new Kt(r.content,e.openStart,e.openEnd)).scrollIntoView())}const i=n.get(fc),s=zn.fromSchema(i).serializeFragment(r.content),a=An.fromSchema(i).parseSlice(s),l=mi(a);l?o.dispatch(o.state.tr.replaceSelectionWith(l,!0)):o.dispatch(o.state.tr.replaceSelection(a))}}(`![image](${e})`)),i(!1)}}})}const W_=()=>{const[e,t]=Od();return me(()=>{if(!e){const e=t();e&&e.action(e=>{e.get(Yl).focus()})}},[e,t]),null},U_=ge(function(n,r){const{value:i,onChange:s,className:a,enableTextPlain:l=!1,enableDownload:c=!1,enableImageUpload:d=!1,onBlur:u}=n,[p,h]=ce(o.NONE),[f,m]=ce(F_.WYSIWYG),g=le(null);ve(r,()=>({getSelectionMarkdown:()=>g.current?.getSelectionMarkdown()??"",replaceSelectionWithMarkdown:e=>g.current?.replaceSelectionWithMarkdown(e),highlightSelectionNodes:e=>g.current?.highlightSelectionNodes(e),clearHighlight:()=>g.current?.clearHighlight()}),[]);const v=le(null),y=we(u);return me(()=>{function e(e){v.current&&!v.current.contains?.(e.target)&&y.current?.()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[v,y]),e(Sd,{children:t("div",{ref:v,className:Ee("jk-md-math-editor wh-100 pn-re",a),onBlur:u,children:[!!u&&e(W_,{}),p===o.LOADING&&e(_e,{}),p===o.LOADING&&t("div",{className:"jk-loader-layer pn-ae jk-col",children:[e("div",{className:"jk-loader-layer pn-ae jk-overlay-backdrop",style:{opacity:.8,zIndex:1}}),e("div",{className:"jk-row",style:{zIndex:1,position:"sticky",margin:"0 auto",top:0,bottom:"50%",transform:"translate(0, 100%)"},children:t("div",{className:"jk-row bc-sf-md jk-pg-sm jk-br-ie",style:{alignItems:"baseline"},children:[e(xe,{className:"tt-se",children:"uploading images"}),"  ",e("div",{className:"dot-flashing"})]})})]}),e(z_,{enableTextPlain:l,enableDownload:c,setMode:m,mode:f}),e(q_,{mode:f}),f===F_.WYSIWYG&&e(B_,{ref:g,value:i,onChange:s,setLoader:h,enableImageUpload:d}),f===F_.TEXT_PLAIN&&e(H_,{value:i,onChange:s,setLoader:h,enableImageUpload:d})]})})});export{U_ as default};