@opentiny/tiny-robot 0.5.2-beta.0 → 0.5.2-rc.0

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.
@@ -1,68 +1,992 @@
1
- import { defineComponent as G, openBlock as w, createBlock as V, unref as A, withCtx as B, createTextVNode as ot, toDisplayString as ee, ref as W, watch as K, createElementBlock as P, Fragment as fe, renderList as pe, withModifiers as ye, normalizeClass as z, createCommentVNode as N, createElementVNode as R, nextTick as te, isRef as ce, Transition as st, normalizeStyle as rt, createVNode as X, toRaw as it, computed as M, onMounted as at, onUnmounted as lt, Teleport as ct, toRef as de, onBeforeUnmount as ut, shallowReactive as dt, toValue as ft, provide as pt, renderSlot as O, createSlots as me, normalizeProps as ne, guardReactiveProps as oe } from "vue";
2
- import { a as mt, u as ue, W as Ke, D as qe } from "../index2.js";
3
- import { NodeViewWrapper as Ee, VueRenderer as Ne, VueNodeViewRenderer as _e, NodeViewContent as ht, useEditor as gt, EditorContent as xt } from "@tiptap/vue-3";
4
- import bt from "@tiptap/extension-document";
5
- import yt from "@tiptap/extension-paragraph";
6
- import Tt from "@tiptap/extension-text";
7
- import vt from "@tiptap/extension-history";
8
- import Et from "@tiptap/extension-placeholder";
9
- import _t from "@tiptap/extension-character-count";
10
- import { h as St, j as Ct, p as At } from "../index4.js";
11
- import { PluginKey as Z, Plugin as Y, TextSelection as D } from "@tiptap/pm/state";
12
- import { DecorationSet as le, Decoration as He } from "@tiptap/pm/view";
13
- import { a as Se, c as Ce, o as Ae, f as we, s as ke } from "../floating-ui.dom.js";
14
- import { _ as U } from "../_plugin-vue_export-helper.js";
15
- import { IconAssociate as wt, IconArrowDown as kt } from "@opentiny/tiny-robot-svgs";
16
- import { s as Lt } from "../useSenderContentRegistration.js";
17
- import { Node as Le, mergeAttributes as Me, Extension as We } from "@tiptap/core";
18
- import { u as Mt } from "../useTeleportTarget.js";
19
- const Pt = /* @__PURE__ */ G({
1
+ import { defineComponent as Z, openBlock as M, createBlock as U, unref as k, withCtx as j, createTextVNode as ln, toDisplayString as pe, ref as F, watch as K, createElementBlock as P, Fragment as Ie, renderList as Be, withModifiers as nt, normalizeClass as Q, createCommentVNode as q, createElementVNode as B, nextTick as me, isRef as ke, Transition as an, normalizeStyle as cn, createVNode as se, toRaw as un, computed as R, onMounted as dn, onUnmounted as fn, Teleport as pn, toRef as De, onBeforeUnmount as mn, shallowReactive as hn, toValue as gn, provide as xn, renderSlot as D, createSlots as $e, normalizeProps as he, guardReactiveProps as ge } from "vue";
2
+ import { a as yn, u as Pe, W as Rt, D as Pt } from "../index2.js";
3
+ import { NodeViewWrapper as lt, VueRenderer as Ot, VueNodeViewRenderer as at, NodeViewContent as bn, useEditor as vn, EditorContent as Tn } from "@tiptap/vue-3";
4
+ import En from "@tiptap/extension-document";
5
+ import wn from "@tiptap/extension-paragraph";
6
+ import Cn from "@tiptap/extension-text";
7
+ import An from "@tiptap/extension-history";
8
+ import Sn from "@tiptap/extension-placeholder";
9
+ import _n from "@tiptap/extension-character-count";
10
+ import { h as Ln, j as kn, p as Mn } from "../index4.js";
11
+ import { PluginKey as re, Plugin as ie, TextSelection as O } from "@tiptap/pm/state";
12
+ import { DecorationSet as Le, Decoration as Dt } from "@tiptap/pm/view";
13
+ import { _ as J } from "../_plugin-vue_export-helper.js";
14
+ import { IconAssociate as Rn, IconArrowDown as Pn } from "@opentiny/tiny-robot-svgs";
15
+ import { s as On } from "../useSenderContentRegistration.js";
16
+ import { Node as ct, mergeAttributes as ut, Extension as It } from "@tiptap/core";
17
+ const Dn = /* @__PURE__ */ Z({
20
18
  __name: "mention-view",
21
19
  props: {
22
20
  node: {},
23
21
  extension: {}
24
22
  },
25
23
  setup(e) {
26
- return (t, o) => (w(), V(A(Ee), {
24
+ return (t, n) => (M(), U(k(lt), {
27
25
  as: "span",
28
26
  class: "mention",
29
27
  "data-id": e.node.attrs.id,
30
28
  "data-value": e.node.attrs.value
31
29
  }, {
32
- default: B(() => [
33
- ot(ee(e.extension.options.char) + ee(e.node.attrs.label), 1)
30
+ default: j(() => [
31
+ ln(pe(e.extension.options.char) + pe(e.node.attrs.label), 1)
34
32
  ]),
35
33
  _: 1
36
34
  }, 8, ["data-id", "data-value"]));
37
35
  }
38
- }), Dt = /* @__PURE__ */ U(Pt, [["__scopeId", "data-v-b42c4fae"]]);
39
- function re(e) {
36
+ }), In = /* @__PURE__ */ J(Dn, [["__scopeId", "data-v-b42c4fae"]]), je = Math.min, fe = Math.max, Ne = Math.round, Oe = Math.floor, ee = (e) => ({
37
+ x: e,
38
+ y: e
39
+ }), Bn = {
40
+ left: "right",
41
+ right: "left",
42
+ bottom: "top",
43
+ top: "bottom"
44
+ };
45
+ function $n(e, t, n) {
46
+ return fe(e, je(t, n));
47
+ }
48
+ function Fe(e, t) {
49
+ return typeof e == "function" ? e(t) : e;
50
+ }
51
+ function Ee(e) {
52
+ return e.split("-")[0];
53
+ }
54
+ function Ve(e) {
55
+ return e.split("-")[1];
56
+ }
57
+ function Bt(e) {
58
+ return e === "x" ? "y" : "x";
59
+ }
60
+ function $t(e) {
61
+ return e === "y" ? "height" : "width";
62
+ }
63
+ function oe(e) {
64
+ const t = e[0];
65
+ return t === "t" || t === "b" ? "y" : "x";
66
+ }
67
+ function jt(e) {
68
+ return Bt(oe(e));
69
+ }
70
+ function jn(e, t, n) {
71
+ n === void 0 && (n = !1);
72
+ const s = Ve(e), r = jt(e), o = $t(r);
73
+ let l = r === "x" ? s === (n ? "end" : "start") ? "right" : "left" : s === "start" ? "bottom" : "top";
74
+ return t.reference[o] > t.floating[o] && (l = We(l)), [l, We(l)];
75
+ }
76
+ function Nn(e) {
77
+ const t = We(e);
78
+ return [ot(e), t, ot(t)];
79
+ }
80
+ function ot(e) {
81
+ return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start");
82
+ }
83
+ const vt = ["left", "right"], Tt = ["right", "left"], Wn = ["top", "bottom"], Kn = ["bottom", "top"];
84
+ function qn(e, t, n) {
85
+ switch (e) {
86
+ case "top":
87
+ case "bottom":
88
+ return n ? t ? Tt : vt : t ? vt : Tt;
89
+ case "left":
90
+ case "right":
91
+ return t ? Wn : Kn;
92
+ default:
93
+ return [];
94
+ }
95
+ }
96
+ function Hn(e, t, n, s) {
97
+ const r = Ve(e);
98
+ let o = qn(Ee(e), n === "start", s);
99
+ return r && (o = o.map((l) => l + "-" + r), t && (o = o.concat(o.map(ot)))), o;
100
+ }
101
+ function We(e) {
102
+ const t = Ee(e);
103
+ return Bn[t] + e.slice(t.length);
104
+ }
105
+ function zn(e) {
106
+ var t, n, s, r;
107
+ return {
108
+ top: (t = e.top) != null ? t : 0,
109
+ right: (n = e.right) != null ? n : 0,
110
+ bottom: (s = e.bottom) != null ? s : 0,
111
+ left: (r = e.left) != null ? r : 0
112
+ };
113
+ }
114
+ function Fn(e) {
115
+ return typeof e != "number" ? zn(e) : {
116
+ top: e,
117
+ right: e,
118
+ bottom: e,
119
+ left: e
120
+ };
121
+ }
122
+ function Ke(e) {
123
+ const {
124
+ x: t,
125
+ y: n,
126
+ width: s,
127
+ height: r
128
+ } = e;
129
+ return {
130
+ width: s,
131
+ height: r,
132
+ top: n,
133
+ left: t,
134
+ right: t + s,
135
+ bottom: n + r,
136
+ x: t,
137
+ y: n
138
+ };
139
+ }
140
+ function Et(e, t, n) {
141
+ let {
142
+ reference: s,
143
+ floating: r
144
+ } = e;
145
+ const o = oe(t), l = jt(t), i = $t(l), a = Ee(t), c = o === "y", d = s.x + s.width / 2 - r.width / 2, u = s.y + s.height / 2 - r.height / 2, g = s[i] / 2 - r[i] / 2;
146
+ let h;
147
+ switch (a) {
148
+ case "top":
149
+ h = {
150
+ x: d,
151
+ y: s.y - r.height
152
+ };
153
+ break;
154
+ case "bottom":
155
+ h = {
156
+ x: d,
157
+ y: s.y + s.height
158
+ };
159
+ break;
160
+ case "right":
161
+ h = {
162
+ x: s.x + s.width,
163
+ y: u
164
+ };
165
+ break;
166
+ case "left":
167
+ h = {
168
+ x: s.x - r.width,
169
+ y: u
170
+ };
171
+ break;
172
+ default:
173
+ h = {
174
+ x: s.x,
175
+ y: s.y
176
+ };
177
+ }
178
+ const E = Ve(t);
179
+ return E && (h[l] += g * (E === "end" ? 1 : -1) * (n && c ? -1 : 1)), h;
180
+ }
181
+ async function Vn(e, t) {
182
+ var n;
183
+ t === void 0 && (t = {});
184
+ const {
185
+ x: s,
186
+ y: r,
187
+ platform: o,
188
+ rects: l,
189
+ elements: i,
190
+ strategy: a
191
+ } = e, {
192
+ boundary: c = "clippingAncestors",
193
+ rootBoundary: d = "viewport",
194
+ elementContext: u = "floating",
195
+ altBoundary: g = !1,
196
+ padding: h = 0
197
+ } = Fe(t, e), E = Fn(h), T = i[g ? u === "floating" ? "reference" : "floating" : u], m = Ke(await o.getClippingRect({
198
+ element: (n = await (o.isElement == null ? void 0 : o.isElement(T))) == null || n ? T : T.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(i.floating)),
199
+ boundary: c,
200
+ rootBoundary: d,
201
+ strategy: a
202
+ })), y = u === "floating" ? {
203
+ x: s,
204
+ y: r,
205
+ width: l.floating.width,
206
+ height: l.floating.height
207
+ } : l.reference, p = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(i.floating)), f = await (o.isElement == null ? void 0 : o.isElement(p)) && await (o.getScale == null ? void 0 : o.getScale(p)) || {
208
+ x: 1,
209
+ y: 1
210
+ }, x = Ke(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
211
+ elements: i,
212
+ rect: y,
213
+ offsetParent: p,
214
+ strategy: a
215
+ }) : y);
216
+ return {
217
+ top: (m.top - x.top + E.top) / f.y,
218
+ bottom: (x.bottom - m.bottom + E.bottom) / f.y,
219
+ left: (m.left - x.left + E.left) / f.x,
220
+ right: (x.right - m.right + E.right) / f.x
221
+ };
222
+ }
223
+ const Gn = 50, Un = async (e, t, n) => {
224
+ const {
225
+ placement: s = "bottom",
226
+ strategy: r = "absolute",
227
+ middleware: o = [],
228
+ platform: l
229
+ } = n, i = l.detectOverflow ? l : {
230
+ ...l,
231
+ detectOverflow: Vn
232
+ }, a = await (l.isRTL == null ? void 0 : l.isRTL(t));
233
+ let c = await l.getElementRects({
234
+ reference: e,
235
+ floating: t,
236
+ strategy: r
237
+ }), {
238
+ x: d,
239
+ y: u
240
+ } = Et(c, s, a), g = s, h = 0;
241
+ const E = {};
242
+ for (let w = 0; w < o.length; w++) {
243
+ const T = o[w];
244
+ if (!T)
245
+ continue;
246
+ const {
247
+ name: m,
248
+ fn: y
249
+ } = T, {
250
+ x: p,
251
+ y: f,
252
+ data: x,
253
+ reset: v
254
+ } = await y({
255
+ x: d,
256
+ y: u,
257
+ initialPlacement: s,
258
+ placement: g,
259
+ strategy: r,
260
+ middlewareData: E,
261
+ rects: c,
262
+ platform: i,
263
+ elements: {
264
+ reference: e,
265
+ floating: t
266
+ }
267
+ });
268
+ d = p ?? d, u = f ?? u, E[m] = {
269
+ ...E[m],
270
+ ...x
271
+ }, v && h < Gn && (h++, typeof v == "object" && (v.placement && (g = v.placement), v.rects && (c = v.rects === !0 ? await l.getElementRects({
272
+ reference: e,
273
+ floating: t,
274
+ strategy: r
275
+ }) : v.rects), {
276
+ x: d,
277
+ y: u
278
+ } = Et(c, g, a)), w = -1);
279
+ }
280
+ return {
281
+ x: d,
282
+ y: u,
283
+ placement: g,
284
+ strategy: r,
285
+ middlewareData: E
286
+ };
287
+ }, Xn = function(e) {
288
+ return e === void 0 && (e = {}), {
289
+ name: "flip",
290
+ options: e,
291
+ async fn(t) {
292
+ var n, s;
293
+ const {
294
+ placement: r,
295
+ middlewareData: o,
296
+ rects: l,
297
+ initialPlacement: i,
298
+ platform: a,
299
+ elements: c
300
+ } = t, {
301
+ mainAxis: d = !0,
302
+ crossAxis: u = !0,
303
+ fallbackPlacements: g,
304
+ fallbackStrategy: h = "bestFit",
305
+ fallbackAxisSideDirection: E = "none",
306
+ flipAlignment: w = !0,
307
+ ...T
308
+ } = Fe(e, t);
309
+ if ((n = o.arrow) != null && n.alignmentOffset)
310
+ return {};
311
+ const m = Ee(r), y = oe(i), p = Ee(i) === i, f = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), x = g || (p || !w ? [We(i)] : Nn(i)), v = E !== "none";
312
+ !g && v && x.push(...Hn(i, w, E, f));
313
+ const S = [i, ...x], _ = await a.detectOverflow(t, T), b = [];
314
+ let L = ((s = o.flip) == null ? void 0 : s.overflows) || [];
315
+ if (d && b.push(_[m]), u) {
316
+ const V = jn(r, l, f);
317
+ b.push(_[V[0]], _[V[1]]);
318
+ }
319
+ if (L = [...L, {
320
+ placement: r,
321
+ overflows: b
322
+ }], !b.every((V) => V <= 0)) {
323
+ var $, N;
324
+ const V = ((($ = o.flip) == null ? void 0 : $.index) || 0) + 1, Je = S[V];
325
+ if (Je && (!(u === "alignment" ? y !== oe(Je) : !1) || // We leave the current main axis only if every placement on that axis
326
+ // overflows the main axis.
327
+ L.every((H) => oe(H.placement) === y ? H.overflows[0] > 0 : !0)))
328
+ return {
329
+ data: {
330
+ index: V,
331
+ overflows: L
332
+ },
333
+ reset: {
334
+ placement: Je
335
+ }
336
+ };
337
+ let _e = (N = L.filter((ce) => ce.overflows[0] <= 0).sort((ce, H) => ce.overflows[1] - H.overflows[1])[0]) == null ? void 0 : N.placement;
338
+ if (!_e)
339
+ switch (h) {
340
+ case "bestFit": {
341
+ var Se;
342
+ const ce = (Se = L.filter((H) => {
343
+ if (v) {
344
+ const ne = oe(H.placement);
345
+ return ne === y || // Create a bias to the `y` side axis due to horizontal
346
+ // reading directions favoring greater width.
347
+ ne === "y";
348
+ }
349
+ return !0;
350
+ }).map((H) => [H.placement, H.overflows.filter((ne) => ne > 0).reduce((ne, rn) => ne + rn, 0)]).sort((H, ne) => H[1] - ne[1])[0]) == null ? void 0 : Se[0];
351
+ ce && (_e = ce);
352
+ break;
353
+ }
354
+ case "initialPlacement":
355
+ _e = i;
356
+ break;
357
+ }
358
+ if (r !== _e)
359
+ return {
360
+ reset: {
361
+ placement: _e
362
+ }
363
+ };
364
+ }
365
+ return {};
366
+ }
367
+ };
368
+ }, Yn = /* @__PURE__ */ new Set(["left", "top"]);
369
+ async function Zn(e, t) {
370
+ const {
371
+ placement: n,
372
+ platform: s,
373
+ elements: r
374
+ } = e, o = await (s.isRTL == null ? void 0 : s.isRTL(r.floating)), l = Ee(n), i = Ve(n), a = oe(n) === "y", c = Yn.has(l) ? -1 : 1, d = o && a ? -1 : 1, u = Fe(t, e);
375
+ let {
376
+ mainAxis: g,
377
+ crossAxis: h,
378
+ alignmentAxis: E
379
+ } = typeof u == "number" ? {
380
+ mainAxis: u,
381
+ crossAxis: 0,
382
+ alignmentAxis: null
383
+ } : {
384
+ mainAxis: u.mainAxis || 0,
385
+ crossAxis: u.crossAxis || 0,
386
+ alignmentAxis: u.alignmentAxis
387
+ };
388
+ return i && typeof E == "number" && (h = i === "end" ? E * -1 : E), a ? {
389
+ x: h * d,
390
+ y: g * c
391
+ } : {
392
+ x: g * c,
393
+ y: h * d
394
+ };
395
+ }
396
+ const Jn = function(e) {
397
+ return e === void 0 && (e = 0), {
398
+ name: "offset",
399
+ options: e,
400
+ async fn(t) {
401
+ var n, s;
402
+ const {
403
+ x: r,
404
+ y: o,
405
+ placement: l,
406
+ middlewareData: i
407
+ } = t, a = await Zn(t, e);
408
+ return l === ((n = i.offset) == null ? void 0 : n.placement) && (s = i.arrow) != null && s.alignmentOffset ? {} : {
409
+ x: r + a.x,
410
+ y: o + a.y,
411
+ data: {
412
+ ...a,
413
+ placement: l
414
+ }
415
+ };
416
+ }
417
+ };
418
+ }, Qn = function(e) {
419
+ return e === void 0 && (e = {}), {
420
+ name: "shift",
421
+ options: e,
422
+ async fn(t) {
423
+ const {
424
+ x: n,
425
+ y: s,
426
+ placement: r,
427
+ platform: o
428
+ } = t, {
429
+ mainAxis: l = !0,
430
+ crossAxis: i = !1,
431
+ limiter: a = {
432
+ fn: (y) => {
433
+ let {
434
+ x: p,
435
+ y: f
436
+ } = y;
437
+ return {
438
+ x: p,
439
+ y: f
440
+ };
441
+ }
442
+ },
443
+ ...c
444
+ } = Fe(e, t), d = {
445
+ x: n,
446
+ y: s
447
+ }, u = await o.detectOverflow(t, c), g = oe(r), h = Bt(g);
448
+ let E = d[h], w = d[g];
449
+ const T = (y, p) => $n(p + u[y === "y" ? "top" : "left"], p, p - u[y === "y" ? "bottom" : "right"]);
450
+ l && (E = T(h, E)), i && (w = T(g, w));
451
+ const m = a.fn({
452
+ ...t,
453
+ [h]: E,
454
+ [g]: w
455
+ });
456
+ return {
457
+ ...m,
458
+ data: {
459
+ x: m.x - n,
460
+ y: m.y - s,
461
+ enabled: {
462
+ [h]: l,
463
+ [g]: i
464
+ }
465
+ }
466
+ };
467
+ }
468
+ };
469
+ };
470
+ function Ge() {
471
+ return typeof window < "u";
472
+ }
473
+ function Ae(e) {
474
+ return Nt(e) ? (e.nodeName || "").toLowerCase() : "#document";
475
+ }
476
+ function W(e) {
477
+ var t;
478
+ return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
479
+ }
480
+ function te(e) {
481
+ var t;
482
+ return (t = (Nt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
483
+ }
484
+ function Nt(e) {
485
+ return Ge() ? e instanceof Node || e instanceof W(e).Node : !1;
486
+ }
487
+ function X(e) {
488
+ return Ge() ? e instanceof Element || e instanceof W(e).Element : !1;
489
+ }
490
+ function le(e) {
491
+ return Ge() ? e instanceof HTMLElement || e instanceof W(e).HTMLElement : !1;
492
+ }
493
+ function wt(e) {
494
+ return !Ge() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof W(e).ShadowRoot;
495
+ }
496
+ function Ue(e) {
497
+ const {
498
+ overflow: t,
499
+ overflowX: n,
500
+ overflowY: s,
501
+ display: r
502
+ } = Y(e);
503
+ return /auto|scroll|overlay|hidden|clip/.test(t + s + n) && r !== "inline" && r !== "contents";
504
+ }
505
+ function eo(e) {
506
+ return /^(table|td|th)$/.test(Ae(e));
507
+ }
508
+ function Xe(e) {
509
+ try {
510
+ if (e.matches(":popover-open"))
511
+ return !0;
512
+ } catch {
513
+ }
514
+ try {
515
+ return e.matches(":modal");
516
+ } catch {
517
+ return !1;
518
+ }
519
+ }
520
+ const to = /transform|translate|scale|rotate|perspective|filter/, no = /paint|layout|strict|content/, ue = (e) => !!e && e !== "none";
521
+ let Qe;
522
+ function dt(e) {
523
+ const t = X(e) ? Y(e) : e;
524
+ return ue(t.transform) || ue(t.translate) || ue(t.scale) || ue(t.rotate) || ue(t.perspective) || !ft() && (ue(t.backdropFilter) || ue(t.filter)) || to.test(t.willChange || "") || no.test(t.contain || "");
525
+ }
526
+ function oo(e) {
527
+ let t = xe(e);
528
+ for (; le(t) && !Me(t); ) {
529
+ if (dt(t))
530
+ return t;
531
+ if (Xe(t))
532
+ return null;
533
+ t = xe(t);
534
+ }
535
+ return null;
536
+ }
537
+ function ft() {
538
+ return Qe == null && (Qe = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), Qe;
539
+ }
540
+ function Me(e) {
541
+ return /^(html|body|#document)$/.test(Ae(e));
542
+ }
543
+ function Y(e) {
544
+ return W(e).getComputedStyle(e);
545
+ }
546
+ function Ye(e) {
547
+ return X(e) ? {
548
+ scrollLeft: e.scrollLeft,
549
+ scrollTop: e.scrollTop
550
+ } : {
551
+ scrollLeft: e.scrollX,
552
+ scrollTop: e.scrollY
553
+ };
554
+ }
555
+ function xe(e) {
556
+ if (Ae(e) === "html")
557
+ return e;
558
+ const t = (
559
+ // Step into the shadow DOM of the parent of a slotted node.
560
+ e.assignedSlot || // DOM Element detected.
561
+ e.parentNode || // ShadowRoot detected.
562
+ wt(e) && e.host || // Fallback.
563
+ te(e)
564
+ );
565
+ return wt(t) ? t.host : t;
566
+ }
567
+ function Wt(e) {
568
+ const t = xe(e);
569
+ return Me(t) ? (e.ownerDocument || e).body : le(t) && Ue(t) ? t : Wt(t);
570
+ }
571
+ function Re(e, t, n) {
572
+ var s;
573
+ t === void 0 && (t = []), n === void 0 && (n = !0);
574
+ const r = Wt(e), o = r === ((s = e.ownerDocument) == null ? void 0 : s.body), l = W(r);
575
+ if (o) {
576
+ const i = st(l);
577
+ return t.concat(l, l.visualViewport || [], Ue(r) ? r : [], i && n ? Re(i) : []);
578
+ } else
579
+ return t.concat(r, Re(r, [], n));
580
+ }
581
+ function st(e) {
582
+ return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
583
+ }
584
+ function Kt(e) {
585
+ const t = Y(e);
586
+ let n = parseFloat(t.width) || 0, s = parseFloat(t.height) || 0;
587
+ const r = le(e), o = r ? e.offsetWidth : n, l = r ? e.offsetHeight : s, i = Ne(n) !== o || Ne(s) !== l;
588
+ return i && (n = o, s = l), {
589
+ width: n,
590
+ height: s,
591
+ $: i
592
+ };
593
+ }
594
+ function pt(e) {
595
+ return X(e) ? e : e.contextElement;
596
+ }
597
+ function Te(e) {
598
+ const t = pt(e);
599
+ if (!le(t))
600
+ return ee(1);
601
+ const n = t.getBoundingClientRect(), {
602
+ width: s,
603
+ height: r,
604
+ $: o
605
+ } = Kt(t);
606
+ let l = (o ? Ne(n.width) : n.width) / s, i = (o ? Ne(n.height) : n.height) / r;
607
+ return (!l || !Number.isFinite(l)) && (l = 1), (!i || !Number.isFinite(i)) && (i = 1), {
608
+ x: l,
609
+ y: i
610
+ };
611
+ }
612
+ const so = /* @__PURE__ */ ee(0);
613
+ function qt(e) {
614
+ const t = W(e);
615
+ return !ft() || !t.visualViewport ? so : {
616
+ x: t.visualViewport.offsetLeft,
617
+ y: t.visualViewport.offsetTop
618
+ };
619
+ }
620
+ function ro(e, t, n) {
621
+ return t === void 0 && (t = !1), !!n && t && n === W(e);
622
+ }
623
+ function ye(e, t, n, s) {
624
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
625
+ const r = e.getBoundingClientRect(), o = pt(e);
626
+ let l = ee(1);
627
+ t && (s ? X(s) && (l = Te(s)) : l = Te(e));
628
+ const i = ro(o, n, s) ? qt(o) : ee(0);
629
+ let a = (r.left + i.x) / l.x, c = (r.top + i.y) / l.y, d = r.width / l.x, u = r.height / l.y;
630
+ if (o && s) {
631
+ const g = W(o), h = X(s) ? W(s) : s;
632
+ let E = g, w = st(E);
633
+ for (; w && h !== E; ) {
634
+ const T = Te(w), m = w.getBoundingClientRect(), y = Y(w), p = m.left + (w.clientLeft + parseFloat(y.paddingLeft)) * T.x, f = m.top + (w.clientTop + parseFloat(y.paddingTop)) * T.y;
635
+ a *= T.x, c *= T.y, d *= T.x, u *= T.y, a += p, c += f, E = W(w), w = st(E);
636
+ }
637
+ }
638
+ return Ke({
639
+ width: d,
640
+ height: u,
641
+ x: a,
642
+ y: c
643
+ });
644
+ }
645
+ function Ze(e, t) {
646
+ const n = Ye(e).scrollLeft;
647
+ return t ? t.left + n : ye(te(e)).left + n;
648
+ }
649
+ function Ht(e, t) {
650
+ const n = e.getBoundingClientRect(), s = n.left + t.scrollLeft - Ze(e, n), r = n.top + t.scrollTop;
651
+ return {
652
+ x: s,
653
+ y: r
654
+ };
655
+ }
656
+ function io(e) {
657
+ let {
658
+ elements: t,
659
+ rect: n,
660
+ offsetParent: s,
661
+ strategy: r
662
+ } = e;
663
+ const o = r === "fixed", l = te(s), i = t ? Xe(t.floating) : !1;
664
+ if (s === l || i && o)
665
+ return n;
666
+ let a = {
667
+ scrollLeft: 0,
668
+ scrollTop: 0
669
+ }, c = ee(1);
670
+ const d = ee(0), u = le(s);
671
+ if ((u || !o) && ((Ae(s) !== "body" || Ue(l)) && (a = Ye(s)), u)) {
672
+ const h = ye(s);
673
+ c = Te(s), d.x = h.x + s.clientLeft, d.y = h.y + s.clientTop;
674
+ }
675
+ const g = l && !u && !o ? Ht(l, a) : ee(0);
676
+ return {
677
+ width: n.width * c.x,
678
+ height: n.height * c.y,
679
+ x: n.x * c.x - a.scrollLeft * c.x + d.x + g.x,
680
+ y: n.y * c.y - a.scrollTop * c.y + d.y + g.y
681
+ };
682
+ }
683
+ function lo(e) {
684
+ return e.getClientRects ? Array.from(e.getClientRects()) : [];
685
+ }
686
+ function ao(e) {
687
+ const t = Ye(e), n = e.ownerDocument.body, s = fe(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), r = fe(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
688
+ let o = -t.scrollLeft + Ze(e);
689
+ const l = -t.scrollTop;
690
+ return Y(n).direction === "rtl" && (o += fe(e.clientWidth, n.clientWidth) - s), {
691
+ width: s,
692
+ height: r,
693
+ x: o,
694
+ y: l
695
+ };
696
+ }
697
+ const co = 25;
698
+ function uo(e, t, n) {
699
+ n === void 0 && (n = "viewport");
700
+ const s = n === "layoutViewport", r = W(e), o = te(e), l = r.visualViewport;
701
+ let i = o.clientWidth, a = o.clientHeight, c = 0, d = 0;
702
+ if (l) {
703
+ const g = !ft() || t === "fixed";
704
+ s ? g || (c = -l.offsetLeft, d = -l.offsetTop) : (i = l.width, a = l.height, g && (c = l.offsetLeft, d = l.offsetTop));
705
+ }
706
+ if (Ze(o) <= 0) {
707
+ const g = o.ownerDocument, h = g.body, E = getComputedStyle(h), w = g.compatMode === "CSS1Compat" && parseFloat(E.marginLeft) + parseFloat(E.marginRight) || 0, T = Math.abs(o.clientWidth - h.clientWidth - w), m = getComputedStyle(o).scrollbarGutter === "stable both-edges" ? T / 2 : T;
708
+ m <= co && (i -= m);
709
+ }
710
+ return {
711
+ width: i,
712
+ height: a,
713
+ x: c,
714
+ y: d
715
+ };
716
+ }
717
+ function fo(e, t) {
718
+ const n = ye(e, !0, t === "fixed"), s = n.top + e.clientTop, r = n.left + e.clientLeft, o = Te(e), l = e.clientWidth * o.x, i = e.clientHeight * o.y, a = r * o.x, c = s * o.y;
719
+ return {
720
+ width: l,
721
+ height: i,
722
+ x: a,
723
+ y: c
724
+ };
725
+ }
726
+ function Ct(e, t, n) {
727
+ let s;
728
+ if (t === "viewport" || t === "layoutViewport")
729
+ s = uo(e, n, t);
730
+ else if (t === "document")
731
+ s = ao(te(e));
732
+ else if (X(t))
733
+ s = fo(t, n);
734
+ else {
735
+ const r = qt(e);
736
+ s = {
737
+ x: t.x - r.x,
738
+ y: t.y - r.y,
739
+ width: t.width,
740
+ height: t.height
741
+ };
742
+ }
743
+ return Ke(s);
744
+ }
745
+ function po(e, t) {
746
+ const n = t.get(e);
747
+ if (n)
748
+ return n;
749
+ let s = Re(e, [], !1).filter((i) => X(i) && Ae(i) !== "body"), r = null;
750
+ const o = Y(e).position === "fixed";
751
+ let l = o ? xe(e) : e;
752
+ for (; X(l) && !Me(l); ) {
753
+ const i = Y(l), a = dt(l), c = r ? r.position : o ? "fixed" : "";
754
+ !a && (c === "fixed" || c === "absolute" && i.position === "static") ? s = s.filter((u) => u !== l) : r = i, l = xe(l);
755
+ }
756
+ return t.set(e, s), s;
757
+ }
758
+ function mo(e) {
759
+ let {
760
+ element: t,
761
+ boundary: n,
762
+ rootBoundary: s,
763
+ strategy: r
764
+ } = e;
765
+ const l = [...n === "clippingAncestors" ? Xe(t) ? [] : po(t, this._c) : [].concat(n), s], i = Ct(t, l[0], r);
766
+ let a = i.top, c = i.right, d = i.bottom, u = i.left;
767
+ for (let g = 1; g < l.length; g++) {
768
+ const h = Ct(t, l[g], r);
769
+ a = fe(h.top, a), c = je(h.right, c), d = je(h.bottom, d), u = fe(h.left, u);
770
+ }
771
+ return {
772
+ width: c - u,
773
+ height: d - a,
774
+ x: u,
775
+ y: a
776
+ };
777
+ }
778
+ function ho(e) {
779
+ const {
780
+ width: t,
781
+ height: n
782
+ } = Kt(e);
783
+ return {
784
+ width: t,
785
+ height: n
786
+ };
787
+ }
788
+ function go(e, t, n) {
789
+ const s = le(t), r = te(t), o = n === "fixed", l = ye(e, !0, o, t);
790
+ let i = {
791
+ scrollLeft: 0,
792
+ scrollTop: 0
793
+ };
794
+ const a = ee(0);
795
+ if ((s || !o) && ((Ae(t) !== "body" || Ue(r)) && (i = Ye(t)), s)) {
796
+ const g = ye(t, !0, o, t);
797
+ a.x = g.x + t.clientLeft, a.y = g.y + t.clientTop;
798
+ }
799
+ !s && r && (a.x = Ze(r));
800
+ const c = r && !s && !o ? Ht(r, i) : ee(0), d = l.left + i.scrollLeft - a.x - c.x, u = l.top + i.scrollTop - a.y - c.y;
801
+ return {
802
+ x: d,
803
+ y: u,
804
+ width: l.width,
805
+ height: l.height
806
+ };
807
+ }
808
+ function et(e) {
809
+ return Y(e).position === "static";
810
+ }
811
+ function At(e, t) {
812
+ if (!le(e) || Y(e).position === "fixed")
813
+ return null;
814
+ if (t)
815
+ return t(e);
816
+ let n = e.offsetParent;
817
+ return te(e) === n && (n = n.ownerDocument.body), n;
818
+ }
819
+ function zt(e, t) {
820
+ const n = W(e);
821
+ if (Xe(e))
822
+ return n;
823
+ if (!le(e)) {
824
+ let r = xe(e);
825
+ for (; r && !Me(r); ) {
826
+ if (X(r) && !et(r))
827
+ return r;
828
+ r = xe(r);
829
+ }
830
+ return n;
831
+ }
832
+ let s = At(e, t);
833
+ for (; s && eo(s) && et(s); )
834
+ s = At(s, t);
835
+ return s && Me(s) && et(s) && !dt(s) ? n : s || oo(e) || n;
836
+ }
837
+ const xo = async function(e) {
838
+ const t = this.getOffsetParent || zt, n = this.getDimensions, s = await n(e.floating);
839
+ return {
840
+ reference: go(e.reference, await t(e.floating), e.strategy),
841
+ floating: {
842
+ x: 0,
843
+ y: 0,
844
+ width: s.width,
845
+ height: s.height
846
+ }
847
+ };
848
+ };
849
+ function yo(e) {
850
+ return Y(e).direction === "rtl";
851
+ }
852
+ const bo = {
853
+ convertOffsetParentRelativeRectToViewportRelativeRect: io,
854
+ getDocumentElement: te,
855
+ getClippingRect: mo,
856
+ getOffsetParent: zt,
857
+ getElementRects: xo,
858
+ getClientRects: lo,
859
+ getDimensions: ho,
860
+ getScale: Te,
861
+ isElement: X,
862
+ isRTL: yo
863
+ };
864
+ function Ft(e, t) {
865
+ return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
866
+ }
867
+ function vo(e, t, n) {
868
+ let s = null, r;
869
+ const o = te(e);
870
+ function l() {
871
+ var d;
872
+ clearTimeout(r), (d = s) == null || d.disconnect(), s = null;
873
+ }
874
+ function i(d, u) {
875
+ d === void 0 && (d = !1), u === void 0 && (u = 1), l();
876
+ const g = e.getBoundingClientRect(), {
877
+ left: h,
878
+ top: E,
879
+ width: w,
880
+ height: T
881
+ } = g;
882
+ if (d || t(), !w || !T)
883
+ return;
884
+ const m = Oe(E), y = Oe(o.clientWidth - (h + w)), p = Oe(o.clientHeight - (E + T)), f = Oe(h), v = {
885
+ rootMargin: -m + "px " + -y + "px " + -p + "px " + -f + "px",
886
+ threshold: fe(0, je(1, u)) || 1
887
+ };
888
+ let S = !0;
889
+ function _(b) {
890
+ const L = b[0].intersectionRatio;
891
+ if (!Ft(g, e.getBoundingClientRect()))
892
+ return i();
893
+ if (L !== u) {
894
+ if (!S)
895
+ return i();
896
+ L ? i(!1, L) : r = setTimeout(() => {
897
+ i(!1, 1e-7);
898
+ }, 1e3);
899
+ }
900
+ S = !1;
901
+ }
902
+ try {
903
+ s = new IntersectionObserver(_, {
904
+ ...v,
905
+ // Handle <iframe>s
906
+ root: o.ownerDocument
907
+ });
908
+ } catch {
909
+ s = new IntersectionObserver(_, v);
910
+ }
911
+ s.observe(e);
912
+ }
913
+ const a = W(e), c = () => i(n);
914
+ return a.addEventListener("resize", c), i(!0), () => {
915
+ a.removeEventListener("resize", c), l();
916
+ };
917
+ }
918
+ function mt(e, t, n, s) {
919
+ s === void 0 && (s = {});
920
+ const {
921
+ ancestorScroll: r = !0,
922
+ ancestorResize: o = !0,
923
+ elementResize: l = typeof ResizeObserver == "function",
924
+ layoutShift: i = typeof IntersectionObserver == "function",
925
+ animationFrame: a = !1
926
+ } = s, c = pt(e), d = r || o ? [...c ? Re(c) : [], ...t ? Re(t) : []] : [];
927
+ d.forEach((m) => {
928
+ r && m.addEventListener("scroll", n), o && m.addEventListener("resize", n);
929
+ });
930
+ const u = c && i ? vo(c, n, o) : null;
931
+ let g = -1, h = null;
932
+ l && (h = new ResizeObserver((m) => {
933
+ let [y] = m;
934
+ y && y.target === c && h && t && (h.unobserve(t), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
935
+ var p;
936
+ (p = h) == null || p.observe(t);
937
+ })), n();
938
+ }), c && !a && h.observe(c), t && h.observe(t));
939
+ let E, w = a ? ye(e) : null;
940
+ a && T();
941
+ function T() {
942
+ const m = ye(e);
943
+ w && !Ft(w, m) && n(), w = m, E = requestAnimationFrame(T);
944
+ }
945
+ return n(), () => {
946
+ var m;
947
+ d.forEach((y) => {
948
+ r && y.removeEventListener("scroll", n), o && y.removeEventListener("resize", n);
949
+ }), u == null || u(), (m = h) == null || m.disconnect(), h = null, a && cancelAnimationFrame(E);
950
+ };
951
+ }
952
+ const ht = Jn, gt = Qn, xt = Xn, yt = (e, t, n) => {
953
+ const s = /* @__PURE__ */ new Map(), r = n ?? {}, o = {
954
+ ...bo,
955
+ ...r.platform,
956
+ _c: s
957
+ };
958
+ return Un(e, t, {
959
+ ...r,
960
+ platform: o
961
+ });
962
+ };
963
+ function ve(e) {
40
964
  return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
41
965
  }
42
- function Ot(e, t, o = !1) {
966
+ function To(e, t, n = !1) {
43
967
  const { $from: s } = e;
44
968
  if (!e.empty || !s.parent.isTextblock)
45
969
  return null;
46
- const i = s.parent.textBetween(0, s.parentOffset, void 0, ""), n = i.lastIndexOf(t);
47
- if (n === -1)
970
+ const r = s.parent.textBetween(0, s.parentOffset, void 0, ""), o = r.lastIndexOf(t);
971
+ if (o === -1)
48
972
  return null;
49
- const a = i.slice(n + t.length);
50
- if (!o && a.includes(" "))
973
+ const l = r.slice(o + t.length);
974
+ if (!n && l.includes(" "))
51
975
  return null;
52
- const r = s.start() + n, l = s.pos;
976
+ const i = s.start() + o, a = s.pos;
53
977
  return {
54
- range: { from: r, to: l },
55
- query: a
978
+ range: { from: i, to: a },
979
+ query: l
56
980
  };
57
981
  }
58
- const se = {
982
+ const be = {
59
983
  /** Template 扩展(包含 TemplateBlock 和 TemplateSelect 子扩展) */
60
984
  TEMPLATE: "template",
61
985
  /** Mention 扩展 */
62
986
  MENTION: "mention",
63
987
  /** Suggestion 扩展 */
64
988
  SUGGESTION: "suggestion"
65
- }, T = {
989
+ }, A = {
66
990
  /** TemplateBlock 节点类型(可编辑块) */
67
991
  TEMPLATE_BLOCK: "templateBlock",
68
992
  /** TemplateSelect 节点类型(下拉选择) */
@@ -73,7 +997,7 @@ const se = {
73
997
  PARAGRAPH: "paragraph",
74
998
  /** Text 节点类型(ProseMirror 内置) */
75
999
  TEXT: "text"
76
- }, J = {
1000
+ }, ae = {
77
1001
  /** Mention 插件 */
78
1002
  MENTION: "mention",
79
1003
  /** Suggestion 插件 */
@@ -90,7 +1014,7 @@ const se = {
90
1014
  TEMPLATE_BLOCK_KEYBOARD: "templateBlockKeyboard",
91
1015
  /** Template Block 粘贴处理插件 */
92
1016
  TEMPLATE_BLOCK_PASTE: "templateBlockPaste"
93
- }, F = {
1017
+ }, G = {
94
1018
  /** 文本类型 */
95
1019
  TEXT: "text",
96
1020
  /** 模板块类型(对应内部的 TemplateBlock 节点) */
@@ -99,7 +1023,7 @@ const se = {
99
1023
  SELECT: "select",
100
1024
  /** Mention 类型 */
101
1025
  MENTION: "mention"
102
- }, ze = {
1026
+ }, Vt = {
103
1027
  /** Enter 键 */
104
1028
  ENTER: "Enter",
105
1029
  /** Escape 键 */
@@ -120,87 +1044,87 @@ const se = {
120
1044
  ARROW_RIGHT: "ArrowRight",
121
1045
  /** 空格键 */
122
1046
  SPACE: " "
123
- }, I = (e, t) => e.key === ze[t], ie = (e, t) => t.some((o) => e.key === ze[o]), It = ["onMousedown", "onMouseenter"], Rt = {
1047
+ }, I = (e, t) => e.key === Vt[t], we = (e, t) => t.some((n) => e.key === Vt[n]), Eo = ["onMousedown", "onMouseenter"], wo = {
124
1048
  key: 0,
125
1049
  class: "mention-icon"
126
- }, Bt = { class: "mention-label" }, jt = {
1050
+ }, Co = { class: "mention-label" }, Ao = {
127
1051
  key: 0,
128
1052
  class: "mention-empty"
129
- }, $t = /* @__PURE__ */ G({
1053
+ }, So = /* @__PURE__ */ Z({
130
1054
  __name: "mention-list",
131
1055
  props: {
132
1056
  items: {},
133
1057
  command: { type: Function }
134
1058
  },
135
1059
  setup(e, { expose: t }) {
136
- const o = e, s = W(0), i = W(null);
1060
+ const n = e, s = F(0), r = F(null);
137
1061
  K(
138
- () => o.items,
1062
+ () => n.items,
139
1063
  () => {
140
1064
  s.value = 0;
141
1065
  }
142
1066
  );
143
- function n({ event: u }) {
144
- return I(u, "ARROW_UP") ? (s.value = Math.max(0, s.value - 1), a(), !0) : I(u, "ARROW_DOWN") ? (s.value = Math.min(o.items.length - 1, s.value + 1), a(), !0) : ie(u, ["ENTER", "TAB"]) ? (r(s.value), !0) : !1;
1067
+ function o({ event: c }) {
1068
+ return I(c, "ARROW_UP") ? (s.value = Math.max(0, s.value - 1), l(), !0) : I(c, "ARROW_DOWN") ? (s.value = Math.min(n.items.length - 1, s.value + 1), l(), !0) : we(c, ["ENTER", "TAB"]) ? (i(s.value), !0) : !1;
145
1069
  }
146
- function a() {
147
- te(() => {
148
- var p;
149
- const u = (p = i.value) == null ? void 0 : p.querySelector(".mention-item.is-selected");
150
- u && u.scrollIntoView({
1070
+ function l() {
1071
+ me(() => {
1072
+ var d;
1073
+ const c = (d = r.value) == null ? void 0 : d.querySelector(".mention-item.is-selected");
1074
+ c && c.scrollIntoView({
151
1075
  block: "nearest",
152
1076
  behavior: "smooth"
153
1077
  });
154
1078
  });
155
1079
  }
156
- function r(u) {
157
- const p = o.items[u];
158
- p && o.command({
159
- id: p.id,
160
- label: p.label,
161
- value: p.value
1080
+ function i(c) {
1081
+ const d = n.items[c];
1082
+ d && n.command({
1083
+ id: d.id,
1084
+ label: d.label,
1085
+ value: d.value
162
1086
  });
163
1087
  }
164
- function l(u) {
165
- s.value = u;
1088
+ function a(c) {
1089
+ s.value = c;
166
1090
  }
167
1091
  return t({
168
- onKeyDown: n
169
- }), (u, p) => (w(), P("div", {
1092
+ onKeyDown: o
1093
+ }), (c, d) => (M(), P("div", {
170
1094
  ref_key: "listRef",
171
- ref: i,
1095
+ ref: r,
172
1096
  class: "mention-list"
173
1097
  }, [
174
- (w(!0), P(fe, null, pe(e.items, (f, E) => (w(), P("button", {
175
- key: f.id,
1098
+ (M(!0), P(Ie, null, Be(e.items, (u, g) => (M(), P("button", {
1099
+ key: u.id,
176
1100
  type: "button",
177
- class: z(["mention-item", { "is-selected": E === s.value }]),
178
- onMousedown: ye((S) => r(E), ["prevent"]),
179
- onMouseenter: (S) => l(E)
1101
+ class: Q(["mention-item", { "is-selected": g === s.value }]),
1102
+ onMousedown: nt((h) => i(g), ["prevent"]),
1103
+ onMouseenter: (h) => a(g)
180
1104
  }, [
181
- f.icon ? (w(), P("span", Rt, ee(f.icon), 1)) : N("", !0),
182
- R("span", Bt, ee(f.label), 1)
183
- ], 42, It))), 128)),
184
- e.items.length === 0 ? (w(), P("div", jt, [...p[0] || (p[0] = [
185
- R("span", null, "未找到匹配的提及项", -1)
186
- ])])) : N("", !0)
1105
+ u.icon ? (M(), P("span", wo, pe(u.icon), 1)) : q("", !0),
1106
+ B("span", Co, pe(u.label), 1)
1107
+ ], 42, Eo))), 128)),
1108
+ e.items.length === 0 ? (M(), P("div", Ao, [...d[0] || (d[0] = [
1109
+ B("span", null, "未找到匹配的提及项", -1)
1110
+ ])])) : q("", !0)
187
1111
  ], 512));
188
1112
  }
189
- }), Kt = /* @__PURE__ */ U($t, [["__scopeId", "data-v-aaa34d1a"]]), Q = new Z(J.MENTION);
190
- function qt(e, t) {
1113
+ }), _o = /* @__PURE__ */ J(So, [["__scopeId", "data-v-aaa34d1a"]]), de = new re(ae.MENTION);
1114
+ function Lo(e, t) {
191
1115
  if (!t)
192
1116
  return e;
193
- const o = t.toLowerCase();
1117
+ const n = t.toLowerCase();
194
1118
  return e.filter((s) => {
195
- var i;
196
- return !!(s.label.toLowerCase().includes(o) || (i = s.value) != null && i.toLowerCase().includes(o));
1119
+ var r;
1120
+ return !!(s.label.toLowerCase().includes(n) || (r = s.value) != null && r.toLowerCase().includes(n));
197
1121
  });
198
1122
  }
199
- function Nt(e) {
200
- const { editor: t, char: o, items: s, allowSpaces: i } = e;
201
- let n = null, a = null, r = null;
202
- return new Y({
203
- key: Q,
1123
+ function ko(e) {
1124
+ const { editor: t, char: n, items: s, allowSpaces: r } = e;
1125
+ let o = null, l = null, i = null;
1126
+ return new ie({
1127
+ key: de,
204
1128
  state: {
205
1129
  init() {
206
1130
  return {
@@ -210,140 +1134,140 @@ function Nt(e) {
210
1134
  filteredItems: []
211
1135
  };
212
1136
  },
213
- apply(l, u) {
214
- const p = l.getMeta(Q);
215
- if (p && p.type === "close")
1137
+ apply(a, c) {
1138
+ const d = a.getMeta(de);
1139
+ if (d && d.type === "close")
216
1140
  return {
217
1141
  active: !1,
218
1142
  range: null,
219
1143
  query: "",
220
1144
  filteredItems: []
221
1145
  };
222
- if (!l.docChanged && !l.selectionSet)
223
- return u;
224
- const f = Ot(l.selection, o, i);
225
- if (!f)
1146
+ if (!a.docChanged && !a.selectionSet)
1147
+ return c;
1148
+ const u = To(a.selection, n, r);
1149
+ if (!u)
226
1150
  return {
227
1151
  active: !1,
228
1152
  range: null,
229
1153
  query: "",
230
1154
  filteredItems: []
231
1155
  };
232
- const E = ce(s) ? s.value : s, S = qt(E, f.query);
1156
+ const g = ke(s) ? s.value : s, h = Lo(g, u.query);
233
1157
  return {
234
- active: S.length > 0,
235
- range: f.range,
236
- query: f.query,
237
- filteredItems: S
1158
+ active: h.length > 0,
1159
+ range: u.range,
1160
+ query: u.query,
1161
+ filteredItems: h
238
1162
  };
239
1163
  }
240
1164
  },
241
1165
  props: {
242
1166
  // 装饰器:高亮触发区域
243
- decorations(l) {
244
- const u = this.getState(l);
245
- if (!(u != null && u.active) || !u.range)
246
- return le.empty;
247
- const p = He.inline(u.range.from, u.range.to, {
1167
+ decorations(a) {
1168
+ const c = this.getState(a);
1169
+ if (!(c != null && c.active) || !c.range)
1170
+ return Le.empty;
1171
+ const d = Dt.inline(c.range.from, c.range.to, {
248
1172
  class: "mention-trigger"
249
1173
  });
250
- return le.create(l.doc, [p]);
1174
+ return Le.create(a.doc, [d]);
251
1175
  },
252
1176
  // 键盘处理
253
- handleKeyDown(l, u) {
254
- var f, E, S, j;
255
- const p = Q.getState(l.state);
256
- if (I(u, "BACKSPACE")) {
257
- const { selection: L } = l.state, { $from: C } = L;
258
- if (C.nodeBefore && C.nodeBefore.type.name === T.MENTION) {
259
- u.preventDefault();
260
- const { tr: h } = l.state, g = C.pos - C.nodeBefore.nodeSize;
261
- return h.delete(g, C.pos), h.insertText(o, g), h.setSelection(D.create(h.doc, g + 1)), l.dispatch(h), l.focus(), !0;
1177
+ handleKeyDown(a, c) {
1178
+ var u, g, h, E;
1179
+ const d = de.getState(a.state);
1180
+ if (I(c, "BACKSPACE")) {
1181
+ const { selection: w } = a.state, { $from: T } = w;
1182
+ if (T.nodeBefore && T.nodeBefore.type.name === A.MENTION) {
1183
+ c.preventDefault();
1184
+ const { tr: m } = a.state, y = T.pos - T.nodeBefore.nodeSize;
1185
+ return m.delete(y, T.pos), m.insertText(n, y), m.setSelection(O.create(m.doc, y + 1)), a.dispatch(m), a.focus(), !0;
262
1186
  }
263
1187
  }
264
- if (!(p != null && p.active))
1188
+ if (!(d != null && d.active))
265
1189
  return !1;
266
- if (I(u, "ESCAPE")) {
267
- u.preventDefault();
268
- const L = l.state.tr;
269
- return L.setMeta(Q, {
1190
+ if (I(c, "ESCAPE")) {
1191
+ c.preventDefault();
1192
+ const w = a.state.tr;
1193
+ return w.setMeta(de, {
270
1194
  type: "close"
271
- }), l.dispatch(L), n && (r == null || r(), r = null, n.destroy(), n = null), a && (a.remove(), a = null), !0;
1195
+ }), a.dispatch(w), o && (i == null || i(), i = null, o.destroy(), o = null), l && (l.remove(), l = null), !0;
272
1196
  }
273
- if (ie(u, ["ENTER", "TAB"])) {
274
- if (u.preventDefault(), (E = (f = n == null ? void 0 : n.ref) == null ? void 0 : f.onKeyDown) == null ? void 0 : E.call(f, { event: u }))
1197
+ if (we(c, ["ENTER", "TAB"])) {
1198
+ if (c.preventDefault(), (g = (u = o == null ? void 0 : o.ref) == null ? void 0 : u.onKeyDown) == null ? void 0 : g.call(u, { event: c }))
275
1199
  return !0;
276
- if (p.filteredItems.length > 0 && p.range) {
277
- const C = p.filteredItems[0];
278
- return Ie(l, p.range, C), !0;
1200
+ if (d.filteredItems.length > 0 && d.range) {
1201
+ const T = d.filteredItems[0];
1202
+ return St(a, d.range, T), !0;
279
1203
  }
280
1204
  return !0;
281
1205
  }
282
- return ie(u, ["ARROW_UP", "ARROW_DOWN"]) && ((j = (S = n == null ? void 0 : n.ref) == null ? void 0 : S.onKeyDown) == null ? void 0 : j.call(S, { event: u })) || !1;
1206
+ return we(c, ["ARROW_UP", "ARROW_DOWN"]) && ((E = (h = o == null ? void 0 : o.ref) == null ? void 0 : h.onKeyDown) == null ? void 0 : E.call(h, { event: c })) || !1;
283
1207
  }
284
1208
  },
285
1209
  view() {
286
1210
  return {
287
- update(l) {
288
- const u = Q.getState(l.state);
289
- if (u != null && u.active && u.filteredItems.length > 0) {
290
- n ? n.updateProps({
291
- items: u.filteredItems
292
- }) : (n = new Ne(Kt, {
1211
+ update(a) {
1212
+ const c = de.getState(a.state);
1213
+ if (c != null && c.active && c.filteredItems.length > 0) {
1214
+ o ? o.updateProps({
1215
+ items: c.filteredItems
1216
+ }) : (o = new Ot(_o, {
293
1217
  props: {
294
- items: u.filteredItems,
295
- command: (f) => {
296
- const E = {
297
- id: f.id,
298
- label: f.label,
299
- value: f.value || ""
1218
+ items: c.filteredItems,
1219
+ command: (u) => {
1220
+ const g = {
1221
+ id: u.id,
1222
+ label: u.label,
1223
+ value: u.value || ""
300
1224
  };
301
- u.range && Ie(l, u.range, E);
1225
+ c.range && St(a, c.range, g);
302
1226
  }
303
1227
  },
304
1228
  editor: t
305
- }), a = n.element, a.style.position = "absolute", a.style.zIndex = "1000", document.body.appendChild(a));
306
- const p = l.dom.querySelector(".mention-trigger");
307
- p && a && (r == null || r(), r = Se(p, a, () => {
308
- Ce(p, a, {
1229
+ }), l = o.element, l.style.position = "absolute", l.style.zIndex = "1000", document.body.appendChild(l));
1230
+ const d = a.dom.querySelector(".mention-trigger");
1231
+ d && l && (i == null || i(), i = mt(d, l, () => {
1232
+ yt(d, l, {
309
1233
  placement: "bottom-start",
310
- middleware: [Ae(8), we(), ke({ padding: 8 })]
311
- }).then((f) => {
312
- a && Object.assign(a.style, {
313
- left: `${f.x}px`,
314
- top: `${f.y}px`
1234
+ middleware: [ht(8), xt(), gt({ padding: 8 })]
1235
+ }).then((u) => {
1236
+ l && Object.assign(l.style, {
1237
+ left: `${u.x}px`,
1238
+ top: `${u.y}px`
315
1239
  });
316
1240
  });
317
1241
  }));
318
1242
  } else
319
- n && (r == null || r(), r = null, n.destroy(), n = null), a && (a.remove(), a = null);
1243
+ o && (i == null || i(), i = null, o.destroy(), o = null), l && (l.remove(), l = null);
320
1244
  },
321
1245
  destroy() {
322
- r == null || r(), n == null || n.destroy(), a == null || a.remove();
1246
+ i == null || i(), o == null || o.destroy(), l == null || l.remove();
323
1247
  }
324
1248
  };
325
1249
  }
326
1250
  });
327
1251
  }
328
- function Ie(e, t, o) {
1252
+ function St(e, t, n) {
329
1253
  e.focus();
330
- const { state: s, dispatch: i } = e, { tr: n } = s, a = s.schema.nodes.mention.create({
331
- id: o.id || re("mention"),
332
- label: o.label,
333
- value: o.value || ""
334
- }), r = s.schema.text(" ");
335
- n.delete(t.from, t.to), n.insert(t.from, [a, r]);
336
- const l = t.from + 2;
337
- n.setSelection(D.create(n.doc, l)), n.scrollIntoView(), i(n);
338
- }
339
- const Ht = {
1254
+ const { state: s, dispatch: r } = e, { tr: o } = s, l = s.schema.nodes.mention.create({
1255
+ id: n.id || ve("mention"),
1256
+ label: n.label,
1257
+ value: n.value || ""
1258
+ }), i = s.schema.text(" ");
1259
+ o.delete(t.from, t.to), o.insert(t.from, [l, i]);
1260
+ const a = t.from + 2;
1261
+ o.setSelection(O.create(o.doc, a)), o.scrollIntoView(), r(o);
1262
+ }
1263
+ const Mo = {
340
1264
  /**
341
1265
  * 插入 mention 节点
342
1266
  */
343
1267
  insertMention: (e) => ({ commands: t }) => t.insertContent({
344
- type: T.MENTION,
1268
+ type: A.MENTION,
345
1269
  attrs: {
346
- id: e.id || re("mention"),
1270
+ id: e.id || ve("mention"),
347
1271
  label: e.label || "",
348
1272
  value: e.value
349
1273
  }
@@ -351,15 +1275,15 @@ const Ht = {
351
1275
  /**
352
1276
  * 删除 mention 节点
353
1277
  */
354
- deleteMention: (e) => ({ tr: t, state: o }) => {
1278
+ deleteMention: (e) => ({ tr: t, state: n }) => {
355
1279
  let s = !1;
356
- return o.doc.descendants((i, n) => {
357
- if (i.type.name === T.MENTION && i.attrs.id === e)
358
- return t.delete(n, n + i.nodeSize), s = !0, !1;
1280
+ return n.doc.descendants((r, o) => {
1281
+ if (r.type.name === A.MENTION && r.attrs.id === e)
1282
+ return t.delete(o, o + r.nodeSize), s = !0, !1;
359
1283
  }), s;
360
1284
  }
361
- }, Fe = Le.create({
362
- name: se.MENTION,
1285
+ }, Gt = ct.create({
1286
+ name: be.MENTION,
363
1287
  // 节点配置
364
1288
  group: "inline",
365
1289
  inline: !0,
@@ -405,7 +1329,7 @@ const Ht = {
405
1329
  renderHTML({ node: e, HTMLAttributes: t }) {
406
1330
  return [
407
1331
  "span",
408
- Me(this.options.HTMLAttributes || {}, t, {
1332
+ ut(this.options.HTMLAttributes || {}, t, {
409
1333
  "data-mention": "",
410
1334
  "data-id": e.attrs.id,
411
1335
  "data-label": e.attrs.label,
@@ -416,7 +1340,7 @@ const Ht = {
416
1340
  },
417
1341
  // 使用 Vue 组件渲染
418
1342
  addNodeView() {
419
- return _e(Dt);
1343
+ return at(In);
420
1344
  },
421
1345
  // 添加 storage 用于存储实例状态
422
1346
  addStorage() {
@@ -426,11 +1350,11 @@ const Ht = {
426
1350
  },
427
1351
  onCreate() {
428
1352
  const { items: e } = this.options;
429
- ce(e) && (this.storage.watchStopHandle = K(
1353
+ ke(e) && (this.storage.watchStopHandle = K(
430
1354
  e,
431
1355
  () => {
432
1356
  const t = this.editor.state.tr;
433
- t.setMeta(Q, { type: "mention-update" }), this.editor.view.dispatch(t);
1357
+ t.setMeta(de, { type: "mention-update" }), this.editor.view.dispatch(t);
434
1358
  },
435
1359
  { deep: !0 }
436
1360
  ));
@@ -441,7 +1365,7 @@ const Ht = {
441
1365
  // 添加 Suggestion 插件
442
1366
  addProseMirrorPlugins() {
443
1367
  return [
444
- Nt({
1368
+ ko({
445
1369
  editor: this.editor,
446
1370
  char: this.options.char,
447
1371
  items: this.options.items,
@@ -458,93 +1382,93 @@ const Ht = {
458
1382
  },
459
1383
  // 自定义命令
460
1384
  addCommands() {
461
- return Ht;
1385
+ return Mo;
462
1386
  }
463
1387
  });
464
- function Wt(e) {
465
- var i;
466
- const t = e.extensionManager.extensions.find((n) => n.name === se.MENTION), o = ((i = t == null ? void 0 : t.options) == null ? void 0 : i.char) || "@";
1388
+ function Ro(e) {
1389
+ var r;
1390
+ const t = e.extensionManager.extensions.find((o) => o.name === be.MENTION), n = ((r = t == null ? void 0 : t.options) == null ? void 0 : r.char) || "@";
467
1391
  let s = "";
468
- return e.state.doc.descendants((n) => {
469
- n.type.name === T.MENTION ? s += `${o}${n.attrs.label}` : n.type.name === T.TEXT && (s += n.text || "");
1392
+ return e.state.doc.descendants((o) => {
1393
+ o.type.name === A.MENTION ? s += `${n}${o.attrs.label}` : o.type.name === A.TEXT && (s += o.text || "");
470
1394
  }), s.trim();
471
1395
  }
472
- function zt(e) {
1396
+ function Po(e) {
473
1397
  const t = [];
474
- return e.state.doc.descendants((o, s, i) => {
475
- if (i && i.type.name === T.PARAGRAPH) {
476
- if (o.type.name === T.MENTION)
1398
+ return e.state.doc.descendants((n, s, r) => {
1399
+ if (r && r.type.name === A.PARAGRAPH) {
1400
+ if (n.type.name === A.MENTION)
477
1401
  t.push({
478
- type: F.MENTION,
479
- content: o.attrs.label,
480
- value: o.attrs.value || ""
1402
+ type: G.MENTION,
1403
+ content: n.attrs.label,
1404
+ value: n.attrs.value || ""
481
1405
  });
482
- else if (o.type.name === T.TEXT) {
483
- const n = o.text || "";
484
- if (n) {
485
- const a = t[t.length - 1];
486
- a && a.type === F.TEXT ? a.content = (a.content || "") + n : t.push({
487
- type: F.TEXT,
488
- content: n
1406
+ else if (n.type.name === A.TEXT) {
1407
+ const o = n.text || "";
1408
+ if (o) {
1409
+ const l = t[t.length - 1];
1410
+ l && l.type === G.TEXT ? l.content = (l.content || "") + o : t.push({
1411
+ type: G.TEXT,
1412
+ content: o
489
1413
  });
490
1414
  }
491
1415
  }
492
1416
  }
493
1417
  }), t;
494
1418
  }
495
- function Ft(e, t = "@", o) {
496
- return Fe.configure({
1419
+ function Oo(e, t = "@", n) {
1420
+ return Gt.configure({
497
1421
  items: e,
498
1422
  char: t,
499
- ...o
1423
+ ...n
500
1424
  });
501
1425
  }
502
- const Ve = (e, t) => {
1426
+ const Ut = (e, t) => {
503
1427
  if (!t.length)
504
1428
  return [{ text: e, isMatch: !1 }];
505
- const o = [];
506
- for (const a of t) {
507
- if (!a) continue;
508
- let r = 0;
509
- const l = e.toLowerCase(), u = a.toLowerCase();
1429
+ const n = [];
1430
+ for (const l of t) {
1431
+ if (!l) continue;
1432
+ let i = 0;
1433
+ const a = e.toLowerCase(), c = l.toLowerCase();
510
1434
  for (; ; ) {
511
- const p = l.indexOf(u, r);
512
- if (p === -1) break;
513
- o.push({
514
- start: p,
515
- end: p + a.length
516
- }), r = p + 1;
1435
+ const d = a.indexOf(c, i);
1436
+ if (d === -1) break;
1437
+ n.push({
1438
+ start: d,
1439
+ end: d + l.length
1440
+ }), i = d + 1;
517
1441
  }
518
1442
  }
519
- if (o.length === 0)
1443
+ if (n.length === 0)
520
1444
  return [{ text: e, isMatch: !1 }];
521
- o.sort((a, r) => a.start - r.start);
1445
+ n.sort((l, i) => l.start - i.start);
522
1446
  const s = [];
523
- for (const a of o)
1447
+ for (const l of n)
524
1448
  if (s.length === 0)
525
- s.push(a);
1449
+ s.push(l);
526
1450
  else {
527
- const r = s[s.length - 1];
528
- a.start <= r.end ? r.end = Math.max(r.end, a.end) : s.push(a);
1451
+ const i = s[s.length - 1];
1452
+ l.start <= i.end ? i.end = Math.max(i.end, l.end) : s.push(l);
529
1453
  }
530
- const i = [];
531
- let n = 0;
532
- for (const a of s)
533
- n < a.start && i.push({
534
- text: e.substring(n, a.start),
1454
+ const r = [];
1455
+ let o = 0;
1456
+ for (const l of s)
1457
+ o < l.start && r.push({
1458
+ text: e.substring(o, l.start),
535
1459
  isMatch: !1
536
- }), i.push({
537
- text: e.substring(a.start, a.end),
1460
+ }), r.push({
1461
+ text: e.substring(l.start, l.end),
538
1462
  isMatch: !0
539
- }), n = a.end;
540
- return n < e.length && i.push({
541
- text: e.substring(n),
1463
+ }), o = l.end;
1464
+ return o < e.length && r.push({
1465
+ text: e.substring(o),
542
1466
  isMatch: !1
543
- }), i;
544
- }, Vt = (e, t) => !t || !e ? [{ text: e, isMatch: !1 }] : Ve(e, [t]), Gt = (e, t) => {
545
- const { content: o, highlights: s } = e;
546
- return typeof s == "function" ? s(o, t) : Array.isArray(s) ? Ve(o, s) : Vt(o, t);
547
- }, Ut = ["onMouseenter", "onClick"], Xt = { class: "suggestion-list__text" }, Zt = /* @__PURE__ */ G({
1467
+ }), r;
1468
+ }, Do = (e, t) => !t || !e ? [{ text: e, isMatch: !1 }] : Ut(e, [t]), Io = (e, t) => {
1469
+ const { content: n, highlights: s } = e;
1470
+ return typeof s == "function" ? s(n, t) : Array.isArray(s) ? Ut(n, s) : Do(n, t);
1471
+ }, Bo = ["onMouseenter", "onClick"], $o = { class: "suggestion-list__text" }, jo = /* @__PURE__ */ Z({
548
1472
  __name: "suggestion-list",
549
1473
  props: {
550
1474
  show: { type: Boolean },
@@ -558,165 +1482,165 @@ const Ve = (e, t) => {
558
1482
  onMouseLeave: { type: Function }
559
1483
  },
560
1484
  setup(e) {
561
- const t = e, o = W(null), s = (r) => r === t.activeKeyboardIndex || r === t.activeMouseIndex, i = (r) => {
562
- var l;
563
- (l = t.onMouseEnter) == null || l.call(t, r);
564
- }, n = () => {
565
- var r;
566
- (r = t.onMouseLeave) == null || r.call(t);
567
- }, a = (r) => {
568
- var u;
569
- const l = t.suggestions[r];
570
- l && ((u = t.onSelect) == null || u.call(t, it(l)));
1485
+ const t = e, n = F(null), s = (i) => i === t.activeKeyboardIndex || i === t.activeMouseIndex, r = (i) => {
1486
+ var a;
1487
+ (a = t.onMouseEnter) == null || a.call(t, i);
1488
+ }, o = () => {
1489
+ var i;
1490
+ (i = t.onMouseLeave) == null || i.call(t);
1491
+ }, l = (i) => {
1492
+ var c;
1493
+ const a = t.suggestions[i];
1494
+ a && ((c = t.onSelect) == null || c.call(t, un(a)));
571
1495
  };
572
1496
  return K(
573
1497
  () => t.activeKeyboardIndex,
574
- (r) => {
575
- if (r !== -1 && o.value) {
576
- const l = o.value.children[r];
577
- l && l.scrollIntoView({ block: "nearest" });
1498
+ (i) => {
1499
+ if (i !== -1 && n.value) {
1500
+ const a = n.value.children[i];
1501
+ a && a.scrollIntoView({ block: "nearest" });
578
1502
  }
579
1503
  }
580
- ), (r, l) => (w(), V(st, { name: "suggestion-slide-up" }, {
581
- default: B(() => [
582
- t.show && t.suggestions.length ? (w(), P("div", {
1504
+ ), (i, a) => (M(), U(an, { name: "suggestion-slide-up" }, {
1505
+ default: j(() => [
1506
+ t.show && t.suggestions.length ? (M(), P("div", {
583
1507
  key: 0,
584
1508
  ref_key: "suggestionsListRef",
585
- ref: o,
1509
+ ref: n,
586
1510
  class: "suggestion-list",
587
- style: rt(t.popupStyle)
1511
+ style: cn(t.popupStyle)
588
1512
  }, [
589
- (w(!0), P(fe, null, pe(t.suggestions, (u, p) => (w(), P("div", {
590
- key: p,
591
- class: z(["suggestion-list__item", { highlighted: s(p) }]),
592
- onMouseenter: (f) => i(p),
593
- onMouseleave: n,
594
- onClick: (f) => a(p)
1513
+ (M(!0), P(Ie, null, Be(t.suggestions, (c, d) => (M(), P("div", {
1514
+ key: d,
1515
+ class: Q(["suggestion-list__item", { highlighted: s(d) }]),
1516
+ onMouseenter: (u) => r(d),
1517
+ onMouseleave: o,
1518
+ onClick: (u) => l(d)
595
1519
  }, [
596
- X(A(wt), { class: "suggestion-list__icon" }),
597
- R("span", Xt, [
598
- (w(!0), P(fe, null, pe(A(Gt)(u, t.inputValue), (f, E) => (w(), P("span", {
599
- key: E,
600
- class: z({
601
- "suggestion-list__text--match": f.isMatch,
602
- "suggestion-list__text--normal": !f.isMatch
1520
+ se(k(Rn), { class: "suggestion-list__icon" }),
1521
+ B("span", $o, [
1522
+ (M(!0), P(Ie, null, Be(k(Io)(c, t.inputValue), (u, g) => (M(), P("span", {
1523
+ key: g,
1524
+ class: Q({
1525
+ "suggestion-list__text--match": u.isMatch,
1526
+ "suggestion-list__text--normal": !u.isMatch
603
1527
  })
604
- }, ee(f.text), 3))), 128))
1528
+ }, pe(u.text), 3))), 128))
605
1529
  ])
606
- ], 42, Ut))), 128))
607
- ], 4)) : N("", !0)
1530
+ ], 42, Bo))), 128))
1531
+ ], 4)) : q("", !0)
608
1532
  ]),
609
1533
  _: 1
610
1534
  }));
611
1535
  }
612
- }), Yt = /* @__PURE__ */ U(Zt, [["__scopeId", "data-v-76a6f35e"]]), Jt = (e, t) => {
1536
+ }), No = /* @__PURE__ */ J(jo, [["__scopeId", "data-v-76a6f35e"]]), Wo = (e, t) => {
613
1537
  if (!e || !t)
614
1538
  return { text: "", show: !1, showTab: !1 };
615
- const o = e.toLowerCase(), s = t.toLowerCase();
616
- if (!o.startsWith(s))
1539
+ const n = e.toLowerCase(), s = t.toLowerCase();
1540
+ if (!n.startsWith(s))
617
1541
  return { text: "", show: !1, showTab: !1 };
618
- const i = e.substring(t.length), n = i.length > 0;
1542
+ const r = e.substring(t.length), o = r.length > 0;
619
1543
  return {
620
- text: i,
621
- show: n,
622
- showTab: n
1544
+ text: r,
1545
+ show: o,
1546
+ showTab: o
623
1547
  };
624
- }, H = new Z(J.SUGGESTION);
625
- function Qt(e) {
1548
+ }, z = new re(ae.SUGGESTION);
1549
+ function Ko(e) {
626
1550
  const {
627
1551
  editor: t,
628
- activeSuggestionKeys: o = ["Enter"],
1552
+ activeSuggestionKeys: n = ["Enter"],
629
1553
  popupWidth: s = 400,
630
- showAutoComplete: i = !0,
631
- filterFn: n,
632
- onSelect: a
1554
+ showAutoComplete: r = !0,
1555
+ filterFn: o,
1556
+ onSelect: l
633
1557
  } = e;
634
- let r = null, l = null, u = null, p = !1;
635
- function f() {
636
- const d = t.extensionManager.extensions.find(
637
- (_) => _.name === se.SUGGESTION
638
- ), c = d == null ? void 0 : d.options, b = (c == null ? void 0 : c.items) || (c == null ? void 0 : c.suggestions) || [];
639
- return b && typeof b == "object" && "value" in b ? b.value : b;
1558
+ let i = null, a = null, c = null, d = !1;
1559
+ function u() {
1560
+ const p = t.extensionManager.extensions.find(
1561
+ (v) => v.name === be.SUGGESTION
1562
+ ), f = p == null ? void 0 : p.options, x = (f == null ? void 0 : f.items) || (f == null ? void 0 : f.suggestions) || [];
1563
+ return x && typeof x == "object" && "value" in x ? x.value : x;
640
1564
  }
641
- function E(d) {
642
- const c = f();
643
- return n ? n(c, d) : c;
1565
+ function g(p) {
1566
+ const f = u();
1567
+ return o ? o(f, p) : f;
644
1568
  }
645
- function S(d) {
646
- return d;
1569
+ function h(p) {
1570
+ return p;
647
1571
  }
648
- function j(d, c, b) {
649
- if (d === -1 || !b[d])
1572
+ function E(p, f, x) {
1573
+ if (p === -1 || !x[p])
650
1574
  return { text: "", show: !1, showTab: !1 };
651
- const _ = b[d];
652
- return Jt(_.content, c);
1575
+ const v = x[p];
1576
+ return Wo(v.content, f);
653
1577
  }
654
- function L(d, c, b) {
655
- if (!c) return;
656
- (a == null ? void 0 : a(b)) !== !1 && t.commands.setContent(b.content), t.commands.focus();
1578
+ function w(p, f, x) {
1579
+ if (!f) return;
1580
+ (l == null ? void 0 : l(x)) !== !1 && t.commands.setContent(x.content), t.commands.focus();
657
1581
  }
658
- function C(d, c) {
659
- const b = c.filteredSuggestions[c.selectedIndex];
660
- b && L(d, c.range, b);
661
- const _ = d.state.tr;
662
- _.setMeta(H, { type: "close" }), d.dispatch(_);
1582
+ function T(p, f) {
1583
+ const x = f.filteredSuggestions[f.selectedIndex];
1584
+ x && w(p, f.range, x);
1585
+ const v = p.state.tr;
1586
+ v.setMeta(z, { type: "close" }), p.dispatch(v);
663
1587
  }
664
- function h(d, c) {
665
- u == null || u();
666
- const _ = d.dom.closest(".tr-sender") || d.dom, x = () => {
1588
+ function m(p, f) {
1589
+ c == null || c();
1590
+ const v = p.dom.closest(".tr-sender") || p.dom, S = () => {
667
1591
  if (typeof s == "number")
668
1592
  return `${s}px`;
669
1593
  if (typeof s == "string") {
670
1594
  if (s.endsWith("%")) {
671
- const v = parseFloat(s) / 100;
672
- return `${_.offsetWidth * v}px`;
1595
+ const _ = parseFloat(s) / 100;
1596
+ return `${v.offsetWidth * _}px`;
673
1597
  }
674
1598
  return s;
675
1599
  }
676
1600
  return "400px";
677
1601
  };
678
- u = Se(_, c, () => {
679
- Ce(_, c, {
1602
+ c = mt(v, f, () => {
1603
+ yt(v, f, {
680
1604
  placement: "top-start",
681
1605
  middleware: [
682
- Ae(8),
683
- we({
1606
+ ht(8),
1607
+ xt({
684
1608
  fallbackPlacements: ["bottom-start", "top-start"]
685
1609
  }),
686
- ke({ padding: 8 })
1610
+ gt({ padding: 8 })
687
1611
  ]
688
- }).then(({ x: v, y: m }) => {
689
- c.style.position = "absolute", c.style.left = `${v}px`, c.style.top = `${m}px`, c.style.zIndex = "2000", c.style.width = x();
1612
+ }).then(({ x: _, y: b }) => {
1613
+ f.style.position = "absolute", f.style.left = `${_}px`, f.style.top = `${b}px`, f.style.zIndex = "2000", f.style.width = S();
690
1614
  });
691
1615
  });
692
1616
  }
693
- function g(d) {
694
- if (!i || !d.active || !d.autoCompleteText || !d.range)
695
- return le.empty;
696
- const c = t.state.doc, { selection: b } = t.state, _ = b.$head.pos;
697
- if (!(_ >= c.content.size - 1))
698
- return le.empty;
699
- const v = He.widget(
700
- _,
1617
+ function y(p) {
1618
+ if (!r || !p.active || !p.autoCompleteText || !p.range)
1619
+ return Le.empty;
1620
+ const f = t.state.doc, { selection: x } = t.state, v = x.$head.pos;
1621
+ if (!(v >= f.content.size - 1))
1622
+ return Le.empty;
1623
+ const _ = Dt.widget(
1624
+ v,
701
1625
  () => {
702
- const m = document.createElement("span");
703
- m.className = "suggestion-autocomplete", m.contentEditable = "false";
704
- const k = document.createElement("span");
705
- if (k.className = "autocomplete-text", k.textContent = d.autoCompleteText, m.appendChild(k), d.showTabIndicator) {
1626
+ const b = document.createElement("span");
1627
+ b.className = "suggestion-autocomplete", b.contentEditable = "false";
1628
+ const L = document.createElement("span");
1629
+ if (L.className = "autocomplete-text", L.textContent = p.autoCompleteText, b.appendChild(L), p.showTabIndicator) {
706
1630
  const $ = document.createElement("span");
707
- $.className = "tab-hint", $.textContent = "TAB", m.appendChild($);
1631
+ $.className = "tab-hint", $.textContent = "TAB", b.appendChild($);
708
1632
  }
709
- return m;
1633
+ return b;
710
1634
  },
711
1635
  {
712
1636
  side: 1
713
1637
  // 显示在光标右侧
714
1638
  }
715
1639
  );
716
- return le.create(c, [v]);
1640
+ return Le.create(f, [_]);
717
1641
  }
718
- return new Y({
719
- key: H,
1642
+ return new ie({
1643
+ key: z,
720
1644
  state: {
721
1645
  init() {
722
1646
  return {
@@ -729,12 +1653,12 @@ function Qt(e) {
729
1653
  showTabIndicator: !1
730
1654
  };
731
1655
  },
732
- apply(d, c) {
733
- const b = d.getMeta(H);
734
- if (b) {
735
- if (b.type === "close")
736
- return p = !0, setTimeout(() => {
737
- p = !1;
1656
+ apply(p, f) {
1657
+ const x = p.getMeta(z);
1658
+ if (x) {
1659
+ if (x.type === "close")
1660
+ return d = !0, setTimeout(() => {
1661
+ d = !1;
738
1662
  }, 0), {
739
1663
  active: !1,
740
1664
  range: null,
@@ -744,19 +1668,19 @@ function Qt(e) {
744
1668
  autoCompleteText: "",
745
1669
  showTabIndicator: !1
746
1670
  };
747
- if (b.type === "updateIndex") {
748
- const k = { ...c, selectedIndex: b.index }, $ = j(b.index, c.query, c.filteredSuggestions);
1671
+ if (x.type === "updateIndex") {
1672
+ const L = { ...f, selectedIndex: x.index }, $ = E(x.index, f.query, f.filteredSuggestions);
749
1673
  return {
750
- ...k,
1674
+ ...L,
751
1675
  autoCompleteText: $.text,
752
1676
  showTabIndicator: $.showTab
753
1677
  };
754
1678
  }
755
1679
  }
756
- if (p || !d.docChanged && !d.selectionSet)
757
- return c;
758
- const _ = d.doc.textContent.trim(), x = _;
759
- if (!_)
1680
+ if (d || !p.docChanged && !p.selectionSet)
1681
+ return f;
1682
+ const v = p.doc.textContent.trim(), S = v;
1683
+ if (!v)
760
1684
  return {
761
1685
  active: !1,
762
1686
  range: null,
@@ -766,8 +1690,8 @@ function Qt(e) {
766
1690
  autoCompleteText: "",
767
1691
  showTabIndicator: !1
768
1692
  };
769
- const v = E(x);
770
- if (v.length === 0)
1693
+ const _ = g(S);
1694
+ if (_.length === 0)
771
1695
  return {
772
1696
  active: !1,
773
1697
  range: null,
@@ -777,23 +1701,23 @@ function Qt(e) {
777
1701
  autoCompleteText: "",
778
1702
  showTabIndicator: !1
779
1703
  };
780
- const m = j(0, x, v);
1704
+ const b = E(0, S, _);
781
1705
  return {
782
1706
  active: !0,
783
- range: { from: 0, to: d.doc.content.size },
784
- query: x,
785
- filteredSuggestions: v,
1707
+ range: { from: 0, to: p.doc.content.size },
1708
+ query: S,
1709
+ filteredSuggestions: _,
786
1710
  selectedIndex: 0,
787
- autoCompleteText: m.text,
788
- showTabIndicator: m.showTab
1711
+ autoCompleteText: b.text,
1712
+ showTabIndicator: b.showTab
789
1713
  };
790
1714
  }
791
1715
  },
792
1716
  props: {
793
- decorations(d) {
794
- const c = this.getState(d);
795
- return g(
796
- c || {
1717
+ decorations(p) {
1718
+ const f = this.getState(p);
1719
+ return y(
1720
+ f || {
797
1721
  active: !1,
798
1722
  range: null,
799
1723
  autoCompleteText: "",
@@ -801,79 +1725,79 @@ function Qt(e) {
801
1725
  }
802
1726
  );
803
1727
  },
804
- handleKeyDown(d, c) {
805
- const b = H.getState(d.state);
806
- if (!(b != null && b.active))
1728
+ handleKeyDown(p, f) {
1729
+ const x = z.getState(p.state);
1730
+ if (!(x != null && x.active))
807
1731
  return !1;
808
- if (I(c, "TAB") && b.autoCompleteText)
809
- return c.preventDefault(), C(d, b), !0;
810
- if (ie(c, ["ARROW_UP", "ARROW_DOWN"])) {
811
- c.preventDefault();
812
- const _ = I(c, "ARROW_DOWN") ? 1 : -1, x = b.filteredSuggestions.length;
813
- let v = b.selectedIndex + _;
814
- v < 0 ? v = x - 1 : v >= x && (v = 0);
815
- const m = d.state.tr;
816
- return m.setMeta(H, {
1732
+ if (I(f, "TAB") && x.autoCompleteText)
1733
+ return f.preventDefault(), T(p, x), !0;
1734
+ if (we(f, ["ARROW_UP", "ARROW_DOWN"])) {
1735
+ f.preventDefault();
1736
+ const v = I(f, "ARROW_DOWN") ? 1 : -1, S = x.filteredSuggestions.length;
1737
+ let _ = x.selectedIndex + v;
1738
+ _ < 0 ? _ = S - 1 : _ >= S && (_ = 0);
1739
+ const b = p.state.tr;
1740
+ return b.setMeta(z, {
817
1741
  type: "updateIndex",
818
- index: v
819
- }), d.dispatch(m), !0;
1742
+ index: _
1743
+ }), p.dispatch(b), !0;
820
1744
  }
821
- if (o.includes(c.key))
822
- return c.preventDefault(), C(d, b), !0;
823
- if (I(c, "ESCAPE")) {
824
- c.preventDefault();
825
- const _ = d.state.tr;
826
- return _.setMeta(H, { type: "close" }), d.dispatch(_), !0;
1745
+ if (n.includes(f.key))
1746
+ return f.preventDefault(), T(p, x), !0;
1747
+ if (I(f, "ESCAPE")) {
1748
+ f.preventDefault();
1749
+ const v = p.state.tr;
1750
+ return v.setMeta(z, { type: "close" }), p.dispatch(v), !0;
827
1751
  }
828
1752
  return !1;
829
1753
  }
830
1754
  },
831
1755
  view() {
832
1756
  return {
833
- update(d) {
834
- const c = H.getState(d.state);
835
- c != null && c.active && c.filteredSuggestions.length > 0 ? (r ? r.updateProps({
836
- show: c.active && c.filteredSuggestions.length > 0,
837
- suggestions: c.filteredSuggestions,
1757
+ update(p) {
1758
+ const f = z.getState(p.state);
1759
+ f != null && f.active && f.filteredSuggestions.length > 0 ? (i ? i.updateProps({
1760
+ show: f.active && f.filteredSuggestions.length > 0,
1761
+ suggestions: f.filteredSuggestions,
838
1762
  popupStyle: {
839
1763
  // 宽度在 computePosition 回调中动态设置,这里只设置 maxWidth
840
1764
  maxWidth: "100%"
841
1765
  },
842
- activeKeyboardIndex: c.selectedIndex,
843
- inputValue: c.query
844
- }) : (r = new Ne(Yt, {
1766
+ activeKeyboardIndex: f.selectedIndex,
1767
+ inputValue: f.query
1768
+ }) : (i = new Ot(No, {
845
1769
  props: {
846
- show: c.active && c.filteredSuggestions.length > 0,
847
- suggestions: c.filteredSuggestions,
1770
+ show: f.active && f.filteredSuggestions.length > 0,
1771
+ suggestions: f.filteredSuggestions,
848
1772
  popupStyle: {
849
1773
  // 宽度在 computePosition 回调中动态设置,这里只设置 maxWidth
850
1774
  maxWidth: "100%"
851
1775
  },
852
- activeKeyboardIndex: c.selectedIndex,
1776
+ activeKeyboardIndex: f.selectedIndex,
853
1777
  activeMouseIndex: -1,
854
- inputValue: c.query,
855
- onSelect: (b) => {
856
- L(d, c.range, b);
857
- const _ = d.state.tr;
858
- _.setMeta(H, { type: "close" }), d.dispatch(_);
1778
+ inputValue: f.query,
1779
+ onSelect: (x) => {
1780
+ w(p, f.range, x);
1781
+ const v = p.state.tr;
1782
+ v.setMeta(z, { type: "close" }), p.dispatch(v);
859
1783
  },
860
- onMouseEnter: (b) => {
861
- const _ = d.state.tr;
862
- _.setMeta(H, { type: "updateIndex", index: b }), d.dispatch(_);
1784
+ onMouseEnter: (x) => {
1785
+ const v = p.state.tr;
1786
+ v.setMeta(z, { type: "updateIndex", index: x }), p.dispatch(v);
863
1787
  }
864
1788
  },
865
1789
  editor: t
866
- }), l = r.element, document.body.appendChild(l)), l && h(d, l)) : (r && (u == null || u(), u = null, r.destroy(), r = null), l && (l.remove(), l = null));
1790
+ }), a = i.element, document.body.appendChild(a)), a && m(p, a)) : (i && (c == null || c(), c = null, i.destroy(), i = null), a && (a.remove(), a = null));
867
1791
  },
868
1792
  destroy() {
869
- u == null || u(), r == null || r.destroy(), l == null || l.remove();
1793
+ c == null || c(), i == null || i.destroy(), a == null || a.remove();
870
1794
  }
871
1795
  };
872
1796
  }
873
1797
  });
874
1798
  }
875
- const Ge = We.create({
876
- name: se.SUGGESTION,
1799
+ const Xt = It.create({
1800
+ name: be.SUGGESTION,
877
1801
  addOptions() {
878
1802
  return {
879
1803
  items: [],
@@ -889,11 +1813,11 @@ const Ge = We.create({
889
1813
  };
890
1814
  },
891
1815
  onCreate() {
892
- ce(this.options.items) && (this.storage.watchStopHandle = K(
1816
+ ke(this.options.items) && (this.storage.watchStopHandle = K(
893
1817
  this.options.items,
894
1818
  () => {
895
1819
  const e = this.editor.state.tr;
896
- e.setMeta(H, { type: "update" }), this.editor.view.dispatch(e);
1820
+ e.setMeta(z, { type: "update" }), this.editor.view.dispatch(e);
897
1821
  },
898
1822
  { deep: !0 }
899
1823
  ));
@@ -903,77 +1827,77 @@ const Ge = We.create({
903
1827
  },
904
1828
  addProseMirrorPlugins() {
905
1829
  return [
906
- Qt({
1830
+ Ko({
907
1831
  editor: this.editor,
908
1832
  ...this.options
909
1833
  })
910
1834
  ];
911
1835
  }
912
1836
  });
913
- function en(e, t) {
914
- return Ge.configure({
1837
+ function qo(e, t) {
1838
+ return Xt.configure({
915
1839
  items: e,
916
1840
  ...t
917
1841
  });
918
1842
  }
919
- function tn(e) {
1843
+ function Ho(e) {
920
1844
  const t = [];
921
- return e.state.doc.descendants((o, s) => {
922
- o.type.name === T.TEMPLATE_BLOCK && t.push({ node: o, pos: s });
1845
+ return e.state.doc.descendants((n, s) => {
1846
+ n.type.name === A.TEMPLATE_BLOCK && t.push({ node: n, pos: s });
923
1847
  }), t;
924
1848
  }
925
- const nn = {
1849
+ const zo = {
926
1850
  /**
927
1851
  * 设置模板数据(批量)
928
1852
  */
929
1853
  setTemplateData: (e) => ({ commands: t }) => {
930
1854
  t.clearContent();
931
- const o = [];
1855
+ const n = [];
932
1856
  return e.forEach((s) => {
933
- s.type === F.TEXT ? s.content && o.push({
934
- type: T.TEXT,
1857
+ s.type === G.TEXT ? s.content && n.push({
1858
+ type: A.TEXT,
935
1859
  text: s.content
936
- }) : s.type === F.BLOCK ? o.push({
937
- type: T.TEMPLATE_BLOCK,
1860
+ }) : s.type === G.BLOCK ? n.push({
1861
+ type: A.TEMPLATE_BLOCK,
938
1862
  attrs: {
939
- id: s.id || re("template"),
1863
+ id: s.id || ve("template"),
940
1864
  content: s.content
941
1865
  },
942
1866
  content: s.content ? [
943
1867
  {
944
- type: T.TEXT,
1868
+ type: A.TEXT,
945
1869
  text: s.content
946
1870
  }
947
1871
  ] : []
948
- }) : s.type === F.SELECT && o.push({
949
- type: T.TEMPLATE_SELECT,
1872
+ }) : s.type === G.SELECT && n.push({
1873
+ type: A.TEMPLATE_SELECT,
950
1874
  attrs: {
951
- id: s.id || re("select"),
1875
+ id: s.id || ve("select"),
952
1876
  placeholder: s.placeholder,
953
1877
  options: s.options,
954
1878
  value: s.value || null
955
1879
  }
956
1880
  });
957
- }), o.length > 0 && t.insertContent({
958
- type: T.PARAGRAPH,
959
- content: o
1881
+ }), n.length > 0 && t.insertContent({
1882
+ type: A.PARAGRAPH,
1883
+ content: n
960
1884
  }), !0;
961
1885
  },
962
1886
  /**
963
1887
  * 插入模板块
964
1888
  */
965
1889
  insertTemplate: (e) => ({ commands: t }) => {
966
- const o = e.content || "";
1890
+ const n = e.content || "";
967
1891
  return t.insertContent({
968
- type: T.TEMPLATE_BLOCK,
1892
+ type: A.TEMPLATE_BLOCK,
969
1893
  attrs: {
970
- id: e.id || re("template"),
971
- content: o
1894
+ id: e.id || ve("template"),
1895
+ content: n
972
1896
  },
973
- content: o ? [
1897
+ content: n ? [
974
1898
  {
975
- type: T.TEXT,
976
- text: o
1899
+ type: A.TEXT,
1900
+ text: n
977
1901
  }
978
1902
  ] : []
979
1903
  });
@@ -982,22 +1906,22 @@ const nn = {
982
1906
  * 聚焦到第一个模板块
983
1907
  */
984
1908
  focusFirstTemplate: () => ({ editor: e }) => {
985
- const t = tn(e);
1909
+ const t = Ho(e);
986
1910
  return setTimeout(() => {
987
- var n;
988
- const { state: o, view: s } = e, i = o.tr;
1911
+ var o;
1912
+ const { state: n, view: s } = e, r = n.tr;
989
1913
  try {
990
- let a;
1914
+ let l;
991
1915
  if (t.length === 0)
992
- a = o.doc.content.size - 1;
1916
+ l = n.doc.content.size - 1;
993
1917
  else {
994
- const { node: l, pos: u } = t[0], p = ((n = l.textContent) == null ? void 0 : n.length) || 0;
995
- a = u + 1 + p;
1918
+ const { node: a, pos: c } = t[0], d = ((o = a.textContent) == null ? void 0 : o.length) || 0;
1919
+ l = c + 1 + d;
996
1920
  }
997
- const r = D.create(o.doc, a);
998
- i.setSelection(r), s.dispatch(i), s.focus();
999
- } catch (a) {
1000
- console.error("[focusFirstTemplate] 设置光标失败", a);
1921
+ const i = O.create(n.doc, l);
1922
+ r.setSelection(i), s.dispatch(r), s.focus();
1923
+ } catch (l) {
1924
+ console.error("[focusFirstTemplate] 设置光标失败", l);
1001
1925
  }
1002
1926
  }, 0), !0;
1003
1927
  },
@@ -1005,72 +1929,72 @@ const nn = {
1005
1929
  * 插入选择器
1006
1930
  */
1007
1931
  insertTemplateSelect: (e) => ({ commands: t }) => t.insertContent({
1008
- type: T.TEMPLATE_SELECT,
1932
+ type: A.TEMPLATE_SELECT,
1009
1933
  attrs: {
1010
- id: e.id || re("select"),
1934
+ id: e.id || ve("select"),
1011
1935
  placeholder: e.placeholder || "Please select",
1012
1936
  options: e.options || [],
1013
1937
  value: e.value || null
1014
1938
  }
1015
1939
  })
1016
- }, y = "​";
1017
- function be(e) {
1018
- return Ue(e).map((o) => o.content).join("");
1940
+ }, C = "​";
1941
+ function tt(e) {
1942
+ return Yt(e).map((n) => n.content).join("");
1019
1943
  }
1020
- function Ue(e) {
1944
+ function Yt(e) {
1021
1945
  const t = [];
1022
- return e.state.doc.descendants((o, s, i) => {
1023
- if (i && i.type.name === T.PARAGRAPH) {
1024
- if (o.type.name === T.TEMPLATE_BLOCK) {
1025
- const n = (o.textContent || "").replace(new RegExp(y, "g"), "");
1946
+ return e.state.doc.descendants((n, s, r) => {
1947
+ if (r && r.type.name === A.PARAGRAPH) {
1948
+ if (n.type.name === A.TEMPLATE_BLOCK) {
1949
+ const o = (n.textContent || "").replace(new RegExp(C, "g"), "");
1026
1950
  t.push({
1027
- type: F.BLOCK,
1028
- content: n
1951
+ type: G.BLOCK,
1952
+ content: o
1029
1953
  });
1030
- } else if (o.type.name === T.TEMPLATE_SELECT) {
1031
- const n = o.attrs.options.find((r) => r.value === o.attrs.value), a = (n == null ? void 0 : n.value) || "";
1954
+ } else if (n.type.name === A.TEMPLATE_SELECT) {
1955
+ const o = n.attrs.options.find((i) => i.value === n.attrs.value), l = (o == null ? void 0 : o.value) || "";
1032
1956
  t.push({
1033
- type: F.SELECT,
1034
- content: a
1957
+ type: G.SELECT,
1958
+ content: l
1035
1959
  });
1036
- } else if (o.type.name === T.TEXT) {
1037
- const n = (o.text || "").replace(new RegExp(y, "g"), "");
1038
- if (n) {
1039
- const a = t[t.length - 1];
1040
- a && a.type === F.TEXT ? a.content += n : t.push({
1041
- type: F.TEXT,
1042
- content: n
1960
+ } else if (n.type.name === A.TEXT) {
1961
+ const o = (n.text || "").replace(new RegExp(C, "g"), "");
1962
+ if (o) {
1963
+ const l = t[t.length - 1];
1964
+ l && l.type === G.TEXT ? l.content += o : t.push({
1965
+ type: G.TEXT,
1966
+ content: o
1043
1967
  });
1044
1968
  }
1045
1969
  }
1046
1970
  }
1047
1971
  }), t;
1048
1972
  }
1049
- const on = /* @__PURE__ */ G({
1973
+ const Fo = /* @__PURE__ */ Z({
1050
1974
  __name: "template-block-view",
1051
1975
  props: {
1052
1976
  node: {}
1053
1977
  },
1054
1978
  setup(e) {
1055
- const t = e, o = M(() => {
1979
+ const t = e, n = R(() => {
1056
1980
  const s = t.node.textContent || "";
1057
- return s.length === 0 || s === y;
1981
+ return s.length === 0 || s === C;
1058
1982
  });
1059
- return (s, i) => (w(), V(A(Ee), {
1983
+ return (s, r) => (M(), U(k(lt), {
1060
1984
  as: "span",
1061
- class: z(["template-block", { "is-empty": o.value }]),
1985
+ class: Q(["template-block", { "is-empty": n.value }]),
1062
1986
  "data-id": e.node.attrs.id
1063
1987
  }, {
1064
- default: B(() => [
1065
- i[0] || (i[0] = R("span", {
1988
+ default: j(() => [
1989
+ r[0] || (r[0] = B("span", {
1066
1990
  contenteditable: "false",
1067
1991
  class: "template-block__prefix"
1068
1992
  }, " ", -1)),
1069
- X(A(ht), {
1993
+ se(k(bn), {
1070
1994
  as: "span",
1071
1995
  class: "template-block__content"
1072
1996
  }),
1073
- i[1] || (i[1] = R("span", {
1997
+ r[1] || (r[1] = B("span", {
1074
1998
  contenteditable: "false",
1075
1999
  class: "template-block__suffix"
1076
2000
  }, " ", -1))
@@ -1078,237 +2002,237 @@ const on = /* @__PURE__ */ G({
1078
2002
  _: 1
1079
2003
  }, 8, ["class", "data-id"]));
1080
2004
  }
1081
- }), sn = /* @__PURE__ */ U(on, [["__scopeId", "data-v-aa55b9db"]]);
1082
- function rn(e) {
2005
+ }), Vo = /* @__PURE__ */ J(Fo, [["__scopeId", "data-v-aa55b9db"]]);
2006
+ function Go(e) {
1083
2007
  const t = [];
1084
- let { tr: o } = e;
1085
- return e.doc.descendants((s, i, n) => {
1086
- if (s.type.name === T.PARAGRAPH && s.childCount > 0) {
1087
- const { lastChild: a, firstChild: r } = s;
1088
- if (r && r.type.name === T.TEMPLATE_BLOCK && t.push(i + 1), a && a.type.name === T.TEMPLATE_BLOCK) {
1089
- const l = i + s.nodeSize - 1;
1090
- o.doc.textBetween(l - 1, l, "", "") !== y && t.push(l);
2008
+ let { tr: n } = e;
2009
+ return e.doc.descendants((s, r, o) => {
2010
+ if (s.type.name === A.PARAGRAPH && s.childCount > 0) {
2011
+ const { lastChild: l, firstChild: i } = s;
2012
+ if (i && i.type.name === A.TEMPLATE_BLOCK && t.push(r + 1), l && l.type.name === A.TEMPLATE_BLOCK) {
2013
+ const a = r + s.nodeSize - 1;
2014
+ n.doc.textBetween(a - 1, a, "", "") !== C && t.push(a);
1091
2015
  }
1092
- a === r && a && a.isText && a.text === y && t.push(["remove", i + 1]);
2016
+ l === i && l && l.isText && l.text === C && t.push(["remove", r + 1]);
1093
2017
  }
1094
- if (s.type.name === T.TEMPLATE_BLOCK && s.content.size === 0 && t.push(i + 1), s.type.name === T.TEMPLATE_BLOCK && n) {
1095
- let a = -1;
1096
- if (n.forEach((r, l, u) => {
1097
- r === s && (a = u);
1098
- }), a > -1 && a < n.childCount - 1 && n.child(a + 1).type.name === T.TEMPLATE_BLOCK) {
1099
- const l = i + s.nodeSize;
1100
- o.doc.textBetween(l, l + 1, "", "") !== y && t.push(l);
2018
+ if (s.type.name === A.TEMPLATE_BLOCK && s.content.size === 0 && t.push(r + 1), s.type.name === A.TEMPLATE_BLOCK && o) {
2019
+ let l = -1;
2020
+ if (o.forEach((i, a, c) => {
2021
+ i === s && (l = c);
2022
+ }), l > -1 && l < o.childCount - 1 && o.child(l + 1).type.name === A.TEMPLATE_BLOCK) {
2023
+ const a = r + s.nodeSize;
2024
+ n.doc.textBetween(a, a + 1, "", "") !== C && t.push(a);
1101
2025
  }
1102
2026
  }
1103
- }), t.length > 0 ? (t.sort((s, i) => {
1104
- const n = Array.isArray(s) ? s[1] : s;
1105
- return (Array.isArray(i) ? i[1] : i) - n;
2027
+ }), t.length > 0 ? (t.sort((s, r) => {
2028
+ const o = Array.isArray(s) ? s[1] : s;
2029
+ return (Array.isArray(r) ? r[1] : r) - o;
1106
2030
  }).forEach((s) => {
1107
- Array.isArray(s) && s[0] === "remove" ? o = o.delete(s[1], s[1] + 1) : typeof s == "number" && (o = o.insertText(y, s, s));
1108
- }), o) : null;
1109
- }
1110
- function an() {
1111
- return new Y({
1112
- key: new Z(J.TEMPLATE_BLOCK_ZERO_WIDTH),
1113
- appendTransaction(e, t, o) {
1114
- return e.some((i) => i.docChanged) ? rn(o) : null;
2031
+ Array.isArray(s) && s[0] === "remove" ? n = n.delete(s[1], s[1] + 1) : typeof s == "number" && (n = n.insertText(C, s, s));
2032
+ }), n) : null;
2033
+ }
2034
+ function Uo() {
2035
+ return new ie({
2036
+ key: new re(ae.TEMPLATE_BLOCK_ZERO_WIDTH),
2037
+ appendTransaction(e, t, n) {
2038
+ return e.some((r) => r.docChanged) ? Go(n) : null;
1115
2039
  }
1116
2040
  });
1117
2041
  }
1118
- function ln() {
1119
- return new Y({
1120
- key: new Z(J.TEMPLATE_BLOCK_KEYBOARD),
2042
+ function Xo() {
2043
+ return new ie({
2044
+ key: new re(ae.TEMPLATE_BLOCK_KEYBOARD),
1121
2045
  props: {
1122
2046
  handleKeyDown(e, t) {
1123
- var r, l, u, p, f, E, S, j, L;
1124
- const { state: o, dispatch: s } = e, { selection: i } = o, { $from: n } = i;
1125
- if (I(t, "ARROW_LEFT") && n.nodeBefore && n.nodeBefore.isText && n.nodeBefore.text && n.nodeBefore.text === y) {
1126
- const C = n.parent, h = n.index();
1127
- if (h >= 2) {
1128
- if (C.child(h - 2).type.name === T.TEMPLATE_BLOCK) {
1129
- const d = n.pos - 2;
1130
- return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2047
+ var i, a, c, d, u, g, h, E, w;
2048
+ const { state: n, dispatch: s } = e, { selection: r } = n, { $from: o } = r;
2049
+ if (I(t, "ARROW_LEFT") && o.nodeBefore && o.nodeBefore.isText && o.nodeBefore.text && o.nodeBefore.text === C) {
2050
+ const T = o.parent, m = o.index();
2051
+ if (m >= 2) {
2052
+ if (T.child(m - 2).type.name === A.TEMPLATE_BLOCK) {
2053
+ const p = o.pos - 2;
2054
+ return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
1131
2055
  }
1132
- } else if (h === 1 && n.pos !== 0) {
1133
- const g = n.before() - 1;
1134
- if (g >= 0)
1135
- return s(o.tr.setSelection(D.create(o.doc, g))), t.preventDefault(), !0;
2056
+ } else if (m === 1 && o.pos !== 0) {
2057
+ const y = o.before() - 1;
2058
+ if (y >= 0)
2059
+ return s(n.tr.setSelection(O.create(n.doc, y))), t.preventDefault(), !0;
1136
2060
  }
1137
2061
  }
1138
- if (I(t, "ARROW_RIGHT") && n.nodeAfter && n.nodeAfter.isText && n.nodeAfter.text === y) {
1139
- const C = n.parent, h = n.index();
1140
- if (h < C.childCount - 1) {
1141
- if (C.child(h + 1).type.name === T.TEMPLATE_BLOCK) {
1142
- const d = n.pos + 2;
1143
- return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2062
+ if (I(t, "ARROW_RIGHT") && o.nodeAfter && o.nodeAfter.isText && o.nodeAfter.text === C) {
2063
+ const T = o.parent, m = o.index();
2064
+ if (m < T.childCount - 1) {
2065
+ if (T.child(m + 1).type.name === A.TEMPLATE_BLOCK) {
2066
+ const p = o.pos + 2;
2067
+ return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
1144
2068
  }
1145
- } else if (h === C.childCount - 1 && o.doc.lastChild !== n.node()) {
1146
- const g = n.after() + 1;
1147
- return s(o.tr.setSelection(D.create(o.doc, g))), t.preventDefault(), !0;
2069
+ } else if (m === T.childCount - 1 && n.doc.lastChild !== o.node()) {
2070
+ const y = o.after() + 1;
2071
+ return s(n.tr.setSelection(O.create(n.doc, y))), t.preventDefault(), !0;
1148
2072
  }
1149
2073
  }
1150
- const a = n.node();
1151
- if (a.type.name === T.TEMPLATE_BLOCK) {
1152
- const C = a.textContent || "";
1153
- if (C === "" || C === y) {
1154
- if (ie(t, ["ARROW_LEFT", "ARROW_RIGHT"])) {
1155
- const h = I(t, "ARROW_LEFT") ? n.before() : n.after();
1156
- if (i.from !== h)
1157
- return s(o.tr.setSelection(D.create(o.doc, h))), t.preventDefault(), !0;
2074
+ const l = o.node();
2075
+ if (l.type.name === A.TEMPLATE_BLOCK) {
2076
+ const T = l.textContent || "";
2077
+ if (T === "" || T === C) {
2078
+ if (we(t, ["ARROW_LEFT", "ARROW_RIGHT"])) {
2079
+ const m = I(t, "ARROW_LEFT") ? o.before() : o.after();
2080
+ if (r.from !== m)
2081
+ return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
1158
2082
  }
1159
2083
  } else {
1160
- if (I(t, "ARROW_LEFT") && n.pos === n.start()) {
1161
- const h = n.before();
1162
- return s(o.tr.setSelection(D.create(o.doc, h))), t.preventDefault(), !0;
2084
+ if (I(t, "ARROW_LEFT") && o.pos === o.start()) {
2085
+ const m = o.before();
2086
+ return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
1163
2087
  }
1164
- if (I(t, "ARROW_RIGHT") && n.pos === n.end()) {
1165
- const h = n.after();
1166
- return s(o.tr.setSelection(D.create(o.doc, h))), t.preventDefault(), !0;
2088
+ if (I(t, "ARROW_RIGHT") && o.pos === o.end()) {
2089
+ const m = o.after();
2090
+ return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
1167
2091
  }
1168
2092
  }
1169
2093
  }
1170
- if (I(t, "BACKSPACE") && i.empty) {
1171
- const C = n.node(), h = n.nodeBefore;
1172
- if (C.type.name === T.TEMPLATE_BLOCK) {
1173
- const g = C.textContent || "";
1174
- if (n.pos === n.end() && g.length === 1 && g !== y) {
1175
- const d = n.pos - 1;
1176
- return s(o.tr.insertText(y, d, d + 1)), t.preventDefault(), !0;
2094
+ if (I(t, "BACKSPACE") && r.empty) {
2095
+ const T = o.node(), m = o.nodeBefore;
2096
+ if (T.type.name === A.TEMPLATE_BLOCK) {
2097
+ const y = T.textContent || "";
2098
+ if (o.pos === o.end() && y.length === 1 && y !== C) {
2099
+ const p = o.pos - 1;
2100
+ return s(n.tr.insertText(C, p, p + 1)), t.preventDefault(), !0;
1177
2101
  }
1178
- if (g === y) {
1179
- const d = n.before(), c = o.tr.setSelection(D.create(o.doc, d));
1180
- return s(c), t.preventDefault(), !0;
2102
+ if (y === C) {
2103
+ const p = o.before(), f = n.tr.setSelection(O.create(n.doc, p));
2104
+ return s(f), t.preventDefault(), !0;
1181
2105
  }
1182
- if (g === "") {
1183
- const d = n.before(), c = o.tr.setSelection(D.create(o.doc, d));
1184
- return s(c), t.preventDefault(), !0;
2106
+ if (y === "") {
2107
+ const p = o.before(), f = n.tr.setSelection(O.create(n.doc, p));
2108
+ return s(f), t.preventDefault(), !0;
1185
2109
  }
1186
- if (n.pos === n.start() && g.length > 0 && g !== y) {
1187
- const d = n.before();
1188
- return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2110
+ if (o.pos === o.start() && y.length > 0 && y !== C) {
2111
+ const p = o.before();
2112
+ return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
1189
2113
  }
1190
2114
  return !1;
1191
2115
  }
1192
- if (h && h.isText && ((r = h.text) == null ? void 0 : r.length) === 1 && h.text !== y && n.nodeAfter && n.nodeAfter.type.name === T.TEMPLATE_BLOCK) {
1193
- const g = n.pos - h.nodeSize, d = n.pos;
1194
- let c = o.tr.delete(g, d);
1195
- return c = c.insertText(y, g, g), s(c), t.preventDefault(), !0;
2116
+ if (m && m.isText && ((i = m.text) == null ? void 0 : i.length) === 1 && m.text !== C && o.nodeAfter && o.nodeAfter.type.name === A.TEMPLATE_BLOCK) {
2117
+ const y = o.pos - m.nodeSize, p = o.pos;
2118
+ let f = n.tr.delete(y, p);
2119
+ return f = f.insertText(C, y, y), s(f), t.preventDefault(), !0;
1196
2120
  }
1197
- if (h && h.type.name === T.TEMPLATE_BLOCK) {
1198
- const g = h.textContent || "";
1199
- if (g.length === 0 || g === y) {
1200
- const c = n.parent, b = n.index(), _ = n.nodeAfter;
1201
- let x = n.pos - h.nodeSize, v = n.pos;
1202
- if (b > 1) {
1203
- const m = c.child(b - 2);
1204
- m && m.isText && m.text === y && (x = x - 1);
2121
+ if (m && m.type.name === A.TEMPLATE_BLOCK) {
2122
+ const y = m.textContent || "";
2123
+ if (y.length === 0 || y === C) {
2124
+ const f = o.parent, x = o.index(), v = o.nodeAfter;
2125
+ let S = o.pos - m.nodeSize, _ = o.pos;
2126
+ if (x > 1) {
2127
+ const b = f.child(x - 2);
2128
+ b && b.isText && b.text === C && (S = S - 1);
1205
2129
  }
1206
- return _ && _.isText && ((l = _.text) != null && l.startsWith(y)) && (v = v + 1), s(o.tr.delete(x, v)), t.preventDefault(), !0;
2130
+ return v && v.isText && ((a = v.text) != null && a.startsWith(C)) && (_ = _ + 1), s(n.tr.delete(S, _)), t.preventDefault(), !0;
1207
2131
  } else {
1208
- const c = n.pos - 1;
1209
- return s(o.tr.setSelection(D.create(o.doc, c))), t.preventDefault(), !0;
2132
+ const f = o.pos - 1;
2133
+ return s(n.tr.setSelection(O.create(n.doc, f))), t.preventDefault(), !0;
1210
2134
  }
1211
2135
  }
1212
- if (h && h.isText) {
1213
- const g = n.parent, d = n.index();
1214
- if (h.text === y) {
1215
- if (d > 1) {
1216
- const c = g.child(d - 2);
1217
- if (c.type.name === T.TEMPLATE_BLOCK) {
1218
- const b = c.textContent || "";
1219
- if (b.length === 0 || b === y) {
1220
- const x = n.pos - h.nodeSize - c.nodeSize, v = n.nodeAfter;
1221
- let m = n.pos;
1222
- return v && v.isText && v.text === y && (m = m + 1), s(o.tr.delete(x, m)), t.preventDefault(), !0;
2136
+ if (m && m.isText) {
2137
+ const y = o.parent, p = o.index();
2138
+ if (m.text === C) {
2139
+ if (p > 1) {
2140
+ const f = y.child(p - 2);
2141
+ if (f.type.name === A.TEMPLATE_BLOCK) {
2142
+ const x = f.textContent || "";
2143
+ if (x.length === 0 || x === C) {
2144
+ const S = o.pos - m.nodeSize - f.nodeSize, _ = o.nodeAfter;
2145
+ let b = o.pos;
2146
+ return _ && _.isText && _.text === C && (b = b + 1), s(n.tr.delete(S, b)), t.preventDefault(), !0;
1223
2147
  } else {
1224
- const x = n.pos - 2;
1225
- if (x >= 0)
1226
- return s(o.tr.setSelection(D.create(o.doc, x))), t.preventDefault(), !0;
2148
+ const S = o.pos - 2;
2149
+ if (S >= 0)
2150
+ return s(n.tr.setSelection(O.create(n.doc, S))), t.preventDefault(), !0;
1227
2151
  }
1228
2152
  }
1229
2153
  }
1230
- } else if (d === 1 && n.pos !== 1 && h.text === y) {
1231
- const c = i.from - 1 - 2;
1232
- if (c >= 0)
1233
- return s(o.tr.delete(c, i.to)), t.preventDefault(), !0;
2154
+ } else if (p === 1 && o.pos !== 1 && m.text === C) {
2155
+ const f = r.from - 1 - 2;
2156
+ if (f >= 0)
2157
+ return s(n.tr.delete(f, r.to)), t.preventDefault(), !0;
1234
2158
  }
1235
2159
  }
1236
2160
  }
1237
- if (I(t, "BACKSPACE") && !i.empty) {
1238
- let C = i.from, h = i.to;
1239
- const g = n.nodeBefore, d = n.nodeAfter;
1240
- if (g && g.isText && ((u = g.text) != null && u.endsWith(y)) && (C -= 1), d && d.isText && ((p = d.text) != null && p.startsWith(y)) && (h += 1), C !== i.from || h !== i.to) {
1241
- const c = o.tr.delete(C, h);
1242
- return s(c), t.preventDefault(), !0;
2161
+ if (I(t, "BACKSPACE") && !r.empty) {
2162
+ let T = r.from, m = r.to;
2163
+ const y = o.nodeBefore, p = o.nodeAfter;
2164
+ if (y && y.isText && ((c = y.text) != null && c.endsWith(C)) && (T -= 1), p && p.isText && ((d = p.text) != null && d.startsWith(C)) && (m += 1), T !== r.from || m !== r.to) {
2165
+ const f = n.tr.delete(T, m);
2166
+ return s(f), t.preventDefault(), !0;
1243
2167
  }
1244
2168
  }
1245
- if (I(t, "DELETE") && i.empty) {
1246
- const C = n.node(), h = n.nodeAfter;
1247
- if (C.type.name === T.TEMPLATE_BLOCK) {
1248
- const g = C.textContent || "";
1249
- if (n.pos === n.start() && g.length === 1 && g !== y) {
1250
- const d = n.pos;
1251
- return s(o.tr.insertText(y, d, d + 1)), t.preventDefault(), !0;
2169
+ if (I(t, "DELETE") && r.empty) {
2170
+ const T = o.node(), m = o.nodeAfter;
2171
+ if (T.type.name === A.TEMPLATE_BLOCK) {
2172
+ const y = T.textContent || "";
2173
+ if (o.pos === o.start() && y.length === 1 && y !== C) {
2174
+ const p = o.pos;
2175
+ return s(n.tr.insertText(C, p, p + 1)), t.preventDefault(), !0;
1252
2176
  }
1253
- if (g === y) {
1254
- const d = n.after(), c = o.tr.setSelection(D.create(o.doc, d));
1255
- return s(c), t.preventDefault(), !0;
2177
+ if (y === C) {
2178
+ const p = o.after(), f = n.tr.setSelection(O.create(n.doc, p));
2179
+ return s(f), t.preventDefault(), !0;
1256
2180
  }
1257
- if (g === "") {
1258
- const d = n.after(), c = o.tr.setSelection(D.create(o.doc, d));
1259
- return s(c), t.preventDefault(), !0;
2181
+ if (y === "") {
2182
+ const p = o.after(), f = n.tr.setSelection(O.create(n.doc, p));
2183
+ return s(f), t.preventDefault(), !0;
1260
2184
  }
1261
- if (n.pos === n.end() && g.length > 0 && g !== y) {
1262
- const d = n.after();
1263
- return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2185
+ if (o.pos === o.end() && y.length > 0 && y !== C) {
2186
+ const p = o.after();
2187
+ return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
1264
2188
  }
1265
2189
  return !1;
1266
2190
  }
1267
- if (h && h.isText && ((f = h.text) == null ? void 0 : f.length) === 1 && h.text !== y && n.nodeBefore && n.nodeBefore.type.name === T.TEMPLATE_BLOCK) {
1268
- const g = n.pos, d = n.pos + h.nodeSize;
1269
- let c = o.tr.delete(g, d);
1270
- return c = c.insertText(y, g, g), s(c), t.preventDefault(), !0;
2191
+ if (m && m.isText && ((u = m.text) == null ? void 0 : u.length) === 1 && m.text !== C && o.nodeBefore && o.nodeBefore.type.name === A.TEMPLATE_BLOCK) {
2192
+ const y = o.pos, p = o.pos + m.nodeSize;
2193
+ let f = n.tr.delete(y, p);
2194
+ return f = f.insertText(C, y, y), s(f), t.preventDefault(), !0;
1271
2195
  }
1272
- if (h && h.type.name === T.TEMPLATE_BLOCK) {
1273
- const g = h.textContent || "";
1274
- if (g.length === 0 || g === y) {
1275
- const c = n.parent, b = n.index(), _ = n.nodeBefore;
1276
- let x = n.pos, v = n.pos + h.nodeSize;
1277
- if (_ && _.isText && _.text === y && (x = x - 1), b < c.childCount - 1) {
1278
- const m = c.child(b + 1);
1279
- m && m.isText && m.text === y && (v = v + 1);
2196
+ if (m && m.type.name === A.TEMPLATE_BLOCK) {
2197
+ const y = m.textContent || "";
2198
+ if (y.length === 0 || y === C) {
2199
+ const f = o.parent, x = o.index(), v = o.nodeBefore;
2200
+ let S = o.pos, _ = o.pos + m.nodeSize;
2201
+ if (v && v.isText && v.text === C && (S = S - 1), x < f.childCount - 1) {
2202
+ const b = f.child(x + 1);
2203
+ b && b.isText && b.text === C && (_ = _ + 1);
1280
2204
  }
1281
- return s(o.tr.delete(x, v)), t.preventDefault(), !0;
2205
+ return s(n.tr.delete(S, _)), t.preventDefault(), !0;
1282
2206
  } else {
1283
- const c = n.pos + 1;
1284
- return s(o.tr.setSelection(D.create(o.doc, c))), t.preventDefault(), !0;
2207
+ const f = o.pos + 1;
2208
+ return s(n.tr.setSelection(O.create(n.doc, f))), t.preventDefault(), !0;
1285
2209
  }
1286
2210
  }
1287
- if (h && h.isText) {
1288
- const g = n.parent, d = n.index();
1289
- if (d < g.childCount - 1) {
1290
- const c = g.child(d + 1);
1291
- if (c.type.name === T.TEMPLATE_BLOCK) {
1292
- const b = c.textContent || "";
1293
- if (b.length === 0 || b === y) {
1294
- let x = n.pos;
1295
- const v = n.pos + h.nodeSize + c.nodeSize, m = n.nodeBefore;
1296
- return m && m.isText && ((E = m.text) != null && E.endsWith(y)) && (x = x - 1), s(o.tr.delete(x, v)), t.preventDefault(), !0;
2211
+ if (m && m.isText) {
2212
+ const y = o.parent, p = o.index();
2213
+ if (p < y.childCount - 1) {
2214
+ const f = y.child(p + 1);
2215
+ if (f.type.name === A.TEMPLATE_BLOCK) {
2216
+ const x = f.textContent || "";
2217
+ if (x.length === 0 || x === C) {
2218
+ let S = o.pos;
2219
+ const _ = o.pos + m.nodeSize + f.nodeSize, b = o.nodeBefore;
2220
+ return b && b.isText && ((g = b.text) != null && g.endsWith(C)) && (S = S - 1), s(n.tr.delete(S, _)), t.preventDefault(), !0;
1297
2221
  }
1298
- if (h.text === y || (S = h.text) != null && S.startsWith(y)) {
1299
- const x = n.pos + 2;
1300
- return s(o.tr.setSelection(D.create(o.doc, x))), t.preventDefault(), !0;
2222
+ if (m.text === C || (h = m.text) != null && h.startsWith(C)) {
2223
+ const S = o.pos + 2;
2224
+ return s(n.tr.setSelection(O.create(n.doc, S))), t.preventDefault(), !0;
1301
2225
  }
1302
2226
  }
1303
2227
  }
1304
2228
  }
1305
2229
  }
1306
- if (I(t, "DELETE") && !i.empty) {
1307
- let C = i.from, h = i.to;
1308
- const g = n.nodeBefore, d = n.nodeAfter;
1309
- if (g && g.isText && ((j = g.text) != null && j.endsWith(y)) && (C -= 1), d && d.isText && ((L = d.text) != null && L.startsWith(y)) && (h += 1), C !== i.from || h !== i.to) {
1310
- const c = o.tr.delete(C, h);
1311
- return s(c), t.preventDefault(), !0;
2230
+ if (I(t, "DELETE") && !r.empty) {
2231
+ let T = r.from, m = r.to;
2232
+ const y = o.nodeBefore, p = o.nodeAfter;
2233
+ if (y && y.isText && ((E = y.text) != null && E.endsWith(C)) && (T -= 1), p && p.isText && ((w = p.text) != null && w.startsWith(C)) && (m += 1), T !== r.from || m !== r.to) {
2234
+ const f = n.tr.delete(T, m);
2235
+ return s(f), t.preventDefault(), !0;
1312
2236
  }
1313
2237
  }
1314
2238
  return !1;
@@ -1316,43 +2240,43 @@ function ln() {
1316
2240
  }
1317
2241
  });
1318
2242
  }
1319
- function cn() {
1320
- return new Y({
1321
- key: new Z(J.TEMPLATE_BLOCK_PASTE),
2243
+ function Yo() {
2244
+ return new ie({
2245
+ key: new re(ae.TEMPLATE_BLOCK_PASTE),
1322
2246
  props: {
1323
2247
  handlePaste(e, t) {
1324
- var n, a, r;
1325
- const o = ((n = t.clipboardData) == null ? void 0 : n.types) || [], s = (a = t.clipboardData) == null ? void 0 : a.getData("text/html");
1326
- if (o.includes("text/html") && (s != null && s.includes("data-template")) || o.includes("application/x-prosemirror-slice"))
2248
+ var o, l, i;
2249
+ const n = ((o = t.clipboardData) == null ? void 0 : o.types) || [], s = (l = t.clipboardData) == null ? void 0 : l.getData("text/html");
2250
+ if (n.includes("text/html") && (s != null && s.includes("data-template")) || n.includes("application/x-prosemirror-slice"))
1327
2251
  return !1;
1328
- const i = (r = t.clipboardData) == null ? void 0 : r.getData("text/plain");
1329
- if (i) {
1330
- const { state: l, dispatch: u } = e, p = l.selection.$from;
1331
- let f = l.tr;
1332
- p.nodeBefore && p.nodeBefore.isText && p.nodeBefore.text === y && (f = f.delete(p.pos - p.nodeBefore.nodeSize, p.pos)), p.nodeAfter && p.nodeAfter.isText && p.nodeAfter.text === y && (f = f.delete(p.pos, p.pos + p.nodeAfter.nodeSize));
1333
- const E = i.split(`
2252
+ const r = (i = t.clipboardData) == null ? void 0 : i.getData("text/plain");
2253
+ if (r) {
2254
+ const { state: a, dispatch: c } = e, d = a.selection.$from;
2255
+ let u = a.tr;
2256
+ d.nodeBefore && d.nodeBefore.isText && d.nodeBefore.text === C && (u = u.delete(d.pos - d.nodeBefore.nodeSize, d.pos)), d.nodeAfter && d.nodeAfter.isText && d.nodeAfter.text === C && (u = u.delete(d.pos, d.pos + d.nodeAfter.nodeSize));
2257
+ const g = r.split(`
1334
2258
  `);
1335
- let S;
1336
- if (E.length === 1)
1337
- f = f.insertText(E[0], f.selection.from, f.selection.to), S = f.selection.$to.pos;
2259
+ let h;
2260
+ if (g.length === 1)
2261
+ u = u.insertText(g[0], u.selection.from, u.selection.to), h = u.selection.$to.pos;
1338
2262
  else {
1339
- f = f.insertText(E[0], f.selection.from, f.selection.to);
1340
- let j = f.selection.$to.pos;
1341
- for (let L = 1; L < E.length; L++) {
1342
- const C = l.schema.nodes.paragraph.create({}, E[L] ? l.schema.text(E[L]) : null);
1343
- f = f.insert(j, C), j += C.nodeSize;
2263
+ u = u.insertText(g[0], u.selection.from, u.selection.to);
2264
+ let E = u.selection.$to.pos;
2265
+ for (let w = 1; w < g.length; w++) {
2266
+ const T = a.schema.nodes.paragraph.create({}, g[w] ? a.schema.text(g[w]) : null);
2267
+ u = u.insert(E, T), E += T.nodeSize;
1344
2268
  }
1345
- S = j;
2269
+ h = E;
1346
2270
  }
1347
- return f = f.setSelection(D.create(f.doc, S)), f = f.scrollIntoView(), u(f), t.preventDefault(), !0;
2271
+ return u = u.setSelection(O.create(u.doc, h)), u = u.scrollIntoView(), c(u), t.preventDefault(), !0;
1348
2272
  }
1349
2273
  return !1;
1350
2274
  }
1351
2275
  }
1352
2276
  });
1353
2277
  }
1354
- const un = Le.create({
1355
- name: T.TEMPLATE_BLOCK,
2278
+ const Zo = ct.create({
2279
+ name: A.TEMPLATE_BLOCK,
1356
2280
  // 节点配置
1357
2281
  group: "inline",
1358
2282
  inline: !0,
@@ -1364,10 +2288,10 @@ const un = Le.create({
1364
2288
  draggable: !1,
1365
2289
  onCreate() {
1366
2290
  const { items: e } = this.options;
1367
- e && ce(e) && K(
2291
+ e && ke(e) && K(
1368
2292
  e,
1369
2293
  () => {
1370
- const t = ce(e) ? e.value : e;
2294
+ const t = ke(e) ? e.value : e;
1371
2295
  t != null && (this.editor.commands.setTemplateData(t), this.editor.commands.focusFirstTemplate());
1372
2296
  },
1373
2297
  { deep: !0, immediate: !0 }
@@ -1402,31 +2326,31 @@ const un = Le.create({
1402
2326
  },
1403
2327
  // HTML 渲染
1404
2328
  renderHTML({ node: e, HTMLAttributes: t }) {
1405
- const o = e.textContent || "";
2329
+ const n = e.textContent || "";
1406
2330
  return [
1407
2331
  "span",
1408
- Me(this.options.HTMLAttributes || {}, t, {
2332
+ ut(this.options.HTMLAttributes || {}, t, {
1409
2333
  "data-template": "",
1410
2334
  "data-id": e.attrs.id,
1411
- "data-content": o
2335
+ "data-content": n
1412
2336
  }),
1413
- o
2337
+ n
1414
2338
  ];
1415
2339
  },
1416
2340
  // 使用 Vue 组件渲染
1417
2341
  addNodeView() {
1418
- return _e(sn);
2342
+ return at(Vo);
1419
2343
  },
1420
2344
  // 添加插件
1421
2345
  addProseMirrorPlugins() {
1422
- return [an(), ln(), cn()];
2346
+ return [Uo(), Xo(), Yo()];
1423
2347
  }
1424
- }), ae = new Z(
1425
- J.TEMPLATE_SELECT_DROPDOWN
2348
+ }), Ce = new re(
2349
+ ae.TEMPLATE_SELECT_DROPDOWN
1426
2350
  );
1427
- function dn() {
1428
- return new Y({
1429
- key: ae,
2351
+ function Jo() {
2352
+ return new ie({
2353
+ key: Ce,
1430
2354
  state: {
1431
2355
  init() {
1432
2356
  return {
@@ -1435,14 +2359,14 @@ function dn() {
1435
2359
  };
1436
2360
  },
1437
2361
  apply(e, t) {
1438
- const o = e.getMeta(ae);
1439
- if (o) {
1440
- if (o.type === "open")
2362
+ const n = e.getMeta(Ce);
2363
+ if (n) {
2364
+ if (n.type === "open")
1441
2365
  return {
1442
2366
  isOpen: !0,
1443
- selectId: o.selectId
2367
+ selectId: n.selectId
1444
2368
  };
1445
- if (o.type === "close")
2369
+ if (n.type === "close")
1446
2370
  return {
1447
2371
  isOpen: !1,
1448
2372
  selectId: null
@@ -1453,81 +2377,81 @@ function dn() {
1453
2377
  }
1454
2378
  });
1455
2379
  }
1456
- function fn() {
1457
- return new Y({
1458
- key: new Z(J.TEMPLATE_SELECT_ZERO_WIDTH),
1459
- appendTransaction(e, t, o) {
1460
- if (!e.some((a) => a.docChanged)) return null;
1461
- const i = [];
1462
- let { tr: n } = o;
1463
- return o.doc.descendants((a, r) => {
1464
- if (a.type.name === T.PARAGRAPH && a.childCount > 0) {
1465
- const { lastChild: l, firstChild: u } = a;
1466
- l === u && l && l.isText && l.text === y && i.push(["remove", r + 1]);
2380
+ function Qo() {
2381
+ return new ie({
2382
+ key: new re(ae.TEMPLATE_SELECT_ZERO_WIDTH),
2383
+ appendTransaction(e, t, n) {
2384
+ if (!e.some((l) => l.docChanged)) return null;
2385
+ const r = [];
2386
+ let { tr: o } = n;
2387
+ return n.doc.descendants((l, i) => {
2388
+ if (l.type.name === A.PARAGRAPH && l.childCount > 0) {
2389
+ const { lastChild: a, firstChild: c } = l;
2390
+ a === c && a && a.isText && a.text === C && r.push(["remove", i + 1]);
1467
2391
  }
1468
- }), i.length > 0 ? (i.forEach(([, a]) => {
1469
- n = n.delete(a, a + 1);
1470
- }), n) : null;
2392
+ }), r.length > 0 ? (r.forEach(([, l]) => {
2393
+ o = o.delete(l, l + 1);
2394
+ }), o) : null;
1471
2395
  }
1472
2396
  });
1473
2397
  }
1474
- function pn() {
1475
- return new Y({
1476
- key: new Z(J.TEMPLATE_SELECT_KEYBOARD),
2398
+ function es() {
2399
+ return new ie({
2400
+ key: new re(ae.TEMPLATE_SELECT_KEYBOARD),
1477
2401
  props: {
1478
2402
  handleKeyDown(e, t) {
1479
- const { state: o, dispatch: s } = e, { selection: i } = o, { $from: n } = i, a = ae.getState(e.state);
1480
- if (a != null && a.isOpen && ie(t, ["ENTER", "ARROW_UP", "ARROW_DOWN", "ESCAPE"]))
2403
+ const { state: n, dispatch: s } = e, { selection: r } = n, { $from: o } = r, l = Ce.getState(e.state);
2404
+ if (l != null && l.isOpen && we(t, ["ENTER", "ARROW_UP", "ARROW_DOWN", "ESCAPE"]))
1481
2405
  return !0;
1482
- if (I(t, "BACKSPACE") && i.empty) {
1483
- const r = n.nodeBefore, l = n.nodeAfter;
1484
- if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_SELECT)
1485
- return s(o.tr.delete(n.pos - r.nodeSize, n.pos)), t.preventDefault(), !0;
1486
- if (r != null && r.isText && r.text === y) {
1487
- const u = n.pos - 1, f = o.doc.resolve(u).nodeBefore;
1488
- if ((f == null ? void 0 : f.type.name) === T.TEMPLATE_SELECT) {
1489
- const E = u - f.nodeSize, S = n.pos;
1490
- return s(o.tr.delete(E, S)), t.preventDefault(), !0;
2406
+ if (I(t, "BACKSPACE") && r.empty) {
2407
+ const i = o.nodeBefore, a = o.nodeAfter;
2408
+ if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_SELECT)
2409
+ return s(n.tr.delete(o.pos - i.nodeSize, o.pos)), t.preventDefault(), !0;
2410
+ if (i != null && i.isText && i.text === C) {
2411
+ const c = o.pos - 1, u = n.doc.resolve(c).nodeBefore;
2412
+ if ((u == null ? void 0 : u.type.name) === A.TEMPLATE_SELECT) {
2413
+ const g = c - u.nodeSize, h = o.pos;
2414
+ return s(n.tr.delete(g, h)), t.preventDefault(), !0;
1491
2415
  }
1492
2416
  }
1493
- if ((l == null ? void 0 : l.type.name) === T.TEMPLATE_SELECT) {
1494
- if (r != null && r.isText && r.text !== y)
1495
- return s(o.tr.delete(n.pos - 1, n.pos)), t.preventDefault(), !0;
1496
- if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_BLOCK)
2417
+ if ((a == null ? void 0 : a.type.name) === A.TEMPLATE_SELECT) {
2418
+ if (i != null && i.isText && i.text !== C)
2419
+ return s(n.tr.delete(o.pos - 1, o.pos)), t.preventDefault(), !0;
2420
+ if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_BLOCK)
1497
2421
  return !1;
1498
2422
  }
1499
- if (!l && (r != null && r.isText) && r.text !== y)
1500
- return s(o.tr.delete(n.pos - 1, n.pos)), t.preventDefault(), !0;
2423
+ if (!a && (i != null && i.isText) && i.text !== C)
2424
+ return s(n.tr.delete(o.pos - 1, o.pos)), t.preventDefault(), !0;
1501
2425
  }
1502
- if (I(t, "DELETE") && i.empty) {
1503
- const r = n.nodeAfter, l = n.nodeBefore;
1504
- if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_SELECT)
1505
- return s(o.tr.delete(n.pos, n.pos + r.nodeSize)), t.preventDefault(), !0;
1506
- if (r != null && r.isText && r.text === y) {
1507
- const u = n.pos + 1, f = o.doc.resolve(u).nodeAfter;
1508
- if ((f == null ? void 0 : f.type.name) === T.TEMPLATE_SELECT) {
1509
- const E = u + f.nodeSize;
1510
- return s(o.tr.delete(n.pos, E)), t.preventDefault(), !0;
2426
+ if (I(t, "DELETE") && r.empty) {
2427
+ const i = o.nodeAfter, a = o.nodeBefore;
2428
+ if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_SELECT)
2429
+ return s(n.tr.delete(o.pos, o.pos + i.nodeSize)), t.preventDefault(), !0;
2430
+ if (i != null && i.isText && i.text === C) {
2431
+ const c = o.pos + 1, u = n.doc.resolve(c).nodeAfter;
2432
+ if ((u == null ? void 0 : u.type.name) === A.TEMPLATE_SELECT) {
2433
+ const g = c + u.nodeSize;
2434
+ return s(n.tr.delete(o.pos, g)), t.preventDefault(), !0;
1511
2435
  }
1512
2436
  }
1513
- if ((l == null ? void 0 : l.type.name) === T.TEMPLATE_SELECT) {
1514
- if (r != null && r.isText && r.text !== y)
1515
- return s(o.tr.delete(n.pos, n.pos + 1)), t.preventDefault(), !0;
1516
- if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_BLOCK)
2437
+ if ((a == null ? void 0 : a.type.name) === A.TEMPLATE_SELECT) {
2438
+ if (i != null && i.isText && i.text !== C)
2439
+ return s(n.tr.delete(o.pos, o.pos + 1)), t.preventDefault(), !0;
2440
+ if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_BLOCK)
1517
2441
  return !1;
1518
2442
  }
1519
- if (!l && (r != null && r.isText) && r.text !== y)
1520
- return s(o.tr.delete(n.pos, n.pos + 1)), t.preventDefault(), !0;
2443
+ if (!a && (i != null && i.isText) && i.text !== C)
2444
+ return s(n.tr.delete(o.pos, o.pos + 1)), t.preventDefault(), !0;
1521
2445
  }
1522
2446
  return !1;
1523
2447
  }
1524
2448
  }
1525
2449
  });
1526
2450
  }
1527
- function mn(e, t, o) {
1528
- const s = (i) => {
1529
- const n = i.target;
1530
- !e.contains(n) && !t.contains(n) && (o(), document.removeEventListener("click", s));
2451
+ function ts(e, t, n) {
2452
+ const s = (r) => {
2453
+ const o = r.target;
2454
+ !e.contains(o) && !t.contains(o) && (n(), document.removeEventListener("click", s));
1531
2455
  };
1532
2456
  return setTimeout(() => {
1533
2457
  document.addEventListener("click", s);
@@ -1535,147 +2459,142 @@ function mn(e, t, o) {
1535
2459
  document.removeEventListener("click", s);
1536
2460
  };
1537
2461
  }
1538
- const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseenter"], xn = /* @__PURE__ */ G({
2462
+ const ns = { class: "template-select__icon" }, os = ["onMousedown", "onMouseenter"], ss = /* @__PURE__ */ Z({
1539
2463
  __name: "template-select-view",
1540
2464
  props: {
1541
2465
  node: {},
1542
2466
  updateAttributes: { type: Function },
1543
- editor: {},
1544
- extension: {}
2467
+ editor: {}
1545
2468
  },
1546
2469
  setup(e) {
1547
- const t = e, o = W(!1), s = W(-1), i = W(), n = W();
1548
- let a = null, r = null;
1549
- const l = Mt(i, t.extension.options.appendTo, { fallback: "body" }), u = M(() => {
1550
- const x = l.value;
1551
- return x instanceof HTMLElement && x !== document.body;
1552
- }), p = M(() => t.node.attrs.options.find((x) => x.value === t.node.attrs.value)), f = M(() => {
2470
+ const t = e, n = F(!1), s = F(-1), r = F(), o = F();
2471
+ let l = null, i = null;
2472
+ const a = R(() => t.node.attrs.options.find((x) => x.value === t.node.attrs.value)), c = R(() => {
1553
2473
  var x;
1554
- return ((x = p.value) == null ? void 0 : x.label) || t.node.attrs.placeholder;
1555
- }), E = M(() => !t.node.attrs.value), S = () => {
1556
- o.value ? L() : j();
1557
- }, j = async () => {
2474
+ return ((x = a.value) == null ? void 0 : x.label) || t.node.attrs.placeholder;
2475
+ }), d = R(() => !t.node.attrs.value), u = () => {
2476
+ n.value ? h() : g();
2477
+ }, g = async () => {
1558
2478
  var x;
1559
- if (o.value = !0, (x = t.editor) != null && x.view) {
1560
- const v = t.editor.view, m = v.state.tr;
1561
- m.setMeta(ae, {
2479
+ if (n.value = !0, (x = t.editor) != null && x.view) {
2480
+ const v = t.editor.view, S = v.state.tr;
2481
+ S.setMeta(Ce, {
1562
2482
  type: "open",
1563
2483
  selectId: t.node.attrs.id
1564
- }), v.dispatch(m);
2484
+ }), v.dispatch(S);
1565
2485
  }
1566
- t.node.attrs.value ? s.value = t.node.attrs.options.findIndex((v) => v.value === t.node.attrs.value) : s.value = -1, await te(), h(), i.value && n.value && (a = mn(i.value, n.value, L));
1567
- }, L = async () => {
2486
+ t.node.attrs.value ? s.value = t.node.attrs.options.findIndex((v) => v.value === t.node.attrs.value) : s.value = -1, await me(), w(), r.value && o.value && (l = ts(r.value, o.value, h));
2487
+ }, h = async () => {
1568
2488
  var x;
1569
- if (o.value = !1, s.value = -1, (x = t.editor) != null && x.view) {
1570
- const v = t.editor.view, m = v.state.tr;
1571
- m.setMeta(ae, {
2489
+ if (n.value = !1, s.value = -1, (x = t.editor) != null && x.view) {
2490
+ const v = t.editor.view, S = v.state.tr;
2491
+ S.setMeta(Ce, {
1572
2492
  type: "close"
1573
- }), v.dispatch(m);
2493
+ }), v.dispatch(S);
1574
2494
  }
1575
- a && (a(), a = null), r && (r(), r = null);
1576
- }, C = (x) => {
1577
- t.updateAttributes({ value: x.value }), L();
1578
- }, h = () => {
1579
- !i.value || !n.value || (r && (r(), r = null), r = Se(i.value, n.value, () => {
1580
- !i.value || !n.value || Ce(i.value, n.value, {
2495
+ l && (l(), l = null), i && (i(), i = null);
2496
+ }, E = (x) => {
2497
+ t.updateAttributes({ value: x.value }), h();
2498
+ }, w = () => {
2499
+ !r.value || !o.value || (i && (i(), i = null), i = mt(r.value, o.value, () => {
2500
+ !r.value || !o.value || yt(r.value, o.value, {
1581
2501
  placement: "bottom-start",
1582
- // 自定义挂载目标使用 absolute 定位
1583
- strategy: u.value ? "absolute" : "fixed",
2502
+ strategy: "fixed",
1584
2503
  // 使用 fixed 定位策略,相对于视口
1585
- middleware: [Ae(4), we(), ke({ padding: 8 })]
2504
+ middleware: [ht(4), xt(), gt({ padding: 8 })]
1586
2505
  }).then(({ x, y: v }) => {
1587
- n.value && Object.assign(n.value.style, {
2506
+ o.value && Object.assign(o.value.style, {
1588
2507
  left: `${x}px`,
1589
2508
  top: `${v}px`
1590
2509
  });
1591
2510
  });
1592
2511
  }));
1593
- }, g = (x) => {
1594
- if (o.value)
2512
+ }, T = (x) => {
2513
+ if (n.value)
1595
2514
  switch (x.key) {
1596
2515
  case "ArrowUp":
1597
- x.preventDefault(), d();
2516
+ x.preventDefault(), m();
1598
2517
  break;
1599
2518
  case "ArrowDown":
1600
- x.preventDefault(), c();
2519
+ x.preventDefault(), y();
1601
2520
  break;
1602
2521
  case "Enter":
1603
- x.preventDefault(), _();
2522
+ x.preventDefault(), f();
1604
2523
  break;
1605
2524
  case "Escape":
1606
- x.preventDefault(), L();
2525
+ x.preventDefault(), h();
1607
2526
  break;
1608
2527
  }
1609
- }, d = () => {
1610
- s.value === -1 || s.value <= 0 ? s.value = t.node.attrs.options.length - 1 : s.value -= 1, b();
1611
- }, c = () => {
1612
- s.value === -1 || s.value >= t.node.attrs.options.length - 1 ? s.value = 0 : s.value += 1, b();
1613
- }, b = () => {
1614
- te(() => {
1615
- if (!n.value) return;
1616
- const x = n.value.querySelector(".template-select__option.is-highlighted");
2528
+ }, m = () => {
2529
+ s.value === -1 || s.value <= 0 ? s.value = t.node.attrs.options.length - 1 : s.value -= 1, p();
2530
+ }, y = () => {
2531
+ s.value === -1 || s.value >= t.node.attrs.options.length - 1 ? s.value = 0 : s.value += 1, p();
2532
+ }, p = () => {
2533
+ me(() => {
2534
+ if (!o.value) return;
2535
+ const x = o.value.querySelector(".template-select__option.is-highlighted");
1617
2536
  x && x.scrollIntoView({
1618
2537
  block: "nearest",
1619
2538
  behavior: "smooth"
1620
2539
  });
1621
2540
  });
1622
- }, _ = () => {
1623
- s.value >= 0 && s.value < t.node.attrs.options.length ? C(t.node.attrs.options[s.value]) : L();
2541
+ }, f = () => {
2542
+ s.value >= 0 && s.value < t.node.attrs.options.length ? E(t.node.attrs.options[s.value]) : h();
1624
2543
  };
1625
- return at(() => {
1626
- document.addEventListener("keydown", g);
1627
- }), lt(() => {
1628
- document.removeEventListener("keydown", g), a && a(), r && r();
1629
- }), (x, v) => (w(), V(A(Ee), {
2544
+ return dn(() => {
2545
+ document.addEventListener("keydown", T);
2546
+ }), fn(() => {
2547
+ document.removeEventListener("keydown", T), l && l(), i && i();
2548
+ }), (x, v) => (M(), U(k(lt), {
1630
2549
  as: "span",
1631
2550
  class: "template-select"
1632
2551
  }, {
1633
- default: B(() => [
1634
- v[0] || (v[0] = R("span", {
2552
+ default: j(() => [
2553
+ v[0] || (v[0] = B("span", {
1635
2554
  contenteditable: "false",
1636
2555
  class: "template-select__prefix"
1637
2556
  }, "​", -1)),
1638
- R("span", {
2557
+ B("span", {
1639
2558
  ref_key: "triggerRef",
1640
- ref: i,
1641
- class: z(["template-select__trigger", { "is-open": o.value }]),
1642
- onMousedown: ye(S, ["prevent"])
2559
+ ref: r,
2560
+ class: Q(["template-select__trigger", { "is-open": n.value }]),
2561
+ onMousedown: nt(u, ["prevent"])
1643
2562
  }, [
1644
- R("span", {
1645
- class: z(["template-select__text", { "is-placeholder": E.value }])
1646
- }, ee(f.value), 3),
1647
- R("span", hn, [
1648
- X(A(kt))
2563
+ B("span", {
2564
+ class: Q(["template-select__text", { "is-placeholder": d.value }])
2565
+ }, pe(c.value), 3),
2566
+ B("span", ns, [
2567
+ se(k(Pn))
1649
2568
  ])
1650
2569
  ], 34),
1651
- v[1] || (v[1] = R("span", {
2570
+ v[1] || (v[1] = B("span", {
1652
2571
  contenteditable: "false",
1653
2572
  class: "template-select__suffix"
1654
2573
  }, "​", -1)),
1655
- (w(), V(ct, { to: A(l) }, [
1656
- o.value ? (w(), P("div", {
2574
+ (M(), U(pn, { to: "body" }, [
2575
+ n.value ? (M(), P("div", {
1657
2576
  key: 0,
1658
2577
  ref_key: "dropdownRef",
1659
- ref: n,
1660
- class: z(["template-select__dropdown", { "is-absolute": u.value }])
2578
+ ref: o,
2579
+ class: "template-select__dropdown"
1661
2580
  }, [
1662
- (w(!0), P(fe, null, pe(e.node.attrs.options, (m, k) => (w(), P("div", {
1663
- key: m.value,
1664
- class: z(["template-select__option", {
1665
- "is-highlighted": k === s.value,
1666
- "is-selected": m.value === e.node.attrs.value
2581
+ (M(!0), P(Ie, null, Be(e.node.attrs.options, (S, _) => (M(), P("div", {
2582
+ key: S.value,
2583
+ class: Q(["template-select__option", {
2584
+ "is-highlighted": _ === s.value,
2585
+ "is-selected": S.value === e.node.attrs.value
1667
2586
  }]),
1668
- onMousedown: ye(($) => C(m), ["prevent"]),
1669
- onMouseenter: ($) => s.value = k
1670
- }, ee(m.label), 43, gn))), 128))
1671
- ], 2)) : N("", !0)
1672
- ], 8, ["to"]))
2587
+ onMousedown: nt((b) => E(S), ["prevent"]),
2588
+ onMouseenter: (b) => s.value = _
2589
+ }, pe(S.label), 43, os))), 128))
2590
+ ], 512)) : q("", !0)
2591
+ ]))
1673
2592
  ]),
1674
2593
  _: 1
1675
2594
  }));
1676
2595
  }
1677
- }), bn = /* @__PURE__ */ U(xn, [["__scopeId", "data-v-5bcba48f"]]), yn = Le.create({
1678
- name: T.TEMPLATE_SELECT,
2596
+ }), rs = /* @__PURE__ */ J(ss, [["__scopeId", "data-v-dbb18436"]]), is = ct.create({
2597
+ name: A.TEMPLATE_SELECT,
1679
2598
  // 节点配置
1680
2599
  group: "inline",
1681
2600
  inline: !0,
@@ -1703,8 +2622,8 @@ const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseente
1703
2622
  if (!t) return [];
1704
2623
  try {
1705
2624
  return JSON.parse(t);
1706
- } catch (o) {
1707
- return console.warn("Failed to parse template select options:", o), [];
2625
+ } catch (n) {
2626
+ return console.warn("Failed to parse template select options:", n), [];
1708
2627
  }
1709
2628
  },
1710
2629
  renderHTML: (e) => {
@@ -1732,22 +2651,22 @@ const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseente
1732
2651
  },
1733
2652
  // HTML 渲染
1734
2653
  renderHTML({ node: e, HTMLAttributes: t }) {
1735
- const o = e.attrs.options.find(
1736
- (n) => n.value === e.attrs.value
1737
- ), s = (o == null ? void 0 : o.label) || e.attrs.placeholder;
1738
- let i = "[]";
2654
+ const n = e.attrs.options.find(
2655
+ (o) => o.value === e.attrs.value
2656
+ ), s = (n == null ? void 0 : n.label) || e.attrs.placeholder;
2657
+ let r = "[]";
1739
2658
  try {
1740
- i = JSON.stringify(e.attrs.options);
1741
- } catch (n) {
1742
- console.error("Failed to stringify template select options in renderHTML:", n);
2659
+ r = JSON.stringify(e.attrs.options);
2660
+ } catch (o) {
2661
+ console.error("Failed to stringify template select options in renderHTML:", o);
1743
2662
  }
1744
2663
  return [
1745
2664
  "span",
1746
- Me(t, {
2665
+ ut(t, {
1747
2666
  "data-template-select": "",
1748
2667
  "data-id": e.attrs.id,
1749
2668
  "data-placeholder": e.attrs.placeholder,
1750
- "data-options": i,
2669
+ "data-options": r,
1751
2670
  "data-value": e.attrs.value || ""
1752
2671
  }),
1753
2672
  s
@@ -1755,120 +2674,120 @@ const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseente
1755
2674
  },
1756
2675
  // 使用 Vue 组件渲染
1757
2676
  addNodeView() {
1758
- return _e(bn);
2677
+ return at(rs);
1759
2678
  },
1760
2679
  // 添加插件
1761
2680
  addProseMirrorPlugins() {
1762
- return [dn(), fn(), pn()];
2681
+ return [Jo(), Qo(), es()];
1763
2682
  }
1764
- }), Xe = We.create({
1765
- name: se.TEMPLATE,
2683
+ }), Zt = It.create({
2684
+ name: be.TEMPLATE,
1766
2685
  addExtensions() {
1767
- return [un.configure(this.options), yn.configure(this.options)];
2686
+ return [Zo.configure(this.options), is];
1768
2687
  },
1769
2688
  // 添加命令(统一命令入口)
1770
2689
  addCommands() {
1771
- return nn;
2690
+ return zo;
1772
2691
  }
1773
2692
  });
1774
- function Tn(e, t) {
1775
- return Xe.configure({
2693
+ function ls(e, t) {
2694
+ return Zt.configure({
1776
2695
  items: e,
1777
2696
  ...t
1778
2697
  });
1779
2698
  }
1780
- function Ze(e, t = "") {
1781
- let o = (
2699
+ function Jt(e, t = "") {
2700
+ let n = (
1782
2701
  /** @type {Array<CategorizedUnicodeRange<T>>} */
1783
2702
  []
1784
- ), s = e.split(",").map((n) => n ? parseInt(n, 36) : 0), i = 0;
1785
- for (let n = 0; n < s.length; n++)
1786
- n % 2 ? o.push([
1787
- i,
1788
- i + s[n],
2703
+ ), s = e.split(",").map((o) => o ? parseInt(o, 36) : 0), r = 0;
2704
+ for (let o = 0; o < s.length; o++)
2705
+ o % 2 ? n.push([
2706
+ r,
2707
+ r + s[o],
1789
2708
  /** @type {T} */
1790
- t ? parseInt(t[n >> 1], 36) : 0
1791
- ]) : i = s[n];
1792
- return o;
1793
- }
1794
- function Ye(e, t, o = 0, s = t.length - 1) {
1795
- for (; o <= s; ) {
1796
- let i = o + s >>> 1, n = t[i];
1797
- if (e < n[0]) s = i - 1;
1798
- else if (e > n[1]) o = i + 1;
1799
- else return i;
2709
+ t ? parseInt(t[o >> 1], 36) : 0
2710
+ ]) : r = s[o];
2711
+ return n;
2712
+ }
2713
+ function Qt(e, t, n = 0, s = t.length - 1) {
2714
+ for (; n <= s; ) {
2715
+ let r = n + s >>> 1, o = t[r];
2716
+ if (e < o[0]) s = r - 1;
2717
+ else if (e > o[1]) n = r + 1;
2718
+ else return r;
1800
2719
  }
1801
2720
  return -1;
1802
2721
  }
1803
- const Te = Ze(
2722
+ const rt = Jt(
1804
2723
  /** @type {UnicodeDataEncoding} */
1805
2724
  ",9,a,,b,1,d,,e,h,3j,w,4p,,4t,,4u,,lc,33,w3,6,13l,18,14v,,14x,1,150,1,153,,16o,5,174,a,17g,,18r,k,19s,,1cm,6,1ct,,1cv,5,1d3,1,1d6,3,1e7,,1e9,,1f4,q,1ie,a,1kb,8,1kt,,1li,3,1ln,8,1lx,2,1m1,4,1nd,2,1ow,1,1p3,8,1qi,n,1r6,,1r7,v,1s3,,1tm,,1tn,,1to,,1tq,2,1tt,7,1u1,3,1u5,,1u6,1,1u9,6,1uq,1,1vl,,1vm,1,1x8,,1xa,,1xb,1,1xd,3,1xj,1,1xn,1,1xp,,1xz,,1ya,1,1z2,,1z5,1,1z7,,20s,,20u,2,20x,1,213,1,217,2,21d,,228,1,22d,,22p,1,22r,,24c,,24e,2,24h,4,24n,1,24p,,24r,1,24t,,25e,1,262,5,269,,26a,1,27w,,27y,1,280,,281,3,287,1,28b,1,28d,,28l,2,28y,1,29u,,2bi,,2bj,,2bk,,2bl,1,2bq,2,2bu,2,2bx,,2c7,,2dc,,2dd,2,2dg,,2f0,,2f2,2,2f5,3,2fa,2,2fe,3,2fp,1,2g2,1,2gx,,2gy,1,2ik,,2im,,2in,1,2ip,,2iq,,2ir,1,2iu,2,2iy,3,2j9,1,2jm,1,2k3,,2kg,1,2ki,1,2m3,1,2m6,,2m7,1,2m9,3,2me,2,2mi,2,2ml,,2mm,,2mv,,2n6,1,2o1,,2o2,1,2q2,,2q7,,2q8,1,2qa,2,2qe,,2qg,6,2qn,,2r6,1,2sx,,2sz,,2t0,6,2tj,7,2wh,,2wj,,2wk,8,2x4,6,2zc,1,305,,307,,309,,30e,1,31t,d,327,,328,4,32e,1,32l,a,32x,z,346,,371,3,375,,376,5,37d,1,37f,1,37h,1,386,1,388,1,38e,2,38x,3,39e,,39g,,39h,1,39p,,3a5,,3cw,2n,3fk,1z,3hk,2f,3tp,2,4k2,3,4ky,2,4lu,1,4mq,1,4ok,1,4om,,4on,6,4ou,7,4p2,,4p3,1,4p5,a,4pp,,4qz,2,4r2,,4r3,,4ud,1,4vd,,4yo,2,4yr,3,4yv,1,4yx,2,4z4,1,4z6,,4z7,5,4zd,2,55j,1,55l,1,55n,,579,,57a,,57b,,57c,6,57k,,57m,,57p,7,57x,5,583,9,58f,,59s,u,5c0,3,5c4,,5dg,9,5dq,3,5du,2,5ez,8,5fk,1,5fm,,5gh,,5gi,3,5gm,1,5go,5,5ie,,5if,,5ig,1,5ii,2,5il,,5im,,5in,4,5k4,7,5kc,7,5kk,1,5km,1,5ow,2,5p0,c,5pd,,5pe,6,5pp,,5pw,,5pz,,5q0,1,5vk,1r,6bv,,6bw,,6bx,,6by,1,6co,6,6d8,,6dl,,6e8,f,6hc,w,6jm,,6k9,,6ms,5,6nd,1,6xm,1,6y0,,70o,,72n,,73d,a,73s,2,79e,,7fu,1,7g6,,7gg,,7i3,3,7i8,5,7if,b,7is,35,7m8,39,7pk,a,7pw,,7py,,7q5,,7q9,,7qg,,7qr,1,7r8,,7rb,,7rg,,7ri,,7rn,2,7rr,,7s3,4,7th,2,7tt,,7u8,,7un,,850,1,8hx,2,8ij,1,8k0,,8k5,,8vj,2,8zj,,928,v,wvj,3,wvo,9,wwu,1,wz4,1,x6q,,x6u,,x6z,,x7n,1,x7p,1,x7r,,x7w,,xa8,1,xbo,f,xc4,1,xcw,h,xdr,,xeu,7,xfr,a,xg2,,xg3,,xgg,s,xhc,2,xhf,,xir,,xis,1,xiu,3,xiy,1,xj0,1,xj2,1,xj4,,xk5,,xm1,5,xm7,1,xm9,1,xmb,1,xmd,1,xmr,,xn0,,xn1,,xoc,,xps,,xpu,2,xpz,1,xq6,1,xq9,,xrf,,xrg,1,xri,1,xrp,,xrq,,xyb,1,xyd,,xye,1,xyg,,xyh,1,xyk,,xyl,,1e68,f,1e74,f,1edb,,1ehq,1,1ek0,b,1eyl,,1f4w,,1f92,4,1gjl,2,1gjp,1,1gjw,3,1gl4,2,1glb,,1gpx,1,1h5w,3,1h7t,4,1hgr,1,1hj0,3,1hl2,a,1hmq,3,1hq8,,1hq9,,1hqa,,1hrs,e,1htc,,1htf,1,1htr,2,1htu,,1hv4,2,1hv7,3,1hvb,1,1hvd,1,1hvh,,1hvm,,1hvx,,1hxc,2,1hyf,4,1hyk,,1hyl,7,1hz9,1,1i0j,,1i0w,1,1i0y,,1i2b,2,1i2e,8,1i2n,,1i2o,,1i2q,1,1i2x,3,1i32,,1i33,,1i5o,2,1i5r,2,1i5u,1,1i5w,3,1i66,,1i69,,1ian,,1iao,2,1iar,7,1ibk,1,1ibm,1,1id7,1,1ida,,1idb,,1idc,,1idd,3,1idj,1,1idn,1,1idp,,1idz,,1iea,1,1iee,6,1ieo,4,1igo,,1igp,1,1igr,5,1igy,,1ih1,,1ih3,2,1ih6,,1ih8,1,1iha,2,1ihd,,1ihe,,1iht,1,1ik5,2,1ik8,7,1ikg,1,1iki,2,1ikl,,1ikm,,1ila,,1ink,,1inl,1,1inn,5,1int,,1inu,,1inv,1,1inx,,1iny,,1inz,1,1io1,,1io2,1,1iun,,1iuo,1,1iuq,3,1iuw,3,1iv0,1,1iv2,,1iv3,1,1ivw,1,1iy8,2,1iyb,7,1iyj,1,1iyl,,1iym,,1iyn,1,1j1n,,1j1o,,1j1p,,1j1q,1,1j1s,7,1j4t,,1j4u,,1j4v,,1j4y,3,1j52,,1j53,4,1jcc,2,1jcf,8,1jco,,1jcp,1,1jjk,,1jjl,4,1jjr,1,1jjv,3,1jjz,,1jk0,,1jk1,,1jk2,,1jk3,,1jo1,2,1jo4,3,1joa,1,1joc,3,1jog,,1jok,,1jpd,9,1jqr,5,1jqx,,1jqy,,1jqz,3,1jrb,,1jrl,5,1jrr,1,1jrt,2,1jt0,5,1jt6,c,1jtj,,1jtk,1,1k4v,,1k4w,6,1k54,5,1k5a,,1k5b,,1k7m,l,1k89,,1k8a,6,1k8h,,1k8i,1,1k8k,,1k8l,1,1kc1,5,1kca,,1kcc,1,1kcf,6,1kcm,,1kcn,,1kei,4,1keo,1,1ker,1,1ket,,1keu,,1kev,,1koj,1,1kol,1,1kow,1,1koy,,1koz,,1kqc,1,1kqe,4,1kqm,1,1kqo,2,1kre,,1ovk,f,1ow0,,1ow7,e,1xr2,b,1xre,2,1xrh,2,1zow,4,1zqo,6,206b,,206f,3,20jz,,20k1,1i,20lr,3,20o4,,20og,1,2ftp,1,2fts,3,2jgg,19,2jhs,m,2jxh,4,2jxp,5,2jxv,7,2jy3,7,2jyd,6,2jze,3,2k3m,2,2lmo,1i,2lob,1d,2lpx,,2lqc,,2lqz,4,2lr5,e,2mtc,6,2mtk,g,2mu3,6,2mub,1,2mue,4,2mxb,,2n1s,6,2nce,,2ne4,3,2nsc,3,2nzi,1,2ok0,6,2on8,6,2pz4,73,2q6l,2,2q7j,,2q98,5,2q9q,1,2qa6,,2qa9,9,2qb1,1k,2qcm,p,2qdd,e,2qe2,,2qen,,2qeq,8,2qf0,3,2qfd,c1,2qrf,4,2qrk,8t,2r0m,7d,2r9c,3j,2rg4,b,2rit,16,2rkc,3,2rm0,7,2rmi,5,2rns,7,2rou,29,2rrg,1a,2rss,9,2rt3,c8,2scg,sd,jny8,v,jnz4,2n,jo1s,3j,jo5c,6n,joc0,2rz",
1806
2725
  "262122424333333393233393339333333333393393b3b3b3b3b333b33b3bb33333b3b3333333b3b33bb3333b33b3bb33333b3bbb333b333b33333b3b3b3b3333b3b33b3bb39333b33b33b3b3b333b333333b3b333333b33b3b3333b3335dc333333b3b3b33323333b3bb3b33b3b3b3333b3333b3b333bb3b33b3b3b3b3b333b333b3323e2244234444444444444444444444444444444444444444443333333333b3b3bb33333b353b3b3b3b333b3b333b333333b3bb3b3b3bb333232333333333333333b3b3333bb3b393933b3b33bb3b393b3b3b3333b33b33b3bbb33b333b3333bb3933b3b3b333b3b3b3b3b33b3b3b33b3b3b33b3b33b33b3b3b33bb39b9b3b33b3b33b9333b393b3b33b33b3b3b3333393b3b3b33b39bb3b332333b333dd3b33332333323333333333333333333333344444444a44444434444444444444423232"
1807
- ), vn = Ze(
2726
+ ), as = Jt(
1808
2727
  /** @type {UnicodeDataEncoding} */
1809
2728
  "1sl,10,1ug,7,1vc,7,1w5,j,1wq,6,1wy,,1x2,3,1y4,1,1y7,,1yo,1,239,j,23u,6,242,1,245,4,261,,26t,j,27e,6,27m,1,27p,4,28s,1,28v,,29d,,2dx,j,2ei,f,2fs,2,2l1,11"
1810
- ), Re = 65535;
1811
- function* En(e) {
2729
+ ), _t = 65535;
2730
+ function* cs(e) {
1812
2731
  let t = e.codePointAt(0);
1813
2732
  if (t == null) return;
1814
- let o = t <= Re ? 1 : 2, s = e.length, i = Be(t), n = 0, a = 0, r = !1, l = !1, u = !1, p = 0, f = i, E = t;
1815
- for (; o < s; ) {
2733
+ let n = t <= _t ? 1 : 2, s = e.length, r = Lt(t), o = 0, l = 0, i = !1, a = !1, c = !1, d = 0, u = r, g = t;
2734
+ for (; n < s; ) {
1816
2735
  t = /** @type {number} */
1817
- e.codePointAt(o), n = Be(t);
1818
- let S = !0;
1819
- i === 1 ? S = n !== 6 : i === 2 || i === 6 || n === 1 || n === 2 || n === 6 ? S = !0 : n === 3 || n === 14 || n === 11 || i === 9 ? S = !1 : i === 14 && n === 4 ? S = !r : i === 10 && n === 10 ? S = a++ % 2 === 1 : i === 5 ? S = !(n === 5 || n === 13 || n === 7 || n === 8) : ((i === 7 || i === 13) && (n === 13 || n === 12) || (i === 8 || i === 12) && n === 12 || n === 0 && l && u && je(t)) && (S = !1), S ? (yield {
1820
- segment: e.slice(p, o),
1821
- index: p,
2736
+ e.codePointAt(n), o = Lt(t);
2737
+ let h = !0;
2738
+ r === 1 ? h = o !== 6 : r === 2 || r === 6 || o === 1 || o === 2 || o === 6 ? h = !0 : o === 3 || o === 14 || o === 11 || r === 9 ? h = !1 : r === 14 && o === 4 ? h = !i : r === 10 && o === 10 ? h = l++ % 2 === 1 : r === 5 ? h = !(o === 5 || o === 13 || o === 7 || o === 8) : ((r === 7 || r === 13) && (o === 13 || o === 12) || (r === 8 || r === 12) && o === 12 || o === 0 && a && c && kt(t)) && (h = !1), h ? (yield {
2739
+ segment: e.slice(d, n),
2740
+ index: d,
1822
2741
  input: e,
1823
- _hd: E,
1824
- _catBegin: f,
1825
- _catEnd: i
1826
- }, r = !1, a = 0, p = o, f = n, E = t) : n === 14 && (i === 3 || i === 4) ? r = !0 : t >= 2325 && (!l && i === 0 && (l = je(E)), l && n === 3 ? u = u || t === 2381 || t === 2509 || t === 2637 || t === 2765 || t === 2893 || t === 3149 || t === 3405 : u = !1), o += t <= Re ? 1 : 2, i = n;
2742
+ _hd: g,
2743
+ _catBegin: u,
2744
+ _catEnd: r
2745
+ }, i = !1, l = 0, d = n, u = o, g = t) : o === 14 && (r === 3 || r === 4) ? i = !0 : t >= 2325 && (!a && r === 0 && (a = kt(g)), a && o === 3 ? c = c || t === 2381 || t === 2509 || t === 2637 || t === 2765 || t === 2893 || t === 3149 || t === 3405 : c = !1), n += t <= _t ? 1 : 2, r = o;
1827
2746
  }
1828
- p < s && (yield {
1829
- segment: e.slice(p),
1830
- index: p,
2747
+ d < s && (yield {
2748
+ segment: e.slice(d),
2749
+ index: d,
1831
2750
  input: e,
1832
- _hd: E,
1833
- _catBegin: f,
1834
- _catEnd: i
2751
+ _hd: g,
2752
+ _catBegin: u,
2753
+ _catEnd: r
1835
2754
  });
1836
2755
  }
1837
- function _n(e) {
2756
+ function us(e) {
1838
2757
  let t = 0;
1839
- for (let o of En(e)) t += 1;
2758
+ for (let n of cs(e)) t += 1;
1840
2759
  return t;
1841
2760
  }
1842
- const Je = new Uint8Array(6080), he = 128, ve = 12287, Qe = new Uint8Array(1536), ge = 40960, et = 44031, Sn = (() => {
2761
+ const en = new Uint8Array(6080), qe = 128, it = 12287, tn = new Uint8Array(1536), He = 40960, nn = 44031, ds = (() => {
1843
2762
  let e = 0;
1844
2763
  for (; ; ) {
1845
- let [t, o, s] = Te[e];
1846
- if (t > et) break;
1847
- if (e++, !(o < he || t > ve && o < ge))
1848
- for (let i = t; i <= o; i++) {
1849
- let n, a = 0;
1850
- i <= ve ? (n = Je, a = i - he >> 1) : (n = Qe, a = i - ge >> 1), n[a] = i & 1 ? n[a] & 15 | s << 4 : n[a] & 240 | s;
2764
+ let [t, n, s] = rt[e];
2765
+ if (t > nn) break;
2766
+ if (e++, !(n < qe || t > it && n < He))
2767
+ for (let r = t; r <= n; r++) {
2768
+ let o, l = 0;
2769
+ r <= it ? (o = en, l = r - qe >> 1) : (o = tn, l = r - He >> 1), o[l] = r & 1 ? o[l] & 15 | s << 4 : o[l] & 240 | s;
1851
2770
  }
1852
2771
  }
1853
2772
  return e;
1854
2773
  })();
1855
- function Be(e) {
1856
- if (e < he)
2774
+ function Lt(e) {
2775
+ if (e < qe)
1857
2776
  return e >= 32 ? 0 : e === 10 ? 6 : e === 13 ? 1 : 2;
1858
- if (e <= ve) {
1859
- let o = Je[e - he >> 1];
2777
+ if (e <= it) {
2778
+ let n = en[e - qe >> 1];
1860
2779
  return (
1861
2780
  /** @type {GraphemeCategoryNum} */
1862
- e & 1 ? o >> 4 : o & 15
2781
+ e & 1 ? n >> 4 : n & 15
1863
2782
  );
1864
2783
  }
1865
- if (e < ge)
2784
+ if (e < He)
1866
2785
  return e < 12336 ? e >= 12330 ? 3 : 0 : e < 12443 ? e === 12336 || e === 12349 ? 4 : e >= 12441 ? 3 : 0 : e === 12951 || e === 12953 ? 4 : 0;
1867
- if (e <= et) {
1868
- let o = Qe[e - ge >> 1];
2786
+ if (e <= nn) {
2787
+ let n = tn[e - He >> 1];
1869
2788
  return (
1870
2789
  /** @type {GraphemeCategoryNum} */
1871
- e & 1 ? o >> 4 : o & 15
2790
+ e & 1 ? n >> 4 : n & 15
1872
2791
  );
1873
2792
  }
1874
2793
  if (e <= 55203)
@@ -1877,44 +2796,44 @@ function Be(e) {
1877
2796
  return e <= 55238 ? e >= 55216 ? 13 : 0 : e >= 55243 ? 12 : 0;
1878
2797
  if (e < 65024)
1879
2798
  return e === 64286 ? 3 : 0;
1880
- let t = Ye(e, Te, Sn);
1881
- return t < 0 ? 0 : Te[t][2];
2799
+ let t = Qt(e, rt, ds);
2800
+ return t < 0 ? 0 : rt[t][2];
1882
2801
  }
1883
- function je(e) {
1884
- return Ye(e, vn) >= 0;
2802
+ function kt(e) {
2803
+ return Qt(e, as) >= 0;
1885
2804
  }
1886
- const $e = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
1887
- function tt(e) {
2805
+ const Mt = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
2806
+ function on(e) {
1888
2807
  if (!e) return 0;
1889
- if ($e) {
2808
+ if (Mt) {
1890
2809
  let t = 0;
1891
- for (const o of $e.segment(e))
2810
+ for (const n of Mt.segment(e))
1892
2811
  t++;
1893
2812
  return t;
1894
2813
  }
1895
- return _n(e);
2814
+ return us(e);
1896
2815
  }
1897
- function Cn(e, t) {
1898
- const o = W(null), s = de(e, "placeholder"), i = () => {
1899
- var r;
1900
- const a = [
1901
- bt,
1902
- yt,
1903
- Tt,
1904
- vt,
2816
+ function fs(e, t) {
2817
+ const n = F(null), s = De(e, "placeholder"), r = () => {
2818
+ var i;
2819
+ const l = [
2820
+ En,
2821
+ wn,
2822
+ Cn,
2823
+ An,
1905
2824
  // 提供 undo/redo 功能
1906
- Et.configure({
2825
+ Sn.configure({
1907
2826
  placeholder: () => s.value || "请输入内容..."
1908
2827
  }),
1909
- _t.configure({
2828
+ _n.configure({
1910
2829
  mode: "textSize",
1911
- textCounter: tt
2830
+ textCounter: on
1912
2831
  })
1913
2832
  ];
1914
- return (r = e.extensions) != null && r.length && a.push(...e.extensions), a;
1915
- }, n = gt({
2833
+ return (i = e.extensions) != null && i.length && l.push(...e.extensions), l;
2834
+ }, o = vn({
1916
2835
  content: e.modelValue ?? e.defaultValue ?? "",
1917
- extensions: i(),
2836
+ extensions: r(),
1918
2837
  autofocus: e.autofocus ? "end" : !1,
1919
2838
  editorProps: {
1920
2839
  attributes: {
@@ -1922,315 +2841,315 @@ function Cn(e, t) {
1922
2841
  enterkeyhint: e.enterkeyhint
1923
2842
  },
1924
2843
  // 处理粘贴事件 - 只粘贴纯文本
1925
- handlePaste(a, r) {
1926
- var E;
1927
- const l = (E = r.clipboardData) == null ? void 0 : E.getData("text/plain");
1928
- if (!l) return !1;
1929
- const u = e.mode === "single" ? l.replace(/\r?\n/g, " ") : l, { state: p } = a, { tr: f } = p;
1930
- return f.insertText(u), a.dispatch(f), te(() => {
1931
- var S;
1932
- (S = n.value) == null || S.commands.scrollIntoView();
2844
+ handlePaste(l, i) {
2845
+ var g;
2846
+ const a = (g = i.clipboardData) == null ? void 0 : g.getData("text/plain");
2847
+ if (!a) return !1;
2848
+ const c = e.mode === "single" ? a.replace(/\r?\n/g, " ") : a, { state: d } = l, { tr: u } = d;
2849
+ return u.insertText(c), l.dispatch(u), me(() => {
2850
+ var h;
2851
+ (h = o.value) == null || h.commands.scrollIntoView();
1933
2852
  }), !0;
1934
2853
  }
1935
2854
  },
1936
- onUpdate: (a) => {
1937
- const r = a.editor.getText();
1938
- t("update:modelValue", r), t("input", r);
2855
+ onUpdate: (l) => {
2856
+ const i = l.editor.getText();
2857
+ t("update:modelValue", i), t("input", i);
1939
2858
  },
1940
- onFocus: (a) => {
1941
- t("focus", a.event);
2859
+ onFocus: (l) => {
2860
+ t("focus", l.event);
1942
2861
  },
1943
- onBlur: (a) => {
1944
- t("blur", a.event);
2862
+ onBlur: (l) => {
2863
+ t("blur", l.event);
1945
2864
  }
1946
2865
  });
1947
2866
  return K(
1948
2867
  () => e.modelValue,
1949
- (a) => {
1950
- n.value && a !== n.value.getText() && n.value.commands.setContent(a ?? "", { emitUpdate: !1 });
2868
+ (l) => {
2869
+ o.value && l !== o.value.getText() && o.value.commands.setContent(l ?? "", { emitUpdate: !1 });
1951
2870
  }
1952
2871
  ), K(
1953
2872
  () => e.placeholder,
1954
2873
  () => {
1955
- if (n.value) {
1956
- const { state: a } = n.value, r = a.tr;
1957
- n.value.view.dispatch(r);
2874
+ if (o.value) {
2875
+ const { state: l } = o.value, i = l.tr;
2876
+ o.value.view.dispatch(i);
1958
2877
  }
1959
2878
  }
1960
2879
  ), K(
1961
2880
  () => e.enterkeyhint,
1962
- (a) => {
1963
- if (n.value) {
1964
- const r = n.value.view.dom;
1965
- a ? r.setAttribute("enterkeyhint", a) : r.removeAttribute("enterkeyhint");
2881
+ (l) => {
2882
+ if (o.value) {
2883
+ const i = o.value.view.dom;
2884
+ l ? i.setAttribute("enterkeyhint", l) : i.removeAttribute("enterkeyhint");
1966
2885
  }
1967
2886
  }
1968
- ), ut(() => {
1969
- var a;
1970
- (a = n.value) == null || a.destroy();
2887
+ ), mn(() => {
2888
+ var l;
2889
+ (l = o.value) == null || l.destroy();
1971
2890
  }), {
1972
- editor: n,
1973
- editorRef: o
2891
+ editor: o,
2892
+ editorRef: n
1974
2893
  };
1975
2894
  }
1976
- function An(e) {
2895
+ function ps(e) {
1977
2896
  const { submitType: t } = e;
1978
2897
  return {
1979
- checkSubmitShortcut: (i) => {
1980
- if (!I(i, "ENTER")) return !1;
2898
+ checkSubmitShortcut: (r) => {
2899
+ if (!I(r, "ENTER")) return !1;
1981
2900
  switch (t.value) {
1982
2901
  case "enter":
1983
- return !i.shiftKey && !i.ctrlKey && !i.metaKey;
2902
+ return !r.shiftKey && !r.ctrlKey && !r.metaKey;
1984
2903
  case "ctrlEnter":
1985
- return (i.ctrlKey || i.metaKey) && !i.shiftKey;
2904
+ return (r.ctrlKey || r.metaKey) && !r.shiftKey;
1986
2905
  case "shiftEnter":
1987
- return i.shiftKey && !i.ctrlKey && !i.metaKey;
2906
+ return r.shiftKey && !r.ctrlKey && !r.metaKey;
1988
2907
  default:
1989
2908
  return !1;
1990
2909
  }
1991
2910
  },
1992
- checkNewlineShortcut: (i) => {
1993
- if (!I(i, "ENTER")) return !1;
2911
+ checkNewlineShortcut: (r) => {
2912
+ if (!I(r, "ENTER")) return !1;
1994
2913
  switch (t.value) {
1995
2914
  case "enter":
1996
- return i.shiftKey || i.ctrlKey || i.metaKey;
2915
+ return r.shiftKey || r.ctrlKey || r.metaKey;
1997
2916
  case "ctrlEnter":
1998
2917
  case "shiftEnter":
1999
- return !i.shiftKey && !i.ctrlKey && !i.metaKey;
2918
+ return !r.shiftKey && !r.ctrlKey && !r.metaKey;
2000
2919
  default:
2001
2920
  return !1;
2002
2921
  }
2003
2922
  }
2004
2923
  };
2005
2924
  }
2006
- function wn(e, t, o) {
2007
- const s = W(e.mode || "single"), i = W(!1), n = W(e.mode || "single"), { start: a, stop: r } = St(
2925
+ function ms(e, t, n) {
2926
+ const s = F(e.mode || "single"), r = F(!1), o = F(e.mode || "single"), { start: l, stop: i } = Ln(
2008
2927
  () => {
2009
- i.value = !1;
2928
+ r.value = !1;
2010
2929
  },
2011
2930
  300,
2012
2931
  { immediate: !1 }
2013
- ), l = M(() => {
2014
- var f;
2015
- return (f = o.value) == null ? void 0 : f.closest(".tr-sender-main");
2016
- }), u = () => {
2017
- if (n.value !== "single" || i.value || !t.value || !o.value) return;
2018
- const f = o.value.querySelector(".ProseMirror");
2019
- if (!f) return;
2020
- const E = t.value.getText();
2021
- s.value === "single" ? f.scrollWidth > f.clientWidth && p("multiple") : E.length || p("single");
2022
- }, p = (f) => {
2023
- s.value !== f && (i.value = !0, s.value = f, te(() => {
2024
- t.value && t.value.commands.focus("end"), r(), a();
2932
+ ), a = R(() => {
2933
+ var u;
2934
+ return (u = n.value) == null ? void 0 : u.closest(".tr-sender-main");
2935
+ }), c = () => {
2936
+ if (o.value !== "single" || r.value || !t.value || !n.value) return;
2937
+ const u = n.value.querySelector(".ProseMirror");
2938
+ if (!u) return;
2939
+ const g = t.value.getText();
2940
+ s.value === "single" ? u.scrollWidth > u.clientWidth && d("multiple") : g.length || d("single");
2941
+ }, d = (u) => {
2942
+ s.value !== u && (r.value = !0, s.value = u, me(() => {
2943
+ t.value && t.value.commands.focus("end"), i(), l();
2025
2944
  }));
2026
2945
  };
2027
- return Ct(l, () => {
2946
+ return kn(a, () => {
2028
2947
  requestAnimationFrame(() => {
2029
- u();
2948
+ c();
2030
2949
  });
2031
2950
  }), K(
2032
2951
  () => e.mode,
2033
- (f) => {
2034
- f && f !== s.value && (n.value = f, p(f));
2952
+ (u) => {
2953
+ u && u !== s.value && (o.value = u, d(u));
2035
2954
  }
2036
2955
  ), {
2037
2956
  currentMode: s,
2038
- isAutoSwitching: i,
2039
- setMode: p,
2040
- checkOverflow: u
2957
+ isAutoSwitching: r,
2958
+ setMode: d,
2959
+ checkOverflow: c
2041
2960
  };
2042
2961
  }
2043
- function kn(e, t, o) {
2044
- const s = At("--tr-sender-line-height", t), i = M(() => {
2045
- const r = s.value;
2046
- if (r) {
2047
- const l = parseFloat(r);
2048
- return isNaN(l) ? 26 : l;
2962
+ function hs(e, t, n) {
2963
+ const s = Mn("--tr-sender-line-height", t), r = R(() => {
2964
+ const i = s.value;
2965
+ if (i) {
2966
+ const a = parseFloat(i);
2967
+ return isNaN(a) ? 26 : a;
2049
2968
  }
2050
2969
  return 26;
2051
- }), n = M(() => o === !1 || o === void 0 ? null : o === !0 ? {
2970
+ }), o = R(() => n === !1 || n === void 0 ? null : n === !0 ? {
2052
2971
  minRows: 1,
2053
2972
  maxRows: 5
2054
- } : typeof o == "object" ? {
2055
- minRows: o.minRows,
2056
- maxRows: o.maxRows
2057
- } : null), a = () => {
2973
+ } : typeof n == "object" ? {
2974
+ minRows: n.minRows,
2975
+ maxRows: n.maxRows
2976
+ } : null), l = () => {
2058
2977
  if (!t.value) return;
2059
- const r = t.value.querySelector(".tr-sender-editor-scroll");
2060
- if (!r) {
2978
+ const i = t.value.querySelector(".tr-sender-editor-scroll");
2979
+ if (!i) {
2061
2980
  console.warn("⚠️ 找不到滚动容器 .tr-sender-editor-scroll");
2062
2981
  return;
2063
2982
  }
2064
- const l = n.value;
2065
- if (e.value === "multiple" && l) {
2066
- const u = i.value * l.minRows, p = i.value * l.maxRows;
2067
- r.style.minHeight = `${u}px`, r.style.maxHeight = `${p}px`, r.style.overflowY = "auto";
2983
+ const a = o.value;
2984
+ if (e.value === "multiple" && a) {
2985
+ const c = r.value * a.minRows, d = r.value * a.maxRows;
2986
+ i.style.minHeight = `${c}px`, i.style.maxHeight = `${d}px`, i.style.overflowY = "auto";
2068
2987
  } else
2069
- r.style.minHeight = "", r.style.maxHeight = "", r.style.overflowY = e.value === "single" ? "hidden" : "auto";
2988
+ i.style.minHeight = "", i.style.maxHeight = "", i.style.overflowY = e.value === "single" ? "hidden" : "auto";
2070
2989
  };
2071
2990
  return K(
2072
2991
  e,
2073
2992
  () => {
2074
- te(() => {
2075
- a();
2993
+ me(() => {
2994
+ l();
2076
2995
  });
2077
2996
  },
2078
2997
  { immediate: !0 }
2079
2998
  ), K(
2080
- n,
2999
+ o,
2081
3000
  () => {
2082
- te(() => {
2083
- a();
3001
+ me(() => {
3002
+ l();
2084
3003
  });
2085
3004
  },
2086
3005
  { immediate: !0 }
2087
3006
  ), {
2088
- updateHeight: a
3007
+ updateHeight: l
2089
3008
  };
2090
3009
  }
2091
- const Ln = (e) => e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.length > 0 : typeof e == "object" ? Object.keys(e).length > 0 : !!e, Mn = (e, t) => {
2092
- const o = ft(t);
2093
- if (Ln(o))
3010
+ const gs = (e) => e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.length > 0 : typeof e == "object" ? Object.keys(e).length > 0 : !!e, xs = (e, t) => {
3011
+ const n = gn(t);
3012
+ if (gs(n))
2094
3013
  return {
2095
3014
  source: e,
2096
- payload: o
3015
+ payload: n
2097
3016
  };
2098
3017
  };
2099
- function Pn() {
2100
- const e = dt(/* @__PURE__ */ new Map()), t = M(() => {
2101
- const i = [];
2102
- for (const n of e.values()) {
2103
- const a = Mn(n.source, n.payload);
2104
- a && i.push(a);
3018
+ function ys() {
3019
+ const e = hn(/* @__PURE__ */ new Map()), t = R(() => {
3020
+ const r = [];
3021
+ for (const o of e.values()) {
3022
+ const l = xs(o.source, o.payload);
3023
+ l && r.push(l);
2105
3024
  }
2106
- return i;
3025
+ return r;
2107
3026
  });
2108
3027
  return {
2109
- hasRegisteredContent: M(() => t.value.length > 0),
2110
- registerContent: (i, n) => {
2111
- const a = Symbol("sender-content");
2112
- return e.set(a, { source: i, payload: n }), () => {
2113
- e.delete(a);
3028
+ hasRegisteredContent: R(() => t.value.length > 0),
3029
+ registerContent: (r, o) => {
3030
+ const l = Symbol("sender-content");
3031
+ return e.set(l, { source: r, payload: o }), () => {
3032
+ e.delete(l);
2114
3033
  };
2115
3034
  },
2116
3035
  externalPayloads: t
2117
3036
  };
2118
3037
  }
2119
- function Dn(e, t) {
2120
- const { editor: o, editorRef: s } = Cn(e, t), i = M(() => o.value ? be(o.value).trim().length > 0 : !1), { hasRegisteredContent: n, registerContent: a, externalPayloads: r } = Pn(), l = M(() => i.value || n.value || !!e.hasExternalContent), u = M(() => o.value ? tt(be(o.value)) : 0), p = M(() => e.maxLength ? u.value > e.maxLength : !1), f = M(() => {
2121
- var m, k;
2122
- return !e.disabled && !e.loading && l.value && !p.value && !((k = (m = e.defaultActions) == null ? void 0 : m.submit) != null && k.disabled);
2123
- }), E = () => {
2124
- if (!f.value || !o.value) return;
2125
- let m, k = "";
2126
- if (o.value.extensionManager.extensions.some((q) => q.name === se.TEMPLATE)) {
2127
- const q = Ue(o.value);
2128
- q.length > 0 && (m = q), k = be(o.value);
2129
- } else if (o.value.extensionManager.extensions.some((q) => q.name === se.MENTION)) {
2130
- const q = zt(o.value);
2131
- q.length > 0 && (m = q), k = Wt(o.value);
3038
+ function bs(e, t) {
3039
+ const { editor: n, editorRef: s } = fs(e, t), r = R(() => n.value ? tt(n.value).trim().length > 0 : !1), { hasRegisteredContent: o, registerContent: l, externalPayloads: i } = ys(), a = R(() => r.value || o.value || !!e.hasExternalContent), c = R(() => n.value ? on(tt(n.value)) : 0), d = R(() => e.maxLength ? c.value > e.maxLength : !1), u = R(() => {
3040
+ var b, L;
3041
+ return !e.disabled && !e.loading && a.value && !d.value && !((L = (b = e.defaultActions) == null ? void 0 : b.submit) != null && L.disabled);
3042
+ }), g = () => {
3043
+ if (!u.value || !n.value) return;
3044
+ let b, L = "";
3045
+ if (n.value.extensionManager.extensions.some((N) => N.name === be.TEMPLATE)) {
3046
+ const N = Yt(n.value);
3047
+ N.length > 0 && (b = N), L = tt(n.value);
3048
+ } else if (n.value.extensionManager.extensions.some((N) => N.name === be.MENTION)) {
3049
+ const N = Po(n.value);
3050
+ N.length > 0 && (b = N), L = Ro(n.value);
2132
3051
  }
2133
- k || (k = o.value.getText());
2134
- const $ = r.value.slice();
3052
+ L || (L = n.value.getText());
3053
+ const $ = i.value.slice();
2135
3054
  if ($.length === 0) {
2136
- t("submit", k, m);
3055
+ t("submit", L, b);
2137
3056
  return;
2138
3057
  }
2139
- t("submit", k, m, {
3058
+ t("submit", L, b, {
2140
3059
  externalPayloads: $
2141
3060
  });
2142
- }, { currentMode: S, isAutoSwitching: j, setMode: L, checkOverflow: C } = wn(e, o, s), h = An({
2143
- submitType: M(() => e.submitType ?? "enter")
3061
+ }, { currentMode: h, isAutoSwitching: E, setMode: w, checkOverflow: T } = ms(e, n, s), m = ps({
3062
+ submitType: R(() => e.submitType ?? "enter")
2144
3063
  });
2145
3064
  K(
2146
- o,
2147
- (m) => {
2148
- m && m.setOptions({
3065
+ n,
3066
+ (b) => {
3067
+ b && b.setOptions({
2149
3068
  editorProps: {
2150
- ...m.options.editorProps,
2151
- handleKeyDown: (k, $) => {
2152
- const q = Q.getState(k.state), De = H.getState(k.state), Oe = ae.getState(k.state);
2153
- return q && q.active || De && De.active || Oe && Oe.isOpen ? !1 : h.checkSubmitShortcut($) ? ($.preventDefault(), E(), !0) : h.checkNewlineShortcut($) ? ($.preventDefault(), S.value === "single" ? (L("multiple"), setTimeout(() => {
2154
- m.commands.splitBlock(), m.commands.focus();
2155
- }, 0)) : m.commands.splitBlock(), !0) : !1;
3069
+ ...b.options.editorProps,
3070
+ handleKeyDown: (L, $) => {
3071
+ const N = de.getState(L.state), Se = z.getState(L.state), V = Ce.getState(L.state);
3072
+ return N && N.active || Se && Se.active || V && V.isOpen ? !1 : m.checkSubmitShortcut($) ? ($.preventDefault(), g(), !0) : m.checkNewlineShortcut($) ? ($.preventDefault(), h.value === "single" ? (w("multiple"), setTimeout(() => {
3073
+ b.commands.splitBlock(), b.commands.focus();
3074
+ }, 0)) : b.commands.splitBlock(), !0) : !1;
2156
3075
  }
2157
3076
  }
2158
3077
  });
2159
3078
  },
2160
3079
  { immediate: !0 }
2161
- ), kn(S, s, e.autoSize), K(
3080
+ ), hs(h, s, e.autoSize), K(
2162
3081
  () => {
2163
- var m;
2164
- return (m = o.value) == null ? void 0 : m.state.doc.content;
3082
+ var b;
3083
+ return (b = n.value) == null ? void 0 : b.state.doc.content;
2165
3084
  },
2166
3085
  () => {
2167
3086
  setTimeout(() => {
2168
- C();
3087
+ T();
2169
3088
  }, 0);
2170
3089
  },
2171
3090
  { deep: !0 }
2172
3091
  );
2173
- const g = () => {
2174
- var m;
2175
- (m = o.value) == null || m.commands.focus();
2176
- }, d = () => {
2177
- var m, k;
2178
- (m = o.value) == null || m.commands.clearContent(), (k = o.value) == null || k.commands.focus(), t("clear");
2179
- }, c = () => {
3092
+ const y = () => {
3093
+ var b;
3094
+ (b = n.value) == null || b.commands.focus();
3095
+ }, p = () => {
3096
+ var b, L;
3097
+ (b = n.value) == null || b.commands.clearContent(), (L = n.value) == null || L.commands.focus(), t("clear");
3098
+ }, f = () => {
2180
3099
  t("cancel");
2181
- }, b = () => {
2182
- var m;
2183
- (m = o.value) == null || m.commands.blur();
2184
- }, _ = (m) => {
2185
- var k;
2186
- (k = o.value) == null || k.commands.setContent(m);
2187
3100
  }, x = () => {
2188
- var m;
2189
- return ((m = o.value) == null ? void 0 : m.getText()) || "";
2190
- }, v = {
2191
- editor: o,
3101
+ var b;
3102
+ (b = n.value) == null || b.commands.blur();
3103
+ }, v = (b) => {
3104
+ var L;
3105
+ (L = n.value) == null || L.commands.setContent(b);
3106
+ }, S = () => {
3107
+ var b;
3108
+ return ((b = n.value) == null ? void 0 : b.getText()) || "";
3109
+ }, _ = {
3110
+ editor: n,
2192
3111
  editorRef: s,
2193
- mode: S,
2194
- isAutoSwitching: j,
2195
- loading: M(() => e.loading ?? !1),
2196
- disabled: M(() => e.disabled ?? !1),
2197
- hasContent: l,
2198
- hasEditorContent: i,
2199
- canSubmit: f,
2200
- isOverLimit: p,
2201
- characterCount: u,
2202
- maxLength: de(e, "maxLength"),
2203
- size: M(() => e.size ?? "normal"),
2204
- showWordLimit: M(() => e.showWordLimit ?? !1),
2205
- clearable: M(() => e.clearable ?? !1),
2206
- defaultActions: de(e, "defaultActions"),
2207
- submitType: M(() => e.submitType ?? "enter"),
2208
- stopText: de(e, "stopText"),
2209
- submit: E,
2210
- clear: d,
2211
- cancel: c,
2212
- focus: g,
2213
- blur: b,
2214
- setContent: _,
2215
- getContent: x
3112
+ mode: h,
3113
+ isAutoSwitching: E,
3114
+ loading: R(() => e.loading ?? !1),
3115
+ disabled: R(() => e.disabled ?? !1),
3116
+ hasContent: a,
3117
+ hasEditorContent: r,
3118
+ canSubmit: u,
3119
+ isOverLimit: d,
3120
+ characterCount: c,
3121
+ maxLength: De(e, "maxLength"),
3122
+ size: R(() => e.size ?? "normal"),
3123
+ showWordLimit: R(() => e.showWordLimit ?? !1),
3124
+ clearable: R(() => e.clearable ?? !1),
3125
+ defaultActions: De(e, "defaultActions"),
3126
+ submitType: R(() => e.submitType ?? "enter"),
3127
+ stopText: De(e, "stopText"),
3128
+ submit: g,
3129
+ clear: p,
3130
+ cancel: f,
3131
+ focus: y,
3132
+ blur: x,
3133
+ setContent: v,
3134
+ getContent: S
2216
3135
  };
2217
- return pt(mt, v), Lt(a), {
2218
- context: v,
3136
+ return xn(yn, _), On(l), {
3137
+ context: _,
2219
3138
  expose: {
2220
- submit: E,
2221
- clear: d,
2222
- cancel: c,
2223
- focus: g,
2224
- blur: b,
2225
- setContent: _,
2226
- getContent: x,
2227
- editor: o
3139
+ submit: g,
3140
+ clear: p,
3141
+ cancel: f,
3142
+ focus: y,
3143
+ blur: x,
3144
+ setContent: v,
3145
+ getContent: S,
3146
+ editor: n
2228
3147
  }
2229
3148
  };
2230
3149
  }
2231
- function Pe() {
2232
- const e = ue();
2233
- return M(() => ({
3150
+ function bt() {
3151
+ const e = Pe();
3152
+ return R(() => ({
2234
3153
  // 编辑器实例
2235
3154
  editor: e.editor.value,
2236
3155
  // 基础操作
@@ -2238,14 +3157,14 @@ function Pe() {
2238
3157
  blur: e.blur,
2239
3158
  // 内容操作(为增强按钮设计)
2240
3159
  insert: (t) => {
2241
- var o;
2242
- (o = e.editor.value) == null || o.commands.insertContent(t + " "), e.focus();
3160
+ var n;
3161
+ (n = e.editor.value) == null || n.commands.insertContent(t + " "), e.focus();
2243
3162
  },
2244
3163
  append: (t) => {
2245
- const o = e.editor.value;
2246
- if (o) {
2247
- const s = o.state.doc.content.size;
2248
- o.chain().focus().insertContentAt(s, t).run();
3164
+ const n = e.editor.value;
3165
+ if (n) {
3166
+ const s = n.state.doc.content.size;
3167
+ n.chain().focus().insertContentAt(s, t).run();
2249
3168
  }
2250
3169
  },
2251
3170
  replace: (t) => {
@@ -2257,58 +3176,58 @@ function Pe() {
2257
3176
  hasContent: e.hasContent.value
2258
3177
  }));
2259
3178
  }
2260
- const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
3179
+ const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
2261
3180
  __name: "index",
2262
3181
  setup(e) {
2263
- const { editor: t, editorRef: o } = ue();
2264
- return (s, i) => (w(), P("div", {
3182
+ const { editor: t, editorRef: n } = Pe();
3183
+ return (s, r) => (M(), P("div", {
2265
3184
  ref_key: "editorRef",
2266
- ref: o,
3185
+ ref: n,
2267
3186
  class: "tr-sender-editor-wrapper"
2268
3187
  }, [
2269
- R("div", On, [
2270
- A(t) ? (w(), V(A(xt), {
3188
+ B("div", vs, [
3189
+ k(t) ? (M(), U(k(Tn), {
2271
3190
  key: 0,
2272
- editor: A(t),
3191
+ editor: k(t),
2273
3192
  class: "tr-sender-editor-content"
2274
- }, null, 8, ["editor"])) : N("", !0)
3193
+ }, null, 8, ["editor"])) : q("", !0)
2275
3194
  ])
2276
3195
  ], 512));
2277
3196
  }
2278
- }), nt = /* @__PURE__ */ U(In, [["__scopeId", "data-v-7f5b51aa"]]), Rn = { class: "tr-sender-single-layout" }, Bn = {
3197
+ }), sn = /* @__PURE__ */ J(Ts, [["__scopeId", "data-v-7f5b51aa"]]), Es = { class: "tr-sender-single-layout" }, ws = {
2279
3198
  key: 0,
2280
3199
  class: "tr-sender-header"
2281
- }, jn = { class: "tr-sender-container" }, $n = { class: "tr-sender-main" }, Kn = {
3200
+ }, Cs = { class: "tr-sender-container" }, As = { class: "tr-sender-main" }, Ss = {
2282
3201
  key: 0,
2283
3202
  class: "tr-sender-prefix"
2284
- }, qn = { class: "tr-sender-content" }, Nn = /* @__PURE__ */ G({
3203
+ }, _s = { class: "tr-sender-content" }, Ls = /* @__PURE__ */ Z({
2285
3204
  __name: "SingleLineLayout",
2286
3205
  setup(e) {
2287
- const { editor: t, hasContent: o, loading: s, showWordLimit: i, maxLength: n } = ue(), a = Pe();
2288
- return (r, l) => (w(), P("div", Rn, [
2289
- r.$slots.header ? (w(), P("div", Bn, [
2290
- O(r.$slots, "header", {}, void 0, !0)
2291
- ])) : N("", !0),
2292
- R("div", jn, [
2293
- R("div", $n, [
2294
- r.$slots.prefix ? (w(), P("div", Kn, [
2295
- O(r.$slots, "prefix", {}, void 0, !0)
2296
- ])) : N("", !0),
2297
- R("div", qn, [
2298
- O(r.$slots, "content", { editor: A(t) }, () => [
2299
- X(nt)
3206
+ const { editor: t, hasContent: n, loading: s, showWordLimit: r, maxLength: o } = Pe(), l = bt();
3207
+ return (i, a) => (M(), P("div", Es, [
3208
+ i.$slots.header ? (M(), P("div", ws, [
3209
+ D(i.$slots, "header", {}, void 0, !0)
3210
+ ])) : q("", !0),
3211
+ B("div", Cs, [
3212
+ B("div", As, [
3213
+ i.$slots.prefix ? (M(), P("div", Ss, [
3214
+ D(i.$slots, "prefix", {}, void 0, !0)
3215
+ ])) : q("", !0),
3216
+ B("div", _s, [
3217
+ D(i.$slots, "content", { editor: k(t) }, () => [
3218
+ se(sn)
2300
3219
  ], !0)
2301
3220
  ])
2302
3221
  ]),
2303
- R("div", {
2304
- class: z(["tr-sender-actions-inline", { "has-content": A(o) || A(s) }])
3222
+ B("div", {
3223
+ class: Q(["tr-sender-actions-inline", { "has-content": k(n) || k(s) }])
2305
3224
  }, [
2306
- A(i) && A(n) ? (w(), V(A(Ke), { key: 0 })) : N("", !0),
2307
- X(A(qe), null, me({ _: 2 }, [
2308
- r.$slots["actions-inline"] ? {
3225
+ k(r) && k(o) ? (M(), U(k(Rt), { key: 0 })) : q("", !0),
3226
+ se(k(Pt), null, $e({ _: 2 }, [
3227
+ i.$slots["actions-inline"] ? {
2309
3228
  name: "prepend",
2310
- fn: B(() => [
2311
- O(r.$slots, "actions-inline", ne(oe(A(a))), void 0, !0)
3229
+ fn: j(() => [
3230
+ D(i.$slots, "actions-inline", he(ge(k(l))), void 0, !0)
2312
3231
  ]),
2313
3232
  key: "0"
2314
3233
  } : void 0
@@ -2317,69 +3236,69 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
2317
3236
  ])
2318
3237
  ]));
2319
3238
  }
2320
- }), Hn = /* @__PURE__ */ U(Nn, [["__scopeId", "data-v-7b0a576c"]]), Wn = {
3239
+ }), ks = /* @__PURE__ */ J(Ls, [["__scopeId", "data-v-7b0a576c"]]), Ms = {
2321
3240
  key: 0,
2322
3241
  class: "tr-sender-footer"
2323
- }, zn = { class: "tr-sender-footer-left" }, Fn = { class: "tr-sender-footer-right" }, Vn = /* @__PURE__ */ G({
3242
+ }, Rs = { class: "tr-sender-footer-left" }, Ps = { class: "tr-sender-footer-right" }, Os = /* @__PURE__ */ Z({
2324
3243
  __name: "index",
2325
3244
  setup(e) {
2326
- const { mode: t, showWordLimit: o, maxLength: s } = ue(), i = Pe();
2327
- return (n, a) => A(t) === "multiple" ? (w(), P("div", Wn, [
2328
- R("div", zn, [
2329
- O(n.$slots, "footer", ne(oe(A(i))), void 0, !0)
3245
+ const { mode: t, showWordLimit: n, maxLength: s } = Pe(), r = bt();
3246
+ return (o, l) => k(t) === "multiple" ? (M(), P("div", Ms, [
3247
+ B("div", Rs, [
3248
+ D(o.$slots, "footer", he(ge(k(r))), void 0, !0)
2330
3249
  ]),
2331
- R("div", Fn, [
2332
- A(o) && A(s) ? (w(), V(A(Ke), { key: 0 })) : N("", !0),
2333
- X(A(qe), null, me({ _: 2 }, [
2334
- n.$slots["footer-right"] ? {
3250
+ B("div", Ps, [
3251
+ k(n) && k(s) ? (M(), U(k(Rt), { key: 0 })) : q("", !0),
3252
+ se(k(Pt), null, $e({ _: 2 }, [
3253
+ o.$slots["footer-right"] ? {
2335
3254
  name: "prepend",
2336
- fn: B(() => [
2337
- O(n.$slots, "footer-right", ne(oe(A(i))), void 0, !0)
3255
+ fn: j(() => [
3256
+ D(o.$slots, "footer-right", he(ge(k(r))), void 0, !0)
2338
3257
  ]),
2339
3258
  key: "0"
2340
3259
  } : void 0
2341
3260
  ]), 1024)
2342
3261
  ])
2343
- ])) : N("", !0);
3262
+ ])) : q("", !0);
2344
3263
  }
2345
- }), Gn = /* @__PURE__ */ U(Vn, [["__scopeId", "data-v-ffcdce27"]]), Un = { class: "tr-sender-multi-layout" }, Xn = {
3264
+ }), Ds = /* @__PURE__ */ J(Os, [["__scopeId", "data-v-ffcdce27"]]), Is = { class: "tr-sender-multi-layout" }, Bs = {
2346
3265
  key: 0,
2347
3266
  class: "tr-sender-header"
2348
- }, Zn = { class: "tr-sender-main" }, Yn = {
3267
+ }, $s = { class: "tr-sender-main" }, js = {
2349
3268
  key: 0,
2350
3269
  class: "tr-sender-prefix"
2351
- }, Jn = { class: "tr-sender-content" }, Qn = /* @__PURE__ */ G({
3270
+ }, Ns = { class: "tr-sender-content" }, Ws = /* @__PURE__ */ Z({
2352
3271
  __name: "MultiLineLayout",
2353
3272
  setup(e) {
2354
- const t = ue(), o = Pe();
2355
- return (s, i) => (w(), P("div", Un, [
2356
- s.$slots.header ? (w(), P("div", Xn, [
2357
- O(s.$slots, "header", {}, void 0, !0)
2358
- ])) : N("", !0),
2359
- R("div", Zn, [
2360
- s.$slots.prefix ? (w(), P("div", Yn, [
2361
- O(s.$slots, "prefix", {}, void 0, !0)
2362
- ])) : N("", !0),
2363
- R("div", Jn, [
2364
- O(s.$slots, "content", {
2365
- editor: A(t).editor
3273
+ const t = Pe(), n = bt();
3274
+ return (s, r) => (M(), P("div", Is, [
3275
+ s.$slots.header ? (M(), P("div", Bs, [
3276
+ D(s.$slots, "header", {}, void 0, !0)
3277
+ ])) : q("", !0),
3278
+ B("div", $s, [
3279
+ s.$slots.prefix ? (M(), P("div", js, [
3280
+ D(s.$slots, "prefix", {}, void 0, !0)
3281
+ ])) : q("", !0),
3282
+ B("div", Ns, [
3283
+ D(s.$slots, "content", {
3284
+ editor: k(t).editor
2366
3285
  }, () => [
2367
- X(nt)
3286
+ se(sn)
2368
3287
  ], !0)
2369
3288
  ])
2370
3289
  ]),
2371
- X(Gn, null, {
2372
- footer: B(() => [
2373
- O(s.$slots, "footer", ne(oe(A(o))), void 0, !0)
3290
+ se(Ds, null, {
3291
+ footer: j(() => [
3292
+ D(s.$slots, "footer", he(ge(k(n))), void 0, !0)
2374
3293
  ]),
2375
- "footer-right": B(() => [
2376
- O(s.$slots, "footer-right", ne(oe(A(o))), void 0, !0)
3294
+ "footer-right": j(() => [
3295
+ D(s.$slots, "footer-right", he(ge(k(n))), void 0, !0)
2377
3296
  ]),
2378
3297
  _: 3
2379
3298
  })
2380
3299
  ]));
2381
3300
  }
2382
- }), eo = /* @__PURE__ */ U(Qn, [["__scopeId", "data-v-0b507198"]]), to = /* @__PURE__ */ G({
3301
+ }), Ks = /* @__PURE__ */ J(Ws, [["__scopeId", "data-v-0b507198"]]), qs = /* @__PURE__ */ Z({
2383
3302
  __name: "index",
2384
3303
  props: {
2385
3304
  modelValue: {},
@@ -2402,103 +3321,103 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
2402
3321
  submitType: { default: "enter" }
2403
3322
  },
2404
3323
  emits: ["update:modelValue", "submit", "focus", "blur", "clear", "cancel", "input"],
2405
- setup(e, { expose: t, emit: o }) {
2406
- const s = e, i = o, { context: n, expose: a } = Dn(s, i);
2407
- return t(a), (r, l) => (w(), P("div", {
2408
- class: z([
3324
+ setup(e, { expose: t, emit: n }) {
3325
+ const s = e, r = n, { context: o, expose: l } = bs(s, r);
3326
+ return t(l), (i, a) => (M(), P("div", {
3327
+ class: Q([
2409
3328
  "tr-sender",
2410
- `tr-sender--${A(n).mode.value}`,
2411
- `tr-sender--${A(n).size.value}`,
3329
+ `tr-sender--${k(o).mode.value}`,
3330
+ `tr-sender--${k(o).size.value}`,
2412
3331
  {
2413
- "is-auto-switching": A(n).isAutoSwitching.value,
2414
- "is-disabled": A(n).disabled.value
3332
+ "is-auto-switching": k(o).isAutoSwitching.value,
3333
+ "is-disabled": k(o).disabled.value
2415
3334
  }
2416
3335
  ])
2417
3336
  }, [
2418
- A(n).mode.value === "single" ? (w(), V(Hn, { key: 0 }, me({ _: 2 }, [
2419
- r.$slots.header ? {
3337
+ k(o).mode.value === "single" ? (M(), U(ks, { key: 0 }, $e({ _: 2 }, [
3338
+ i.$slots.header ? {
2420
3339
  name: "header",
2421
- fn: B(() => [
2422
- O(r.$slots, "header", {}, void 0, !0)
3340
+ fn: j(() => [
3341
+ D(i.$slots, "header", {}, void 0, !0)
2423
3342
  ]),
2424
3343
  key: "0"
2425
3344
  } : void 0,
2426
- r.$slots.prefix ? {
3345
+ i.$slots.prefix ? {
2427
3346
  name: "prefix",
2428
- fn: B(() => [
2429
- O(r.$slots, "prefix", {}, void 0, !0)
3347
+ fn: j(() => [
3348
+ D(i.$slots, "prefix", {}, void 0, !0)
2430
3349
  ]),
2431
3350
  key: "1"
2432
3351
  } : void 0,
2433
- r.$slots.content ? {
3352
+ i.$slots.content ? {
2434
3353
  name: "content",
2435
- fn: B((u) => [
2436
- O(r.$slots, "content", ne(oe(u)), void 0, !0)
3354
+ fn: j((c) => [
3355
+ D(i.$slots, "content", he(ge(c)), void 0, !0)
2437
3356
  ]),
2438
3357
  key: "2"
2439
3358
  } : void 0,
2440
- r.$slots["actions-inline"] ? {
3359
+ i.$slots["actions-inline"] ? {
2441
3360
  name: "actions-inline",
2442
- fn: B(() => [
2443
- O(r.$slots, "actions-inline", {}, void 0, !0)
3361
+ fn: j(() => [
3362
+ D(i.$slots, "actions-inline", {}, void 0, !0)
2444
3363
  ]),
2445
3364
  key: "3"
2446
3365
  } : void 0
2447
- ]), 1024)) : (w(), V(eo, { key: 1 }, me({ _: 2 }, [
2448
- r.$slots.header ? {
3366
+ ]), 1024)) : (M(), U(Ks, { key: 1 }, $e({ _: 2 }, [
3367
+ i.$slots.header ? {
2449
3368
  name: "header",
2450
- fn: B(() => [
2451
- O(r.$slots, "header", {}, void 0, !0)
3369
+ fn: j(() => [
3370
+ D(i.$slots, "header", {}, void 0, !0)
2452
3371
  ]),
2453
3372
  key: "0"
2454
3373
  } : void 0,
2455
- r.$slots.prefix ? {
3374
+ i.$slots.prefix ? {
2456
3375
  name: "prefix",
2457
- fn: B(() => [
2458
- O(r.$slots, "prefix", {}, void 0, !0)
3376
+ fn: j(() => [
3377
+ D(i.$slots, "prefix", {}, void 0, !0)
2459
3378
  ]),
2460
3379
  key: "1"
2461
3380
  } : void 0,
2462
- r.$slots.content ? {
3381
+ i.$slots.content ? {
2463
3382
  name: "content",
2464
- fn: B((u) => [
2465
- O(r.$slots, "content", ne(oe(u)), void 0, !0)
3383
+ fn: j((c) => [
3384
+ D(i.$slots, "content", he(ge(c)), void 0, !0)
2466
3385
  ]),
2467
3386
  key: "2"
2468
3387
  } : void 0,
2469
- r.$slots.footer ? {
3388
+ i.$slots.footer ? {
2470
3389
  name: "footer",
2471
- fn: B(() => [
2472
- O(r.$slots, "footer", {}, void 0, !0)
3390
+ fn: j(() => [
3391
+ D(i.$slots, "footer", {}, void 0, !0)
2473
3392
  ]),
2474
3393
  key: "3"
2475
3394
  } : void 0,
2476
- r.$slots["footer-right"] ? {
3395
+ i.$slots["footer-right"] ? {
2477
3396
  name: "footer-right",
2478
- fn: B(() => [
2479
- O(r.$slots, "footer-right", {}, void 0, !0)
3397
+ fn: j(() => [
3398
+ D(i.$slots, "footer-right", {}, void 0, !0)
2480
3399
  ]),
2481
3400
  key: "4"
2482
3401
  } : void 0
2483
3402
  ]), 1024))
2484
3403
  ], 2));
2485
3404
  }
2486
- }), xe = /* @__PURE__ */ U(to, [["__scopeId", "data-v-a15c5d11"]]);
2487
- xe.name = "TrSender";
2488
- const no = function(e) {
2489
- e.component(xe.name, xe);
2490
- }, Eo = Object.assign(xe, {
2491
- install: no,
3405
+ }), ze = /* @__PURE__ */ J(qs, [["__scopeId", "data-v-a15c5d11"]]);
3406
+ ze.name = "TrSender";
3407
+ const Hs = function(e) {
3408
+ e.component(ze.name, ze);
3409
+ }, ir = Object.assign(ze, {
3410
+ install: Hs,
2492
3411
  // 扩展类(用于继承)
2493
- Mention: Fe,
2494
- Suggestion: Ge,
2495
- Template: Xe,
3412
+ Mention: Gt,
3413
+ Suggestion: Xt,
3414
+ Template: Zt,
2496
3415
  // 便捷函数(用于简单场景)
2497
- mention: Ft,
2498
- suggestion: en,
2499
- template: Tn
3416
+ mention: Oo,
3417
+ suggestion: qo,
3418
+ template: ls
2500
3419
  });
2501
3420
  export {
2502
- Eo as default,
2503
- ue as useSenderContext
3421
+ ir as default,
3422
+ Pe as useSenderContext
2504
3423
  };