reactjs-tiptap-editor 1.0.9 → 1.0.11

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 (159) hide show
  1. package/lib/{ActionMenuButton-CmDopTWt.cjs → ActionMenuButton-BLlse5KO.cjs} +1 -1
  2. package/lib/{ActionMenuButton-C4aNFFa8.js → ActionMenuButton-DTXFBdGX.js} +2 -2
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +7 -7
  5. package/lib/Blockquote.cjs +1 -1
  6. package/lib/Blockquote.js +3 -3
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +6 -6
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +3 -3
  11. package/lib/Clear.cjs +1 -1
  12. package/lib/Clear.js +3 -3
  13. package/lib/Code.cjs +1 -1
  14. package/lib/Code.js +6 -6
  15. package/lib/CodeBlock.cjs +1 -1
  16. package/lib/CodeBlock.js +4 -4
  17. package/lib/CodeView.cjs +1 -1
  18. package/lib/CodeView.js +3 -3
  19. package/lib/Color.cjs +1 -1
  20. package/lib/Color.js +5 -5
  21. package/lib/Column.cjs +1 -1
  22. package/lib/Column.js +8 -8
  23. package/lib/{Drawer-DG0gPU_U.js → Drawer-D0yQ0wR7.js} +6 -6
  24. package/lib/{Drawer-CTr2snNd.cjs → Drawer-kv6BU_6O.cjs} +1 -1
  25. package/lib/Drawer.cjs +1 -1
  26. package/lib/Drawer.js +3 -3
  27. package/lib/Emoji.cjs +1 -1
  28. package/lib/Emoji.js +8 -7
  29. package/lib/{Excalidraw-DtezFdjR.cjs → Excalidraw-B82ThkJA.cjs} +1 -1
  30. package/lib/{Excalidraw-DpgdxOsc.js → Excalidraw-CO4IRHmG.js} +7 -7
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +2 -2
  33. package/lib/ExportPdf.cjs +1 -1
  34. package/lib/ExportPdf.js +3 -3
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +3 -3
  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/Heading.cjs +1 -1
  42. package/lib/Heading.js +5 -5
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +5 -5
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +4 -4
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +3 -3
  49. package/lib/{Icon-C_buGjWy.js → Icon-DRuJhcHK.js} +1 -1
  50. package/lib/{Icon-b6HQAURz.cjs → Icon-DXePECFW.cjs} +1 -1
  51. package/lib/{Iframe-CUrXCDxj.cjs → Iframe-03dn9wcM.cjs} +1 -1
  52. package/lib/{Iframe-De88TYvj.js → Iframe-BEO28NPs.js} +8 -8
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +2 -2
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +13 -13
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +14 -14
  59. package/lib/ImportWord.cjs +1 -1
  60. package/lib/ImportWord.js +3 -3
  61. package/lib/{Indent-Bensb2nf.js → Indent-CXurBbOr.js} +5 -5
  62. package/lib/{Indent-D_KtZNHW.cjs → Indent-Cqjdn3Jt.cjs} +1 -1
  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 +3 -3
  67. package/lib/{Katex-C0dtqznb.js → Katex-Bvj469K1.js} +7 -7
  68. package/lib/{Katex-NqelWRoi.cjs → Katex-DdWTV5NJ.cjs} +1 -1
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +2 -2
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +5 -5
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +2 -2
  75. package/lib/{LinkEditBlock-BSZ-vgNB.cjs → LinkEditBlock-8ePAZ-G1.cjs} +1 -1
  76. package/lib/{LinkEditBlock-Bv12sKvW.js → LinkEditBlock-DjXUEubR.js} +32 -32
  77. package/lib/Mention.cjs +1 -1
  78. package/lib/Mention.js +23 -22
  79. package/lib/Mermaid.cjs +1 -1
  80. package/lib/Mermaid.js +26 -26
  81. package/lib/MoreMark.cjs +1 -1
  82. package/lib/MoreMark.js +5 -5
  83. package/lib/OrderedList.cjs +1 -1
  84. package/lib/OrderedList.js +3 -3
  85. package/lib/SearchAndReplace.cjs +1 -1
  86. package/lib/SearchAndReplace.js +9 -9
  87. package/lib/SlashCommand.cjs +1 -1
  88. package/lib/SlashCommand.js +39 -266
  89. package/lib/SlashCommandNodeView-Bl_gwZJB.cjs +1 -0
  90. package/lib/SlashCommandNodeView-CcqL8ymb.js +254 -0
  91. package/lib/Strike.cjs +1 -1
  92. package/lib/Strike.js +3 -3
  93. package/lib/{Table-D9ckv6Tb.js → Table-9Y0Cg8Ab.js} +5 -5
  94. package/lib/{Table-cy1mUM2X.cjs → Table-DBGjezZK.cjs} +1 -1
  95. package/lib/Table.cjs +1 -1
  96. package/lib/Table.js +1 -1
  97. package/lib/TaskList.cjs +1 -1
  98. package/lib/TaskList.js +3 -3
  99. package/lib/TextAlign.cjs +1 -1
  100. package/lib/TextAlign.js +5 -5
  101. package/lib/TextDirection.cjs +1 -1
  102. package/lib/TextDirection.js +5 -5
  103. package/lib/TextUnderline.cjs +1 -1
  104. package/lib/TextUnderline.js +3 -3
  105. package/lib/{Twitter-Bvs3sW8F.cjs → Twitter-Cnvt7GBg.cjs} +1 -1
  106. package/lib/{Twitter-KUvyySA0.js → Twitter-DWwd0vHR.js} +46 -46
  107. package/lib/Twitter.cjs +1 -1
  108. package/lib/Twitter.js +2 -2
  109. package/lib/Video.cjs +1 -1
  110. package/lib/Video.js +7 -7
  111. package/lib/bubble.cjs +4 -4
  112. package/lib/bubble.js +1659 -1567
  113. package/lib/{button-U6XpZt2X.cjs → button-BW5bDPz_.cjs} +1 -1
  114. package/lib/{button-D8SI-g7p.js → button-RnHbJfd-.js} +1 -1
  115. package/lib/{checkbox-xrY2c5yo.js → checkbox-CLSoR1Qj.js} +1 -1
  116. package/lib/{checkbox-DaIBNthL.cjs → checkbox-CTEN0q4y.cjs} +1 -1
  117. package/lib/{dialog-DgnnVCfv.cjs → dialog-CMC9hsCo.cjs} +1 -1
  118. package/lib/{dialog-DjnkASYP.js → dialog-D_HCtKvc.js} +1 -1
  119. package/lib/{dropdown-menu-bI14Gyw4.js → dropdown-menu-66q7Ofc5.js} +3 -2
  120. package/lib/dropdown-menu-DKSAS-w_.cjs +1 -0
  121. package/lib/extensions/SlashCommand/types.d.ts +1 -0
  122. package/lib/index-9A6-kVBM.js +1351 -0
  123. package/lib/{index-4pRt5Vqu.js → index-C3zg3DPB.js} +442 -403
  124. package/lib/index-C838s-or.cjs +8 -0
  125. package/lib/index-Cv9Z6dyV.cjs +1 -0
  126. package/lib/{index-EKFybgpP.js → index-DKt5wfAc.js} +1 -1
  127. package/lib/{index-BimeTI7q.js → index-DRHrDScg.js} +1 -1
  128. package/lib/{index-BQ6ZdLsu.js → index-DmPwbBqm.js} +1 -1
  129. package/lib/{index-CbIQPoF6.js → index-sVScpCFG.js} +20 -20
  130. package/lib/index.cjs +1 -1
  131. package/lib/index.js +5 -5
  132. package/lib/{input-C5zU49Q1.js → input-CvyMYMZG.js} +1 -1
  133. package/lib/{input-BtDj0NeF.cjs → input-D555880-.cjs} +1 -1
  134. package/lib/{isNumber-8HKEgTkA.js → isNumber-DF0fU3ob.js} +1 -1
  135. package/lib/{label-BEUVs-IA.js → label-DsOYPjAo.js} +1 -1
  136. package/lib/{label-C8BonzOY.cjs → label-E6jF3Xud.cjs} +1 -1
  137. package/lib/{popover-CPY5lMCj.js → popover-B7ec5-u2.js} +1 -1
  138. package/lib/{popover-DjL0De8d.cjs → popover-BSzR_R01.cjs} +1 -1
  139. package/lib/{separator-BlIlS7LP.js → separator-JaTTqb3J.js} +4 -4
  140. package/lib/{separator-BzMkiI_c.cjs → separator-PGnA-6Hr.cjs} +1 -1
  141. package/lib/{store-D_GvIPxo.js → store-Cf7tFiiI.js} +1 -1
  142. package/lib/{store-BSCjQxMK.cjs → store-oDk-lTPM.cjs} +1 -1
  143. package/lib/style.css +1 -1
  144. package/lib/{tabs-CHy82_rs.cjs → tabs-BTwiZkWd.cjs} +1 -1
  145. package/lib/{tabs-tQpXIzfV.js → tabs-CWr9HYaM.js} +1 -1
  146. package/lib/{textarea-CMDYVXYo.js → textarea-BdeLXbp8.js} +1 -1
  147. package/lib/{textarea-B-qfanCT.cjs → textarea-Yetl_PZi.cjs} +1 -1
  148. package/lib/{throttle-BIkZV3Y_.js → throttle-DsowOft0.js} +1 -1
  149. package/lib/updatePosition-Bbd8ETMv.js +16 -0
  150. package/lib/updatePosition-M2IyqkI1.cjs +1 -0
  151. package/lib/{useButtonProps-BqBGuqoP.cjs → useButtonProps-DfnJiJLV.cjs} +1 -1
  152. package/lib/{useButtonProps-DTngjZge.js → useButtonProps-cMoicZgd.js} +14 -14
  153. package/package.json +1 -1
  154. package/lib/dropdown-menu-BvVMltdB.cjs +0 -1
  155. package/lib/floating-ui.dom-U1vPFQ5f.js +0 -1151
  156. package/lib/floating-ui.dom-VCrc58uF.cjs +0 -1
  157. package/lib/index-DvvMf6Wu.cjs +0 -7
  158. package/lib/updatePosition-GLTrgcib.js +0 -215
  159. package/lib/updatePosition-u2mTh3mG.cjs +0 -1
