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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
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";
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 Y, unref as C, withCtx as re, createElementVNode as z, 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";
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 { 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";
5
+ import { p as gt, u as vt, I as yt, x as mt, i as St, l as wt, z as _t } from "../tiny-robot-svgs.js";
6
6
  import { _ as Oe } from "../_plugin-vue_export-helper.js";
7
7
  import { t as bt } from "../utils.js";
8
8
  function Ct(i, c) {
@@ -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, b, h, k, g, I, m, K, B) {
42
+ function kt(i, c, a, u, v, w, o, p, b, h, k, g, I, m, P, B) {
43
43
  const A = () => {
44
- g.value && (K != null && K.value && (B == null || B()), c("submit", a.value.trim()));
45
- }, f = (y, P) => {
44
+ g.value && (P != null && P.value && (B == null || B()), c("submit", a.value.trim()));
45
+ }, f = (y, W) => {
46
46
  if (!(y.key === "Enter")) return !1;
47
- switch (P) {
47
+ switch (W) {
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, b, h, k, g, I, m, K, 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 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;
63
+ const K = y.target, q = K.selectionStart, Q = a.value;
64
+ a.value = Q.substring(0, q) + `
65
+ ` + Q.substring(q), setTimeout(() => {
66
+ K.selectionStart = K.selectionEnd = q + 1;
67
67
  }, 0);
68
68
  return;
69
69
  }
@@ -200,7 +200,7 @@ function Rt(i, c, a, u, v) {
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
- }), K = L(() => {
203
+ }), P = 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) => {
@@ -208,25 +208,25 @@ function Rt(i, c, a, u, v) {
208
208
  b.value = "", h.value = !1;
209
209
  return;
210
210
  }
211
- const V = O || K.value;
211
+ const V = O || P.value;
212
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
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 || X(() => {
218
+ u.value || g.value || J(() => {
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 P = (O) => {
224
- g.value = !0, a.value = O, c("update:modelValue", O), c("suggestion-select", O), U(), X(() => {
223
+ const W = (O) => {
224
+ g.value = !0, a.value = O, c("update:modelValue", O), c("suggestion-select", O), q(), J(() => {
225
225
  g.value = !1;
226
226
  });
227
- }, W = () => {
228
- K.value && P(K.value);
229
- }, U = () => {
227
+ }, K = () => {
228
+ P.value && W(P.value);
229
+ }, q = () => {
230
230
  f();
231
231
  };
232
232
  return {
@@ -235,13 +235,13 @@ function Rt(i, c, a, u, v) {
235
235
  showTabHint: h,
236
236
  suggestionsListRef: k,
237
237
  filteredSuggestions: m,
238
- activeSuggestion: K,
238
+ activeSuggestion: P,
239
239
  isItemHighlighted: B,
240
240
  updateCompletionPlaceholder: A,
241
241
  updateSuggestionsState: y,
242
- selectSuggestion: P,
243
- acceptCurrentSuggestion: W,
244
- closeSuggestionsPopup: U,
242
+ selectSuggestion: W,
243
+ acceptCurrentSuggestion: K,
244
+ closeSuggestionsPopup: q,
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
- U();
268
+ q();
269
269
  },
270
270
  highlightSuggestionText: It
271
271
  };
@@ -320,7 +320,7 @@ const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
320
320
  }
321
321
  }, m = () => {
322
322
  h.value || u("submit");
323
- }, K = () => {
323
+ }, P = () => {
324
324
  b.value || u("cancel");
325
325
  }, B = L(() => {
326
326
  var f, E;
@@ -332,7 +332,7 @@ 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: Ke({ "padding-right": f.hasContent || f.loading ? "0" : "6px" })
335
+ style: Pe({ "padding-right": f.hasContent || f.loading ? "0" : "6px" })
336
336
  }, [
337
337
  f.allowFiles && !f.loading ? (S(), Y(C(Ee), {
338
338
  key: 0,
@@ -342,18 +342,18 @@ const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
342
342
  "visible-arrow": !1
343
343
  }, {
344
344
  default: re(() => [
345
- M("div", {
345
+ z("div", {
346
346
  class: "action-buttons__button",
347
347
  onClick: A
348
348
  }, [
349
- J(C(gt), {
349
+ X(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"])) : q("", !0),
356
+ }, 8, ["render-content"])) : M("", !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 }]),
@@ -368,38 +368,38 @@ const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
368
368
  class: "action-buttons__icon",
369
369
  alt: "录音"
370
370
  }))
371
- ], 2)) : q("", !0),
371
+ ], 2)) : M("", !0),
372
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
- M("div", {
378
+ z("div", {
379
379
  class: "action-buttons__button",
380
380
  onClick: g
381
381
  }, [
382
- J(C(mt), { class: "action-buttons__icon action-buttons__icon--clear" })
382
+ X(C(mt), { class: "action-buttons__icon action-buttons__icon--clear" })
383
383
  ])
384
384
  ]),
385
385
  _: 1
386
- })) : q("", !0)
387
- ], 4)) : q("", !0),
386
+ })) : M("", !0)
387
+ ], 4)) : M("", !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 ? K() : m())
391
+ onClick: E[0] || (E[0] = (y) => f.loading ? P() : m())
392
392
  }, [
393
- M("div", Tt, [
393
+ z("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
- J(C(wt), {
398
+ X(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)) : q("", !0)
402
+ f.stopText ? (S(), R("span", $t, ae(f.stopText), 1)) : M("", !0)
403
403
  ], 2)) : (S(), Y(C(Ee), {
404
404
  key: 0,
405
405
  effect: "light",
@@ -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
- J(C(St), {
411
+ X(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
- ])) : q("", !0)
419
+ ])) : M("", !0)
420
420
  ]));
