@opentiny/tiny-robot 0.3.0-alpha.31 → 0.3.0-alpha.33

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