@@ -0,0 +1,1351 @@
1
+ import { PluginKey as Kt, Plugin as Ut } from "@tiptap/pm/state";
2
+ import { DecorationSet as Gt, Decoration as Jt } from "@tiptap/pm/view";
3
+ import { P as Qt } from "./index-sVScpCFG.js";
4
+ const Bt = ["top", "right", "bottom", "left"], Rt = ["start", "end"], At = /* @__PURE__ */ Bt.reduce((t, e) => t.concat(e, e + "-" + Rt[0], e + "-" + Rt[1]), []), j = Math.min, M = Math.max, rt = Math.round, H = (t) => ({
5
+ x: t,
6
+ y: t
7
+ }), Zt = {
8
+ left: "right",
9
+ right: "left",
10
+ bottom: "top",
11
+ top: "bottom"
12
+ }, te = {
13
+ start: "end",
14
+ end: "start"
15
+ };
16
+ function ht(t, e, o) {
17
+ return M(t, j(e, o));
18
+ }
19
+ function Y(t, e) {
20
+ return typeof t == "function" ? t(e) : t;
21
+ }
22
+ function F(t) {
23
+ return t.split("-")[0];
24
+ }
25
+ function I(t) {
26
+ return t.split("-")[1];
27
+ }
28
+ function Mt(t) {
29
+ return t === "x" ? "y" : "x";
30
+ }
31
+ function wt(t) {
32
+ return t === "y" ? "height" : "width";
33
+ }
34
+ const ee = /* @__PURE__ */ new Set(["top", "bottom"]);
35
+ function V(t) {
36
+ return ee.has(F(t)) ? "y" : "x";
37
+ }
38
+ function xt(t) {
39
+ return Mt(V(t));
40
+ }
41
+ function _t(t, e, o) {
42
+ o === void 0 && (o = !1);
43
+ const n = I(t), i = xt(t), s = wt(i);
44
+ let r = i === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
45
+ return e.reference[s] > e.floating[s] && (r = lt(r)), [r, lt(r)];
46
+ }
47
+ function ne(t) {
48
+ const e = lt(t);
49
+ return [ct(t), e, ct(e)];
50
+ }
51
+ function ct(t) {
52
+ return t.replace(/start|end/g, (e) => te[e]);
53
+ }
54
+ const Ot = ["left", "right"], Ct = ["right", "left"], oe = ["top", "bottom"], ie = ["bottom", "top"];
55
+ function se(t, e, o) {
56
+ switch (t) {
57
+ case "top":
58
+ case "bottom":
59
+ return o ? e ? Ct : Ot : e ? Ot : Ct;
60
+ case "left":
61
+ case "right":
62
+ return e ? oe : ie;
63
+ default:
64
+ return [];
65
+ }
66
+ }
67
+ function re(t, e, o, n) {
68
+ const i = I(t);
69
+ let s = se(F(t), o === "start", n);
70
+ return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(ct)))), s;
71
+ }
72
+ function lt(t) {
73
+ return t.replace(/left|right|bottom|top/g, (e) => Zt[e]);
74
+ }
75
+ function ce(t) {
76
+ return {
77
+ top: 0,
78
+ right: 0,
79
+ bottom: 0,
80
+ left: 0,
81
+ ...t
82
+ };
83
+ }
84
+ function yt(t) {
85
+ return typeof t != "number" ? ce(t) : {
86
+ top: t,
87
+ right: t,
88
+ bottom: t,
89
+ left: t
90
+ };
91
+ }
92
+ function Q(t) {
93
+ const {
94
+ x: e,
95
+ y: o,
96
+ width: n,
97
+ height: i
98
+ } = t;
99
+ return {
100
+ width: n,
101
+ height: i,
102
+ top: o,
103
+ left: e,
104
+ right: e + n,
105
+ bottom: o + i,
106
+ x: e,
107
+ y: o
108
+ };
109
+ }
110
+ function Pt(t, e, o) {
111
+ let {
112
+ reference: n,
113
+ floating: i
114
+ } = t;
115
+ const s = V(e), r = xt(e), c = wt(r), f = F(e), a = s === "y", u = n.x + n.width / 2 - i.width / 2, l = n.y + n.height / 2 - i.height / 2, w = n[c] / 2 - i[c] / 2;
116
+ let g;
117
+ switch (f) {
118
+ case "top":
119
+ g = {
120
+ x: u,
121
+ y: n.y - i.height
122
+ };
123
+ break;
124
+ case "bottom":
125
+ g = {
126
+ x: u,
127
+ y: n.y + n.height
128
+ };
129
+ break;
130
+ case "right":
131
+ g = {
132
+ x: n.x + n.width,
133
+ y: l
134
+ };
135
+ break;
136
+ case "left":
137
+ g = {
138
+ x: n.x - i.width,
139
+ y: l
140
+ };
141
+ break;
142
+ default:
143
+ g = {
144
+ x: n.x,
145
+ y: n.y
146
+ };
147
+ }
148
+ switch (I(e)) {
149
+ case "start":
150
+ g[r] -= w * (o && a ? -1 : 1);
151
+ break;
152
+ case "end":
153
+ g[r] += w * (o && a ? -1 : 1);
154
+ break;
155
+ }
156
+ return g;
157
+ }
158
+ const le = async (t, e, o) => {
159
+ const {
160
+ placement: n = "bottom",
161
+ strategy: i = "absolute",
162
+ middleware: s = [],
163
+ platform: r
164
+ } = o, c = s.filter(Boolean), f = await (r.isRTL == null ? void 0 : r.isRTL(e));
165
+ let a = await r.getElementRects({
166
+ reference: t,
167
+ floating: e,
168
+ strategy: i
169
+ }), {
170
+ x: u,
171
+ y: l
172
+ } = Pt(a, n, f), w = n, g = {}, p = 0;
173
+ for (let v = 0; v < c.length; v++) {
174
+ const {
175
+ name: d,
176
+ fn: m
177
+ } = c[v], {
178
+ x: S,
179
+ y: A,
180
+ data: E,
181
+ reset: O
182
+ } = await m({
183
+ x: u,
184
+ y: l,
185
+ initialPlacement: n,
186
+ placement: w,
187
+ strategy: i,
188
+ middlewareData: g,
189
+ rects: a,
190
+ platform: r,
191
+ elements: {
192
+ reference: t,
193
+ floating: e
194
+ }
195
+ });
196
+ u = S ?? u, l = A ?? l, g = {
197
+ ...g,
198
+ [d]: {
199
+ ...g[d],
200
+ ...E
201
+ }
202
+ }, O && p <= 50 && (p++, typeof O == "object" && (O.placement && (w = O.placement), O.rects && (a = O.rects === !0 ? await r.getElementRects({
203
+ reference: t,
204
+ floating: e,
205
+ strategy: i
206
+ }) : O.rects), {
207
+ x: u,
208
+ y: l
209
+ } = Pt(a, w, f)), v = -1);
210
+ }
211
+ return {
212
+ x: u,
213
+ y: l,
214
+ placement: w,
215
+ strategy: i,
216
+ middlewareData: g
217
+ };
218
+ };
219
+ async function Z(t, e) {
220
+ var o;
221
+ e === void 0 && (e = {});
222
+ const {
223
+ x: n,
224
+ y: i,
225
+ platform: s,
226
+ rects: r,
227
+ elements: c,
228
+ strategy: f
229
+ } = t, {
230
+ boundary: a = "clippingAncestors",
231
+ rootBoundary: u = "viewport",
232
+ elementContext: l = "floating",
233
+ altBoundary: w = !1,
234
+ padding: g = 0
235
+ } = Y(e, t), p = yt(g), d = c[w ? l === "floating" ? "reference" : "floating" : l], m = Q(await s.getClippingRect({
236
+ element: (o = await (s.isElement == null ? void 0 : s.isElement(d))) == null || o ? d : d.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
237
+ boundary: a,
238
+ rootBoundary: u,
239
+ strategy: f
240
+ })), S = l === "floating" ? {
241
+ x: n,
242
+ y: i,
243
+ width: r.floating.width,
244
+ height: r.floating.height
245
+ } : r.reference, A = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), E = await (s.isElement == null ? void 0 : s.isElement(A)) ? await (s.getScale == null ? void 0 : s.getScale(A)) || {
246
+ x: 1,
247
+ y: 1
248
+ } : {
249
+ x: 1,
250
+ y: 1
251
+ }, O = Q(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
252
+ elements: c,
253
+ rect: S,
254
+ offsetParent: A,
255
+ strategy: f
256
+ }) : S);
257
+ return {
258
+ top: (m.top - O.top + p.top) / E.y,
259
+ bottom: (O.bottom - m.bottom + p.bottom) / E.y,
260
+ left: (m.left - O.left + p.left) / E.x,
261
+ right: (O.right - m.right + p.right) / E.x
262
+ };
263
+ }
264
+ const ae = (t) => ({
265
+ name: "arrow",
266
+ options: t,
267
+ async fn(e) {
268
+ const {
269
+ x: o,
270
+ y: n,
271
+ placement: i,
272
+ rects: s,
273
+ platform: r,
274
+ elements: c,
275
+ middlewareData: f
276
+ } = e, {
277
+ element: a,
278
+ padding: u = 0
279
+ } = Y(t, e) || {};
280
+ if (a == null)
281
+ return {};
282
+ const l = yt(u), w = {
283
+ x: o,
284
+ y: n
285
+ }, g = xt(i), p = wt(g), v = await r.getDimensions(a), d = g === "y", m = d ? "top" : "left", S = d ? "bottom" : "right", A = d ? "clientHeight" : "clientWidth", E = s.reference[p] + s.reference[g] - w[g] - s.floating[p], O = w[g] - s.reference[g], y = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
286
+ let b = y ? y[A] : 0;
287
+ (!b || !await (r.isElement == null ? void 0 : r.isElement(y))) && (b = c.floating[A] || s.floating[p]);
288
+ const C = E / 2 - O / 2, P = b / 2 - v[p] / 2 - 1, h = j(l[m], P), R = j(l[S], P), D = h, k = b - v[p] - R, L = b / 2 - v[p] / 2 + C, x = ht(D, L, k), $ = !f.arrow && I(i) != null && L !== x && s.reference[p] / 2 - (L < D ? h : R) - v[p] / 2 < 0, T = $ ? L < D ? L - D : L - k : 0;
289
+ return {
290
+ [g]: w[g] + T,
291
+ data: {
292
+ [g]: x,
293
+ centerOffset: L - x - T,
294
+ ...$ && {
295
+ alignmentOffset: T
296
+ }
297
+ },
298
+ reset: $
299
+ };
300
+ }
301
+ });
302
+ function fe(t, e, o) {
303
+ return (t ? [...o.filter((i) => I(i) === t), ...o.filter((i) => I(i) !== t)] : o.filter((i) => F(i) === i)).filter((i) => t ? I(i) === t || (e ? ct(i) !== i : !1) : !0);
304
+ }
305
+ const ue = function(t) {
306
+ return t === void 0 && (t = {}), {
307
+ name: "autoPlacement",
308
+ options: t,
309
+ async fn(e) {
310
+ var o, n, i;
311
+ const {
312
+ rects: s,
313
+ middlewareData: r,
314
+ placement: c,
315
+ platform: f,
316
+ elements: a
317
+ } = e, {
318
+ crossAxis: u = !1,
319
+ alignment: l,
320
+ allowedPlacements: w = At,
321
+ autoAlignment: g = !0,
322
+ ...p
323
+ } = Y(t, e), v = l !== void 0 || w === At ? fe(l || null, g, w) : w, d = await Z(e, p), m = ((o = r.autoPlacement) == null ? void 0 : o.index) || 0, S = v[m];
324
+ if (S == null)
325
+ return {};
326
+ const A = _t(S, s, await (f.isRTL == null ? void 0 : f.isRTL(a.floating)));
327
+ if (c !== S)
328
+ return {
329
+ reset: {
330
+ placement: v[0]
331
+ }
332
+ };
333
+ const E = [d[F(S)], d[A[0]], d[A[1]]], O = [...((n = r.autoPlacement) == null ? void 0 : n.overflows) || [], {
334
+ placement: S,
335
+ overflows: E
336
+ }], y = v[m + 1];
337
+ if (y)
338
+ return {
339
+ data: {
340
+ index: m + 1,
341
+ overflows: O
342
+ },
343
+ reset: {
344
+ placement: y
345
+ }
346
+ };
347
+ const b = O.map((h) => {
348
+ const R = I(h.placement);
349
+ return [h.placement, R && u ? (
350
+ // Check along the mainAxis and main crossAxis side.
351
+ h.overflows.slice(0, 2).reduce((D, k) => D + k, 0)
352
+ ) : (
353
+ // Check only the mainAxis.
354
+ h.overflows[0]
355
+ ), h.overflows];
356
+ }).sort((h, R) => h[1] - R[1]), P = ((i = b.filter((h) => h[2].slice(
357
+ 0,
358
+ // Aligned placements should not check their opposite crossAxis
359
+ // side.
360
+ I(h[0]) ? 2 : 3
361
+ ).every((R) => R <= 0))[0]) == null ? void 0 : i[0]) || b[0][0];
362
+ return P !== c ? {
363
+ data: {
364
+ index: m + 1,
365
+ overflows: O
366
+ },
367
+ reset: {
368
+ placement: P
369
+ }
370
+ } : {};
371
+ }
372
+ };
373
+ }, de = function(t) {
374
+ return t === void 0 && (t = {}), {
375
+ name: "flip",
376
+ options: t,
377
+ async fn(e) {
378
+ var o, n;
379
+ const {
380
+ placement: i,
381
+ middlewareData: s,
382
+ rects: r,
383
+ initialPlacement: c,
384
+ platform: f,
385
+ elements: a
386
+ } = e, {
387
+ mainAxis: u = !0,
388
+ crossAxis: l = !0,
389
+ fallbackPlacements: w,
390
+ fallbackStrategy: g = "bestFit",
391
+ fallbackAxisSideDirection: p = "none",
392
+ flipAlignment: v = !0,
393
+ ...d
394
+ } = Y(t, e);
395
+ if ((o = s.arrow) != null && o.alignmentOffset)
396
+ return {};
397
+ const m = F(i), S = V(c), A = F(c) === c, E = await (f.isRTL == null ? void 0 : f.isRTL(a.floating)), O = w || (A || !v ? [lt(c)] : ne(c)), y = p !== "none";
398
+ !w && y && O.push(...re(c, v, p, E));
399
+ const b = [c, ...O], C = await Z(e, d), P = [];
400
+ let h = ((n = s.flip) == null ? void 0 : n.overflows) || [];
401
+ if (u && P.push(C[m]), l) {
402
+ const L = _t(i, r, E);
403
+ P.push(C[L[0]], C[L[1]]);
404
+ }
405
+ if (h = [...h, {
406
+ placement: i,
407
+ overflows: P
408
+ }], !P.every((L) => L <= 0)) {
409
+ var R, D;
410
+ const L = (((R = s.flip) == null ? void 0 : R.index) || 0) + 1, x = b[L];
411
+ if (x && (!(l === "alignment" ? S !== V(x) : !1) || // We leave the current main axis only if every placement on that axis
412
+ // overflows the main axis.
413
+ h.every((B) => V(B.placement) === S ? B.overflows[0] > 0 : !0)))
414
+ return {
415
+ data: {
416
+ index: L,
417
+ overflows: h
418
+ },
419
+ reset: {
420
+ placement: x
421
+ }
422
+ };
423
+ let $ = (D = h.filter((T) => T.overflows[0] <= 0).sort((T, B) => T.overflows[1] - B.overflows[1])[0]) == null ? void 0 : D.placement;
424
+ if (!$)
425
+ switch (g) {
426
+ case "bestFit": {
427
+ var k;
428
+ const T = (k = h.filter((B) => {
429
+ if (y) {
430
+ const _ = V(B.placement);
431
+ return _ === S || // Create a bias to the `y` side axis due to horizontal
432
+ // reading directions favoring greater width.
433
+ _ === "y";
434
+ }
435
+ return !0;
436
+ }).map((B) => [B.placement, B.overflows.filter((_) => _ > 0).reduce((_, U) => _ + U, 0)]).sort((B, _) => B[1] - _[1])[0]) == null ? void 0 : k[0];
437
+ T && ($ = T);
438
+ break;
439
+ }
440
+ case "initialPlacement":
441
+ $ = c;
442
+ break;
443
+ }
444
+ if (i !== $)
445
+ return {
446
+ reset: {
447
+ placement: $
448
+ }
449
+ };
450
+ }
451
+ return {};
452
+ }
453
+ };
454
+ };
455
+ function Et(t, e) {
456
+ return {
457
+ top: t.top - e.height,
458
+ right: t.right - e.width,
459
+ bottom: t.bottom - e.height,
460
+ left: t.left - e.width
461
+ };
462
+ }
463
+ function Dt(t) {
464
+ return Bt.some((e) => t[e] >= 0);
465
+ }
466
+ const me = function(t) {
467
+ return t === void 0 && (t = {}), {
468
+ name: "hide",
469
+ options: t,
470
+ async fn(e) {
471
+ const {
472
+ rects: o
473
+ } = e, {
474
+ strategy: n = "referenceHidden",
475
+ ...i
476
+ } = Y(t, e);
477
+ switch (n) {
478
+ case "referenceHidden": {
479
+ const s = await Z(e, {
480
+ ...i,
481
+ elementContext: "reference"
482
+ }), r = Et(s, o.reference);
483
+ return {
484
+ data: {
485
+ referenceHiddenOffsets: r,
486
+ referenceHidden: Dt(r)
487
+ }
488
+ };
489
+ }
490
+ case "escaped": {
491
+ const s = await Z(e, {
492
+ ...i,
493
+ altBoundary: !0
494
+ }), r = Et(s, o.floating);
495
+ return {
496
+ data: {
497
+ escapedOffsets: r,
498
+ escaped: Dt(r)
499
+ }
500
+ };
501
+ }
502
+ default:
503
+ return {};
504
+ }
505
+ }
506
+ };
507
+ };
508
+ function Nt(t) {
509
+ const e = j(...t.map((s) => s.left)), o = j(...t.map((s) => s.top)), n = M(...t.map((s) => s.right)), i = M(...t.map((s) => s.bottom));
510
+ return {
511
+ x: e,
512
+ y: o,
513
+ width: n - e,
514
+ height: i - o
515
+ };
516
+ }
517
+ function ge(t) {
518
+ const e = t.slice().sort((i, s) => i.y - s.y), o = [];
519
+ let n = null;
520
+ for (let i = 0; i < e.length; i++) {
521
+ const s = e[i];
522
+ !n || s.y - n.y > n.height / 2 ? o.push([s]) : o[o.length - 1].push(s), n = s;
523
+ }
524
+ return o.map((i) => Q(Nt(i)));
525
+ }
526
+ const he = function(t) {
527
+ return t === void 0 && (t = {}), {
528
+ name: "inline",
529
+ options: t,
530
+ async fn(e) {
531
+ const {
532
+ placement: o,
533
+ elements: n,
534
+ rects: i,
535
+ platform: s,
536
+ strategy: r
537
+ } = e, {
538
+ padding: c = 2,
539
+ x: f,
540
+ y: a
541
+ } = Y(t, e), u = Array.from(await (s.getClientRects == null ? void 0 : s.getClientRects(n.reference)) || []), l = ge(u), w = Q(Nt(u)), g = yt(c);
542
+ function p() {
543
+ if (l.length === 2 && l[0].left > l[1].right && f != null && a != null)
544
+ return l.find((d) => f > d.left - g.left && f < d.right + g.right && a > d.top - g.top && a < d.bottom + g.bottom) || w;
545
+ if (l.length >= 2) {
546
+ if (V(o) === "y") {
547
+ const h = l[0], R = l[l.length - 1], D = F(o) === "top", k = h.top, L = R.bottom, x = D ? h.left : R.left, $ = D ? h.right : R.right, T = $ - x, B = L - k;
548
+ return {
549
+ top: k,
550
+ bottom: L,
551
+ left: x,
552
+ right: $,
553
+ width: T,
554
+ height: B,
555
+ x,
556
+ y: k
557
+ };
558
+ }
559
+ const d = F(o) === "left", m = M(...l.map((h) => h.right)), S = j(...l.map((h) => h.left)), A = l.filter((h) => d ? h.left === S : h.right === m), E = A[0].top, O = A[A.length - 1].bottom, y = S, b = m, C = b - y, P = O - E;
560
+ return {
561
+ top: E,
562
+ bottom: O,
563
+ left: y,
564
+ right: b,
565
+ width: C,
566
+ height: P,
567
+ x: y,
568
+ y: E
569
+ };
570
+ }
571
+ return w;
572
+ }
573
+ const v = await s.getElementRects({
574
+ reference: {
575
+ getBoundingClientRect: p
576
+ },
577
+ floating: n.floating,
578
+ strategy: r
579
+ });
580
+ return i.reference.x !== v.reference.x || i.reference.y !== v.reference.y || i.reference.width !== v.reference.width || i.reference.height !== v.reference.height ? {
581
+ reset: {
582
+ rects: v
583
+ }
584
+ } : {};
585
+ }
586
+ };
587
+ }, pe = /* @__PURE__ */ new Set(["left", "top"]);
588
+ async function we(t, e) {
589
+ const {
590
+ placement: o,
591
+ platform: n,
592
+ elements: i
593
+ } = t, s = await (n.isRTL == null ? void 0 : n.isRTL(i.floating)), r = F(o), c = I(o), f = V(o) === "y", a = pe.has(r) ? -1 : 1, u = s && f ? -1 : 1, l = Y(e, t);
594
+ let {
595
+ mainAxis: w,
596
+ crossAxis: g,
597
+ alignmentAxis: p
598
+ } = typeof l == "number" ? {
599
+ mainAxis: l,
600
+ crossAxis: 0,
601
+ alignmentAxis: null
602
+ } : {
603
+ mainAxis: l.mainAxis || 0,
604
+ crossAxis: l.crossAxis || 0,
605
+ alignmentAxis: l.alignmentAxis
606
+ };
607
+ return c && typeof p == "number" && (g = c === "end" ? p * -1 : p), f ? {
608
+ x: g * u,
609
+ y: w * a
610
+ } : {
611
+ x: w * a,
612
+ y: g * u
613
+ };
614
+ }
615
+ const xe = function(t) {
616
+ return t === void 0 && (t = 0), {
617
+ name: "offset",
618
+ options: t,
619
+ async fn(e) {
620
+ var o, n;
621
+ const {
622
+ x: i,
623
+ y: s,
624
+ placement: r,
625
+ middlewareData: c
626
+ } = e, f = await we(e, t);
627
+ return r === ((o = c.offset) == null ? void 0 : o.placement) && (n = c.arrow) != null && n.alignmentOffset ? {} : {
628
+ x: i + f.x,
629
+ y: s + f.y,
630
+ data: {
631
+ ...f,
632
+ placement: r
633
+ }
634
+ };
635
+ }
636
+ };
637
+ }, ye = function(t) {
638
+ return t === void 0 && (t = {}), {
639
+ name: "shift",
640
+ options: t,
641
+ async fn(e) {
642
+ const {
643
+ x: o,
644
+ y: n,
645
+ placement: i
646
+ } = e, {
647
+ mainAxis: s = !0,
648
+ crossAxis: r = !1,
649
+ limiter: c = {
650
+ fn: (d) => {
651
+ let {
652
+ x: m,
653
+ y: S
654
+ } = d;
655
+ return {
656
+ x: m,
657
+ y: S
658
+ };
659
+ }
660
+ },
661
+ ...f
662
+ } = Y(t, e), a = {
663
+ x: o,
664
+ y: n
665
+ }, u = await Z(e, f), l = V(F(i)), w = Mt(l);
666
+ let g = a[w], p = a[l];
667
+ if (s) {
668
+ const d = w === "y" ? "top" : "left", m = w === "y" ? "bottom" : "right", S = g + u[d], A = g - u[m];
669
+ g = ht(S, g, A);
670
+ }
671
+ if (r) {
672
+ const d = l === "y" ? "top" : "left", m = l === "y" ? "bottom" : "right", S = p + u[d], A = p - u[m];
673
+ p = ht(S, p, A);
674
+ }
675
+ const v = c.fn({
676
+ ...e,
677
+ [w]: g,
678
+ [l]: p
679
+ });
680
+ return {
681
+ ...v,
682
+ data: {
683
+ x: v.x - o,
684
+ y: v.y - n,
685
+ enabled: {
686
+ [w]: s,
687
+ [l]: r
688
+ }
689
+ }
690
+ };
691
+ }
692
+ };
693
+ }, ve = function(t) {
694
+ return t === void 0 && (t = {}), {
695
+ name: "size",
696
+ options: t,
697
+ async fn(e) {
698
+ var o, n;
699
+ const {
700
+ placement: i,
701
+ rects: s,
702
+ platform: r,
703
+ elements: c
704
+ } = e, {
705
+ apply: f = () => {
706
+ },
707
+ ...a
708
+ } = Y(t, e), u = await Z(e, a), l = F(i), w = I(i), g = V(i) === "y", {
709
+ width: p,
710
+ height: v
711
+ } = s.floating;
712
+ let d, m;
713
+ l === "top" || l === "bottom" ? (d = l, m = w === (await (r.isRTL == null ? void 0 : r.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (m = l, d = w === "end" ? "top" : "bottom");
714
+ const S = v - u.top - u.bottom, A = p - u.left - u.right, E = j(v - u[d], S), O = j(p - u[m], A), y = !e.middlewareData.shift;
715
+ let b = E, C = O;
716
+ if ((o = e.middlewareData.shift) != null && o.enabled.x && (C = A), (n = e.middlewareData.shift) != null && n.enabled.y && (b = S), y && !w) {
717
+ const h = M(u.left, 0), R = M(u.right, 0), D = M(u.top, 0), k = M(u.bottom, 0);
718
+ g ? C = p - 2 * (h !== 0 || R !== 0 ? h + R : M(u.left, u.right)) : b = v - 2 * (D !== 0 || k !== 0 ? D + k : M(u.top, u.bottom));
719
+ }
720
+ await f({
721
+ ...e,
722
+ availableWidth: C,
723
+ availableHeight: b
724
+ });
725
+ const P = await r.getDimensions(c.floating);
726
+ return p !== P.width || v !== P.height ? {
727
+ reset: {
728
+ rects: !0
729
+ }
730
+ } : {};
731
+ }
732
+ };
733
+ };
734
+ function at() {
735
+ return typeof window < "u";
736
+ }
737
+ function et(t) {
738
+ return Ft(t) ? (t.nodeName || "").toLowerCase() : "#document";
739
+ }
740
+ function N(t) {
741
+ var e;
742
+ return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
743
+ }
744
+ function z(t) {
745
+ var e;
746
+ return (e = (Ft(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
747
+ }
748
+ function Ft(t) {
749
+ return at() ? t instanceof Node || t instanceof N(t).Node : !1;
750
+ }
751
+ function W(t) {
752
+ return at() ? t instanceof Element || t instanceof N(t).Element : !1;
753
+ }
754
+ function X(t) {
755
+ return at() ? t instanceof HTMLElement || t instanceof N(t).HTMLElement : !1;
756
+ }
757
+ function Tt(t) {
758
+ return !at() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof N(t).ShadowRoot;
759
+ }
760
+ const be = /* @__PURE__ */ new Set(["inline", "contents"]);
761
+ function it(t) {
762
+ const {
763
+ overflow: e,
764
+ overflowX: o,
765
+ overflowY: n,
766
+ display: i
767
+ } = q(t);
768
+ return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && !be.has(i);
769
+ }
770
+ const Se = /* @__PURE__ */ new Set(["table", "td", "th"]);
771
+ function Re(t) {
772
+ return Se.has(et(t));
773
+ }
774
+ const Ae = [":popover-open", ":modal"];
775
+ function ft(t) {
776
+ return Ae.some((e) => {
777
+ try {
778
+ return t.matches(e);
779
+ } catch {
780
+ return !1;
781
+ }
782
+ });
783
+ }
784
+ const Oe = ["transform", "translate", "scale", "rotate", "perspective"], Ce = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Pe = ["paint", "layout", "strict", "content"];
785
+ function vt(t) {
786
+ const e = bt(), o = W(t) ? q(t) : t;
787
+ return Oe.some((n) => o[n] ? o[n] !== "none" : !1) || (o.containerType ? o.containerType !== "normal" : !1) || !e && (o.backdropFilter ? o.backdropFilter !== "none" : !1) || !e && (o.filter ? o.filter !== "none" : !1) || Ce.some((n) => (o.willChange || "").includes(n)) || Pe.some((n) => (o.contain || "").includes(n));
788
+ }
789
+ function Ee(t) {
790
+ let e = K(t);
791
+ for (; X(e) && !tt(e); ) {
792
+ if (vt(e))
793
+ return e;
794
+ if (ft(e))
795
+ return null;
796
+ e = K(e);
797
+ }
798
+ return null;
799
+ }
800
+ function bt() {
801
+ return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
802
+ }
803
+ const De = /* @__PURE__ */ new Set(["html", "body", "#document"]);
804
+ function tt(t) {
805
+ return De.has(et(t));
806
+ }
807
+ function q(t) {
808
+ return N(t).getComputedStyle(t);
809
+ }
810
+ function ut(t) {
811
+ return W(t) ? {
812
+ scrollLeft: t.scrollLeft,
813
+ scrollTop: t.scrollTop
814
+ } : {
815
+ scrollLeft: t.scrollX,
816
+ scrollTop: t.scrollY
817
+ };
818
+ }
819
+ function K(t) {
820
+ if (et(t) === "html")
821
+ return t;
822
+ const e = (
823
+ // Step into the shadow DOM of the parent of a slotted node.
824
+ t.assignedSlot || // DOM Element detected.
825
+ t.parentNode || // ShadowRoot detected.
826
+ Tt(t) && t.host || // Fallback.
827
+ z(t)
828
+ );
829
+ return Tt(e) ? e.host : e;
830
+ }
831
+ function It(t) {
832
+ const e = K(t);
833
+ return tt(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : X(e) && it(e) ? e : It(e);
834
+ }
835
+ function Wt(t, e, o) {
836
+ var n;
837
+ e === void 0 && (e = []);
838
+ const i = It(t), s = i === ((n = t.ownerDocument) == null ? void 0 : n.body), r = N(i);
839
+ return s ? (pt(r), e.concat(r, r.visualViewport || [], it(i) ? i : [], [])) : e.concat(i, Wt(i, []));
840
+ }
841
+ function pt(t) {
842
+ return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
843
+ }
844
+ function qt(t) {
845
+ const e = q(t);
846
+ let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
847
+ const i = X(t), s = i ? t.offsetWidth : o, r = i ? t.offsetHeight : n, c = rt(o) !== s || rt(n) !== r;
848
+ return c && (o = s, n = r), {
849
+ width: o,
850
+ height: n,
851
+ $: c
852
+ };
853
+ }
854
+ function Vt(t) {
855
+ return W(t) ? t : t.contextElement;
856
+ }
857
+ function J(t) {
858
+ const e = Vt(t);
859
+ if (!X(e))
860
+ return H(1);
861
+ const o = e.getBoundingClientRect(), {
862
+ width: n,
863
+ height: i,
864
+ $: s
865
+ } = qt(e);
866
+ let r = (s ? rt(o.width) : o.width) / n, c = (s ? rt(o.height) : o.height) / i;
867
+ return (!r || !Number.isFinite(r)) && (r = 1), (!c || !Number.isFinite(c)) && (c = 1), {
868
+ x: r,
869
+ y: c
870
+ };
871
+ }
872
+ const Te = /* @__PURE__ */ H(0);
873
+ function Ht(t) {
874
+ const e = N(t);
875
+ return !bt() || !e.visualViewport ? Te : {
876
+ x: e.visualViewport.offsetLeft,
877
+ y: e.visualViewport.offsetTop
878
+ };
879
+ }
880
+ function Le(t, e, o) {
881
+ return e === void 0 && (e = !1), !o || e && o !== N(t) ? !1 : e;
882
+ }
883
+ function ot(t, e, o, n) {
884
+ e === void 0 && (e = !1), o === void 0 && (o = !1);
885
+ const i = t.getBoundingClientRect(), s = Vt(t);
886
+ let r = H(1);
887
+ e && (n ? W(n) && (r = J(n)) : r = J(t));
888
+ const c = Le(s, o, n) ? Ht(s) : H(0);
889
+ let f = (i.left + c.x) / r.x, a = (i.top + c.y) / r.y, u = i.width / r.x, l = i.height / r.y;
890
+ if (s) {
891
+ const w = N(s), g = n && W(n) ? N(n) : n;
892
+ let p = w, v = pt(p);
893
+ for (; v && n && g !== p; ) {
894
+ const d = J(v), m = v.getBoundingClientRect(), S = q(v), A = m.left + (v.clientLeft + parseFloat(S.paddingLeft)) * d.x, E = m.top + (v.clientTop + parseFloat(S.paddingTop)) * d.y;
895
+ f *= d.x, a *= d.y, u *= d.x, l *= d.y, f += A, a += E, p = N(v), v = pt(p);
896
+ }
897
+ }
898
+ return Q({
899
+ width: u,
900
+ height: l,
901
+ x: f,
902
+ y: a
903
+ });
904
+ }
905
+ function dt(t, e) {
906
+ const o = ut(t).scrollLeft;
907
+ return e ? e.left + o : ot(z(t)).left + o;
908
+ }
909
+ function jt(t, e) {
910
+ const o = t.getBoundingClientRect(), n = o.left + e.scrollLeft - dt(t, o), i = o.top + e.scrollTop;
911
+ return {
912
+ x: n,
913
+ y: i
914
+ };
915
+ }
916
+ function $e(t) {
917
+ let {
918
+ elements: e,
919
+ rect: o,
920
+ offsetParent: n,
921
+ strategy: i
922
+ } = t;
923
+ const s = i === "fixed", r = z(n), c = e ? ft(e.floating) : !1;
924
+ if (n === r || c && s)
925
+ return o;
926
+ let f = {
927
+ scrollLeft: 0,
928
+ scrollTop: 0
929
+ }, a = H(1);
930
+ const u = H(0), l = X(n);
931
+ if ((l || !l && !s) && ((et(n) !== "body" || it(r)) && (f = ut(n)), X(n))) {
932
+ const g = ot(n);
933
+ a = J(n), u.x = g.x + n.clientLeft, u.y = g.y + n.clientTop;
934
+ }
935
+ const w = r && !l && !s ? jt(r, f) : H(0);
936
+ return {
937
+ width: o.width * a.x,
938
+ height: o.height * a.y,
939
+ x: o.x * a.x - f.scrollLeft * a.x + u.x + w.x,
940
+ y: o.y * a.y - f.scrollTop * a.y + u.y + w.y
941
+ };
942
+ }
943
+ function ke(t) {
944
+ return Array.from(t.getClientRects());
945
+ }
946
+ function Be(t) {
947
+ const e = z(t), o = ut(t), n = t.ownerDocument.body, i = M(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), s = M(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
948
+ let r = -o.scrollLeft + dt(t);
949
+ const c = -o.scrollTop;
950
+ return q(n).direction === "rtl" && (r += M(e.clientWidth, n.clientWidth) - i), {
951
+ width: i,
952
+ height: s,
953
+ x: r,
954
+ y: c
955
+ };
956
+ }
957
+ const Lt = 25;
958
+ function Me(t, e) {
959
+ const o = N(t), n = z(t), i = o.visualViewport;
960
+ let s = n.clientWidth, r = n.clientHeight, c = 0, f = 0;
961
+ if (i) {
962
+ s = i.width, r = i.height;
963
+ const u = bt();
964
+ (!u || u && e === "fixed") && (c = i.offsetLeft, f = i.offsetTop);
965
+ }
966
+ const a = dt(n);
967
+ if (a <= 0) {
968
+ const u = n.ownerDocument, l = u.body, w = getComputedStyle(l), g = u.compatMode === "CSS1Compat" && parseFloat(w.marginLeft) + parseFloat(w.marginRight) || 0, p = Math.abs(n.clientWidth - l.clientWidth - g);
969
+ p <= Lt && (s -= p);
970
+ } else a <= Lt && (s += a);
971
+ return {
972
+ width: s,
973
+ height: r,
974
+ x: c,
975
+ y: f
976
+ };
977
+ }
978
+ const _e = /* @__PURE__ */ new Set(["absolute", "fixed"]);
979
+ function Ne(t, e) {
980
+ const o = ot(t, !0, e === "fixed"), n = o.top + t.clientTop, i = o.left + t.clientLeft, s = X(t) ? J(t) : H(1), r = t.clientWidth * s.x, c = t.clientHeight * s.y, f = i * s.x, a = n * s.y;
981
+ return {
982
+ width: r,
983
+ height: c,
984
+ x: f,
985
+ y: a
986
+ };
987
+ }
988
+ function $t(t, e, o) {
989
+ let n;
990
+ if (e === "viewport")
991
+ n = Me(t, o);
992
+ else if (e === "document")
993
+ n = Be(z(t));
994
+ else if (W(e))
995
+ n = Ne(e, o);
996
+ else {
997
+ const i = Ht(t);
998
+ n = {
999
+ x: e.x - i.x,
1000
+ y: e.y - i.y,
1001
+ width: e.width,
1002
+ height: e.height
1003
+ };
1004
+ }
1005
+ return Q(n);
1006
+ }
1007
+ function Xt(t, e) {
1008
+ const o = K(t);
1009
+ return o === e || !W(o) || tt(o) ? !1 : q(o).position === "fixed" || Xt(o, e);
1010
+ }
1011
+ function Fe(t, e) {
1012
+ const o = e.get(t);
1013
+ if (o)
1014
+ return o;
1015
+ let n = Wt(t, []).filter((c) => W(c) && et(c) !== "body"), i = null;
1016
+ const s = q(t).position === "fixed";
1017
+ let r = s ? K(t) : t;
1018
+ for (; W(r) && !tt(r); ) {
1019
+ const c = q(r), f = vt(r);
1020
+ !f && c.position === "fixed" && (i = null), (s ? !f && !i : !f && c.position === "static" && !!i && _e.has(i.position) || it(r) && !f && Xt(t, r)) ? n = n.filter((u) => u !== r) : i = c, r = K(r);
1021
+ }
1022
+ return e.set(t, n), n;
1023
+ }
1024
+ function Ie(t) {
1025
+ let {
1026
+ element: e,
1027
+ boundary: o,
1028
+ rootBoundary: n,
1029
+ strategy: i
1030
+ } = t;
1031
+ const r = [...o === "clippingAncestors" ? ft(e) ? [] : Fe(e, this._c) : [].concat(o), n], c = r[0], f = r.reduce((a, u) => {
1032
+ const l = $t(e, u, i);
1033
+ return a.top = M(l.top, a.top), a.right = j(l.right, a.right), a.bottom = j(l.bottom, a.bottom), a.left = M(l.left, a.left), a;
1034
+ }, $t(e, c, i));
1035
+ return {
1036
+ width: f.right - f.left,
1037
+ height: f.bottom - f.top,
1038
+ x: f.left,
1039
+ y: f.top
1040
+ };
1041
+ }
1042
+ function We(t) {
1043
+ const {
1044
+ width: e,
1045
+ height: o
1046
+ } = qt(t);
1047
+ return {
1048
+ width: e,
1049
+ height: o
1050
+ };
1051
+ }
1052
+ function qe(t, e, o) {
1053
+ const n = X(e), i = z(e), s = o === "fixed", r = ot(t, !0, s, e);
1054
+ let c = {
1055
+ scrollLeft: 0,
1056
+ scrollTop: 0
1057
+ };
1058
+ const f = H(0);
1059
+ function a() {
1060
+ f.x = dt(i);
1061
+ }
1062
+ if (n || !n && !s)
1063
+ if ((et(e) !== "body" || it(i)) && (c = ut(e)), n) {
1064
+ const g = ot(e, !0, s, e);
1065
+ f.x = g.x + e.clientLeft, f.y = g.y + e.clientTop;
1066
+ } else i && a();
1067
+ s && !n && i && a();
1068
+ const u = i && !n && !s ? jt(i, c) : H(0), l = r.left + c.scrollLeft - f.x - u.x, w = r.top + c.scrollTop - f.y - u.y;
1069
+ return {
1070
+ x: l,
1071
+ y: w,
1072
+ width: r.width,
1073
+ height: r.height
1074
+ };
1075
+ }
1076
+ function gt(t) {
1077
+ return q(t).position === "static";
1078
+ }
1079
+ function kt(t, e) {
1080
+ if (!X(t) || q(t).position === "fixed")
1081
+ return null;
1082
+ if (e)
1083
+ return e(t);
1084
+ let o = t.offsetParent;
1085
+ return z(t) === o && (o = o.ownerDocument.body), o;
1086
+ }
1087
+ function Yt(t, e) {
1088
+ const o = N(t);
1089
+ if (ft(t))
1090
+ return o;
1091
+ if (!X(t)) {
1092
+ let i = K(t);
1093
+ for (; i && !tt(i); ) {
1094
+ if (W(i) && !gt(i))
1095
+ return i;
1096
+ i = K(i);
1097
+ }
1098
+ return o;
1099
+ }
1100
+ let n = kt(t, e);
1101
+ for (; n && Re(n) && gt(n); )
1102
+ n = kt(n, e);
1103
+ return n && tt(n) && gt(n) && !vt(n) ? o : n || Ee(t) || o;
1104
+ }
1105
+ const Ve = async function(t) {
1106
+ const e = this.getOffsetParent || Yt, o = this.getDimensions, n = await o(t.floating);
1107
+ return {
1108
+ reference: qe(t.reference, await e(t.floating), t.strategy),
1109
+ floating: {
1110
+ x: 0,
1111
+ y: 0,
1112
+ width: n.width,
1113
+ height: n.height
1114
+ }
1115
+ };
1116
+ };
1117
+ function He(t) {
1118
+ return q(t).direction === "rtl";
1119
+ }
1120
+ const je = {
1121
+ convertOffsetParentRelativeRectToViewportRelativeRect: $e,
1122
+ getDocumentElement: z,
1123
+ getClippingRect: Ie,
1124
+ getOffsetParent: Yt,
1125
+ getElementRects: Ve,
1126
+ getClientRects: ke,
1127
+ getDimensions: We,
1128
+ getScale: J,
1129
+ isElement: W,
1130
+ isRTL: He
1131
+ }, Je = xe, Qe = ue, Ze = ye, tn = de, en = ve, nn = me, on = ae, sn = he, rn = (t, e, o) => {
1132
+ const n = /* @__PURE__ */ new Map(), i = {
1133
+ platform: je,
1134
+ ...o
1135
+ }, s = {
1136
+ ...i.platform,
1137
+ _c: n
1138
+ };
1139
+ return le(t, e, {
1140
+ ...i,
1141
+ platform: s
1142
+ });
1143
+ };
1144
+ function Xe(t) {
1145
+ var e;
1146
+ const { char: o, allowSpaces: n, allowToIncludeChar: i, allowedPrefixes: s, startOfLine: r, $position: c } = t, f = n && !i, a = Qt(o), u = new RegExp(`\\s${a}$`), l = r ? "^" : "", w = i ? "" : a, g = f ? new RegExp(`${l}${a}.*?(?=\\s${w}|$)`, "gm") : new RegExp(`${l}(?:^)?${a}[^\\s${w}]*`, "gm"), p = ((e = c.nodeBefore) == null ? void 0 : e.isText) && c.nodeBefore.text;
1147
+ if (!p)
1148
+ return null;
1149
+ const v = c.pos - p.length, d = Array.from(p.matchAll(g)).pop();
1150
+ if (!d || d.input === void 0 || d.index === void 0)
1151
+ return null;
1152
+ const m = d.input.slice(Math.max(0, d.index - 1), d.index), S = new RegExp(`^[${s == null ? void 0 : s.join("")}\0]?$`).test(m);
1153
+ if (s !== null && !S)
1154
+ return null;
1155
+ const A = v + d.index;
1156
+ let E = A + d[0].length;
1157
+ return f && u.test(p.slice(E - 1, E + 1)) && (d[0] += " ", E += 1), A < c.pos && E >= c.pos ? {
1158
+ range: {
1159
+ from: A,
1160
+ to: E
1161
+ },
1162
+ query: d[0].slice(o.length),
1163
+ text: d[0]
1164
+ } : null;
1165
+ }
1166
+ var Ye = new Kt("suggestion");
1167
+ function ze({
1168
+ pluginKey: t = Ye,
1169
+ editor: e,
1170
+ char: o = "@",
1171
+ allowSpaces: n = !1,
1172
+ allowToIncludeChar: i = !1,
1173
+ allowedPrefixes: s = [" "],
1174
+ startOfLine: r = !1,
1175
+ decorationTag: c = "span",
1176
+ decorationClass: f = "suggestion",
1177
+ decorationContent: a = "",
1178
+ decorationEmptyClass: u = "is-empty",
1179
+ command: l = () => null,
1180
+ items: w = () => [],
1181
+ render: g = () => ({}),
1182
+ allow: p = () => !0,
1183
+ findSuggestionMatch: v = Xe
1184
+ }) {
1185
+ let d;
1186
+ const m = g == null ? void 0 : g(), S = () => {
1187
+ const y = e.state.selection.$anchor.pos, b = e.view.coordsAtPos(y), { top: C, right: P, bottom: h, left: R } = b;
1188
+ try {
1189
+ return new DOMRect(R, C, P - R, h - C);
1190
+ } catch {
1191
+ return null;
1192
+ }
1193
+ }, A = (y, b) => b ? () => {
1194
+ const C = t.getState(e.state), P = C == null ? void 0 : C.decorationId, h = y.dom.querySelector(`[data-decoration-id="${P}"]`);
1195
+ return (h == null ? void 0 : h.getBoundingClientRect()) || null;
1196
+ } : S;
1197
+ function E(y, b) {
1198
+ var C;
1199
+ try {
1200
+ const h = t.getState(y.state), R = h != null && h.decorationId ? y.dom.querySelector(`[data-decoration-id="${h.decorationId}"]`) : null, D = {
1201
+ // @ts-ignore editor is available in closure
1202
+ editor: e,
1203
+ range: (h == null ? void 0 : h.range) || { from: 0, to: 0 },
1204
+ query: (h == null ? void 0 : h.query) || null,
1205
+ text: (h == null ? void 0 : h.text) || null,
1206
+ items: [],
1207
+ command: (k) => l({ editor: e, range: (h == null ? void 0 : h.range) || { from: 0, to: 0 }, props: k }),
1208
+ decorationNode: R,
1209
+ clientRect: A(y, R)
1210
+ };
1211
+ (C = m == null ? void 0 : m.onExit) == null || C.call(m, D);
1212
+ } catch {
1213
+ }
1214
+ const P = y.state.tr.setMeta(b, { exit: !0 });
1215
+ y.dispatch(P);
1216
+ }
1217
+ const O = new Ut({
1218
+ key: t,
1219
+ view() {
1220
+ return {
1221
+ update: async (y, b) => {
1222
+ var C, P, h, R, D, k, L;
1223
+ const x = (C = this.key) == null ? void 0 : C.getState(b), $ = (P = this.key) == null ? void 0 : P.getState(y.state), T = x.active && $.active && x.range.from !== $.range.from, B = !x.active && $.active, _ = x.active && !$.active, U = !B && !_ && x.query !== $.query, nt = B || T && U, st = U || T, mt = _ || T && U;
1224
+ if (!nt && !st && !mt)
1225
+ return;
1226
+ const G = mt && !nt ? x : $, St = y.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);
1227
+ d = {
1228
+ editor: e,
1229
+ range: G.range,
1230
+ query: G.query,
1231
+ text: G.text,
1232
+ items: [],
1233
+ command: (zt) => l({
1234
+ editor: e,
1235
+ range: G.range,
1236
+ props: zt
1237
+ }),
1238
+ decorationNode: St,
1239
+ clientRect: A(y, St)
1240
+ }, nt && ((h = m == null ? void 0 : m.onBeforeStart) == null || h.call(m, d)), st && ((R = m == null ? void 0 : m.onBeforeUpdate) == null || R.call(m, d)), (st || nt) && (d.items = await w({
1241
+ editor: e,
1242
+ query: G.query
1243
+ })), mt && ((D = m == null ? void 0 : m.onExit) == null || D.call(m, d)), st && ((k = m == null ? void 0 : m.onUpdate) == null || k.call(m, d)), nt && ((L = m == null ? void 0 : m.onStart) == null || L.call(m, d));
1244
+ },
1245
+ destroy: () => {
1246
+ var y;
1247
+ d && ((y = m == null ? void 0 : m.onExit) == null || y.call(m, d));
1248
+ }
1249
+ };
1250
+ },
1251
+ state: {
1252
+ // Initialize the plugin's internal state.
1253
+ init() {
1254
+ return {
1255
+ active: !1,
1256
+ range: {
1257
+ from: 0,
1258
+ to: 0
1259
+ },
1260
+ query: null,
1261
+ text: null,
1262
+ composing: !1
1263
+ };
1264
+ },
1265
+ // Apply changes to the plugin state from a view transaction.
1266
+ apply(y, b, C, P) {
1267
+ const { isEditable: h } = e, { composing: R } = e.view, { selection: D } = y, { empty: k, from: L } = D, x = { ...b }, $ = y.getMeta(t);
1268
+ if ($ && $.exit)
1269
+ return x.active = !1, x.decorationId = null, x.range = { from: 0, to: 0 }, x.query = null, x.text = null, x;
1270
+ if (x.composing = R, h && (k || e.view.composing)) {
1271
+ (L < b.range.from || L > b.range.to) && !R && !b.composing && (x.active = !1);
1272
+ const T = v({
1273
+ char: o,
1274
+ allowSpaces: n,
1275
+ allowToIncludeChar: i,
1276
+ allowedPrefixes: s,
1277
+ startOfLine: r,
1278
+ $position: D.$from
1279
+ }), B = `id_${Math.floor(Math.random() * 4294967295)}`;
1280
+ T && p({
1281
+ editor: e,
1282
+ state: P,
1283
+ range: T.range,
1284
+ isActive: b.active
1285
+ }) ? (x.active = !0, x.decorationId = b.decorationId ? b.decorationId : B, x.range = T.range, x.query = T.query, x.text = T.text) : x.active = !1;
1286
+ } else
1287
+ x.active = !1;
1288
+ return x.active || (x.decorationId = null, x.range = { from: 0, to: 0 }, x.query = null, x.text = null), x;
1289
+ }
1290
+ },
1291
+ props: {
1292
+ // Call the keydown hook if suggestion is active.
1293
+ handleKeyDown(y, b) {
1294
+ var C, P, h, R;
1295
+ const { active: D, range: k } = O.getState(y.state);
1296
+ if (!D)
1297
+ return !1;
1298
+ if (b.key === "Escape" || b.key === "Esc") {
1299
+ const x = O.getState(y.state), $ = (C = d == null ? void 0 : d.decorationNode) != null ? C : null, T = $ ?? (x != null && x.decorationId ? y.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`) : null);
1300
+ if (((P = m == null ? void 0 : m.onKeyDown) == null ? void 0 : P.call(m, { view: y, event: b, range: x.range })) || !1)
1301
+ return !0;
1302
+ const _ = {
1303
+ editor: e,
1304
+ range: x.range,
1305
+ query: x.query,
1306
+ text: x.text,
1307
+ items: [],
1308
+ command: (U) => l({ editor: e, range: x.range, props: U }),
1309
+ decorationNode: T,
1310
+ // If we have a cached decoration node, use it for the clientRect
1311
+ // to avoid another DOM lookup. If not, leave clientRect null and
1312
+ // let consumer decide if they want to query.
1313
+ clientRect: T ? () => T.getBoundingClientRect() || null : null
1314
+ };
1315
+ return (h = m == null ? void 0 : m.onExit) == null || h.call(m, _), E(y, t), !0;
1316
+ }
1317
+ return ((R = m == null ? void 0 : m.onKeyDown) == null ? void 0 : R.call(m, { view: y, event: b, range: k })) || !1;
1318
+ },
1319
+ // Setup decorator on the currently active suggestion.
1320
+ decorations(y) {
1321
+ const { active: b, range: C, decorationId: P, query: h } = O.getState(y);
1322
+ if (!b)
1323
+ return null;
1324
+ const R = !(h != null && h.length), D = [f];
1325
+ return R && D.push(u), Gt.create(y.doc, [
1326
+ Jt.inline(C.from, C.to, {
1327
+ nodeName: c,
1328
+ class: D.join(" "),
1329
+ "data-decoration-id": P,
1330
+ "data-decoration-content": a
1331
+ })
1332
+ ]);
1333
+ }
1334
+ }
1335
+ });
1336
+ return O;
1337
+ }
1338
+ var cn = ze;
1339
+ export {
1340
+ ze as S,
1341
+ on as a,
1342
+ en as b,
1343
+ rn as c,
1344
+ Qe as d,
1345
+ sn as e,
1346
+ tn as f,
1347
+ nn as h,
1348
+ cn as i,
1349
+ Je as o,
1350
+ Ze as s
1351
+ };