reactjs-tiptap-editor-pro 0.2.32 → 0.2.34

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.
package/lib/index.js CHANGED
@@ -1,16 +1,3620 @@
1
- import { useRef as d, useState as o, useEffect as f } from "react";
2
- import { R as m } from "./RichTextEditor-iGJ6-rbq.js";
3
- import { B as x } from "./tiptap-DkWHMWDt.js";
4
- function c() {
5
- var t;
6
- const e = d({ editor: null }), [u, s] = o(!1), [i, n] = o(null);
7
- return f(() => {
8
- var r;
9
- (r = e.current) != null && r.editor && (s(!0), n(e.current.editor));
10
- }, [e, (t = e.current) == null ? void 0 : t.editor]), { isReady: u, editor: i, editorRef: e };
1
+ var dr = Object.defineProperty;
2
+ var ur = (e, t, n) => t in e ? dr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var me = (e, t, n) => ur(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import * as ie from "react";
5
+ import { useRef as ne, useState as I, useEffect as R, useMemo as F, Fragment as Ve, useCallback as O, memo as fr, forwardRef as hr, useId as mr, useImperativeHandle as gr, useLayoutEffect as pr } from "react";
6
+ import { jsx as a, jsxs as p, Fragment as N } from "react/jsx-runtime";
7
+ import { i as Ke, S as re, t as vr, a as Ce, b as oe, r as J, c as Z, f as yr, d as ae, e as wr, D as Xe, g as qe, A as C, h as Ye, j as Je, C as xr, k as Ze, B as Y, s as cn, l as dn, m as un, u as Te, n as vt, o as L, p as U, P as br, q as Cr, v as Tr, L as $e, I as ye, w as se, x as Ae, y as Ar, K as ge, T as fn, M as yt, z as wt, F as Sr, E as hn, G as mn, H as Pr, J as he, N as _r, O as Nr, Q as Er, R as gn, U as $r, V as Or, W as z, X as Rr, Y as Ir, Z as Dr, _ as Mr, $ as Br, a0 as kr, a1 as W, a2 as Lr, a3 as xt, a4 as bt, a5 as Ct, a6 as Tt, a7 as At, a8 as St, a9 as pn, aa as zr, ab as vn, ac as yn, ad as Fr, ae as jr, af as Hr, ag as Pt, ah as Ur, ai as Gr, aj as Wr, ak as Vr, al as Kr, am as _t, an as Nt, ao as Xr, ap as qr, aq as Yr, ar as Jr, as as Zr, at as Qr, au as ei } from "./ColorPicker-BGCCdXrc.js";
8
+ import { u as D, B as ti, l as M, I as we, V as Et, E as ni } from "./locale-bundle-CT7qZRHF.js";
9
+ import * as j from "@radix-ui/react-toast";
10
+ import { X as ri, HelpCircle as ii, Pencil as oi, Trash2 as ai } from "lucide-react";
11
+ import { Editor as si, makeDropdownToolbar as li } from "easydrawer";
12
+ import ci from "katex";
13
+ import $t from "mermaid";
14
+ import di, { sticky as ui } from "tippy.js";
15
+ function Gc() {
16
+ var o;
17
+ const e = ne({ editor: null }), [t, n] = I(!1), [r, i] = I(null);
18
+ return R(() => {
19
+ var s;
20
+ (s = e.current) != null && s.editor && (n(!0), i(e.current.editor));
21
+ }, [e, (o = e.current) == null ? void 0 : o.editor]), { isReady: t, editor: r, editorRef: e };
11
22
  }
23
+ function wn(e, t) {
24
+ for (var n = -1, r = e == null ? 0 : e.length, i = Array(r); ++n < r; )
25
+ i[n] = t(e[n], n, e);
26
+ return i;
27
+ }
28
+ var G = Array.isArray, Ot = re ? re.prototype : void 0, Rt = Ot ? Ot.toString : void 0;
29
+ function xe(e) {
30
+ if (typeof e == "string")
31
+ return e;
32
+ if (G(e))
33
+ return wn(e, xe) + "";
34
+ if (Ke(e))
35
+ return Rt ? Rt.call(e) : "";
36
+ var t = e + "";
37
+ return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
38
+ }
39
+ var fi = 1 / 0, hi = 17976931348623157e292;
40
+ function mi(e) {
41
+ if (!e)
42
+ return e === 0 ? e : 0;
43
+ if (e = vr(e), e === fi || e === -1 / 0) {
44
+ var t = e < 0 ? -1 : 1;
45
+ return t * hi;
46
+ }
47
+ return e === e ? e : 0;
48
+ }
49
+ function gi(e) {
50
+ var t = mi(e), n = t % 1;
51
+ return t === t ? n ? t - n : t : 0;
52
+ }
53
+ function Qe(e) {
54
+ return e;
55
+ }
56
+ var pi = "[object AsyncFunction]", vi = "[object Function]", yi = "[object GeneratorFunction]", wi = "[object Proxy]";
57
+ function xn(e) {
58
+ if (!Ce(e))
59
+ return !1;
60
+ var t = oe(e);
61
+ return t == vi || t == yi || t == pi || t == wi;
62
+ }
63
+ var Oe = J["__core-js_shared__"], It = function() {
64
+ var e = /[^.]+$/.exec(Oe && Oe.keys && Oe.keys.IE_PROTO || "");
65
+ return e ? "Symbol(src)_1." + e : "";
66
+ }();
67
+ function xi(e) {
68
+ return !!It && It in e;
69
+ }
70
+ var bi = Function.prototype, Ci = bi.toString;
71
+ function ee(e) {
72
+ if (e != null) {
73
+ try {
74
+ return Ci.call(e);
75
+ } catch {
76
+ }
77
+ try {
78
+ return e + "";
79
+ } catch {
80
+ }
81
+ }
82
+ return "";
83
+ }
84
+ var Ti = /[\\^$.*+?()[\]{}|]/g, Ai = /^\[object .+?Constructor\]$/, Si = Function.prototype, Pi = Object.prototype, _i = Si.toString, Ni = Pi.hasOwnProperty, Ei = RegExp(
85
+ "^" + _i.call(Ni).replace(Ti, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
86
+ );
87
+ function $i(e) {
88
+ if (!Ce(e) || xi(e))
89
+ return !1;
90
+ var t = xn(e) ? Ei : Ai;
91
+ return t.test(ee(e));
92
+ }
93
+ function Oi(e, t) {
94
+ return e == null ? void 0 : e[t];
95
+ }
96
+ function te(e, t) {
97
+ var n = Oi(e, t);
98
+ return $i(n) ? n : void 0;
99
+ }
100
+ var Me = te(J, "WeakMap");
101
+ function Ri(e, t, n) {
102
+ switch (n.length) {
103
+ case 0:
104
+ return e.call(t);
105
+ case 1:
106
+ return e.call(t, n[0]);
107
+ case 2:
108
+ return e.call(t, n[0], n[1]);
109
+ case 3:
110
+ return e.call(t, n[0], n[1], n[2]);
111
+ }
112
+ return e.apply(t, n);
113
+ }
114
+ var Ii = 800, Di = 16, Mi = Date.now;
115
+ function Bi(e) {
116
+ var t = 0, n = 0;
117
+ return function() {
118
+ var r = Mi(), i = Di - (r - n);
119
+ if (n = r, i > 0) {
120
+ if (++t >= Ii)
121
+ return arguments[0];
122
+ } else
123
+ t = 0;
124
+ return e.apply(void 0, arguments);
125
+ };
126
+ }
127
+ function ki(e) {
128
+ return function() {
129
+ return e;
130
+ };
131
+ }
132
+ var Dt = function() {
133
+ try {
134
+ var e = te(Object, "defineProperty");
135
+ return e({}, "", {}), e;
136
+ } catch {
137
+ }
138
+ }(), Li = Dt ? function(e, t) {
139
+ return Dt(e, "toString", {
140
+ configurable: !0,
141
+ enumerable: !1,
142
+ value: ki(t),
143
+ writable: !0
144
+ });
145
+ } : Qe, zi = Bi(Li);
146
+ function Fi(e, t, n, r) {
147
+ for (var i = e.length, o = n + -1; ++o < i; )
148
+ if (t(e[o], o, e))
149
+ return o;
150
+ return -1;
151
+ }
152
+ function ji(e) {
153
+ return e !== e;
154
+ }
155
+ function Hi(e, t, n) {
156
+ for (var r = n - 1, i = e.length; ++r < i; )
157
+ if (e[r] === t)
158
+ return r;
159
+ return -1;
160
+ }
161
+ function Ui(e, t, n) {
162
+ return t === t ? Hi(e, t, n) : Fi(e, ji, n);
163
+ }
164
+ function Gi(e, t) {
165
+ var n = e == null ? 0 : e.length;
166
+ return !!n && Ui(e, t, 0) > -1;
167
+ }
168
+ var Wi = 9007199254740991, Vi = /^(?:0|[1-9]\d*)$/;
169
+ function bn(e, t) {
170
+ var n = typeof e;
171
+ return t = t ?? Wi, !!t && (n == "number" || n != "symbol" && Vi.test(e)) && e > -1 && e % 1 == 0 && e < t;
172
+ }
173
+ function Cn(e, t) {
174
+ return e === t || e !== e && t !== t;
175
+ }
176
+ var Mt = Math.max;
177
+ function Ki(e, t, n) {
178
+ return t = Mt(t === void 0 ? e.length - 1 : t, 0), function() {
179
+ for (var r = arguments, i = -1, o = Mt(r.length - t, 0), s = Array(o); ++i < o; )
180
+ s[i] = r[t + i];
181
+ i = -1;
182
+ for (var c = Array(t + 1); ++i < t; )
183
+ c[i] = r[i];
184
+ return c[t] = n(s), Ri(e, this, c);
185
+ };
186
+ }
187
+ function Xi(e, t) {
188
+ return zi(Ki(e, t, Qe), e + "");
189
+ }
190
+ var qi = 9007199254740991;
191
+ function et(e) {
192
+ return typeof e == "number" && e > -1 && e % 1 == 0 && e <= qi;
193
+ }
194
+ function Tn(e) {
195
+ return e != null && et(e.length) && !xn(e);
196
+ }
197
+ var Yi = Object.prototype;
198
+ function Ji(e) {
199
+ var t = e && e.constructor, n = typeof t == "function" && t.prototype || Yi;
200
+ return e === n;
201
+ }
202
+ function Zi(e, t) {
203
+ for (var n = -1, r = Array(e); ++n < e; )
204
+ r[n] = t(n);
205
+ return r;
206
+ }
207
+ var Qi = "[object Arguments]";
208
+ function Bt(e) {
209
+ return Z(e) && oe(e) == Qi;
210
+ }
211
+ var An = Object.prototype, eo = An.hasOwnProperty, to = An.propertyIsEnumerable, tt = Bt(/* @__PURE__ */ function() {
212
+ return arguments;
213
+ }()) ? Bt : function(e) {
214
+ return Z(e) && eo.call(e, "callee") && !to.call(e, "callee");
215
+ };
216
+ function no() {
217
+ return !1;
218
+ }
219
+ var Sn = typeof exports == "object" && exports && !exports.nodeType && exports, kt = Sn && typeof module == "object" && module && !module.nodeType && module, ro = kt && kt.exports === Sn, Lt = ro ? J.Buffer : void 0, io = Lt ? Lt.isBuffer : void 0, Be = io || no, oo = "[object Arguments]", ao = "[object Array]", so = "[object Boolean]", lo = "[object Date]", co = "[object Error]", uo = "[object Function]", fo = "[object Map]", ho = "[object Number]", mo = "[object Object]", go = "[object RegExp]", po = "[object Set]", vo = "[object String]", yo = "[object WeakMap]", wo = "[object ArrayBuffer]", xo = "[object DataView]", bo = "[object Float32Array]", Co = "[object Float64Array]", To = "[object Int8Array]", Ao = "[object Int16Array]", So = "[object Int32Array]", Po = "[object Uint8Array]", _o = "[object Uint8ClampedArray]", No = "[object Uint16Array]", Eo = "[object Uint32Array]", $ = {};
220
+ $[bo] = $[Co] = $[To] = $[Ao] = $[So] = $[Po] = $[_o] = $[No] = $[Eo] = !0;
221
+ $[oo] = $[ao] = $[wo] = $[so] = $[xo] = $[lo] = $[co] = $[uo] = $[fo] = $[ho] = $[mo] = $[go] = $[po] = $[vo] = $[yo] = !1;
222
+ function $o(e) {
223
+ return Z(e) && et(e.length) && !!$[oe(e)];
224
+ }
225
+ function nt(e) {
226
+ return function(t) {
227
+ return e(t);
228
+ };
229
+ }
230
+ var Pn = typeof exports == "object" && exports && !exports.nodeType && exports, ce = Pn && typeof module == "object" && module && !module.nodeType && module, Oo = ce && ce.exports === Pn, Re = Oo && yr.process, be = function() {
231
+ try {
232
+ var e = ce && ce.require && ce.require("util").types;
233
+ return e || Re && Re.binding && Re.binding("util");
234
+ } catch {
235
+ }
236
+ }(), zt = be && be.isTypedArray, _n = zt ? nt(zt) : $o, Ro = Object.prototype, Io = Ro.hasOwnProperty;
237
+ function Do(e, t) {
238
+ var n = G(e), r = !n && tt(e), i = !n && !r && Be(e), o = !n && !r && !i && _n(e), s = n || r || i || o, c = s ? Zi(e.length, String) : [], l = c.length;
239
+ for (var d in e)
240
+ Io.call(e, d) && !(s && // Safari 9 has enumerable `arguments.length` in strict mode.
241
+ (d == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
242
+ i && (d == "offset" || d == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
243
+ o && (d == "buffer" || d == "byteLength" || d == "byteOffset") || // Skip index properties.
244
+ bn(d, l))) && c.push(d);
245
+ return c;
246
+ }
247
+ function Mo(e, t) {
248
+ return function(n) {
249
+ return e(t(n));
250
+ };
251
+ }
252
+ var Bo = Mo(Object.keys, Object), ko = Object.prototype, Lo = ko.hasOwnProperty;
253
+ function zo(e) {
254
+ if (!Ji(e))
255
+ return Bo(e);
256
+ var t = [];
257
+ for (var n in Object(e))
258
+ Lo.call(e, n) && n != "constructor" && t.push(n);
259
+ return t;
260
+ }
261
+ function Nn(e) {
262
+ return Tn(e) ? Do(e) : zo(e);
263
+ }
264
+ var Fo = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, jo = /^\w*$/;
265
+ function rt(e, t) {
266
+ if (G(e))
267
+ return !1;
268
+ var n = typeof e;
269
+ return n == "number" || n == "symbol" || n == "boolean" || e == null || Ke(e) ? !0 : jo.test(e) || !Fo.test(e) || t != null && e in Object(t);
270
+ }
271
+ var de = te(Object, "create");
272
+ function Ho() {
273
+ this.__data__ = de ? de(null) : {}, this.size = 0;
274
+ }
275
+ function Uo(e) {
276
+ var t = this.has(e) && delete this.__data__[e];
277
+ return this.size -= t ? 1 : 0, t;
278
+ }
279
+ var Go = "__lodash_hash_undefined__", Wo = Object.prototype, Vo = Wo.hasOwnProperty;
280
+ function Ko(e) {
281
+ var t = this.__data__;
282
+ if (de) {
283
+ var n = t[e];
284
+ return n === Go ? void 0 : n;
285
+ }
286
+ return Vo.call(t, e) ? t[e] : void 0;
287
+ }
288
+ var Xo = Object.prototype, qo = Xo.hasOwnProperty;
289
+ function Yo(e) {
290
+ var t = this.__data__;
291
+ return de ? t[e] !== void 0 : qo.call(t, e);
292
+ }
293
+ var Jo = "__lodash_hash_undefined__";
294
+ function Zo(e, t) {
295
+ var n = this.__data__;
296
+ return this.size += this.has(e) ? 0 : 1, n[e] = de && t === void 0 ? Jo : t, this;
297
+ }
298
+ function Q(e) {
299
+ var t = -1, n = e == null ? 0 : e.length;
300
+ for (this.clear(); ++t < n; ) {
301
+ var r = e[t];
302
+ this.set(r[0], r[1]);
303
+ }
304
+ }
305
+ Q.prototype.clear = Ho;
306
+ Q.prototype.delete = Uo;
307
+ Q.prototype.get = Ko;
308
+ Q.prototype.has = Yo;
309
+ Q.prototype.set = Zo;
310
+ function Qo() {
311
+ this.__data__ = [], this.size = 0;
312
+ }
313
+ function Se(e, t) {
314
+ for (var n = e.length; n--; )
315
+ if (Cn(e[n][0], t))
316
+ return n;
317
+ return -1;
318
+ }
319
+ var ea = Array.prototype, ta = ea.splice;
320
+ function na(e) {
321
+ var t = this.__data__, n = Se(t, e);
322
+ if (n < 0)
323
+ return !1;
324
+ var r = t.length - 1;
325
+ return n == r ? t.pop() : ta.call(t, n, 1), --this.size, !0;
326
+ }
327
+ function ra(e) {
328
+ var t = this.__data__, n = Se(t, e);
329
+ return n < 0 ? void 0 : t[n][1];
330
+ }
331
+ function ia(e) {
332
+ return Se(this.__data__, e) > -1;
333
+ }
334
+ function oa(e, t) {
335
+ var n = this.__data__, r = Se(n, e);
336
+ return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this;
337
+ }
338
+ function K(e) {
339
+ var t = -1, n = e == null ? 0 : e.length;
340
+ for (this.clear(); ++t < n; ) {
341
+ var r = e[t];
342
+ this.set(r[0], r[1]);
343
+ }
344
+ }
345
+ K.prototype.clear = Qo;
346
+ K.prototype.delete = na;
347
+ K.prototype.get = ra;
348
+ K.prototype.has = ia;
349
+ K.prototype.set = oa;
350
+ var ue = te(J, "Map");
351
+ function aa() {
352
+ this.size = 0, this.__data__ = {
353
+ hash: new Q(),
354
+ map: new (ue || K)(),
355
+ string: new Q()
356
+ };
357
+ }
358
+ function sa(e) {
359
+ var t = typeof e;
360
+ return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
361
+ }
362
+ function Pe(e, t) {
363
+ var n = e.__data__;
364
+ return sa(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
365
+ }
366
+ function la(e) {
367
+ var t = Pe(this, e).delete(e);
368
+ return this.size -= t ? 1 : 0, t;
369
+ }
370
+ function ca(e) {
371
+ return Pe(this, e).get(e);
372
+ }
373
+ function da(e) {
374
+ return Pe(this, e).has(e);
375
+ }
376
+ function ua(e, t) {
377
+ var n = Pe(this, e), r = n.size;
378
+ return n.set(e, t), this.size += n.size == r ? 0 : 1, this;
379
+ }
380
+ function X(e) {
381
+ var t = -1, n = e == null ? 0 : e.length;
382
+ for (this.clear(); ++t < n; ) {
383
+ var r = e[t];
384
+ this.set(r[0], r[1]);
385
+ }
386
+ }
387
+ X.prototype.clear = aa;
388
+ X.prototype.delete = la;
389
+ X.prototype.get = ca;
390
+ X.prototype.has = da;
391
+ X.prototype.set = ua;
392
+ var fa = "Expected a function";
393
+ function it(e, t) {
394
+ if (typeof e != "function" || t != null && typeof t != "function")
395
+ throw new TypeError(fa);
396
+ var n = function() {
397
+ var r = arguments, i = t ? t.apply(this, r) : r[0], o = n.cache;
398
+ if (o.has(i))
399
+ return o.get(i);
400
+ var s = e.apply(this, r);
401
+ return n.cache = o.set(i, s) || o, s;
402
+ };
403
+ return n.cache = new (it.Cache || X)(), n;
404
+ }
405
+ it.Cache = X;
406
+ var ha = 500;
407
+ function ma(e) {
408
+ var t = it(e, function(r) {
409
+ return n.size === ha && n.clear(), r;
410
+ }), n = t.cache;
411
+ return t;
412
+ }
413
+ var ga = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, pa = /\\(\\)?/g, va = ma(function(e) {
414
+ var t = [];
415
+ return e.charCodeAt(0) === 46 && t.push(""), e.replace(ga, function(n, r, i, o) {
416
+ t.push(i ? o.replace(pa, "$1") : r || n);
417
+ }), t;
418
+ });
419
+ function ke(e) {
420
+ return e == null ? "" : xe(e);
421
+ }
422
+ function En(e, t) {
423
+ return G(e) ? e : rt(e, t) ? [e] : va(ke(e));
424
+ }
425
+ function _e(e) {
426
+ if (typeof e == "string" || Ke(e))
427
+ return e;
428
+ var t = e + "";
429
+ return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
430
+ }
431
+ function $n(e, t) {
432
+ t = En(t, e);
433
+ for (var n = 0, r = t.length; e != null && n < r; )
434
+ e = e[_e(t[n++])];
435
+ return n && n == r ? e : void 0;
436
+ }
437
+ function ya(e, t, n) {
438
+ var r = e == null ? void 0 : $n(e, t);
439
+ return r === void 0 ? n : r;
440
+ }
441
+ function On(e, t) {
442
+ for (var n = -1, r = t.length, i = e.length; ++n < r; )
443
+ e[i + n] = t[n];
444
+ return e;
445
+ }
446
+ var Ft = re ? re.isConcatSpreadable : void 0;
447
+ function wa(e) {
448
+ return G(e) || tt(e) || !!(Ft && e && e[Ft]);
449
+ }
450
+ function xa(e, t, n, r, i) {
451
+ var o = -1, s = e.length;
452
+ for (n || (n = wa), i || (i = []); ++o < s; ) {
453
+ var c = e[o];
454
+ n(c) && On(i, c);
455
+ }
456
+ return i;
457
+ }
458
+ function ba(e, t, n) {
459
+ var r = -1, i = e.length;
460
+ t < 0 && (t = -t > i ? 0 : i + t), n = n > i ? i : n, n < 0 && (n += i), i = t > n ? 0 : n - t >>> 0, t >>>= 0;
461
+ for (var o = Array(i); ++r < i; )
462
+ o[r] = e[r + t];
463
+ return o;
464
+ }
465
+ function Ca(e, t, n) {
466
+ var r = e.length;
467
+ return n = n === void 0 ? r : n, n >= r ? e : ba(e, t, n);
468
+ }
469
+ var Ta = "\\ud800-\\udfff", Aa = "\\u0300-\\u036f", Sa = "\\ufe20-\\ufe2f", Pa = "\\u20d0-\\u20ff", _a = Aa + Sa + Pa, Na = "\\ufe0e\\ufe0f", Ea = "\\u200d", $a = RegExp("[" + Ea + Ta + _a + Na + "]");
470
+ function ot(e) {
471
+ return $a.test(e);
472
+ }
473
+ function Oa(e) {
474
+ return e.split("");
475
+ }
476
+ var Rn = "\\ud800-\\udfff", Ra = "\\u0300-\\u036f", Ia = "\\ufe20-\\ufe2f", Da = "\\u20d0-\\u20ff", Ma = Ra + Ia + Da, Ba = "\\ufe0e\\ufe0f", ka = "[" + Rn + "]", Le = "[" + Ma + "]", ze = "\\ud83c[\\udffb-\\udfff]", La = "(?:" + Le + "|" + ze + ")", In = "[^" + Rn + "]", Dn = "(?:\\ud83c[\\udde6-\\uddff]){2}", Mn = "[\\ud800-\\udbff][\\udc00-\\udfff]", za = "\\u200d", Bn = La + "?", kn = "[" + Ba + "]?", Fa = "(?:" + za + "(?:" + [In, Dn, Mn].join("|") + ")" + kn + Bn + ")*", ja = kn + Bn + Fa, Ha = "(?:" + [In + Le + "?", Le, Dn, Mn, ka].join("|") + ")", Ua = RegExp(ze + "(?=" + ze + ")|" + Ha + ja, "g");
477
+ function Ga(e) {
478
+ return e.match(Ua) || [];
479
+ }
480
+ function Wa(e) {
481
+ return ot(e) ? Ga(e) : Oa(e);
482
+ }
483
+ function Va() {
484
+ this.__data__ = new K(), this.size = 0;
485
+ }
486
+ function Ka(e) {
487
+ var t = this.__data__, n = t.delete(e);
488
+ return this.size = t.size, n;
489
+ }
490
+ function Xa(e) {
491
+ return this.__data__.get(e);
492
+ }
493
+ function qa(e) {
494
+ return this.__data__.has(e);
495
+ }
496
+ var Ya = 200;
497
+ function Ja(e, t) {
498
+ var n = this.__data__;
499
+ if (n instanceof K) {
500
+ var r = n.__data__;
501
+ if (!ue || r.length < Ya - 1)
502
+ return r.push([e, t]), this.size = ++n.size, this;
503
+ n = this.__data__ = new X(r);
504
+ }
505
+ return n.set(e, t), this.size = n.size, this;
506
+ }
507
+ function V(e) {
508
+ var t = this.__data__ = new K(e);
509
+ this.size = t.size;
510
+ }
511
+ V.prototype.clear = Va;
512
+ V.prototype.delete = Ka;
513
+ V.prototype.get = Xa;
514
+ V.prototype.has = qa;
515
+ V.prototype.set = Ja;
516
+ function Za(e, t) {
517
+ for (var n = -1, r = e == null ? 0 : e.length, i = 0, o = []; ++n < r; ) {
518
+ var s = e[n];
519
+ t(s, n, e) && (o[i++] = s);
520
+ }
521
+ return o;
522
+ }
523
+ function Qa() {
524
+ return [];
525
+ }
526
+ var es = Object.prototype, ts = es.propertyIsEnumerable, jt = Object.getOwnPropertySymbols, ns = jt ? function(e) {
527
+ return e == null ? [] : (e = Object(e), Za(jt(e), function(t) {
528
+ return ts.call(e, t);
529
+ }));
530
+ } : Qa;
531
+ function rs(e, t, n) {
532
+ var r = t(e);
533
+ return G(e) ? r : On(r, n(e));
534
+ }
535
+ function Ht(e) {
536
+ return rs(e, Nn, ns);
537
+ }
538
+ var Fe = te(J, "DataView"), je = te(J, "Promise"), He = te(J, "Set"), Ut = "[object Map]", is = "[object Object]", Gt = "[object Promise]", Wt = "[object Set]", Vt = "[object WeakMap]", Kt = "[object DataView]", os = ee(Fe), as = ee(ue), ss = ee(je), ls = ee(He), cs = ee(Me), q = oe;
539
+ (Fe && q(new Fe(new ArrayBuffer(1))) != Kt || ue && q(new ue()) != Ut || je && q(je.resolve()) != Gt || He && q(new He()) != Wt || Me && q(new Me()) != Vt) && (q = function(e) {
540
+ var t = oe(e), n = t == is ? e.constructor : void 0, r = n ? ee(n) : "";
541
+ if (r)
542
+ switch (r) {
543
+ case os:
544
+ return Kt;
545
+ case as:
546
+ return Ut;
547
+ case ss:
548
+ return Gt;
549
+ case ls:
550
+ return Wt;
551
+ case cs:
552
+ return Vt;
553
+ }
554
+ return t;
555
+ });
556
+ var Xt = J.Uint8Array, ds = "__lodash_hash_undefined__";
557
+ function us(e) {
558
+ return this.__data__.set(e, ds), this;
559
+ }
560
+ function fs(e) {
561
+ return this.__data__.has(e);
562
+ }
563
+ function fe(e) {
564
+ var t = -1, n = e == null ? 0 : e.length;
565
+ for (this.__data__ = new X(); ++t < n; )
566
+ this.add(e[t]);
567
+ }
568
+ fe.prototype.add = fe.prototype.push = us;
569
+ fe.prototype.has = fs;
570
+ function hs(e, t) {
571
+ for (var n = -1, r = e == null ? 0 : e.length; ++n < r; )
572
+ if (t(e[n], n, e))
573
+ return !0;
574
+ return !1;
575
+ }
576
+ function Ln(e, t) {
577
+ return e.has(t);
578
+ }
579
+ var ms = 1, gs = 2;
580
+ function zn(e, t, n, r, i, o) {
581
+ var s = n & ms, c = e.length, l = t.length;
582
+ if (c != l && !(s && l > c))
583
+ return !1;
584
+ var d = o.get(e), f = o.get(t);
585
+ if (d && f)
586
+ return d == t && f == e;
587
+ var u = -1, h = !0, m = n & gs ? new fe() : void 0;
588
+ for (o.set(e, t), o.set(t, e); ++u < c; ) {
589
+ var g = e[u], v = t[u];
590
+ if (r)
591
+ var x = s ? r(v, g, u, t, e, o) : r(g, v, u, e, t, o);
592
+ if (x !== void 0) {
593
+ if (x)
594
+ continue;
595
+ h = !1;
596
+ break;
597
+ }
598
+ if (m) {
599
+ if (!hs(t, function(A, _) {
600
+ if (!Ln(m, _) && (g === A || i(g, A, n, r, o)))
601
+ return m.push(_);
602
+ })) {
603
+ h = !1;
604
+ break;
605
+ }
606
+ } else if (!(g === v || i(g, v, n, r, o))) {
607
+ h = !1;
608
+ break;
609
+ }
610
+ }
611
+ return o.delete(e), o.delete(t), h;
612
+ }
613
+ function ps(e) {
614
+ var t = -1, n = Array(e.size);
615
+ return e.forEach(function(r, i) {
616
+ n[++t] = [i, r];
617
+ }), n;
618
+ }
619
+ function vs(e) {
620
+ var t = -1, n = Array(e.size);
621
+ return e.forEach(function(r) {
622
+ n[++t] = r;
623
+ }), n;
624
+ }
625
+ var ys = 1, ws = 2, xs = "[object Boolean]", bs = "[object Date]", Cs = "[object Error]", Ts = "[object Map]", As = "[object Number]", Ss = "[object RegExp]", Ps = "[object Set]", _s = "[object String]", Ns = "[object Symbol]", Es = "[object ArrayBuffer]", $s = "[object DataView]", qt = re ? re.prototype : void 0, Ie = qt ? qt.valueOf : void 0;
626
+ function Os(e, t, n, r, i, o, s) {
627
+ switch (n) {
628
+ case $s:
629
+ if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset)
630
+ return !1;
631
+ e = e.buffer, t = t.buffer;
632
+ case Es:
633
+ return !(e.byteLength != t.byteLength || !o(new Xt(e), new Xt(t)));
634
+ case xs:
635
+ case bs:
636
+ case As:
637
+ return Cn(+e, +t);
638
+ case Cs:
639
+ return e.name == t.name && e.message == t.message;
640
+ case Ss:
641
+ case _s:
642
+ return e == t + "";
643
+ case Ts:
644
+ var c = ps;
645
+ case Ps:
646
+ var l = r & ys;
647
+ if (c || (c = vs), e.size != t.size && !l)
648
+ return !1;
649
+ var d = s.get(e);
650
+ if (d)
651
+ return d == t;
652
+ r |= ws, s.set(e, t);
653
+ var f = zn(c(e), c(t), r, i, o, s);
654
+ return s.delete(e), f;
655
+ case Ns:
656
+ if (Ie)
657
+ return Ie.call(e) == Ie.call(t);
658
+ }
659
+ return !1;
660
+ }
661
+ var Rs = 1, Is = Object.prototype, Ds = Is.hasOwnProperty;
662
+ function Ms(e, t, n, r, i, o) {
663
+ var s = n & Rs, c = Ht(e), l = c.length, d = Ht(t), f = d.length;
664
+ if (l != f && !s)
665
+ return !1;
666
+ for (var u = l; u--; ) {
667
+ var h = c[u];
668
+ if (!(s ? h in t : Ds.call(t, h)))
669
+ return !1;
670
+ }
671
+ var m = o.get(e), g = o.get(t);
672
+ if (m && g)
673
+ return m == t && g == e;
674
+ var v = !0;
675
+ o.set(e, t), o.set(t, e);
676
+ for (var x = s; ++u < l; ) {
677
+ h = c[u];
678
+ var A = e[h], _ = t[h];
679
+ if (r)
680
+ var E = s ? r(_, A, h, t, e, o) : r(A, _, h, e, t, o);
681
+ if (!(E === void 0 ? A === _ || i(A, _, n, r, o) : E)) {
682
+ v = !1;
683
+ break;
684
+ }
685
+ x || (x = h == "constructor");
686
+ }
687
+ if (v && !x) {
688
+ var b = e.constructor, y = t.constructor;
689
+ b != y && "constructor" in e && "constructor" in t && !(typeof b == "function" && b instanceof b && typeof y == "function" && y instanceof y) && (v = !1);
690
+ }
691
+ return o.delete(e), o.delete(t), v;
692
+ }
693
+ var Bs = 1, Yt = "[object Arguments]", Jt = "[object Array]", pe = "[object Object]", ks = Object.prototype, Zt = ks.hasOwnProperty;
694
+ function Ls(e, t, n, r, i, o) {
695
+ var s = G(e), c = G(t), l = s ? Jt : q(e), d = c ? Jt : q(t);
696
+ l = l == Yt ? pe : l, d = d == Yt ? pe : d;
697
+ var f = l == pe, u = d == pe, h = l == d;
698
+ if (h && Be(e)) {
699
+ if (!Be(t))
700
+ return !1;
701
+ s = !0, f = !1;
702
+ }
703
+ if (h && !f)
704
+ return o || (o = new V()), s || _n(e) ? zn(e, t, n, r, i, o) : Os(e, t, l, n, r, i, o);
705
+ if (!(n & Bs)) {
706
+ var m = f && Zt.call(e, "__wrapped__"), g = u && Zt.call(t, "__wrapped__");
707
+ if (m || g) {
708
+ var v = m ? e.value() : e, x = g ? t.value() : t;
709
+ return o || (o = new V()), i(v, x, n, r, o);
710
+ }
711
+ }
712
+ return h ? (o || (o = new V()), Ms(e, t, n, r, i, o)) : !1;
713
+ }
714
+ function at(e, t, n, r, i) {
715
+ return e === t ? !0 : e == null || t == null || !Z(e) && !Z(t) ? e !== e && t !== t : Ls(e, t, n, r, at, i);
716
+ }
717
+ var zs = 1, Fs = 2;
718
+ function js(e, t, n, r) {
719
+ var i = n.length, o = i;
720
+ if (e == null)
721
+ return !o;
722
+ for (e = Object(e); i--; ) {
723
+ var s = n[i];
724
+ if (s[2] ? s[1] !== e[s[0]] : !(s[0] in e))
725
+ return !1;
726
+ }
727
+ for (; ++i < o; ) {
728
+ s = n[i];
729
+ var c = s[0], l = e[c], d = s[1];
730
+ if (s[2]) {
731
+ if (l === void 0 && !(c in e))
732
+ return !1;
733
+ } else {
734
+ var f = new V(), u;
735
+ if (!(u === void 0 ? at(d, l, zs | Fs, r, f) : u))
736
+ return !1;
737
+ }
738
+ }
739
+ return !0;
740
+ }
741
+ function Fn(e) {
742
+ return e === e && !Ce(e);
743
+ }
744
+ function Hs(e) {
745
+ for (var t = Nn(e), n = t.length; n--; ) {
746
+ var r = t[n], i = e[r];
747
+ t[n] = [r, i, Fn(i)];
748
+ }
749
+ return t;
750
+ }
751
+ function jn(e, t) {
752
+ return function(n) {
753
+ return n == null ? !1 : n[e] === t && (t !== void 0 || e in Object(n));
754
+ };
755
+ }
756
+ function Us(e) {
757
+ var t = Hs(e);
758
+ return t.length == 1 && t[0][2] ? jn(t[0][0], t[0][1]) : function(n) {
759
+ return n === e || js(n, e, t);
760
+ };
761
+ }
762
+ function Gs(e, t) {
763
+ return e != null && t in Object(e);
764
+ }
765
+ function Ws(e, t, n) {
766
+ t = En(t, e);
767
+ for (var r = -1, i = t.length, o = !1; ++r < i; ) {
768
+ var s = _e(t[r]);
769
+ if (!(o = e != null && n(e, s)))
770
+ break;
771
+ e = e[s];
772
+ }
773
+ return o || ++r != i ? o : (i = e == null ? 0 : e.length, !!i && et(i) && bn(s, i) && (G(e) || tt(e)));
774
+ }
775
+ function Vs(e, t) {
776
+ return e != null && Ws(e, t, Gs);
777
+ }
778
+ var Ks = 1, Xs = 2;
779
+ function qs(e, t) {
780
+ return rt(e) && Fn(t) ? jn(_e(e), t) : function(n) {
781
+ var r = ya(n, e);
782
+ return r === void 0 && r === t ? Vs(n, e) : at(t, r, Ks | Xs);
783
+ };
784
+ }
785
+ function Hn(e) {
786
+ return function(t) {
787
+ return t == null ? void 0 : t[e];
788
+ };
789
+ }
790
+ function Ys(e) {
791
+ return function(t) {
792
+ return $n(t, e);
793
+ };
794
+ }
795
+ function Js(e) {
796
+ return rt(e) ? Hn(_e(e)) : Ys(e);
797
+ }
798
+ function Zs(e) {
799
+ return typeof e == "function" ? e : e == null ? Qe : typeof e == "object" ? G(e) ? qs(e[0], e[1]) : Us(e) : Js(e);
800
+ }
801
+ function De(e) {
802
+ return Z(e) && Tn(e);
803
+ }
804
+ var Qs = 200;
805
+ function el(e, t, n, r) {
806
+ var i = -1, o = Gi, s = !0, c = e.length, l = [], d = t.length;
807
+ if (!c)
808
+ return l;
809
+ n && (t = wn(t, nt(n))), t.length >= Qs && (o = Ln, s = !1, t = new fe(t));
810
+ e:
811
+ for (; ++i < c; ) {
812
+ var f = e[i], u = n == null ? f : n(f);
813
+ if (f = f !== 0 ? f : 0, s && u === u) {
814
+ for (var h = d; h--; )
815
+ if (t[h] === u)
816
+ continue e;
817
+ l.push(f);
818
+ } else o(t, u, r) || l.push(f);
819
+ }
820
+ return l;
821
+ }
822
+ function tl(e) {
823
+ var t = e == null ? 0 : e.length;
824
+ return t ? e[t - 1] : void 0;
825
+ }
826
+ var nl = Xi(function(e, t) {
827
+ var n = tl(t);
828
+ return De(n) && (n = void 0), De(e) ? el(e, xa(t, 1, De), Zs(n)) : [];
829
+ }), rl = "[object RegExp]";
830
+ function il(e) {
831
+ return Z(e) && oe(e) == rl;
832
+ }
833
+ var Qt = be && be.isRegExp, ol = Qt ? nt(Qt) : il, al = Hn("length"), Un = "\\ud800-\\udfff", sl = "\\u0300-\\u036f", ll = "\\ufe20-\\ufe2f", cl = "\\u20d0-\\u20ff", dl = sl + ll + cl, ul = "\\ufe0e\\ufe0f", fl = "[" + Un + "]", Ue = "[" + dl + "]", Ge = "\\ud83c[\\udffb-\\udfff]", hl = "(?:" + Ue + "|" + Ge + ")", Gn = "[^" + Un + "]", Wn = "(?:\\ud83c[\\udde6-\\uddff]){2}", Vn = "[\\ud800-\\udbff][\\udc00-\\udfff]", ml = "\\u200d", Kn = hl + "?", Xn = "[" + ul + "]?", gl = "(?:" + ml + "(?:" + [Gn, Wn, Vn].join("|") + ")" + Xn + Kn + ")*", pl = Xn + Kn + gl, vl = "(?:" + [Gn + Ue + "?", Ue, Wn, Vn, fl].join("|") + ")", en = RegExp(Ge + "(?=" + Ge + ")|" + vl + pl, "g");
834
+ function yl(e) {
835
+ for (var t = en.lastIndex = 0; en.test(e); )
836
+ ++t;
837
+ return t;
838
+ }
839
+ function wl(e) {
840
+ return ot(e) ? yl(e) : al(e);
841
+ }
842
+ var xl = 30, bl = "...", Cl = /\w*$/;
843
+ function Tl(e, t) {
844
+ var n = xl, r = bl;
845
+ if (Ce(t)) {
846
+ var i = "separator" in t ? t.separator : i;
847
+ n = "length" in t ? gi(t.length) : n, r = "omission" in t ? xe(t.omission) : r;
848
+ }
849
+ e = ke(e);
850
+ var o = e.length;
851
+ if (ot(e)) {
852
+ var s = Wa(e);
853
+ o = s.length;
854
+ }
855
+ if (n >= o)
856
+ return e;
857
+ var c = n - wl(r);
858
+ if (c < 1)
859
+ return r;
860
+ var l = s ? Ca(s, 0, c).join("") : e.slice(0, c);
861
+ if (i === void 0)
862
+ return l + r;
863
+ if (s && (c += l.length - c), ol(i)) {
864
+ if (e.slice(c).search(i)) {
865
+ var d, f = l;
866
+ for (i.global || (i = RegExp(i.source, ke(Cl.exec(i)) + "g")), i.lastIndex = 0; d = i.exec(f); )
867
+ var u = d.index;
868
+ l = l.slice(0, u === void 0 ? c : u);
869
+ }
870
+ } else if (e.indexOf(xe(i), c) != c) {
871
+ var h = l.lastIndexOf(i);
872
+ h > -1 && (l = l.slice(0, h));
873
+ }
874
+ return l + r;
875
+ }
876
+ const Al = j.Provider, qn = ie.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
877
+ j.Viewport,
878
+ {
879
+ ref: n,
880
+ className: ae(
881
+ "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
882
+ e
883
+ ),
884
+ ...t
885
+ }
886
+ ));
887
+ qn.displayName = j.Viewport.displayName;
888
+ const Sl = wr(
889
+ "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md !border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
890
+ {
891
+ variants: {
892
+ variant: {
893
+ default: "border bg-background text-foreground",
894
+ destructive: "destructive group border-destructive bg-destructive text-destructive-foreground"
895
+ }
896
+ },
897
+ defaultVariants: {
898
+ variant: "default"
899
+ }
900
+ }
901
+ ), Yn = ie.forwardRef(({ className: e, variant: t, ...n }, r) => /* @__PURE__ */ a(
902
+ j.Root,
903
+ {
904
+ ref: r,
905
+ className: ae(Sl({ variant: t }), e),
906
+ ...n
907
+ }
908
+ ));
909
+ Yn.displayName = j.Root.displayName;
910
+ const Pl = ie.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
911
+ j.Action,
912
+ {
913
+ ref: n,
914
+ className: ae(
915
+ "inline-flex h-8 shrink-0 items-center justify-center rounded-md !border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",
916
+ e
917
+ ),
918
+ ...t
919
+ }
920
+ ));
921
+ Pl.displayName = j.Action.displayName;
922
+ const Jn = ie.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
923
+ j.Close,
924
+ {
925
+ ref: n,
926
+ className: ae(
927
+ "absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
928
+ e
929
+ ),
930
+ "toast-close": "",
931
+ ...t,
932
+ children: /* @__PURE__ */ a(ri, { className: "h-4 w-4" })
933
+ }
934
+ ));
935
+ Jn.displayName = j.Close.displayName;
936
+ const Zn = ie.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
937
+ j.Title,
938
+ {
939
+ ref: n,
940
+ className: ae("text-sm font-semibold", e),
941
+ ...t
942
+ }
943
+ ));
944
+ Zn.displayName = j.Title.displayName;
945
+ const Qn = ie.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
946
+ j.Description,
947
+ {
948
+ ref: n,
949
+ className: ae("text-sm opacity-90", e),
950
+ ...t
951
+ }
952
+ ));
953
+ Qn.displayName = j.Description.displayName;
954
+ let le = !1;
955
+ function _l({ editor: e, attrs: t, extension: n }) {
956
+ const [r, i] = I(!1), o = ne(null), s = ne(null), { alt: c, align: l } = t, d = n == null ? void 0 : n.options.upload, f = () => {
957
+ (async () => {
958
+ const w = document.querySelector("#easydrawer");
959
+ w && (o.current = new si(w, {
960
+ wheelEventsEnabled: !1,
961
+ disableZoom: !0
962
+ }), s.current = li(o.current), s.current.addDefaultToolWidgets(), o.current.loadFromSVG(decodeURIComponent(c)));
963
+ })();
964
+ };
965
+ R(() => {
966
+ r && setTimeout(() => {
967
+ f();
968
+ }, 200);
969
+ }, [r]);
970
+ const u = async () => {
971
+ if (o.current) {
972
+ const T = o.current.toSVG(), w = T.outerHTML, P = `drawer-${cn()}.svg`;
973
+ let B = dn(T.outerHTML);
974
+ if (d) {
975
+ const k = un(B, P);
976
+ B = await d(k);
977
+ }
978
+ e == null || e.chain().focus().setDrawer(
979
+ {
980
+ type: "drawer",
981
+ src: B,
982
+ alt: encodeURIComponent(w),
983
+ width: 426,
984
+ height: 212
985
+ },
986
+ !!w
987
+ ).run(), e == null || e.commands.setAlignImageDrawer(l);
988
+ }
989
+ i(!1);
990
+ }, h = (T) => {
991
+ const w = o.current.toolController.getPrimaryTools()[2], P = s.current.getWidgetById("pen-1");
992
+ w && P && (w.setColor(T), P.serializeState());
993
+ }, m = (T) => {
994
+ const w = o.current.toolController.getPrimaryTools()[2], P = s.current.getWidgetById("pen-1");
995
+ w && P && (w.setThickness(T), P.serializeState());
996
+ }, g = (T) => {
997
+ const w = o.current.toolController.getPrimaryTools()[3], P = s.current.getWidgetById("pen-2");
998
+ w && P && (w.setColor(T), P.serializeState());
999
+ }, v = (T) => {
1000
+ const w = s.current.getWidgetById("shape");
1001
+ w && w.setShapeType(T);
1002
+ }, x = (T) => {
1003
+ const w = o.current.toolController.getPrimaryTools()[5], P = s.current.getWidgetById("shape");
1004
+ w && P && (w.setColor(T), P.serializeState());
1005
+ }, A = (T) => {
1006
+ const w = o.current.toolController.getPrimaryTools()[5], P = s.current.getWidgetById("shape");
1007
+ w && P && (w.setThickness(T), P.serializeState());
1008
+ }, _ = (T) => {
1009
+ const w = o.current.toolController.getPrimaryTools()[5], P = s.current.getWidgetById("shape");
1010
+ w && P && (w.setBorderColor(T), P.serializeState());
1011
+ }, E = () => {
1012
+ if (le) {
1013
+ for (; o.current.history.redoStackSize > 0; )
1014
+ o.current.history.redo();
1015
+ le = !1;
1016
+ return;
1017
+ }
1018
+ o.current.history.undo();
1019
+ };
1020
+ return /* @__PURE__ */ p(
1021
+ Xe,
1022
+ {
1023
+ onOpenChange: i,
1024
+ open: r,
1025
+ children: [
1026
+ /* @__PURE__ */ a(qe, { asChild: !0, children: /* @__PURE__ */ a(
1027
+ C,
1028
+ {
1029
+ action: () => i(!0),
1030
+ icon: "Pencil",
1031
+ tooltip: "Edit Drawer"
1032
+ }
1033
+ ) }),
1034
+ /* @__PURE__ */ p(Ye, { className: "z-[99999] !max-w-[1300px]", children: [
1035
+ /* @__PURE__ */ a(Je, { children: "Edit Drawer" }),
1036
+ /* @__PURE__ */ p("div", { style: { height: "100%", borderWidth: 1, background: "white", position: "relative" }, children: [
1037
+ /* @__PURE__ */ a(
1038
+ "div",
1039
+ {
1040
+ className: "size-full",
1041
+ id: "easydrawer"
1042
+ }
1043
+ ),
1044
+ /* @__PURE__ */ a(
1045
+ xr,
1046
+ {
1047
+ changeBorderColorShape: _,
1048
+ changeColorShape: x,
1049
+ changeShape: v,
1050
+ onClear: () => {
1051
+ if (!le) {
1052
+ for (; o.current.history.undoStackSize > 0; )
1053
+ E();
1054
+ le = !0;
1055
+ }
1056
+ },
1057
+ onRedo: () => {
1058
+ le || o.current.history.redo();
1059
+ },
1060
+ onThicknessChange: A,
1061
+ onUndo: E,
1062
+ refEditor: o,
1063
+ setColorHighlight: g,
1064
+ setColorPen: h,
1065
+ setThicknessPen: m
1066
+ }
1067
+ )
1068
+ ] }),
1069
+ /* @__PURE__ */ a(Ze, { children: /* @__PURE__ */ a(
1070
+ Y,
1071
+ {
1072
+ onClick: u,
1073
+ type: "button",
1074
+ children: "Save changes"
1075
+ }
1076
+ ) })
1077
+ ] })
1078
+ ]
1079
+ }
1080
+ );
1081
+ }
1082
+ function er(e, t) {
1083
+ const [n, r] = I(void 0);
1084
+ return R(() => {
1085
+ const i = () => {
1086
+ const o = e.extensionManager.extensions.find((s) => s.name === t);
1087
+ o && r(o);
1088
+ };
1089
+ return e.on("selectionUpdate", i), e.on("transaction", i), () => {
1090
+ e.off("selectionUpdate", i), e.off("transaction", i);
1091
+ };
1092
+ }, [e, t]), n;
1093
+ }
1094
+ const Nl = {
1095
+ maxWidth: "auto",
1096
+ zIndex: 20,
1097
+ appendTo: "parent",
1098
+ moveTransition: "transform 0.1s ease-out"
1099
+ };
1100
+ function El({ item: e, disabled: t, editor: n }) {
1101
+ var i;
1102
+ const r = e.component;
1103
+ return r ? /* @__PURE__ */ a(Ve, { children: e.type === "divider" ? /* @__PURE__ */ a(
1104
+ U,
1105
+ {
1106
+ className: "!mx-1 !my-2 !h-[16px]",
1107
+ orientation: "vertical"
1108
+ }
1109
+ ) : /* @__PURE__ */ a(
1110
+ r,
1111
+ {
1112
+ ...e.componentProps,
1113
+ disabled: t || ((i = e == null ? void 0 : e.componentProps) == null ? void 0 : i.disabled),
1114
+ editor: n
1115
+ }
1116
+ ) }) : /* @__PURE__ */ a(N, {});
1117
+ }
1118
+ function $l(e) {
1119
+ return e.type.name === "drawer";
1120
+ }
1121
+ function Ol(e) {
1122
+ const { lang: t } = D(), n = Te(e.editor, vt.name), r = er(e.editor, vt.name), i = ({ editor: s }) => {
1123
+ const { selection: c } = s.view.state, { $from: l, to: d } = c;
1124
+ let f = !1;
1125
+ return s.view.state.doc.nodesBetween(l.pos, d, (u) => {
1126
+ if ($l(u))
1127
+ return f = !0, !1;
1128
+ }), f;
1129
+ }, o = F(() => e.disabled ? [] : ec(e.editor), [e.disabled, e.editor, t]);
1130
+ return /* @__PURE__ */ a(N, { children: /* @__PURE__ */ a(
1131
+ L,
1132
+ {
1133
+ editor: e == null ? void 0 : e.editor,
1134
+ shouldShow: i,
1135
+ tippyOptions: Nl,
1136
+ children: o != null && o.length ? /* @__PURE__ */ a("div", { className: "pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800", children: /* @__PURE__ */ a("div", { className: "relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap", children: o == null ? void 0 : o.map((s, c) => s.type === "edit" && (n != null && n.src) ? /* @__PURE__ */ a(
1137
+ _l,
1138
+ {
1139
+ attrs: n,
1140
+ editor: e.editor,
1141
+ extension: r
1142
+ },
1143
+ `bubbleMenu-drawer-${c}`
1144
+ ) : /* @__PURE__ */ a(
1145
+ El,
1146
+ {
1147
+ disabled: e.disabled,
1148
+ editor: e.editor,
1149
+ item: s
1150
+ },
1151
+ `bubbleMenu-drawer-${c}`
1152
+ )) }) }) : /* @__PURE__ */ a(N, {})
1153
+ }
1154
+ ) });
1155
+ }
1156
+ const Rl = { padding: "0 12px 12px" }, Il = ({ width: e, maxWidth: t, height: n, onOk: r, children: i }) => {
1157
+ const { t: o } = D(), [s, c] = I({
1158
+ width: "",
1159
+ height: "",
1160
+ maxWidth: ""
1161
+ });
1162
+ R(() => {
1163
+ c({
1164
+ width: e,
1165
+ height: n,
1166
+ maxWidth: t
1167
+ });
1168
+ }, [n, t, e]);
1169
+ function l(d) {
1170
+ d.preventDefault(), d.stopPropagation(), r(s);
1171
+ }
1172
+ return /* @__PURE__ */ p(br, { modal: !0, children: [
1173
+ /* @__PURE__ */ a(Cr, { asChild: !0, children: i }),
1174
+ /* @__PURE__ */ a(Tr, { children: /* @__PURE__ */ a("div", { style: Rl, children: /* @__PURE__ */ p("form", { className: "flex flex-col gap-2", onSubmit: l, children: [
1175
+ /* @__PURE__ */ a($e, { className: "mb-[6px]", children: "Width" }),
1176
+ /* @__PURE__ */ a("div", { className: "flex w-full max-w-sm items-center gap-1.5", children: /* @__PURE__ */ a("div", { className: "relative items-center w-full max-w-sm", children: /* @__PURE__ */ a(
1177
+ ye,
1178
+ {
1179
+ type: "number",
1180
+ value: s.width,
1181
+ required: !0,
1182
+ onChange: (d) => c({ ...s, width: d.target.value })
1183
+ }
1184
+ ) }) }),
1185
+ /* @__PURE__ */ a($e, { className: "mb-[6px]", children: "Max Width" }),
1186
+ /* @__PURE__ */ a("div", { className: "flex w-full max-w-sm items-center gap-1.5", children: /* @__PURE__ */ a("div", { className: "relative items-center w-full max-w-sm", children: /* @__PURE__ */ a(
1187
+ ye,
1188
+ {
1189
+ type: "number",
1190
+ value: s.maxWidth,
1191
+ required: !0,
1192
+ onChange: (d) => c({ ...s, maxWidth: d.target.value })
1193
+ }
1194
+ ) }) }),
1195
+ /* @__PURE__ */ a($e, { className: "mb-[6px]", children: "Height" }),
1196
+ /* @__PURE__ */ a("div", { className: "flex w-full max-w-sm items-center gap-1.5", children: /* @__PURE__ */ a("div", { className: "relative items-center w-full max-w-sm", children: /* @__PURE__ */ a(
1197
+ ye,
1198
+ {
1199
+ type: "number",
1200
+ value: s.height,
1201
+ required: !0,
1202
+ onChange: (d) => c({ ...s, height: d.target.value })
1203
+ }
1204
+ ) }) }),
1205
+ /* @__PURE__ */ a(Y, { type: "submit", className: "self-end mt-2", children: o("editor.link.dialog.button.apply") })
1206
+ ] }) }) })
1207
+ ] });
1208
+ };
1209
+ function Dl({ editor: e }) {
1210
+ const { t } = D(), { width: n, height: r, url: i } = Te(e, se.name, {
1211
+ width: 0,
1212
+ height: 0,
1213
+ url: "",
1214
+ defaultShowPicker: !1
1215
+ }), [o, s] = I(!1), [c, l] = I(""), d = O(() => {
1216
+ s(!1);
1217
+ }, [s]);
1218
+ R(() => {
1219
+ o && l(i);
1220
+ }, [o, i]);
1221
+ const f = O(() => {
1222
+ e.chain().updateAttributes(se.name, {
1223
+ url: c
1224
+ }).setNodeSelection(e.state.selection.from).focus().run(), s(!1);
1225
+ }, [e, c, s]), u = O(() => {
1226
+ window.open(i, "_blank");
1227
+ }, [i]), h = O(() => {
1228
+ s(!0);
1229
+ }, [s]), m = O(
1230
+ (x) => {
1231
+ e.chain().updateAttributes(se.name, x).setNodeSelection(e.state.selection.from).focus().run();
1232
+ },
1233
+ [e]
1234
+ ), g = O(() => e.isActive(se.name) && !i, [e, i]), v = O(() => Ae(se.name, e), [e]);
1235
+ return /* @__PURE__ */ p(N, { children: [
1236
+ /* @__PURE__ */ a(
1237
+ L,
1238
+ {
1239
+ className: "bubble-menu",
1240
+ editor: e,
1241
+ pluginKey: "iframe-bubble-menu",
1242
+ shouldShow: g,
1243
+ tippyOptions: {
1244
+ popperOptions: {
1245
+ modifiers: [{ name: "flip", enabled: !1 }]
1246
+ },
1247
+ placement: "bottom-start",
1248
+ offset: [-2, 16],
1249
+ zIndex: 9999
1250
+ // onHidden: () => {
1251
+ // toggleVisible(false)
1252
+ // },
1253
+ },
1254
+ children: /* @__PURE__ */ p("div", { className: "w-auto px-3 py-2 transition-all !border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-background", children: [
1255
+ /* @__PURE__ */ a(
1256
+ C,
1257
+ {
1258
+ action: u,
1259
+ icon: "Eye",
1260
+ tooltip: "Visit Link"
1261
+ }
1262
+ ),
1263
+ /* @__PURE__ */ a(
1264
+ C,
1265
+ {
1266
+ action: h,
1267
+ icon: "Pencil",
1268
+ tooltip: "Open Edit Link"
1269
+ }
1270
+ ),
1271
+ /* @__PURE__ */ a(Il, { width: n, height: r, onOk: m, children: /* @__PURE__ */ a(
1272
+ C,
1273
+ {
1274
+ icon: "Settings",
1275
+ tooltip: t("editor.settings")
1276
+ }
1277
+ ) }),
1278
+ /* @__PURE__ */ a(
1279
+ C,
1280
+ {
1281
+ action: v,
1282
+ icon: "Trash2",
1283
+ tooltip: t("editor.delete")
1284
+ }
1285
+ )
1286
+ ] })
1287
+ }
1288
+ ),
1289
+ /* @__PURE__ */ p(
1290
+ Xe,
1291
+ {
1292
+ open: o,
1293
+ onOpenChange: s,
1294
+ children: [
1295
+ /* @__PURE__ */ a(qe, {}),
1296
+ /* @__PURE__ */ p(Ye, { children: [
1297
+ /* @__PURE__ */ a(Ar, { children: /* @__PURE__ */ a(Je, { children: "Edit Link Iframe" }) }),
1298
+ /* @__PURE__ */ a(
1299
+ ye,
1300
+ {
1301
+ value: c,
1302
+ onInput: (x) => l(x.target.value),
1303
+ type: "url",
1304
+ autoFocus: !0,
1305
+ placeholder: "Enter link"
1306
+ }
1307
+ ),
1308
+ /* @__PURE__ */ p(Ze, { children: [
1309
+ /* @__PURE__ */ a(Y, { onClick: d, children: "Cancel" }),
1310
+ /* @__PURE__ */ a(Y, { onClick: f, children: "OK" })
1311
+ ] })
1312
+ ] })
1313
+ ]
1314
+ }
1315
+ )
1316
+ ] });
1317
+ }
1318
+ function Ml({ editor: e, ...t }) {
1319
+ const n = Te(e, ge.name, {
1320
+ text: "",
1321
+ defaultShowPicker: !1
1322
+ }), { text: r, defaultShowPicker: i } = n, [o, s] = I(""), [c, l] = I(!1), d = O(() => e.isActive(ge.name), [e]), f = O(() => Ae(ge.name, e), [e]), u = O(() => {
1323
+ e.chain().focus().setKatex({ text: o }).run(), l(!1);
1324
+ }, [e, o]);
1325
+ R(() => {
1326
+ i && (l(!0), e.chain().updateAttributes(ge.name, { defaultShowPicker: !1 }).focus().run());
1327
+ }, [e, i, l]), R(() => {
1328
+ c && s(r || "");
1329
+ }, [c]);
1330
+ const h = F(() => {
1331
+ try {
1332
+ return ci.renderToString(`${o}`);
1333
+ } catch {
1334
+ return o;
1335
+ }
1336
+ }, [o]), m = F(
1337
+ () => `${o}`.trim() ? /* @__PURE__ */ a("span", { contentEditable: !1, dangerouslySetInnerHTML: { __html: h || "" } }) : null,
1338
+ [o, h]
1339
+ );
1340
+ return /* @__PURE__ */ a(
1341
+ L,
1342
+ {
1343
+ editor: e,
1344
+ pluginKey: "Katex-bubble-menu",
1345
+ shouldShow: d,
1346
+ tippyOptions: {
1347
+ popperOptions: {
1348
+ modifiers: [{ name: "flip", enabled: !1 }]
1349
+ },
1350
+ placement: "bottom-start",
1351
+ offset: [-2, 16],
1352
+ zIndex: 9999,
1353
+ onHidden: () => {
1354
+ l(!1);
1355
+ }
1356
+ },
1357
+ children: t != null && t.disabled ? /* @__PURE__ */ a(N, {}) : /* @__PURE__ */ a("div", { className: "p-2 bg-white !border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800", children: c ? /* @__PURE__ */ p(N, { children: [
1358
+ /* @__PURE__ */ a(
1359
+ fn,
1360
+ {
1361
+ value: o,
1362
+ onChange: (g) => s(g.target.value),
1363
+ autoFocus: !0,
1364
+ placeholder: "Formula text",
1365
+ rows: 3,
1366
+ defaultValue: r,
1367
+ style: { marginBottom: 8 }
1368
+ }
1369
+ ),
1370
+ m && /* @__PURE__ */ a("div", { className: "my-[10px] p-[10px] rounded-[6px] !border-[1px] whitespace-nowrap overflow-auto", children: m }),
1371
+ /* @__PURE__ */ p("div", { className: "flex items-center justify-between gap-[6px]", children: [
1372
+ /* @__PURE__ */ a(Y, { onClick: u, className: "flex-1", children: "Submit" }),
1373
+ /* @__PURE__ */ a("a", { href: "https://katex.org/docs/supported", target: "_blank", rel: "noreferrer noopener", children: /* @__PURE__ */ a(ii, { size: 16 }) })
1374
+ ] })
1375
+ ] }) : /* @__PURE__ */ p("div", { className: "flex items-center justify-center gap-[6px]", children: [
1376
+ /* @__PURE__ */ a(C, { tooltip: "Edit", action: () => l(!c), children: /* @__PURE__ */ a(oi, { size: 16 }) }),
1377
+ /* @__PURE__ */ a(C, { tooltip: "Delete", action: f, children: /* @__PURE__ */ a(ai, { size: 16 }) })
1378
+ ] }) })
1379
+ }
1380
+ );
1381
+ }
1382
+ const tn = `graph TB
1383
+ a-->b`, Bl = ({ editor: e, attrs: t, extension: n }) => {
1384
+ const { alt: r, align: i } = t, [o, s] = I(decodeURIComponent(r ?? tn)), [c, l] = I(""), [d, f] = I(!1), u = ne(null), h = n == null ? void 0 : n.options.upload, m = async (x) => {
1385
+ try {
1386
+ const { svg: A } = await $t.render("mermaid-svg", x);
1387
+ l(A);
1388
+ } catch {
1389
+ l("");
1390
+ }
1391
+ }, g = () => {
1392
+ $t.initialize({
1393
+ darkMode: !1,
1394
+ startOnLoad: !1,
1395
+ // fontFamily:'',
1396
+ fontSize: 12,
1397
+ theme: "base"
1398
+ }), m(o);
1399
+ };
1400
+ return R(() => {
1401
+ d && g();
1402
+ }, [d]), R(() => {
1403
+ d && m(o);
1404
+ }, [o]), /* @__PURE__ */ p(
1405
+ Xe,
1406
+ {
1407
+ onOpenChange: f,
1408
+ open: d,
1409
+ children: [
1410
+ /* @__PURE__ */ a(qe, { asChild: !0, children: /* @__PURE__ */ a(
1411
+ C,
1412
+ {
1413
+ action: () => f(!0),
1414
+ icon: "Pencil",
1415
+ tooltip: "Edit Mermaid"
1416
+ }
1417
+ ) }),
1418
+ /* @__PURE__ */ p(Ye, { className: "z-[99999] !max-w-[1300px]", children: [
1419
+ /* @__PURE__ */ a(Je, { children: "Edit Mermaid" }),
1420
+ /* @__PURE__ */ a("div", { style: { height: "100%", border: "1px solid hsl(var(--border))" }, children: /* @__PURE__ */ p("div", { className: "flex gap-[10px] rounded-[10px] p-[10px]", children: [
1421
+ /* @__PURE__ */ a(
1422
+ fn,
1423
+ {
1424
+ autoFocus: !0,
1425
+ className: "flex-1",
1426
+ defaultValue: tn,
1427
+ onChange: (x) => s(x.target.value),
1428
+ placeholder: "Text",
1429
+ required: !0,
1430
+ rows: 10,
1431
+ value: o,
1432
+ style: {
1433
+ color: "hsl(var(--foreground))"
1434
+ }
1435
+ }
1436
+ ),
1437
+ /* @__PURE__ */ a(
1438
+ "div",
1439
+ {
1440
+ className: "flex flex-1 items-center justify-center rounded-[10px] p-[10px]",
1441
+ dangerouslySetInnerHTML: { __html: c },
1442
+ ref: u,
1443
+ style: { height: "100%", border: "1px solid hsl(var(--border))", minHeight: 500, background: "#fff" }
1444
+ }
1445
+ )
1446
+ ] }) }),
1447
+ /* @__PURE__ */ a(Ze, { children: /* @__PURE__ */ a(
1448
+ Y,
1449
+ {
1450
+ onClick: async () => {
1451
+ if (o !== "") {
1452
+ if (o) {
1453
+ const x = u.current.querySelector("svg"), { width: A, height: _ } = x.getBoundingClientRect(), E = `mermaid-${cn()}.svg`;
1454
+ let b = dn(x.outerHTML);
1455
+ if (h) {
1456
+ const y = un(b, E);
1457
+ b = await h(y);
1458
+ }
1459
+ e == null || e.chain().focus().setMermaid(
1460
+ {
1461
+ type: "mermaid",
1462
+ src: b,
1463
+ alt: encodeURIComponent(o),
1464
+ width: A,
1465
+ height: _
1466
+ },
1467
+ !!o
1468
+ ).run(), e == null || e.commands.setAlignImageMermaid(i);
1469
+ }
1470
+ f(!1);
1471
+ }
1472
+ },
1473
+ type: "button",
1474
+ children: "Save changes"
1475
+ }
1476
+ ) })
1477
+ ] })
1478
+ ]
1479
+ }
1480
+ );
1481
+ }, kl = {
1482
+ maxWidth: "auto",
1483
+ zIndex: 20,
1484
+ appendTo: "parent",
1485
+ moveTransition: "transform 0.1s ease-out"
1486
+ };
1487
+ function Ll({ item: e, disabled: t, editor: n }) {
1488
+ var i;
1489
+ const r = e.component;
1490
+ return r ? /* @__PURE__ */ a(Ve, { children: e.type === "divider" ? /* @__PURE__ */ a(
1491
+ U,
1492
+ {
1493
+ className: "!mx-1 !my-2 !h-[16px]",
1494
+ orientation: "vertical"
1495
+ }
1496
+ ) : /* @__PURE__ */ a(
1497
+ r,
1498
+ {
1499
+ ...e.componentProps,
1500
+ disabled: t || ((i = e == null ? void 0 : e.componentProps) == null ? void 0 : i.disabled),
1501
+ editor: n
1502
+ }
1503
+ ) }) : /* @__PURE__ */ a(N, {});
1504
+ }
1505
+ function zl(e) {
1506
+ return e.type.name === "mermaid";
1507
+ }
1508
+ function Fl(e) {
1509
+ const { lang: t } = D(), n = Te(e.editor, yt.name), r = er(e.editor, yt.name), i = ({ editor: s }) => {
1510
+ const { selection: c } = s.view.state, { $from: l, to: d } = c;
1511
+ let f = !1;
1512
+ return s.view.state.doc.nodesBetween(l.pos, d, (u) => {
1513
+ if (zl(u))
1514
+ return f = !0, !1;
1515
+ }), f;
1516
+ }, o = F(() => e.disabled ? [] : Ql(e.editor), [e.disabled, e.editor, t]);
1517
+ return /* @__PURE__ */ a(N, { children: /* @__PURE__ */ a(
1518
+ L,
1519
+ {
1520
+ editor: e == null ? void 0 : e.editor,
1521
+ shouldShow: i,
1522
+ tippyOptions: kl,
1523
+ children: o != null && o.length ? /* @__PURE__ */ a("div", { className: "pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800", children: /* @__PURE__ */ a("div", { className: "relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap", children: o == null ? void 0 : o.map((s, c) => s.type === "edit" && (n != null && n.src) ? /* @__PURE__ */ a(
1524
+ Bl,
1525
+ {
1526
+ attrs: n,
1527
+ editor: e.editor,
1528
+ extension: r
1529
+ },
1530
+ `bubbleMenu-mermaid-${c}`
1531
+ ) : /* @__PURE__ */ a(
1532
+ Ll,
1533
+ {
1534
+ disabled: e.disabled,
1535
+ editor: e.editor,
1536
+ item: s
1537
+ },
1538
+ `bubbleMenu-mermaid-${c}`
1539
+ )) }) }) : /* @__PURE__ */ a(N, {})
1540
+ }
1541
+ ) });
1542
+ }
1543
+ function jl({ editor: e, disabled: t }) {
1544
+ const [n, r] = I(!1), { t: i } = D(), o = O(({ editor: l }) => l.isActive(wt.name), []), s = (l) => {
1545
+ e.commands.updateTweet({ src: l }), r(!1);
1546
+ }, c = O(() => Ae(wt.name, e), [e]);
1547
+ return /* @__PURE__ */ a(N, { children: /* @__PURE__ */ a(
1548
+ L,
1549
+ {
1550
+ editor: e,
1551
+ shouldShow: o,
1552
+ tippyOptions: {
1553
+ popperOptions: {
1554
+ modifiers: [{ name: "flip", enabled: !1 }]
1555
+ },
1556
+ placement: "bottom-start",
1557
+ offset: [-2, 16],
1558
+ zIndex: 9999,
1559
+ onHidden: () => {
1560
+ r(!1);
1561
+ }
1562
+ },
1563
+ children: t ? /* @__PURE__ */ a(N, {}) : /* @__PURE__ */ a(N, { children: n ? /* @__PURE__ */ a(
1564
+ Sr,
1565
+ {
1566
+ editor: e,
1567
+ onSetLink: s
1568
+ }
1569
+ ) : /* @__PURE__ */ a("div", { className: "flex items-center gap-2 rounded-lg !border border-neutral-200 bg-white p-2 shadow-sm dark:border-neutral-800 dark:bg-black", children: /* @__PURE__ */ p("div", { className: "flex flex-nowrap", children: [
1570
+ /* @__PURE__ */ a(
1571
+ C,
1572
+ {
1573
+ icon: "Pencil",
1574
+ tooltip: i("editor.link.edit.tooltip"),
1575
+ tooltipOptions: { sideOffset: 15 },
1576
+ action: () => {
1577
+ r(!0);
1578
+ }
1579
+ }
1580
+ ),
1581
+ /* @__PURE__ */ a(
1582
+ C,
1583
+ {
1584
+ action: c,
1585
+ icon: "Trash",
1586
+ tooltip: i("editor.delete"),
1587
+ tooltipOptions: { sideOffset: 15 }
1588
+ }
1589
+ )
1590
+ ] }) }) })
1591
+ }
1592
+ ) });
1593
+ }
1594
+ function Hl({ editor: e, disabled: t, bubbleMenu: n }) {
1595
+ const r = e.extensionManager.extensions.map((o) => o.name), i = () => {
1596
+ var o, s, c, l, d, f, u, h, m, g, v, x, A, _, E, b;
1597
+ return [
1598
+ r.includes("columns") && !((o = n == null ? void 0 : n.columnConfig) != null && o.hidden) ? /* @__PURE__ */ a(
1599
+ bc,
1600
+ {
1601
+ editor: e
1602
+ },
1603
+ "columns"
1604
+ ) : null,
1605
+ r.includes("table") && !((s = n == null ? void 0 : n.tableConfig) != null && s.hidden) ? /* @__PURE__ */ a(
1606
+ fc,
1607
+ {
1608
+ editor: e,
1609
+ items: (c = n == null ? void 0 : n.tableConfig) == null ? void 0 : c.items,
1610
+ actions: (l = n == null ? void 0 : n.tableConfig) == null ? void 0 : l.actions
1611
+ },
1612
+ "table"
1613
+ ) : null,
1614
+ r.includes("link") && !((d = n == null ? void 0 : n.linkConfig) != null && d.hidden) ? /* @__PURE__ */ a(
1615
+ mc,
1616
+ {
1617
+ disabled: t,
1618
+ editor: e
1619
+ },
1620
+ "link"
1621
+ ) : null,
1622
+ r.includes(hn.name) && !((f = n == null ? void 0 : n.imageConfig) != null && f.hidden) ? /* @__PURE__ */ a(
1623
+ yc,
1624
+ {
1625
+ disabled: t,
1626
+ editor: e
1627
+ },
1628
+ "image"
1629
+ ) : null,
1630
+ r.includes(mn.name) && !((u = n == null ? void 0 : n.imageGifConfig) != null && u.hidden) ? /* @__PURE__ */ a(
1631
+ wc,
1632
+ {
1633
+ disabled: t,
1634
+ editor: e
1635
+ },
1636
+ "imageGif"
1637
+ ) : null,
1638
+ r.includes("video") && !((h = n == null ? void 0 : n.videoConfig) != null && h.hidden) ? /* @__PURE__ */ a(
1639
+ xc,
1640
+ {
1641
+ disabled: t,
1642
+ editor: e
1643
+ },
1644
+ "video"
1645
+ ) : null,
1646
+ r.includes("katex") && !((m = n == null ? void 0 : n.katexConfig) != null && m.hidden) ? /* @__PURE__ */ a(
1647
+ Ml,
1648
+ {
1649
+ disabled: t,
1650
+ editor: e
1651
+ },
1652
+ "katex"
1653
+ ) : null,
1654
+ r.includes("mermaid") && !((g = n == null ? void 0 : n.mermaidConfig) != null && g.hidden) ? /* @__PURE__ */ a(
1655
+ Fl,
1656
+ {
1657
+ disabled: t,
1658
+ editor: e
1659
+ },
1660
+ "mermaid"
1661
+ ) : null,
1662
+ r.includes("iframe") && !((v = n == null ? void 0 : n.iframeConfig) != null && v.hidden) ? /* @__PURE__ */ a(
1663
+ Dl,
1664
+ {
1665
+ disabled: t,
1666
+ editor: e
1667
+ },
1668
+ "iframe"
1669
+ ) : null,
1670
+ r.includes("twitter") && !((x = n == null ? void 0 : n.twitterConfig) != null && x.hidden) ? /* @__PURE__ */ a(
1671
+ jl,
1672
+ {
1673
+ disabled: t,
1674
+ editor: e
1675
+ },
1676
+ "twitter"
1677
+ ) : null,
1678
+ (A = n == null ? void 0 : n.floatingMenuConfig) != null && A.hidden ? null : /* @__PURE__ */ a(
1679
+ ac,
1680
+ {
1681
+ disabled: t,
1682
+ editor: e
1683
+ },
1684
+ "content"
1685
+ ),
1686
+ (_ = n == null ? void 0 : n.textConfig) != null && _.hidden ? null : /* @__PURE__ */ a(
1687
+ lc,
1688
+ {
1689
+ disabled: t,
1690
+ editor: e,
1691
+ items: (E = n == null ? void 0 : n.textConfig) == null ? void 0 : E.items
1692
+ },
1693
+ "text"
1694
+ ),
1695
+ r.includes("drawer") && !((b = n == null ? void 0 : n.drawerConfig) != null && b.hidden) ? /* @__PURE__ */ a(
1696
+ Ol,
1697
+ {
1698
+ disabled: t,
1699
+ editor: e
1700
+ },
1701
+ "drawer"
1702
+ ) : null
1703
+ ];
1704
+ };
1705
+ return n != null && n.render ? n.render({ editor: e, disabled: t || !1, bubbleMenu: n }, i()) : i().filter(Boolean);
1706
+ }
1707
+ function Ul({ editor: e, disabled: t, toolbar: n }) {
1708
+ const { t: r, lang: i } = D(), o = F(() => {
1709
+ const d = [...e.extensionManager.extensions].sort((u, h) => {
1710
+ const m = u.options.sort ?? -1, g = h.options.sort ?? -1;
1711
+ return m - g;
1712
+ });
1713
+ let f = [];
1714
+ for (const u of d) {
1715
+ const {
1716
+ button: h,
1717
+ divider: m = !1,
1718
+ spacer: g = !1,
1719
+ toolbar: v = !0
1720
+ } = u.options;
1721
+ if (!h || !Pr(h) || !v)
1722
+ continue;
1723
+ const x = h({
1724
+ editor: e,
1725
+ extension: u,
1726
+ t: r
1727
+ });
1728
+ if (Array.isArray(x)) {
1729
+ const A = x.map((_, E) => ({
1730
+ button: _,
1731
+ divider: E === x.length - 1 ? m : !1,
1732
+ spacer: E === 0 ? g : !1,
1733
+ type: u.type,
1734
+ name: u.name
1735
+ }));
1736
+ f = [...f, ...A];
1737
+ continue;
1738
+ }
1739
+ f.push({
1740
+ button: x,
1741
+ divider: m,
1742
+ spacer: g,
1743
+ type: u.type,
1744
+ name: u.name
1745
+ });
1746
+ }
1747
+ return f;
1748
+ }, [e, r, i]), s = (l) => /* @__PURE__ */ a(
1749
+ "div",
1750
+ {
1751
+ className: "toolbar px-1 py-2 !border-b",
1752
+ style: {
1753
+ pointerEvents: t ? "none" : "auto",
1754
+ opacity: t ? 0.5 : 1
1755
+ },
1756
+ children: /* @__PURE__ */ a("div", { className: "relative flex flex-wrap h-auto gap-y-1 gap-x-1", children: l })
1757
+ }
1758
+ ), c = o.map((l, d) => {
1759
+ var u, h;
1760
+ const f = l.button.component;
1761
+ return /* @__PURE__ */ p("div", { className: "flex items-center", children: [
1762
+ (l == null ? void 0 : l.spacer) && /* @__PURE__ */ a(U, { orientation: "vertical", className: "!h-[16px] !mx-[10px]" }),
1763
+ /* @__PURE__ */ a(
1764
+ f,
1765
+ {
1766
+ ...l.button.componentProps,
1767
+ disabled: t || ((h = (u = l == null ? void 0 : l.button) == null ? void 0 : u.componentProps) == null ? void 0 : h.disabled)
1768
+ }
1769
+ ),
1770
+ (l == null ? void 0 : l.divider) && /* @__PURE__ */ a(U, { orientation: "vertical", className: "!h-auto !mx-2" })
1771
+ ] }, `toolbar-item-${d}`);
1772
+ });
1773
+ return n && (n != null && n.render) ? n.render({ editor: e, disabled: t || !1 }, o, c, s) : s(c);
1774
+ }
1775
+ function Gl(e) {
1776
+ const t = ["size-small", "size-medium", "size-large"], n = [
1777
+ "SizeS",
1778
+ "SizeM",
1779
+ "SizeL"
1780
+ ];
1781
+ return t.map((r, i) => ({
1782
+ type: `image-${r}`,
1783
+ component: C,
1784
+ componentProps: {
1785
+ tooltip: M.t(`editor.${r.replace("-", ".")}.tooltip`),
1786
+ icon: n[i],
1787
+ action: () => e.commands.updateImage({ width: we[r] }),
1788
+ isActive: () => e.isActive("image", { width: we[r] })
1789
+ }
1790
+ }));
1791
+ }
1792
+ function Wl(e) {
1793
+ const t = ["size-small", "size-medium", "size-large"], n = [
1794
+ "SizeS",
1795
+ "SizeM",
1796
+ "SizeL"
1797
+ ];
1798
+ return t.map((r, i) => ({
1799
+ type: `image-${r}`,
1800
+ component: C,
1801
+ componentProps: {
1802
+ tooltip: M.t(`editor.${r.replace("-", ".")}.tooltip`),
1803
+ icon: n[i],
1804
+ action: () => e.commands.updateImageGif({ width: we[r] }),
1805
+ isActive: () => e.isActive("image", { width: we[r] })
1806
+ }
1807
+ }));
1808
+ }
1809
+ function Vl(e) {
1810
+ const t = ["left", "center", "right"], n = {
1811
+ left: "AlignLeft",
1812
+ center: "AlignCenter",
1813
+ right: "AlignRight"
1814
+ };
1815
+ return t.map((r) => ({
1816
+ type: `image-${r}`,
1817
+ component: C,
1818
+ componentProps: {
1819
+ tooltip: M.t(`editor.textalign.${r}.tooltip`),
1820
+ icon: n[r],
1821
+ action: () => {
1822
+ var i, o;
1823
+ return (o = (i = e.commands) == null ? void 0 : i.setAlignImage) == null ? void 0 : o.call(i, r);
1824
+ },
1825
+ isActive: () => e.isActive({ align: r }) || !1,
1826
+ disabled: !1
1827
+ }
1828
+ }));
1829
+ }
1830
+ function Kl(e) {
1831
+ const t = ["left", "center", "right"], n = {
1832
+ left: "AlignLeft",
1833
+ center: "AlignCenter",
1834
+ right: "AlignRight"
1835
+ };
1836
+ return t.map((r) => ({
1837
+ type: `image-${r}`,
1838
+ component: C,
1839
+ componentProps: {
1840
+ tooltip: M.t(`editor.textalign.${r}.tooltip`),
1841
+ icon: n[r],
1842
+ action: () => {
1843
+ var i, o;
1844
+ return (o = (i = e.commands) == null ? void 0 : i.setAlignImageGif) == null ? void 0 : o.call(i, r);
1845
+ },
1846
+ isActive: () => e.isActive({ align: r }) || !1,
1847
+ disabled: !1
1848
+ }
1849
+ }));
1850
+ }
1851
+ function Xl(e) {
1852
+ const t = ["left", "center", "right"], n = {
1853
+ left: "AlignLeft",
1854
+ center: "AlignCenter",
1855
+ right: "AlignRight"
1856
+ };
1857
+ return t.map((r) => ({
1858
+ type: `image-${r}`,
1859
+ component: C,
1860
+ componentProps: {
1861
+ tooltip: M.t(`editor.textalign.${r}.tooltip`),
1862
+ icon: n[r],
1863
+ action: () => {
1864
+ var i, o;
1865
+ return (o = (i = e.commands) == null ? void 0 : i.setAlignImageMermaid) == null ? void 0 : o.call(i, r);
1866
+ },
1867
+ isActive: () => e.isActive({ align: r }) || !1,
1868
+ disabled: !1
1869
+ }
1870
+ }));
1871
+ }
1872
+ function ql(e) {
1873
+ const t = ["left", "center", "right"], n = {
1874
+ left: "AlignLeft",
1875
+ center: "AlignCenter",
1876
+ right: "AlignRight"
1877
+ };
1878
+ return t.map((r) => ({
1879
+ type: `image-${r}`,
1880
+ component: C,
1881
+ componentProps: {
1882
+ tooltip: M.t(`editor.textalign.${r}.tooltip`),
1883
+ icon: n[r],
1884
+ action: () => {
1885
+ var i, o;
1886
+ return (o = (i = e.commands) == null ? void 0 : i.setAlignImageDrawer) == null ? void 0 : o.call(i, r);
1887
+ },
1888
+ isActive: () => e.isActive({ align: r }) || !1,
1889
+ disabled: !1
1890
+ }
1891
+ }));
1892
+ }
1893
+ function Yl(e) {
1894
+ const t = ["size-small", "size-medium", "size-large"], n = [
1895
+ "SizeS",
1896
+ "SizeM",
1897
+ "SizeL"
1898
+ ];
1899
+ return t.map((r, i) => ({
1900
+ type: `video-${r}`,
1901
+ component: C,
1902
+ componentProps: {
1903
+ tooltip: M.t(`editor.${r.replace("-", ".")}.tooltip`),
1904
+ icon: n[i],
1905
+ action: () => e.commands.updateVideo({ width: Et[r] }),
1906
+ isActive: () => e.isActive("video", { width: Et[r] })
1907
+ }
1908
+ }));
1909
+ }
1910
+ function Jl(e) {
1911
+ return [
1912
+ {
1913
+ type: "flipX",
1914
+ component: C,
1915
+ componentProps: {
1916
+ editor: e,
1917
+ tooltip: M.t("editor.tooltip.flipX"),
1918
+ icon: "FlipX",
1919
+ action: () => {
1920
+ const t = e.getAttributes("image"), { flipX: n } = t;
1921
+ e.chain().focus(void 0, { scrollIntoView: !1 }).updateImage({
1922
+ flipX: !n
1923
+ }).run();
1924
+ }
1925
+ }
1926
+ },
1927
+ {
1928
+ type: "flipY",
1929
+ component: C,
1930
+ componentProps: {
1931
+ editor: e,
1932
+ tooltip: M.t("editor.tooltip.flipY"),
1933
+ icon: "FlipY",
1934
+ action: () => {
1935
+ const t = e.getAttributes("image"), { flipY: n } = t;
1936
+ e.chain().focus(void 0, { scrollIntoView: !1 }).updateImage({
1937
+ flipY: !n
1938
+ }).run();
1939
+ }
1940
+ }
1941
+ },
1942
+ ...Gl(e),
1943
+ ...Vl(e),
1944
+ {
1945
+ type: "remove",
1946
+ component: C,
1947
+ componentProps: {
1948
+ editor: e,
1949
+ tooltip: M.t("editor.remove"),
1950
+ icon: "Trash2",
1951
+ action: () => {
1952
+ const { state: t, dispatch: n } = e.view;
1953
+ he(t, n);
1954
+ }
1955
+ }
1956
+ }
1957
+ ];
1958
+ }
1959
+ function Zl(e) {
1960
+ return [
1961
+ ...Wl(e),
1962
+ ...Kl(e),
1963
+ {
1964
+ type: "remove",
1965
+ component: C,
1966
+ componentProps: {
1967
+ editor: e,
1968
+ tooltip: M.t("editor.remove"),
1969
+ icon: "Trash2",
1970
+ action: () => {
1971
+ const { state: t, dispatch: n } = e.view;
1972
+ he(t, n);
1973
+ }
1974
+ }
1975
+ }
1976
+ ];
1977
+ }
1978
+ function Ql(e) {
1979
+ return [
1980
+ ...Xl(e),
1981
+ {
1982
+ type: "edit",
1983
+ component: C,
1984
+ componentProps: {
1985
+ editor: e,
1986
+ tooltip: M.t("editor.edit"),
1987
+ icon: "Pencil",
1988
+ action: () => !0
1989
+ }
1990
+ },
1991
+ {
1992
+ type: "remove",
1993
+ component: C,
1994
+ componentProps: {
1995
+ editor: e,
1996
+ tooltip: M.t("editor.remove"),
1997
+ icon: "Trash2",
1998
+ action: () => {
1999
+ const { state: t, dispatch: n } = e.view;
2000
+ he(t, n);
2001
+ }
2002
+ }
2003
+ }
2004
+ ];
2005
+ }
2006
+ function ec(e) {
2007
+ return [
2008
+ ...ql(e),
2009
+ {
2010
+ type: "edit",
2011
+ component: C,
2012
+ componentProps: {
2013
+ editor: e,
2014
+ tooltip: M.t("editor.edit"),
2015
+ icon: "Pencil",
2016
+ action: () => (console.log("AAA"), !0)
2017
+ }
2018
+ },
2019
+ {
2020
+ type: "remove",
2021
+ component: C,
2022
+ componentProps: {
2023
+ editor: e,
2024
+ tooltip: M.t("editor.remove"),
2025
+ icon: "Trash2",
2026
+ action: () => {
2027
+ const { state: t, dispatch: n } = e.view;
2028
+ he(t, n);
2029
+ }
2030
+ }
2031
+ }
2032
+ ];
2033
+ }
2034
+ function tc(e) {
2035
+ return [
2036
+ ...Yl(e),
2037
+ {
2038
+ type: "remove",
2039
+ component: C,
2040
+ componentProps: {
2041
+ editor: e,
2042
+ tooltip: M.t("editor.remove"),
2043
+ icon: "Trash2",
2044
+ action: () => {
2045
+ const { state: t, dispatch: n } = e.view;
2046
+ he(t, n);
2047
+ }
2048
+ }
2049
+ }
2050
+ ];
2051
+ }
2052
+ function tr(e, t, n = ti) {
2053
+ return n.reduce((r, i) => {
2054
+ if (i === "divider" && r.length > 0)
2055
+ return [...r, {
2056
+ type: "divider",
2057
+ component: void 0,
2058
+ componentProps: {}
2059
+ }];
2060
+ const o = e.extensionManager.extensions.find((s) => s.name === i);
2061
+ return o ? [...r, o.configure().options.button({ editor: e, t, extension: o })] : r;
2062
+ }, []);
2063
+ }
2064
+ function st(e, t, n) {
2065
+ const r = [], i = e.node(0);
2066
+ n = typeof n == "number" && n >= 0 ? n : e.sameParent(t) ? Math.max(0, e.sharedDepth(t.pos) - 1) : e.sharedDepth(t.pos);
2067
+ const o = new _r(e, t, n), s = o.depth === 0 ? 0 : i.resolve(o.start).posAtIndex(0);
2068
+ return o.parent.forEach((c, l) => {
2069
+ const d = s + l, f = d + c.nodeSize;
2070
+ if (d < o.start || d >= o.end) return;
2071
+ const u = new Nr(i.resolve(d), i.resolve(f));
2072
+ r.push(u);
2073
+ }), r;
2074
+ }
2075
+ class lt {
2076
+ constructor(t, n) {
2077
+ me(this, "anchor");
2078
+ me(this, "head");
2079
+ this.anchor = t, this.head = n;
2080
+ }
2081
+ map(t) {
2082
+ return new lt(t.map(this.anchor), t.map(this.head));
2083
+ }
2084
+ resolve(t) {
2085
+ const n = t.resolve(this.anchor), r = t.resolve(this.head);
2086
+ return new H(n, r);
2087
+ }
2088
+ }
2089
+ class H extends Er {
2090
+ constructor(n, r, i, o = 1) {
2091
+ const { doc: s } = n, c = n === r, l = n.pos === s.content.size && r.pos === s.content.size, d = c && !l ? s.resolve(r.pos + (o > 0 ? 1 : -1)) : r, f = c && l ? s.resolve(n.pos - (o > 0 ? 1 : -1)) : n, u = st(f.min(d), f.max(d), i);
2092
+ super(
2093
+ d.pos >= n.pos ? u[0].$from : u[u.length - 1].$to,
2094
+ d.pos >= n.pos ? u[u.length - 1].$to : u[0].$from,
2095
+ u
2096
+ );
2097
+ me(this, "depth");
2098
+ this.depth = i;
2099
+ }
2100
+ get $to() {
2101
+ return this.ranges[this.ranges.length - 1].$to;
2102
+ }
2103
+ eq(n) {
2104
+ return n instanceof H && n.$from.pos === this.$from.pos && n.$to.pos === this.$to.pos;
2105
+ }
2106
+ map(n, r) {
2107
+ const i = n.resolve(r.map(this.anchor)), o = n.resolve(r.map(this.head));
2108
+ return new H(i, o);
2109
+ }
2110
+ toJSON() {
2111
+ return { type: "nodeRange", anchor: this.anchor, head: this.head };
2112
+ }
2113
+ get isForwards() {
2114
+ return this.head >= this.anchor;
2115
+ }
2116
+ get isBackwards() {
2117
+ return !this.isForwards;
2118
+ }
2119
+ extendBackwards() {
2120
+ const { doc: n } = this.$from;
2121
+ if (this.isForwards && this.ranges.length > 1) {
2122
+ const o = this.ranges.slice(0, -1), s = o[0].$from, c = o[o.length - 1].$to;
2123
+ return new H(s, c, this.depth);
2124
+ }
2125
+ const r = this.ranges[0], i = n.resolve(Math.max(0, r.$from.pos - 1));
2126
+ return new H(this.$anchor, i, this.depth);
2127
+ }
2128
+ extendForwards() {
2129
+ const { doc: n } = this.$from;
2130
+ if (this.isBackwards && this.ranges.length > 1) {
2131
+ const o = this.ranges.slice(1), s = o[0].$from, c = o[o.length - 1].$to;
2132
+ return new H(c, s, this.depth);
2133
+ }
2134
+ const r = this.ranges[this.ranges.length - 1], i = n.resolve(Math.min(n.content.size, r.$to.pos + 1));
2135
+ return new H(this.$anchor, i, this.depth);
2136
+ }
2137
+ static fromJSON(n, r) {
2138
+ return new H(n.resolve(r.anchor), n.resolve(r.head));
2139
+ }
2140
+ static create(n, r, i, o, s = 1) {
2141
+ return new this(n.resolve(r), n.resolve(i), o, s);
2142
+ }
2143
+ getBookmark() {
2144
+ return new lt(this.anchor, this.head);
2145
+ }
2146
+ }
2147
+ function nc(e) {
2148
+ const t = e.cloneNode(!0), n = [e, ...Array.from(e.getElementsByTagName("*"))], r = [t, ...Array.from(t.getElementsByTagName("*"))];
2149
+ return n.forEach((i, o) => {
2150
+ r[o].style.cssText = function(s) {
2151
+ let c = "";
2152
+ const l = getComputedStyle(s);
2153
+ for (let d = 0; d < l.length; d += 1)
2154
+ c += `${l[d]}:${l.getPropertyValue(l[d])};`;
2155
+ return c;
2156
+ }(i);
2157
+ }), t;
2158
+ }
2159
+ function ve(e, t) {
2160
+ return window.getComputedStyle(e)[t];
2161
+ }
2162
+ function rc(e = 0, t = 0, n = 0) {
2163
+ return Math.min(Math.max(e, t), n);
2164
+ }
2165
+ function nn(e) {
2166
+ e.parentNode !== null && e.parentNode !== void 0 && e.parentNode.removeChild(e);
2167
+ }
2168
+ function nr(e) {
2169
+ const { x: t, y: n, direction: r, editor: i } = e;
2170
+ let o = null, s = null, c = null, l = t;
2171
+ for (; s === null && l < window.innerWidth && l > 0; ) {
2172
+ const d = document.elementsFromPoint(l, n), f = d.findIndex((h) => h.classList.contains("ProseMirror")), u = d.slice(0, f);
2173
+ if (u.length > 0) {
2174
+ const h = u[0];
2175
+ if (o = h, c = i.view.posAtDOM(h, 0), c >= 0) {
2176
+ s = i.state.doc.nodeAt(Math.max(c - 1, 0)), (s === null || s.isText) && (s = i.state.doc.nodeAt(Math.max(c - 1, 0))), s || (s = i.state.doc.nodeAt(Math.max(c, 0)));
2177
+ break;
2178
+ }
2179
+ }
2180
+ r === "left" ? l -= 1 : l += 1;
2181
+ }
2182
+ return {
2183
+ resultElement: o,
2184
+ resultNode: s,
2185
+ pos: c !== null ? c : null
2186
+ };
2187
+ }
2188
+ function ic(e, t) {
2189
+ const { doc: n } = t.view.state, r = nr({ editor: t, x: e.clientX, y: e.clientY, direction: "right" });
2190
+ if (!r.resultNode || r.pos === null) return [];
2191
+ const i = e.clientX, o = function(f, u, h) {
2192
+ const m = Number.parseInt(ve(f.dom, "paddingLeft"), 10), g = Number.parseInt(ve(f.dom, "paddingRight"), 10), v = Number.parseInt(ve(f.dom, "borderLeftWidth"), 10), x = Number.parseInt(ve(f.dom, "borderLeftWidth"), 10), A = f.dom.getBoundingClientRect();
2193
+ return {
2194
+ left: rc(
2195
+ u,
2196
+ A.left + m + v,
2197
+ A.right - g - x
2198
+ ),
2199
+ top: h
2200
+ };
2201
+ }(t.view, i, e.clientY), s = t.view.posAtCoords(o);
2202
+ if (!s) return [];
2203
+ const { pos: c } = s;
2204
+ if (!n.resolve(c).parent) return [];
2205
+ const l = n.resolve(r.pos), d = n.resolve(r.pos + 1);
2206
+ return st(l, d, 0);
2207
+ }
2208
+ function rn(e, t) {
2209
+ const n = e.resolve(t), { depth: r } = n;
2210
+ return r === 0 ? t : n.pos - n.parentOffset - 1;
2211
+ }
2212
+ function on(e, t) {
2213
+ const n = e.nodeAt(t), r = e.resolve(t);
2214
+ let { depth: i } = r, o = n;
2215
+ for (; i > 0; ) {
2216
+ const s = r.node(i);
2217
+ i -= 1, i === 0 && (o = s);
2218
+ }
2219
+ return o;
2220
+ }
2221
+ function an(e, t) {
2222
+ let n = t;
2223
+ for (; n && n.parentNode && n.parentNode !== e.dom; ) n = n.parentNode;
2224
+ return n;
2225
+ }
2226
+ const rr = new gn("dragHandle");
2227
+ function oc({
2228
+ pluginKey: e = rr,
2229
+ element: t,
2230
+ editor: n,
2231
+ tippyOptions: r,
2232
+ onNodeChange: i
2233
+ }) {
2234
+ const o = document.createElement("div");
2235
+ let s = null, c = !1, l = null, d = -1;
2236
+ return t.addEventListener("dragstart", (f) => {
2237
+ const { view: u } = n;
2238
+ if (!f.dataTransfer) return;
2239
+ const { empty: h, $from: m, $to: g } = u.state.selection, v = ic(f, n), x = st(m, g, 0), A = x.some((B) => v.find((k) => k.$from === B.$from && k.$to === B.$to)), _ = h || !A ? v : x;
2240
+ if (_.length === 0) return;
2241
+ const { tr: E } = u.state, b = document.createElement("div"), y = _[0].$from.pos, T = _[_.length - 1].$to.pos, w = H.create(u.state.doc, y, T), P = w.content();
2242
+ _.forEach((B) => {
2243
+ const k = nc(u.nodeDOM(B.$from.pos));
2244
+ b.append(k);
2245
+ }), b.style.position = "absolute", b.style.top = "-10000px", document.body.append(b), f.dataTransfer.clearData(), f.dataTransfer.setDragImage(b, 0, 0), u.dragging = { slice: P, move: !0 }, E.setSelection(w), u.dispatch(E), document.addEventListener("drop", () => nn(b), { once: !0 }), setTimeout(() => {
2246
+ t && (t.style.pointerEvents = "none");
2247
+ }, 0);
2248
+ }), t.addEventListener("dragend", () => {
2249
+ t && (t.style.pointerEvents = "auto");
2250
+ }), new $r({
2251
+ key: typeof e == "string" ? new gn(e) : e,
2252
+ state: {
2253
+ init: () => ({ locked: !1 }),
2254
+ apply(f, u) {
2255
+ const h = f.getMeta("lockDragHandle"), m = f.getMeta("hideDragHandle");
2256
+ if (h !== void 0 && (c = h), m && s)
2257
+ return s.hide(), c = !1, l = null, d = -1, i == null || i({ editor: n, node: null, pos: -1 }), u;
2258
+ if (f.docChanged && d !== -1 && t && s) {
2259
+ const g = f.mapping.map(d);
2260
+ g !== d && (d = g);
2261
+ }
2262
+ return u;
2263
+ }
2264
+ },
2265
+ view: (f) => {
2266
+ return u(), h(n.view.dom), s = di(f.dom, {
2267
+ ...m(),
2268
+ ...r
2269
+ }), {
2270
+ update(b, y) {
2271
+ if (!g(t, s) || (t.draggable = !c, !v(b, y)))
2272
+ return;
2273
+ const T = x(b);
2274
+ T && A(b, T);
2275
+ },
2276
+ destroy() {
2277
+ E();
2278
+ }
2279
+ };
2280
+ function u() {
2281
+ t.draggable = !0, t.style.pointerEvents = "auto";
2282
+ }
2283
+ function h(b) {
2284
+ var y;
2285
+ (y = b.parentElement) == null || y.appendChild(o), o.appendChild(t), Object.assign(o.style, {
2286
+ pointerEvents: "none",
2287
+ position: "absolute",
2288
+ top: "0",
2289
+ left: "0"
2290
+ });
2291
+ }
2292
+ function m() {
2293
+ return {
2294
+ getReferenceClientRect: null,
2295
+ interactive: !0,
2296
+ trigger: "manual",
2297
+ placement: "left-start",
2298
+ hideOnClick: !1,
2299
+ duration: 100,
2300
+ zIndex: 10,
2301
+ appendTo: o,
2302
+ content: t,
2303
+ popperOptions: {
2304
+ modifiers: [
2305
+ { name: "flip", enabled: !1 },
2306
+ {
2307
+ name: "preventOverflow",
2308
+ options: {
2309
+ rootBoundary: "document",
2310
+ mainAxis: !1
2311
+ }
2312
+ }
2313
+ ]
2314
+ }
2315
+ };
2316
+ }
2317
+ function g(b, y) {
2318
+ return b && y;
2319
+ }
2320
+ function v(b, y) {
2321
+ return !b.state.doc.eq(y.doc) && d !== -1;
2322
+ }
2323
+ function x(b) {
2324
+ let y = b.nodeDOM(d);
2325
+ return y = an(b, y), y === b.dom || (y == null ? void 0 : y.nodeType) !== 1 ? null : y;
2326
+ }
2327
+ function A(b, y) {
2328
+ const T = b.posAtDOM(y, 0), w = on(n.state.doc, T);
2329
+ if (w === l)
2330
+ return;
2331
+ const P = rn(n.state.doc, T);
2332
+ l = w, d = P, i == null || i({
2333
+ editor: n,
2334
+ node: l,
2335
+ pos: d
2336
+ }), _(y);
2337
+ }
2338
+ function _(b) {
2339
+ s.setProps({
2340
+ getReferenceClientRect: () => b.getBoundingClientRect()
2341
+ }), s.show();
2342
+ }
2343
+ function E() {
2344
+ s == null || s.destroy(), t && nn(o);
2345
+ }
2346
+ },
2347
+ props: {
2348
+ handleDOMEvents: {
2349
+ mouseleave: (f, u) => {
2350
+ if (c || !h(u)) return !1;
2351
+ return m(), g(), !1;
2352
+ function h(v) {
2353
+ return v.target && !o.contains(v.relatedTarget);
2354
+ }
2355
+ function m() {
2356
+ s == null || s.hide();
2357
+ }
2358
+ function g() {
2359
+ l = null, d = -1, i == null || i({
2360
+ editor: n,
2361
+ node: null,
2362
+ pos: -1
2363
+ });
2364
+ }
2365
+ },
2366
+ mousemove: Or((f, u) => {
2367
+ if (!t || !s || c)
2368
+ return !1;
2369
+ const h = nr({
2370
+ x: u.clientX,
2371
+ y: u.clientY,
2372
+ direction: "right",
2373
+ editor: n
2374
+ });
2375
+ if (!h.resultElement || h.resultElement === f.dom)
2376
+ return !1;
2377
+ const m = an(f, h.resultElement);
2378
+ if (m === f.dom || (m == null ? void 0 : m.nodeType) !== 1)
2379
+ return !1;
2380
+ const g = f.posAtDOM(m, 0), v = on(n.state.doc, g);
2381
+ if (v === l)
2382
+ return !1;
2383
+ const x = rn(n.state.doc, g);
2384
+ return l = v, d = x, i == null || i({
2385
+ editor: n,
2386
+ node: l,
2387
+ pos: d
2388
+ }), s.setProps({
2389
+ getReferenceClientRect: () => m.getBoundingClientRect()
2390
+ }), s.show(), !1;
2391
+ }, 100)
2392
+ }
2393
+ }
2394
+ });
2395
+ }
2396
+ function ac(e) {
2397
+ var P, B, k;
2398
+ const { pluginKey: t = rr } = e, { t: n } = D(), [r, i] = I(null), [o, s] = I(-1), c = ne(null), l = ne(null), [d, f] = I(!1), u = e.editor.extensionManager.extensions.some((S) => S.name === "textAlign"), h = e.editor.extensionManager.extensions.some((S) => S.name === "indent"), m = e.editor.extensionManager.extensions.some((S) => S.name === "clear");
2399
+ R(() => {
2400
+ c.current && !e.editor.isDestroyed && (l.current = oc({
2401
+ editor: e.editor,
2402
+ element: c.current,
2403
+ pluginKey: "ContentItemMenu",
2404
+ tippyOptions: {
2405
+ offset: [-2, 16],
2406
+ zIndex: 99,
2407
+ moveTransition: "transform 0.15s ease-out"
2408
+ },
2409
+ onNodeChange: y
2410
+ }), e.editor.registerPlugin(l.current));
2411
+ }, [e.editor, c]);
2412
+ function g() {
2413
+ const S = e.editor.chain();
2414
+ S.setNodeSelection(o).unsetAllMarks(), (r == null ? void 0 : r.type.name) !== "paragraph" && S.setParagraph(), S.run();
2415
+ }
2416
+ function v() {
2417
+ e.editor.chain().focus().setNodeSelection(o).run(), document.execCommand("copy");
2418
+ }
2419
+ function x() {
2420
+ e.editor.commands.setNodeSelection(o);
2421
+ const { $anchor: S } = e.editor.state.selection, Ne = S.node(1) || e.editor.state.selection.node;
2422
+ e.editor.chain().setMeta("hideDragHandle", !0).insertContentAt(o + ((r == null ? void 0 : r.nodeSize) || 0), Ne.toJSON()).run();
2423
+ }
2424
+ function A(S) {
2425
+ e.editor.commands.setTextAlign(S);
2426
+ }
2427
+ function _() {
2428
+ const S = St(e.editor.state.tr, o, 1);
2429
+ S.setMeta("hideDragHandle", !0), e.editor.view.dispatch && e.editor.view.dispatch(S);
2430
+ }
2431
+ function E() {
2432
+ const S = St(e.editor.state.tr, o, -1);
2433
+ e.editor.view.dispatch && e.editor.view.dispatch(S);
2434
+ }
2435
+ function b() {
2436
+ e.editor.chain().setMeta("hideDragHandle", !0).setNodeSelection(o).deleteSelection().run();
2437
+ }
2438
+ function y(S) {
2439
+ S.node && i(S.node), s(S.pos);
2440
+ }
2441
+ function T() {
2442
+ var S;
2443
+ if (o !== -1) {
2444
+ const Ne = (r == null ? void 0 : r.nodeSize) || 0, ht = o + Ne, mt = (r == null ? void 0 : r.type.name) === "paragraph" && ((S = r == null ? void 0 : r.content) == null ? void 0 : S.size) === 0, cr = mt ? o + 2 : ht + 2;
2445
+ e.editor.chain().command(({ dispatch: gt, tr: Ee, state: pt }) => gt ? (mt ? Ee.insertText("/", o, o + 1) : Ee.insert(
2446
+ ht,
2447
+ pt.schema.nodes.paragraph.create(null, [pt.schema.text("/")])
2448
+ ), gt(Ee)) : !0).focus(cr).run();
2449
+ }
2450
+ }
2451
+ R(() => (d ? e.editor.commands.setMeta("lockDragHandle", !0) : e.editor.commands.setMeta("lockDragHandle", !1), () => {
2452
+ e.editor.commands.setMeta("lockDragHandle", !1);
2453
+ }), [d]), R(() => () => {
2454
+ l.current && (e.editor.unregisterPlugin(t), l.current = null);
2455
+ }, []), R(() => {
2456
+ var S;
2457
+ (S = e.editor) != null && S.isDestroyed && l.current && (e.editor.unregisterPlugin(t), l.current = null);
2458
+ }, [(P = e.editor) == null ? void 0 : P.isDestroyed]);
2459
+ const w = (S) => {
2460
+ e != null && e.disabled || f(S);
2461
+ };
2462
+ return /* @__PURE__ */ a(
2463
+ "div",
2464
+ {
2465
+ ref: c,
2466
+ className: `drag-handle duration-200 ease-in-out [transition-property:top,_left] ${e == null ? void 0 : e.className}`,
2467
+ style: {
2468
+ opacity: e != null && e.disabled ? 0 : 1
2469
+ },
2470
+ children: /* @__PURE__ */ p("div", { className: "flex items-center gap-0.5 duration-200 ease-in-out [transition-property:top,_left]", children: [
2471
+ /* @__PURE__ */ a(
2472
+ Y,
2473
+ {
2474
+ className: "!size-7 cursor-grab",
2475
+ disabled: e == null ? void 0 : e.disabled,
2476
+ onClick: T,
2477
+ size: "icon",
2478
+ type: "button",
2479
+ variant: "ghost",
2480
+ children: /* @__PURE__ */ a(
2481
+ z,
2482
+ {
2483
+ className: "text-lg text-neutral-600 dark:text-neutral-200",
2484
+ name: "Plus"
2485
+ }
2486
+ )
2487
+ }
2488
+ ),
2489
+ /* @__PURE__ */ p(
2490
+ Rr,
2491
+ {
2492
+ onOpenChange: w,
2493
+ open: d,
2494
+ children: [
2495
+ /* @__PURE__ */ p("div", { className: "relative flex flex-col", children: [
2496
+ /* @__PURE__ */ p(Ir, { children: [
2497
+ /* @__PURE__ */ a(
2498
+ Dr,
2499
+ {
2500
+ asChild: !0,
2501
+ disabled: e == null ? void 0 : e.disabled,
2502
+ children: /* @__PURE__ */ a(
2503
+ Y,
2504
+ {
2505
+ className: "relative z-[1] !size-7 cursor-grab",
2506
+ disabled: e == null ? void 0 : e.disabled,
2507
+ size: "icon",
2508
+ type: "button",
2509
+ variant: "ghost",
2510
+ onMouseUp: (S) => {
2511
+ S.preventDefault(), !(e != null && e.disabled) && f(!0);
2512
+ },
2513
+ children: /* @__PURE__ */ a(
2514
+ z,
2515
+ {
2516
+ className: "text-sm text-neutral-600 dark:text-neutral-200",
2517
+ name: "Grip"
2518
+ }
2519
+ )
2520
+ }
2521
+ )
2522
+ }
2523
+ ),
2524
+ /* @__PURE__ */ a(Mr, { children: n("editor.draghandle.tooltip") })
2525
+ ] }),
2526
+ /* @__PURE__ */ a(Br, { className: "absolute left-0 top-0 z-0 size-[28px]" })
2527
+ ] }),
2528
+ /* @__PURE__ */ p(
2529
+ kr,
2530
+ {
2531
+ align: "start",
2532
+ className: "w-48",
2533
+ side: "bottom",
2534
+ sideOffset: 0,
2535
+ children: [
2536
+ /* @__PURE__ */ p(
2537
+ W,
2538
+ {
2539
+ className: "flex gap-3 bg-opacity-10 hover:bg-red-400 hover:bg-opacity-20 focus:bg-red-400 focus:bg-opacity-30 focus:text-red-500 dark:hover:bg-opacity-20 dark:hover:text-red-500",
2540
+ onClick: b,
2541
+ children: [
2542
+ /* @__PURE__ */ a(z, { name: "Trash2" }),
2543
+ /* @__PURE__ */ a("span", { children: n("editor.remove") })
2544
+ ]
2545
+ }
2546
+ ),
2547
+ m ? /* @__PURE__ */ p(
2548
+ W,
2549
+ {
2550
+ className: "flex gap-3",
2551
+ onClick: g,
2552
+ children: [
2553
+ /* @__PURE__ */ a(z, { name: "PaintRoller" }),
2554
+ /* @__PURE__ */ a("span", { children: n("editor.clear.tooltip") })
2555
+ ]
2556
+ }
2557
+ ) : null,
2558
+ /* @__PURE__ */ p(
2559
+ W,
2560
+ {
2561
+ className: "flex gap-3",
2562
+ onClick: v,
2563
+ children: [
2564
+ /* @__PURE__ */ a(z, { name: "Clipboard" }),
2565
+ /* @__PURE__ */ a("span", { children: n("editor.copyToClipboard") })
2566
+ ]
2567
+ }
2568
+ ),
2569
+ /* @__PURE__ */ p(
2570
+ W,
2571
+ {
2572
+ className: "flex gap-3",
2573
+ onClick: x,
2574
+ children: [
2575
+ /* @__PURE__ */ a(z, { name: "Copy" }),
2576
+ /* @__PURE__ */ a("span", { children: n("editor.copy") })
2577
+ ]
2578
+ }
2579
+ ),
2580
+ u || h ? /* @__PURE__ */ a(Lr, {}) : null,
2581
+ u ? /* @__PURE__ */ p(xt, { children: [
2582
+ /* @__PURE__ */ p(bt, { className: "flex gap-3", children: [
2583
+ /* @__PURE__ */ a(z, { name: "AlignCenter" }),
2584
+ /* @__PURE__ */ a("span", { children: n("editor.textalign.tooltip") })
2585
+ ] }),
2586
+ /* @__PURE__ */ a(Ct, { children: /* @__PURE__ */ p(Tt, { children: [
2587
+ /* @__PURE__ */ p(
2588
+ W,
2589
+ {
2590
+ className: "flex gap-3",
2591
+ onClick: () => A("left"),
2592
+ children: [
2593
+ /* @__PURE__ */ a(z, { name: "AlignLeft" }),
2594
+ /* @__PURE__ */ a("span", { children: n("editor.textalign.left.tooltip") })
2595
+ ]
2596
+ }
2597
+ ),
2598
+ /* @__PURE__ */ p(
2599
+ W,
2600
+ {
2601
+ className: "flex gap-3",
2602
+ onClick: () => A("center"),
2603
+ children: [
2604
+ /* @__PURE__ */ a(z, { name: "AlignCenter" }),
2605
+ /* @__PURE__ */ a("span", { children: n("editor.textalign.center.tooltip") })
2606
+ ]
2607
+ }
2608
+ ),
2609
+ /* @__PURE__ */ p(
2610
+ W,
2611
+ {
2612
+ className: "flex gap-3",
2613
+ onClick: () => A("right"),
2614
+ children: [
2615
+ /* @__PURE__ */ a(z, { name: "AlignRight" }),
2616
+ /* @__PURE__ */ a("span", { children: n("editor.textalign.right.tooltip") })
2617
+ ]
2618
+ }
2619
+ )
2620
+ ] }) })
2621
+ ] }) : null,
2622
+ h ? /* @__PURE__ */ p(xt, { children: [
2623
+ /* @__PURE__ */ p(bt, { className: "flex gap-3", children: [
2624
+ /* @__PURE__ */ a(z, { name: "IndentIncrease" }),
2625
+ /* @__PURE__ */ a("span", { children: n("editor.indent") })
2626
+ ] }),
2627
+ /* @__PURE__ */ a(Ct, { children: /* @__PURE__ */ p(Tt, { children: [
2628
+ /* @__PURE__ */ p(
2629
+ W,
2630
+ {
2631
+ className: "flex gap-3",
2632
+ disabled: ((B = r == null ? void 0 : r.attrs) == null ? void 0 : B.indent) >= At.max,
2633
+ onClick: _,
2634
+ children: [
2635
+ /* @__PURE__ */ a(z, { name: "IndentIncrease" }),
2636
+ /* @__PURE__ */ a("span", { children: n("editor.indent.tooltip") })
2637
+ ]
2638
+ }
2639
+ ),
2640
+ /* @__PURE__ */ p(
2641
+ W,
2642
+ {
2643
+ className: "flex gap-3",
2644
+ disabled: ((k = r == null ? void 0 : r.attrs) == null ? void 0 : k.indent) <= At.min,
2645
+ onClick: E,
2646
+ children: [
2647
+ /* @__PURE__ */ a(z, { name: "IndentDecrease" }),
2648
+ /* @__PURE__ */ a("span", { children: n("editor.outdent.tooltip") })
2649
+ ]
2650
+ }
2651
+ )
2652
+ ] }) })
2653
+ ] }) : null
2654
+ ]
2655
+ }
2656
+ )
2657
+ ]
2658
+ }
2659
+ )
2660
+ ] })
2661
+ }
2662
+ );
2663
+ }
2664
+ const sc = {
2665
+ maxWidth: "auto",
2666
+ zIndex: 20,
2667
+ moveTransition: "transform 0.1s ease-out"
2668
+ };
2669
+ function ir({ item: e, disabled: t, editor: n }) {
2670
+ var i;
2671
+ const r = e.component;
2672
+ return r ? /* @__PURE__ */ a(
2673
+ r,
2674
+ {
2675
+ ...e.componentProps,
2676
+ disabled: t || ((i = e == null ? void 0 : e.componentProps) == null ? void 0 : i.disabled),
2677
+ editor: n
2678
+ }
2679
+ ) : /* @__PURE__ */ a(N, {});
2680
+ }
2681
+ function lc(e) {
2682
+ const { t, lang: n } = D(), r = ({ editor: o }) => {
2683
+ const { selection: s } = o.view.state, { $from: c, to: l } = s;
2684
+ return c.pos === l ? !1 : s instanceof pn;
2685
+ }, i = F(() => e.disabled || !(e != null && e.editor) ? [] : tr(e.editor, t, e.items), [e.disabled, e.editor, e.items, n, t]);
2686
+ return /* @__PURE__ */ a(
2687
+ L,
2688
+ {
2689
+ editor: e == null ? void 0 : e.editor,
2690
+ shouldShow: r,
2691
+ tippyOptions: sc,
2692
+ children: i != null && i.length ? /* @__PURE__ */ a("div", { className: "pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800", children: /* @__PURE__ */ a("div", { className: "relative flex h-[26px] flex-nowrap items-center justify-start gap-[4px] whitespace-nowrap", children: i == null ? void 0 : i.map((o, s) => (o == null ? void 0 : o.type) === "divider" ? /* @__PURE__ */ a(
2693
+ U,
2694
+ {
2695
+ className: "!mx-1 !my-2 !h-[16px]",
2696
+ orientation: "vertical"
2697
+ },
2698
+ `bubbleMenu-divider-${s}`
2699
+ ) : /* @__PURE__ */ a(
2700
+ ir,
2701
+ {
2702
+ disabled: e.disabled,
2703
+ editor: e.editor,
2704
+ item: o
2705
+ },
2706
+ `bubbleMenu-text-${s}`
2707
+ )) }) }) : /* @__PURE__ */ a(N, {})
2708
+ }
2709
+ );
2710
+ }
2711
+ function ct({ children: e, vertical: t }) {
2712
+ return /* @__PURE__ */ a("div", { className: "pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800", children: /* @__PURE__ */ a(
2713
+ "div",
2714
+ {
2715
+ className: `relative flex h-[26px] flex-nowrap items-center justify-start gap-[4px] whitespace-nowrap ${t ? "h-max flex-col" : ""}`,
2716
+ children: e
2717
+ }
2718
+ ) });
2719
+ }
2720
+ function cc({ editor: e, disabled: t }) {
2721
+ var c, l, d, f, u, h;
2722
+ const { t: n } = D(), r = O(
2723
+ ({ view: m, state: g, from: v }) => !g || !v ? !1 : vn({ editor: e, view: m, state: g, from: v }),
2724
+ [e]
2725
+ );
2726
+ function i() {
2727
+ e.chain().focus().addRowBefore().run();
2728
+ }
2729
+ function o() {
2730
+ e.chain().focus().addRowAfter().run();
2731
+ }
2732
+ function s() {
2733
+ e.chain().focus().deleteRow().run();
2734
+ }
2735
+ return t ? null : /* @__PURE__ */ a(
2736
+ L,
2737
+ {
2738
+ editor: e,
2739
+ pluginKey: "tableRowMenu",
2740
+ shouldShow: r,
2741
+ updateDelay: 0,
2742
+ tippyOptions: {
2743
+ placement: "left",
2744
+ offset: [0, 15],
2745
+ popperOptions: {
2746
+ modifiers: [{ name: "flip", enabled: !1 }]
2747
+ }
2748
+ },
2749
+ children: /* @__PURE__ */ p(ct, { vertical: !0, children: [
2750
+ /* @__PURE__ */ a(
2751
+ C,
2752
+ {
2753
+ action: i,
2754
+ disabled: !((l = e == null ? void 0 : (c = e.can()).addRowBefore) != null && l.call(c)),
2755
+ icon: "BetweenVerticalEnd",
2756
+ tooltip: n("editor.table.menu.insertRowAbove"),
2757
+ "tooltip-options": {
2758
+ sideOffset: 15
2759
+ }
2760
+ }
2761
+ ),
2762
+ /* @__PURE__ */ a(
2763
+ C,
2764
+ {
2765
+ action: o,
2766
+ disabled: !((f = (d = e == null ? void 0 : e.can()) == null ? void 0 : d.addRowAfter) != null && f.call(d)),
2767
+ icon: "BetweenVerticalStart",
2768
+ tooltip: n("editor.table.menu.insertRowBelow"),
2769
+ "tooltip-options": {
2770
+ sideOffset: 15
2771
+ }
2772
+ }
2773
+ ),
2774
+ /* @__PURE__ */ a(
2775
+ C,
2776
+ {
2777
+ action: s,
2778
+ disabled: !((h = (u = e == null ? void 0 : e.can()) == null ? void 0 : u.deleteRow) != null && h.call(u)),
2779
+ icon: "DeleteRow",
2780
+ tooltip: n("editor.table.menu.deleteRow"),
2781
+ "tooltip-options": {
2782
+ sideOffset: 15
2783
+ }
2784
+ }
2785
+ )
2786
+ ] })
2787
+ }
2788
+ );
2789
+ }
2790
+ function dc({ editor: e, disabled: t }) {
2791
+ var c, l, d, f, u, h;
2792
+ const { t: n } = D(), r = O(
2793
+ ({ view: m, state: g, from: v }) => g ? yn({ editor: e, view: m, state: g, from: v || 0 }) : !1,
2794
+ [e]
2795
+ );
2796
+ function i() {
2797
+ e.chain().focus().addColumnBefore().run();
2798
+ }
2799
+ function o() {
2800
+ e.chain().focus().addColumnAfter().run();
2801
+ }
2802
+ function s() {
2803
+ e.chain().focus().deleteColumn().run();
2804
+ }
2805
+ return t ? null : /* @__PURE__ */ a(
2806
+ L,
2807
+ {
2808
+ editor: e,
2809
+ pluginKey: "tableColumnMenu",
2810
+ shouldShow: r,
2811
+ updateDelay: 0,
2812
+ tippyOptions: {
2813
+ offset: [0, 15],
2814
+ popperOptions: {
2815
+ modifiers: [{ name: "flip", enabled: !1 }]
2816
+ }
2817
+ },
2818
+ children: /* @__PURE__ */ p(ct, { children: [
2819
+ /* @__PURE__ */ a(
2820
+ C,
2821
+ {
2822
+ action: i,
2823
+ disabled: !((l = (c = e == null ? void 0 : e.can()) == null ? void 0 : c.addColumnBefore) != null && l.call(c)),
2824
+ icon: "BetweenHorizonalEnd",
2825
+ tooltip: n("editor.table.menu.insertColumnBefore"),
2826
+ "tooltip-options": {
2827
+ sideOffset: 15
2828
+ }
2829
+ }
2830
+ ),
2831
+ /* @__PURE__ */ a(
2832
+ C,
2833
+ {
2834
+ action: o,
2835
+ disabled: !((f = (d = e == null ? void 0 : e.can()) == null ? void 0 : d.addColumnAfter) != null && f.call(d)),
2836
+ icon: "BetweenHorizonalStart",
2837
+ tooltip: n("editor.table.menu.insertColumnAfter"),
2838
+ "tooltip-options": {
2839
+ sideOffset: 15
2840
+ }
2841
+ }
2842
+ ),
2843
+ /* @__PURE__ */ a(
2844
+ C,
2845
+ {
2846
+ action: s,
2847
+ disabled: !((h = e == null ? void 0 : (u = e.can()).deleteColumn) != null && h.call(u)),
2848
+ icon: "DeleteColumn",
2849
+ tooltip: n("editor.table.menu.deleteColumn"),
2850
+ "tooltip-options": {
2851
+ sideOffset: 15
2852
+ }
2853
+ }
2854
+ )
2855
+ ] })
2856
+ }
2857
+ );
2858
+ }
2859
+ function uc({ editor: e, disabled: t, actions: n, ...r }) {
2860
+ var v, x, A, _, E, b;
2861
+ const i = ({ editor: y, view: T, state: w, from: P }) => {
2862
+ const { selection: B } = y.view.state, { $from: k, to: S } = B;
2863
+ return k.pos === S || !w || !P ? !1 : B instanceof pn || vn({ editor: y, view: T, state: w, from: P }) || yn({ editor: y, view: T, state: w, from: P });
2864
+ }, o = ({ editor: y }) => Fr(y.view.state, "table"), s = (y) => o(y) && !i(y), { t: c, lang: l } = D();
2865
+ function d() {
2866
+ e.chain().focus().mergeCells().run();
2867
+ }
2868
+ function f() {
2869
+ e == null || e.chain().focus().splitCell().run();
2870
+ }
2871
+ function u() {
2872
+ e.chain().focus().deleteTable().run();
2873
+ }
2874
+ function h(y) {
2875
+ e.chain().focus().setTableCellBackground(y).run();
2876
+ }
2877
+ const m = () => {
2878
+ var k;
2879
+ const {
2880
+ view: y,
2881
+ state: {
2882
+ selection: { from: T }
2883
+ }
2884
+ } = e, w = y.domAtPos(T).node;
2885
+ if (!w)
2886
+ return new DOMRect(-1e3, -1e3, 0, 0);
2887
+ const P = (k = w == null ? void 0 : w.closest) == null ? void 0 : k.call(w, ".tableWrapper");
2888
+ return P ? P.getBoundingClientRect() : new DOMRect(-1e3, -1e3, 0, 0);
2889
+ }, g = F(() => t || !e ? [] : tr(e, c, r.items || []), [t, e, r.items, l, c]);
2890
+ return t ? null : /* @__PURE__ */ a(
2891
+ L,
2892
+ {
2893
+ editor: e,
2894
+ pluginKey: "table",
2895
+ shouldShow: s,
2896
+ updateDelay: 0,
2897
+ tippyOptions: {
2898
+ offset: [0, 15],
2899
+ popperOptions: {
2900
+ modifiers: [{ name: "flip", enabled: !1 }]
2901
+ },
2902
+ maxWidth: "auto",
2903
+ getReferenceClientRect: m,
2904
+ plugins: [ui],
2905
+ sticky: "popper"
2906
+ },
2907
+ children: /* @__PURE__ */ p(ct, { children: [
2908
+ n && /* @__PURE__ */ p(N, { children: [
2909
+ n.map((y, T) => /* @__PURE__ */ a(C, { ...y }, T)),
2910
+ /* @__PURE__ */ a(
2911
+ U,
2912
+ {
2913
+ className: "!mx-1 !my-2 !h-[16px]",
2914
+ orientation: "vertical"
2915
+ }
2916
+ )
2917
+ ] }),
2918
+ r.items && /* @__PURE__ */ p(N, { children: [
2919
+ g.map((y, T) => /* @__PURE__ */ a(
2920
+ ir,
2921
+ {
2922
+ disabled: t,
2923
+ editor: e,
2924
+ item: y
2925
+ },
2926
+ T
2927
+ )),
2928
+ /* @__PURE__ */ a(
2929
+ U,
2930
+ {
2931
+ className: "!mx-1 !my-2 !h-[16px]",
2932
+ orientation: "vertical"
2933
+ }
2934
+ )
2935
+ ] }),
2936
+ /* @__PURE__ */ a(
2937
+ C,
2938
+ {
2939
+ action: d,
2940
+ disabled: !((x = (v = e == null ? void 0 : e.can()) == null ? void 0 : v.mergeCells) != null && x.call(v)),
2941
+ icon: "TableCellsMerge",
2942
+ tooltip: c("editor.table.menu.mergeCells"),
2943
+ "tooltip-options": {
2944
+ sideOffset: 15
2945
+ }
2946
+ }
2947
+ ),
2948
+ /* @__PURE__ */ a(
2949
+ C,
2950
+ {
2951
+ action: f,
2952
+ disabled: !((_ = (A = e == null ? void 0 : e.can()) == null ? void 0 : A.splitCell) != null && _.call(A)),
2953
+ icon: "TableCellsSplit",
2954
+ tooltip: c("editor.table.menu.splitCells"),
2955
+ "tooltip-options": {
2956
+ sideOffset: 15
2957
+ }
2958
+ }
2959
+ ),
2960
+ /* @__PURE__ */ a(U, { className: "!mx-1 !my-2 !h-[16px]", orientation: "vertical" }),
2961
+ /* @__PURE__ */ a(
2962
+ zr,
2963
+ {
2964
+ action: h,
2965
+ editor: e,
2966
+ tooltip: c("editor.table.menu.setCellsBgColor"),
2967
+ tooltipOptions: {
2968
+ sideOffset: 15
2969
+ }
2970
+ }
2971
+ ),
2972
+ /* @__PURE__ */ a(
2973
+ C,
2974
+ {
2975
+ action: u,
2976
+ disabled: !((b = (E = e == null ? void 0 : e.can()) == null ? void 0 : E.deleteTable) != null && b.call(E)),
2977
+ icon: "Trash2",
2978
+ tooltip: c("editor.table.menu.deleteTable"),
2979
+ "tooltip-options": {
2980
+ sideOffset: 15
2981
+ }
2982
+ }
2983
+ )
2984
+ ] })
2985
+ }
2986
+ );
2987
+ }
2988
+ function fc(e) {
2989
+ return /* @__PURE__ */ p(N, { children: [
2990
+ /* @__PURE__ */ a(uc, { ...e }),
2991
+ /* @__PURE__ */ a(cc, { ...e }),
2992
+ /* @__PURE__ */ a(dc, { ...e })
2993
+ ] });
2994
+ }
2995
+ function hc(e) {
2996
+ const { t } = D();
2997
+ return /* @__PURE__ */ p("div", { className: "flex items-center gap-2 p-2 bg-white !border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800", children: [
2998
+ /* @__PURE__ */ a(
2999
+ "a",
3000
+ {
3001
+ href: e == null ? void 0 : e.link,
3002
+ target: "_blank",
3003
+ rel: "noopener noreferrer",
3004
+ className: "text-sm underline break-all",
3005
+ children: Tl(e == null ? void 0 : e.link, {
3006
+ length: 50,
3007
+ omission: "…"
3008
+ })
3009
+ }
3010
+ ),
3011
+ (e == null ? void 0 : e.link) && /* @__PURE__ */ a(U, { orientation: "vertical", className: "!h-4" }),
3012
+ /* @__PURE__ */ p("div", { className: "flex flex-nowrap", children: [
3013
+ /* @__PURE__ */ a(
3014
+ C,
3015
+ {
3016
+ icon: "Pencil",
3017
+ tooltip: t("editor.link.edit.tooltip"),
3018
+ action: () => {
3019
+ e == null || e.onEdit();
3020
+ },
3021
+ tooltipOptions: { sideOffset: 15 }
3022
+ }
3023
+ ),
3024
+ /* @__PURE__ */ a(
3025
+ C,
3026
+ {
3027
+ icon: "Unlink",
3028
+ tooltip: t("editor.link.unlink.tooltip"),
3029
+ action: () => {
3030
+ e == null || e.onClear();
3031
+ },
3032
+ tooltipOptions: { sideOffset: 15 }
3033
+ }
3034
+ )
3035
+ ] })
3036
+ ] });
3037
+ }
3038
+ function mc({ editor: e, disabled: t }) {
3039
+ const [n, r] = I(!1), i = F(() => {
3040
+ const { href: l } = e.getAttributes("link");
3041
+ return l;
3042
+ }, [e]), o = O(({ editor: l }) => l.isActive("link"), []), s = (l, d, f) => {
3043
+ e.chain().extendMarkRange("link").insertContent({
3044
+ type: "text",
3045
+ text: d,
3046
+ marks: [
3047
+ {
3048
+ type: "link",
3049
+ attrs: {
3050
+ href: l,
3051
+ target: f ? "_blank" : ""
3052
+ }
3053
+ }
3054
+ ]
3055
+ }).setLink({ href: l }).focus().run(), r(!1);
3056
+ }, c = O(() => {
3057
+ e.chain().extendMarkRange("link").unsetLink().focus().run(), r(!1);
3058
+ }, [e]);
3059
+ return /* @__PURE__ */ a(N, { children: /* @__PURE__ */ a(
3060
+ L,
3061
+ {
3062
+ editor: e,
3063
+ shouldShow: o,
3064
+ tippyOptions: {
3065
+ popperOptions: {
3066
+ modifiers: [{ name: "flip", enabled: !1 }]
3067
+ },
3068
+ placement: "bottom-start",
3069
+ offset: [-2, 16],
3070
+ zIndex: 9999,
3071
+ onHidden: () => {
3072
+ r(!1);
3073
+ }
3074
+ },
3075
+ children: t ? /* @__PURE__ */ a(N, {}) : /* @__PURE__ */ a(N, { children: n ? /* @__PURE__ */ a(jr, { onSetLink: s, editor: e }) : /* @__PURE__ */ a(
3076
+ hc,
3077
+ {
3078
+ editor: e,
3079
+ onClear: c,
3080
+ onEdit: () => {
3081
+ r(!0);
3082
+ },
3083
+ link: i
3084
+ }
3085
+ ) })
3086
+ }
3087
+ ) });
3088
+ }
3089
+ const dt = {
3090
+ maxWidth: "auto",
3091
+ zIndex: 20,
3092
+ appendTo: "parent",
3093
+ moveTransition: "transform 0.1s ease-out"
3094
+ };
3095
+ function ut({ item: e, disabled: t, editor: n }) {
3096
+ var i;
3097
+ const r = e.component;
3098
+ return r ? /* @__PURE__ */ a(Ve, { children: e.type === "divider" ? /* @__PURE__ */ a(
3099
+ U,
3100
+ {
3101
+ className: "!mx-1 !my-2 !h-[16px]",
3102
+ orientation: "vertical"
3103
+ }
3104
+ ) : /* @__PURE__ */ a(
3105
+ r,
3106
+ {
3107
+ ...e.componentProps,
3108
+ disabled: t || ((i = e == null ? void 0 : e.componentProps) == null ? void 0 : i.disabled),
3109
+ editor: n
3110
+ }
3111
+ ) }) : /* @__PURE__ */ a(N, {});
3112
+ }
3113
+ function gc(e) {
3114
+ return e.type.name === hn.name;
3115
+ }
3116
+ function pc(e) {
3117
+ return e.type.name === mn.name;
3118
+ }
3119
+ function vc(e) {
3120
+ return e.type.name === Hr.name;
3121
+ }
3122
+ function yc(e) {
3123
+ const { lang: t } = D(), n = ({ editor: i }) => {
3124
+ const { selection: o } = i.view.state, { $from: s, to: c } = o;
3125
+ let l = !1;
3126
+ return i.view.state.doc.nodesBetween(s.pos, c, (d) => {
3127
+ if (gc(d))
3128
+ return l = !0, !1;
3129
+ }), l;
3130
+ }, r = F(() => e.disabled ? [] : Jl(e.editor), [e.disabled, e.editor, t]);
3131
+ return /* @__PURE__ */ a(N, { children: /* @__PURE__ */ a(
3132
+ L,
3133
+ {
3134
+ editor: e == null ? void 0 : e.editor,
3135
+ shouldShow: n,
3136
+ tippyOptions: dt,
3137
+ children: r != null && r.length ? /* @__PURE__ */ a("div", { className: "pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800", children: /* @__PURE__ */ a("div", { className: "relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap", children: r == null ? void 0 : r.map((i, o) => /* @__PURE__ */ a(
3138
+ ut,
3139
+ {
3140
+ disabled: e.disabled,
3141
+ editor: e.editor,
3142
+ item: i
3143
+ },
3144
+ `bubbleMenu-image-${o}`
3145
+ )) }) }) : /* @__PURE__ */ a(N, {})
3146
+ }
3147
+ ) });
3148
+ }
3149
+ function wc(e) {
3150
+ const { lang: t } = D(), n = ({ editor: i }) => {
3151
+ const { selection: o } = i.view.state, { $from: s, to: c } = o;
3152
+ let l = !1;
3153
+ return i.view.state.doc.nodesBetween(s.pos, c, (d) => {
3154
+ if (pc(d))
3155
+ return l = !0, !1;
3156
+ }), l;
3157
+ }, r = F(() => e.disabled ? [] : Zl(e.editor), [e.disabled, e.editor, t]);
3158
+ return /* @__PURE__ */ a(N, { children: /* @__PURE__ */ a(
3159
+ L,
3160
+ {
3161
+ editor: e == null ? void 0 : e.editor,
3162
+ shouldShow: n,
3163
+ tippyOptions: dt,
3164
+ children: r != null && r.length ? /* @__PURE__ */ a("div", { className: "pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800", children: /* @__PURE__ */ a("div", { className: "relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap", children: r == null ? void 0 : r.map((i, o) => /* @__PURE__ */ a(
3165
+ ut,
3166
+ {
3167
+ disabled: e.disabled,
3168
+ editor: e.editor,
3169
+ item: i
3170
+ },
3171
+ `bubbleMenu-image-gif-${o}`
3172
+ )) }) }) : /* @__PURE__ */ a(N, {})
3173
+ }
3174
+ ) });
3175
+ }
3176
+ function xc(e) {
3177
+ const { lang: t } = D(), n = ({ editor: i }) => {
3178
+ const { selection: o } = i.view.state, { $from: s, to: c } = o;
3179
+ let l = !1;
3180
+ return i.view.state.doc.nodesBetween(s.pos, c, (d) => {
3181
+ if (vc(d))
3182
+ return l = !0, !1;
3183
+ }), l;
3184
+ }, r = F(() => e.disabled ? [] : tc(e.editor), [e.editor, e.disabled, t]);
3185
+ return /* @__PURE__ */ a(N, { children: /* @__PURE__ */ a(
3186
+ L,
3187
+ {
3188
+ editor: e == null ? void 0 : e.editor,
3189
+ shouldShow: n,
3190
+ tippyOptions: dt,
3191
+ children: r != null && r.length ? /* @__PURE__ */ a("div", { className: "pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800", children: /* @__PURE__ */ a("div", { className: "relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap", children: r == null ? void 0 : r.map((i, o) => /* @__PURE__ */ a(
3192
+ ut,
3193
+ {
3194
+ disabled: e.disabled,
3195
+ editor: e.editor,
3196
+ item: i
3197
+ },
3198
+ `bubbleMenu-video-${o}`
3199
+ )) }) }) : /* @__PURE__ */ a(N, {})
3200
+ }
3201
+ ) });
3202
+ }
3203
+ function bc({ editor: e }) {
3204
+ const { t } = D(), n = O(() => e.isActive(Pt.name), [e]), r = O(() => Ae(Pt.name, e), [e]), i = O(() => e.chain().focus().addColBefore().run(), [e]), o = O(() => e.chain().focus().addColAfter().run(), [e]), s = O(() => e.chain().focus().deleteCol().run(), [e]);
3205
+ return /* @__PURE__ */ a(
3206
+ L,
3207
+ {
3208
+ pluginKey: "columns-bubble-menu",
3209
+ editor: e,
3210
+ shouldShow: n,
3211
+ tippyOptions: {
3212
+ popperOptions: {
3213
+ modifiers: [{ name: "flip", enabled: !1 }]
3214
+ },
3215
+ placement: "bottom-start",
3216
+ offset: [-2, 16],
3217
+ zIndex: 9999
3218
+ // onHidden: () => {
3219
+ // toggleVisible(false)
3220
+ // },
3221
+ },
3222
+ children: /* @__PURE__ */ p("div", { className: "w-auto px-3 py-2 transition-all !border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-background", children: [
3223
+ /* @__PURE__ */ a(
3224
+ C,
3225
+ {
3226
+ action: i,
3227
+ icon: "ColumnAddLeft",
3228
+ tooltip: t("editor.table.menu.insertColumnBefore")
3229
+ }
3230
+ ),
3231
+ /* @__PURE__ */ a(
3232
+ C,
3233
+ {
3234
+ action: o,
3235
+ icon: "ColumnAddRight",
3236
+ tooltip: t("editor.table.menu.insertColumnAfter")
3237
+ }
3238
+ ),
3239
+ /* @__PURE__ */ a(
3240
+ C,
3241
+ {
3242
+ action: s,
3243
+ icon: "DeleteColumn",
3244
+ tooltip: t("editor.table.menu.deleteColumn")
3245
+ }
3246
+ ),
3247
+ /* @__PURE__ */ a(
3248
+ C,
3249
+ {
3250
+ action: r,
3251
+ icon: "Trash2",
3252
+ tooltip: t("editor.table.menu.delete_column")
3253
+ }
3254
+ )
3255
+ ] })
3256
+ }
3257
+ );
3258
+ }
3259
+ function Cc({ editor: e, extensions: t }) {
3260
+ const { t: n } = D(), r = F(() => {
3261
+ var i, o, s;
3262
+ return (s = (o = (i = t == null ? void 0 : t.find((c) => c.name === "base-kit")) == null ? void 0 : i.options) == null ? void 0 : o.characterCount) == null ? void 0 : s.limit;
3263
+ }, [t]);
3264
+ return r ? /* @__PURE__ */ a("div", { className: "flex items-center justify-between p-3 border-t", children: /* @__PURE__ */ a("div", { className: "flex flex-col", children: /* @__PURE__ */ a("div", { className: "flex justify-end gap-3 text-sm", children: /* @__PURE__ */ p("span", { children: [
3265
+ e.storage.characterCount.characters(),
3266
+ "/",
3267
+ r,
3268
+ " ",
3269
+ n("editor.characters")
3270
+ ] }) }) }) }) : /* @__PURE__ */ a("div", { className: "flex items-center justify-between p-3 border-t", children: /* @__PURE__ */ a("div", { className: "flex flex-col", children: /* @__PURE__ */ a("div", { className: "flex justify-end gap-3 text-sm", children: /* @__PURE__ */ p("span", { children: [
3271
+ e.storage.characterCount.characters(),
3272
+ " ",
3273
+ n("editor.characters")
3274
+ ] }) }) }) });
3275
+ }
3276
+ function Tc() {
3277
+ const { toasts: e } = Ur();
3278
+ return /* @__PURE__ */ p(Al, { children: [
3279
+ e.map(({ id: t, title: n, description: r, action: i, ...o }) => /* @__PURE__ */ p(
3280
+ Yn,
3281
+ {
3282
+ ...o,
3283
+ children: [
3284
+ /* @__PURE__ */ p("div", { className: "grid gap-1", children: [
3285
+ n && /* @__PURE__ */ a(Zn, { children: n }),
3286
+ r && /* @__PURE__ */ a(Qn, { children: r })
3287
+ ] }),
3288
+ i,
3289
+ /* @__PURE__ */ a(Jn, {})
3290
+ ]
3291
+ },
3292
+ t
3293
+ )),
3294
+ /* @__PURE__ */ a(qn, {})
3295
+ ] });
3296
+ }
3297
+ const Ac = `
3298
+ .reactjs-tiptap-editor,
3299
+ .dialog-content {
3300
+ button,
3301
+ input:where([type=button]),
3302
+ input:where([type=reset]),
3303
+ input:where([type=submit]) {
3304
+ -webkit-appearance: button;
3305
+ background-color: transparent;
3306
+ background-image: none;
3307
+ }
3308
+
3309
+ input,
3310
+ optgroup,
3311
+ select,
3312
+ textarea {
3313
+ font-family: inherit;
3314
+ font-feature-settings: inherit;
3315
+ font-variation-settings: inherit;
3316
+ font-size: 100%;
3317
+ font-weight: inherit;
3318
+ line-height: inherit;
3319
+ letter-spacing: inherit;
3320
+ color: inherit;
3321
+ }
3322
+
3323
+ button {
3324
+ font-family: inherit;
3325
+ font-feature-settings: inherit;
3326
+ font-variation-settings: inherit;
3327
+ font-size: 100%;
3328
+ font-weight: inherit;
3329
+ line-height: inherit;
3330
+ letter-spacing: inherit;
3331
+ color: inherit;
3332
+ }
3333
+
3334
+ *,
3335
+ ::before,
3336
+ ::after {
3337
+ box-sizing: border-box;
3338
+ border-width: 0;
3339
+ border-style: solid;
3340
+ border-color: hsl(var(--border));
3341
+ }
3342
+
3343
+ background-color: hsl(var(--background));
3344
+ color: hsl(var(--foreground));
3345
+
3346
+ hr {
3347
+ height: 0;
3348
+ color: inherit;
3349
+ border-top-width: 1px;
3350
+ }
3351
+
3352
+ a {
3353
+ color: inherit;
3354
+ text-decoration: inherit;
3355
+ }
3356
+
3357
+ b,
3358
+ strong {
3359
+ font-weight: bolder;
3360
+ }
3361
+
3362
+ code,
3363
+ kbd,
3364
+ samp,
3365
+ pre {
3366
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
3367
+ font-feature-settings: normal;
3368
+ font-variation-settings: normal;
3369
+ font-size: 1em;
3370
+ }
3371
+
3372
+ table {
3373
+ text-indent: 0;
3374
+ border-color: inherit;
3375
+ border-collapse: collapse;
3376
+ }
3377
+
3378
+ input, textarea {
3379
+ border-width: 1px;
3380
+ }
3381
+
3382
+ textarea {
3383
+ resize: vertical;
3384
+ }
3385
+
3386
+ input::placeholder,
3387
+ textarea::placeholder {
3388
+ opacity: 1;
3389
+ color: #9ca3af;
3390
+ }
3391
+
3392
+ button, input, textarea {
3393
+ cursor: pointer;
3394
+ color: inherit;
3395
+ }
3396
+
3397
+ img,
3398
+ svg,
3399
+ video,
3400
+ canvas,
3401
+ audio,
3402
+ iframe,
3403
+ embed,
3404
+ object {
3405
+ display: block;
3406
+ vertical-align: middle;
3407
+ }
3408
+
3409
+ img,
3410
+ video {
3411
+ max-width: 100%;
3412
+ height: auto;
3413
+ }
3414
+ }
3415
+
3416
+ div[data-radix-popper-content-wrapper],
3417
+ div[data-tippy-root] {
3418
+ *,
3419
+ ::before,
3420
+ ::after {
3421
+ box-sizing: border-box;
3422
+ border-width: 0;
3423
+ border-style: solid;
3424
+ border-color: hsl(var(--border));
3425
+ }
3426
+
3427
+ background-color: hsl(var(--background));
3428
+ color: hsl(var(--foreground));
3429
+
3430
+ button, input, textarea {
3431
+ cursor: pointer;
3432
+ color: inherit;
3433
+ }
3434
+ }
3435
+ `, Sc = fr(({ children: e, id: t }) => {
3436
+ const [, n] = Vr((s) => s.value), [, r] = Kr((s) => s.value), i = (s) => {
3437
+ n({
3438
+ value: s.detail
3439
+ });
3440
+ }, o = (s) => {
3441
+ r({
3442
+ value: s.detail
3443
+ });
3444
+ };
3445
+ return R(() => {
3446
+ const s = _t(Nt.EDIT(t), i), c = _t(Nt.UPDATE_THEME(t), o);
3447
+ return () => {
3448
+ s(), c();
3449
+ };
3450
+ }, []), /* @__PURE__ */ a(N, { children: e });
3451
+ });
3452
+ function Pc({ children: e, id: t }) {
3453
+ return /* @__PURE__ */ a(Gr, { children: /* @__PURE__ */ a(Wr, { children: /* @__PURE__ */ a(Sc, { id: t, children: e }) }) });
3454
+ }
3455
+ const sn = "data-rc-order", ln = "data-rc-priority", _c = "rc-util-key", We = /* @__PURE__ */ new Map();
3456
+ function Nc(e, t) {
3457
+ if (!e)
3458
+ return !1;
3459
+ if (e.contains)
3460
+ return e.contains(t);
3461
+ let n = t;
3462
+ for (; n; ) {
3463
+ if (n === e)
3464
+ return !0;
3465
+ n = n.parentNode;
3466
+ }
3467
+ return !1;
3468
+ }
3469
+ function or({ mark: e } = {}) {
3470
+ return e ? e.startsWith("data-") ? e : `data-${e}` : _c;
3471
+ }
3472
+ function ft(e) {
3473
+ return e.attachTo ? e.attachTo : document.querySelector("head") || document.body;
3474
+ }
3475
+ function Ec(e) {
3476
+ return e === "queue" ? "prependQueue" : e ? "prepend" : "append";
3477
+ }
3478
+ function ar(e) {
3479
+ return [...(We.get(e) || e).children].filter(
3480
+ (t) => t.tagName === "STYLE"
3481
+ );
3482
+ }
3483
+ function sr(e, t = {}) {
3484
+ const { csp: n, prepend: r, priority: i = 0 } = t, o = Ec(r), s = o === "prependQueue", c = document.createElement("style");
3485
+ c.setAttribute(sn, o), s && i && c.setAttribute(ln, `${i}`), n != null && n.nonce && (c.nonce = n == null ? void 0 : n.nonce), c.innerHTML = e;
3486
+ const l = ft(t), { firstChild: d } = l;
3487
+ if (r) {
3488
+ if (s) {
3489
+ const f = ar(l).filter((u) => {
3490
+ if (!["prepend", "prependQueue"].includes(u.getAttribute(sn)))
3491
+ return !1;
3492
+ const h = Number(u.getAttribute(ln) || 0);
3493
+ return i >= h;
3494
+ });
3495
+ if (f.length > 0)
3496
+ return l.insertBefore(c, f.at(-1).nextSibling), c;
3497
+ }
3498
+ d.before(c);
3499
+ } else
3500
+ l.append(c);
3501
+ return c;
3502
+ }
3503
+ function lr(e, t = {}) {
3504
+ const n = ft(t);
3505
+ return ar(n).find((r) => r.getAttribute(or(t)) === e);
3506
+ }
3507
+ function $c(e, t = {}) {
3508
+ const n = lr(e, t);
3509
+ n && n.remove();
3510
+ }
3511
+ function Oc(e, t) {
3512
+ const n = We.get(e);
3513
+ if (!n || !Nc(document, n)) {
3514
+ const r = sr("", t), { parentNode: i } = r;
3515
+ We.set(e, i), r.remove();
3516
+ }
3517
+ }
3518
+ function Rc(e, t, n = {}) {
3519
+ var s, c, l;
3520
+ const r = ft(n);
3521
+ Oc(r, n);
3522
+ const i = lr(t, n);
3523
+ if (i)
3524
+ return (s = n.csp) != null && s.nonce && i.nonce !== ((c = n.csp) == null ? void 0 : c.nonce) && (i.nonce = (l = n.csp) == null ? void 0 : l.nonce), i.innerHTML !== e && (i.innerHTML = e), i;
3525
+ const o = sr(e, n);
3526
+ return o.setAttribute(or(n), t), o;
3527
+ }
3528
+ function Ic(e, t) {
3529
+ const { content: n, extensions: r, useEditorOptions: i = {} } = e, o = mr(), s = F(() => {
3530
+ const u = nl(r, r, "name");
3531
+ return [...r.map((m) => {
3532
+ const g = r.find((v) => v.name === m.name);
3533
+ return g ? m.configure(g.options) : m;
3534
+ }), ...u].map((m, g) => m.configure({ sort: g }));
3535
+ }, [r]), c = Xr((u) => {
3536
+ var m;
3537
+ const h = d(u, e.output);
3538
+ (m = e == null ? void 0 : e.onChangeContent) == null || m.call(e, h);
3539
+ }, ni), l = qr({
3540
+ extensions: s,
3541
+ content: n,
3542
+ onUpdate: ({ editor: u }) => {
3543
+ c && c(u);
3544
+ },
3545
+ ...i
3546
+ });
3547
+ gr(t, () => ({
3548
+ editor: l
3549
+ })), R(() => {
3550
+ document.documentElement.classList.toggle("dark", e.dark), Yr.setTheme(o, e.dark ? "dark" : "light");
3551
+ }, [e.dark]), R(() => {
3552
+ l == null || l.setEditable(!(e != null && e.disabled)), Jr.setDisable(o, !(e != null && e.disabled));
3553
+ }, [l, e == null ? void 0 : e.disabled]), R(() => ((e == null ? void 0 : e.resetCSS) !== !1 && Rc(Ac, "react-tiptap-reset"), () => {
3554
+ $c("react-tiptap-reset");
3555
+ }), [e == null ? void 0 : e.resetCSS]);
3556
+ function d(u, h) {
3557
+ return e != null && e.removeDefaultWrapper ? h === "html" ? u.isEmpty ? "" : u.getHTML() : h === "json" ? u.isEmpty ? {} : u.getJSON() : h === "text" ? u.isEmpty ? "" : u.getText() : "" : h === "html" ? u.getHTML() : h === "json" ? u.getJSON() : h === "text" ? u.getText() : "";
3558
+ }
3559
+ pr(() => {
3560
+ l && (l.id = o);
3561
+ }, [o, l]), R(() => () => {
3562
+ var u;
3563
+ (u = l == null ? void 0 : l.destroy) == null || u.call(l);
3564
+ }, []);
3565
+ const f = Zr(l, "characterCount");
3566
+ return l ? /* @__PURE__ */ p("div", { className: "reactjs-tiptap-editor", children: [
3567
+ /* @__PURE__ */ a(
3568
+ Pc,
3569
+ {
3570
+ id: o,
3571
+ children: /* @__PURE__ */ a(
3572
+ Qr,
3573
+ {
3574
+ delayDuration: 0,
3575
+ disableHoverableContent: !0,
3576
+ children: /* @__PURE__ */ a("div", { className: "overflow-hidden rounded-[0.5rem] bg-background", children: /* @__PURE__ */ p("div", { className: "flex max-h-full w-full flex-col", children: [
3577
+ !(e != null && e.hideToolbar) && /* @__PURE__ */ a(
3578
+ Ul,
3579
+ {
3580
+ disabled: !!(e != null && e.disabled),
3581
+ editor: l,
3582
+ toolbar: e.toolbar
3583
+ }
3584
+ ),
3585
+ /* @__PURE__ */ a(
3586
+ ei,
3587
+ {
3588
+ className: `relative ${(e == null ? void 0 : e.contentClass) || ""}`,
3589
+ editor: l
3590
+ }
3591
+ ),
3592
+ f && /* @__PURE__ */ a(
3593
+ Cc,
3594
+ {
3595
+ editor: l,
3596
+ extensions: r
3597
+ }
3598
+ ),
3599
+ !(e != null && e.hideBubble) && /* @__PURE__ */ a(
3600
+ Hl,
3601
+ {
3602
+ bubbleMenu: e == null ? void 0 : e.bubbleMenu,
3603
+ disabled: e == null ? void 0 : e.disabled,
3604
+ editor: l
3605
+ }
3606
+ )
3607
+ ] }) })
3608
+ }
3609
+ )
3610
+ }
3611
+ ),
3612
+ /* @__PURE__ */ a(Tc, {})
3613
+ ] }) : /* @__PURE__ */ a(N, {});
3614
+ }
3615
+ const Wc = hr(Ic);
12
3616
  export {
13
- x as BubbleMenu,
14
- m as default,
15
- c as useEditorState
3617
+ L as BubbleMenu,
3618
+ Wc as default,
3619
+ Gc as useEditorState
16
3620
  };