react-reason-editor 1.0.24

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 (871) hide show
  1. package/README.md +225 -0
  2. package/dist/ActionMenuButton-BGj7ODjl.cjs +1 -0
  3. package/dist/ActionMenuButton-DHYJFTev.js +2 -0
  4. package/dist/Attachment-DGzsbPZZ.js +4 -0
  5. package/dist/Attachment.cjs +1 -0
  6. package/dist/Attachment.js +1 -0
  7. package/dist/Blockquote-CQ6HlDnL.js +2 -0
  8. package/dist/Blockquote.cjs +1 -0
  9. package/dist/Blockquote.js +1 -0
  10. package/dist/Bold-Ciuvp1pM.js +2 -0
  11. package/dist/Bold-M6IKTPME.cjs +1 -0
  12. package/dist/Bold.cjs +1 -0
  13. package/dist/Bold.js +1 -0
  14. package/dist/BulletList.cjs +1 -0
  15. package/dist/BulletList.js +1 -0
  16. package/dist/Callout-DOHjjQtT.cjs +1 -0
  17. package/dist/Callout-heY7R-Zu.js +11 -0
  18. package/dist/Callout.cjs +1 -0
  19. package/dist/Callout.js +1 -0
  20. package/dist/Clear.cjs +1 -0
  21. package/dist/Clear.js +1 -0
  22. package/dist/Code-B17BQJf-.js +1 -0
  23. package/dist/Code-BsD1D1sK.cjs +1 -0
  24. package/dist/Code.cjs +1 -0
  25. package/dist/Code.js +1 -0
  26. package/dist/CodeBlock-B7Wklup8.js +1 -0
  27. package/dist/CodeBlock-D2OKvGCF.cjs +1 -0
  28. package/dist/CodeBlock.cjs +1 -0
  29. package/dist/CodeBlock.js +1 -0
  30. package/dist/CodeView.cjs +1 -0
  31. package/dist/CodeView.js +1 -0
  32. package/dist/Color-BxzxtvJH.cjs +1 -0
  33. package/dist/Color-VWGwmpsG.js +5 -0
  34. package/dist/Color.cjs +1 -0
  35. package/dist/Color.js +1 -0
  36. package/dist/Column-D4FgAp5K.js +1 -0
  37. package/dist/Column-I4gS_xKw.cjs +1 -0
  38. package/dist/Column.cjs +1 -0
  39. package/dist/Column.js +1 -0
  40. package/dist/Comment-DEtjWTFF.js +14 -0
  41. package/dist/Comment-DaHgAu2h.cjs +1 -0
  42. package/dist/Comment.cjs +1 -0
  43. package/dist/Comment.js +1 -0
  44. package/dist/Drawer-Dunw22Q1.js +63 -0
  45. package/dist/Drawer-DxCO6TBr.cjs +1 -0
  46. package/dist/Drawer.cjs +1 -0
  47. package/dist/Drawer.js +1 -0
  48. package/dist/Drawio-Bx8zt_CW.cjs +1 -0
  49. package/dist/Drawio-eqEGDkwW.js +6 -0
  50. package/dist/Drawio.cjs +1 -0
  51. package/dist/Drawio.js +1 -0
  52. package/dist/Emoji-BU-itkPp.js +12 -0
  53. package/dist/Emoji.cjs +1 -0
  54. package/dist/Emoji.js +1 -0
  55. package/dist/ExportPdf-DPeFg2GG.js +1 -0
  56. package/dist/ExportPdf.cjs +1 -0
  57. package/dist/ExportPdf.js +1 -0
  58. package/dist/ExportWord-TFEb3HXz.js +1 -0
  59. package/dist/ExportWord.cjs +1 -0
  60. package/dist/ExportWord.js +1 -0
  61. package/dist/FontFamily.cjs +1 -0
  62. package/dist/FontFamily.js +2 -0
  63. package/dist/FontSize.cjs +1 -0
  64. package/dist/FontSize.js +8 -0
  65. package/dist/Harper-1cMMY1sx.cjs +1 -0
  66. package/dist/Harper-BMTF3gpj.js +1 -0
  67. package/dist/Harper.cjs +1 -0
  68. package/dist/Harper.js +1 -0
  69. package/dist/Heading-YSJHyWCU.js +2 -0
  70. package/dist/Heading.cjs +1 -0
  71. package/dist/Heading.js +1 -0
  72. package/dist/Highlight-BeqLxfbY.cjs +1 -0
  73. package/dist/Highlight-OkaWwhRk.js +5 -0
  74. package/dist/Highlight.cjs +1 -0
  75. package/dist/Highlight.js +1 -0
  76. package/dist/History-C6yBYB2w.js +1 -0
  77. package/dist/History.cjs +1 -0
  78. package/dist/History.js +1 -0
  79. package/dist/HorizontalRule-kAw8TV0V.js +1 -0
  80. package/dist/HorizontalRule.cjs +1 -0
  81. package/dist/HorizontalRule.js +1 -0
  82. package/dist/Icon-CJJ9AQtR.js +1 -0
  83. package/dist/Icon-DQdA22_-.cjs +1 -0
  84. package/dist/Iframe-B-0W9YYq.js +2 -0
  85. package/dist/Iframe-DS5N9EFx.cjs +1 -0
  86. package/dist/Iframe.cjs +1 -0
  87. package/dist/Iframe.js +1 -0
  88. package/dist/Image.cjs +1 -0
  89. package/dist/Image.js +1 -0
  90. package/dist/ImageCropper-BAWOk69J.cjs +1 -0
  91. package/dist/ImageCropper-Dlz4nJQu.js +11 -0
  92. package/dist/ImageGif-CWfgVc6e.cjs +1 -0
  93. package/dist/ImageGif-D5Qw_Xf-.js +3 -0
  94. package/dist/ImageGif.cjs +1 -0
  95. package/dist/ImageGif.js +1 -0
  96. package/dist/ImportWord-BCcs3dYp.js +1 -0
  97. package/dist/ImportWord.cjs +1 -0
  98. package/dist/ImportWord.js +1 -0
  99. package/dist/Indent-6tc8tB62.cjs +1 -0
  100. package/dist/Indent-DpTPoZMk.js +1 -0
  101. package/dist/Indent.cjs +1 -0
  102. package/dist/Indent.js +1 -0
  103. package/dist/Italic-Brjxxqsi.cjs +1 -0
  104. package/dist/Italic-CZkbT3Dd.js +1 -0
  105. package/dist/Italic.cjs +1 -0
  106. package/dist/Italic.js +1 -0
  107. package/dist/Katex-Bo_vfXrd.js +10 -0
  108. package/dist/Katex-D_vF5gsD.cjs +1 -0
  109. package/dist/Katex.cjs +1 -0
  110. package/dist/Katex.js +1 -0
  111. package/dist/LineHeight.cjs +1 -0
  112. package/dist/LineHeight.js +1 -0
  113. package/dist/Link-C0cNnjXo.js +6 -0
  114. package/dist/Link.cjs +1 -0
  115. package/dist/Link.js +1 -0
  116. package/dist/LinkEditBlock-Or1HIYih.cjs +1 -0
  117. package/dist/MarkdownPaste-C5jQ33SR.js +1 -0
  118. package/dist/MarkdownPaste.cjs +1 -0
  119. package/dist/MarkdownPaste.js +1 -0
  120. package/dist/Mention-DEkbeL04.js +1 -0
  121. package/dist/Mention.cjs +1 -0
  122. package/dist/Mention.js +1 -0
  123. package/dist/Mermaid-BB15qd24.cjs +1 -0
  124. package/dist/Mermaid-DxpFRVu0.js +5 -0
  125. package/dist/Mermaid.cjs +1 -0
  126. package/dist/Mermaid.js +1 -0
  127. package/dist/MoreMark-CXudh2cm.js +3 -0
  128. package/dist/MoreMark.cjs +1 -0
  129. package/dist/MoreMark.js +1 -0
  130. package/dist/OfficePaste-BmPshTAb.js +1 -0
  131. package/dist/OfficePaste-Day0T6Ox.cjs +1 -0
  132. package/dist/OfficePaste.cjs +1 -0
  133. package/dist/OfficePaste.js +1 -0
  134. package/dist/OrderedList.cjs +1 -0
  135. package/dist/OrderedList.js +1 -0
  136. package/dist/Pagination-B8rfYYi_.js +1 -0
  137. package/dist/Pagination-yjRu_qJK.cjs +1 -0
  138. package/dist/Pagination.cjs +1 -0
  139. package/dist/Pagination.js +1 -0
  140. package/dist/SearchAndReplace.cjs +1 -0
  141. package/dist/SearchAndReplace.js +11 -0
  142. package/dist/SlashCommand-8LkH8bHy.js +1 -0
  143. package/dist/SlashCommand.cjs +1 -0
  144. package/dist/SlashCommand.js +1 -0
  145. package/dist/Strike-BsMuOhxs.js +1 -0
  146. package/dist/Strike.cjs +1 -0
  147. package/dist/Strike.js +1 -0
  148. package/dist/Table-B4KNW7Yq.cjs +1 -0
  149. package/dist/Table-C9t-k9Qu.js +3 -0
  150. package/dist/Table.cjs +1 -0
  151. package/dist/Table.js +1 -0
  152. package/dist/TableOfContents.cjs +1 -0
  153. package/dist/TableOfContents.js +1 -0
  154. package/dist/TaskList.cjs +1 -0
  155. package/dist/TaskList.js +1 -0
  156. package/dist/TextAlign-6ElUYI4_.cjs +1 -0
  157. package/dist/TextAlign-C75gn_OM.js +1 -0
  158. package/dist/TextAlign.cjs +1 -0
  159. package/dist/TextAlign.js +1 -0
  160. package/dist/TextDirection.cjs +1 -0
  161. package/dist/TextDirection.js +1 -0
  162. package/dist/TextUnderline-BaV7bhwo.js +1 -0
  163. package/dist/TextUnderline-ofstnQx_.cjs +1 -0
  164. package/dist/TextUnderline.cjs +1 -0
  165. package/dist/TextUnderline.js +1 -0
  166. package/dist/Twitter-D5UNfT-K.js +5 -0
  167. package/dist/Twitter-DyrQT0n4.cjs +1 -0
  168. package/dist/Twitter.cjs +1 -0
  169. package/dist/Twitter.js +1 -0
  170. package/dist/Video-BSH5k6Jd.cjs +1 -0
  171. package/dist/Video-_YlAC2R_.js +5 -0
  172. package/dist/Video.cjs +1 -0
  173. package/dist/Video.js +1 -0
  174. package/dist/WordCount.cjs +1 -0
  175. package/dist/WordCount.js +2 -0
  176. package/dist/app-hooks/use-mobile.d.ts +5 -0
  177. package/dist/app-hooks/useDocumentSync.d.ts +27 -0
  178. package/dist/app-hooks/useLocalStorage.d.ts +11 -0
  179. package/dist/app-theme/theme-dropdown.d.ts +1 -0
  180. package/dist/app-types/document.d.ts +81 -0
  181. package/dist/app-types/fileSource.d.ts +124 -0
  182. package/dist/app-types/team.d.ts +52 -0
  183. package/dist/app-types/toc.d.ts +2 -0
  184. package/dist/app-ui/FileTypeIcon.d.ts +11 -0
  185. package/dist/app-ui/alert-dialog.d.ts +14 -0
  186. package/dist/app-ui/avatar.d.ts +6 -0
  187. package/dist/app-ui/badge.d.ts +13 -0
  188. package/dist/app-ui/breadcrumb.d.ts +15 -0
  189. package/dist/app-ui/button.d.ts +15 -0
  190. package/dist/app-ui/context-menu.d.ts +28 -0
  191. package/dist/app-ui/dialog.d.ts +15 -0
  192. package/dist/app-ui/dropdown-menu.d.ts +25 -0
  193. package/dist/app-ui/input.d.ts +7 -0
  194. package/dist/app-ui/label.d.ts +4 -0
  195. package/dist/app-ui/radio-group.d.ts +5 -0
  196. package/dist/app-ui/scroll-area.d.ts +5 -0
  197. package/dist/app-ui/select.d.ts +13 -0
  198. package/dist/app-ui/separator.d.ts +4 -0
  199. package/dist/app-ui/sheet.d.ts +13 -0
  200. package/dist/app-ui/sidebar.d.ts +70 -0
  201. package/dist/app-ui/skeleton.d.ts +3 -0
  202. package/dist/app-ui/switch.d.ts +4 -0
  203. package/dist/app-ui/tabs.d.ts +7 -0
  204. package/dist/app-ui/textarea.d.ts +7 -0
  205. package/dist/app-ui/tooltip.d.ts +7 -0
  206. package/dist/app-ui/tree.d.ts +19 -0
  207. package/dist/app-ui/visually-hidden.d.ts +6 -0
  208. package/dist/app-utils/file-sources/sources.d.ts +37 -0
  209. package/dist/app-utils/utils.d.ts +1 -0
  210. package/dist/bubble---c27x7L.js +80 -0
  211. package/dist/bubble.cjs +1 -0
  212. package/dist/bubble.d.ts +4 -0
  213. package/dist/bubble.js +1 -0
  214. package/dist/button-CXcuJkiM.js +1 -0
  215. package/dist/button-CYMsgP3Y.cjs +1 -0
  216. package/dist/cdn-loader-D76eUWN7.cjs +1 -0
  217. package/dist/cdn-loader-w67sLKk9.js +1 -0
  218. package/dist/checkbox-BtMvSk4V.cjs +1 -0
  219. package/dist/checkbox-zfuPZBhD.js +1 -0
  220. package/dist/comments/CommentsSidebar.d.ts +14 -0
  221. package/dist/comments/commentMarks.d.ts +40 -0
  222. package/dist/comments/useCommentThreads.d.ts +29 -0
  223. package/dist/components/ActionButton.d.ts +23 -0
  224. package/dist/components/ActionMenuButton.d.ts +28 -0
  225. package/dist/components/Bubble/RichTextBubbleCallout.d.ts +4 -0
  226. package/dist/components/Bubble/RichTextBubbleCodeBlock.d.ts +4 -0
  227. package/dist/components/Bubble/RichTextBubbleColumns.d.ts +4 -0
  228. package/dist/components/Bubble/RichTextBubbleDrawer.d.ts +4 -0
  229. package/dist/components/Bubble/RichTextBubbleDrawio.d.ts +4 -0
  230. package/dist/components/Bubble/RichTextBubbleIframe.d.ts +4 -0
  231. package/dist/components/Bubble/RichTextBubbleKatex.d.ts +2 -0
  232. package/dist/components/Bubble/RichTextBubbleLink.d.ts +6 -0
  233. package/dist/components/Bubble/RichTextBubbleMedia.d.ts +7 -0
  234. package/dist/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +2 -0
  235. package/dist/components/Bubble/RichTextBubbleMermaid.d.ts +4 -0
  236. package/dist/components/Bubble/RichTextBubbleTable.d.ts +8 -0
  237. package/dist/components/Bubble/RichTextBubbleText.d.ts +8 -0
  238. package/dist/components/Bubble/RichTextBubbleTwitter.d.ts +4 -0
  239. package/dist/components/Bubble/formatBubble.d.ts +55 -0
  240. package/dist/components/Bubble/index.d.ts +17 -0
  241. package/dist/components/ColorPicker.d.ts +11 -0
  242. package/dist/components/ReactBus.d.ts +11 -0
  243. package/dist/components/RichTextProvider.d.ts +8 -0
  244. package/dist/components/SizeSetter/SizeSetter.d.ts +16 -0
  245. package/dist/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +4 -0
  246. package/dist/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +4 -0
  247. package/dist/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +6 -0
  248. package/dist/components/ToolbarMenuItem.d.ts +15 -0
  249. package/dist/components/icons/Activity.d.ts +3 -0
  250. package/dist/components/icons/Animas.d.ts +3 -0
  251. package/dist/components/icons/AspectRatio.d.ts +2 -0
  252. package/dist/components/icons/Blockquote.d.ts +2 -0
  253. package/dist/components/icons/CodeView.d.ts +4 -0
  254. package/dist/components/icons/ColumnAddLeft.d.ts +4 -0
  255. package/dist/components/icons/ColumnAddRight.d.ts +4 -0
  256. package/dist/components/icons/DeleteColumn.d.ts +5 -0
  257. package/dist/components/icons/DeleteRow.d.ts +5 -0
  258. package/dist/components/icons/Direction.d.ts +4 -0
  259. package/dist/components/icons/Drawio.d.ts +4 -0
  260. package/dist/components/icons/ExportPdf.d.ts +4 -0
  261. package/dist/components/icons/ExportWord.d.ts +3 -0
  262. package/dist/components/icons/FileWordOutline.d.ts +2 -0
  263. package/dist/components/icons/Flag.d.ts +3 -0
  264. package/dist/components/icons/Food.d.ts +3 -0
  265. package/dist/components/icons/GIfIcon.d.ts +4 -0
  266. package/dist/components/icons/Html.d.ts +4 -0
  267. package/dist/components/icons/Icon.d.ts +8 -0
  268. package/dist/components/icons/IconColorFill.d.ts +8 -0
  269. package/dist/components/icons/IconHighlightFill.d.ts +6 -0
  270. package/dist/components/icons/ImportWord.d.ts +3 -0
  271. package/dist/components/icons/LeftToRight.d.ts +4 -0
  272. package/dist/components/icons/LineHeight.d.ts +2 -0
  273. package/dist/components/icons/MenuDown.d.ts +2 -0
  274. package/dist/components/icons/Mermaid.d.ts +4 -0
  275. package/dist/components/icons/NoFill.d.ts +4 -0
  276. package/dist/components/icons/Object.d.ts +3 -0
  277. package/dist/components/icons/RightToLeft.d.ts +4 -0
  278. package/dist/components/icons/SizeL.d.ts +2 -0
  279. package/dist/components/icons/SizeM.d.ts +2 -0
  280. package/dist/components/icons/SizeS.d.ts +2 -0
  281. package/dist/components/icons/Symbol.d.ts +3 -0
  282. package/dist/components/icons/Travel.d.ts +3 -0
  283. package/dist/components/icons/Twitter.d.ts +4 -0
  284. package/dist/components/icons/icons.d.ts +4 -0
  285. package/dist/components/icons/index.d.ts +15 -0
  286. package/dist/components/index.d.ts +10 -0
  287. package/dist/components/ui/FileTypeIcon.d.ts +11 -0
  288. package/dist/components/ui/alert-dialog.d.ts +14 -0
  289. package/dist/components/ui/avatar.d.ts +6 -0
  290. package/dist/components/ui/badge.d.ts +13 -0
  291. package/dist/components/ui/breadcrumb.d.ts +15 -0
  292. package/dist/components/ui/button.d.ts +11 -0
  293. package/dist/components/ui/card.d.ts +13 -0
  294. package/dist/components/ui/checkbox.d.ts +7 -0
  295. package/dist/components/ui/context-menu.d.ts +28 -0
  296. package/dist/components/ui/dialog.d.ts +22 -0
  297. package/dist/components/ui/dropdown-menu.d.ts +30 -0
  298. package/dist/components/ui/emoji-picker.d.ts +22 -0
  299. package/dist/components/ui/index.d.ts +33 -0
  300. package/dist/components/ui/input.d.ts +8 -0
  301. package/dist/components/ui/label.d.ts +8 -0
  302. package/dist/components/ui/popover.d.ts +9 -0
  303. package/dist/components/ui/radio-group.d.ts +5 -0
  304. package/dist/components/ui/scroll-area.d.ts +5 -0
  305. package/dist/components/ui/select.d.ts +16 -0
  306. package/dist/components/ui/separator.d.ts +7 -0
  307. package/dist/components/ui/sheet.d.ts +13 -0
  308. package/dist/components/ui/sidebar.d.ts +70 -0
  309. package/dist/components/ui/skeleton.d.ts +3 -0
  310. package/dist/components/ui/switch.d.ts +7 -0
  311. package/dist/components/ui/tabs.d.ts +10 -0
  312. package/dist/components/ui/textarea.d.ts +8 -0
  313. package/dist/components/ui/toast.d.ts +18 -0
  314. package/dist/components/ui/toaster.d.ts +4 -0
  315. package/dist/components/ui/toggle.d.ts +15 -0
  316. package/dist/components/ui/tooltip.d.ts +7 -0
  317. package/dist/components/ui/tree.d.ts +19 -0
  318. package/dist/components/ui/use-toast.d.ts +47 -0
  319. package/dist/components/ui/visually-hidden.d.ts +6 -0
  320. package/dist/constants/index.d.ts +50 -0
  321. package/dist/constants/resetCSS.d.ts +4 -0
  322. package/dist/demo/alternatives.html +23 -0
  323. package/dist/demo/assets/BinaryModule-DTTQwokQ-8eah-8sx.js +4 -0
  324. package/dist/demo/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  325. package/dist/demo/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  326. package/dist/demo/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  327. package/dist/demo/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  328. package/dist/demo/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  329. package/dist/demo/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  330. package/dist/demo/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  331. package/dist/demo/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  332. package/dist/demo/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  333. package/dist/demo/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  334. package/dist/demo/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  335. package/dist/demo/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  336. package/dist/demo/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  337. package/dist/demo/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  338. package/dist/demo/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  339. package/dist/demo/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  340. package/dist/demo/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  341. package/dist/demo/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  342. package/dist/demo/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  343. package/dist/demo/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  344. package/dist/demo/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  345. package/dist/demo/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  346. package/dist/demo/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  347. package/dist/demo/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  348. package/dist/demo/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  349. package/dist/demo/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  350. package/dist/demo/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  351. package/dist/demo/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  352. package/dist/demo/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  353. package/dist/demo/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  354. package/dist/demo/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  355. package/dist/demo/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  356. package/dist/demo/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  357. package/dist/demo/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  358. package/dist/demo/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  359. package/dist/demo/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  360. package/dist/demo/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  361. package/dist/demo/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  362. package/dist/demo/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  363. package/dist/demo/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  364. package/dist/demo/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  365. package/dist/demo/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  366. package/dist/demo/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  367. package/dist/demo/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  368. package/dist/demo/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  369. package/dist/demo/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  370. package/dist/demo/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  371. package/dist/demo/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  372. package/dist/demo/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  373. package/dist/demo/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  374. package/dist/demo/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  375. package/dist/demo/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  376. package/dist/demo/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  377. package/dist/demo/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  378. package/dist/demo/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  379. package/dist/demo/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  380. package/dist/demo/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  381. package/dist/demo/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  382. package/dist/demo/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  383. package/dist/demo/assets/abnfDiagram-VRR7QNED-Dfd140vw.js +1 -0
  384. package/dist/demo/assets/alternatives-B9ZaH43Q.js +34 -0
  385. package/dist/demo/assets/arc-DgAnSXoo.js +1 -0
  386. package/dist/demo/assets/architecture-TIHT7OUA-PKWnSAaw.js +1 -0
  387. package/dist/demo/assets/architectureDiagram-ZJ3FMSHR-DKbvCH_5.js +36 -0
  388. package/dist/demo/assets/archiver-web.es-9DdX0ee3.js +1 -0
  389. package/dist/demo/assets/array-BifhSqXX.js +1 -0
  390. package/dist/demo/assets/binary-C5gJtLso.js +1 -0
  391. package/dist/demo/assets/blockDiagram-677ZJIJ3-CG98KmMB.js +132 -0
  392. package/dist/demo/assets/c4Diagram-LMCZKHZV-DMoYN41z.js +10 -0
  393. package/dist/demo/assets/channel-KwEJ8erK.js +1 -0
  394. package/dist/demo/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  395. package/dist/demo/assets/chunk-32BRIVSS-urznovFN.js +1 -0
  396. package/dist/demo/assets/chunk-52WLFC77-CVCkOQ0G.js +10 -0
  397. package/dist/demo/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  398. package/dist/demo/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
  399. package/dist/demo/assets/chunk-C7G6YPKG-3KR4wxr6.js +1 -0
  400. package/dist/demo/assets/chunk-EX3LRPZG-7H4O5zer.js +231 -0
  401. package/dist/demo/assets/chunk-FWX5IMBZ-Cr5hG-Ne.js +2 -0
  402. package/dist/demo/assets/chunk-HOUHSVGY-D-1II34k.js +1 -0
  403. package/dist/demo/assets/chunk-ICXQ74PX-6-sSSj2J.js +2 -0
  404. package/dist/demo/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  405. package/dist/demo/assets/chunk-KEIR6QF5-DEvma7oi.js +161 -0
  406. package/dist/demo/assets/chunk-MOJQB5TN-BI6A8dXC.js +88 -0
  407. package/dist/demo/assets/chunk-OGEWGWER-CbUWwSGR.js +1 -0
  408. package/dist/demo/assets/chunk-PUDLZKDR-DZFGcS0W.js +156 -0
  409. package/dist/demo/assets/chunk-Q4XR5HBZ-DZGKW5Hb.js +70 -0
  410. package/dist/demo/assets/chunk-RYQCIY6F-ngGojZR9.js +1 -0
  411. package/dist/demo/assets/chunk-V7JOEXUC-BHAISEav.js +206 -0
  412. package/dist/demo/assets/chunk-VAUOI2AC-DJJNd7f5.js +1 -0
  413. package/dist/demo/assets/chunk-VR4S4FIN-BohNhf6y.js +1 -0
  414. package/dist/demo/assets/chunk-WYO6CB5R-B4Oap74a.js +127 -0
  415. package/dist/demo/assets/chunk-XXDRQBXY-CazVBYiP.js +1 -0
  416. package/dist/demo/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  417. package/dist/demo/assets/chunk-ZGVPDNZ5-BIzSs0a_.js +62 -0
  418. package/dist/demo/assets/chunk-ZIRB5QZD-BpeS1aZ7.js +32 -0
  419. package/dist/demo/assets/classDiagram-OUVF2IWQ-DHWWAQXA.js +1 -0
  420. package/dist/demo/assets/classDiagram-v2-EOCWNBFH-DHWWAQXA.js +1 -0
  421. package/dist/demo/assets/cose-bilkent-JH36ORCC-BX8lNO9u.js +1 -0
  422. package/dist/demo/assets/cynefin-VYW2F7L2-BgajGb2C.js +1 -0
  423. package/dist/demo/assets/cynefinDiagram-TSTJHNR4-DzhUAZoU.js +62 -0
  424. package/dist/demo/assets/cytoscape.esm-C3UvhD5t.js +321 -0
  425. package/dist/demo/assets/dagre-Do4loULv.js +1 -0
  426. package/dist/demo/assets/dagre-VKFMJZFB-BsopUNng.js +4 -0
  427. package/dist/demo/assets/defaultLocale-BFoDCU3G.js +1 -0
  428. package/dist/demo/assets/diagram-FQU43EPY-CnINkZTL.js +3 -0
  429. package/dist/demo/assets/diagram-G47NLZAW-Dz3Rtzen.js +24 -0
  430. package/dist/demo/assets/diagram-NH7WQ7WH-Be_1UuNu.js +24 -0
  431. package/dist/demo/assets/diagram-OA4YK3LP-CoSIFO2U.js +30 -0
  432. package/dist/demo/assets/diagram-WEI45ONY-BSRZnbDT.js +41 -0
  433. package/dist/demo/assets/dist-Cs1z76FA.js +3464 -0
  434. package/dist/demo/assets/dist-Cz2MTljl.js +1 -0
  435. package/dist/demo/assets/dist-D6vyGdj4.js +1 -0
  436. package/dist/demo/assets/ebnfDiagram-CCIWWBDH-CyNs0RvY.js +1 -0
  437. package/dist/demo/assets/editorConfig-DhK0JFvA.js +1355 -0
  438. package/dist/demo/assets/editorConfig-DsFwDEyj.css +2 -0
  439. package/dist/demo/assets/erDiagram-Q63AITRT-Duw2zQw3.js +85 -0
  440. package/dist/demo/assets/eventmodeling-45OFAUF4-BMPwBTgC.js +1 -0
  441. package/dist/demo/assets/flowDiagram-23GEKE2U-vnvQkbfP.js +1 -0
  442. package/dist/demo/assets/ganttDiagram-NO4QXBWP-BUQaZ9pm.js +292 -0
  443. package/dist/demo/assets/gitGraph-TEB2WS4Q-Bqyr024o.js +1 -0
  444. package/dist/demo/assets/gitGraphDiagram-IHSO6WYX-BHYVHdDB.js +106 -0
  445. package/dist/demo/assets/graphlib-0Qhce9xj.js +1 -0
  446. package/dist/demo/assets/harper_wasm_bg-C0DPov_6.wasm +0 -0
  447. package/dist/demo/assets/html-to-docx.esm-C-vYVLZ6.js +75 -0
  448. package/dist/demo/assets/index-CLlAnStL-Ad588yu1.js +18 -0
  449. package/dist/demo/assets/info-DKCQHKI2-CFeY2ca_.js +1 -0
  450. package/dist/demo/assets/infoDiagram-FWYZ7A6U-DL4MXbtI.js +2 -0
  451. package/dist/demo/assets/init-C-OQMol4.js +1 -0
  452. package/dist/demo/assets/isObject-BNleAbAq.js +1 -0
  453. package/dist/demo/assets/ishikawaDiagram-FXEZZL3T-DmCRB68D.js +70 -0
  454. package/dist/demo/assets/journeyDiagram-5HDEW3XC-CweGyybk.js +139 -0
  455. package/dist/demo/assets/kanban-definition-HUTT4EX6-C66P6IsH.js +89 -0
  456. package/dist/demo/assets/katex-DolUETbr.js +257 -0
  457. package/dist/demo/assets/line-BidjcqCQ.js +1 -0
  458. package/dist/demo/assets/linear-CilxpIUn.js +1 -0
  459. package/dist/demo/assets/main-B9AIVkTk.js +10 -0
  460. package/dist/demo/assets/main-BprCJcmy.css +1 -0
  461. package/dist/demo/assets/map-CD2wglgO.js +1 -0
  462. package/dist/demo/assets/mermaid-parser.core-9KJPT0XG.js +7 -0
  463. package/dist/demo/assets/mermaid.core-laQQcj-T.js +11 -0
  464. package/dist/demo/assets/mindmap-definition-LN4V7U3C-BQN-bZLe.js +96 -0
  465. package/dist/demo/assets/ordinal-DtR4qwUh.js +1 -0
  466. package/dist/demo/assets/packet-7NZHBO7P-DxBPLOYy.js +1 -0
  467. package/dist/demo/assets/path-COt_16Va.js +1 -0
  468. package/dist/demo/assets/pegDiagram-2B236MQR-BpHXi9RG.js +1 -0
  469. package/dist/demo/assets/pie-RZYD4A2V-DrQV2Hpi.js +1 -0
  470. package/dist/demo/assets/pieDiagram-ENE6RG2P-CG5jHfId.js +39 -0
  471. package/dist/demo/assets/quadrantDiagram-ABIIQ3AL-Dcu2-MJ0.js +7 -0
  472. package/dist/demo/assets/radar-I7S5WNFK-tVb61Efp.js +1 -0
  473. package/dist/demo/assets/railroad-3IZDKUUU-DkJtB_j_.js +1 -0
  474. package/dist/demo/assets/railroad-abnf-AHOZXSZD-CfCTKFr3.js +1 -0
  475. package/dist/demo/assets/railroad-ebnf-EBAXGLYW-_v-6l-Ly.js +1 -0
  476. package/dist/demo/assets/railroad-peg-LSFZ7HO6-BBeu0SHC.js +1 -0
  477. package/dist/demo/assets/railroadDiagram-RFXS5EU6-Bv3QCzUt.js +1 -0
  478. package/dist/demo/assets/requirementDiagram-TGXJPOKE-DBRcoYhq.js +84 -0
  479. package/dist/demo/assets/rolldown-runtime-C0FnF6B9.js +1 -0
  480. package/dist/demo/assets/rough.esm-By172zw-.js +1 -0
  481. package/dist/demo/assets/sankeyDiagram-HTMAVEWB-BUvv1AGS.js +40 -0
  482. package/dist/demo/assets/sequenceDiagram-DBY2YBRQ-DF4ltyiE.js +162 -0
  483. package/dist/demo/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
  484. package/dist/demo/assets/src-CllyRBe0.js +1 -0
  485. package/dist/demo/assets/stateDiagram-2N3HPSRC-hdEszuU_.js +1 -0
  486. package/dist/demo/assets/stateDiagram-v2-6OUMAXLB-frodkCZE.js +1 -0
  487. package/dist/demo/assets/swimlanes-5IMT3BWC-BXUPe25m.js +2 -0
  488. package/dist/demo/assets/swimlanesDiagram-G3AALYLV-CN1oenl6.js +8 -0
  489. package/dist/demo/assets/timeline-definition-FHXFAJF6-Dphs5ING.js +120 -0
  490. package/dist/demo/assets/treeView-QDETBFTQ-MqbtC4u9.js +1 -0
  491. package/dist/demo/assets/treemap-6X3UGDF4-BExpaQPn.js +1 -0
  492. package/dist/demo/assets/v4-DDdyfk2q.js +1 -0
  493. package/dist/demo/assets/vennDiagram-L72KCM5P-BKVdTvjh.js +34 -0
  494. package/dist/demo/assets/wardley-OPB4EBWU-e6QJ2uBL.js +1 -0
  495. package/dist/demo/assets/wardleyDiagram-EHGQE667-DCxRFNx3.js +78 -0
  496. package/dist/demo/assets/xychartDiagram-FW5EYKEG-OnzZBgPH.js +7 -0
  497. package/dist/demo/index.html +23 -0
  498. package/dist/dialog-CxZ2oxD2.cjs +1 -0
  499. package/dist/dialog-DgdVbRUv.js +3 -0
  500. package/dist/dialogs/FileManagerModal.d.ts +9 -0
  501. package/dist/dialogs/InviteModal.d.ts +13 -0
  502. package/dist/dialogs/filemanager-data.d.ts +12 -0
  503. package/dist/dist-BEFKWXG8.js +1 -0
  504. package/dist/dist-BZqs5TU5.js +1 -0
  505. package/dist/dist-C5TeAoJ9.cjs +1 -0
  506. package/dist/dist-Cn_OUKh6.cjs +1 -0
  507. package/dist/dist-CsCFCV4K.js +29 -0
  508. package/dist/dist-D0RROJPB.cjs +1 -0
  509. package/dist/dist-GxnWmQlw.cjs +1 -0
  510. package/dist/dist-ICzvPVCE.cjs +1 -0
  511. package/dist/dist-fiA_WbbM.js +1 -0
  512. package/dist/documents/DocumentTree.d.ts +59 -0
  513. package/dist/documents/defaultDocuments.d.ts +7 -0
  514. package/dist/dom-dataset-D3Nz0h73.js +1 -0
  515. package/dist/dom-dataset-w2ZYeuXJ.cjs +1 -0
  516. package/dist/dropdown-menu-CVJhYAPA.cjs +1 -0
  517. package/dist/dropdown-menu-CfGzSpIy.js +2 -0
  518. package/dist/editor/EditorArea.d.ts +42 -0
  519. package/dist/editor/ReasonDocs.d.ts +7 -0
  520. package/dist/editor/ReasonDocsDialogs.d.ts +47 -0
  521. package/dist/editor/RightPanel.d.ts +43 -0
  522. package/dist/editor/TiptapEditorWrapper.d.ts +56 -0
  523. package/dist/editor/useReasonDocsState.d.ts +108 -0
  524. package/dist/editor/useSyncStore.d.ts +16 -0
  525. package/dist/events.constant-BkYOoqSk.cjs +1 -0
  526. package/dist/events.constant-DYciHxmk.js +2 -0
  527. package/dist/extensions/Attachment/Attachment.d.ts +15 -0
  528. package/dist/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +4 -0
  529. package/dist/extensions/Attachment/components/NodeViewAttachment/FileIconString.d.ts +4 -0
  530. package/dist/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +4 -0
  531. package/dist/extensions/Attachment/components/RichTextAttachment.d.ts +4 -0
  532. package/dist/extensions/Attachment/index.d.ts +4 -0
  533. package/dist/extensions/Blockquote/Blockquote.d.ts +6 -0
  534. package/dist/extensions/Blockquote/components/RichTextBlockquote.d.ts +4 -0
  535. package/dist/extensions/Blockquote/index.d.ts +4 -0
  536. package/dist/extensions/Bold/Bold.d.ts +6 -0
  537. package/dist/extensions/Bold/components/RichTextBold.d.ts +4 -0
  538. package/dist/extensions/Bold/index.d.ts +4 -0
  539. package/dist/extensions/BulletList/BulletList.d.ts +6 -0
  540. package/dist/extensions/BulletList/components/RichTextBulletList.d.ts +4 -0
  541. package/dist/extensions/BulletList/index.d.ts +4 -0
  542. package/dist/extensions/Callout/Callout.d.ts +18 -0
  543. package/dist/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +4 -0
  544. package/dist/extensions/Callout/components/RichTextCallout.d.ts +4 -0
  545. package/dist/extensions/Callout/index.d.ts +4 -0
  546. package/dist/extensions/Clear/Clear.d.ts +6 -0
  547. package/dist/extensions/Clear/components/RichTextClear.d.ts +4 -0
  548. package/dist/extensions/Clear/index.d.ts +4 -0
  549. package/dist/extensions/Code/Code.d.ts +6 -0
  550. package/dist/extensions/Code/components/RichTextCode.d.ts +4 -0
  551. package/dist/extensions/Code/index.d.ts +4 -0
  552. package/dist/extensions/CodeBlock/CodeBlock.d.ts +6 -0
  553. package/dist/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +2 -0
  554. package/dist/extensions/CodeBlock/index.d.ts +4 -0
  555. package/dist/extensions/CodeView/CodeView.d.ts +17 -0
  556. package/dist/extensions/CodeView/components/RichTextCodeView.d.ts +4 -0
  557. package/dist/extensions/CodeView/index.d.ts +4 -0
  558. package/dist/extensions/Color/Color.d.ts +22 -0
  559. package/dist/extensions/Color/components/RichTextColor.d.ts +4 -0
  560. package/dist/extensions/Color/index.d.ts +4 -0
  561. package/dist/extensions/Column/Column.d.ts +25 -0
  562. package/dist/extensions/Column/components/RichTextColumn.d.ts +4 -0
  563. package/dist/extensions/Column/index.d.ts +4 -0
  564. package/dist/extensions/Comment/Comment.d.ts +41 -0
  565. package/dist/extensions/Comment/components/CommentView.d.ts +17 -0
  566. package/dist/extensions/Comment/index.d.ts +5 -0
  567. package/dist/extensions/Drawer/Drawer.d.ts +15 -0
  568. package/dist/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +3 -0
  569. package/dist/extensions/Drawer/components/ControlDrawer/icon.d.ts +28 -0
  570. package/dist/extensions/Drawer/components/EditDrawerBlock.d.ts +4 -0
  571. package/dist/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +2 -0
  572. package/dist/extensions/Drawer/components/RichTextDrawer.d.ts +4 -0
  573. package/dist/extensions/Drawer/index.d.ts +4 -0
  574. package/dist/extensions/Drawio/Drawio.d.ts +17 -0
  575. package/dist/extensions/Drawio/components/NodeViewDrawio/NodeViewDrawio.d.ts +3 -0
  576. package/dist/extensions/Drawio/components/RichTextDrawio.d.ts +4 -0
  577. package/dist/extensions/Drawio/index.d.ts +4 -0
  578. package/dist/extensions/Emoji/Emoji.d.ts +5 -0
  579. package/dist/extensions/Emoji/components/EmojiList/EmojiNodeView.d.ts +11 -0
  580. package/dist/extensions/Emoji/components/RichTextEmoji.d.ts +2 -0
  581. package/dist/extensions/Emoji/index.d.ts +4 -0
  582. package/dist/extensions/ExportPdf/ExportPdf.d.ts +21 -0
  583. package/dist/extensions/ExportPdf/components/RichTextExportPdf.d.ts +4 -0
  584. package/dist/extensions/ExportPdf/index.d.ts +4 -0
  585. package/dist/extensions/ExportWord/ExportWord.d.ts +13 -0
  586. package/dist/extensions/ExportWord/components/RichTextExportWord.d.ts +4 -0
  587. package/dist/extensions/ExportWord/index.d.ts +4 -0
  588. package/dist/extensions/FontFamily/FontFamily.d.ts +10 -0
  589. package/dist/extensions/FontFamily/components/RichTextFontFamily.d.ts +15 -0
  590. package/dist/extensions/FontFamily/index.d.ts +4 -0
  591. package/dist/extensions/FontSize/FontSize.d.ts +32 -0
  592. package/dist/extensions/FontSize/components/RichTextFontSize.d.ts +12 -0
  593. package/dist/extensions/FontSize/index.d.ts +4 -0
  594. package/dist/extensions/Harper/Harper.d.ts +73 -0
  595. package/dist/extensions/Harper/components/RichTextHarper.d.ts +15 -0
  596. package/dist/extensions/Harper/index.d.ts +9 -0
  597. package/dist/extensions/Harper/lib/createHarperLinter.d.ts +22 -0
  598. package/dist/extensions/Harper/lib/extractTextWithMap.d.ts +33 -0
  599. package/dist/extensions/Heading/Heading.d.ts +6 -0
  600. package/dist/extensions/Heading/components/RichTextHeading.d.ts +17 -0
  601. package/dist/extensions/Heading/index.d.ts +4 -0
  602. package/dist/extensions/Highlight/Highlight.d.ts +18 -0
  603. package/dist/extensions/Highlight/components/RichTextHighlight.d.ts +2 -0
  604. package/dist/extensions/Highlight/index.d.ts +4 -0
  605. package/dist/extensions/History/History.d.ts +6 -0
  606. package/dist/extensions/History/components/RichTextHistory.d.ts +3 -0
  607. package/dist/extensions/History/index.d.ts +4 -0
  608. package/dist/extensions/HorizontalRule/HorizontalRule.d.ts +6 -0
  609. package/dist/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +4 -0
  610. package/dist/extensions/HorizontalRule/index.d.ts +4 -0
  611. package/dist/extensions/Iframe/Iframe.d.ts +16 -0
  612. package/dist/extensions/Iframe/components/IframeNodeView.d.ts +5 -0
  613. package/dist/extensions/Iframe/components/RichTextIframe.d.ts +4 -0
  614. package/dist/extensions/Iframe/index.d.ts +4 -0
  615. package/dist/extensions/Iframe/utils.d.ts +9 -0
  616. package/dist/extensions/Image/Image.d.ts +57 -0
  617. package/dist/extensions/Image/components/ImageCropper.d.ts +2 -0
  618. package/dist/extensions/Image/components/ImageView.d.ts +3 -0
  619. package/dist/extensions/Image/components/RichTextImage.d.ts +4 -0
  620. package/dist/extensions/Image/index.d.ts +4 -0
  621. package/dist/extensions/ImageGif/ImageGif.d.ts +39 -0
  622. package/dist/extensions/ImageGif/components/ImageGifView.d.ts +3 -0
  623. package/dist/extensions/ImageGif/components/RichTextImageGif.d.ts +2 -0
  624. package/dist/extensions/ImageGif/components/services.d.ts +461 -0
  625. package/dist/extensions/ImageGif/index.d.ts +4 -0
  626. package/dist/extensions/ImportWord/ImportWord.d.ts +16 -0
  627. package/dist/extensions/ImportWord/components/RichTextImportWord.d.ts +4 -0
  628. package/dist/extensions/ImportWord/docx-to-html.d.ts +24 -0
  629. package/dist/extensions/ImportWord/index.d.ts +4 -0
  630. package/dist/extensions/Indent/Indent.d.ts +23 -0
  631. package/dist/extensions/Indent/components/RichTextIndent.d.ts +4 -0
  632. package/dist/extensions/Indent/index.d.ts +4 -0
  633. package/dist/extensions/Italic/Italic.d.ts +6 -0
  634. package/dist/extensions/Italic/components/RichTextItalic.d.ts +4 -0
  635. package/dist/extensions/Italic/index.d.ts +4 -0
  636. package/dist/extensions/Katex/Katex.d.ts +17 -0
  637. package/dist/extensions/Katex/components/KatexWrapper.d.ts +4 -0
  638. package/dist/extensions/Katex/components/RichTextKatex.d.ts +4 -0
  639. package/dist/extensions/Katex/index.d.ts +4 -0
  640. package/dist/extensions/LineHeight/LineHeight.d.ts +7 -0
  641. package/dist/extensions/LineHeight/components/RichTextLightHeight.d.ts +4 -0
  642. package/dist/extensions/LineHeight/index.d.ts +4 -0
  643. package/dist/extensions/Link/Link.d.ts +6 -0
  644. package/dist/extensions/Link/components/LinkEditBlock.d.ts +12 -0
  645. package/dist/extensions/Link/components/LinkViewBlock.d.ts +9 -0
  646. package/dist/extensions/Link/components/RichTextLink.d.ts +4 -0
  647. package/dist/extensions/Link/index.d.ts +4 -0
  648. package/dist/extensions/MarkdownPaste/MarkdownPaste.d.ts +5 -0
  649. package/dist/extensions/MarkdownPaste/index.d.ts +4 -0
  650. package/dist/extensions/Mention/Mention.d.ts +3 -0
  651. package/dist/extensions/Mention/components/NodeViewMentionList.d.ts +16 -0
  652. package/dist/extensions/Mention/index.d.ts +4 -0
  653. package/dist/extensions/Mermaid/Mermaid.d.ts +15 -0
  654. package/dist/extensions/Mermaid/components/EditMermaidBlock.d.ts +8 -0
  655. package/dist/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +2 -0
  656. package/dist/extensions/Mermaid/components/RichTextMermaid.d.ts +4 -0
  657. package/dist/extensions/Mermaid/index.d.ts +4 -0
  658. package/dist/extensions/MoreMark/MoreMark.d.ts +20 -0
  659. package/dist/extensions/MoreMark/components/RichTextMoreMark.d.ts +14 -0
  660. package/dist/extensions/MoreMark/index.d.ts +4 -0
  661. package/dist/extensions/OfficePaste/OfficePaste.d.ts +7 -0
  662. package/dist/extensions/OfficePaste/index.d.ts +4 -0
  663. package/dist/extensions/OrderedList/OrderedList.d.ts +6 -0
  664. package/dist/extensions/OrderedList/components/RichTextOrderedList.d.ts +4 -0
  665. package/dist/extensions/OrderedList/index.d.ts +4 -0
  666. package/dist/extensions/Pagination/Pagination.d.ts +37 -0
  667. package/dist/extensions/Pagination/components/RichTextPagination.d.ts +4 -0
  668. package/dist/extensions/Pagination/index.d.ts +5 -0
  669. package/dist/extensions/SearchAndReplace/SearchAndReplace.d.ts +36 -0
  670. package/dist/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +4 -0
  671. package/dist/extensions/SearchAndReplace/index.d.ts +4 -0
  672. package/dist/extensions/SlashCommand/SlashCommand.d.ts +4 -0
  673. package/dist/extensions/SlashCommand/components/SlashCommandList.d.ts +6 -0
  674. package/dist/extensions/SlashCommand/components/SlashCommandNodeView.d.ts +3 -0
  675. package/dist/extensions/SlashCommand/index.d.ts +4 -0
  676. package/dist/extensions/SlashCommand/renderCommandListDefault.d.ts +7 -0
  677. package/dist/extensions/SlashCommand/types.d.ts +20 -0
  678. package/dist/extensions/Strike/Strike.d.ts +6 -0
  679. package/dist/extensions/Strike/components/RichTextStrike.d.ts +4 -0
  680. package/dist/extensions/Strike/index.d.ts +4 -0
  681. package/dist/extensions/Subscript/components/RichTextSubscript.d.ts +4 -0
  682. package/dist/extensions/Superscript/components/RichTextSuperscript.d.ts +4 -0
  683. package/dist/extensions/Table/Table.d.ts +21 -0
  684. package/dist/extensions/Table/TableCellBackground.d.ts +14 -0
  685. package/dist/extensions/Table/components/CreateTablePopover.d.ts +8 -0
  686. package/dist/extensions/Table/components/RichTextTable.d.ts +2 -0
  687. package/dist/extensions/Table/index.d.ts +4 -0
  688. package/dist/extensions/TableOfContents/TableOfContents.d.ts +15 -0
  689. package/dist/extensions/TableOfContents/components/RichTextTableOfContents.d.ts +8 -0
  690. package/dist/extensions/TableOfContents/components/RichTextTableOfContentsPanel.d.ts +19 -0
  691. package/dist/extensions/TableOfContents/index.d.ts +6 -0
  692. package/dist/extensions/TaskList/TaskList.d.ts +11 -0
  693. package/dist/extensions/TaskList/components/RichTextTaskList.d.ts +4 -0
  694. package/dist/extensions/TaskList/index.d.ts +4 -0
  695. package/dist/extensions/TextAlign/TextAlign.d.ts +17 -0
  696. package/dist/extensions/TextAlign/components/RichTextAlign.d.ts +14 -0
  697. package/dist/extensions/TextAlign/index.d.ts +4 -0
  698. package/dist/extensions/TextDirection/TextDirection.d.ts +5 -0
  699. package/dist/extensions/TextDirection/components/RichTextTextDirection.d.ts +15 -0
  700. package/dist/extensions/TextDirection/index.d.ts +4 -0
  701. package/dist/extensions/TextUnderline/TextUnderline.d.ts +6 -0
  702. package/dist/extensions/TextUnderline/components/RichTextUnderline.d.ts +4 -0
  703. package/dist/extensions/TextUnderline/index.d.ts +4 -0
  704. package/dist/extensions/Twitter/Twitter.d.ts +46 -0
  705. package/dist/extensions/Twitter/components/FormEditLinkTwitter.d.ts +9 -0
  706. package/dist/extensions/Twitter/components/NodeViewTweet.d.ts +8 -0
  707. package/dist/extensions/Twitter/components/RichTextTwitter.d.ts +4 -0
  708. package/dist/extensions/Twitter/index.d.ts +4 -0
  709. package/dist/extensions/Video/Video.d.ts +66 -0
  710. package/dist/extensions/Video/components/RichTextVideo.d.ts +4 -0
  711. package/dist/extensions/Video/index.d.ts +4 -0
  712. package/dist/extensions/WordCount/WordCount.d.ts +7 -0
  713. package/dist/extensions/WordCount/components/RichTextWordCount.d.ts +4 -0
  714. package/dist/extensions/WordCount/index.d.ts +4 -0
  715. package/dist/extensions/WordCount/utils/wordCount.d.ts +25 -0
  716. package/dist/extensions/Zoom/components/RichTextZoom.d.ts +2 -0
  717. package/dist/features/ai-rewrite/AIRewriteSuggestion.d.ts +27 -0
  718. package/dist/features/ai-rewrite/rewriteModes.d.ts +37 -0
  719. package/dist/features/settings/Settings.d.ts +11 -0
  720. package/dist/features/settings/sections/AIRewriteModesSection.d.ts +6 -0
  721. package/dist/features/settings/sections/AboutSection.d.ts +1 -0
  722. package/dist/features/settings/sections/AppearanceSection.d.ts +6 -0
  723. package/dist/features/settings/sections/FileSourcesSection.d.ts +6 -0
  724. package/dist/features/settings/sections/StorageSection.d.ts +6 -0
  725. package/dist/features/tags/TagManagementDialog.d.ts +18 -0
  726. package/dist/features/team/TeamManagement.d.ts +13 -0
  727. package/dist/file-B1Z0XcVJ.cjs +1 -0
  728. package/dist/file-aBzFF1LO.js +1 -0
  729. package/dist/file-tree/FileTreeContextMenu.d.ts +18 -0
  730. package/dist/file-tree/documentUtils.d.ts +57 -0
  731. package/dist/file-tree/filetree.d.ts +28 -0
  732. package/dist/file-tree/index.d.ts +8 -0
  733. package/dist/file-tree/useFileTreeOperations.d.ts +27 -0
  734. package/dist/floating-ui.dom-D9FglguG.cjs +1 -0
  735. package/dist/floating-ui.dom-DledU50u.js +1 -0
  736. package/dist/hooks/use-mobile.d.ts +5 -0
  737. package/dist/hooks/useActive.d.ts +24 -0
  738. package/dist/hooks/useAttributes.d.ts +2 -0
  739. package/dist/hooks/useButtonProps.d.ts +4 -0
  740. package/dist/hooks/useCopy.d.ts +8 -0
  741. package/dist/hooks/useExtension.d.ts +4 -0
  742. package/dist/hooks/useLocalStorage.d.ts +13 -0
  743. package/dist/html-to-docx.esm-BSqAFns8.cjs +1 -0
  744. package/dist/html-to-docx.esm-DkztZsL5-DQYdhD3B.cjs +1 -0
  745. package/dist/html-to-docx.esm-DkztZsL5.js +1 -0
  746. package/dist/index.cjs +1 -0
  747. package/dist/index.d.ts +10 -0
  748. package/dist/index.js +1 -0
  749. package/dist/input-AvqqajGM.cjs +1 -0
  750. package/dist/input-CMD6LZFr.js +1 -0
  751. package/dist/isNumber-7Fi2iQVS.js +1 -0
  752. package/dist/isNumber-CmHpmrpR.cjs +1 -0
  753. package/dist/jsx-runtime-BLWGWoMZ.cjs +1 -0
  754. package/dist/jsx-runtime-DqgyBF0N.js +1 -0
  755. package/dist/jszip.min-3Yxv_4wz.cjs +1 -0
  756. package/dist/jszip.min-BUJ6OksG.js +1 -0
  757. package/dist/label-DPSH3PiY.cjs +1 -0
  758. package/dist/label-Dx1mMx8l.js +1 -0
  759. package/dist/layout/Sidebar.d.ts +7 -0
  760. package/dist/layout/sidebar/Sidebar.d.ts +2 -0
  761. package/dist/layout/sidebar/SidebarContent.d.ts +76 -0
  762. package/dist/layout/sidebar/SidebarFooter.d.ts +45 -0
  763. package/dist/layout/sidebar/SidebarToolbar.d.ts +85 -0
  764. package/dist/layout/sidebar/SidebarViewMenu.d.ts +24 -0
  765. package/dist/layout/sidebar/fileSourceUtils.d.ts +2 -0
  766. package/dist/layout/sidebar/index.d.ts +12 -0
  767. package/dist/layout/sidebar/panelOptions.d.ts +29 -0
  768. package/dist/layout/sidebar/types.d.ts +68 -0
  769. package/dist/lib/utils.d.ts +2 -0
  770. package/dist/locale-bundle.cjs +1 -0
  771. package/dist/locale-bundle.d.ts +4 -0
  772. package/dist/locale-bundle.js +1 -0
  773. package/dist/locales/ar.d.ts +201 -0
  774. package/dist/locales/de.d.ts +201 -0
  775. package/dist/locales/en.d.ts +201 -0
  776. package/dist/locales/es.d.ts +201 -0
  777. package/dist/locales/fa.d.ts +201 -0
  778. package/dist/locales/fi.d.ts +201 -0
  779. package/dist/locales/fr.d.ts +201 -0
  780. package/dist/locales/he.d.ts +201 -0
  781. package/dist/locales/hi.d.ts +201 -0
  782. package/dist/locales/hu.d.ts +201 -0
  783. package/dist/locales/index.d.ts +3576 -0
  784. package/dist/locales/it.d.ts +201 -0
  785. package/dist/locales/ja.d.ts +201 -0
  786. package/dist/locales/ko.d.ts +201 -0
  787. package/dist/locales/nl.d.ts +201 -0
  788. package/dist/locales/pt-br.d.ts +201 -0
  789. package/dist/locales/ru.d.ts +201 -0
  790. package/dist/locales/tr.d.ts +201 -0
  791. package/dist/locales/uk.d.ts +201 -0
  792. package/dist/locales/vi.d.ts +201 -0
  793. package/dist/locales/zh-cn.d.ts +201 -0
  794. package/dist/locales-DfkG6-1b.js +1 -0
  795. package/dist/locales-Dg9XL0yP.cjs +1 -0
  796. package/dist/plugins/image-upload.d.ts +13 -0
  797. package/dist/popover-DEGqjF2J.cjs +1 -0
  798. package/dist/popover-DGEv-NbL.js +1 -0
  799. package/dist/reason-docs.cjs +1 -0
  800. package/dist/reason-docs.d.ts +1 -0
  801. package/dist/reason-docs.js +1 -0
  802. package/dist/renderCommandListDefault-CJd5Cd3Q.js +1 -0
  803. package/dist/renderCommandListDefault-CykwYpTX.cjs +1 -0
  804. package/dist/renderNodeView-Bis8Vxth.cjs +1 -0
  805. package/dist/renderNodeView-EV3OWici.js +1 -0
  806. package/dist/rolldown-runtime-BeavJI0R.cjs +1 -0
  807. package/dist/rolldown-runtime-Drgf5FY8-7XpCJKyX.cjs +1 -0
  808. package/dist/rolldown-runtime-Drgf5FY8.js +1 -0
  809. package/dist/search/DynamicIslandTOC.d.ts +14 -0
  810. package/dist/search/OutlineView.d.ts +29 -0
  811. package/dist/search/SearchModal.d.ts +26 -0
  812. package/dist/separator-BHN46aj5.cjs +1 -0
  813. package/dist/separator-CTa6o9S_.js +10 -0
  814. package/dist/shortId-B25DIOpW.cjs +1 -0
  815. package/dist/shortId-COE42cHb.js +1 -0
  816. package/dist/src-C7k3RYxJ.js +646 -0
  817. package/dist/src-DYbBlAjR.cjs +1 -0
  818. package/dist/store/EditorEditableReactive.d.ts +4 -0
  819. package/dist/store/ThemeColorReactive.d.ts +4 -0
  820. package/dist/store/commandList.d.ts +2 -0
  821. package/dist/store/editor.d.ts +21 -0
  822. package/dist/store/store.d.ts +6 -0
  823. package/dist/style.css +5 -0
  824. package/dist/tabs-BovAV0Y3.js +1 -0
  825. package/dist/tabs-CoJRfGS8.cjs +1 -0
  826. package/dist/textarea-BFbGcrSO.cjs +1 -0
  827. package/dist/textarea-uEPOPNqf.js +1 -0
  828. package/dist/theme/theme.d.ts +372 -0
  829. package/dist/theme.cjs +1 -0
  830. package/dist/theme.js +1 -0
  831. package/dist/throttle-BpbN7uB1.js +1 -0
  832. package/dist/throttle-COe5rswR.cjs +1 -0
  833. package/dist/toggle-BXl_NYYh.js +2 -0
  834. package/dist/toggle-CRftKzl0.cjs +1 -0
  835. package/dist/tooltip-CzY0Diit.cjs +1 -0
  836. package/dist/tooltip-DC3DBc55.js +5 -0
  837. package/dist/types.d.ts +223 -0
  838. package/dist/updatePosition-CBT0mUIB.js +1 -0
  839. package/dist/updatePosition-DMu5F8JX.cjs +1 -0
  840. package/dist/useButtonProps-D2Hd5DbR.cjs +1 -0
  841. package/dist/useButtonProps-DSIajp_B.js +1 -0
  842. package/dist/utils/base64.d.ts +5 -0
  843. package/dist/utils/cdn-loader.d.ts +10 -0
  844. package/dist/utils/checkIsVideoUrl.d.ts +4 -0
  845. package/dist/utils/color.d.ts +10 -0
  846. package/dist/utils/columns.d.ts +14 -0
  847. package/dist/utils/customEvents/events.constant.d.ts +9 -0
  848. package/dist/utils/delete-node.d.ts +2 -0
  849. package/dist/utils/dom-dataset.d.ts +31 -0
  850. package/dist/utils/download.d.ts +4 -0
  851. package/dist/utils/dynamicCSS.d.ts +28 -0
  852. package/dist/utils/editor-container-size.d.ts +4 -0
  853. package/dist/utils/file.d.ts +30 -0
  854. package/dist/utils/getRenderContainer.d.ts +3 -0
  855. package/dist/utils/indent.d.ts +14 -0
  856. package/dist/utils/is-mobile.d.ts +22 -0
  857. package/dist/utils/json.d.ts +5 -0
  858. package/dist/utils/lru-cache.d.ts +34 -0
  859. package/dist/utils/mitt.d.ts +24 -0
  860. package/dist/utils/node.d.ts +15 -0
  861. package/dist/utils/pdf.d.ts +3 -0
  862. package/dist/utils/plateform.d.ts +14 -0
  863. package/dist/utils/renderNodeView.d.ts +9 -0
  864. package/dist/utils/shortId.d.ts +4 -0
  865. package/dist/utils/storage.d.ts +7 -0
  866. package/dist/utils/updatePosition.d.ts +4 -0
  867. package/dist/utils/utils.d.ts +20 -0
  868. package/dist/utils/validateFile.d.ts +16 -0
  869. package/dist/which-typed-array-Dj_53908.js +1 -0
  870. package/dist/which-typed-array-MFmINaJW.cjs +1 -0
  871. package/package.json +912 -0
