@clevertask/scribe 0.1.3 → 0.1.4

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 (32) hide show
  1. package/dist/{BarMenu-DaKIz3zZ.js → BarMenu-BNk2I0zi.js} +1 -1
  2. package/dist/assets/index.css +1 -1
  3. package/dist/components/Menu/BarMenu.js +2 -2
  4. package/dist/components/Menu/BubbleMenu.js +378 -1445
  5. package/dist/components/Menu/Mobile/ListOptionBar.d.ts +1 -1
  6. package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
  7. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  8. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  9. package/dist/components/Scribe/extension/extension-link.js +1 -1
  10. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  11. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  12. package/dist/components/Scribe/extension/index.js +5735 -3383
  13. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  14. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  15. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  16. package/dist/components/Scribe/index.js +5 -5
  17. package/dist/{extension-link-Ch_T7WWG.js → extension-link-P1rro4zO.js} +247 -218
  18. package/dist/floating-ui.dom-ZRy7FSVk.js +1246 -0
  19. package/dist/{index-DxF-1P4n.js → index-BMISMQrG.js} +168 -147
  20. package/dist/{index-CqzMmrnw.js → index-ByyiiYsp.js} +1 -1
  21. package/dist/{index-BiBV5TQx.js → index-CnKS-BY2.js} +2644 -2323
  22. package/dist/index-CnQHDObA.js +539 -0
  23. package/dist/main.js +1 -1
  24. package/dist/{markdown-to-html-pL7ckd-m.js → markdown-to-html-Bw9L43K6.js} +1 -1
  25. package/dist/purify.es-DC1iJOxX.js +864 -0
  26. package/dist/utils/create-scribe-editor.js +3 -3
  27. package/dist/utils/html-to-markdown.js +1 -1
  28. package/dist/utils/index.js +1 -1
  29. package/dist/utils/markdown-to-html.js +2 -2
  30. package/package.json +31 -31
  31. package/dist/index-V-gN11Y9.js +0 -249
  32. package/dist/purify.es-exIQuqhb.js +0 -595
