@opentiny/tiny-robot 0.2.3 → 0.2.4

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,7 +1,7 @@
1
- import { ref as O, watch as Y, reactive as Oe, computed as $, nextTick as W, defineComponent as ve, createElementBlock as M, openBlock as k, createCommentVNode as P, createBlock as Z, unref as x, withCtx as G, createVNode as U, normalizeClass as oe, resolveDynamicComponent as Ze, createElementVNode as K, mergeModels as Ne, useModel as Ge, onMounted as Je, useSlots as Qe, Transition as ge, renderSlot as ne, isRef as Te, createTextVNode as xe, toDisplayString as se, normalizeStyle as Re, Fragment as ke, renderList as De, withModifiers as Ye } from "vue";
1
+ import { ref as O, watch as Y, reactive as Oe, computed as $, nextTick as W, defineComponent as he, createElementBlock as I, openBlock as k, createCommentVNode as P, createBlock as G, unref as x, withCtx as J, createVNode as U, normalizeClass as oe, resolveDynamicComponent as Ze, createElementVNode as X, mergeModels as _e, useModel as Ge, onMounted as Je, useSlots as Qe, Transition as ge, renderSlot as ne, isRef as Ne, createTextVNode as Te, toDisplayString as se, normalizeStyle as xe, Fragment as Re, renderList as ke, withModifiers as Ye } from "vue";
2
2
  import { I as et } from "../index5.js";
3
3
  import { B as ue } from "../index3.js";
4
- import { T as me } from "../index4.js";
4
+ import { T as De } from "../index4.js";
5
5
  import { i as tt } from "../close.js";
6
6
  import { I as nt, L as st, v as ot, w as lt, P as at, _ as it } from "../tiny-robot-svgs.js";
7
7
  import { t as rt } from "../utils.js";
@@ -39,14 +39,14 @@ function ut(t, b) {
39
39
  }
40
40
  };
41
41
  }
