@opentiny/tiny-robot 0.3.0-alpha.11 → 0.3.0-alpha.13

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,10 +1,10 @@
1
- import { ref as H, watch as ee, reactive as at, computed as L, nextTick as J, defineComponent as me, createElementBlock as R, openBlock as S, createCommentVNode as M, normalizeStyle as Pe, createBlock as Q, unref as C, withCtx as re, createElementVNode as U, createVNode as X, normalizeClass as te, toDisplayString as ae, useAttrs as lt, resolveComponent as rt, mergeProps as ve, Fragment as ie, renderList as ye, mergeModels as it, useModel as ut, Transition as He, withModifiers as ct, useSlots as dt, renderSlot as oe, isRef as ft, createTextVNode as Ge } from "vue";
1
+ import { ref as H, watch as ee, reactive as at, computed as L, nextTick as X, defineComponent as me, createElementBlock as R, openBlock as S, createCommentVNode as q, normalizeStyle as Ke, createBlock as Y, unref as C, withCtx as re, createElementVNode as M, createVNode as J, normalizeClass as te, toDisplayString as ae, useAttrs as lt, resolveComponent as rt, mergeProps as ve, Fragment as ie, renderList as ye, mergeModels as it, useModel as ut, Transition as He, withModifiers as ct, useSlots as dt, renderSlot as oe, isRef as ft, createTextVNode as Ge } from "vue";
2
2
  import { I as pt } from "../index6.js";
3
3
  import { d as ht } from "../index3.js";
4
4
  import { T as Ee } from "../index2.js";
5
- import { B as gt, Z as vt, a as yt, U as mt, O as St, b as wt, S as bt } from "../tiny-robot-svgs.js";
5
+ import { K as gt, $ as vt, H as yt, c as mt, q as St, J as wt, s as _t } from "../tiny-robot-svgs.js";
6
6
  import { _ as Oe } from "../_plugin-vue_export-helper.js";
7
- import { t as _t } from "../utils.js";
7
+ import { t as bt } from "../utils.js";
8
8
  function Ct(i, c) {
9
9
  const a = H(i.modelValue || i.defaultValue || ""), u = H(null);
10
10
  ee(
@@ -39,12 +39,12 @@ function Ct(i, c) {
39
39
  }
40
40
  };
41
41
  }
