@opentiny/tiny-robot 0.3.5 → 0.3.6-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,115 +1,115 @@
1
- var ft = Object.defineProperty;
2
- var pt = (t, i, a) => i in t ? ft(t, i, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[i] = a;
3
- var Ne = (t, i, a) => pt(t, typeof i != "symbol" ? i + "" : i, a);
4
- import { ref as A, watch as ne, reactive as ht, onUnmounted as st, computed as B, defineComponent as Ce, isVNode as vt, openBlock as m, createElementBlock as R, normalizeStyle as Ae, createBlock as oe, unref as k, withCtx as me, createElementVNode as G, createVNode as ee, normalizeClass as se, createCommentVNode as M, resolveDynamicComponent as yt, toDisplayString as fe, useAttrs as gt, resolveComponent as mt, mergeProps as Se, Fragment as we, renderList as xe, useModel as wt, onMounted as bt, nextTick as q, mergeModels as tt, Transition as qe, withModifiers as St, useSlots as xt, onBeforeUnmount as Ct, toRef as ze, renderSlot as ce, isRef as _t, createTextVNode as nt } from "vue";
5
- import { TinyTooltip as Ue, TinyInput as It } from "@opentiny/vue";
6
- import { g as kt, f as Rt } from "../index4.js";
7
- import { IconVoice as Tt, IconUpload as Et, IconRecordingWave as Ot, IconClear as $t, IconSend as Bt, IconStop as Lt, IconAssociate as Dt } from "@opentiny/tiny-robot-svgs";
8
- import { _ as _e } from "../_plugin-vue_export-helper.js";
9
- import { t as Pt } from "../utils.js";
10
- function Kt(t, i) {
11
- const a = A(t.modelValue || t.defaultValue || ""), l = A(null);
12
- ne(
1
+ var gt = Object.defineProperty;
2
+ var mt = (t, i, a) => i in t ? gt(t, i, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[i] = a;
3
+ var qe = (t, i, a) => mt(t, typeof i != "symbol" ? i + "" : i, a);
4
+ import { ref as K, watch as ie, reactive as wt, onUnmounted as rt, computed as $, defineComponent as Te, isVNode as bt, openBlock as m, createElementBlock as E, normalizeStyle as Ve, createBlock as ae, unref as I, withCtx as we, createElementVNode as q, createVNode as se, normalizeClass as le, createCommentVNode as N, resolveDynamicComponent as St, toDisplayString as he, useAttrs as xt, resolveComponent as Ct, mergeProps as Re, Fragment as be, renderList as ke, useModel as _t, onMounted as It, nextTick as G, mergeModels as st, Transition as Ye, withModifiers as Rt, useSlots as kt, onBeforeUnmount as Tt, toRef as je, renderSlot as ue, isRef as Et, createTextVNode as it } from "vue";
5
+ import { TinyTooltip as Je, TinyInput as Ot } from "@opentiny/vue";
6
+ import { g as at, f as $t } from "../index4.js";
7
+ import { IconVoice as Bt, IconUpload as Lt, IconRecordingWave as Dt, IconClear as Pt, IconSend as Kt, IconStop as At, IconAssociate as Ht } from "@opentiny/tiny-robot-svgs";
8
+ import { _ as Ee } from "../_plugin-vue_export-helper.js";
9
+ import { t as Vt } from "../utils.js";
10
+ function Ft(t, i) {
11
+ const a = K(t.modelValue || t.defaultValue || ""), l = K(null);
12
+ ie(
13
13
  () => t.modelValue,
14
14
  (g) => {
15
15
  g !== void 0 && g !== a.value && (a.value = g);
16
16
  }
17
- ), ne(
17
+ ), ie(
18
18
  () => a.value,
19
19
  (g) => {
20
20
  i("update:modelValue", g);
21
21
  }
22
22
  );
23
- const p = (g) => {
23
+ const f = (g) => {
24
24
  a.value = g, i("update:modelValue", g);
25
- }, I = (g) => {
25
+ }, C = (g) => {
26
26
  g == null || g.preventDefault();
27
- const T = a.value;
28
- !t.disabled && !t.loading && T.trim() && i("submit", T);
27
+ const O = a.value;
28
+ !t.disabled && !t.loading && O.trim() && i("submit", O);
29
29
  }, h = () => {
30
30
  a.value = "", i("update:modelValue", ""), i("clear");
31
- }, v = A(!1);
31
+ }, v = K(!1);
32
32
  return {
33
33
  inputValue: a,
34
34
  inputWrapper: l,
35
35
  isComposing: v,
36
- handleChange: p,
37
- handleSubmit: I,
36
+ handleChange: f,
37
+ handleSubmit: C,
38
38
  handleClear: h,
39
39
  clearInput: () => {
40
40
  h();
41
41
  }
42
42
  };
43
43
  }
44
- function At(t, i, a, l, p, I, h, v, y, g, T, L, D, H, _, V) {
45
- const j = () => {
44
+ function Wt(t, i, a, l, f, C, h, v, y, g, O, L, A, M, F, H) {
45
+ const _ = () => {
46
46
  if (!L.value) return;
47
- const f = a.value.trim();
48
- if (_ != null && _.value && Array.isArray(t.templateData)) {
49
- const S = t.templateData.map(({ id: z, ...Z }) => Z);
50
- i("submit", f, S), V == null || V();
47
+ const u = a.value.trim();
48
+ if (F != null && F.value && Array.isArray(t.templateData)) {
49
+ const S = t.templateData.map(({ id: j, ...Z }) => Z);
50
+ i("submit", u, S), H == null || H();
51
51
  } else
52
- i("submit", f);
53
- }, E = (f, S) => {
54
- if (!(f.key === "Enter")) return !1;
52
+ i("submit", u);
53
+ }, k = (u, S) => {
54
+ if (!(u.key === "Enter")) return !1;
55
55
  switch (S) {
56
56
  case "enter":
57
- return !f.shiftKey && !f.ctrlKey && !f.metaKey;
57
+ return !u.shiftKey && !u.ctrlKey && !u.metaKey;
58
58
  case "ctrlEnter":
59
- return (f.ctrlKey || f.metaKey) && !f.shiftKey;
59
+ return (u.ctrlKey || u.metaKey) && !u.shiftKey;
60
60
  case "shiftEnter":
61
- return f.shiftKey && !f.ctrlKey && !f.metaKey;
61
+ return u.shiftKey && !u.ctrlKey && !u.metaKey;
62
62
  default:
63
63
  return !1;
64
64
  }
65
- }, W = (f) => {
66
- const S = f.selectionStart ?? 0, z = f.selectionEnd ?? S, Z = a.value;
65
+ }, z = (u) => {
66
+ const S = u.selectionStart ?? 0, j = u.selectionEnd ?? S, Z = a.value;
67
67
  a.value = Z.substring(0, S) + `
68
- ` + Z.substring(z), setTimeout(() => {
69
- const K = S + 1;
70
- f.selectionStart = f.selectionEnd = K, f.scrollTop = f.scrollHeight;
68
+ ` + Z.substring(j), setTimeout(() => {
69
+ const D = S + 1;
70
+ u.selectionStart = u.selectionEnd = D, u.scrollTop = u.scrollHeight;
71
71
  }, 0);
72
- }, b = (f) => {
73
- if (t.submitType !== "enter" || f.key !== "Enter") return !1;
74
- const S = f.ctrlKey && !f.shiftKey, z = f.shiftKey && !f.ctrlKey;
75
- if (S || z) {
76
- f.preventDefault();
77
- const Z = f.target;
78
- return (D == null ? void 0 : D.value) === "single" && H && H(), W(Z), !0;
72
+ }, b = (u) => {
73
+ if (t.submitType !== "enter" || u.key !== "Enter") return !1;
74
+ const S = u.ctrlKey && !u.shiftKey, j = u.shiftKey && !u.ctrlKey;
75
+ if (S || j) {
76
+ u.preventDefault();
77
+ const Z = u.target;
78
+ return (A == null ? void 0 : A.value) === "single" && M && M(), z(Z), !0;
79
79
  }
80
80
  return !1;
81
81
  };
82
82
  return {
83
- handleKeyPress: (f) => {
84
- if (!l.value && !b(f)) {
85
- if (I.value) {
86
- if (f.key === "ArrowDown") {
87
- f.preventDefault(), g("down");
83
+ handleKeyPress: (u) => {
84
+ if (!l.value && !b(u)) {
85
+ if (C.value) {
86
+ if (u.key === "ArrowDown") {
87
+ u.preventDefault(), g("down");
88
88
  return;
89
89
  }
90
- if (f.key === "ArrowUp") {
91
- f.preventDefault(), g("up");
90
+ if (u.key === "ArrowUp") {
91
+ u.preventDefault(), g("up");
92
92
  return;
93
93
  }
94
- if (h.value && (t.activeSuggestionKeys || ["Enter", "Tab"]).includes(f.key)) {
95
- f.preventDefault(), v();
94
+ if (h.value && (t.activeSuggestionKeys || ["Enter", "Tab"]).includes(u.key)) {
95
+ u.preventDefault(), v();
96
96
  return;
97
97
  }
98
98
  }
99
- if (f.key === "Escape") {
100
- I.value ? (y(), f.preventDefault()) : p.isRecording && (T(), f.preventDefault()), i("escape-press");
99
+ if (u.key === "Escape") {
100
+ C.value ? (y(), u.preventDefault()) : f.isRecording && (O(), u.preventDefault()), i("escape-press");
101
101
  return;
102
102
  }
103
- E(f, t.submitType) && L.value && (f.preventDefault(), j());
103
+ k(u, t.submitType) && L.value && (u.preventDefault(), _());
104
104
  }
105
105
  },
106
- triggerSubmit: j
106
+ triggerSubmit: _
107
107
  };
108
108
  }
109
- class Pe {
109
+ class Ae {
110
110
  constructor(i) {
111
- Ne(this, "recognition");
112
- Ne(this, "options");
111
+ qe(this, "recognition");
112
+ qe(this, "options");
113
113
  this.options = i, this.initialize();
114
114
  }
115
115
  /**
@@ -128,7 +128,7 @@ class Pe {
128
128
  * 检查浏览器是否支持 Web Speech API(实例方法)
129
129
  */
130
130
  isSupported() {
131
- return Pe.isSupported();
131
+ return Ae.isSupported();
132
132
  }
133
133
  /**
134
134
  * 设置语音识别事件处理器
@@ -140,8 +140,8 @@ class Pe {
140
140
  }, this.recognition.onend = () => {
141
141
  i.onEnd();
142
142
  }, this.recognition.onresult = (a) => {
143
- const l = Array.from(a.results).map((I) => I[0].transcript).join(""), p = a.results[a.resultIndex];
144
- p != null && p.isFinal ? i.onFinal(l) : i.onInterim(l);
143
+ const l = Array.from(a.results).map((C) => C[0].transcript).join(""), f = a.results[a.resultIndex];
144
+ f != null && f.isFinal ? i.onFinal(l) : i.onInterim(l);
145
145
  }, this.recognition.onerror = (a) => {
146
146
  i.onError(new Error(a.error)), this.cleanup();
147
147
  });
@@ -182,8 +182,8 @@ class Pe {
182
182
  }
183
183
  }
184
184
  }
185
- function Ht(t) {
186
- const i = ht({
185
+ function Mt(t) {
186
+ const i = wt({
187
187
  isRecording: !1,
188
188
  isSupported: !1,
189
189
  error: void 0
@@ -208,99 +208,99 @@ function Ht(t) {
208
208
  var y;
209
209
  i.error = v, i.isRecording = !1, (y = t.onError) == null || y.call(t, v);
210
210
  }
211
- }, l = Pe.isSupported();
211
+ }, l = Ae.isSupported();
212
212
  i.isSupported = t.customHandler ? t.customHandler.isSupported() : l;
213
- const p = t.customHandler ?? (l ? new Pe(t) : null), I = () => {
213
+ const f = t.customHandler ?? (l ? new Ae(t) : null), C = () => {
214
214
  var v;
215
- if (!i.isSupported || !p) {
215
+ if (!i.isSupported || !f) {
216
216
  const y = new Error("语音识别不受支持");
217
217
  i.error = y, (v = t.onError) == null || v.call(t, y);
218
218
  return;
219
219
  }
220
220
  if (i.isRecording) {
221
- p.stop(), i.isRecording = !1, setTimeout(() => {
222
- p.start(a);
221
+ f.stop(), i.isRecording = !1, setTimeout(() => {
222
+ f.start(a);
223
223
  }, 200);
224
224
  return;
225
225
  }
226
- p.start(a);
226
+ f.start(a);
227
227
  }, h = () => {
228
- !i.isRecording || !p || (p.stop(), a.onEnd());
228
+ !i.isRecording || !f || (f.stop(), a.onEnd());
229
229
  };
230
- return st(() => {
231
- i.isRecording && p && (p.stop(), i.isRecording = !1);
230
+ return rt(() => {
231
+ i.isRecording && f && (f.stop(), i.isRecording = !1);
232
232
  }), {
233
233
  speechState: i,
234
- start: I,
234
+ start: C,
235
235
  stop: h
236
236
  };
237
237
  }
238
- function Vt(t, i, a, l, p, I) {
239
- const h = A(!1), v = A(-1), y = A(-1), g = A(null), T = A(""), L = A(!1), D = B(() => {
240
- var J, X;
241
- if (!((J = t.value) != null && J.length)) return "";
242
- const K = g.value === "mouse" ? y.value : v.value;
243
- return ((X = t.value[K]) == null ? void 0 : X.content) || "";
244
- }), H = (K) => {
245
- T.value = K, L.value = !0;
246
- }, _ = () => {
247
- T.value = "", L.value = !1;
248
- }, V = (K) => {
249
- const J = K || D.value;
250
- if (!J || !i.value) {
251
- _();
238
+ function Nt(t, i, a, l, f, C) {
239
+ const h = K(!1), v = K(-1), y = K(-1), g = K(null), O = K(""), L = K(!1), A = $(() => {
240
+ var Q, J;
241
+ if (!((Q = t.value) != null && Q.length)) return "";
242
+ const D = g.value === "mouse" ? y.value : v.value;
243
+ return ((J = t.value[D]) == null ? void 0 : J.content) || "";
244
+ }), M = (D) => {
245
+ O.value = D, L.value = !0;
246
+ }, F = () => {
247
+ O.value = "", L.value = !1;
248
+ }, H = (D) => {
249
+ const Q = D || A.value;
250
+ if (!Q || !i.value) {
251
+ F();
252
252
  return;
253
253
  }
254
- const X = J.substring(i.value.length);
255
- J.toLowerCase().startsWith(i.value.toLowerCase()) && X ? H(X) : _();
256
- }, j = () => {
254
+ const J = Q.substring(i.value.length);
255
+ Q.toLowerCase().startsWith(i.value.toLowerCase()) && J ? M(J) : F();
256
+ }, _ = () => {
257
257
  v.value = -1, y.value = -1, g.value = null;
258
- }, E = () => {
259
- h.value = !0, V();
260
- }, W = () => {
261
- h.value = !1, j(), _();
262
- }, b = B(() => {
263
- var K;
264
- return a.value ? !0 : !!(i.value && ((K = t.value) == null ? void 0 : K.length) > 0 && !l.value);
265
- }), x = (K) => {
266
- W(), i.value = K, p(K), I(K);
267
- }, f = () => {
268
- D.value && x(D.value);
269
- }, S = (K) => {
270
- !h.value || !t.value || (g.value = "keyboard", v.value === -1 ? v.value = K === "down" ? 0 : t.value.length - 1 : K === "down" ? v.value = (v.value + 1) % t.value.length : v.value = (v.value - 1 + t.value.length) % t.value.length, V());
271
- }, z = (K) => {
272
- t.value && (g.value = "mouse", y.value = K, V());
258
+ }, k = () => {
259
+ h.value = !0, H();
260
+ }, z = () => {
261
+ h.value = !1, _(), F();
262
+ }, b = $(() => {
263
+ var D;
264
+ return a.value ? !0 : !!(i.value && ((D = t.value) == null ? void 0 : D.length) > 0 && !l.value);
265
+ }), x = (D) => {
266
+ z(), i.value = D, f(D), C(D);
267
+ }, u = () => {
268
+ A.value && x(A.value);
269
+ }, S = (D) => {
270
+ !h.value || !t.value || (g.value = "keyboard", v.value === -1 ? v.value = D === "down" ? 0 : t.value.length - 1 : D === "down" ? v.value = (v.value + 1) % t.value.length : v.value = (v.value - 1 + t.value.length) % t.value.length, H());
271
+ }, j = (D) => {
272
+ t.value && (g.value = "mouse", y.value = D, H());
273
273
  }, Z = () => {
274
- t.value && (y.value = -1, v.value !== -1 ? g.value = "keyboard" : g.value = null, V());
274
+ t.value && (y.value = -1, v.value !== -1 ? g.value = "keyboard" : g.value = null, H());
275
275
  };
276
- return ne(b, (K) => {
277
- K ? h.value || E() : h.value && W();
276
+ return ie(b, (D) => {
277
+ D ? h.value || k() : h.value && z();
278
278
  }), {
279
279
  // 弹窗控制
280
280
  isPopupVisible: h,
281
- openPopup: E,
282
- closePopup: W,
281
+ openPopup: k,
282
+ closePopup: z,
283
283
  // 自动完成占位符
284
- autoCompleteText: T,
284
+ autoCompleteText: O,
285
285
  showTabIndicator: L,
286
- syncAutoComplete: V,
286
+ syncAutoComplete: H,
287
287
  // 选中控制层
288
- activeSuggestion: D,
288
+ activeSuggestion: A,
289
289
  activeKeyboardIndex: v,
290
290
  activeMouseIndex: y,
291
291
  // 交互处理
292
292
  navigateWithKeyboard: S,
293
- handleMouseEnter: z,
293
+ handleMouseEnter: j,
294
294
  handleMouseLeave: Z,
295
295
  // 业务操作
296
296
  applySuggestion: x,
297
- confirmSelection: f
297
+ confirmSelection: u
298
298
  };
299
299
  }
300
- const Ft = { class: "action-buttons" }, Mt = { class: "action-buttons__submit-content" }, Wt = {
300
+ const zt = { class: "action-buttons" }, Ut = { class: "action-buttons__submit-content" }, Gt = {
301
301
  key: 0,
302
302
  class: "action-buttons__cancel-text"
303
- }, Nt = /* @__PURE__ */ Ce({
303
+ }, qt = /* @__PURE__ */ Te({
304
304
  __name: "ActionButtons",
305
305
  props: {
306
306
  loading: { type: Boolean, default: !1 },
@@ -321,149 +321,149 @@ const Ft = { class: "action-buttons" }, Mt = { class: "action-buttons__submit-co
321
321
  },
322
322
  emits: ["clear", "submit", "cancel", "trigger-select", "voice-button-click"],
323
323
  setup(t, { emit: i }) {
324
- const a = t, l = i, p = B(() => {
325
- var x, f;
326
- const b = (f = (x = a.buttonGroup) == null ? void 0 : x.file) == null ? void 0 : f.tooltips;
324
+ const a = t, l = i, f = $(() => {
325
+ var x, u;
326
+ const b = (u = (x = a.buttonGroup) == null ? void 0 : x.file) == null ? void 0 : u.tooltips;
327
327
  if (typeof b == "string" && b)
328
328
  return () => b;
329
329
  if (typeof b == "function")
330
330
  return b;
331
- }), I = B(() => {
332
- var x, f;
333
- const b = (f = (x = a.buttonGroup) == null ? void 0 : x.submit) == null ? void 0 : f.tooltips;
331
+ }), C = $(() => {
332
+ var x, u;
333
+ const b = (u = (x = a.buttonGroup) == null ? void 0 : x.submit) == null ? void 0 : u.tooltips;
334
334
  if (typeof b == "string" && b)
335
335
  return () => b;
336
336
  if (typeof b == "function")
337
337
  return b;
338
- }), h = B(() => a.allowSpeech), v = B(() => a.speechStatus.isRecording), y = B(() => a.disabled), g = B(() => {
338
+ }), h = $(() => a.allowSpeech), v = $(() => a.speechStatus.isRecording), y = $(() => a.disabled), g = $(() => {
339
339
  var b, x;
340
340
  return y.value || a.isOverLimit || ((x = (b = a.buttonGroup) == null ? void 0 : b.submit) == null ? void 0 : x.disabled);
341
- }), T = B(() => a.allowFiles || a.allowSpeech || a.showClear), L = B(() => {
342
- var x, f;
343
- const b = (f = (x = a.buttonGroup) == null ? void 0 : x.voice) == null ? void 0 : f.icon;
344
- return b ? vt(b) ? () => b : b : Tt;
345
- }), D = () => {
341
+ }), O = $(() => a.allowFiles || a.allowSpeech || a.showClear), L = $(() => {
342
+ var x, u;
343
+ const b = (u = (x = a.buttonGroup) == null ? void 0 : x.voice) == null ? void 0 : u.icon;
344
+ return b ? bt(b) ? () => b : b : Bt;
345
+ }), A = () => {
346
346
  y.value || l("clear");
347
- }, H = () => {
347
+ }, M = () => {
348
348
  y.value || l("voice-button-click");
349
- }, _ = () => {
349
+ }, F = () => {
350
350
  g.value || l("submit");
351
- }, V = () => {
351
+ }, H = () => {
352
352
  y.value || l("cancel");
353
- }, j = B(() => {
353
+ }, _ = $(() => {
354
354
  var b, x;
355
355
  return y.value || ((x = (b = a.buttonGroup) == null ? void 0 : b.file) == null ? void 0 : x.disabled);
356
- }), E = () => {
357
- j.value || l("trigger-select");
358
- }, W = B(() => {
356
+ }), k = () => {
357
+ _.value || l("trigger-select");
358
+ }, z = $(() => {
359
359
  var b, x;
360
360
  return ((x = (b = a.buttonGroup) == null ? void 0 : b.file) == null ? void 0 : x.tooltipPlacement) || "top";
361
361
  });
362
- return (b, x) => (m(), R("div", Ft, [
363
- T.value ? (m(), R("div", {
362
+ return (b, x) => (m(), E("div", zt, [
363
+ O.value ? (m(), E("div", {
364
364
  key: 0,
365
365
  class: "action-buttons__utility",
366
- style: Ae({ "padding-right": t.hasContent || t.loading ? "0" : "6px" })
366
+ style: Ve({ "padding-right": t.hasContent || t.loading ? "0" : "6px" })
367
367
  }, [
368
- t.allowFiles && !t.loading ? (m(), oe(k(Ue), {
368
+ t.allowFiles && !t.loading ? (m(), ae(I(Je), {
369
369
  key: 0,
370
370
  effect: "light",
371
- placement: W.value,
372
- "render-content": p.value,
371
+ placement: z.value,
372
+ "render-content": f.value,
373
373
  "visible-arrow": !1,
374
374
  "popper-class": "tr-sender-actions-upload-button-popper"
375
375
  }, {
376
- default: me(() => [
377
- G("div", {
376
+ default: we(() => [
377
+ q("div", {
378
378
  class: "action-buttons__button",
379
- onClick: E,
380
- onFocusCapture: x[0] || (x[0] = (f) => f.stopPropagation())
379
+ onClick: k,
380
+ onFocusCapture: x[0] || (x[0] = (u) => u.stopPropagation())
381
381
  }, [
382
- ee(k(Et), {
383
- class: se(["action-buttons__icon", { "is-disabled": j.value }]),
382
+ se(I(Lt), {
383
+ class: le(["action-buttons__icon", { "is-disabled": _.value }]),
384
384
  alt: "上传文件"
385
385
  }, null, 8, ["class"])
386
386
  ], 32)
387
387
  ]),
388
388
  _: 1
389
- }, 8, ["placement", "render-content"])) : M("", !0),
390
- h.value && !t.loading ? (m(), R("div", {
389
+ }, 8, ["placement", "render-content"])) : N("", !0),
390
+ h.value && !t.loading ? (m(), E("div", {
391
391
  key: 1,
392
- class: se(["action-buttons__button", { "is-recording": v.value }]),
393
- onClick: H
392
+ class: le(["action-buttons__button", { "is-recording": v.value }]),
393
+ onClick: M
394
394
  }, [
395
- v.value ? (m(), oe(k(Ot), {
395
+ v.value ? (m(), ae(I(Dt), {
396
396
  key: 1,
397
397
  class: "action-buttons__icon",
398
398
  alt: "语音中"
399
- })) : (m(), oe(yt(L.value), {
399
+ })) : (m(), ae(St(L.value), {
400
400
  key: 0,
401
401
  class: "action-buttons__icon",
402
402
  alt: "录音"
403
403
  }))
404
- ], 2)) : M("", !0),
405
- t.showClear && t.hasContent ? (m(), oe(k(Ue), {
404
+ ], 2)) : N("", !0),
405
+ t.showClear && t.hasContent ? (m(), ae(I(Je), {
406
406
  key: 2,
407
407
  content: "清空内容",
408
408
  placement: "top"
409
409
  }, {
410
- default: me(() => [
411
- G("div", {
410
+ default: we(() => [
411
+ q("div", {
412
412
  class: "action-buttons__button",
413
- onClick: D
413
+ onClick: A
414
414
  }, [
415
- ee(k($t), { class: "action-buttons__icon" })
415
+ se(I(Pt), { class: "action-buttons__icon" })
416
416
  ])
417
417
  ]),
418
418
  _: 1
419
- })) : M("", !0)
420
- ], 4)) : M("", !0),
421
- t.hasContent || t.loading ? (m(), R("div", {
419
+ })) : N("", !0)
420
+ ], 4)) : N("", !0),
421
+ t.hasContent || t.loading ? (m(), E("div", {
422
422
  key: 1,
423
423
  class: "action-buttons__button action-buttons__submit",
424
- onClick: x[1] || (x[1] = (f) => t.loading ? V() : _())
424
+ onClick: x[1] || (x[1] = (u) => t.loading ? H() : F())
425
425
  }, [
426
- G("div", Mt, [
427
- t.loading ? (m(), R("div", {
426
+ q("div", Ut, [
427
+ t.loading ? (m(), E("div", {
428
428
  key: 1,
429
- class: se(["action-buttons__cancel", { "action-buttons__cancel--icon-only": !t.stopText }])
429
+ class: le(["action-buttons__cancel", { "action-buttons__cancel--icon-only": !t.stopText }])
430
430
  }, [
431
- ee(k(Lt), {
431
+ se(I(At), {
432
432
  class: "action-buttons__icon action-buttons__icon--cancel",
433
433
  alt: "停止"
434
434
  }),
435
- t.stopText ? (m(), R("span", Wt, fe(t.stopText), 1)) : M("", !0)
436
- ], 2)) : (m(), oe(k(Ue), {
435
+ t.stopText ? (m(), E("span", Gt, he(t.stopText), 1)) : N("", !0)
436
+ ], 2)) : (m(), ae(I(Je), {
437
437
  key: 0,
438
438
  effect: "light",
439
439
  placement: "top",
440
- "render-content": I.value,
440
+ "render-content": C.value,
441
441
  "visible-arrow": !1
442
442
  }, {
443
- default: me(() => [
444
- ee(k(Bt), {
445
- class: se(["action-buttons__icon", "action-buttons__icon--send", { "is-disabled": g.value }]),
443
+ default: we(() => [
444
+ se(I(Kt), {
445
+ class: le(["action-buttons__icon", "action-buttons__icon--send", { "is-disabled": g.value }]),
446
446
  alt: "发送"
447
447
  }, null, 8, ["class"])
448
448
  ]),
449
449
  _: 1
450
450
  }, 8, ["render-content"]))
451
451
  ])
452
- ])) : M("", !0)
452
+ ])) : N("", !0)
453
453
  ]));
454
454
  }
455
- }), ot = /* @__PURE__ */ _e(Nt, [["__scopeId", "data-v-f71ebb23"]]);
456
- function zt(t, i = {}) {
457
- let a = [], l = [], p = t;
458
- return { commit: (T) => {
455
+ }), lt = /* @__PURE__ */ Ee(qt, [["__scopeId", "data-v-f71ebb23"]]);
456
+ function jt(t, i = {}) {
457
+ let a = [], l = [], f = t;
458
+ return { commit: (O) => {
459
459
  var L;
460
- a.push(p), p = T, l.length && ((L = i.onRemoveHistory) == null || L.call(i, l)), l = [];
461
- }, undo: () => a.length ? (l.push(p), p = a.pop(), p) : null, redo: () => l.length ? (a.push(p), p = l.pop(), p) : null, clear: () => {
462
- var T, L;
463
- a.length && ((T = i.onRemoveHistory) == null || T.call(i, a)), l.length && ((L = i.onRemoveHistory) == null || L.call(i, l)), a = [], l = [];
464
- }, get: () => p };
460
+ a.push(f), f = O, l.length && ((L = i.onRemoveHistory) == null || L.call(i, l)), l = [];
461
+ }, undo: () => a.length ? (l.push(f), f = a.pop(), f) : null, redo: () => l.length ? (a.push(f), f = l.pop(), f) : null, clear: () => {
462
+ var O, L;
463
+ a.length && ((O = i.onRemoveHistory) == null || O.call(i, a)), l.length && ((L = i.onRemoveHistory) == null || L.call(i, l)), a = [], l = [];
464
+ }, get: () => f };
465
465
  }
466
- const Ut = ["data-id", "data-type"], Gt = ["data-id", "data-type"], qt = /* @__PURE__ */ Ce({
466
+ const Jt = ["data-id", "data-type"], Xt = ["data-id", "data-type"], Yt = /* @__PURE__ */ Te({
467
467
  inheritAttrs: !1,
468
468
  __name: "Block",
469
469
  props: {
@@ -474,64 +474,64 @@ const Ut = ["data-id", "data-type"], Gt = ["data-id", "data-type"], qt = /* @__P
474
474
  asChild: { type: Boolean }
475
475
  },
476
476
  setup(t) {
477
- const i = t, a = gt();
478
- return (l, p) => {
479
- const I = mt("Block", !0);
480
- return i.type !== "block" ? (m(), R("span", Se({
477
+ const i = t, a = xt();
478
+ return (l, f) => {
479
+ const C = Ct("Block", !0);
480
+ return i.type !== "block" ? (m(), E("span", Re({
481
481
  key: 0,
482
482
  "data-id": i.id,
483
483
  "data-type": i.type
484
- }, k(a)), fe(i.content), 17, Ut)) : (m(), R(we, { key: 1 }, [
485
- i.asChild ? (m(!0), R(we, { key: 0 }, xe(i.content, (h) => (m(), oe(I, Se({
484
+ }, I(a)), he(i.content), 17, Jt)) : (m(), E(be, { key: 1 }, [
485
+ i.asChild ? (m(!0), E(be, { key: 0 }, ke(i.content, (h) => (m(), ae(C, Re({
486
486
  key: `${h.id}-${h.type}`
487
- }, { ref_for: !0 }, h), null, 16))), 128)) : (m(), R("span", Se({
487
+ }, { ref_for: !0 }, h), null, 16))), 128)) : (m(), E("span", Re({
488
488
  key: 1,
489
489
  "data-id": i.id,
490
490
  "data-type": i.type
491
- }, k(a)), [
492
- (m(!0), R(we, null, xe(i.content, (h) => (m(), oe(I, Se({
491
+ }, I(a)), [
492
+ (m(!0), E(be, null, ke(i.content, (h) => (m(), ae(C, Re({
493
493
  key: `${h.id}-${h.type}`
494
494
  }, { ref_for: !0 }, h), null, 16))), 128))
495
- ], 16, Gt))
495
+ ], 16, Xt))
496
496
  ], 64));
497
497
  };
498
498
  }
499
- }), jt = /* @__PURE__ */ _e(qt, [["__scopeId", "data-v-13862606"]]), Jt = { class: "editor-container" }, Ge = "​", Xt = 40, Yt = /* @__PURE__ */ Ce({
499
+ }), Zt = /* @__PURE__ */ Ee(Yt, [["__scopeId", "data-v-13862606"]]), Qt = { class: "editor-container" }, Xe = "​", en = 40, tn = /* @__PURE__ */ Te({
500
500
  __name: "TemplateEditor",
501
- props: /* @__PURE__ */ tt({
501
+ props: /* @__PURE__ */ st({
502
502
  autoSize: { type: [Boolean, Object] }
503
503
  }, {
504
504
  modelValue: { default: () => [] },
505
505
  modelModifiers: {}
506
506
  }),
507
- emits: /* @__PURE__ */ tt(["submit"], ["update:modelValue"]),
507
+ emits: /* @__PURE__ */ st(["submit"], ["update:modelValue"]),
508
508
  setup(t, { expose: i, emit: a }) {
509
- const l = typeof window.ShadowRoot.prototype.getSelection == "function", p = typeof window.Selection.prototype.getComposedRanges == "function";
510
- function I() {
509
+ const l = typeof window.ShadowRoot.prototype.getSelection == "function", f = typeof window.Selection.prototype.getComposedRanges == "function";
510
+ function C() {
511
511
  const e = navigator.userAgent;
512
512
  return e.includes("Safari") && !e.includes("Chrome") && !e.includes("Chromium") && !e.includes("CriOS");
513
513
  }
514
- const h = I(), v = () => Math.random().toString(36).substring(2, 15), y = Ge, g = Ge, T = Ge, L = t, D = wt(t, "modelValue"), H = a, _ = A(0), V = (e) => e.map((n) => ({
514
+ const h = C(), v = () => Math.random().toString(36).substring(2, 15), y = Xe, g = Xe, O = Xe, L = t, A = _t(t, "modelValue"), M = a, F = K(0), H = (e) => e.map((n) => ({
515
515
  id: n.id || v(),
516
- ...n.type === "template" ? { ...n, prefix: g, suffix: T } : n
517
- })), j = (e) => e.map((n) => ({ id: n.id, type: n.type, content: n.content })), E = A(V(D.value || [])), W = (e) => {
518
- E.value = e;
519
- }, b = B(() => {
520
- const e = [], n = [], o = E.value;
516
+ ...n.type === "template" ? { ...n, prefix: g, suffix: O } : n
517
+ })), _ = (e) => e.map((n) => ({ id: n.id, type: n.type, content: n.content })), k = K(H(A.value || [])), z = (e) => {
518
+ k.value = e;
519
+ }, b = $(() => {
520
+ const e = [], n = [], o = k.value;
521
521
  if (o.length >= 2) {
522
- const c = o[0], d = o[1];
523
- c.type === "text" && c.content.length === 0 && d.type === "template" && e.push({ ...c, content: y });
524
- const w = o[o.length - 1], O = o[o.length - 2];
525
- w.type === "text" && w.content.length === 0 && O.type === "template" && n.push({ ...w, content: y });
522
+ const r = o[0], d = o[1];
523
+ r.type === "text" && r.content.length === 0 && d.type === "template" && e.push({ ...r, content: y });
524
+ const w = o[o.length - 1], T = o[o.length - 2];
525
+ w.type === "text" && w.content.length === 0 && T.type === "template" && n.push({ ...w, content: y });
526
526
  }
527
527
  o.length > 0 && o[0].type === "template" && e.push({ type: "text", content: y, id: v() }), o.length > 0 && o[o.length - 1].type === "template" && n.push({ type: "text", content: y, id: v() });
528
- const r = new RegExp(y, "g");
529
- return o.length > 0 && (o[0].content !== y && (o[0].content = o[0].content.replace(r, "")), o[o.length - 1].content !== y && (o[o.length - 1].content = o[o.length - 1].content.replace(r, ""))), e.concat(o).concat(n);
530
- }), x = B(() => E.value.map((e) => e.type === "template" ? [
528
+ const c = new RegExp(y, "g");
529
+ return o.length > 0 && (o[0].content !== y && (o[0].content = o[0].content.replace(c, "")), o[o.length - 1].content !== y && (o[o.length - 1].content = o[o.length - 1].content.replace(c, ""))), e.concat(o).concat(n);
530
+ }), x = $(() => k.value.map((e) => e.type === "template" ? [
531
531
  { id: e.id, type: "prefix", content: e.prefix },
532
532
  { id: e.id, type: "template", content: e.content },
533
533
  { id: e.id, type: "suffix", content: e.suffix }
534
- ] : [e]).flat()), f = B(() => b.value.map((e) => e.type === "text" ? e : h ? {
534
+ ] : [e]).flat()), u = $(() => b.value.map((e) => e.type === "text" ? e : h ? {
535
535
  id: e.id,
536
536
  type: "block",
537
537
  asChild: !0,
@@ -561,115 +561,115 @@ const Ut = ["data-id", "data-type"], Gt = ["data-id", "data-type"], qt = /* @__P
561
561
  },
562
562
  { id: e.id, type: "suffix", content: e.suffix }
563
563
  ]
564
- })), S = A(null), z = A(Xt), Z = () => {
564
+ })), S = K(null), j = K(en), Z = () => {
565
565
  if (!S.value) return;
566
566
  const e = window.getComputedStyle(S.value), n = parseFloat(e.fontSize), o = parseFloat(e.lineHeight);
567
- z.value = isNaN(o) ? n * 2.5 : o;
568
- }, K = B(() => {
567
+ j.value = isNaN(o) ? n * 2.5 : o;
568
+ }, D = $(() => {
569
569
  if (!L.autoSize)
570
570
  return {};
571
- const e = typeof L.autoSize == "boolean" ? { minRows: 1, maxRows: 3 } : L.autoSize, n = e.minRows * z.value, o = e.maxRows * z.value;
571
+ const e = typeof L.autoSize == "boolean" ? { minRows: 1, maxRows: 3 } : L.autoSize, n = e.minRows * j.value, o = e.maxRows * j.value;
572
572
  return {
573
573
  minHeight: `${n}px`,
574
574
  maxHeight: `${o}px`,
575
575
  overflowY: "auto",
576
576
  overflowX: "hidden"
577
577
  };
578
- }), J = () => {
578
+ }), Q = () => {
579
579
  if (!S.value) return;
580
580
  const e = window.getSelection();
581
581
  if (!e || e.rangeCount === 0) return;
582
- const o = e.getRangeAt(0).getBoundingClientRect(), r = S.value.getBoundingClientRect(), c = o.top - r.top, d = o.bottom - r.top, w = S.value.scrollTop, O = S.value.clientHeight;
583
- d > O ? S.value.scrollTop = w + (d - O) + 10 : c < 0 && (S.value.scrollTop = w + c - 10);
584
- }, X = (e) => {
582
+ const o = e.getRangeAt(0).getBoundingClientRect(), c = S.value.getBoundingClientRect(), r = o.top - c.top, d = o.bottom - c.top, w = S.value.scrollTop, T = S.value.clientHeight;
583
+ d > T ? S.value.scrollTop = w + (d - T) + 10 : r < 0 && (S.value.scrollTop = w + r - 10);
584
+ }, J = (e) => {
585
585
  const n = Date.now(), o = JSON.stringify(e);
586
586
  return `${n}:${o}`;
587
- }, Ie = (e) => {
587
+ }, Se = (e) => {
588
588
  const n = parseInt(e.slice(0, 13)), o = JSON.parse(e.slice(14));
589
589
  return {
590
590
  timestamp: n,
591
591
  data: o
592
592
  };
593
- }, Q = /* @__PURE__ */ new Map(), N = zt(X(E.value), {
593
+ }, ee = /* @__PURE__ */ new Map(), U = jt(J(k.value), {
594
594
  onRemoveHistory: (e) => {
595
595
  for (const n of e)
596
- Q.delete(n);
596
+ ee.delete(n);
597
597
  }
598
598
  });
599
- ne(
600
- () => D.value,
599
+ ie(
600
+ () => A.value,
601
601
  (e) => {
602
- const n = V(e || []);
603
- if (JSON.stringify(n) !== JSON.stringify(E.value)) {
602
+ const n = H(e || []);
603
+ if (JSON.stringify(n) !== JSON.stringify(k.value)) {
604
604
  if (S.value) {
605
- const r = te(S.value);
606
- r && Q.set(N.get(), Y(r));
605
+ const c = ye(S.value);
606
+ c && ee.set(U.get(), te(c));
607
607
  }
608
- W(n), N.commit(X(E.value));
608
+ z(n), U.commit(J(k.value));
609
609
  }
610
610
  },
611
611
  { deep: !0 }
612
612
  );
613
- const be = (e, n = document.body) => n.contains(e) ? e instanceof HTMLElement && e.dataset.id ? e : e.parentElement ? be(e.parentElement, n) : null : null, F = (e) => e === S.value, te = (e) => {
613
+ const xe = (e, n = document.body) => n.contains(e) ? e instanceof HTMLElement && e.dataset.id ? e : e.parentElement ? xe(e.parentElement, n) : null : null, ve = (e) => e === S.value, ye = (e) => {
614
614
  const n = window.getSelection();
615
615
  if (!n)
616
616
  return null;
617
- const o = n.rangeCount > 0 ? n.getRangeAt(0) : null, r = e.getRootNode();
618
- if (!(r instanceof ShadowRoot))
617
+ const o = n.rangeCount > 0 ? n.getRangeAt(0) : null, c = e.getRootNode();
618
+ if (!(c instanceof ShadowRoot))
619
619
  return o;
620
- if (p) {
621
- const c = n.getComposedRanges(h ? r : { shadowRoots: [r] });
622
- return (c == null ? void 0 : c[0]) ?? null;
620
+ if (f) {
621
+ const r = n.getComposedRanges(h ? c : { shadowRoots: [c] });
622
+ return (r == null ? void 0 : r[0]) ?? null;
623
623
  }
624
624
  if (l) {
625
- const c = r.getSelection();
626
- return c.rangeCount > 0 ? c.getRangeAt(0) : null;
625
+ const r = c.getSelection();
626
+ return r.rangeCount > 0 ? r.getRangeAt(0) : null;
627
627
  }
628
628
  return o;
629
- }, ke = (e, n) => {
630
- var r;
629
+ }, W = (e, n) => {
630
+ var c;
631
631
  if (!e.firstChild || e.firstChild.nodeType !== Node.TEXT_NODE)
632
632
  return { node: e, offset: 0 };
633
- const o = ((r = e.firstChild.textContent) == null ? void 0 : r.length) ?? 0;
633
+ const o = ((c = e.firstChild.textContent) == null ? void 0 : c.length) ?? 0;
634
634
  return { node: e.firstChild, offset: Math.min(n, o) };
635
- }, ie = (e, n, o, r) => {
636
- const c = window.getSelection();
637
- if (!c)
635
+ }, X = (e, n, o, c) => {
636
+ const r = window.getSelection();
637
+ if (!r)
638
638
  return;
639
- const { node: d, offset: w } = ke(e, n);
639
+ const { node: d, offset: w } = W(e, n);
640
640
  if (!o)
641
- c.setBaseAndExtent(d, w, d, w);
641
+ r.setBaseAndExtent(d, w, d, w);
642
642
  else {
643
- const { node: O, offset: U } = ke(o, r ?? 0);
644
- c.setBaseAndExtent(d, w, O, U);
643
+ const { node: T, offset: Y } = W(o, c ?? 0);
644
+ r.setBaseAndExtent(d, w, T, Y);
645
645
  }
646
- q(() => {
647
- J();
646
+ G(() => {
647
+ Q();
648
648
  });
649
- }, pe = (e, n) => {
650
- const o = v(), r = { id: o, type: "text", content: e };
649
+ }, Ce = (e, n) => {
650
+ const o = v(), c = { id: o, type: "text", content: e };
651
651
  if (n) {
652
- const c = E.value.findIndex((d) => d.id === n);
653
- c !== -1 ? (W(
654
- E.value.slice(0, c + 1).concat(r).concat(E.value.slice(c + 1))
655
- ), N.commit(X(E.value))) : console.warn(`can not find item with id: ${n}`);
652
+ const r = k.value.findIndex((d) => d.id === n);
653
+ r !== -1 ? (z(
654
+ k.value.slice(0, r + 1).concat(c).concat(k.value.slice(r + 1))
655
+ ), U.commit(J(k.value))) : console.warn(`can not find item with id: ${n}`);
656
656
  } else
657
- W([r].concat(E.value)), N.commit(X(E.value));
658
- q(() => {
657
+ z([c].concat(k.value)), U.commit(J(k.value));
658
+ G(() => {
659
659
  var d;
660
- const c = (d = S.value) == null ? void 0 : d.querySelector(`[data-id="${o}"][data-type="text"]`);
661
- c && ie(c, e.length);
662
- }), D.value = j(E.value);
663
- }, ae = A({
660
+ const r = (d = S.value) == null ? void 0 : d.querySelector(`[data-id="${o}"][data-type="text"]`);
661
+ r && X(r, e.length);
662
+ }), A.value = _(k.value);
663
+ }, de = K({
664
664
  hasStarted: !1,
665
665
  range: null
666
- }), He = (e) => {
667
- var O;
666
+ }), Oe = (e) => {
667
+ var T;
668
668
  const n = e;
669
669
  e.preventDefault();
670
- const { inputType: o } = n, r = (n.data || ((O = n.dataTransfer) == null ? void 0 : O.getData("text/plain")) || "").replace(g, "").replace(T, ""), c = n.getTargetRanges()[0];
671
- if (!c) {
672
- console.warn("range is null", c);
670
+ const { inputType: o } = n, c = (n.data || ((T = n.dataTransfer) == null ? void 0 : T.getData("text/plain")) || "").replace(g, "").replace(O, ""), r = n.getTargetRanges()[0];
671
+ if (!r) {
672
+ console.warn("range is null", r);
673
673
  return;
674
674
  }
675
675
  const d = [
@@ -683,17 +683,17 @@ const Ut = ["data-id", "data-type"], Gt = ["data-id", "data-type"], qt = /* @__P
683
683
  "deleteSoftLineBackward",
684
684
  "deleteSoftLineForward",
685
685
  "deleteByCut"
686
- ], w = te(S.value);
686
+ ], w = ye(S.value);
687
687
  if (d.includes(o)) {
688
- if (r && F(c.startContainer) && F(c.endContainer)) {
689
- w && Q.set(N.get(), Y(w)), pe(r);
688
+ if (c && ve(r.startContainer) && ve(r.endContainer)) {
689
+ w && ee.set(U.get(), te(w)), Ce(c);
690
690
  return;
691
691
  }
692
- const U = Y(c);
693
- U.startId && U.endId ? (w && Q.set(N.get(), Y(w)), Re(U, o, r)) : console.warn("range is not valid, range:", U);
694
- } else o === "insertCompositionText" && ae.value.hasStarted && (ae.value = { hasStarted: !1, range: Y(c) });
695
- }, Y = (e) => {
696
- const n = be(e.startContainer, S.value), o = be(e.endContainer, S.value);
692
+ const Y = te(r);
693
+ Y.startId && Y.endId ? (w && ee.set(U.get(), te(w)), ge(Y, o, c)) : console.warn("range is not valid, range:", Y);
694
+ } else o === "insertCompositionText" && de.value.hasStarted && (de.value = { hasStarted: !1, range: te(r) });
695
+ }, te = (e) => {
696
+ const n = xe(e.startContainer, S.value), o = xe(e.endContainer, S.value);
697
697
  return {
698
698
  collapsed: e.collapsed,
699
699
  endContainer: e.endContainer,
@@ -707,152 +707,152 @@ const Ut = ["data-id", "data-type"], Gt = ["data-id", "data-type"], qt = /* @__P
707
707
  startOffset: e.startOffset,
708
708
  startType: n == null ? void 0 : n.dataset.type
709
709
  };
710
- }, he = (e, n, o, r) => e.slice(0, o) + n + e.slice(r), Re = (e, n, o) => {
711
- const r = ue(e);
712
- if (!Array.isArray(r) || r.length === 0)
710
+ }, $e = (e, n, o, c) => e.slice(0, o) + n + e.slice(c), ge = (e, n, o) => {
711
+ const c = Fe(e);
712
+ if (!Array.isArray(c) || c.length === 0)
713
713
  return;
714
- const c = Te(r, e, n, o);
715
- if (c.some(($) => $.tag === "new")) {
716
- const { afterId: $, content: P } = c[0];
717
- pe(P, $);
714
+ const r = We(c, e, n, o);
715
+ if (r.some((B) => B.tag === "new")) {
716
+ const { afterId: B, content: P } = r[0];
717
+ Ce(P, B);
718
718
  return;
719
719
  }
720
- const d = c, w = [];
721
- for (const [$, P] of d.entries()) {
722
- const s = E.value.find((C) => C.id === P.id), u = $ === 0 ? o : "";
723
- s ? s.type === "text" ? s.content = he(s.content, u, P.startOffset, P.endOffset) : s.type === "template" ? P.type === "prefix" || P.type === "suffix" ? P.startOffset === 0 && P.endOffset === 1 && u.length === 0 ? s[P.type] = "" : console.warn(`${P.type} can not be inserted text. it only can be deleted`, P) : P.startOffset < 0 || P.endOffset > s.content.length ? w.push(s.id) : s.content = he(s.content, u, P.startOffset, P.endOffset) : console.warn("dataItem.type is not text or template", s) : console.warn("can not find dataItem", P);
720
+ const d = r, w = [];
721
+ for (const [B, P] of d.entries()) {
722
+ const V = k.value.find((fe) => fe.id === P.id), ne = B === 0 ? o : "";
723
+ V ? V.type === "text" ? V.content = $e(V.content, ne, P.startOffset, P.endOffset) : V.type === "template" ? P.type === "prefix" || P.type === "suffix" ? P.startOffset === 0 && P.endOffset === 1 && ne.length === 0 ? V[P.type] = "" : console.warn(`${P.type} can not be inserted text. it only can be deleted`, P) : P.startOffset < 0 || P.endOffset > V.content.length ? w.push(V.id) : V.content = $e(V.content, ne, P.startOffset, P.endOffset) : console.warn("dataItem.type is not text or template", V) : console.warn("can not find dataItem", P);
724
724
  }
725
- let O = E.value.filter(($) => !w.includes($.id));
726
- O = O.filter(($) => !($.type === "template" && [$.prefix, $.suffix, $.content].join("").length === 0));
727
- const U = /* @__PURE__ */ new Set();
728
- O.forEach(($, P, s) => {
729
- if (s.length >= 2) {
725
+ let T = k.value.filter((B) => !w.includes(B.id));
726
+ T = T.filter((B) => !(B.type === "template" && [B.prefix, B.suffix, B.content].join("").length === 0));
727
+ const Y = /* @__PURE__ */ new Set();
728
+ T.forEach((B, P, V) => {
729
+ if (V.length >= 2) {
730
730
  if (P === 0 || P === 1) {
731
- const u = s[0], C = s[1];
732
- if (u.type === "text" && u.content.length === 0 && C.type === "template")
731
+ const ne = V[0], fe = V[1];
732
+ if (ne.type === "text" && ne.content.length === 0 && fe.type === "template")
733
733
  return;
734
734
  }
735
- if (P === s.length - 2 || P === s.length - 1) {
736
- const u = s[s.length - 1], C = s[s.length - 2];
737
- if (u.type === "text" && u.content.length === 0 && C.type === "template")
735
+ if (P === V.length - 2 || P === V.length - 1) {
736
+ const ne = V[V.length - 1], fe = V[V.length - 2];
737
+ if (ne.type === "text" && ne.content.length === 0 && fe.type === "template")
738
738
  return;
739
739
  }
740
740
  }
741
- $.type === "text" && $.content.length === 0 && U.add($.id);
742
- }), O = O.filter(($) => !U.has($.id));
743
- for (const $ of O.filter((P) => P.type === "template"))
744
- $.prefix.length === 0 && ($.prefix = g), $.suffix.length === 0 && ($.suffix = T);
745
- W(O), N.commit(X(E.value)), d.length > 0 && Ve(d, o), D.value = j(E.value), q(() => {
746
- J();
741
+ B.type === "text" && B.content.length === 0 && Y.add(B.id);
742
+ }), T = T.filter((B) => !Y.has(B.id));
743
+ for (const B of T.filter((P) => P.type === "template"))
744
+ B.prefix.length === 0 && (B.prefix = g), B.suffix.length === 0 && (B.suffix = O);
745
+ z(T), U.commit(J(k.value)), d.length > 0 && _e(d, o), A.value = _(k.value), G(() => {
746
+ Q();
747
747
  });
748
- }, Ve = (e, n) => {
749
- const o = e[0], r = `[data-id="${o.id}"][data-type="${o.type}"]`, c = e.slice(1).map((d) => `[data-id="${d.id}"][data-type="${d.type}"]`);
750
- q(() => {
751
- var w, O;
752
- const d = (w = S.value) == null ? void 0 : w.querySelector(r);
748
+ }, _e = (e, n) => {
749
+ const o = e[0], c = `[data-id="${o.id}"][data-type="${o.type}"]`, r = e.slice(1).map((d) => `[data-id="${d.id}"][data-type="${d.type}"]`);
750
+ G(() => {
751
+ var w, T;
752
+ const d = (w = S.value) == null ? void 0 : w.querySelector(c);
753
753
  if (d)
754
- ie(d, o.startOffset + n.length);
754
+ X(d, o.startOffset + n.length);
755
755
  else if (n.length === 0)
756
- for (const U of c) {
757
- const $ = (O = S.value) == null ? void 0 : O.querySelector(U);
758
- if ($) {
759
- ie($, 0);
756
+ for (const Y of r) {
757
+ const B = (T = S.value) == null ? void 0 : T.querySelector(Y);
758
+ if (B) {
759
+ X(B, 0);
760
760
  break;
761
761
  }
762
762
  }
763
763
  else
764
- console.warn(`can not find el with selector: ${r}`);
764
+ console.warn(`can not find el with selector: ${c}`);
765
765
  });
766
- }, ue = (e) => {
766
+ }, Fe = (e) => {
767
767
  const n = x.value.findIndex((w) => w.id === e.startId && w.type === e.startType), o = x.value.findIndex((w) => w.id === e.endId && w.type === e.endType);
768
768
  if (n === -1 || o === -1 || n > o)
769
769
  return console.warn("startIndex or endIndex is -1, or startIndex > endIndex. ", { range: e }), null;
770
- const r = x.value[n], c = x.value[o];
770
+ const c = x.value[n], r = x.value[o];
771
771
  if (n === o)
772
772
  return [
773
773
  {
774
- id: r.id,
775
- type: r.type,
774
+ id: c.id,
775
+ type: c.type,
776
776
  startOffset: e.startOffset,
777
777
  endOffset: e.endOffset
778
778
  }
779
779
  ];
780
780
  const d = [
781
781
  {
782
- id: r.id,
783
- type: r.type,
782
+ id: c.id,
783
+ type: c.type,
784
784
  startOffset: e.startOffset,
785
- endOffset: r.content.length
785
+ endOffset: c.content.length
786
786
  }
787
787
  ];
788
788
  for (let w = n + 1; w < o; w++) {
789
- const O = x.value[w];
789
+ const T = x.value[w];
790
790
  d.push({
791
- id: O.id,
792
- type: O.type,
791
+ id: T.id,
792
+ type: T.type,
793
793
  startOffset: 0,
794
- endOffset: O.content.length
794
+ endOffset: T.content.length
795
795
  });
796
796
  }
797
797
  return d.push({
798
- id: c.id,
799
- type: c.type,
798
+ id: r.id,
799
+ type: r.type,
800
800
  startOffset: 0,
801
801
  endOffset: e.endOffset
802
802
  }), d;
803
- }, Te = (e, n, o, r) => {
804
- const c = e[0];
805
- if (c.type !== "prefix" && c.type !== "suffix")
803
+ }, We = (e, n, o, c) => {
804
+ const r = e[0];
805
+ if (r.type !== "prefix" && r.type !== "suffix")
806
806
  return e;
807
807
  if (e.length === 1) {
808
808
  if (n.collapsed)
809
809
  if (n.startOffset === 0) {
810
- const d = ve(c, r);
810
+ const d = re(r, c);
811
811
  return d ? [d] : [];
812
812
  } else {
813
- const d = ye(c, r);
813
+ const d = me(r, c);
814
814
  return d ? [d] : [];
815
815
  }
816
816
  if (o.startsWith("insert"))
817
817
  if (h) {
818
- const d = ve(c, r);
818
+ const d = re(r, c);
819
819
  return d ? [d] : [];
820
820
  } else {
821
- const d = ye(c, r);
821
+ const d = me(r, c);
822
822
  return d ? [d] : [];
823
823
  }
824
824
  if (o.startsWith("delete")) {
825
825
  if (o.includes("Backward")) {
826
- const d = ve(c, r, 1);
826
+ const d = re(r, c, 1);
827
827
  return d ? [d] : [];
828
828
  } else if (o.includes("Forward")) {
829
- const d = ye(c, r, 1);
829
+ const d = me(r, c, 1);
830
830
  return d ? [d] : [];
831
831
  }
832
832
  }
833
833
  }
834
- return r.length > 0 ? e.slice(1) : e;
835
- }, ve = (e, n, o = 0) => {
836
- const r = x.value.findIndex((c) => c.id === e.id && c.type === e.type);
837
- if (r > 0) {
838
- const c = x.value[r - 1], { id: d, type: w, content: O } = c;
834
+ return c.length > 0 ? e.slice(1) : e;
835
+ }, re = (e, n, o = 0) => {
836
+ const c = x.value.findIndex((r) => r.id === e.id && r.type === e.type);
837
+ if (c > 0) {
838
+ const r = x.value[c - 1], { id: d, type: w, content: T } = r;
839
839
  if (w === "text" || w === "template")
840
840
  return {
841
841
  id: d,
842
842
  type: w,
843
- startOffset: O.length - o,
844
- endOffset: O.length
843
+ startOffset: T.length - o,
844
+ endOffset: T.length
845
845
  };
846
846
  if (n.length > 0)
847
847
  return { tag: "new", afterId: d, type: "text", content: n };
848
- if (console.warn("the previous item is not text or template", { current: e, previous: c }), o === 1)
848
+ if (console.warn("the previous item is not text or template", { current: e, previous: r }), o === 1)
849
849
  return { ...e, endOffset: e.startOffset };
850
850
  } else return n.length > 0 ? { tag: "new", type: "text", content: n } : (console.warn("the previous item of current is not found", { current: e }), null);
851
851
  return e;
852
- }, ye = (e, n, o = 0) => {
853
- const r = x.value.findIndex((c) => c.id === e.id && c.type === e.type);
854
- if (r < x.value.length - 1) {
855
- const c = x.value[r + 1], { id: d, type: w } = c;
852
+ }, me = (e, n, o = 0) => {
853
+ const c = x.value.findIndex((r) => r.id === e.id && r.type === e.type);
854
+ if (c < x.value.length - 1) {
855
+ const r = x.value[c + 1], { id: d, type: w } = r;
856
856
  if (w === "text" || w === "template")
857
857
  return {
858
858
  id: d,
@@ -862,106 +862,106 @@ const Ut = ["data-id", "data-type"], Gt = ["data-id", "data-type"], qt = /* @__P
862
862
  };
863
863
  if (n.length > 0)
864
864
  return { tag: "new", afterId: e.id, type: "text", content: n };
865
- if (console.warn("the next item is not text or template", { current: e, next: c }), o === 1)
865
+ if (console.warn("the next item is not text or template", { current: e, next: r }), o === 1)
866
866
  return { ...e, startOffset: e.endOffset };
867
867
  } else return n.length > 0 ? { tag: "new", afterId: e.id, type: "text", content: n } : (console.warn("the next item of current is not found", { current: e }), null);
868
868
  return e;
869
- }, Ee = () => {
870
- ae.value = { hasStarted: !0, range: null };
871
- }, ge = (e) => {
872
- const n = ae.value.range;
873
- n ? (e.data && F(n.startContainer) && F(n.endContainer) ? (Q.set(N.get(), Y(n)), pe(e.data)) : n.startId && n.endId ? (Q.set(N.get(), Y(n)), Re(n, "insertCompositionText", e.data)) : console.warn("range is not valid, range:", n), _.value++, q(() => {
874
- J();
875
- })) : console.warn("range is null, compositionEnd:", e), ae.value = { hasStarted: !1, range: null };
876
- }, le = (() => {
869
+ }, Be = () => {
870
+ de.value = { hasStarted: !0, range: null };
871
+ }, Le = (e) => {
872
+ const n = de.value.range;
873
+ n ? (e.data && ve(n.startContainer) && ve(n.endContainer) ? (ee.set(U.get(), te(n)), Ce(e.data)) : n.startId && n.endId ? (ee.set(U.get(), te(n)), ge(n, "insertCompositionText", e.data)) : console.warn("range is not valid, range:", n), F.value++, G(() => {
874
+ Q();
875
+ })) : console.warn("range is null, compositionEnd:", e), de.value = { hasStarted: !1, range: null };
876
+ }, ce = (() => {
877
877
  const e = navigator.userAgent.toLowerCase();
878
878
  return /macintosh|mac os x|iphone|ipad|ipod/.test(e);
879
- })(), Fe = (e) => {
880
- const n = le && e.metaKey && !e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Z
881
- !le && e.ctrlKey && !e.shiftKey && e.key.toLowerCase() === "z", o = le && e.metaKey && e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Shift+z
882
- !le && e.ctrlKey && (e.key.toLowerCase() === "y" || e.shiftKey && e.key.toLowerCase() === "z"), r = e.key.toLowerCase() === "enter";
879
+ })(), Ne = (e) => {
880
+ const n = ce && e.metaKey && !e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Z
881
+ !ce && e.ctrlKey && !e.shiftKey && e.key.toLowerCase() === "z", o = ce && e.metaKey && e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Shift+z
882
+ !ce && e.ctrlKey && (e.key.toLowerCase() === "y" || e.shiftKey && e.key.toLowerCase() === "z"), c = e.key.toLowerCase() === "enter";
883
883
  if (n) {
884
884
  e.preventDefault();
885
- const c = te(S.value);
886
- c && Q.set(N.get(), Y(c));
887
- const d = N.undo();
888
- d && Oe(d);
885
+ const r = ye(S.value);
886
+ r && ee.set(U.get(), te(r));
887
+ const d = U.undo();
888
+ d && pe(d);
889
889
  }
890
890
  if (o) {
891
891
  e.preventDefault();
892
- const c = N.redo();
893
- c && Oe(c);
892
+ const r = U.redo();
893
+ r && pe(r);
894
894
  }
895
- r && (e.preventDefault(), H("submit"));
896
- }, Oe = (e) => {
897
- const { data: n } = Ie(e);
898
- if (W(n), Q.has(e)) {
899
- const o = Q.get(e);
900
- q(() => {
901
- const r = S.value.querySelector(`[data-id="${o.startId}"][data-type="${o.startType}"]`), c = S.value.querySelector(`[data-id="${o.endId}"][data-type="${o.endType}"]`);
902
- r && ie(r, o.startOffset, c, o.endOffset);
895
+ c && (e.preventDefault(), M("submit"));
896
+ }, pe = (e) => {
897
+ const { data: n } = Se(e);
898
+ if (z(n), ee.has(e)) {
899
+ const o = ee.get(e);
900
+ G(() => {
901
+ const c = S.value.querySelector(`[data-id="${o.startId}"][data-type="${o.startType}"]`), r = S.value.querySelector(`[data-id="${o.endId}"][data-type="${o.endType}"]`);
902
+ c && X(c, o.startOffset, r, o.endOffset);
903
903
  });
904
904
  }
905
- D.value = j(E.value);
906
- }, $e = (e, n) => {
907
- var c, d;
908
- const o = (c = S.value) == null ? void 0 : c.querySelector(`[data-id="${e}"][data-type="${n}"]`);
905
+ A.value = _(k.value);
906
+ }, De = (e, n) => {
907
+ var r, d;
908
+ const o = (r = S.value) == null ? void 0 : r.querySelector(`[data-id="${e}"][data-type="${n}"]`);
909
909
  if (!o) return;
910
- const r = ((d = o.textContent) == null ? void 0 : d.length) || 0;
911
- ie(o, r);
912
- }, Be = () => {
913
- S.value && q(() => {
914
- const e = E.value, n = e.find((r) => r.type === "template");
915
- n && $e(n.id, "template"), e.every((r) => r.type === "text") && e.length === 1 && $e(e[0].id, "text");
910
+ const c = ((d = o.textContent) == null ? void 0 : d.length) || 0;
911
+ X(o, c);
912
+ }, ze = () => {
913
+ S.value && G(() => {
914
+ const e = k.value, n = e.find((c) => c.type === "template");
915
+ n && De(n.id, "template"), e.every((c) => c.type === "text") && e.length === 1 && De(e[0].id, "text");
916
916
  });
917
- }, Me = () => {
918
- N.clear(), Q.clear();
919
- }, de = () => {
920
- if (!S.value || ae.value.range)
917
+ }, Ue = () => {
918
+ U.clear(), ee.clear();
919
+ }, Ie = () => {
920
+ if (!S.value || de.value.range)
921
921
  return;
922
- const e = te(S.value);
922
+ const e = ye(S.value);
923
923
  if (e != null && e.collapsed && b.value.length > 0) {
924
- const n = Y(e), o = b.value[0];
924
+ const n = te(e), o = b.value[0];
925
925
  if (n.startEl && n.startId === o.id && n.startOffset === 0 && o.content === y && o.type === "text") {
926
- ie(n.startEl, 1);
926
+ X(n.startEl, 1);
927
927
  return;
928
928
  }
929
- const r = b.value[b.value.length - 1];
930
- if (n.endEl && n.endId === r.id && n.endOffset === 1 && r.content === y && r.type === "text") {
931
- ie(n.endEl, 0);
929
+ const c = b.value[b.value.length - 1];
930
+ if (n.endEl && n.endId === c.id && n.endOffset === 1 && c.content === y && c.type === "text") {
931
+ X(n.endEl, 0);
932
932
  return;
933
933
  }
934
934
  }
935
935
  };
936
- return bt(() => {
937
- document.addEventListener("selectionchange", de), q(() => {
936
+ return It(() => {
937
+ document.addEventListener("selectionchange", Ie), G(() => {
938
938
  Z();
939
939
  });
940
- }), st(() => {
941
- document.removeEventListener("selectionchange", de);
940
+ }), rt(() => {
941
+ document.removeEventListener("selectionchange", Ie);
942
942
  }), i({
943
- clearHistory: Me,
944
- activateFirstField: Be
945
- }), (e, n) => (m(), R("div", Jt, [
946
- (m(), R("div", {
943
+ clearHistory: Ue,
944
+ activateFirstField: ze
945
+ }), (e, n) => (m(), E("div", Qt, [
946
+ (m(), E("div", {
947
947
  contenteditable: "true",
948
948
  ref_key: "editorRef",
949
949
  ref: S,
950
- key: _.value,
950
+ key: F.value,
951
951
  class: "editor",
952
- style: Ae(K.value),
953
- onBeforeinput: He,
954
- onCompositionstart: Ee,
955
- onCompositionend: ge,
956
- onKeydown: Fe
952
+ style: Ve(D.value),
953
+ onBeforeinput: Oe,
954
+ onCompositionstart: Be,
955
+ onCompositionend: Le,
956
+ onKeydown: Ne
957
957
  }, [
958
- (m(!0), R(we, null, xe(f.value, (o) => (m(), oe(jt, Se({
958
+ (m(!0), E(be, null, ke(u.value, (o) => (m(), ae(Zt, Re({
959
959
  key: `${o.id}-${o.type}`
960
960
  }, { ref_for: !0 }, o), null, 16))), 128))
961
961
  ], 36))
962
962
  ]));
963
963
  }
964
- }), Zt = /* @__PURE__ */ _e(Yt, [["__scopeId", "data-v-b5c1a845"]]), it = (t, i) => {
964
+ }), nn = /* @__PURE__ */ Ee(tn, [["__scopeId", "data-v-b5c1a845"]]), ct = (t, i) => {
965
965
  if (!i.length)
966
966
  return [{ text: t, isMatch: !1 }];
967
967
  const a = [];
@@ -970,12 +970,12 @@ const Ut = ["data-id", "data-type"], Gt = ["data-id", "data-type"], qt = /* @__P
970
970
  let v = 0;
971
971
  const y = t.toLowerCase(), g = h.toLowerCase();
972
972
  for (; ; ) {
973
- const T = y.indexOf(g, v);
974
- if (T === -1) break;
973
+ const O = y.indexOf(g, v);
974
+ if (O === -1) break;
975
975
  a.push({
976
- start: T,
977
- end: T + h.length
978
- }), v = T + 1;
976
+ start: O,
977
+ end: O + h.length
978
+ }), v = O + 1;
979
979
  }
980
980
  }
981
981
  if (a.length === 0)
@@ -989,24 +989,24 @@ const Ut = ["data-id", "data-type"], Gt = ["data-id", "data-type"], qt = /* @__P
989
989
  const v = l[l.length - 1];
990
990
  h.start <= v.end ? v.end = Math.max(v.end, h.end) : l.push(h);
991
991
  }
992
- const p = [];
993
- let I = 0;
992
+ const f = [];
993
+ let C = 0;
994
994
  for (const h of l)
995
- I < h.start && p.push({
996
- text: t.substring(I, h.start),
995
+ C < h.start && f.push({
996
+ text: t.substring(C, h.start),
997
997
  isMatch: !1
998
- }), p.push({
998
+ }), f.push({
999
999
  text: t.substring(h.start, h.end),
1000
1000
  isMatch: !0
1001
- }), I = h.end;
1002
- return I < t.length && p.push({
1003
- text: t.substring(I),
1001
+ }), C = h.end;
1002
+ return C < t.length && f.push({
1003
+ text: t.substring(C),
1004
1004
  isMatch: !1
1005
- }), p;
1006
- }, Qt = (t, i) => !i || !t ? [{ text: t, isMatch: !1 }] : it(t, [i]), en = (t, i) => {
1005
+ }), f;
1006
+ }, on = (t, i) => !i || !t ? [{ text: t, isMatch: !1 }] : ct(t, [i]), sn = (t, i) => {
1007
1007
  const { content: a, highlights: l } = t;
1008
- return typeof l == "function" ? l(a, i) : Array.isArray(l) ? it(a, l) : Qt(a, i);
1009
- }, tn = ["onMouseenter", "onMousedown"], nn = { class: "suggestion-list__text" }, on = /* @__PURE__ */ Ce({
1008
+ return typeof l == "function" ? l(a, i) : Array.isArray(l) ? ct(a, l) : on(a, i);
1009
+ }, an = ["onMouseenter", "onMousedown"], ln = { class: "suggestion-list__text" }, rn = /* @__PURE__ */ Te({
1010
1010
  __name: "SuggestionList",
1011
1011
  props: {
1012
1012
  show: { type: Boolean },
@@ -1018,81 +1018,81 @@ const Ut = ["data-id", "data-type"], Gt = ["data-id", "data-type"], qt = /* @__P
1018
1018
  },
1019
1019
  emits: ["select", "mouse-enter", "mouse-leave"],
1020
1020
  setup(t, { emit: i }) {
1021
- const a = t, l = i, p = A(null), I = (g) => g === a.activeKeyboardIndex || g === a.activeMouseIndex, h = (g) => {
1021
+ const a = t, l = i, f = K(null), C = (g) => g === a.activeKeyboardIndex || g === a.activeMouseIndex, h = (g) => {
1022
1022
  l("mouse-enter", g);
1023
1023
  }, v = () => {
1024
1024
  l("mouse-leave");
1025
1025
  }, y = (g) => {
1026
1026
  l("select", g);
1027
1027
  };
1028
- return ne(
1028
+ return ie(
1029
1029
  () => a.activeKeyboardIndex,
1030
1030
  (g) => {
1031
- if (g !== -1 && p.value) {
1032
- const T = p.value.children[g];
1033
- T && T.scrollIntoView({ block: "nearest" });
1031
+ if (g !== -1 && f.value) {
1032
+ const O = f.value.children[g];
1033
+ O && O.scrollIntoView({ block: "nearest" });
1034
1034
  }
1035
1035
  }
1036
- ), (g, T) => (m(), oe(qe, { name: "tiny-sender-slide-up" }, {
1037
- default: me(() => [
1038
- a.show && a.suggestions.length ? (m(), R("div", {
1036
+ ), (g, O) => (m(), ae(Ye, { name: "tiny-sender-slide-up" }, {
1037
+ default: we(() => [
1038
+ a.show && a.suggestions.length ? (m(), E("div", {
1039
1039
  key: 0,
1040
1040
  ref_key: "suggestionsListRef",
1041
- ref: p,
1041
+ ref: f,
1042
1042
  class: "suggestion-list",
1043
- style: Ae(a.popupStyle)
1043
+ style: Ve(a.popupStyle)
1044
1044
  }, [
1045
- (m(!0), R(we, null, xe(a.suggestions, (L, D) => (m(), R("div", {
1046
- key: D,
1047
- class: se(["suggestion-list__item", { highlighted: I(D) }]),
1048
- onMouseenter: (H) => h(D),
1045
+ (m(!0), E(be, null, ke(a.suggestions, (L, A) => (m(), E("div", {
1046
+ key: A,
1047
+ class: le(["suggestion-list__item", { highlighted: C(A) }]),
1048
+ onMouseenter: (M) => h(A),
1049
1049
  onMouseleave: v,
1050
- onMousedown: St((H) => y(L.content), ["prevent"])
1050
+ onMousedown: Rt((M) => y(L.content), ["prevent"])
1051
1051
  }, [
1052
- ee(k(Dt), { class: "suggestion-list__icon" }),
1053
- G("span", nn, [
1054
- (m(!0), R(we, null, xe(k(en)(L, a.inputValue), (H, _) => (m(), R("span", {
1055
- key: _,
1056
- class: se({
1057
- "suggestion-list__text--match": H.isMatch,
1058
- "suggestion-list__text--normal": !H.isMatch
1052
+ se(I(Ht), { class: "suggestion-list__icon" }),
1053
+ q("span", ln, [
1054
+ (m(!0), E(be, null, ke(I(sn)(L, a.inputValue), (M, F) => (m(), E("span", {
1055
+ key: F,
1056
+ class: le({
1057
+ "suggestion-list__text--match": M.isMatch,
1058
+ "suggestion-list__text--normal": !M.isMatch
1059
1059
  })
1060
- }, fe(H.text), 3))), 128))
1060
+ }, he(M.text), 3))), 128))
1061
1061
  ])
1062
- ], 42, tn))), 128))
1063
- ], 4)) : M("", !0)
1062
+ ], 42, an))), 128))
1063
+ ], 4)) : N("", !0)
1064
1064
  ]),
1065
1065
  _: 1
1066
1066
  }));
1067
1067
  }
1068
- }), sn = /* @__PURE__ */ _e(on, [["__scopeId", "data-v-e0ec9fe3"]]), an = ["data-theme"], ln = { class: "tiny-sender__container" }, rn = {
1068
+ }), cn = /* @__PURE__ */ Ee(rn, [["__scopeId", "data-v-e0ec9fe3"]]), un = ["data-theme"], dn = { class: "tiny-sender__container" }, fn = {
1069
1069
  key: 0,
1070
1070
  class: "tiny-sender__header-slot"
1071
- }, cn = {
1071
+ }, pn = {
1072
1072
  key: 0,
1073
1073
  class: "tiny-sender__prefix-slot"
1074
- }, un = { class: "tiny-sender__content-area" }, dn = {
1074
+ }, hn = { class: "tiny-sender__content-area" }, vn = {
1075
1075
  key: 0,
1076
1076
  class: "tiny-sender__decorative-content"
1077
- }, fn = {
1077
+ }, yn = {
1078
1078
  key: 1,
1079
1079
  class: "tiny-sender__completion-placeholder"
1080
- }, pn = { class: "user-input-mirror" }, hn = {
1080
+ }, gn = { class: "user-input-mirror" }, mn = {
1081
1081
  key: 0,
1082
1082
  class: "tiny-sender__tab-hint"
1083
- }, vn = {
1083
+ }, wn = {
1084
1084
  key: 1,
1085
1085
  class: "tiny-sender__actions-slot"
1086
- }, yn = {
1086
+ }, bn = {
1087
1087
  key: 0,
1088
1088
  class: "tiny-sender__footer-slot tiny-sender__bottom-row"
1089
- }, gn = { class: "tiny-sender__footer-left" }, mn = { class: "tiny-sender__footer-right" }, wn = { class: "real-word-length" }, bn = {
1089
+ }, Sn = { class: "tiny-sender__footer-left" }, xn = { class: "tiny-sender__footer-right" }, Cn = { class: "real-word-length" }, _n = {
1090
1090
  key: 1,
1091
1091
  class: "tiny-sender__toolbar"
1092
- }, Sn = { class: "tiny-sender__buttons-container" }, xn = {
1092
+ }, In = { class: "tiny-sender__buttons-container" }, Rn = {
1093
1093
  key: 1,
1094
1094
  class: "tiny-sender__footer-slot"
1095
- }, Cn = /* @__PURE__ */ Ce({
1095
+ }, kn = /* @__PURE__ */ Te({
1096
1096
  __name: "index",
1097
1097
  props: {
1098
1098
  autofocus: { type: Boolean, default: !1 },
@@ -1120,419 +1120,427 @@ const Ut = ["data-id", "data-type"], Gt = ["data-id", "data-type"], qt = /* @__P
1120
1120
  },
1121
1121
  emits: ["update:modelValue", "update:templateData", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template", "files-selected"],
1122
1122
  setup(t, { expose: i, emit: a }) {
1123
- const l = t, p = a, I = A(null), h = A(null), v = A(null), y = A(null), g = A(null), T = A(null), L = A(0);
1124
- let D = null;
1125
- const H = B(() => l.templateData && l.templateData.length > 0), { inputValue: _, isComposing: V, clearInput: j } = Kt(l, p), E = B(() => !!_.value.trim()), W = B(() => {
1126
- var s, u;
1127
- return !(l.disabled || l.loading || !E.value || ge.value || (u = (s = l.buttonGroup) == null ? void 0 : s.submit) != null && u.disabled);
1123
+ const l = t, f = a, C = K(null), h = K(null), v = K(null), y = K(null), g = K(null), O = K(null), L = K(0), A = K(0);
1124
+ let M = 0, F = null;
1125
+ const H = $(() => l.templateData && l.templateData.length > 0), { inputValue: _, isComposing: k, clearInput: z } = Ft(l, f), b = $(() => !!_.value.trim()), x = $(() => {
1126
+ var s, p;
1127
+ return !(l.disabled || l.loading || !b.value || ce.value || (p = (s = l.buttonGroup) == null ? void 0 : s.submit) != null && p.disabled);
1128
1128
  }), {
1129
- isPopupVisible: b,
1130
- activeSuggestion: x,
1131
- activeKeyboardIndex: f,
1132
- activeMouseIndex: S,
1133
- autoCompleteText: z,
1134
- showTabIndicator: Z,
1135
- syncAutoComplete: K,
1136
- closePopup: J,
1137
- applySuggestion: X,
1138
- confirmSelection: Ie,
1139
- navigateWithKeyboard: Q,
1140
- handleMouseEnter: N,
1141
- handleMouseLeave: be
1142
- } = Vt(
1143
- B(() => l.suggestions),
1129
+ isPopupVisible: u,
1130
+ activeSuggestion: S,
1131
+ activeKeyboardIndex: j,
1132
+ activeMouseIndex: Z,
1133
+ autoCompleteText: D,
1134
+ showTabIndicator: Q,
1135
+ syncAutoComplete: J,
1136
+ closePopup: Se,
1137
+ applySuggestion: ee,
1138
+ confirmSelection: U,
1139
+ navigateWithKeyboard: xe,
1140
+ handleMouseEnter: ve,
1141
+ handleMouseLeave: ye
1142
+ } = Nt(
1143
+ $(() => l.suggestions),
1144
1144
  _,
1145
- V,
1145
+ k,
1146
1146
  H,
1147
- (s) => p("update:modelValue", s),
1148
- (s) => p("suggestion-select", s)
1149
- ), F = A(l.mode), te = A(!1), ke = () => {
1150
- F.value === "single" && (F.value = "multiple", q(() => {
1147
+ (s) => f("update:modelValue", s),
1148
+ (s) => f("suggestion-select", s)
1149
+ ), W = K(l.mode), X = K(!1), Ce = () => {
1150
+ W.value === "single" && (W.value = "multiple", G(() => {
1151
1151
  setTimeout(() => {
1152
1152
  const s = document.querySelector(".tiny-textarea__inner");
1153
1153
  if (s) {
1154
1154
  s.style.whiteSpace = "pre-wrap";
1155
- const u = _.value.length;
1156
- s.focus(), s.setSelectionRange(u, u);
1155
+ const p = _.value.length;
1156
+ s.focus(), s.setSelectionRange(p, p);
1157
1157
  }
1158
1158
  }, 50);
1159
1159
  }));
1160
- }, ie = (s, u) => {
1161
- const C = document.createElement("span");
1162
- C.style.visibility = "hidden", C.style.position = "absolute", C.style.whiteSpace = "nowrap", C.style.font = u, C.textContent = s, document.body.appendChild(C);
1163
- const re = C.offsetWidth;
1164
- return document.body.removeChild(C), re;
1165
- }, pe = () => {
1166
- var Le, Ye, Ze;
1167
- if (l.mode !== "single" || !I.value || te.value || !h.value || !y.value) return;
1160
+ }, de = (s, p) => {
1161
+ const R = document.createElement("span");
1162
+ R.style.visibility = "hidden", R.style.position = "absolute", R.style.whiteSpace = "nowrap", R.style.font = p, R.textContent = s, document.body.appendChild(R);
1163
+ const oe = R.offsetWidth;
1164
+ return document.body.removeChild(R), oe;
1165
+ }, Oe = () => {
1166
+ var Pe, et, tt;
1167
+ if (l.mode !== "single" || !C.value || X.value || !h.value || !y.value) return;
1168
1168
  const s = h.value.querySelector(".tiny-sender__content-area");
1169
1169
  if (!s) return;
1170
- const u = ((Ye = (Le = I.value) == null ? void 0 : Le.querySelector) == null ? void 0 : Ye.call(Le, ".tiny-input__inner")) || s.querySelector(".tiny-input__inner"), C = T.value || h.value.querySelector(".tiny-sender__buttons-container");
1171
- if (!u) {
1170
+ const p = ((et = (Pe = C.value) == null ? void 0 : Pe.querySelector) == null ? void 0 : et.call(Pe, ".tiny-input__inner")) || s.querySelector(".tiny-input__inner"), R = O.value || h.value.querySelector(".tiny-sender__buttons-container");
1171
+ if (!p) {
1172
1172
  console.warn("Cannot find input element for overflow check");
1173
1173
  return;
1174
1174
  }
1175
- const re = u.getBoundingClientRect(), We = C == null ? void 0 : C.getBoundingClientRect();
1176
- if (re.width === 0) {
1177
- setTimeout(() => pe(), 50);
1175
+ const oe = p.getBoundingClientRect(), Ge = R == null ? void 0 : R.getBoundingClientRect();
1176
+ if (oe.width === 0) {
1177
+ setTimeout(() => Oe(), 50);
1178
1178
  return;
1179
1179
  }
1180
- const at = window.getComputedStyle(u).font, lt = ie(_.value, at), Je = (Ze = h.value) == null ? void 0 : Ze.classList.contains("tr-sender-compact"), rt = Je ? 12 : 20, ct = re.width, ut = (We == null ? void 0 : We.width) || 0, Xe = ct - ut - rt, dt = Je ? 50 : 80;
1181
- lt > Xe && Xe > dt && F.value === "single" && (te.value = !0, F.value = "multiple", q(() => {
1182
- I.value ? setTimeout(() => {
1183
- var Qe;
1184
- const De = (Qe = h.value) == null ? void 0 : Qe.querySelector(".tiny-textarea__inner");
1185
- if (De) {
1186
- De.style.whiteSpace = "pre-wrap";
1187
- const et = _.value.length;
1188
- De.focus(), De.setSelectionRange(et, et);
1180
+ const dt = window.getComputedStyle(p).font, ft = de(_.value, dt), Ze = (tt = h.value) == null ? void 0 : tt.classList.contains("tr-sender-compact"), pt = Ze ? 12 : 20, ht = oe.width, vt = (Ge == null ? void 0 : Ge.width) || 0, Qe = ht - vt - pt, yt = Ze ? 50 : 80;
1181
+ ft > Qe && Qe > yt && W.value === "single" && (X.value = !0, W.value = "multiple", G(() => {
1182
+ C.value ? setTimeout(() => {
1183
+ var nt;
1184
+ const Ke = (nt = h.value) == null ? void 0 : nt.querySelector(".tiny-textarea__inner");
1185
+ if (Ke) {
1186
+ Ke.style.whiteSpace = "pre-wrap";
1187
+ const ot = _.value.length;
1188
+ Ke.focus(), Ke.setSelectionRange(ot, ot);
1189
1189
  }
1190
- te.value = !1;
1191
- }, 300) : te.value = !1;
1190
+ X.value = !1;
1191
+ }, 300) : X.value = !1;
1192
1192
  }));
1193
- }, ae = () => {
1193
+ }, te = () => {
1194
1194
  if (H.value && v.value)
1195
- U();
1196
- else if (I.value)
1197
- I.value.focus();
1195
+ ne();
1196
+ else if (C.value)
1197
+ C.value.focus();
1198
1198
  else {
1199
1199
  const s = document.querySelector(".tiny-input__inner");
1200
1200
  s == null || s.focus();
1201
1201
  }
1202
- }, He = () => {
1203
- if (I.value)
1204
- I.value.blur();
1202
+ }, $e = () => {
1203
+ if (C.value)
1204
+ C.value.blur();
1205
1205
  else {
1206
1206
  const s = document.querySelector(".tiny-input__inner");
1207
1207
  s == null || s.blur();
1208
1208
  }
1209
- }, Y = () => {
1209
+ }, ge = () => {
1210
1210
  var s;
1211
- p("update:templateData", []), (s = v.value) == null || s.clearHistory(), q(() => {
1212
- _.value === "" && (F.value = l.mode || "single"), setTimeout(() => {
1213
- ae();
1211
+ f("update:templateData", []), (s = v.value) == null || s.clearHistory(), G(() => {
1212
+ _.value === "" && (W.value = l.mode || "single"), setTimeout(() => {
1213
+ te();
1214
1214
  }, 50);
1215
1215
  });
1216
- }, he = () => {
1216
+ }, _e = () => {
1217
1217
  var s;
1218
- j(), H.value ? Y() : (s = h.value) == null || s.focus(), q(() => {
1219
- _.value === "" && (F.value = l.mode || "single");
1218
+ z(), H.value ? ge() : (s = h.value) == null || s.focus(), G(() => {
1219
+ _.value === "" && (W.value = l.mode || "single");
1220
1220
  });
1221
- }, Re = (s) => {
1222
- const u = (re) => re.type === "text" && re.content === "​";
1223
- if (s.length === 0 || s.every(u)) {
1224
- Y();
1221
+ }, Fe = (s) => {
1222
+ const p = (oe) => oe.type === "text" && oe.content === "​";
1223
+ if (s.length === 0 || s.every(p)) {
1224
+ ge();
1225
1225
  return;
1226
1226
  }
1227
- p("update:templateData", s);
1227
+ f("update:templateData", s);
1228
1228
  };
1229
- ne(
1229
+ ie(
1230
1230
  () => l.templateData,
1231
1231
  () => {
1232
1232
  _.value = l.templateData.map((s) => s.content).join("");
1233
1233
  },
1234
1234
  { deep: !0 }
1235
1235
  );
1236
- const Ve = B(() => {
1236
+ const We = $(() => {
1237
1237
  const s = typeof l.speech == "object" ? l.speech : {};
1238
1238
  return {
1239
1239
  ...s,
1240
- onStart: () => p("speech-start"),
1241
- onEnd: (u) => p("speech-end", u),
1242
- onInterim: (u) => p("speech-interim", u),
1243
- onFinal: (u) => {
1240
+ onStart: () => f("speech-start"),
1241
+ onEnd: (p) => f("speech-end", p),
1242
+ onInterim: (p) => f("speech-interim", p),
1243
+ onFinal: (p) => {
1244
1244
  if (s.autoReplace)
1245
- _.value = u;
1245
+ _.value = p;
1246
1246
  else {
1247
- const C = _.value;
1248
- C && u && !C.endsWith(" ") && !u.startsWith(" ") && C.length > 0 ? _.value = C + " " + u : _.value = C + u;
1247
+ const R = _.value;
1248
+ R && p && !R.endsWith(" ") && !p.startsWith(" ") && R.length > 0 ? _.value = R + " " + p : _.value = R + p;
1249
1249
  }
1250
- p("speech-end", u);
1250
+ f("speech-end", p);
1251
1251
  },
1252
- onError: (u) => {
1253
- p("speech-error", u);
1252
+ onError: (p) => {
1253
+ f("speech-error", p);
1254
1254
  }
1255
1255
  };
1256
- }), { speechState: ue, start: Te, stop: ve } = Ht(Ve.value), ye = () => {
1257
- ue.isRecording ? ve() : Te();
1258
- }, Ee = async () => {
1259
- const s = typeof l.speech == "object" ? l.speech : {}, u = ue.isRecording;
1256
+ }), { speechState: re, start: me, stop: Be } = Mt(We.value), Le = () => {
1257
+ re.isRecording ? Be() : me();
1258
+ }, Me = async () => {
1259
+ const s = typeof l.speech == "object" ? l.speech : {}, p = re.isRecording;
1260
1260
  if (s.onVoiceButtonClick) {
1261
- let C = !1;
1261
+ let R = !1;
1262
1262
  try {
1263
- await s.onVoiceButtonClick(u, () => {
1264
- C = !0;
1263
+ await s.onVoiceButtonClick(p, () => {
1264
+ R = !0;
1265
1265
  });
1266
- } catch (re) {
1267
- console.error("语音按钮点击拦截器执行失败:", re);
1266
+ } catch (oe) {
1267
+ console.error("语音按钮点击拦截器执行失败:", oe);
1268
1268
  }
1269
- if (C)
1269
+ if (R)
1270
1270
  return;
1271
1271
  }
1272
- ye();
1273
- }, ge = B(() => l.maxLength !== 1 / 0 && _.value.length > l.maxLength), { handleKeyPress: je, triggerSubmit: le } = At(
1272
+ Le();
1273
+ }, ce = $(() => l.maxLength !== 1 / 0 && _.value.length > l.maxLength), { handleKeyPress: Ne, triggerSubmit: pe } = Wt(
1274
1274
  l,
1275
- p,
1275
+ f,
1276
1276
  _,
1277
- V,
1278
- ue,
1279
- b,
1277
+ k,
1278
+ re,
1279
+ u,
1280
+ S,
1281
+ U,
1282
+ Se,
1283
+ xe,
1284
+ Le,
1280
1285
  x,
1281
- Ie,
1282
- J,
1283
- Q,
1284
- ye,
1285
1286
  W,
1286
- F,
1287
- ke,
1287
+ Ce,
1288
1288
  H,
1289
- Y
1290
- ), Fe = (s) => {
1291
- p("focus", s), _.value && !H.value && (b.value = !0);
1292
- }, Oe = (s) => {
1293
- p("blur", s), J();
1294
- }, $e = B(() => F.value === "multiple" ? "textarea" : "text"), Be = xt(), Me = B(() => !!Be.decorativeContent), de = B(
1295
- () => F.value === "multiple" && !!Be["input-prefix"] && !H.value
1296
- );
1297
- kt(g, ([s]) => {
1298
- var u, C;
1299
- (C = (u = g.value) == null ? void 0 : u.parentElement) == null || C.style.setProperty(
1289
+ ge
1290
+ ), De = (s) => {
1291
+ f("focus", s), _.value && !H.value && (u.value = !0);
1292
+ }, ze = (s) => {
1293
+ f("blur", s), Se();
1294
+ }, Ue = $(() => W.value === "multiple" ? "textarea" : "text"), Ie = kt(), e = $(() => !!Ie.decorativeContent), n = $(
1295
+ () => W.value === "multiple" && !!Ie["input-prefix"] && !H.value
1296
+ ), o = $(() => n.value && A.value > 0), c = () => {
1297
+ G(() => {
1298
+ var s, p;
1299
+ W.value === "multiple" && ((p = (s = C.value) == null ? void 0 : s.resizeTextarea) == null || p.call(s));
1300
+ });
1301
+ };
1302
+ at(g, ([s]) => {
1303
+ var R, oe;
1304
+ const p = s.contentRect.width;
1305
+ A.value = p, (oe = (R = g.value) == null ? void 0 : R.parentElement) == null || oe.style.setProperty(
1300
1306
  "--tr-sender-input-prefix-width",
1301
- `${s.contentRect.width}px`
1302
- );
1307
+ `${p}px`
1308
+ ), c();
1309
+ }), at(y, ([s]) => {
1310
+ s.contentRect.width !== M && (M = s.contentRect.width, c());
1303
1311
  });
1304
- const e = (s) => {
1312
+ const r = (s) => {
1305
1313
  L.value = s.target.scrollTop;
1306
- }, n = () => {
1307
- D == null || D.removeEventListener("scroll", e), D = null, L.value = 0;
1308
- }, o = async (s) => {
1309
- var C;
1310
- if (n(), !s || (await q(), !de.value)) return;
1311
- const u = (C = h.value) == null ? void 0 : C.querySelector(".tiny-textarea__inner");
1312
- u && (D = u, u.addEventListener("scroll", e), L.value = u.scrollTop);
1314
+ }, d = () => {
1315
+ F == null || F.removeEventListener("scroll", r), F = null, L.value = 0;
1316
+ }, w = async (s) => {
1317
+ var R;
1318
+ if (d(), !s || (await G(), !o.value)) return;
1319
+ const p = (R = h.value) == null ? void 0 : R.querySelector(".tiny-textarea__inner");
1320
+ p && (F = p, p.addEventListener("scroll", r), L.value = p.scrollTop);
1313
1321
  };
1314
- ne(
1315
- [de, I],
1322
+ ie(
1323
+ [o, C],
1316
1324
  ([s]) => {
1317
- o(s);
1325
+ w(s);
1318
1326
  },
1319
1327
  { immediate: !0, flush: "post" }
1320
- ), Ct(n);
1321
- const r = B(() => l.disabled || Me.value), c = B(() => l.loading), d = B(() => ({
1322
- "is-disabled": r.value,
1323
- "is-loading": c.value,
1324
- "is-auto-switching": te.value
1325
- })), w = B(() => ({
1326
- width: Pt(l.suggestionPopupWidth),
1328
+ ), Tt(d);
1329
+ const T = $(() => l.disabled || e.value), Y = $(() => l.loading), B = $(() => ({
1330
+ "is-disabled": T.value,
1331
+ "is-loading": Y.value,
1332
+ "is-auto-switching": X.value
1333
+ })), P = $(() => ({
1334
+ width: Vt(l.suggestionPopupWidth),
1327
1335
  maxWidth: "100%"
1328
1336
  // 确保不超出父容器宽度
1329
- })), O = () => {
1330
- V.value = !1;
1337
+ })), V = () => {
1338
+ k.value = !1;
1331
1339
  };
1332
- ne(_, () => {
1333
- q(pe), _.value === "" && l.mode === "single" && (F.value = "single"), K();
1334
- }), ne(
1340
+ ie(_, () => {
1341
+ G(Oe), _.value === "" && l.mode === "single" && (W.value = "single"), J();
1342
+ }), ie(
1335
1343
  () => H.value,
1336
1344
  (s) => {
1337
- s && (F.value = "multiple");
1345
+ s && (W.value = "multiple");
1338
1346
  }
1339
1347
  );
1340
- const U = () => {
1348
+ const ne = () => {
1341
1349
  v.value && v.value.activateFirstField();
1342
- }, { open: $, files: P } = Rt({
1343
- accept: ze(() => {
1344
- var s, u;
1345
- return ((u = (s = l.buttonGroup) == null ? void 0 : s.file) == null ? void 0 : u.accept) ?? "*";
1350
+ }, { open: fe, files: ut } = $t({
1351
+ accept: je(() => {
1352
+ var s, p;
1353
+ return ((p = (s = l.buttonGroup) == null ? void 0 : s.file) == null ? void 0 : p.accept) ?? "*";
1346
1354
  }),
1347
- multiple: ze(() => {
1348
- var s, u;
1349
- return ((u = (s = l.buttonGroup) == null ? void 0 : s.file) == null ? void 0 : u.multiple) ?? !0;
1355
+ multiple: je(() => {
1356
+ var s, p;
1357
+ return ((p = (s = l.buttonGroup) == null ? void 0 : s.file) == null ? void 0 : p.multiple) ?? !0;
1350
1358
  }),
1351
- reset: ze(() => {
1352
- var s, u;
1353
- return ((u = (s = l.buttonGroup) == null ? void 0 : s.file) == null ? void 0 : u.reset) ?? !0;
1359
+ reset: je(() => {
1360
+ var s, p;
1361
+ return ((p = (s = l.buttonGroup) == null ? void 0 : s.file) == null ? void 0 : p.reset) ?? !0;
1354
1362
  })
1355
1363
  });
1356
- return ne(P, (s) => {
1357
- s && s.length > 0 && p("files-selected", Array.from(s));
1364
+ return ie(ut, (s) => {
1365
+ s && s.length > 0 && f("files-selected", Array.from(s));
1358
1366
  }), i({
1359
- focus: ae,
1360
- blur: He,
1361
- clear: he,
1362
- submit: le,
1363
- startSpeech: Te,
1364
- stopSpeech: ve,
1365
- activateTemplateFirstField: U
1366
- }), (s, u) => (m(), R("div", {
1367
+ focus: te,
1368
+ blur: $e,
1369
+ clear: _e,
1370
+ submit: pe,
1371
+ startSpeech: me,
1372
+ stopSpeech: Be,
1373
+ activateTemplateFirstField: ne
1374
+ }), (s, p) => (m(), E("div", {
1367
1375
  ref_key: "senderRef",
1368
1376
  ref: h,
1369
- class: se(["tiny-sender", [d.value, `theme-${t.theme}`, `mode-${F.value}`]]),
1377
+ class: le(["tiny-sender", [B.value, `theme-${t.theme}`, `mode-${W.value}`]]),
1370
1378
  "data-theme": t.theme
1371
1379
  }, [
1372
- G("div", ln, [
1373
- G("div", {
1380
+ q("div", dn, [
1381
+ q("div", {
1374
1382
  class: "tiny-sender__input-wrapper",
1375
1383
  ref_key: "inputWrapperRef",
1376
1384
  ref: y
1377
1385
  }, [
1378
- ee(qe, { name: "tiny-sender-slide-down" }, {
1379
- default: me(() => [
1380
- s.$slots.header ? (m(), R("div", rn, [
1381
- ce(s.$slots, "header", {}, void 0, !0)
1382
- ])) : M("", !0)
1386
+ se(Ye, { name: "tiny-sender-slide-down" }, {
1387
+ default: we(() => [
1388
+ s.$slots.header ? (m(), E("div", fn, [
1389
+ ue(s.$slots, "header", {}, void 0, !0)
1390
+ ])) : N("", !0)
1383
1391
  ]),
1384
1392
  _: 3
1385
1393
  }),
1386
- G("div", {
1387
- class: se(["tiny-sender__input-row", { "has-prefix": s.$slots.prefix, "has-header": s.$slots.header }])
1394
+ q("div", {
1395
+ class: le(["tiny-sender__input-row", { "has-prefix": s.$slots.prefix, "has-header": s.$slots.header }])
1388
1396
  }, [
1389
- s.$slots.prefix ? (m(), R("div", cn, [
1390
- ce(s.$slots, "prefix", {}, void 0, !0)
1391
- ])) : M("", !0),
1392
- G("div", un, [
1393
- ce(s.$slots, "content", {}, () => [
1394
- s.$slots.decorativeContent ? (m(), R("div", dn, [
1395
- ce(s.$slots, "decorativeContent", {}, void 0, !0)
1396
- ])) : M("", !0),
1397
- H.value ? (m(), oe(Zt, {
1397
+ s.$slots.prefix ? (m(), E("div", pn, [
1398
+ ue(s.$slots, "prefix", {}, void 0, !0)
1399
+ ])) : N("", !0),
1400
+ q("div", hn, [
1401
+ ue(s.$slots, "content", {}, () => [
1402
+ s.$slots.decorativeContent ? (m(), E("div", vn, [
1403
+ ue(s.$slots, "decorativeContent", {}, void 0, !0)
1404
+ ])) : N("", !0),
1405
+ H.value ? (m(), ae(nn, {
1398
1406
  key: 1,
1399
1407
  ref_key: "templateEditorRef",
1400
1408
  ref: v,
1401
1409
  "model-value": l.templateData,
1402
1410
  "auto-size": t.autoSize,
1403
- "onUpdate:modelValue": Re,
1404
- onSubmit: k(le)
1405
- }, null, 8, ["model-value", "auto-size", "onSubmit"])) : (m(), R("div", {
1411
+ "onUpdate:modelValue": Fe,
1412
+ onSubmit: I(pe)
1413
+ }, null, 8, ["model-value", "auto-size", "onSubmit"])) : (m(), E("div", {
1406
1414
  key: 2,
1407
- class: se(["tiny-sender__input-field-wrapper", { "has-input-prefix": de.value }])
1415
+ class: le(["tiny-sender__input-field-wrapper", { "has-input-prefix": o.value }])
1408
1416
  }, [
1409
- de.value ? (m(), R("div", {
1417
+ n.value ? (m(), E("div", {
1410
1418
  key: 0,
1411
1419
  ref_key: "inputPrefixRef",
1412
1420
  ref: g,
1413
1421
  class: "tiny-sender__input-prefix",
1414
- style: Ae({ transform: `translateY(-${L.value}px)` })
1422
+ style: Ve({ transform: `translateY(-${L.value}px)` })
1415
1423
  }, [
1416
- ce(s.$slots, "input-prefix", {}, void 0, !0)
1417
- ], 4)) : M("", !0),
1418
- ee(k(It), {
1424
+ ue(s.$slots, "input-prefix", {}, void 0, !0)
1425
+ ], 4)) : N("", !0),
1426
+ se(I(Ot), {
1419
1427
  ref_key: "inputRef",
1420
- ref: I,
1428
+ ref: C,
1421
1429
  autosize: t.autoSize,
1422
- type: $e.value,
1430
+ type: Ue.value,
1423
1431
  resize: "none",
1424
- modelValue: k(_),
1425
- "onUpdate:modelValue": u[0] || (u[0] = (C) => _t(_) ? _.value = C : null),
1426
- disabled: r.value,
1432
+ modelValue: I(_),
1433
+ "onUpdate:modelValue": p[0] || (p[0] = (R) => Et(_) ? _.value = R : null),
1434
+ disabled: T.value,
1427
1435
  placeholder: t.placeholder,
1428
1436
  autofocus: t.autofocus,
1429
- onKeydown: k(je),
1430
- onCompositionstart: u[1] || (u[1] = (C) => V.value = !0),
1431
- onCompositionend: O,
1432
- onFocus: Fe,
1433
- onBlur: Oe
1437
+ onKeydown: I(Ne),
1438
+ onCompositionstart: p[1] || (p[1] = (R) => k.value = !0),
1439
+ onCompositionend: V,
1440
+ onFocus: De,
1441
+ onBlur: ze
1434
1442
  }, null, 8, ["autosize", "type", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
1435
- k(z) && !k(V) ? (m(), R("div", fn, [
1436
- G("span", pn, fe(k(_)), 1),
1437
- nt(" " + fe(k(z)) + " ", 1),
1438
- k(Z) ? (m(), R("div", hn, "TAB")) : M("", !0)
1439
- ])) : M("", !0)
1443
+ I(D) && !I(k) ? (m(), E("div", yn, [
1444
+ q("span", gn, he(I(_)), 1),
1445
+ it(" " + he(I(D)) + " ", 1),
1446
+ I(Q) ? (m(), E("div", mn, "TAB")) : N("", !0)
1447
+ ])) : N("", !0)
1440
1448
  ], 2))
1441
1449
  ], !0)
1442
1450
  ]),
1443
- F.value === "single" ? (m(), R("div", vn, [
1444
- G("div", {
1451
+ W.value === "single" ? (m(), E("div", wn, [
1452
+ q("div", {
1445
1453
  class: "tiny-sender__buttons-container",
1446
1454
  ref_key: "buttonsContainerRef",
1447
- ref: T
1455
+ ref: O
1448
1456
  }, [
1449
- ce(s.$slots, "actions", {}, void 0, !0),
1450
- ee(ot, {
1457
+ ue(s.$slots, "actions", {}, void 0, !0),
1458
+ se(lt, {
1451
1459
  "allow-speech": t.allowSpeech,
1452
1460
  "allow-files": t.allowFiles,
1453
1461
  loading: t.loading,
1454
- disabled: r.value,
1462
+ disabled: T.value,
1455
1463
  "show-clear": t.clearable,
1456
- "has-content": E.value,
1457
- "speech-status": k(ue),
1464
+ "has-content": b.value,
1465
+ "speech-status": I(re),
1458
1466
  "button-group": t.buttonGroup,
1459
1467
  "submit-type": t.submitType,
1460
- "is-over-limit": ge.value,
1468
+ "is-over-limit": ce.value,
1461
1469
  "stop-text": t.stopText,
1462
- onClear: he,
1463
- onVoiceButtonClick: Ee,
1464
- onSubmit: k(le),
1465
- onCancel: u[2] || (u[2] = (C) => s.$emit("cancel")),
1466
- onTriggerSelect: k($)
1470
+ onClear: _e,
1471
+ onVoiceButtonClick: Me,
1472
+ onSubmit: I(pe),
1473
+ onCancel: p[2] || (p[2] = (R) => s.$emit("cancel")),
1474
+ onTriggerSelect: I(fe)
1467
1475
  }, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "button-group", "submit-type", "is-over-limit", "stop-text", "onSubmit", "onTriggerSelect"])
1468
1476
  ], 512)
1469
- ])) : M("", !0)
1477
+ ])) : N("", !0)
1470
1478
  ], 2),
1471
- ee(qe, { name: "tiny-sender-slide-up" }, {
1472
- default: me(() => [
1473
- F.value === "multiple" ? (m(), R("div", yn, [
1474
- G("div", gn, [
1475
- ce(s.$slots, "footer-left", {}, void 0, !0)
1479
+ se(Ye, { name: "tiny-sender-slide-up" }, {
1480
+ default: we(() => [
1481
+ W.value === "multiple" ? (m(), E("div", bn, [
1482
+ q("div", Sn, [
1483
+ ue(s.$slots, "footer-left", {}, void 0, !0)
1476
1484
  ]),
1477
- G("div", mn, [
1478
- ce(s.$slots, "footer-right", {}, void 0, !0),
1479
- t.showWordLimit && t.maxLength !== 1 / 0 ? (m(), R("div", {
1485
+ q("div", xn, [
1486
+ ue(s.$slots, "footer-right", {}, void 0, !0),
1487
+ t.showWordLimit && t.maxLength !== 1 / 0 ? (m(), E("div", {
1480
1488
  key: 0,
1481
- class: se(["tiny-sender__word-limit", { "is-over-limit": ge.value }])
1489
+ class: le(["tiny-sender__word-limit", { "is-over-limit": ce.value }])
1482
1490
  }, [
1483
- G("span", wn, fe(k(_).length), 1),
1484
- nt("/" + fe(t.maxLength), 1)
1485
- ], 2)) : M("", !0),
1486
- F.value === "multiple" ? (m(), R("div", bn, [
1487
- G("div", Sn, [
1488
- ee(ot, {
1491
+ q("span", Cn, he(I(_).length), 1),
1492
+ it("/" + he(t.maxLength), 1)
1493
+ ], 2)) : N("", !0),
1494
+ W.value === "multiple" ? (m(), E("div", _n, [
1495
+ q("div", In, [
1496
+ se(lt, {
1489
1497
  "allow-speech": t.allowSpeech,
1490
1498
  "allow-files": t.allowFiles,
1491
1499
  loading: t.loading,
1492
- disabled: r.value,
1500
+ disabled: T.value,
1493
1501
  "show-clear": t.clearable,
1494
- "has-content": E.value,
1495
- "speech-status": k(ue),
1502
+ "has-content": b.value,
1503
+ "speech-status": I(re),
1496
1504
  "button-group": t.buttonGroup,
1497
1505
  "submit-type": t.submitType,
1498
- "is-over-limit": ge.value,
1506
+ "is-over-limit": ce.value,
1499
1507
  "stop-text": t.stopText,
1500
- onClear: he,
1501
- onVoiceButtonClick: Ee,
1502
- onSubmit: k(le),
1503
- onCancel: u[3] || (u[3] = (C) => s.$emit("cancel")),
1504
- onTriggerSelect: k($)
1508
+ onClear: _e,
1509
+ onVoiceButtonClick: Me,
1510
+ onSubmit: I(pe),
1511
+ onCancel: p[3] || (p[3] = (R) => s.$emit("cancel")),
1512
+ onTriggerSelect: I(fe)
1505
1513
  }, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "button-group", "submit-type", "is-over-limit", "stop-text", "onSubmit", "onTriggerSelect"])
1506
1514
  ])
1507
- ])) : M("", !0)
1515
+ ])) : N("", !0)
1508
1516
  ])
1509
- ])) : s.$slots.footer ? (m(), R("div", xn, [
1510
- ce(s.$slots, "footer", {}, void 0, !0)
1511
- ])) : M("", !0)
1517
+ ])) : s.$slots.footer ? (m(), E("div", Rn, [
1518
+ ue(s.$slots, "footer", {}, void 0, !0)
1519
+ ])) : N("", !0)
1512
1520
  ]),
1513
1521
  _: 3
1514
1522
  })
1515
1523
  ], 512)
1516
1524
  ]),
1517
- ee(sn, {
1518
- show: k(b),
1525
+ se(cn, {
1526
+ show: I(u),
1519
1527
  suggestions: t.suggestions,
1520
- "popup-style": w.value,
1521
- "active-keyboard-index": k(f),
1522
- "active-mouse-index": k(S),
1523
- "input-value": k(_),
1524
- onSelect: k(X),
1525
- onMouseEnter: k(N),
1526
- onMouseLeave: k(be)
1528
+ "popup-style": P.value,
1529
+ "active-keyboard-index": I(j),
1530
+ "active-mouse-index": I(Z),
1531
+ "input-value": I(_),
1532
+ onSelect: I(ee),
1533
+ onMouseEnter: I(ve),
1534
+ onMouseLeave: I(ye)
1527
1535
  }, null, 8, ["show", "suggestions", "popup-style", "active-keyboard-index", "active-mouse-index", "input-value", "onSelect", "onMouseEnter", "onMouseLeave"])
1528
- ], 10, an));
1536
+ ], 10, un));
1529
1537
  }
1530
- }), Ke = /* @__PURE__ */ _e(Cn, [["__scopeId", "data-v-be921b04"]]);
1531
- Ke.name = "TrSender";
1532
- const _n = function(t) {
1533
- t.component(Ke.name, Ke);
1538
+ }), He = /* @__PURE__ */ Ee(kn, [["__scopeId", "data-v-b534dc0f"]]);
1539
+ He.name = "TrSender";
1540
+ const Tn = function(t) {
1541
+ t.component(He.name, He);
1534
1542
  };
1535
- Ke.install = _n;
1543
+ He.install = Tn;
1536
1544
  export {
1537
- Ke as default
1545
+ He as default
1538
1546
  };