@opentiny/tiny-robot 0.3.0-alpha.3 → 0.3.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-group/index.js +41 -38
- package/dist/base-popper/index.js +123 -0
- package/dist/bubble/index.js +1207 -1992
- package/dist/container/index.js +12 -12
- package/dist/dropdown-menu/index.js +77 -62
- package/dist/feedback/index.js +42 -42
- package/dist/flow-layout-buttons/index.js +23 -20
- package/dist/history/index.js +24 -24
- package/dist/icon-button/index.js +18 -19
- package/dist/index.d.ts +606 -1935
- package/dist/index.js +43 -58
- package/dist/index2.js +358 -290
- package/dist/index3.js +33 -25
- package/dist/index5.js +179 -180
- package/dist/index6.js +610 -613
- package/dist/question/index.js +58 -58
- package/dist/sender/index.js +994 -1184
- package/dist/style.css +1 -1
- package/dist/suggestion/index.js +70 -70
- package/dist/suggestion-pills/index.js +179 -129
- package/dist/suggestion-popover/index.js +215 -212
- package/dist/tiny-robot-svgs.js +174 -227
- package/dist/utils.js +4 -15
- package/package.json +3 -4
- package/dist/loading.js +0 -4
package/dist/sender/index.js
CHANGED
|
@@ -1,432 +1,278 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { I as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
() =>
|
|
12
|
-
|
|
13
|
-
f !== void 0 && f !== h.value && (h.value = f);
|
|
1
|
+
import { ref as E, watch as Z, reactive as et, computed as D, nextTick as q, defineComponent as ge, createElementBlock as R, openBlock as m, createCommentVNode as K, normalizeStyle as De, createBlock as X, unref as k, withCtx as pe, createElementVNode as A, createVNode as j, normalizeClass as ee, toDisplayString as le, useAttrs as tt, resolveComponent as nt, mergeProps as fe, Fragment as ce, renderList as he, mergeModels as st, useModel as ot, Transition as Ee, withModifiers as at, useSlots as lt, renderSlot as ae, isRef as it, createTextVNode as Ne } from "vue";
|
|
2
|
+
import { I as rt } from "../index5.js";
|
|
3
|
+
import { T as Me } from "../index4.js";
|
|
4
|
+
import { I as ut, L as ct, v as dt, t as ft, w as pt, P as ht, _ as gt } from "../tiny-robot-svgs.js";
|
|
5
|
+
import { _ as be } from "../_plugin-vue_export-helper.js";
|
|
6
|
+
import { t as vt } from "../utils.js";
|
|
7
|
+
function yt(i, r) {
|
|
8
|
+
const a = E(i.modelValue || i.defaultValue || ""), c = E(null);
|
|
9
|
+
Z(
|
|
10
|
+
() => i.modelValue,
|
|
11
|
+
(h) => {
|
|
12
|
+
h !== void 0 && h !== a.value && (a.value = h);
|
|
14
13
|
}
|
|
15
|
-
),
|
|
16
|
-
() =>
|
|
17
|
-
(
|
|
18
|
-
|
|
14
|
+
), Z(
|
|
15
|
+
() => a.value,
|
|
16
|
+
(h) => {
|
|
17
|
+
r("update:modelValue", h);
|
|
19
18
|
}
|
|
20
19
|
);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
!
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
20
|
+
const y = (h) => {
|
|
21
|
+
a.value = h, r("update:modelValue", h);
|
|
22
|
+
}, w = (h) => {
|
|
23
|
+
h == null || h.preventDefault();
|
|
24
|
+
const _ = a.value;
|
|
25
|
+
!i.disabled && !i.loading && _.trim() && r("submit", _);
|
|
26
|
+
}, n = () => {
|
|
27
|
+
a.value = "", r("update:modelValue", ""), r("clear");
|
|
28
|
+
}, p = E(!1);
|
|
30
29
|
return {
|
|
31
|
-
inputValue:
|
|
32
|
-
inputWrapper:
|
|
33
|
-
isComposing:
|
|
34
|
-
handleChange:
|
|
35
|
-
handleSubmit:
|
|
36
|
-
handleClear:
|
|
30
|
+
inputValue: a,
|
|
31
|
+
inputWrapper: c,
|
|
32
|
+
isComposing: p,
|
|
33
|
+
handleChange: y,
|
|
34
|
+
handleSubmit: w,
|
|
35
|
+
handleClear: n,
|
|
37
36
|
clearInput: () => {
|
|
38
|
-
|
|
37
|
+
n();
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return;
|
|
49
|
-
const h = ye();
|
|
50
|
-
t.parentNode && t.parentNode.insertBefore(h, t.nextSibling);
|
|
51
|
-
}, _t = (t) => {
|
|
52
|
-
Array.from(t.childNodes).forEach((h) => {
|
|
53
|
-
if (h.nodeType === Node.TEXT_NODE && ee(h.textContent || "")) {
|
|
54
|
-
const o = h.previousSibling;
|
|
55
|
-
o && o.nodeType === Node.ELEMENT_NODE && o.classList.contains("template-field") || h.parentNode && h.parentNode.removeChild(h);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
function Tt(t, y, h, o, x, u, i, r, c, f, p, a, b, L) {
|
|
60
|
-
const _ = (m) => !(t.disabled || t.loading || m.trim().length === 0 || a.value), v = () => {
|
|
61
|
-
_(h.value) && y("submit", h.value.trim());
|
|
62
|
-
}, R = (m, $) => {
|
|
63
|
-
if (!(m.key === "Enter")) return !1;
|
|
64
|
-
switch ($) {
|
|
41
|
+
function mt(i, r, a, c, y, w, n, p, C, h, _, g, I, d, L, U) {
|
|
42
|
+
const $ = () => {
|
|
43
|
+
g.value && (L != null && L.value && (U == null || U()), r("submit", a.value.trim()));
|
|
44
|
+
}, z = (v, F) => {
|
|
45
|
+
if (!(v.key === "Enter")) return !1;
|
|
46
|
+
switch (F) {
|
|
65
47
|
case "enter":
|
|
66
|
-
return !
|
|
48
|
+
return !v.shiftKey && !v.ctrlKey && !v.metaKey;
|
|
67
49
|
case "ctrlEnter":
|
|
68
|
-
return (
|
|
50
|
+
return (v.ctrlKey || v.metaKey) && !v.shiftKey;
|
|
69
51
|
case "shiftEnter":
|
|
70
|
-
return
|
|
52
|
+
return v.shiftKey && !v.ctrlKey && !v.metaKey;
|
|
71
53
|
default:
|
|
72
54
|
return !1;
|
|
73
55
|
}
|
|
74
56
|
};
|
|
75
57
|
return {
|
|
76
|
-
handleKeyPress: (
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
const V =
|
|
81
|
-
|
|
82
|
-
` +
|
|
83
|
-
V.selectionStart = V.selectionEnd =
|
|
58
|
+
handleKeyPress: (v) => {
|
|
59
|
+
if (c.value) return;
|
|
60
|
+
if (v.key === "Enter" && v.shiftKey && (I == null ? void 0 : I.value) === "single" && d) {
|
|
61
|
+
v.preventDefault(), d();
|
|
62
|
+
const V = v.target, W = V.selectionStart, G = a.value;
|
|
63
|
+
a.value = G.substring(0, W) + `
|
|
64
|
+
` + G.substring(W), setTimeout(() => {
|
|
65
|
+
V.selectionStart = V.selectionEnd = W + 1;
|
|
84
66
|
}, 0);
|
|
85
67
|
return;
|
|
86
68
|
}
|
|
87
|
-
if (
|
|
88
|
-
|
|
69
|
+
if (v.key === "Tab" && w.value && n.value) {
|
|
70
|
+
v.preventDefault(), p();
|
|
89
71
|
return;
|
|
90
72
|
}
|
|
91
|
-
if (
|
|
92
|
-
if (
|
|
93
|
-
|
|
73
|
+
if (w.value) {
|
|
74
|
+
if (v.key === "ArrowDown") {
|
|
75
|
+
v.preventDefault(), h("down");
|
|
94
76
|
return;
|
|
95
77
|
}
|
|
96
|
-
if (
|
|
97
|
-
|
|
78
|
+
if (v.key === "ArrowUp") {
|
|
79
|
+
v.preventDefault(), h("up");
|
|
98
80
|
return;
|
|
99
81
|
}
|
|
100
|
-
if (
|
|
101
|
-
|
|
82
|
+
if (v.key === "Enter" && n.value) {
|
|
83
|
+
v.preventDefault(), p();
|
|
102
84
|
return;
|
|
103
85
|
}
|
|
104
86
|
}
|
|
105
|
-
if (
|
|
106
|
-
|
|
87
|
+
if (v.key === "Escape") {
|
|
88
|
+
w.value ? (C(), v.preventDefault()) : y.isRecording && (_(), v.preventDefault()), r("escape-press");
|
|
107
89
|
return;
|
|
108
90
|
}
|
|
109
|
-
|
|
91
|
+
z(v, i.submitType) && (v.preventDefault(), g.value && $());
|
|
110
92
|
},
|
|
111
|
-
triggerSubmit:
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function Nt(t) {
|
|
115
|
-
const y = (u, i, r) => {
|
|
116
|
-
var L, _;
|
|
117
|
-
const { startOffset: c, collapsed: f } = i;
|
|
118
|
-
let p = i.startContainer;
|
|
119
|
-
if ((L = p.parentElement) != null && L.classList.contains("template-field") && (p = p.parentElement), !f) return !1;
|
|
120
|
-
const a = p.nodeType === Node.TEXT_NODE && c === 0 && u.key === "ArrowLeft", b = p.nodeType === Node.TEXT_NODE && c === (((_ = p.textContent) == null ? void 0 : _.length) || 0) && u.key === "ArrowRight";
|
|
121
|
-
if (a || b) {
|
|
122
|
-
let v = null, R = "inside";
|
|
123
|
-
if (a)
|
|
124
|
-
if (p.parentNode && p.parentNode.classList.contains("template-field"))
|
|
125
|
-
v = p.parentNode, R = "before";
|
|
126
|
-
else {
|
|
127
|
-
let w = p.previousSibling;
|
|
128
|
-
!w && p.parentNode && p.parentNode !== r && (w = p.parentNode.previousSibling), w && w.nodeType === Node.ELEMENT_NODE && w.classList.contains("template-field") && (v = w, R = "inside");
|
|
129
|
-
}
|
|
130
|
-
else if (b)
|
|
131
|
-
if (p.parentNode && p.parentNode.classList.contains("template-field"))
|
|
132
|
-
v = p.parentNode, R = "after";
|
|
133
|
-
else {
|
|
134
|
-
let w = p.nextSibling;
|
|
135
|
-
!w && p.parentNode && p.parentNode !== r && (w = p.parentNode.nextSibling), w && w.nodeType === Node.ELEMENT_NODE && w.classList.contains("template-field") && (v = w, R = "inside");
|
|
136
|
-
}
|
|
137
|
-
if (v) {
|
|
138
|
-
u.preventDefault();
|
|
139
|
-
const w = document.createRange(), m = z(r);
|
|
140
|
-
return m && (R === "before" ? w.setStartBefore(v) : R === "after" ? w.setStartAfter(v) : (w.selectNodeContents(v), w.collapse(u.key === "ArrowLeft")), m.removeAllRanges(), m.addRange(w)), !0;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (p.nodeType === Node.ELEMENT_NODE && p.classList.contains("template-field")) {
|
|
144
|
-
const R = p.textContent || "", w = J(R);
|
|
145
|
-
if (!w || w.trim() === "") {
|
|
146
|
-
u.preventDefault();
|
|
147
|
-
const m = document.createRange(), $ = z(r);
|
|
148
|
-
if (!$) return !0;
|
|
149
|
-
if (u.key === "ArrowLeft")
|
|
150
|
-
m.setStartBefore(p);
|
|
151
|
-
else {
|
|
152
|
-
const V = p.nextSibling;
|
|
153
|
-
V && V.nodeType === Node.TEXT_NODE && ee(V.textContent || "") ? (m.setStart(V, 0), m.setEnd(V, 0)) : m.setStartAfter(p);
|
|
154
|
-
}
|
|
155
|
-
return m.collapse(!0), $.removeAllRanges(), $.addRange(m), !0;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (p.nodeType === Node.TEXT_NODE && ee(p.textContent || "")) {
|
|
159
|
-
const v = p.previousSibling, R = p.nextSibling;
|
|
160
|
-
u.preventDefault();
|
|
161
|
-
const w = document.createRange(), m = z(r);
|
|
162
|
-
return m && (u.key === "ArrowLeft" ? v && v.nodeType === Node.ELEMENT_NODE && v.classList.contains("template-field") ? (w.selectNodeContents(v), w.collapse(!1)) : w.setStartBefore(p) : R ? R.nodeType === Node.ELEMENT_NODE && R.classList.contains("template-field") ? (w.selectNodeContents(R), w.collapse(!0)) : pt(r) ? (w.setStart(R, 1), w.collapse(!0)) : w.setStartAfter(p) : w.setStartAfter(p), m.removeAllRanges(), m.addRange(w)), !0;
|
|
163
|
-
}
|
|
164
|
-
return !1;
|
|
165
|
-
}, h = (u, i, r) => {
|
|
166
|
-
if (!i.collapsed) return !1;
|
|
167
|
-
const { startContainer: c, startOffset: f } = i;
|
|
168
|
-
if (c.nodeType === Node.TEXT_NODE && ee(c.textContent || "")) {
|
|
169
|
-
const a = c.previousSibling;
|
|
170
|
-
if (a && a.nodeType === Node.ELEMENT_NODE && a.classList.contains("template-field")) {
|
|
171
|
-
const b = a, L = b.textContent || "", _ = J(L);
|
|
172
|
-
if (!_ || _.trim() === "") {
|
|
173
|
-
u.preventDefault();
|
|
174
|
-
const v = b.previousSibling, R = c.nextSibling;
|
|
175
|
-
b.parentNode && b.parentNode.removeChild(b), c.parentNode && c.parentNode.removeChild(c);
|
|
176
|
-
const w = z(r);
|
|
177
|
-
if (w) {
|
|
178
|
-
const m = document.createRange();
|
|
179
|
-
v ? v.nodeType === Node.ELEMENT_NODE && v.classList.contains("template-field") ? (m.selectNodeContents(v), m.collapse(!1)) : v.nodeType === Node.TEXT_NODE && ee(v.textContent || "") ? (m.setStart(v, 0), m.setEnd(v, 0)) : m.setStartAfter(v) : R ? m.setStartBefore(R) : m.setStart(r, 0), m.collapse(!0), w.removeAllRanges(), w.addRange(m);
|
|
180
|
-
}
|
|
181
|
-
return t.handleInput(), !0;
|
|
182
|
-
} else {
|
|
183
|
-
u.preventDefault();
|
|
184
|
-
const v = z(r);
|
|
185
|
-
if (v) {
|
|
186
|
-
const R = document.createRange();
|
|
187
|
-
R.selectNodeContents(b), R.collapse(!1), v.removeAllRanges(), v.addRange(R);
|
|
188
|
-
}
|
|
189
|
-
return !0;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
if (c.nodeType === Node.TEXT_NODE && c.parentNode && c.parentNode.classList.contains("template-field") && c.textContent) {
|
|
194
|
-
const a = c.textContent;
|
|
195
|
-
if (J(a).length === 1 && f === a.length) {
|
|
196
|
-
u.preventDefault(), c.textContent = "";
|
|
197
|
-
const L = c.parentNode, _ = z(r);
|
|
198
|
-
if (_) {
|
|
199
|
-
const v = document.createRange();
|
|
200
|
-
v.selectNodeContents(L), v.collapse(!0), _.removeAllRanges(), _.addRange(v);
|
|
201
|
-
}
|
|
202
|
-
return t.handleInput(), !0;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
if (f === 0) {
|
|
206
|
-
let a = null;
|
|
207
|
-
if (c.nodeType === Node.ELEMENT_NODE && c.classList.contains("template-field") ? a = c : c.nodeType === Node.TEXT_NODE && c.parentNode && c.parentNode.classList.contains("template-field") && (a = c.parentNode), a) {
|
|
208
|
-
u.preventDefault();
|
|
209
|
-
const b = z(r);
|
|
210
|
-
return b && (i.setStartBefore(a), i.collapse(!0), b.removeAllRanges(), b.addRange(i)), !0;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return !1;
|
|
214
|
-
}, o = (u, i, r) => {
|
|
215
|
-
if (!i.collapsed) return !1;
|
|
216
|
-
const { startContainer: c, startOffset: f } = i;
|
|
217
|
-
if (c.nodeType === Node.TEXT_NODE && c.parentNode && c.parentNode.classList.contains("template-field") && c.textContent) {
|
|
218
|
-
const a = c.textContent, b = J(a);
|
|
219
|
-
if (f === a.length && b.length === 1) {
|
|
220
|
-
u.preventDefault(), c.textContent = "";
|
|
221
|
-
const L = c.parentNode, _ = z(r);
|
|
222
|
-
if (_) {
|
|
223
|
-
const v = document.createRange();
|
|
224
|
-
v.selectNodeContents(L), v.collapse(!0), _.removeAllRanges(), _.addRange(v);
|
|
225
|
-
}
|
|
226
|
-
return t.handleInput(), !0;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return !1;
|
|
230
|
-
};
|
|
231
|
-
return {
|
|
232
|
-
handleTemplateKeyDown: (u) => {
|
|
233
|
-
if (t.isComposing.value) return;
|
|
234
|
-
const i = t.editor.value;
|
|
235
|
-
if (!i) return;
|
|
236
|
-
const r = z(i);
|
|
237
|
-
if (!r || r.rangeCount === 0) return;
|
|
238
|
-
const c = r.getRangeAt(0);
|
|
239
|
-
if (u.key === "Enter") {
|
|
240
|
-
u.preventDefault(), t.onSubmit(t.getValueFromDOM());
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
(u.key === "ArrowLeft" || u.key === "ArrowRight") && !u.shiftKey && y(u, c, i) || u.key === "Backspace" && h(u, c, i) || u.key === "Delete" && o(u, c, i);
|
|
244
|
-
}
|
|
93
|
+
triggerSubmit: $
|
|
245
94
|
};
|
|
246
95
|
}
|
|
247
|
-
function
|
|
248
|
-
const
|
|
96
|
+
function wt(i) {
|
|
97
|
+
const r = et({
|
|
249
98
|
isRecording: !1,
|
|
250
99
|
isSupported: typeof window < "u" && "webkitSpeechRecognition" in window || "SpeechRecognition" in window,
|
|
251
100
|
error: void 0
|
|
252
|
-
}),
|
|
253
|
-
|
|
254
|
-
var
|
|
255
|
-
|
|
256
|
-
},
|
|
257
|
-
var
|
|
258
|
-
|
|
259
|
-
},
|
|
260
|
-
var
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
},
|
|
264
|
-
var
|
|
265
|
-
|
|
101
|
+
}), a = r.isSupported ? new (window.webkitSpeechRecognition || window.SpeechRecognition)() : void 0;
|
|
102
|
+
a !== void 0 && (a.continuous = i.continuous ?? !1, a.interimResults = i.interimResults ?? !0, a.lang = i.lang ?? navigator.language, a.onstart = () => {
|
|
103
|
+
var n;
|
|
104
|
+
r.isRecording = !0, r.error = void 0, (n = i.onStart) == null || n.call(i);
|
|
105
|
+
}, a.onend = () => {
|
|
106
|
+
var n;
|
|
107
|
+
r.isRecording = !1, (n = i.onEnd) == null || n.call(i);
|
|
108
|
+
}, a.onresult = (n) => {
|
|
109
|
+
var C, h;
|
|
110
|
+
const p = Array.from(n.results).map((_) => _[0].transcript).join("");
|
|
111
|
+
n.results[0].isFinal ? (C = i.onFinal) == null || C.call(i, p) : (h = i.onInterim) == null || h.call(i, p);
|
|
112
|
+
}, a.onerror = (n) => {
|
|
113
|
+
var p;
|
|
114
|
+
r.error = new Error(n.error), r.isRecording = !1, (p = i.onError) == null || p.call(i, r.error);
|
|
266
115
|
});
|
|
267
|
-
const
|
|
268
|
-
var
|
|
269
|
-
if (!
|
|
270
|
-
const
|
|
271
|
-
|
|
116
|
+
const c = () => {
|
|
117
|
+
var n;
|
|
118
|
+
if (!a) {
|
|
119
|
+
const p = new Error("浏览器不支持语音识别");
|
|
120
|
+
r.error = p, (n = i.onError) == null || n.call(i, p);
|
|
272
121
|
return;
|
|
273
122
|
}
|
|
274
|
-
if (
|
|
123
|
+
if (r.isRecording) {
|
|
275
124
|
try {
|
|
276
|
-
|
|
125
|
+
a.stop(), setTimeout(() => {
|
|
277
126
|
try {
|
|
278
|
-
|
|
279
|
-
} catch (
|
|
280
|
-
|
|
127
|
+
a.start();
|
|
128
|
+
} catch (p) {
|
|
129
|
+
w(p);
|
|
281
130
|
}
|
|
282
131
|
}, 100);
|
|
283
|
-
} catch (
|
|
284
|
-
|
|
132
|
+
} catch (p) {
|
|
133
|
+
w(p);
|
|
285
134
|
}
|
|
286
135
|
return;
|
|
287
136
|
}
|
|
288
137
|
try {
|
|
289
|
-
|
|
290
|
-
} catch (
|
|
291
|
-
|
|
138
|
+
a.start();
|
|
139
|
+
} catch (p) {
|
|
140
|
+
w(p);
|
|
292
141
|
}
|
|
293
|
-
},
|
|
294
|
-
if (
|
|
142
|
+
}, y = () => {
|
|
143
|
+
if (a && r.isRecording)
|
|
295
144
|
try {
|
|
296
|
-
|
|
297
|
-
} catch (
|
|
298
|
-
|
|
145
|
+
a.stop();
|
|
146
|
+
} catch (n) {
|
|
147
|
+
w(n);
|
|
299
148
|
}
|
|
300
|
-
},
|
|
301
|
-
var
|
|
302
|
-
|
|
149
|
+
}, w = (n) => {
|
|
150
|
+
var p;
|
|
151
|
+
r.error = n instanceof Error ? n : new Error("语音识别操作失败"), r.isRecording = !1, (p = i.onError) == null || p.call(i, r.error);
|
|
303
152
|
};
|
|
304
153
|
return {
|
|
305
|
-
speechState:
|
|
306
|
-
start:
|
|
307
|
-
stop:
|
|
154
|
+
speechState: r,
|
|
155
|
+
start: c,
|
|
156
|
+
stop: y
|
|
308
157
|
};
|
|
309
158
|
}
|
|
310
|
-
const
|
|
311
|
-
if (!
|
|
312
|
-
return [{ text:
|
|
313
|
-
const
|
|
314
|
-
let
|
|
315
|
-
for (;
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
318
|
-
|
|
319
|
-
start:
|
|
320
|
-
end:
|
|
321
|
-
}),
|
|
159
|
+
const St = (i, r) => {
|
|
160
|
+
if (!r || !i)
|
|
161
|
+
return [{ text: i, isMatch: !1 }];
|
|
162
|
+
const a = i.toLowerCase(), c = r.toLowerCase(), y = [];
|
|
163
|
+
let w = 0;
|
|
164
|
+
for (; w < a.length; ) {
|
|
165
|
+
const h = a.indexOf(c, w);
|
|
166
|
+
if (h === -1) break;
|
|
167
|
+
y.push({
|
|
168
|
+
start: h,
|
|
169
|
+
end: h + r.length
|
|
170
|
+
}), w = h + 1;
|
|
322
171
|
}
|
|
323
|
-
if (
|
|
324
|
-
return [{ text:
|
|
325
|
-
const
|
|
326
|
-
for (const
|
|
327
|
-
if (
|
|
328
|
-
|
|
172
|
+
if (y.length === 0)
|
|
173
|
+
return [{ text: i, isMatch: !1 }];
|
|
174
|
+
const n = [];
|
|
175
|
+
for (const h of y)
|
|
176
|
+
if (n.length === 0)
|
|
177
|
+
n.push(h);
|
|
329
178
|
else {
|
|
330
|
-
const
|
|
331
|
-
|
|
179
|
+
const _ = n[n.length - 1];
|
|
180
|
+
h.start <= _.end ? _.end = Math.max(_.end, h.end) : n.push(h);
|
|
332
181
|
}
|
|
333
|
-
const
|
|
334
|
-
let
|
|
335
|
-
for (const
|
|
336
|
-
|
|
337
|
-
text:
|
|
182
|
+
const p = [];
|
|
183
|
+
let C = 0;
|
|
184
|
+
for (const h of n)
|
|
185
|
+
C < h.start && p.push({
|
|
186
|
+
text: i.substring(C, h.start),
|
|
338
187
|
isMatch: !1
|
|
339
|
-
}),
|
|
340
|
-
text:
|
|
188
|
+
}), p.push({
|
|
189
|
+
text: i.substring(h.start, h.end),
|
|
341
190
|
isMatch: !0
|
|
342
|
-
}),
|
|
343
|
-
return
|
|
344
|
-
text:
|
|
191
|
+
}), C = h.end;
|
|
192
|
+
return C < i.length && p.push({
|
|
193
|
+
text: i.substring(C),
|
|
345
194
|
isMatch: !1
|
|
346
|
-
}),
|
|
195
|
+
}), p;
|
|
347
196
|
};
|
|
348
|
-
function
|
|
349
|
-
const
|
|
350
|
-
if (!
|
|
351
|
-
const
|
|
352
|
-
return
|
|
353
|
-
}), L =
|
|
354
|
-
let
|
|
355
|
-
return
|
|
356
|
-
}),
|
|
357
|
-
if (
|
|
358
|
-
|
|
197
|
+
function _t(i, r, a, c, y) {
|
|
198
|
+
const w = E(!1), n = E(-1), p = E(-1), C = E(""), h = E(!1), _ = E(null), g = E(!1), I = E(null), d = D(() => {
|
|
199
|
+
if (!i.suggestions || !a.value || y.value) return [];
|
|
200
|
+
const x = a.value.toLowerCase();
|
|
201
|
+
return i.suggestions.filter((N) => N.toLowerCase().includes(x));
|
|
202
|
+
}), L = D(() => {
|
|
203
|
+
let x = -1;
|
|
204
|
+
return I.value === "mouse" && p.value !== -1 ? x = p.value : I.value === "keyboard" && n.value !== -1 && (x = n.value), d.value[x] || null;
|
|
205
|
+
}), U = (x) => x === n.value || x === p.value, $ = (x) => {
|
|
206
|
+
if (I.value === null) {
|
|
207
|
+
C.value = "", h.value = !1;
|
|
359
208
|
return;
|
|
360
209
|
}
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
},
|
|
364
|
-
|
|
365
|
-
},
|
|
366
|
-
|
|
367
|
-
},
|
|
368
|
-
|
|
369
|
-
|
|
210
|
+
const N = x || L.value;
|
|
211
|
+
N && a.value && N.toLowerCase().startsWith(a.value.toLowerCase()) ? (C.value = N.substring(a.value.length), h.value = !0) : (C.value = "", h.value = !1);
|
|
212
|
+
}, z = () => {
|
|
213
|
+
w.value = !1, n.value = -1, p.value = -1, I.value = null, C.value = "", h.value = !1;
|
|
214
|
+
}, te = () => {
|
|
215
|
+
w.value = !0, n.value = -1, p.value = -1, I.value = null, $();
|
|
216
|
+
}, v = () => {
|
|
217
|
+
c.value || g.value || q(() => {
|
|
218
|
+
a.value && i.suggestions && i.suggestions.length > 0 && !y.value && d.value.length > 0 ? te() : z();
|
|
370
219
|
});
|
|
371
220
|
};
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
221
|
+
Z(a, v), Z(() => i.suggestions, v);
|
|
222
|
+
const F = (x) => {
|
|
223
|
+
g.value = !0, a.value = x, r("update:modelValue", x), r("suggestion-select", x), W(), q(() => {
|
|
224
|
+
g.value = !1;
|
|
376
225
|
});
|
|
377
226
|
}, V = () => {
|
|
378
|
-
L.value &&
|
|
379
|
-
},
|
|
380
|
-
|
|
227
|
+
L.value && F(L.value);
|
|
228
|
+
}, W = () => {
|
|
229
|
+
z();
|
|
381
230
|
};
|
|
382
231
|
return {
|
|
383
|
-
showSuggestionsPopup:
|
|
384
|
-
completionPlaceholder:
|
|
385
|
-
showTabHint:
|
|
386
|
-
suggestionsListRef:
|
|
387
|
-
filteredSuggestions:
|
|
232
|
+
showSuggestionsPopup: w,
|
|
233
|
+
completionPlaceholder: C,
|
|
234
|
+
showTabHint: h,
|
|
235
|
+
suggestionsListRef: _,
|
|
236
|
+
filteredSuggestions: d,
|
|
388
237
|
activeSuggestion: L,
|
|
389
|
-
isItemHighlighted:
|
|
390
|
-
updateCompletionPlaceholder:
|
|
391
|
-
updateSuggestionsState:
|
|
392
|
-
selectSuggestion:
|
|
238
|
+
isItemHighlighted: U,
|
|
239
|
+
updateCompletionPlaceholder: $,
|
|
240
|
+
updateSuggestionsState: v,
|
|
241
|
+
selectSuggestion: F,
|
|
393
242
|
acceptCurrentSuggestion: V,
|
|
394
|
-
closeSuggestionsPopup:
|
|
395
|
-
navigateSuggestions: (
|
|
396
|
-
if (!
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
const
|
|
401
|
-
if (
|
|
402
|
-
const
|
|
403
|
-
|
|
243
|
+
closeSuggestionsPopup: W,
|
|
244
|
+
navigateSuggestions: (x) => {
|
|
245
|
+
if (!w.value || d.value.length === 0) return;
|
|
246
|
+
I.value = "keyboard", n.value === -1 ? n.value = x === "down" ? 0 : d.value.length - 1 : x === "down" ? n.value = (n.value + 1) % d.value.length : n.value = (n.value - 1 + d.value.length) % d.value.length;
|
|
247
|
+
const N = d.value[n.value];
|
|
248
|
+
N && $(N);
|
|
249
|
+
const M = _.value;
|
|
250
|
+
if (M) {
|
|
251
|
+
const ne = M.children[n.value];
|
|
252
|
+
ne && ne.scrollIntoView({ block: "nearest" });
|
|
404
253
|
}
|
|
405
254
|
},
|
|
406
|
-
handleSuggestionItemHover: (
|
|
407
|
-
|
|
255
|
+
handleSuggestionItemHover: (x) => {
|
|
256
|
+
I.value = "mouse", p.value = x, $(d.value[x]);
|
|
408
257
|
},
|
|
409
258
|
handleSuggestionItemLeave: () => {
|
|
410
|
-
if (
|
|
411
|
-
|
|
412
|
-
const
|
|
413
|
-
|
|
259
|
+
if (p.value = -1, n.value !== -1) {
|
|
260
|
+
I.value = "keyboard";
|
|
261
|
+
const x = d.value[n.value];
|
|
262
|
+
x && $(x);
|
|
414
263
|
} else
|
|
415
|
-
|
|
264
|
+
I.value = null, $();
|
|
416
265
|
},
|
|
417
266
|
handleClickOutside: () => {
|
|
418
|
-
|
|
267
|
+
W();
|
|
419
268
|
},
|
|
420
|
-
highlightSuggestionText:
|
|
269
|
+
highlightSuggestionText: St
|
|
421
270
|
};
|
|
422
271
|
}
|
|
423
|
-
const
|
|
272
|
+
const bt = { class: "action-buttons" }, Ct = { class: "action-buttons__button" }, kt = { class: "action-buttons__submit-content" }, xt = {
|
|
424
273
|
key: 0,
|
|
425
|
-
class: "action-
|
|
426
|
-
},
|
|
427
|
-
key: 1,
|
|
428
|
-
class: "action-buttons__cancel"
|
|
429
|
-
}, We = /* @__PURE__ */ be({
|
|
274
|
+
class: "action-buttons__cancel-text"
|
|
275
|
+
}, It = /* @__PURE__ */ ge({
|
|
430
276
|
__name: "ActionButtons",
|
|
431
277
|
props: {
|
|
432
278
|
loading: { type: Boolean, default: !1 },
|
|
@@ -441,617 +287,594 @@ const Dt = { class: "action-buttons" }, Ft = {
|
|
|
441
287
|
allowFiles: { type: Boolean, default: !1 },
|
|
442
288
|
submitType: { default: "enter" },
|
|
443
289
|
showShortcuts: { type: Boolean },
|
|
444
|
-
isOverLimit: { type: Boolean, default: !1 }
|
|
290
|
+
isOverLimit: { type: Boolean, default: !1 },
|
|
291
|
+
stopText: { default: void 0 }
|
|
445
292
|
},
|
|
446
293
|
emits: ["clear", "toggle-speech", "submit", "cancel"],
|
|
447
|
-
setup(
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
},
|
|
451
|
-
if (!
|
|
452
|
-
const
|
|
453
|
-
|
|
294
|
+
setup(i, { emit: r }) {
|
|
295
|
+
const a = i, c = r, y = D(() => a.allowSpeech), w = D(() => a.speechStatus.isRecording), n = D(() => a.disabled), p = D(() => n.value || a.isOverLimit), C = D(() => a.allowFiles || a.allowSpeech || a.showClear), h = () => {
|
|
296
|
+
n.value || c("clear");
|
|
297
|
+
}, _ = () => {
|
|
298
|
+
if (!n.value) {
|
|
299
|
+
const d = !a.speechStatus.isRecording;
|
|
300
|
+
c("toggle-speech", d);
|
|
454
301
|
}
|
|
455
|
-
},
|
|
456
|
-
|
|
457
|
-
},
|
|
458
|
-
|
|
302
|
+
}, g = () => {
|
|
303
|
+
p.value || c("submit");
|
|
304
|
+
}, I = () => {
|
|
305
|
+
n.value || c("cancel");
|
|
459
306
|
};
|
|
460
|
-
return (
|
|
461
|
-
|
|
462
|
-
|
|
307
|
+
return (d, L) => (m(), R("div", bt, [
|
|
308
|
+
C.value ? (m(), R("div", {
|
|
309
|
+
key: 0,
|
|
310
|
+
class: "action-buttons__utility",
|
|
311
|
+
style: De({ "padding-right": d.hasContent || d.loading ? "0" : "6px" })
|
|
312
|
+
}, [
|
|
313
|
+
d.allowFiles && !d.loading ? (m(), X(k(Me), {
|
|
463
314
|
key: 0,
|
|
464
315
|
content: "上传文件",
|
|
465
316
|
placement: "top"
|
|
466
317
|
}, {
|
|
467
|
-
default:
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
G(E(gt), {
|
|
475
|
-
class: "action-buttons__icon",
|
|
476
|
-
alt: "上传文件"
|
|
477
|
-
})
|
|
478
|
-
]),
|
|
479
|
-
_: 1
|
|
480
|
-
}, 8, ["disabled"])
|
|
318
|
+
default: pe(() => [
|
|
319
|
+
A("div", Ct, [
|
|
320
|
+
j(k(ut), {
|
|
321
|
+
class: "action-buttons__icon",
|
|
322
|
+
alt: "上传文件"
|
|
323
|
+
})
|
|
324
|
+
])
|
|
481
325
|
]),
|
|
482
326
|
_: 1
|
|
483
|
-
})) :
|
|
484
|
-
|
|
327
|
+
})) : K("", !0),
|
|
328
|
+
y.value && !d.loading ? (m(), R("div", {
|
|
485
329
|
key: 1,
|
|
486
|
-
class:
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}))
|
|
501
|
-
]),
|
|
502
|
-
_: 1
|
|
503
|
-
}, 8, ["disabled", "class"])) : H("", !0),
|
|
504
|
-
_.showClear ? (D(), Q(E(Ve), {
|
|
330
|
+
class: ee(["action-buttons__button", { "is-recording": w.value }]),
|
|
331
|
+
onClick: _
|
|
332
|
+
}, [
|
|
333
|
+
w.value ? (m(), X(k(dt), {
|
|
334
|
+
key: 1,
|
|
335
|
+
class: "action-buttons__icon action-buttons__icon--recording",
|
|
336
|
+
alt: "语音中"
|
|
337
|
+
})) : (m(), X(k(ct), {
|
|
338
|
+
key: 0,
|
|
339
|
+
class: "action-buttons__icon",
|
|
340
|
+
alt: "录音"
|
|
341
|
+
}))
|
|
342
|
+
], 2)) : K("", !0),
|
|
343
|
+
d.showClear ? (m(), X(k(Me), {
|
|
505
344
|
key: 2,
|
|
506
345
|
content: "清空内容",
|
|
507
346
|
placement: "top"
|
|
508
347
|
}, {
|
|
509
|
-
default:
|
|
510
|
-
|
|
511
|
-
class: "action-buttons__button
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
default: Y(() => [
|
|
517
|
-
(D(), Q(it(E(h)), { class: "action-buttons__icon action-buttons__icon--close" }))
|
|
518
|
-
]),
|
|
519
|
-
_: 1
|
|
520
|
-
}, 8, ["disabled"])
|
|
348
|
+
default: pe(() => [
|
|
349
|
+
A("div", {
|
|
350
|
+
class: "action-buttons__button",
|
|
351
|
+
onClick: h
|
|
352
|
+
}, [
|
|
353
|
+
j(k(ft), { class: "action-buttons__icon action-buttons__icon--clear" })
|
|
354
|
+
])
|
|
521
355
|
]),
|
|
522
356
|
_: 1
|
|
523
|
-
})) :
|
|
524
|
-
])) :
|
|
525
|
-
|
|
357
|
+
})) : K("", !0)
|
|
358
|
+
], 4)) : K("", !0),
|
|
359
|
+
d.hasContent || d.loading ? (m(), R("div", {
|
|
526
360
|
key: 1,
|
|
527
|
-
type: "text",
|
|
528
361
|
class: "action-buttons__button action-buttons__submit",
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
])
|
|
546
|
-
])
|
|
547
|
-
|
|
548
|
-
}, 8, ["disabled"])) : H("", !0)
|
|
362
|
+
onClick: L[0] || (L[0] = (U) => d.loading ? I() : g())
|
|
363
|
+
}, [
|
|
364
|
+
A("div", kt, [
|
|
365
|
+
d.loading ? (m(), R("div", {
|
|
366
|
+
key: 1,
|
|
367
|
+
class: ee(["action-buttons__cancel", { "action-buttons__cancel--icon-only": !d.stopText }])
|
|
368
|
+
}, [
|
|
369
|
+
j(k(ht), {
|
|
370
|
+
class: "action-buttons__icon action-buttons__icon--cancel",
|
|
371
|
+
alt: "停止"
|
|
372
|
+
}),
|
|
373
|
+
d.stopText ? (m(), R("span", xt, le(d.stopText), 1)) : K("", !0)
|
|
374
|
+
], 2)) : (m(), X(k(pt), {
|
|
375
|
+
key: 0,
|
|
376
|
+
class: ee(["action-buttons__icon", "action-buttons__icon--send", { "is-disabled": p.value }]),
|
|
377
|
+
alt: "发送"
|
|
378
|
+
}, null, 8, ["class"]))
|
|
379
|
+
])
|
|
380
|
+
])) : K("", !0)
|
|
549
381
|
]));
|
|
550
382
|
}
|
|
551
|
-
})
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
else
|
|
583
|
-
for (const T of Array.from(g.childNodes))
|
|
584
|
-
s += l(T);
|
|
585
|
-
}
|
|
586
|
-
return s;
|
|
383
|
+
}), qe = /* @__PURE__ */ be(It, [["__scopeId", "data-v-f811794c"]]), Rt = ["data-id", "data-type"], Ot = ["data-id", "data-type"], Tt = /* @__PURE__ */ ge({
|
|
384
|
+
inheritAttrs: !1,
|
|
385
|
+
__name: "Block",
|
|
386
|
+
props: {
|
|
387
|
+
id: {},
|
|
388
|
+
type: {},
|
|
389
|
+
content: {},
|
|
390
|
+
readonly: { type: Boolean },
|
|
391
|
+
asChild: { type: Boolean }
|
|
392
|
+
},
|
|
393
|
+
setup(i) {
|
|
394
|
+
const r = i, a = tt();
|
|
395
|
+
return (c, y) => {
|
|
396
|
+
const w = nt("Block", !0);
|
|
397
|
+
return r.type !== "block" ? (m(), R("span", fe({
|
|
398
|
+
key: 0,
|
|
399
|
+
"data-id": r.id,
|
|
400
|
+
"data-type": r.type
|
|
401
|
+
}, k(a)), le(r.content), 17, Rt)) : (m(), R(ce, { key: 1 }, [
|
|
402
|
+
r.asChild ? (m(!0), R(ce, { key: 0 }, he(r.content, (n) => (m(), X(w, fe({
|
|
403
|
+
key: `${n.id}-${n.type}`
|
|
404
|
+
}, { ref_for: !0 }, n), null, 16))), 128)) : (m(), R("span", fe({
|
|
405
|
+
key: 1,
|
|
406
|
+
"data-id": r.id,
|
|
407
|
+
"data-type": r.type
|
|
408
|
+
}, k(a)), [
|
|
409
|
+
(m(!0), R(ce, null, he(r.content, (n) => (m(), X(w, fe({
|
|
410
|
+
key: `${n.id}-${n.type}`
|
|
411
|
+
}, { ref_for: !0 }, n), null, 16))), 128))
|
|
412
|
+
], 16, Ot))
|
|
413
|
+
], 64));
|
|
587
414
|
};
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
415
|
+
}
|
|
416
|
+
}), $t = /* @__PURE__ */ be(Tt, [["__scopeId", "data-v-13862606"]]);
|
|
417
|
+
function Lt(i, r = {}) {
|
|
418
|
+
let a = [], c = [], y = i;
|
|
419
|
+
return { commit: (_) => {
|
|
420
|
+
var g;
|
|
421
|
+
a.push(y), y = _, c.length && ((g = r.onRemoveHistory) == null || g.call(r, c)), c = [];
|
|
422
|
+
}, undo: () => a.length ? (c.push(y), y = a.pop(), y) : null, redo: () => c.length ? (a.push(y), y = c.pop(), y) : null, clear: () => {
|
|
423
|
+
var _, g;
|
|
424
|
+
a.length && ((_ = r.onRemoveHistory) == null || _.call(r, a)), c.length && ((g = r.onRemoveHistory) == null || g.call(r, c)), a = [], c = [];
|
|
425
|
+
}, get: () => y };
|
|
426
|
+
}
|
|
427
|
+
const Bt = { class: "editor-container" }, Le = "", Be = "", Et = /* @__PURE__ */ ge({
|
|
428
|
+
__name: "TemplateEditor",
|
|
429
|
+
props: {
|
|
430
|
+
modelValue: { default: () => [] },
|
|
431
|
+
modelModifiers: {}
|
|
432
|
+
},
|
|
433
|
+
emits: /* @__PURE__ */ st(["submit"], ["update:modelValue"]),
|
|
434
|
+
setup(i, { expose: r, emit: a }) {
|
|
435
|
+
const c = typeof window.ShadowRoot.prototype.getSelection == "function", y = typeof window.Selection.prototype.getComposedRanges == "function";
|
|
436
|
+
function w() {
|
|
437
|
+
const e = navigator.userAgent;
|
|
438
|
+
return e.includes("Safari") && !e.includes("Chrome") && !e.includes("Chromium") && !e.includes("CriOS");
|
|
439
|
+
}
|
|
440
|
+
const n = w(), p = () => Math.random().toString(36).substring(2, 15), C = ot(i, "modelValue"), h = a, _ = E(0), g = (e) => e.map((t, o) => ({
|
|
441
|
+
id: `id-${o}`,
|
|
442
|
+
...t.type === "template" ? { ...t, prefix: Le, suffix: Be } : t
|
|
443
|
+
})), I = (e) => e.map((t) => ({ type: t.type, content: t.content })), d = E(g(C.value || [])), L = D(() => d.value.map((e) => e.type === "template" ? [
|
|
444
|
+
{ id: e.id, type: "prefix", content: e.prefix },
|
|
445
|
+
{ id: e.id, type: "template", content: e.content },
|
|
446
|
+
{ id: e.id, type: "suffix", content: e.suffix }
|
|
447
|
+
] : [e]).flat()), U = D(() => d.value.map((e) => e.type === "text" ? e : n ? {
|
|
448
|
+
id: e.id,
|
|
449
|
+
type: "block",
|
|
450
|
+
asChild: !0,
|
|
451
|
+
content: [
|
|
452
|
+
{ id: e.id, type: "prefix", content: e.prefix },
|
|
453
|
+
{
|
|
454
|
+
id: e.id,
|
|
455
|
+
type: "block",
|
|
456
|
+
content: [
|
|
457
|
+
{ id: e.id, type: "template", content: e.content },
|
|
458
|
+
{ id: e.id, type: "suffix", content: e.suffix }
|
|
459
|
+
]
|
|
460
|
+
}
|
|
461
|
+
]
|
|
462
|
+
} : {
|
|
463
|
+
id: e.id,
|
|
464
|
+
type: "block",
|
|
465
|
+
asChild: !0,
|
|
466
|
+
content: [
|
|
467
|
+
{
|
|
468
|
+
id: e.id,
|
|
469
|
+
type: "block",
|
|
470
|
+
content: [
|
|
471
|
+
{ id: e.id, type: "prefix", content: e.prefix },
|
|
472
|
+
{ id: e.id, type: "template", content: e.content }
|
|
473
|
+
]
|
|
474
|
+
},
|
|
475
|
+
{ id: e.id, type: "suffix", content: e.suffix }
|
|
476
|
+
]
|
|
477
|
+
})), $ = E(null), z = (e) => {
|
|
478
|
+
const t = Date.now(), o = JSON.stringify(e);
|
|
479
|
+
return `${t}:${o}`;
|
|
480
|
+
}, te = (e) => {
|
|
481
|
+
const t = parseInt(e.slice(0, 13)), o = JSON.parse(e.slice(14));
|
|
482
|
+
return {
|
|
483
|
+
timestamp: t,
|
|
484
|
+
data: o
|
|
485
|
+
};
|
|
486
|
+
}, v = /* @__PURE__ */ new Map(), F = Lt(z(d.value), {
|
|
487
|
+
onRemoveHistory: (e) => {
|
|
488
|
+
for (const t of e)
|
|
489
|
+
v.delete(t);
|
|
632
490
|
}
|
|
633
|
-
s.removeAllRanges(), s.addRange(g), e.focus && e.focus();
|
|
634
491
|
});
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
492
|
+
Z(
|
|
493
|
+
() => C.value,
|
|
494
|
+
(e) => {
|
|
495
|
+
d.value = g(e || []), F.commit(z(d.value));
|
|
496
|
+
},
|
|
497
|
+
{ deep: !0 }
|
|
498
|
+
);
|
|
499
|
+
const V = (e, t = document.body) => t.contains(e) ? e instanceof HTMLElement && e.dataset.id ? e : e.parentElement ? V(e.parentElement, t) : null : null, W = (e) => e === $.value, G = (e) => {
|
|
500
|
+
const t = window.getSelection();
|
|
501
|
+
if (!t)
|
|
502
|
+
return null;
|
|
503
|
+
const o = t.rangeCount > 0 ? t.getRangeAt(0) : null, u = e.getRootNode();
|
|
504
|
+
if (!(u instanceof ShadowRoot))
|
|
505
|
+
return o;
|
|
506
|
+
if (y) {
|
|
507
|
+
const l = t.getComposedRanges(n ? u : { shadowRoots: [u] });
|
|
508
|
+
return (l == null ? void 0 : l[0]) ?? null;
|
|
641
509
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
if (!n) return null;
|
|
646
|
-
n.innerHTML = "";
|
|
647
|
-
let s = null;
|
|
648
|
-
if (!l || l === o.template)
|
|
649
|
-
e.forEach((g) => {
|
|
650
|
-
if (g.type === "field") {
|
|
651
|
-
const T = r(g.content), I = c(g.content, T);
|
|
652
|
-
n.appendChild(I);
|
|
653
|
-
const M = ye();
|
|
654
|
-
n.appendChild(M), s || (s = I);
|
|
655
|
-
} else
|
|
656
|
-
n.appendChild(document.createTextNode(g.content));
|
|
657
|
-
}), o.initialValues && Object.keys(o.initialValues).length > 0 && W(() => {
|
|
658
|
-
const g = i();
|
|
659
|
-
g !== o.value && (o.onValueChange(g), o.onInput(g));
|
|
660
|
-
});
|
|
661
|
-
else {
|
|
662
|
-
const g = v(e, l);
|
|
663
|
-
g.success ? g.elements.forEach((T) => {
|
|
664
|
-
if (n.appendChild(T.node), T.isField) {
|
|
665
|
-
const I = ye();
|
|
666
|
-
n.appendChild(I);
|
|
667
|
-
}
|
|
668
|
-
T.isField && !s && (s = T.node);
|
|
669
|
-
}) : (n.appendChild(document.createTextNode(l)), s = null);
|
|
670
|
-
}
|
|
671
|
-
return s;
|
|
672
|
-
}, v = (e, l) => {
|
|
673
|
-
const n = [];
|
|
674
|
-
let s = 0, g = 0, T = !0;
|
|
675
|
-
for (; g < e.length && s <= l.length && T; ) {
|
|
676
|
-
const I = e[g];
|
|
677
|
-
if (I.type === "text")
|
|
678
|
-
l.substring(s).startsWith(I.content) ? (n.push({
|
|
679
|
-
node: document.createTextNode(I.content),
|
|
680
|
-
isField: !1
|
|
681
|
-
}), s += I.content.length, g++) : T = !1;
|
|
682
|
-
else {
|
|
683
|
-
let M = "";
|
|
684
|
-
const j = e.find((B, q) => q > g && B.type === "text");
|
|
685
|
-
if (j) {
|
|
686
|
-
const B = l.substring(s), q = B.indexOf(j.content);
|
|
687
|
-
q !== -1 ? (M = B.substring(0, q), s += M.length) : T = !1;
|
|
688
|
-
} else
|
|
689
|
-
M = l.substring(s), s = l.length;
|
|
690
|
-
if (T) {
|
|
691
|
-
const B = c(I.content, M);
|
|
692
|
-
n.push({ node: B, isField: !0 }), g++;
|
|
693
|
-
}
|
|
510
|
+
if (c) {
|
|
511
|
+
const l = u.getSelection();
|
|
512
|
+
return l.rangeCount > 0 ? l.getRangeAt(0) : null;
|
|
694
513
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
514
|
+
return o;
|
|
515
|
+
}, de = (e, t) => {
|
|
516
|
+
var u;
|
|
517
|
+
if (!e.firstChild || e.firstChild.nodeType !== Node.TEXT_NODE)
|
|
518
|
+
return console.warn("el.firstChild is not a text node. set anchor and focus to the element with offset 0", e), { node: e, offset: 0 };
|
|
519
|
+
const o = ((u = e.firstChild.textContent) == null ? void 0 : u.length) ?? 0;
|
|
520
|
+
return t > o && console.warn("offset is too large", { offset: t, el: e }), { node: e.firstChild, offset: Math.min(t, o) };
|
|
521
|
+
}, Q = (e, t, o, u) => {
|
|
522
|
+
const l = window.getSelection();
|
|
523
|
+
if (!l)
|
|
524
|
+
return;
|
|
525
|
+
const { node: f, offset: b } = de(e, t);
|
|
526
|
+
if (!o) {
|
|
527
|
+
l.setBaseAndExtent(f, b, f, b);
|
|
528
|
+
return;
|
|
707
529
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
const n = l.textContent || "", s = J(n);
|
|
716
|
-
s && s.trim() !== "" ? b(l, "inside", !1) : b(l, "inside", !0);
|
|
530
|
+
const { node: S, offset: O } = de(o, u ?? 0);
|
|
531
|
+
l.setBaseAndExtent(f, b, S, O);
|
|
532
|
+
}, J = (e, t) => {
|
|
533
|
+
const o = p(), u = { id: o, type: "text", content: e };
|
|
534
|
+
if (t) {
|
|
535
|
+
const l = d.value.findIndex((f) => f.id === t);
|
|
536
|
+
l !== -1 ? d.value = d.value.slice(0, l + 1).concat(u).concat(d.value.slice(l + 1)) : console.warn(`can not find item with id: ${t}`);
|
|
717
537
|
} else
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
t.value.childNodes.forEach((l) => {
|
|
735
|
-
if (l.nodeType === Node.TEXT_NODE) {
|
|
736
|
-
const n = l.textContent || "";
|
|
737
|
-
if (ee(n)) {
|
|
738
|
-
const s = l.previousSibling;
|
|
739
|
-
if (s && s.nodeType === Node.ELEMENT_NODE && s.classList.contains("template-field"))
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
(n.trim() === "" || ee(n)) && e.push(l);
|
|
743
|
-
} else l.nodeType === Node.ELEMENT_NODE && l.tagName.toLowerCase() === "br" && e.push(l);
|
|
744
|
-
}), e.forEach((l) => {
|
|
745
|
-
l.parentNode && l.parentNode.removeChild(l);
|
|
746
|
-
});
|
|
747
|
-
}, V = (e) => {
|
|
748
|
-
if (!o.template || !o.initialValues)
|
|
749
|
-
return "字段";
|
|
750
|
-
for (const [l, n] of Object.entries(o.initialValues))
|
|
751
|
-
if (n === e)
|
|
752
|
-
return l;
|
|
753
|
-
return e.length <= 2 || /^[[\]{}()]+$/.test(e) || e.includes("[") && e.includes("]") ? e : "字段";
|
|
754
|
-
}, K = (e) => {
|
|
755
|
-
const l = e.getAttribute("data-placeholder");
|
|
756
|
-
if (l)
|
|
757
|
-
return l;
|
|
758
|
-
const n = e.getAttribute("title") || e.getAttribute("data-field") || e.getAttribute("data-key") || e.getAttribute("placeholder") || "";
|
|
759
|
-
if (n)
|
|
760
|
-
return n;
|
|
761
|
-
const s = e.textContent || "";
|
|
762
|
-
return V(s);
|
|
763
|
-
}, C = () => {
|
|
764
|
-
if (!t.value) return;
|
|
765
|
-
t.value.querySelectorAll("span").forEach((l) => {
|
|
766
|
-
const n = l, s = n.style, g = n.classList.contains("template-field"), T = n.hasAttribute("data-placeholder");
|
|
767
|
-
if (g && T)
|
|
538
|
+
d.value.unshift(u);
|
|
539
|
+
q(() => {
|
|
540
|
+
var f;
|
|
541
|
+
const l = (f = $.value) == null ? void 0 : f.querySelector(`[data-id="${o}"][data-type="text"]`);
|
|
542
|
+
l && Q(l, e.length);
|
|
543
|
+
}), C.value = I(d.value);
|
|
544
|
+
}, x = E({
|
|
545
|
+
hasStarted: !1,
|
|
546
|
+
range: null
|
|
547
|
+
}), N = (e) => {
|
|
548
|
+
var S;
|
|
549
|
+
const t = e;
|
|
550
|
+
e.preventDefault();
|
|
551
|
+
const { inputType: o } = t, u = (t.data || ((S = t.dataTransfer) == null ? void 0 : S.getData("text/plain")) || "").replace(Le, "").replace(Be, ""), l = t.getTargetRanges()[0];
|
|
552
|
+
if (!l) {
|
|
553
|
+
console.warn("range is null", l);
|
|
768
554
|
return;
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
555
|
+
}
|
|
556
|
+
const f = [
|
|
557
|
+
"insertText",
|
|
558
|
+
"insertFromPaste",
|
|
559
|
+
"insertReplacementText",
|
|
560
|
+
"deleteContentBackward",
|
|
561
|
+
"deleteContentForward",
|
|
562
|
+
"deleteWordBackward",
|
|
563
|
+
"deleteWordForward",
|
|
564
|
+
"deleteSoftLineBackward",
|
|
565
|
+
"deleteSoftLineForward",
|
|
566
|
+
"deleteByCut"
|
|
567
|
+
], b = G($.value);
|
|
568
|
+
if (f.includes(o)) {
|
|
569
|
+
if (u && W(l.startContainer) && W(l.endContainer)) {
|
|
570
|
+
J(u), b && v.set(F.get(), M(b));
|
|
571
|
+
return;
|
|
777
572
|
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
573
|
+
const O = M(l);
|
|
574
|
+
O.startId && O.endId ? (P(O, o, u), b && v.set(F.get(), M(b))) : console.warn("range is not valid, range:", O);
|
|
575
|
+
} else o === "insertCompositionText" && x.value.hasStarted && (x.value = { hasStarted: !1, range: M(l) });
|
|
576
|
+
}, M = (e) => {
|
|
577
|
+
const t = V(e.startContainer, $.value), o = V(e.endContainer, $.value);
|
|
578
|
+
return {
|
|
579
|
+
collapsed: e.collapsed,
|
|
580
|
+
endContainer: e.endContainer,
|
|
581
|
+
endId: o == null ? void 0 : o.dataset.id,
|
|
582
|
+
endOffset: e.endOffset,
|
|
583
|
+
endType: o == null ? void 0 : o.dataset.type,
|
|
584
|
+
startContainer: e.startContainer,
|
|
585
|
+
startId: t == null ? void 0 : t.dataset.id,
|
|
586
|
+
startOffset: e.startOffset,
|
|
587
|
+
startType: t == null ? void 0 : t.dataset.type
|
|
588
|
+
};
|
|
589
|
+
}, ne = (e, t, o, u) => e.slice(0, o) + t + e.slice(u), P = (e, t, o) => {
|
|
590
|
+
const u = Ce(e);
|
|
591
|
+
if (!Array.isArray(u) || u.length === 0)
|
|
592
|
+
return;
|
|
593
|
+
const l = ke(u, e, t, o);
|
|
594
|
+
if (l.some((S) => S.tag === "new")) {
|
|
595
|
+
const { afterId: S, content: O } = l[0];
|
|
596
|
+
J(O, S);
|
|
597
|
+
return;
|
|
781
598
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
// 推断 placeholder
|
|
809
|
-
inferPlaceholderForContent: V,
|
|
810
|
-
extractPlaceholderFromElement: K,
|
|
811
|
-
// 方法
|
|
812
|
-
resetFields: () => {
|
|
813
|
-
if (!t.value) return;
|
|
814
|
-
o.isInternalUpdate = !0;
|
|
815
|
-
const e = t.value;
|
|
816
|
-
e.innerHTML = "";
|
|
817
|
-
const l = u(o.template);
|
|
818
|
-
let n = "";
|
|
819
|
-
l.forEach((s) => {
|
|
820
|
-
if (s.type === "field") {
|
|
821
|
-
const g = r(s.content), T = c(s.content, g);
|
|
822
|
-
g && (n += g), e.appendChild(T);
|
|
823
|
-
} else
|
|
824
|
-
e.appendChild(document.createTextNode(s.content)), n += s.content;
|
|
825
|
-
}), o.onValueChange(n), L(), a(n), W(() => {
|
|
826
|
-
o.isInternalUpdate = !1;
|
|
599
|
+
const f = l, b = [];
|
|
600
|
+
for (const [S, O] of f.entries()) {
|
|
601
|
+
const H = d.value.find((Te) => Te.id === O.id), Y = S === 0 ? o : "";
|
|
602
|
+
H ? H.type === "text" ? H.content = ne(H.content, Y, O.startOffset, O.endOffset) : H.type === "template" ? O.type === "prefix" || O.type === "suffix" ? O.startOffset === 0 && O.endOffset === 1 && Y.length === 0 ? H[O.type] = "" : console.warn(`${O.type} can not be inserted text. it only can be deleted`, O) : O.startOffset < 0 || O.endOffset > H.content.length ? b.push(H.id) : H.content = ne(H.content, Y, O.startOffset, O.endOffset) : console.warn("dataItem.type is not text or template", H) : console.warn("can not find dataItem", O);
|
|
603
|
+
}
|
|
604
|
+
d.value = d.value.filter((S) => !b.includes(S.id)), d.value = d.value.filter((S) => S.type === "text" ? S.content.length > 0 : [S.prefix, S.suffix, S.content].join("").length > 0);
|
|
605
|
+
for (const S of d.value.filter((O) => O.type === "template"))
|
|
606
|
+
S.prefix.length === 0 && (S.prefix = Le), S.suffix.length === 0 && (S.suffix = Be);
|
|
607
|
+
f.length > 0 && se(f, o), C.value = I(d.value);
|
|
608
|
+
}, se = (e, t) => {
|
|
609
|
+
const o = e[0], u = `[data-id="${o.id}"][data-type="${o.type}"]`, l = e.slice(1).map((f) => `[data-id="${f.id}"][data-type="${f.type}"]`);
|
|
610
|
+
q(() => {
|
|
611
|
+
var b, S;
|
|
612
|
+
const f = (b = $.value) == null ? void 0 : b.querySelector(u);
|
|
613
|
+
if (f)
|
|
614
|
+
Q(f, o.startOffset + t.length);
|
|
615
|
+
else if (t.length === 0)
|
|
616
|
+
for (const O of l) {
|
|
617
|
+
const H = (S = $.value) == null ? void 0 : S.querySelector(O);
|
|
618
|
+
if (H) {
|
|
619
|
+
Q(H, 0);
|
|
620
|
+
break;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
else
|
|
624
|
+
console.warn(`can not find el with selector: ${u}`);
|
|
827
625
|
});
|
|
828
|
-
},
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
setup(t, { expose: y, emit: h }) {
|
|
849
|
-
const o = rt(t, "value"), x = t, u = h, i = O(null), r = O(""), c = O({}), f = O(!1), p = O(!1), a = It(i, {
|
|
850
|
-
template: r.value,
|
|
851
|
-
value: o.value,
|
|
852
|
-
initialValues: c.value,
|
|
853
|
-
isInternalUpdate: f,
|
|
854
|
-
isComposing: p,
|
|
855
|
-
onValueChange: (C) => {
|
|
856
|
-
if (o.value !== C) {
|
|
857
|
-
const S = f.value;
|
|
858
|
-
f.value = !0, o.value = C, W(() => {
|
|
859
|
-
f.value = S;
|
|
860
|
-
});
|
|
626
|
+
}, Ce = (e) => {
|
|
627
|
+
const t = L.value.findIndex((b) => b.id === e.startId && b.type === e.startType), o = L.value.findIndex((b) => b.id === e.endId && b.type === e.endType);
|
|
628
|
+
if (t === -1 || o === -1 || t > o)
|
|
629
|
+
return console.warn("startIndex or endIndex is -1, or startIndex > endIndex. ", { range: e }), null;
|
|
630
|
+
const u = L.value[t], l = L.value[o];
|
|
631
|
+
if (t === o)
|
|
632
|
+
return [
|
|
633
|
+
{
|
|
634
|
+
id: u.id,
|
|
635
|
+
type: u.type,
|
|
636
|
+
startOffset: e.startOffset,
|
|
637
|
+
endOffset: e.endOffset
|
|
638
|
+
}
|
|
639
|
+
];
|
|
640
|
+
const f = [
|
|
641
|
+
{
|
|
642
|
+
id: u.id,
|
|
643
|
+
type: u.type,
|
|
644
|
+
startOffset: e.startOffset,
|
|
645
|
+
endOffset: u.content.length
|
|
861
646
|
}
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
getValueFromDOM: a.getValueFromDOM,
|
|
872
|
-
handleInput: a.handleInput,
|
|
873
|
-
onSubmit: (C) => u("submit", C)
|
|
874
|
-
}), L = (C, S) => {
|
|
875
|
-
let N = C;
|
|
876
|
-
return Object.entries(S).forEach(([X, e]) => {
|
|
877
|
-
const l = `[${X}]`;
|
|
878
|
-
N = N.replace(new RegExp(l.replace(/[[\]]/g, "\\$&"), "g"), e);
|
|
879
|
-
}), N;
|
|
880
|
-
}, _ = (C) => {
|
|
881
|
-
f.value = !0, r.value = C.template, c.value = C.initialValues || {};
|
|
882
|
-
const S = L(r.value, c.value);
|
|
883
|
-
a.updateOptions({
|
|
884
|
-
template: r.value,
|
|
885
|
-
value: S,
|
|
886
|
-
// 使用新生成的内容而不是旧的inputValue
|
|
887
|
-
initialValues: c.value
|
|
888
|
-
}), a.updateEditorDOM(), o.value = S, W(() => {
|
|
889
|
-
f.value = !1;
|
|
890
|
-
});
|
|
891
|
-
}, v = () => {
|
|
892
|
-
p.value = !0;
|
|
893
|
-
}, R = () => {
|
|
894
|
-
p.value = !1, a.handleInput();
|
|
895
|
-
}, w = (C) => {
|
|
896
|
-
var X;
|
|
897
|
-
if (!i.value) return;
|
|
898
|
-
const S = C.target;
|
|
899
|
-
let N = null;
|
|
900
|
-
if (S.classList.contains("template-field") ? N = S : (X = S.parentElement) != null && X.classList.contains("template-field") && (N = S.parentElement), N && (!N.textContent || N.textContent.trim() === "")) {
|
|
901
|
-
const e = z(i.value), l = document.createRange();
|
|
902
|
-
e && (l.selectNodeContents(N), l.collapse(!0), e.removeAllRanges(), e.addRange(l), N.focus(), C.preventDefault(), C.stopPropagation());
|
|
647
|
+
];
|
|
648
|
+
for (let b = t + 1; b < o; b++) {
|
|
649
|
+
const S = L.value[b];
|
|
650
|
+
f.push({
|
|
651
|
+
id: S.id,
|
|
652
|
+
type: S.type,
|
|
653
|
+
startOffset: 0,
|
|
654
|
+
endOffset: S.content.length
|
|
655
|
+
});
|
|
903
656
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
e
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
657
|
+
return f.push({
|
|
658
|
+
id: l.id,
|
|
659
|
+
type: l.type,
|
|
660
|
+
startOffset: 0,
|
|
661
|
+
endOffset: e.endOffset
|
|
662
|
+
}), f;
|
|
663
|
+
}, ke = (e, t, o, u) => {
|
|
664
|
+
const l = e[0];
|
|
665
|
+
if (l.type !== "prefix" && l.type !== "suffix")
|
|
666
|
+
return e;
|
|
667
|
+
if (e.length === 1) {
|
|
668
|
+
if (t.collapsed)
|
|
669
|
+
if (t.startOffset === 0) {
|
|
670
|
+
const f = ie(l, u);
|
|
671
|
+
return f ? [f] : [];
|
|
672
|
+
} else {
|
|
673
|
+
const f = re(l, u);
|
|
674
|
+
return f ? [f] : [];
|
|
675
|
+
}
|
|
676
|
+
if (o.startsWith("insert"))
|
|
677
|
+
if (n) {
|
|
678
|
+
const f = ie(l, u);
|
|
679
|
+
return f ? [f] : [];
|
|
680
|
+
} else {
|
|
681
|
+
const f = re(l, u);
|
|
682
|
+
return f ? [f] : [];
|
|
683
|
+
}
|
|
684
|
+
if (o.startsWith("delete")) {
|
|
685
|
+
if (o.includes("Backward")) {
|
|
686
|
+
const f = ie(l, u, 1);
|
|
687
|
+
return f ? [f] : [];
|
|
688
|
+
} else if (o.includes("Forward")) {
|
|
689
|
+
const f = re(l, u, 1);
|
|
690
|
+
return f ? [f] : [];
|
|
927
691
|
}
|
|
928
|
-
}), n) {
|
|
929
|
-
$(e);
|
|
930
|
-
return;
|
|
931
692
|
}
|
|
932
693
|
}
|
|
933
|
-
|
|
934
|
-
},
|
|
935
|
-
const
|
|
936
|
-
if (
|
|
937
|
-
const
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
694
|
+
return u.length > 0 ? e.slice(1) : e;
|
|
695
|
+
}, ie = (e, t, o = 0) => {
|
|
696
|
+
const u = L.value.findIndex((l) => l.id === e.id && l.type === e.type);
|
|
697
|
+
if (u > 0) {
|
|
698
|
+
const l = L.value[u - 1], { id: f, type: b, content: S } = l;
|
|
699
|
+
if (b === "text" || b === "template")
|
|
700
|
+
return {
|
|
701
|
+
id: f,
|
|
702
|
+
type: b,
|
|
703
|
+
startOffset: S.length - o,
|
|
704
|
+
endOffset: S.length
|
|
705
|
+
};
|
|
706
|
+
if (t.length > 0)
|
|
707
|
+
return { tag: "new", afterId: f, type: "text", content: t };
|
|
708
|
+
if (console.warn("the previous item is not text or template", { current: e, previous: l }), o === 1)
|
|
709
|
+
return { ...e, endOffset: e.startOffset };
|
|
710
|
+
} else return t.length > 0 ? { tag: "new", type: "text", content: t } : (console.warn("the previous item of current is not found", { current: e }), null);
|
|
711
|
+
return e;
|
|
712
|
+
}, re = (e, t, o = 0) => {
|
|
713
|
+
const u = L.value.findIndex((l) => l.id === e.id && l.type === e.type);
|
|
714
|
+
if (u < L.value.length - 1) {
|
|
715
|
+
const l = L.value[u + 1], { id: f, type: b } = l;
|
|
716
|
+
if (b === "text" || b === "template")
|
|
717
|
+
return {
|
|
718
|
+
id: f,
|
|
719
|
+
type: b,
|
|
720
|
+
startOffset: 0,
|
|
721
|
+
endOffset: 0 + o
|
|
722
|
+
};
|
|
723
|
+
if (t.length > 0)
|
|
724
|
+
return { tag: "new", afterId: e.id, type: "text", content: t };
|
|
725
|
+
if (console.warn("the next item is not text or template", { current: e, next: l }), o === 1)
|
|
726
|
+
return { ...e, startOffset: e.endOffset };
|
|
727
|
+
} else return t.length > 0 ? { tag: "new", afterId: e.id, type: "text", content: t } : (console.warn("the next item of current is not found", { current: e }), null);
|
|
728
|
+
return e;
|
|
729
|
+
}, xe = () => {
|
|
730
|
+
x.value = { hasStarted: !0, range: null };
|
|
731
|
+
}, ve = (e) => {
|
|
732
|
+
const t = x.value.range;
|
|
733
|
+
t ? (e.data && W(t.startContainer) && W(t.endContainer) ? (J(e.data), v.set(F.get(), M(t))) : t.startId && t.endId ? (P(t, "insertCompositionText", e.data), v.set(F.get(), M(t))) : console.warn("range is not valid, range:", t), _.value++) : console.warn("range is null, compositionEnd:", e), x.value = { hasStarted: !1, range: null };
|
|
734
|
+
}, ue = (() => {
|
|
735
|
+
const e = navigator.userAgent.toLowerCase();
|
|
736
|
+
return /macintosh|mac os x|iphone|ipad|ipod/.test(e);
|
|
737
|
+
})(), Ie = (e) => {
|
|
738
|
+
const t = ue && e.metaKey && !e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Z
|
|
739
|
+
!ue && e.ctrlKey && !e.shiftKey && e.key.toLowerCase() === "z", o = ue && e.metaKey && e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Shift+z
|
|
740
|
+
!ue && e.ctrlKey && (e.key.toLowerCase() === "y" || e.shiftKey && e.key.toLowerCase() === "z"), u = e.key.toLowerCase() === "enter";
|
|
741
|
+
if (t) {
|
|
742
|
+
e.preventDefault();
|
|
743
|
+
const l = G($.value);
|
|
744
|
+
l && v.set(F.get(), M(l));
|
|
745
|
+
const f = F.undo();
|
|
746
|
+
f && oe(f);
|
|
943
747
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
N.deleteContents(), N.insertNode(document.createTextNode(C)), N.collapse(!1), S.removeAllRanges(), S.addRange(N), K();
|
|
748
|
+
if (o) {
|
|
749
|
+
e.preventDefault();
|
|
750
|
+
const l = F.redo();
|
|
751
|
+
l && oe(l);
|
|
949
752
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
}
|
|
960
|
-
setTimeout(() => {
|
|
961
|
-
const S = a.getValueFromDOM();
|
|
962
|
-
S !== o.value && (f.value = !0, o.value = S, u("input", S), W(() => {
|
|
963
|
-
f.value = !1;
|
|
964
|
-
}));
|
|
965
|
-
}, 50);
|
|
966
|
-
});
|
|
967
|
-
};
|
|
968
|
-
return ut(() => {
|
|
969
|
-
r.value && a.updateEditorDOM(), x.autofocus && i.value && a.setCursorToEnd();
|
|
970
|
-
}), te(
|
|
971
|
-
() => r.value,
|
|
972
|
-
() => {
|
|
973
|
-
f.value || (a.updateOptions({
|
|
974
|
-
template: r.value,
|
|
975
|
-
value: o.value,
|
|
976
|
-
initialValues: c.value
|
|
977
|
-
}), a.updateEditorDOM());
|
|
753
|
+
u && (e.preventDefault(), h("submit"));
|
|
754
|
+
}, oe = (e) => {
|
|
755
|
+
const { data: t } = te(e);
|
|
756
|
+
if (d.value = t, v.has(e)) {
|
|
757
|
+
const o = v.get(e);
|
|
758
|
+
q(() => {
|
|
759
|
+
const u = $.value.querySelector(`[data-id="${o.startId}"][data-type="${o.startType}"]`), l = $.value.querySelector(`[data-id="${o.endId}"][data-type="${o.endType}"]`);
|
|
760
|
+
u && Q(u, o.startOffset, l, o.endOffset);
|
|
761
|
+
});
|
|
978
762
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
() => {
|
|
982
|
-
|
|
983
|
-
template: r.value,
|
|
984
|
-
value: o.value,
|
|
985
|
-
initialValues: c.value
|
|
986
|
-
}), a.updateEditorDOM());
|
|
763
|
+
};
|
|
764
|
+
return r({
|
|
765
|
+
clearHistory: () => {
|
|
766
|
+
F.clear(), v.clear();
|
|
987
767
|
},
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
value:
|
|
995
|
-
|
|
996
|
-
|
|
768
|
+
activateFirstField: () => {
|
|
769
|
+
if (!$.value)
|
|
770
|
+
return;
|
|
771
|
+
const e = d.value.find((t) => t.type === "template");
|
|
772
|
+
e && q(() => {
|
|
773
|
+
var o, u;
|
|
774
|
+
const t = (o = $.value) == null ? void 0 : o.querySelector(`[data-id="${e.id}"][data-type="template"]`);
|
|
775
|
+
if (t) {
|
|
776
|
+
const l = ((u = t.textContent) == null ? void 0 : u.length) || 0;
|
|
777
|
+
Q(t, l);
|
|
778
|
+
}
|
|
779
|
+
});
|
|
997
780
|
}
|
|
998
|
-
),
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
},
|
|
781
|
+
}), (e, t) => (m(), R("div", Bt, [
|
|
782
|
+
(m(), R("div", {
|
|
783
|
+
contenteditable: "true",
|
|
784
|
+
ref_key: "editorRef",
|
|
785
|
+
ref: $,
|
|
786
|
+
key: _.value,
|
|
787
|
+
class: "editor",
|
|
788
|
+
onBeforeinput: N,
|
|
789
|
+
onCompositionstart: xe,
|
|
790
|
+
onCompositionend: ve,
|
|
791
|
+
onKeydown: Ie
|
|
792
|
+
}, [
|
|
793
|
+
(m(!0), R(ce, null, he(U.value, (o) => (m(), X($t, fe({
|
|
794
|
+
key: `${o.id}-${o.type}`
|
|
795
|
+
}, { ref_for: !0 }, o), null, 16))), 128))
|
|
796
|
+
], 32))
|
|
797
|
+
]));
|
|
798
|
+
}
|
|
799
|
+
}), Dt = /* @__PURE__ */ be(Et, [["__scopeId", "data-v-b0269a2a"]]), Ft = ["onMouseenter", "onMousedown"], Pt = { class: "suggestion-list__text" }, Ht = /* @__PURE__ */ ge({
|
|
800
|
+
__name: "SuggestionList",
|
|
801
|
+
props: {
|
|
802
|
+
show: { type: Boolean },
|
|
803
|
+
suggestions: {},
|
|
804
|
+
popupStyle: {},
|
|
805
|
+
isItemHighlighted: { type: Function },
|
|
806
|
+
highlightSuggestionText: { type: Function },
|
|
807
|
+
inputValue: {}
|
|
808
|
+
},
|
|
809
|
+
emits: ["item-hover", "item-leave", "select"],
|
|
810
|
+
setup(i, { emit: r }) {
|
|
811
|
+
const a = i, c = r, y = E(null), w = (C) => {
|
|
812
|
+
c("item-hover", C);
|
|
813
|
+
}, n = () => {
|
|
814
|
+
c("item-leave");
|
|
815
|
+
}, p = (C) => {
|
|
816
|
+
c("select", C);
|
|
817
|
+
};
|
|
818
|
+
return (C, h) => (m(), X(Ee, { name: "tiny-sender-slide-up" }, {
|
|
819
|
+
default: pe(() => [
|
|
820
|
+
a.show && a.suggestions.length ? (m(), R("div", {
|
|
821
|
+
key: 0,
|
|
822
|
+
ref_key: "suggestionsListRef",
|
|
823
|
+
ref: y,
|
|
824
|
+
class: "suggestion-list",
|
|
825
|
+
style: De(a.popupStyle)
|
|
826
|
+
}, [
|
|
827
|
+
(m(!0), R(ce, null, he(a.suggestions, (_, g) => (m(), R("div", {
|
|
828
|
+
key: g,
|
|
829
|
+
class: ee(["suggestion-list__item", { highlighted: a.isItemHighlighted(g) }]),
|
|
830
|
+
onMouseenter: (I) => w(g),
|
|
831
|
+
onMouseleave: n,
|
|
832
|
+
onMousedown: at((I) => p(_), ["prevent"])
|
|
833
|
+
}, [
|
|
834
|
+
j(k(gt), { class: "suggestion-list__icon" }),
|
|
835
|
+
A("span", Pt, [
|
|
836
|
+
(m(!0), R(ce, null, he(a.highlightSuggestionText(_, a.inputValue), (I, d) => (m(), R("span", {
|
|
837
|
+
key: d,
|
|
838
|
+
class: ee({
|
|
839
|
+
"suggestion-list__text--match": I.isMatch,
|
|
840
|
+
"suggestion-list__text--normal": !I.isMatch
|
|
841
|
+
})
|
|
842
|
+
}, le(I.text), 3))), 128))
|
|
843
|
+
])
|
|
844
|
+
], 42, Ft))), 128))
|
|
845
|
+
], 4)) : K("", !0)
|
|
846
|
+
]),
|
|
847
|
+
_: 1
|
|
848
|
+
}));
|
|
1023
849
|
}
|
|
1024
|
-
}),
|
|
850
|
+
}), Kt = /* @__PURE__ */ be(Ht, [["__scopeId", "data-v-f801eb8b"]]), Wt = ["data-theme"], At = { class: "tiny-sender__container" }, Vt = {
|
|
1025
851
|
key: 0,
|
|
1026
852
|
class: "tiny-sender__header-slot"
|
|
1027
|
-
},
|
|
853
|
+
}, Nt = {
|
|
1028
854
|
key: 0,
|
|
1029
855
|
class: "tiny-sender__prefix-slot"
|
|
1030
|
-
},
|
|
856
|
+
}, Mt = { class: "tiny-sender__content-area" }, qt = {
|
|
1031
857
|
key: 0,
|
|
1032
858
|
class: "tiny-sender__decorative-content"
|
|
1033
|
-
},
|
|
859
|
+
}, Ut = {
|
|
1034
860
|
key: 2,
|
|
1035
861
|
class: "tiny-sender__input-field-wrapper"
|
|
1036
|
-
},
|
|
862
|
+
}, zt = {
|
|
1037
863
|
key: 0,
|
|
1038
864
|
class: "tiny-sender__completion-placeholder"
|
|
1039
|
-
},
|
|
865
|
+
}, jt = { class: "user-input-mirror" }, Xt = {
|
|
1040
866
|
key: 0,
|
|
1041
867
|
class: "tiny-sender__tab-hint"
|
|
1042
|
-
},
|
|
868
|
+
}, Jt = {
|
|
1043
869
|
key: 1,
|
|
1044
870
|
class: "tiny-sender__actions-slot"
|
|
1045
|
-
},
|
|
871
|
+
}, Gt = { class: "tiny-sender__footer-left" }, Qt = { class: "tiny-sender__footer-right" }, Yt = { class: "real-word-length" }, Zt = {
|
|
1046
872
|
key: 1,
|
|
1047
873
|
class: "tiny-sender__toolbar"
|
|
1048
|
-
},
|
|
874
|
+
}, en = { class: "tiny-sender__buttons-container" }, tn = {
|
|
1049
875
|
key: 1,
|
|
1050
876
|
class: "tiny-sender__footer-slot"
|
|
1051
|
-
},
|
|
1052
|
-
key: 0,
|
|
1053
|
-
class: "tiny-sender__error"
|
|
1054
|
-
}, pe = /* @__PURE__ */ be({
|
|
877
|
+
}, _e = /* @__PURE__ */ ge({
|
|
1055
878
|
__name: "index",
|
|
1056
879
|
props: {
|
|
1057
880
|
autofocus: { type: Boolean, default: !1 },
|
|
@@ -1072,360 +895,347 @@ const At = /* @__PURE__ */ be({
|
|
|
1072
895
|
suggestions: { default: () => [] },
|
|
1073
896
|
suggestionPopupWidth: { default: 400 },
|
|
1074
897
|
theme: { default: "light" },
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
templateInitialValues: { default: () => ({}) }
|
|
898
|
+
templateData: { default: () => [] },
|
|
899
|
+
stopText: { default: "" }
|
|
1078
900
|
},
|
|
1079
|
-
emits: ["update:modelValue", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template"],
|
|
1080
|
-
setup(
|
|
1081
|
-
const
|
|
1082
|
-
showSuggestionsPopup:
|
|
1083
|
-
completionPlaceholder:
|
|
1084
|
-
showTabHint:
|
|
1085
|
-
suggestionsListRef:
|
|
1086
|
-
filteredSuggestions:
|
|
1087
|
-
activeSuggestion:
|
|
1088
|
-
isItemHighlighted:
|
|
1089
|
-
updateSuggestionsState:
|
|
1090
|
-
selectSuggestion:
|
|
1091
|
-
acceptCurrentSuggestion:
|
|
1092
|
-
closeSuggestionsPopup:
|
|
1093
|
-
navigateSuggestions:
|
|
1094
|
-
handleSuggestionItemHover:
|
|
1095
|
-
handleSuggestionItemLeave:
|
|
1096
|
-
highlightSuggestionText:
|
|
1097
|
-
} =
|
|
1098
|
-
|
|
901
|
+
emits: ["update:modelValue", "update:templateData", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template"],
|
|
902
|
+
setup(i, { expose: r, emit: a }) {
|
|
903
|
+
const c = i, y = a, w = E(null), n = E(null), p = E(null), C = E(null), h = E(null), _ = D(() => c.templateData && c.templateData.length > 0), { inputValue: g, isComposing: I, clearInput: d } = yt(c, y), L = D(() => !!g.value.trim()), U = D(() => !(c.disabled || c.loading || !L.value || t.value)), {
|
|
904
|
+
showSuggestionsPopup: $,
|
|
905
|
+
completionPlaceholder: z,
|
|
906
|
+
showTabHint: te,
|
|
907
|
+
suggestionsListRef: v,
|
|
908
|
+
filteredSuggestions: F,
|
|
909
|
+
activeSuggestion: V,
|
|
910
|
+
isItemHighlighted: W,
|
|
911
|
+
updateSuggestionsState: G,
|
|
912
|
+
selectSuggestion: de,
|
|
913
|
+
acceptCurrentSuggestion: Q,
|
|
914
|
+
closeSuggestionsPopup: J,
|
|
915
|
+
navigateSuggestions: x,
|
|
916
|
+
handleSuggestionItemHover: N,
|
|
917
|
+
handleSuggestionItemLeave: M,
|
|
918
|
+
highlightSuggestionText: ne
|
|
919
|
+
} = _t(c, y, g, I, _), P = E(c.mode), se = E(!1), Ce = () => {
|
|
920
|
+
P.value === "single" && (P.value = "multiple", q(() => {
|
|
1099
921
|
setTimeout(() => {
|
|
1100
|
-
const
|
|
1101
|
-
if (
|
|
1102
|
-
|
|
1103
|
-
const
|
|
1104
|
-
|
|
922
|
+
const s = document.querySelector(".tiny-textarea__inner");
|
|
923
|
+
if (s) {
|
|
924
|
+
s.style.whiteSpace = "pre-wrap";
|
|
925
|
+
const T = g.value.length;
|
|
926
|
+
s.focus(), s.setSelectionRange(T, T);
|
|
1105
927
|
}
|
|
1106
928
|
}, 50);
|
|
1107
929
|
}));
|
|
1108
|
-
},
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1111
|
-
const
|
|
1112
|
-
return document.body.removeChild(
|
|
1113
|
-
},
|
|
1114
|
-
var
|
|
1115
|
-
if (
|
|
1116
|
-
const
|
|
1117
|
-
if (!
|
|
1118
|
-
const
|
|
1119
|
-
if (!
|
|
930
|
+
}, ke = (s, T) => {
|
|
931
|
+
const B = document.createElement("span");
|
|
932
|
+
B.style.visibility = "hidden", B.style.position = "absolute", B.style.whiteSpace = "nowrap", B.style.font = T, B.textContent = s, document.body.appendChild(B);
|
|
933
|
+
const me = B.offsetWidth;
|
|
934
|
+
return document.body.removeChild(B), me;
|
|
935
|
+
}, ie = () => {
|
|
936
|
+
var we, Ke, We;
|
|
937
|
+
if (c.mode !== "single" || !w.value || se.value || !n.value || !C.value) return;
|
|
938
|
+
const s = n.value.querySelector(".tiny-sender__content-area");
|
|
939
|
+
if (!s) return;
|
|
940
|
+
const T = ((Ke = (we = w.value) == null ? void 0 : we.querySelector) == null ? void 0 : Ke.call(we, ".tiny-input__inner")) || s.querySelector(".tiny-input__inner"), B = h.value || n.value.querySelector(".tiny-sender__buttons-container");
|
|
941
|
+
if (!T) {
|
|
1120
942
|
console.warn("Cannot find input element for overflow check");
|
|
1121
943
|
return;
|
|
1122
944
|
}
|
|
1123
|
-
const
|
|
1124
|
-
if (
|
|
1125
|
-
setTimeout(() =>
|
|
945
|
+
const me = T.getBoundingClientRect(), $e = B == null ? void 0 : B.getBoundingClientRect();
|
|
946
|
+
if (me.width === 0) {
|
|
947
|
+
setTimeout(() => ie(), 50);
|
|
1126
948
|
return;
|
|
1127
949
|
}
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
var
|
|
1132
|
-
const
|
|
1133
|
-
if (
|
|
1134
|
-
|
|
1135
|
-
const
|
|
1136
|
-
|
|
950
|
+
const Xe = window.getComputedStyle(T).font, Je = ke(g.value, Xe), Pe = (We = n.value) == null ? void 0 : We.classList.contains("tr-sender-compact"), Ge = Pe ? 12 : 20, Qe = me.width, Ye = ($e == null ? void 0 : $e.width) || 0, He = Qe - Ye - Ge, Ze = Pe ? 50 : 80;
|
|
951
|
+
Je > He && He > Ze && P.value === "single" && (se.value = !0, P.value = "multiple", q(() => {
|
|
952
|
+
w.value ? setTimeout(() => {
|
|
953
|
+
var Ae;
|
|
954
|
+
const Se = (Ae = n.value) == null ? void 0 : Ae.querySelector(".tiny-textarea__inner");
|
|
955
|
+
if (Se) {
|
|
956
|
+
Se.style.whiteSpace = "pre-wrap";
|
|
957
|
+
const Ve = g.value.length;
|
|
958
|
+
Se.focus(), Se.setSelectionRange(Ve, Ve);
|
|
1137
959
|
}
|
|
1138
|
-
|
|
1139
|
-
}, 300) :
|
|
960
|
+
se.value = !1;
|
|
961
|
+
}, 300) : se.value = !1;
|
|
1140
962
|
}));
|
|
1141
|
-
},
|
|
1142
|
-
if (
|
|
1143
|
-
|
|
1144
|
-
else if (
|
|
1145
|
-
|
|
963
|
+
}, re = () => {
|
|
964
|
+
if (_.value && p.value)
|
|
965
|
+
Fe();
|
|
966
|
+
else if (w.value)
|
|
967
|
+
w.value.focus();
|
|
1146
968
|
else {
|
|
1147
|
-
const
|
|
1148
|
-
|
|
969
|
+
const s = document.querySelector(".tiny-input__inner");
|
|
970
|
+
s == null || s.focus();
|
|
1149
971
|
}
|
|
1150
|
-
},
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
972
|
+
}, xe = () => {
|
|
973
|
+
if (w.value)
|
|
974
|
+
w.value.blur();
|
|
975
|
+
else {
|
|
976
|
+
const s = document.querySelector(".tiny-input__inner");
|
|
977
|
+
s == null || s.blur();
|
|
978
|
+
}
|
|
979
|
+
}, ve = () => {
|
|
980
|
+
var s;
|
|
981
|
+
y("update:templateData", []), (s = p.value) == null || s.clearHistory(), q(() => {
|
|
982
|
+
g.value === "" && (P.value = c.mode || "single"), setTimeout(() => {
|
|
983
|
+
re();
|
|
1154
984
|
}, 50);
|
|
1155
|
-
});
|
|
1156
|
-
},
|
|
1157
|
-
var
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
}),
|
|
1161
|
-
},
|
|
1162
|
-
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
|
|
985
|
+
}), J();
|
|
986
|
+
}, ye = () => {
|
|
987
|
+
var s;
|
|
988
|
+
d(), _.value ? ve() : (s = n.value) == null || s.focus(), q(() => {
|
|
989
|
+
g.value === "" && (P.value = c.mode || "single");
|
|
990
|
+
}), J();
|
|
991
|
+
}, ue = (s) => {
|
|
992
|
+
y("update:templateData", s);
|
|
993
|
+
};
|
|
994
|
+
Z(
|
|
995
|
+
() => c.templateData,
|
|
996
|
+
() => {
|
|
997
|
+
g.value = c.templateData.map((s) => s.content).join("");
|
|
998
|
+
},
|
|
999
|
+
{ deep: !0 }
|
|
1000
|
+
);
|
|
1001
|
+
const Ie = D(() => {
|
|
1002
|
+
const s = typeof c.speech == "object" ? c.speech : {};
|
|
1171
1003
|
return {
|
|
1172
|
-
...
|
|
1173
|
-
onStart: () =>
|
|
1174
|
-
onEnd: (
|
|
1175
|
-
onInterim: (
|
|
1176
|
-
onFinal: (
|
|
1177
|
-
if (
|
|
1178
|
-
|
|
1004
|
+
...s,
|
|
1005
|
+
onStart: () => y("speech-start"),
|
|
1006
|
+
onEnd: (T) => y("speech-end", T),
|
|
1007
|
+
onInterim: (T) => y("speech-interim", T),
|
|
1008
|
+
onFinal: (T) => {
|
|
1009
|
+
if (s.autoReplace)
|
|
1010
|
+
g.value = T;
|
|
1179
1011
|
else {
|
|
1180
|
-
const
|
|
1181
|
-
|
|
1012
|
+
const B = g.value;
|
|
1013
|
+
B && T && !B.endsWith(" ") && !T.startsWith(" ") && B.length > 0 ? g.value = B + " " + T : g.value = B + T;
|
|
1182
1014
|
}
|
|
1183
|
-
|
|
1015
|
+
y("speech-end", T);
|
|
1184
1016
|
},
|
|
1185
|
-
onError: (
|
|
1186
|
-
|
|
1017
|
+
onError: (T) => {
|
|
1018
|
+
y("speech-error", T);
|
|
1187
1019
|
}
|
|
1188
1020
|
};
|
|
1189
|
-
}), { speechState:
|
|
1190
|
-
|
|
1191
|
-
},
|
|
1192
|
-
|
|
1021
|
+
}), { speechState: oe, start: Re, stop: Oe } = wt(Ie.value), e = () => {
|
|
1022
|
+
oe.isRecording ? Oe() : Re();
|
|
1023
|
+
}, t = D(() => c.maxLength !== 1 / 0 && g.value.length > c.maxLength), { handleKeyPress: o, triggerSubmit: u } = mt(
|
|
1024
|
+
c,
|
|
1025
|
+
y,
|
|
1026
|
+
g,
|
|
1027
|
+
I,
|
|
1028
|
+
oe,
|
|
1029
|
+
$,
|
|
1030
|
+
V,
|
|
1031
|
+
Q,
|
|
1032
|
+
J,
|
|
1193
1033
|
x,
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1034
|
+
e,
|
|
1035
|
+
U,
|
|
1036
|
+
P,
|
|
1037
|
+
Ce,
|
|
1197
1038
|
_,
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
s,
|
|
1205
|
-
T
|
|
1206
|
-
), ze = (d) => {
|
|
1207
|
-
x("focus", d), a.value && m.value.length > 0 && !o.template && (_.value = !0, R.value = !0);
|
|
1208
|
-
}, je = (d) => {
|
|
1209
|
-
x("blur", d), N();
|
|
1210
|
-
}, Ue = P(() => s.value === "multiple" ? "textarea" : "text"), Ze = P(
|
|
1039
|
+
ve
|
|
1040
|
+
), l = (s) => {
|
|
1041
|
+
y("focus", s), g.value && F.value.length > 0 && !_.value && ($.value = !0, te.value = !0);
|
|
1042
|
+
}, f = (s) => {
|
|
1043
|
+
y("blur", s), J();
|
|
1044
|
+
}, b = D(() => P.value === "multiple" ? "textarea" : "text"), S = D(
|
|
1211
1045
|
() => ({
|
|
1212
1046
|
display: "flex",
|
|
1213
|
-
justifyContent:
|
|
1047
|
+
justifyContent: c.showWordLimit && c.maxLength !== 1 / 0 ? "space-between" : "flex-end",
|
|
1214
1048
|
alignItems: "center"
|
|
1215
1049
|
})
|
|
1216
|
-
),
|
|
1217
|
-
"is-disabled":
|
|
1218
|
-
"is-loading":
|
|
1219
|
-
"
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
width: mt(o.suggestionPopupWidth),
|
|
1050
|
+
), O = lt(), H = D(() => !!O.decorativeContent), Y = D(() => c.disabled || H.value), Te = D(() => c.loading), Ue = D(() => ({
|
|
1051
|
+
"is-disabled": Y.value,
|
|
1052
|
+
"is-loading": Te.value,
|
|
1053
|
+
"is-auto-switching": se.value
|
|
1054
|
+
})), ze = D(() => ({
|
|
1055
|
+
width: vt(c.suggestionPopupWidth),
|
|
1223
1056
|
maxWidth: "100%"
|
|
1224
1057
|
// 确保不超出父容器宽度
|
|
1225
|
-
})),
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
b.value = !1, setTimeout(() => {
|
|
1229
|
-
b.value = !1, K();
|
|
1058
|
+
})), je = () => {
|
|
1059
|
+
I.value = !1, setTimeout(() => {
|
|
1060
|
+
I.value = !1, G();
|
|
1230
1061
|
}, 50);
|
|
1231
1062
|
};
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
}),
|
|
1235
|
-
() =>
|
|
1236
|
-
(
|
|
1237
|
-
|
|
1063
|
+
Z(g, () => {
|
|
1064
|
+
q(ie), g.value === "" && c.mode === "single" && (P.value = "single");
|
|
1065
|
+
}), Z(
|
|
1066
|
+
() => _.value,
|
|
1067
|
+
(s) => {
|
|
1068
|
+
s && (P.value = "multiple");
|
|
1238
1069
|
}
|
|
1239
|
-
)
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
stopSpeech: we,
|
|
1253
|
-
activateTemplateFirstField: Ce,
|
|
1254
|
-
setTemplate: Ke
|
|
1255
|
-
}), (d, k) => (D(), A("div", {
|
|
1070
|
+
);
|
|
1071
|
+
const Fe = () => {
|
|
1072
|
+
p.value && p.value.activateFirstField();
|
|
1073
|
+
};
|
|
1074
|
+
return r({
|
|
1075
|
+
focus: re,
|
|
1076
|
+
blur: xe,
|
|
1077
|
+
clear: ye,
|
|
1078
|
+
submit: u,
|
|
1079
|
+
startSpeech: Re,
|
|
1080
|
+
stopSpeech: Oe,
|
|
1081
|
+
activateTemplateFirstField: Fe
|
|
1082
|
+
}), (s, T) => (m(), R("div", {
|
|
1256
1083
|
ref_key: "senderRef",
|
|
1257
|
-
ref:
|
|
1258
|
-
class:
|
|
1259
|
-
"data-theme":
|
|
1084
|
+
ref: n,
|
|
1085
|
+
class: ee(["tiny-sender", [Ue.value, `theme-${s.theme}`, `mode-${P.value}`]]),
|
|
1086
|
+
"data-theme": s.theme
|
|
1260
1087
|
}, [
|
|
1261
|
-
|
|
1262
|
-
|
|
1088
|
+
A("div", At, [
|
|
1089
|
+
A("div", {
|
|
1263
1090
|
class: "tiny-sender__input-wrapper",
|
|
1264
1091
|
ref_key: "inputWrapperRef",
|
|
1265
|
-
ref:
|
|
1092
|
+
ref: C
|
|
1266
1093
|
}, [
|
|
1267
|
-
|
|
1268
|
-
default:
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
])) :
|
|
1094
|
+
j(Ee, { name: "tiny-sender-slide-down" }, {
|
|
1095
|
+
default: pe(() => [
|
|
1096
|
+
s.$slots.header ? (m(), R("div", Vt, [
|
|
1097
|
+
ae(s.$slots, "header")
|
|
1098
|
+
])) : K("", !0)
|
|
1272
1099
|
]),
|
|
1273
1100
|
_: 3
|
|
1274
1101
|
}),
|
|
1275
|
-
|
|
1276
|
-
class:
|
|
1102
|
+
A("div", {
|
|
1103
|
+
class: ee(["tiny-sender__input-row", { "has-prefix": s.$slots.prefix, "has-header": s.$slots.header }])
|
|
1277
1104
|
}, [
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
])) :
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
])) :
|
|
1285
|
-
|
|
1105
|
+
s.$slots.prefix ? (m(), R("div", Nt, [
|
|
1106
|
+
ae(s.$slots, "prefix")
|
|
1107
|
+
])) : K("", !0),
|
|
1108
|
+
A("div", Mt, [
|
|
1109
|
+
s.$slots.decorativeContent ? (m(), R("div", qt, [
|
|
1110
|
+
ae(s.$slots, "decorativeContent")
|
|
1111
|
+
])) : K("", !0),
|
|
1112
|
+
_.value ? (m(), X(Dt, {
|
|
1286
1113
|
key: 1,
|
|
1287
1114
|
ref_key: "templateEditorRef",
|
|
1288
|
-
ref:
|
|
1289
|
-
value:
|
|
1290
|
-
"onUpdate:
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
G(E(ft), {
|
|
1115
|
+
ref: p,
|
|
1116
|
+
"model-value": c.templateData,
|
|
1117
|
+
"onUpdate:modelValue": ue,
|
|
1118
|
+
onSubmit: k(u)
|
|
1119
|
+
}, null, 8, ["model-value", "onSubmit"])) : (m(), R("div", Ut, [
|
|
1120
|
+
j(k(rt), {
|
|
1295
1121
|
ref_key: "inputRef",
|
|
1296
|
-
ref:
|
|
1297
|
-
autosize:
|
|
1298
|
-
type:
|
|
1299
|
-
readonly: Ee.value,
|
|
1122
|
+
ref: w,
|
|
1123
|
+
autosize: s.autoSize,
|
|
1124
|
+
type: b.value,
|
|
1300
1125
|
resize: "none",
|
|
1301
|
-
modelValue:
|
|
1302
|
-
"onUpdate:modelValue":
|
|
1303
|
-
disabled:
|
|
1304
|
-
placeholder:
|
|
1305
|
-
autofocus:
|
|
1306
|
-
onKeydown:
|
|
1307
|
-
onCompositionstart:
|
|
1308
|
-
onCompositionend:
|
|
1309
|
-
onFocus:
|
|
1310
|
-
onBlur:
|
|
1311
|
-
}, null, 8, ["autosize", "type", "
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
])) :
|
|
1126
|
+
modelValue: k(g),
|
|
1127
|
+
"onUpdate:modelValue": T[0] || (T[0] = (B) => it(g) ? g.value = B : null),
|
|
1128
|
+
disabled: Y.value,
|
|
1129
|
+
placeholder: s.placeholder,
|
|
1130
|
+
autofocus: s.autofocus,
|
|
1131
|
+
onKeydown: k(o),
|
|
1132
|
+
onCompositionstart: T[1] || (T[1] = (B) => I.value = !0),
|
|
1133
|
+
onCompositionend: je,
|
|
1134
|
+
onFocus: l,
|
|
1135
|
+
onBlur: f
|
|
1136
|
+
}, null, 8, ["autosize", "type", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
|
|
1137
|
+
k(z) && !k(I) ? (m(), R("div", zt, [
|
|
1138
|
+
A("span", jt, le(k(g)), 1),
|
|
1139
|
+
Ne(le(k(z)) + " ", 1),
|
|
1140
|
+
k(te) ? (m(), R("div", Xt, "TAB")) : K("", !0)
|
|
1141
|
+
])) : K("", !0)
|
|
1317
1142
|
]))
|
|
1318
1143
|
]),
|
|
1319
|
-
|
|
1320
|
-
|
|
1144
|
+
P.value === "single" ? (m(), R("div", Jt, [
|
|
1145
|
+
A("div", {
|
|
1321
1146
|
class: "tiny-sender__buttons-container",
|
|
1322
1147
|
ref_key: "buttonsContainerRef",
|
|
1323
|
-
ref:
|
|
1148
|
+
ref: h
|
|
1324
1149
|
}, [
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
"allow-speech":
|
|
1328
|
-
"allow-files":
|
|
1329
|
-
loading:
|
|
1330
|
-
disabled:
|
|
1331
|
-
"show-clear":
|
|
1332
|
-
"has-content":
|
|
1333
|
-
"speech-status":
|
|
1334
|
-
"submit-type":
|
|
1335
|
-
"is-over-limit":
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1150
|
+
ae(s.$slots, "actions"),
|
|
1151
|
+
j(qe, {
|
|
1152
|
+
"allow-speech": s.allowSpeech,
|
|
1153
|
+
"allow-files": s.allowFiles,
|
|
1154
|
+
loading: s.loading,
|
|
1155
|
+
disabled: Y.value,
|
|
1156
|
+
"show-clear": s.clearable,
|
|
1157
|
+
"has-content": L.value,
|
|
1158
|
+
"speech-status": k(oe),
|
|
1159
|
+
"submit-type": s.submitType,
|
|
1160
|
+
"is-over-limit": t.value,
|
|
1161
|
+
"stop-text": s.stopText,
|
|
1162
|
+
onClear: ye,
|
|
1163
|
+
onToggleSpeech: e,
|
|
1164
|
+
onSubmit: k(u),
|
|
1165
|
+
onCancel: T[2] || (T[2] = (B) => s.$emit("cancel"))
|
|
1166
|
+
}, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "submit-type", "is-over-limit", "stop-text", "onSubmit"])
|
|
1341
1167
|
], 512)
|
|
1342
|
-
])) :
|
|
1168
|
+
])) : K("", !0)
|
|
1343
1169
|
], 2),
|
|
1344
|
-
|
|
1345
|
-
default:
|
|
1346
|
-
|
|
1170
|
+
j(Ee, { name: "tiny-sender-slide-up" }, {
|
|
1171
|
+
default: pe(() => [
|
|
1172
|
+
P.value === "multiple" ? (m(), R("div", {
|
|
1347
1173
|
key: 0,
|
|
1348
|
-
style:
|
|
1174
|
+
style: De(S.value),
|
|
1349
1175
|
class: "tiny-sender__footer-slot tiny-sender__bottom-row"
|
|
1350
1176
|
}, [
|
|
1351
|
-
|
|
1352
|
-
|
|
1177
|
+
A("div", Gt, [
|
|
1178
|
+
ae(s.$slots, "footer-left")
|
|
1353
1179
|
]),
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1180
|
+
A("div", Qt, [
|
|
1181
|
+
ae(s.$slots, "footer-right"),
|
|
1182
|
+
s.showWordLimit && s.maxLength !== 1 / 0 ? (m(), R("div", {
|
|
1357
1183
|
key: 0,
|
|
1358
|
-
class:
|
|
1184
|
+
class: ee(["tiny-sender__word-limit", { "is-over-limit": t.value }])
|
|
1359
1185
|
}, [
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
], 2)) :
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
"allow-speech":
|
|
1367
|
-
"allow-files":
|
|
1368
|
-
loading:
|
|
1369
|
-
disabled:
|
|
1370
|
-
"show-clear":
|
|
1371
|
-
"has-content":
|
|
1372
|
-
"speech-status":
|
|
1373
|
-
"submit-type":
|
|
1374
|
-
"is-over-limit":
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1186
|
+
A("span", Yt, le(k(g).length), 1),
|
|
1187
|
+
Ne("/" + le(s.maxLength), 1)
|
|
1188
|
+
], 2)) : K("", !0),
|
|
1189
|
+
P.value === "multiple" ? (m(), R("div", Zt, [
|
|
1190
|
+
A("div", en, [
|
|
1191
|
+
j(qe, {
|
|
1192
|
+
"allow-speech": s.allowSpeech,
|
|
1193
|
+
"allow-files": s.allowFiles,
|
|
1194
|
+
loading: s.loading,
|
|
1195
|
+
disabled: Y.value,
|
|
1196
|
+
"show-clear": s.clearable,
|
|
1197
|
+
"has-content": L.value,
|
|
1198
|
+
"speech-status": k(oe),
|
|
1199
|
+
"submit-type": s.submitType,
|
|
1200
|
+
"is-over-limit": t.value,
|
|
1201
|
+
"stop-text": s.stopText,
|
|
1202
|
+
onClear: ye,
|
|
1203
|
+
onToggleSpeech: e,
|
|
1204
|
+
onSubmit: k(u),
|
|
1205
|
+
onCancel: T[3] || (T[3] = (B) => s.$emit("cancel"))
|
|
1206
|
+
}, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "submit-type", "is-over-limit", "stop-text", "onSubmit"])
|
|
1380
1207
|
])
|
|
1381
|
-
])) :
|
|
1208
|
+
])) : K("", !0)
|
|
1382
1209
|
])
|
|
1383
|
-
], 4)) :
|
|
1384
|
-
|
|
1385
|
-
])) :
|
|
1210
|
+
], 4)) : s.$slots.footer ? (m(), R("div", tn, [
|
|
1211
|
+
ae(s.$slots, "footer")
|
|
1212
|
+
])) : K("", !0)
|
|
1386
1213
|
]),
|
|
1387
1214
|
_: 3
|
|
1388
1215
|
})
|
|
1389
1216
|
], 512)
|
|
1390
1217
|
]),
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
(...Z) => E(l) && E(l)(...Z)),
|
|
1406
|
-
onMousedown: dt((Z) => E(C)(F), ["prevent"])
|
|
1407
|
-
}, [
|
|
1408
|
-
G(E(St), { class: "suggestion-item__icon" }),
|
|
1409
|
-
U("span", en, [
|
|
1410
|
-
(D(!0), A(Ae, null, Me(E(n)(F, E(a)), (Z, ge) => (D(), A("span", {
|
|
1411
|
-
key: ge,
|
|
1412
|
-
class: ae({ "suggestion-item__text--match": Z.isMatch, "suggestion-item__text--normal": !Z.isMatch })
|
|
1413
|
-
}, le(Z.text), 3))), 128))
|
|
1414
|
-
])
|
|
1415
|
-
], 42, Yt))), 128))
|
|
1416
|
-
], 4)) : H("", !0)
|
|
1417
|
-
]),
|
|
1418
|
-
_: 1
|
|
1419
|
-
}),
|
|
1420
|
-
oe.value ? (D(), A("div", tn, le(oe.value), 1)) : H("", !0)
|
|
1421
|
-
], 10, Mt));
|
|
1218
|
+
j(Kt, {
|
|
1219
|
+
ref_key: "suggestionsListRef",
|
|
1220
|
+
ref: v,
|
|
1221
|
+
show: k($),
|
|
1222
|
+
suggestions: k(F),
|
|
1223
|
+
"popup-style": ze.value,
|
|
1224
|
+
"is-item-highlighted": k(W),
|
|
1225
|
+
"highlight-suggestion-text": k(ne),
|
|
1226
|
+
"input-value": k(g),
|
|
1227
|
+
onItemHover: k(N),
|
|
1228
|
+
onItemLeave: k(M),
|
|
1229
|
+
onSelect: k(de)
|
|
1230
|
+
}, null, 8, ["show", "suggestions", "popup-style", "is-item-highlighted", "highlight-suggestion-text", "input-value", "onItemHover", "onItemLeave", "onSelect"])
|
|
1231
|
+
], 10, Wt));
|
|
1422
1232
|
}
|
|
1423
1233
|
});
|
|
1424
|
-
|
|
1425
|
-
const nn = function(
|
|
1426
|
-
|
|
1234
|
+
_e.name = "TrSender";
|
|
1235
|
+
const nn = function(i) {
|
|
1236
|
+
i.component(_e.name, _e);
|
|
1427
1237
|
};
|
|
1428
|
-
|
|
1238
|
+
_e.install = nn;
|
|
1429
1239
|
export {
|
|
1430
|
-
|
|
1240
|
+
_e as default
|
|
1431
1241
|
};
|