@opentiny/tiny-robot 0.5.0 → 0.5.1-alpha.14

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