42
- const Ae = "​", Q = (t) => t.split("").every((b) => b === Ae), J = (t) => t.replace(/\u200B/g, ""), he = () => document.createTextNode(Ae), ct = (t) => {
43
- const b = t.textContent || "", d = J(b);
42
+ const Ae = "​", Q = (t) => t.split("").every((b) => b === Ae), Z = (t) => t.replace(/\u200B/g, ""), me = () => document.createTextNode(Ae), ct = (t) => {
43
+ const b = t.textContent || "", d = Z(b);
44
44
  return !d || d.trim() === "";
45
45
  }, Fe = (t) => {
46
46
  const b = t.nextSibling;
47
47
  if (b && b.nodeType === Node.TEXT_NODE && Q(b.textContent || ""))
48
48
  return;
49
- const d = he();
49
+ const d = me();
50
50
  t.parentNode && t.parentNode.insertBefore(d, t.nextSibling);
51
51
  }, dt = (t) => {
52
52
  Array.from(t.childNodes).forEach((d) => {
@@ -77,10 +77,10 @@ function ft(t, b, d, o, S, i, f, u, s, v, _, l, E) {
77
77
  if (o.value) return;
78
78
  if (m.key === "Enter" && m.shiftKey && (l == null ? void 0 : l.value) === "single" && E) {
79
79
  m.preventDefault(), E();
80
- const I = m.target, z = I.selectionStart, j = d.value;
80
+ const M = m.target, z = M.selectionStart, j = d.value;
81
81
  d.value = j.substring(0, z) + `
82
82
  ` + j.substring(z), setTimeout(() => {
83
- I.selectionStart = I.selectionEnd = z + 1;
83
+ M.selectionStart = M.selectionEnd = z + 1;
84
84
  }, 0);
85
85
  return;
86
86
  }
@@ -140,7 +140,7 @@ function pt(t) {
140
140
  }
141
141
  }
142
142
  if (s.nodeType === Node.ELEMENT_NODE && s.classList.contains("template-field")) {
143
- const w = s.textContent || "", C = J(w);
143
+ const w = s.textContent || "", C = Z(w);
144
144
  if (!C || C.trim() === "") {
145
145
  i.preventDefault();
146
146
  const m = document.createRange(), L = window.getSelection();
@@ -148,8 +148,8 @@ function pt(t) {
148
148
  if (i.key === "ArrowLeft")
149
149
  m.setStartBefore(s);
150
150
  else {
151
- const I = s.nextSibling;
152
- I && I.nodeType === Node.TEXT_NODE && Q(I.textContent || "") ? (m.setStart(I, 0), m.setEnd(I, 0)) : m.setStartAfter(s);
151
+ const M = s.nextSibling;
152
+ M && M.nodeType === Node.TEXT_NODE && Q(M.textContent || "") ? (m.setStart(M, 0), m.setEnd(M, 0)) : m.setStartAfter(s);
153
153
  }
154
154
  return m.collapse(!0), L.removeAllRanges(), L.addRange(m), !0;
155
155
  }
@@ -167,7 +167,7 @@ function pt(t) {
167
167
  if (s.nodeType === Node.TEXT_NODE && Q(s.textContent || "")) {
168
168
  const l = s.previousSibling;
169
169
  if (l && l.nodeType === Node.ELEMENT_NODE && l.classList.contains("template-field")) {
170
- const E = l, F = E.textContent || "", y = J(F);
170
+ const E = l, F = E.textContent || "", y = Z(F);
171
171
  if (!y || y.trim() === "") {
172
172
  i.preventDefault();
173
173
  const w = E.previousSibling, C = s.nextSibling;
@@ -191,7 +191,7 @@ function pt(t) {
191
191
  }
192
192
  if (s.nodeType === Node.TEXT_NODE && s.parentNode && s.parentNode.classList.contains("template-field") && s.textContent) {
193
193
  const l = s.textContent;
194
- if (J(l).length === 1 && v === l.length) {
194
+ if (Z(l).length === 1 && v === l.length) {
195
195
  i.preventDefault(), s.textContent = "";
196
196
  const F = s.parentNode, y = window.getSelection();
197
197
  if (y) {
@@ -214,7 +214,7 @@ function pt(t) {
214
214
  if (!f.collapsed) return !1;
215
215
  const { startContainer: u, startOffset: s } = f;
216
216
  if (u.nodeType === Node.TEXT_NODE && u.parentNode && u.parentNode.classList.contains("template-field") && u.textContent) {
217
- const _ = u.textContent, l = J(_);
217
+ const _ = u.textContent, l = Z(_);
218
218
  if (s === _.length && l.length === 1) {
219
219
  i.preventDefault(), u.textContent = "";
220
220
  const E = u.parentNode, F = window.getSelection();
@@ -389,7 +389,10 @@ function ht(t, b, d, o) {
389
389
  const vt = { class: "action-buttons" }, yt = {
390
390
  key: 0,
391
391
  class: "action-buttons__utility"
392
- }, bt = { class: "action-buttons__submit-content" }, Ct = { class: "action-buttons__cancel" }, Le = /* @__PURE__ */ ve({
392
+ }, bt = { class: "action-buttons__submit-content" }, Ct = {
393
+ key: 1,
394
+ class: "action-buttons__cancel"
395
+ }, Le = /* @__PURE__ */ he({
393
396
  __name: "ActionButtons",
394
397
  props: {
395
398
  loading: { type: Boolean, default: !1 },
@@ -420,20 +423,20 @@ const vt = { class: "action-buttons" }, yt = {
420
423
  }, F = () => {
421
424
  u.value || S("cancel");
422
425
  };
423
- return (y, w) => (k(), M("div", vt, [
424
- v.value ? (k(), M("div", yt, [
425
- y.allowFiles && !y.loading ? (k(), Z(x(me), {
426
+ return (y, w) => (k(), I("div", vt, [
427
+ v.value ? (k(), I("div", yt, [
428
+ y.allowFiles && !y.loading ? (k(), G(x(De), {
426
429
  key: 0,
427
430
  content: "上传文件",
428
431
  placement: "top"
429
432
  }, {
430
- default: G(() => [
433
+ default: J(() => [
431
434
  U(x(ue), {
432
435
  class: "action-buttons__button action-buttons__file-button",
433
436
  type: "text",
434
437
  disabled: u.value
435
438
  }, {
436
- default: G(() => [
439
+ default: J(() => [
437
440
  U(x(nt), {
438
441
  class: "action-buttons__icon",
439
442
  alt: "上传文件"
@@ -444,19 +447,19 @@ const vt = { class: "action-buttons" }, yt = {
444
447
  ]),
445
448
  _: 1
446
449
  })) : P("", !0),
447
- i.value && !y.loading ? (k(), Z(x(ue), {
450
+ i.value && !y.loading ? (k(), G(x(ue), {
448
451
  key: 1,
449
452
  class: oe(["action-buttons__button action-buttons__speech-button", { "is-recording": f.value }]),
450
453
  type: "text",
451
454
  disabled: u.value,
452
455
  onClick: l
453
456
  }, {
454
- default: G(() => [
455
- f.value ? (k(), Z(x(ot), {
457
+ default: J(() => [
458
+ f.value ? (k(), G(x(ot), {
456
459
  key: 1,
457
460
  class: "action-buttons__icon action-buttons__icon--recording",
458
461
  alt: "语音中"
459
- })) : (k(), Z(x(st), {
462
+ })) : (k(), G(x(st), {
460
463
  key: 0,
461
464
  class: "action-buttons__icon",
462
465
  alt: "录音"
@@ -464,20 +467,20 @@ const vt = { class: "action-buttons" }, yt = {
464
467
  ]),
465
468
  _: 1
466
469
  }, 8, ["disabled", "class"])) : P("", !0),
467
- y.showClear ? (k(), Z(x(me), {
470
+ y.showClear ? (k(), G(x(De), {
468
471
  key: 2,
469
472
  content: "清空内容",
470
473
  placement: "top"
471
474
  }, {
472
- default: G(() => [
475
+ default: J(() => [
473
476
  U(x(ue), {
474
477
  class: "action-buttons__button action-buttons__clear-button",
475
478
  type: "text",
476
479
  disabled: u.value || !y.hasContent,
477
480
  onClick: _
478
481
  }, {
479
- default: G(() => [
480
- (k(), Z(Ze(x(d)), { class: "action-buttons__icon action-buttons__icon--close" }))
482
+ default: J(() => [
483
+ (k(), G(Ze(x(d)), { class: "action-buttons__icon action-buttons__icon--close" }))
481
484
  ]),
482
485
  _: 1
483
486
  }, 8, ["disabled"])
@@ -485,31 +488,22 @@ const vt = { class: "action-buttons" }, yt = {
485
488
  _: 1
486
489
  })) : P("", !0)
487
490
  ])) : P("", !0),
488
- y.hasContent || y.loading ? (k(), Z(x(ue), {
491
+ y.hasContent || y.loading ? (k(), G(x(ue), {
489
492
  key: 1,
490
493
  type: "text",
491
494
  class: "action-buttons__button action-buttons__submit",
492
495
  disabled: y.loading ? u.value : s.value,
493
496
  onClick: w[0] || (w[0] = (C) => y.loading ? F() : E())
494
497
  }, {
495
- default: G(() => [
496
- K("div", bt, [
497
- y.loading ? (k(), Z(x(me), {
498
- key: 1,
499
- content: "停止生成",
500
- placement: "top"
501
- }, {
502
- default: G(() => [
503
- K("div", Ct, [
504
- U(x(at), {
505
- class: "action-buttons__icon action-buttons__icon--stop",
506
- alt: "加载中"
507
- }),
508
- w[1] || (w[1] = K("span", { class: "action-buttons__cancel-text" }, "停止回答", -1))
509
- ])
510
- ]),
511
- _: 1
512
- })) : (k(), Z(x(lt), {
498
+ default: J(() => [
499
+ X("div", bt, [
500
+ y.loading ? (k(), I("div", Ct, [
501
+ U(x(at), {
502
+ class: "action-buttons__icon action-buttons__icon--stop",
503
+ alt: "加载中"
504
+ }),
505
+ w[1] || (w[1] = X("span", { class: "action-buttons__cancel-text" }, "停止回答", -1))
506
+ ])) : (k(), G(x(lt), {
513
507
  key: 0,
514
508
  class: "action-buttons__icon action-buttons__icon--send",
515
509
  alt: "发送"
@@ -539,15 +533,15 @@ function wt(t, b) {
539
533
  let a = "";
540
534
  if (e.nodeType === Node.TEXT_NODE) {
541
535
  const g = e.textContent || "";
542
- a += J(g);
536
+ a += Z(g);
543
537
  } else if (e.nodeType === Node.ELEMENT_NODE) {
544
538
  const g = e;
545
539
  if (g.classList.contains("template-field")) {
546
540
  const T = g.textContent || "";
547
- a += J(T);
541
+ a += Z(T);
548
542
  } else if (g.tagName.toLowerCase() === "span") {
549
543
  const T = g.textContent || "";
550
- a += J(T);
544
+ a += Z(T);
551
545
  } else if (g.tagName.toLowerCase() === "br")
552
546
  a += `
553
547
  `;
@@ -566,7 +560,7 @@ function wt(t, b) {
566
560
  v(e, r || "");
567
561
  }), e;
568
562
  }, v = (n, r) => {
569
- const e = J(r);
563
+ const e = Z(r);
570
564
  if (!e || e.trim() === "") {
571
565
  const a = n.getAttribute("data-placeholder") || "";
572
566
  a ? _(n, a, !0) : (n.style.minWidth = "", n.style.width = "");
@@ -578,7 +572,7 @@ function wt(t, b) {
578
572
  a.className = "template-field", a.style.visibility = "hidden", a.style.position = "absolute", a.style.top = "-9999px", a.style.left = "-9999px", a.style.whiteSpace = "nowrap", a.style.padding = "3px 8px", a.style.margin = "0 2px", a.style.boxSizing = "border-box", a.textContent = r, document.body.appendChild(a);
579
573
  const g = getComputedStyle(a), T = a.offsetWidth, A = parseFloat(g.fontSize);
580
574
  document.body.removeChild(a);
581
- const V = e ? 1.5 : 2, X = T / A, B = Math.max(V, Math.ceil(X));
575
+ const V = e ? 1.5 : 2, H = T / A, B = Math.max(V, Math.ceil(H));
582
576
  n.style.setProperty("min-width", `${B}em`, "important");
583
577
  const q = 20;
584
578
  B > q ? (n.style.setProperty("max-width", `${q}em`, "important"), n.style.setProperty("white-space", "normal", "important"), n.style.setProperty("word-break", "break-word", "important")) : n.style.removeProperty("max-width");
@@ -622,7 +616,7 @@ function wt(t, b) {
622
616
  if (g.type === "field") {
623
617
  const T = u(g.content), A = s(g.content, T);
624
618
  e.appendChild(A);
625
- const V = he();
619
+ const V = me();
626
620
  e.appendChild(V), a || (a = A);
627
621
  } else
628
622
  e.appendChild(document.createTextNode(g.content));
@@ -634,7 +628,7 @@ function wt(t, b) {
634
628
  const g = w(n, r);
635
629
  g.success ? g.elements.forEach((T) => {
636
630
  if (e.appendChild(T.node), T.isField) {
637
- const A = he();
631
+ const A = me();
638
632
  e.appendChild(A);
639
633
  }
640
634
  T.isField && !a && (a = T.node);
@@ -653,9 +647,9 @@ function wt(t, b) {
653
647
  }), a += A.content.length, g++) : T = !1;
654
648
  else {
655
649
  let V = "";
656
- const X = n.find((B, q) => q > g && B.type === "text");
657
- if (X) {
658
- const B = r.substring(a), q = B.indexOf(X.content);
650
+ const H = n.find((B, q) => q > g && B.type === "text");
651
+ if (H) {
652
+ const B = r.substring(a), q = B.indexOf(H.content);
659
653
  q !== -1 ? (V = B.substring(0, q), a += V.length) : T = !1;
660
654
  } else
661
655
  V = r.substring(a), a = r.length;
@@ -669,7 +663,7 @@ function wt(t, b) {
669
663
  for (let A = g; A < n.length; A++) {
670
664
  const V = n[A];
671
665
  if (V.type === "field") {
672
- const X = !o.value || o.value === "" ? u(V.content) : "", B = s(V.content, X);
666
+ const H = !o.value || o.value === "" ? u(V.content) : "", B = s(V.content, H);
673
667
  e.push({ node: B, isField: !0 });
674
668
  } else
675
669
  e.push({
@@ -684,7 +678,7 @@ function wt(t, b) {
684
678
  const n = i(o.template), r = y(n, o.value);
685
679
  l(), W(() => {
686
680
  if (h(), r) {
687
- const e = r.textContent || "", a = J(e);
681
+ const e = r.textContent || "", a = Z(e);
688
682
  a && a.trim() !== "" ? E(r, "inside", !1) : E(r, "inside", !0);
689
683
  } else
690
684
  F();
@@ -692,15 +686,15 @@ function wt(t, b) {
692
686
  });
693
687
  }, m = () => {
694
688
  if (o.isComposing) return;
695
- I(), p(), L(), h();
689
+ M(), p(), L(), h();
696
690
  const n = f();
697
- n !== o.value && (o.onValueChange(n), o.onInput(n)), l(n), n === "" && t.value && Array.from(t.value.childNodes).every((e) => e.nodeType === Node.ELEMENT_NODE && e.classList.contains("template-field") ? ct(e) : !!(e.nodeType === Node.TEXT_NODE && Q(e.textContent || ""))) && I();
691
+ n !== o.value && (o.onValueChange(n), o.onInput(n)), l(n), n === "" && t.value && Array.from(t.value.childNodes).every((e) => e.nodeType === Node.ELEMENT_NODE && e.classList.contains("template-field") ? ct(e) : !!(e.nodeType === Node.TEXT_NODE && Q(e.textContent || ""))) && M();
698
692
  }, L = () => {
699
693
  if (!t.value) return;
700
694
  dt(t.value), t.value.querySelectorAll(".template-field").forEach((r) => {
701
695
  Fe(r);
702
696
  });
703
- }, I = () => {
697
+ }, M = () => {
704
698
  if (!t.value) return;
705
699
  const n = [];
706
700
  t.value.childNodes.forEach((r) => {
@@ -748,8 +742,8 @@ function wt(t, b) {
748
742
  B && e.setAttribute("data-placeholder", B);
749
743
  }
750
744
  e.removeAttribute("style");
751
- const X = e.textContent || "";
752
- v(e, X);
745
+ const H = e.textContent || "";
746
+ v(e, H);
753
747
  }
754
748
  });
755
749
  }, h = () => {
@@ -776,7 +770,7 @@ function wt(t, b) {
776
770
  // 事件处理
777
771
  handleInput: m,
778
772
  checkHasContent: l,
779
- cleanupEmptyTextNodes: I,
773
+ cleanupEmptyTextNodes: M,
780
774
  // 推断 placeholder
781
775
  inferPlaceholderForContent: z,
782
776
  extractPlaceholderFromElement: j,
@@ -807,16 +801,16 @@ function wt(t, b) {
807
801
  updateOptions: S
808
802
  };
809
803
  }
810
- const St = /* @__PURE__ */ ve({
804
+ const St = /* @__PURE__ */ he({
811
805
  __name: "TemplateEditor",
812
- props: /* @__PURE__ */ Ne({
806
+ props: /* @__PURE__ */ _e({
813
807
  value: {},
814
808
  autofocus: { type: Boolean }
815
809
  }, {
816
810
  value: { default: "" },
817
811
  valueModifiers: {}
818
812
  }),
819
- emits: /* @__PURE__ */ Ne(["input", "content-status", "submit", "focus", "blur", "empty-content"], ["update:value"]),
813
+ emits: /* @__PURE__ */ _e(["input", "content-status", "submit", "focus", "blur", "empty-content"], ["update:value"]),
820
814
  setup(t, { expose: b, emit: d }) {
821
815
  const o = Ge(t, "value"), S = t, i = d, f = O(null), u = O(""), s = O({}), v = O(!1), _ = O(!1), l = wt(f, {
822
816
  template: u.value,
@@ -845,8 +839,8 @@ const St = /* @__PURE__ */ ve({
845
839
  onSubmit: (p) => i("submit", p)
846
840
  }), F = (p, h) => {
847
841
  let N = p;
848
- return Object.entries(h).forEach(([H, n]) => {
849
- const r = `[${H}]`;
842
+ return Object.entries(h).forEach(([K, n]) => {
843
+ const r = `[${K}]`;
850
844
  N = N.replace(new RegExp(r.replace(/[[\]]/g, "\\$&"), "g"), n);
851
845
  }), N;
852
846
  }, y = (p) => {
@@ -865,11 +859,11 @@ const St = /* @__PURE__ */ ve({
865
859
  }, C = () => {
866
860
  _.value = !1, l.handleInput();
867
861
  }, m = (p) => {
868
- var H;
862
+ var K;
869
863
  if (!f.value) return;
870
864
  const h = p.target;
871
865
  let N = null;
872
- if (h.classList.contains("template-field") ? N = h : (H = h.parentElement) != null && H.classList.contains("template-field") && (N = h.parentElement), N && (!N.textContent || N.textContent.trim() === "")) {
866
+ if (h.classList.contains("template-field") ? N = h : (K = h.parentElement) != null && K.classList.contains("template-field") && (N = h.parentElement), N && (!N.textContent || N.textContent.trim() === "")) {
873
867
  const n = window.getSelection(), r = document.createRange();
874
868
  n && (r.selectNodeContents(N), r.collapse(!0), n.removeAllRanges(), n.addRange(r), N.focus(), p.preventDefault(), p.stopPropagation());
875
869
  }
@@ -877,18 +871,18 @@ const St = /* @__PURE__ */ ve({
877
871
  p.preventDefault();
878
872
  const h = p.clipboardData;
879
873
  if (!h) return;
880
- const N = h.getData("text/html"), H = h.getData("text/plain");
874
+ const N = h.getData("text/html"), K = h.getData("text/plain");
881
875
  if (N) {
882
876
  const n = document.createElement("div");
883
877
  n.innerHTML = N;
884
878
  const r = n.querySelectorAll("span");
885
879
  let e = !1;
886
880
  if (r.forEach((a) => {
887
- const g = a, T = g.style, A = g.classList.contains("template-field"), V = g.hasAttribute("data-placeholder"), X = T.backgroundColor && // 标准格式
881
+ const g = a, T = g.style, A = g.classList.contains("template-field"), V = g.hasAttribute("data-placeholder"), H = T.backgroundColor && // 标准格式
888
882
  (T.backgroundColor === "rgba(0, 0, 0, 0.05)" || T.backgroundColor === "rgba(0, 0, 0, 0.08)" || // 可能的变体格式
889
883
  T.backgroundColor.includes("rgba(0, 0, 0, 0.05)") || T.backgroundColor.includes("rgba(0, 0, 0, 0.08)") || // 十六进制或其他可能的格式
890
884
  T.backgroundColor.toLowerCase().includes("0.05") || T.backgroundColor.toLowerCase().includes("0.08")), B = T.borderRadius === "4px" || T.padding === "3px 8px" || T.margin === "0px 2px" || T.whiteSpace === "nowrap";
891
- if (A || V || X || B) {
885
+ if (A || V || H || B) {
892
886
  if (e = !0, g.className = "template-field", !g.getAttribute("data-placeholder")) {
893
887
  const q = l.extractPlaceholderFromElement(g);
894
888
  q && g.setAttribute("data-placeholder", q);
@@ -896,20 +890,20 @@ const St = /* @__PURE__ */ ve({
896
890
  g.removeAttribute("style");
897
891
  }
898
892
  }), e) {
899
- I(n);
893
+ M(n);
900
894
  return;
901
895
  }
902
896
  }
903
- H && z(H);
904
- }, I = (p) => {
897
+ K && z(K);
898
+ }, M = (p) => {
905
899
  const h = window.getSelection();
906
900
  if (h && h.rangeCount > 0) {
907
901
  const N = h.getRangeAt(0);
908
902
  N.deleteContents();
909
- const H = document.createDocumentFragment();
903
+ const K = document.createDocumentFragment();
910
904
  for (; p.firstChild; )
911
- H.appendChild(p.firstChild);
912
- N.insertNode(H), N.collapse(!1), h.removeAllRanges(), h.addRange(N), j();
905
+ K.appendChild(p.firstChild);
906
+ N.insertNode(K), N.collapse(!1), h.removeAllRanges(), h.addRange(N), j();
913
907
  }
914
908
  }, z = (p) => {
915
909
  const h = window.getSelection();
@@ -974,7 +968,7 @@ const St = /* @__PURE__ */ ve({
974
968
  activateFirstField: l.activateFirstField,
975
969
  getValueFromDOM: l.getValueFromDOM,
976
970
  setTemplate: y
977
- }), (p, h) => (k(), M("div", {
971
+ }), (p, h) => (k(), I("div", {
978
972
  class: "template-editor",
979
973
  ref_key: "contentEditableRef",
980
974
  ref: f,
@@ -1021,7 +1015,7 @@ const St = /* @__PURE__ */ ve({
1021
1015
  }, $t = ["onMouseenter", "onMousedown"], Pt = { class: "suggestion-item__text" }, Kt = {
1022
1016
  key: 0,
1023
1017
  class: "tiny-sender__error"
1024
- }, ce = /* @__PURE__ */ ve({
1018
+ }, ce = /* @__PURE__ */ he({
1025
1019
  __name: "index",
1026
1020
  props: {
1027
1021
  autofocus: { type: Boolean, default: !1 },
@@ -1054,13 +1048,13 @@ const St = /* @__PURE__ */ ve({
1054
1048
  completionPlaceholder: C,
1055
1049
  showTabHint: m,
1056
1050
  suggestionsListRef: L,
1057
- filteredSuggestions: I,
1051
+ filteredSuggestions: M,
1058
1052
  activeSuggestion: z,
1059
1053
  updateSuggestionsState: j,
1060
1054
  selectSuggestion: p,
1061
1055
  acceptCurrentSuggestion: h,
1062
1056
  closeSuggestionsPopup: N,
1063
- navigateSuggestions: H,
1057
+ navigateSuggestions: K,
1064
1058
  handleSuggestionItemHover: n,
1065
1059
  highlightSuggestionText: r
1066
1060
  } = ht(o, S, l, E), e = O(o.mode), a = O(!1), g = () => {
@@ -1089,22 +1083,22 @@ const St = /* @__PURE__ */ ve({
1089
1083
  const re = document.querySelector(".tiny-textarea__inner");
1090
1084
  if (re) {
1091
1085
  re.style.whiteSpace = "pre-wrap";
1092
- const _e = l.value.length;
1093
- re.focus(), re.setSelectionRange(_e, _e);
1086
+ const Ee = l.value.length;
1087
+ re.focus(), re.setSelectionRange(Ee, Ee);
1094
1088
  }
1095
1089
  a.value = !1;
1096
1090
  }, 300) : a.value = !1;
1097
1091
  }));
1098
1092
  }, V = () => {
1099
1093
  if (_.value && u.value)
1100
- ye();
1094
+ ve();
1101
1095
  else if (i.value)
1102
1096
  i.value.focus();
1103
1097
  else {
1104
1098
  const c = document.querySelector(".tiny-input__inner");
1105
1099
  c == null || c.focus();
1106
1100
  }
1107
- }, X = () => {
1101
+ }, H = () => {
1108
1102
  _.value = !1, S("reset-template"), W(() => {
1109
1103
  l.value === "" && (e.value = o.mode || "single"), setTimeout(() => {
1110
1104
  V();
@@ -1112,12 +1106,12 @@ const St = /* @__PURE__ */ ve({
1112
1106
  });
1113
1107
  }, B = () => {
1114
1108
  var c;
1115
- F(), _.value ? X() : (c = f.value) == null || c.focus(), W(() => {
1109
+ F(), _.value ? H() : (c = f.value) == null || c.focus(), W(() => {
1116
1110
  l.value === "" && (e.value = o.mode || "single");
1117
1111
  }), N();
1118
1112
  }, q = (c) => {
1119
1113
  S("update:modelValue", c);
1120
- }, ye = () => {
1114
+ }, ve = () => {
1121
1115
  u.value && u.value.activateFirstField();
1122
1116
  }, Ie = (c, R) => {
1123
1117
  _.value = !0, W(() => {
@@ -1143,8 +1137,8 @@ const St = /* @__PURE__ */ ve({
1143
1137
  ze(R.message), S("speech-error", R);
1144
1138
  }
1145
1139
  };
1146
- }), { speechState: ae, start: be, stop: Ce } = gt(Me.value), de = () => {
1147
- ae.isRecording ? Ce() : be();
1140
+ }), { speechState: ae, start: ye, stop: be } = gt(Me.value), de = () => {
1141
+ ae.isRecording ? be() : ye();
1148
1142
  }, { handleKeyPress: Ve, triggerSubmit: fe } = ft(
1149
1143
  o,
1150
1144
  S,
@@ -1155,12 +1149,12 @@ const St = /* @__PURE__ */ ve({
1155
1149
  z,
1156
1150
  h,
1157
1151
  N,
1158
- H,
1152
+ K,
1159
1153
  de,
1160
1154
  e,
1161
1155
  g
1162
1156
  ), Be = (c) => {
1163
- S("focus", c), l.value && I.value.length > 0 && !o.template && (y.value = !0, m.value = !0);
1157
+ S("focus", c), l.value && M.value.length > 0 && !o.template && (y.value = !0, m.value = !0);
1164
1158
  }, We = (c) => {
1165
1159
  S("blur", c), N();
1166
1160
  }, $e = $(() => e.value === "multiple" ? "textarea" : "text"), Pe = $(
@@ -1169,9 +1163,9 @@ const St = /* @__PURE__ */ ve({
1169
1163
  justifyContent: o.showWordLimit && o.maxLength !== 1 / 0 ? "space-between" : "flex-end",
1170
1164
  alignItems: "center"
1171
1165
  })
1172
- ), Ke = Qe(), He = $(() => !!Ke.decorativeContent), ie = $(() => o.disabled || He.value), we = $(() => o.loading), Se = $(() => o.hasContent !== void 0 ? o.hasContent : !!l.value), Xe = $(() => ({
1166
+ ), Ke = Qe(), He = $(() => !!Ke.decorativeContent), ie = $(() => o.disabled || He.value), Ce = $(() => o.loading), we = $(() => o.hasContent !== void 0 ? o.hasContent : !!l.value), Xe = $(() => ({
1173
1167
  "is-disabled": ie.value,
1174
- "is-loading": we.value,
1168
+ "is-loading": Ce.value,
1175
1169
  "has-error": !!le.value,
1176
1170
  "is-auto-switching": a.value
1177
1171
  })), qe = $(() => ({
@@ -1204,58 +1198,58 @@ const St = /* @__PURE__ */ ve({
1204
1198
  },
1205
1199
  clear: B,
1206
1200
  submit: fe,
1207
- startSpeech: be,
1208
- stopSpeech: Ce,
1209
- activateTemplateFirstField: ye,
1201
+ startSpeech: ye,
1202
+ stopSpeech: be,
1203
+ activateTemplateFirstField: ve,
1210
1204
  setTemplate: Ie
1211
- }), (c, R) => (k(), M("div", {
1205
+ }), (c, R) => (k(), I("div", {
1212
1206
  ref_key: "senderRef",
1213
1207
  ref: f,
1214
1208
  class: oe(["tiny-sender", [Xe.value, `theme-${c.theme}`, `mode-${e.value}`]]),
1215
1209
  "data-theme": c.theme
1216
1210
  }, [
1217
- K("div", _t, [
1218
- K("div", {
1211
+ X("div", _t, [
1212
+ X("div", {
1219
1213
  class: "tiny-sender__input-wrapper",
1220
1214
  ref_key: "inputWrapperRef",
1221
1215
  ref: s
1222
1216
  }, [
1223
1217
  U(ge, { name: "tiny-sender-slide-down" }, {
1224
- default: G(() => [
1225
- c.$slots.header ? (k(), M("div", Nt, [
1218
+ default: J(() => [
1219
+ c.$slots.header ? (k(), I("div", Nt, [
1226
1220
  ne(c.$slots, "header")
1227
1221
  ])) : P("", !0)
1228
1222
  ]),
1229
1223
  _: 3
1230
1224
  }),
1231
- K("div", {
1225
+ X("div", {
1232
1226
  class: oe(["tiny-sender__input-row", { "has-prefix": c.$slots.prefix, "has-header": c.$slots.header }])
1233
1227
  }, [
1234
- c.$slots.prefix ? (k(), M("div", Tt, [
1228
+ c.$slots.prefix ? (k(), I("div", Tt, [
1235
1229
  ne(c.$slots, "prefix")
1236
1230
  ])) : P("", !0),
1237
- K("div", xt, [
1238
- c.$slots.decorativeContent ? (k(), M("div", Rt, [
1231
+ X("div", xt, [
1232
+ c.$slots.decorativeContent ? (k(), I("div", Rt, [
1239
1233
  ne(c.$slots, "decorativeContent")
1240
1234
  ])) : P("", !0),
1241
- _.value ? (k(), Z(St, {
1235
+ _.value ? (k(), G(St, {
1242
1236
  key: 1,
1243
1237
  ref_key: "templateEditorRef",
1244
1238
  ref: u,
1245
1239
  value: x(l),
1246
- "onUpdate:value": R[0] || (R[0] = (D) => Te(l) ? l.value = D : null),
1240
+ "onUpdate:value": R[0] || (R[0] = (D) => Ne(l) ? l.value = D : null),
1247
1241
  onInput: q,
1248
- onEmptyContent: X
1249
- }, null, 8, ["value"])) : (k(), M("div", kt, [
1242
+ onEmptyContent: H
1243
+ }, null, 8, ["value"])) : (k(), I("div", kt, [
1250
1244
  U(x(et), {
1251
1245
  ref_key: "inputRef",
1252
1246
  ref: i,
1253
1247
  autosize: c.autoSize,
1254
1248
  type: $e.value,
1255
- readonly: we.value,
1249
+ readonly: Ce.value,
1256
1250
  resize: "none",
1257
1251
  modelValue: x(l),
1258
- "onUpdate:modelValue": R[1] || (R[1] = (D) => Te(l) ? l.value = D : null),
1252
+ "onUpdate:modelValue": R[1] || (R[1] = (D) => Ne(l) ? l.value = D : null),
1259
1253
  disabled: ie.value,
1260
1254
  placeholder: c.placeholder,
1261
1255
  autofocus: c.autofocus,
@@ -1265,15 +1259,15 @@ const St = /* @__PURE__ */ ve({
1265
1259
  onFocus: Be,
1266
1260
  onBlur: We
1267
1261
  }, null, 8, ["autosize", "type", "readonly", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
1268
- x(C) && !x(E) ? (k(), M("div", Dt, [
1269
- K("span", Ft, se(x(l)), 1),
1270
- xe(se(x(C)) + " ", 1),
1271
- x(m) ? (k(), M("div", Lt, "TAB")) : P("", !0)
1262
+ x(C) && !x(E) ? (k(), I("div", Dt, [
1263
+ X("span", Ft, se(x(l)), 1),
1264
+ Te(se(x(C)) + " ", 1),
1265
+ x(m) ? (k(), I("div", Lt, "TAB")) : P("", !0)
1272
1266
  ])) : P("", !0)
1273
1267
  ]))
1274
1268
  ]),
1275
- e.value === "single" ? (k(), M("div", Ot, [
1276
- K("div", {
1269
+ e.value === "single" ? (k(), I("div", Ot, [
1270
+ X("div", {
1277
1271
  class: "tiny-sender__buttons-container",
1278
1272
  ref_key: "buttonsContainerRef",
1279
1273
  ref: v
@@ -1285,7 +1279,7 @@ const St = /* @__PURE__ */ ve({
1285
1279
  loading: c.loading,
1286
1280
  disabled: ie.value,
1287
1281
  "show-clear": c.clearable,
1288
- "has-content": Se.value,
1282
+ "has-content": we.value,
1289
1283
  "speech-status": x(ae),
1290
1284
  "submit-type": c.submitType,
1291
1285
  "is-over-limit": pe.value,
@@ -1298,33 +1292,33 @@ const St = /* @__PURE__ */ ve({
1298
1292
  ])) : P("", !0)
1299
1293
  ], 2),
1300
1294
  U(ge, { name: "tiny-sender-slide-up" }, {
1301
- default: G(() => [
1302
- e.value === "multiple" ? (k(), M("div", {
1295
+ default: J(() => [
1296
+ e.value === "multiple" ? (k(), I("div", {
1303
1297
  key: 0,
1304
- style: Re(Pe.value),
1298
+ style: xe(Pe.value),
1305
1299
  class: "tiny-sender__footer-slot tiny-sender__bottom-row"
1306
1300
  }, [
1307
- K("div", At, [
1301
+ X("div", At, [
1308
1302
  ne(c.$slots, "footer-left")
1309
1303
  ]),
1310
- K("div", It, [
1304
+ X("div", It, [
1311
1305
  ne(c.$slots, "footer-right"),
1312
- c.showWordLimit && c.maxLength !== 1 / 0 ? (k(), M("div", {
1306
+ c.showWordLimit && c.maxLength !== 1 / 0 ? (k(), I("div", {
1313
1307
  key: 0,
1314
1308
  class: oe(["tiny-sender__word-limit", { "is-over-limit": pe.value }])
1315
1309
  }, [
1316
- K("span", Mt, se(x(l).length), 1),
1317
- xe("/" + se(c.maxLength), 1)
1310
+ X("span", Mt, se(x(l).length), 1),
1311
+ Te("/" + se(c.maxLength), 1)
1318
1312
  ], 2)) : P("", !0),
1319
- e.value === "multiple" ? (k(), M("div", Vt, [
1320
- K("div", Bt, [
1313
+ e.value === "multiple" ? (k(), I("div", Vt, [
1314
+ X("div", Bt, [
1321
1315
  U(Le, {
1322
1316
  "allow-speech": c.allowSpeech,
1323
1317
  "allow-files": c.allowFiles,
1324
1318
  loading: c.loading,
1325
1319
  disabled: ie.value,
1326
1320
  "show-clear": c.clearable,
1327
- "has-content": Se.value,
1321
+ "has-content": we.value,
1328
1322
  "speech-status": x(ae),
1329
1323
  "submit-type": c.submitType,
1330
1324
  "is-over-limit": pe.value,
@@ -1336,7 +1330,7 @@ const St = /* @__PURE__ */ ve({
1336
1330
  ])
1337
1331
  ])) : P("", !0)
1338
1332
  ])
1339
- ], 4)) : c.$slots.footer ? (k(), M("div", Wt, [
1333
+ ], 4)) : c.$slots.footer ? (k(), I("div", Wt, [
1340
1334
  ne(c.$slots, "footer")
1341
1335
  ])) : P("", !0)
1342
1336
  ]),
@@ -1345,24 +1339,24 @@ const St = /* @__PURE__ */ ve({
1345
1339
  ], 512)
1346
1340
  ]),
1347
1341
  U(ge, { name: "tiny-sender-slide-up" }, {
1348
- default: G(() => [
1349
- x(y) && x(I).length ? (k(), M("div", {
1342
+ default: J(() => [
1343
+ x(y) && x(M).length ? (k(), I("div", {
1350
1344
  key: 0,
1351
1345
  ref_key: "suggestionsListRef",
1352
1346
  ref: L,
1353
1347
  class: "tiny-sender__suggestions",
1354
- style: Re(qe.value)
1348
+ style: xe(qe.value)
1355
1349
  }, [
1356
- (k(!0), M(ke, null, De(x(I), (D, ee) => (k(), M("div", {
1350
+ (k(!0), I(Re, null, ke(x(M), (D, ee) => (k(), I("div", {
1357
1351
  key: ee,
1358
1352
  class: oe(["suggestion-item", { highlighted: ee === x(w) }]),
1359
1353
  onMouseenter: (te) => x(n)(ee),
1360
1354
  onMousedown: Ye((te) => x(p)(D), ["prevent"])
1361
1355
  }, [
1362
1356
  U(x(it), { class: "suggestion-item__icon" }),
1363
- K("span", Pt, [
1364
- (k(!0), M(ke, null, De(x(r)(D, x(l)), (te, Ee) => (k(), M("span", {
1365
- key: Ee,
1357
+ X("span", Pt, [
1358
+ (k(!0), I(Re, null, ke(x(r)(D, x(l)), (te, Se) => (k(), I("span", {
1359
+ key: Se,
1366
1360
  class: oe({ "suggestion-item__text--match": te.isMatch, "suggestion-item__text--normal": !te.isMatch })
1367
1361
  }, se(te.text), 3))), 128))
1368
1362
  ])
@@ -1371,7 +1365,7 @@ const St = /* @__PURE__ */ ve({
1371
1365
  ]),
1372
1366
  _: 1
1373
1367
  }),
1374
- le.value ? (k(), M("div", Kt, se(le.value), 1)) : P("", !0)
1368
+ le.value ? (k(), I("div", Kt, se(le.value), 1)) : P("", !0)
1375
1369
  ], 10, Et));
1376
1370
  }
1377
1371
  });