reactjs-tiptap-editor 0.4.2 → 1.0.1

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 (338) hide show
  1. package/lib/ActionMenuButton-BKOg7hkq.js +38 -0
  2. package/lib/ActionMenuButton-DLQyd_gx.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.d.cts +27 -39
  5. package/lib/Attachment.d.ts +27 -39
  6. package/lib/Attachment.js +129 -99
  7. package/lib/Blockquote.cjs +3 -3
  8. package/lib/Blockquote.d.cts +27 -39
  9. package/lib/Blockquote.d.ts +27 -39
  10. package/lib/Blockquote.js +50 -22
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +27 -39
  13. package/lib/Bold.d.ts +27 -39
  14. package/lib/Bold.js +48 -20
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +27 -39
  17. package/lib/BulletList.d.ts +27 -39
  18. package/lib/BulletList.js +38 -9
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +27 -39
  21. package/lib/Clear.d.ts +27 -39
  22. package/lib/Clear.js +32 -6
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +27 -39
  25. package/lib/Code.d.ts +27 -39
  26. package/lib/Code.js +53 -25
  27. package/lib/CodeBlock.cjs +35 -35
  28. package/lib/CodeBlock.d.cts +27 -39
  29. package/lib/CodeBlock.d.ts +27 -39
  30. package/lib/CodeBlock.js +605 -590
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +28 -40
  33. package/lib/CodeView.d.ts +28 -40
  34. package/lib/CodeView.js +49 -21
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +31 -39
  37. package/lib/Color.d.ts +31 -39
  38. package/lib/Color.js +123 -79
  39. package/lib/Column.cjs +1 -0
  40. package/lib/{Document.d.cts → Column.d.cts} +33 -42
  41. package/lib/{Document.d.ts → Column.d.ts} +33 -42
  42. package/lib/Column.js +217 -0
  43. package/lib/{Drawer-CaAfmqNo.js → Drawer-DZ5jvmrX.js} +404 -394
  44. package/lib/Drawer-SRhwOc6T.cjs +1 -0
  45. package/lib/Drawer.cjs +1 -1
  46. package/lib/Drawer.d.cts +27 -39
  47. package/lib/Drawer.d.ts +27 -39
  48. package/lib/Drawer.js +6 -5
  49. package/lib/Emoji.cjs +1 -1
  50. package/lib/Emoji.d.cts +27 -44
  51. package/lib/Emoji.d.ts +27 -44
  52. package/lib/Emoji.js +377 -392
  53. package/lib/Excalidraw-DwBRXEtC.js +345 -0
  54. package/lib/Excalidraw-ZN3DQvDC.cjs +1 -0
  55. package/lib/Excalidraw.cjs +1 -1
  56. package/lib/Excalidraw.d.cts +27 -39
  57. package/lib/Excalidraw.d.ts +27 -39
  58. package/lib/Excalidraw.js +6 -4
  59. package/lib/ExportPdf.cjs +5 -5
  60. package/lib/ExportPdf.d.cts +27 -39
  61. package/lib/ExportPdf.d.ts +27 -39
  62. package/lib/ExportPdf.js +60 -32
  63. package/lib/ExportWord.cjs +1 -1
  64. package/lib/ExportWord.d.cts +28 -40
  65. package/lib/ExportWord.d.ts +28 -40
  66. package/lib/ExportWord.js +84 -21
  67. package/lib/FontFamily.cjs +1 -1
  68. package/lib/FontFamily.d.cts +41 -42
  69. package/lib/FontFamily.d.ts +41 -42
  70. package/lib/FontFamily.js +72 -74
  71. package/lib/FontSize.cjs +1 -1
  72. package/lib/FontSize.d.cts +38 -42
  73. package/lib/FontSize.d.ts +38 -42
  74. package/lib/FontSize.js +72 -64
  75. package/lib/Heading.cjs +1 -1
  76. package/lib/Heading.d.cts +41 -39
  77. package/lib/Heading.d.ts +41 -39
  78. package/lib/Heading.js +91 -73
  79. package/lib/Highlight.cjs +1 -1
  80. package/lib/Highlight.d.cts +31 -39
  81. package/lib/Highlight.d.ts +31 -39
  82. package/lib/Highlight.js +150 -19
  83. package/lib/History.cjs +1 -1
  84. package/lib/History.d.cts +29 -39
  85. package/lib/History.d.ts +29 -39
  86. package/lib/History.js +976 -53
  87. package/lib/HorizontalRule.cjs +1 -1
  88. package/lib/HorizontalRule.d.cts +27 -39
  89. package/lib/HorizontalRule.d.ts +27 -39
  90. package/lib/HorizontalRule.js +97 -17
  91. package/lib/Icon-DUpv2cI6.cjs +1 -0
  92. package/lib/Icon-jKs8Hr6p.js +11 -0
  93. package/lib/Iframe-CmXkEqOd.js +431 -0
  94. package/lib/Iframe-Cvca2G7X.cjs +1 -0
  95. package/lib/Iframe.cjs +1 -1
  96. package/lib/Iframe.d.cts +26 -45
  97. package/lib/Iframe.d.ts +26 -45
  98. package/lib/Iframe.js +6 -4
  99. package/lib/Image.cjs +1 -1
  100. package/lib/Image.d.cts +27 -40
  101. package/lib/Image.d.ts +27 -40
  102. package/lib/Image.js +848 -5
  103. package/lib/ImageGif.cjs +1 -1
  104. package/lib/ImageGif.d.cts +28 -42
  105. package/lib/ImageGif.d.ts +28 -42
  106. package/lib/ImageGif.js +424 -5
  107. package/lib/ImportWord.cjs +48 -48
  108. package/lib/ImportWord.d.cts +28 -40
  109. package/lib/ImportWord.d.ts +28 -40
  110. package/lib/ImportWord.js +2759 -2751
  111. package/lib/Indent.cjs +1 -1
  112. package/lib/Indent.d.cts +27 -39
  113. package/lib/Indent.d.ts +27 -39
  114. package/lib/Indent.js +97 -27
  115. package/lib/Italic.cjs +1 -1
  116. package/lib/Italic.d.cts +27 -39
  117. package/lib/Italic.d.ts +27 -39
  118. package/lib/Italic.js +47 -19
  119. package/lib/Katex-DsYXsjSS.js +2740 -0
  120. package/lib/Katex-XfrNne6U.cjs +4 -0
  121. package/lib/Katex.cjs +1 -1
  122. package/lib/Katex.d.cts +27 -39
  123. package/lib/Katex.d.ts +27 -39
  124. package/lib/Katex.js +5 -196
  125. package/lib/LineHeight.cjs +1 -1
  126. package/lib/LineHeight.d.cts +29 -45
  127. package/lib/LineHeight.d.ts +29 -45
  128. package/lib/LineHeight.js +71 -112
  129. package/lib/Link.cjs +1 -1
  130. package/lib/Link.d.cts +28 -42
  131. package/lib/Link.d.ts +28 -42
  132. package/lib/Link.js +3 -3
  133. package/lib/LinkEditBlock-BZenZq-Z.cjs +5 -0
  134. package/lib/LinkEditBlock-CB8yIffE.js +1241 -0
  135. package/lib/Mention.cjs +1 -1
  136. package/lib/Mention.d.cts +24 -39
  137. package/lib/Mention.d.ts +24 -39
  138. package/lib/Mention.js +112 -124
  139. package/lib/Mermaid.cjs +2 -2
  140. package/lib/Mermaid.d.cts +27 -39
  141. package/lib/Mermaid.d.ts +27 -39
  142. package/lib/Mermaid.js +177 -165
  143. package/lib/MoreMark.cjs +1 -1
  144. package/lib/MoreMark.d.cts +42 -41
  145. package/lib/MoreMark.d.ts +42 -41
  146. package/lib/MoreMark.js +125 -55
  147. package/lib/OrderedList.cjs +1 -1
  148. package/lib/OrderedList.d.cts +27 -39
  149. package/lib/OrderedList.d.ts +27 -39
  150. package/lib/OrderedList.js +37 -9
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +27 -42
  153. package/lib/SearchAndReplace.d.ts +27 -42
  154. package/lib/SearchAndReplace.js +221 -197
  155. package/lib/SlashCommand.cjs +1 -1
  156. package/lib/SlashCommand.d.cts +39 -46
  157. package/lib/SlashCommand.d.ts +39 -46
  158. package/lib/SlashCommand.js +235 -249
  159. package/lib/Strike.cjs +1 -1
  160. package/lib/Strike.d.cts +27 -39
  161. package/lib/Strike.d.ts +27 -39
  162. package/lib/Strike.js +39 -11
  163. package/lib/Table-B1j1Ebmh.cjs +9 -0
  164. package/lib/Table-Db8TcQX8.js +1984 -0
  165. package/lib/Table.cjs +1 -9
  166. package/lib/Table.d.cts +28 -42
  167. package/lib/Table.d.ts +28 -42
  168. package/lib/Table.js +3 -558
  169. package/lib/TaskList.cjs +1 -1
  170. package/lib/TaskList.d.cts +27 -39
  171. package/lib/TaskList.d.ts +27 -39
  172. package/lib/TaskList.js +38 -10
  173. package/lib/TextAlign.cjs +1 -1
  174. package/lib/TextAlign.d.cts +40 -39
  175. package/lib/TextAlign.d.ts +40 -39
  176. package/lib/TextAlign.js +108 -101
  177. package/lib/TextDirection.cjs +1 -1
  178. package/lib/TextDirection.d.cts +56 -39
  179. package/lib/TextDirection.d.ts +56 -39
  180. package/lib/TextDirection.js +105 -112
  181. package/lib/TextUnderline.cjs +1 -1
  182. package/lib/TextUnderline.d.cts +27 -39
  183. package/lib/TextUnderline.d.ts +27 -39
  184. package/lib/TextUnderline.js +46 -18
  185. package/lib/{Twitter-BFULyqdR.js → Twitter-CXmmjz9R.js} +536 -498
  186. package/lib/Twitter-CtVTIWJW.cjs +1 -0
  187. package/lib/Twitter.cjs +1 -1
  188. package/lib/Twitter.d.cts +27 -39
  189. package/lib/Twitter.d.ts +27 -39
  190. package/lib/Twitter.js +5 -4
  191. package/lib/Video.cjs +1 -1
  192. package/lib/Video.d.cts +27 -39
  193. package/lib/Video.d.ts +27 -39
  194. package/lib/Video.js +261 -4
  195. package/lib/_commonjsHelpers-BItOPCY9.js +28 -0
  196. package/lib/_commonjsHelpers-BTDuMlIz.cjs +1 -0
  197. package/lib/bubble.cjs +2 -0
  198. package/lib/{bubble-extra.d.cts → bubble.d.cts} +53 -54
  199. package/lib/{bubble-extra.d.ts → bubble.d.ts} +53 -54
  200. package/lib/bubble.js +1925 -0
  201. package/lib/button-B12K7BJ4.cjs +1 -0
  202. package/lib/button-DXMsXUEn.js +43 -0
  203. package/lib/clsx-C11secjj.cjs +1 -0
  204. package/lib/clsx-OuTLNxxd.js +16 -0
  205. package/lib/delete-node-CosiBes5.cjs +1 -0
  206. package/lib/delete-node-IyVmiRbI.js +22 -0
  207. package/lib/dialog-CaCS-W5S.cjs +1 -0
  208. package/lib/dialog-PtQivpHS.js +100 -0
  209. package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
  210. package/lib/dom-dataset-CIEeltF6.js +47 -0
  211. package/lib/dropdown-menu-BPp2Z_U-.js +136 -0
  212. package/lib/dropdown-menu-CdSm4emp.cjs +1 -0
  213. package/lib/file-BLas99n7.js +43 -0
  214. package/lib/file-i7e4nQY2.cjs +1 -0
  215. package/lib/floating-ui.dom-U1vPFQ5f.js +1151 -0
  216. package/lib/floating-ui.dom-VCrc58uF.cjs +1 -0
  217. package/lib/icons-Cllpys39.js +362 -0
  218. package/lib/icons-CqHjeW5T.cjs +1 -0
  219. package/lib/index-BH4bc3jN.cjs +33 -0
  220. package/lib/index-BPfVXs5_.js +2380 -0
  221. package/lib/index-Bnmd0WvY.js +1631 -0
  222. package/lib/{index-Ch6dBBad.js → index-CBce_TWY.js} +40 -42
  223. package/lib/{index-5iBZLua9.cjs → index-D-5U8dY8.cjs} +8 -8
  224. package/lib/{index-ByurDDMv.js → index-D2TUfKkC.js} +2 -2
  225. package/lib/index-DV5kbgRU.cjs +1 -0
  226. package/lib/{index-LmrOdnen.js → index-DYkucCoF.js} +396 -495
  227. package/lib/index-Dfmm6FTT.cjs +1 -0
  228. package/lib/index-DnWWK9F_.js +6374 -0
  229. package/lib/index-DzcKxutn.js +632 -0
  230. package/lib/index-DzvuNTxo.cjs +4 -0
  231. package/lib/{index-BeCTd5v2.cjs → index-N--9MohJ.cjs} +1 -1
  232. package/lib/index-RfTlOzIr.cjs +22 -0
  233. package/lib/index.cjs +132 -1
  234. package/lib/index.d.cts +29 -280
  235. package/lib/index.d.ts +29 -280
  236. package/lib/index.js +243 -2
  237. package/lib/input-_ECRfn3Y.cjs +1 -0
  238. package/lib/input-wJ9PDEzZ.js +21 -0
  239. package/lib/isNumber-ClPupm7P.cjs +1 -0
  240. package/lib/isNumber-fpLGS0AZ.js +15 -0
  241. package/lib/label-BkgAe7IY.cjs +1 -0
  242. package/lib/label-CGdLYWv7.js +19 -0
  243. package/lib/locale-bundle.cjs +1 -1
  244. package/lib/locale-bundle.d.cts +5405 -57
  245. package/lib/locale-bundle.d.ts +5405 -57
  246. package/lib/locale-bundle.js +9 -7
  247. package/lib/popover-BgmUNMHj.cjs +1 -0
  248. package/lib/popover-CAuEW0Mr.js +23 -0
  249. package/lib/separator-CuBW_w98.js +328 -0
  250. package/lib/separator-DRIrVZ2N.cjs +1 -0
  251. package/lib/store-DX599H5W.js +10 -0
  252. package/lib/store-WStcMOiW.cjs +1 -0
  253. package/lib/style.css +1 -1
  254. package/lib/switch-CnLJ7Y-b.cjs +1 -0
  255. package/lib/switch-Coix_FA1.js +27 -0
  256. package/lib/tabs-B5mVSN1I.js +46 -0
  257. package/lib/tabs-BoLCMcCI.cjs +1 -0
  258. package/lib/textarea-B-6zTKQz.cjs +1 -0
  259. package/lib/{textarea-aPtytkDx.js → textarea-DUUM1jZd.js} +1 -1
  260. package/lib/theme-B7aAsK_T.js +15 -0
  261. package/lib/theme-D8_cxGqB.cjs +1 -0
  262. package/lib/throttle-CdwDrFpn.js +249 -0
  263. package/lib/throttle-qX7Yjtsg.cjs +1 -0
  264. package/lib/toggle-Cdp4IT2U.js +85 -0
  265. package/lib/toggle-D41PzQLJ.cjs +1 -0
  266. package/lib/tooltip-BuEiE96N.cjs +1 -0
  267. package/lib/tooltip-CopwsU8q.js +23 -0
  268. package/lib/updatePosition-8Sdem5jb.cjs +1 -0
  269. package/lib/updatePosition-BPmcE0YD.js +215 -0
  270. package/lib/use-toast-Bz3QCOtE.cjs +1 -0
  271. package/lib/use-toast-Crf7-q5H.js +98 -0
  272. package/lib/useButtonProps-BsEd4zYM.js +141 -0
  273. package/lib/useButtonProps-C6Vpn190.cjs +1 -0
  274. package/package.json +22 -105
  275. package/lib/ActionMenuButton-CYdM1xx5.cjs +0 -1
  276. package/lib/ActionMenuButton-DKRF6oa0.js +0 -33
  277. package/lib/BaseKit.cjs +0 -3
  278. package/lib/BaseKit.d.cts +0 -481
  279. package/lib/BaseKit.d.ts +0 -481
  280. package/lib/BaseKit.js +0 -132
  281. package/lib/Document.cjs +0 -1
  282. package/lib/Document.js +0 -9
  283. package/lib/Drawer-CdvCMSzN.cjs +0 -1
  284. package/lib/Excalidraw-BbMQhNvs.cjs +0 -1
  285. package/lib/Excalidraw-CVWz2Vyn.js +0 -290
  286. package/lib/FormatPainter.cjs +0 -1
  287. package/lib/FormatPainter.d.cts +0 -372
  288. package/lib/FormatPainter.d.ts +0 -372
  289. package/lib/FormatPainter.js +0 -76
  290. package/lib/ListItem.cjs +0 -1
  291. package/lib/ListItem.d.cts +0 -290
  292. package/lib/ListItem.d.ts +0 -290
  293. package/lib/ListItem.js +0 -7
  294. package/lib/MultiColumn.cjs +0 -1
  295. package/lib/MultiColumn.d.cts +0 -294
  296. package/lib/MultiColumn.d.ts +0 -294
  297. package/lib/MultiColumn.js +0 -8
  298. package/lib/RichTextEditor-CxvwGvQG.cjs +0 -142
  299. package/lib/RichTextEditor-DGcKEUGr.js +0 -22166
  300. package/lib/Selection.cjs +0 -1
  301. package/lib/Selection.d.cts +0 -289
  302. package/lib/Selection.d.ts +0 -289
  303. package/lib/Selection.js +0 -25
  304. package/lib/SubAndSuperScript.cjs +0 -1
  305. package/lib/SubAndSuperScript.d.cts +0 -377
  306. package/lib/SubAndSuperScript.d.ts +0 -377
  307. package/lib/SubAndSuperScript.js +0 -43
  308. package/lib/TableOfContent.cjs +0 -1
  309. package/lib/TableOfContent.d.cts +0 -291
  310. package/lib/TableOfContent.d.ts +0 -291
  311. package/lib/TableOfContent.js +0 -185
  312. package/lib/TextBubble.cjs +0 -1
  313. package/lib/TextBubble.d.cts +0 -362
  314. package/lib/TextBubble.d.ts +0 -362
  315. package/lib/TextBubble.js +0 -133
  316. package/lib/TrailingNode.cjs +0 -1
  317. package/lib/TrailingNode.d.cts +0 -297
  318. package/lib/TrailingNode.d.ts +0 -297
  319. package/lib/TrailingNode.js +0 -41
  320. package/lib/Twitter-Cutpkh3h.cjs +0 -1
  321. package/lib/bubble-extra.cjs +0 -2
  322. package/lib/bubble-extra.js +0 -631
  323. package/lib/dom-dataset-_6-diIRQ.cjs +0 -33
  324. package/lib/dom-dataset-lYeH6gfI.js +0 -2361
  325. package/lib/index-6D1J-A-o.cjs +0 -1
  326. package/lib/index-B96Cclrj.cjs +0 -3
  327. package/lib/index-BBz7Nmv9.js +0 -55
  328. package/lib/index-CUogRI7j.cjs +0 -1
  329. package/lib/index-DF2Lp4HZ.cjs +0 -100
  330. package/lib/index-D_L6n8O8.js +0 -76
  331. package/lib/index-Dbvi-Bvh.cjs +0 -1
  332. package/lib/index-DpCrt7xs.cjs +0 -1
  333. package/lib/index-DsAX1Vq8.cjs +0 -1
  334. package/lib/index-Dy4DlW9o.js +0 -12
  335. package/lib/index-J3jHHZ4d.js +0 -200
  336. package/lib/index-VvXaaKe3.js +0 -898
  337. package/lib/index-kbO3iWqL.js +0 -13432
  338. package/lib/textarea-DFo_aXnj.cjs +0 -1
