reactjs-tiptap-editor-pro 0.2.32 → 0.2.33

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