@@ -1,1171 +1,28 @@
1
- import { jsx as E } from "react/jsx-runtime";
2
- import { Flex as ve, IconButton as ye } from "@radix-ui/themes";
3
- import { a as Bt, u as be } from "../../index-DxF-1P4n.js";
4
- import { b as Vt, P as vt, p as xe, q as zt, N as Oe, a as Nt, r as Ce, s as Se } from "../../index-BiBV5TQx.js";
5
- import { C as Te } from "../../index-CqzMmrnw.js";
6
- import _t, { useRef as k, useState as Wt, useEffect as it, useLayoutEffect as Ee, useCallback as Re } from "react";
7
- import { createPortal as kt } from "react-dom";
8
- import { getPopupMountTarget as Ie } from "../Scribe/extension/getPopupMountTarget.js";
9
- const Ft = ["top", "right", "bottom", "left"], St = ["start", "end"], Tt = /* @__PURE__ */ Ft.reduce((t, e) => t.concat(e, e + "-" + St[0], e + "-" + St[1]), []), K = Math.min, D = Math.max, st = Math.round, $ = (t) => ({
10
- x: t,
11
- y: t
12
- }), Le = {
13
- left: "right",
14
- right: "left",
15
- bottom: "top",
16
- top: "bottom"
17
- };
18
- function gt(t, e, n) {
19
- return D(t, K(e, n));
20
- }
21
- function j(t, e) {
22
- return typeof t == "function" ? t(e) : t;
23
- }
24
- function V(t) {
25
- return t.split("-")[0];
26
- }
27
- function N(t) {
28
- return t.split("-")[1];
29
- }
30
- function $t(t) {
31
- return t === "x" ? "y" : "x";
32
- }
33
- function yt(t) {
34
- return t === "y" ? "height" : "width";
35
- }
36
- function F(t) {
37
- const e = t[0];
38
- return e === "t" || e === "b" ? "y" : "x";
39
- }
40
- function bt(t) {
41
- return $t(F(t));
42
- }
43
- function Kt(t, e, n) {
44
- n === void 0 && (n = !1);
45
- const o = N(t), i = bt(t), s = yt(i);
46
- let r = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
47
- return e.reference[s] > e.floating[s] && (r = lt(r)), [r, lt(r)];
48
- }
49
- function De(t) {
50
- const e = lt(t);
51
- return [rt(t), e, rt(e)];
52
- }
53
- function rt(t) {
54
- return t.includes("start") ? t.replace("start", "end") : t.replace("end", "start");
55
- }
56
- const Et = ["left", "right"], Rt = ["right", "left"], He = ["top", "bottom"], Ae = ["bottom", "top"];
57
- function Me(t, e, n) {
58
- switch (t) {
59
- case "top":
60
- case "bottom":
61
- return n ? e ? Rt : Et : e ? Et : Rt;
62
- case "left":
63
- case "right":
64
- return e ? He : Ae;
65
- default:
66
- return [];
67
- }
68
- }
69
- function Pe(t, e, n, o) {
70
- const i = N(t);
71
- let s = Me(V(t), n === "start", o);
72
- return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(rt)))), s;
73
- }
74
- function lt(t) {
75
- const e = V(t);
76
- return Le[e] + t.slice(e.length);
77
- }
78
- function Ue(t) {
79
- return {
80
- top: 0,
81
- right: 0,
82
- bottom: 0,
83
- left: 0,
84
- ...t
85
- };
86
- }
87
- function xt(t) {
88
- return typeof t != "number" ? Ue(t) : {
89
- top: t,
90
- right: t,
91
- bottom: t,
92
- left: t
93
- };
94
- }
95
- function Q(t) {
96
- const {
97
- x: e,
98
- y: n,
99
- width: o,
100
- height: i
101
- } = t;
102
- return {
103
- width: o,
104
- height: i,
105
- top: n,
106
- left: e,
107
- right: e + o,
108
- bottom: n + i,
109
- x: e,
110
- y: n
111
- };
112
- }
113
- function It(t, e, n) {
114
- let {
115
- reference: o,
116
- floating: i
117
- } = t;
118
- const s = F(e), r = bt(e), l = yt(r), c = V(e), p = s === "y", f = o.x + o.width / 2 - i.width / 2, a = o.y + o.height / 2 - i.height / 2, d = o[l] / 2 - i[l] / 2;
119
- let u;
120
- switch (c) {
121
- case "top":
122
- u = {
123
- x: f,
124
- y: o.y - i.height
125
- };
126
- break;
127
- case "bottom":
128
- u = {
129
- x: f,
130
- y: o.y + o.height
131
- };
132
- break;
133
- case "right":
134
- u = {
135
- x: o.x + o.width,
136
- y: a
137
- };
138
- break;
139
- case "left":
140
- u = {
141
- x: o.x - i.width,
142
- y: a
143
- };
144
- break;
145
- default:
146
- u = {
147
- x: o.x,
148
- y: o.y
149
- };
150
- }
151
- switch (N(e)) {
152
- case "start":
153
- u[r] -= d * (n && p ? -1 : 1);
154
- break;
155
- case "end":
156
- u[r] += d * (n && p ? -1 : 1);
157
- break;
158
- }
159
- return u;
160
- }
161
- async function Be(t, e) {
162
- var n;
163
- e === void 0 && (e = {});
164
- const {
165
- x: o,
166
- y: i,
167
- platform: s,
168
- rects: r,
169
- elements: l,
170
- strategy: c
171
- } = t, {
172
- boundary: p = "clippingAncestors",
173
- rootBoundary: f = "viewport",
174
- elementContext: a = "floating",
175
- altBoundary: d = !1,
176
- padding: u = 0
177
- } = j(e, t), h = xt(u), m = l[d ? a === "floating" ? "reference" : "floating" : a], v = Q(await s.getClippingRect({
178
- element: (n = await (s.isElement == null ? void 0 : s.isElement(m))) == null || n ? m : m.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(l.floating)),
179
- boundary: p,
180
- rootBoundary: f,
181
- strategy: c
182
- })), y = a === "floating" ? {
183
- x: o,
184
- y: i,
185
- width: r.floating.width,
186
- height: r.floating.height
187
- } : r.reference, w = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), b = await (s.isElement == null ? void 0 : s.isElement(w)) ? await (s.getScale == null ? void 0 : s.getScale(w)) || {
188
- x: 1,
189
- y: 1
190
- } : {
191
- x: 1,
192
- y: 1
193
- }, C = Q(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
194
- elements: l,
195
- rect: y,
196
- offsetParent: w,
197
- strategy: c
198
- }) : y);
199
- return {
200
- top: (v.top - C.top + h.top) / b.y,
201
- bottom: (C.bottom - v.bottom + h.bottom) / b.y,
202
- left: (v.left - C.left + h.left) / b.x,
203
- right: (C.right - v.right + h.right) / b.x
204
- };
205
- }
206
- const Ve = 50, ze = async (t, e, n) => {
207
- const {
208
- placement: o = "bottom",
209
- strategy: i = "absolute",
210
- middleware: s = [],
211
- platform: r
212
- } = n, l = r.detectOverflow ? r : {
213
- ...r,
214
- detectOverflow: Be
215
- }, c = await (r.isRTL == null ? void 0 : r.isRTL(e));
216
- let p = await r.getElementRects({
217
- reference: t,
218
- floating: e,
219
- strategy: i
220
- }), {
221
- x: f,
222
- y: a
223
- } = It(p, o, c), d = o, u = 0;
224
- const h = {};
225
- for (let g = 0; g < s.length; g++) {
226
- const m = s[g];
227
- if (!m)
228
- continue;
229
- const {
230
- name: v,
231
- fn: y
232
- } = m, {
233
- x: w,
234
- y: b,
235
- data: C,
236
- reset: O
237
- } = await y({
238
- x: f,
239
- y: a,
240
- initialPlacement: o,
241
- placement: d,
242
- strategy: i,
243
- middlewareData: h,
244
- rects: p,
245
- platform: l,
246
- elements: {
247
- reference: t,
248
- floating: e
249
- }
250
- });
251
- f = w ?? f, a = b ?? a, h[v] = {
252
- ...h[v],
253
- ...C
254
- }, O && u < Ve && (u++, typeof O == "object" && (O.placement && (d = O.placement), O.rects && (p = O.rects === !0 ? await r.getElementRects({
255
- reference: t,
256
- floating: e,
257
- strategy: i
258
- }) : O.rects), {
259
- x: f,
260
- y: a
261
- } = It(p, d, c)), g = -1);
262
- }
263
- return {
264
- x: f,
265
- y: a,
266
- placement: d,
267
- strategy: i,
268
- middlewareData: h
269
- };
270
- }, Ne = (t) => ({
271
- name: "arrow",
272
- options: t,
273
- async fn(e) {
274
- const {
275
- x: n,
276
- y: o,
277
- placement: i,
278
- rects: s,
279
- platform: r,
280
- elements: l,
281
- middlewareData: c
282
- } = e, {
283
- element: p,
284
- padding: f = 0
285
- } = j(t, e) || {};
286
- if (p == null)
287
- return {};
288
- const a = xt(f), d = {
289
- x: n,
290
- y: o
291
- }, u = bt(i), h = yt(u), g = await r.getDimensions(p), m = u === "y", v = m ? "top" : "left", y = m ? "bottom" : "right", w = m ? "clientHeight" : "clientWidth", b = s.reference[h] + s.reference[u] - d[u] - s.floating[h], C = d[u] - s.reference[u], O = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(p));
292
- let R = O ? O[w] : 0;
293
- (!R || !await (r.isElement == null ? void 0 : r.isElement(O))) && (R = l.floating[w] || s.floating[h]);
294
- const U = b / 2 - C / 2, I = R / 2 - g[h] / 2 - 1, x = K(a[v], I), S = K(a[y], I), L = x, H = R - g[h] - S, T = R / 2 - g[h] / 2 + U, z = gt(L, T, H), B = !c.arrow && N(i) != null && T !== z && s.reference[h] / 2 - (T < L ? x : S) - g[h] / 2 < 0, A = B ? T < L ? T - L : T - H : 0;
295
- return {
296
- [u]: d[u] + A,
297
- data: {
298
- [u]: z,
299
- centerOffset: T - z - A,
300
- ...B && {
301
- alignmentOffset: A
302
- }
303
- },
304
- reset: B
305
- };
306
- }
307
- });
308
- function _e(t, e, n) {
309
- return (t ? [...n.filter((i) => N(i) === t), ...n.filter((i) => N(i) !== t)] : n.filter((i) => V(i) === i)).filter((i) => t ? N(i) === t || (e ? rt(i) !== i : !1) : !0);
310
- }
311
- const We = function(t) {
312
- return t === void 0 && (t = {}), {
313
- name: "autoPlacement",
314
- options: t,
315
- async fn(e) {
316
- var n, o, i;
317
- const {
318
- rects: s,
319
- middlewareData: r,
320
- placement: l,
321
- platform: c,
322
- elements: p
323
- } = e, {
324
- crossAxis: f = !1,
325
- alignment: a,
326
- allowedPlacements: d = Tt,
327
- autoAlignment: u = !0,
328
- ...h
329
- } = j(t, e), g = a !== void 0 || d === Tt ? _e(a || null, u, d) : d, m = await c.detectOverflow(e, h), v = ((n = r.autoPlacement) == null ? void 0 : n.index) || 0, y = g[v];
330
- if (y == null)
331
- return {};
332
- const w = Kt(y, s, await (c.isRTL == null ? void 0 : c.isRTL(p.floating)));
333
- if (l !== y)
334
- return {
335
- reset: {
336
- placement: g[0]
337
- }
338
- };
339
- const b = [m[V(y)], m[w[0]], m[w[1]]], C = [...((o = r.autoPlacement) == null ? void 0 : o.overflows) || [], {
340
- placement: y,
341
- overflows: b
342
- }], O = g[v + 1];
343
- if (O)
344
- return {
345
- data: {
346
- index: v + 1,
347
- overflows: C
348
- },
349
- reset: {
350
- placement: O
351
- }
352
- };
353
- const R = C.map((x) => {
354
- const S = N(x.placement);
355
- return [x.placement, S && f ? (
356
- // Check along the mainAxis and main crossAxis side.
357
- x.overflows.slice(0, 2).reduce((L, H) => L + H, 0)
358
- ) : (
359
- // Check only the mainAxis.
360
- x.overflows[0]
361
- ), x.overflows];
362
- }).sort((x, S) => x[1] - S[1]), I = ((i = R.filter((x) => x[2].slice(
363
- 0,
364
- // Aligned placements should not check their opposite crossAxis
365
- // side.
366
- N(x[0]) ? 2 : 3
367
- ).every((S) => S <= 0))[0]) == null ? void 0 : i[0]) || R[0][0];
368
- return I !== l ? {
369
- data: {
370
- index: v + 1,
371
- overflows: C
372
- },
373
- reset: {
374
- placement: I
375
- }
376
- } : {};
377
- }
378
- };
379
- }, ke = function(t) {
380
- return t === void 0 && (t = {}), {
381
- name: "flip",
382
- options: t,
383
- async fn(e) {
384
- var n, o;
385
- const {
386
- placement: i,
387
- middlewareData: s,
388
- rects: r,
389
- initialPlacement: l,
390
- platform: c,
391
- elements: p
392
- } = e, {
393
- mainAxis: f = !0,
394
- crossAxis: a = !0,
395
- fallbackPlacements: d,
396
- fallbackStrategy: u = "bestFit",
397
- fallbackAxisSideDirection: h = "none",
398
- flipAlignment: g = !0,
399
- ...m
400
- } = j(t, e);
401
- if ((n = s.arrow) != null && n.alignmentOffset)
402
- return {};
403
- const v = V(i), y = F(l), w = V(l) === l, b = await (c.isRTL == null ? void 0 : c.isRTL(p.floating)), C = d || (w || !g ? [lt(l)] : De(l)), O = h !== "none";
404
- !d && O && C.push(...Pe(l, g, h, b));
405
- const R = [l, ...C], U = await c.detectOverflow(e, m), I = [];
406
- let x = ((o = s.flip) == null ? void 0 : o.overflows) || [];
407
- if (f && I.push(U[v]), a) {
408
- const T = Kt(i, r, b);
409
- I.push(U[T[0]], U[T[1]]);
410
- }
411
- if (x = [...x, {
412
- placement: i,
413
- overflows: I
414
- }], !I.every((T) => T <= 0)) {
415
- var S, L;
416
- const T = (((S = s.flip) == null ? void 0 : S.index) || 0) + 1, z = R[T];
417
- if (z && (!(a === "alignment" ? y !== F(z) : !1) || // We leave the current main axis only if every placement on that axis
418
- // overflows the main axis.
419
- x.every((M) => F(M.placement) === y ? M.overflows[0] > 0 : !0)))
420
- return {
421
- data: {
422
- index: T,
423
- overflows: x
424
- },
425
- reset: {
426
- placement: z
427
- }
428
- };
429
- let B = (L = x.filter((A) => A.overflows[0] <= 0).sort((A, M) => A.overflows[1] - M.overflows[1])[0]) == null ? void 0 : L.placement;
430
- if (!B)
431
- switch (u) {
432
- case "bestFit": {
433
- var H;
434
- const A = (H = x.filter((M) => {
435
- if (O) {
436
- const q = F(M.placement);
437
- return q === y || // Create a bias to the `y` side axis due to horizontal
438
- // reading directions favoring greater width.
439
- q === "y";
440
- }
441
- return !0;
442
- }).map((M) => [M.placement, M.overflows.filter((q) => q > 0).reduce((q, we) => q + we, 0)]).sort((M, q) => M[1] - q[1])[0]) == null ? void 0 : H[0];
443
- A && (B = A);
444
- break;
445
- }
446
- case "initialPlacement":
447
- B = l;
448
- break;
449
- }
450
- if (i !== B)
451
- return {
452
- reset: {
453
- placement: B
454
- }
455
- };
456
- }
457
- return {};
458
- }
459
- };
460
- };
461
- function Lt(t, e) {
462
- return {
463
- top: t.top - e.height,
464
- right: t.right - e.width,
465
- bottom: t.bottom - e.height,
466
- left: t.left - e.width
467
- };
468
- }
469
- function Dt(t) {
470
- return Ft.some((e) => t[e] >= 0);
471
- }
472
- const Fe = function(t) {
473
- return t === void 0 && (t = {}), {
474
- name: "hide",
475
- options: t,
476
- async fn(e) {
477
- const {
478
- rects: n,
479
- platform: o
480
- } = e, {
481
- strategy: i = "referenceHidden",
482
- ...s
483
- } = j(t, e);
484
- switch (i) {
485
- case "referenceHidden": {
486
- const r = await o.detectOverflow(e, {
487
- ...s,
488
- elementContext: "reference"
489
- }), l = Lt(r, n.reference);
490
- return {
491
- data: {
492
- referenceHiddenOffsets: l,
493
- referenceHidden: Dt(l)
494
- }
495
- };
496
- }
497
- case "escaped": {
498
- const r = await o.detectOverflow(e, {
499
- ...s,
500
- altBoundary: !0
501
- }), l = Lt(r, n.floating);
502
- return {
503
- data: {
504
- escapedOffsets: l,
505
- escaped: Dt(l)
506
- }
507
- };
508
- }
509
- default:
510
- return {};
511
- }
512
- }
513
- };
514
- };
515
- function jt(t) {
516
- const e = K(...t.map((s) => s.left)), n = K(...t.map((s) => s.top)), o = D(...t.map((s) => s.right)), i = D(...t.map((s) => s.bottom));
517
- return {
518
- x: e,
519
- y: n,
520
- width: o - e,
521
- height: i - n
522
- };
523
- }
524
- function $e(t) {
525
- const e = t.slice().sort((i, s) => i.y - s.y), n = [];
526
- let o = null;
527
- for (let i = 0; i < e.length; i++) {
528
- const s = e[i];
529
- !o || s.y - o.y > o.height / 2 ? n.push([s]) : n[n.length - 1].push(s), o = s;
530
- }
531
- return n.map((i) => Q(jt(i)));
532
- }
533
- const Ke = function(t) {
534
- return t === void 0 && (t = {}), {
535
- name: "inline",
536
- options: t,
537
- async fn(e) {
538
- const {
539
- placement: n,
540
- elements: o,
541
- rects: i,
542
- platform: s,
543
- strategy: r
544
- } = e, {
545
- padding: l = 2,
546
- x: c,
547
- y: p
548
- } = j(t, e), f = Array.from(await (s.getClientRects == null ? void 0 : s.getClientRects(o.reference)) || []), a = $e(f), d = Q(jt(f)), u = xt(l);
549
- function h() {
550
- if (a.length === 2 && a[0].left > a[1].right && c != null && p != null)
551
- return a.find((m) => c > m.left - u.left && c < m.right + u.right && p > m.top - u.top && p < m.bottom + u.bottom) || d;
552
- if (a.length >= 2) {
553
- if (F(n) === "y") {
554
- const x = a[0], S = a[a.length - 1], L = V(n) === "top", H = x.top, T = S.bottom, z = L ? x.left : S.left, B = L ? x.right : S.right, A = B - z, M = T - H;
555
- return {
556
- top: H,
557
- bottom: T,
558
- left: z,
559
- right: B,
560
- width: A,
561
- height: M,
562
- x: z,
563
- y: H
564
- };
565
- }
566
- const m = V(n) === "left", v = D(...a.map((x) => x.right)), y = K(...a.map((x) => x.left)), w = a.filter((x) => m ? x.left === y : x.right === v), b = w[0].top, C = w[w.length - 1].bottom, O = y, R = v, U = R - O, I = C - b;
567
- return {
568
- top: b,
569
- bottom: C,
570
- left: O,
571
- right: R,
572
- width: U,
573
- height: I,
574
- x: O,
575
- y: b
576
- };
577
- }
578
- return d;
579
- }
580
- const g = await s.getElementRects({
581
- reference: {
582
- getBoundingClientRect: h
583
- },
584
- floating: o.floating,
585
- strategy: r
586
- });
587
- return i.reference.x !== g.reference.x || i.reference.y !== g.reference.y || i.reference.width !== g.reference.width || i.reference.height !== g.reference.height ? {
588
- reset: {
589
- rects: g
590
- }
591
- } : {};
592
- }
593
- };
594
- }, je = /* @__PURE__ */ new Set(["left", "top"]);
595
- async function Ye(t, e) {
596
- const {
597
- placement: n,
598
- platform: o,
599
- elements: i
600
- } = t, s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = V(n), l = N(n), c = F(n) === "y", p = je.has(r) ? -1 : 1, f = s && c ? -1 : 1, a = j(e, t);
601
- let {
602
- mainAxis: d,
603
- crossAxis: u,
604
- alignmentAxis: h
605
- } = typeof a == "number" ? {
606
- mainAxis: a,
607
- crossAxis: 0,
608
- alignmentAxis: null
609
- } : {
610
- mainAxis: a.mainAxis || 0,
611
- crossAxis: a.crossAxis || 0,
612
- alignmentAxis: a.alignmentAxis
613
- };
614
- return l && typeof h == "number" && (u = l === "end" ? h * -1 : h), c ? {
615
- x: u * f,
616
- y: d * p
617
- } : {
618
- x: d * p,
619
- y: u * f
620
- };
621
- }
622
- const Xe = function(t) {
623
- return t === void 0 && (t = 0), {
624
- name: "offset",
625
- options: t,
626
- async fn(e) {
627
- var n, o;
628
- const {
629
- x: i,
630
- y: s,
631
- placement: r,
632
- middlewareData: l
633
- } = e, c = await Ye(e, t);
634
- return r === ((n = l.offset) == null ? void 0 : n.placement) && (o = l.arrow) != null && o.alignmentOffset ? {} : {
635
- x: i + c.x,
636
- y: s + c.y,
637
- data: {
638
- ...c,
639
- placement: r
640
- }
641
- };
642
- }
643
- };
644
- }, qe = function(t) {
645
- return t === void 0 && (t = {}), {
646
- name: "shift",
647
- options: t,
648
- async fn(e) {
649
- const {
650
- x: n,
651
- y: o,
652
- placement: i,
653
- platform: s
654
- } = e, {
655
- mainAxis: r = !0,
656
- crossAxis: l = !1,
657
- limiter: c = {
658
- fn: (v) => {
659
- let {
660
- x: y,
661
- y: w
662
- } = v;
663
- return {
664
- x: y,
665
- y: w
666
- };
667
- }
668
- },
669
- ...p
670
- } = j(t, e), f = {
671
- x: n,
672
- y: o
673
- }, a = await s.detectOverflow(e, p), d = F(V(i)), u = $t(d);
674
- let h = f[u], g = f[d];
675
- if (r) {
676
- const v = u === "y" ? "top" : "left", y = u === "y" ? "bottom" : "right", w = h + a[v], b = h - a[y];
677
- h = gt(w, h, b);
678
- }
679
- if (l) {
680
- const v = d === "y" ? "top" : "left", y = d === "y" ? "bottom" : "right", w = g + a[v], b = g - a[y];
681
- g = gt(w, g, b);
682
- }
683
- const m = c.fn({
684
- ...e,
685
- [u]: h,
686
- [d]: g
687
- });
688
- return {
689
- ...m,
690
- data: {
691
- x: m.x - n,
692
- y: m.y - o,
693
- enabled: {
694
- [u]: r,
695
- [d]: l
696
- }
697
- }
698
- };
699
- }
700
- };
701
- }, Ge = function(t) {
702
- return t === void 0 && (t = {}), {
703
- name: "size",
704
- options: t,
705
- async fn(e) {
706
- var n, o;
707
- const {
708
- placement: i,
709
- rects: s,
710
- platform: r,
711
- elements: l
712
- } = e, {
713
- apply: c = () => {
714
- },
715
- ...p
716
- } = j(t, e), f = await r.detectOverflow(e, p), a = V(i), d = N(i), u = F(i) === "y", {
717
- width: h,
718
- height: g
719
- } = s.floating;
720
- let m, v;
721
- a === "top" || a === "bottom" ? (m = a, v = d === (await (r.isRTL == null ? void 0 : r.isRTL(l.floating)) ? "start" : "end") ? "left" : "right") : (v = a, m = d === "end" ? "top" : "bottom");
722
- const y = g - f.top - f.bottom, w = h - f.left - f.right, b = K(g - f[m], y), C = K(h - f[v], w), O = !e.middlewareData.shift;
723
- let R = b, U = C;
724
- if ((n = e.middlewareData.shift) != null && n.enabled.x && (U = w), (o = e.middlewareData.shift) != null && o.enabled.y && (R = y), O && !d) {
725
- const x = D(f.left, 0), S = D(f.right, 0), L = D(f.top, 0), H = D(f.bottom, 0);
726
- u ? U = h - 2 * (x !== 0 || S !== 0 ? x + S : D(f.left, f.right)) : R = g - 2 * (L !== 0 || H !== 0 ? L + H : D(f.top, f.bottom));
727
- }
728
- await c({
729
- ...e,
730
- availableWidth: U,
731
- availableHeight: R
732
- });
733
- const I = await r.getDimensions(l.floating);
734
- return h !== I.width || g !== I.height ? {
735
- reset: {
736
- rects: !0
737
- }
738
- } : {};
739
- }
740
- };
741
- };
742
- function at() {
743
- return typeof window < "u";
744
- }
745
- function et(t) {
746
- return Yt(t) ? (t.nodeName || "").toLowerCase() : "#document";
747
- }
748
- function P(t) {
749
- var e;
750
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
751
- }
752
- function Y(t) {
753
- var e;
754
- return (e = (Yt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
755
- }
756
- function Yt(t) {
757
- return at() ? t instanceof Node || t instanceof P(t).Node : !1;
758
- }
759
- function _(t) {
760
- return at() ? t instanceof Element || t instanceof P(t).Element : !1;
761
- }
762
- function X(t) {
763
- return at() ? t instanceof HTMLElement || t instanceof P(t).HTMLElement : !1;
764
- }
765
- function Ht(t) {
766
- return !at() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof P(t).ShadowRoot;
767
- }
768
- function ot(t) {
769
- const {
770
- overflow: e,
771
- overflowX: n,
772
- overflowY: o,
773
- display: i
774
- } = W(t);
775
- return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && i !== "inline" && i !== "contents";
776
- }
777
- function Ze(t) {
778
- return /^(table|td|th)$/.test(et(t));
779
- }
780
- function ct(t) {
781
- try {
782
- if (t.matches(":popover-open"))
783
- return !0;
784
- } catch {
785
- }
786
- try {
787
- return t.matches(":modal");
788
- } catch {
789
- return !1;
790
- }
791
- }
792
- const Je = /transform|translate|scale|rotate|perspective|filter/, Qe = /paint|layout|strict|content/, Z = (t) => !!t && t !== "none";
793
- let dt;
794
- function Ot(t) {
795
- const e = _(t) ? W(t) : t;
796
- return Z(e.transform) || Z(e.translate) || Z(e.scale) || Z(e.rotate) || Z(e.perspective) || !Ct() && (Z(e.backdropFilter) || Z(e.filter)) || Je.test(e.willChange || "") || Qe.test(e.contain || "");
797
- }
798
- function ti(t) {
799
- let e = G(t);
800
- for (; X(e) && !tt(e); ) {
801
- if (Ot(e))
802
- return e;
803
- if (ct(e))
804
- return null;
805
- e = G(e);
806
- }
807
- return null;
808
- }
809
- function Ct() {
810
- return dt == null && (dt = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), dt;
811
- }
812
- function tt(t) {
813
- return /^(html|body|#document)$/.test(et(t));
814
- }
815
- function W(t) {
816
- return P(t).getComputedStyle(t);
817
- }
818
- function ut(t) {
819
- return _(t) ? {
820
- scrollLeft: t.scrollLeft,
821
- scrollTop: t.scrollTop
822
- } : {
823
- scrollLeft: t.scrollX,
824
- scrollTop: t.scrollY
825
- };
826
- }
827
- function G(t) {
828
- if (et(t) === "html")
829
- return t;
830
- const e = (
831
- // Step into the shadow DOM of the parent of a slotted node.
832
- t.assignedSlot || // DOM Element detected.
833
- t.parentNode || // ShadowRoot detected.
834
- Ht(t) && t.host || // Fallback.
835
- Y(t)
836
- );
837
- return Ht(e) ? e.host : e;
838
- }
839
- function Xt(t) {
840
- const e = G(t);
841
- return tt(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : X(e) && ot(e) ? e : Xt(e);
842
- }
843
- function qt(t, e, n) {
844
- var o;
845
- e === void 0 && (e = []);
846
- const i = Xt(t), s = i === ((o = t.ownerDocument) == null ? void 0 : o.body), r = P(i);
847
- return s ? (mt(r), e.concat(r, r.visualViewport || [], ot(i) ? i : [], [])) : e.concat(i, qt(i, []));
848
- }
849
- function mt(t) {
850
- return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
851
- }
852
- function Gt(t) {
853
- const e = W(t);
854
- let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
855
- const i = X(t), s = i ? t.offsetWidth : n, r = i ? t.offsetHeight : o, l = st(n) !== s || st(o) !== r;
856
- return l && (n = s, o = r), {
857
- width: n,
858
- height: o,
859
- $: l
860
- };
861
- }
862
- function Zt(t) {
863
- return _(t) ? t : t.contextElement;
864
- }
865
- function J(t) {
866
- const e = Zt(t);
867
- if (!X(e))
868
- return $(1);
869
- const n = e.getBoundingClientRect(), {
870
- width: o,
871
- height: i,
872
- $: s
873
- } = Gt(e);
874
- let r = (s ? st(n.width) : n.width) / o, l = (s ? st(n.height) : n.height) / i;
875
- return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
876
- x: r,
877
- y: l
878
- };
879
- }
880
- const ei = /* @__PURE__ */ $(0);
881
- function Jt(t) {
882
- const e = P(t);
883
- return !Ct() || !e.visualViewport ? ei : {
884
- x: e.visualViewport.offsetLeft,
885
- y: e.visualViewport.offsetTop
886
- };
887
- }
888
- function ii(t, e, n) {
889
- return e === void 0 && (e = !1), !n || e && n !== P(t) ? !1 : e;
890
- }
891
- function nt(t, e, n, o) {
892
- e === void 0 && (e = !1), n === void 0 && (n = !1);
893
- const i = t.getBoundingClientRect(), s = Zt(t);
894
- let r = $(1);
895
- e && (o ? _(o) && (r = J(o)) : r = J(t));
896
- const l = ii(s, n, o) ? Jt(s) : $(0);
897
- let c = (i.left + l.x) / r.x, p = (i.top + l.y) / r.y, f = i.width / r.x, a = i.height / r.y;
898
- if (s) {
899
- const d = P(s), u = o && _(o) ? P(o) : o;
900
- let h = d, g = mt(h);
901
- for (; g && o && u !== h; ) {
902
- const m = J(g), v = g.getBoundingClientRect(), y = W(g), w = v.left + (g.clientLeft + parseFloat(y.paddingLeft)) * m.x, b = v.top + (g.clientTop + parseFloat(y.paddingTop)) * m.y;
903
- c *= m.x, p *= m.y, f *= m.x, a *= m.y, c += w, p += b, h = P(g), g = mt(h);
904
- }
905
- }
906
- return Q({
907
- width: f,
908
- height: a,
909
- x: c,
910
- y: p
911
- });
912
- }
913
- function ft(t, e) {
914
- const n = ut(t).scrollLeft;
915
- return e ? e.left + n : nt(Y(t)).left + n;
916
- }
917
- function Qt(t, e) {
918
- const n = t.getBoundingClientRect(), o = n.left + e.scrollLeft - ft(t, n), i = n.top + e.scrollTop;
919
- return {
920
- x: o,
921
- y: i
922
- };
923
- }
924
- function ni(t) {
925
- let {
926
- elements: e,
927
- rect: n,
928
- offsetParent: o,
929
- strategy: i
930
- } = t;
931
- const s = i === "fixed", r = Y(o), l = e ? ct(e.floating) : !1;
932
- if (o === r || l && s)
933
- return n;
934
- let c = {
935
- scrollLeft: 0,
936
- scrollTop: 0
937
- }, p = $(1);
938
- const f = $(0), a = X(o);
939
- if ((a || !a && !s) && ((et(o) !== "body" || ot(r)) && (c = ut(o)), a)) {
940
- const u = nt(o);
941
- p = J(o), f.x = u.x + o.clientLeft, f.y = u.y + o.clientTop;
942
- }
943
- const d = r && !a && !s ? Qt(r, c) : $(0);
944
- return {
945
- width: n.width * p.x,
946
- height: n.height * p.y,
947
- x: n.x * p.x - c.scrollLeft * p.x + f.x + d.x,
948
- y: n.y * p.y - c.scrollTop * p.y + f.y + d.y
949
- };
950
- }
951
- function oi(t) {
952
- return Array.from(t.getClientRects());
953
- }
954
- function si(t) {
955
- const e = Y(t), n = ut(t), o = t.ownerDocument.body, i = D(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), s = D(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
956
- let r = -n.scrollLeft + ft(t);
957
- const l = -n.scrollTop;
958
- return W(o).direction === "rtl" && (r += D(e.clientWidth, o.clientWidth) - i), {
959
- width: i,
960
- height: s,
961
- x: r,
962
- y: l
963
- };
964
- }
965
- const At = 25;
966
- function ri(t, e) {
967
- const n = P(t), o = Y(t), i = n.visualViewport;
968
- let s = o.clientWidth, r = o.clientHeight, l = 0, c = 0;
969
- if (i) {
970
- s = i.width, r = i.height;
971
- const f = Ct();
972
- (!f || f && e === "fixed") && (l = i.offsetLeft, c = i.offsetTop);
973
- }
974
- const p = ft(o);
975
- if (p <= 0) {
976
- const f = o.ownerDocument, a = f.body, d = getComputedStyle(a), u = f.compatMode === "CSS1Compat" && parseFloat(d.marginLeft) + parseFloat(d.marginRight) || 0, h = Math.abs(o.clientWidth - a.clientWidth - u);
977
- h <= At && (s -= h);
978
- } else p <= At && (s += p);
979
- return {
980
- width: s,
981
- height: r,
982
- x: l,
983
- y: c
984
- };
985
- }
986
- function li(t, e) {
987
- const n = nt(t, !0, e === "fixed"), o = n.top + t.clientTop, i = n.left + t.clientLeft, s = X(t) ? J(t) : $(1), r = t.clientWidth * s.x, l = t.clientHeight * s.y, c = i * s.x, p = o * s.y;
988
- return {
989
- width: r,
990
- height: l,
991
- x: c,
992
- y: p
993
- };
994
- }
995
- function Mt(t, e, n) {
996
- let o;
997
- if (e === "viewport")
998
- o = ri(t, n);
999
- else if (e === "document")
1000
- o = si(Y(t));
1001
- else if (_(e))
1002
- o = li(e, n);
1003
- else {
1004
- const i = Jt(t);
1005
- o = {
1006
- x: e.x - i.x,
1007
- y: e.y - i.y,
1008
- width: e.width,
1009
- height: e.height
1010
- };
1011
- }
1012
- return Q(o);
1013
- }
1014
- function te(t, e) {
1015
- const n = G(t);
1016
- return n === e || !_(n) || tt(n) ? !1 : W(n).position === "fixed" || te(n, e);
1017
- }
1018
- function ai(t, e) {
1019
- const n = e.get(t);
1020
- if (n)
1021
- return n;
1022
- let o = qt(t, []).filter((l) => _(l) && et(l) !== "body"), i = null;
1023
- const s = W(t).position === "fixed";
1024
- let r = s ? G(t) : t;
1025
- for (; _(r) && !tt(r); ) {
1026
- const l = W(r), c = Ot(r);
1027
- !c && l.position === "fixed" && (i = null), (s ? !c && !i : !c && l.position === "static" && !!i && (i.position === "absolute" || i.position === "fixed") || ot(r) && !c && te(t, r)) ? o = o.filter((f) => f !== r) : i = l, r = G(r);
1028
- }
1029
- return e.set(t, o), o;
1030
- }
1031
- function ci(t) {
1032
- let {
1033
- element: e,
1034
- boundary: n,
1035
- rootBoundary: o,
1036
- strategy: i
1037
- } = t;
1038
- const r = [...n === "clippingAncestors" ? ct(e) ? [] : ai(e, this._c) : [].concat(n), o], l = Mt(e, r[0], i);
1039
- let c = l.top, p = l.right, f = l.bottom, a = l.left;
1040
- for (let d = 1; d < r.length; d++) {
1041
- const u = Mt(e, r[d], i);
1042
- c = D(u.top, c), p = K(u.right, p), f = K(u.bottom, f), a = D(u.left, a);
1043
- }
1044
- return {
1045
- width: p - a,
1046
- height: f - c,
1047
- x: a,
1048
- y: c
1049
- };
1050
- }
1051
- function ui(t) {
1052
- const {
1053
- width: e,
1054
- height: n
1055
- } = Gt(t);
1056
- return {
1057
- width: e,
1058
- height: n
1059
- };
1060
- }
1061
- function fi(t, e, n) {
1062
- const o = X(e), i = Y(e), s = n === "fixed", r = nt(t, !0, s, e);
1063
- let l = {
1064
- scrollLeft: 0,
1065
- scrollTop: 0
1066
- };
1067
- const c = $(0);
1068
- function p() {
1069
- c.x = ft(i);
1070
- }
1071
- if (o || !o && !s)
1072
- if ((et(e) !== "body" || ot(i)) && (l = ut(e)), o) {
1073
- const u = nt(e, !0, s, e);
1074
- c.x = u.x + e.clientLeft, c.y = u.y + e.clientTop;
1075
- } else i && p();
1076
- s && !o && i && p();
1077
- const f = i && !o && !s ? Qt(i, l) : $(0), a = r.left + l.scrollLeft - c.x - f.x, d = r.top + l.scrollTop - c.y - f.y;
1078
- return {
1079
- x: a,
1080
- y: d,
1081
- width: r.width,
1082
- height: r.height
1083
- };
1084
- }
1085
- function ht(t) {
1086
- return W(t).position === "static";
1087
- }
1088
- function Pt(t, e) {
1089
- if (!X(t) || W(t).position === "fixed")
1090
- return null;
1091
- if (e)
1092
- return e(t);
1093
- let n = t.offsetParent;
1094
- return Y(t) === n && (n = n.ownerDocument.body), n;
1095
- }
1096
- function ee(t, e) {
1097
- const n = P(t);
1098
- if (ct(t))
1099
- return n;
1100
- if (!X(t)) {
1101
- let i = G(t);
1102
- for (; i && !tt(i); ) {
1103
- if (_(i) && !ht(i))
1104
- return i;
1105
- i = G(i);
1106
- }
1107
- return n;
1108
- }
1109
- let o = Pt(t, e);
1110
- for (; o && Ze(o) && ht(o); )
1111
- o = Pt(o, e);
1112
- return o && tt(o) && ht(o) && !Ot(o) ? n : o || ti(t) || n;
1113
- }
1114
- const di = async function(t) {
1115
- const e = this.getOffsetParent || ee, n = this.getDimensions, o = await n(t.floating);
1116
- return {
1117
- reference: fi(t.reference, await e(t.floating), t.strategy),
1118
- floating: {
1119
- x: 0,
1120
- y: 0,
1121
- width: o.width,
1122
- height: o.height
1123
- }
1124
- };
1125
- };
1126
- function hi(t) {
1127
- return W(t).direction === "rtl";
1128
- }
1129
- const pi = {
1130
- convertOffsetParentRelativeRectToViewportRelativeRect: ni,
1131
- getDocumentElement: Y,
1132
- getClippingRect: ci,
1133
- getOffsetParent: ee,
1134
- getElementRects: di,
1135
- getClientRects: oi,
1136
- getDimensions: ui,
1137
- getScale: J,
1138
- isElement: _,
1139
- isRTL: hi
1140
- }, ie = Xe, ne = We, oe = qe, se = ke, re = Ge, le = Fe, ae = Ne, ce = Ke, ue = (t, e, n) => {
1141
- const o = /* @__PURE__ */ new Map(), i = {
1142
- platform: pi,
1143
- ...n
1144
- }, s = {
1145
- ...i.platform,
1146
- _c: o
1147
- };
1148
- return ze(t, e, {
1149
- ...i,
1150
- platform: s
1151
- });
1152
- };
1153
- function gi(t, e) {
1154
- const n = Math.min(t.top, e.top), o = Math.max(t.bottom, e.bottom), i = Math.min(t.left, e.left), r = Math.max(t.right, e.right) - i, l = o - n, c = i, p = n;
1155
- return new DOMRect(c, p, r, l);
1156
- }
1157
- var mi = class {
1
+ import { jsx as g } from "react/jsx-runtime";
2
+ import { Flex as J, IconButton as Q } from "@radix-ui/themes";
3
+ import { a as M, u as tt } from "../../index-BMISMQrG.js";
4
+ import { b as D, P as S, p as et, q as L, N as it, a as z, r as nt, s as st } from "../../index-CnKS-BY2.js";
5
+ import { f as P, s as x, o as R, b as B, d as V, e as A, h as K, i as _, c as N } from "../../floating-ui.dom-ZRy7FSVk.js";
6
+ import { C as ot } from "../../index-ByyiiYsp.js";
7
+ import W, { useRef as w, useState as k, useEffect as E, useLayoutEffect as rt, useCallback as lt } from "react";
8
+ import { createPortal as j } from "react-dom";
9
+ import { getPopupMountTarget as at } from "../Scribe/extension/getPopupMountTarget.js";
10
+ function ut(t, e) {
11
+ const n = Math.min(t.top, e.top), s = Math.max(t.bottom, e.bottom), i = Math.min(t.left, e.left), o = Math.max(t.right, e.right) - i, a = s - n, u = i, f = n;
12
+ return new DOMRect(u, f, o, a);
13
+ }
14
+ var dt = class {
1158
15
  constructor({
1159
16
  editor: t,
1160
17
  element: e,
1161
18
  view: n,
1162
- pluginKey: o = "bubbleMenu",
19
+ pluginKey: s = "bubbleMenu",
1163
20
  updateDelay: i = 250,
1164
- resizeDelay: s = 60,
1165
- shouldShow: r,
1166
- appendTo: l,
1167
- getReferencedVirtualElement: c,
1168
- options: p
21
+ resizeDelay: l = 60,
22
+ shouldShow: o,
23
+ appendTo: a,
24
+ getReferencedVirtualElement: u,
25
+ options: f
1169
26
  }) {
1170
27
  this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.floatingUIOptions = {
1171
28
  strategy: "absolute",
@@ -1182,9 +39,14 @@ var mi = class {
1182
39
  onHide: void 0,
1183
40
  onUpdate: void 0,
1184
41
  onDestroy: void 0
1185
- }, this.shouldShow = ({ view: a, state: d, from: u, to: h }) => {
1186
- const { doc: g, selection: m } = d, { empty: v } = m, y = !g.textBetween(u, h).length && xe(d.selection), w = this.element.contains(document.activeElement);
1187
- return !(!(a.hasFocus() || w) || v || y || !this.editor.isEditable);
42
+ }, this.shouldShow = ({
43
+ view: r,
44
+ state: d,
45
+ from: h,
46
+ to: p
47
+ }) => {
48
+ const { doc: m, selection: v } = d, { empty: O } = v, I = !m.textBetween(h, p).length && et(d.selection), b = this.element.contains(document.activeElement);
49
+ return !(!(r.hasFocus() || b) || O || I || !this.editor.isEditable);
1188
50
  }, this.mousedownHandler = () => {
1189
51
  this.preventHide = !0;
1190
52
  }, this.dragstartHandler = () => {
@@ -1195,7 +57,7 @@ var mi = class {
1195
57
  }, this.resizeDelay);
1196
58
  }, this.focusHandler = () => {
1197
59
  setTimeout(() => this.update(this.editor.view));
1198
- }, this.blurHandler = ({ event: a }) => {
60
+ }, this.blurHandler = ({ event: r }) => {
1199
61
  var d;
1200
62
  if (this.editor.isDestroyed) {
1201
63
  this.destroy();
@@ -1205,119 +67,137 @@ var mi = class {
1205
67
  this.preventHide = !1;
1206
68
  return;
1207
69
  }
1208
- a?.relatedTarget && ((d = this.element.parentNode) != null && d.contains(a.relatedTarget)) || a?.relatedTarget !== this.editor.view.dom && this.hide();
1209
- }, this.handleDebouncedUpdate = (a, d) => {
1210
- const u = !d?.selection.eq(a.state.selection), h = !d?.doc.eq(a.state.doc);
1211
- !u && !h || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
1212
- this.updateHandler(a, u, h, d);
70
+ r?.relatedTarget && ((d = this.element.parentNode) != null && d.contains(r.relatedTarget)) || r?.relatedTarget !== this.editor.view.dom && this.hide();
71
+ }, this.handleDebouncedUpdate = (r, d) => {
72
+ const h = !d?.selection.eq(r.state.selection), p = !d?.doc.eq(r.state.doc);
73
+ !h && !p || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
74
+ this.updateHandler(r, h, p, d);
1213
75
  }, this.updateDelay));
1214
- }, this.updateHandler = (a, d, u, h) => {
1215
- const { composing: g } = a;
1216
- if (g || !d && !u)
76
+ }, this.updateHandler = (r, d, h, p) => {
77
+ const { composing: m } = r;
78
+ if (m || !d && !h)
1217
79
  return;
1218
- if (!this.getShouldShow(h)) {
80
+ if (!this.getShouldShow(p)) {
1219
81
  this.hide();
1220
82
  return;
1221
83
  }
1222
84
  this.show(), this.updatePosition();
1223
- }, this.transactionHandler = ({ transaction: a }) => {
1224
- const d = a.getMeta(this.pluginKey);
85
+ }, this.transactionHandler = ({ transaction: r }) => {
86
+ const d = r.getMeta(this.pluginKey);
1225
87
  d === "updatePosition" ? this.updatePosition() : d && typeof d == "object" && d.type === "updateOptions" ? this.updateOptions(d.options) : d === "hide" ? this.hide() : d === "show" && (this.updatePosition(), this.show());
1226
88
  };
1227
- var f;
1228
- this.editor = t, this.element = e, this.view = n, this.pluginKey = o, this.updateDelay = i, this.resizeDelay = s, this.appendTo = l, this.scrollTarget = (f = p?.scrollTarget) != null ? f : window, this.getReferencedVirtualElement = c, this.floatingUIOptions = {
89
+ var c;
90
+ this.editor = t, this.element = e, this.view = n, this.pluginKey = s, this.updateDelay = i, this.resizeDelay = l, this.appendTo = a, this.scrollTarget = (c = f?.scrollTarget) != null ? c : window, this.getReferencedVirtualElement = u, this.floatingUIOptions = {
1229
91
  ...this.floatingUIOptions,
1230
- ...p
1231
- }, this.element.tabIndex = 0, r && (this.shouldShow = r), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
92
+ ...f
93
+ }, this.element.tabIndex = 0, o && (this.shouldShow = o), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
1232
94
  }
1233
95
  get middlewares() {
1234
96
  const t = [];
1235
- return this.floatingUIOptions.flip && t.push(se(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && t.push(
1236
- oe(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
97
+ return this.floatingUIOptions.flip && t.push(
98
+ P(
99
+ typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0
100
+ )
101
+ ), this.floatingUIOptions.shift && t.push(
102
+ x(
103
+ typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0
104
+ )
1237
105
  ), this.floatingUIOptions.offset && t.push(
1238
- ie(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
1239
- ), this.floatingUIOptions.arrow && t.push(ae(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(re(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && t.push(
1240
- ne(
106
+ R(
107
+ typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0
108
+ )
109
+ ), this.floatingUIOptions.arrow && t.push(B(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(
110
+ V(
111
+ typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0
112
+ )
113
+ ), this.floatingUIOptions.autoPlacement && t.push(
114
+ A(
1241
115
  typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
1242
116
  )
1243
- ), this.floatingUIOptions.hide && t.push(le(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && t.push(
1244
- ce(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
117
+ ), this.floatingUIOptions.hide && t.push(
118
+ K(
119
+ typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0
120
+ )
121
+ ), this.floatingUIOptions.inline && t.push(
122
+ _(
123
+ typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0
124
+ )
1245
125
  ), t;
1246
126
  }
1247
127
  get virtualElement() {
1248
128
  var t, e, n;
1249
- const { selection: o } = this.editor.state, i = (t = this.getReferencedVirtualElement) == null ? void 0 : t.call(this);
129
+ const { selection: s } = this.editor.state, i = (t = this.getReferencedVirtualElement) == null ? void 0 : t.call(this);
1250
130
  if (i)
1251
131
  return i;
1252
132
  if (!((n = (e = this.view) == null ? void 0 : e.dom) != null && n.parentNode))
1253
133
  return;
1254
- const s = zt(this.view, o.from, o.to);
1255
- let r = {
1256
- getBoundingClientRect: () => s,
1257
- getClientRects: () => [s]
134
+ const l = L(this.view, s.from, s.to);
135
+ let o = {
136
+ getBoundingClientRect: () => l,
137
+ getClientRects: () => [l]
1258
138
  };
1259
- if (o instanceof Oe) {
1260
- let l = this.view.nodeDOM(o.from);
1261
- const c = l.dataset.nodeViewWrapper ? l : l.querySelector("[data-node-view-wrapper]");
1262
- c && (l = c), l && (r = {
1263
- getBoundingClientRect: () => l.getBoundingClientRect(),
1264
- getClientRects: () => [l.getBoundingClientRect()]
139
+ if (s instanceof it) {
140
+ let a = this.view.nodeDOM(s.from);
141
+ const u = a.dataset.nodeViewWrapper ? a : a.querySelector("[data-node-view-wrapper]");
142
+ u && (a = u), a && (o = {
143
+ getBoundingClientRect: () => a.getBoundingClientRect(),
144
+ getClientRects: () => [a.getBoundingClientRect()]
1265
145
  });
1266
146
  }
1267
- if (o instanceof Te) {
1268
- const { $anchorCell: l, $headCell: c } = o, p = l ? l.pos : c.pos, f = c ? c.pos : l.pos, a = this.view.nodeDOM(p), d = this.view.nodeDOM(f);
1269
- if (!a || !d)
147
+ if (s instanceof ot) {
148
+ const { $anchorCell: a, $headCell: u } = s, f = a ? a.pos : u.pos, c = u ? u.pos : a.pos, r = this.view.nodeDOM(f), d = this.view.nodeDOM(c);
149
+ if (!r || !d)
1270
150
  return;
1271
- const u = a === d ? a.getBoundingClientRect() : gi(
1272
- a.getBoundingClientRect(),
151
+ const h = r === d ? r.getBoundingClientRect() : ut(
152
+ r.getBoundingClientRect(),
1273
153
  d.getBoundingClientRect()
1274
154
  );
1275
- r = {
1276
- getBoundingClientRect: () => u,
1277
- getClientRects: () => [u]
155
+ o = {
156
+ getBoundingClientRect: () => h,
157
+ getClientRects: () => [h]
1278
158
  };
1279
159
  }
1280
- return r;
160
+ return o;
1281
161
  }
1282
162
  updatePosition() {
1283
163
  if (!this.isVisible)
1284
164
  return;
1285
165
  const t = this.virtualElement;
1286
- t && ue(t, this.element, {
166
+ t && N(t, this.element, {
1287
167
  placement: this.floatingUIOptions.placement,
1288
168
  strategy: this.floatingUIOptions.strategy,
1289
169
  middleware: this.middlewares
1290
- }).then(({ x: e, y: n, strategy: o, middlewareData: i }) => {
1291
- var s, r;
170
+ }).then(({ x: e, y: n, strategy: s, middlewareData: i }) => {
171
+ var l, o;
1292
172
  if (!(!this.isVisible || this.editor.isDestroyed || !this.element.isConnected)) {
1293
- if ((s = i.hide) != null && s.referenceHidden || (r = i.hide) != null && r.escaped) {
173
+ if ((l = i.hide) != null && l.referenceHidden || (o = i.hide) != null && o.escaped) {
1294
174
  this.element.style.visibility = "hidden";
1295
175
  return;
1296
176
  }
1297
- this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = o, this.element.style.left = `${e}px`, this.element.style.top = `${n}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
177
+ this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = s, this.element.style.left = `${e}px`, this.element.style.top = `${n}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
1298
178
  }
1299
179
  });
1300
180
  }
1301
181
  update(t, e) {
1302
- const { state: n } = t, o = n.selection.from !== n.selection.to;
1303
- if (this.updateDelay > 0 && o) {
182
+ const { state: n } = t, s = n.selection.from !== n.selection.to;
183
+ if (this.updateDelay > 0 && s) {
1304
184
  this.handleDebouncedUpdate(t, e);
1305
185
  return;
1306
186
  }
1307
- const i = !e?.selection.eq(t.state.selection), s = !e?.doc.eq(t.state.doc);
1308
- this.updateHandler(t, i, s, e);
187
+ const i = !e?.selection.eq(t.state.selection), l = !e?.doc.eq(t.state.doc);
188
+ this.updateHandler(t, i, l, e);
1309
189
  }
1310
190
  getShouldShow(t) {
1311
191
  var e;
1312
- const { state: n } = this.view, { selection: o } = n, { ranges: i } = o, s = Math.min(...i.map((c) => c.$from.pos)), r = Math.max(...i.map((c) => c.$to.pos));
192
+ const { state: n } = this.view, { selection: s } = n, { ranges: i } = s, l = Math.min(...i.map((u) => u.$from.pos)), o = Math.max(...i.map((u) => u.$to.pos));
1313
193
  return ((e = this.shouldShow) == null ? void 0 : e.call(this, {
1314
194
  editor: this.editor,
1315
195
  element: this.element,
1316
196
  view: this.view,
1317
197
  state: n,
1318
198
  oldState: t,
1319
- from: s,
1320
- to: r
199
+ from: l,
200
+ to: o
1321
201
  })) || !1;
1322
202
  }
1323
203
  show() {
@@ -1344,11 +224,11 @@ var mi = class {
1344
224
  destroy() {
1345
225
  this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
1346
226
  }
1347
- }, fe = (t) => new Vt({
1348
- key: typeof t.pluginKey == "string" ? new vt(t.pluginKey) : t.pluginKey,
1349
- view: (e) => new mi({ view: e, ...t })
227
+ }, F = (t) => new D({
228
+ key: typeof t.pluginKey == "string" ? new S(t.pluginKey) : t.pluginKey,
229
+ view: (e) => new dt({ view: e, ...t })
1350
230
  });
1351
- Nt.create({
231
+ z.create({
1352
232
  name: "bubbleMenu",
1353
233
  addOptions() {
1354
234
  return {
@@ -1361,7 +241,7 @@ Nt.create({
1361
241
  },
1362
242
  addProseMirrorPlugins() {
1363
243
  return this.options.element ? [
1364
- fe({
244
+ F({
1365
245
  pluginKey: this.options.pluginKey,
1366
246
  editor: this.editor,
1367
247
  element: this.options.element,
@@ -1374,21 +254,21 @@ Nt.create({
1374
254
  ] : [];
1375
255
  }
1376
256
  });
1377
- var wi = class {
257
+ var ht = class {
1378
258
  constructor({
1379
259
  editor: t,
1380
260
  element: e,
1381
261
  view: n,
1382
- pluginKey: o = "floatingMenu",
262
+ pluginKey: s = "floatingMenu",
1383
263
  updateDelay: i = 250,
1384
- resizeDelay: s = 60,
1385
- options: r,
1386
- appendTo: l,
1387
- shouldShow: c
264
+ resizeDelay: l = 60,
265
+ options: o,
266
+ appendTo: a,
267
+ shouldShow: u
1388
268
  }) {
1389
- this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.shouldShow = ({ view: f, state: a }) => {
1390
- const { selection: d } = a, { $anchor: u, empty: h } = d, g = u.depth === 1, m = u.parent.isTextblock && !u.parent.type.spec.code && !u.parent.textContent && u.parent.childCount === 0 && !this.getTextContent(u.parent);
1391
- return !(!f.hasFocus() || !h || !g || !m || !this.editor.isEditable);
269
+ this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.shouldShow = ({ view: c, state: r }) => {
270
+ const { selection: d } = r, { $anchor: h, empty: p } = d, m = h.depth === 1, v = h.parent.isTextblock && !h.parent.type.spec.code && !h.parent.textContent && h.parent.childCount === 0 && !this.getTextContent(h.parent);
271
+ return !(!c.hasFocus() || !p || !m || !v || !this.editor.isEditable);
1392
272
  }, this.floatingUIOptions = {
1393
273
  strategy: "absolute",
1394
274
  placement: "right",
@@ -1400,11 +280,11 @@ var wi = class {
1400
280
  autoPlacement: !1,
1401
281
  hide: !1,
1402
282
  inline: !1
1403
- }, this.updateHandler = (f, a, d, u) => {
1404
- const { composing: h } = f;
1405
- if (h || !a && !d)
283
+ }, this.updateHandler = (c, r, d, h) => {
284
+ const { composing: p } = c;
285
+ if (p || !r && !d)
1406
286
  return;
1407
- if (!this.getShouldShow(u)) {
287
+ if (!this.getShouldShow(h)) {
1408
288
  this.hide();
1409
289
  return;
1410
290
  }
@@ -1413,54 +293,72 @@ var wi = class {
1413
293
  this.preventHide = !0;
1414
294
  }, this.focusHandler = () => {
1415
295
  setTimeout(() => this.update(this.editor.view));
1416
- }, this.blurHandler = ({ event: f }) => {
1417
- var a;
296
+ }, this.blurHandler = ({ event: c }) => {
297
+ var r;
1418
298
  if (this.preventHide) {
1419
299
  this.preventHide = !1;
1420
300
  return;
1421
301
  }
1422
- f?.relatedTarget && ((a = this.element.parentNode) != null && a.contains(f.relatedTarget)) || f?.relatedTarget !== this.editor.view.dom && this.hide();
1423
- }, this.transactionHandler = ({ transaction: f }) => {
1424
- const a = f.getMeta(this.pluginKey);
1425
- a === "updatePosition" ? this.updatePosition() : a && typeof a == "object" && a.type === "updateOptions" ? this.updateOptions(a.options) : a === "hide" ? this.hide() : a === "show" && (this.updatePosition(), this.show());
302
+ c?.relatedTarget && ((r = this.element.parentNode) != null && r.contains(c.relatedTarget)) || c?.relatedTarget !== this.editor.view.dom && this.hide();
303
+ }, this.transactionHandler = ({ transaction: c }) => {
304
+ const r = c.getMeta(this.pluginKey);
305
+ r === "updatePosition" ? this.updatePosition() : r && typeof r == "object" && r.type === "updateOptions" ? this.updateOptions(r.options) : r === "hide" ? this.hide() : r === "show" && (this.updatePosition(), this.show());
1426
306
  }, this.resizeHandler = () => {
1427
307
  this.resizeDebounceTimer && clearTimeout(this.resizeDebounceTimer), this.resizeDebounceTimer = window.setTimeout(() => {
1428
308
  this.updatePosition();
1429
309
  }, this.resizeDelay);
1430
310
  };
1431
- var p;
1432
- this.editor = t, this.element = e, this.view = n, this.pluginKey = o, this.updateDelay = i, this.resizeDelay = s, this.appendTo = l, this.scrollTarget = (p = r?.scrollTarget) != null ? p : window, this.floatingUIOptions = {
311
+ var f;
312
+ this.editor = t, this.element = e, this.view = n, this.pluginKey = s, this.updateDelay = i, this.resizeDelay = l, this.appendTo = a, this.scrollTarget = (f = o?.scrollTarget) != null ? f : window, this.floatingUIOptions = {
1433
313
  ...this.floatingUIOptions,
1434
- ...r
1435
- }, this.element.tabIndex = 0, c && (this.shouldShow = c), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
314
+ ...o
315
+ }, this.element.tabIndex = 0, u && (this.shouldShow = u), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
1436
316
  }
1437
317
  getTextContent(t) {
1438
- return Ce(t, { textSerializers: Se(this.editor.schema) });
318
+ return nt(t, { textSerializers: st(this.editor.schema) });
1439
319
  }
1440
320
  get middlewares() {
1441
321
  const t = [];
1442
- return this.floatingUIOptions.flip && t.push(se(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && t.push(
1443
- oe(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
322
+ return this.floatingUIOptions.flip && t.push(
323
+ P(
324
+ typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0
325
+ )
326
+ ), this.floatingUIOptions.shift && t.push(
327
+ x(
328
+ typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0
329
+ )
1444
330
  ), this.floatingUIOptions.offset && t.push(
1445
- ie(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
1446
- ), this.floatingUIOptions.arrow && t.push(ae(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(re(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && t.push(
1447
- ne(
331
+ R(
332
+ typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0
333
+ )
334
+ ), this.floatingUIOptions.arrow && t.push(B(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(
335
+ V(
336
+ typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0
337
+ )
338
+ ), this.floatingUIOptions.autoPlacement && t.push(
339
+ A(
1448
340
  typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
1449
341
  )
1450
- ), this.floatingUIOptions.hide && t.push(le(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && t.push(
1451
- ce(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
342
+ ), this.floatingUIOptions.hide && t.push(
343
+ K(
344
+ typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0
345
+ )
346
+ ), this.floatingUIOptions.inline && t.push(
347
+ _(
348
+ typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0
349
+ )
1452
350
  ), t;
1453
351
  }
1454
352
  getShouldShow(t) {
1455
353
  var e;
1456
- const { state: n } = this.view, { selection: o } = n, { ranges: i } = o, s = Math.min(...i.map((c) => c.$from.pos)), r = Math.max(...i.map((c) => c.$to.pos));
354
+ const { state: n } = this.view, { selection: s } = n, { ranges: i } = s, l = Math.min(...i.map((u) => u.$from.pos)), o = Math.max(...i.map((u) => u.$to.pos));
1457
355
  return (e = this.shouldShow) == null ? void 0 : e.call(this, {
1458
356
  editor: this.editor,
1459
357
  view: this.view,
1460
358
  state: n,
1461
359
  oldState: t,
1462
- from: s,
1463
- to: r
360
+ from: l,
361
+ to: o
1464
362
  });
1465
363
  }
1466
364
  updateOptions(t) {
@@ -1474,26 +372,29 @@ var wi = class {
1474
372
  }
1475
373
  }
1476
374
  updatePosition() {
1477
- const { selection: t } = this.editor.state, e = zt(this.view, t.from, t.to);
1478
- ue({
1479
- getBoundingClientRect: () => e,
1480
- getClientRects: () => [e]
375
+ var t, e;
376
+ if (!((e = (t = this.view) == null ? void 0 : t.dom) != null && e.parentNode))
377
+ return;
378
+ const { selection: n } = this.editor.state, s = L(this.view, n.from, n.to);
379
+ N({
380
+ getBoundingClientRect: () => s,
381
+ getClientRects: () => [s]
1481
382
  }, this.element, {
1482
383
  placement: this.floatingUIOptions.placement,
1483
384
  strategy: this.floatingUIOptions.strategy,
1484
385
  middleware: this.middlewares
1485
- }).then(({ x: o, y: i, strategy: s, middlewareData: r }) => {
1486
- var l, c;
1487
- if ((l = r.hide) != null && l.referenceHidden || (c = r.hide) != null && c.escaped) {
386
+ }).then(({ x: l, y: o, strategy: a, middlewareData: u }) => {
387
+ var f, c;
388
+ if ((f = u.hide) != null && f.referenceHidden || (c = u.hide) != null && c.escaped) {
1488
389
  this.element.style.visibility = "hidden";
1489
390
  return;
1490
391
  }
1491
- this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = s, this.element.style.left = `${o}px`, this.element.style.top = `${i}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
392
+ this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = a, this.element.style.left = `${l}px`, this.element.style.top = `${o}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
1492
393
  });
1493
394
  }
1494
395
  update(t, e) {
1495
- const n = !e?.selection.eq(t.state.selection), o = !e?.doc.eq(t.state.doc);
1496
- this.updateHandler(t, n, o, e);
396
+ const n = !e?.selection.eq(t.state.selection), s = !e?.doc.eq(t.state.doc);
397
+ this.updateHandler(t, n, s, e);
1497
398
  }
1498
399
  show() {
1499
400
  var t;
@@ -1509,11 +410,11 @@ var wi = class {
1509
410
  destroy() {
1510
411
  this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
1511
412
  }
1512
- }, de = (t) => new Vt({
1513
- key: typeof t.pluginKey == "string" ? new vt(t.pluginKey) : t.pluginKey,
1514
- view: (e) => new wi({ view: e, ...t })
413
+ }, $ = (t) => new D({
414
+ key: typeof t.pluginKey == "string" ? new S(t.pluginKey) : t.pluginKey,
415
+ view: (e) => new ht({ view: e, ...t })
1515
416
  });
1516
- Nt.create({
417
+ z.create({
1517
418
  name: "floatingMenu",
1518
419
  addOptions() {
1519
420
  return {
@@ -1533,7 +434,7 @@ Nt.create({
1533
434
  },
1534
435
  addProseMirrorPlugins() {
1535
436
  return this.options.element ? [
1536
- de({
437
+ $({
1537
438
  pluginKey: this.options.pluginKey,
1538
439
  editor: this.editor,
1539
440
  element: this.options.element,
@@ -1546,10 +447,17 @@ Nt.create({
1546
447
  ] : [];
1547
448
  }
1548
449
  });
1549
- function he(t, e) {
1550
- return t ?? new vt(e);
450
+ function q(t, e) {
451
+ return t ?? new S(e);
1551
452
  }
1552
- var vi = typeof window < "u" ? Ee : it, pe = /* @__PURE__ */ new Set(["left", "opacity", "position", "top", "visibility", "width"]), yi = /* @__PURE__ */ new Set([
453
+ var ct = typeof window < "u" ? rt : E, Y = /* @__PURE__ */ new Set([
454
+ "left",
455
+ "opacity",
456
+ "position",
457
+ "top",
458
+ "visibility",
459
+ "width"
460
+ ]), pt = /* @__PURE__ */ new Set([
1553
461
  "animationIterationCount",
1554
462
  "aspectRatio",
1555
463
  "borderImageOutset",
@@ -1585,7 +493,7 @@ var vi = typeof window < "u" ? Ee : it, pe = /* @__PURE__ */ new Set(["left", "o
1585
493
  "widows",
1586
494
  "zIndex",
1587
495
  "zoom"
1588
- ]), bi = /* @__PURE__ */ new Set(["children", "className", "style"]), xi = /* @__PURE__ */ new Set(["tabIndex"]), Oi = /* @__PURE__ */ new Set([
496
+ ]), ft = /* @__PURE__ */ new Set(["children", "className", "style"]), gt = /* @__PURE__ */ new Set(["tabIndex"]), mt = /* @__PURE__ */ new Set([
1589
497
  "accessKey",
1590
498
  "autoCapitalize",
1591
499
  "contentEditable",
@@ -1603,35 +511,35 @@ var vi = typeof window < "u" ? Ee : it, pe = /* @__PURE__ */ new Set(["left", "o
1603
511
  "tabIndex",
1604
512
  "title",
1605
513
  "translate"
1606
- ]), Ci = {
514
+ ]), vt = {
1607
515
  Blur: "focusout",
1608
516
  DoubleClick: "dblclick",
1609
517
  Focus: "focusin",
1610
518
  MouseEnter: "mouseenter",
1611
519
  MouseLeave: "mouseleave"
1612
520
  };
1613
- function wt(t, e) {
521
+ function U(t, e) {
1614
522
  return /^on[A-Z]/.test(t) && typeof e == "function";
1615
523
  }
1616
- function Si(t) {
524
+ function bt(t) {
1617
525
  return t.startsWith("aria-") || t.startsWith("data-"), t;
1618
526
  }
1619
- function Ti(t) {
1620
- return t.startsWith("aria-") || t.startsWith("data-") || Oi.has(t);
527
+ function wt(t) {
528
+ return t.startsWith("aria-") || t.startsWith("data-") || mt.has(t);
1621
529
  }
1622
- function ge(t) {
530
+ function G(t) {
1623
531
  return t.startsWith("--") ? t : t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
1624
532
  }
1625
- function Ei(t) {
533
+ function yt(t) {
1626
534
  var e;
1627
535
  const n = t.endsWith("Capture"), i = (n ? t.slice(0, -7) : t).slice(2);
1628
536
  return {
1629
- eventName: (e = Ci[i]) != null ? e : i.toLowerCase(),
537
+ eventName: (e = vt[i]) != null ? e : i.toLowerCase(),
1630
538
  options: n ? { capture: !0 } : void 0
1631
539
  };
1632
540
  }
1633
- function Ri(t, e) {
1634
- let n = e.defaultPrevented, o = !1;
541
+ function Ot(t, e) {
542
+ let n = e.defaultPrevented, s = !1;
1635
543
  const i = Object.create(e);
1636
544
  return Object.defineProperties(i, {
1637
545
  nativeEvent: { value: e },
@@ -1640,7 +548,7 @@ function Ri(t, e) {
1640
548
  persist: { value: () => {
1641
549
  } },
1642
550
  isDefaultPrevented: { value: () => n },
1643
- isPropagationStopped: { value: () => o },
551
+ isPropagationStopped: { value: () => s },
1644
552
  preventDefault: {
1645
553
  value: () => {
1646
554
  n = !0, e.preventDefault();
@@ -1648,22 +556,22 @@ function Ri(t, e) {
1648
556
  },
1649
557
  stopPropagation: {
1650
558
  value: () => {
1651
- o = !0, e.stopPropagation();
559
+ s = !0, e.stopPropagation();
1652
560
  }
1653
561
  }
1654
562
  }), i;
1655
563
  }
1656
- function pt(t) {
1657
- return xi.has(t);
564
+ function H(t) {
565
+ return gt.has(t);
1658
566
  }
1659
- function Ut(t, e, n) {
567
+ function C(t, e, n) {
1660
568
  if (e === "tabIndex") {
1661
569
  t.tabIndex = Number(n);
1662
570
  return;
1663
571
  }
1664
572
  t[e] = n;
1665
573
  }
1666
- function Ii(t, e) {
574
+ function It(t, e) {
1667
575
  if (e === "tabIndex") {
1668
576
  t.removeAttribute("tabindex");
1669
577
  return;
@@ -1679,39 +587,39 @@ function Ii(t, e) {
1679
587
  }
1680
588
  t[e] = "";
1681
589
  }
1682
- function Li(t, e) {
1683
- return typeof e != "number" || e === 0 || t.startsWith("--") || yi.has(t) ? String(e) : `${e}px`;
590
+ function Et(t, e) {
591
+ return typeof e != "number" || e === 0 || t.startsWith("--") || pt.has(t) ? String(e) : `${e}px`;
1684
592
  }
1685
- function Di(t, e) {
1686
- pe.has(e) || t.style.removeProperty(ge(e));
593
+ function Tt(t, e) {
594
+ Y.has(e) || t.style.removeProperty(G(e));
1687
595
  }
1688
- function Hi(t, e, n) {
1689
- pe.has(e) || t.style.setProperty(ge(e), Li(e, n));
596
+ function Ht(t, e, n) {
597
+ Y.has(e) || t.style.setProperty(G(e), Et(e, n));
1690
598
  }
1691
- function Ai(t, e, n) {
599
+ function Ut(t, e, n) {
1692
600
  (/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(n)])).forEach((i) => {
1693
- if (bi.has(i) || !Ti(i) || wt(i, e[i]) || wt(i, n[i]))
601
+ if (ft.has(i) || !wt(i) || U(i, e[i]) || U(i, n[i]))
1694
602
  return;
1695
- const s = e[i], r = n[i];
1696
- if (s === r)
603
+ const l = e[i], o = n[i];
604
+ if (l === o)
1697
605
  return;
1698
- const l = Si(i);
1699
- if (r == null || r === !1) {
1700
- pt(i) && Ii(t, i), t.removeAttribute(l);
606
+ const a = bt(i);
607
+ if (o == null || o === !1) {
608
+ H(i) && It(t, i), t.removeAttribute(a);
1701
609
  return;
1702
610
  }
1703
- if (r === !0) {
1704
- pt(i) && Ut(t, i, !0), t.setAttribute(l, "");
611
+ if (o === !0) {
612
+ H(i) && C(t, i, !0), t.setAttribute(a, "");
1705
613
  return;
1706
614
  }
1707
- if (pt(i)) {
1708
- Ut(t, i, r);
615
+ if (H(i)) {
616
+ C(t, i, o);
1709
617
  return;
1710
618
  }
1711
- t.setAttribute(l, String(r));
619
+ t.setAttribute(a, String(o));
1712
620
  });
1713
621
  }
1714
- function Mi(t, e, n) {
622
+ function St(t, e, n) {
1715
623
  if (e !== n) {
1716
624
  if (n) {
1717
625
  t.className = n;
@@ -1720,172 +628,197 @@ function Mi(t, e, n) {
1720
628
  t.removeAttribute("class");
1721
629
  }
1722
630
  }
1723
- function Pi(t, e, n) {
1724
- const o = e ?? {}, i = n ?? {};
1725
- (/* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(i)])).forEach((r) => {
1726
- const l = o[r], c = i[r];
1727
- if (l !== c) {
1728
- if (c == null) {
1729
- Di(t, r);
631
+ function Ct(t, e, n) {
632
+ const s = e ?? {}, i = n ?? {};
633
+ (/* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(i)])).forEach((o) => {
634
+ const a = s[o], u = i[o];
635
+ if (a !== u) {
636
+ if (u == null) {
637
+ Tt(t, o);
1730
638
  return;
1731
639
  }
1732
- Hi(t, r, c);
640
+ Ht(t, o, u);
1733
641
  }
1734
642
  });
1735
643
  }
1736
- function Ui(t, e, n) {
1737
- e.forEach(({ eventName: i, listener: s, options: r }) => {
1738
- t.removeEventListener(i, s, r);
644
+ function Mt(t, e, n) {
645
+ e.forEach(({ eventName: i, listener: l, options: o }) => {
646
+ t.removeEventListener(i, l, o);
1739
647
  });
1740
- const o = [];
1741
- return Object.entries(n).forEach(([i, s]) => {
1742
- if (!wt(i, s))
648
+ const s = [];
649
+ return Object.entries(n).forEach(([i, l]) => {
650
+ if (!U(i, l))
1743
651
  return;
1744
- const { eventName: r, options: l } = Ei(i), c = (p) => {
1745
- s(Ri(t, p));
652
+ const { eventName: o, options: a } = yt(i), u = (f) => {
653
+ l(Ot(t, f));
1746
654
  };
1747
- t.addEventListener(r, c, l), o.push({ eventName: r, listener: c, options: l });
1748
- }), o;
655
+ t.addEventListener(o, u, a), s.push({ eventName: o, listener: u, options: a });
656
+ }), s;
1749
657
  }
1750
- function me(t, e) {
1751
- const n = k({}), o = k([]);
1752
- vi(() => {
658
+ function Z(t, e) {
659
+ const n = w({}), s = w([]);
660
+ ct(() => {
1753
661
  const i = n.current;
1754
- return Mi(t, i.className, e.className), Pi(t, i.style, e.style), Ai(t, i, e), o.current = Ui(t, o.current, e), n.current = e, () => {
1755
- o.current.forEach(({ eventName: s, listener: r, options: l }) => {
1756
- t.removeEventListener(s, r, l);
1757
- }), o.current = [];
662
+ return St(t, i.className, e.className), Ct(t, i.style, e.style), Ut(t, i, e), s.current = Mt(t, s.current, e), n.current = e, () => {
663
+ s.current.forEach(({ eventName: l, listener: o, options: a }) => {
664
+ t.removeEventListener(l, o, a);
665
+ }), s.current = [];
1758
666
  };
1759
667
  }, [t, e]);
1760
668
  }
1761
- var Bi = _t.forwardRef(
669
+ var Dt = W.forwardRef(
1762
670
  ({
1763
671
  pluginKey: t,
1764
672
  editor: e,
1765
673
  updateDelay: n,
1766
- resizeDelay: o,
674
+ resizeDelay: s,
1767
675
  appendTo: i,
1768
- shouldShow: s = null,
1769
- getReferencedVirtualElement: r,
1770
- options: l,
1771
- children: c,
1772
- ...p
1773
- }, f) => {
1774
- const a = k(document.createElement("div")), d = k(he(t, "bubbleMenu")).current;
1775
- me(a.current, p), typeof f == "function" ? f(a.current) : f && (f.current = a.current);
1776
- const { editor: u } = Bt(), h = e || u, g = {
676
+ shouldShow: l = null,
677
+ getReferencedVirtualElement: o,
678
+ options: a,
679
+ children: u,
680
+ ...f
681
+ }, c) => {
682
+ const r = w(document.createElement("div")), d = w(
683
+ q(t, "bubbleMenu")
684
+ ).current;
685
+ Z(r.current, f), typeof c == "function" ? c(r.current) : c && (c.current = r.current);
686
+ const { editor: h } = M(), p = e || h, m = {
1777
687
  updateDelay: n,
1778
- resizeDelay: o,
688
+ resizeDelay: s,
1779
689
  appendTo: i,
1780
690
  pluginKey: d,
1781
- shouldShow: s,
1782
- getReferencedVirtualElement: r,
1783
- options: l
1784
- }, m = k(g);
1785
- m.current = g;
1786
- const [v, y] = Wt(!1), w = k(!0);
1787
- return it(() => {
1788
- if (h?.isDestroyed)
691
+ shouldShow: l,
692
+ getReferencedVirtualElement: o,
693
+ options: a
694
+ }, v = w(m);
695
+ v.current = m;
696
+ const [O, I] = k(!1), b = w(!0);
697
+ return E(() => {
698
+ if (p?.isDestroyed)
1789
699
  return;
1790
- if (!h) {
1791
- console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
700
+ if (!p) {
701
+ console.warn(
702
+ "BubbleMenu component is not rendered inside of an editor component or does not have editor prop."
703
+ );
1792
704
  return;
1793
705
  }
1794
- const b = a.current;
1795
- b.style.visibility = "hidden", b.style.position = "absolute";
1796
- const C = fe({
1797
- ...m.current,
1798
- editor: h,
1799
- element: b
706
+ const y = r.current;
707
+ y.style.visibility = "hidden", y.style.position = "absolute";
708
+ const T = F({
709
+ ...v.current,
710
+ editor: p,
711
+ element: y
1800
712
  });
1801
- h.registerPlugin(C);
1802
- const O = m.current.pluginKey;
1803
- return w.current = !0, y(!0), () => {
1804
- y(!1), h.unregisterPlugin(O), window.requestAnimationFrame(() => {
1805
- b.parentNode && b.parentNode.removeChild(b);
713
+ p.registerPlugin(T);
714
+ const X = v.current.pluginKey;
715
+ return b.current = !0, I(!0), () => {
716
+ I(!1), p.unregisterPlugin(X), window.requestAnimationFrame(() => {
717
+ y.parentNode && y.parentNode.removeChild(y);
1806
718
  });
1807
719
  };
1808
- }, [h]), it(() => {
1809
- if (!(!v || !h || h.isDestroyed)) {
1810
- if (w.current) {
1811
- w.current = !1;
720
+ }, [p]), E(() => {
721
+ if (!(!O || !p || p.isDestroyed)) {
722
+ if (b.current) {
723
+ b.current = !1;
1812
724
  return;
1813
725
  }
1814
- h.view.dispatch(
1815
- h.state.tr.setMeta(d, {
726
+ p.view.dispatch(
727
+ p.state.tr.setMeta(d, {
1816
728
  type: "updateOptions",
1817
- options: m.current
729
+ options: v.current
1818
730
  })
1819
731
  );
1820
732
  }
1821
733
  }, [
1822
- v,
1823
- h,
734
+ O,
735
+ p,
1824
736
  n,
1825
- o,
1826
737
  s,
1827
738
  l,
739
+ a,
1828
740
  i,
1829
- r,
741
+ o,
1830
742
  d
1831
- ]), kt(c, a.current);
743
+ ]), j(u, r.current);
1832
744
  }
1833
745
  );
1834
- _t.forwardRef(
1835
- ({ pluginKey: t, editor: e, updateDelay: n, resizeDelay: o, appendTo: i, shouldShow: s = null, options: r, children: l, ...c }, p) => {
1836
- const f = k(document.createElement("div")), a = k(he(t, "floatingMenu")).current;
1837
- me(f.current, c), typeof p == "function" ? p(f.current) : p && (p.current = f.current);
1838
- const { editor: d } = Bt(), u = e || d, h = {
746
+ W.forwardRef(
747
+ ({
748
+ pluginKey: t,
749
+ editor: e,
750
+ updateDelay: n,
751
+ resizeDelay: s,
752
+ appendTo: i,
753
+ shouldShow: l = null,
754
+ options: o,
755
+ children: a,
756
+ ...u
757
+ }, f) => {
758
+ const c = w(document.createElement("div")), r = w(
759
+ q(t, "floatingMenu")
760
+ ).current;
761
+ Z(c.current, u), typeof f == "function" ? f(c.current) : f && (f.current = c.current);
762
+ const { editor: d } = M(), h = e || d, p = {
1839
763
  updateDelay: n,
1840
- resizeDelay: o,
764
+ resizeDelay: s,
1841
765
  appendTo: i,
1842
- pluginKey: a,
1843
- shouldShow: s,
1844
- options: r
1845
- }, g = k(h);
1846
- g.current = h;
1847
- const [m, v] = Wt(!1), y = k(!0);
1848
- return it(() => {
1849
- if (u?.isDestroyed)
766
+ pluginKey: r,
767
+ shouldShow: l,
768
+ options: o
769
+ }, m = w(p);
770
+ m.current = p;
771
+ const [v, O] = k(!1), I = w(!0);
772
+ return E(() => {
773
+ if (h?.isDestroyed)
1850
774
  return;
1851
- if (!u) {
775
+ if (!h) {
1852
776
  console.warn(
1853
777
  "FloatingMenu component is not rendered inside of an editor component or does not have editor prop."
1854
778
  );
1855
779
  return;
1856
780
  }
1857
- const w = f.current;
1858
- w.style.visibility = "hidden", w.style.position = "absolute";
1859
- const b = de({
1860
- ...g.current,
1861
- editor: u,
1862
- element: w
781
+ const b = c.current;
782
+ b.style.visibility = "hidden", b.style.position = "absolute";
783
+ const y = $({
784
+ ...m.current,
785
+ editor: h,
786
+ element: b
1863
787
  });
1864
- u.registerPlugin(b);
1865
- const C = g.current.pluginKey;
1866
- return y.current = !0, v(!0), () => {
1867
- v(!1), u.unregisterPlugin(C), window.requestAnimationFrame(() => {
1868
- w.parentNode && w.parentNode.removeChild(w);
788
+ h.registerPlugin(y);
789
+ const T = m.current.pluginKey;
790
+ return I.current = !0, O(!0), () => {
791
+ O(!1), h.unregisterPlugin(T), window.requestAnimationFrame(() => {
792
+ b.parentNode && b.parentNode.removeChild(b);
1869
793
  });
1870
794
  };
1871
- }, [u]), it(() => {
1872
- if (!(!m || !u || u.isDestroyed)) {
1873
- if (y.current) {
1874
- y.current = !1;
795
+ }, [h]), E(() => {
796
+ if (!(!v || !h || h.isDestroyed)) {
797
+ if (I.current) {
798
+ I.current = !1;
1875
799
  return;
1876
800
  }
1877
- u.view.dispatch(
1878
- u.state.tr.setMeta(a, {
801
+ h.view.dispatch(
802
+ h.state.tr.setMeta(r, {
1879
803
  type: "updateOptions",
1880
- options: g.current
804
+ options: m.current
1881
805
  })
1882
806
  );
1883
807
  }
1884
- }, [m, u, n, o, s, r, i, a]), kt(l, f.current);
808
+ }, [
809
+ v,
810
+ h,
811
+ n,
812
+ s,
813
+ l,
814
+ o,
815
+ i,
816
+ r
817
+ ]), j(a, c.current);
1885
818
  }
1886
819
  );
1887
- const Ki = ({ editor: t }) => {
1888
- const e = be({
820
+ const _t = ({ editor: t }) => {
821
+ const e = tt({
1889
822
  editor: t,
1890
823
  selector: ({ editor: i }) => i ? {
1891
824
  isHeading1: i.isActive("heading", { level: 1 }),
@@ -1896,24 +829,24 @@ const Ki = ({ editor: t }) => {
1896
829
  isStrike: i.isActive("strike"),
1897
830
  isCode: i.isActive("code")
1898
831
  } : null
1899
- }), n = Re(
1900
- (i, s) => {
1901
- i.preventDefault(), s();
832
+ }), n = lt(
833
+ (i, l) => {
834
+ i.preventDefault(), l();
1902
835
  },
1903
836
  []
1904
- ), o = [
837
+ ), s = [
1905
838
  {
1906
839
  ariaLabel: "Heading 1",
1907
840
  command: () => t.chain().focus().toggleHeading({ level: 1 }).run(),
1908
841
  isActive: () => !!e?.isHeading1,
1909
- icon: /* @__PURE__ */ E(
842
+ icon: /* @__PURE__ */ g(
1910
843
  "svg",
1911
844
  {
1912
845
  className: "scribe-inline-menu-icon",
1913
846
  viewBox: "0 0 24 24",
1914
847
  fill: "none",
1915
848
  xmlns: "http://www.w3.org/2000/svg",
1916
- children: /* @__PURE__ */ E(
849
+ children: /* @__PURE__ */ g(
1917
850
  "path",
1918
851
  {
1919
852
  d: "M4.00023 5L4 17M13 5L12.9998 17M4 11H12.9998M19.875 19V10L17.625 12.25",
@@ -1929,14 +862,14 @@ const Ki = ({ editor: t }) => {
1929
862
  ariaLabel: "Heading 2",
1930
863
  command: () => t.chain().focus().toggleHeading({ level: 2 }).run(),
1931
864
  isActive: () => !!e?.isHeading2,
1932
- icon: /* @__PURE__ */ E(
865
+ icon: /* @__PURE__ */ g(
1933
866
  "svg",
1934
867
  {
1935
868
  fill: "none",
1936
869
  xmlns: "http://www.w3.org/2000/svg",
1937
870
  className: "scribe-inline-menu-icon",
1938
871
  viewBox: "0 0 24 24",
1939
- children: /* @__PURE__ */ E(
872
+ children: /* @__PURE__ */ g(
1940
873
  "path",
1941
874
  {
1942
875
  d: "M3.37402 5V17M12.374 5V17M3.37402 11H12.374M16.302 11.373C16.5035 10.8941 16.8644 10.4997 17.3236 10.2566C17.7829 10.0136 18.312 9.93705 18.8213 10.0399C19.3306 10.1427 19.7886 10.4186 20.1175 10.8207C20.4465 11.2229 20.6262 11.7265 20.626 12.246C20.628 12.694 20.494 13.132 20.242 13.503L16.123 19H20.626",
@@ -1952,14 +885,14 @@ const Ki = ({ editor: t }) => {
1952
885
  ariaLabel: "Heading 3",
1953
886
  command: () => t.chain().focus().toggleHeading({ level: 3 }).run(),
1954
887
  isActive: () => !!e?.isHeading3,
1955
- icon: /* @__PURE__ */ E(
888
+ icon: /* @__PURE__ */ g(
1956
889
  "svg",
1957
890
  {
1958
891
  className: "scribe-inline-menu-icon",
1959
892
  viewBox: "0 0 24 24",
1960
893
  fill: "none",
1961
894
  xmlns: "http://www.w3.org/2000/svg",
1962
- children: /* @__PURE__ */ E(
895
+ children: /* @__PURE__ */ g(
1963
896
  "path",
1964
897
  {
1965
898
  d: "M3.375 5V17M12.375 5V17M3.375 11H12.375M16.125 10H20.625L18 13.75C18.4317 13.7499 18.8568 13.8564 19.2375 14.0598C19.6183 14.2633 19.943 14.5575 20.1828 14.9165C20.4227 15.2754 20.5703 15.688 20.6127 16.1176C20.655 16.5472 20.5907 16.9807 20.4255 17.3795C20.2603 17.7783 19.9993 18.1303 19.6656 18.4042C19.3319 18.678 18.9358 18.8654 18.5123 18.9496C18.0889 19.0338 17.6513 19.0123 17.2382 18.8869C16.8251 18.7616 16.4492 18.5363 16.144 18.231",
@@ -1975,14 +908,14 @@ const Ki = ({ editor: t }) => {
1975
908
  ariaLabel: "Bold",
1976
909
  command: () => t.chain().focus().toggleBold().run(),
1977
910
  isActive: () => !!e?.isBold,
1978
- icon: /* @__PURE__ */ E(
911
+ icon: /* @__PURE__ */ g(
1979
912
  "svg",
1980
913
  {
1981
914
  className: "scribe-inline-menu-icon",
1982
915
  viewBox: "0 0 24 24",
1983
916
  fill: "none",
1984
917
  xmlns: "http://www.w3.org/2000/svg",
1985
- children: /* @__PURE__ */ E(
918
+ children: /* @__PURE__ */ g(
1986
919
  "path",
1987
920
  {
1988
921
  d: "M12.8571 12C13.918 12 14.9354 11.5786 15.6856 10.8284C16.4357 10.0783 16.8571 9.06087 16.8571 8C16.8571 6.93913 16.4357 5.92172 15.6856 5.17157C14.9354 4.42143 13.918 4 12.8571 4H6V12M12.8571 12H6M12.8571 12H14C15.0609 12 16.0783 12.4214 16.8284 13.1716C17.5786 13.9217 18 14.9391 18 16C18 17.0609 17.5786 18.0783 16.8284 18.8284C16.0783 19.5786 15.0609 20 14 20H6V12",
@@ -1998,14 +931,14 @@ const Ki = ({ editor: t }) => {
1998
931
  ariaLabel: "Italic",
1999
932
  command: () => t.chain().focus().toggleItalic().run(),
2000
933
  isActive: () => !!e?.isItalic,
2001
- icon: /* @__PURE__ */ E(
934
+ icon: /* @__PURE__ */ g(
2002
935
  "svg",
2003
936
  {
2004
937
  className: "scribe-inline-menu-icon",
2005
938
  viewBox: "0 0 24 24",
2006
939
  fill: "none",
2007
940
  xmlns: "http://www.w3.org/2000/svg",
2008
- children: /* @__PURE__ */ E(
941
+ children: /* @__PURE__ */ g(
2009
942
  "path",
2010
943
  {
2011
944
  d: "M10.8571 4H17.7142M6.28564 20H13.1428M14.2856 4L9.71422 20",
@@ -2021,14 +954,14 @@ const Ki = ({ editor: t }) => {
2021
954
  ariaLabel: "Strike",
2022
955
  command: () => t.chain().focus().toggleStrike().run(),
2023
956
  isActive: () => !!e?.isStrike,
2024
- icon: /* @__PURE__ */ E(
957
+ icon: /* @__PURE__ */ g(
2025
958
  "svg",
2026
959
  {
2027
960
  className: "scribe-inline-menu-icon",
2028
961
  viewBox: "0 0 24 24",
2029
962
  fill: "none",
2030
963
  xmlns: "http://www.w3.org/2000/svg",
2031
- children: /* @__PURE__ */ E(
964
+ children: /* @__PURE__ */ g(
2032
965
  "path",
2033
966
  {
2034
967
  d: "M11.0121 12H12.9874C15.1693 12 16.938 13.7909 16.938 16C16.938 18.2091 15.1693 20 12.9874 20H11.0121C8.83024 20 7.06149 18.2091 7.06149 16M16.938 8C16.938 5.79086 15.1693 4 12.9874 4H11.0121C8.83024 4 7.06149 5.79086 7.06149 8C7.06149 8.3453 7.1047 8.68038 7.18595 9M4 12H20",
@@ -2044,14 +977,14 @@ const Ki = ({ editor: t }) => {
2044
977
  ariaLabel: "Inline code",
2045
978
  command: () => t.chain().focus().toggleCode().run(),
2046
979
  isActive: () => !!e?.isCode,
2047
- icon: /* @__PURE__ */ E(
980
+ icon: /* @__PURE__ */ g(
2048
981
  "svg",
2049
982
  {
2050
983
  className: "scribe-inline-menu-icon",
2051
984
  viewBox: "0 0 24 24",
2052
985
  fill: "none",
2053
986
  xmlns: "http://www.w3.org/2000/svg",
2054
- children: /* @__PURE__ */ E(
987
+ children: /* @__PURE__ */ g(
2055
988
  "path",
2056
989
  {
2057
990
  d: "M16.5 16.5L21 12L16.5 7.50002M7.5 7.50002L3 12L7.5 16.5M13.8 3.90002L10.2 20.1",
@@ -2064,21 +997,21 @@ const Ki = ({ editor: t }) => {
2064
997
  )
2065
998
  }
2066
999
  ];
2067
- return /* @__PURE__ */ E(
2068
- Bi,
1000
+ return /* @__PURE__ */ g(
1001
+ Dt,
2069
1002
  {
2070
1003
  editor: t,
2071
- appendTo: Ie(t),
1004
+ appendTo: at(t),
2072
1005
  options: { strategy: "fixed" },
2073
- children: /* @__PURE__ */ E("div", { className: "scribe-bubble-menu", children: /* @__PURE__ */ E(ve, { align: "center", gap: "2", children: o.map((i) => /* @__PURE__ */ E(
2074
- ye,
1006
+ children: /* @__PURE__ */ g("div", { className: "scribe-bubble-menu", children: /* @__PURE__ */ g(J, { align: "center", gap: "2", children: s.map((i) => /* @__PURE__ */ g(
1007
+ Q,
2075
1008
  {
2076
1009
  type: "button",
2077
1010
  size: "1",
2078
1011
  radius: "medium",
2079
1012
  color: "gray",
2080
1013
  variant: i.isActive() ? "soft" : "ghost",
2081
- onMouseDown: (s) => n(s, i.command),
1014
+ onMouseDown: (l) => n(l, i.command),
2082
1015
  children: i.icon
2083
1016
  },
2084
1017
  i.ariaLabel
@@ -2087,5 +1020,5 @@ const Ki = ({ editor: t }) => {
2087
1020
  );
2088
1021
  };
2089
1022
  export {
2090
- Ki as default
1023
+ _t as default
2091
1024
  };