@@ -1,2361 +0,0 @@
1
- import B, { createContext as st, useRef as Pt, useState as at, useDebugValue as ct, useEffect as lt, forwardRef as qt, useLayoutEffect as Mt, useContext as ut, createRef as Nt, memo as Vt, createElement as jt, version as Le } from "react";
2
- import It, { flushSync as Bt } from "react-dom";
3
- import { jsxs as Wt, Fragment as ft, jsx as Z } from "react/jsx-runtime";
4
- import { Q as $t, R as kt, U as Ft } from "./index-kbO3iWqL.js";
5
- var ae = { exports: {} }, ve = {};
6
- /**
7
- * @license React
8
- * use-sync-external-store-shim.production.js
9
- *
10
- * Copyright (c) Meta Platforms, Inc. and affiliates.
11
- *
12
- * This source code is licensed under the MIT license found in the
13
- * LICENSE file in the root directory of this source tree.
14
- */
15
- var Pe;
16
- function Ht() {
17
- if (Pe) return ve;
18
- Pe = 1;
19
- var e = B;
20
- function t(c, m) {
21
- return c === m && (c !== 0 || 1 / c === 1 / m) || c !== c && m !== m;
22
- }
23
- var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, i = e.useEffect, o = e.useLayoutEffect, s = e.useDebugValue;
24
- function a(c, m) {
25
- var f = m(), g = n({ inst: { value: f, getSnapshot: m } }), d = g[0].inst, p = g[1];
26
- return o(
27
- function() {
28
- d.value = f, d.getSnapshot = m, l(d) && p({ inst: d });
29
- },
30
- [c, f, m]
31
- ), i(
32
- function() {
33
- return l(d) && p({ inst: d }), c(function() {
34
- l(d) && p({ inst: d });
35
- });
36
- },
37
- [c]
38
- ), s(f), f;
39
- }
40
- function l(c) {
41
- var m = c.getSnapshot;
42
- c = c.value;
43
- try {
44
- var f = m();
45
- return !r(c, f);
46
- } catch {
47
- return !0;
48
- }
49
- }
50
- function u(c, m) {
51
- return m();
52
- }
53
- var h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : a;
54
- return ve.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : h, ve;
55
- }
56
- var ye = {};
57
- /**
58
- * @license React
59
- * use-sync-external-store-shim.development.js
60
- *
61
- * Copyright (c) Meta Platforms, Inc. and affiliates.
62
- *
63
- * This source code is licensed under the MIT license found in the
64
- * LICENSE file in the root directory of this source tree.
65
- */
66
- var qe;
67
- function Ut() {
68
- return qe || (qe = 1, process.env.NODE_ENV !== "production" && (function() {
69
- function e(f, g) {
70
- return f === g && (f !== 0 || 1 / f === 1 / g) || f !== f && g !== g;
71
- }
72
- function t(f, g) {
73
- h || i.startTransition === void 0 || (h = !0, console.error(
74
- "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
75
- ));
76
- var d = g();
77
- if (!c) {
78
- var p = g();
79
- o(d, p) || (console.error(
80
- "The result of getSnapshot should be cached to avoid an infinite loop"
81
- ), c = !0);
82
- }
83
- p = s({
84
- inst: { value: d, getSnapshot: g }
85
- });
86
- var v = p[0].inst, y = p[1];
87
- return l(
88
- function() {
89
- v.value = d, v.getSnapshot = g, r(v) && y({ inst: v });
90
- },
91
- [f, d, g]
92
- ), a(
93
- function() {
94
- return r(v) && y({ inst: v }), f(function() {
95
- r(v) && y({ inst: v });
96
- });
97
- },
98
- [f]
99
- ), u(d), d;
100
- }
101
- function r(f) {
102
- var g = f.getSnapshot;
103
- f = f.value;
104
- try {
105
- var d = g();
106
- return !o(f, d);
107
- } catch {
108
- return !0;
109
- }
110
- }
111
- function n(f, g) {
112
- return g();
113
- }
114
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
115
- var i = B, o = typeof Object.is == "function" ? Object.is : e, s = i.useState, a = i.useEffect, l = i.useLayoutEffect, u = i.useDebugValue, h = !1, c = !1, m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? n : t;
116
- ye.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : m, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
117
- })()), ye;
118
- }
119
- var Me;
120
- function Re() {
121
- return Me || (Me = 1, process.env.NODE_ENV === "production" ? ae.exports = Ht() : ae.exports = Ut()), ae.exports;
122
- }
123
- var dt = Re(), Gt = Object.getOwnPropertyNames, zt = Object.getOwnPropertySymbols, Kt = Object.prototype.hasOwnProperty;
124
- function Ne(e, t) {
125
- return function(n, i, o) {
126
- return e(n, i, o) && t(n, i, o);
127
- };
128
- }
129
- function ce(e) {
130
- return function(r, n, i) {
131
- if (!r || !n || typeof r != "object" || typeof n != "object")
132
- return e(r, n, i);
133
- var o = i.cache, s = o.get(r), a = o.get(n);
134
- if (s && a)
135
- return s === n && a === r;
136
- o.set(r, n), o.set(n, r);
137
- var l = e(r, n, i);
138
- return o.delete(r), o.delete(n), l;
139
- };
140
- }
141
- function Xt(e) {
142
- return e != null ? e[Symbol.toStringTag] : void 0;
143
- }
144
- function Ve(e) {
145
- return Gt(e).concat(zt(e));
146
- }
147
- var Yt = (
148
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
149
- Object.hasOwn || (function(e, t) {
150
- return Kt.call(e, t);
151
- })
152
- );
153
- function J(e, t) {
154
- return e === t || !e && !t && e !== e && t !== t;
155
- }
156
- var Jt = "__v", Qt = "__o", Zt = "_owner", je = Object.getOwnPropertyDescriptor, Ie = Object.keys;
157
- function en(e, t, r) {
158
- var n = e.length;
159
- if (t.length !== n)
160
- return !1;
161
- for (; n-- > 0; )
162
- if (!r.equals(e[n], t[n], n, n, e, t, r))
163
- return !1;
164
- return !0;
165
- }
166
- function tn(e, t) {
167
- return J(e.getTime(), t.getTime());
168
- }
169
- function nn(e, t) {
170
- return e.name === t.name && e.message === t.message && e.cause === t.cause && e.stack === t.stack;
171
- }
172
- function rn(e, t) {
173
- return e === t;
174
- }
175
- function Be(e, t, r) {
176
- var n = e.size;
177
- if (n !== t.size)
178
- return !1;
179
- if (!n)
180
- return !0;
181
- for (var i = new Array(n), o = e.entries(), s, a, l = 0; (s = o.next()) && !s.done; ) {
182
- for (var u = t.entries(), h = !1, c = 0; (a = u.next()) && !a.done; ) {
183
- if (i[c]) {
184
- c++;
185
- continue;
186
- }
187
- var m = s.value, f = a.value;
188
- if (r.equals(m[0], f[0], l, c, e, t, r) && r.equals(m[1], f[1], m[0], f[0], e, t, r)) {
189
- h = i[c] = !0;
190
- break;
191
- }
192
- c++;
193
- }
194
- if (!h)
195
- return !1;
196
- l++;
197
- }
198
- return !0;
199
- }
200
- var on = J;
201
- function sn(e, t, r) {
202
- var n = Ie(e), i = n.length;
203
- if (Ie(t).length !== i)
204
- return !1;
205
- for (; i-- > 0; )
206
- if (!ht(e, t, r, n[i]))
207
- return !1;
208
- return !0;
209
- }
210
- function ie(e, t, r) {
211
- var n = Ve(e), i = n.length;
212
- if (Ve(t).length !== i)
213
- return !1;
214
- for (var o, s, a; i-- > 0; )
215
- if (o = n[i], !ht(e, t, r, o) || (s = je(e, o), a = je(t, o), (s || a) && (!s || !a || s.configurable !== a.configurable || s.enumerable !== a.enumerable || s.writable !== a.writable)))
216
- return !1;
217
- return !0;
218
- }
219
- function an(e, t) {
220
- return J(e.valueOf(), t.valueOf());
221
- }
222
- function cn(e, t) {
223
- return e.source === t.source && e.flags === t.flags;
224
- }
225
- function We(e, t, r) {
226
- var n = e.size;
227
- if (n !== t.size)
228
- return !1;
229
- if (!n)
230
- return !0;
231
- for (var i = new Array(n), o = e.values(), s, a; (s = o.next()) && !s.done; ) {
232
- for (var l = t.values(), u = !1, h = 0; (a = l.next()) && !a.done; ) {
233
- if (!i[h] && r.equals(s.value, a.value, s.value, a.value, e, t, r)) {
234
- u = i[h] = !0;
235
- break;
236
- }
237
- h++;
238
- }
239
- if (!u)
240
- return !1;
241
- }
242
- return !0;
243
- }
244
- function ln(e, t) {
245
- var r = e.length;
246
- if (t.length !== r)
247
- return !1;
248
- for (; r-- > 0; )
249
- if (e[r] !== t[r])
250
- return !1;
251
- return !0;
252
- }
253
- function un(e, t) {
254
- return e.hostname === t.hostname && e.pathname === t.pathname && e.protocol === t.protocol && e.port === t.port && e.hash === t.hash && e.username === t.username && e.password === t.password;
255
- }
256
- function ht(e, t, r, n) {
257
- return (n === Zt || n === Qt || n === Jt) && (e.$$typeof || t.$$typeof) ? !0 : Yt(t, n) && r.equals(e[n], t[n], n, n, e, t, r);
258
- }
259
- var fn = "[object Arguments]", dn = "[object Boolean]", hn = "[object Date]", pn = "[object Error]", mn = "[object Map]", gn = "[object Number]", vn = "[object Object]", yn = "[object RegExp]", wn = "[object Set]", En = "[object String]", bn = "[object URL]", Sn = Array.isArray, $e = typeof ArrayBuffer < "u" && typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView : null, ke = Object.assign, xn = Object.prototype.toString.call.bind(Object.prototype.toString);
260
- function On(e) {
261
- var t = e.areArraysEqual, r = e.areDatesEqual, n = e.areErrorsEqual, i = e.areFunctionsEqual, o = e.areMapsEqual, s = e.areNumbersEqual, a = e.areObjectsEqual, l = e.arePrimitiveWrappersEqual, u = e.areRegExpsEqual, h = e.areSetsEqual, c = e.areTypedArraysEqual, m = e.areUrlsEqual, f = e.unknownTagComparators;
262
- return function(d, p, v) {
263
- if (d === p)
264
- return !0;
265
- if (d == null || p == null)
266
- return !1;
267
- var y = typeof d;
268
- if (y !== typeof p)
269
- return !1;
270
- if (y !== "object")
271
- return y === "number" ? s(d, p, v) : y === "function" ? i(d, p, v) : !1;
272
- var w = d.constructor;
273
- if (w !== p.constructor)
274
- return !1;
275
- if (w === Object)
276
- return a(d, p, v);
277
- if (Sn(d))
278
- return t(d, p, v);
279
- if ($e != null && $e(d))
280
- return c(d, p, v);
281
- if (w === Date)
282
- return r(d, p, v);
283
- if (w === RegExp)
284
- return u(d, p, v);
285
- if (w === Map)
286
- return o(d, p, v);
287
- if (w === Set)
288
- return h(d, p, v);
289
- var E = xn(d);
290
- if (E === hn)
291
- return r(d, p, v);
292
- if (E === yn)
293
- return u(d, p, v);
294
- if (E === mn)
295
- return o(d, p, v);
296
- if (E === wn)
297
- return h(d, p, v);
298
- if (E === vn)
299
- return typeof d.then != "function" && typeof p.then != "function" && a(d, p, v);
300
- if (E === bn)
301
- return m(d, p, v);
302
- if (E === pn)
303
- return n(d, p, v);
304
- if (E === fn)
305
- return a(d, p, v);
306
- if (E === dn || E === gn || E === En)
307
- return l(d, p, v);
308
- if (f) {
309
- var S = f[E];
310
- if (!S) {
311
- var b = Xt(d);
312
- b && (S = f[b]);
313
- }
314
- if (S)
315
- return S(d, p, v);
316
- }
317
- return !1;
318
- };
319
- }
320
- function Rn(e) {
321
- var t = e.circular, r = e.createCustomConfig, n = e.strict, i = {
322
- areArraysEqual: n ? ie : en,
323
- areDatesEqual: tn,
324
- areErrorsEqual: nn,
325
- areFunctionsEqual: rn,
326
- areMapsEqual: n ? Ne(Be, ie) : Be,
327
- areNumbersEqual: on,
328
- areObjectsEqual: n ? ie : sn,
329
- arePrimitiveWrappersEqual: an,
330
- areRegExpsEqual: cn,
331
- areSetsEqual: n ? Ne(We, ie) : We,
332
- areTypedArraysEqual: n ? ie : ln,
333
- areUrlsEqual: un,
334
- unknownTagComparators: void 0
335
- };
336
- if (r && (i = ke({}, i, r(i))), t) {
337
- var o = ce(i.areArraysEqual), s = ce(i.areMapsEqual), a = ce(i.areObjectsEqual), l = ce(i.areSetsEqual);
338
- i = ke({}, i, {
339
- areArraysEqual: o,
340
- areMapsEqual: s,
341
- areObjectsEqual: a,
342
- areSetsEqual: l
343
- });
344
- }
345
- return i;
346
- }
347
- function An(e) {
348
- return function(t, r, n, i, o, s, a) {
349
- return e(t, r, a);
350
- };
351
- }
352
- function Cn(e) {
353
- var t = e.circular, r = e.comparator, n = e.createState, i = e.equals, o = e.strict;
354
- if (n)
355
- return function(l, u) {
356
- var h = n(), c = h.cache, m = c === void 0 ? t ? /* @__PURE__ */ new WeakMap() : void 0 : c, f = h.meta;
357
- return r(l, u, {
358
- cache: m,
359
- equals: i,
360
- meta: f,
361
- strict: o
362
- });
363
- };
364
- if (t)
365
- return function(l, u) {
366
- return r(l, u, {
367
- cache: /* @__PURE__ */ new WeakMap(),
368
- equals: i,
369
- meta: void 0,
370
- strict: o
371
- });
372
- };
373
- var s = {
374
- cache: void 0,
375
- equals: i,
376
- meta: void 0,
377
- strict: o
378
- };
379
- return function(l, u) {
380
- return r(l, u, s);
381
- };
382
- }
383
- var _n = Y();
384
- Y({ strict: !0 });
385
- Y({ circular: !0 });
386
- Y({
387
- circular: !0,
388
- strict: !0
389
- });
390
- Y({
391
- createInternalComparator: function() {
392
- return J;
393
- }
394
- });
395
- Y({
396
- strict: !0,
397
- createInternalComparator: function() {
398
- return J;
399
- }
400
- });
401
- Y({
402
- circular: !0,
403
- createInternalComparator: function() {
404
- return J;
405
- }
406
- });
407
- Y({
408
- circular: !0,
409
- createInternalComparator: function() {
410
- return J;
411
- },
412
- strict: !0
413
- });
414
- function Y(e) {
415
- e === void 0 && (e = {});
416
- var t = e.circular, r = t === void 0 ? !1 : t, n = e.createInternalComparator, i = e.createState, o = e.strict, s = o === void 0 ? !1 : o, a = Rn(e), l = On(a), u = n ? n(l) : An(l);
417
- return Cn({ circular: r, comparator: l, createState: i, equals: u, strict: s });
418
- }
419
- var le = { exports: {} }, we = {};
420
- /**
421
- * @license React
422
- * use-sync-external-store-shim/with-selector.production.js
423
- *
424
- * Copyright (c) Meta Platforms, Inc. and affiliates.
425
- *
426
- * This source code is licensed under the MIT license found in the
427
- * LICENSE file in the root directory of this source tree.
428
- */
429
- var Fe;
430
- function Dn() {
431
- if (Fe) return we;
432
- Fe = 1;
433
- var e = B, t = Re();
434
- function r(u, h) {
435
- return u === h && (u !== 0 || 1 / u === 1 / h) || u !== u && h !== h;
436
- }
437
- var n = typeof Object.is == "function" ? Object.is : r, i = t.useSyncExternalStore, o = e.useRef, s = e.useEffect, a = e.useMemo, l = e.useDebugValue;
438
- return we.useSyncExternalStoreWithSelector = function(u, h, c, m, f) {
439
- var g = o(null);
440
- if (g.current === null) {
441
- var d = { hasValue: !1, value: null };
442
- g.current = d;
443
- } else d = g.current;
444
- g = a(
445
- function() {
446
- function v(b) {
447
- if (!y) {
448
- if (y = !0, w = b, b = m(b), f !== void 0 && d.hasValue) {
449
- var O = d.value;
450
- if (f(O, b))
451
- return E = O;
452
- }
453
- return E = b;
454
- }
455
- if (O = E, n(w, b)) return O;
456
- var R = m(b);
457
- return f !== void 0 && f(O, R) ? (w = b, O) : (w = b, E = R);
458
- }
459
- var y = !1, w, E, S = c === void 0 ? null : c;
460
- return [
461
- function() {
462
- return v(h());
463
- },
464
- S === null ? void 0 : function() {
465
- return v(S());
466
- }
467
- ];
468
- },
469
- [h, c, m, f]
470
- );
471
- var p = i(u, g[0], g[1]);
472
- return s(
473
- function() {
474
- d.hasValue = !0, d.value = p;
475
- },
476
- [p]
477
- ), l(p), p;
478
- }, we;
479
- }
480
- var Ee = {};
481
- /**
482
- * @license React
483
- * use-sync-external-store-shim/with-selector.development.js
484
- *
485
- * Copyright (c) Meta Platforms, Inc. and affiliates.
486
- *
487
- * This source code is licensed under the MIT license found in the
488
- * LICENSE file in the root directory of this source tree.
489
- */
490
- var He;
491
- function Tn() {
492
- return He || (He = 1, process.env.NODE_ENV !== "production" && (function() {
493
- function e(u, h) {
494
- return u === h && (u !== 0 || 1 / u === 1 / h) || u !== u && h !== h;
495
- }
496
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
497
- var t = B, r = Re(), n = typeof Object.is == "function" ? Object.is : e, i = r.useSyncExternalStore, o = t.useRef, s = t.useEffect, a = t.useMemo, l = t.useDebugValue;
498
- Ee.useSyncExternalStoreWithSelector = function(u, h, c, m, f) {
499
- var g = o(null);
500
- if (g.current === null) {
501
- var d = { hasValue: !1, value: null };
502
- g.current = d;
503
- } else d = g.current;
504
- g = a(
505
- function() {
506
- function v(b) {
507
- if (!y) {
508
- if (y = !0, w = b, b = m(b), f !== void 0 && d.hasValue) {
509
- var O = d.value;
510
- if (f(O, b))
511
- return E = O;
512
- }
513
- return E = b;
514
- }
515
- if (O = E, n(w, b))
516
- return O;
517
- var R = m(b);
518
- return f !== void 0 && f(O, R) ? (w = b, O) : (w = b, E = R);
519
- }
520
- var y = !1, w, E, S = c === void 0 ? null : c;
521
- return [
522
- function() {
523
- return v(h());
524
- },
525
- S === null ? void 0 : function() {
526
- return v(S());
527
- }
528
- ];
529
- },
530
- [h, c, m, f]
531
- );
532
- var p = i(u, g[0], g[1]);
533
- return s(
534
- function() {
535
- d.hasValue = !0, d.value = p;
536
- },
537
- [p]
538
- ), l(p), p;
539
- }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
540
- })()), Ee;
541
- }
542
- var Ue;
543
- function Ln() {
544
- return Ue || (Ue = 1, process.env.NODE_ENV === "production" ? le.exports = Dn() : le.exports = Tn()), le.exports;
545
- }
546
- var Pn = Ln(), qn = (...e) => (t) => {
547
- e.forEach((r) => {
548
- typeof r == "function" ? r(t) : r && (r.current = t);
549
- });
550
- }, Mn = ({ contentComponent: e }) => {
551
- const t = dt.useSyncExternalStore(
552
- e.subscribe,
553
- e.getSnapshot,
554
- e.getServerSnapshot
555
- );
556
- return /* @__PURE__ */ Z(ft, { children: Object.values(t) });
557
- };
558
- function Nn() {
559
- const e = /* @__PURE__ */ new Set();
560
- let t = {};
561
- return {
562
- /**
563
- * Subscribe to the editor instance's changes.
564
- */
565
- subscribe(r) {
566
- return e.add(r), () => {
567
- e.delete(r);
568
- };
569
- },
570
- getSnapshot() {
571
- return t;
572
- },
573
- getServerSnapshot() {
574
- return t;
575
- },
576
- /**
577
- * Adds a new NodeView Renderer to the editor.
578
- */
579
- setRenderer(r, n) {
580
- t = {
581
- ...t,
582
- [r]: It.createPortal(n.reactElement, n.element, r)
583
- }, e.forEach((i) => i());
584
- },
585
- /**
586
- * Removes a NodeView Renderer from the editor.
587
- */
588
- removeRenderer(r) {
589
- const n = { ...t };
590
- delete n[r], t = n, e.forEach((i) => i());
591
- }
592
- };
593
- }
594
- var Vn = class extends B.Component {
595
- constructor(e) {
596
- var t;
597
- super(e), this.editorContentRef = B.createRef(), this.initialized = !1, this.state = {
598
- hasContentComponentInitialized: !!((t = e.editor) != null && t.contentComponent)
599
- };
600
- }
601
- componentDidMount() {
602
- this.init();
603
- }
604
- componentDidUpdate() {
605
- this.init();
606
- }
607
- init() {
608
- const e = this.props.editor;
609
- if (e && !e.isDestroyed && e.options.element) {
610
- if (e.contentComponent)
611
- return;
612
- const t = this.editorContentRef.current;
613
- t.append(e.view.dom), e.setOptions({
614
- element: t
615
- }), e.contentComponent = Nn(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = e.contentComponent.subscribe(() => {
616
- this.setState((r) => r.hasContentComponentInitialized ? r : {
617
- hasContentComponentInitialized: !0
618
- }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
619
- })), e.createNodeViews(), this.initialized = !0;
620
- }
621
- }
622
- componentWillUnmount() {
623
- var e;
624
- const t = this.props.editor;
625
- if (t) {
626
- this.initialized = !1, t.isDestroyed || t.view.setProps({
627
- nodeViews: {}
628
- }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent(), t.contentComponent = null;
629
- try {
630
- if (!((e = t.view.dom) != null && e.firstChild))
631
- return;
632
- const r = document.createElement("div");
633
- r.append(t.view.dom), t.setOptions({
634
- element: r
635
- });
636
- } catch {
637
- }
638
- }
639
- }
640
- render() {
641
- const { editor: e, innerRef: t, ...r } = this.props;
642
- return /* @__PURE__ */ Wt(ft, { children: [
643
- /* @__PURE__ */ Z("div", { ref: qn(t, this.editorContentRef), ...r }),
644
- (e == null ? void 0 : e.contentComponent) && /* @__PURE__ */ Z(Mn, { contentComponent: e.contentComponent })
645
- ] });
646
- }
647
- }, jn = qt(
648
- (e, t) => {
649
- const r = B.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
650
- return B.createElement(Vn, {
651
- key: r,
652
- innerRef: t,
653
- ...e
654
- });
655
- }
656
- ), Gr = B.memo(jn), In = typeof window < "u" ? Mt : lt, Bn = class {
657
- constructor(e) {
658
- this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = e, this.lastSnapshot = { editor: e, transactionNumber: 0 }, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
659
- }
660
- /**
661
- * Get the current editor instance.
662
- */
663
- getSnapshot() {
664
- return this.transactionNumber === this.lastTransactionNumber ? this.lastSnapshot : (this.lastTransactionNumber = this.transactionNumber, this.lastSnapshot = { editor: this.editor, transactionNumber: this.transactionNumber }, this.lastSnapshot);
665
- }
666
- /**
667
- * Always disable the editor on the server-side.
668
- */
669
- getServerSnapshot() {
670
- return { editor: null, transactionNumber: 0 };
671
- }
672
- /**
673
- * Subscribe to the editor instance's changes.
674
- */
675
- subscribe(e) {
676
- return this.subscribers.add(e), () => {
677
- this.subscribers.delete(e);
678
- };
679
- }
680
- /**
681
- * Watch the editor instance for changes.
682
- */
683
- watch(e) {
684
- if (this.editor = e, this.editor) {
685
- const t = () => {
686
- this.transactionNumber += 1, this.subscribers.forEach((n) => n());
687
- }, r = this.editor;
688
- return r.on("transaction", t), () => {
689
- r.off("transaction", t);
690
- };
691
- }
692
- }
693
- };
694
- function Wn(e) {
695
- var t;
696
- const [r] = at(() => new Bn(e.editor)), n = Pn.useSyncExternalStoreWithSelector(
697
- r.subscribe,
698
- r.getSnapshot,
699
- r.getServerSnapshot,
700
- e.selector,
701
- (t = e.equalityFn) != null ? t : _n
702
- );
703
- return In(() => r.watch(e.editor), [e.editor, r]), ct(n), n;
704
- }
705
- var Ge = process.env.NODE_ENV !== "production", Se = typeof window > "u", $n = Se || !!(typeof window < "u" && window.next), kn = class pt {
706
- constructor(t) {
707
- this.editor = null, this.subscriptions = /* @__PURE__ */ new Set(), this.isComponentMounted = !1, this.previousDeps = null, this.instanceId = "", this.options = t, this.subscriptions = /* @__PURE__ */ new Set(), this.setEditor(this.getInitialEditor()), this.scheduleDestroy(), this.getEditor = this.getEditor.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.subscribe = this.subscribe.bind(this), this.refreshEditorInstance = this.refreshEditorInstance.bind(this), this.scheduleDestroy = this.scheduleDestroy.bind(this), this.onRender = this.onRender.bind(this), this.createEditor = this.createEditor.bind(this);
708
- }
709
- setEditor(t) {
710
- this.editor = t, this.instanceId = Math.random().toString(36).slice(2, 9), this.subscriptions.forEach((r) => r());
711
- }
712
- getInitialEditor() {
713
- if (this.options.current.immediatelyRender === void 0) {
714
- if (Se || $n) {
715
- if (Ge)
716
- throw new Error(
717
- "Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."
718
- );
719
- return null;
720
- }
721
- return this.createEditor();
722
- }
723
- if (this.options.current.immediatelyRender && Se && Ge)
724
- throw new Error(
725
- "Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches."
726
- );
727
- return this.options.current.immediatelyRender ? this.createEditor() : null;
728
- }
729
- /**
730
- * Create a new editor instance. And attach event listeners.
731
- */
732
- createEditor() {
733
- const t = {
734
- ...this.options.current,
735
- // Always call the most recent version of the callback function by default
736
- onBeforeCreate: (...n) => {
737
- var i, o;
738
- return (o = (i = this.options.current).onBeforeCreate) == null ? void 0 : o.call(i, ...n);
739
- },
740
- onBlur: (...n) => {
741
- var i, o;
742
- return (o = (i = this.options.current).onBlur) == null ? void 0 : o.call(i, ...n);
743
- },
744
- onCreate: (...n) => {
745
- var i, o;
746
- return (o = (i = this.options.current).onCreate) == null ? void 0 : o.call(i, ...n);
747
- },
748
- onDestroy: (...n) => {
749
- var i, o;
750
- return (o = (i = this.options.current).onDestroy) == null ? void 0 : o.call(i, ...n);
751
- },
752
- onFocus: (...n) => {
753
- var i, o;
754
- return (o = (i = this.options.current).onFocus) == null ? void 0 : o.call(i, ...n);
755
- },
756
- onSelectionUpdate: (...n) => {
757
- var i, o;
758
- return (o = (i = this.options.current).onSelectionUpdate) == null ? void 0 : o.call(i, ...n);
759
- },
760
- onTransaction: (...n) => {
761
- var i, o;
762
- return (o = (i = this.options.current).onTransaction) == null ? void 0 : o.call(i, ...n);
763
- },
764
- onUpdate: (...n) => {
765
- var i, o;
766
- return (o = (i = this.options.current).onUpdate) == null ? void 0 : o.call(i, ...n);
767
- },
768
- onContentError: (...n) => {
769
- var i, o;
770
- return (o = (i = this.options.current).onContentError) == null ? void 0 : o.call(i, ...n);
771
- },
772
- onDrop: (...n) => {
773
- var i, o;
774
- return (o = (i = this.options.current).onDrop) == null ? void 0 : o.call(i, ...n);
775
- },
776
- onPaste: (...n) => {
777
- var i, o;
778
- return (o = (i = this.options.current).onPaste) == null ? void 0 : o.call(i, ...n);
779
- },
780
- onDelete: (...n) => {
781
- var i, o;
782
- return (o = (i = this.options.current).onDelete) == null ? void 0 : o.call(i, ...n);
783
- }
784
- };
785
- return new $t(t);
786
- }
787
- /**
788
- * Get the current editor instance.
789
- */
790
- getEditor() {
791
- return this.editor;
792
- }
793
- /**
794
- * Always disable the editor on the server-side.
795
- */
796
- getServerSnapshot() {
797
- return null;
798
- }
799
- /**
800
- * Subscribe to the editor instance's changes.
801
- */
802
- subscribe(t) {
803
- return this.subscriptions.add(t), () => {
804
- this.subscriptions.delete(t);
805
- };
806
- }
807
- static compareOptions(t, r) {
808
- return Object.keys(t).every((n) => [
809
- "onCreate",
810
- "onBeforeCreate",
811
- "onDestroy",
812
- "onUpdate",
813
- "onTransaction",
814
- "onFocus",
815
- "onBlur",
816
- "onSelectionUpdate",
817
- "onContentError",
818
- "onDrop",
819
- "onPaste"
820
- ].includes(n) ? !0 : n === "extensions" && t.extensions && r.extensions ? t.extensions.length !== r.extensions.length ? !1 : t.extensions.every((i, o) => {
821
- var s;
822
- return i === ((s = r.extensions) == null ? void 0 : s[o]);
823
- }) : t[n] === r[n]);
824
- }
825
- /**
826
- * On each render, we will create, update, or destroy the editor instance.
827
- * @param deps The dependencies to watch for changes
828
- * @returns A cleanup function
829
- */
830
- onRender(t) {
831
- return () => (this.isComponentMounted = !0, clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && t.length === 0 ? pt.compareOptions(this.options.current, this.editor.options) || this.editor.setOptions({
832
- ...this.options.current,
833
- editable: this.editor.isEditable
834
- }) : this.refreshEditorInstance(t), () => {
835
- this.isComponentMounted = !1, this.scheduleDestroy();
836
- });
837
- }
838
- /**
839
- * Recreate the editor instance if the dependencies have changed.
840
- */
841
- refreshEditorInstance(t) {
842
- if (this.editor && !this.editor.isDestroyed) {
843
- if (this.previousDeps === null) {
844
- this.previousDeps = t;
845
- return;
846
- }
847
- if (this.previousDeps.length === t.length && this.previousDeps.every((n, i) => n === t[i]))
848
- return;
849
- }
850
- this.editor && !this.editor.isDestroyed && this.editor.destroy(), this.setEditor(this.createEditor()), this.previousDeps = t;
851
- }
852
- /**
853
- * Schedule the destruction of the editor instance.
854
- * This will only destroy the editor if it was not mounted on the next tick.
855
- * This is to avoid destroying the editor instance when it's actually still mounted.
856
- */
857
- scheduleDestroy() {
858
- const t = this.instanceId, r = this.editor;
859
- this.scheduledDestructionTimeout = setTimeout(() => {
860
- if (this.isComponentMounted && this.instanceId === t) {
861
- r && r.setOptions(this.options.current);
862
- return;
863
- }
864
- r && !r.isDestroyed && (r.destroy(), this.instanceId === t && this.setEditor(null));
865
- }, 1);
866
- }
867
- };
868
- function zr(e = {}, t = []) {
869
- const r = Pt(e);
870
- r.current = e;
871
- const [n] = at(() => new kn(r)), i = dt.useSyncExternalStore(
872
- n.subscribe,
873
- n.getEditor,
874
- n.getServerSnapshot
875
- );
876
- return ct(i), lt(n.onRender(t)), Wn({
877
- editor: i,
878
- selector: ({ transactionNumber: o }) => e.shouldRerenderOnTransaction === !1 || e.shouldRerenderOnTransaction === void 0 ? null : e.immediatelyRender && o === 0 ? 0 : o + 1
879
- }), i;
880
- }
881
- var mt = st({
882
- editor: null
883
- });
884
- mt.Consumer;
885
- var Kr = () => ut(mt), gt = st({
886
- onDragStart: () => {
887
- },
888
- nodeViewContentChildren: void 0,
889
- nodeViewContentRef: () => {
890
- }
891
- }), Fn = () => ut(gt), Xr = B.forwardRef((e, t) => {
892
- const { onDragStart: r } = Fn(), n = e.as || "div";
893
- return (
894
- // @ts-ignore
895
- /* @__PURE__ */ Z(
896
- n,
897
- {
898
- ...e,
899
- ref: t,
900
- "data-node-view-wrapper": "",
901
- onDragStart: r,
902
- style: {
903
- whiteSpace: "normal",
904
- ...e.style
905
- }
906
- }
907
- )
908
- );
909
- });
910
- function ze(e) {
911
- return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
912
- }
913
- function Ke(e) {
914
- return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.forward_ref)" || e.$$typeof.description === "react.forward_ref"));
915
- }
916
- function Hn(e) {
917
- return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.memo)" || e.$$typeof.description === "react.memo"));
918
- }
919
- function Un(e) {
920
- if (ze(e) || Ke(e))
921
- return !0;
922
- if (Hn(e)) {
923
- const t = e.type;
924
- if (t)
925
- return ze(t) || Ke(t);
926
- }
927
- return !1;
928
- }
929
- function Gn() {
930
- try {
931
- if (Le)
932
- return parseInt(Le.split(".")[0], 10) >= 19;
933
- } catch {
934
- }
935
- return !1;
936
- }
937
- var zn = class {
938
- /**
939
- * Immediately creates element and renders the provided React component.
940
- */
941
- constructor(e, { editor: t, props: r = {}, as: n = "div", className: i = "" }) {
942
- this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = e, this.editor = t, this.props = r, this.element = document.createElement(n), this.element.classList.add("react-renderer"), i && this.element.classList.add(...i.split(" ")), this.editor.isInitialized ? Bt(() => {
943
- this.render();
944
- }) : queueMicrotask(() => {
945
- this.render();
946
- });
947
- }
948
- /**
949
- * Render the React component.
950
- */
951
- render() {
952
- var e;
953
- const t = this.component, r = this.props, n = this.editor, i = Gn(), o = Un(t), s = { ...r };
954
- s.ref && !(i || o) && delete s.ref, !s.ref && (i || o) && (s.ref = (a) => {
955
- this.ref = a;
956
- }), this.reactElement = /* @__PURE__ */ Z(t, { ...s }), (e = n == null ? void 0 : n.contentComponent) == null || e.setRenderer(this.id, this);
957
- }
958
- /**
959
- * Re-renders the React component with new props.
960
- */
961
- updateProps(e = {}) {
962
- this.props = {
963
- ...this.props,
964
- ...e
965
- }, this.render();
966
- }
967
- /**
968
- * Destroy the React component.
969
- */
970
- destroy() {
971
- var e;
972
- const t = this.editor;
973
- (e = t == null ? void 0 : t.contentComponent) == null || e.removeRenderer(this.id);
974
- try {
975
- this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element);
976
- } catch {
977
- }
978
- }
979
- /**
980
- * Update the attributes of the element that holds the React component.
981
- */
982
- updateAttributes(e) {
983
- Object.keys(e).forEach((t) => {
984
- this.element.setAttribute(t, e[t]);
985
- });
986
- }
987
- };
988
- B.createContext({
989
- markViewContentRef: () => {
990
- }
991
- });
992
- var Kn = class extends kt {
993
- constructor(e, t, r) {
994
- if (super(e, t, r), this.selectionRafId = null, !this.node.isLeaf) {
995
- this.options.contentDOMElementTag ? this.contentDOMElement = document.createElement(this.options.contentDOMElementTag) : this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement.dataset.nodeViewContentReact = "", this.contentDOMElement.dataset.nodeViewWrapper = "", this.contentDOMElement.style.whiteSpace = "inherit";
996
- const n = this.dom.querySelector("[data-node-view-content]");
997
- if (!n)
998
- return;
999
- n.appendChild(this.contentDOMElement);
1000
- }
1001
- }
1002
- /**
1003
- * Setup the React component.
1004
- * Called on initialization.
1005
- */
1006
- mount() {
1007
- const e = {
1008
- editor: this.editor,
1009
- node: this.node,
1010
- decorations: this.decorations,
1011
- innerDecorations: this.innerDecorations,
1012
- view: this.view,
1013
- selected: !1,
1014
- extension: this.extension,
1015
- HTMLAttributes: this.HTMLAttributes,
1016
- getPos: () => this.getPos(),
1017
- updateAttributes: (l = {}) => this.updateAttributes(l),
1018
- deleteNode: () => this.deleteNode(),
1019
- ref: Nt()
1020
- };
1021
- if (!this.component.displayName) {
1022
- const l = (u) => u.charAt(0).toUpperCase() + u.substring(1);
1023
- this.component.displayName = l(this.extension.name);
1024
- }
1025
- const n = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (l) => {
1026
- l && this.contentDOMElement && l.firstChild !== this.contentDOMElement && (l.hasAttribute("data-node-view-wrapper") && l.removeAttribute("data-node-view-wrapper"), l.appendChild(this.contentDOMElement));
1027
- } }, i = this.component, o = Vt((l) => /* @__PURE__ */ Z(gt.Provider, { value: n, children: jt(i, l) }));
1028
- o.displayName = "ReactNodeView";
1029
- let s = this.node.isInline ? "span" : "div";
1030
- this.options.as && (s = this.options.as);
1031
- const { className: a = "" } = this.options;
1032
- this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.renderer = new zn(o, {
1033
- editor: this.editor,
1034
- props: e,
1035
- as: s,
1036
- className: `node-${this.node.type.name} ${a}`.trim()
1037
- }), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.updateElementAttributes();
1038
- }
1039
- /**
1040
- * Return the DOM element.
1041
- * This is the element that will be used to display the node view.
1042
- */
1043
- get dom() {
1044
- var e;
1045
- if (this.renderer.element.firstElementChild && !((e = this.renderer.element.firstElementChild) != null && e.hasAttribute("data-node-view-wrapper")))
1046
- throw Error("Please use the NodeViewWrapper component for your node view.");
1047
- return this.renderer.element;
1048
- }
1049
- /**
1050
- * Return the content DOM element.
1051
- * This is the element that will be used to display the rich-text content of the node.
1052
- */
1053
- get contentDOM() {
1054
- return this.node.isLeaf ? null : this.contentDOMElement;
1055
- }
1056
- /**
1057
- * On editor selection update, check if the node is selected.
1058
- * If it is, call `selectNode`, otherwise call `deselectNode`.
1059
- */
1060
- handleSelectionUpdate() {
1061
- this.selectionRafId && (cancelAnimationFrame(this.selectionRafId), this.selectionRafId = null), this.selectionRafId = requestAnimationFrame(() => {
1062
- this.selectionRafId = null;
1063
- const { from: e, to: t } = this.editor.state.selection, r = this.getPos();
1064
- if (typeof r == "number")
1065
- if (e <= r && t >= r + this.node.nodeSize) {
1066
- if (this.renderer.props.selected)
1067
- return;
1068
- this.selectNode();
1069
- } else {
1070
- if (!this.renderer.props.selected)
1071
- return;
1072
- this.deselectNode();
1073
- }
1074
- });
1075
- }
1076
- /**
1077
- * On update, update the React component.
1078
- * To prevent unnecessary updates, the `update` option can be used.
1079
- */
1080
- update(e, t, r) {
1081
- const n = (i) => {
1082
- this.renderer.updateProps(i), typeof this.options.attrs == "function" && this.updateElementAttributes();
1083
- };
1084
- if (e.type !== this.node.type)
1085
- return !1;
1086
- if (typeof this.options.update == "function") {
1087
- const i = this.node, o = this.decorations, s = this.innerDecorations;
1088
- return this.node = e, this.decorations = t, this.innerDecorations = r, this.options.update({
1089
- oldNode: i,
1090
- oldDecorations: o,
1091
- newNode: e,
1092
- newDecorations: t,
1093
- oldInnerDecorations: s,
1094
- innerDecorations: r,
1095
- updateProps: () => n({ node: e, decorations: t, innerDecorations: r })
1096
- });
1097
- }
1098
- return e === this.node && this.decorations === t && this.innerDecorations === r || (this.node = e, this.decorations = t, this.innerDecorations = r, n({ node: e, decorations: t, innerDecorations: r })), !0;
1099
- }
1100
- /**
1101
- * Select the node.
1102
- * Add the `selected` prop and the `ProseMirror-selectednode` class.
1103
- */
1104
- selectNode() {
1105
- this.renderer.updateProps({
1106
- selected: !0
1107
- }), this.renderer.element.classList.add("ProseMirror-selectednode");
1108
- }
1109
- /**
1110
- * Deselect the node.
1111
- * Remove the `selected` prop and the `ProseMirror-selectednode` class.
1112
- */
1113
- deselectNode() {
1114
- this.renderer.updateProps({
1115
- selected: !1
1116
- }), this.renderer.element.classList.remove("ProseMirror-selectednode");
1117
- }
1118
- /**
1119
- * Destroy the React component instance.
1120
- */
1121
- destroy() {
1122
- this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.contentDOMElement = null, this.selectionRafId && (cancelAnimationFrame(this.selectionRafId), this.selectionRafId = null);
1123
- }
1124
- /**
1125
- * Update the attributes of the top-level element that holds the React component.
1126
- * Applying the attributes defined in the `attrs` option.
1127
- */
1128
- updateElementAttributes() {
1129
- if (this.options.attrs) {
1130
- let e = {};
1131
- if (typeof this.options.attrs == "function") {
1132
- const t = this.editor.extensionManager.attributes, r = Ft(this.node, t);
1133
- e = this.options.attrs({ node: this.node, HTMLAttributes: r });
1134
- } else
1135
- e = this.options.attrs;
1136
- this.renderer.updateAttributes(e);
1137
- }
1138
- }
1139
- };
1140
- function Yr(e, t) {
1141
- return (r) => r.editor.contentComponent ? new Kn(e, r, t) : {};
1142
- }
1143
- function vt(e) {
1144
- var t, r, n = "";
1145
- if (typeof e == "string" || typeof e == "number") n += e;
1146
- else if (typeof e == "object") if (Array.isArray(e)) {
1147
- var i = e.length;
1148
- for (t = 0; t < i; t++) e[t] && (r = vt(e[t])) && (n && (n += " "), n += r);
1149
- } else for (r in e) e[r] && (n && (n += " "), n += r);
1150
- return n;
1151
- }
1152
- function Jr() {
1153
- for (var e, t, r = 0, n = "", i = arguments.length; r < i; r++) (e = arguments[r]) && (t = vt(e)) && (n && (n += " "), n += t);
1154
- return n;
1155
- }
1156
- const yt = ["top", "right", "bottom", "left"], Xe = ["start", "end"], Ye = /* @__PURE__ */ yt.reduce((e, t) => e.concat(t, t + "-" + Xe[0], t + "-" + Xe[1]), []), H = Math.min, T = Math.max, ue = Math.round, F = (e) => ({
1157
- x: e,
1158
- y: e
1159
- }), Xn = {
1160
- left: "right",
1161
- right: "left",
1162
- bottom: "top",
1163
- top: "bottom"
1164
- }, Yn = {
1165
- start: "end",
1166
- end: "start"
1167
- };
1168
- function xe(e, t, r) {
1169
- return T(e, H(t, r));
1170
- }
1171
- function G(e, t) {
1172
- return typeof e == "function" ? e(t) : e;
1173
- }
1174
- function V(e) {
1175
- return e.split("-")[0];
1176
- }
1177
- function I(e) {
1178
- return e.split("-")[1];
1179
- }
1180
- function wt(e) {
1181
- return e === "x" ? "y" : "x";
1182
- }
1183
- function Ae(e) {
1184
- return e === "y" ? "height" : "width";
1185
- }
1186
- const Jn = /* @__PURE__ */ new Set(["top", "bottom"]);
1187
- function k(e) {
1188
- return Jn.has(V(e)) ? "y" : "x";
1189
- }
1190
- function Ce(e) {
1191
- return wt(k(e));
1192
- }
1193
- function Et(e, t, r) {
1194
- r === void 0 && (r = !1);
1195
- const n = I(e), i = Ce(e), o = Ae(i);
1196
- let s = i === "x" ? n === (r ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
1197
- return t.reference[o] > t.floating[o] && (s = de(s)), [s, de(s)];
1198
- }
1199
- function Qn(e) {
1200
- const t = de(e);
1201
- return [fe(e), t, fe(t)];
1202
- }
1203
- function fe(e) {
1204
- return e.replace(/start|end/g, (t) => Yn[t]);
1205
- }
1206
- const Je = ["left", "right"], Qe = ["right", "left"], Zn = ["top", "bottom"], er = ["bottom", "top"];
1207
- function tr(e, t, r) {
1208
- switch (e) {
1209
- case "top":
1210
- case "bottom":
1211
- return r ? t ? Qe : Je : t ? Je : Qe;
1212
- case "left":
1213
- case "right":
1214
- return t ? Zn : er;
1215
- default:
1216
- return [];
1217
- }
1218
- }
1219
- function nr(e, t, r, n) {
1220
- const i = I(e);
1221
- let o = tr(V(e), r === "start", n);
1222
- return i && (o = o.map((s) => s + "-" + i), t && (o = o.concat(o.map(fe)))), o;
1223
- }
1224
- function de(e) {
1225
- return e.replace(/left|right|bottom|top/g, (t) => Xn[t]);
1226
- }
1227
- function rr(e) {
1228
- return {
1229
- top: 0,
1230
- right: 0,
1231
- bottom: 0,
1232
- left: 0,
1233
- ...e
1234
- };
1235
- }
1236
- function _e(e) {
1237
- return typeof e != "number" ? rr(e) : {
1238
- top: e,
1239
- right: e,
1240
- bottom: e,
1241
- left: e
1242
- };
1243
- }
1244
- function ee(e) {
1245
- const {
1246
- x: t,
1247
- y: r,
1248
- width: n,
1249
- height: i
1250
- } = e;
1251
- return {
1252
- width: n,
1253
- height: i,
1254
- top: r,
1255
- left: t,
1256
- right: t + n,
1257
- bottom: r + i,
1258
- x: t,
1259
- y: r
1260
- };
1261
- }
1262
- function Ze(e, t, r) {
1263
- let {
1264
- reference: n,
1265
- floating: i
1266
- } = e;
1267
- const o = k(t), s = Ce(t), a = Ae(s), l = V(t), u = o === "y", h = n.x + n.width / 2 - i.width / 2, c = n.y + n.height / 2 - i.height / 2, m = n[a] / 2 - i[a] / 2;
1268
- let f;
1269
- switch (l) {
1270
- case "top":
1271
- f = {
1272
- x: h,
1273
- y: n.y - i.height
1274
- };
1275
- break;
1276
- case "bottom":
1277
- f = {
1278
- x: h,
1279
- y: n.y + n.height
1280
- };
1281
- break;
1282
- case "right":
1283
- f = {
1284
- x: n.x + n.width,
1285
- y: c
1286
- };
1287
- break;
1288
- case "left":
1289
- f = {
1290
- x: n.x - i.width,
1291
- y: c
1292
- };
1293
- break;
1294
- default:
1295
- f = {
1296
- x: n.x,
1297
- y: n.y
1298
- };
1299
- }
1300
- switch (I(t)) {
1301
- case "start":
1302
- f[s] -= m * (r && u ? -1 : 1);
1303
- break;
1304
- case "end":
1305
- f[s] += m * (r && u ? -1 : 1);
1306
- break;
1307
- }
1308
- return f;
1309
- }
1310
- const ir = async (e, t, r) => {
1311
- const {
1312
- placement: n = "bottom",
1313
- strategy: i = "absolute",
1314
- middleware: o = [],
1315
- platform: s
1316
- } = r, a = o.filter(Boolean), l = await (s.isRTL == null ? void 0 : s.isRTL(t));
1317
- let u = await s.getElementRects({
1318
- reference: e,
1319
- floating: t,
1320
- strategy: i
1321
- }), {
1322
- x: h,
1323
- y: c
1324
- } = Ze(u, n, l), m = n, f = {}, g = 0;
1325
- for (let d = 0; d < a.length; d++) {
1326
- const {
1327
- name: p,
1328
- fn: v
1329
- } = a[d], {
1330
- x: y,
1331
- y: w,
1332
- data: E,
1333
- reset: S
1334
- } = await v({
1335
- x: h,
1336
- y: c,
1337
- initialPlacement: n,
1338
- placement: m,
1339
- strategy: i,
1340
- middlewareData: f,
1341
- rects: u,
1342
- platform: s,
1343
- elements: {
1344
- reference: e,
1345
- floating: t
1346
- }
1347
- });
1348
- h = y ?? h, c = w ?? c, f = {
1349
- ...f,
1350
- [p]: {
1351
- ...f[p],
1352
- ...E
1353
- }
1354
- }, S && g <= 50 && (g++, typeof S == "object" && (S.placement && (m = S.placement), S.rects && (u = S.rects === !0 ? await s.getElementRects({
1355
- reference: e,
1356
- floating: t,
1357
- strategy: i
1358
- }) : S.rects), {
1359
- x: h,
1360
- y: c
1361
- } = Ze(u, m, l)), d = -1);
1362
- }
1363
- return {
1364
- x: h,
1365
- y: c,
1366
- placement: m,
1367
- strategy: i,
1368
- middlewareData: f
1369
- };
1370
- };
1371
- async function te(e, t) {
1372
- var r;
1373
- t === void 0 && (t = {});
1374
- const {
1375
- x: n,
1376
- y: i,
1377
- platform: o,
1378
- rects: s,
1379
- elements: a,
1380
- strategy: l
1381
- } = e, {
1382
- boundary: u = "clippingAncestors",
1383
- rootBoundary: h = "viewport",
1384
- elementContext: c = "floating",
1385
- altBoundary: m = !1,
1386
- padding: f = 0
1387
- } = G(t, e), g = _e(f), p = a[m ? c === "floating" ? "reference" : "floating" : c], v = ee(await o.getClippingRect({
1388
- element: (r = await (o.isElement == null ? void 0 : o.isElement(p))) == null || r ? p : p.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(a.floating)),
1389
- boundary: u,
1390
- rootBoundary: h,
1391
- strategy: l
1392
- })), y = c === "floating" ? {
1393
- x: n,
1394
- y: i,
1395
- width: s.floating.width,
1396
- height: s.floating.height
1397
- } : s.reference, w = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), E = await (o.isElement == null ? void 0 : o.isElement(w)) ? await (o.getScale == null ? void 0 : o.getScale(w)) || {
1398
- x: 1,
1399
- y: 1
1400
- } : {
1401
- x: 1,
1402
- y: 1
1403
- }, S = ee(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
1404
- elements: a,
1405
- rect: y,
1406
- offsetParent: w,
1407
- strategy: l
1408
- }) : y);
1409
- return {
1410
- top: (v.top - S.top + g.top) / E.y,
1411
- bottom: (S.bottom - v.bottom + g.bottom) / E.y,
1412
- left: (v.left - S.left + g.left) / E.x,
1413
- right: (S.right - v.right + g.right) / E.x
1414
- };
1415
- }
1416
- const or = (e) => ({
1417
- name: "arrow",
1418
- options: e,
1419
- async fn(t) {
1420
- const {
1421
- x: r,
1422
- y: n,
1423
- placement: i,
1424
- rects: o,
1425
- platform: s,
1426
- elements: a,
1427
- middlewareData: l
1428
- } = t, {
1429
- element: u,
1430
- padding: h = 0
1431
- } = G(e, t) || {};
1432
- if (u == null)
1433
- return {};
1434
- const c = _e(h), m = {
1435
- x: r,
1436
- y: n
1437
- }, f = Ce(i), g = Ae(f), d = await s.getDimensions(u), p = f === "y", v = p ? "top" : "left", y = p ? "bottom" : "right", w = p ? "clientHeight" : "clientWidth", E = o.reference[g] + o.reference[f] - m[f] - o.floating[g], S = m[f] - o.reference[f], b = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(u));
1438
- let O = b ? b[w] : 0;
1439
- (!O || !await (s.isElement == null ? void 0 : s.isElement(b))) && (O = a.floating[w] || o.floating[g]);
1440
- const R = E / 2 - S / 2, _ = O / 2 - d[g] / 2 - 1, x = H(c[v], _), A = H(c[y], _), D = x, L = O - d[g] - A, C = O / 2 - d[g] / 2 + R, j = xe(D, C, L), N = !l.arrow && I(i) != null && C !== j && o.reference[g] / 2 - (C < D ? x : A) - d[g] / 2 < 0, P = N ? C < D ? C - D : C - L : 0;
1441
- return {
1442
- [f]: m[f] + P,
1443
- data: {
1444
- [f]: j,
1445
- centerOffset: C - j - P,
1446
- ...N && {
1447
- alignmentOffset: P
1448
- }
1449
- },
1450
- reset: N
1451
- };
1452
- }
1453
- });
1454
- function sr(e, t, r) {
1455
- return (e ? [...r.filter((i) => I(i) === e), ...r.filter((i) => I(i) !== e)] : r.filter((i) => V(i) === i)).filter((i) => e ? I(i) === e || (t ? fe(i) !== i : !1) : !0);
1456
- }
1457
- const ar = function(e) {
1458
- return e === void 0 && (e = {}), {
1459
- name: "autoPlacement",
1460
- options: e,
1461
- async fn(t) {
1462
- var r, n, i;
1463
- const {
1464
- rects: o,
1465
- middlewareData: s,
1466
- placement: a,
1467
- platform: l,
1468
- elements: u
1469
- } = t, {
1470
- crossAxis: h = !1,
1471
- alignment: c,
1472
- allowedPlacements: m = Ye,
1473
- autoAlignment: f = !0,
1474
- ...g
1475
- } = G(e, t), d = c !== void 0 || m === Ye ? sr(c || null, f, m) : m, p = await te(t, g), v = ((r = s.autoPlacement) == null ? void 0 : r.index) || 0, y = d[v];
1476
- if (y == null)
1477
- return {};
1478
- const w = Et(y, o, await (l.isRTL == null ? void 0 : l.isRTL(u.floating)));
1479
- if (a !== y)
1480
- return {
1481
- reset: {
1482
- placement: d[0]
1483
- }
1484
- };
1485
- const E = [p[V(y)], p[w[0]], p[w[1]]], S = [...((n = s.autoPlacement) == null ? void 0 : n.overflows) || [], {
1486
- placement: y,
1487
- overflows: E
1488
- }], b = d[v + 1];
1489
- if (b)
1490
- return {
1491
- data: {
1492
- index: v + 1,
1493
- overflows: S
1494
- },
1495
- reset: {
1496
- placement: b
1497
- }
1498
- };
1499
- const O = S.map((x) => {
1500
- const A = I(x.placement);
1501
- return [x.placement, A && h ? (
1502
- // Check along the mainAxis and main crossAxis side.
1503
- x.overflows.slice(0, 2).reduce((D, L) => D + L, 0)
1504
- ) : (
1505
- // Check only the mainAxis.
1506
- x.overflows[0]
1507
- ), x.overflows];
1508
- }).sort((x, A) => x[1] - A[1]), _ = ((i = O.filter((x) => x[2].slice(
1509
- 0,
1510
- // Aligned placements should not check their opposite crossAxis
1511
- // side.
1512
- I(x[0]) ? 2 : 3
1513
- ).every((A) => A <= 0))[0]) == null ? void 0 : i[0]) || O[0][0];
1514
- return _ !== a ? {
1515
- data: {
1516
- index: v + 1,
1517
- overflows: S
1518
- },
1519
- reset: {
1520
- placement: _
1521
- }
1522
- } : {};
1523
- }
1524
- };
1525
- }, cr = function(e) {
1526
- return e === void 0 && (e = {}), {
1527
- name: "flip",
1528
- options: e,
1529
- async fn(t) {
1530
- var r, n;
1531
- const {
1532
- placement: i,
1533
- middlewareData: o,
1534
- rects: s,
1535
- initialPlacement: a,
1536
- platform: l,
1537
- elements: u
1538
- } = t, {
1539
- mainAxis: h = !0,
1540
- crossAxis: c = !0,
1541
- fallbackPlacements: m,
1542
- fallbackStrategy: f = "bestFit",
1543
- fallbackAxisSideDirection: g = "none",
1544
- flipAlignment: d = !0,
1545
- ...p
1546
- } = G(e, t);
1547
- if ((r = o.arrow) != null && r.alignmentOffset)
1548
- return {};
1549
- const v = V(i), y = k(a), w = V(a) === a, E = await (l.isRTL == null ? void 0 : l.isRTL(u.floating)), S = m || (w || !d ? [de(a)] : Qn(a)), b = g !== "none";
1550
- !m && b && S.push(...nr(a, d, g, E));
1551
- const O = [a, ...S], R = await te(t, p), _ = [];
1552
- let x = ((n = o.flip) == null ? void 0 : n.overflows) || [];
1553
- if (h && _.push(R[v]), c) {
1554
- const C = Et(i, s, E);
1555
- _.push(R[C[0]], R[C[1]]);
1556
- }
1557
- if (x = [...x, {
1558
- placement: i,
1559
- overflows: _
1560
- }], !_.every((C) => C <= 0)) {
1561
- var A, D;
1562
- const C = (((A = o.flip) == null ? void 0 : A.index) || 0) + 1, j = O[C];
1563
- if (j && (!(c === "alignment" ? y !== k(j) : !1) || // We leave the current main axis only if every placement on that axis
1564
- // overflows the main axis.
1565
- x.every((q) => k(q.placement) === y ? q.overflows[0] > 0 : !0)))
1566
- return {
1567
- data: {
1568
- index: C,
1569
- overflows: x
1570
- },
1571
- reset: {
1572
- placement: j
1573
- }
1574
- };
1575
- let N = (D = x.filter((P) => P.overflows[0] <= 0).sort((P, q) => P.overflows[1] - q.overflows[1])[0]) == null ? void 0 : D.placement;
1576
- if (!N)
1577
- switch (f) {
1578
- case "bestFit": {
1579
- var L;
1580
- const P = (L = x.filter((q) => {
1581
- if (b) {
1582
- const K = k(q.placement);
1583
- return K === y || // Create a bias to the `y` side axis due to horizontal
1584
- // reading directions favoring greater width.
1585
- K === "y";
1586
- }
1587
- return !0;
1588
- }).map((q) => [q.placement, q.overflows.filter((K) => K > 0).reduce((K, Lt) => K + Lt, 0)]).sort((q, K) => q[1] - K[1])[0]) == null ? void 0 : L[0];
1589
- P && (N = P);
1590
- break;
1591
- }
1592
- case "initialPlacement":
1593
- N = a;
1594
- break;
1595
- }
1596
- if (i !== N)
1597
- return {
1598
- reset: {
1599
- placement: N
1600
- }
1601
- };
1602
- }
1603
- return {};
1604
- }
1605
- };
1606
- };
1607
- function et(e, t) {
1608
- return {
1609
- top: e.top - t.height,
1610
- right: e.right - t.width,
1611
- bottom: e.bottom - t.height,
1612
- left: e.left - t.width
1613
- };
1614
- }
1615
- function tt(e) {
1616
- return yt.some((t) => e[t] >= 0);
1617
- }
1618
- const lr = function(e) {
1619
- return e === void 0 && (e = {}), {
1620
- name: "hide",
1621
- options: e,
1622
- async fn(t) {
1623
- const {
1624
- rects: r
1625
- } = t, {
1626
- strategy: n = "referenceHidden",
1627
- ...i
1628
- } = G(e, t);
1629
- switch (n) {
1630
- case "referenceHidden": {
1631
- const o = await te(t, {
1632
- ...i,
1633
- elementContext: "reference"
1634
- }), s = et(o, r.reference);
1635
- return {
1636
- data: {
1637
- referenceHiddenOffsets: s,
1638
- referenceHidden: tt(s)
1639
- }
1640
- };
1641
- }
1642
- case "escaped": {
1643
- const o = await te(t, {
1644
- ...i,
1645
- altBoundary: !0
1646
- }), s = et(o, r.floating);
1647
- return {
1648
- data: {
1649
- escapedOffsets: s,
1650
- escaped: tt(s)
1651
- }
1652
- };
1653
- }
1654
- default:
1655
- return {};
1656
- }
1657
- }
1658
- };
1659
- };
1660
- function bt(e) {
1661
- const t = H(...e.map((o) => o.left)), r = H(...e.map((o) => o.top)), n = T(...e.map((o) => o.right)), i = T(...e.map((o) => o.bottom));
1662
- return {
1663
- x: t,
1664
- y: r,
1665
- width: n - t,
1666
- height: i - r
1667
- };
1668
- }
1669
- function ur(e) {
1670
- const t = e.slice().sort((i, o) => i.y - o.y), r = [];
1671
- let n = null;
1672
- for (let i = 0; i < t.length; i++) {
1673
- const o = t[i];
1674
- !n || o.y - n.y > n.height / 2 ? r.push([o]) : r[r.length - 1].push(o), n = o;
1675
- }
1676
- return r.map((i) => ee(bt(i)));
1677
- }
1678
- const fr = function(e) {
1679
- return e === void 0 && (e = {}), {
1680
- name: "inline",
1681
- options: e,
1682
- async fn(t) {
1683
- const {
1684
- placement: r,
1685
- elements: n,
1686
- rects: i,
1687
- platform: o,
1688
- strategy: s
1689
- } = t, {
1690
- padding: a = 2,
1691
- x: l,
1692
- y: u
1693
- } = G(e, t), h = Array.from(await (o.getClientRects == null ? void 0 : o.getClientRects(n.reference)) || []), c = ur(h), m = ee(bt(h)), f = _e(a);
1694
- function g() {
1695
- if (c.length === 2 && c[0].left > c[1].right && l != null && u != null)
1696
- return c.find((p) => l > p.left - f.left && l < p.right + f.right && u > p.top - f.top && u < p.bottom + f.bottom) || m;
1697
- if (c.length >= 2) {
1698
- if (k(r) === "y") {
1699
- const x = c[0], A = c[c.length - 1], D = V(r) === "top", L = x.top, C = A.bottom, j = D ? x.left : A.left, N = D ? x.right : A.right, P = N - j, q = C - L;
1700
- return {
1701
- top: L,
1702
- bottom: C,
1703
- left: j,
1704
- right: N,
1705
- width: P,
1706
- height: q,
1707
- x: j,
1708
- y: L
1709
- };
1710
- }
1711
- const p = V(r) === "left", v = T(...c.map((x) => x.right)), y = H(...c.map((x) => x.left)), w = c.filter((x) => p ? x.left === y : x.right === v), E = w[0].top, S = w[w.length - 1].bottom, b = y, O = v, R = O - b, _ = S - E;
1712
- return {
1713
- top: E,
1714
- bottom: S,
1715
- left: b,
1716
- right: O,
1717
- width: R,
1718
- height: _,
1719
- x: b,
1720
- y: E
1721
- };
1722
- }
1723
- return m;
1724
- }
1725
- const d = await o.getElementRects({
1726
- reference: {
1727
- getBoundingClientRect: g
1728
- },
1729
- floating: n.floating,
1730
- strategy: s
1731
- });
1732
- return i.reference.x !== d.reference.x || i.reference.y !== d.reference.y || i.reference.width !== d.reference.width || i.reference.height !== d.reference.height ? {
1733
- reset: {
1734
- rects: d
1735
- }
1736
- } : {};
1737
- }
1738
- };
1739
- }, dr = /* @__PURE__ */ new Set(["left", "top"]);
1740
- async function hr(e, t) {
1741
- const {
1742
- placement: r,
1743
- platform: n,
1744
- elements: i
1745
- } = e, o = await (n.isRTL == null ? void 0 : n.isRTL(i.floating)), s = V(r), a = I(r), l = k(r) === "y", u = dr.has(s) ? -1 : 1, h = o && l ? -1 : 1, c = G(t, e);
1746
- let {
1747
- mainAxis: m,
1748
- crossAxis: f,
1749
- alignmentAxis: g
1750
- } = typeof c == "number" ? {
1751
- mainAxis: c,
1752
- crossAxis: 0,
1753
- alignmentAxis: null
1754
- } : {
1755
- mainAxis: c.mainAxis || 0,
1756
- crossAxis: c.crossAxis || 0,
1757
- alignmentAxis: c.alignmentAxis
1758
- };
1759
- return a && typeof g == "number" && (f = a === "end" ? g * -1 : g), l ? {
1760
- x: f * h,
1761
- y: m * u
1762
- } : {
1763
- x: m * u,
1764
- y: f * h
1765
- };
1766
- }
1767
- const pr = function(e) {
1768
- return e === void 0 && (e = 0), {
1769
- name: "offset",
1770
- options: e,
1771
- async fn(t) {
1772
- var r, n;
1773
- const {
1774
- x: i,
1775
- y: o,
1776
- placement: s,
1777
- middlewareData: a
1778
- } = t, l = await hr(t, e);
1779
- return s === ((r = a.offset) == null ? void 0 : r.placement) && (n = a.arrow) != null && n.alignmentOffset ? {} : {
1780
- x: i + l.x,
1781
- y: o + l.y,
1782
- data: {
1783
- ...l,
1784
- placement: s
1785
- }
1786
- };
1787
- }
1788
- };
1789
- }, mr = function(e) {
1790
- return e === void 0 && (e = {}), {
1791
- name: "shift",
1792
- options: e,
1793
- async fn(t) {
1794
- const {
1795
- x: r,
1796
- y: n,
1797
- placement: i
1798
- } = t, {
1799
- mainAxis: o = !0,
1800
- crossAxis: s = !1,
1801
- limiter: a = {
1802
- fn: (p) => {
1803
- let {
1804
- x: v,
1805
- y
1806
- } = p;
1807
- return {
1808
- x: v,
1809
- y
1810
- };
1811
- }
1812
- },
1813
- ...l
1814
- } = G(e, t), u = {
1815
- x: r,
1816
- y: n
1817
- }, h = await te(t, l), c = k(V(i)), m = wt(c);
1818
- let f = u[m], g = u[c];
1819
- if (o) {
1820
- const p = m === "y" ? "top" : "left", v = m === "y" ? "bottom" : "right", y = f + h[p], w = f - h[v];
1821
- f = xe(y, f, w);
1822
- }
1823
- if (s) {
1824
- const p = c === "y" ? "top" : "left", v = c === "y" ? "bottom" : "right", y = g + h[p], w = g - h[v];
1825
- g = xe(y, g, w);
1826
- }
1827
- const d = a.fn({
1828
- ...t,
1829
- [m]: f,
1830
- [c]: g
1831
- });
1832
- return {
1833
- ...d,
1834
- data: {
1835
- x: d.x - r,
1836
- y: d.y - n,
1837
- enabled: {
1838
- [m]: o,
1839
- [c]: s
1840
- }
1841
- }
1842
- };
1843
- }
1844
- };
1845
- }, gr = function(e) {
1846
- return e === void 0 && (e = {}), {
1847
- name: "size",
1848
- options: e,
1849
- async fn(t) {
1850
- var r, n;
1851
- const {
1852
- placement: i,
1853
- rects: o,
1854
- platform: s,
1855
- elements: a
1856
- } = t, {
1857
- apply: l = () => {
1858
- },
1859
- ...u
1860
- } = G(e, t), h = await te(t, u), c = V(i), m = I(i), f = k(i) === "y", {
1861
- width: g,
1862
- height: d
1863
- } = o.floating;
1864
- let p, v;
1865
- c === "top" || c === "bottom" ? (p = c, v = m === (await (s.isRTL == null ? void 0 : s.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (v = c, p = m === "end" ? "top" : "bottom");
1866
- const y = d - h.top - h.bottom, w = g - h.left - h.right, E = H(d - h[p], y), S = H(g - h[v], w), b = !t.middlewareData.shift;
1867
- let O = E, R = S;
1868
- if ((r = t.middlewareData.shift) != null && r.enabled.x && (R = w), (n = t.middlewareData.shift) != null && n.enabled.y && (O = y), b && !m) {
1869
- const x = T(h.left, 0), A = T(h.right, 0), D = T(h.top, 0), L = T(h.bottom, 0);
1870
- f ? R = g - 2 * (x !== 0 || A !== 0 ? x + A : T(h.left, h.right)) : O = d - 2 * (D !== 0 || L !== 0 ? D + L : T(h.top, h.bottom));
1871
- }
1872
- await l({
1873
- ...t,
1874
- availableWidth: R,
1875
- availableHeight: O
1876
- });
1877
- const _ = await s.getDimensions(a.floating);
1878
- return g !== _.width || d !== _.height ? {
1879
- reset: {
1880
- rects: !0
1881
- }
1882
- } : {};
1883
- }
1884
- };
1885
- };
1886
- function he() {
1887
- return typeof window < "u";
1888
- }
1889
- function re(e) {
1890
- return St(e) ? (e.nodeName || "").toLowerCase() : "#document";
1891
- }
1892
- function M(e) {
1893
- var t;
1894
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
1895
- }
1896
- function z(e) {
1897
- var t;
1898
- return (t = (St(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
1899
- }
1900
- function St(e) {
1901
- return he() ? e instanceof Node || e instanceof M(e).Node : !1;
1902
- }
1903
- function W(e) {
1904
- return he() ? e instanceof Element || e instanceof M(e).Element : !1;
1905
- }
1906
- function U(e) {
1907
- return he() ? e instanceof HTMLElement || e instanceof M(e).HTMLElement : !1;
1908
- }
1909
- function nt(e) {
1910
- return !he() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof M(e).ShadowRoot;
1911
- }
1912
- const vr = /* @__PURE__ */ new Set(["inline", "contents"]);
1913
- function se(e) {
1914
- const {
1915
- overflow: t,
1916
- overflowX: r,
1917
- overflowY: n,
1918
- display: i
1919
- } = $(e);
1920
- return /auto|scroll|overlay|hidden|clip/.test(t + n + r) && !vr.has(i);
1921
- }
1922
- const yr = /* @__PURE__ */ new Set(["table", "td", "th"]);
1923
- function wr(e) {
1924
- return yr.has(re(e));
1925
- }
1926
- const Er = [":popover-open", ":modal"];
1927
- function pe(e) {
1928
- return Er.some((t) => {
1929
- try {
1930
- return e.matches(t);
1931
- } catch {
1932
- return !1;
1933
- }
1934
- });
1935
- }
1936
- const br = ["transform", "translate", "scale", "rotate", "perspective"], Sr = ["transform", "translate", "scale", "rotate", "perspective", "filter"], xr = ["paint", "layout", "strict", "content"];
1937
- function De(e) {
1938
- const t = Te(), r = W(e) ? $(e) : e;
1939
- return br.some((n) => r[n] ? r[n] !== "none" : !1) || (r.containerType ? r.containerType !== "normal" : !1) || !t && (r.backdropFilter ? r.backdropFilter !== "none" : !1) || !t && (r.filter ? r.filter !== "none" : !1) || Sr.some((n) => (r.willChange || "").includes(n)) || xr.some((n) => (r.contain || "").includes(n));
1940
- }
1941
- function Or(e) {
1942
- let t = X(e);
1943
- for (; U(t) && !ne(t); ) {
1944
- if (De(t))
1945
- return t;
1946
- if (pe(t))
1947
- return null;
1948
- t = X(t);
1949
- }
1950
- return null;
1951
- }
1952
- function Te() {
1953
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1954
- }
1955
- const Rr = /* @__PURE__ */ new Set(["html", "body", "#document"]);
1956
- function ne(e) {
1957
- return Rr.has(re(e));
1958
- }
1959
- function $(e) {
1960
- return M(e).getComputedStyle(e);
1961
- }
1962
- function me(e) {
1963
- return W(e) ? {
1964
- scrollLeft: e.scrollLeft,
1965
- scrollTop: e.scrollTop
1966
- } : {
1967
- scrollLeft: e.scrollX,
1968
- scrollTop: e.scrollY
1969
- };
1970
- }
1971
- function X(e) {
1972
- if (re(e) === "html")
1973
- return e;
1974
- const t = (
1975
- // Step into the shadow DOM of the parent of a slotted node.
1976
- e.assignedSlot || // DOM Element detected.
1977
- e.parentNode || // ShadowRoot detected.
1978
- nt(e) && e.host || // Fallback.
1979
- z(e)
1980
- );
1981
- return nt(t) ? t.host : t;
1982
- }
1983
- function xt(e) {
1984
- const t = X(e);
1985
- return ne(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : U(t) && se(t) ? t : xt(t);
1986
- }
1987
- function Ot(e, t, r) {
1988
- var n;
1989
- t === void 0 && (t = []);
1990
- const i = xt(e), o = i === ((n = e.ownerDocument) == null ? void 0 : n.body), s = M(i);
1991
- return o ? (Oe(s), t.concat(s, s.visualViewport || [], se(i) ? i : [], [])) : t.concat(i, Ot(i, []));
1992
- }
1993
- function Oe(e) {
1994
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
1995
- }
1996
- function Rt(e) {
1997
- const t = $(e);
1998
- let r = parseFloat(t.width) || 0, n = parseFloat(t.height) || 0;
1999
- const i = U(e), o = i ? e.offsetWidth : r, s = i ? e.offsetHeight : n, a = ue(r) !== o || ue(n) !== s;
2000
- return a && (r = o, n = s), {
2001
- width: r,
2002
- height: n,
2003
- $: a
2004
- };
2005
- }
2006
- function At(e) {
2007
- return W(e) ? e : e.contextElement;
2008
- }
2009
- function Q(e) {
2010
- const t = At(e);
2011
- if (!U(t))
2012
- return F(1);
2013
- const r = t.getBoundingClientRect(), {
2014
- width: n,
2015
- height: i,
2016
- $: o
2017
- } = Rt(t);
2018
- let s = (o ? ue(r.width) : r.width) / n, a = (o ? ue(r.height) : r.height) / i;
2019
- return (!s || !Number.isFinite(s)) && (s = 1), (!a || !Number.isFinite(a)) && (a = 1), {
2020
- x: s,
2021
- y: a
2022
- };
2023
- }
2024
- const Ar = /* @__PURE__ */ F(0);
2025
- function Ct(e) {
2026
- const t = M(e);
2027
- return !Te() || !t.visualViewport ? Ar : {
2028
- x: t.visualViewport.offsetLeft,
2029
- y: t.visualViewport.offsetTop
2030
- };
2031
- }
2032
- function Cr(e, t, r) {
2033
- return t === void 0 && (t = !1), !r || t && r !== M(e) ? !1 : t;
2034
- }
2035
- function oe(e, t, r, n) {
2036
- t === void 0 && (t = !1), r === void 0 && (r = !1);
2037
- const i = e.getBoundingClientRect(), o = At(e);
2038
- let s = F(1);
2039
- t && (n ? W(n) && (s = Q(n)) : s = Q(e));
2040
- const a = Cr(o, r, n) ? Ct(o) : F(0);
2041
- let l = (i.left + a.x) / s.x, u = (i.top + a.y) / s.y, h = i.width / s.x, c = i.height / s.y;
2042
- if (o) {
2043
- const m = M(o), f = n && W(n) ? M(n) : n;
2044
- let g = m, d = Oe(g);
2045
- for (; d && n && f !== g; ) {
2046
- const p = Q(d), v = d.getBoundingClientRect(), y = $(d), w = v.left + (d.clientLeft + parseFloat(y.paddingLeft)) * p.x, E = v.top + (d.clientTop + parseFloat(y.paddingTop)) * p.y;
2047
- l *= p.x, u *= p.y, h *= p.x, c *= p.y, l += w, u += E, g = M(d), d = Oe(g);
2048
- }
2049
- }
2050
- return ee({
2051
- width: h,
2052
- height: c,
2053
- x: l,
2054
- y: u
2055
- });
2056
- }
2057
- function ge(e, t) {
2058
- const r = me(e).scrollLeft;
2059
- return t ? t.left + r : oe(z(e)).left + r;
2060
- }
2061
- function _t(e, t) {
2062
- const r = e.getBoundingClientRect(), n = r.left + t.scrollLeft - ge(e, r), i = r.top + t.scrollTop;
2063
- return {
2064
- x: n,
2065
- y: i
2066
- };
2067
- }
2068
- function _r(e) {
2069
- let {
2070
- elements: t,
2071
- rect: r,
2072
- offsetParent: n,
2073
- strategy: i
2074
- } = e;
2075
- const o = i === "fixed", s = z(n), a = t ? pe(t.floating) : !1;
2076
- if (n === s || a && o)
2077
- return r;
2078
- let l = {
2079
- scrollLeft: 0,
2080
- scrollTop: 0
2081
- }, u = F(1);
2082
- const h = F(0), c = U(n);
2083
- if ((c || !c && !o) && ((re(n) !== "body" || se(s)) && (l = me(n)), U(n))) {
2084
- const f = oe(n);
2085
- u = Q(n), h.x = f.x + n.clientLeft, h.y = f.y + n.clientTop;
2086
- }
2087
- const m = s && !c && !o ? _t(s, l) : F(0);
2088
- return {
2089
- width: r.width * u.x,
2090
- height: r.height * u.y,
2091
- x: r.x * u.x - l.scrollLeft * u.x + h.x + m.x,
2092
- y: r.y * u.y - l.scrollTop * u.y + h.y + m.y
2093
- };
2094
- }
2095
- function Dr(e) {
2096
- return Array.from(e.getClientRects());
2097
- }
2098
- function Tr(e) {
2099
- const t = z(e), r = me(e), n = e.ownerDocument.body, i = T(t.scrollWidth, t.clientWidth, n.scrollWidth, n.clientWidth), o = T(t.scrollHeight, t.clientHeight, n.scrollHeight, n.clientHeight);
2100
- let s = -r.scrollLeft + ge(e);
2101
- const a = -r.scrollTop;
2102
- return $(n).direction === "rtl" && (s += T(t.clientWidth, n.clientWidth) - i), {
2103
- width: i,
2104
- height: o,
2105
- x: s,
2106
- y: a
2107
- };
2108
- }
2109
- const rt = 25;
2110
- function Lr(e, t) {
2111
- const r = M(e), n = z(e), i = r.visualViewport;
2112
- let o = n.clientWidth, s = n.clientHeight, a = 0, l = 0;
2113
- if (i) {
2114
- o = i.width, s = i.height;
2115
- const h = Te();
2116
- (!h || h && t === "fixed") && (a = i.offsetLeft, l = i.offsetTop);
2117
- }
2118
- const u = ge(n);
2119
- if (u <= 0) {
2120
- const h = n.ownerDocument, c = h.body, m = getComputedStyle(c), f = h.compatMode === "CSS1Compat" && parseFloat(m.marginLeft) + parseFloat(m.marginRight) || 0, g = Math.abs(n.clientWidth - c.clientWidth - f);
2121
- g <= rt && (o -= g);
2122
- } else u <= rt && (o += u);
2123
- return {
2124
- width: o,
2125
- height: s,
2126
- x: a,
2127
- y: l
2128
- };
2129
- }
2130
- const Pr = /* @__PURE__ */ new Set(["absolute", "fixed"]);
2131
- function qr(e, t) {
2132
- const r = oe(e, !0, t === "fixed"), n = r.top + e.clientTop, i = r.left + e.clientLeft, o = U(e) ? Q(e) : F(1), s = e.clientWidth * o.x, a = e.clientHeight * o.y, l = i * o.x, u = n * o.y;
2133
- return {
2134
- width: s,
2135
- height: a,
2136
- x: l,
2137
- y: u
2138
- };
2139
- }
2140
- function it(e, t, r) {
2141
- let n;
2142
- if (t === "viewport")
2143
- n = Lr(e, r);
2144
- else if (t === "document")
2145
- n = Tr(z(e));
2146
- else if (W(t))
2147
- n = qr(t, r);
2148
- else {
2149
- const i = Ct(e);
2150
- n = {
2151
- x: t.x - i.x,
2152
- y: t.y - i.y,
2153
- width: t.width,
2154
- height: t.height
2155
- };
2156
- }
2157
- return ee(n);
2158
- }
2159
- function Dt(e, t) {
2160
- const r = X(e);
2161
- return r === t || !W(r) || ne(r) ? !1 : $(r).position === "fixed" || Dt(r, t);
2162
- }
2163
- function Mr(e, t) {
2164
- const r = t.get(e);
2165
- if (r)
2166
- return r;
2167
- let n = Ot(e, []).filter((a) => W(a) && re(a) !== "body"), i = null;
2168
- const o = $(e).position === "fixed";
2169
- let s = o ? X(e) : e;
2170
- for (; W(s) && !ne(s); ) {
2171
- const a = $(s), l = De(s);
2172
- !l && a.position === "fixed" && (i = null), (o ? !l && !i : !l && a.position === "static" && !!i && Pr.has(i.position) || se(s) && !l && Dt(e, s)) ? n = n.filter((h) => h !== s) : i = a, s = X(s);
2173
- }
2174
- return t.set(e, n), n;
2175
- }
2176
- function Nr(e) {
2177
- let {
2178
- element: t,
2179
- boundary: r,
2180
- rootBoundary: n,
2181
- strategy: i
2182
- } = e;
2183
- const s = [...r === "clippingAncestors" ? pe(t) ? [] : Mr(t, this._c) : [].concat(r), n], a = s[0], l = s.reduce((u, h) => {
2184
- const c = it(t, h, i);
2185
- return u.top = T(c.top, u.top), u.right = H(c.right, u.right), u.bottom = H(c.bottom, u.bottom), u.left = T(c.left, u.left), u;
2186
- }, it(t, a, i));
2187
- return {
2188
- width: l.right - l.left,
2189
- height: l.bottom - l.top,
2190
- x: l.left,
2191
- y: l.top
2192
- };
2193
- }
2194
- function Vr(e) {
2195
- const {
2196
- width: t,
2197
- height: r
2198
- } = Rt(e);
2199
- return {
2200
- width: t,
2201
- height: r
2202
- };
2203
- }
2204
- function jr(e, t, r) {
2205
- const n = U(t), i = z(t), o = r === "fixed", s = oe(e, !0, o, t);
2206
- let a = {
2207
- scrollLeft: 0,
2208
- scrollTop: 0
2209
- };
2210
- const l = F(0);
2211
- function u() {
2212
- l.x = ge(i);
2213
- }
2214
- if (n || !n && !o)
2215
- if ((re(t) !== "body" || se(i)) && (a = me(t)), n) {
2216
- const f = oe(t, !0, o, t);
2217
- l.x = f.x + t.clientLeft, l.y = f.y + t.clientTop;
2218
- } else i && u();
2219
- o && !n && i && u();
2220
- const h = i && !n && !o ? _t(i, a) : F(0), c = s.left + a.scrollLeft - l.x - h.x, m = s.top + a.scrollTop - l.y - h.y;
2221
- return {
2222
- x: c,
2223
- y: m,
2224
- width: s.width,
2225
- height: s.height
2226
- };
2227
- }
2228
- function be(e) {
2229
- return $(e).position === "static";
2230
- }
2231
- function ot(e, t) {
2232
- if (!U(e) || $(e).position === "fixed")
2233
- return null;
2234
- if (t)
2235
- return t(e);
2236
- let r = e.offsetParent;
2237
- return z(e) === r && (r = r.ownerDocument.body), r;
2238
- }
2239
- function Tt(e, t) {
2240
- const r = M(e);
2241
- if (pe(e))
2242
- return r;
2243
- if (!U(e)) {
2244
- let i = X(e);
2245
- for (; i && !ne(i); ) {
2246
- if (W(i) && !be(i))
2247
- return i;
2248
- i = X(i);
2249
- }
2250
- return r;
2251
- }
2252
- let n = ot(e, t);
2253
- for (; n && wr(n) && be(n); )
2254
- n = ot(n, t);
2255
- return n && ne(n) && be(n) && !De(n) ? r : n || Or(e) || r;
2256
- }
2257
- const Ir = async function(e) {
2258
- const t = this.getOffsetParent || Tt, r = this.getDimensions, n = await r(e.floating);
2259
- return {
2260
- reference: jr(e.reference, await t(e.floating), e.strategy),
2261
- floating: {
2262
- x: 0,
2263
- y: 0,
2264
- width: n.width,
2265
- height: n.height
2266
- }
2267
- };
2268
- };
2269
- function Br(e) {
2270
- return $(e).direction === "rtl";
2271
- }
2272
- const Wr = {
2273
- convertOffsetParentRelativeRectToViewportRelativeRect: _r,
2274
- getDocumentElement: z,
2275
- getClippingRect: Nr,
2276
- getOffsetParent: Tt,
2277
- getElementRects: Ir,
2278
- getClientRects: Dr,
2279
- getDimensions: Vr,
2280
- getScale: Q,
2281
- isElement: W,
2282
- isRTL: Br
2283
- }, Qr = pr, Zr = ar, ei = mr, ti = cr, ni = gr, ri = lr, ii = or, oi = fr, si = (e, t, r) => {
2284
- const n = /* @__PURE__ */ new Map(), i = {
2285
- platform: Wr,
2286
- ...r
2287
- }, o = {
2288
- ...i.platform,
2289
- _c: n
2290
- };
2291
- return ir(e, t, {
2292
- ...i,
2293
- platform: o
2294
- });
2295
- };
2296
- function $r(e) {
2297
- try {
2298
- return JSON.stringify(e);
2299
- } catch {
2300
- return JSON.stringify({});
2301
- }
2302
- }
2303
- function ai(e, t = !1) {
2304
- return (r) => {
2305
- const n = e.startsWith("data-") ? e : `data-${e}`;
2306
- let i = decodeURIComponent(r.getAttribute(n));
2307
- if (i == null || typeof i == "string" && i === "null")
2308
- try {
2309
- const a = r.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);
2310
- a && a.length > 0 && (i = (a.map((u) => u.trim()).reduce((u, h) => {
2311
- const c = h.indexOf("="), m = [h.slice(0, c), h.slice(c + 1).slice(1, -1)];
2312
- return u[m[0]] = m[1], u;
2313
- }, {})[e.toLowerCase()] || "").replaceAll("&quot;", '"'));
2314
- } catch (s) {
2315
- console.error("Error getDatasetAttribute ", s.message, r);
2316
- }
2317
- if (t)
2318
- try {
2319
- return JSON.parse(i);
2320
- } catch {
2321
- return {};
2322
- }
2323
- if (i.includes("%") || i.includes("auto"))
2324
- return i;
2325
- const o = Number.parseInt(i);
2326
- return o !== o ? i : o;
2327
- };
2328
- }
2329
- function ci(e) {
2330
- const { attrs: t } = e;
2331
- return Object.keys(t).reduce((r, n) => {
2332
- const i = t[n];
2333
- if (i == null)
2334
- return r;
2335
- let o = "";
2336
- return typeof i == "object" ? o = $r(i) : o = i, r[n] = o, r;
2337
- }, /* @__PURE__ */ Object.create(null));
2338
- }
2339
- export {
2340
- mt as E,
2341
- Xr as N,
2342
- Yr as R,
2343
- zn as a,
2344
- si as b,
2345
- Jr as c,
2346
- ei as d,
2347
- ii as e,
2348
- ti as f,
2349
- ai as g,
2350
- ni as h,
2351
- Zr as i,
2352
- ri as j,
2353
- oi as k,
2354
- Wn as l,
2355
- zr as m,
2356
- ci as n,
2357
- Qr as o,
2358
- Gr as p,
2359
- dt as s,
2360
- Kr as u
2361
- };