42
- function kt(i, c, a, u, v, w, o, p, _, h, k, g, I, m, P, B) {
42
+ function kt(i, c, a, u, v, w, o, p, b, h, k, g, I, m, K, B) {
43
43
  const A = () => {
44
- g.value && (P != null && P.value && (B == null || B()), c("submit", a.value.trim()));
45
- }, f = (y, W) => {
44
+ g.value && (K != null && K.value && (B == null || B()), c("submit", a.value.trim()));
45
+ }, f = (y, P) => {
46
46
  if (!(y.key === "Enter")) return !1;
47
- switch (W) {
47
+ switch (P) {
48
48
  case "enter":
49
49
  return !y.shiftKey && !y.ctrlKey && !y.metaKey;
50
50
  case "ctrlEnter":
@@ -60,10 +60,10 @@ function kt(i, c, a, u, v, w, o, p, _, h, k, g, I, m, P, B) {
60
60
  if (u.value) return;
61
61
  if (y.key === "Enter" && y.shiftKey && (I == null ? void 0 : I.value) === "single" && m) {
62
62
  y.preventDefault(), m();
63
- const K = y.target, q = K.selectionStart, Z = a.value;
64
- a.value = Z.substring(0, q) + `
65
- ` + Z.substring(q), setTimeout(() => {
66
- K.selectionStart = K.selectionEnd = q + 1;
63
+ const W = y.target, U = W.selectionStart, Q = a.value;
64
+ a.value = Q.substring(0, U) + `
65
+ ` + Q.substring(U), setTimeout(() => {
66
+ W.selectionStart = W.selectionEnd = U + 1;
67
67
  }, 0);
68
68
  return;
69
69
  }
@@ -86,7 +86,7 @@ function kt(i, c, a, u, v, w, o, p, _, h, k, g, I, m, P, B) {
86
86
  }
87
87
  }
88
88
  if (y.key === "Escape") {
89
- w.value ? (_(), y.preventDefault()) : v.isRecording && (k(), y.preventDefault()), c("escape-press");
89
+ w.value ? (b(), y.preventDefault()) : v.isRecording && (k(), y.preventDefault()), c("escape-press");
90
90
  return;
91
91
  }
92
92
  f(y, i.submitType) && (y.preventDefault(), g.value && A());
@@ -107,9 +107,9 @@ function xt(i) {
107
107
  var o;
108
108
  c.isRecording = !1, (o = i.onEnd) == null || o.call(i);
109
109
  }, a.onresult = (o) => {
110
- var _, h;
110
+ var b, h;
111
111
  const p = Array.from(o.results).map((k) => k[0].transcript).join("");
112
- o.results[0].isFinal ? (_ = i.onFinal) == null || _.call(i, p) : (h = i.onInterim) == null || h.call(i, p);
112
+ o.results[0].isFinal ? (b = i.onFinal) == null || b.call(i, p) : (h = i.onInterim) == null || h.call(i, p);
113
113
  }, a.onerror = (o) => {
114
114
  var p;
115
115
  c.error = new Error(o.error), c.isRecording = !1, (p = i.onError) == null || p.call(i, c.error);
@@ -181,67 +181,67 @@ const It = (i, c) => {
181
181
  h.start <= k.end ? k.end = Math.max(k.end, h.end) : o.push(h);
182
182
  }
183
183
  const p = [];
184
- let _ = 0;
184
+ let b = 0;
185
185
  for (const h of o)
186
- _ < h.start && p.push({
187
- text: i.substring(_, h.start),
186
+ b < h.start && p.push({
187
+ text: i.substring(b, h.start),
188
188
  isMatch: !1
189
189
  }), p.push({
190
190
  text: i.substring(h.start, h.end),
191
191
  isMatch: !0
192
- }), _ = h.end;
193
- return _ < i.length && p.push({
194
- text: i.substring(_),
192
+ }), b = h.end;
193
+ return b < i.length && p.push({
194
+ text: i.substring(b),
195
195
  isMatch: !1
196
196
  }), p;
197
197
  };
198
198
  function Rt(i, c, a, u, v) {
199
- const w = H(!1), o = H(-1), p = H(-1), _ = H(""), h = H(!1), k = H(null), g = H(!1), I = H(null), m = L(() => {
199
+ const w = H(!1), o = H(-1), p = H(-1), b = H(""), h = H(!1), k = H(null), g = H(!1), I = H(null), m = L(() => {
200
200
  if (!i.suggestions || !a.value || v.value) return [];
201
201
  const O = a.value.toLowerCase();
202
202
  return i.suggestions.filter((V) => V.toLowerCase().includes(O));
203
- }), P = L(() => {
203
+ }), K = L(() => {
204
204
  let O = -1;
205
205
  return I.value === "mouse" && p.value !== -1 ? O = p.value : I.value === "keyboard" && o.value !== -1 && (O = o.value), m.value[O] || null;
206
206
  }), B = (O) => O === o.value || O === p.value, A = (O) => {
207
207
  if (I.value === null) {
208
- _.value = "", h.value = !1;
208
+ b.value = "", h.value = !1;
209
209
  return;
210
210
  }
211
- const V = O || P.value;
212
- V && a.value && V.toLowerCase().startsWith(a.value.toLowerCase()) ? (_.value = V.substring(a.value.length), h.value = !0) : (_.value = "", h.value = !1);
211
+ const V = O || K.value;
212
+ V && a.value && V.toLowerCase().startsWith(a.value.toLowerCase()) ? (b.value = V.substring(a.value.length), h.value = !0) : (b.value = "", h.value = !1);
213
213
  }, f = () => {
214
- w.value = !1, o.value = -1, p.value = -1, I.value = null, _.value = "", h.value = !1;
214
+ w.value = !1, o.value = -1, p.value = -1, I.value = null, b.value = "", h.value = !1;
215
215
  }, E = () => {
216
216
  w.value = !0, o.value = -1, p.value = -1, I.value = null, A();
217
217
  }, y = () => {
218
- u.value || g.value || J(() => {
218
+ u.value || g.value || X(() => {
219
219
  a.value && i.suggestions && i.suggestions.length > 0 && !v.value && m.value.length > 0 ? E() : f();
220
220
  });
221
221
  };
222
222
  ee(a, y), ee(() => i.suggestions, y);
223
- const W = (O) => {
224
- g.value = !0, a.value = O, c("update:modelValue", O), c("suggestion-select", O), q(), J(() => {
223
+ const P = (O) => {
224
+ g.value = !0, a.value = O, c("update:modelValue", O), c("suggestion-select", O), U(), X(() => {
225
225
  g.value = !1;
226
226
  });
227
- }, K = () => {
228
- P.value && W(P.value);
229
- }, q = () => {
227
+ }, W = () => {
228
+ K.value && P(K.value);
229
+ }, U = () => {
230
230
  f();
231
231
  };
232
232
  return {
233
233
  showSuggestionsPopup: w,
234
- completionPlaceholder: _,
234
+ completionPlaceholder: b,
235
235
  showTabHint: h,
236
236
  suggestionsListRef: k,
237
237
  filteredSuggestions: m,
238
- activeSuggestion: P,
238
+ activeSuggestion: K,
239
239
  isItemHighlighted: B,
240
240
  updateCompletionPlaceholder: A,
241
241
  updateSuggestionsState: y,
242
- selectSuggestion: W,
243
- acceptCurrentSuggestion: K,
244
- closeSuggestionsPopup: q,
242
+ selectSuggestion: P,
243
+ acceptCurrentSuggestion: W,
244
+ closeSuggestionsPopup: U,
245
245
  navigateSuggestions: (O) => {
246
246
  if (!w.value || m.value.length === 0) return;
247
247
  I.value = "keyboard", o.value === -1 ? o.value = O === "down" ? 0 : m.value.length - 1 : O === "down" ? o.value = (o.value + 1) % m.value.length : o.value = (o.value - 1 + m.value.length) % m.value.length;
@@ -265,7 +265,7 @@ function Rt(i, c, a, u, v) {
265
265
  I.value = null, A();
266
266
  },
267
267
  handleClickOutside: () => {
268
- q();
268
+ U();
269
269
  },
270
270
  highlightSuggestionText: It
271
271
  };
@@ -308,23 +308,23 @@ const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
308
308
  return () => f;
309
309
  if (typeof f == "function")
310
310
  return f;
311
- }), o = L(() => a.allowSpeech), p = L(() => a.speechStatus.isRecording), _ = L(() => a.disabled), h = L(() => {
311
+ }), o = L(() => a.allowSpeech), p = L(() => a.speechStatus.isRecording), b = L(() => a.disabled), h = L(() => {
312
312
  var f, E;
313
- return _.value || a.isOverLimit || ((E = (f = a.buttonGroup) == null ? void 0 : f.submit) == null ? void 0 : E.disabled);
313
+ return b.value || a.isOverLimit || ((E = (f = a.buttonGroup) == null ? void 0 : f.submit) == null ? void 0 : E.disabled);
314
314
  }), k = L(() => a.allowFiles || a.allowSpeech || a.showClear), g = () => {
315
- _.value || u("clear");
315
+ b.value || u("clear");
316
316
  }, I = () => {
317
- if (!_.value) {
317
+ if (!b.value) {
318
318
  const f = !a.speechStatus.isRecording;
319
319
  u("toggle-speech", f);
320
320
  }
321
321
  }, m = () => {
322
322
  h.value || u("submit");
323
- }, P = () => {
324
- _.value || u("cancel");
323
+ }, K = () => {
324
+ b.value || u("cancel");
325
325
  }, B = L(() => {
326
326
  var f, E;
327
- return _.value || ((E = (f = a.buttonGroup) == null ? void 0 : f.file) == null ? void 0 : E.disabled);
327
+ return b.value || ((E = (f = a.buttonGroup) == null ? void 0 : f.file) == null ? void 0 : E.disabled);
328
328
  }), A = () => {
329
329
  B.value || u("trigger-select");
330
330
  };
@@ -332,9 +332,9 @@ const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
332
332
  k.value ? (S(), R("div", {
333
333
  key: 0,
334
334
  class: "action-buttons__utility",
335
- style: Pe({ "padding-right": f.hasContent || f.loading ? "0" : "6px" })
335
+ style: Ke({ "padding-right": f.hasContent || f.loading ? "0" : "6px" })
336
336
  }, [
337
- f.allowFiles && !f.loading ? (S(), Q(C(Ee), {
337
+ f.allowFiles && !f.loading ? (S(), Y(C(Ee), {
338
338
  key: 0,
339
339
  effect: "light",
340
340
  placement: "top",
@@ -342,65 +342,65 @@ const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
342
342
  "visible-arrow": !1
343
343
  }, {
344
344
  default: re(() => [
345
- U("div", {
345
+ M("div", {
346
346
  class: "action-buttons__button",
347
347
  onClick: A
348
348
  }, [
349
- X(C(gt), {
349
+ J(C(gt), {
350
350
  class: te(["action-buttons__icon", "action-buttons__icon--upload", { "is-disabled": B.value }]),
351
351
  alt: "上传文件"
352
352
  }, null, 8, ["class"])
353
353
  ])
354
354
  ]),
355
355
  _: 1
356
- }, 8, ["render-content"])) : M("", !0),
356
+ }, 8, ["render-content"])) : q("", !0),
357
357
  o.value && !f.loading ? (S(), R("div", {
358
358
  key: 1,
359
359
  class: te(["action-buttons__button", { "is-recording": p.value }]),
360
360
  onClick: I
361
361
  }, [
362
- p.value ? (S(), Q(C(yt), {
362
+ p.value ? (S(), Y(C(yt), {
363
363
  key: 1,
364
364
  class: "action-buttons__icon action-buttons__icon--recording",
365
365
  alt: "语音中"
366
- })) : (S(), Q(C(vt), {
366
+ })) : (S(), Y(C(vt), {
367
367
  key: 0,
368
368
  class: "action-buttons__icon",
369
369
  alt: "录音"
370
370
  }))
371
- ], 2)) : M("", !0),
372
- f.showClear ? (S(), Q(C(Ee), {
371
+ ], 2)) : q("", !0),
372
+ f.showClear ? (S(), Y(C(Ee), {
373
373
  key: 2,
374
374
  content: "清空内容",
375
375
  placement: "top"
376
376
  }, {
377
377
  default: re(() => [
378
- U("div", {
378
+ M("div", {
379
379
  class: "action-buttons__button",
380
380
  onClick: g
381
381
  }, [
382
- X(C(mt), { class: "action-buttons__icon action-buttons__icon--clear" })
382
+ J(C(mt), { class: "action-buttons__icon action-buttons__icon--clear" })
383
383
  ])
384
384
  ]),
385
385
  _: 1
386
- })) : M("", !0)
387
- ], 4)) : M("", !0),
386
+ })) : q("", !0)
387
+ ], 4)) : q("", !0),
388
388
  f.hasContent || f.loading ? (S(), R("div", {
389
389
  key: 1,
390
390
  class: "action-buttons__button action-buttons__submit",
391
- onClick: E[0] || (E[0] = (y) => f.loading ? P() : m())
391
+ onClick: E[0] || (E[0] = (y) => f.loading ? K() : m())
392
392
  }, [
393
- U("div", Tt, [
393
+ M("div", Tt, [
394
394
  f.loading ? (S(), R("div", {
395
395
  key: 1,
396
396
  class: te(["action-buttons__cancel", { "action-buttons__cancel--icon-only": !f.stopText }])
397
397
  }, [
398
- X(C(wt), {
398
+ J(C(wt), {
399
399
  class: "action-buttons__icon action-buttons__icon--cancel",
400
400
  alt: "停止"
401
401
  }),
402
- f.stopText ? (S(), R("span", $t, ae(f.stopText), 1)) : M("", !0)
403
- ], 2)) : (S(), Q(C(Ee), {
402
+ f.stopText ? (S(), R("span", $t, ae(f.stopText), 1)) : q("", !0)
403
+ ], 2)) : (S(), Y(C(Ee), {
404
404
  key: 0,
405
405
  effect: "light",
406
406
  placement: "top",
@@ -408,7 +408,7 @@ const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
408
408
  "visible-arrow": !1
409
409
  }, {
410
410
  default: re(() => [
411
- X(C(St), {
411
+ J(C(St), {
412
412
  class: te(["action-buttons__icon", "action-buttons__icon--send", { "is-disabled": h.value }]),
413
413
  alt: "发送"
414
414
  }, null, 8, ["class"])
@@ -416,10 +416,10 @@ const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
416
416
  _: 1
417
417
  }, 8, ["render-content"]))
418
418
  ])
419
- ])) : M("", !0)
419
+ ])) : q("", !0)
420
420
  ]));
421
421
  }
422
- }), Xe = /* @__PURE__ */ Oe(Bt, [["__scopeId", "data-v-a9e0fa92"]]), Lt = ["data-id", "data-type"], Et = ["data-id", "data-type"], Dt = /* @__PURE__ */ me({
422
+ }), Je = /* @__PURE__ */ Oe(Bt, [["__scopeId", "data-v-a9e0fa92"]]), Lt = ["data-id", "data-type"], Et = ["data-id", "data-type"], Dt = /* @__PURE__ */ me({
423
423
  inheritAttrs: !1,
424
424
  __name: "Block",
425
425
  props: {
@@ -438,14 +438,14 @@ const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
438
438
  "data-id": c.id,
439
439
  "data-type": c.type
440
440
  }, C(a)), ae(c.content), 17, Lt)) : (S(), R(ie, { key: 1 }, [
441
- c.asChild ? (S(!0), R(ie, { key: 0 }, ye(c.content, (o) => (S(), Q(w, ve({
441
+ c.asChild ? (S(!0), R(ie, { key: 0 }, ye(c.content, (o) => (S(), Y(w, ve({
442
442
  key: `${o.id}-${o.type}`
443
443
  }, { ref_for: !0 }, o), null, 16))), 128)) : (S(), R("span", ve({
444
444
  key: 1,
445
445
  "data-id": c.id,
446
446
  "data-type": c.type
447
447
  }, C(a)), [
448
- (S(!0), R(ie, null, ye(c.content, (o) => (S(), Q(w, ve({
448
+ (S(!0), R(ie, null, ye(c.content, (o) => (S(), Y(w, ve({
449
449
  key: `${o.id}-${o.type}`
450
450
  }, { ref_for: !0 }, o), null, 16))), 128))
451
451
  ], 16, Et))
@@ -463,7 +463,7 @@ function Ht(i, c = {}) {
463
463
  a.length && ((k = c.onRemoveHistory) == null || k.call(c, a)), u.length && ((g = c.onRemoveHistory) == null || g.call(c, u)), a = [], u = [];
464
464
  }, get: () => v };
465
465
  }
466
- const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PURE__ */ me({
466
+ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PURE__ */ me({
467
467
  __name: "TemplateEditor",
468
468
  props: {
469
469
  modelValue: { default: () => [] },
@@ -476,10 +476,10 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
476
476
  const e = navigator.userAgent;
477
477
  return e.includes("Safari") && !e.includes("Chrome") && !e.includes("Chromium") && !e.includes("CriOS");
478
478
  }
479
- const o = w(), p = () => Math.random().toString(36).substring(2, 15), _ = ut(i, "modelValue"), h = a, k = H(0), g = (e) => e.map((t, s) => ({
479
+ const o = w(), p = () => Math.random().toString(36).substring(2, 15), b = ut(i, "modelValue"), h = a, k = H(0), g = (e) => e.map((t, s) => ({
480
480
  id: `id-${s}`,
481
481
  ...t.type === "template" ? { ...t, prefix: De, suffix: Fe } : t
482
- })), I = (e) => e.map((t) => ({ type: t.type, content: t.content })), m = H(g(_.value || [])), P = (e) => {
482
+ })), I = (e) => e.map((t) => ({ type: t.type, content: t.content })), m = H(g(b.value || [])), K = (e) => {
483
483
  const t = { type: "text", content: "​", id: p() };
484
484
  if (e.length > 0)
485
485
  if (o && e[e.length - 1].type === "template")
@@ -536,20 +536,20 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
536
536
  timestamp: t,
537
537
  data: s
538
538
  };
539
- }, W = /* @__PURE__ */ new Map(), K = Ht(E(m.value), {
539
+ }, P = /* @__PURE__ */ new Map(), W = Ht(E(m.value), {
540
540
  onRemoveHistory: (e) => {
541
541
  for (const t of e)
542
- W.delete(t);
542
+ P.delete(t);
543
543
  }
544
544
  });
545
545
  ee(
546
- () => _.value,
546
+ () => b.value,
547
547
  (e) => {
548
- P(g(e || [])), K.commit(E(m.value));
548
+ K(g(e || [])), W.commit(E(m.value));
549
549
  },
550
550
  { deep: !0 }
551
551
  );
552
- const q = (e, t = document.body) => t.contains(e) ? e instanceof HTMLElement && e.dataset.id ? e : e.parentElement ? q(e.parentElement, t) : null : null, Z = (e) => e === f.value, ue = (e) => {
552
+ const U = (e, t = document.body) => t.contains(e) ? e instanceof HTMLElement && e.dataset.id ? e : e.parentElement ? U(e.parentElement, t) : null : null, Q = (e) => e === f.value, ue = (e) => {
553
553
  const t = window.getSelection();
554
554
  if (!t)
555
555
  return null;
@@ -575,27 +575,27 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
575
575
  const l = window.getSelection();
576
576
  if (!l)
577
577
  return;
578
- const { node: d, offset: b } = ce(e, t);
578
+ const { node: d, offset: _ } = ce(e, t);
579
579
  if (!s) {
580
- l.setBaseAndExtent(d, b, d, b);
580
+ l.setBaseAndExtent(d, _, d, _);
581
581
  return;
582
582
  }
583
583
  const { node: D, offset: T } = ce(s, r ?? 0);
584
- l.setBaseAndExtent(d, b, D, T);
584
+ l.setBaseAndExtent(d, _, D, T);
585
585
  }, O = (e, t) => {
586
586
  const s = p(), r = { id: s, type: "text", content: e };
587
587
  if (t) {
588
588
  const l = m.value.findIndex((d) => d.id === t);
589
- l !== -1 ? P(
589
+ l !== -1 ? K(
590
590
  m.value.slice(0, l + 1).concat(r).concat(m.value.slice(l + 1))
591
591
  ) : console.warn(`can not find item with id: ${t}`);
592
592
  } else
593
- P([r].concat(m.value));
594
- J(() => {
593
+ K([r].concat(m.value));
594
+ X(() => {
595
595
  var d;
596
596
  const l = (d = f.value) == null ? void 0 : d.querySelector(`[data-id="${s}"][data-type="text"]`);
597
597
  l && G(l, e.length);
598
- }), _.value = I(m.value);
598
+ }), b.value = I(m.value);
599
599
  }, V = H({
600
600
  hasStarted: !1,
601
601
  range: null
@@ -619,17 +619,17 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
619
619
  "deleteSoftLineBackward",
620
620
  "deleteSoftLineForward",
621
621
  "deleteByCut"
622
- ], b = ue(f.value);
622
+ ], _ = ue(f.value);
623
623
  if (d.includes(s)) {
624
- if (r && Z(l.startContainer) && Z(l.endContainer)) {
625
- O(r), b && W.set(K.get(), j(b));
624
+ if (r && Q(l.startContainer) && Q(l.endContainer)) {
625
+ O(r), _ && P.set(W.get(), j(_));
626
626
  return;
627
627
  }
628
628
  const T = j(l);
629
- T.startId && T.endId ? (Se(T, s, r), b && W.set(K.get(), j(b))) : console.warn("range is not valid, range:", T);
629
+ T.startId && T.endId ? (Se(T, s, r), _ && P.set(W.get(), j(_))) : console.warn("range is not valid, range:", T);
630
630
  } else s === "insertCompositionText" && V.value.hasStarted && (V.value = { hasStarted: !1, range: j(l) });
631
631
  }, j = (e) => {
632
- const t = q(e.startContainer, f.value), s = q(e.endContainer, f.value);
632
+ const t = U(e.startContainer, f.value), s = U(e.endContainer, f.value);
633
633
  return {
634
634
  collapsed: e.collapsed,
635
635
  endContainer: e.endContainer,
@@ -650,11 +650,11 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
650
650
  const d = B.value.findIndex((D) => D.id === r.id);
651
651
  if (d < 0 || d >= B.value.length - 1)
652
652
  return [{ ...r, startOffset: 0, endOffset: 0 }];
653
- const b = B.value[d + 1];
653
+ const _ = B.value[d + 1];
654
654
  return [
655
655
  {
656
- id: b.id,
657
- type: b.type,
656
+ id: _.id,
657
+ type: _.type,
658
658
  startOffset: 0,
659
659
  endOffset: 0
660
660
  }
@@ -663,18 +663,18 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
663
663
  const r = we(e);
664
664
  if (!Array.isArray(r) || r.length === 0)
665
665
  return;
666
- const l = ne(r, e, t), d = be(l, e, t, s);
666
+ const l = ne(r, e, t), d = _e(l, e, t, s);
667
667
  if (d.some((T) => T.tag === "new")) {
668
668
  const { afterId: T, content: $ } = d[0];
669
669
  O($, T);
670
670
  return;
671
671
  }
672
- const b = d, D = [];
673
- for (const [T, $] of b.entries()) {
672
+ const _ = d, D = [];
673
+ for (const [T, $] of _.entries()) {
674
674
  const z = m.value.find((Be) => Be.id === $.id), ge = T === 0 ? s : "";
675
675
  z ? z.type === "text" ? z.content = N(z.content, ge, $.startOffset, $.endOffset) : z.type === "template" ? $.type === "prefix" || $.type === "suffix" ? $.startOffset === 0 && $.endOffset === 1 && ge.length === 0 ? z[$.type] = "" : console.warn(`${$.type} can not be inserted text. it only can be deleted`, $) : $.startOffset < 0 || $.endOffset > z.content.length ? D.push(z.id) : z.content = N(z.content, ge, $.startOffset, $.endOffset) : console.warn("dataItem.type is not text or template", z) : console.warn("can not find dataItem", $);
676
676
  }
677
- P(m.value.filter((T) => !D.includes(T.id))), P(
677
+ K(m.value.filter((T) => !D.includes(T.id))), K(
678
678
  m.value.filter((T) => {
679
679
  if (T.type === "text")
680
680
  return T.content.length > 0;
@@ -684,12 +684,12 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
684
684
  );
685
685
  for (const T of m.value.filter(($) => $.type === "template"))
686
686
  T.prefix.length === 0 && (T.prefix = De), T.suffix.length === 0 && (T.suffix = Fe);
687
- b.length > 0 && Te(b, s), _.value = I(m.value);
687
+ _.length > 0 && Te(_, s), b.value = I(m.value);
688
688
  }, Te = (e, t) => {
689
689
  const s = e[0], r = `[data-id="${s.id}"][data-type="${s.type}"]`, l = e.slice(1).map((d) => `[data-id="${d.id}"][data-type="${d.type}"]`);
690
- J(() => {
691
- var b, D;
692
- const d = (b = f.value) == null ? void 0 : b.querySelector(r);
690
+ X(() => {
691
+ var _, D;
692
+ const d = (_ = f.value) == null ? void 0 : _.querySelector(r);
693
693
  if (d)
694
694
  G(d, s.startOffset + t.length);
695
695
  else if (t.length === 0)
@@ -704,7 +704,7 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
704
704
  console.warn(`can not find el with selector: ${r}`);
705
705
  });
706
706
  }, we = (e) => {
707
- const t = B.value.findIndex((b) => b.id === e.startId && b.type === e.startType), s = B.value.findIndex((b) => b.id === e.endId && b.type === e.endType);
707
+ const t = B.value.findIndex((_) => _.id === e.startId && _.type === e.startType), s = B.value.findIndex((_) => _.id === e.endId && _.type === e.endType);
708
708
  if (t === -1 || s === -1 || t > s)
709
709
  return console.warn("startIndex or endIndex is -1, or startIndex > endIndex. ", { range: e }), null;
710
710
  const r = B.value[t], l = B.value[s];
@@ -725,8 +725,8 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
725
725
  endOffset: r.content.length
726
726
  }
727
727
  ];
728
- for (let b = t + 1; b < s; b++) {
729
- const D = B.value[b];
728
+ for (let _ = t + 1; _ < s; _++) {
729
+ const D = B.value[_];
730
730
  d.push({
731
731
  id: D.id,
732
732
  type: D.type,
@@ -740,7 +740,7 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
740
740
  startOffset: 0,
741
741
  endOffset: e.endOffset
742
742
  }), d;
743
- }, be = (e, t, s, r) => {
743
+ }, _e = (e, t, s, r) => {
744
744
  const l = e[0];
745
745
  if (l.type !== "prefix" && l.type !== "suffix")
746
746
  return e;
@@ -775,11 +775,11 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
775
775
  }, de = (e, t, s = 0) => {
776
776
  const r = B.value.findIndex((l) => l.id === e.id && l.type === e.type);
777
777
  if (r > 0) {
778
- const l = B.value[r - 1], { id: d, type: b, content: D } = l;
779
- if (b === "text" || b === "template")
778
+ const l = B.value[r - 1], { id: d, type: _, content: D } = l;
779
+ if (_ === "text" || _ === "template")
780
780
  return {
781
781
  id: d,
782
- type: b,
782
+ type: _,
783
783
  startOffset: D.length - s,
784
784
  endOffset: D.length
785
785
  };
@@ -792,11 +792,11 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
792
792
  }, se = (e, t, s = 0) => {
793
793
  const r = B.value.findIndex((l) => l.id === e.id && l.type === e.type);
794
794
  if (r < B.value.length - 1) {
795
- const l = B.value[r + 1], { id: d, type: b } = l;
796
- if (b === "text" || b === "template")
795
+ const l = B.value[r + 1], { id: d, type: _ } = l;
796
+ if (_ === "text" || _ === "template")
797
797
  return {
798
798
  id: d,
799
- type: b,
799
+ type: _,
800
800
  startOffset: 0,
801
801
  endOffset: 0 + s
802
802
  };
@@ -810,32 +810,32 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
810
810
  V.value = { hasStarted: !0, range: null };
811
811
  }, $e = (e) => {
812
812
  const t = V.value.range;
813
- t ? (e.data && Z(t.startContainer) && Z(t.endContainer) ? (O(e.data), W.set(K.get(), j(t))) : t.startId && t.endId ? (Se(t, "insertCompositionText", e.data), W.set(K.get(), j(t))) : console.warn("range is not valid, range:", t), k.value++) : console.warn("range is null, compositionEnd:", e), V.value = { hasStarted: !1, range: null };
814
- }, Y = (() => {
813
+ t ? (e.data && Q(t.startContainer) && Q(t.endContainer) ? (O(e.data), P.set(W.get(), j(t))) : t.startId && t.endId ? (Se(t, "insertCompositionText", e.data), P.set(W.get(), j(t))) : console.warn("range is not valid, range:", t), k.value++) : console.warn("range is null, compositionEnd:", e), V.value = { hasStarted: !1, range: null };
814
+ }, Z = (() => {
815
815
  const e = navigator.userAgent.toLowerCase();
816
816
  return /macintosh|mac os x|iphone|ipad|ipod/.test(e);
817
- })(), _e = (e) => {
818
- const t = Y && e.metaKey && !e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Z
819
- !Y && e.ctrlKey && !e.shiftKey && e.key.toLowerCase() === "z", s = Y && e.metaKey && e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Shift+z
820
- !Y && e.ctrlKey && (e.key.toLowerCase() === "y" || e.shiftKey && e.key.toLowerCase() === "z"), r = e.key.toLowerCase() === "enter";
817
+ })(), be = (e) => {
818
+ const t = Z && e.metaKey && !e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Z
819
+ !Z && e.ctrlKey && !e.shiftKey && e.key.toLowerCase() === "z", s = Z && e.metaKey && e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Shift+z
820
+ !Z && e.ctrlKey && (e.key.toLowerCase() === "y" || e.shiftKey && e.key.toLowerCase() === "z"), r = e.key.toLowerCase() === "enter";
821
821
  if (t) {
822
822
  e.preventDefault();
823
823
  const l = ue(f.value);
824
- l && W.set(K.get(), j(l));
825
- const d = K.undo();
824
+ l && P.set(W.get(), j(l));
825
+ const d = W.undo();
826
826
  d && pe(d);
827
827
  }
828
828
  if (s) {
829
829
  e.preventDefault();
830
- const l = K.redo();
830
+ const l = W.redo();
831
831
  l && pe(l);
832
832
  }
833
833
  r && (e.preventDefault(), h("submit"));
834
834
  }, pe = (e) => {
835
835
  const { data: t } = y(e);
836
- if (P(t), W.has(e)) {
837
- const s = W.get(e);
838
- J(() => {
836
+ if (K(t), P.has(e)) {
837
+ const s = P.get(e);
838
+ X(() => {
839
839
  const r = f.value.querySelector(`[data-id="${s.startId}"][data-type="${s.startType}"]`), l = f.value.querySelector(`[data-id="${s.endId}"][data-type="${s.endType}"]`);
840
840
  r && G(r, s.startOffset, l, s.endOffset);
841
841
  });
@@ -843,13 +843,13 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
843
843
  };
844
844
  return c({
845
845
  clearHistory: () => {
846
- K.clear(), W.clear();
846
+ W.clear(), P.clear();
847
847
  },
848
848
  activateFirstField: () => {
849
849
  if (!f.value)
850
850
  return;
851
851
  const e = m.value.find((t) => t.type === "template");
852
- e && J(() => {
852
+ e && X(() => {
853
853
  var s, r;
854
854
  const t = (s = f.value) == null ? void 0 : s.querySelector(`[data-id="${e.id}"][data-type="template"]`);
855
855
  if (t) {
@@ -858,7 +858,7 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
858
858
  }
859
859
  });
860
860
  }
861
- }), (e, t) => (S(), R("div", Pt, [
861
+ }), (e, t) => (S(), R("div", Kt, [
862
862
  (S(), R("div", {
863
863
  contenteditable: "true",
864
864
  ref_key: "editorRef",
@@ -868,15 +868,15 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
868
868
  onBeforeinput: le,
869
869
  onCompositionstart: fe,
870
870
  onCompositionend: $e,
871
- onKeydown: _e
871
+ onKeydown: be
872
872
  }, [
873
- (S(!0), R(ie, null, ye(A.value, (s) => (S(), Q(Ft, ve({
873
+ (S(!0), R(ie, null, ye(A.value, (s) => (S(), Y(Ft, ve({
874
874
  key: `${s.id}-${s.type}`
875
875
  }, { ref_for: !0 }, s), null, 16))), 128))
876
876
  ], 32))
877
877
  ]));
878
878
  }
879
- }), Kt = /* @__PURE__ */ Oe(Wt, [["__scopeId", "data-v-3ae7b00d"]]), At = ["onMouseenter", "onMousedown"], Nt = { class: "suggestion-list__text" }, Vt = /* @__PURE__ */ me({
879
+ }), Wt = /* @__PURE__ */ Oe(Pt, [["__scopeId", "data-v-3ae7b00d"]]), At = ["onMouseenter", "onMousedown"], Nt = { class: "suggestion-list__text" }, Vt = /* @__PURE__ */ me({
880
880
  __name: "SuggestionList",
881
881
  props: {
882
882
  show: { type: Boolean },
@@ -888,21 +888,21 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
888
888
  },
889
889
  emits: ["item-hover", "item-leave", "select"],
890
890
  setup(i, { emit: c }) {
891
- const a = i, u = c, v = H(null), w = (_) => {
892
- u("item-hover", _);
891
+ const a = i, u = c, v = H(null), w = (b) => {
892
+ u("item-hover", b);
893
893
  }, o = () => {
894
894
  u("item-leave");
895
- }, p = (_) => {
896
- u("select", _);
895
+ }, p = (b) => {
896
+ u("select", b);
897
897
  };
898
- return (_, h) => (S(), Q(He, { name: "tiny-sender-slide-up" }, {
898
+ return (b, h) => (S(), Y(He, { name: "tiny-sender-slide-up" }, {
899
899
  default: re(() => [
900
900
  a.show && a.suggestions.length ? (S(), R("div", {
901
901
  key: 0,
902
902
  ref_key: "suggestionsListRef",
903
903
  ref: v,
904
904
  class: "suggestion-list",
905
- style: Pe(a.popupStyle)
905
+ style: Ke(a.popupStyle)
906
906
  }, [
907
907
  (S(!0), R(ie, null, ye(a.suggestions, (k, g) => (S(), R("div", {
908
908
  key: g,
@@ -911,8 +911,8 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
911
911
  onMouseleave: o,
912
912
  onMousedown: ct((I) => p(k), ["prevent"])
913
913
  }, [
914
- X(C(bt), { class: "suggestion-list__icon" }),
915
- U("span", Nt, [
914
+ J(C(_t), { class: "suggestion-list__icon" }),
915
+ M("span", Nt, [
916
916
  (S(!0), R(ie, null, ye(a.highlightSuggestionText(k, a.inputValue), (I, m) => (S(), R("span", {
917
917
  key: m,
918
918
  class: te({
@@ -922,27 +922,27 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
922
922
  }, ae(I.text), 3))), 128))
923
923
  ])
924
924
  ], 42, At))), 128))
925
- ], 4)) : M("", !0)
925
+ ], 4)) : q("", !0)
926
926
  ]),
927
927
  _: 1
928
928
  }));
929
929
  }
930
- }), Mt = /* @__PURE__ */ Oe(Vt, [["__scopeId", "data-v-238fcdfd"]]), Ut = ["data-theme"], qt = { class: "tiny-sender__container" }, zt = {
930
+ }), qt = /* @__PURE__ */ Oe(Vt, [["__scopeId", "data-v-238fcdfd"]]), Mt = ["data-theme"], Ut = { class: "tiny-sender__container" }, zt = {
931
931
  key: 0,
932
932
  class: "tiny-sender__header-slot"
933
933
  }, jt = {
934
934
  key: 0,
935
935
  class: "tiny-sender__prefix-slot"
936
- }, Gt = { class: "tiny-sender__content-area" }, Xt = {
936
+ }, Gt = { class: "tiny-sender__content-area" }, Jt = {
937
937
  key: 0,
938
938
  class: "tiny-sender__decorative-content"
939
- }, Jt = {
939
+ }, Xt = {
940
940
  key: 2,
941
941
  class: "tiny-sender__input-field-wrapper"
942
- }, Zt = {
942
+ }, Qt = {
943
943
  key: 0,
944
944
  class: "tiny-sender__completion-placeholder"
945
- }, Qt = { class: "user-input-mirror" }, Yt = {
945
+ }, Yt = { class: "user-input-mirror" }, Zt = {
946
946
  key: 0,
947
947
  class: "tiny-sender__tab-hint"
948
948
  }, en = {
@@ -982,18 +982,18 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
982
982
  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"],
983
983
  setup(i, { expose: c, emit: a }) {
984
984
  var Ne;
985
- const u = i, v = a, w = H(null), o = H(null), p = H(null), _ = H(null), h = H(null), k = L(() => u.templateData && u.templateData.length > 0), { inputValue: g, isComposing: I, clearInput: m } = Ct(u, v), P = L(() => !!g.value.trim()), B = L(() => {
985
+ const u = i, v = a, w = H(null), o = H(null), p = H(null), b = H(null), h = H(null), k = L(() => u.templateData && u.templateData.length > 0), { inputValue: g, isComposing: I, clearInput: m } = Ct(u, v), K = L(() => !!g.value.trim()), B = L(() => {
986
986
  var n, x;
987
- return !(u.disabled || u.loading || !P.value || he.value || (x = (n = u.buttonGroup) == null ? void 0 : n.submit) != null && x.disabled);
987
+ return !(u.disabled || u.loading || !K.value || he.value || (x = (n = u.buttonGroup) == null ? void 0 : n.submit) != null && x.disabled);
988
988
  }), {
989
989
  showSuggestionsPopup: A,
990
990
  completionPlaceholder: f,
991
991
  showTabHint: E,
992
992
  suggestionsListRef: y,
993
- filteredSuggestions: W,
994
- activeSuggestion: K,
995
- isItemHighlighted: q,
996
- updateSuggestionsState: Z,
993
+ filteredSuggestions: P,
994
+ activeSuggestion: W,
995
+ isItemHighlighted: U,
996
+ updateSuggestionsState: Q,
997
997
  selectSuggestion: ue,
998
998
  acceptCurrentSuggestion: ce,
999
999
  closeSuggestionsPopup: G,
@@ -1002,7 +1002,7 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1002
1002
  handleSuggestionItemLeave: le,
1003
1003
  highlightSuggestionText: j
1004
1004
  } = Rt(u, v, g, I, k), N = H(u.mode), ne = H(!1), Se = () => {
1005
- N.value === "single" && (N.value = "multiple", J(() => {
1005
+ N.value === "single" && (N.value = "multiple", X(() => {
1006
1006
  setTimeout(() => {
1007
1007
  const n = document.querySelector(".tiny-textarea__inner");
1008
1008
  if (n) {
@@ -1018,11 +1018,11 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1018
1018
  const ke = F.offsetWidth;
1019
1019
  return document.body.removeChild(F), ke;
1020
1020
  }, we = () => {
1021
- var xe, Ue, qe;
1022
- if (u.mode !== "single" || !w.value || ne.value || !o.value || !_.value) return;
1021
+ var xe, Me, Ue;
1022
+ if (u.mode !== "single" || !w.value || ne.value || !o.value || !b.value) return;
1023
1023
  const n = o.value.querySelector(".tiny-sender__content-area");
1024
1024
  if (!n) return;
1025
- const x = ((Ue = (xe = w.value) == null ? void 0 : xe.querySelector) == null ? void 0 : Ue.call(xe, ".tiny-input__inner")) || n.querySelector(".tiny-input__inner"), F = h.value || o.value.querySelector(".tiny-sender__buttons-container");
1025
+ const x = ((Me = (xe = w.value) == null ? void 0 : xe.querySelector) == null ? void 0 : Me.call(xe, ".tiny-input__inner")) || n.querySelector(".tiny-input__inner"), F = h.value || o.value.querySelector(".tiny-sender__buttons-container");
1026
1026
  if (!x) {
1027
1027
  console.warn("Cannot find input element for overflow check");
1028
1028
  return;
@@ -1032,8 +1032,8 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1032
1032
  setTimeout(() => we(), 50);
1033
1033
  return;
1034
1034
  }
1035
- const Ye = window.getComputedStyle(x).font, et = Te(g.value, Ye), Ve = (qe = o.value) == null ? void 0 : qe.classList.contains("tr-sender-compact"), tt = Ve ? 12 : 20, nt = ke.width, st = (Le == null ? void 0 : Le.width) || 0, Me = nt - st - tt, ot = Ve ? 50 : 80;
1036
- et > Me && Me > ot && N.value === "single" && (ne.value = !0, N.value = "multiple", J(() => {
1035
+ const Ze = window.getComputedStyle(x).font, et = Te(g.value, Ze), Ve = (Ue = o.value) == null ? void 0 : Ue.classList.contains("tr-sender-compact"), tt = Ve ? 12 : 20, nt = ke.width, st = (Le == null ? void 0 : Le.width) || 0, qe = nt - st - tt, ot = Ve ? 50 : 80;
1036
+ et > qe && qe > ot && N.value === "single" && (ne.value = !0, N.value = "multiple", X(() => {
1037
1037
  w.value ? setTimeout(() => {
1038
1038
  var ze;
1039
1039
  const Ie = (ze = o.value) == null ? void 0 : ze.querySelector(".tiny-textarea__inner");
@@ -1045,9 +1045,9 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1045
1045
  ne.value = !1;
1046
1046
  }, 300) : ne.value = !1;
1047
1047
  }));
1048
- }, be = () => {
1048
+ }, _e = () => {
1049
1049
  if (k.value && p.value)
1050
- Ke();
1050
+ We();
1051
1051
  else if (w.value)
1052
1052
  w.value.focus();
1053
1053
  else {
@@ -1063,14 +1063,14 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1063
1063
  }
1064
1064
  }, se = () => {
1065
1065
  var n;
1066
- v("update:templateData", []), (n = p.value) == null || n.clearHistory(), J(() => {
1066
+ v("update:templateData", []), (n = p.value) == null || n.clearHistory(), X(() => {
1067
1067
  g.value === "" && (N.value = u.mode || "single"), setTimeout(() => {
1068
- be();
1068
+ _e();
1069
1069
  }, 50);
1070
1070
  }), G();
1071
1071
  }, fe = () => {
1072
1072
  var n;
1073
- m(), k.value ? se() : (n = o.value) == null || n.focus(), J(() => {
1073
+ m(), k.value ? se() : (n = o.value) == null || n.focus(), X(() => {
1074
1074
  g.value === "" && (N.value = u.mode || "single");
1075
1075
  }), G();
1076
1076
  }, $e = (n) => {
@@ -1087,7 +1087,7 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1087
1087
  },
1088
1088
  { deep: !0 }
1089
1089
  );
1090
- const We = L(() => {
1090
+ const Pe = L(() => {
1091
1091
  const n = typeof u.speech == "object" ? u.speech : {};
1092
1092
  return {
1093
1093
  ...n,
@@ -1107,16 +1107,16 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1107
1107
  v("speech-error", x);
1108
1108
  }
1109
1109
  };
1110
- }), { speechState: Y, start: _e, stop: pe } = xt(We.value), Ce = () => {
1111
- Y.isRecording ? pe() : _e();
1110
+ }), { speechState: Z, start: be, stop: pe } = xt(Pe.value), Ce = () => {
1111
+ Z.isRecording ? pe() : be();
1112
1112
  }, he = L(() => u.maxLength !== 1 / 0 && g.value.length > u.maxLength), { handleKeyPress: e, triggerSubmit: t } = kt(
1113
1113
  u,
1114
1114
  v,
1115
1115
  g,
1116
1116
  I,
1117
- Y,
1117
+ Z,
1118
1118
  A,
1119
- K,
1119
+ W,
1120
1120
  ce,
1121
1121
  G,
1122
1122
  O,
@@ -1127,7 +1127,7 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1127
1127
  k,
1128
1128
  se
1129
1129
  ), s = (n) => {
1130
- v("focus", n), g.value && W.value.length > 0 && !k.value && (A.value = !0, E.value = !0);
1130
+ v("focus", n), g.value && P.value.length > 0 && !k.value && (A.value = !0, E.value = !0);
1131
1131
  }, r = (n) => {
1132
1132
  v("blur", n), G();
1133
1133
  }, l = L(() => N.value === "multiple" ? "textarea" : "text"), d = L(
@@ -1136,79 +1136,79 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1136
1136
  justifyContent: u.showWordLimit && u.maxLength !== 1 / 0 ? "space-between" : "flex-end",
1137
1137
  alignItems: "center"
1138
1138
  })
1139
- ), b = dt(), D = L(() => !!b.decorativeContent), T = L(() => u.disabled || D.value), $ = L(() => u.loading), z = L(() => ({
1139
+ ), _ = dt(), D = L(() => !!_.decorativeContent), T = L(() => u.disabled || D.value), $ = L(() => u.loading), z = L(() => ({
1140
1140
  "is-disabled": T.value,
1141
1141
  "is-loading": $.value,
1142
1142
  "is-auto-switching": ne.value
1143
1143
  })), ge = L(() => ({
1144
- width: _t(u.suggestionPopupWidth),
1144
+ width: bt(u.suggestionPopupWidth),
1145
1145
  maxWidth: "100%"
1146
1146
  // 确保不超出父容器宽度
1147
1147
  })), Be = () => {
1148
1148
  I.value = !1, setTimeout(() => {
1149
- I.value = !1, Z();
1149
+ I.value = !1, Q();
1150
1150
  }, 50);
1151
1151
  };
1152
1152
  ee(g, () => {
1153
- J(we), g.value === "" && u.mode === "single" && (N.value = "single");
1153
+ X(we), g.value === "" && u.mode === "single" && (N.value = "single");
1154
1154
  }), ee(
1155
1155
  () => k.value,
1156
1156
  (n) => {
1157
1157
  n && (N.value = "multiple");
1158
1158
  }
1159
1159
  );
1160
- const Ke = () => {
1160
+ const We = () => {
1161
1161
  p.value && p.value.activateFirstField();
1162
- }, { accept: Je = "*", multiple: Ze = !0 } = ((Ne = u.buttonGroup) == null ? void 0 : Ne.file) || {}, { open: Ae, files: Qe } = ht({ accept: Je, multiple: Ze });
1163
- return ee(Qe, (n) => {
1162
+ }, { accept: Xe = "*", multiple: Qe = !0 } = ((Ne = u.buttonGroup) == null ? void 0 : Ne.file) || {}, { open: Ae, files: Ye } = ht({ accept: Xe, multiple: Qe });
1163
+ return ee(Ye, (n) => {
1164
1164
  n && n.length > 0 && v("files-selected", Array.from(n));
1165
1165
  }), c({
1166
- focus: be,
1166
+ focus: _e,
1167
1167
  blur: de,
1168
1168
  clear: fe,
1169
1169
  submit: t,
1170
- startSpeech: _e,
1170
+ startSpeech: be,
1171
1171
  stopSpeech: pe,
1172
- activateTemplateFirstField: Ke
1172
+ activateTemplateFirstField: We
1173
1173
  }), (n, x) => (S(), R("div", {
1174
1174
  ref_key: "senderRef",
1175
1175
  ref: o,
1176
1176
  class: te(["tiny-sender", [z.value, `theme-${n.theme}`, `mode-${N.value}`]]),
1177
1177
  "data-theme": n.theme
1178
1178
  }, [
1179
- U("div", qt, [
1180
- U("div", {
1179
+ M("div", Ut, [
1180
+ M("div", {
1181
1181
  class: "tiny-sender__input-wrapper",
1182
1182
  ref_key: "inputWrapperRef",
1183
- ref: _
1183
+ ref: b
1184
1184
  }, [
1185
- X(He, { name: "tiny-sender-slide-down" }, {
1185
+ J(He, { name: "tiny-sender-slide-down" }, {
1186
1186
  default: re(() => [
1187
1187
  n.$slots.header ? (S(), R("div", zt, [
1188
1188
  oe(n.$slots, "header")
1189
- ])) : M("", !0)
1189
+ ])) : q("", !0)
1190
1190
  ]),
1191
1191
  _: 3
1192
1192
  }),
1193
- U("div", {
1193
+ M("div", {
1194
1194
  class: te(["tiny-sender__input-row", { "has-prefix": n.$slots.prefix, "has-header": n.$slots.header }])
1195
1195
  }, [
1196
1196
  n.$slots.prefix ? (S(), R("div", jt, [
1197
1197
  oe(n.$slots, "prefix")
1198
- ])) : M("", !0),
1199
- U("div", Gt, [
1200
- n.$slots.decorativeContent ? (S(), R("div", Xt, [
1198
+ ])) : q("", !0),
1199
+ M("div", Gt, [
1200
+ n.$slots.decorativeContent ? (S(), R("div", Jt, [
1201
1201
  oe(n.$slots, "decorativeContent")
1202
- ])) : M("", !0),
1203
- k.value ? (S(), Q(Kt, {
1202
+ ])) : q("", !0),
1203
+ k.value ? (S(), Y(Wt, {
1204
1204
  key: 1,
1205
1205
  ref_key: "templateEditorRef",
1206
1206
  ref: p,
1207
1207
  "model-value": u.templateData,
1208
1208
  "onUpdate:modelValue": $e,
1209
1209
  onSubmit: C(t)
1210
- }, null, 8, ["model-value", "onSubmit"])) : (S(), R("div", Jt, [
1211
- X(C(pt), {
1210
+ }, null, 8, ["model-value", "onSubmit"])) : (S(), R("div", Xt, [
1211
+ J(C(pt), {
1212
1212
  ref_key: "inputRef",
1213
1213
  ref: w,
1214
1214
  autosize: n.autoSize,
@@ -1225,28 +1225,28 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1225
1225
  onFocus: s,
1226
1226
  onBlur: r
1227
1227
  }, null, 8, ["autosize", "type", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
1228
- C(f) && !C(I) ? (S(), R("div", Zt, [
1229
- U("span", Qt, ae(C(g)), 1),
1228
+ C(f) && !C(I) ? (S(), R("div", Qt, [
1229
+ M("span", Yt, ae(C(g)), 1),
1230
1230
  Ge(ae(C(f)) + " ", 1),
1231
- C(E) ? (S(), R("div", Yt, "TAB")) : M("", !0)
1232
- ])) : M("", !0)
1231
+ C(E) ? (S(), R("div", Zt, "TAB")) : q("", !0)
1232
+ ])) : q("", !0)
1233
1233
  ]))
1234
1234
  ]),
1235
1235
  N.value === "single" ? (S(), R("div", en, [
1236
- U("div", {
1236
+ M("div", {
1237
1237
  class: "tiny-sender__buttons-container",
1238
1238
  ref_key: "buttonsContainerRef",
1239
1239
  ref: h
1240
1240
  }, [
1241
1241
  oe(n.$slots, "actions"),
1242
- X(Xe, {
1242
+ J(Je, {
1243
1243
  "allow-speech": n.allowSpeech,
1244
1244
  "allow-files": n.allowFiles,
1245
1245
  loading: n.loading,
1246
1246
  disabled: T.value,
1247
1247
  "show-clear": n.clearable,
1248
- "has-content": P.value,
1249
- "speech-status": C(Y),
1248
+ "has-content": K.value,
1249
+ "speech-status": C(Z),
1250
1250
  "button-group": n.buttonGroup,
1251
1251
  "submit-type": n.submitType,
1252
1252
  "is-over-limit": he.value,
@@ -1258,37 +1258,37 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1258
1258
  onTriggerSelect: C(Ae)
1259
1259
  }, 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"])
1260
1260
  ], 512)
1261
- ])) : M("", !0)
1261
+ ])) : q("", !0)
1262
1262
  ], 2),
1263
- X(He, { name: "tiny-sender-slide-up" }, {
1263
+ J(He, { name: "tiny-sender-slide-up" }, {
1264
1264
  default: re(() => [
1265
1265
  N.value === "multiple" ? (S(), R("div", {
1266
1266
  key: 0,
1267
- style: Pe(d.value),
1267
+ style: Ke(d.value),
1268
1268
  class: "tiny-sender__footer-slot tiny-sender__bottom-row"
1269
1269
  }, [
1270
- U("div", tn, [
1270
+ M("div", tn, [
1271
1271
  oe(n.$slots, "footer-left")
1272
1272
  ]),
1273
- U("div", nn, [
1273
+ M("div", nn, [
1274
1274
  oe(n.$slots, "footer-right"),
1275
1275
  n.showWordLimit && n.maxLength !== 1 / 0 ? (S(), R("div", {
1276
1276
  key: 0,
1277
1277
  class: te(["tiny-sender__word-limit", { "is-over-limit": he.value }])
1278
1278
  }, [
1279
- U("span", sn, ae(C(g).length), 1),
1279
+ M("span", sn, ae(C(g).length), 1),
1280
1280
  Ge("/" + ae(n.maxLength), 1)
1281
- ], 2)) : M("", !0),
1281
+ ], 2)) : q("", !0),
1282
1282
  N.value === "multiple" ? (S(), R("div", on, [
1283
- U("div", an, [
1284
- X(Xe, {
1283
+ M("div", an, [
1284
+ J(Je, {
1285
1285
  "allow-speech": n.allowSpeech,
1286
1286
  "allow-files": n.allowFiles,
1287
1287
  loading: n.loading,
1288
1288
  disabled: T.value,
1289
1289
  "show-clear": n.clearable,
1290
- "has-content": P.value,
1291
- "speech-status": C(Y),
1290
+ "has-content": K.value,
1291
+ "speech-status": C(Z),
1292
1292
  "button-group": n.buttonGroup,
1293
1293
  "submit-type": n.submitType,
1294
1294
  "is-over-limit": he.value,
@@ -1300,30 +1300,30 @@ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PUR
1300
1300
  onTriggerSelect: C(Ae)
1301
1301
  }, 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"])
1302
1302
  ])
1303
- ])) : M("", !0)
1303
+ ])) : q("", !0)
1304
1304
  ])
1305
1305
  ], 4)) : n.$slots.footer ? (S(), R("div", ln, [
1306
1306
  oe(n.$slots, "footer")
1307
- ])) : M("", !0)
1307
+ ])) : q("", !0)
1308
1308
  ]),
1309
1309
  _: 3
1310
1310
  })
1311
1311
  ], 512)
1312
1312
  ]),
1313
- X(Mt, {
1313
+ J(qt, {
1314
1314
  ref_key: "suggestionsListRef",
1315
1315
  ref: y,
1316
1316
  show: C(A),
1317
- suggestions: C(W),
1317
+ suggestions: C(P),
1318
1318
  "popup-style": ge.value,
1319
- "is-item-highlighted": C(q),
1319
+ "is-item-highlighted": C(U),
1320
1320
  "highlight-suggestion-text": C(j),
1321
1321
  "input-value": C(g),
1322
1322
  onItemHover: C(V),
1323
1323
  onItemLeave: C(le),
1324
1324
  onSelect: C(ue)
1325
1325
  }, null, 8, ["show", "suggestions", "popup-style", "is-item-highlighted", "highlight-suggestion-text", "input-value", "onItemHover", "onItemLeave", "onSelect"])
1326
- ], 10, Ut));
1326
+ ], 10, Mt));
1327
1327
  }
1328
1328
  });
1329
1329
  Re.name = "TrSender";