@opentiny/tiny-robot 0.3.0-alpha.1 → 0.3.0-alpha.3

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,34 +1,34 @@
1
1
  import { ref as O, watch as te, reactive as $e, computed as P, nextTick as W, defineComponent as be, createElementBlock as A, openBlock as D, createCommentVNode as H, createBlock as Q, unref as E, withCtx as Y, createVNode as G, normalizeClass as ae, resolveDynamicComponent as it, createElementVNode as U, mergeModels as Fe, useModel as rt, onMounted as ut, useSlots as ct, Transition as ve, renderSlot as se, isRef as Le, createTextVNode as Oe, toDisplayString as le, normalizeStyle as Ie, Fragment as Ae, renderList as Me, withModifiers as dt } from "vue";
2
2
  import { I as ft } from "../index5.js";
3
- import { g as z, i as pt, t as ht } from "../utils.js";
3
+ import { g as z, i as pt, t as mt } from "../utils.js";
4
4
  import { B as fe } from "../index3.js";
5
5
  import { T as Ve } from "../index4.js";
6
- import { i as mt } from "../close.js";
7
- import { d as gt, k as vt, P as yt, h as bt, H as Ct, i as St } from "../tiny-robot-svgs.js";
6
+ import { i as ht } from "../close.js";
7
+ import { o as gt, H as vt, g as yt, F as bt, X as Ct, s as St } from "../tiny-robot-svgs.js";
8
8
  function wt(t, y) {
9
- const m = O(t.modelValue || t.defaultValue || ""), o = O(null);
9
+ const h = O(t.modelValue || t.defaultValue || ""), o = O(null);
10
10
  te(
11
11
  () => t.modelValue,
12
12
  (f) => {
13
- f !== void 0 && f !== m.value && (m.value = f);
13
+ f !== void 0 && f !== h.value && (h.value = f);
14
14
  }
15
15
  ), te(
16
- () => m.value,
16
+ () => h.value,
17
17
  (f) => {
18
18
  y("update:modelValue", f);
19
19
  }
20
20
  );
21
21
  const x = (f) => {
22
- m.value = f, y("update:modelValue", f);
22
+ h.value = f, y("update:modelValue", f);
23
23
  }, u = (f) => {
24
24
  f == null || f.preventDefault();
25
- const p = m.value;
25
+ const p = h.value;
26
26
  !t.disabled && !t.loading && p.trim() && y("submit", p);
27
27
  }, i = () => {
28
- m.value = "", y("update:modelValue", ""), y("clear");
28
+ h.value = "", y("update:modelValue", ""), y("clear");
29
29
  }, r = O(!1);
30
30
  return {
31
- inputValue: m,
31
+ inputValue: h,
32
32
  inputWrapper: o,
33
33
  isComposing: r,
34
34
  handleChange: x,
@@ -40,73 +40,73 @@ function wt(t, y) {
40
40
  };
41
41
  }
42
42
  const Pe = "​", ee = (t) => t.split("").every((y) => y === Pe), J = (t) => t.replace(/\u200B/g, ""), ye = () => document.createTextNode(Pe), Et = (t) => {
43
- const y = t.textContent || "", m = J(y);
44
- return !m || m.trim() === "";
43
+ const y = t.textContent || "", h = J(y);
44
+ return !h || h.trim() === "";
45
45
  }, Be = (t) => {
46
46
  const y = t.nextSibling;
47
47
  if (y && y.nodeType === Node.TEXT_NODE && ee(y.textContent || ""))
48
48
  return;
49
- const m = ye();
50
- t.parentNode && t.parentNode.insertBefore(m, t.nextSibling);
49
+ const h = ye();
50
+ t.parentNode && t.parentNode.insertBefore(h, t.nextSibling);
51
51
  }, _t = (t) => {
52
- Array.from(t.childNodes).forEach((m) => {
53
- if (m.nodeType === Node.TEXT_NODE && ee(m.textContent || "")) {
54
- const o = m.previousSibling;
55
- o && o.nodeType === Node.ELEMENT_NODE && o.classList.contains("template-field") || m.parentNode && m.parentNode.removeChild(m);
52
+ Array.from(t.childNodes).forEach((h) => {
53
+ if (h.nodeType === Node.TEXT_NODE && ee(h.textContent || "")) {
54
+ const o = h.previousSibling;
55
+ o && o.nodeType === Node.ELEMENT_NODE && o.classList.contains("template-field") || h.parentNode && h.parentNode.removeChild(h);
56
56
  }
57
57
  });
58
58
  };
59
- function Tt(t, y, m, o, x, u, i, r, c, f, p, a, b, L) {
60
- const _ = (h) => !(t.disabled || t.loading || h.trim().length === 0 || a.value), v = () => {
61
- _(m.value) && y("submit", m.value.trim());
62
- }, R = (h, $) => {
63
- if (!(h.key === "Enter")) return !1;
59
+ function Tt(t, y, h, o, x, u, i, r, c, f, p, a, b, L) {
60
+ const _ = (m) => !(t.disabled || t.loading || m.trim().length === 0 || a.value), v = () => {
61
+ _(h.value) && y("submit", h.value.trim());
62
+ }, R = (m, $) => {
63
+ if (!(m.key === "Enter")) return !1;
64
64
  switch ($) {
65
65
  case "enter":
66
- return !h.shiftKey && !h.ctrlKey && !h.metaKey;
66
+ return !m.shiftKey && !m.ctrlKey && !m.metaKey;
67
67
  case "ctrlEnter":
68
- return (h.ctrlKey || h.metaKey) && !h.shiftKey;
68
+ return (m.ctrlKey || m.metaKey) && !m.shiftKey;
69
69
  case "shiftEnter":
70
- return h.shiftKey && !h.ctrlKey && !h.metaKey;
70
+ return m.shiftKey && !m.ctrlKey && !m.metaKey;
71
71
  default:
72
72
  return !1;
73
73
  }
74
74
  };
75
75
  return {
76
- handleKeyPress: (h) => {
76
+ handleKeyPress: (m) => {
77
77
  if (o.value) return;
78
- if (h.key === "Enter" && h.shiftKey && (b == null ? void 0 : b.value) === "single" && L) {
79
- h.preventDefault(), L();
80
- const V = h.target, K = V.selectionStart, C = m.value;
81
- m.value = C.substring(0, K) + `
78
+ if (m.key === "Enter" && m.shiftKey && (b == null ? void 0 : b.value) === "single" && L) {
79
+ m.preventDefault(), L();
80
+ const V = m.target, K = V.selectionStart, C = h.value;
81
+ h.value = C.substring(0, K) + `
82
82
  ` + C.substring(K), setTimeout(() => {
83
83
  V.selectionStart = V.selectionEnd = K + 1;
84
84
  }, 0);
85
85
  return;
86
86
  }
87
- if (h.key === "Tab" && u.value && i.value) {
88
- h.preventDefault(), r();
87
+ if (m.key === "Tab" && u.value && i.value) {
88
+ m.preventDefault(), r();
89
89
  return;
90
90
  }
91
91
  if (u.value) {
92
- if (h.key === "ArrowDown") {
93
- h.preventDefault(), f("down");
92
+ if (m.key === "ArrowDown") {
93
+ m.preventDefault(), f("down");
94
94
  return;
95
95
  }
96
- if (h.key === "ArrowUp") {
97
- h.preventDefault(), f("up");
96
+ if (m.key === "ArrowUp") {
97
+ m.preventDefault(), f("up");
98
98
  return;
99
99
  }
100
- if (h.key === "Enter" && i.value) {
101
- h.preventDefault(), r();
100
+ if (m.key === "Enter" && i.value) {
101
+ m.preventDefault(), r();
102
102
  return;
103
103
  }
104
104
  }
105
- if (h.key === "Escape") {
106
- u.value ? (c(), h.preventDefault()) : x.isRecording && (p(), h.preventDefault()), y("escape-press");
105
+ if (m.key === "Escape") {
106
+ u.value ? (c(), m.preventDefault()) : x.isRecording && (p(), m.preventDefault()), y("escape-press");
107
107
  return;
108
108
  }
109
- R(h, t.submitType) && _(m.value) && (h.preventDefault(), v());
109
+ R(m, t.submitType) && _(h.value) && (m.preventDefault(), v());
110
110
  },
111
111
  triggerSubmit: v
112
112
  };
@@ -136,33 +136,33 @@ function Nt(t) {
136
136
  }
137
137
  if (v) {
138
138
  u.preventDefault();
139
- const w = document.createRange(), h = z(r);
140
- return h && (R === "before" ? w.setStartBefore(v) : R === "after" ? w.setStartAfter(v) : (w.selectNodeContents(v), w.collapse(u.key === "ArrowLeft")), h.removeAllRanges(), h.addRange(w)), !0;
139
+ const w = document.createRange(), m = z(r);
140
+ return m && (R === "before" ? w.setStartBefore(v) : R === "after" ? w.setStartAfter(v) : (w.selectNodeContents(v), w.collapse(u.key === "ArrowLeft")), m.removeAllRanges(), m.addRange(w)), !0;
141
141
  }
142
142
  }
143
143
  if (p.nodeType === Node.ELEMENT_NODE && p.classList.contains("template-field")) {
144
144
  const R = p.textContent || "", w = J(R);
145
145
  if (!w || w.trim() === "") {
146
146
  u.preventDefault();
147
- const h = document.createRange(), $ = z(r);
147
+ const m = document.createRange(), $ = z(r);
148
148
  if (!$) return !0;
149
149
  if (u.key === "ArrowLeft")
150
- h.setStartBefore(p);
150
+ m.setStartBefore(p);
151
151
  else {
152
152
  const V = p.nextSibling;
153
- V && V.nodeType === Node.TEXT_NODE && ee(V.textContent || "") ? (h.setStart(V, 0), h.setEnd(V, 0)) : h.setStartAfter(p);
153
+ V && V.nodeType === Node.TEXT_NODE && ee(V.textContent || "") ? (m.setStart(V, 0), m.setEnd(V, 0)) : m.setStartAfter(p);
154
154
  }
155
- return h.collapse(!0), $.removeAllRanges(), $.addRange(h), !0;
155
+ return m.collapse(!0), $.removeAllRanges(), $.addRange(m), !0;
156
156
  }
157
157
  }
158
158
  if (p.nodeType === Node.TEXT_NODE && ee(p.textContent || "")) {
159
159
  const v = p.previousSibling, R = p.nextSibling;
160
160
  u.preventDefault();
161
- const w = document.createRange(), h = z(r);
162
- return h && (u.key === "ArrowLeft" ? v && v.nodeType === Node.ELEMENT_NODE && v.classList.contains("template-field") ? (w.selectNodeContents(v), w.collapse(!1)) : w.setStartBefore(p) : R ? R.nodeType === Node.ELEMENT_NODE && R.classList.contains("template-field") ? (w.selectNodeContents(R), w.collapse(!0)) : pt(r) ? (w.setStart(R, 1), w.collapse(!0)) : w.setStartAfter(p) : w.setStartAfter(p), h.removeAllRanges(), h.addRange(w)), !0;
161
+ const w = document.createRange(), m = z(r);
162
+ return m && (u.key === "ArrowLeft" ? v && v.nodeType === Node.ELEMENT_NODE && v.classList.contains("template-field") ? (w.selectNodeContents(v), w.collapse(!1)) : w.setStartBefore(p) : R ? R.nodeType === Node.ELEMENT_NODE && R.classList.contains("template-field") ? (w.selectNodeContents(R), w.collapse(!0)) : pt(r) ? (w.setStart(R, 1), w.collapse(!0)) : w.setStartAfter(p) : w.setStartAfter(p), m.removeAllRanges(), m.addRange(w)), !0;
163
163
  }
164
164
  return !1;
165
- }, m = (u, i, r) => {
165
+ }, h = (u, i, r) => {
166
166
  if (!i.collapsed) return !1;
167
167
  const { startContainer: c, startOffset: f } = i;
168
168
  if (c.nodeType === Node.TEXT_NODE && ee(c.textContent || "")) {
@@ -175,8 +175,8 @@ function Nt(t) {
175
175
  b.parentNode && b.parentNode.removeChild(b), c.parentNode && c.parentNode.removeChild(c);
176
176
  const w = z(r);
177
177
  if (w) {
178
- const h = document.createRange();
179
- v ? v.nodeType === Node.ELEMENT_NODE && v.classList.contains("template-field") ? (h.selectNodeContents(v), h.collapse(!1)) : v.nodeType === Node.TEXT_NODE && ee(v.textContent || "") ? (h.setStart(v, 0), h.setEnd(v, 0)) : h.setStartAfter(v) : R ? h.setStartBefore(R) : h.setStart(r, 0), h.collapse(!0), w.removeAllRanges(), w.addRange(h);
178
+ const m = document.createRange();
179
+ v ? v.nodeType === Node.ELEMENT_NODE && v.classList.contains("template-field") ? (m.selectNodeContents(v), m.collapse(!1)) : v.nodeType === Node.TEXT_NODE && ee(v.textContent || "") ? (m.setStart(v, 0), m.setEnd(v, 0)) : m.setStartAfter(v) : R ? m.setStartBefore(R) : m.setStart(r, 0), m.collapse(!0), w.removeAllRanges(), w.addRange(m);
180
180
  }
181
181
  return t.handleInput(), !0;
182
182
  } else {
@@ -240,7 +240,7 @@ function Nt(t) {
240
240
  u.preventDefault(), t.onSubmit(t.getValueFromDOM());
241
241
  return;
242
242
  }
243
- (u.key === "ArrowLeft" || u.key === "ArrowRight") && !u.shiftKey && y(u, c, i) || u.key === "Backspace" && m(u, c, i) || u.key === "Delete" && o(u, c, i);
243
+ (u.key === "ArrowLeft" || u.key === "ArrowRight") && !u.shiftKey && y(u, c, i) || u.key === "Backspace" && h(u, c, i) || u.key === "Delete" && o(u, c, i);
244
244
  }
245
245
  };
246
246
  }
@@ -249,33 +249,33 @@ function xt(t) {
249
249
  isRecording: !1,
250
250
  isSupported: typeof window < "u" && "webkitSpeechRecognition" in window || "SpeechRecognition" in window,
251
251
  error: void 0
252
- }), m = y.isSupported ? new (window.webkitSpeechRecognition || window.SpeechRecognition)() : void 0;
253
- m !== void 0 && (m.continuous = t.continuous ?? !1, m.interimResults = t.interimResults ?? !0, m.lang = t.lang ?? navigator.language, m.onstart = () => {
252
+ }), h = y.isSupported ? new (window.webkitSpeechRecognition || window.SpeechRecognition)() : void 0;
253
+ h !== void 0 && (h.continuous = t.continuous ?? !1, h.interimResults = t.interimResults ?? !0, h.lang = t.lang ?? navigator.language, h.onstart = () => {
254
254
  var i;
255
255
  y.isRecording = !0, y.error = void 0, (i = t.onStart) == null || i.call(t);
256
- }, m.onend = () => {
256
+ }, h.onend = () => {
257
257
  var i;
258
258
  y.isRecording = !1, (i = t.onEnd) == null || i.call(t);
259
- }, m.onresult = (i) => {
259
+ }, h.onresult = (i) => {
260
260
  var c, f;
261
261
  const r = Array.from(i.results).map((p) => p[0].transcript).join("");
262
262
  i.results[0].isFinal ? (c = t.onFinal) == null || c.call(t, r) : (f = t.onInterim) == null || f.call(t, r);
263
- }, m.onerror = (i) => {
263
+ }, h.onerror = (i) => {
264
264
  var r;
265
265
  y.error = new Error(i.error), y.isRecording = !1, (r = t.onError) == null || r.call(t, y.error);
266
266
  });
267
267
  const o = () => {
268
268
  var i;
269
- if (!m) {
269
+ if (!h) {
270
270
  const r = new Error("浏览器不支持语音识别");
271
271
  y.error = r, (i = t.onError) == null || i.call(t, r);
272
272
  return;
273
273
  }
274
274
  if (y.isRecording) {
275
275
  try {
276
- m.stop(), setTimeout(() => {
276
+ h.stop(), setTimeout(() => {
277
277
  try {
278
- m.start();
278
+ h.start();
279
279
  } catch (r) {
280
280
  u(r);
281
281
  }
@@ -286,14 +286,14 @@ function xt(t) {
286
286
  return;
287
287
  }
288
288
  try {
289
- m.start();
289
+ h.start();
290
290
  } catch (r) {
291
291
  u(r);
292
292
  }
293
293
  }, x = () => {
294
- if (m && y.isRecording)
294
+ if (h && y.isRecording)
295
295
  try {
296
- m.stop();
296
+ h.stop();
297
297
  } catch (i) {
298
298
  u(i);
299
299
  }
@@ -310,10 +310,10 @@ function xt(t) {
310
310
  const kt = (t, y) => {
311
311
  if (!y || !t)
312
312
  return [{ text: t, isMatch: !1 }];
313
- const m = t.toLowerCase(), o = y.toLowerCase(), x = [];
313
+ const h = t.toLowerCase(), o = y.toLowerCase(), x = [];
314
314
  let u = 0;
315
- for (; u < m.length; ) {
316
- const f = m.indexOf(o, u);
315
+ for (; u < h.length; ) {
316
+ const f = h.indexOf(o, u);
317
317
  if (f === -1) break;
318
318
  x.push({
319
319
  start: f,
@@ -345,10 +345,10 @@ const kt = (t, y) => {
345
345
  isMatch: !1
346
346
  }), r;
347
347
  };
348
- function Rt(t, y, m, o) {
348
+ function Rt(t, y, h, o) {
349
349
  const x = O(!1), u = O(-1), i = O(-1), r = O(""), c = O(!1), f = O(null), p = O(!1), a = O(null), b = P(() => {
350
- if (!t.suggestions || !m.value || t.template) return [];
351
- const e = m.value.toLowerCase();
350
+ if (!t.suggestions || !h.value || t.template) return [];
351
+ const e = h.value.toLowerCase();
352
352
  return t.suggestions.filter((l) => l.toLowerCase().includes(e));
353
353
  }), L = P(() => {
354
354
  let e = -1;
@@ -359,19 +359,19 @@ function Rt(t, y, m, o) {
359
359
  return;
360
360
  }
361
361
  const l = e || L.value;
362
- l && m.value && l.toLowerCase().startsWith(m.value.toLowerCase()) ? (r.value = l.substring(m.value.length), c.value = !0) : (r.value = "", c.value = !1);
362
+ l && h.value && l.toLowerCase().startsWith(h.value.toLowerCase()) ? (r.value = l.substring(h.value.length), c.value = !0) : (r.value = "", c.value = !1);
363
363
  }, R = () => {
364
364
  x.value = !1, u.value = -1, i.value = -1, a.value = null, r.value = "", c.value = !1;
365
365
  }, w = () => {
366
366
  x.value = !0, u.value = -1, i.value = -1, a.value = null, v();
367
- }, h = () => {
367
+ }, m = () => {
368
368
  o.value || p.value || W(() => {
369
- m.value && t.suggestions && t.suggestions.length > 0 && !t.template && b.value.length > 0 ? w() : R();
369
+ h.value && t.suggestions && t.suggestions.length > 0 && !t.template && b.value.length > 0 ? w() : R();
370
370
  });
371
371
  };
372
- te(m, h), te(() => t.suggestions, h);
372
+ te(h, m), te(() => t.suggestions, m);
373
373
  const $ = (e) => {
374
- p.value = !0, m.value = e, y("update:modelValue", e), y("suggestion-select", e), K(), W(() => {
374
+ p.value = !0, h.value = e, y("update:modelValue", e), y("suggestion-select", e), K(), W(() => {
375
375
  p.value = !1;
376
376
  });
377
377
  }, V = () => {
@@ -388,7 +388,7 @@ function Rt(t, y, m, o) {
388
388
  activeSuggestion: L,
389
389
  isItemHighlighted: _,
390
390
  updateCompletionPlaceholder: v,
391
- updateSuggestionsState: h,
391
+ updateSuggestionsState: m,
392
392
  selectSuggestion: $,
393
393
  acceptCurrentSuggestion: V,
394
394
  closeSuggestionsPopup: K,
@@ -445,7 +445,7 @@ const Dt = { class: "action-buttons" }, Ft = {
445
445
  },
446
446
  emits: ["clear", "toggle-speech", "submit", "cancel"],
447
447
  setup(t, { emit: y }) {
448
- const m = mt(), o = t, x = y, u = P(() => o.allowSpeech), i = P(() => o.speechStatus.isRecording), r = P(() => o.disabled), c = P(() => r.value || o.isOverLimit), f = P(() => o.allowFiles || o.allowSpeech || o.showClear), p = () => {
448
+ const h = ht(), o = t, x = y, u = P(() => o.allowSpeech), i = P(() => o.speechStatus.isRecording), r = P(() => o.disabled), c = P(() => r.value || o.isOverLimit), f = P(() => o.allowFiles || o.allowSpeech || o.showClear), p = () => {
449
449
  r.value || x("clear");
450
450
  }, a = () => {
451
451
  if (!r.value) {
@@ -514,7 +514,7 @@ const Dt = { class: "action-buttons" }, Ft = {
514
514
  onClick: p
515
515
  }, {
516
516
  default: Y(() => [
517
- (D(), Q(it(E(m)), { class: "action-buttons__icon action-buttons__icon--close" }))
517
+ (D(), Q(it(E(h)), { class: "action-buttons__icon action-buttons__icon--close" }))
518
518
  ]),
519
519
  _: 1
520
520
  }, 8, ["disabled"])
@@ -550,7 +550,7 @@ const Dt = { class: "action-buttons" }, Ft = {
550
550
  }
551
551
  });
552
552
  function It(t, y) {
553
- const m = O(!1), o = $e({ ...y }), x = (e) => {
553
+ const h = O(!1), o = $e({ ...y }), x = (e) => {
554
554
  Object.assign(o, e);
555
555
  }, u = (e) => {
556
556
  const l = [];
@@ -608,11 +608,11 @@ function It(t, y) {
608
608
  document.body.removeChild(s);
609
609
  const M = n ? 1.5 : 2, j = T / I, B = Math.max(M, Math.ceil(j));
610
610
  e.style.setProperty("min-width", `${B}em`, "important");
611
- const X = 20;
612
- B > X ? (e.style.setProperty("max-width", `${X}em`, "important"), e.style.setProperty("white-space", "normal", "important"), e.style.setProperty("word-break", "break-word", "important")) : e.style.removeProperty("max-width");
611
+ const q = 20;
612
+ B > q ? (e.style.setProperty("max-width", `${q}em`, "important"), e.style.setProperty("white-space", "normal", "important"), e.style.setProperty("word-break", "break-word", "important")) : e.style.removeProperty("max-width");
613
613
  }, a = (e) => {
614
614
  const n = (e === void 0 ? i() : e).trim().length > 0;
615
- m.value !== n && (m.value = n, o.onContentStatusChange(n));
615
+ h.value !== n && (h.value = n, o.onContentStatusChange(n));
616
616
  }, b = (e, l = "inside", n = !1) => {
617
617
  W(() => {
618
618
  const s = z(t.value);
@@ -681,10 +681,10 @@ function It(t, y) {
681
681
  }), s += I.content.length, g++) : T = !1;
682
682
  else {
683
683
  let M = "";
684
- const j = e.find((B, X) => X > g && B.type === "text");
684
+ const j = e.find((B, q) => q > g && B.type === "text");
685
685
  if (j) {
686
- const B = l.substring(s), X = B.indexOf(j.content);
687
- X !== -1 ? (M = B.substring(0, X), s += M.length) : T = !1;
686
+ const B = l.substring(s), q = B.indexOf(j.content);
687
+ q !== -1 ? (M = B.substring(0, q), s += M.length) : T = !1;
688
688
  } else
689
689
  M = l.substring(s), s = l.length;
690
690
  if (T) {
@@ -720,10 +720,10 @@ function It(t, y) {
720
720
  });
721
721
  }, w = () => {
722
722
  if (o.isComposing) return;
723
- $(), C(), h(), S();
723
+ $(), C(), m(), S();
724
724
  const e = i();
725
725
  e !== o.value && (o.onValueChange(e), o.onInput(e)), a(e), e === "" && t.value && Array.from(t.value.childNodes).every((n) => n.nodeType === Node.ELEMENT_NODE && n.classList.contains("template-field") ? Et(n) : !!(n.nodeType === Node.TEXT_NODE && ee(n.textContent || ""))) && $();
726
- }, h = () => {
726
+ }, m = () => {
727
727
  if (!t.value) return;
728
728
  _t(t.value), t.value.querySelectorAll(".template-field").forEach((l) => {
729
729
  Be(l);
@@ -789,7 +789,7 @@ function It(t, y) {
789
789
  };
790
790
  return {
791
791
  // 状态
792
- hasContent: m,
792
+ hasContent: h,
793
793
  // 解析和DOM操作
794
794
  parseTemplateToParts: u,
795
795
  getValueFromDOM: i,
@@ -845,8 +845,8 @@ const At = /* @__PURE__ */ be({
845
845
  valueModifiers: {}
846
846
  }),
847
847
  emits: /* @__PURE__ */ Fe(["input", "content-status", "submit", "focus", "blur", "empty-content"], ["update:value"]),
848
- setup(t, { expose: y, emit: m }) {
849
- const o = rt(t, "value"), x = t, u = m, i = O(null), r = O(""), c = O({}), f = O(!1), p = O(!1), a = It(i, {
848
+ setup(t, { expose: y, emit: h }) {
849
+ const o = rt(t, "value"), x = t, u = h, i = O(null), r = O(""), c = O({}), f = O(!1), p = O(!1), a = It(i, {
850
850
  template: r.value,
851
851
  value: o.value,
852
852
  initialValues: c.value,
@@ -873,8 +873,8 @@ const At = /* @__PURE__ */ be({
873
873
  onSubmit: (C) => u("submit", C)
874
874
  }), L = (C, S) => {
875
875
  let N = C;
876
- return Object.entries(S).forEach(([q, e]) => {
877
- const l = `[${q}]`;
876
+ return Object.entries(S).forEach(([X, e]) => {
877
+ const l = `[${X}]`;
878
878
  N = N.replace(new RegExp(l.replace(/[[\]]/g, "\\$&"), "g"), e);
879
879
  }), N;
880
880
  }, _ = (C) => {
@@ -893,21 +893,21 @@ const At = /* @__PURE__ */ be({
893
893
  }, R = () => {
894
894
  p.value = !1, a.handleInput();
895
895
  }, w = (C) => {
896
- var q;
896
+ var X;
897
897
  if (!i.value) return;
898
898
  const S = C.target;
899
899
  let N = null;
900
- if (S.classList.contains("template-field") ? N = S : (q = S.parentElement) != null && q.classList.contains("template-field") && (N = S.parentElement), N && (!N.textContent || N.textContent.trim() === "")) {
900
+ if (S.classList.contains("template-field") ? N = S : (X = S.parentElement) != null && X.classList.contains("template-field") && (N = S.parentElement), N && (!N.textContent || N.textContent.trim() === "")) {
901
901
  const e = z(i.value), l = document.createRange();
902
902
  e && (l.selectNodeContents(N), l.collapse(!0), e.removeAllRanges(), e.addRange(l), N.focus(), C.preventDefault(), C.stopPropagation());
903
903
  }
904
- }, h = (C) => {
904
+ }, m = (C) => {
905
905
  if (typeof ShadowRoot.prototype.getSelection != "function")
906
906
  return;
907
907
  C.preventDefault();
908
908
  const S = C.clipboardData;
909
909
  if (!S) return;
910
- const N = S.getData("text/html"), q = S.getData("text/plain");
910
+ const N = S.getData("text/html"), X = S.getData("text/plain");
911
911
  if (N) {
912
912
  const e = document.createElement("div");
913
913
  e.innerHTML = N;
@@ -920,8 +920,8 @@ const At = /* @__PURE__ */ be({
920
920
  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";
921
921
  if (I || M || j || B) {
922
922
  if (n = !0, g.className = "template-field", !g.getAttribute("data-placeholder")) {
923
- const X = a.extractPlaceholderFromElement(g);
924
- X && g.setAttribute("data-placeholder", X);
923
+ const q = a.extractPlaceholderFromElement(g);
924
+ q && g.setAttribute("data-placeholder", q);
925
925
  }
926
926
  g.removeAttribute("style");
927
927
  }
@@ -930,16 +930,16 @@ const At = /* @__PURE__ */ be({
930
930
  return;
931
931
  }
932
932
  }
933
- q && V(q);
933
+ X && V(X);
934
934
  }, $ = (C) => {
935
935
  const S = z(i.value);
936
936
  if (S && S.rangeCount > 0) {
937
937
  const N = S.getRangeAt(0);
938
938
  N.deleteContents();
939
- const q = document.createDocumentFragment();
939
+ const X = document.createDocumentFragment();
940
940
  for (; C.firstChild; )
941
- q.appendChild(C.firstChild);
942
- N.insertNode(q), N.collapse(!1), S.removeAllRanges(), S.addRange(N), K();
941
+ X.appendChild(C.firstChild);
942
+ N.insertNode(X), N.collapse(!1), S.removeAllRanges(), S.addRange(N), K();
943
943
  }
944
944
  }, V = (C) => {
945
945
  const S = z(i.value);
@@ -1018,7 +1018,7 @@ const At = /* @__PURE__ */ be({
1018
1018
  onCompositionend: R,
1019
1019
  onFocus: S[2] || (S[2] = (N) => C.$emit("focus", N)),
1020
1020
  onBlur: S[3] || (S[3] = (N) => C.$emit("blur", N)),
1021
- onPaste: h
1021
+ onPaste: m
1022
1022
  }, null, 544));
1023
1023
  }
1024
1024
  }), Mt = ["data-theme"], Vt = { class: "tiny-sender__container" }, Bt = {
@@ -1036,7 +1036,7 @@ const At = /* @__PURE__ */ be({
1036
1036
  }, Kt = {
1037
1037
  key: 0,
1038
1038
  class: "tiny-sender__completion-placeholder"
1039
- }, qt = { class: "user-input-mirror" }, Xt = {
1039
+ }, Xt = { class: "user-input-mirror" }, qt = {
1040
1040
  key: 0,
1041
1041
  class: "tiny-sender__tab-hint"
1042
1042
  }, zt = {
@@ -1077,20 +1077,20 @@ const At = /* @__PURE__ */ be({
1077
1077
  templateInitialValues: { default: () => ({}) }
1078
1078
  },
1079
1079
  emits: ["update:modelValue", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template"],
1080
- setup(t, { expose: y, emit: m }) {
1081
- const o = t, x = m, u = O(null), i = O(null), r = O(null), c = O(null), f = O(null), p = O(!1), { inputValue: a, isComposing: b, clearInput: L } = wt(o, x), {
1080
+ setup(t, { expose: y, emit: h }) {
1081
+ const o = t, x = h, u = O(null), i = O(null), r = O(null), c = O(null), f = O(null), p = O(!1), { inputValue: a, isComposing: b, clearInput: L } = wt(o, x), {
1082
1082
  showSuggestionsPopup: _,
1083
1083
  completionPlaceholder: v,
1084
1084
  showTabHint: R,
1085
1085
  suggestionsListRef: w,
1086
- filteredSuggestions: h,
1086
+ filteredSuggestions: m,
1087
1087
  activeSuggestion: $,
1088
1088
  isItemHighlighted: V,
1089
1089
  updateSuggestionsState: K,
1090
1090
  selectSuggestion: C,
1091
1091
  acceptCurrentSuggestion: S,
1092
1092
  closeSuggestionsPopup: N,
1093
- navigateSuggestions: q,
1093
+ navigateSuggestions: X,
1094
1094
  handleSuggestionItemHover: e,
1095
1095
  handleSuggestionItemLeave: l,
1096
1096
  highlightSuggestionText: n
@@ -1153,7 +1153,7 @@ const At = /* @__PURE__ */ be({
1153
1153
  j();
1154
1154
  }, 50);
1155
1155
  });
1156
- }, X = () => {
1156
+ }, q = () => {
1157
1157
  var d;
1158
1158
  L(), p.value ? B() : (d = i.value) == null || d.focus(), W(() => {
1159
1159
  a.value === "" && (s.value = o.mode || "single");
@@ -1166,7 +1166,7 @@ const At = /* @__PURE__ */ be({
1166
1166
  p.value = !0, W(() => {
1167
1167
  r.value && r.value.setTemplate({ template: d, initialValues: k });
1168
1168
  });
1169
- }, qe = P(() => {
1169
+ }, Xe = P(() => {
1170
1170
  const d = typeof o.speech == "object" ? o.speech : {};
1171
1171
  return {
1172
1172
  ...d,
@@ -1186,9 +1186,9 @@ const At = /* @__PURE__ */ be({
1186
1186
  et(k.message), x("speech-error", k);
1187
1187
  }
1188
1188
  };
1189
- }), { speechState: ie, start: Se, stop: we } = xt(qe.value), he = () => {
1189
+ }), { speechState: ie, start: Se, stop: we } = xt(Xe.value), me = () => {
1190
1190
  ie.isRecording ? we() : Se();
1191
- }, re = P(() => o.maxLength !== 1 / 0 && a.value.length > o.maxLength), { handleKeyPress: Xe, triggerSubmit: me } = Tt(
1191
+ }, re = P(() => o.maxLength !== 1 / 0 && a.value.length > o.maxLength), { handleKeyPress: qe, triggerSubmit: he } = Tt(
1192
1192
  o,
1193
1193
  x,
1194
1194
  a,
@@ -1198,13 +1198,13 @@ const At = /* @__PURE__ */ be({
1198
1198
  $,
1199
1199
  S,
1200
1200
  N,
1201
- q,
1202
- he,
1201
+ X,
1202
+ me,
1203
1203
  re,
1204
1204
  s,
1205
1205
  T
1206
1206
  ), ze = (d) => {
1207
- x("focus", d), a.value && h.value.length > 0 && !o.template && (_.value = !0, R.value = !0);
1207
+ x("focus", d), a.value && m.value.length > 0 && !o.template && (_.value = !0, R.value = !0);
1208
1208
  }, je = (d) => {
1209
1209
  x("blur", d), N();
1210
1210
  }, Ue = P(() => s.value === "multiple" ? "textarea" : "text"), Ze = P(
@@ -1219,7 +1219,7 @@ const At = /* @__PURE__ */ be({
1219
1219
  "has-error": !!oe.value,
1220
1220
  "is-auto-switching": g.value
1221
1221
  })), Ye = P(() => ({
1222
- width: ht(o.suggestionPopupWidth),
1222
+ width: mt(o.suggestionPopupWidth),
1223
1223
  maxWidth: "100%"
1224
1224
  // 确保不超出父容器宽度
1225
1225
  })), oe = O(""), et = (d) => {
@@ -1246,8 +1246,8 @@ const At = /* @__PURE__ */ be({
1246
1246
  d == null || d.blur();
1247
1247
  }
1248
1248
  },
1249
- clear: X,
1250
- submit: me,
1249
+ clear: q,
1250
+ submit: he,
1251
1251
  startSpeech: Se,
1252
1252
  stopSpeech: we,
1253
1253
  activateTemplateFirstField: Ce,
@@ -1303,16 +1303,16 @@ const At = /* @__PURE__ */ be({
1303
1303
  disabled: ue.value,
1304
1304
  placeholder: d.placeholder,
1305
1305
  autofocus: d.autofocus,
1306
- onKeydown: E(Xe),
1306
+ onKeydown: E(qe),
1307
1307
  onCompositionstart: k[2] || (k[2] = (F) => b.value = !0),
1308
1308
  onCompositionend: tt,
1309
1309
  onFocus: ze,
1310
1310
  onBlur: je
1311
1311
  }, null, 8, ["autosize", "type", "readonly", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
1312
1312
  E(v) && !E(b) ? (D(), A("div", Kt, [
1313
- U("span", qt, le(E(a)), 1),
1313
+ U("span", Xt, le(E(a)), 1),
1314
1314
  Oe(le(E(v)) + " ", 1),
1315
- E(R) ? (D(), A("div", Xt, "TAB")) : H("", !0)
1315
+ E(R) ? (D(), A("div", qt, "TAB")) : H("", !0)
1316
1316
  ])) : H("", !0)
1317
1317
  ]))
1318
1318
  ]),
@@ -1333,9 +1333,9 @@ const At = /* @__PURE__ */ be({
1333
1333
  "speech-status": E(ie),
1334
1334
  "submit-type": d.submitType,
1335
1335
  "is-over-limit": re.value,
1336
- onClear: X,
1337
- onToggleSpeech: he,
1338
- onSubmit: E(me),
1336
+ onClear: q,
1337
+ onToggleSpeech: me,
1338
+ onSubmit: E(he),
1339
1339
  onCancel: k[3] || (k[3] = (F) => d.$emit("cancel"))
1340
1340
  }, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "submit-type", "is-over-limit", "onSubmit"])
1341
1341
  ], 512)
@@ -1372,9 +1372,9 @@ const At = /* @__PURE__ */ be({
1372
1372
  "speech-status": E(ie),
1373
1373
  "submit-type": d.submitType,
1374
1374
  "is-over-limit": re.value,
1375
- onClear: X,
1376
- onToggleSpeech: he,
1377
- onSubmit: E(me),
1375
+ onClear: q,
1376
+ onToggleSpeech: me,
1377
+ onSubmit: E(he),
1378
1378
  onCancel: k[4] || (k[4] = (F) => d.$emit("cancel"))
1379
1379
  }, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "submit-type", "is-over-limit", "onSubmit"])
1380
1380
  ])
@@ -1390,14 +1390,14 @@ const At = /* @__PURE__ */ be({
1390
1390
  ]),
1391
1391
  G(ve, { name: "tiny-sender-slide-up" }, {
1392
1392
  default: Y(() => [
1393
- E(_) && E(h).length ? (D(), A("div", {
1393
+ E(_) && E(m).length ? (D(), A("div", {
1394
1394
  key: 0,
1395
1395
  ref_key: "suggestionsListRef",
1396
1396
  ref: w,
1397
1397
  class: "tiny-sender__suggestions",
1398
1398
  style: Ie(Ye.value)
1399
1399
  }, [
1400
- (D(!0), A(Ae, null, Me(E(h), (F, ne) => (D(), A("div", {
1400
+ (D(!0), A(Ae, null, Me(E(m), (F, ne) => (D(), A("div", {
1401
1401
  key: ne,
1402
1402
  class: ae(["suggestion-item", { highlighted: E(V)(ne) }]),
1403
1403
  onMouseenter: (Z) => E(e)(ne),