reactjs-tiptap-editor 1.0.25 → 1.0.26

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 (289) hide show
  1. package/lib/{ActionMenuButton-8cTG45Ft.js → ActionMenuButton-B4KDkZ0z.js} +1 -1
  2. package/lib/{ActionMenuButton-CXeFhner.cjs → ActionMenuButton-C3Cfeza9.cjs} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +25 -25
  5. package/lib/Blockquote.cjs +5 -5
  6. package/lib/Blockquote.js +1490 -53
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +3 -3
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -2
  11. package/lib/Callout.cjs +1 -1
  12. package/lib/Callout.js +222 -8
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +2 -2
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +56 -39
  17. package/lib/CodeBlock.cjs +1 -1
  18. package/lib/CodeBlock.js +8 -4
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +2 -2
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +3 -3
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +2 -2
  25. package/lib/{Drawer-TJY4NuHx.cjs → Drawer-D7E9kTca.cjs} +1 -1
  26. package/lib/{Drawer-C-EO1uoK.js → Drawer-DA0FLHs9.js} +20 -20
  27. package/lib/Drawer.cjs +1 -1
  28. package/lib/Drawer.js +4 -4
  29. package/lib/Emoji.cjs +1 -1
  30. package/lib/Emoji.js +1644 -148
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +10 -10
  33. package/lib/ExportPdf.cjs +1 -1
  34. package/lib/ExportPdf.js +2 -2
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +2 -2
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +5 -5
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +5 -5
  41. package/lib/FormatPainter.cjs +1 -0
  42. package/lib/FormatPainter.js +133 -0
  43. package/lib/Heading.cjs +1 -1
  44. package/lib/Heading.js +10 -6
  45. package/lib/Highlight.cjs +1 -1
  46. package/lib/Highlight.js +3 -3
  47. package/lib/History.cjs +7 -1
  48. package/lib/History.js +519 -478
  49. package/lib/HorizontalRule.cjs +1 -1
  50. package/lib/HorizontalRule.js +2 -2
  51. package/lib/{Iframe-CGb6-2LD.js → Iframe-DZ3r3QzK.js} +7 -7
  52. package/lib/{Iframe-5zx43DL4.cjs → Iframe-OMVd0xa_.cjs} +1 -1
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +3 -3
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +6 -6
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +35 -35
  59. package/lib/ImportWord.cjs +1 -1
  60. package/lib/ImportWord.js +15 -15
  61. package/lib/{Indent-DuwV8s1t.cjs → Indent-QgCoonRk.cjs} +1 -1
  62. package/lib/{Indent-CdMYsDNS.js → Indent-kI4G-clX.js} +2 -2
  63. package/lib/Indent.cjs +1 -1
  64. package/lib/Indent.js +2 -2
  65. package/lib/Italic.cjs +1 -1
  66. package/lib/Italic.js +2 -2
  67. package/lib/{Katex-CCP_ZQz2.js → Katex-BPbXjcZQ.js} +6 -7
  68. package/lib/Katex-CUofhjB5.cjs +4 -0
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +3 -3
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +4 -4
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +2 -2
  75. package/lib/{LinkEditBlock-B1m-TVMu.js → LinkEditBlock-BYWwH2_x.js} +59 -32
  76. package/lib/{LinkEditBlock-DQ8-iufJ.cjs → LinkEditBlock-Z7RRurvx.cjs} +2 -2
  77. package/lib/MarkdownPaste.cjs +1 -1
  78. package/lib/MarkdownPaste.js +1 -1
  79. package/lib/Mention.cjs +1 -1
  80. package/lib/Mention.js +9 -5
  81. package/lib/Mermaid.cjs +2 -2
  82. package/lib/Mermaid.js +61 -62
  83. package/lib/MoreMark.cjs +1 -1
  84. package/lib/MoreMark.js +5 -5
  85. package/lib/OrderedList.cjs +1 -1
  86. package/lib/OrderedList.js +2 -2
  87. package/lib/SearchAndReplace.cjs +1 -1
  88. package/lib/SearchAndReplace.js +14 -14
  89. package/lib/SlashCommand.cjs +1 -1
  90. package/lib/SlashCommand.js +7 -7
  91. package/lib/{SlashCommandNodeView-Dt6n1SP9.js → SlashCommandNodeView-C0l3Fb_3.js} +10 -10
  92. package/lib/{SlashCommandNodeView-DNixmQGa.cjs → SlashCommandNodeView-DPPmYEjC.cjs} +1 -1
  93. package/lib/Strike.cjs +1 -1
  94. package/lib/Strike.js +2 -2
  95. package/lib/{Table-C5JxBXef.cjs → Table-D5G3rfwb.cjs} +5 -5
  96. package/lib/{Table-DdEgaUwa.js → Table-DwseaFSD.js} +115 -97
  97. package/lib/Table.cjs +1 -1
  98. package/lib/Table.js +1 -1
  99. package/lib/TaskList.cjs +1 -1
  100. package/lib/TaskList.js +2 -2
  101. package/lib/TextAlign.cjs +1 -1
  102. package/lib/TextAlign.js +11 -11
  103. package/lib/TextDirection.cjs +1 -1
  104. package/lib/TextDirection.js +3 -3
  105. package/lib/TextUnderline.cjs +1 -1
  106. package/lib/TextUnderline.js +2 -2
  107. package/lib/{Twitter-Dnz9qyW0.js → Twitter-DP26Lkn8.js} +195 -195
  108. package/lib/Twitter-q4ZGZL0i.cjs +1 -0
  109. package/lib/Twitter.cjs +1 -1
  110. package/lib/Twitter.js +3 -3
  111. package/lib/Video.cjs +1 -1
  112. package/lib/Video.js +5 -5
  113. package/lib/bubble.cjs +6 -6
  114. package/lib/bubble.js +2783 -2137
  115. package/lib/{clsx-D6gYQn3o.cjs → clsx-DRbkQ4T7.cjs} +1 -1
  116. package/lib/{clsx-0OU6n9va.js → clsx-_bq4MQQ7.js} +14 -4
  117. package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -1
  118. package/lib/components/Bubble/RichTextBubbleCodeBlock.d.ts +1 -1
  119. package/lib/components/Bubble/RichTextBubbleColumns.d.ts +1 -1
  120. package/lib/components/Bubble/RichTextBubbleDrawer.d.ts +1 -1
  121. package/lib/components/Bubble/RichTextBubbleExcalidraw.d.ts +1 -1
  122. package/lib/components/Bubble/RichTextBubbleIframe.d.ts +1 -1
  123. package/lib/components/Bubble/RichTextBubbleKatex.d.ts +2 -1
  124. package/lib/components/Bubble/RichTextBubbleLink.d.ts +1 -1
  125. package/lib/components/Bubble/RichTextBubbleMedia.d.ts +3 -3
  126. package/lib/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +2 -1
  127. package/lib/components/Bubble/RichTextBubbleMermaid.d.ts +1 -1
  128. package/lib/components/Bubble/RichTextBubbleTable.d.ts +1 -1
  129. package/lib/components/Bubble/RichTextBubbleText.d.ts +1 -1
  130. package/lib/components/Bubble/RichTextBubbleTwitter.d.ts +1 -1
  131. package/lib/components/ColorPicker.d.ts +1 -1
  132. package/lib/components/ReactBus.d.ts +1 -1
  133. package/lib/components/RichTextProvider.d.ts +1 -1
  134. package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -1
  135. package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -1
  136. package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +2 -1
  137. package/lib/components/icons/Activity.d.ts +2 -1
  138. package/lib/components/icons/Animas.d.ts +2 -1
  139. package/lib/components/icons/AspectRatio.d.ts +1 -1
  140. package/lib/components/icons/Blockquote.d.ts +1 -1
  141. package/lib/components/icons/CodeView.d.ts +1 -1
  142. package/lib/components/icons/ColumnAddLeft.d.ts +1 -1
  143. package/lib/components/icons/ColumnAddRight.d.ts +1 -1
  144. package/lib/components/icons/DeleteColumn.d.ts +1 -1
  145. package/lib/components/icons/DeleteRow.d.ts +1 -1
  146. package/lib/components/icons/Direction.d.ts +1 -1
  147. package/lib/components/icons/Excalidraw.d.ts +1 -1
  148. package/lib/components/icons/ExportPdf.d.ts +1 -1
  149. package/lib/components/icons/ExportWord.d.ts +2 -1
  150. package/lib/components/icons/FileWordOutline.d.ts +1 -1
  151. package/lib/components/icons/Flag.d.ts +2 -1
  152. package/lib/components/icons/Food.d.ts +2 -1
  153. package/lib/components/icons/GIfIcon.d.ts +1 -1
  154. package/lib/components/icons/Html.d.ts +1 -1
  155. package/lib/components/icons/Icon.d.ts +1 -1
  156. package/lib/components/icons/IconColorFill.d.ts +1 -1
  157. package/lib/components/icons/IconHighlightFill.d.ts +1 -1
  158. package/lib/components/icons/ImportWord.d.ts +2 -1
  159. package/lib/components/icons/LeftToRight.d.ts +1 -1
  160. package/lib/components/icons/LineHeight.d.ts +1 -1
  161. package/lib/components/icons/MenuDown.d.ts +1 -1
  162. package/lib/components/icons/Mermaid.d.ts +1 -1
  163. package/lib/components/icons/NoFill.d.ts +1 -1
  164. package/lib/components/icons/Object.d.ts +2 -1
  165. package/lib/components/icons/RightToLeft.d.ts +1 -1
  166. package/lib/components/icons/SizeL.d.ts +1 -1
  167. package/lib/components/icons/SizeM.d.ts +1 -1
  168. package/lib/components/icons/SizeS.d.ts +1 -1
  169. package/lib/components/icons/Symbol.d.ts +2 -1
  170. package/lib/components/icons/Travel.d.ts +2 -1
  171. package/lib/components/icons/Twitter.d.ts +1 -1
  172. package/lib/components/ui/dialog.d.ts +2 -2
  173. package/lib/components/ui/dropdown-menu.d.ts +1 -1
  174. package/lib/components/ui/emoji-picker.d.ts +4 -4
  175. package/lib/components/ui/toaster.d.ts +1 -1
  176. package/lib/{dropdown-menu-ROihzXsP.js → dropdown-menu-BKSX4gvT.js} +1 -1
  177. package/lib/{dropdown-menu-yQ-sQ1k4.cjs → dropdown-menu-CURWpB9o.cjs} +1 -1
  178. package/lib/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +1 -1
  179. package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -1
  180. package/lib/extensions/Attachment/components/RichTextAttachment.d.ts +1 -1
  181. package/lib/extensions/Blockquote/components/RichTextBlockquote.d.ts +1 -1
  182. package/lib/extensions/Bold/components/RichTextBold.d.ts +1 -1
  183. package/lib/extensions/BulletList/components/RichTextBulletList.d.ts +1 -1
  184. package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -1
  185. package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -1
  186. package/lib/extensions/Clear/components/RichTextClear.d.ts +1 -1
  187. package/lib/extensions/Code/components/RichTextCode.d.ts +1 -1
  188. package/lib/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +2 -1
  189. package/lib/extensions/CodeView/components/RichTextCodeView.d.ts +1 -1
  190. package/lib/extensions/Color/components/RichTextColor.d.ts +1 -1
  191. package/lib/extensions/Column/components/RichTextColumn.d.ts +1 -1
  192. package/lib/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +2 -1
  193. package/lib/extensions/Drawer/components/ControlDrawer/icon.d.ts +27 -27
  194. package/lib/extensions/Drawer/components/EditDrawerBlock.d.ts +1 -1
  195. package/lib/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +2 -1
  196. package/lib/extensions/Drawer/components/RichTextDrawer.d.ts +1 -1
  197. package/lib/extensions/Emoji/components/RichTextEmoji.d.ts +2 -1
  198. package/lib/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.d.ts +2 -1
  199. package/lib/extensions/Excalidraw/components/RichTextExcalidraw.d.ts +1 -1
  200. package/lib/extensions/ExportPdf/components/RichTextExportPdf.d.ts +1 -1
  201. package/lib/extensions/ExportWord/components/RichTextExportWord.d.ts +1 -1
  202. package/lib/extensions/FontFamily/components/RichTextFontFamily.d.ts +1 -1
  203. package/lib/extensions/FontSize/components/RichTextFontSize.d.ts +1 -1
  204. package/lib/extensions/FormatPainter/FormatPainter.d.ts +17 -0
  205. package/lib/extensions/FormatPainter/components/RichTextFormatPainter.d.ts +1 -0
  206. package/lib/extensions/FormatPainter/index.d.ts +1 -0
  207. package/lib/extensions/Heading/components/RichTextHeading.d.ts +1 -1
  208. package/lib/extensions/Highlight/components/RichTextHighlight.d.ts +2 -1
  209. package/lib/extensions/History/components/RichTextHistory.d.ts +3 -2
  210. package/lib/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +1 -1
  211. package/lib/extensions/Iframe/components/IframeNodeView.d.ts +1 -1
  212. package/lib/extensions/Iframe/components/RichTextIframe.d.ts +1 -1
  213. package/lib/extensions/Image/components/ImageCropper.d.ts +2 -1
  214. package/lib/extensions/Image/components/ImageView.d.ts +2 -1
  215. package/lib/extensions/Image/components/RichTextImage.d.ts +1 -1
  216. package/lib/extensions/ImageGif/components/ImageGifView.d.ts +2 -1
  217. package/lib/extensions/ImageGif/components/RichTextImageGif.d.ts +2 -1
  218. package/lib/extensions/ImportWord/components/RichTextImportWord.d.ts +1 -1
  219. package/lib/extensions/Indent/components/RichTextIndent.d.ts +1 -1
  220. package/lib/extensions/Italic/components/RichTextItalic.d.ts +1 -1
  221. package/lib/extensions/Katex/components/KatexWrapper.d.ts +1 -1
  222. package/lib/extensions/Katex/components/RichTextKatex.d.ts +1 -1
  223. package/lib/extensions/LineHeight/components/RichTextLightHeight.d.ts +1 -1
  224. package/lib/extensions/Link/components/LinkEditBlock.d.ts +1 -1
  225. package/lib/extensions/Link/components/LinkViewBlock.d.ts +2 -1
  226. package/lib/extensions/Link/components/RichTextLink.d.ts +1 -1
  227. package/lib/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +2 -1
  228. package/lib/extensions/Mermaid/components/RichTextMermaid.d.ts +1 -1
  229. package/lib/extensions/MoreMark/components/RichTextMoreMark.d.ts +1 -1
  230. package/lib/extensions/OrderedList/components/RichTextOrderedList.d.ts +1 -1
  231. package/lib/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +1 -1
  232. package/lib/extensions/SlashCommand/components/SlashCommandList.d.ts +1 -1
  233. package/lib/extensions/Strike/components/RichTextStrike.d.ts +1 -1
  234. package/lib/extensions/Table/components/CreateTablePopover.d.ts +2 -1
  235. package/lib/extensions/Table/components/RichTextTable.d.ts +2 -1
  236. package/lib/extensions/TaskList/components/RichTextTaskList.d.ts +1 -1
  237. package/lib/extensions/TextAlign/components/RichTextAlign.d.ts +1 -1
  238. package/lib/extensions/TextDirection/components/RichTextTextDirection.d.ts +1 -1
  239. package/lib/extensions/TextUnderline/components/RichTextUnderline.d.ts +1 -1
  240. package/lib/extensions/Twitter/components/FormEditLinkTwitter.d.ts +1 -1
  241. package/lib/extensions/Twitter/components/NodeViewTweet.d.ts +1 -1
  242. package/lib/extensions/Twitter/components/RichTextTwitter.d.ts +1 -1
  243. package/lib/extensions/Video/components/RichTextVideo.d.ts +1 -1
  244. package/lib/index-BGfIcDCQ.cjs +26 -0
  245. package/lib/index-BaR0Brts.js +1115 -0
  246. package/lib/index-BgNKVyMW.cjs +2 -0
  247. package/lib/index-BpLw6ebr.cjs +1 -0
  248. package/lib/{index-X6WZUM9O.js → index-C52cuQ_Y.js} +1503 -1352
  249. package/lib/index-CDw4Eszh.cjs +12 -0
  250. package/lib/{index-CUvjYuRp.cjs → index-CHVV5iY-.cjs} +1 -1
  251. package/lib/{index-zw-Kd38i.js → index-CJMI7Fjf.js} +1 -1
  252. package/lib/{index-D-Ouz0vF.js → index-DQy9iBzV.js} +1 -1
  253. package/lib/index-Dbm_Mans.js +1756 -0
  254. package/lib/{index-oj858lQO.js → index-DtyAGMbq.js} +208 -208
  255. package/lib/{index-BblvcbTH.js → index-Dx-Dh7KS.js} +1464 -1348
  256. package/lib/{index-BAb_UADw.cjs → index-SEMQrdk2.cjs} +1 -1
  257. package/lib/index-aujjnfSJ.cjs +1 -0
  258. package/lib/index.cjs +1 -1
  259. package/lib/index.js +12 -12
  260. package/lib/{jsx-runtime-CT7Pcg-t.js → jsx-runtime-DE8oVoME.js} +3 -1
  261. package/lib/locale-bundle.cjs +1 -1
  262. package/lib/locale-bundle.js +1 -1
  263. package/lib/locales/index.d.ts +1 -1
  264. package/lib/{popover-BfWFqCIs.js → popover-BB-ZDnqk.js} +1 -1
  265. package/lib/{popover-BPzkMuyi.cjs → popover-CrywEkBR.cjs} +1 -1
  266. package/lib/{renderNodeView-D--fDFov.cjs → renderNodeView-5h3-p80E.cjs} +1 -1
  267. package/lib/{renderNodeView-CfWJK4rG.js → renderNodeView-DoKZ4GYy.js} +2 -2
  268. package/lib/{separator-DpaS43Gt.cjs → separator-BGO9AZp4.cjs} +1 -1
  269. package/lib/{separator-CBPrZizK.js → separator-DuuOJRQd.js} +21 -21
  270. package/lib/store/EditorEditableReactive.d.ts +1 -1
  271. package/lib/store/ThemeColorReactive.d.ts +1 -1
  272. package/lib/style.css +1 -1
  273. package/lib/types.d.ts +2 -2
  274. package/lib/{updatePosition-DGPtRfWN.cjs → updatePosition-B1oRJE1x.cjs} +1 -1
  275. package/lib/{updatePosition-BwzAsiY0.js → updatePosition-CFTYKYNJ.js} +2 -2
  276. package/package.json +79 -66
  277. package/lib/Callout-DWOMZPiP.cjs +0 -1
  278. package/lib/Callout-ZlPQrMEt.js +0 -340
  279. package/lib/Katex-D9FP7EUE.cjs +0 -4
  280. package/lib/Twitter--tfifMt1.cjs +0 -1
  281. package/lib/index-BF3EVCB1.cjs +0 -2
  282. package/lib/index-Bcj8cyOO.cjs +0 -24
  283. package/lib/index-CGjT-a9h.js +0 -1377
  284. package/lib/index-CPTpXLfX.cjs +0 -11
  285. package/lib/index-CWw4s87s.cjs +0 -1
  286. package/lib/index-Cal5SPfB.js +0 -779
  287. package/lib/index-Gi752TMk.cjs +0 -1
  288. package/lib/textarea-Bl64keav.js +0 -20
  289. package/lib/textarea-wvARZKyA.cjs +0 -1