@@ -0,0 +1,80 @@
1
+ import{n as t}from"./toggle-BXl_NYYh.js";import{t as e}from"./separator-CTa6o9S_.js";import{_ as n,n as r,v as i}from"./locales-DfkG6-1b.js";import{t as o}from"./Icon-CJJ9AQtR.js";import{t as s}from"./button-CXcuJkiM.js";import{a as l,d as c,i as a,l as h,n as d,o as u,s as p,t as f,u as g}from"./floating-ui.dom-DledU50u.js";import{a as m,i as y,n as w,o as x,r as b,t as v}from"./dialog-DgdVbRUv.js";import{d as k,f as S,i as C,l as _,o as E,r as O,s as A,t as D,u as T}from"./dropdown-menu-CfGzSpIy.js";import{t as I}from"./input-CMD6LZFr.js";import{t as N}from"./label-Dx1mMx8l.js";import{n as M,r as R,t as z}from"./popover-DGEv-NbL.js";import{a as U,i as P,o as L,r as $,s as j,t as H}from"./Callout-heY7R-Zu.js";import{t as B}from"./textarea-uEPOPNqf.js";import{r as F}from"./ImageCropper-Dlz4nJQu.js";import{r as V,t as J}from"./events.constant-DYciHxmk.js";import{d as W,l as K,o as q}from"./useButtonProps-DSIajp_B.js";import{t as G}from"./file-aBzFF1LO.js";import{t as X}from"./Video-_YlAC2R_.js";import{t as Y}from"./CodeBlock-B7Wklup8.js";import{Clear as Z}from"./Clear.js";import{n as Q}from"./Bold-Ciuvp1pM.js";import{n as tt}from"./Italic-CZkbT3Dd.js";import{n as et}from"./TextUnderline-BaV7bhwo.js";import{n as nt}from"./Highlight-OkaWwhRk.js";import{n as rt}from"./Color-VWGwmpsG.js";import{n as it}from"./Code-B17BQJf-.js";import{i as ot,r as st,t as lt}from"./Indent-DpTPoZMk.js";import{n as ct,t as at}from"./TextAlign-C75gn_OM.js";import{n as ht,r as dt,t as ut}from"./Link-C0cNnjXo.js";import{i as pt,r as ft,t as gt}from"./Katex-Bo_vfXrd.js";import{t as mt}from"./ImageGif-D5Qw_Xf-.js";import{t as yt}from"./Table-C9t-k9Qu.js";import{r as wt}from"./Column-D4FgAp5K.js";import{r as xt,t as bt}from"./Twitter-D5UNfT-K.js";import{n as vt}from"./cdn-loader-w67sLKk9.js";import{t as kt}from"./Mermaid-DxpFRVu0.js";import{n as St,t as Ct}from"./shortId-COE42cHb.js";import{t as _t}from"./Drawio-eqEGDkwW.js";import{r as Et,t as Ot}from"./Drawer-Dunw22Q1.js";import{r as At,t as Dt}from"./Iframe-B-0W9YYq.js";import{t as Tt}from"./renderCommandListDefault-CJd5Cd3Q.js";import{useCurrentEditor as It}from"@tiptap/react";import Nt,{Fragment as Mt,useCallback as Rt,useEffect as zt,useLayoutEffect as Ut,useMemo as Pt,useRef as Lt,useState as $t}from"react";import{Fragment as jt,jsx as Ht,jsxs as Bt}from"react/jsx-runtime";import{Check as Ft,Copy as Vt,Pencil as Jt,Trash2 as Wt}from"lucide-react";import{createPortal as Kt}from"react-dom";import{Extension as qt,MappablePosition as Gt,getText as Xt,getTextSerializersFromSchema as Yt,getUpdatedPosition as Zt,isActive as Qt,isFirefox as te,isTextSelection as ee,posToDOMRect as ne}from"@tiptap/core";import{NodeSelection as re,Plugin as ie,PluginKey as oe,Selection as se,SelectionRange as le,TextSelection as ce}from"@tiptap/pm/state";import{Decoration as ae,DecorationSet as he}from"@tiptap/pm/view";import{NodeRange as de}from"@tiptap/pm/model";import{CellSelection as ue}from"@tiptap/pm/tables";import{deleteSelection as pe}from"@tiptap/pm/commands";import{Editor as fe,makeDropdownToolbar as ge}from"easydrawer";var me=class{constructor({editor:t,element:e,view:n,pluginKey:r="bubbleMenu",updateDelay:i=250,resizeDelay:o=60,shouldShow:s,appendTo:l,getReferencedVirtualElement:c,options:a}){var h;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:t,state:e,from:n,to:r})=>{const{doc:i,selection:o}=e,{empty:s}=o,l=!i.textBetween(n,r).length&&ee(e.selection),c=this.element.contains(document.activeElement);return!(!t.hasFocus()&&!c||s||l||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:t})=>{var e;this.editor.isDestroyed?this.destroy():this.preventHide?this.preventHide=!1:(null==t?void 0:t.relatedTarget)&&(null==(e=this.element.parentNode)?void 0:e.contains(t.relatedTarget))||(null==t?void 0:t.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(t,e)=>{const n=!(null==e?void 0:e.selection.eq(t.state.selection)),r=!(null==e?void 0:e.doc.eq(t.state.doc));(n||r)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(t,n,r,e)},this.updateDelay))},this.updateHandler=(t,e,n,r)=>{const{composing:i}=t;i||!e&&!n||(this.getShouldShow(r)?(this.show(),this.updatePosition()):this.hide())},this.transactionHandler=({transaction:t})=>{const e=t.getMeta(this.pluginKey);"updatePosition"===e?this.updatePosition():e&&"object"==typeof e&&"updateOptions"===e.type?this.updateOptions(e.options):"hide"===e?this.hide():"show"===e&&(this.updatePosition(),this.show())},this.editor=t,this.element=e,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=o,this.appendTo=l,this.scrollTarget=null!=(h=null==a?void 0:a.scrollTarget)?h:window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(l("boolean"!=typeof this.floatingUIOptions.flip?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(g("boolean"!=typeof this.floatingUIOptions.shift?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(h("boolean"!=typeof this.floatingUIOptions.offset?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(f(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(c("boolean"!=typeof this.floatingUIOptions.size?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(d("boolean"!=typeof this.floatingUIOptions.autoPlacement?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(u("boolean"!=typeof this.floatingUIOptions.hide?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(p("boolean"!=typeof this.floatingUIOptions.inline?this.floatingUIOptions.inline:void 0)),t}get virtualElement(){var t,e,n;const{selection:r}=this.editor.state,i=null==(t=this.getReferencedVirtualElement)?void 0:t.call(this);if(i)return i;if(!(null==(n=null==(e=this.view)?void 0:e.dom)?void 0:n.parentNode))return;const o=ne(this.view,r.from,r.to);let s={getBoundingClientRect:()=>o,getClientRects:()=>[o]};if(r instanceof re){let t=this.view.nodeDOM(r.from);const e=t.dataset.nodeViewWrapper?t:t.querySelector("[data-node-view-wrapper]");e&&(t=e),t&&(s={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(r instanceof ue){const{$anchorCell:t,$headCell:e}=r,n=t?t.pos:e.pos,i=e?e.pos:t.pos,o=this.view.nodeDOM(n),l=this.view.nodeDOM(i);if(!o||!l)return;const c=o===l?o.getBoundingClientRect():function(t,e){const n=Math.min(t.top,e.top),r=Math.max(t.bottom,e.bottom),i=Math.min(t.left,e.left),o=Math.max(t.right,e.right)-i;return new DOMRect(i,n,o,r-n)}(o.getBoundingClientRect(),l.getBoundingClientRect());s={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return s}updatePosition(){if(!this.isVisible)return;const t=this.virtualElement;t&&a(t,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:e,strategy:n,middlewareData:r})=>{var i,o;this.isVisible&&!this.editor.isDestroyed&&this.element.isConnected&&((null==(i=r.hide)?void 0:i.referenceHidden)||(null==(o=r.hide)?void 0:o.escaped)?this.element.style.visibility="hidden":(this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${t}px`,this.element.style.top=`${e}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()))})}update(t,e){const{state:n}=t,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r)return void this.handleDebouncedUpdate(t,e);const i=!(null==e?void 0:e.selection.eq(t.state.selection)),o=!(null==e?void 0:e.doc.eq(t.state.doc));this.updateHandler(t,i,o,e)}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(t=>t.$from.pos)),s=Math.max(...i.map(t=>t.$to.pos));return(null==(e=this.shouldShow)?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:t,from:o,to:s}))||!1}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e="function"==typeof this.appendTo?this.appendTo():this.appendTo;null==(t=null!=e?e:this.view.dom.parentElement)||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(t){var e;if(void 0!==t.updateDelay&&(this.updateDelay=t.updateDelay),void 0!==t.resizeDelay&&(this.resizeDelay=t.resizeDelay),void 0!==t.appendTo&&(this.appendTo=t.appendTo),void 0!==t.getReferencedVirtualElement&&(this.getReferencedVirtualElement=t.getReferencedVirtualElement),void 0!==t.shouldShow&&t.shouldShow&&(this.shouldShow=t.shouldShow),void 0!==t.options){const n=null!=(e=t.options.scrollTarget)?e:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},ye=t=>new ie({key:"string"==typeof t.pluginKey?new oe(t.pluginKey):t.pluginKey,view:e=>new me({view:e,...t})}),we=(qt.create({name:"bubbleMenu",addOptions:()=>({element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}),addProseMirrorPlugins(){return this.options.element?[ye({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}}),class{constructor({editor:t,element:e,view:n,pluginKey:r="floatingMenu",updateDelay:i=250,resizeDelay:o=60,options:s,appendTo:l,shouldShow:c}){var a;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:t,state:e})=>{const{selection:n}=e,{$anchor:r,empty:i}=n,o=1===r.depth,s=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&0===r.parent.childCount&&!this.getTextContent(r.parent);return!!(t.hasFocus()&&i&&o&&s&&this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(t,e,n,r)=>{const{composing:i}=t;i||!e&&!n||(this.getShouldShow(r)?(this.updatePosition(),this.show()):this.hide())},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:t})=>{var e;this.preventHide?this.preventHide=!1:(null==t?void 0:t.relatedTarget)&&(null==(e=this.element.parentNode)?void 0:e.contains(t.relatedTarget))||(null==t?void 0:t.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:t})=>{const e=t.getMeta(this.pluginKey);"updatePosition"===e?this.updatePosition():e&&"object"==typeof e&&"updateOptions"===e.type?this.updateOptions(e.options):"hide"===e?this.hide():"show"===e&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=t,this.element=e,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=o,this.appendTo=l,this.scrollTarget=null!=(a=null==s?void 0:s.scrollTarget)?a:window,this.floatingUIOptions={...this.floatingUIOptions,...s},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(t){return Xt(t,{textSerializers:Yt(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(l("boolean"!=typeof this.floatingUIOptions.flip?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(g("boolean"!=typeof this.floatingUIOptions.shift?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(h("boolean"!=typeof this.floatingUIOptions.offset?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(f(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(c("boolean"!=typeof this.floatingUIOptions.size?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(d("boolean"!=typeof this.floatingUIOptions.autoPlacement?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(u("boolean"!=typeof this.floatingUIOptions.hide?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(p("boolean"!=typeof this.floatingUIOptions.inline?this.floatingUIOptions.inline:void 0)),t}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(t=>t.$from.pos)),s=Math.max(...i.map(t=>t.$to.pos));return null==(e=this.shouldShow)?void 0:e.call(this,{editor:this.editor,view:this.view,state:n,oldState:t,from:o,to:s})}updateOptions(t){var e;if(void 0!==t.updateDelay&&(this.updateDelay=t.updateDelay),void 0!==t.resizeDelay&&(this.resizeDelay=t.resizeDelay),void 0!==t.appendTo&&(this.appendTo=t.appendTo),void 0!==t.shouldShow&&t.shouldShow&&(this.shouldShow=t.shouldShow),void 0!==t.options){const n=null!=(e=t.options.scrollTarget)?e:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}updatePosition(){var t,e;if(!(null==(e=null==(t=this.view)?void 0:t.dom)?void 0:e.parentNode))return;const{selection:n}=this.editor.state,r=ne(this.view,n.from,n.to);a({getBoundingClientRect:()=>r,getClientRects:()=>[r]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:e,strategy:n,middlewareData:r})=>{var i,o;(null==(i=r.hide)?void 0:i.referenceHidden)||(null==(o=r.hide)?void 0:o.escaped)?this.element.style.visibility="hidden":(this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${t}px`,this.element.style.top=`${e}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate())})}update(t,e){const n=!(null==e?void 0:e.selection.eq(t.state.selection)),r=!(null==e?void 0:e.doc.eq(t.state.doc));this.updateHandler(t,n,r,e)}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e="function"==typeof this.appendTo?this.appendTo():this.appendTo;null==(t=null!=e?e:this.view.dom.parentElement)||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}}),xe=t=>new ie({key:"string"==typeof t.pluginKey?new oe(t.pluginKey):t.pluginKey,view:e=>new we({view:e,...t})});qt.create({name:"floatingMenu",addOptions:()=>({element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}),addCommands(){return{updateFloatingMenuPosition:()=>({tr:t,dispatch:e})=>(e&&t.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[xe({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function be(t,e){return null!=t?t:new oe(e)}var ve="undefined"!=typeof window?Ut:zt,ke=/* @__PURE__ */new Set(["left","opacity","position","top","visibility","width"]),Se=/* @__PURE__ */new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),Ce=/* @__PURE__ */new Set(["children","className","style"]),_e=/* @__PURE__ */new Set(["tabIndex"]),Ee=/* @__PURE__ */new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),Oe={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function Ae(t,e){return/^on[A-Z]/.test(t)&&"function"==typeof e}function De(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Te(t){return _e.has(t)}function Ie(t,e,n){"tabIndex"!==e?t[e]=n:t.tabIndex=Number(n)}function Ne(t,e,n){ke.has(e)||t.style.setProperty(De(e),function(t,e){return"number"!=typeof e||0===e||t.startsWith("--")||Se.has(t)?String(e):`${e}px`}(e,n))}function Me(t,e,n){
2
+ /* @__PURE__ */new Set([...Object.keys(e),...Object.keys(n)]).forEach(r=>{if(Ce.has(r)||!function(t){return t.startsWith("aria-")||t.startsWith("data-")||Ee.has(t)}(r)||Ae(r,e[r])||Ae(r,n[r]))return;const i=e[r],o=n[r];if(i===o)return;const s=function(t){return t.startsWith("aria-")||t.startsWith("data-"),t}(r);return null==o||!1===o?(Te(r)&&function(t,e){if("tabIndex"===e)return void t.removeAttribute("tabindex");const n=t[e];t[e]="boolean"!=typeof n&&("number"!=typeof n?"":0)}(t,r),void t.removeAttribute(s)):!0===o?(Te(r)&&Ie(t,r,!0),void t.setAttribute(s,"")):void(Te(r)?Ie(t,r,o):t.setAttribute(s,String(o)))})}function Re(t,e,n){const r=null!=e?e:{},i=null!=n?n:{};
3
+ /* @__PURE__ */new Set([...Object.keys(r),...Object.keys(i)]).forEach(e=>{const n=r[e],o=i[e];n!==o&&(null!=o?Ne(t,e,o):function(t,e){ke.has(e)||t.style.removeProperty(De(e))}(t,e))})}function ze(t,e,n){e.forEach(({eventName:e,listener:n,options:r})=>{t.removeEventListener(e,n,r)});const r=[];return Object.entries(n).forEach(([e,n])=>{if(!Ae(e,n))return;const{eventName:i,options:o}=function(t){var e;const n=t.endsWith("Capture"),r=(n?t.slice(0,-7):t).slice(2);return{eventName:null!=(e=Oe[r])?e:r.toLowerCase(),options:n?{capture:!0}:void 0}}(e),s=e=>{n(function(t,e){let n=e.defaultPrevented,r=!1;const i=Object.create(e);return Object.defineProperties(i,{nativeEvent:{value:e},currentTarget:{value:t},target:{value:e.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,e.preventDefault()}},stopPropagation:{value:()=>{r=!0,e.stopPropagation()}}}),i}(t,e))};t.addEventListener(i,s,o),r.push({eventName:i,listener:s,options:o})}),r}function Ue(t,e){const n=Lt({}),r=Lt([]);ve(()=>{const i=n.current;return function(t,e,n){e!==n&&(n?t.className=n:t.removeAttribute("class"))}(t,i.className,e.className),Re(t,i.style,e.style),Me(t,i,e),r.current=ze(t,r.current,e),n.current=e,()=>{r.current.forEach(({eventName:e,listener:n,options:r})=>{t.removeEventListener(e,n,r)}),r.current=[]}},[t,e])}var Pe=Nt.forwardRef(({pluginKey:t,editor:e,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:o=null,getReferencedVirtualElement:s,options:l,children:c,...a},h)=>{const d=Lt(document.createElement("div")),u=Lt(be(t,"bubbleMenu")).current;Ue(d.current,a),"function"==typeof h?h(d.current):h&&(h.current=d.current);const{editor:p}=It(),f=e||p,g={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:u,shouldShow:o,getReferencedVirtualElement:s,options:l},m=Lt(g);m.current=g;const[y,w]=$t(!1),x=Lt(!0);return zt(()=>{if(null==f?void 0:f.isDestroyed)return;if(!f)return;const t=d.current;t.style.visibility="hidden",t.style.position="absolute";const e=ye({...m.current,editor:f,element:t});f.registerPlugin(e);const n=m.current.pluginKey;return x.current=!0,w(!0),()=>{w(!1),f.unregisterPlugin(n),window.requestAnimationFrame(()=>{t.parentNode&&t.parentNode.removeChild(t)})}},[f]),zt(()=>{y&&f&&!f.isDestroyed&&(x.current?x.current=!1:f.view.dispatch(f.state.tr.setMeta(u,{type:"updateOptions",options:m.current})))},[y,f,n,r,o,l,i,s,u]),Kt(c,d.current)});Nt.forwardRef(({pluginKey:t,editor:e,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:o=null,options:s,children:l,...c},a)=>{const h=Lt(document.createElement("div")),d=Lt(be(t,"floatingMenu")).current;Ue(h.current,c),"function"==typeof a?a(h.current):a&&(a.current=h.current);const{editor:u}=It(),p=e||u,f={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:o,options:s},g=Lt(f);g.current=f;const[m,y]=$t(!1),w=Lt(!0);return zt(()=>{if(null==p?void 0:p.isDestroyed)return;if(!p)return;const t=h.current;t.style.visibility="hidden",t.style.position="absolute";const e=xe({...g.current,editor:p,element:t});p.registerPlugin(e);const n=g.current.pluginKey;return w.current=!0,y(!0),()=>{y(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{t.parentNode&&t.parentNode.removeChild(t)})}},[p]),zt(()=>{m&&p&&!p.isDestroyed&&(w.current?w.current=!1:p.view.dispatch(p.state.tr.setMeta(d,{type:"updateOptions",options:g.current})))},[m,p,n,r,o,s,i,d]),Kt(l,h.current)});function Le(t,e){const{state:n}=e,r=n.selection.$anchor;let i=!1;if(r.depth)for(let o=r.depth;o>0;o--)r.node(o).type.name===t&&(e.dispatchTransaction&&e.dispatchTransaction(n.tr.delete(r.before(o),r.after(o)).scrollIntoView()),i=!0);else{const r=n.selection.node;r&&r.type.name===t&&(e.chain().deleteSelection().run(),i=!0)}if(!i){const o=r.pos;if(o){const r=n.tr.doc.nodeAt(o);r&&r.type.name===t&&(e.dispatchTransaction&&e.dispatchTransaction(n.tr.delete(o,o+r.nodeSize)),i=!0)}}return i}var $e=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function je(){const e=K(),n=W(),{t:i}=r(),{type:o,title:l,body:c}=ft(n,H.name,{type:"note",title:"",body:""}),[a,h]=$t(!1),[d,u]=$t("note"),[p,f]=$t(""),[g,y]=$t("");zt(()=>{a&&(u(o||"note"),f(l||""),y(c||""))},[a,o,l,c]);const k=Rt(()=>{n&&(n.chain().updateAttributes(H.name,{type:d,title:p,body:g}).focus().run(),h(!1))},[n,d,p,g]),S=Rt(()=>{h(!1)},[]),C=Rt(()=>{Le(H.name,n)},[n]),_=Rt(()=>n.isActive(H.name),[n]);return e?/* @__PURE__ */Ht(Pe,{editor:n,options:{placement:"top",offset:8,flip:!0},pluginKey:"RichTextBubbleCallout",shouldShow:_,children:/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[/* @__PURE__ */Bt(v,{onOpenChange:h,open:a,children:[/* @__PURE__ */Ht(x,{asChild:!0,children:/* @__PURE__ */Ht(t,{icon:"Pencil",tooltip:i("editor.callout.edit.title")})}),/* @__PURE__ */Bt(w,{children:[
4
+ /* @__PURE__ */Ht(m,{children:i("editor.callout.edit.title")}),
5
+ /* @__PURE__ */Bt("div",{className:"richtext-space-y-4 richtext-py-4",children:[
6
+ /* @__PURE__ */Bt("div",{className:"richtext-space-y-2",children:[/* @__PURE__ */Ht(N,{children:i("editor.callout.dialog.type")}),/* @__PURE__ */Bt($,{onValueChange:u,value:d,children:[/* @__PURE__ */Ht(L,{children:/* @__PURE__ */Ht(j,{className:"richtext-text-accent",placeholder:i("editor.callout.dialog.type.placeholder")})}),/* @__PURE__ */Ht(P,{children:$e.map(t=>/* @__PURE__ */Ht(U,{value:t.value,children:i(`editor.callout.type.${t.value}`)},t.value))})]})]}),
7
+ /* @__PURE__ */Bt("div",{className:"richtext-space-y-2",children:[/* @__PURE__ */Ht(N,{children:i("editor.callout.dialog.title.label")}),/* @__PURE__ */Ht(I,{onChange:t=>f(t.target.value),placeholder:i("editor.callout.dialog.title.placeholder"),type:"text",value:p})]}),
8
+ /* @__PURE__ */Bt("div",{className:"richtext-space-y-2",children:[/* @__PURE__ */Ht(N,{children:i("editor.callout.dialog.body.label")}),/* @__PURE__ */Ht(I,{onChange:t=>y(t.target.value),placeholder:i("editor.callout.dialog.body.placeholder"),type:"text",value:g})]})]}),
9
+ /* @__PURE__ */Bt(b,{children:[/* @__PURE__ */Ht(s,{onClick:S,variant:"outline",children:i("editor.callout.dialog.button.cancel")}),/* @__PURE__ */Ht(s,{onClick:k,children:i("editor.callout.dialog.button.apply")})]})]})]}),/* @__PURE__ */Ht(t,{action:C,icon:"Trash2",tooltip:i("editor.delete")})]})}):/* @__PURE__ */Ht(jt,{})}function He(){const e=K(),n=W(),{t:i}=r(),o=Rt(()=>n.isActive(wt.name),[n]),s=Rt(()=>Le(wt.name,n),[n]),l=Rt(()=>n.chain().focus().addColBefore().run(),[n]),c=Rt(()=>n.chain().focus().addColAfter().run(),[n]),a=Rt(()=>n.chain().focus().deleteCol().run(),[n]);return e?/* @__PURE__ */Ht(Pe,{editor:n,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleColumns",shouldShow:o,children:/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[
10
+ /* @__PURE__ */Ht(t,{action:l,icon:"ColumnAddLeft",tooltip:i("editor.table.menu.insertColumnBefore")}),
11
+ /* @__PURE__ */Ht(t,{action:c,icon:"ColumnAddRight",tooltip:i("editor.table.menu.insertColumnAfter")}),
12
+ /* @__PURE__ */Ht(t,{action:a,icon:"DeleteColumn",tooltip:i("editor.table.menu.deleteColumn")}),
13
+ /* @__PURE__ */Ht(t,{action:s,icon:"Trash2",tooltip:i("editor.table.menu.delete_column")})]})}):/* @__PURE__ */Ht(jt,{})}function Be(e,r){const i=["SizeS","SizeM","SizeL"];return["size-small","size-medium","size-large"].map((o,s)=>({type:`image-${o}`,component:t,componentProps:{tooltip:r(`editor.${o.replace("-",".")}.tooltip`),icon:i[s],action:()=>e.commands.updateImage({width:n[o]}),isActive:()=>e.isActive("image",{width:n[o]})}}))}function Fe(e,r){const i=["SizeS","SizeM","SizeL"];return["size-small","size-medium","size-large"].map((o,s)=>({type:`image-${o}`,component:t,componentProps:{tooltip:r(`editor.${o.replace("-",".")}.tooltip`),icon:i[s],action:()=>e.commands.updateImageGif({width:n[o]}),isActive:()=>e.isActive("image",{width:n[o]})}}))}function Ve(e,n){const r={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return["left","center","right"].map(i=>({type:`image-${i}`,component:t,componentProps:{tooltip:n(`editor.textalign.${i}.tooltip`),icon:r[i],action:()=>e.commands?.setAlignImage?.(i),isActive:()=>e.isActive({align:i})||!1,disabled:!1}}))}function Je(e,n){const r={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return["left","center","right"].map(i=>({type:`image-${i}`,component:t,componentProps:{tooltip:n(`editor.textalign.${i}.tooltip`),icon:r[i],action:()=>e.commands?.setAlignImageGif?.(i),isActive:()=>e.isActive({align:i})||!1,disabled:!1}}))}function We(e,n){const r={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return["left","center","right"].map(i=>({type:`image-${i}`,component:t,componentProps:{tooltip:n(`editor.textalign.${i}.tooltip`),icon:r[i],action:()=>e.commands?.setAlignImageMermaid?.(i),isActive:()=>e.isActive({align:i})||!1,disabled:!1}}))}function Ke(e,n){const r={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return["left","center","right"].map(i=>({type:`image-${i}`,component:t,componentProps:{tooltip:n(`editor.textalign.${i}.tooltip`),icon:r[i],action:()=>e.commands?.setAlignImageDrawer?.(i),isActive:()=>e.isActive({align:i})||!1,disabled:!1}}))}function qe(e){return[{type:"flex-start",icon:"AlignLeft",tooltip:"Align left"},{type:"center",icon:"AlignCenter",tooltip:"Align center"},{type:"flex-end",icon:"AlignRight",tooltip:"Align right"}].map(n=>({type:`video-align-${n.type}`,component:t,componentProps:{tooltip:n.tooltip,icon:n.icon,action:()=>e.commands.updateVideo({align:n.type}),isActive:()=>e.getAttributes("video").align===n.type}}))}function Ge(e,n){const r=["SizeS","SizeM","SizeL"];return["size-small","size-medium","size-large"].map((o,s)=>({type:`video-${o}`,component:t,componentProps:{tooltip:n(`editor.${o.replace("-",".")}.tooltip`),icon:r[s],action:()=>e.commands.updateVideo({width:i[o]}),isActive:()=>e.isActive("video",{width:i[o]})}}))}var Xe=!1;function Ye({editor:e,attrs:n,extension:r}){const[i,o]=$t(!1),l=Lt(null),c=Lt(null),{alt:a,align:h}=n,d=r?.options.upload;zt(()=>{i&&setTimeout(()=>{(async()=>{const t=document.querySelector("#easydrawer");t&&(l.current=new fe(t,{wheelEventsEnabled:!1,disableZoom:!0}),c.current=ge(l.current),c.current.addDefaultToolWidgets(),l.current.loadFromSVG(decodeURIComponent(a)))})()},200)},[i]);const u=()=>{if(Xe){for(;l.current.history.redoStackSize>0;)l.current.history.redo();Xe=!1}else l.current.history.undo()};/* @__PURE__ */
14
+ return Bt(v,{onOpenChange:o,open:i,children:[/* @__PURE__ */Ht(x,{asChild:!0,children:/* @__PURE__ */Ht(t,{action:()=>o(!0),icon:"Pencil",tooltip:"Edit Drawer"})}),/* @__PURE__ */Bt(w,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[
15
+ /* @__PURE__ */Ht(m,{children:"Edit Drawer"}),
16
+ /* @__PURE__ */Bt("div",{style:{height:"100%",borderWidth:1,background:"white",position:"relative"},children:[/* @__PURE__ */Ht("div",{className:"richtext-size-full",id:"easydrawer"}),/* @__PURE__ */Ht(Et,{changeBorderColorShape:t=>{const e=l.current.toolController.getPrimaryTools()[5],n=c.current.getWidgetById("shape");e&&n&&(e.setBorderColor(t),n.serializeState())},changeColorShape:t=>{const e=l.current.toolController.getPrimaryTools()[5],n=c.current.getWidgetById("shape");e&&n&&(e.setColor(t),n.serializeState())},changeShape:t=>{const e=c.current.getWidgetById("shape");e&&e.setShapeType(t)},onClear:()=>{if(!Xe){for(;l.current.history.undoStackSize>0;)u();Xe=!0}},onRedo:()=>{Xe||l.current.history.redo()},onThicknessChange:t=>{const e=l.current.toolController.getPrimaryTools()[5],n=c.current.getWidgetById("shape");e&&n&&(e.setThickness(t),n.serializeState())},onUndo:u,refEditor:l,setColorHighlight:t=>{const e=l.current.toolController.getPrimaryTools()[3],n=c.current.getWidgetById("pen-2");e&&n&&(e.setColor(t),n.serializeState())},setColorPen:t=>{const e=l.current.toolController.getPrimaryTools()[2],n=c.current.getWidgetById("pen-1");e&&n&&(e.setColor(t),n.serializeState())},setThicknessPen:t=>{const e=l.current.toolController.getPrimaryTools()[2],n=c.current.getWidgetById("pen-1");e&&n&&(e.setThickness(t),n.serializeState())}})]}),
17
+ /* @__PURE__ */Ht(b,{children:/* @__PURE__ */Ht(s,{onClick:async()=>{if(l.current){const t=l.current.toSVG(),n=t.outerHTML,r=`drawer-${Ct()}.svg`;let i=St(t.outerHTML);if(d){const t=G(i,r);i=await d(t)}e?.chain().focus().setDrawer({type:"drawer",src:i,alt:encodeURIComponent(n),width:426,height:212},!!n).run(),e?.commands.setAlignImageDrawer(h)}o(!1)},type:"button",children:"Save changes"})})]})]})}function Ze({item:t,disabled:n,editor:r}){const i=t.component;return i?/* @__PURE__ */Ht(Mt,{children:"divider"===t.type?/* @__PURE__ */Ht(e,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):/* @__PURE__ */Ht(i,{...t.componentProps,disabled:n||t?.componentProps?.disabled,editor:r})}):/* @__PURE__ */Ht(jt,{})}function Qe(){const{lang:e,t:n}=r(),i=K(),o=W(),s=ft(o,Ot.name),l=q(Ot.name),c=Pt(()=>function(e,n){return[...Ke(e,n),{type:"edit",component:t,componentProps:{editor:e,tooltip:n("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:t,componentProps:{editor:e,tooltip:n("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;pe(t,n)}}}]}(o,n),[o,e,n]);return i?/* @__PURE__ */Ht(Pe,{editor:o,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleDrawer",shouldShow:({editor:t})=>{const{selection:e}=t.view.state,{$from:n,to:r}=e;let i=!1;return t.view.state.doc.nodesBetween(n.pos,r,t=>{if(t.type.name===Ot.name)return i=!0,!1}),i},children:c?.length?/* @__PURE__ */Ht("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:c?.map((t,e)=>"edit"===t.type&&s?.src?/* @__PURE__ */Ht(Ye,{attrs:s,editor:o,extension:l},`bubbleMenu-drawer-${e}`):/* @__PURE__ */Ht(Ze,{editor:o,item:t},`bubbleMenu-drawer-${e}`))}):/* @__PURE__ */Ht(jt,{})}):/* @__PURE__ */Ht(jt,{})}var tn=({width:t,maxWidth:e,height:n,onOk:i,children:o})=>{const{t:l}=r(),[c,a]=$t({width:"",height:"",maxWidth:""});return zt(()=>{a({width:t,height:n,maxWidth:e})},[n,e,t]),/* @__PURE__ */Bt(z,{modal:!0,children:[/* @__PURE__ */Ht(R,{asChild:!0,children:o}),/* @__PURE__ */Ht(M,{children:/* @__PURE__ */Bt("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:function(t){t.preventDefault(),t.stopPropagation(),i(c)},children:[
18
+ /* @__PURE__ */Ht(N,{className:"mb-[6px]",children:"Width"}),
19
+ /* @__PURE__ */Ht("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:/* @__PURE__ */Ht("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:/* @__PURE__ */Ht(I,{onChange:t=>a({...c,width:t.target.value}),required:!0,type:"number",value:c.width})})}),
20
+ /* @__PURE__ */Ht(N,{className:"mb-[6px]",children:"Max Width"}),
21
+ /* @__PURE__ */Ht("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:/* @__PURE__ */Ht("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:/* @__PURE__ */Ht(I,{onChange:t=>a({...c,maxWidth:t.target.value}),required:!0,type:"number",value:c.maxWidth})})}),
22
+ /* @__PURE__ */Ht(N,{className:"mb-[6px]",children:"Height"}),
23
+ /* @__PURE__ */Ht("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:/* @__PURE__ */Ht("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:/* @__PURE__ */Ht(I,{onChange:t=>a({...c,height:t.target.value}),required:!0,type:"number",value:c.height})})}),
24
+ /* @__PURE__ */Ht(s,{className:"richtext-mt-2 richtext-self-end",type:"submit",children:l("editor.link.dialog.button.apply")})]})})]})},en=/* @__PURE__ */new Map;function nn(){const e=K(),n=W(),{t:i}=r(),{width:o}=function(t){const e=t.options.element;en.has("width")||en.set("width",e.clientWidth),en.has("width")&&en.get("width")<=0&&en.set("width",e.clientWidth);const n=new MutationObserver(function(){en.set("width",e.clientWidth)});return n.observe(e,{attributes:!0,childList:!0,subtree:!0}),t.on("destroy",()=>{n.disconnect()}),{width:en.get("width")}}(n),s=ft(n,_t.name,{defaultShowPicker:!1,createUser:"",width:0,height:0}),{defaultShowPicker:l,createUser:c,width:a,height:h}=s,d=Rt(t=>{n.chain().updateAttributes(_t.name,t).setNodeSelection(n.state.selection.from).focus().run()},[n]),u=Rt(()=>{const t=J.DRAWIO?.(n.id)||`drawio-${n.id}`;V(t,s)},[n,s]),p=Rt(()=>n.isActive(_t.name),[n]),f=Rt(()=>Le(_t.name,n),[n]);return zt(()=>{l&&(u(),n.chain().updateAttributes(_t.name,{defaultShowPicker:!1}).focus().run())},[c,l,n,u]),e?/* @__PURE__ */Ht(Pe,{editor:n,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleDrawio",shouldShow:p,children:/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[
25
+ /* @__PURE__ */Ht(t,{action:u,icon:"Pencil",tooltip:i("editor.edit")}),
26
+ /* @__PURE__ */Ht(tn,{height:h,maxWidth:o,onOk:d,width:a,children:/* @__PURE__ */Ht(t,{icon:"Settings",tooltip:i("editor.settings")})}),
27
+ /* @__PURE__ */Ht(t,{action:f,icon:"Trash2",tooltip:i("editor.delete")})]})}):/* @__PURE__ */Ht(jt,{})}function rn(){const e=K(),n=W(),{t:i}=r(),{width:o,height:l,src:c}=ft(n,Dt.name,{width:0,height:0,src:"",defaultShowPicker:!1}),[a,h]=$t(!1),[d,u]=$t(""),p=Rt(t=>{t?.preventDefault?.(),h(!1)},[h]);zt(()=>{a&&u(c)},[a,c]);const f=Rt(t=>{t?.preventDefault?.();const e=At(d);n.chain().updateAttributes(Dt.name,{src:e?.src||d}).setNodeSelection(n.state.selection.from).focus().run(),h(!1)},[n,d,h]),g=Rt(()=>{window.open(c,"_blank")},[c]),k=Rt(t=>{n.chain().updateAttributes(Dt.name,t).setNodeSelection(n.state.selection.from).focus().run()},[n]),S=Rt(()=>n.isActive(Dt.name)&&!c,[n,c]),C=Rt(()=>Le(Dt.name,n),[n]);/* @__PURE__ */
28
+ return Ht(jt,e?{children:/* @__PURE__ */Ht(Pe,{editor:n,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleIframe",shouldShow:S,children:/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[
29
+ /* @__PURE__ */Ht(t,{action:g,icon:"Eye",tooltip:"Visit Link"}),
30
+ /* @__PURE__ */Bt(v,{onOpenChange:h,open:a,children:[/* @__PURE__ */Ht(x,{asChild:!0,children:/* @__PURE__ */Ht(t,{icon:"Pencil",tooltip:"Open Edit Link"})}),/* @__PURE__ */Bt(w,{children:[
31
+ /* @__PURE__ */Ht(y,{children:/* @__PURE__ */Ht(m,{children:"Edit Link Iframe"})}),
32
+ /* @__PURE__ */Ht(I,{autoFocus:!0,onInput:t=>u(t.target.value),placeholder:"Enter link",type:"url",value:d}),
33
+ /* @__PURE__ */Bt(b,{children:[/* @__PURE__ */Ht(s,{onClick:p,type:"button",children:"Cancel"}),/* @__PURE__ */Ht(s,{onClick:f,type:"button",children:"OK"})]})]})]}),
34
+ /* @__PURE__ */Ht(tn,{height:l,onOk:k,width:o,children:/* @__PURE__ */Ht(t,{icon:"Settings",tooltip:i("editor.settings")})}),
35
+ /* @__PURE__ */Ht(t,{action:C,icon:"Trash2",tooltip:i("editor.delete")})]})})}:{})}function on({children:t,visible:e,toggleVisible:n}){const{t:i}=r(),o=W(),[l,c]=$t(null);zt(()=>{vt().then(c)},[]);const{text:a,macros:h}=ft(o,gt.name,{text:"",macros:""}),[d,u]=$t(decodeURIComponent(a||"")),[p,f]=$t(decodeURIComponent(h||""));zt(()=>{e&&(u(decodeURIComponent(a||"")),f(decodeURIComponent(h||"")))},[e]);const g=Rt(()=>{o.chain().focus().setKatex({text:encodeURIComponent(d),macros:encodeURIComponent(p)}).run(),u(""),f(""),n(!1)},[o,d,p,n]),y=Pt(()=>{if(!l)return d;try{return l.renderToString(d,{macros:pt(p||"")})}catch{return d}},[d,p,l]),k=Pt(()=>`${d}`.trim()?y:null,[d,y]);/* @__PURE__ */
36
+ return Bt(v,{onOpenChange:n,open:e,children:[/* @__PURE__ */Ht(x,{asChild:!0,children:t}),/* @__PURE__ */Bt(w,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[
37
+ /* @__PURE__ */Ht(m,{children:i("editor.formula.dialog.text")}),
38
+ /* @__PURE__ */Ht("div",{style:{height:"100%",border:"1px solid hsl(var(--border))"},children:/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[/* @__PURE__ */Bt("div",{className:"richtext-flex-1",children:[
39
+ /* @__PURE__ */Ht(N,{className:"mb-[6px]",children:"Expression"}),
40
+ /* @__PURE__ */Ht(B,{autoFocus:!0,className:"richtext-mb-[10px]",onChange:t=>u(t.target.value),placeholder:"Text",required:!0,rows:10,value:d,style:{color:"hsl(var(--foreground))"}}),
41
+ /* @__PURE__ */Ht(N,{className:"mb-[6px]",children:"Macros"}),
42
+ /* @__PURE__ */Ht(B,{onChange:t=>f(t.target.value),placeholder:"Macros",rows:10,value:p,style:{color:"hsl(var(--foreground))"}})]}),/* @__PURE__ */Ht("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:k||""},style:{height:"100%",borderWidth:1,minHeight:500,background:"#fff"}})]})}),
43
+ /* @__PURE__ */Ht(b,{children:/* @__PURE__ */Ht(s,{onClick:g,type:"button",children:"Save changes"})})]})]})}function sn(){const e=K(),n=W(),[r,i]=$t(!1),o=Rt(()=>n.isActive(gt.name),[n]),s=Rt(()=>Le(gt.name,n),[n]);return e?/* @__PURE__ */Ht(Pe,{editor:n,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleKatex",shouldShow:o,children:/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[/* @__PURE__ */Ht(on,{toggleVisible:i,visible:r,children:/* @__PURE__ */Ht(t,{action:()=>i(!r),tooltip:"Edit",children:/* @__PURE__ */Ht(Jt,{size:16})})}),/* @__PURE__ */Ht(t,{action:s,tooltip:"Delete",children:/* @__PURE__ */Ht(Wt,{size:16})})]})}):/* @__PURE__ */Ht(jt,{})}function ln(e){const{t:n}=r();/* @__PURE__ */
44
+ return Bt("div",{className:"richtext-flex richtext-flex-nowrap",children:[
45
+ /* @__PURE__ */Ht(t,{disabled:!e?.link,icon:"ExternalLink",tooltip:n("editor.link.open.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{window.open(e?.link,"_blank")}}),
46
+ /* @__PURE__ */Ht(t,{icon:"Pencil",tooltip:n("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{e?.onEdit()}}),
47
+ /* @__PURE__ */Ht(t,{icon:"Unlink",tooltip:n("editor.link.unlink.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{e?.onClear()}})]})}function cn(){const t=K(),e=W(),[n,r]=$t(!1),i=ft(e,ut.name)?.href,o=Rt(({editor:t})=>t.isActive(ut.name),[]),s=Rt(()=>{e.chain().extendMarkRange("link").unsetLink().focus().run(),r(!1)},[e]);return t?/* @__PURE__ */Ht(Pe,{editor:e,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleLink",shouldShow:o,children:/* @__PURE__ */Ht(jt,{children:/* @__PURE__ */Ht("div",n?{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:/* @__PURE__ */Ht(dt,{editor:e,onClose:()=>{r(!1)},onSetLink:(t,n,i)=>{const{from:o}=e.state.selection,s=o+(n?.length??0);e.chain().extendMarkRange("link").insertContent({type:"text",text:n,marks:[{type:"link",attrs:{href:t,target:i?"_blank":""}}]}).setLink({href:t}).setTextSelection({from:o,to:s}).focus().run(),r(!1)}})}:{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:/* @__PURE__ */Ht(ln,{editor:e,link:i,onClear:s,onEdit:()=>{r(!0)}})})})}):/* @__PURE__ */Ht(jt,{})}function an({item:t,disabled:n,editor:r}){const i=t.component;return i?/* @__PURE__ */Ht(Mt,{children:"divider"===t.type?/* @__PURE__ */Ht(e,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):/* @__PURE__ */Ht(i,{...t.componentProps,disabled:n||t?.componentdisabled,editor:r})}):/* @__PURE__ */Ht(jt,{})}function hn(){const{lang:e,t:n}=r(),i=K(),o=W(),s=Pt(()=>function(e,n){return[{type:"flipX",component:t,componentProps:{editor:e,tooltip:n("editor.tooltip.flipX"),icon:"FlipX",action:()=>{const{flipX:t}=e.getAttributes("image");e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!t}).run()}}},{type:"flipY",component:t,componentProps:{editor:e,tooltip:n("editor.tooltip.flipY"),icon:"FlipY",action:()=>{const{flipY:t}=e.getAttributes("image");e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!t}).run()}}},...Be(e,n),...Ve(e,n),{type:"remove",component:t,componentProps:{editor:e,tooltip:n("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;pe(t,n)}}}]}(o,n),[o,e,n]);return i?/* @__PURE__ */Ht(Pe,{editor:o,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleImage",shouldShow:({editor:t})=>{const{selection:e}=t.view.state,{$from:n,to:r}=e;let i=!1;return t.view.state.doc.nodesBetween(n.pos,r,t=>{if(function(t){return t.type.name===F.name}(t))return i=!0,!1}),i},children:s?.length?/* @__PURE__ */Ht("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:s?.map((t,e)=>/* @__PURE__ */Ht(an,{editor:o,item:t},`bubbleMenu-image-${e}`))}):/* @__PURE__ */Ht(jt,{})}):/* @__PURE__ */Ht(jt,{})}function dn(){const{lang:e,t:n}=r(),i=K(),o=W(),s=Pt(()=>function(e,n){return[...Fe(e,n),...Je(e,n),{type:"remove",component:t,componentProps:{editor:e,tooltip:n("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;pe(t,n)}}}]}(o,n),[o,n,e]);return i?/* @__PURE__ */Ht(Pe,{editor:o,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleImageGif",shouldShow:({editor:t})=>{const{selection:e}=t.view.state,{$from:n,to:r}=e;let i=!1;return t.view.state.doc.nodesBetween(n.pos,r,t=>{if(function(t){return t.type.name===mt.name}(t))return i=!0,!1}),i},children:s?.length?/* @__PURE__ */Ht("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:s?.map((t,e)=>/* @__PURE__ */Ht(an,{editor:o,item:t},`bubbleMenu-image-gif-${e}`))}):/* @__PURE__ */Ht(jt,{})}):/* @__PURE__ */Ht(jt,{})}function un(){const{t:e}=r(),n=K(),i=W(),o=Pt(()=>function(e,n){return[...Ge(e,n),...qe(e),{type:"remove",component:t,componentProps:{editor:e,tooltip:n("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;pe(t,n)}}}]}(i,e),[i,e]);return n?/* @__PURE__ */Ht(Pe,{editor:i,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleVideo",shouldShow:({editor:t})=>{const{selection:e}=t.view.state,{$from:n,to:r}=e;let i=!1;return t.view.state.doc.nodesBetween(n.pos,r,t=>{if(function(t){return t.type.name===X.name}(t))return i=!0,!1}),i},children:o?.length?/* @__PURE__ */Ht("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:o?.map((t,e)=>/* @__PURE__ */Ht(an,{editor:i,item:t},`bubbleMenu-video-${e}`))}):/* @__PURE__ */Ht(jt,{})}):/* @__PURE__ */Ht(jt,{})}var pn="graph TB\na--\x3eb",fn=({editor:e,attrs:n,extension:r})=>{const{alt:i,align:o}=n,[l,c]=$t(decodeURIComponent(i??pn)),[a,h]=$t(""),[d,u]=$t(!1),p=Lt(null),[f,g]=$t(null),y=r?.options.upload,k=Rt(t=>{t&&import("mermaid").then(t=>{g(t.default)})},[]),S=async t=>{try{const{svg:e}=await f.render("mermaid-svg",t);h(e)}catch{h("")}};zt(()=>{f&&d&&(f.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),S(l))},[f,d]),zt(()=>{f&&d&&S(l)},[f,l]);/* @__PURE__ */
48
+ return Bt(v,{onOpenChange:u,open:d,children:[/* @__PURE__ */Ht(x,{asChild:!0,children:/* @__PURE__ */Ht(t,{action:()=>u(!0),icon:"Pencil",tooltip:"Edit Mermaid"})}),/* @__PURE__ */Bt(w,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[
49
+ /* @__PURE__ */Ht(m,{children:"Edit Mermaid"}),
50
+ /* @__PURE__ */Ht("div",{ref:k,style:{height:"100%",border:"1px solid hsl(var(--border))"},children:/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[/* @__PURE__ */Ht(B,{autoFocus:!0,className:"richtext-flex-1",defaultValue:pn,onChange:t=>c(t.target.value),placeholder:"Text",required:!0,rows:10,value:l,style:{color:"hsl(var(--foreground))"}}),/* @__PURE__ */Ht("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:a},ref:p,style:{height:"100%",border:"1px solid hsl(var(--border))",minHeight:500}})]})}),
51
+ /* @__PURE__ */Ht(b,{children:/* @__PURE__ */Ht(s,{onClick:async()=>{if(""!==l){if(l){const t=p.current.querySelector("svg"),{width:n,height:r}=t.getBoundingClientRect(),i=`mermaid-${Ct()}.svg`;let s=St(t.outerHTML);if(y){const t=G(s,i);s=await y(t)}e?.chain().focus().setMermaid({type:"mermaid",src:s,alt:encodeURIComponent(l),width:n,height:r},!!l).run(),e?.commands.setAlignImageMermaid(o)}u(!1)}},type:"button",children:"Save changes"})})]})]})};function gn({item:t,disabled:n,editor:r}){const i=t.component;return i?/* @__PURE__ */Ht(Mt,{children:"divider"===t.type?/* @__PURE__ */Ht(e,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):/* @__PURE__ */Ht(i,{...t.componentProps,disabled:n||t?.componentProps?.disabled,editor:r})}):/* @__PURE__ */Ht(jt,{})}function mn(){const{lang:e,t:n}=r(),i=K(),o=W(),s=ft(o,kt.name),l=q(kt.name),c=Pt(()=>function(e,n){return[...We(e,n),{type:"edit",component:t,componentProps:{editor:e,tooltip:n("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:t,componentProps:{editor:e,tooltip:n("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;pe(t,n)}}}]}(o,n),[o,e,n]);return i?/* @__PURE__ */Ht(Pe,{editor:o,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleMermaid",shouldShow:({editor:t})=>{const{selection:e}=t.view.state,{$from:n,to:r}=e;let i=!1;return t.view.state.doc.nodesBetween(n.pos,r,t=>{if(function(t){return t.type.name===kt.name}(t))return i=!0,!1}),i},children:c?.length?/* @__PURE__ */Ht("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:c?.map((t,e)=>"edit"===t.type&&s?.src?/* @__PURE__ */Ht(fn,{attrs:s,editor:o,extension:l},`bubbleMenu-mermaid-${e}`):/* @__PURE__ */Ht(gn,{editor:o,item:t},`bubbleMenu-mermaid-${e}`))}):/* @__PURE__ */Ht(jt,{})}):/* @__PURE__ */Ht(jt,{})}function yn({hiddenActions:n=[]}){const{t:i}=r(),o=K(),s=W(),l=t=>n.includes(t);return o?/* @__PURE__ */Ht(Pe,{editor:s,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleTable",shouldShow:({editor:t})=>Qt(t.view.state,yt.name),children:/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[!l("addColumnBefore")&&/* @__PURE__ */Ht(t,{action:function(){s.chain().focus().addColumnBefore().run()},disabled:!s?.can()?.addColumnBefore?.(),icon:"BetweenHorizonalEnd",tooltip:i("editor.table.menu.insertColumnBefore"),tooltipOptions:{sideOffset:15}}),!l("addColumnAfter")&&/* @__PURE__ */Ht(t,{action:function(){s.chain().focus().addColumnAfter().run()},disabled:!s?.can()?.addColumnAfter?.(),icon:"BetweenHorizonalStart",tooltip:i("editor.table.menu.insertColumnAfter"),tooltipOptions:{sideOffset:15}}),!l("deleteColumn")&&/* @__PURE__ */Ht(t,{action:function(){s.chain().focus().deleteColumn().run()},disabled:!s?.can().deleteColumn?.(),icon:"DeleteColumn",tooltip:i("editor.table.menu.deleteColumn"),tooltipOptions:{sideOffset:15}}),
52
+ /* @__PURE__ */Ht(e,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!l("addRowAbove")&&/* @__PURE__ */Ht(t,{action:function(){s.chain().focus().addRowBefore().run()},disabled:!s?.can().addRowBefore?.(),icon:"BetweenVerticalEnd",tooltip:i("editor.table.menu.insertRowAbove"),tooltipOptions:{sideOffset:15}}),!l("addRowBelow")&&/* @__PURE__ */Ht(t,{action:function(){s.chain().focus().addRowAfter().run()},disabled:!s?.can()?.addRowAfter?.(),icon:"BetweenVerticalStart",tooltip:i("editor.table.menu.insertRowBelow"),tooltipOptions:{sideOffset:15}}),!l("deleteRow")&&/* @__PURE__ */Ht(t,{action:function(){s.chain().focus().deleteRow().run()},disabled:!s?.can()?.deleteRow?.(),icon:"DeleteRow",tooltip:i("editor.table.menu.deleteRow"),tooltipOptions:{sideOffset:15}}),
53
+ /* @__PURE__ */Ht(e,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!l("mergeCells")&&/* @__PURE__ */Ht(t,{action:function(){s.chain().focus().mergeCells().run()},disabled:!s?.can()?.mergeCells?.(),icon:"TableCellsMerge",tooltip:i("editor.table.menu.mergeCells"),tooltipOptions:{sideOffset:15}}),!l("splitCells")&&/* @__PURE__ */Ht(t,{action:function(){s?.chain().focus().splitCell().run()},disabled:!s?.can()?.splitCell?.(),icon:"TableCellsSplit",tooltip:i("editor.table.menu.splitCells"),tooltipOptions:{sideOffset:15}}),
54
+ /* @__PURE__ */Ht(e,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!l("deleteTable")&&/* @__PURE__ */Ht(t,{action:function(){s.chain().focus().deleteTable().run()},disabled:!s?.can()?.deleteTable?.(),icon:"Trash2",tooltip:i("editor.table.menu.deleteTable"),tooltipOptions:{sideOffset:15}})]})}):/* @__PURE__ */Ht(jt,{})}function wn(){const{t:e}=r(),[n,i]=$t(!1),s=W(),l=Pt(()=>Tt({t:e})?.[0]?.commands,[e]),c=Pt(()=>l?.find(t=>t?.isActive?.(s))?.label,[s.state.selection.ranges,n,s,l,e]),a=Pt(()=>l?.find(t=>t?.isActive?.(s)),[s.state.selection.ranges,n,s,l]);/* @__PURE__ */
55
+ return Bt(z,{modal:!0,onOpenChange:i,open:n,children:[/* @__PURE__ */Ht(R,{asChild:!0,className:"hover:richtext-bg-accent data-[state=on]:richtext-bg-accent",children:/* @__PURE__ */Ht(t,{dataState:!!c,tooltip:c||e("editor.paragraph.tooltip"),children:/* @__PURE__ */Ht(o,{name:a?.iconName||"Type"})})}),/* @__PURE__ */Ht(M,{align:"start",className:"!richtext-w-[initial] !richtext-p-[4px]",hideWhenDetached:!0,side:"bottom",children:l?.map(t=>{const n=t?.isActive?.(s);/* @__PURE__ */
56
+ return Bt("div",{className:"richtext-flex richtext-w-full richtext-items-center richtext-gap-1.5 richtext-rounded-sm !richtext-border-none !richtext-bg-transparent richtext-px-2 richtext-py-1.5 richtext-text-left richtext-text-sm richtext-text-foreground !richtext-outline-none richtext-transition-colors hover:!richtext-bg-accent",onClick:e=>{e.preventDefault(),t.action({editor:s,range:s.state.selection.ranges}),i(!1)},children:[/* @__PURE__ */Bt("div",{className:"!richtext-min-w-[16px]",children:[n&&/* @__PURE__ */Ht(Ft,{size:16}),!c&&t.label===e("editor.paragraph.tooltip")&&!n&&/* @__PURE__ */Ht(Ft,{size:16})]}),/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-items-center richtext-gap-1",children:[t.iconName&&/* @__PURE__ */Ht(o,{className:"!richtext-mr-1 !richtext-text-lg",name:t.iconName}),t.label]})]},t.name)})})]})}function xn(){/* @__PURE__ */
57
+ return Bt(jt,{children:[
58
+ /* @__PURE__ */Ht(wn,{}),
59
+ /* @__PURE__ */Ht(e,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),
60
+ /* @__PURE__ */Ht(Q,{}),
61
+ /* @__PURE__ */Ht(tt,{}),
62
+ /* @__PURE__ */Ht(et,{}),
63
+ /* @__PURE__ */Ht(it,{}),
64
+ /* @__PURE__ */Ht(ht,{}),
65
+ /* @__PURE__ */Ht(e,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),
66
+ /* @__PURE__ */Ht(rt,{}),
67
+ /* @__PURE__ */Ht(nt,{}),
68
+ /* @__PURE__ */Ht(ct,{})]})}function bn({buttonBubble:t}){const e=W();return K()?/* @__PURE__ */Ht(Pe,{editor:e,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleText",shouldShow:({editor:t})=>{const{selection:e}=t.view.state,{$from:n,to:r}=e;return!t.isActive("codeBlock")&&(n.pos!==r&&e instanceof ce)},children:t?/* @__PURE__ */Ht(jt,{children:t}):/* @__PURE__ */Ht("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:/* @__PURE__ */Ht(xn,{})})}):/* @__PURE__ */Ht(jt,{})}function vn(){const{t:e}=r(),n=K(),i=W(),[o,s]=$t(!1),l=Rt(({editor:t})=>t.isActive(bt.name),[]),c=Rt(()=>Le(bt.name,i),[i]);return n?/* @__PURE__ */Ht(Pe,{editor:i,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleTwitter",shouldShow:l,children:/* @__PURE__ */Ht(jt,{children:o?/* @__PURE__ */Ht("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:/* @__PURE__ */Ht(xt,{editor:i,onSetLink:t=>{i.commands.updateTweet({src:t}),s(!1)}})}):/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[/* @__PURE__ */Ht(t,{icon:"Pencil",tooltip:e("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{s(!0)}}),/* @__PURE__ */Ht(t,{action:c,icon:"Trash",tooltip:e("editor.delete"),tooltipOptions:{sideOffset:15}})]})})}):/* @__PURE__ */Ht(jt,{})}var kn=()=>/* @__PURE__ */new Map,Sn=t=>{const e=kn();return t.forEach((t,n)=>{e.set(n,t)}),e},Cn=(t,e,n)=>{let r=t.get(e);return void 0===r&&t.set(e,r=n()),r},_n=()=>/* @__PURE__ */new Set,En=t=>t[t.length-1],On=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},An=Array.from,Dn=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},Tn=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},In=Array.isArray,Nn=class{constructor(){this._observers=kn()}on(t,e){return Cn(this._observers,t,_n).add(e),e}once(t,e){const n=(...r)=>{this.off(t,n),e(...r)};this.on(t,n)}off(t,e){const n=this._observers.get(t);void 0!==n&&(n.delete(e),0===n.size&&this._observers.delete(t))}emit(t,e){return An((this._observers.get(t)||kn()).values()).forEach(t=>t(...e))}destroy(){this._observers=kn()}},Mn=Math.floor,Rn=Math.abs,zn=(t,e)=>t<e?t:e,Un=(t,e)=>t>e?t:e,Pn=(Number.isNaN,t=>0!==t?t<0:1/t<0),Ln=Number.MAX_SAFE_INTEGER,$n=Number.MIN_SAFE_INTEGER,jn=Number.isInteger||(t=>"number"==typeof t&&isFinite(t)&&Mn(t)===t),Hn=(Number.isNaN,Number.parseInt,String.fromCharCode),Bn=(String.fromCodePoint,Hn(65535),/^\s*/g),Fn=/([A-Z])/g,Vn=(t,e)=>(t=>t.replace(Bn,""))(t.replace(Fn,t=>`${e}${(t=>t.toLowerCase())(t)}`)),Jn="undefined"!=typeof TextEncoder?new TextEncoder:null,Wn=Jn?t=>Jn.encode(t):t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},Kn="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Kn&&1===Kn.decode(/* @__PURE__ */new Uint8Array).length&&(Kn=null);var qn=(t,e)=>((t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n})(e,()=>t).join(""),Gn=class{constructor(){this.cpos=0,this.cbuf=/* @__PURE__ */new Uint8Array(100),this.bufs=[]}},Xn=()=>new Gn,Yn=t=>{const e=new Uint8Array((t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e})(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},Zn=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(2*n),t.cpos=0),t.cbuf[t.cpos++]=e},Qn=Zn,tr=(t,e)=>{for(;e>127;)Zn(t,128|127&e),e=Mn(e/128);Zn(t,127&e)},er=(t,e)=>{const n=Pn(e);for(n&&(e=-e),Zn(t,(e>63?128:0)|(n?64:0)|63&e),e=Mn(e/64);e>0;)Zn(t,(e>127?128:0)|127&e),e=Mn(e/128)},nr=/* @__PURE__ */new Uint8Array(3e4),rr=nr.length/3,ir=Jn&&Jn.encodeInto?(t,e)=>{if(e.length<rr){const n=Jn.encodeInto(e,nr).written||0;tr(t,n);for(let e=0;e<n;e++)Zn(t,nr[e])}else sr(t,Wn(e))}:(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;tr(t,r);for(let i=0;i<r;i++)Zn(t,n.codePointAt(i))},or=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=zn(n-r,e.length),o=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(Un(2*n,o)),t.cbuf.set(e.subarray(i)),t.cpos=o)},sr=(t,e)=>{tr(t,e.byteLength),or(t,e)},lr=(t,e)=>{((t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(2*Un(n,e)),t.cpos=0)})(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},cr=/* @__PURE__ */new DataView(/* @__PURE__ */new ArrayBuffer(4)),ar=(t,e)=>{switch(typeof e){case"string":Zn(t,119),ir(t,e);break;case"number":jn(e)&&Rn(e)<=2147483647?(Zn(t,125),er(t,e)):(n=e,cr.setFloat32(0,n),cr.getFloat32(0)===n?(Zn(t,124),((t,e)=>{lr(t,4).setFloat32(0,e,!1)})(t,e)):(Zn(t,123),((t,e)=>{lr(t,8).setFloat64(0,e,!1)})(t,e)));break;case"bigint":Zn(t,122),((t,e)=>{lr(t,8).setBigInt64(0,e,!1)})(t,e);break;case"object":if(null===e)Zn(t,126);else if(In(e)){Zn(t,117),tr(t,e.length);for(let n=0;n<e.length;n++)ar(t,e[n])}else if(e instanceof Uint8Array)Zn(t,116),sr(t,e);else{Zn(t,118);const n=Object.keys(e);tr(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];ir(t,i),ar(t,e[i])}}break;case"boolean":Zn(t,e?120:121);break;default:Zn(t,127)}var n},hr=class extends Gn{constructor(t){super(),this.w=t,this.s=null,this.count=0}write(t){this.s===t?this.count++:(this.count>0&&tr(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}},dr=t=>{t.count>0&&(er(t.encoder,1===t.count?t.s:-t.s),t.count>1&&tr(t.encoder,t.count-2))},ur=class{constructor(){this.encoder=new Gn,this.s=0,this.count=0}write(t){this.s===t?this.count++:(dr(this),this.count=1,this.s=t)}toUint8Array(){return dr(this),Yn(this.encoder)}},pr=t=>{if(t.count>0){const e=2*t.diff+(1===t.count?0:1);er(t.encoder,e),t.count>1&&tr(t.encoder,t.count-2)}},fr=class{constructor(){this.encoder=new Gn,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(pr(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return pr(this),Yn(this.encoder)}},gr=class{constructor(){this.sarr=[],this.s="",this.lensE=new ur}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){const t=new Gn;return this.sarr.push(this.s),this.s="",ir(t,this.sarr.join("")),or(t,this.lensE.toUint8Array()),Yn(t)}},mr=t=>new Error(t),yr=()=>{throw mr("Method unimplemented")},wr=()=>{throw mr("Unexpected case")},xr=mr("Unexpected end of array"),br=mr("Integer out of Range"),vr=class{constructor(t){this.arr=t,this.pos=0}},kr=t=>new vr(t),Sr=t=>((t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n})(t,_r(t)),Cr=t=>t.arr[t.pos++],_r=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const r=t.arr[t.pos++];if(e+=(127&r)*n,n*=128,r<128)return e;if(e>Ln)throw br}throw xr},Er=t=>{let e=t.arr[t.pos++],n=63&e,r=64;const i=(64&e)>0?-1:1;if(!(128&e))return i*n;const o=t.arr.length;for(;t.pos<o;){if(e=t.arr[t.pos++],n+=(127&e)*r,r*=128,e<128)return i*n;if(n>Ln)throw br}throw xr},Or=Kn?t=>Kn.decode(Sr(t)):t=>{let e=_r(t);if(0===e)return"";{let n=String.fromCodePoint(Cr(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Cr(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},Ar=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},Dr=[t=>{},t=>null,Er,t=>Ar(t,4).getFloat32(0,!1),t=>Ar(t,8).getFloat64(0,!1),t=>Ar(t,8).getBigInt64(0,!1),t=>!1,t=>!0,Or,t=>{const e=_r(t),n={};for(let r=0;r<e;r++){n[Or(t)]=Tr(t)}return n},t=>{const e=_r(t),n=[];for(let r=0;r<e;r++)n.push(Tr(t));return n},Sr],Tr=t=>Dr[127-Cr(t)](t),Ir=class extends vr{constructor(t,e){super(t),this.reader=e,this.s=null,this.count=0}read(){var t;return 0===this.count&&(this.s=this.reader(this),(t=this).pos!==t.arr.length?this.count=_r(this)+1:this.count=-1),this.count--,this.s}},Nr=class extends vr{constructor(t){super(t),this.s=0,this.count=0}read(){if(0===this.count){this.s=Er(this);const t=Pn(this.s);this.count=1,t&&(this.s=-this.s,this.count=_r(this)+2)}return this.count--,this.s}},Mr=class extends vr{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(0===this.count){const t=Er(this),e=1&t;this.diff=Mn(t/2),this.count=1,e&&(this.count=_r(this)+2)}return this.s+=this.diff,this.count--,this.s}},Rr=class{constructor(t){this.decoder=new Nr(t),this.str=Or(this.decoder),this.spos=0}read(){const t=this.spos+this.decoder.read(),e=this.str.slice(this.spos,t);return this.spos=t,e}},zr=(crypto.subtle,crypto.getRandomValues.bind(crypto)),Ur=Math.random,Pr=()=>zr(/* @__PURE__ */new Uint32Array(1))[0],Lr=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(t^Pr()&15>>t/4).toString(16)),$r=Date.now,jr=t=>new Promise(t),Hr=(Promise.all.bind(Promise),t=>void 0===t?null:t),Br=new class{constructor(){this.map=/* @__PURE__ */new Map}setItem(t,e){this.map.set(t,e)}getItem(t){return this.map.get(t)}};try{"undefined"!=typeof localStorage&&localStorage&&(Br=localStorage,!1)}catch(Dd){}var Fr,Vr,Jr,Wr,Kr=Br,qr=Symbol("Equality"),Gr=(t,e)=>t===e||!!t?.[qr]?.(e)||!1,Xr=Object.assign,Yr=Object.keys,Zr=t=>Yr(t).length,Qr=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},ti=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),ei=Object.freeze,ni=t=>{for(const e in t){const n=t[e];"object"!=typeof n&&"function"!=typeof n||ni(t[e])}return ei(t)},ri=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&ri(t,e,n+1)}},ii=(t,e)=>{if(t===e)return!0;if(null==t||null==e||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(null!=t[qr])return t[qr](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break;case Set:if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break;case Map:if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!ii(t.get(n),e.get(n)))return!1;break;case void 0:case Object:if(Zr(t)!==Zr(e))return!1;for(const n in t)if(!ti(t,n)||!ii(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!ii(t[n],e[n]))return!1;break;default:return!1}return!0},oi="undefined"!=typeof process&&process.release&&/node|io\.js/.test(process.release.name)&&"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),si="undefined"!=typeof window&&"undefined"!=typeof document&&!oi,li=("undefined"!=typeof navigator&&/Mac/.test(navigator.platform),[]),ci=t=>(()=>{if(void 0===Fr)if(oi){Fr=kn();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];"-"===r[0]?(null!==e&&Fr.set(e,""),e=r):null!==e?(Fr.set(e,r),e=null):li.push(r)}null!==e&&Fr.set(e,"")}else"object"==typeof location?(Fr=kn(),(location.search||"?").slice(1).split("&").forEach(t=>{if(0!==t.length){const[e,n]=t.split("=");Fr.set(`--${Vn(e,"-")}`,n),Fr.set(`-${Vn(e,"-")}`,n)}})):Fr=kn();return Fr})().has(t),ai=t=>Hr(oi?process.env[t.toUpperCase().replaceAll("-","_")]:Kr.getItem(t)),hi=t=>ci("--"+t)||null!==ai(t),di=hi("production"),ui=oi&&(Vr=process.env.FORCE_COLOR,Jr=["true","1","2"],Jr.includes(Vr)),pi=(ui||!ci("--no-colors")&&!hi("no-color")&&(!oi||process.stdout.isTTY)&&(!oi||ci("--color")||null!==ai("COLORTERM")||(ai("TERM")||"").includes("color")),si?t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=Hn(t[n]);return btoa(e)}:t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64")),fi=t=>(t=>{const e=Xn();return t(e),Yn(e)})(e=>ar(e,t)),gi=class{constructor(t,e){this.left=t,this.right=e}},mi=(t,e)=>new gi(t,e),yi=t=>t.next()>=.5,wi=(t,e,n)=>Mn(t.next()*(n+1-e)+e),xi=(t,e,n)=>Mn(t.next()*(n+1-e)+e),bi=(t,e,n)=>xi(t,e,n),vi=t=>Hn(bi(t,97,122)),ki=(t,e)=>e[bi(t,0,e.length-1)],Si=Symbol("0schema"),Ci=class{constructor(){this._rerrs=[]}extend(t,e,n,r=null){this._rerrs.push({path:t,expected:e,has:n,message:r})}toString(){const t=[];for(let e=this._rerrs.length-1;e>0;e--){const n=this._rerrs[e];t.push(qn(" ",2*(this._rerrs.length-e))+`${null!=n.path?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return t.join("\n")}},_i=(t,e)=>t===e||null!=t&&null!=e&&t.constructor===e.constructor&&(t[qr]?Gr(t,e):In(t)?Dn(t,t=>Tn(e,e=>_i(t,e))):"object"==typeof t&&Qr(t,(t,n)=>_i(t,e[n]))),Ei=class{static _dilutes=!1;extends(t){let[e,n]=[this.shape,t.shape];return this.constructor._dilutes&&([n,e]=[e,n]),_i(e,n)}equals(t){return this.constructor===t.constructor&&ii(this.shape,t.shape)}[Si](){return!0}[qr](t){return this.equals(t)}validate(t){return this.check(t)}check(t,e){yr()}get nullable(){return no(this,wo)}get optional(){return new Pi(this)}cast(t){return ko(t,this),t}expect(t){return ko(t,this),t}},Oi=class extends Ei{constructor(t,e){super(),this.shape=t,this._c=e}check(t,e=void 0){const n=t?.constructor===this.shape&&(null==this._c||this._c(t));return!n&&e?.extend(null,this.shape.name,t?.constructor.name,t?.constructor!==this.shape?"Constructor match failed":"Check failed"),n}},Ai=(t,e=null)=>new Oi(t,e),Di=(Ai(Oi),class extends Ei{constructor(t){super(),this.shape=t}check(t,e){const n=this.shape(t);return!n&&e?.extend(null,"custom prop",t?.constructor.name,"failed to check custom prop"),n}}),Ti=t=>new Di(t),Ii=(Ai(Di),class extends Ei{constructor(t){super(),this.shape=t}check(t,e){const n=this.shape.some(e=>e===t);return!n&&e?.extend(null,this.shape.join(" | "),t.toString()),n}}),Ni=(...t)=>new Ii(t),Mi=Ai(Ii),Ri=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),zi=t=>po.check(t)?[Ri(t)]:Mi.check(t)?t.shape.map(t=>t+""):uo.check(t)?["[+-]?\\d+.?\\d*"]:fo.check(t)?[".*"]:ro.check(t)?t.shape.map(zi).flat(1):void wr(),Ui=(Ai(class extends Ei{constructor(t){super(),this.shape=t,this._r=new RegExp("^"+t.map(zi).map(t=>`(${t.join("|")})`).join("")+"$")}check(t,e){const n=null!=this._r.exec(t);return!n&&e?.extend(null,this._r.toString(),t.toString(),"String doesn't match string template."),n}}),Symbol("optional")),Pi=class extends Ei{constructor(t){super(),this.shape=t}check(t,e){const n=void 0===t||this.shape.check(t);return!n&&e?.extend(null,"undefined (optional)","()"),n}get[Ui](){return!0}},Li=Ai(Pi),$i=class extends Ei{check(t,e){return e?.extend(null,"never",typeof t),!1}},ji=(new $i,Ai($i),class t extends Ei{constructor(t,e=!1){super(),this.shape=t,this._isPartial=e}static _dilutes=!0;get partial(){return new t(this.shape,!0)}check(t,e){return null==t?(e?.extend(null,"object","null"),!1):Qr(this.shape,(n,r)=>{const i=this._isPartial&&!ti(t,r)||n.check(t[r],e);return!i&&e?.extend(r.toString(),n.toString(),typeof t[r],"Object property does not match"),i})}}),Hi=Ai(ji),Bi=Ti(t=>null!=t&&(t.constructor===Object||null==t.constructor)),Fi=class extends Ei{constructor(t,e){super(),this.shape={keys:t,values:e}}check(t,e){return null!=t&&Qr(t,(n,r)=>{const i=this.shape.keys.check(r,e);return!i&&e?.extend(r+"","Record",typeof t,i?"Key doesn't match schema":"Value doesn't match value"),i&&this.shape.values.check(n,e)})}},Vi=(t,e)=>new Fi(t,e),Ji=Ai(Fi),Wi=class extends Ei{constructor(t){super(),this.shape=t}check(t,e){return null!=t&&Qr(this.shape,(n,r)=>{const i=n.check(t[r],e);return!i&&e?.extend(r.toString(),"Tuple",typeof n),i})}},Ki=(Ai(Wi),class extends Ei{constructor(t){super(),this.shape=1===t.length?t[0]:new eo(t)}check(t,e){const n=In(t)&&Dn(t,t=>this.shape.check(t));return!n&&e?.extend(null,"Array",""),n}}),qi=(...t)=>new Ki(t),Gi=Ai(Ki),Xi=Ti(t=>In(t)),Yi=class extends Ei{constructor(t,e){super(),this.shape=t,this._c=e}check(t,e){const n=t instanceof this.shape&&(null==this._c||this._c(t));return!n&&e?.extend(null,this.shape.name,t?.constructor.name),n}},Zi=(Ai(Yi),((t,e=null)=>new Yi(t,e))(Ei)),Qi=Ai(class extends Ei{constructor(t){super(),this.len=t.length-1,this.args=((...t)=>new Wi(t))(...t.slice(-1)),this.res=t[this.len]}check(t,e){const n=t.constructor===Function&&t.length<=this.len;return!n&&e?.extend(null,"function",typeof t),n}}),to=Ti(t=>"function"==typeof t),eo=(Ai(class extends Ei{constructor(t){super(),this.shape=t}check(t,e){const n=Dn(this.shape,n=>n.check(t,e));return!n&&e?.extend(null,"Intersectinon",typeof t),n}},t=>t.shape.length>0),class extends Ei{static _dilutes=!0;constructor(t){super(),this.shape=t}check(t,e){const n=Tn(this.shape,n=>n.check(t,e));return e?.extend(null,"Union",typeof t),n}}),no=(...t)=>t.findIndex(t=>ro.check(t))>=0?no(...t.map(t=>vo(t)).map(t=>ro.check(t)?t.shape:[t]).flat(1)):1===t.length?t[0]:new eo(t),ro=Ai(eo),io=()=>!0,oo=Ti(io),so=Ai(Di,t=>t.shape===io),lo=Ti(t=>"bigint"==typeof t),co=Ti(t=>t===lo),ao=Ti(t=>"symbol"==typeof t),ho=(Ti(t=>t===ao),Ti(t=>"number"==typeof t)),uo=Ti(t=>t===ho),po=Ti(t=>"string"==typeof t),fo=Ti(t=>t===po),go=Ti(t=>"boolean"==typeof t),mo=Ti(t=>t===go),yo=Ni(void 0),wo=(Ai(Ii,t=>1===t.shape.length&&void 0===t.shape[0]),Ni(void 0),Ni(null)),xo=Ai(Ii,t=>1===t.shape.length&&null===t.shape[0]),bo=(Ai(Uint8Array),Ai(Oi,t=>t.shape===Uint8Array),no(ho,po,wo,yo,lo,go,ao)),vo=((()=>{const t=qi(oo),e=Vi(po,oo),n=no(ho,po,wo,go,t,e);t.shape=n,e.shape.values=n})(),t=>{if(Zi.check(t))return t;if(Bi.check(t)){const e={};for(const n in t)e[n]=vo(t[n]);return new ji(e)}return Xi.check(t)?no(...t.map(vo)):bo.check(t)?Ni(t):to.check(t)?Ai(t):void wr()}),ko=di?()=>{}:(t,e)=>{const n=new Ci;if(!e.check(t,n))throw mr(`Expected value to be of type ${e.constructor.name}.\n${n.toString()}`)},So=class{constructor(t){this.patterns=[],this.$state=t}if(t,e){return this.patterns.push({if:vo(t),h:e}),this}else(t){return this.if(oo,t)}done(){return(t,e)=>{for(let n=0;n<this.patterns.length;n++){const r=this.patterns[n];if(r.if.check(t))return r.h(t,e)}throw mr("Unhandled pattern")}}},Co=(Wr=oo,new So(Wr)).if(uo,(t,e)=>wi(e,$n,Ln)).if(fo,(t,e)=>((t,e=0,n=20)=>{const r=bi(t,e,n);let i="";for(let o=0;o<r;o++)i+=vi(t);return i})(e)).if(mo,(t,e)=>yi(e)).if(co,(t,e)=>BigInt(wi(e,$n,Ln))).if(ro,(t,e)=>_o(e,ki(e,t.shape))).if(Hi,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(Li.check(i)){if(yi(e))continue;i=i.shape}n[r]=Co(i,e)}return n}).if(Gi,(t,e)=>{const n=[],r=xi(e,0,42);for(let i=0;i<r;i++)n.push(_o(e,t.shape));return n}).if(Mi,(t,e)=>ki(e,t.shape)).if(xo,(t,e)=>null).if(Qi,(t,e)=>{const n=_o(e,t.res);return()=>n}).if(so,(t,e)=>_o(e,ki(e,[ho,po,wo,yo,lo,go,qi(ho),Vi(no("a","b","c"),ho)]))).if(Ji,(t,e)=>{const n={},r=wi(e,0,3);for(let i=0;i<r;i++){n[_o(e,t.shape.keys)]=_o(e,t.shape.values)}return n}).done(),_o=(t,e)=>Co(vo(e),t),Eo="undefined"!=typeof document?document:{},Oo=(Ti(t=>t.nodeType===To),"undefined"!=typeof DOMParser&&new DOMParser,Ti(t=>t.nodeType===Oo),Ti(t=>t.nodeType===Ao),Eo.ELEMENT_NODE),Ao=Eo.TEXT_NODE,Do=(Eo.CDATA_SECTION_NODE,Eo.COMMENT_NODE,Eo.DOCUMENT_NODE),To=(Eo.DOCUMENT_TYPE_NODE,Eo.DOCUMENT_FRAGMENT_NODE),Io=(Ti(t=>t.nodeType===Do),t=>class{constructor(t){this._=t}destroy(){t(this._)}}),No=Io(clearTimeout),Mo=(t,e)=>new No(setTimeout(e,t)),Ro=(Io(clearInterval),Io(t=>"undefined"!=typeof requestAnimationFrame&&cancelAnimationFrame(t)),Io(t=>"undefined"!=typeof cancelIdleCallback&&cancelIdleCallback(t)),Symbol),zo=Ro(),Uo=Ro(),Po=Ro(),Lo=Ro(),$o=Ro(),jo=Ro(),Ho=Ro(),Bo=Ro(),Fo=Ro(),Vo=($r(),mi("font-weight","bold"),mi("font-weight","normal"),mi("color","blue"),mi("color","green"),mi("color","grey"),mi("color","red"),mi("color","purple"),mi("color","orange"),mi("color","black"),(...t)=>{t.unshift(Bo),Jo.forEach(e=>e.print(t))}),Jo=_n(),Wo=t=>({[Symbol.iterator](){return this},next:t}),Ko=(t,e)=>Wo(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}}),qo=class{constructor(t,e){this.clock=t,this.len=e}},Go=class{constructor(){this.clients=/* @__PURE__ */new Map}},Xo=(t,e,n)=>e.clients.forEach((e,r)=>{const i=t.doc.store.clients.get(r);if(null!=i){const r=i[i.length-1],o=r.id.clock+r.length;for(let s=0,l=e[s];s<e.length&&l.clock<o;l=e[++s])Vs(t,i,l.clock,l.len,n)}}),Yo=(t,e)=>{const n=t.clients.get(e.client);return void 0!==n&&null!==((t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=Mn((n+r)/2),o=t[i],s=o.clock;if(s<=e){if(e<s+o.len)return i;n=i+1}else r=i-1}return null})(n,e.clock)},Zo=t=>{t.clients.forEach(t=>{let e,n;for(t.sort((t,e)=>t.clock-e.clock),e=1,n=1;e<t.length;e++){const r=t[n-1],i=t[e];r.clock+r.len>=i.clock?t[n-1]=new qo(r.clock,Un(r.len,i.clock+i.len-r.clock)):(n<e&&(t[n]=i),n++)}t.length=n})},Qo=t=>{const e=new Go;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,i)=>{if(!e.clients.has(i)){const o=r.slice();for(let e=n+1;e<t.length;e++)On(o,t[e].clients.get(i)||[]);e.clients.set(i,o)}});return Zo(e),e},ts=(t,e,n,r)=>{Cn(t.clients,e,()=>[]).push(new qo(n,r))},es=()=>new Go,ns=(t,e)=>{tr(t.restEncoder,e.clients.size),An(e.clients.entries()).sort((t,e)=>e[0]-t[0]).forEach(([e,n])=>{t.resetDsCurVal(),tr(t.restEncoder,e);const r=n.length;tr(t.restEncoder,r);for(let i=0;i<r;i++){const e=n[i];t.writeDsClock(e.clock),t.writeDsLen(e.len)}})},rs=(t,e,n)=>{const r=new Go,i=_r(t.restDecoder);for(let o=0;o<i;o++){t.resetDsCurVal();const i=_r(t.restDecoder),o=_r(t.restDecoder),s=n.clients.get(i)||[],l=Ps(n,i);for(let n=0;n<o;n++){const n=t.readDsClock(),o=n+t.readDsLen();if(n<l){l<o&&ts(r,i,l,o-l);let t=$s(s,n),c=s[t];for(!c.deleted&&c.id.clock<n&&(s.splice(t+1,0,Ic(e,c,n-c.id.clock)),t++);t<s.length&&(c=s[t++],c.id.clock<o);)c.deleted||(o<c.id.clock+c.length&&s.splice(t,0,Ic(e,c,o-c.id.clock)),c.delete(e))}else ts(r,i,n,o-n)}}if(r.clients.size>0){const t=new ds;return tr(t.restEncoder,0),ns(t,r),t.toUint8Array()}return null},is=Pr,os=class t extends Nn{constructor({guid:t=Lr(),collectionid:e=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:o=!1,shouldLoad:s=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=is(),this.guid=t,this.collectionid=e,this.share=/* @__PURE__ */new Map,this.store=new zs,this._transaction=null,this._transactionCleanups=[],this.subdocs=/* @__PURE__ */new Set,this._item=null,this.shouldLoad=s,this.autoLoad=o,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=jr(t=>{this.on("load",()=>{this.isLoaded=!0,t(this)})});const l=()=>jr(t=>{const e=n=>{void 0!==n&&!0!==n||(this.off("sync",e),t())};this.on("sync",e)});this.on("sync",t=>{!1===t&&this.isSynced&&(this.whenSynced=l()),this.isSynced=void 0===t||!0===t,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;null===t||this.shouldLoad||Xs(t.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(An(this.subdocs).map(t=>t.guid))}transact(t,e=null){return Xs(this,t,e)}get(t,e=wl){const n=Cn(this.share,t,()=>{const t=new e;return t._integrate(this,null),t}),r=n.constructor;if(e!==wl&&r!==e){if(r===wl){const r=new e;r._map=n._map,n._map.forEach(t=>{for(;null!==t;t=t.left)t.parent=r}),r._start=n._start;for(let t=r._start;null!==t;t=t.right)t.parent=r;return r._length=n._length,this.share.set(t,r),r._integrate(this,null),r}throw new Error(`Type with the name ${t} has already been defined with a different constructor`)}return n}getArray(t=""){return this.get(t,Pl)}getText(t=""){return this.get(t,ec)}getMap(t=""){return this.get(t,$l)}getXmlElement(t=""){return this.get(t,ic)}getXmlFragment(t=""){return this.get(t,rc)}toJSON(){const t={};return this.share.forEach((e,n)=>{t[n]=e.toJSON()}),t}destroy(){this.isDestroyed=!0,An(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(null!==e){this._item=null;const n=e.content;n.doc=new t({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Xs(e.parent.doc,t=>{const r=n.doc;e.deleted||t.subdocsAdded.add(r),t.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}},ss=class{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=_r(this.restDecoder),this.dsCurrVal}readDsLen(){const t=_r(this.restDecoder)+1;return this.dsCurrVal+=t,t}},ls=class extends ss{constructor(t){super(t),this.keys=[],_r(t),this.keyClockDecoder=new Mr(Sr(t)),this.clientDecoder=new Nr(Sr(t)),this.leftClockDecoder=new Mr(Sr(t)),this.rightClockDecoder=new Mr(Sr(t)),this.infoDecoder=new Ir(Sr(t),Cr),this.stringDecoder=new Rr(Sr(t)),this.parentInfoDecoder=new Ir(Sr(t),Cr),this.typeRefDecoder=new Nr(Sr(t)),this.lenDecoder=new Nr(Sr(t))}readLeftID(){return new bs(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new bs(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return 1===this.parentInfoDecoder.read()}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Tr(this.restDecoder)}readBuf(){return Sr(this.restDecoder)}readJSON(){return Tr(this.restDecoder)}readKey(){const t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];{const t=this.stringDecoder.read();return this.keys.push(t),t}}},cs=class{constructor(){this.restEncoder=Xn()}toUint8Array(){return Yn(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){tr(this.restEncoder,t)}writeDsLen(t){tr(this.restEncoder,t)}},as=class extends cs{writeLeftID(t){tr(this.restEncoder,t.client),tr(this.restEncoder,t.clock)}writeRightID(t){tr(this.restEncoder,t.client),tr(this.restEncoder,t.clock)}writeClient(t){tr(this.restEncoder,t)}writeInfo(t){Qn(this.restEncoder,t)}writeString(t){ir(this.restEncoder,t)}writeParentInfo(t){tr(this.restEncoder,t?1:0)}writeTypeRef(t){tr(this.restEncoder,t)}writeLen(t){tr(this.restEncoder,t)}writeAny(t){ar(this.restEncoder,t)}writeBuf(t){sr(this.restEncoder,t)}writeJSON(t){ir(this.restEncoder,JSON.stringify(t))}writeKey(t){ir(this.restEncoder,t)}},hs=class{constructor(){this.restEncoder=Xn(),this.dsCurrVal=0}toUint8Array(){return Yn(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){const e=t-this.dsCurrVal;this.dsCurrVal=t,tr(this.restEncoder,e)}writeDsLen(t){0===t&&wr(),tr(this.restEncoder,t-1),this.dsCurrVal+=t}},ds=class extends hs{constructor(){super(),this.keyMap=/* @__PURE__ */new Map,this.keyClock=0,this.keyClockEncoder=new fr,this.clientEncoder=new ur,this.leftClockEncoder=new fr,this.rightClockEncoder=new fr,this.infoEncoder=new hr(Qn),this.stringEncoder=new gr,this.parentInfoEncoder=new hr(Qn),this.typeRefEncoder=new ur,this.lenEncoder=new ur}toUint8Array(){const t=Xn();return tr(t,0),sr(t,this.keyClockEncoder.toUint8Array()),sr(t,this.clientEncoder.toUint8Array()),sr(t,this.leftClockEncoder.toUint8Array()),sr(t,this.rightClockEncoder.toUint8Array()),sr(t,Yn(this.infoEncoder)),sr(t,this.stringEncoder.toUint8Array()),sr(t,Yn(this.parentInfoEncoder)),sr(t,this.typeRefEncoder.toUint8Array()),sr(t,this.lenEncoder.toUint8Array()),or(t,Yn(this.restEncoder)),Yn(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){ar(this.restEncoder,t)}writeBuf(t){sr(this.restEncoder,t)}writeJSON(t){ar(this.restEncoder,t)}writeKey(t){const e=this.keyMap.get(t);void 0===e?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t)):this.keyClockEncoder.write(e)}},us=(t,e,n)=>{const r=/* @__PURE__ */new Map;n.forEach((t,n)=>{Ps(e,n)>t&&r.set(n,t)}),Us(e).forEach((t,e)=>{n.has(e)||r.set(e,0)}),tr(t.restEncoder,r.size),An(r.entries()).sort((t,e)=>e[0]-t[0]).forEach(([n,r])=>{((t,e,n,r)=>{r=Un(r,e[0].id.clock);const i=$s(e,r);tr(t.restEncoder,e.length-i),t.writeClient(n),tr(t.restEncoder,r);const o=e[i];o.write(t,r-o.id.clock);for(let s=i+1;s<e.length;s++)e[s].write(t,0)})(t,e.clients.get(n),n,r)})},ps=(t,e,n,r=new ls(t))=>Xs(e,t=>{t.local=!1;let e=!1;const n=t.doc,i=n.store,o=((t,e)=>{const n=kn(),r=_r(t.restDecoder);for(let i=0;i<r;i++){const r=_r(t.restDecoder),i=new Array(r),o=t.readClient();let s=_r(t.restDecoder);n.set(o,{i:0,refs:i});for(let n=0;n<r;n++){const r=t.readInfo();switch(31&r){case 0:{const e=t.readLen();i[n]=new ac(ks(o,s),e),s+=e;break}case 10:{const e=_r(t.restDecoder);i[n]=new Pc(ks(o,s),e),s+=e;break}default:{const l=!(192&r),c=new Rc(ks(o,s),null,128&~r?null:t.readLeftID(),null,64&~r?null:t.readRightID(),l?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,!l||32&~r?null:t.readString(),zc(t,r));i[n]=c,s+=c.length}}}}return n})(r,n),s=((t,e,n)=>{const r=[];let i=An(n.keys()).sort((t,e)=>t-e);if(0===i.length)return null;const o=()=>{if(0===i.length)return null;let t=n.get(i[i.length-1]);for(;t.refs.length===t.i;){if(i.pop(),!(i.length>0))return null;t=n.get(i[i.length-1])}return t};let s=o();if(null===s)return null;const l=new zs,c=/* @__PURE__ */new Map,a=(t,e)=>{const n=c.get(t);(null==n||n>e)&&c.set(t,e)};let h=s.refs[s.i++];const d=/* @__PURE__ */new Map,u=()=>{for(const t of r){const e=t.id.client,r=n.get(e);r?(r.i--,l.clients.set(e,r.refs.slice(r.i)),n.delete(e),r.i=0,r.refs=[]):l.clients.set(e,[t]),i=i.filter(t=>t!==e)}r.length=0};for(;;){if(h.constructor!==Pc){const i=Cn(d,h.id.client,()=>Ps(e,h.id.client))-h.id.clock;if(i<0)r.push(h),a(h.id.client,h.id.clock-1),u();else{const o=h.getMissing(t,e);if(null!==o){r.push(h);const t=n.get(o)||{refs:[],i:0};if(t.refs.length!==t.i){h=t.refs[t.i++];continue}a(o,Ps(e,o)),u()}else(0===i||i<h.length)&&(h.integrate(t,i),d.set(h.id.client,h.id.clock+h.length))}}if(r.length>0)h=r.pop();else if(null!==s&&s.i<s.refs.length)h=s.refs[s.i++];else{if(s=o(),null===s)break;h=s.refs[s.i++]}}if(l.clients.size>0){const t=new ds;return us(t,l,/* @__PURE__ */new Map),tr(t.restEncoder,0),{missing:c,update:t.toUint8Array()}}return null})(t,i,o),l=i.pendingStructs;if(l){for(const[t,n]of l.missing)if(n<Ps(i,t)){e=!0;break}if(s){for(const[t,e]of s.missing){const n=l.missing.get(t);(null==n||n>e)&&l.missing.set(t,e)}l.update=il([l.update,s.update])}}else i.pendingStructs=s;const c=rs(r,t,i);if(i.pendingDs){const e=new ls(kr(i.pendingDs));_r(e.restDecoder);const n=rs(e,t,i);i.pendingDs=c&&n?il([c,n]):c||n}else i.pendingDs=c;if(e){const e=i.pendingStructs.update;i.pendingStructs=null,fs(t.doc,e)}},n,!1),fs=(t,e,n,r=ls)=>{const i=kr(e);ps(i,t,n,new r(i))},gs=class{constructor(){this.l=[]}},ms=()=>new gs,ys=(t,e)=>t.l.push(e),ws=(t,e)=>{const n=t.l;n.length;t.l=n.filter(t=>e!==t),t.l.length},xs=(t,e,n)=>ri(t.l,[e,n]),bs=class{constructor(t,e){this.client=t,this.clock=e}},vs=(t,e)=>t===e||null!==t&&null!==e&&t.client===e.client&&t.clock===e.clock,ks=(t,e)=>new bs(t,e),Ss=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw wr()},Cs=(t,e)=>{for(;null!==e;){if(e.parent===t)return!0;e=e.parent._item}return!1},_s=class{constructor(t,e,n,r=0){this.type=t,this.tname=e,this.item=n,this.assoc=r}},Es=class{constructor(t,e,n=0){this.type=t,this.index=e,this.assoc=n}},Os=(t,e,n)=>{let r=null,i=null;return null===t._item?i=Ss(t):r=ks(t._item.id.client,t._item.id.clock),new _s(r,i,e,n)},As=(t,e,n=0)=>{let r=t._start;if(n<0){if(0===e)return Os(t,null,n);e--}for(;null!==r;){if(!r.deleted&&r.countable){if(r.length>e)return Os(t,ks(r.id.client,r.id.clock+e),n);e-=r.length}if(null===r.right&&n<0)return Os(t,r.lastId,n);r=r.right}return Os(t,null,n)},Ds=(t,e,n=!0)=>{const r=e.store,i=t.item,o=t.type,s=t.tname,l=t.assoc;let c=null,a=0;if(null!==i){if(Ps(r,i.client)<=i.clock)return null;const t=n?Dc(r,i):((t,e)=>{const n=js(t,e);return{item:n,diff:e.clock-n.id.clock}})(r,i),e=t.item;if(!(e instanceof Rc))return null;if(c=e.parent,null===c._item||!c._item.deleted){a=e.deleted||!e.countable?0:t.diff+(l>=0?0:1);let n=e.left;for(;null!==n;)!n.deleted&&n.countable&&(a+=n.length),n=n.left}}else{if(null!==s)c=e.get(s);else{if(null===o)throw wr();{if(Ps(r,o.client)<=o.clock)return null;const{item:t}=n?Dc(r,o):{item:js(r,o)};if(!(t instanceof Rc&&t.content instanceof Ac))return null;c=t.content.type}}a=l>=0?c._length:0}return((t,e,n=0)=>new Es(t,e,n))(c,a,t.assoc)},Ts=class{constructor(t,e){this.ds=t,this.sv=e}},Is=(t,e)=>new Ts(t,e),Ns=(Is(es(),/* @__PURE__ */new Map),t=>Is((t=>{const e=es();return t.clients.forEach((t,n)=>{const r=[];for(let e=0;e<t.length;e++){const n=t[e];if(n.deleted){const i=n.id.clock;let o=n.length;if(e+1<t.length)for(let n=t[e+1];e+1<t.length&&n.deleted;n=t[1+ ++e])o+=n.length;r.push(new qo(i,o))}}r.length>0&&e.clients.set(n,r)}),e})(t.store),Us(t.store))),Ms=(t,e)=>void 0===e?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Yo(e.ds,t.id),Rs=(t,e)=>{const n=Cn(t.meta,Rs,_n),r=t.doc.store;n.has(e)||(e.sv.forEach((e,n)=>{e<Ps(r,n)&&Bs(t,ks(n,e))}),Xo(t,e.ds,t=>{}),n.add(e))},zs=class{constructor(){this.clients=/* @__PURE__ */new Map,this.pendingStructs=null,this.pendingDs=null}},Us=t=>{const e=/* @__PURE__ */new Map;return t.clients.forEach((t,n)=>{const r=t[t.length-1];e.set(n,r.id.clock+r.length)}),e},Ps=(t,e)=>{const n=t.clients.get(e);if(void 0===n)return 0;const r=n[n.length-1];return r.id.clock+r.length},Ls=(t,e)=>{let n=t.clients.get(e.id.client);if(void 0===n)n=[],t.clients.set(e.id.client,n);else{const t=n[n.length-1];if(t.id.clock+t.length!==e.id.clock)throw wr()}n.push(e)},$s=(t,e)=>{let n=0,r=t.length-1,i=t[r],o=i.id.clock;if(o===e)return r;let s=Mn(e/(o+i.length-1)*r);for(;n<=r;){if(i=t[s],o=i.id.clock,o<=e){if(e<o+i.length)return s;n=s+1}else r=s-1;s=Mn((n+r)/2)}throw wr()},js=(t,e)=>{const n=t.clients.get(e.client);return n[$s(n,e.clock)]},Hs=(t,e,n)=>{const r=$s(e,n),i=e[r];return i.id.clock<n&&i instanceof Rc?(e.splice(r+1,0,Ic(t,i,n-i.id.clock)),r+1):r},Bs=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Hs(t,n,e.clock)]},Fs=(t,e,n)=>{const r=e.clients.get(n.client),i=$s(r,n.clock),o=r[i];return n.clock!==o.id.clock+o.length-1&&o.constructor!==ac&&r.splice(i+1,0,Ic(t,o,n.clock-o.id.clock+1)),o},Vs=(t,e,n,r,i)=>{if(0===r)return;const o=n+r;let s,l=Hs(t,e,n);do{s=e[l++],o<s.id.clock+s.length&&Hs(t,e,o),i(s)}while(l<e.length&&e[l].id.clock<o)},Js=class{constructor(t,e,n){this.doc=t,this.deleteSet=new Go,this.beforeState=Us(t.store),this.afterState=/* @__PURE__ */new Map,this.changed=/* @__PURE__ */new Map,this.changedParentTypes=/* @__PURE__ */new Map,this._mergeStructs=[],this.origin=e,this.meta=/* @__PURE__ */new Map,this.local=n,this.subdocsAdded=/* @__PURE__ */new Set,this.subdocsRemoved=/* @__PURE__ */new Set,this.subdocsLoaded=/* @__PURE__ */new Set,this._needFormattingCleanup=!1}},Ws=(t,e)=>!(0===e.deleteSet.clients.size&&!((t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1})(e.afterState,(t,n)=>e.beforeState.get(n)!==t))&&(Zo(e.deleteSet),((t,e)=>{us(t,e.doc.store,e.beforeState)})(t,e),ns(t,e.deleteSet),!0),Ks=(t,e,n)=>{const r=e._item;(null===r||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Cn(t.changed,e,_n).add(n)},qs=(t,e)=>{let n=t[e],r=t[e-1],i=e;for(;i>0&&(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n));n=r,r=t[--i-1])n instanceof Rc&&null!==n.parentSub&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);const o=e-i;return o&&t.splice(e+1-o,o),o},Gs=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,o=n.deleteSet,s=n._mergeStructs;try{Zo(o),n.afterState=Us(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const t=[];n.changed.forEach((e,r)=>t.push(()=>{null!==r._item&&r._item.deleted||r._callObserver(n,e)})),t.push(()=>{n.changedParentTypes.forEach((e,r)=>{r._dEH.l.length>0&&(null===r._item||!r._item.deleted)&&((e=e.filter(t=>null===t.target._item||!t.target._item.deleted)).forEach(t=>{t.currentTarget=r,t._path=null}),e.sort((t,e)=>t.path.length-e.path.length),t.push(()=>{xs(r._dEH,e,n)}))}),t.push(()=>r.emit("afterTransaction",[n,r])),t.push(()=>{n._needFormattingCleanup&&Zl(n)})}),ri(t,[])}finally{r.gc&&((t,e,n)=>{for(const[r,i]of t.clients.entries()){const t=e.clients.get(r);for(let r=i.length-1;r>=0;r--){const o=i[r],s=o.clock+o.len;for(let r=$s(t,o.clock),i=t[r];r<t.length&&i.id.clock<s;i=t[++r]){const i=t[r];if(o.clock+o.len<=i.id.clock)break;i instanceof Rc&&i.deleted&&!i.keep&&n(i)&&i.gc(e,!1)}}}})(o,i,r.gcFilter),((t,e)=>{t.clients.forEach((t,n)=>{const r=e.clients.get(n);for(let e=t.length-1;e>=0;e--){const n=t[e];for(let t=zn(r.length-1,1+$s(r,n.clock+n.len-1)),e=r[t];t>0&&e.id.clock>=n.clock;e=r[t])t-=1+qs(r,t)}})})(o,i),n.afterState.forEach((t,e)=>{const r=n.beforeState.get(e)||0;if(r!==t){const t=i.clients.get(e),n=Un($s(t,r),1);for(let e=t.length-1;e>=n;)e-=1+qs(t,e)}});for(let t=s.length-1;t>=0;t--){const{client:e,clock:n}=s[t].id,r=i.clients.get(e),o=$s(r,n);o+1<r.length&&qs(r,o+1)>1||o>0&&qs(r,o)}if(n.local||n.afterState.get(r.clientID)===n.beforeState.get(r.clientID)||(((...t)=>{Jo.forEach(e=>e.print(t))})(Bo,zo,"[yjs] ",Uo,jo,"Changed the client-id because another client seems to be using it."),r.clientID=is()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const t=new as;Ws(t,n)&&r.emit("update",[t.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const t=new ds;Ws(t,n)&&r.emit("updateV2",[t.toUint8Array(),n.origin,r,n])}const{subdocsAdded:l,subdocsLoaded:c,subdocsRemoved:a}=n;(l.size>0||a.size>0||c.size>0)&&(l.forEach(t=>{t.clientID=r.clientID,null==t.collectionid&&(t.collectionid=r.collectionid),r.subdocs.add(t)}),a.forEach(t=>r.subdocs.delete(t)),r.emit("subdocs",[{loaded:c,added:l,removed:a},r,n]),a.forEach(t=>t.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):Gs(t,e+1)}}},Xs=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let o=!1,s=null;null===t._transaction&&(o=!0,t._transaction=new Js(t,n,r),i.push(t._transaction),1===i.length&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{s=e(t._transaction)}finally{if(o){const e=t._transaction===i[0];t._transaction=null,e&&Gs(i,0)}}return s},Ys=class{constructor(t,e){this.insertions=e,this.deletions=t,this.meta=/* @__PURE__ */new Map}},Zs=(t,e,n)=>{Xo(t,n.deletions,n=>{n instanceof Rc&&e.scope.some(e=>e===t.doc||Cs(e,n))&&Tc(n,!1)})},Qs=(t,e,n)=>{let r=null;const i=t.doc,o=t.scope;Xs(i,n=>{for(;e.length>0&&null===t.currStackItem;){const r=i.store,s=e.pop(),l=/* @__PURE__ */new Set,c=[];let a=!1;Xo(n,s.insertions,t=>{if(t instanceof Rc){if(null!==t.redone){let{item:e,diff:i}=Dc(r,t.id);i>0&&(e=Bs(n,ks(e.id.client,e.id.clock+i))),t=e}!t.deleted&&o.some(e=>e===n.doc||Cs(e,t))&&c.push(t)}}),Xo(n,s.deletions,t=>{t instanceof Rc&&o.some(e=>e===n.doc||Cs(e,t))&&!Yo(s.insertions,t.id)&&l.add(t)}),l.forEach(e=>{a=null!==Mc(n,e,l,s.insertions,t.ignoreRemoteMapChanges,t)||a});for(let e=c.length-1;e>=0;e--){const r=c[e];t.deleteFilter(r)&&(r.delete(n),a=!0)}t.currStackItem=a?s:null}n.changed.forEach((t,e)=>{t.has(null)&&e._searchMarker&&(e._searchMarker.length=0)}),r=n},t);const s=t.currStackItem;if(null!=s){const e=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:s,type:n,changedParentTypes:e,origin:t},t]),t.currStackItem=null}return s},tl=class extends Nn{constructor(t,{captureTimeout:e=500,captureTransaction:n=t=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=/* @__PURE__ */new Set([null]),ignoreRemoteMapChanges:o=!1,doc:s=(In(t)?t[0].doc:t instanceof os?t:t.doc)}={}){super(),this.scope=[],this.doc=s,this.addToScope(t),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=e,this.afterTransactionHandler=t=>{if(!(this.captureTransaction(t)&&this.scope.some(e=>t.changedParentTypes.has(e)||e===this.doc)&&(this.trackedOrigins.has(t.origin)||t.origin&&this.trackedOrigins.has(t.origin.constructor))))return;const e=this.undoing,n=this.redoing,r=e?this.redoStack:this.undoStack;e?this.stopCapturing():n||this.clear(!1,!0);const i=new Go;t.afterState.forEach((e,n)=>{const r=t.beforeState.get(n)||0,o=e-r;o>0&&ts(i,n,r,o)});const o=$r();let s=!1;if(this.lastChange>0&&o-this.lastChange<this.captureTimeout&&r.length>0&&!e&&!n){const e=r[r.length-1];e.deletions=Qo([e.deletions,t.deleteSet]),e.insertions=Qo([e.insertions,i])}else r.push(new Ys(t.deleteSet,i)),s=!0;e||n||(this.lastChange=o),Xo(t,t.deleteSet,e=>{e instanceof Rc&&this.scope.some(n=>n===t.doc||Cs(n,e))&&Tc(e,!0)});const l=[{stackItem:r[r.length-1],origin:t.origin,type:e?"redo":"undo",changedParentTypes:t.changedParentTypes},this];s?this.emit("stack-item-added",l):this.emit("stack-item-updated",l)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(t){const e=new Set(this.scope);(t=In(t)?t:[t]).forEach(t=>{e.has(t)||(e.add(t),(t instanceof wl?t.doc!==this.doc:t!==this.doc)&&Vo("[yjs#509] Not same Y.Doc"),this.scope.push(t))})}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,e=!0){(t&&this.canUndo()||e&&this.canRedo())&&this.doc.transact(n=>{t&&(this.undoStack.forEach(t=>Zs(n,this,t)),this.undoStack=[]),e&&(this.redoStack.forEach(t=>Zs(n,this,t)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:t,redoStackCleared:e}])})}stopCapturing(){this.lastChange=0}undo(){let t;this.undoing=!0;try{t=Qs(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){let t;this.redoing=!0;try{t=Qs(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}};var el=class{constructor(t,e){this.gen=function*(t){const e=_r(t.restDecoder);for(let n=0;n<e;n++){const e=_r(t.restDecoder),n=t.readClient();let r=_r(t.restDecoder);for(let i=0;i<e;i++){const e=t.readInfo();if(10===e){const e=_r(t.restDecoder);yield new Pc(ks(n,r),e),r+=e}else if(31&e){const i=!(192&e),o=new Rc(ks(n,r),null,128&~e?null:t.readLeftID(),null,64&~e?null:t.readRightID(),i?t.readParentInfo()?t.readString():t.readLeftID():null,!i||32&~e?null:t.readString(),zc(t,e));yield o,r+=o.length}else{const e=t.readLen();yield new ac(ks(n,r),e),r+=e}}}}(t),this.curr=null,this.done=!1,this.filterSkips=e,this.next()}next(){do{this.curr=this.gen.next().value||null}while(this.filterSkips&&null!==this.curr&&this.curr.constructor===Pc);return this.curr}},nl=class{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}},rl=(t,e)=>{if(t.constructor===ac){const{client:n,clock:r}=t.id;return new ac(ks(n,r+e),t.length-e)}if(t.constructor===Pc){const{client:n,clock:r}=t.id;return new Pc(ks(n,r+e),t.length-e)}{const n=t,{client:r,clock:i}=n.id;return new Rc(ks(r,i+e),null,ks(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},il=(t,e=ls,n=ds)=>{if(1===t.length)return t[0];const r=t.map(t=>new e(kr(t)));let i=r.map(t=>new el(t,!0)),o=null;const s=new n,l=new nl(s);for(;i=i.filter(t=>null!==t.curr),i.sort((t,e)=>{if(t.curr.id.client===e.curr.id.client){const n=t.curr.id.clock-e.curr.id.clock;return 0===n?t.curr.constructor===e.curr.constructor?0:t.curr.constructor===Pc?1:-1:n}return e.curr.id.client-t.curr.id.client}),0!==i.length;){const t=i[0],e=t.curr.id.client;if(null!==o){let n=t.curr,r=!1;for(;null!==n&&n.id.clock+n.length<=o.struct.id.clock+o.struct.length&&n.id.client>=o.struct.id.client;)n=t.next(),r=!0;if(null===n||n.id.client!==e||r&&n.id.clock>o.struct.id.clock+o.struct.length)continue;if(e!==o.struct.id.client)sl(l,o.struct,o.offset),o={struct:n,offset:0},t.next();else if(o.struct.id.clock+o.struct.length<n.id.clock)if(o.struct.constructor===Pc)o.struct.length=n.id.clock+n.length-o.struct.id.clock;else{sl(l,o.struct,o.offset);const t=n.id.clock-o.struct.id.clock-o.struct.length;o={struct:new Pc(ks(e,o.struct.id.clock+o.struct.length),t),offset:0}}else{const e=o.struct.id.clock+o.struct.length-n.id.clock;e>0&&(o.struct.constructor===Pc?o.struct.length-=e:n=rl(n,e)),o.struct.mergeWith(n)||(sl(l,o.struct,o.offset),o={struct:n,offset:0},t.next())}}else o={struct:t.curr,offset:0},t.next();for(let n=t.curr;null!==n&&n.id.client===e&&n.id.clock===o.struct.id.clock+o.struct.length&&n.constructor!==Pc;n=t.next())sl(l,o.struct,o.offset),o={struct:n,offset:0}}null!==o&&(sl(l,o.struct,o.offset),o=null),ll(l);const c=r.map(t=>(t=>{const e=new Go,n=_r(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const n=_r(t.restDecoder),r=_r(t.restDecoder);if(r>0){const i=Cn(e.clients,n,()=>[]);for(let e=0;e<r;e++)i.push(new qo(t.readDsClock(),t.readDsLen()))}}return e})(t)),a=Qo(c);return ns(s,a),s.toUint8Array()},ol=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:Yn(t.encoder.restEncoder)}),t.encoder.restEncoder=Xn(),t.written=0)},sl=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&ol(t),0===t.written&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),tr(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},ll=t=>{ol(t);const e=t.encoder.restEncoder;tr(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];tr(e,r.written),or(e,r.restEncoder)}},cl="You must not compute changes after the event-handler fired.",al=class{constructor(t,e){this.target=t,this.currentTarget=t,this.transaction=e,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=hl(this.currentTarget,this.target))}deletes(t){return Yo(this.transaction.deleteSet,t.id)}get keys(){if(null===this._keys){if(0===this.transaction.doc._transactionCleanups.length)throw mr(cl);const t=/* @__PURE__ */new Map,e=this.target;this.transaction.changed.get(e).forEach(n=>{if(null!==n){const r=e._map.get(n);let i,o;if(this.adds(r)){let t=r.left;for(;null!==t&&this.adds(t);)t=t.left;if(this.deletes(r)){if(null===t||!this.deletes(t))return;i="delete",o=En(t.content.getContent())}else null!==t&&this.deletes(t)?(i="update",o=En(t.content.getContent())):(i="add",o=void 0)}else{if(!this.deletes(r))return;i="delete",o=En(r.content.getContent())}t.set(n,{action:i,oldValue:o})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(null===t){if(0===this.transaction.doc._transactionCleanups.length)throw mr(cl);const e=this.target,n=_n(),r=_n(),i=[];if(t={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(e).has(null)){let t=null;const o=()=>{t&&i.push(t)};for(let i=e._start;null!==i;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&(null!==t&&void 0!==t.delete||(o(),t={delete:0}),t.delete+=i.length,r.add(i)):this.adds(i)?(null!==t&&void 0!==t.insert||(o(),t={insert:[]}),t.insert=t.insert.concat(i.content.getContent()),n.add(i)):(null!==t&&void 0!==t.retain||(o(),t={retain:0}),t.retain+=i.length);null!==t&&void 0===t.retain&&o()}this._changes=t}return t}},hl=(t,e)=>{const n=[];for(;null!==e._item&&e!==t;){if(null!==e._item.parentSub)n.unshift(e._item.parentSub);else{let t=0,r=e._item.parent._start;for(;r!==e._item&&null!==r;)!r.deleted&&r.countable&&(t+=r.length),r=r.right;n.unshift(t)}e=e._item.parent}return n},dl=()=>{Vo("Invalid access: Add Yjs type to a document before reading data.")},ul=0,pl=class{constructor(t,e){t.marker=!0,this.p=t,this.index=e,this.timestamp=ul++}},fl=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=ul++},gl=(t,e)=>{if(null===t._start||0===e||null===t._searchMarker)return null;const n=0===t._searchMarker.length?null:t._searchMarker.reduce((t,n)=>Rn(e-t.index)<Rn(e-n.index)?t:n);let r=t._start,i=0;for(null!==n&&(r=n.p,i=n.index,(t=>{t.timestamp=ul++})(n));null!==r.right&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;null!==r.left&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;null!==r.left&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return null!==n&&Rn(n.index-i)<r.parent.length/80?(fl(n,r,i),n):((t,e,n)=>{if(t.length>=80){const r=t.reduce((t,e)=>t.timestamp<e.timestamp?t:e);return fl(r,e,n),r}{const r=new pl(e,n);return t.push(r),r}})(t._searchMarker,r,i)},ml=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const i=t[r];if(n>0){let e=i.p;for(e.marker=!1;e&&(e.deleted||!e.countable);)e=e.left,e&&!e.deleted&&e.countable&&(i.index-=e.length);if(null===e||!0===e.marker){t.splice(r,1);continue}i.p=e,e.marker=!0}(e<i.index||n>0&&e===i.index)&&(i.index=Un(e,i.index+n))}},yl=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;Cn(i,t,()=>[]).push(n),null!==t._item;)t=t._item.parent;xs(r._eH,n,e)},wl=class{constructor(){this._item=null,this._map=/* @__PURE__ */new Map,this._start=null,this.doc=null,this._length=0,this._eH=ms(),this._dEH=ms(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,e){this.doc=t,this._item=e}_copy(){throw yr()}clone(){throw yr()}_write(t){}get _first(){let t=this._start;for(;null!==t&&t.deleted;)t=t.right;return t}_callObserver(t,e){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){ys(this._eH,t)}observeDeep(t){ys(this._dEH,t)}unobserve(t){ws(this._eH,t)}unobserveDeep(t){ws(this._dEH,t)}toJSON(){}},xl=(t,e,n)=>{t.doc??dl(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let o=t._start;for(;null!==o&&r>0;){if(o.countable&&!o.deleted){const t=o.content.getContent();if(t.length<=e)e-=t.length;else{for(let n=e;n<t.length&&r>0;n++)i.push(t[n]),r--;e=0}}o=o.right}return i},bl=t=>{t.doc??dl();const e=[];let n=t._start;for(;null!==n;){if(n.countable&&!n.deleted){const t=n.content.getContent();for(let n=0;n<t.length;n++)e.push(t[n])}n=n.right}return e},vl=(t,e)=>{const n=[];let r=t._start;for(;null!==r;){if(r.countable&&Ms(r,e)){const t=r.content.getContent();for(let e=0;e<t.length;e++)n.push(t[e])}r=r.right}return n},kl=(t,e)=>{let n=0,r=t._start;for(t.doc??dl();null!==r;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let r=0;r<i.length;r++)e(i[r],n++,t)}r=r.right}},Sl=(t,e)=>{const n=[];return kl(t,(r,i)=>{n.push(e(r,i,t))}),n},Cl=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(null===n){for(;null!==e&&e.deleted;)e=e.right;if(null===e)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const t=n[r++];return n.length<=r&&(n=null),{done:!1,value:t}}}},_l=(t,e)=>{t.doc??dl();const n=gl(t,e);let r=t._start;for(null!==n&&(r=n.p,e-=n.index);null!==r;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},El=(t,e,n,r)=>{let i=n;const o=t.doc,s=o.clientID,l=o.store,c=null===n?e._start:n.right;let a=[];const h=()=>{a.length>0&&(i=new Rc(ks(s,Ps(l,s)),i,i&&i.lastId,c,c&&c.id,e,null,new wc(a)),i.integrate(t,0),a=[])};r.forEach(n=>{if(null===n)a.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:a.push(n);break;default:switch(h(),n.constructor){case Uint8Array:case ArrayBuffer:i=new Rc(ks(s,Ps(l,s)),i,i&&i.lastId,c,c&&c.id,e,null,new hc(new Uint8Array(n))),i.integrate(t,0);break;case os:i=new Rc(ks(s,Ps(l,s)),i,i&&i.lastId,c,c&&c.id,e,null,new pc(n)),i.integrate(t,0);break;default:if(!(n instanceof wl))throw new Error("Unexpected content type in insert operation");i=new Rc(ks(s,Ps(l,s)),i,i&&i.lastId,c,c&&c.id,e,null,new Ac(n)),i.integrate(t,0)}}}),h()},Ol=()=>mr("Length exceeded!"),Al=(t,e,n,r)=>{if(n>e._length)throw Ol();if(0===n)return e._searchMarker&&ml(e._searchMarker,n,r.length),El(t,e,null,r);const i=n,o=gl(e,n);let s=e._start;for(null!==o&&(s=o.p,0===(n-=o.index)&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));null!==s;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&Bs(t,ks(s.id.client,s.id.clock+n));break}n-=s.length}return e._searchMarker&&ml(e._searchMarker,i,r.length),El(t,e,s,r)},Dl=(t,e,n,r)=>{if(0===r)return;const i=n,o=r,s=gl(e,n);let l=e._start;for(null!==s&&(l=s.p,n-=s.index);null!==l&&n>0;l=l.right)!l.deleted&&l.countable&&(n<l.length&&Bs(t,ks(l.id.client,l.id.clock+n)),n-=l.length);for(;r>0&&null!==l;)l.deleted||(r<l.length&&Bs(t,ks(l.id.client,l.id.clock+r)),l.delete(t),r-=l.length),l=l.right;if(r>0)throw Ol();e._searchMarker&&ml(e._searchMarker,i,-o+r)},Tl=(t,e,n)=>{const r=e._map.get(n);void 0!==r&&r.delete(t)},Il=(t,e,n,r)=>{const i=e._map.get(n)||null,o=t.doc,s=o.clientID;let l;if(null==r)l=new wc([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new wc([r]);break;case Uint8Array:l=new hc(r);break;case os:l=new pc(r);break;default:if(!(r instanceof wl))throw new Error("Unexpected content type");l=new Ac(r)}new Rc(ks(s,Ps(o.store,s)),i,i&&i.lastId,null,null,e,n,l).integrate(t,0)},Nl=(t,e)=>{t.doc??dl();const n=t._map.get(e);return void 0===n||n.deleted?void 0:n.content.getContent()[n.length-1]},Ml=t=>{const e={};return t.doc??dl(),t._map.forEach((t,n)=>{t.deleted||(e[n]=t.content.getContent()[t.length-1])}),e},Rl=(t,e)=>{t.doc??dl();const n=t._map.get(e);return void 0!==n&&!n.deleted},zl=t=>{return t.doc??dl(),e=t._map.entries(),n=t=>!t[1].deleted,Wo(()=>{let t;do{t=e.next()}while(!t.done&&!n(t.value));return t});var e,n},Ul=class extends al{},Pl=class t extends wl{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new t;return n.push(e),n}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new t}clone(){const e=new t;return e.insert(0,this.toArray().map(t=>t instanceof wl?t.clone():t)),e}get length(){return this.doc??dl(),this._length}_callObserver(t,e){super._callObserver(t,e),yl(this,t,new Ul(this,t))}insert(t,e){null!==this.doc?Xs(this.doc,n=>{Al(n,this,t,e)}):this._prelimContent.splice(t,0,...e)}push(t){null!==this.doc?Xs(this.doc,e=>{((t,e,n)=>{let r=(e._searchMarker||[]).reduce((t,e)=>e.index>t.index?e:t,{index:0,p:e._start}).p;if(r)for(;r.right;)r=r.right;El(t,e,r,n)})(e,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,e=1){null!==this.doc?Xs(this.doc,n=>{Dl(n,this,t,e)}):this._prelimContent.splice(t,e)}get(t){return _l(this,t)}toArray(){return bl(this)}slice(t=0,e=this.length){return xl(this,t,e)}toJSON(){return this.map(t=>t instanceof wl?t.toJSON():t)}map(t){return Sl(this,t)}forEach(t){kl(this,t)}[Symbol.iterator](){return Cl(this)}_write(t){t.writeTypeRef(vc)}},Ll=class extends al{constructor(t,e,n){super(t,e),this.keysChanged=n}},$l=class t extends wl{constructor(t){super(),this._prelimContent=null,this._prelimContent=void 0===t?/* @__PURE__ */new Map:new Map(t)}_integrate(t,e){super._integrate(t,e),this._prelimContent.forEach((t,e)=>{this.set(e,t)}),this._prelimContent=null}_copy(){return new t}clone(){const e=new t;return this.forEach((t,n)=>{e.set(n,t instanceof wl?t.clone():t)}),e}_callObserver(t,e){yl(this,t,new Ll(this,t,e))}toJSON(){this.doc??dl();const t={};return this._map.forEach((e,n)=>{if(!e.deleted){const r=e.content.getContent()[e.length-1];t[n]=r instanceof wl?r.toJSON():r}}),t}get size(){return[...zl(this)].length}keys(){return Ko(zl(this),t=>t[0])}values(){return Ko(zl(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return Ko(zl(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??dl(),this._map.forEach((e,n)=>{e.deleted||t(e.content.getContent()[e.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(t){null!==this.doc?Xs(this.doc,e=>{Tl(e,this,t)}):this._prelimContent.delete(t)}set(t,e){return null!==this.doc?Xs(this.doc,n=>{Il(n,this,t,e)}):this._prelimContent.set(t,e),e}get(t){return Nl(this,t)}has(t){return Rl(this,t)}clear(){null!==this.doc?Xs(this.doc,t=>{this.forEach(function(e,n,r){Tl(t,r,n)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(kc)}},jl=(t,e)=>t===e||"object"==typeof t&&"object"==typeof e&&t&&e&&((t,e)=>t===e||Zr(t)===Zr(e)&&Qr(t,(t,n)=>(void 0!==t||ti(e,n))&&Gr(e[n],t)))(t,e),Hl=class{constructor(t,e,n,r){this.left=t,this.right=e,this.index=n,this.currentAttributes=r}forward(){if(null===this.right&&wr(),this.right.content.constructor===gc)this.right.deleted||Jl(this.currentAttributes,this.right.content);else this.right.deleted||(this.index+=this.right.length);this.left=this.right,this.right=this.right.right}},Bl=(t,e,n)=>{for(;null!==e.right&&n>0;){if(e.right.content.constructor===gc)e.right.deleted||Jl(e.currentAttributes,e.right.content);else e.right.deleted||(n<e.right.length&&Bs(t,ks(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);e.left=e.right,e.right=e.right.right}return e},Fl=(t,e,n,r)=>{const i=/* @__PURE__ */new Map,o=r?gl(e,n):null;if(o){const e=new Hl(o.p.left,o.p,o.index,i);return Bl(t,e,n-o.index)}{const r=new Hl(null,e._start,0,i);return Bl(t,r,n)}},Vl=(t,e,n,r)=>{for(;null!==n.right&&(!0===n.right.deleted||n.right.content.constructor===gc&&jl(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,o=i.clientID;r.forEach((r,s)=>{const l=n.left,c=n.right,a=new Rc(ks(o,Ps(i.store,o)),l,l&&l.lastId,c,c&&c.id,e,null,new gc(s,r));a.integrate(t,0),n.right=a,n.forward()})},Jl=(t,e)=>{const{key:n,value:r}=e;null===r?t.delete(n):t.set(n,r)},Wl=(t,e)=>{for(;null!==t.right&&(t.right.deleted||t.right.content.constructor===gc&&jl(e[t.right.content.key]??null,t.right.content.value));)t.forward()},Kl=(t,e,n,r)=>{const i=t.doc,o=i.clientID,s=/* @__PURE__ */new Map;for(const l in r){const c=r[l],a=n.currentAttributes.get(l)??null;if(!jl(a,c)){s.set(l,a);const{left:r,right:h}=n;n.right=new Rc(ks(o,Ps(i.store,o)),r,r&&r.lastId,h,h&&h.id,e,null,new gc(l,c)),n.right.integrate(t,0),n.forward()}}return s},ql=(t,e,n,r,i)=>{n.currentAttributes.forEach((t,e)=>{void 0===i[e]&&(i[e]=null)});const o=t.doc,s=o.clientID;Wl(n,i);const l=Kl(t,e,n,i),c=r.constructor===String?new xc(r):r instanceof wl?new Ac(r):new fc(r);let{left:a,right:h,index:d}=n;e._searchMarker&&ml(e._searchMarker,n.index,c.getLength()),h=new Rc(ks(s,Ps(o.store,s)),a,a&&a.lastId,h,h&&h.id,e,null,c),h.integrate(t,0),n.right=h,n.index=d,n.forward(),Vl(t,e,n,l)},Gl=(t,e,n,r,i)=>{const o=t.doc,s=o.clientID;Wl(n,i);const l=Kl(t,e,n,i);t:for(;null!==n.right&&(r>0||l.size>0&&(n.right.deleted||n.right.content.constructor===gc));){if(!n.right.deleted)switch(n.right.content.constructor){case gc:{const{key:e,value:o}=n.right.content,s=i[e];if(void 0!==s){if(jl(s,o))l.delete(e);else{if(0===r)break t;l.set(e,o)}n.right.delete(t)}else n.currentAttributes.set(e,o);break}default:r<n.right.length&&Bs(t,ks(n.right.id.client,n.right.id.clock+r)),r-=n.right.length}n.forward()}if(r>0){let i="";for(;r>0;r--)i+="\n";n.right=new Rc(ks(s,Ps(o.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new xc(i)),n.right.integrate(t,0),n.forward()}Vl(t,e,n,l)},Xl=(t,e,n,r,i)=>{let o=e;const s=kn();for(;o&&(!o.countable||o.deleted);){if(!o.deleted&&o.content.constructor===gc){const t=o.content;s.set(t.key,t)}o=o.right}let l=0,c=!1;for(;e!==o;){if(n===e&&(c=!0),!e.deleted){const n=e.content;switch(n.constructor){case gc:{const{key:o,value:a}=n,h=r.get(o)??null;s.get(o)===n&&h!==a||(e.delete(t),l++,c||(i.get(o)??null)!==a||h===a||(null===h?i.delete(o):i.set(o,h))),c||e.deleted||Jl(i,n);break}}}e=e.right}return l},Yl=t=>{let e=0;return Xs(t.doc,n=>{let r=t._start,i=t._start,o=kn();const s=Sn(o);for(;i;){if(!1===i.deleted)if(i.content.constructor===gc)Jl(s,i.content);else e+=Xl(n,r,i,o,s),o=Sn(s),r=i;i=i.right}}),e},Zl=t=>{const e=/* @__PURE__ */new Set,n=t.doc;for(const[r,i]of t.afterState.entries()){const o=t.beforeState.get(r)||0;i!==o&&Vs(t,n.store.clients.get(r),o,i,t=>{t.deleted||t.content.constructor!==gc||t.constructor===ac||e.add(t.parent)})}Xs(n,n=>{Xo(t,t.deleteSet,t=>{if(t instanceof ac||!t.parent._hasFormatting||e.has(t.parent))return;const r=t.parent;t.content.constructor===gc?e.add(r):((t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=/* @__PURE__ */new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===gc){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}})(n,t)});for(const t of e)Yl(t)})},Ql=(t,e,n)=>{const r=n,i=Sn(e.currentAttributes),o=e.right;for(;n>0&&null!==e.right;){if(!1===e.right.deleted)switch(e.right.content.constructor){case Ac:case fc:case xc:n<e.right.length&&Bs(t,ks(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t)}e.forward()}o&&Xl(t,o,e.right,i,e.currentAttributes);const s=(e.left||e.right).parent;return s._searchMarker&&ml(s._searchMarker,e.index,-r+n),e},tc=class extends al{constructor(t,e,n){super(t,e),this.childListChanged=!1,this.keysChanged=/* @__PURE__ */new Set,n.forEach(t=>{null===t?this.childListChanged=!0:this.keysChanged.add(t)})}get changes(){if(null===this._changes){const t={keys:this.keys,delta:this.delta,added:/* @__PURE__ */new Set,deleted:/* @__PURE__ */new Set};this._changes=t}return this._changes}get delta(){if(null===this._delta){const t=this.target.doc,e=[];Xs(t,t=>{const n=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;let i=this.target._start,o=null;const s={};let l="",c=0,a=0;const h=()=>{if(null!==o){let t=null;switch(o){case"delete":a>0&&(t={delete:a}),a=0;break;case"insert":("object"==typeof l||l.length>0)&&(t={insert:l},n.size>0&&(t.attributes={},n.forEach((e,n)=>{null!==e&&(t.attributes[n]=e)}))),l="";break;case"retain":c>0&&(t={retain:c},(t=>{for(const e in t)return!1;return!0})(s)||(t.attributes=Xr({},s))),c=0}t&&e.push(t),o=null}};for(;null!==i;){switch(i.content.constructor){case Ac:case fc:this.adds(i)?this.deletes(i)||(h(),o="insert",l=i.content.getContent()[0],h()):this.deletes(i)?("delete"!==o&&(h(),o="delete"),a+=1):i.deleted||("retain"!==o&&(h(),o="retain"),c+=1);break;case xc:this.adds(i)?this.deletes(i)||("insert"!==o&&(h(),o="insert"),l+=i.content.str):this.deletes(i)?("delete"!==o&&(h(),o="delete"),a+=i.length):i.deleted||("retain"!==o&&(h(),o="retain"),c+=i.length);break;case gc:{const{key:e,value:l}=i.content;if(this.adds(i)){if(!this.deletes(i)){const c=n.get(e)??null;jl(c,l)?null!==l&&i.delete(t):("retain"===o&&h(),jl(l,r.get(e)??null)?delete s[e]:s[e]=l)}}else if(this.deletes(i)){r.set(e,l);const t=n.get(e)??null;jl(t,l)||("retain"===o&&h(),s[e]=t)}else if(!i.deleted){r.set(e,l);const n=s[e];void 0!==n&&(jl(n,l)?null!==n&&i.delete(t):("retain"===o&&h(),null===l?delete s[e]:s[e]=l))}i.deleted||("insert"===o&&h(),Jl(n,i.content));break}}i=i.right}for(h();e.length>0;){const t=e[e.length-1];if(void 0===t.retain||void 0!==t.attributes)break;e.pop()}}),this._delta=e}return this._delta}},ec=class t extends wl{constructor(t){super(),this._pending=void 0!==t?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??dl(),this._length}_integrate(t,e){super._integrate(t,e);try{this._pending.forEach(t=>t())}catch(Dd){}this._pending=null}_copy(){return new t}clone(){const e=new t;return e.applyDelta(this.toDelta()),e}_callObserver(t,e){super._callObserver(t,e);const n=new tc(this,t,e);yl(this,t,n),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??dl();let t="",e=this._start;for(;null!==e;)!e.deleted&&e.countable&&e.content.constructor===xc&&(t+=e.content.str),e=e.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:e=!0}={}){null!==this.doc?Xs(this.doc,n=>{const r=new Hl(null,this._start,0,/* @__PURE__ */new Map);for(let i=0;i<t.length;i++){const o=t[i];if(void 0!==o.insert){const s=e||"string"!=typeof o.insert||i!==t.length-1||null!==r.right||"\n"!==o.insert.slice(-1)?o.insert:o.insert.slice(0,-1);("string"!=typeof s||s.length>0)&&ql(n,this,r,s,o.attributes||{})}else void 0!==o.retain?Gl(n,this,r,o.retain,o.attributes||{}):void 0!==o.delete&&Ql(n,r,o.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,e,n){this.doc??dl();const r=[],i=/* @__PURE__ */new Map,o=this.doc;let s="",l=this._start;function c(){if(s.length>0){const t={};let e=!1;i.forEach((n,r)=>{e=!0,t[r]=n});const n={insert:s};e&&(n.attributes=t),r.push(n),s=""}}const a=()=>{for(;null!==l;){if(Ms(l,t)||void 0!==e&&Ms(l,e))switch(l.content.constructor){case xc:{const r=i.get("ychange");void 0===t||Ms(l,t)?void 0===e||Ms(l,e)?void 0!==r&&(c(),i.delete("ychange")):void 0!==r&&r.user===l.id.client&&"added"===r.type||(c(),i.set("ychange",n?n("added",l.id):{type:"added"})):void 0!==r&&r.user===l.id.client&&"removed"===r.type||(c(),i.set("ychange",n?n("removed",l.id):{type:"removed"})),s+=l.content.str;break}case Ac:case fc:{c();const t={insert:l.content.getContent()[0]};if(i.size>0){const e={};t.attributes=e,i.forEach((t,n)=>{e[n]=t})}r.push(t);break}case gc:Ms(l,t)&&(c(),Jl(i,l.content))}l=l.right}c()};return t||e?Xs(o,n=>{t&&Rs(n,t),e&&Rs(n,e),a()},"cleanup"):a(),r}insert(t,e,n){if(e.length<=0)return;const r=this.doc;null!==r?Xs(r,r=>{const i=Fl(r,this,t,!n);n||(n={},i.currentAttributes.forEach((t,e)=>{n[e]=t})),ql(r,this,i,e,n)}):this._pending.push(()=>this.insert(t,e,n))}insertEmbed(t,e,n){const r=this.doc;null!==r?Xs(r,r=>{const i=Fl(r,this,t,!n);ql(r,this,i,e,n||{})}):this._pending.push(()=>this.insertEmbed(t,e,n||{}))}delete(t,e){if(0===e)return;const n=this.doc;null!==n?Xs(n,n=>{Ql(n,Fl(n,this,t,!0),e)}):this._pending.push(()=>this.delete(t,e))}format(t,e,n){if(0===e)return;const r=this.doc;null!==r?Xs(r,r=>{const i=Fl(r,this,t,!1);null!==i.right&&Gl(r,this,i,e,n)}):this._pending.push(()=>this.format(t,e,n))}removeAttribute(t){null!==this.doc?Xs(this.doc,e=>{Tl(e,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,e){null!==this.doc?Xs(this.doc,n=>{Il(n,this,t,e)}):this._pending.push(()=>this.setAttribute(t,e))}getAttribute(t){return Nl(this,t)}getAttributes(){return Ml(this)}_write(t){t.writeTypeRef(Sc)}},nc=class{constructor(t,e=()=>!0){this._filter=e,this._root=t,this._currentNode=t._start,this._firstCall=!0,t.doc??dl()}[Symbol.iterator](){return this}next(){let t=this._currentNode,e=t&&t.content&&t.content.type;if(null!==t&&(!this._firstCall||t.deleted||!this._filter(e)))do{if(e=t.content.type,t.deleted||e.constructor!==ic&&e.constructor!==rc||null===e._start)for(;null!==t;){const e=t.next;if(null!==e){t=e;break}t=t.parent===this._root?null:t.parent._item}else t=e._start}while(null!==t&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,null===t?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}},rc=class t extends wl{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new t}clone(){const e=new t;return e.insert(0,this.toArray().map(t=>t instanceof wl?t.clone():t)),e}get length(){return this.doc??dl(),null===this._prelimContent?this._length:this._prelimContent.length}createTreeWalker(t){return new nc(this,t)}querySelector(t){t=t.toUpperCase();const e=new nc(this,e=>e.nodeName&&e.nodeName.toUpperCase()===t).next();return e.done?null:e.value}querySelectorAll(t){return t=t.toUpperCase(),An(new nc(this,e=>e.nodeName&&e.nodeName.toUpperCase()===t))}_callObserver(t,e){yl(this,t,new oc(this,e,t))}toString(){return Sl(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,e={},n){const r=t.createDocumentFragment();return void 0!==n&&n._createAssociation(r,this),kl(this,i=>{r.insertBefore(i.toDOM(t,e,n),null)}),r}insert(t,e){null!==this.doc?Xs(this.doc,n=>{Al(n,this,t,e)}):this._prelimContent.splice(t,0,...e)}insertAfter(t,e){if(null!==this.doc)Xs(this.doc,n=>{const r=t&&t instanceof wl?t._item:t;El(n,this,r,e)});else{const n=this._prelimContent,r=null===t?0:n.findIndex(e=>e===t)+1;if(0===r&&null!==t)throw mr("Reference item not found");n.splice(r,0,...e)}}delete(t,e=1){null!==this.doc?Xs(this.doc,n=>{Dl(n,this,t,e)}):this._prelimContent.splice(t,e)}toArray(){return bl(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return _l(this,t)}slice(t=0,e=this.length){return xl(this,t,e)}forEach(t){kl(this,t)}_write(t){t.writeTypeRef(_c)}},ic=class t extends rc{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=/* @__PURE__ */new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,e){super._integrate(t,e),this._prelimAttrs.forEach((t,e)=>{this.setAttribute(e,t)}),this._prelimAttrs=null}_copy(){return new t(this.nodeName)}clone(){const e=new t(this.nodeName);return((t,e)=>{for(const n in t)e(t[n],n)})(this.getAttributes(),(t,n)=>{e.setAttribute(n,t)}),e.insert(0,this.toArray().map(t=>t instanceof wl?t.clone():t)),e}toString(){const t=this.getAttributes(),e=[],n=[];for(const o in t)n.push(o);n.sort();const r=n.length;for(let o=0;o<r;o++){const r=n[o];e.push(r+'="'+t[r]+'"')}const i=this.nodeName.toLocaleLowerCase();return`<${i}${e.length>0?" "+e.join(" "):""}>${super.toString()}</${i}>`}removeAttribute(t){null!==this.doc?Xs(this.doc,e=>{Tl(e,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,e){null!==this.doc?Xs(this.doc,n=>{Il(n,this,t,e)}):this._prelimAttrs.set(t,e)}getAttribute(t){return Nl(this,t)}hasAttribute(t){return Rl(this,t)}getAttributes(t){return t?((t,e)=>{const n={};return t._map.forEach((t,r)=>{let i=t;for(;null!==i&&(!e.sv.has(i.id.client)||i.id.clock>=(e.sv.get(i.id.client)||0));)i=i.left;null!==i&&Ms(i,e)&&(n[r]=i.content.getContent()[i.length-1])}),n})(this,t):Ml(this)}toDOM(t=document,e={},n){const r=t.createElement(this.nodeName),i=this.getAttributes();for(const o in i){const t=i[o];"string"==typeof t&&r.setAttribute(o,t)}return kl(this,i=>{r.appendChild(i.toDOM(t,e,n))}),void 0!==n&&n._createAssociation(r,this),r}_write(t){t.writeTypeRef(Cc),t.writeKey(this.nodeName)}},oc=class extends al{constructor(t,e,n){super(t,n),this.childListChanged=!1,this.attributesChanged=/* @__PURE__ */new Set,e.forEach(t=>{null===t?this.childListChanged=!0:this.attributesChanged.add(t)})}},sc=class t extends $l{constructor(t){super(),this.hookName=t}_copy(){return new t(this.hookName)}clone(){const e=new t(this.hookName);return this.forEach((t,n)=>{e.set(n,t)}),e}toDOM(t=document,e={},n){const r=e[this.hookName];let i;return i=void 0!==r?r.createDom(this):document.createElement(this.hookName),i.setAttribute("data-yjs-hook",this.hookName),void 0!==n&&n._createAssociation(i,this),i}_write(t){t.writeTypeRef(Ec),t.writeKey(this.hookName)}},lc=class t extends ec{get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new t}clone(){const e=new t;return e.applyDelta(this.toDelta()),e}toDOM(t=document,e,n){const r=t.createTextNode(this.toString());return void 0!==n&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(t=>{const e=[];for(const r in t.attributes){const n=[];for(const e in t.attributes[r])n.push({key:e,value:t.attributes[r][e]});n.sort((t,e)=>t.key<e.key?-1:1),e.push({nodeName:r,attrs:n})}e.sort((t,e)=>t.nodeName<e.nodeName?-1:1);let n="";for(let r=0;r<e.length;r++){const t=e[r];n+=`<${t.nodeName}`;for(let e=0;e<t.attrs.length;e++){const r=t.attrs[e];n+=` ${r.key}="${r.value}"`}n+=">"}n+=t.insert;for(let r=e.length-1;r>=0;r--)n+=`</${e[r].nodeName}>`;return n}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(Oc)}},cc=class{constructor(t,e){this.id=t,this.length=e}get deleted(){throw yr()}mergeWith(t){return!1}write(t,e,n){throw yr()}integrate(t,e){throw yr()}},ac=class extends cc{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor===t.constructor&&(this.length+=t.length,!0)}integrate(t,e){e>0&&(this.id.clock+=e,this.length-=e),Ls(t.doc.store,this)}write(t,e){t.writeInfo(0),t.writeLen(this.length-e)}getMissing(t,e){return null}},hc=class t{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new t(this.content)}splice(t){throw yr()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeBuf(this.content)}getRef(){return 3}},dc=class t{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new t(this.len)}splice(e){const n=new t(this.len-e);return this.len=e,n}mergeWith(t){return this.len+=t.len,!0}integrate(t,e){ts(t.deleteSet,e.id.client,e.id.clock,this.len),e.markDeleted()}delete(t){}gc(t){}write(t,e){t.writeLen(this.len-e)}getRef(){return 1}},uc=(t,e)=>new os({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1}),pc=class t{constructor(t){t._item,this.doc=t;const e={};this.opts=e,t.gc||(e.gc=!1),t.autoLoad&&(e.autoLoad=!0),null!==t.meta&&(e.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new t(uc(this.doc.guid,this.opts))}splice(t){throw yr()}mergeWith(t){return!1}integrate(t,e){this.doc._item=e,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,e){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}},fc=class t{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new t(this.embed)}splice(t){throw yr()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeJSON(this.embed)}getRef(){return 5}},gc=class t{constructor(t,e){this.key=t,this.value=e}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new t(this.key,this.value)}splice(t){throw yr()}mergeWith(t){return!1}integrate(t,e){const n=e.parent;n._searchMarker=null,n._hasFormatting=!0}delete(t){}gc(t){}write(t,e){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}},mc=class t{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new t(this.arr)}splice(e){const n=new t(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){const n=this.arr.length;t.writeLen(n-e);for(let r=e;r<n;r++){const e=this.arr[r];t.writeString(void 0===e?"undefined":JSON.stringify(e))}}getRef(){return 2}},yc="development"===ai("node_env"),wc=class t{constructor(t){this.arr=t,yc&&ni(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new t(this.arr)}splice(e){const n=new t(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){const n=this.arr.length;t.writeLen(n-e);for(let r=e;r<n;r++){const e=this.arr[r];t.writeAny(e)}}getRef(){return 8}},xc=class t{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new t(this.str)}splice(e){const n=new t(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(t){return this.str+=t.str,!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeString(0===e?this.str:this.str.slice(e))}getRef(){return 4}},bc=[t=>new Pl,t=>new $l,t=>new ec,t=>new ic(t.readKey()),t=>new rc,t=>new sc(t.readKey()),t=>new lc],vc=0,kc=1,Sc=2,Cc=3,_c=4,Ec=5,Oc=6,Ac=class t{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new t(this.type._copy())}splice(t){throw yr()}mergeWith(t){return!1}integrate(t,e){this.type._integrate(t.doc,e)}delete(t){let e=this.type._start;for(;null!==e;)e.deleted?e.id.clock<(t.beforeState.get(e.id.client)||0)&&t._mergeStructs.push(e):e.delete(t),e=e.right;this.type._map.forEach(e=>{e.deleted?e.id.clock<(t.beforeState.get(e.id.client)||0)&&t._mergeStructs.push(e):e.delete(t)}),t.changed.delete(this.type)}gc(t){let e=this.type._start;for(;null!==e;)e.gc(t,!0),e=e.right;this.type._start=null,this.type._map.forEach(e=>{for(;null!==e;)e.gc(t,!0),e=e.left}),this.type._map=/* @__PURE__ */new Map}write(t,e){this.type._write(t)}getRef(){return 7}},Dc=(t,e)=>{let n,r=e,i=0;do{i>0&&(r=ks(r.client,r.clock+i)),n=js(t,r),i=r.clock-n.id.clock,r=n.redone}while(null!==r&&n instanceof Rc);return{item:n,diff:i}},Tc=(t,e)=>{for(;null!==t&&t.keep!==e;)t.keep=e,t=t.parent._item},Ic=(t,e,n)=>{const{client:r,clock:i}=e.id,o=new Rc(ks(r,i+n),e,ks(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&o.markDeleted(),e.keep&&(o.keep=!0),null!==e.redone&&(o.redone=ks(e.redone.client,e.redone.clock+n)),e.right=o,null!==o.right&&(o.right.left=o),t._mergeStructs.push(o),null!==o.parentSub&&null===o.right&&o.parent._map.set(o.parentSub,o),e.length=n,o},Nc=(t,e)=>Tn(t,t=>Yo(t.deletions,e)),Mc=(t,e,n,r,i,o)=>{const s=t.doc,l=s.store,c=s.clientID,a=e.redone;if(null!==a)return Bs(t,a);let h,d=e.parent._item,u=null;if(null!==d&&!0===d.deleted){if(null===d.redone&&(!n.has(d)||null===Mc(t,d,n,r,i,o)))return null;for(;null!==d.redone;)d=Bs(t,d.redone)}const p=null===d?e.parent:d.content.type;if(null===e.parentSub){for(u=e.left,h=e;null!==u;){let e=u;for(;null!==e&&e.parent._item!==d;)e=null===e.redone?null:Bs(t,e.redone);if(null!==e&&e.parent._item===d){u=e;break}u=u.left}for(;null!==h;){let e=h;for(;null!==e&&e.parent._item!==d;)e=null===e.redone?null:Bs(t,e.redone);if(null!==e&&e.parent._item===d){h=e;break}h=h.right}}else{if(h=null,e.right&&!i){for(u=e;null!==u&&null!==u.right&&(u.right.redone||Yo(r,u.right.id)||Nc(o.undoStack,u.right.id)||Nc(o.redoStack,u.right.id));)for(u=u.right;u.redone;)u=Bs(t,u.redone);if(u&&null!==u.right)return null}else u=p._map.get(e.parentSub)||null;null!==u&&u.parent._item!==d&&(u=p._map.get(e.parentSub)||null)}const f=Ps(l,c),g=ks(c,f),m=new Rc(g,u,u&&u.lastId,h,h&&h.id,p,e.parentSub,e.content.copy());return e.redone=g,Tc(m,!0),m.integrate(t,0),m},Rc=class t extends cc{constructor(t,e,n,r,i,o,s,l){super(t,l.getLength()),this.origin=n,this.left=e,this.right=r,this.rightOrigin=i,this.parent=o,this.parentSub=s,this.redone=null,this.content=l,this.info=this.content.isCountable()?2:0}set marker(t){(8&this.info)>0!==t&&(this.info^=8)}get marker(){return(8&this.info)>0}get keep(){return(1&this.info)>0}set keep(t){this.keep!==t&&(this.info^=1)}get countable(){return(2&this.info)>0}get deleted(){return(4&this.info)>0}set deleted(t){this.deleted!==t&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ps(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ps(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===bs&&this.id.client!==this.parent.client&&this.parent.clock>=Ps(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Fs(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Bs(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===ac||this.right&&this.right.constructor===ac)this.parent=null;else if(this.parent){if(this.parent.constructor===bs){const t=js(n,this.parent);t.constructor===ac?this.parent=null:this.parent=t.content.type}}else this.left&&this.left.constructor===t?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===t&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);return null}integrate(t,e){if(e>0&&(this.id.clock+=e,this.left=Fs(t,t.doc.store,ks(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(e),this.length-=e),this.parent){if(!this.left&&(!this.right||null!==this.right.left)||this.left&&this.left.right!==this.right){let e,n=this.left;if(null!==n)e=n.right;else if(null!==this.parentSub)for(e=this.parent._map.get(this.parentSub)||null;null!==e&&null!==e.left;)e=e.left;else e=this.parent._start;const r=/* @__PURE__ */new Set,i=/* @__PURE__ */new Set;for(;null!==e&&e!==this.right;){if(i.add(e),r.add(e),vs(this.origin,e.origin)){if(e.id.client<this.id.client)n=e,r.clear();else if(vs(this.rightOrigin,e.rightOrigin))break}else{if(null===e.origin||!i.has(js(t.doc.store,e.origin)))break;r.has(js(t.doc.store,e.origin))||(n=e,r.clear())}e=e.right}this.left=n}if(null!==this.left){const t=this.left.right;this.right=t,this.left.right=this}else{let t;if(null!==this.parentSub)for(t=this.parent._map.get(this.parentSub)||null;null!==t&&null!==t.left;)t=t.left;else t=this.parent._start,this.parent._start=this;this.right=t}null!==this.right?this.right.left=this:null!==this.parentSub&&(this.parent._map.set(this.parentSub,this),null!==this.left&&this.left.delete(t)),null===this.parentSub&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Ls(t.doc.store,this),this.content.integrate(t,this),Ks(t,this.parent,this.parentSub),(null!==this.parent._item&&this.parent._item.deleted||null!==this.parentSub&&null!==this.right)&&this.delete(t)}else new ac(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;null!==t&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;null!==t&&t.deleted;)t=t.left;return t}get lastId(){return 1===this.length?this.id:ks(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&vs(t.origin,this.lastId)&&this.right===t&&vs(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&null===this.redone&&null===t.redone&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){const e=this.parent._searchMarker;return e&&e.forEach(e=>{e.p===t&&(e.p=this,!this.deleted&&this.countable&&(e.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,null!==this.right&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const e=this.parent;this.countable&&null===this.parentSub&&(e._length-=this.length),this.markDeleted(),ts(t.deleteSet,this.id.client,this.id.clock,this.length),Ks(t,e,this.parentSub),this.content.delete(t)}}gc(t,e){if(!this.deleted)throw wr();this.content.gc(t),e?((t,e,n)=>{const r=t.clients.get(e.id.client);r[$s(r,e.id.clock)]=n})(t,this,new ac(this.id,this.length)):this.content=new dc(this.length)}write(t,e){const n=e>0?ks(this.id.client,this.id.clock+e-1):this.origin,r=this.rightOrigin,i=this.parentSub,o=31&this.content.getRef()|(null===n?0:128)|(null===r?0:64)|(null===i?0:32);if(t.writeInfo(o),null!==n&&t.writeLeftID(n),null!==r&&t.writeRightID(r),null===n&&null===r){const e=this.parent;if(void 0!==e._item){const n=e._item;if(null===n){const n=Ss(e);t.writeParentInfo(!0),t.writeString(n)}else t.writeParentInfo(!1),t.writeLeftID(n.id)}else e.constructor===String?(t.writeParentInfo(!0),t.writeString(e)):e.constructor===bs?(t.writeParentInfo(!1),t.writeLeftID(e)):wr();null!==i&&t.writeString(i)}this.content.write(t,e)}},zc=(t,e)=>Uc[31&e](t),Uc=[()=>{wr()},t=>new dc(t.readLen()),t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const e=t.readString();"undefined"===e?n.push(void 0):n.push(JSON.parse(e))}return new mc(n)},t=>new hc(t.readBuf()),t=>new xc(t.readString()),t=>new fc(t.readJSON()),t=>new gc(t.readKey(),t.readJSON()),t=>new Ac(bc[t.readTypeRef()](t)),t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new wc(n)},t=>new pc(uc(t.readString(),t.readAny())),()=>{wr()}],Pc=class extends cc{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor===t.constructor&&(this.length+=t.length,!0)}integrate(t,e){wr()}write(t,e){t.writeInfo(10),tr(t.restEncoder,this.length-e)}getMissing(t,e){return null}},Lc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},$c="__ $YJS$ __";function jc(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i!=o){if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){let t=i.text,e=o.text,r=0;for(;t[r]==e[r];r++)n++;return r&&r<t.length&&r<e.length&&Fc(t.charCodeAt(r-1))&&Bc(t.charCodeAt(r))&&n--,n}if(i.content.size||o.content.size){let t=jc(i.content,o.content,n+1);if(null!=t)return t}n+=i.nodeSize}else n+=i.nodeSize}}function Hc(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(0==i||0==o)return i==o?null:{a:n,b:r};let s=t.child(--i),l=e.child(--o),c=s.nodeSize;if(s!=l){if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let t=s.text,e=l.text,i=t.length,o=e.length;for(;i>0&&o>0&&t[i-1]==e[o-1];)i--,o--,n--,r--;return i&&o&&i<t.length&&Fc(t.charCodeAt(i-1))&&Bc(t.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(s.content.size||l.content.size){let t=Hc(s.content,l.content,n-1,r-1);if(t)return t}n-=c,r-=c}else n-=c,r-=c}}function Bc(t){return t>=56320&&t<57344}function Fc(t){return t>=55296&&t<56320}Lc[$c],Lc[$c]=!0;var Vc=class t{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let n=0;n<t.length;n++)this.size+=t[n].nodeSize}nodesBetween(t,e,n,r=0,i){for(let o=0,s=0;s<e;o++){let l=this.content[o],c=s+l.nodeSize;if(c>t&&!1!==n(l,r+s,i||null,o)&&l.content.size){let i=s+1;l.nodesBetween(Math.max(0,t-i),Math.min(l.content.size,e-i),n,r+i)}s=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,r){let i="",o=!0;return this.nodesBetween(t,e,(s,l)=>{let c=s.isText?s.text.slice(Math.max(t,l)-l,e-l):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&c||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new t(i,this.size+e.size)}cut(e,n=this.size){if(0==e&&n==this.size)return this;let r=[],i=0;if(n>e)for(let t=0,o=0;o<n;t++){let s=this.content[t],l=o+s.nodeSize;l>e&&((o<e||l>n)&&(s=s.isText?s.cut(Math.max(0,e-o),Math.min(s.text.length,n-o)):s.cut(Math.max(0,e-o-1),Math.min(s.content.size,n-o-1))),r.push(s),i+=s.nodeSize),o=l}return new t(r,i)}cutByIndex(e,n){return e==n?t.empty:0==e&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new t(i,o)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(this.content.concat(e),this.size+e.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))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(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,n=0;e<this.content.length;e++){let r=this.content[e];t(r,n,e),n+=r.nodeSize}}findDiffStart(t,e=0){return jc(this,t,e)}findDiffEnd(t,e=this.size,n=t.size){return Hc(this,t,e,n)}findIndex(t){if(0==t)return Wc(0,t);if(t==this.size)return Wc(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let e=0,n=0;;e++){let r=n+this.child(e).nodeSize;if(r>=t)return r==t?Wc(e+1,r):Wc(e,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return t.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let t=0;t<e.length;t++){let i=e[t];r+=i.nodeSize,t&&i.isText&&e[t-1].sameMarkup(i)?(n||(n=e.slice(0,t)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new t(n||e,r)}static from(e){if(!e)return t.empty;if(e instanceof t)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new t([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Vc.empty=new Vc([],0);var Jc={index:0,offset:0};function Wc(t,e){return Jc.index=t,Jc.offset=e,Jc}function Kc(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!Kc(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!Kc(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}var qc=class t{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,n=!1;for(let r=0;r<t.length;r++){let i=t[r];if(this.eq(i))return t;if(this.type.excludes(i.type))e||(e=t.slice(0,r));else{if(i.type.excludes(this.type))return t;!n&&i.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(i)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Kc(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[e.type];if(!n)throw new RangeError(`There is no mark type ${e.type} in this schema`);let r=n.create(e.attrs);return n.checkAttrs(r.attrs),r}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return t.none;if(e instanceof t)return[e];let n=e.slice();return n.sort((t,e)=>t.type.rank-e.type.rank),n}};qc.none=[];var Gc=class extends Error{},Xc=class t{constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Zc(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(Yc(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(e,n){if(!n)return t.empty;let r=n.openStart||0,i=n.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid input for Slice.fromJSON");return new t(Vc.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let t=e.firstChild;t&&!t.isLeaf&&(n||!t.type.spec.isolating);t=t.firstChild)r++;for(let t=e.lastChild;t&&!t.isLeaf&&(n||!t.type.spec.isolating);t=t.lastChild)i++;return new t(e,r,i)}};function Yc(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(i==e||o.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Yc(o.content,e-i-1,n-i-1)))}function Zc(t,e,n,r,i,o){let{index:s,offset:l}=t.findIndex(e),c=t.maybeChild(s);if(l==e||c.isText)return o&&r<=0&&i<=0&&!o.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Zc(c.content,e-l-1,n,0==s?r-1:0,s==t.childCount-1?i-1:0,c);return a&&t.replaceChild(s,c.copy(a))}Xc.empty=new Xc(Vc.empty,0,0);Object.create(null);var Qc=class t{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new ta(e,n);if(null==r.next)return t.empty;let i=ea(r);r.next&&r.err("Unexpected trailing text");let o=ca(function(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){let i={term:r,to:n};return e[t].push(i),i}function i(t,e){t.forEach(t=>t.to=e)}function o(t,e){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(o(n,e)),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(e,s),i(o(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return i(o(t.expr,e),s),i(o(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(e)].concat(o(t.expr,e));if("range"==t.type){let s=e;for(let e=0;e<t.min;e++){let e=n();i(o(t.expr,s),e),s=e}if(-1==t.max)i(o(t.expr,s),s);else for(let e=t.min;e<t.max;e++){let e=n();r(s,e),i(o(t.expr,s),e),s=e}return[r(s)]}if("name"==t.type)return[r(e,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=o(t.exprs[r],e);if(r==t.exprs.length-1)return s;i(s,e=n())}}}(i));return function(t,e){for(let n=0,r=[t];n<r.length;n++){let t=r[n],i=!t.validEnd,o=[];for(let e=0;e<t.next.length;e++){let{type:n,next:s}=t.next[e];o.push(n.name),!i||n.isText||n.hasRequiredAttrs()||(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,r),o}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,n=t.childCount){let r=this;for(let i=e;r&&i<n;i++)r=r.matchType(t.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let n=0;n<t.next.length;n++)if(this.next[e].type==t.next[n].type)return!0;return!1}fillBefore(t,e=!1,n=0){let r=[this];return function i(o,s){let l=o.matchFragment(t,n);if(l&&(!e||l.validEnd))return Vc.from(s.map(t=>t.createAndFill()));for(let t=0;t<o.next.length;t++){let{type:e,next:n}=o.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let t=i(n,s.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==t)return this.wrapCache[n+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(t)){let t=[];for(let e=r;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<i.next.length;t++){let{type:o,next:s}=i.next[t];o.isLeaf||o.hasRequiredAttrs()||o.name in e||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),e[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(n){t.push(n);for(let r=0;r<n.next.length;r++)-1==t.indexOf(n.next[r].next)&&e(n.next[r].next)}(this),t.map((e,n)=>{let r=n+(e.validEnd?"*":" ")+" ";for(let i=0;i<e.next.length;i++)r+=(i?", ":"")+e.next[i].type.name+"->"+t.indexOf(e.next[i].next);return r}).join("\n")}};Qc.empty=new Qc(!0);var ta=class{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}};function ea(t){let e=[];do{e.push(na(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function na(t){let e=[];do{e.push(ra(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function ra(t){let e=function(t){if(t.eat("(")){let e=ea(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let t=n[o];t.isInGroup(e)&&i.push(t)}0==i.length&&t.err("No node type or group '"+e+"' found");return i}(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=oa(t,e)}return e}function ia(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function oa(t,e){let n=ia(t),r=n;return t.eat(",")&&(r="}"!=t.next?ia(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function sa(t,e){return e-t}function la(t,e){let n=[];return function e(r){let i=t[r];if(1==i.length&&!i[0].term)return e(i[0].to);n.push(r);for(let t=0;t<i.length;t++){let{term:r,to:o}=i[t];r||-1!=n.indexOf(o)||e(o)}}(e),n.sort(sa)}function ca(t){let e=Object.create(null);return function n(r){let i=[];r.forEach(e=>{t[e].forEach(({term:e,to:n})=>{if(!e)return;let r;for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);la(t,n).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})})});let o=e[r.join(",")]=new Qc(r.indexOf(t.length-1)>-1);for(let t=0;t<i.length;t++){let r=i[t][1].sort(sa);o.next.push({type:i[t][0],next:e[r.join(",")]||n(r)})}return o}(la(t,0))}var aa=Math.pow(2,16);function ha(t,e){return t+e*aa}function da(t){return 65535&t}var ua=class{constructor(t,e,n){this.pos=t,this.delInfo=e,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}},pa=class t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&t.empty)return t.empty}recover(t){let e=0,n=da(t);if(!this.inverted)for(let r=0;r<n;r++)e+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/aa}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,n){let r=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?r:0);if(l>t)break;let c=this.ranges[s+i],a=this.ranges[s+o],h=l+c;if(t<=h){let i=l+r+((c?t==l?-1:t==h?1:e:e)<0?0:a);if(n)return i;let o=t==(e<0?l:h)?null:ha(s/3,t-l),d=t==l?2:t==h?1:4;return(e<0?t!=l:t!=h)&&(d|=8),new ua(i,d,o)}r+=a-c}return n?t+r:new ua(t+r,0,null)}touches(t,e){let n=0,r=da(e),i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let e=this.ranges[s]-(this.inverted?n:0);if(e>t)break;let l=this.ranges[s+i];if(t<=e+l&&s==3*r)return!0;n+=this.ranges[s+o]-l}return!1}forEach(t){let e=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),l=o+(this.inverted?0:i),c=this.ranges[r+e],a=this.ranges[r+n];t(s,s+c,l,l+a),i+=a-c}}invert(){return new t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?t.empty:new t(e<0?[0,-e,0]:[0,0,e])}};pa.empty=new pa([]);var fa=Object.create(null),ga=class{getMap(){return pa.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=fa[e.stepType];if(!n)throw new RangeError(`No step type ${e.stepType} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in fa)throw new RangeError("Duplicate use of step JSON ID "+t);return fa[t]=e,e.prototype.jsonID=t,e}},ma=class t{constructor(t,e){this.doc=t,this.failed=e}static ok(e){return new t(e,null)}static fail(e){return new t(null,e)}static fromReplace(e,n,r,i){try{return t.ok(e.replace(n,r,i))}catch(Dd){if(Dd instanceof Gc)return t.fail(Dd.message);throw Dd}}};function ya(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(ya(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return Vc.fromArray(r)}var wa=class t extends ga{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=t.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new Xc(ya(e.content,(t,e)=>t.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t,r),e.openStart,e.openEnd);return ma.fromReplace(t,this.from,this.to,i)}invert(){return new xa(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};ga.jsonID("addMark",wa);var xa=class t extends ga{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=new Xc(ya(e.content,t=>t.mark(this.mark.removeFromSet(t.marks)),t),e.openStart,e.openEnd);return ma.fromReplace(t,this.from,this.to,n)}invert(){return new wa(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};ga.jsonID("removeMark",xa);var ba=class t extends ga{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return ma.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return ma.fromReplace(t,this.pos,this.pos+1,new Xc(Vc.from(n),0,e.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let e=this.mark.addToSet(n.marks);if(e.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(e))return new t(this.pos,n.marks[r]);return new t(this.pos,this.mark)}}return new va(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}};ga.jsonID("addNodeMark",ba);var va=class t extends ga{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return ma.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return ma.fromReplace(t,this.pos,this.pos+1,new Xc(Vc.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new ba(this.pos,this.mark):this}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}};ga.jsonID("removeNodeMark",va);var ka=class t extends ga{constructor(t,e,n,r=!1){super(),this.from=t,this.to=e,this.slice=n,this.structure=r}apply(t){return this.structure&&Ca(t,this.from,this.to)?ma.fail("Structure replace would overwrite content"):ma.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new pa([this.from,this.to-this.from,this.slice.size])}invert(e){return new t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&t.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new t(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof t)||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 n=this.slice.size+e.slice.size==0?Xc.empty:new Xc(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(e.from,this.to,n,this.structure)}}{let n=this.slice.size+e.slice.size==0?Xc.empty:new Xc(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(this.from,this.to+(e.to-e.from),n,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new t(n.from,n.to,Xc.fromJSON(e,n.slice),!!n.structure)}};ka.MAP_BIAS=1,ga.jsonID("replace",ka);var Sa=class t extends ga{constructor(t,e,n,r,i,o,s=!1){super(),this.from=t,this.to=e,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(t){if(this.structure&&(Ca(t,this.from,this.gapFrom)||Ca(t,this.gapTo,this.to)))return ma.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return ma.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,e.content);return n?ma.fromReplace(t,this.from,this.to,n):ma.fail("Content does not fit in gap")}getMap(){return new pa([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new t(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new t(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(e,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,Xc.fromJSON(e,n.slice),n.insert,!!n.structure)}};function Ca(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let t=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!t||t.isLeaf)return!0;t=t.firstChild,i--}}return!1}ga.jsonID("replaceAround",Sa);ga.jsonID("attr",class t extends ga{constructor(t,e,n){super(),this.pos=t,this.attr=e,this.value=n}apply(t){let e=t.nodeAt(this.pos);if(!e)return ma.fail("No node at attribute step's position");let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,null,e.marks);return ma.fromReplace(t,this.pos,this.pos+1,new Xc(Vc.from(r),0,e.isLeaf?0:1))}getMap(){return pa.empty}invert(e){return new t(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if("number"!=typeof n.pos||"string"!=typeof n.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new t(n.pos,n.attr,n.value)}});ga.jsonID("docAttr",class t extends ga{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let r in t.attrs)e[r]=t.attrs[r];e[this.attr]=this.value;let n=t.type.create(e,t.content,t.marks);return ma.ok(n)}getMap(){return pa.empty}invert(e){return new t(this.attr,e.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if("string"!=typeof n.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new t(n.attr,n.value)}});var _a=Error;((_a=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n}).prototype=Object.create(Error.prototype)).constructor=_a,_a.prototype.name="TransformError";var Ea=Object.create(null),Oa=class{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new Aa(t.min(e),t.max(e))]}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 t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=Xc.empty){let n=e.content.lastChild,r=null;for(let s=0;s<e.openEnd;s++)r=n,n=n.lastChild;let i=t.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:c}=o[s],a=t.mapping.slice(i);t.replaceRange(a.map(l.pos),a.map(c.pos),s?Xc.empty:e),0==s&&La(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],l=t.mapping.slice(n),c=l.map(o.pos),a=l.map(s.pos);i?t.deleteRange(c,a):(t.replaceRangeWith(c,a,e),La(t,n,e.isInline?-1:1))}}static findFrom(t,e,n=!1){let r=t.parent.inlineContent?new Ia(t):Pa(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let i=t.depth-1;i>=0;i--){let r=e<0?Pa(t.node(0),t.node(i),t.before(i+1),t.index(i),e,n):Pa(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,e,n);if(r)return r}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new za(t.node(0))}static atStart(t){return Pa(t,t,0,0,1)||new za(t)}static atEnd(t){return Pa(t,t,t.content.size,t.childCount,-1)||new za(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Ea[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in Ea)throw new RangeError("Duplicate use of selection JSON ID "+t);return Ea[t]=e,e.prototype.jsonID=t,e}getBookmark(){return Ia.between(this.$anchor,this.$head).getBookmark()}};Oa.prototype.visible=!0;var Aa=class{constructor(t,e){this.$from=t,this.$to=e}},Da=!1;function Ta(t){Da||t.parent.inlineContent||(Da=!0)}var Ia=class t extends Oa{constructor(t,e=t){Ta(t),Ta(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Oa.near(r);let i=e.resolve(n.map(this.anchor));return new t(i.parent.inlineContent?i:r,r)}replace(t,e=Xc.empty){if(super.replace(t,e),e==Xc.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Na(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new t(e.resolve(n.anchor),e.resolve(n.head))}static create(t,e,n=e){let r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))}static between(e,n,r){let i=e.pos-n.pos;if(r&&!i||(r=i>=0?1:-1),!n.parent.inlineContent){let t=Oa.findFrom(n,r,!0)||Oa.findFrom(n,-r,!0);if(!t)return Oa.near(n,r);n=t.$head}return e.parent.inlineContent||(0==i||(e=(Oa.findFrom(e,-r,!0)||Oa.findFrom(e,r,!0)).$anchor).pos<n.pos!=i<0)&&(e=n),new t(e,n)}};Oa.jsonID("text",Ia);var Na=class t{constructor(t,e){this.anchor=t,this.head=e}map(e){return new t(e.map(this.anchor),e.map(this.head))}resolve(t){return Ia.between(t.resolve(this.anchor),t.resolve(this.head))}},Ma=class t extends Oa{constructor(t){let e=t.nodeAfter,n=t.node(0).resolve(t.pos+e.nodeSize);super(t,n),this.node=e}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?Oa.near(o):new t(o)}content(){return new Xc(Vc.from(this.node),0,0)}eq(e){return e instanceof t&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ra(this.anchor)}static fromJSON(e,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new t(e.resolve(n.anchor))}static create(e,n){return new t(e.resolve(n))}static isSelectable(t){return!t.isText&&!1!==t.type.spec.selectable}};Ma.prototype.visible=!1,Oa.jsonID("node",Ma);var Ra=class t{constructor(t){this.anchor=t}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Na(r,r):new t(r)}resolve(t){let e=t.resolve(this.anchor),n=e.nodeAfter;return n&&Ma.isSelectable(n)?new Ma(e):Oa.near(e)}},za=class t extends Oa{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=Xc.empty){if(e==Xc.empty){t.delete(0,t.doc.content.size);let e=Oa.atStart(t.doc);e.eq(t.selection)||t.setSelection(e)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(e){return new t(e)}map(e){return new t(e)}eq(e){return e instanceof t}getBookmark(){return Ua}};Oa.jsonID("all",za);var Ua={map(){return this},resolve:t=>new za(t)};function Pa(t,e,n,r,i,o=!1){if(e.inlineContent)return Ia.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let r=e.child(s);if(r.isAtom){if(!o&&Ma.isSelectable(r))return Ma.create(t,n-(i<0?r.nodeSize:0))}else{let e=Pa(t,r,n+i,i<0?r.childCount:0,i,o);if(e)return e}n+=r.nodeSize*i}return null}function La(t,e,n){let r=t.steps.length-1;if(r<e)return;let i,o=t.steps[r];(o instanceof ka||o instanceof Sa)&&(t.mapping.maps[r].forEach((t,e,n,r)=>{null==i&&(i=r)}),t.setSelection(Oa.near(t.doc.resolve(i),n)))}function $a(t,e){return e&&t?t.bind(e):t}var ja=class{constructor(t,e,n){this.name=t,this.init=$a(e.init,n),this.apply=$a(e.apply,n)}};new ja("doc",{init:t=>t.doc||t.schema.topNodeType.createAndFill(),apply:t=>t.doc}),new ja("selection",{init:(t,e)=>t.selection||Oa.atStart(e.doc),apply:t=>t.selection}),new ja("storedMarks",{init:t=>t.storedMarks||null,apply:(t,e,n,r)=>r.selection.$cursor?t.storedMarks:null}),new ja("scrollToSelection",{init:()=>0,apply:(t,e)=>t.scrolledIntoView?e+1:e});function Ha(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):"handleDOMEvents"==r&&(i=Ha(i,e,{})),n[r]=i}return n}var Ba=class{constructor(t){this.spec=t,this.props={},t.props&&Ha(t.props,this,this.props),this.key=t.key?t.key.key:Va("plugin")}getState(t){return t[this.key]}},Fa=Object.create(null);function Va(t){return t in Fa?t+"$"+ ++Fa[t]:(Fa[t]=0,t+"$")}var Ja=class{constructor(t="key"){this.key=Va(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}},Wa=/[\uD800-\uDBFF]/,Ka=/[\uDC00-\uDFFF]/,qa=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&Wa.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&Ka.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},Ga=(t,e)=>t>>>e|t<<32-e,Xa=t=>Ga(t,2)^Ga(t,13)^Ga(t,22),Ya=t=>Ga(t,6)^Ga(t,11)^Ga(t,25),Za=t=>Ga(t,7)^Ga(t,18)^t>>>3,Qa=t=>Ga(t,17)^Ga(t,19)^t>>>10,th=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),eh=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),nh=class{constructor(){const t=/* @__PURE__ */new ArrayBuffer(320);this._H=new Uint32Array(t,0,8),this._H.set(eh),this._W=new Uint32Array(t,64,64)}_updateHash(){const t=this._H,e=this._W;for(let h=16;h<64;h++)e[h]=Qa(e[h-2])+e[h-7]+Za(e[h-15])+e[h-16];let n=t[0],r=t[1],i=t[2],o=t[3],s=t[4],l=t[5],c=t[6],a=t[7];for(let h,d,u=0;u<64;u++)h=a+Ya(s)+(s&l^~s&c)+th[u]+e[u]>>>0,d=Xa(n)+(n&r^n&i^r&i)>>>0,a=c,c=l,l=s,s=o+h>>>0,o=i,i=r,r=n,n=h+d>>>0;t[0]+=n,t[1]+=r,t[2]+=i,t[3]+=o,t[4]+=s,t[5]+=l,t[6]+=c,t[7]+=a}digest(t){let e=0;for(;e+56<=t.length;){let n=0;for(;n<16&&e+3<t.length;n++)this._W[n]=t[e++]<<24|t[e++]<<16|t[e++]<<8|t[e++];if(e%64!=0){for(this._W.fill(0,n,16);e<t.length;)this._W[n]|=t[e]<<8*(3-e%4),e++;this._W[n]|=128<<8*(3-e%4)}this._updateHash()}const n=e%64!=0;this._W.fill(0,0,16);let r=0;for(;e<t.length;r++)for(let n=3;n>=0&&e<t.length;n--)this._W[r]|=t[e++]<<8*n;n||(this._W[r-(e%4==0?0:1)]|=128<<8*(3-e%4)),this._W[14]=t.byteLength/536870912,this._W[15]=8*t.byteLength,this._updateHash();const i=/* @__PURE__ */new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let t=0;t<4;t++)i[4*o+t]=this._H[o]>>>8*(3-t);return i}},rh=new Ja("y-sync"),ih=new Ja("y-undo"),oh=(new Ja("yjs-cursor"),t=>{return pi((t=>{for(let e=6;e<t.length;e++)t[e%6]=t[e%6]^t[e];return t.slice(0,6)})((e=fi(t),(new nh).digest(e))));var e}),sh=(t,e)=>void 0===e?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Yo(e.ds,t.id),lh=[{light:"#ecd44433",dark:"#ecd444"}],ch=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const n=_n();t.forEach(t=>n.add(t)),e=e.filter(t=>!n.has(t))}t.set(n,(r=e)[Mn(Ur()*r.length)])}var r;return t.get(n)},ah=(t,{colors:e=lh,colorMapping:n=/* @__PURE__ */new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:o}={})=>{let s=!1;const l=new fh(t,o),c=new Ba({props:{editable:t=>{const e=rh.getState(t);return null==e.snapshot&&null==e.prevSnapshot}},key:rh,state:{init:(i,o)=>({type:t,doc:t.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(t,e)=>{const n=t.getMeta(rh);if(void 0!==n){e=Object.assign({},e);for(const t in n)e[t]=n[t]}return e.addToHistory=!1!==t.getMeta("addToHistory"),e.isChangeOrigin=void 0!==n&&!!n.isChangeOrigin,e.isUndoRedoOperation=void 0!==n&&!!n.isChangeOrigin&&!!n.isUndoRedoOperation,null!==l.prosemirrorView&&(void 0===n||null==n.snapshot&&null==n.prevSnapshot||Mo(0,()=>{null!=l.prosemirrorView&&(null==n.restore?l._renderSnapshot(n.snapshot,n.prevSnapshot,e):(l._renderSnapshot(n.snapshot,n.snapshot,e),delete e.restore,delete e.snapshot,delete e.prevSnapshot,l.mux(()=>{l._prosemirrorChanged(l.prosemirrorView.state.doc)})))})),e}},view:t=>(l.initView(t),null==o&&l._forceRerender(),i(),{update:()=>{const e=c.getState(t.state);if(null==e.snapshot&&null==e.prevSnapshot&&(s||null!==t.state.doc.content.findDiffStart(t.state.doc.type.createAndFill().content))){if(s=!0,!1===e.addToHistory&&!e.isChangeOrigin){const e=ih.getState(t.state),n=e&&e.undoManager;n&&n.stopCapturing()}l.mux(()=>{e.doc.transact(n=>{n.meta.set("addToHistory",e.addToHistory),l._prosemirrorChanged(t.state.doc)},rh)})}},destroy:()=>{l.destroy()}})});return c},hh=(t,e,n,r)=>{if(null==n)return r;if(!(null===r||n>1&&r<=1||Fh(e,t,n,r)))return r;const i=Bh(e,t,n);return null!==i?i:r},dh=(t,e)=>{const n=t.doc.resolve(e);return n.nodeAfter?Ma.create(t.doc,e):Ia.near(n)},uh=(t,e,n,r)=>{if(null===e||null===n)return null;const i=Math.min(Math.max(e,0),t.doc.content.size),o=Math.min(Math.max(n,0),t.doc.content.size);try{const e=Oa.fromJSON(t.doc,{type:"nodeRange",anchor:i,head:o,depth:r});return e.ranges.length?e:Ia.near(t.doc.resolve(i))}catch(Dd){return Ia.near(t.doc.resolve(i))}},ph=(t,e)=>{const n=e.selection.jsonID;return{type:n,depth:"nodeRange"===n?e.selection.depth:void 0,anchor:Lh(e.selection.anchor,t.type,t.mapping),head:Lh(e.selection.head,t.type,t.mapping),absAnchor:e.selection.anchor,absHead:e.selection.head}},fh=class{constructor(t,e=/* @__PURE__ */new Map){this.type=t,this.prosemirrorView=null,this.mux=(()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else void 0!==n&&n()}})(),this.mapping=e,this.isOMark=/* @__PURE__ */new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=t.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{null===this.beforeTransactionSelection&&null!=this.prosemirrorView&&(this.beforeTransactionSelection=ph(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return!!this.prosemirrorView.hasFocus()&&(si&&null===this._domSelectionInView&&(Mo(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView)}_isDomSelectionInView(){const t=this.prosemirrorView._root.getSelection();if(null==t||null==t.anchorNode)return!1;const e=this.prosemirrorView._root.createRange();e.setStart(t.anchorNode,t.anchorOffset),e.setEnd(t.focusNode,t.focusOffset),0===e.getClientRects().length&&e.startContainer&&e.collapsed&&e.selectNodeContents(e.startContainer);const n=e.getBoundingClientRect(),r=Eo.documentElement;return n.bottom>=0&&n.right>=0&&n.left<=(window.innerWidth||r.clientWidth||0)&&n.top<=(window.innerHeight||r.clientHeight||0)}renderSnapshot(t,e){e||(e=Is(es(),/* @__PURE__ */new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(rh,{snapshot:t,prevSnapshot:e}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const t=this.type.toArray().map(t=>mh(t,this.prosemirrorView.state.schema,this)).filter(t=>null!==t),e=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Xc(Vc.from(t),0,0));e.setMeta(rh,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(e)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const t=null!==this.beforeTransactionSelection?null:this.prosemirrorView.state.selection,e=this.type.toArray().map(t=>mh(t,this.prosemirrorView.state.schema,this)).filter(t=>null!==t),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Xc(Vc.from(e),0,0));if(t){const e=zn(Un(t.anchor,0),n.doc.content.size),r=zn(Un(t.head,0),n.doc.content.size);n.setSelection(Ia.create(n.doc,e,r))}this.prosemirrorView.dispatch(n.setMeta(rh,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(t,e,n){let r=this.doc,i=this.type;if(t||(t=Ns(this.doc)),t instanceof Uint8Array||e instanceof Uint8Array)if(t instanceof Uint8Array&&e instanceof Uint8Array||wr(),r=new os({gc:!1}),fs(r,e),e=Ns(r),fs(r,t),t=Ns(r),null===i._item){const t=Array.from(this.doc.share.keys()).find(t=>this.doc.share.get(t)===this.type);i=r.getXmlFragment(t)}else{const t=r.store.clients.get(i._item.id.client)??[];i=t[$s(t,i._item.id.clock)].content.type}this.mapping.clear(),this.mux(()=>{r.transact(r=>{const o=n.permanentUserData;o&&o.dss.forEach(t=>{Xo(r,t,t=>{})});const s=(t,e)=>{const r="added"===t?o.getUserByClientId(e.client):o.getUserByDeletedId(e);return{user:r,type:t,color:ch(n.colorMapping,n.colors,r)}},l=vl(i,new Ts(e.ds,t.sv)).map(n=>!n._item.deleted||sh(n._item,t)||sh(n._item,e)?mh(n,this.prosemirrorView.state.schema,{mapping:/* @__PURE__ */new Map,isOMark:/* @__PURE__ */new Map},t,e,s):null).filter(t=>null!==t),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Xc(Vc.from(l),0,0));this.prosemirrorView.dispatch(c.setMeta(rh,{isChangeOrigin:!0}))},rh)})}_typeChanged(t,e){if(null==this.prosemirrorView)return;const n=rh.getState(this.prosemirrorView.state);0!==t.length&&null==n.snapshot&&null==n.prevSnapshot?this.mux(()=>{const t=(t,e)=>this.mapping.delete(e);Xo(e,e.deleteSet,t=>{if(t.constructor===Rc){const e=t.content.type;e&&this.mapping.delete(e)}}),e.changed.forEach(t),e.changedParentTypes.forEach(t),this.mapping.clear();const n=this.type.toArray().map(t=>gh(t,this.prosemirrorView.state.schema,this)).filter(t=>null!==t),r=this.prosemirrorView.state.doc;let i=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Xc(Vc.from(n),0,0));((t,e,n,r)=>{if(null!==e&&null!==e.anchor&&null!==e.head)if("all"===e.type)t.setSelection(new za(t.doc));else if("node"===e.type){const r=jh(n.doc,n.type,e.anchor,n.mapping);null!==r&&t.setSelection(dh(t,r))}else if("nodeRange"===e.type){const r=jh(n.doc,n.type,e.anchor,n.mapping),i=jh(n.doc,n.type,e.head,n.mapping),o=uh(t,r,i,e.depth);null!==o&&t.setSelection(o)}else{let i=jh(n.doc,n.type,e.anchor,n.mapping),o=jh(n.doc,n.type,e.head,n.mapping);null!=r&&(i=hh(t.doc,r,e.absAnchor,i),o=hh(t.doc,r,e.absHead,o)),null===i&&(i=o),null===o&&(o=i),null!==i&&null!==o&&t.setSelection(Ia.between(t.doc.resolve(i),t.doc.resolve(o)))}})(i,this.beforeTransactionSelection,this,r),i=i.setMeta(rh,{isChangeOrigin:!0,isUndoRedoOperation:e.origin instanceof tl}),null!==this.beforeTransactionSelection&&this._isLocalCursorInView()&&i.scrollIntoView(),this.prosemirrorView.dispatch(i)}):this.renderSnapshot(n.snapshot,n.prevSnapshot)}_prosemirrorChanged(t){this.doc.transact(()=>{Uh(this.doc,this.type,t,this),this.beforeTransactionSelection=ph(this,this.prosemirrorView.state)},rh)}initView(t){null!=this.prosemirrorView&&this.destroy(),this.prosemirrorView=t,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){null!=this.prosemirrorView&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}},gh=(t,e,n,r,i,o)=>{const s=n.mapping.get(t);if(void 0===s){if(t instanceof ic)return mh(t,e,n,r,i,o);throw yr()}return s},mh=(t,e,n,r,i,o)=>{const s=[],l=t=>{if(t instanceof ic){const l=gh(t,e,n,r,i,o);null!==l&&s.push(l)}else{const l=(t._item.right?.content)?.type;l instanceof ec&&!l._item.deleted&&l._item.id.client===l.doc.clientID&&(t.applyDelta([{retain:t.length},...l.toDelta()]),l.doc.transact(t=>{l._item.delete(t)}));const c=yh(t,e,n,r,i,o);null!==c&&c.forEach(t=>{null!==t&&s.push(t)})}};void 0===r||void 0===i?t.toArray().forEach(l):vl(t,new Ts(i.ds,r.sv)).forEach(l);try{const l=t.getAttributes(r);void 0!==r&&(sh(t._item,r)?sh(t._item,i)||(l.ychange=o?o("added",t._item.id):{type:"added"}):l.ychange=o?o("removed",t._item.id):{type:"removed"});const c=e.node(t.nodeName,l,s);return n.mapping.set(t,c),c}catch(Dd){return t.doc.transact(e=>{t._item.delete(e)},rh),n.mapping.delete(t),null}},yh=(t,e,n,r,i,o)=>{const s=[],l=t.toDelta(r,i,o);try{for(let t=0;t<l.length;t++){const n=l[t];s.push(e.text(n.insert,Rh(n.attributes,e)))}}catch(Dd){return t.doc.transact(e=>{t._item.delete(e)},rh),null}return s},wh=(t,e)=>t instanceof Array?((t,e)=>{const n=new lc,r=t.map(t=>({insert:t.text,attributes:zh(t.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n})(t,e):((t,e)=>{const n=new ic(t.type.name);for(const r in t.attrs){const e=t.attrs[r];null!==e&&"ychange"!==r&&n.setAttribute(r,e)}return n.insert(0,vh(t).map(t=>wh(t,e))),e.mapping.set(n,t),n})(t,e),xh=t=>"object"==typeof t&&null!==t,bh=(t,e)=>{const n=Object.keys(t).filter(e=>null!==t[e]);let r=n.length===Object.keys(e).filter(t=>null!==e[t]).length;for(let i=0;i<n.length&&r;i++){const o=n[i],s=t[o],l=e[o];r="ychange"===o||s===l||xh(s)&&xh(l)&&bh(s,l)}return r},vh=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const t=e[r];if(t.isText){const t=[];for(let n=e[r];r<e.length&&n.isText;n=e[++r])t.push(n);r--,n.push(t)}else n.push(t)}return n},kh=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((t,n)=>t.insert===e[n].text&&Yr(t.attributes||{}).length===e[n].marks.length&&Qr(t.attributes,(t,r)=>{const i=Mh(r),o=e[n].marks;return!!o.find(t=>t.type.name===i)&&bh(t,o.find(t=>t.type.name===i)?.attrs)}))},Sh=(t,e)=>{if(t instanceof ic&&!(e instanceof Array)&&Ph(t,e)){const n=vh(e);return t._length===n.length&&bh(t.getAttributes(),e.attrs)&&t.toArray().every((t,e)=>Sh(t,n[e]))}return t instanceof lc&&e instanceof Array&&kh(t,e)},Ch=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((t,n)=>e[n]===t),_h=(t,e,n,r)=>{n>0&&(t.slice(e,e+n).forEach(t=>r.mapping.delete(t)),t.delete(e,n))},Eh=(t,e,n,r,i,o)=>{if(r<i){const s=[];for(let t=r;t<i;t++)s.push(wh(n[t],o));t.insert(e,s)}},Oh=(t,e,n,r)=>e instanceof lc&&n instanceof Array?(kh(e,n)?r.mapping.set(e,n):Ih(e,n,r),!0):!(!(e instanceof ic)||n instanceof Array||!Ph(e,n))&&(Sh(e,n)?r.mapping.set(e,n):Uh(t,e,n,r),!0),Ah=(t,e,n,r,i,o,s,l,c)=>{const a=zn(o-i,l-s);for(let h=0;h<a;h++){const o=r[i+h],l=n[s+h];Oh(t,o,l,c)||(_h(e,s+h,1,c),Eh(e,s+h,n,s+h,s+h+1,c))}_h(e,s+a,o-i-a,c),Eh(e,s+a,n,s+a,l,c)},Dh=(t,e,n,r,i)=>{const o=((t,e,n)=>{const r=/* @__PURE__ */new Map;e.forEach((t,e)=>{r.has(t)||r.set(t,e)});const i=[];if(t.forEach((t,o)=>{const s=n.mapping.get(t),l=r.get(s);void 0!==l&&Ch(s,e[l])&&i.push({yIndex:o,pIndex:l,yChild:t})}),0===i.length)return[];const o=new Array(i.length),s=[];for(let c=0;c<i.length;c++){let t=0,e=s.length;for(;t<e;){const n=t+e>>1;i[s[n]].pIndex<i[c].pIndex?t=n+1:e=n}o[c]=t>0?s[t-1]:-1,s[t]=c}const l=[];for(let c=s[s.length-1];-1!==c;c=o[c])l.push(i[c]);return l.reverse()})(r,n,i);if(o.length<2||!o.some(t=>t.yIndex!==t.pIndex)||o.some(t=>{const e=n[t.pIndex];return!(t.yChild instanceof lc&&e instanceof Array||t.yChild instanceof ic&&!(e instanceof Array))}))return!1;let s=0,l=0;for(const c of o){Ah(t,e,n,r,s,c.yIndex,l,c.pIndex,i);const o=n[c.pIndex];Oh(t,c.yChild,o,i),s=c.yIndex+1,l=c.pIndex+1}return Ah(t,e,n,r,s,r.length,l,n.length,i),!0},Th=(t,e,n)=>{const r=t.toArray(),i=vh(e),o=i.length,s=r.length,l=zn(s,o);let c=0,a=0,h=!1;for(;c<l;c++){const t=r[c],e=i[c];if(Ch(n.mapping.get(t),e))h=!0;else if(!Sh(t,e))break}for(;c+a<l;a++){const t=r[s-a-1],e=i[o-a-1];if(Ch(n.mapping.get(t),e))h=!0;else if(!Sh(t,e))break}return{equalityFactor:c+a,foundMappedChild:h}},Ih=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=(t=>{let e="",n=t._start;const r={};for(;null!==n;)n.deleted||(n.countable&&n.content instanceof xc?e+=n.content.str:n.content instanceof gc&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}})(t),o=e.map(t=>({insert:t.text,attributes:Object.assign({},r,zh(t.marks,n))})),{insert:s,remove:l,index:c}=qa(i,o.map(t=>t.insert).join(""));t.delete(c,l),t.insert(c,s),t.applyDelta(o.map(t=>({retain:t.insert.length,attributes:t.attributes})))},Nh=/(.*)(--[a-zA-Z0-9+/=]{8})$/,Mh=t=>Nh.exec(t)?.[1]??t,Rh=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(Mh(r),t[r]));return n},zh=(t,e)=>{const n={};return t.forEach(t=>{if("ychange"!==t.type.name){const r=Cn(e.isOMark,t.type,()=>!t.type.excludes(t.type));n[r?`${t.type.name}--${oh(t.toJSON())}`:t.type.name]=t.attrs}}),n},Uh=(t,e,n,r)=>{if(e instanceof ic&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof ic){const t=e.getAttributes(),r=n.attrs;for(const n in r)null!==r[n]?t[n]!==r[n]&&"ychange"!==n&&e.setAttribute(n,r[n]):e.removeAttribute(n);for(const n in t)void 0===r[n]&&e.removeAttribute(n)}const i=vh(n),o=i.length,s=e.toArray(),l=s.length,c=zn(o,l);if(Dh(t,e,i,s,r))return;let a=0,h=0;for(;a<c;a++){const t=s[a],e=i[a];if(!Ch(r.mapping.get(t),e)){if(!Sh(t,e))break;r.mapping.set(t,e)}}for(;h+a+1<c;h++){const t=s[l-h-1],e=i[o-h-1];if(!Ch(r.mapping.get(t),e)){if(!Sh(t,e))break;r.mapping.set(t,e)}}t.transact(()=>{for(;l-a-h>0&&o-a-h>0;){const n=s[a],c=i[a],d=s[l-h-1],u=i[o-h-1];if(n instanceof lc&&c instanceof Array)kh(n,c)||Ih(n,c,r),a+=1;else{let i=n instanceof ic&&Ph(n,c),o=d instanceof ic&&Ph(d,u);if(i&&o){const t=Th(n,c,r),e=Th(d,u,r);t.foundMappedChild&&!e.foundMappedChild?o=!1:!t.foundMappedChild&&e.foundMappedChild||t.equalityFactor<e.equalityFactor?i=!1:o=!1}i?(Uh(t,n,c,r),a+=1):o?(Uh(t,d,u,r),h+=1):(r.mapping.delete(e.get(a)),e.delete(a,1),e.insert(a,[wh(c,r)]),a+=1)}}const n=l-a-h;if(1===l&&0===o&&s[0]instanceof lc?(r.mapping.delete(s[0]),s[0].delete(0,s[0].length)):n>0&&(e.slice(a,a+n).forEach(t=>r.mapping.delete(t)),e.delete(a,n)),a+h<o){const t=[];for(let e=a;e<o-h;e++)t.push(wh(i[e],r));e.insert(a,t)}},rh)},Ph=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name,Lh=(t,e,n)=>{if(0===t)return As(e,0,-1);let r=null===e._first?null:e._first.content.type;for(;null!==r&&e!==r;){if(r instanceof lc){if(r._length>=t)return As(r,t,-1);if(t-=r._length,null!==r._item&&null!==r._item.next)r=r._item.next.content.type;else{do{r=null===r._item?null:r._item.parent,t--}while(r!==e&&null!==r&&null!==r._item&&null===r._item.next);null!==r&&r!==e&&(r=null===r._item?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(null!==r._first&&t<i)r=r._first.content.type,t--;else{if(1===t&&0===r._length&&i>1)return new _s(null===r._item?null:r._item.id,null===r._item?Ss(r):null,null);if(t-=i,null!==r._item&&null!==r._item.next)r=r._item.next.content.type;else{if(0===t)return r=null===r._item?r:r._item.parent,new _s(null===r._item?null:r._item.id,null===r._item?Ss(r):null,null);do{r=r._item.parent,t--}while(r!==e&&null===r._item.next);r!==e&&(r=r._item.next.content.type)}}}if(null===r)throw wr();if(0===t&&r.constructor!==lc&&r!==e)return $h(r._item.parent,r._item)}return As(e,e._length,-1)},$h=(t,e)=>{let n=null,r=null;return null===t._item?r=Ss(t):n=ks(t._item.id.client,t._item.id.clock),new _s(n,r,e.id)},jh=(t,e,n,r)=>{const i=Ds(n,t);if(null===i||i.type!==e&&!Cs(e,i.type._item))return null;let o=i.type,s=0;if(o.constructor===lc)s=i.index;else if(null===o._item||!o._item.deleted){let t=o._first,e=0;for(;e<o._length&&e<i.index&&null!==t;){if(!t.deleted){const n=t.content.type;if(e++,n instanceof lc)s+=n._length;else{const t=r.get(n);if(null==t)return null;s+=t.nodeSize}}t=t.right}s+=1}for(;o!==e&&null!==o._item;){const t=o._item.parent;if(null===t._item||!t._item.deleted){s+=1;let e=t._first;for(;null!==e;){const t=e.content.type;if(t===o)break;if(!e.deleted)if(t instanceof lc)s+=t._length;else{const e=r.get(t);if(null==e)return null;s+=e.nodeSize}e=e.right}}o=t}const l=s-1;return((t,e,n)=>{if(null===n)return!1;const r=Ds(e,t);return null!==r&&r.type instanceof lc&&null!==e.item&&n<=1})(t,n,l)?null:l},Hh=(t,e)=>{if(t===e)return!0;const n=Object.keys(t);return n.length===Object.keys(e).length&&n.every(n=>t[n]===e[n])},Bh=(t,e,n)=>{let r=0,i=0;for(;i<t.childCount;i++){const e=t.child(i);if(r+e.nodeSize>n)break;r+=e.nodeSize}if(i>=t.childCount)return null;const o=t.child(i),s=t.resolve(n),l=(t,e)=>{if(0===s.depth){const i=t+(n-r),o=t+1,s=t+e.nodeSize-1;return Math.max(o,Math.min(i,s))}return((t,e,n)=>{let r=e+1,i=n;for(let o=1;o<t.depth;o++){const e=t.index(o);if(e>=i.childCount)return null;for(let t=0;t<e;t++)r+=i.child(t).nodeSize;if(r+=1,i=i.child(e),i.type!==t.node(o+1).type)return null}return i.isTextblock?r+Math.min(t.parentOffset,i.content.size):null})(s,t,e)},c=(n,r=!1)=>{let o=0;for(let e=0;e<=i;e++)n(t.child(e))&&o++;let s=0,c=-1,a=null,h=0;for(let t=0;t<e.childCount;t++){const r=e.child(t);n(r)&&(s++,s===o&&(c=h,a=r)),h+=r.nodeSize}return null===a||r&&(1!==o||1!==s)?null:l(c,a)},a=t=>t.type===o.type&&Hh(t.attrs,o.attrs),h=o.textContent,d=c(t=>a(t)&&t.textContent===h);if(null!==d)return d;const u=c(t=>t.type===o.type&&t.textContent===h);if(null!==u)return u;if((t=>{const e=t.type.spec.attrs||{};return Object.keys(t.attrs).some(n=>{const r=e[n];return null==r||!Object.prototype.hasOwnProperty.call(r,"default")||r.default!==t.attrs[n]})})(o)){const t=c(a,!0);if(null!==t)return t}return c(t=>a(t)&&""!==h&&""!==t.textContent&&(h.startsWith(t.textContent)||t.textContent.startsWith(h)),!0)},Fh=(t,e,n,r)=>{if(null===r)return!1;const i=t.resolve(n),o=e.resolve(r);if(!i.parent.isTextblock)return!1;if(!o.parent.isTextblock)return!0;if(i.parent.textContent!==o.parent.textContent)return!0;if(0!==i.parentOffset&&0===o.parentOffset)return!0;const s=0===i.parentOffset&&0===o.parentOffset,l=i.parentOffset!==o.parentOffset||i.parent.type!==o.parent.type||!Hh(i.parent.attrs,o.parent.attrs);if(s||l){const i=Bh(t,e,n);return null!==i&&i!==r}return!1},Vh=/* @__PURE__ */new Set(["paragraph"]),Jh=({protectedNodes:t=Vh,trackedOrigins:e=[],undoManager:n=null}={})=>new Ba({key:ih,state:{init:(r,i)=>{const o=rh.getState(i);let s=n;if(!s){const n=o.doc,r=new Set(n?n._observers.get("destroy"):[]);s=new tl(o.type,{trackedOrigins:new Set([rh].concat(e)),deleteFilter:e=>((t,e)=>!(t instanceof Rc&&t.content instanceof Ac&&(t.content.type instanceof ec||t.content.type instanceof ic&&e.has(t.content.type.nodeName))&&0!==t.content.type._length))(e,t),captureTransaction:t=>!1!==t.meta.get("addToHistory")});const i=n?n._observers.get("destroy"):/* @__PURE__ */new Set;s._yTiptapDocDestroyListeners=Array.from(i||[]).filter(t=>!r.has(t))}return{undoManager:s,prevSel:null,hasUndoOps:s.undoStack.length>0,hasRedoOps:s.redoStack.length>0}},apply:(t,e,n,r)=>{const i=rh.getState(r).binding,o=e.undoManager,s=o.undoStack.length>0,l=o.redoStack.length>0;return i?{undoManager:o,prevSel:ph(i,n),hasUndoOps:s,hasRedoOps:l}:s!==e.hasUndoOps||l!==e.hasRedoOps?Object.assign({},e,{hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}):e}},view:t=>{const e=rh.getState(t.state),n=ih.getState(t.state).undoManager;return n.on("stack-item-added",({stackItem:n})=>{const r=e.binding;r&&n.meta.set(r,ih.getState(t.state).prevSel)}),n.on("stack-item-popped",({stackItem:t})=>{const n=e.binding;n&&(n.beforeTransactionSelection=t.meta.get(n)||n.beforeTransactionSelection)}),{destroy:()=>{n.destroy();const t=n._yTiptapDocDestroyListeners;t&&n.doc&&(t.forEach(t=>n.doc.off("destroy",t)),n._yTiptapDocDestroyListeners=null)}}}});function Wh(t){return!!t.getMeta(rh)}function Kh(t,e){const n=rh.getState(t);return jh(n.doc,n.type,e,n.binding.mapping)||0}function qh(t,e){const n=rh.getState(t);return Lh(e,n.type,n.binding.mapping)}var Gh=class t extends Gt{constructor(t,e){super(t),this.yRelativePosition=e}static fromJSON(e){return new t(e.position,e.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};qt.create({name:"collaboration",priority:1e3,addOptions:()=>({document:null,field:"default",fragment:null,provider:null}),addStorage:()=>({isDisabled:!1}),onCreate(){this.editor.extensionManager.extensions.find(t=>"undoRedo"===t.name)},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(t,e)=>function(t,e,n){const r=t instanceof Gh?t.yRelativePosition:null;if(Wh(e)&&r)return{position:new Gh(Kh(n,r),r),mapResult:null};const i=Zt(t,e),o=i.position.position;return{position:new Gh(o,null!=r?r:qh(n,o)),mapResult:i.mapResult}}(t,e,this.editor.state),this.editor.utils.createMappablePosition=t=>function(t,e){return new Gh(t,qh(e,t))}(t,this.editor.state)},addCommands:()=>({undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),0!==ih.getState(e).undoManager.undoStack.length&&(!n||(t=>{const e=ih.getState(t).undoManager;if(null!=e)return e.undo(),!0})(e))),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),0!==ih.getState(e).undoManager.redoStack.length&&(!n||(t=>{const e=ih.getState(t).undoManager;if(null!=e)return e.redo(),!0})(e)))}),addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){const t=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),e=Jh(this.options.yUndoOptions),n=e.spec.view;e.spec.view=t=>{const{undoManager:e}=ih.getState(t.state);e.restore&&(e.restore(),e.restore=()=>{});const r=n?n(t):void 0;return{destroy:()=>{const t=e.trackedOrigins.has(e),n=e._observers;e.restore=()=>{t&&e.trackedOrigins.add(e),e.doc.on("afterTransaction",e.afterTransactionHandler),e._observers=n},(null==r?void 0:r.destroy)&&r.destroy()}}};const r={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender};return[ah(t,r),e,this.editor.options.enableContentCheck&&new ie({key:new oe("filterInvalidContent"),filterTransaction:e=>{if(!Wh(e))return!0;if(this.storage.isDisabled)return!1;if(!e.docChanged)return!0;try{return e.doc.check(),!0}catch(n){return this.storage.isDisabled=!0,this.editor.emit("contentError",{error:n,editor:this.editor,disableCollaboration:()=>{var e;null==(e=t.doc)||e.destroy()}}),!0}}})].filter(Boolean)}});function Xh(t){if(!t.length)return he.empty;const e=[],n=t[0].$from.node(0);return t.forEach(t=>{const n=t.$from.pos,r=t.$from.nodeAfter;r&&e.push(ae.node(n,n+r.nodeSize,{class:"ProseMirror-selectednoderange"}))}),he.create(n,e)}function Yh(t,e,n,r={}){const i=[],o=t.node(0),{extendOnBoundaryOverlap:s=!0}=r;"number"==typeof n&&n>=0||(n=t.sameParent(e)?Math.max(0,t.sharedDepth(e.pos)-1):t.sharedDepth(e.pos));const l=new de(t,e,n),c=0===l.depth?0:o.resolve(l.start).posAtIndex(0);return l.parent.forEach((n,r)=>{const a=c+r,h=a+n.nodeSize,d=function(t,e,n){const r=n.isText||n.isAtom?0:1;return{start:t+r,end:t+e-r}}(a,n.nodeSize,n),u=s?e.pos>=d.start&&t.pos<=d.end:e.pos>d.start&&t.pos<d.end;if(a<l.start||a>=l.end)return;if(!u)return;const p=new le(o.resolve(a),o.resolve(h));i.push(p)}),i}var Zh=class t{constructor(t,e,n){this.anchor=t,this.head=e,this.depth=null!=n?n:0}map(e){return new t(e.map(this.anchor),e.map(this.head),this.depth)}resolve(t){return new Qh(t.resolve(this.anchor),t.resolve(this.head),this.depth)}},Qh=class t extends se{constructor(t,e,n,r=1){const{doc:i}=t,o=t===e,s=t.pos===i.content.size&&e.pos===i.content.size,l=o&&!s?i.resolve(e.pos+(r>0?1:-1)):e,c=o&&s?i.resolve(t.pos-(r>0?1:-1)):t,a=Yh(c.min(l),c.max(l),n);super(l.pos>=t.pos?a[0].$from:a[a.length-1].$to,l.pos>=t.pos?a[a.length-1].$to:a[0].$from,a),this.depth=n}get $to(){return this.ranges[this.ranges.length-1].$to}eq(e){return e instanceof t&&e.$from.pos===this.$from.pos&&e.$to.pos===this.$to.pos}map(e,n){const r=e.resolve(n.map(this.anchor)),i=e.resolve(n.map(this.head));return new t(r,i,this.depth)}toJSON(){return{type:"nodeRange",anchor:this.anchor,head:this.head,depth:this.depth}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){const{doc:e}=this.$from;if(this.isForwards&&this.ranges.length>1){const e=this.ranges.slice(0,-1),n=e[0].$from,r=e[e.length-1].$to;return new t(n,r,this.depth)}const n=this.ranges[0],r=e.resolve(Math.max(0,n.$from.pos-1));return new t(this.$anchor,r,this.depth)}extendForwards(){const{doc:e}=this.$from;if(this.isBackwards&&this.ranges.length>1){const e=this.ranges.slice(1),n=e[0].$from,r=e[e.length-1].$to;return new t(r,n,this.depth)}const n=this.ranges[this.ranges.length-1],r=e.resolve(Math.min(e.content.size,n.$to.pos+1));return new t(this.$anchor,r,this.depth)}static fromJSON(e,n){return new t(e.resolve(n.anchor),e.resolve(n.head),n.depth)}static create(t,e,n,r,i=1){return new this(t.resolve(e),t.resolve(n),r,i)}getBookmark(){return new Zh(this.anchor,this.head,this.depth)}};Qh.prototype.visible=!1;try{se.jsonID("nodeRange",Qh)}catch{}function td(t){return t instanceof Qh}qt.create({name:"nodeRange",addOptions:()=>({depth:void 0,key:"Mod"}),addKeyboardShortcuts(){return{"Shift-ArrowUp":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:i,selection:o,tr:s}=r,{anchor:l,head:c}=o;if(!td(o)){const t=Qh.create(i,l,c,e,-1);return s.setSelection(t),n.dispatch(s),!0}const a=o.extendBackwards();return s.setSelection(a),n.dispatch(s),!0},"Shift-ArrowDown":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:i,selection:o,tr:s}=r,{anchor:l,head:c}=o;if(!td(o)){const t=Qh.create(i,l,c,e);return s.setSelection(t),n.dispatch(s),!0}const a=o.extendForwards();return s.setSelection(a),n.dispatch(s),!0},"Mod-a":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:i,tr:o}=r,s=Qh.create(i,0,i.content.size,e);return o.setSelection(s),n.dispatch(o),!0}}},onSelectionUpdate(){const{selection:t}=this.editor.state;td(t)&&this.editor.view.dom.classList.add("ProseMirror-noderangeselection")},addProseMirrorPlugins(){let t=!1,e=!1;return[new ie({key:new oe("nodeRange"),props:{attributes:()=>t?{class:"ProseMirror-noderangeselection"}:{class:""},handleDOMEvents:{mousedown:(t,n)=>{const{key:r}=this.options,i=/Mac/.test(navigator.platform),o=!!n.shiftKey,s=!!n.ctrlKey,l=!!n.altKey,c=!!n.metaKey;return(null==r||"Shift"===r&&o||"Control"===r&&s||"Alt"===r&&l||"Meta"===r&&c||"Mod"===r&&(i?c:s))&&(e=!0),!!e&&(document.addEventListener("mouseup",()=>{e=!1;const{state:n}=t,{doc:r,selection:i,tr:o}=n,{$anchor:s,$head:l}=i;if(s.sameParent(l))return;const c=Qh.create(r,s.pos,l.pos,this.options.depth);o.setSelection(c),t.dispatch(o)},{once:!0}),!1)}},decorations:n=>{const{selection:r}=n,i=td(r);if(t=!1,!e)return i?(t=!0,Xh(r.ranges)):null;const{$from:o,$to:s}=r;if(!i&&o.sameParent(s))return null;const l=Yh(o,s,this.options.depth);return l.length?(t=!0,Xh(l)):null}}})]}});function ed(t,e){const n=t.cloneNode(!0),r=[t,...Array.from(t.getElementsByTagName("*"))],i=[n,...Array.from(n.getElementsByTagName("*"))];return r.forEach((t,n)=>{i[n].style.cssText=function(t,e){const n=getComputedStyle(t);if(e)return e.map(t=>t.trim()).filter(t=>t.length>0).map(t=>`${t}:${n.getPropertyValue(t)};`).join("");let r="";for(let i=0;i<n.length;i+=1)r+=`${n[i]}:${n.getPropertyValue(n[i])};`;return r}(t,e)}),n}var nd=[{id:"listItemFirstChild",evaluate:({parent:t,isFirst:e})=>e&&t&&["listItem","taskItem"].includes(t.type.name)?1e3:0},{id:"listWrapperDeprioritize",evaluate:({node:t})=>{const e=t.firstChild;return e&&["listItem","taskItem"].includes(e.type.name)?1e3:0}},{id:"tableStructure",evaluate:({node:t,parent:e})=>["tableRow","tableCell","tableHeader"].includes(t.type.name)||e&&"tableHeader"===e.type.name?1e3:0},{id:"inlineContent",evaluate:({node:t})=>t.isInline||t.isText?1e3:0}],rd={edges:["left","top"],threshold:12,strength:500};function id(t){return void 0===t||"left"===t?{...rd}:"right"===t?{edges:["right","top"],threshold:12,strength:500}:"both"===t?{edges:["left","right","top"],threshold:12,strength:500}:"none"===t?{edges:[],threshold:0,strength:0}:{...rd,...t}}function od(t,e,n,r){let i=1e3,o=!1;if(e.every(e=>{const n=e.evaluate(t);return i-=n,!(i<=0)||(o=!0,!1)}),o)return-1;const s=t.view.nodeDOM(t.pos);return i-=function(t,e,n,r){return e&&0!==n.edges.length&&function(t,e,n){if(0===n.edges.length)return!1;const r=e.getBoundingClientRect(),{threshold:i,edges:o}=n;return o.some(e=>"left"===e?t.x-r.left<i:"right"===e?r.right-t.x<i:"top"===e?t.y-r.top<i:"bottom"===e&&r.bottom-t.y<i)}(t,e,n)?n.strength*r:0}(r,s,n,t.depth),i<=0?-1:i}function sd(t,e,n){return Array.from({length:e},(t,n)=>e-1-n).some(e=>n.includes(t.node(e).type.name))}function ld(t){return Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&Number.isFinite(t.left)&&Number.isFinite(t.right)&&t.width>0&&t.height>0}function cd(t,e){let n="first"===e?t.firstElementChild:t.lastElementChild;for(;n;){const t=n.getBoundingClientRect();if(ld(t))return t;n="first"===e?n.nextElementSibling:n.previousElementSibling}return null}var ad=t=>{const{x:e,y:n,editor:r,nestedOptions:i}=t,{view:o,state:s}=r,l=function(t,e,n,r=5){if(!Number.isFinite(e)||!Number.isFinite(n))return null;const i=t.dom,o=cd(i,"first"),s=cd(i,"last");if(!o||!s)return null;const l=Math.min(Math.max(o.top+r,n),s.bottom-r),c=Math.abs(o.left-s.left)<.5,a=Math.abs(o.right-s.right)<.5;let h=o;c&&a&&(h=o);const d=Math.min(Math.max(h.left+r,e),h.right-r);return Number.isFinite(d)&&Number.isFinite(l)?{x:d,y:l}:null}(o,e,n,5);if(!l)return{resultElement:null,resultNode:null,pos:null};const{x:c,y:a}=l;if(null==i?void 0:i.enabled){const t=function(t,e,n){if(!Number.isFinite(e.x)||!Number.isFinite(e.y))return null;const r=t.posAtCoords({left:e.x,top:e.y});if(!r)return null;const{doc:i}=t.state,o=i.resolve(r.pos),s=[];n.defaultRules&&s.push(...nd),s.push(...n.rules);const l=Array.from({length:o.depth},(t,e)=>o.depth-e).map(r=>{const i=o.node(r),l=o.before(r);if(n.allowedContainers&&r>0&&!sd(o,r,n.allowedContainers))return null;const c=r>0?o.node(r-1):null,a=r>0?o.index(r-1):0,h=od({node:i,pos:l,depth:r,parent:c,index:a,isFirst:0===a,isLast:a===(c?c.childCount:1)-1,$pos:o,view:t},s,n.edgeDetection,e);return h<0?null:{node:i,pos:l,depth:r,score:h,dom:t.nodeDOM(l)}}).filter(t=>null!==t),c=o.nodeAfter;if(c&&c.isAtom&&!c.isInline){const i=r.pos,a=o.depth+1,h=o.parent,d=o.index(),u=h.childCount;let p=!0;if(n.allowedContainers&&(p=sd(o,a,n.allowedContainers)),p){const r=od({node:c,pos:i,depth:a,parent:h,index:d,isFirst:0===d,isLast:d===u-1,$pos:o,view:t},s,n.edgeDetection,e);if(r>=0){const e=t.nodeDOM(i);e&&l.push({node:c,pos:i,depth:a,score:r,dom:e})}}}if(0===l.length)return null;l.sort((t,e)=>e.score!==t.score?e.score-t.score:e.depth-t.depth);const a=l[0];return a.dom?{node:a.node,pos:a.pos,dom:a.dom}:null}(o,{x:c,y:a},i);return t?{resultElement:t.dom,resultNode:t.node,pos:t.pos}:{resultElement:null,resultNode:null,pos:null}}const h=o.root.elementsFromPoint(c,a);let d,u;if(Array.prototype.some.call(h,t=>{if(!o.dom.contains(t))return!1;const e=function(t,e){var n;let r=t;for(;(null==r?void 0:r.parentElement)&&r.parentElement!==e.dom;)r=r.parentElement;if((null==r?void 0:r.parentElement)===e.dom&&(null==(n=r.pmViewDesc)?void 0:n.node))return r}(t,o);return!!e&&(d=e,!0)}),!d){const t=o.posAtCoords({left:c,top:a});if(t){const e=s.doc.resolve(t.pos),n=Math.min(e.depth,1),r=n>0?e.before(n):e.pos,i=s.doc.nodeAt(r);if(i){const t=o.nodeDOM(r);return{resultElement:t instanceof HTMLElement?t:null,resultNode:i,pos:r}}}return{resultElement:null,resultNode:null,pos:null}}try{u=o.posAtDOM(d,0)}catch{return{resultElement:null,resultNode:null,pos:null}}const p=s.doc.nodeAt(u);if(!p){const t=s.doc.resolve(u),e=t.parent;return{resultElement:d,resultNode:e,pos:t.start()}}return{resultElement:d,resultNode:p,pos:u}};function hd(t,e){const n=t.nodeDOM(e);if(n instanceof Element&&n!==t.dom)return n;const{node:r,offset:i}=t.domAtPos(e),o=r.childNodes[i];return o instanceof Element?o:r instanceof Element?r:r.nodeType===Node.TEXT_NODE&&r.parentElement?r.parentElement:null}function dd(t){var e;null==(e=t.parentNode)||e.removeChild(t)}function ud(t,e,n,r,i){const{view:o}=e;if(!t.dataTransfer)return;const{empty:s,$from:l,$to:c}=o.state.selection,a=function(t,e,n,r){const{doc:i}=e.view.state;if((null==n?void 0:n.enabled)&&(null==r?void 0:r.node)&&r.pos>=0){const t=r.pos,e=r.pos+r.node.nodeSize;return[{$from:i.resolve(t),$to:i.resolve(e)}]}const o=ad({editor:e,x:t.clientX,y:t.clientY,direction:"right",nestedOptions:n});if(!o.resultNode||null===o.pos)return[];const s=o.resultNode.isText||o.resultNode.isAtom?0:-1;return Yh(i.resolve(o.pos),i.resolve(o.pos+o.resultNode.nodeSize+s),0,{extendOnBoundaryOverlap:!1})}(t,e,n,r),h=Yh(l,c,0,{extendOnBoundaryOverlap:!1}),d=h.some(t=>a.find(e=>e.$from===t.$from&&e.$to===t.$to)),u=s||!d?a:h;if(!u.length)return;const{tr:p}=o.state,f=document.createElement("div"),g=u[0].$from.pos,m=u[u.length-1].$to.pos,y=function(t,e){const n=hd(t,e);return(n?getComputedStyle(n).direction:getComputedStyle(t.dom).direction)||"ltr"}(o,g);f.setAttribute("dir",y);const w=(null==n?void 0:n.enabled)&&(null==r?void 0:r.node),x=1===u.length;let b,v;w&&x?(b=o.state.doc.slice(g,m),v=re.create(o.state.doc,g)):(v=Qh.create(o.state.doc,g,m),b=v.content());const k=function(t){return!t||!t.some(t=>{const e=t.trim().toLowerCase();return"margin"===e||e.startsWith("margin-")})}(i);u.forEach(t=>{const e=hd(o,t.$from.pos);if(!e)return;const n=ed(e,i);k&&(n.style.margin="0"),f.append(n)}),f.style.position="absolute",f.style.top="-10000px",document.body.append(f),t.dataTransfer.clearData();const S=function(t,e){return"rtl"===t?e:0}(y,f.getBoundingClientRect().width);t.dataTransfer.setDragImage(f,S,0);let C=!1;const _=()=>{C||(C=!0,dd(f),document.removeEventListener("drop",_),document.removeEventListener("dragend",_))},E=v instanceof re?v:void 0;o.dragging={slice:b,move:!0,node:E},p.setSelection(v),o.dispatch(p),document.addEventListener("drop",_),document.addEventListener("dragend",_)}var pd=(t,e)=>{const n=t.resolve(e),{depth:r}=n;return 0===r?e:n.pos-n.parentOffset-1},fd=(t,e)=>{const n=t.nodeAt(e),r=t.resolve(e);let{depth:i}=r,o=n;for(;i>0;){const t=r.node(i);i-=1,0===i&&(o=t)}return o};function gd(t,e,n){let r=0;for(let i=e;i<n;i+=1)r+=t.child(i).nodeSize;return r}function md(t,e,n,r){try{const i=function(t,e,n,r){const i=t.resolve(e),o=i.node(r);let s=i.index(r);s>=o.childCount&&(s=Math.max(0,o.childCount-n));const l=Math.min(n,o.childCount-s);if(l<=0)return null;const c=i.start(r)+gd(o,0,s);return{anchor:c,head:c+gd(o,s,s+l),count:l}}(t,e,n,r);if(!i)return null;const o=Qh.create(t,i.anchor,i.head,r);return o.ranges.length===n?o:null}catch{return null}}var yd=(t,e)=>{const n=rh.getState(t);return n?Lh(e,n.type,n.binding.mapping):null},wd=(t,e)=>{const n=rh.getState(t);return n?jh(n.doc,n.type,e,n.binding.mapping)||0:-1},xd=(t,e)=>{let n=e;for(;(null==n?void 0:n.parentNode)&&n.parentNode!==t.dom;)n=n.parentNode;return n},bd=new oe("dragHandle"),vd=({pluginKey:t=bd,element:e,editor:n,computePositionConfig:r,getReferencedVirtualElement:i,onNodeChange:o,onElementDragStart:s,onElementDragEnd:l,nestedOptions:c,dragImageProperties:h})=>{const d=document.createElement("div");let u,p=!1,f=null,g=-1,m=null,y=null,w=null,x=null;function b(){w=null,x=null}function v(t,e){x&&(x=function(t,e,n){if(!e.docChanged)return t;if(n.isChangeOrigin&&null!=t.relativeAnchorPos){const e=n.getAbsolutePos(t.relativeAnchorPos);return!Number.isFinite(e)||e<=0?null:{...t,anchorPos:e}}const r=e.mapping.mapResult(t.anchorPos,1);return r.deleted?null:{...t,anchorPos:r.pos}}(x,t,{isChangeOrigin:Wh(t),getAbsolutePos:t=>wd(e,t)}))}function k(){e&&(e.style.visibility="hidden",e.style.pointerEvents="none")}function S(t){const n=(null==i?void 0:i())||{getBoundingClientRect:()=>t.getBoundingClientRect()};a(n,e,r).then(t=>{Object.assign(e.style,{position:t.strategy,left:`${t.x}px`,top:`${t.y}px`})})}function C(t){var r,i;s?.(t),ud(t,n,c,{node:f,pos:g},h),r=n.state.selection,w=td(r)?{anchorPos:r.from,nodeCount:r.ranges.length,depth:null!=(i=r.depth)?i:0}:null,e&&(e.dataset.dragging="true"),setTimeout(()=>{e&&(e.style.pointerEvents="none")},0)}function _(t){l?.(t),w=null,k(),e&&(e.style.pointerEvents="auto",e.dataset.dragging="false")}function E(t){if(!t.target||!n.view.dom.contains(t.target))return;if(te()){const t=n.view.dom;requestAnimationFrame(()=>{t.isContentEditable&&(t.contentEditable="false",t.contentEditable="true")})}if(!w||n.view.state.selection.empty)return;const e=n.state.selection.from,r=yd(n.state,e);x={...w,anchorPos:e,relativeAnchorPos:null!=r?r:void 0},n.view.dispatch(n.state.tr.setMeta("addToHistory",!1))}function O(){e.removeEventListener("dragstart",C),e.removeEventListener("dragend",_),document.removeEventListener("drop",E),m&&(cancelAnimationFrame(m),m=null,y=null),b()}return d.appendChild(e),{unbind(){O()},plugin:new ie({key:"string"==typeof t?new oe(t):t,state:{init:()=>({locked:!1}),apply(t,r,i,s){v(t,s);const l=t.getMeta("lockDragHandle"),c=t.getMeta("hideDragHandle");if(void 0!==l&&(p=l),c)return k(),p=!1,f=null,g=-1,o?.({editor:n,node:null,pos:-1}),r;if(t.docChanged&&-1!==g&&e)if(Wh(t)){const t=wd(s,u);t!==g&&(g=t)}else{const e=t.mapping.map(g);e!==g&&(g=e,u=yd(s,g))}return r}},appendTransaction:(t,e,n)=>function(t){if(!x)return null;const e=md(t.doc,x.anchorPos,x.nodeCount,x.depth);return e?(b(),t.tr.setSelection(e)):(x=null,w=null,null)}(n),view:t=>{var r;return e.draggable=!0,e.style.pointerEvents="auto",e.dataset.dragging="false",null==(r=n.view.dom.parentElement)||r.appendChild(d),d.style.pointerEvents="none",d.style.position="absolute",d.style.top="0",d.style.left="0",d.style.zIndex="10",e.addEventListener("dragstart",C),e.addEventListener("dragend",_),document.addEventListener("drop",E),{update(r,i){if(!e)return;if(!n.isEditable)return void k();if(e.draggable=!p,t.state.doc.eq(i.doc)||-1===g)return;let s=t.nodeDOM(g);if(s=xd(t,s),s===t.dom)return;if(1!==(null==s?void 0:s.nodeType))return;const l=t.posAtDOM(s,0),c=fd(n.state.doc,l),a=pd(n.state.doc,l);f=c,g=a,u=yd(t.state,g),o?.({editor:n,node:f,pos:g}),S(s)},destroy(){O(),e&&dd(d)}}},props:{handleDOMEvents:{keydown:t=>!(!e||p)&&(!!t.hasFocus()&&(k(),f=null,g=-1,o?.({editor:n,node:null,pos:-1}),!1)),mouseleave:(t,e)=>(p||e.target&&!d.contains(e.relatedTarget)&&(k(),f=null,g=-1,o?.({editor:n,node:null,pos:-1})),!1),mousemove:(t,r)=>!(!e||p)&&(y={x:r.clientX,y:r.clientY},m||(m=requestAnimationFrame(()=>{if(m=null,!y)return;const{x:r,y:i}=y;y=null;const s=ad({x:r,y:i,direction:"right",editor:n,nestedOptions:c});if(!s.resultElement)return;let l=s.resultElement,a=s.resultNode,h=s.pos;if(!(null==c?void 0:c.enabled)){if(l=xd(t,l),l===t.dom)return;if(1!==(null==l?void 0:l.nodeType))return;const e=t.posAtDOM(l,0);a=fd(n.state.doc,e),h=pd(n.state.doc,e)}a!==f&&(f=a,g=null!=h?h:-1,u=yd(t.state,g),o?.({editor:n,node:f,pos:g}),S(l),e&&(n.isEditable?(e.style.visibility="",e.style.pointerEvents="auto"):k()))})),!1)}}})}};function kd(t){var e,n;return!1===t||void 0===t?{enabled:!1,rules:[],defaultRules:!0,allowedContainers:void 0,edgeDetection:id("none")}:!0===t?{enabled:!0,rules:[],defaultRules:!0,allowedContainers:void 0,edgeDetection:id("left")}:{enabled:!0,rules:null!=(e=t.rules)?e:[],defaultRules:null==(n=t.defaultRules)||n,allowedContainers:t.allowedContainers,edgeDetection:id(t.edgeDetection)}}var Sd={placement:"left-start",strategy:"absolute"},Cd=(qt.create({name:"dragHandle",addOptions:()=>({render(){const t=document.createElement("div");return t.classList.add("drag-handle"),t},computePositionConfig:{},locked:!1,onNodeChange:()=>null,onElementDragStart:void 0,onElementDragEnd:void 0,nested:!1,dragImageProperties:void 0}),addCommands(){return{lockDragHandle:()=>({editor:t})=>(this.options.locked=!0,t.commands.setMeta("lockDragHandle",this.options.locked)),unlockDragHandle:()=>({editor:t})=>(this.options.locked=!1,t.commands.setMeta("lockDragHandle",this.options.locked)),toggleDragHandle:()=>({editor:t})=>(this.options.locked=!this.options.locked,t.commands.setMeta("lockDragHandle",this.options.locked))}},addProseMirrorPlugins(){const t=this.options.render(),e=kd(this.options.nested);return[vd({computePositionConfig:{...Sd,...this.options.computePositionConfig},getReferencedVirtualElement:this.options.getReferencedVirtualElement,element:t,editor:this.editor,onNodeChange:this.options.onNodeChange,onElementDragStart:this.options.onElementDragStart,onElementDragEnd:this.options.onElementDragEnd,nestedOptions:e,dragImageProperties:this.options.dragImageProperties}).plugin]}}),t=>{const{className:e="drag-handle",children:n,editor:r,pluginKey:i=bd,onNodeChange:o,onElementDragStart:s,onElementDragEnd:l,getReferencedVirtualElement:c,computePositionConfig:a=Sd,nested:h=!1}=t,d=Lt(null);null===d.current&&"undefined"!=typeof document&&(d.current=document.createElement("div"));const u=Pt(()=>kd(h),[JSON.stringify(h)]);zt(()=>{const t=d.current;t&&(t.className=e)},[e]),zt(()=>{if("undefined"==typeof document)return;if(r.isDestroyed)return;const t=d.current;if(!t)return;t.style.visibility="hidden",t.style.position="absolute",t.dataset.dragging="false";const{plugin:e,unbind:n}=vd({editor:r,element:t,pluginKey:i,computePositionConfig:{...Sd,...a},onElementDragStart:s,onElementDragEnd:l,onNodeChange:o,getReferencedVirtualElement:c,nestedOptions:u});return r.registerPlugin(e),()=>{r.isDestroyed||r.unregisterPlugin(i),n()}},[r,o,c,i,a,s,l,u]);const p=d.current;return p?Kt(n,p):null});function _d(){const e=W(),n=K(),{t:i}=r(),[s,l]=$t(null),[c,a]=$t(-1),[h,d]=$t(!1),u=e?.extensionManager?.extensions?.some(t=>t?.name===at.name),p=e?.extensionManager?.extensions?.some(t=>t?.name===lt.name),f=e?.extensionManager?.extensions?.some(t=>t?.name===Z.name);function g(t){e.commands.setTextAlign(t)}const m=Rt(t=>{t.node&&l(t.node),a(t.pos),requestAnimationFrame(()=>{t.editor.commands.focus()})},[]);zt(()=>(h?e.commands.setMeta("lockDragHandle",!0):e.commands.setMeta("lockDragHandle",!1),()=>{e.commands.setMeta("lockDragHandle",!1)}),[h]);const y=t=>{n&&d(t)};/* @__PURE__ */
69
+ return Ht(Cd,{className:"richtext-transition-all richtext-duration-200 richtext-ease-out",editor:e,onNodeChange:m,pluginKey:"RichTextBubbleMenuDragHandle",children:/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-items-center richtext-gap-0.5",children:[/* @__PURE__ */Ht(t,{disabled:!n,icon:"Grip",tooltip:i("editor.draghandle.grip"),action:t=>{t.preventDefault(),t.stopPropagation(),y(!h)}}),/* @__PURE__ */Bt(D,{onOpenChange:y,open:h,children:[/* @__PURE__ */Ht(S,{className:"richtext-pointer-events-none"}),/* @__PURE__ */Bt(O,{align:"start",className:"richtext-w-48",hideWhenDetached:!0,side:"bottom",sideOffset:0,children:[
70
+ /* @__PURE__ */Bt(C,{className:"richtext-flex richtext-gap-3 richtext-bg-opacity-10 hover:richtext-bg-red-400 hover:richtext-bg-opacity-20 focus:richtext-bg-red-400 focus:richtext-bg-opacity-30 focus:richtext-text-red-500 dark:hover:richtext-bg-opacity-20 dark:hover:richtext-text-red-500",onClick:function(){e.chain().setMeta("hideDragHandle",!0).setNodeSelection(c).deleteSelection().run()},children:[/* @__PURE__ */Ht(o,{name:"Trash2"}),/* @__PURE__ */Ht("span",{children:i("editor.remove")})]}),f?/* @__PURE__ */Bt(C,{className:"richtext-flex richtext-gap-3",onClick:function(){const t=e.chain();t.setNodeSelection(c).unsetAllMarks(),"paragraph"!==s?.type.name&&t.setParagraph(),t.run()},children:[/* @__PURE__ */Ht(o,{name:"PaintRoller"}),/* @__PURE__ */Ht("span",{children:i("editor.clear.tooltip")})]}):null,
71
+ /* @__PURE__ */Bt(C,{className:"richtext-flex richtext-gap-3",onClick:function(){e.commands.setNodeSelection(c);const{$anchor:t}=e.state.selection,n=t.node(1)||e.state.selection.node;e.chain().setMeta("hideDragHandle",!0).insertContentAt(c+(s?.nodeSize||0),n.toJSON()).run()},children:[/* @__PURE__ */Ht(o,{name:"Copy"}),/* @__PURE__ */Ht("span",{children:i("editor.copy")})]}),u||p?/* @__PURE__ */Ht(A,{}):null,u?/* @__PURE__ */Bt(_,{children:[/* @__PURE__ */Bt(k,{className:"richtext-flex richtext-gap-3",children:[/* @__PURE__ */Ht(o,{name:"AlignCenter"}),/* @__PURE__ */Ht("span",{children:i("editor.textalign.tooltip")})]}),/* @__PURE__ */Ht(E,{children:/* @__PURE__ */Bt(T,{children:[
72
+ /* @__PURE__ */Bt(C,{className:"richtext-flex richtext-gap-3",onClick:()=>g("left"),children:[/* @__PURE__ */Ht(o,{name:"AlignLeft"}),/* @__PURE__ */Ht("span",{children:i("editor.textalign.left.tooltip")})]}),
73
+ /* @__PURE__ */Bt(C,{className:"richtext-flex richtext-gap-3",onClick:()=>g("center"),children:[/* @__PURE__ */Ht(o,{name:"AlignCenter"}),/* @__PURE__ */Ht("span",{children:i("editor.textalign.center.tooltip")})]}),
74
+ /* @__PURE__ */Bt(C,{className:"richtext-flex richtext-gap-3",onClick:()=>g("right"),children:[/* @__PURE__ */Ht(o,{name:"AlignRight"}),/* @__PURE__ */Ht("span",{children:i("editor.textalign.right.tooltip")})]})]})})]}):null,p?/* @__PURE__ */Bt(_,{children:[/* @__PURE__ */Bt(k,{className:"richtext-flex richtext-gap-3",children:[/* @__PURE__ */Ht(o,{name:"IndentIncrease"}),/* @__PURE__ */Ht("span",{children:i("editor.indent")})]}),/* @__PURE__ */Ht(E,{children:/* @__PURE__ */Bt(T,{children:[/* @__PURE__ */Bt(C,{className:"richtext-flex richtext-gap-3",disabled:s?.attrs?.indent>=st.max,onClick:function(){const t=ot(e.state.tr,c,1);t.setMeta("hideDragHandle",!0),e.view.dispatch&&e.view.dispatch(t)},children:[/* @__PURE__ */Ht(o,{name:"IndentIncrease"}),/* @__PURE__ */Ht("span",{children:i("editor.indent.tooltip")})]}),/* @__PURE__ */Bt(C,{className:"richtext-flex richtext-gap-3",disabled:s?.attrs?.indent<=st.min,onClick:function(){const t=ot(e.state.tr,c,-1);e.view.dispatch&&e.view.dispatch(t)},children:[/* @__PURE__ */Ht(o,{name:"IndentDecrease"}),/* @__PURE__ */Ht("span",{children:i("editor.outdent.tooltip")})]})]})})]}):null]})]})]})})}var Ed={plaintext:"Plain Text",js:"JavaScript",ts:"TypeScript",css:"CSS",html:"HTML",python:"Python",bash:"Bash"};function Od({listLanguages:e}){const{t:n}=r(),[i,s]=$t(!1),l=W(),c=Pt(()=>{const{selection:t}=l.state,e=t.$from.parent;if("codeBlock"===e.type.name){const t=e.attrs.language||"plaintext";return Ed[t]||t}},[l.state,e]),a=Pt(()=>{let t=e||[];return e?.includes("plaintext")||(t=["plaintext",...t]),t.map(t=>({label:Ed[t]||t,value:t}))},[e]);/* @__PURE__ */
75
+ return Bt(z,{modal:!0,onOpenChange:s,open:i,children:[/* @__PURE__ */Ht(R,{asChild:!0,className:"hover:richtext-bg-accent data-[state=on]:richtext-bg-accent",children:/* @__PURE__ */Bt(t,{dataState:!!c,children:[/* @__PURE__ */Ht(jt,c?{children:c}:{children:n("editor.paragraph.tooltip")}),/* @__PURE__ */Ht(o,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})]})}),/* @__PURE__ */Ht(M,{align:"start",className:"!richtext-w-[initial] !richtext-p-[4px]",hideWhenDetached:!0,side:"bottom",children:a?.map(t=>/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-w-full richtext-items-center richtext-gap-3 richtext-rounded-sm !richtext-border-none !richtext-bg-transparent richtext-px-2 richtext-py-1.5 richtext-text-left richtext-text-sm richtext-text-foreground !richtext-outline-none richtext-transition-colors hover:!richtext-bg-accent",onClick:e=>{e.preventDefault(),l.chain().focus().setCodeBlock({language:t.value}).run(),s(!1)},children:[/* @__PURE__ */Ht("div",{className:"!richtext-min-w-[20px]",children:c===t.value&&/* @__PURE__ */Ht(Ft,{size:16})}),/* @__PURE__ */Ht("div",{className:"richtext-flex richtext-items-center richtext-gap-1",children:t.label})]},t.value))})]})}function Ad(){const n=K(),r=W(),i=q(Y.name),o=Rt(({editor:t})=>t.isActive(Y.name),[]),s=Pt(()=>i?i.options?.lowlight?.listLanguages?.()||["plaintext","html","css","js","ts"]:[],[i]),l=Rt(()=>Le(Y.name,r),[r]);return n?/* @__PURE__ */Ht(Pe,{editor:r,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleCodeBlock",shouldShow:o,getReferencedVirtualElement:()=>{const{from:t}=r.state.selection,e=r.view.domAtPos(t).node.parentElement;return e?{getBoundingClientRect:()=>e.getBoundingClientRect()}:null},children:/* @__PURE__ */Bt("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[
76
+ /* @__PURE__ */Ht(Od,{listLanguages:s}),
77
+ /* @__PURE__ */Ht(e,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),
78
+ /* @__PURE__ */Ht(t,{action:()=>{const t=(()=>{const{from:t}=r.state.selection,e=r.state.doc.resolve(t);for(let n=e.depth;n>=0;n--){const t=e.node(n);if("codeBlock"===t.type.name)return t.textContent}return""})();navigator.clipboard.writeText(t)},tooltip:"Copy",children:/* @__PURE__ */Ht(Vt,{size:16})}),
79
+ /* @__PURE__ */Ht(e,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),
80
+ /* @__PURE__ */Ht(t,{action:l,tooltip:"Delete",children:/* @__PURE__ */Ht(Wt,{size:16})})]})}):/* @__PURE__ */Ht(jt,{})}export{yn as a,dn as c,sn as d,rn as f,je as g,He as h,bn as i,un as l,Qe as m,_d as n,mn as o,nn as p,vn as r,hn as s,Ad as t,cn as u};