421
421
  }
422
- }), Je = /* @__PURE__ */ Oe(Bt, [["__scopeId", "data-v-a9e0fa92"]]), Lt = ["data-id", "data-type"], Et = ["data-id", "data-type"], Dt = /* @__PURE__ */ me({
422
+ }), Xe = /* @__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: {
@@ -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 Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PURE__ */ me({
466
+ const Pt = { class: "editor-container" }, De = "​", Fe = "​", Wt = /* @__PURE__ */ me({
467
467
  __name: "TemplateEditor",
468
468
  props: {
469
469
  modelValue: { default: () => [] },
@@ -479,7 +479,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
479
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(b.value || [])), K = (e) => {
482
+ })), I = (e) => e.map((t) => ({ type: t.type, content: t.content })), m = H(g(b.value || [])), P = (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 Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
536
536
  timestamp: t,
537
537
  data: s
538
538
  };
539
- }, P = /* @__PURE__ */ new Map(), W = Ht(E(m.value), {
539
+ }, W = /* @__PURE__ */ new Map(), K = Ht(E(m.value), {
540
540
  onRemoveHistory: (e) => {
541
541
  for (const t of e)
542
- P.delete(t);
542
+ W.delete(t);
543
543
  }
544
544
  });
545
545
  ee(
546
546
  () => b.value,
547
547
  (e) => {
548
- K(g(e || [])), W.commit(E(m.value));
548
+ P(g(e || [])), K.commit(E(m.value));
549
549
  },
550
550
  { deep: !0 }
551
551
  );
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) => {
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, Q = (e) => e === f.value, ue = (e) => {
553
553
  const t = window.getSelection();
554
554
  if (!t)
555
555
  return null;
@@ -586,12 +586,12 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
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 ? K(
589
+ l !== -1 ? P(
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
- K([r].concat(m.value));
594
- X(() => {
593
+ P([r].concat(m.value));
594
+ J(() => {
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);
@@ -622,14 +622,14 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
622
622
  ], _ = ue(f.value);
623
623
  if (d.includes(s)) {
624
624
  if (r && Q(l.startContainer) && Q(l.endContainer)) {
625
- O(r), _ && P.set(W.get(), j(_));
625
+ O(r), _ && W.set(K.get(), j(_));
626
626
  return;
627
627
  }
628
628
  const T = j(l);
629
- T.startId && T.endId ? (Se(T, s, r), _ && P.set(W.get(), j(_))) : console.warn("range is not valid, range:", T);
629
+ T.startId && T.endId ? (Se(T, s, r), _ && W.set(K.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 = U(e.startContainer, f.value), s = U(e.endContainer, f.value);
632
+ const t = q(e.startContainer, f.value), s = q(e.endContainer, f.value);
633
633
  return {
634
634
  collapsed: e.collapsed,
635
635
  endContainer: e.endContainer,
@@ -671,10 +671,10 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
671
671
  }
672
672
  const _ = d, D = [];
673
673
  for (const [T, $] of _.entries()) {
674
- const z = m.value.find((Be) => Be.id === $.id), ge = T === 0 ? s : "";
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", $);
674
+ const U = m.value.find((Be) => Be.id === $.id), ge = T === 0 ? s : "";
675
+ U ? U.type === "text" ? U.content = N(U.content, ge, $.startOffset, $.endOffset) : U.type === "template" ? $.type === "prefix" || $.type === "suffix" ? $.startOffset === 0 && $.endOffset === 1 && ge.length === 0 ? U[$.type] = "" : console.warn(`${$.type} can not be inserted text. it only can be deleted`, $) : $.startOffset < 0 || $.endOffset > U.content.length ? D.push(U.id) : U.content = N(U.content, ge, $.startOffset, $.endOffset) : console.warn("dataItem.type is not text or template", U) : console.warn("can not find dataItem", $);
676
676
  }
677
- K(m.value.filter((T) => !D.includes(T.id))), K(
677
+ P(m.value.filter((T) => !D.includes(T.id))), P(
678
678
  m.value.filter((T) => {
679
679
  if (T.type === "text")
680
680
  return T.content.length > 0;
@@ -687,7 +687,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
687
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
- X(() => {
690
+ J(() => {
691
691
  var _, D;
692
692
  const d = (_ = f.value) == null ? void 0 : _.querySelector(r);
693
693
  if (d)
@@ -810,7 +810,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
810
810
  V.value = { hasStarted: !0, range: null };
811
811
  }, $e = (e) => {
812
812
  const t = V.value.range;
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 };
813
+ t ? (e.data && Q(t.startContainer) && Q(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
814
  }, Z = (() => {
815
815
  const e = navigator.userAgent.toLowerCase();
816
816
  return /macintosh|mac os x|iphone|ipad|ipod/.test(e);
@@ -821,21 +821,21 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
821
821
  if (t) {
822
822
  e.preventDefault();
823
823
  const l = ue(f.value);
824
- l && P.set(W.get(), j(l));
825
- const d = W.undo();
824
+ l && W.set(K.get(), j(l));
825
+ const d = K.undo();
826
826
  d && pe(d);
827
827
  }
828
828
  if (s) {
829
829
  e.preventDefault();
830
- const l = W.redo();
830
+ const l = K.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 (K(t), P.has(e)) {
837
- const s = P.get(e);
838
- X(() => {
836
+ if (P(t), W.has(e)) {
837
+ const s = W.get(e);
838
+ J(() => {
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 Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
843
843
  };
844
844
  return c({
845
845
  clearHistory: () => {
846
- W.clear(), P.clear();
846
+ K.clear(), W.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 && X(() => {
852
+ e && J(() => {
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 Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
858
858
  }
859
859
  });
860
860
  }
861
- }), (e, t) => (S(), R("div", Kt, [
861
+ }), (e, t) => (S(), R("div", Pt, [
862
862
  (S(), R("div", {
863
863
  contenteditable: "true",
864
864
  ref_key: "editorRef",
@@ -876,7 +876,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
876
876
  ], 32))
877
877
  ]));
878
878
  }
879
- }), Wt = /* @__PURE__ */ Oe(Pt, [["__scopeId", "data-v-3ae7b00d"]]), At = ["onMouseenter", "onMousedown"], Nt = { class: "suggestion-list__text" }, Vt = /* @__PURE__ */ me({
879
+ }), Kt = /* @__PURE__ */ Oe(Wt, [["__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 },
@@ -902,7 +902,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
902
902
  ref_key: "suggestionsListRef",
903
903
  ref: v,
904
904
  class: "suggestion-list",
905
- style: Ke(a.popupStyle)
905
+ style: Pe(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 Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
911
911
  onMouseleave: o,
912
912
  onMousedown: ct((I) => p(k), ["prevent"])
913
913
  }, [
914
- J(C(_t), { class: "suggestion-list__icon" }),
915
- M("span", Nt, [
914
+ X(C(_t), { class: "suggestion-list__icon" }),
915
+ z("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,21 +922,21 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
922
922
  }, ae(I.text), 3))), 128))
923
923
  ])
924
924
  ], 42, At))), 128))
925
- ], 4)) : q("", !0)
925
+ ], 4)) : M("", !0)
926
926
  ]),
927
927
  _: 1
928
928
  }));
929
929
  }
930
- }), qt = /* @__PURE__ */ Oe(Vt, [["__scopeId", "data-v-238fcdfd"]]), Mt = ["data-theme"], Ut = { class: "tiny-sender__container" }, zt = {
930
+ }), Mt = /* @__PURE__ */ Oe(Vt, [["__scopeId", "data-v-238fcdfd"]]), zt = ["data-theme"], qt = { class: "tiny-sender__container" }, Ut = {
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" }, Jt = {
936
+ }, Gt = { class: "tiny-sender__content-area" }, Xt = {
937
937
  key: 0,
938
938
  class: "tiny-sender__decorative-content"
939
- }, Xt = {
939
+ }, Jt = {
940
940
  key: 2,
941
941
  class: "tiny-sender__input-field-wrapper"
942
942
  }, Qt = {
@@ -982,17 +982,17 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__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), 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(() => {
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), P = L(() => !!g.value.trim()), B = L(() => {
986
986
  var n, x;
987
- return !(u.disabled || u.loading || !K.value || he.value || (x = (n = u.buttonGroup) == null ? void 0 : n.submit) != null && x.disabled);
987
+ return !(u.disabled || u.loading || !P.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: P,
994
- activeSuggestion: W,
995
- isItemHighlighted: U,
993
+ filteredSuggestions: W,
994
+ activeSuggestion: K,
995
+ isItemHighlighted: q,
996
996
  updateSuggestionsState: Q,
997
997
  selectSuggestion: ue,
998
998
  acceptCurrentSuggestion: ce,
@@ -1002,7 +1002,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__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", X(() => {
1005
+ N.value === "single" && (N.value = "multiple", J(() => {
1006
1006
  setTimeout(() => {
1007
1007
  const n = document.querySelector(".tiny-textarea__inner");
1008
1008
  if (n) {
@@ -1018,11 +1018,11 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1018
1018
  const ke = F.offsetWidth;
1019
1019
  return document.body.removeChild(F), ke;
1020
1020
  }, we = () => {
1021
- var xe, Me, Ue;
1021
+ var xe, ze, qe;
1022
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 = ((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");
1025
+ const x = ((ze = (xe = w.value) == null ? void 0 : xe.querySelector) == null ? void 0 : ze.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,11 +1032,11 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1032
1032
  setTimeout(() => we(), 50);
1033
1033
  return;
1034
1034
  }
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(() => {
1035
+ const Ze = window.getComputedStyle(x).font, et = Te(g.value, Ze), 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(() => {
1037
1037
  w.value ? setTimeout(() => {
1038
- var ze;
1039
- const Ie = (ze = o.value) == null ? void 0 : ze.querySelector(".tiny-textarea__inner");
1038
+ var Ue;
1039
+ const Ie = (Ue = o.value) == null ? void 0 : Ue.querySelector(".tiny-textarea__inner");
1040
1040
  if (Ie) {
1041
1041
  Ie.style.whiteSpace = "pre-wrap";
1042
1042
  const je = g.value.length;
@@ -1047,7 +1047,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1047
1047
  }));
1048
1048
  }, _e = () => {
1049
1049
  if (k.value && p.value)
1050
- We();
1050
+ Ke();
1051
1051
  else if (w.value)
1052
1052
  w.value.focus();
1053
1053
  else {
@@ -1063,14 +1063,14 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1063
1063
  }
1064
1064
  }, se = () => {
1065
1065
  var n;
1066
- v("update:templateData", []), (n = p.value) == null || n.clearHistory(), X(() => {
1066
+ v("update:templateData", []), (n = p.value) == null || n.clearHistory(), J(() => {
1067
1067
  g.value === "" && (N.value = u.mode || "single"), setTimeout(() => {
1068
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(), X(() => {
1073
+ m(), k.value ? se() : (n = o.value) == null || n.focus(), J(() => {
1074
1074
  g.value === "" && (N.value = u.mode || "single");
1075
1075
  }), G();
1076
1076
  }, $e = (n) => {
@@ -1087,7 +1087,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1087
1087
  },
1088
1088
  { deep: !0 }
1089
1089
  );
1090
- const Pe = L(() => {
1090
+ const We = L(() => {
1091
1091
  const n = typeof u.speech == "object" ? u.speech : {};
1092
1092
  return {
1093
1093
  ...n,
@@ -1107,7 +1107,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1107
1107
  v("speech-error", x);
1108
1108
  }
1109
1109
  };
1110
- }), { speechState: Z, start: be, stop: pe } = xt(Pe.value), Ce = () => {
1110
+ }), { speechState: Z, start: be, stop: pe } = xt(We.value), Ce = () => {
1111
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,
@@ -1116,7 +1116,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1116
1116
  I,
1117
1117
  Z,
1118
1118
  A,
1119
- W,
1119
+ K,
1120
1120
  ce,
1121
1121
  G,
1122
1122
  O,
@@ -1127,7 +1127,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1127
1127
  k,
1128
1128
  se
1129
1129
  ), s = (n) => {
1130
- v("focus", n), g.value && P.value.length > 0 && !k.value && (A.value = !0, E.value = !0);
1130
+ v("focus", n), g.value && W.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,7 +1136,7 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1136
1136
  justifyContent: u.showWordLimit && u.maxLength !== 1 / 0 ? "space-between" : "flex-end",
1137
1137
  alignItems: "center"
1138
1138
  })
1139
- ), _ = dt(), D = L(() => !!_.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), U = L(() => ({
1140
1140
  "is-disabled": T.value,
1141
1141
  "is-loading": $.value,
1142
1142
  "is-auto-switching": ne.value
@@ -1150,16 +1150,16 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1150
1150
  }, 50);
1151
1151
  };
1152
1152
  ee(g, () => {
1153
- X(we), g.value === "" && u.mode === "single" && (N.value = "single");
1153
+ J(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 We = () => {
1160
+ const Ke = () => {
1161
1161
  p.value && p.value.activateFirstField();
1162
- }, { accept: Xe = "*", multiple: Qe = !0 } = ((Ne = u.buttonGroup) == null ? void 0 : Ne.file) || {}, { open: Ae, files: Ye } = ht({ accept: Xe, multiple: Qe });
1162
+ }, { accept: Je = "*", multiple: Qe = !0 } = ((Ne = u.buttonGroup) == null ? void 0 : Ne.file) || {}, { open: Ae, files: Ye } = ht({ accept: Je, multiple: Qe });
1163
1163
  return ee(Ye, (n) => {
1164
1164
  n && n.length > 0 && v("files-selected", Array.from(n));
1165
1165
  }), c({
@@ -1169,46 +1169,46 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1169
1169
  submit: t,
1170
1170
  startSpeech: be,
1171
1171
  stopSpeech: pe,
1172
- activateTemplateFirstField: We
1172
+ activateTemplateFirstField: Ke
1173
1173
  }), (n, x) => (S(), R("div", {
1174
1174
  ref_key: "senderRef",
1175
1175
  ref: o,
1176
- class: te(["tiny-sender", [z.value, `theme-${n.theme}`, `mode-${N.value}`]]),
1176
+ class: te(["tiny-sender", [U.value, `theme-${n.theme}`, `mode-${N.value}`]]),
1177
1177
  "data-theme": n.theme
1178
1178
  }, [
1179
- M("div", Ut, [
1180
- M("div", {
1179
+ z("div", qt, [
1180
+ z("div", {
1181
1181
  class: "tiny-sender__input-wrapper",
1182
1182
  ref_key: "inputWrapperRef",
1183
1183
  ref: b
1184
1184
  }, [
1185
- J(He, { name: "tiny-sender-slide-down" }, {
1185
+ X(He, { name: "tiny-sender-slide-down" }, {
1186
1186
  default: re(() => [
1187
- n.$slots.header ? (S(), R("div", zt, [
1187
+ n.$slots.header ? (S(), R("div", Ut, [
1188
1188
  oe(n.$slots, "header")
1189
- ])) : q("", !0)
1189
+ ])) : M("", !0)
1190
1190
  ]),
1191
1191
  _: 3
1192
1192
  }),
1193
- M("div", {
1193
+ z("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
- ])) : q("", !0),
1199
- M("div", Gt, [
1200
- n.$slots.decorativeContent ? (S(), R("div", Jt, [
1198
+ ])) : M("", !0),
1199
+ z("div", Gt, [
1200
+ n.$slots.decorativeContent ? (S(), R("div", Xt, [
1201
1201
  oe(n.$slots, "decorativeContent")
1202
- ])) : q("", !0),
1203
- k.value ? (S(), Y(Wt, {
1202
+ ])) : M("", !0),
1203
+ k.value ? (S(), Y(Kt, {
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", Xt, [
1211
- J(C(pt), {
1210
+ }, null, 8, ["model-value", "onSubmit"])) : (S(), R("div", Jt, [
1211
+ X(C(pt), {
1212
1212
  ref_key: "inputRef",
1213
1213
  ref: w,
1214
1214
  autosize: n.autoSize,
@@ -1226,26 +1226,26 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__PUR
1226
1226
  onBlur: r
1227
1227
  }, null, 8, ["autosize", "type", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
1228
1228
  C(f) && !C(I) ? (S(), R("div", Qt, [
1229
- M("span", Yt, ae(C(g)), 1),
1229
+ z("span", Yt, ae(C(g)), 1),
1230
1230
  Ge(ae(C(f)) + " ", 1),
1231
- C(E) ? (S(), R("div", Zt, "TAB")) : q("", !0)
1232
- ])) : q("", !0)
1231
+ C(E) ? (S(), R("div", Zt, "TAB")) : M("", !0)
1232
+ ])) : M("", !0)
1233
1233
  ]))
1234
1234
  ]),
1235
1235
  N.value === "single" ? (S(), R("div", en, [
1236
- M("div", {
1236
+ z("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
- J(Je, {
1242
+ X(Xe, {
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": K.value,
1248
+ "has-content": P.value,
1249
1249
  "speech-status": C(Z),
1250
1250
  "button-group": n.buttonGroup,
1251
1251
  "submit-type": n.submitType,
@@ -1258,36 +1258,36 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__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
- ])) : q("", !0)
1261
+ ])) : M("", !0)
1262
1262
  ], 2),
1263
- J(He, { name: "tiny-sender-slide-up" }, {
1263
+ X(He, { name: "tiny-sender-slide-up" }, {
1264
1264
  default: re(() => [
1265
1265
  N.value === "multiple" ? (S(), R("div", {
1266
1266
  key: 0,
1267
- style: Ke(d.value),
1267
+ style: Pe(d.value),
1268
1268
  class: "tiny-sender__footer-slot tiny-sender__bottom-row"
1269
1269
  }, [
1270
- M("div", tn, [
1270
+ z("div", tn, [
1271
1271
  oe(n.$slots, "footer-left")
1272
1272
  ]),
1273
- M("div", nn, [
1273
+ z("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
- M("span", sn, ae(C(g).length), 1),
1279
+ z("span", sn, ae(C(g).length), 1),
1280
1280
  Ge("/" + ae(n.maxLength), 1)
1281
- ], 2)) : q("", !0),
1281
+ ], 2)) : M("", !0),
1282
1282
  N.value === "multiple" ? (S(), R("div", on, [
1283
- M("div", an, [
1284
- J(Je, {
1283
+ z("div", an, [
1284
+ X(Xe, {
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": K.value,
1290
+ "has-content": P.value,
1291
1291
  "speech-status": C(Z),
1292
1292
  "button-group": n.buttonGroup,
1293
1293
  "submit-type": n.submitType,
@@ -1300,30 +1300,30 @@ const Kt = { class: "editor-container" }, De = "​", Fe = "​", Pt = /* @__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
- ])) : q("", !0)
1303
+ ])) : M("", !0)
1304
1304
  ])
1305
1305
  ], 4)) : n.$slots.footer ? (S(), R("div", ln, [
1306
1306
  oe(n.$slots, "footer")
1307
- ])) : q("", !0)
1307
+ ])) : M("", !0)
1308
1308
  ]),
1309
1309
  _: 3
1310
1310
  })
1311
1311
  ], 512)
1312
1312
  ]),
1313
- J(qt, {
1313
+ X(Mt, {
1314
1314
  ref_key: "suggestionsListRef",
1315
1315
  ref: y,
1316
1316
  show: C(A),
1317
- suggestions: C(P),
1317
+ suggestions: C(W),
1318
1318
  "popup-style": ge.value,
1319
- "is-item-highlighted": C(U),
1319
+ "is-item-highlighted": C(q),
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, Mt));
1326
+ ], 10, zt));
1327
1327
  }
1328
1328
  });
1329
1329
  Re.name = "TrSender";