@@ -0,0 +1,1756 @@
1
+ import { PluginKey as Yt, Plugin as Kt } from "@tiptap/pm/state";
2
+ import { J as Jt } from "./index-Dx-Dh7KS.js";
3
+ import { DecorationSet as Qt, Decoration as Gt } from "@tiptap/pm/view";
4
+ const Bt = ["top", "right", "bottom", "left"], Ot = ["start", "end"], Ct = /* @__PURE__ */ Bt.reduce((t, e) => t.concat(e, e + "-" + Ot[0], e + "-" + Ot[1]), []), q = Math.min, _ = Math.max, st = Math.round, it = Math.floor, z = (t) => ({
5
+ x: t,
6
+ y: t
7
+ }), Zt = {
8
+ left: "right",
9
+ right: "left",
10
+ bottom: "top",
11
+ top: "bottom"
12
+ };
13
+ function ht(t, e, o) {
14
+ return _(t, q(e, o));
15
+ }
16
+ function X(t, e) {
17
+ return typeof t == "function" ? t(e) : t;
18
+ }
19
+ function k(t) {
20
+ return t.split("-")[0];
21
+ }
22
+ function N(t) {
23
+ return t.split("-")[1];
24
+ }
25
+ function kt(t) {
26
+ return t === "x" ? "y" : "x";
27
+ }
28
+ function wt(t) {
29
+ return t === "y" ? "height" : "width";
30
+ }
31
+ function I(t) {
32
+ const e = t[0];
33
+ return e === "t" || e === "b" ? "y" : "x";
34
+ }
35
+ function xt(t) {
36
+ return kt(I(t));
37
+ }
38
+ function Wt(t, e, o) {
39
+ o === void 0 && (o = !1);
40
+ const n = N(t), i = xt(t), r = wt(i);
41
+ let s = i === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
42
+ return e.reference[r] > e.floating[r] && (s = ct(s)), [s, ct(s)];
43
+ }
44
+ function te(t) {
45
+ const e = ct(t);
46
+ return [rt(t), e, rt(e)];
47
+ }
48
+ function rt(t) {
49
+ return t.includes("start") ? t.replace("start", "end") : t.replace("end", "start");
50
+ }
51
+ const Et = ["left", "right"], Pt = ["right", "left"], ee = ["top", "bottom"], ne = ["bottom", "top"];
52
+ function oe(t, e, o) {
53
+ switch (t) {
54
+ case "top":
55
+ case "bottom":
56
+ return o ? e ? Pt : Et : e ? Et : Pt;
57
+ case "left":
58
+ case "right":
59
+ return e ? ee : ne;
60
+ default:
61
+ return [];
62
+ }
63
+ }
64
+ function ie(t, e, o, n) {
65
+ const i = N(t);
66
+ let r = oe(k(t), o === "start", n);
67
+ return i && (r = r.map((s) => s + "-" + i), e && (r = r.concat(r.map(rt)))), r;
68
+ }
69
+ function ct(t) {
70
+ const e = k(t);
71
+ return Zt[e] + t.slice(e.length);
72
+ }
73
+ function se(t) {
74
+ return {
75
+ top: 0,
76
+ right: 0,
77
+ bottom: 0,
78
+ left: 0,
79
+ ...t
80
+ };
81
+ }
82
+ function yt(t) {
83
+ return typeof t != "number" ? se(t) : {
84
+ top: t,
85
+ right: t,
86
+ bottom: t,
87
+ left: t
88
+ };
89
+ }
90
+ function G(t) {
91
+ const {
92
+ x: e,
93
+ y: o,
94
+ width: n,
95
+ height: i
96
+ } = t;
97
+ return {
98
+ width: n,
99
+ height: i,
100
+ top: o,
101
+ left: e,
102
+ right: e + n,
103
+ bottom: o + i,
104
+ x: e,
105
+ y: o
106
+ };
107
+ }
108
+ function Dt(t, e, o) {
109
+ let {
110
+ reference: n,
111
+ floating: i
112
+ } = t;
113
+ const r = I(e), s = xt(e), c = wt(s), a = k(e), u = r === "y", f = n.x + n.width / 2 - i.width / 2, l = n.y + n.height / 2 - i.height / 2, g = n[c] / 2 - i[c] / 2;
114
+ let d;
115
+ switch (a) {
116
+ case "top":
117
+ d = {
118
+ x: f,
119
+ y: n.y - i.height
120
+ };
121
+ break;
122
+ case "bottom":
123
+ d = {
124
+ x: f,
125
+ y: n.y + n.height
126
+ };
127
+ break;
128
+ case "right":
129
+ d = {
130
+ x: n.x + n.width,
131
+ y: l
132
+ };
133
+ break;
134
+ case "left":
135
+ d = {
136
+ x: n.x - i.width,
137
+ y: l
138
+ };
139
+ break;
140
+ default:
141
+ d = {
142
+ x: n.x,
143
+ y: n.y
144
+ };
145
+ }
146
+ switch (N(e)) {
147
+ case "start":
148
+ d[s] -= g * (o && u ? -1 : 1);
149
+ break;
150
+ case "end":
151
+ d[s] += g * (o && u ? -1 : 1);
152
+ break;
153
+ }
154
+ return d;
155
+ }
156
+ async function re(t, e) {
157
+ var o;
158
+ e === void 0 && (e = {});
159
+ const {
160
+ x: n,
161
+ y: i,
162
+ platform: r,
163
+ rects: s,
164
+ elements: c,
165
+ strategy: a
166
+ } = t, {
167
+ boundary: u = "clippingAncestors",
168
+ rootBoundary: f = "viewport",
169
+ elementContext: l = "floating",
170
+ altBoundary: g = !1,
171
+ padding: d = 0
172
+ } = X(e, t), p = yt(d), h = c[g ? l === "floating" ? "reference" : "floating" : l], x = G(await r.getClippingRect({
173
+ element: (o = await (r.isElement == null ? void 0 : r.isElement(h))) == null || o ? h : h.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(c.floating)),
174
+ boundary: u,
175
+ rootBoundary: f,
176
+ strategy: a
177
+ })), v = l === "floating" ? {
178
+ x: n,
179
+ y: i,
180
+ width: s.floating.width,
181
+ height: s.floating.height
182
+ } : s.reference, y = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(c.floating)), m = await (r.isElement == null ? void 0 : r.isElement(y)) ? await (r.getScale == null ? void 0 : r.getScale(y)) || {
183
+ x: 1,
184
+ y: 1
185
+ } : {
186
+ x: 1,
187
+ y: 1
188
+ }, A = G(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
189
+ elements: c,
190
+ rect: v,
191
+ offsetParent: y,
192
+ strategy: a
193
+ }) : v);
194
+ return {
195
+ top: (x.top - A.top + p.top) / m.y,
196
+ bottom: (A.bottom - x.bottom + p.bottom) / m.y,
197
+ left: (x.left - A.left + p.left) / m.x,
198
+ right: (A.right - x.right + p.right) / m.x
199
+ };
200
+ }
201
+ const ce = 50, le = async (t, e, o) => {
202
+ const {
203
+ placement: n = "bottom",
204
+ strategy: i = "absolute",
205
+ middleware: r = [],
206
+ platform: s
207
+ } = o, c = s.detectOverflow ? s : {
208
+ ...s,
209
+ detectOverflow: re
210
+ }, a = await (s.isRTL == null ? void 0 : s.isRTL(e));
211
+ let u = await s.getElementRects({
212
+ reference: t,
213
+ floating: e,
214
+ strategy: i
215
+ }), {
216
+ x: f,
217
+ y: l
218
+ } = Dt(u, n, a), g = n, d = 0;
219
+ const p = {};
220
+ for (let w = 0; w < r.length; w++) {
221
+ const h = r[w];
222
+ if (!h)
223
+ continue;
224
+ const {
225
+ name: x,
226
+ fn: v
227
+ } = h, {
228
+ x: y,
229
+ y: m,
230
+ data: A,
231
+ reset: b
232
+ } = await v({
233
+ x: f,
234
+ y: l,
235
+ initialPlacement: n,
236
+ placement: g,
237
+ strategy: i,
238
+ middlewareData: p,
239
+ rects: u,
240
+ platform: c,
241
+ elements: {
242
+ reference: t,
243
+ floating: e
244
+ }
245
+ });
246
+ f = y ?? f, l = m ?? l, p[x] = {
247
+ ...p[x],
248
+ ...A
249
+ }, b && d < ce && (d++, typeof b == "object" && (b.placement && (g = b.placement), b.rects && (u = b.rects === !0 ? await s.getElementRects({
250
+ reference: t,
251
+ floating: e,
252
+ strategy: i
253
+ }) : b.rects), {
254
+ x: f,
255
+ y: l
256
+ } = Dt(u, g, a)), w = -1);
257
+ }
258
+ return {
259
+ x: f,
260
+ y: l,
261
+ placement: g,
262
+ strategy: i,
263
+ middlewareData: p
264
+ };
265
+ }, ae = (t) => ({
266
+ name: "arrow",
267
+ options: t,
268
+ async fn(e) {
269
+ const {
270
+ x: o,
271
+ y: n,
272
+ placement: i,
273
+ rects: r,
274
+ platform: s,
275
+ elements: c,
276
+ middlewareData: a
277
+ } = e, {
278
+ element: u,
279
+ padding: f = 0
280
+ } = X(t, e) || {};
281
+ if (u == null)
282
+ return {};
283
+ const l = yt(f), g = {
284
+ x: o,
285
+ y: n
286
+ }, d = xt(i), p = wt(d), w = await s.getDimensions(u), h = d === "y", x = h ? "top" : "left", v = h ? "bottom" : "right", y = h ? "clientHeight" : "clientWidth", m = r.reference[p] + r.reference[d] - g[d] - r.floating[p], A = g[d] - r.reference[d], b = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(u));
287
+ let O = b ? b[y] : 0;
288
+ (!O || !await (s.isElement == null ? void 0 : s.isElement(b))) && (O = c.floating[y] || r.floating[p]);
289
+ const D = m / 2 - A / 2, L = O / 2 - w[p] / 2 - 1, R = q(l[x], L), C = q(l[v], L), S = R, M = O - w[p] - C, P = O / 2 - w[p] / 2 + D, $ = ht(S, P, M), T = !a.arrow && N(i) != null && P !== $ && r.reference[p] / 2 - (P < S ? R : C) - w[p] / 2 < 0, E = T ? P < S ? P - S : P - M : 0;
290
+ return {
291
+ [d]: g[d] + E,
292
+ data: {
293
+ [d]: $,
294
+ centerOffset: P - $ - E,
295
+ ...T && {
296
+ alignmentOffset: E
297
+ }
298
+ },
299
+ reset: T
300
+ };
301
+ }
302
+ });
303
+ function fe(t, e, o) {
304
+ return (t ? [...o.filter((i) => N(i) === t), ...o.filter((i) => N(i) !== t)] : o.filter((i) => k(i) === i)).filter((i) => t ? N(i) === t || (e ? rt(i) !== i : !1) : !0);
305
+ }
306
+ const ue = function(t) {
307
+ return t === void 0 && (t = {}), {
308
+ name: "autoPlacement",
309
+ options: t,
310
+ async fn(e) {
311
+ var o, n, i;
312
+ const {
313
+ rects: r,
314
+ middlewareData: s,
315
+ placement: c,
316
+ platform: a,
317
+ elements: u
318
+ } = e, {
319
+ crossAxis: f = !1,
320
+ alignment: l,
321
+ allowedPlacements: g = Ct,
322
+ autoAlignment: d = !0,
323
+ ...p
324
+ } = X(t, e), w = l !== void 0 || g === Ct ? fe(l || null, d, g) : g, h = await a.detectOverflow(e, p), x = ((o = s.autoPlacement) == null ? void 0 : o.index) || 0, v = w[x];
325
+ if (v == null)
326
+ return {};
327
+ const y = Wt(v, r, await (a.isRTL == null ? void 0 : a.isRTL(u.floating)));
328
+ if (c !== v)
329
+ return {
330
+ reset: {
331
+ placement: w[0]
332
+ }
333
+ };
334
+ const m = [h[k(v)], h[y[0]], h[y[1]]], A = [...((n = s.autoPlacement) == null ? void 0 : n.overflows) || [], {
335
+ placement: v,
336
+ overflows: m
337
+ }], b = w[x + 1];
338
+ if (b)
339
+ return {
340
+ data: {
341
+ index: x + 1,
342
+ overflows: A
343
+ },
344
+ reset: {
345
+ placement: b
346
+ }
347
+ };
348
+ const O = A.map((R) => {
349
+ const C = N(R.placement);
350
+ return [R.placement, C && f ? (
351
+ // Check along the mainAxis and main crossAxis side.
352
+ R.overflows.slice(0, 2).reduce((S, M) => S + M, 0)
353
+ ) : (
354
+ // Check only the mainAxis.
355
+ R.overflows[0]
356
+ ), R.overflows];
357
+ }).sort((R, C) => R[1] - C[1]), L = ((i = O.filter((R) => R[2].slice(
358
+ 0,
359
+ // Aligned placements should not check their opposite crossAxis
360
+ // side.
361
+ N(R[0]) ? 2 : 3
362
+ ).every((C) => C <= 0))[0]) == null ? void 0 : i[0]) || O[0][0];
363
+ return L !== c ? {
364
+ data: {
365
+ index: x + 1,
366
+ overflows: A
367
+ },
368
+ reset: {
369
+ placement: L
370
+ }
371
+ } : {};
372
+ }
373
+ };
374
+ }, de = function(t) {
375
+ return t === void 0 && (t = {}), {
376
+ name: "flip",
377
+ options: t,
378
+ async fn(e) {
379
+ var o, n;
380
+ const {
381
+ placement: i,
382
+ middlewareData: r,
383
+ rects: s,
384
+ initialPlacement: c,
385
+ platform: a,
386
+ elements: u
387
+ } = e, {
388
+ mainAxis: f = !0,
389
+ crossAxis: l = !0,
390
+ fallbackPlacements: g,
391
+ fallbackStrategy: d = "bestFit",
392
+ fallbackAxisSideDirection: p = "none",
393
+ flipAlignment: w = !0,
394
+ ...h
395
+ } = X(t, e);
396
+ if ((o = r.arrow) != null && o.alignmentOffset)
397
+ return {};
398
+ const x = k(i), v = I(c), y = k(c) === c, m = await (a.isRTL == null ? void 0 : a.isRTL(u.floating)), A = g || (y || !w ? [ct(c)] : te(c)), b = p !== "none";
399
+ !g && b && A.push(...ie(c, w, p, m));
400
+ const O = [c, ...A], D = await a.detectOverflow(e, h), L = [];
401
+ let R = ((n = r.flip) == null ? void 0 : n.overflows) || [];
402
+ if (f && L.push(D[x]), l) {
403
+ const P = Wt(i, s, m);
404
+ L.push(D[P[0]], D[P[1]]);
405
+ }
406
+ if (R = [...R, {
407
+ placement: i,
408
+ overflows: L
409
+ }], !L.every((P) => P <= 0)) {
410
+ var C, S;
411
+ const P = (((C = r.flip) == null ? void 0 : C.index) || 0) + 1, $ = O[P];
412
+ if ($ && (!(l === "alignment" ? v !== I($) : !1) || // We leave the current main axis only if every placement on that axis
413
+ // overflows the main axis.
414
+ R.every((F) => I(F.placement) === v ? F.overflows[0] > 0 : !0)))
415
+ return {
416
+ data: {
417
+ index: P,
418
+ overflows: R
419
+ },
420
+ reset: {
421
+ placement: $
422
+ }
423
+ };
424
+ let T = (S = R.filter((E) => E.overflows[0] <= 0).sort((E, F) => E.overflows[1] - F.overflows[1])[0]) == null ? void 0 : S.placement;
425
+ if (!T)
426
+ switch (d) {
427
+ case "bestFit": {
428
+ var M;
429
+ const E = (M = R.filter((F) => {
430
+ if (b) {
431
+ const W = I(F.placement);
432
+ return W === v || // Create a bias to the `y` side axis due to horizontal
433
+ // reading directions favoring greater width.
434
+ W === "y";
435
+ }
436
+ return !0;
437
+ }).map((F) => [F.placement, F.overflows.filter((W) => W > 0).reduce((W, dt) => W + dt, 0)]).sort((F, W) => F[1] - W[1])[0]) == null ? void 0 : M[0];
438
+ E && (T = E);
439
+ break;
440
+ }
441
+ case "initialPlacement":
442
+ T = c;
443
+ break;
444
+ }
445
+ if (i !== T)
446
+ return {
447
+ reset: {
448
+ placement: T
449
+ }
450
+ };
451
+ }
452
+ return {};
453
+ }
454
+ };
455
+ };
456
+ function Lt(t, e) {
457
+ return {
458
+ top: t.top - e.height,
459
+ right: t.right - e.width,
460
+ bottom: t.bottom - e.height,
461
+ left: t.left - e.width
462
+ };
463
+ }
464
+ function Tt(t) {
465
+ return Bt.some((e) => t[e] >= 0);
466
+ }
467
+ const ge = function(t) {
468
+ return t === void 0 && (t = {}), {
469
+ name: "hide",
470
+ options: t,
471
+ async fn(e) {
472
+ const {
473
+ rects: o,
474
+ platform: n
475
+ } = e, {
476
+ strategy: i = "referenceHidden",
477
+ ...r
478
+ } = X(t, e);
479
+ switch (i) {
480
+ case "referenceHidden": {
481
+ const s = await n.detectOverflow(e, {
482
+ ...r,
483
+ elementContext: "reference"
484
+ }), c = Lt(s, o.reference);
485
+ return {
486
+ data: {
487
+ referenceHiddenOffsets: c,
488
+ referenceHidden: Tt(c)
489
+ }
490
+ };
491
+ }
492
+ case "escaped": {
493
+ const s = await n.detectOverflow(e, {
494
+ ...r,
495
+ altBoundary: !0
496
+ }), c = Lt(s, o.floating);
497
+ return {
498
+ data: {
499
+ escapedOffsets: c,
500
+ escaped: Tt(c)
501
+ }
502
+ };
503
+ }
504
+ default:
505
+ return {};
506
+ }
507
+ }
508
+ };
509
+ };
510
+ function Nt(t) {
511
+ const e = q(...t.map((r) => r.left)), o = q(...t.map((r) => r.top)), n = _(...t.map((r) => r.right)), i = _(...t.map((r) => r.bottom));
512
+ return {
513
+ x: e,
514
+ y: o,
515
+ width: n - e,
516
+ height: i - o
517
+ };
518
+ }
519
+ function me(t) {
520
+ const e = t.slice().sort((i, r) => i.y - r.y), o = [];
521
+ let n = null;
522
+ for (let i = 0; i < e.length; i++) {
523
+ const r = e[i];
524
+ !n || r.y - n.y > n.height / 2 ? o.push([r]) : o[o.length - 1].push(r), n = r;
525
+ }
526
+ return o.map((i) => G(Nt(i)));
527
+ }
528
+ const he = function(t) {
529
+ return t === void 0 && (t = {}), {
530
+ name: "inline",
531
+ options: t,
532
+ async fn(e) {
533
+ const {
534
+ placement: o,
535
+ elements: n,
536
+ rects: i,
537
+ platform: r,
538
+ strategy: s
539
+ } = e, {
540
+ padding: c = 2,
541
+ x: a,
542
+ y: u
543
+ } = X(t, e), f = Array.from(await (r.getClientRects == null ? void 0 : r.getClientRects(n.reference)) || []), l = me(f), g = G(Nt(f)), d = yt(c);
544
+ function p() {
545
+ if (l.length === 2 && l[0].left > l[1].right && a != null && u != null)
546
+ return l.find((h) => a > h.left - d.left && a < h.right + d.right && u > h.top - d.top && u < h.bottom + d.bottom) || g;
547
+ if (l.length >= 2) {
548
+ if (I(o) === "y") {
549
+ const R = l[0], C = l[l.length - 1], S = k(o) === "top", M = R.top, P = C.bottom, $ = S ? R.left : C.left, T = S ? R.right : C.right, E = T - $, F = P - M;
550
+ return {
551
+ top: M,
552
+ bottom: P,
553
+ left: $,
554
+ right: T,
555
+ width: E,
556
+ height: F,
557
+ x: $,
558
+ y: M
559
+ };
560
+ }
561
+ const h = k(o) === "left", x = _(...l.map((R) => R.right)), v = q(...l.map((R) => R.left)), y = l.filter((R) => h ? R.left === v : R.right === x), m = y[0].top, A = y[y.length - 1].bottom, b = v, O = x, D = O - b, L = A - m;
562
+ return {
563
+ top: m,
564
+ bottom: A,
565
+ left: b,
566
+ right: O,
567
+ width: D,
568
+ height: L,
569
+ x: b,
570
+ y: m
571
+ };
572
+ }
573
+ return g;
574
+ }
575
+ const w = await r.getElementRects({
576
+ reference: {
577
+ getBoundingClientRect: p
578
+ },
579
+ floating: n.floating,
580
+ strategy: s
581
+ });
582
+ return i.reference.x !== w.reference.x || i.reference.y !== w.reference.y || i.reference.width !== w.reference.width || i.reference.height !== w.reference.height ? {
583
+ reset: {
584
+ rects: w
585
+ }
586
+ } : {};
587
+ }
588
+ };
589
+ }, pe = /* @__PURE__ */ new Set(["left", "top"]);
590
+ async function we(t, e) {
591
+ const {
592
+ placement: o,
593
+ platform: n,
594
+ elements: i
595
+ } = t, r = await (n.isRTL == null ? void 0 : n.isRTL(i.floating)), s = k(o), c = N(o), a = I(o) === "y", u = pe.has(s) ? -1 : 1, f = r && a ? -1 : 1, l = X(e, t);
596
+ let {
597
+ mainAxis: g,
598
+ crossAxis: d,
599
+ alignmentAxis: p
600
+ } = typeof l == "number" ? {
601
+ mainAxis: l,
602
+ crossAxis: 0,
603
+ alignmentAxis: null
604
+ } : {
605
+ mainAxis: l.mainAxis || 0,
606
+ crossAxis: l.crossAxis || 0,
607
+ alignmentAxis: l.alignmentAxis
608
+ };
609
+ return c && typeof p == "number" && (d = c === "end" ? p * -1 : p), a ? {
610
+ x: d * f,
611
+ y: g * u
612
+ } : {
613
+ x: g * u,
614
+ y: d * f
615
+ };
616
+ }
617
+ const xe = function(t) {
618
+ return t === void 0 && (t = 0), {
619
+ name: "offset",
620
+ options: t,
621
+ async fn(e) {
622
+ var o, n;
623
+ const {
624
+ x: i,
625
+ y: r,
626
+ placement: s,
627
+ middlewareData: c
628
+ } = e, a = await we(e, t);
629
+ return s === ((o = c.offset) == null ? void 0 : o.placement) && (n = c.arrow) != null && n.alignmentOffset ? {} : {
630
+ x: i + a.x,
631
+ y: r + a.y,
632
+ data: {
633
+ ...a,
634
+ placement: s
635
+ }
636
+ };
637
+ }
638
+ };
639
+ }, ye = function(t) {
640
+ return t === void 0 && (t = {}), {
641
+ name: "shift",
642
+ options: t,
643
+ async fn(e) {
644
+ const {
645
+ x: o,
646
+ y: n,
647
+ placement: i,
648
+ platform: r
649
+ } = e, {
650
+ mainAxis: s = !0,
651
+ crossAxis: c = !1,
652
+ limiter: a = {
653
+ fn: (x) => {
654
+ let {
655
+ x: v,
656
+ y
657
+ } = x;
658
+ return {
659
+ x: v,
660
+ y
661
+ };
662
+ }
663
+ },
664
+ ...u
665
+ } = X(t, e), f = {
666
+ x: o,
667
+ y: n
668
+ }, l = await r.detectOverflow(e, u), g = I(k(i)), d = kt(g);
669
+ let p = f[d], w = f[g];
670
+ if (s) {
671
+ const x = d === "y" ? "top" : "left", v = d === "y" ? "bottom" : "right", y = p + l[x], m = p - l[v];
672
+ p = ht(y, p, m);
673
+ }
674
+ if (c) {
675
+ const x = g === "y" ? "top" : "left", v = g === "y" ? "bottom" : "right", y = w + l[x], m = w - l[v];
676
+ w = ht(y, w, m);
677
+ }
678
+ const h = a.fn({
679
+ ...e,
680
+ [d]: p,
681
+ [g]: w
682
+ });
683
+ return {
684
+ ...h,
685
+ data: {
686
+ x: h.x - o,
687
+ y: h.y - n,
688
+ enabled: {
689
+ [d]: s,
690
+ [g]: c
691
+ }
692
+ }
693
+ };
694
+ }
695
+ };
696
+ }, ve = function(t) {
697
+ return t === void 0 && (t = {}), {
698
+ name: "size",
699
+ options: t,
700
+ async fn(e) {
701
+ var o, n;
702
+ const {
703
+ placement: i,
704
+ rects: r,
705
+ platform: s,
706
+ elements: c
707
+ } = e, {
708
+ apply: a = () => {
709
+ },
710
+ ...u
711
+ } = X(t, e), f = await s.detectOverflow(e, u), l = k(i), g = N(i), d = I(i) === "y", {
712
+ width: p,
713
+ height: w
714
+ } = r.floating;
715
+ let h, x;
716
+ l === "top" || l === "bottom" ? (h = l, x = g === (await (s.isRTL == null ? void 0 : s.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (x = l, h = g === "end" ? "top" : "bottom");
717
+ const v = w - f.top - f.bottom, y = p - f.left - f.right, m = q(w - f[h], v), A = q(p - f[x], y), b = !e.middlewareData.shift;
718
+ let O = m, D = A;
719
+ if ((o = e.middlewareData.shift) != null && o.enabled.x && (D = y), (n = e.middlewareData.shift) != null && n.enabled.y && (O = v), b && !g) {
720
+ const R = _(f.left, 0), C = _(f.right, 0), S = _(f.top, 0), M = _(f.bottom, 0);
721
+ d ? D = p - 2 * (R !== 0 || C !== 0 ? R + C : _(f.left, f.right)) : O = w - 2 * (S !== 0 || M !== 0 ? S + M : _(f.top, f.bottom));
722
+ }
723
+ await a({
724
+ ...e,
725
+ availableWidth: D,
726
+ availableHeight: O
727
+ });
728
+ const L = await s.getDimensions(c.floating);
729
+ return p !== L.width || w !== L.height ? {
730
+ reset: {
731
+ rects: !0
732
+ }
733
+ } : {};
734
+ }
735
+ };
736
+ };
737
+ function lt() {
738
+ return typeof window < "u";
739
+ }
740
+ function tt(t) {
741
+ return qt(t) ? (t.nodeName || "").toLowerCase() : "#document";
742
+ }
743
+ function B(t) {
744
+ var e;
745
+ return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
746
+ }
747
+ function j(t) {
748
+ var e;
749
+ return (e = (qt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
750
+ }
751
+ function qt(t) {
752
+ return lt() ? t instanceof Node || t instanceof B(t).Node : !1;
753
+ }
754
+ function H(t) {
755
+ return lt() ? t instanceof Element || t instanceof B(t).Element : !1;
756
+ }
757
+ function U(t) {
758
+ return lt() ? t instanceof HTMLElement || t instanceof B(t).HTMLElement : !1;
759
+ }
760
+ function Mt(t) {
761
+ return !lt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof B(t).ShadowRoot;
762
+ }
763
+ function ot(t) {
764
+ const {
765
+ overflow: e,
766
+ overflowX: o,
767
+ overflowY: n,
768
+ display: i
769
+ } = V(t);
770
+ return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && i !== "inline" && i !== "contents";
771
+ }
772
+ function be(t) {
773
+ return /^(table|td|th)$/.test(tt(t));
774
+ }
775
+ function at(t) {
776
+ try {
777
+ if (t.matches(":popover-open"))
778
+ return !0;
779
+ } catch {
780
+ }
781
+ try {
782
+ return t.matches(":modal");
783
+ } catch {
784
+ return !1;
785
+ }
786
+ }
787
+ const Re = /transform|translate|scale|rotate|perspective|filter/, Se = /paint|layout|strict|content/, K = (t) => !!t && t !== "none";
788
+ let gt;
789
+ function vt(t) {
790
+ const e = H(t) ? V(t) : t;
791
+ return K(e.transform) || K(e.translate) || K(e.scale) || K(e.rotate) || K(e.perspective) || !bt() && (K(e.backdropFilter) || K(e.filter)) || Re.test(e.willChange || "") || Se.test(e.contain || "");
792
+ }
793
+ function Ae(t) {
794
+ let e = Y(t);
795
+ for (; U(e) && !Z(e); ) {
796
+ if (vt(e))
797
+ return e;
798
+ if (at(e))
799
+ return null;
800
+ e = Y(e);
801
+ }
802
+ return null;
803
+ }
804
+ function bt() {
805
+ return gt == null && (gt = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), gt;
806
+ }
807
+ function Z(t) {
808
+ return /^(html|body|#document)$/.test(tt(t));
809
+ }
810
+ function V(t) {
811
+ return B(t).getComputedStyle(t);
812
+ }
813
+ function ft(t) {
814
+ return H(t) ? {
815
+ scrollLeft: t.scrollLeft,
816
+ scrollTop: t.scrollTop
817
+ } : {
818
+ scrollLeft: t.scrollX,
819
+ scrollTop: t.scrollY
820
+ };
821
+ }
822
+ function Y(t) {
823
+ if (tt(t) === "html")
824
+ return t;
825
+ const e = (
826
+ // Step into the shadow DOM of the parent of a slotted node.
827
+ t.assignedSlot || // DOM Element detected.
828
+ t.parentNode || // ShadowRoot detected.
829
+ Mt(t) && t.host || // Fallback.
830
+ j(t)
831
+ );
832
+ return Mt(e) ? e.host : e;
833
+ }
834
+ function Ht(t) {
835
+ const e = Y(t);
836
+ return Z(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : U(e) && ot(e) ? e : Ht(e);
837
+ }
838
+ function nt(t, e, o) {
839
+ var n;
840
+ e === void 0 && (e = []), o === void 0 && (o = !0);
841
+ const i = Ht(t), r = i === ((n = t.ownerDocument) == null ? void 0 : n.body), s = B(i);
842
+ if (r) {
843
+ const c = pt(s);
844
+ return e.concat(s, s.visualViewport || [], ot(i) ? i : [], c && o ? nt(c) : []);
845
+ } else
846
+ return e.concat(i, nt(i, [], o));
847
+ }
848
+ function pt(t) {
849
+ return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
850
+ }
851
+ function Vt(t) {
852
+ const e = V(t);
853
+ let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
854
+ const i = U(t), r = i ? t.offsetWidth : o, s = i ? t.offsetHeight : n, c = st(o) !== r || st(n) !== s;
855
+ return c && (o = r, n = s), {
856
+ width: o,
857
+ height: n,
858
+ $: c
859
+ };
860
+ }
861
+ function Rt(t) {
862
+ return H(t) ? t : t.contextElement;
863
+ }
864
+ function Q(t) {
865
+ const e = Rt(t);
866
+ if (!U(e))
867
+ return z(1);
868
+ const o = e.getBoundingClientRect(), {
869
+ width: n,
870
+ height: i,
871
+ $: r
872
+ } = Vt(e);
873
+ let s = (r ? st(o.width) : o.width) / n, c = (r ? st(o.height) : o.height) / i;
874
+ return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
875
+ x: s,
876
+ y: c
877
+ };
878
+ }
879
+ const Oe = /* @__PURE__ */ z(0);
880
+ function It(t) {
881
+ const e = B(t);
882
+ return !bt() || !e.visualViewport ? Oe : {
883
+ x: e.visualViewport.offsetLeft,
884
+ y: e.visualViewport.offsetTop
885
+ };
886
+ }
887
+ function Ce(t, e, o) {
888
+ return e === void 0 && (e = !1), !o || e && o !== B(t) ? !1 : e;
889
+ }
890
+ function J(t, e, o, n) {
891
+ e === void 0 && (e = !1), o === void 0 && (o = !1);
892
+ const i = t.getBoundingClientRect(), r = Rt(t);
893
+ let s = z(1);
894
+ e && (n ? H(n) && (s = Q(n)) : s = Q(t));
895
+ const c = Ce(r, o, n) ? It(r) : z(0);
896
+ let a = (i.left + c.x) / s.x, u = (i.top + c.y) / s.y, f = i.width / s.x, l = i.height / s.y;
897
+ if (r) {
898
+ const g = B(r), d = n && H(n) ? B(n) : n;
899
+ let p = g, w = pt(p);
900
+ for (; w && n && d !== p; ) {
901
+ const h = Q(w), x = w.getBoundingClientRect(), v = V(w), y = x.left + (w.clientLeft + parseFloat(v.paddingLeft)) * h.x, m = x.top + (w.clientTop + parseFloat(v.paddingTop)) * h.y;
902
+ a *= h.x, u *= h.y, f *= h.x, l *= h.y, a += y, u += m, p = B(w), w = pt(p);
903
+ }
904
+ }
905
+ return G({
906
+ width: f,
907
+ height: l,
908
+ x: a,
909
+ y: u
910
+ });
911
+ }
912
+ function ut(t, e) {
913
+ const o = ft(t).scrollLeft;
914
+ return e ? e.left + o : J(j(t)).left + o;
915
+ }
916
+ function zt(t, e) {
917
+ const o = t.getBoundingClientRect(), n = o.left + e.scrollLeft - ut(t, o), i = o.top + e.scrollTop;
918
+ return {
919
+ x: n,
920
+ y: i
921
+ };
922
+ }
923
+ function Ee(t) {
924
+ let {
925
+ elements: e,
926
+ rect: o,
927
+ offsetParent: n,
928
+ strategy: i
929
+ } = t;
930
+ const r = i === "fixed", s = j(n), c = e ? at(e.floating) : !1;
931
+ if (n === s || c && r)
932
+ return o;
933
+ let a = {
934
+ scrollLeft: 0,
935
+ scrollTop: 0
936
+ }, u = z(1);
937
+ const f = z(0), l = U(n);
938
+ if ((l || !l && !r) && ((tt(n) !== "body" || ot(s)) && (a = ft(n)), l)) {
939
+ const d = J(n);
940
+ u = Q(n), f.x = d.x + n.clientLeft, f.y = d.y + n.clientTop;
941
+ }
942
+ const g = s && !l && !r ? zt(s, a) : z(0);
943
+ return {
944
+ width: o.width * u.x,
945
+ height: o.height * u.y,
946
+ x: o.x * u.x - a.scrollLeft * u.x + f.x + g.x,
947
+ y: o.y * u.y - a.scrollTop * u.y + f.y + g.y
948
+ };
949
+ }
950
+ function Pe(t) {
951
+ return Array.from(t.getClientRects());
952
+ }
953
+ function De(t) {
954
+ const e = j(t), o = ft(t), n = t.ownerDocument.body, i = _(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), r = _(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
955
+ let s = -o.scrollLeft + ut(t);
956
+ const c = -o.scrollTop;
957
+ return V(n).direction === "rtl" && (s += _(e.clientWidth, n.clientWidth) - i), {
958
+ width: i,
959
+ height: r,
960
+ x: s,
961
+ y: c
962
+ };
963
+ }
964
+ const $t = 25;
965
+ function Le(t, e) {
966
+ const o = B(t), n = j(t), i = o.visualViewport;
967
+ let r = n.clientWidth, s = n.clientHeight, c = 0, a = 0;
968
+ if (i) {
969
+ r = i.width, s = i.height;
970
+ const f = bt();
971
+ (!f || f && e === "fixed") && (c = i.offsetLeft, a = i.offsetTop);
972
+ }
973
+ const u = ut(n);
974
+ if (u <= 0) {
975
+ const f = n.ownerDocument, l = f.body, g = getComputedStyle(l), d = f.compatMode === "CSS1Compat" && parseFloat(g.marginLeft) + parseFloat(g.marginRight) || 0, p = Math.abs(n.clientWidth - l.clientWidth - d);
976
+ p <= $t && (r -= p);
977
+ } else u <= $t && (r += u);
978
+ return {
979
+ width: r,
980
+ height: s,
981
+ x: c,
982
+ y: a
983
+ };
984
+ }
985
+ function Te(t, e) {
986
+ const o = J(t, !0, e === "fixed"), n = o.top + t.clientTop, i = o.left + t.clientLeft, r = U(t) ? Q(t) : z(1), s = t.clientWidth * r.x, c = t.clientHeight * r.y, a = i * r.x, u = n * r.y;
987
+ return {
988
+ width: s,
989
+ height: c,
990
+ x: a,
991
+ y: u
992
+ };
993
+ }
994
+ function Ft(t, e, o) {
995
+ let n;
996
+ if (e === "viewport")
997
+ n = Le(t, o);
998
+ else if (e === "document")
999
+ n = De(j(t));
1000
+ else if (H(e))
1001
+ n = Te(e, o);
1002
+ else {
1003
+ const i = It(t);
1004
+ n = {
1005
+ x: e.x - i.x,
1006
+ y: e.y - i.y,
1007
+ width: e.width,
1008
+ height: e.height
1009
+ };
1010
+ }
1011
+ return G(n);
1012
+ }
1013
+ function jt(t, e) {
1014
+ const o = Y(t);
1015
+ return o === e || !H(o) || Z(o) ? !1 : V(o).position === "fixed" || jt(o, e);
1016
+ }
1017
+ function Me(t, e) {
1018
+ const o = e.get(t);
1019
+ if (o)
1020
+ return o;
1021
+ let n = nt(t, [], !1).filter((c) => H(c) && tt(c) !== "body"), i = null;
1022
+ const r = V(t).position === "fixed";
1023
+ let s = r ? Y(t) : t;
1024
+ for (; H(s) && !Z(s); ) {
1025
+ const c = V(s), a = vt(s);
1026
+ !a && c.position === "fixed" && (i = null), (r ? !a && !i : !a && c.position === "static" && !!i && (i.position === "absolute" || i.position === "fixed") || ot(s) && !a && jt(t, s)) ? n = n.filter((f) => f !== s) : i = c, s = Y(s);
1027
+ }
1028
+ return e.set(t, n), n;
1029
+ }
1030
+ function $e(t) {
1031
+ let {
1032
+ element: e,
1033
+ boundary: o,
1034
+ rootBoundary: n,
1035
+ strategy: i
1036
+ } = t;
1037
+ const s = [...o === "clippingAncestors" ? at(e) ? [] : Me(e, this._c) : [].concat(o), n], c = Ft(e, s[0], i);
1038
+ let a = c.top, u = c.right, f = c.bottom, l = c.left;
1039
+ for (let g = 1; g < s.length; g++) {
1040
+ const d = Ft(e, s[g], i);
1041
+ a = _(d.top, a), u = q(d.right, u), f = q(d.bottom, f), l = _(d.left, l);
1042
+ }
1043
+ return {
1044
+ width: u - l,
1045
+ height: f - a,
1046
+ x: l,
1047
+ y: a
1048
+ };
1049
+ }
1050
+ function Fe(t) {
1051
+ const {
1052
+ width: e,
1053
+ height: o
1054
+ } = Vt(t);
1055
+ return {
1056
+ width: e,
1057
+ height: o
1058
+ };
1059
+ }
1060
+ function _e(t, e, o) {
1061
+ const n = U(e), i = j(e), r = o === "fixed", s = J(t, !0, r, e);
1062
+ let c = {
1063
+ scrollLeft: 0,
1064
+ scrollTop: 0
1065
+ };
1066
+ const a = z(0);
1067
+ function u() {
1068
+ a.x = ut(i);
1069
+ }
1070
+ if (n || !n && !r)
1071
+ if ((tt(e) !== "body" || ot(i)) && (c = ft(e)), n) {
1072
+ const d = J(e, !0, r, e);
1073
+ a.x = d.x + e.clientLeft, a.y = d.y + e.clientTop;
1074
+ } else i && u();
1075
+ r && !n && i && u();
1076
+ const f = i && !n && !r ? zt(i, c) : z(0), l = s.left + c.scrollLeft - a.x - f.x, g = s.top + c.scrollTop - a.y - f.y;
1077
+ return {
1078
+ x: l,
1079
+ y: g,
1080
+ width: s.width,
1081
+ height: s.height
1082
+ };
1083
+ }
1084
+ function mt(t) {
1085
+ return V(t).position === "static";
1086
+ }
1087
+ function _t(t, e) {
1088
+ if (!U(t) || V(t).position === "fixed")
1089
+ return null;
1090
+ if (e)
1091
+ return e(t);
1092
+ let o = t.offsetParent;
1093
+ return j(t) === o && (o = o.ownerDocument.body), o;
1094
+ }
1095
+ function Xt(t, e) {
1096
+ const o = B(t);
1097
+ if (at(t))
1098
+ return o;
1099
+ if (!U(t)) {
1100
+ let i = Y(t);
1101
+ for (; i && !Z(i); ) {
1102
+ if (H(i) && !mt(i))
1103
+ return i;
1104
+ i = Y(i);
1105
+ }
1106
+ return o;
1107
+ }
1108
+ let n = _t(t, e);
1109
+ for (; n && be(n) && mt(n); )
1110
+ n = _t(n, e);
1111
+ return n && Z(n) && mt(n) && !vt(n) ? o : n || Ae(t) || o;
1112
+ }
1113
+ const Be = async function(t) {
1114
+ const e = this.getOffsetParent || Xt, o = this.getDimensions, n = await o(t.floating);
1115
+ return {
1116
+ reference: _e(t.reference, await e(t.floating), t.strategy),
1117
+ floating: {
1118
+ x: 0,
1119
+ y: 0,
1120
+ width: n.width,
1121
+ height: n.height
1122
+ }
1123
+ };
1124
+ };
1125
+ function ke(t) {
1126
+ return V(t).direction === "rtl";
1127
+ }
1128
+ const We = {
1129
+ convertOffsetParentRelativeRectToViewportRelativeRect: Ee,
1130
+ getDocumentElement: j,
1131
+ getClippingRect: $e,
1132
+ getOffsetParent: Xt,
1133
+ getElementRects: Be,
1134
+ getClientRects: Pe,
1135
+ getDimensions: Fe,
1136
+ getScale: Q,
1137
+ isElement: H,
1138
+ isRTL: ke
1139
+ };
1140
+ function Ut(t, e) {
1141
+ return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
1142
+ }
1143
+ function Ne(t, e) {
1144
+ let o = null, n;
1145
+ const i = j(t);
1146
+ function r() {
1147
+ var c;
1148
+ clearTimeout(n), (c = o) == null || c.disconnect(), o = null;
1149
+ }
1150
+ function s(c, a) {
1151
+ c === void 0 && (c = !1), a === void 0 && (a = 1), r();
1152
+ const u = t.getBoundingClientRect(), {
1153
+ left: f,
1154
+ top: l,
1155
+ width: g,
1156
+ height: d
1157
+ } = u;
1158
+ if (c || e(), !g || !d)
1159
+ return;
1160
+ const p = it(l), w = it(i.clientWidth - (f + g)), h = it(i.clientHeight - (l + d)), x = it(f), y = {
1161
+ rootMargin: -p + "px " + -w + "px " + -h + "px " + -x + "px",
1162
+ threshold: _(0, q(1, a)) || 1
1163
+ };
1164
+ let m = !0;
1165
+ function A(b) {
1166
+ const O = b[0].intersectionRatio;
1167
+ if (O !== a) {
1168
+ if (!m)
1169
+ return s();
1170
+ O ? s(!1, O) : n = setTimeout(() => {
1171
+ s(!1, 1e-7);
1172
+ }, 1e3);
1173
+ }
1174
+ O === 1 && !Ut(u, t.getBoundingClientRect()) && s(), m = !1;
1175
+ }
1176
+ try {
1177
+ o = new IntersectionObserver(A, {
1178
+ ...y,
1179
+ // Handle <iframe>s
1180
+ root: i.ownerDocument
1181
+ });
1182
+ } catch {
1183
+ o = new IntersectionObserver(A, y);
1184
+ }
1185
+ o.observe(t);
1186
+ }
1187
+ return s(!0), r;
1188
+ }
1189
+ function qe(t, e, o, n) {
1190
+ n === void 0 && (n = {});
1191
+ const {
1192
+ ancestorScroll: i = !0,
1193
+ ancestorResize: r = !0,
1194
+ elementResize: s = typeof ResizeObserver == "function",
1195
+ layoutShift: c = typeof IntersectionObserver == "function",
1196
+ animationFrame: a = !1
1197
+ } = n, u = Rt(t), f = i || r ? [...u ? nt(u) : [], ...e ? nt(e) : []] : [];
1198
+ f.forEach((x) => {
1199
+ i && x.addEventListener("scroll", o, {
1200
+ passive: !0
1201
+ }), r && x.addEventListener("resize", o);
1202
+ });
1203
+ const l = u && c ? Ne(u, o) : null;
1204
+ let g = -1, d = null;
1205
+ s && (d = new ResizeObserver((x) => {
1206
+ let [v] = x;
1207
+ v && v.target === u && d && e && (d.unobserve(e), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
1208
+ var y;
1209
+ (y = d) == null || y.observe(e);
1210
+ })), o();
1211
+ }), u && !a && d.observe(u), e && d.observe(e));
1212
+ let p, w = a ? J(t) : null;
1213
+ a && h();
1214
+ function h() {
1215
+ const x = J(t);
1216
+ w && !Ut(w, x) && o(), w = x, p = requestAnimationFrame(h);
1217
+ }
1218
+ return o(), () => {
1219
+ var x;
1220
+ f.forEach((v) => {
1221
+ i && v.removeEventListener("scroll", o), r && v.removeEventListener("resize", o);
1222
+ }), l == null || l(), (x = d) == null || x.disconnect(), d = null, a && cancelAnimationFrame(p);
1223
+ };
1224
+ }
1225
+ const He = xe, ln = ue, an = ye, Ve = de, fn = ve, un = ge, dn = ae, gn = he, Ie = (t, e, o) => {
1226
+ const n = /* @__PURE__ */ new Map(), i = {
1227
+ platform: We,
1228
+ ...o
1229
+ }, r = {
1230
+ ...i.platform,
1231
+ _c: n
1232
+ };
1233
+ return le(t, e, {
1234
+ ...i,
1235
+ platform: r
1236
+ });
1237
+ };
1238
+ function ze(t) {
1239
+ var e;
1240
+ const {
1241
+ char: o,
1242
+ allowSpaces: n,
1243
+ allowToIncludeChar: i,
1244
+ allowedPrefixes: r,
1245
+ startOfLine: s,
1246
+ $position: c
1247
+ } = t, a = n && !i, u = Jt(o), f = new RegExp(`\\s${u}$`), l = s ? "^" : "", g = i ? "" : u, d = a ? new RegExp(`${l}${u}.*?(?=\\s${g}|$)`, "gm") : new RegExp(`${l}(?:^)?${u}[^\\s${g}]*`, "gm"), p = ((e = c.nodeBefore) == null ? void 0 : e.isText) && c.nodeBefore.text;
1248
+ if (!p)
1249
+ return null;
1250
+ const w = c.pos - p.length, h = Array.from(p.matchAll(d)).pop();
1251
+ if (!h || h.input === void 0 || h.index === void 0)
1252
+ return null;
1253
+ const x = h.input.slice(Math.max(0, h.index - 1), h.index), v = new RegExp(`^[${r == null ? void 0 : r.join("")}\0]?$`).test(x);
1254
+ if (r !== null && !v)
1255
+ return null;
1256
+ const y = w + h.index;
1257
+ let m = y + h[0].length;
1258
+ return a && f.test(p.slice(m - 1, m + 1)) && (h[0] += " ", m += 1), y < c.pos && m >= c.pos ? {
1259
+ range: {
1260
+ from: y,
1261
+ to: m
1262
+ },
1263
+ query: h[0].slice(o.length),
1264
+ text: h[0]
1265
+ } : null;
1266
+ }
1267
+ function je(t) {
1268
+ return t.docChanged ? t.steps.some((e) => {
1269
+ const o = e.slice;
1270
+ if (!(o != null && o.content))
1271
+ return !1;
1272
+ const n = o.content.textBetween(0, o.content.size, `
1273
+ `);
1274
+ return /\s/.test(n);
1275
+ }) : !1;
1276
+ }
1277
+ function Xe(t) {
1278
+ return () => {
1279
+ const e = t.state.selection.$anchor.pos, o = t.view.coordsAtPos(e), { top: n, right: i, bottom: r, left: s } = o;
1280
+ try {
1281
+ return new DOMRect(s, n, i - s, r - n);
1282
+ } catch {
1283
+ return null;
1284
+ }
1285
+ };
1286
+ }
1287
+ function Ue(t, e, o, n) {
1288
+ return o ? () => {
1289
+ const i = n.getState(t.state), r = i == null ? void 0 : i.decorationId, s = e.dom.querySelector(`[data-decoration-id="${r}"]`);
1290
+ return (s == null ? void 0 : s.getBoundingClientRect()) || null;
1291
+ } : Xe(t);
1292
+ }
1293
+ function Ye({
1294
+ match: t,
1295
+ dismissedRange: e,
1296
+ state: o,
1297
+ transaction: n,
1298
+ editor: i,
1299
+ shouldResetDismissed: r,
1300
+ effectiveAllowSpaces: s
1301
+ }) {
1302
+ return r != null && r({
1303
+ editor: i,
1304
+ state: o,
1305
+ range: e,
1306
+ match: t,
1307
+ transaction: n,
1308
+ allowSpaces: s
1309
+ }) ? !1 : s ? t.range.from === e.from : t.range.from === e.from && !je(n);
1310
+ }
1311
+ function Ke({
1312
+ view: t,
1313
+ pluginKeyRef: e
1314
+ }) {
1315
+ const o = t.state.tr.setMeta(e, { exit: !0 });
1316
+ t.dispatch(o);
1317
+ }
1318
+ function Je({
1319
+ pluginKey: t,
1320
+ decorationTag: e,
1321
+ decorationClass: o,
1322
+ decorationContent: n,
1323
+ decorationEmptyClass: i,
1324
+ renderer: r,
1325
+ dispatchExit: s
1326
+ }) {
1327
+ return {
1328
+ /**
1329
+ * Call the keydown hook if suggestion is active.
1330
+ */
1331
+ handleKeyDown(c, a) {
1332
+ var u, f;
1333
+ const l = t.getState(c.state);
1334
+ return l.active ? a.key === "Escape" || a.key === "Esc" ? ((u = r == null ? void 0 : r.onKeyDown) == null || u.call(r, { view: c, event: a, range: l.range }), s(c), !0) : ((f = r == null ? void 0 : r.onKeyDown) == null ? void 0 : f.call(r, { view: c, event: a, range: l.range })) || !1 : !1;
1335
+ },
1336
+ /**
1337
+ * Setup decorator on the currently active suggestion.
1338
+ */
1339
+ decorations(c) {
1340
+ const a = t.getState(c), { active: u, range: f, decorationId: l, query: g } = a;
1341
+ if (!u)
1342
+ return null;
1343
+ const d = !(g != null && g.length), p = [o];
1344
+ return d && p.push(i), Qt.create(c.doc, [
1345
+ Gt.inline(f.from, f.to, {
1346
+ nodeName: e,
1347
+ class: p.join(" "),
1348
+ "data-decoration-id": l || void 0,
1349
+ "data-decoration-content": n
1350
+ })
1351
+ ]);
1352
+ }
1353
+ };
1354
+ }
1355
+ function Qe({
1356
+ editor: t,
1357
+ char: e,
1358
+ effectiveAllowSpaces: o,
1359
+ allowToIncludeChar: n,
1360
+ allowedPrefixes: i,
1361
+ startOfLine: r,
1362
+ findSuggestionMatch: s,
1363
+ allow: c,
1364
+ shouldShow: a,
1365
+ shouldKeepDismissed: u,
1366
+ pluginKey: f
1367
+ }) {
1368
+ return {
1369
+ /**
1370
+ * Initialize the plugin's internal state.
1371
+ */
1372
+ init() {
1373
+ return {
1374
+ active: !1,
1375
+ range: { from: 0, to: 0 },
1376
+ query: null,
1377
+ text: null,
1378
+ composing: !1,
1379
+ dismissedRange: null
1380
+ };
1381
+ },
1382
+ /**
1383
+ * Apply changes to the plugin state from a view transaction.
1384
+ */
1385
+ apply(l, g, d, p) {
1386
+ const { isEditable: w } = t, { composing: h } = t.view, { selection: x } = l, { empty: v, from: y } = x, m = { ...g }, A = l.getMeta(f);
1387
+ if (A && A.exit)
1388
+ return m.active = !1, m.decorationId = null, m.range = { from: 0, to: 0 }, m.query = null, m.text = null, m.dismissedRange = g.active ? { ...g.range } : g.dismissedRange, m;
1389
+ if (m.composing = h, l.docChanged && m.dismissedRange !== null && (m.dismissedRange = {
1390
+ from: l.mapping.map(m.dismissedRange.from),
1391
+ to: l.mapping.map(m.dismissedRange.to)
1392
+ }), w && (v || t.view.composing)) {
1393
+ (y < g.range.from || y > g.range.to) && !h && !g.composing && (m.active = !1);
1394
+ const b = s({
1395
+ char: e,
1396
+ allowSpaces: o,
1397
+ allowToIncludeChar: n,
1398
+ allowedPrefixes: i,
1399
+ startOfLine: r,
1400
+ $position: x.$from
1401
+ }), O = `id_${Math.floor(Math.random() * 4294967295)}`;
1402
+ b && c({
1403
+ editor: t,
1404
+ state: p,
1405
+ range: b.range,
1406
+ isActive: g.active
1407
+ }) && (!a || a({
1408
+ editor: t,
1409
+ range: b.range,
1410
+ query: b.query,
1411
+ text: b.text,
1412
+ transaction: l
1413
+ })) ? (m.dismissedRange !== null && !u({
1414
+ match: b,
1415
+ dismissedRange: m.dismissedRange,
1416
+ state: p,
1417
+ transaction: l
1418
+ }) && (m.dismissedRange = null), m.dismissedRange === null ? (m.active = !0, m.decorationId = g.decorationId || O, m.range = b.range, m.query = b.query, m.text = b.text) : m.active = !1) : (b || (m.dismissedRange = null), m.active = !1);
1419
+ } else
1420
+ m.active = !1;
1421
+ return m.active || (m.decorationId = null, m.range = { from: 0, to: 0 }, m.query = null, m.text = null), m;
1422
+ }
1423
+ };
1424
+ }
1425
+ function Ge({
1426
+ editor: t,
1427
+ items: e
1428
+ }) {
1429
+ let o = null, n = null, i = null;
1430
+ const r = () => {
1431
+ n !== null && (clearTimeout(n), n = null), i == null || i(), i = null;
1432
+ }, s = (u) => new Promise((f) => {
1433
+ i = f, n = setTimeout(() => {
1434
+ n = null;
1435
+ const l = i;
1436
+ i = null, l == null || l();
1437
+ }, u);
1438
+ }), c = () => {
1439
+ o == null || o.abort(), r(), o = null;
1440
+ };
1441
+ return {
1442
+ abort: c,
1443
+ fetch: async (u, f) => {
1444
+ c(), o = new AbortController();
1445
+ const l = o;
1446
+ if (f > 0 && await s(f), o !== l || l.signal.aborted)
1447
+ return { status: "aborted" };
1448
+ try {
1449
+ const g = await e({
1450
+ editor: t,
1451
+ query: u,
1452
+ signal: l.signal
1453
+ });
1454
+ return o !== l || l.signal.aborted ? { status: "aborted" } : { status: "resolved", items: g };
1455
+ } catch {
1456
+ return o !== l || l.signal.aborted ? { status: "aborted" } : { status: "error" };
1457
+ }
1458
+ }
1459
+ };
1460
+ }
1461
+ function Ze({
1462
+ placement: t,
1463
+ offset: e,
1464
+ flip: o,
1465
+ floatingUi: n
1466
+ }) {
1467
+ var i, r, s, c;
1468
+ const a = [
1469
+ He({
1470
+ mainAxis: (i = e.mainAxis) != null ? i : 4,
1471
+ crossAxis: (r = e.crossAxis) != null ? r : 0
1472
+ })
1473
+ ];
1474
+ return o && a.push(Ve()), (s = n == null ? void 0 : n.middleware) != null && s.length && a.push(...n.middleware), {
1475
+ placement: t,
1476
+ strategy: (c = n == null ? void 0 : n.strategy) != null ? c : "absolute",
1477
+ middleware: a
1478
+ };
1479
+ }
1480
+ function tn(t) {
1481
+ if (t instanceof HTMLElement)
1482
+ return t;
1483
+ if (typeof t == "string")
1484
+ try {
1485
+ const e = document.querySelector(t);
1486
+ if (e)
1487
+ return e;
1488
+ } catch {
1489
+ return document.body;
1490
+ }
1491
+ return document.body;
1492
+ }
1493
+ function en({
1494
+ getReferenceRect: t,
1495
+ contextElement: e,
1496
+ config: o,
1497
+ container: n,
1498
+ dismissOnOutsideClick: i,
1499
+ dismiss: r
1500
+ }) {
1501
+ return (s, c = {}) => {
1502
+ const a = {
1503
+ getBoundingClientRect: () => {
1504
+ var p;
1505
+ return (p = t()) != null ? p : new DOMRect();
1506
+ },
1507
+ contextElement: e
1508
+ };
1509
+ let u = !1;
1510
+ const f = !s.isConnected;
1511
+ f && tn(n).appendChild(s), c.onPosition || (s.style.visibility = "hidden", s.style.width = "max-content");
1512
+ const g = qe(a, s, () => {
1513
+ Ie(a, s, {
1514
+ placement: o.placement,
1515
+ strategy: o.strategy,
1516
+ middleware: o.middleware
1517
+ }).then(({ x: p, y: w, placement: h, strategy: x }) => {
1518
+ if (c.onPosition) {
1519
+ c.onPosition({ x: p, y: w, placement: h, strategy: x });
1520
+ return;
1521
+ }
1522
+ Object.assign(s.style, {
1523
+ position: x,
1524
+ left: `${p}px`,
1525
+ top: `${w}px`
1526
+ }), u || (u = !0, s.style.visibility = "");
1527
+ });
1528
+ }, c.autoUpdate);
1529
+ let d;
1530
+ return i && (d = (p) => {
1531
+ const w = p.target;
1532
+ !(w instanceof Node) || s.contains(w) || e.contains(w) || r();
1533
+ }, document.addEventListener("pointerdown", d, !0)), () => {
1534
+ g(), d && document.removeEventListener("pointerdown", d, !0), f && s.remove();
1535
+ };
1536
+ };
1537
+ }
1538
+ function nn({
1539
+ editor: t,
1540
+ pluginKey: e,
1541
+ items: o,
1542
+ renderer: n,
1543
+ minQueryLength: i,
1544
+ debounce: r,
1545
+ initialItems: s,
1546
+ placement: c,
1547
+ offset: a,
1548
+ container: u,
1549
+ flip: f,
1550
+ floatingUi: l,
1551
+ dismissOnOutsideClick: g,
1552
+ command: d,
1553
+ clientRectFor: p,
1554
+ dispatchExit: w
1555
+ }) {
1556
+ let h;
1557
+ const x = Ge({
1558
+ editor: t,
1559
+ items: o
1560
+ }), v = Ze({
1561
+ placement: c,
1562
+ offset: a,
1563
+ flip: f,
1564
+ floatingUi: l
1565
+ });
1566
+ function y(m, A) {
1567
+ var b, O, D;
1568
+ switch (m) {
1569
+ case "started":
1570
+ (b = n == null ? void 0 : n.onStart) == null || b.call(n, A);
1571
+ break;
1572
+ case "updated":
1573
+ (O = n == null ? void 0 : n.onUpdate) == null || O.call(n, A);
1574
+ break;
1575
+ case "stopped":
1576
+ (D = n == null ? void 0 : n.onExit) == null || D.call(n, A);
1577
+ break;
1578
+ }
1579
+ }
1580
+ return {
1581
+ update: async (m, A) => {
1582
+ var b, O, D, L;
1583
+ const R = e.getState(A), C = e.getState(m.state);
1584
+ if (!R || !C)
1585
+ return;
1586
+ let S = null;
1587
+ const M = R.query !== C.query, P = R.text !== C.text, $ = R.range.from !== C.range.from || R.range.to !== C.range.to, T = M || P || $;
1588
+ if (!R.active && C.active)
1589
+ S = "started";
1590
+ else if (R.active && !C.active)
1591
+ S = "stopped";
1592
+ else if (C.active && T)
1593
+ S = "updated";
1594
+ else
1595
+ return;
1596
+ const E = S === "stopped" ? R : C, F = m.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`), W = p(m, F), dt = i === 0 || (E.query ? E.query.length >= i : !1), St = (S === "started" || S === "updated") && dt;
1597
+ if (h = {
1598
+ editor: t,
1599
+ range: E.range,
1600
+ query: E.query || "",
1601
+ text: E.text || "",
1602
+ items: s ?? [],
1603
+ command: (et) => d({
1604
+ editor: t,
1605
+ range: E.range,
1606
+ props: et
1607
+ }),
1608
+ decorationNode: F,
1609
+ clientRect: W,
1610
+ loading: St,
1611
+ placement: c,
1612
+ offset: { mainAxis: (b = a.mainAxis) != null ? b : 4, crossAxis: (O = a.crossAxis) != null ? O : 0 },
1613
+ container: u,
1614
+ flip: f,
1615
+ floatingUi: v,
1616
+ mount: en({
1617
+ getReferenceRect: W,
1618
+ contextElement: m.dom,
1619
+ config: v,
1620
+ container: u,
1621
+ dismissOnOutsideClick: g,
1622
+ dismiss: () => w(t.view)
1623
+ })
1624
+ }, S === "started" && ((D = n == null ? void 0 : n.onBeforeStart) == null || D.call(n, h)), S === "updated" && ((L = n == null ? void 0 : n.onBeforeUpdate) == null || L.call(n, h)), S === "started" && y(S, h), S === "started" || S === "updated")
1625
+ if (!St)
1626
+ x.abort(), h = { ...h, items: s ?? [], loading: !1 };
1627
+ else {
1628
+ h = { ...h, items: s ?? [], loading: !0 }, S = "updated", y(S, h);
1629
+ const et = await x.fetch(E.query || "", r);
1630
+ if (et.status === "aborted")
1631
+ return;
1632
+ const At = e.getState(m.state);
1633
+ if (!(At != null && At.active)) {
1634
+ x.abort();
1635
+ return;
1636
+ }
1637
+ h = et.status === "resolved" ? {
1638
+ ...h,
1639
+ items: et.items,
1640
+ loading: !1
1641
+ } : {
1642
+ ...h,
1643
+ loading: !1
1644
+ };
1645
+ }
1646
+ if (S === "stopped") {
1647
+ x.abort(), y(S, h), h = void 0;
1648
+ return;
1649
+ }
1650
+ S === "updated" && y(S, h);
1651
+ },
1652
+ destroy: () => {
1653
+ var m;
1654
+ x.abort(), h && ((m = n == null ? void 0 : n.onExit) == null || m.call(n, h));
1655
+ }
1656
+ };
1657
+ }
1658
+ var on = new Yt("suggestion");
1659
+ function mn({
1660
+ pluginKey: t = on,
1661
+ editor: e,
1662
+ char: o = "@",
1663
+ allowSpaces: n = !1,
1664
+ allowToIncludeChar: i = !1,
1665
+ allowedPrefixes: r = [" "],
1666
+ startOfLine: s = !1,
1667
+ decorationTag: c = "span",
1668
+ decorationClass: a = "suggestion",
1669
+ decorationContent: u = "",
1670
+ decorationEmptyClass: f = "is-empty",
1671
+ command: l = () => null,
1672
+ items: g = () => [],
1673
+ minQueryLength: d = 0,
1674
+ debounce: p = 0,
1675
+ initialItems: w,
1676
+ placement: h = "bottom-start",
1677
+ offset: x = {},
1678
+ container: v,
1679
+ flip: y = !0,
1680
+ floatingUi: m,
1681
+ dismissOnOutsideClick: A = !0,
1682
+ render: b = () => ({}),
1683
+ allow: O = () => !0,
1684
+ findSuggestionMatch: D = ze,
1685
+ shouldShow: L,
1686
+ shouldResetDismissed: R
1687
+ }) {
1688
+ const C = b == null ? void 0 : b(), S = n && !i, M = (T, E) => Ue(e, T, E, t);
1689
+ function P(T) {
1690
+ return Ye({
1691
+ ...T,
1692
+ editor: e,
1693
+ shouldResetDismissed: R,
1694
+ effectiveAllowSpaces: S
1695
+ });
1696
+ }
1697
+ const $ = (T) => Ke({
1698
+ view: T,
1699
+ pluginKeyRef: t
1700
+ });
1701
+ return new Kt({
1702
+ key: t,
1703
+ view: () => nn({
1704
+ editor: e,
1705
+ pluginKey: t,
1706
+ items: g,
1707
+ renderer: C,
1708
+ minQueryLength: d,
1709
+ debounce: p,
1710
+ initialItems: w,
1711
+ placement: h,
1712
+ offset: x,
1713
+ container: v,
1714
+ flip: y,
1715
+ floatingUi: m,
1716
+ dismissOnOutsideClick: A,
1717
+ command: l,
1718
+ clientRectFor: M,
1719
+ dispatchExit: $
1720
+ }),
1721
+ state: Qe({
1722
+ editor: e,
1723
+ char: o,
1724
+ effectiveAllowSpaces: S,
1725
+ allowToIncludeChar: i,
1726
+ allowedPrefixes: r,
1727
+ startOfLine: s,
1728
+ findSuggestionMatch: D,
1729
+ allow: O,
1730
+ shouldShow: L,
1731
+ shouldKeepDismissed: P,
1732
+ pluginKey: t
1733
+ }),
1734
+ props: Je({
1735
+ pluginKey: t,
1736
+ decorationTag: c,
1737
+ decorationClass: a,
1738
+ decorationContent: u,
1739
+ decorationEmptyClass: f,
1740
+ renderer: C,
1741
+ dispatchExit: $
1742
+ })
1743
+ });
1744
+ }
1745
+ export {
1746
+ mn as S,
1747
+ dn as a,
1748
+ fn as b,
1749
+ Ie as c,
1750
+ ln as d,
1751
+ Ve as f,
1752
+ un as h,
1753
+ gn as i,
1754
+ He as o,
1755
+ an as s
1756
+ };