@opentiny/tiny-robot 0.5.2-alpha.15 → 0.5.2-alpha.17

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.
package/dist/index6.js CHANGED
@@ -1,193 +1,206 @@
1
- import { ref as M, watch as U, toValue as k, onMounted as xe, onUnmounted as We, nextTick as te, defineComponent as I, openBlock as v, createElementBlock as E, renderSlot as C, computed as x, unref as R, normalizeClass as G, createVNode as V, onBeforeUnmount as Ve, Fragment as D, createElementVNode as B, mergeProps as w, toDisplayString as z, withDirectives as Q, vShow as ee, createBlock as A, resolveDynamicComponent as J, normalizeProps as P, guardReactiveProps as H, createCommentVNode as ae, watchEffect as ne, useCssModule as ze, renderList as W, markRaw as F, inject as T, provide as L, reactive as Xe, readonly as qe, withCtx as $ } from "vue";
2
- import { _ as O } from "./_plugin-vue_export-helper.js";
3
- import { IconLoading as Be, IconAtom as Ze, IconArrowDown as Re, IconPlugin as me, IconError as Qe, IconCancelled as et } from "@opentiny/tiny-robot-svgs";
4
- import { l as tt, w as nt, g as ot, u as st } from "./index4.js";
5
- function _e(t, e) {
6
- const n = U(t, (o, l) => {
7
- l === !0 && o === !1 && (e(), n());
1
+ import { ref as $, watch as U, toValue as S, onMounted as ke, onUnmounted as Ze, nextTick as re, defineComponent as M, openBlock as y, createElementBlock as I, renderSlot as A, computed as R, unref as k, normalizeClass as z, createVNode as ee, onBeforeUnmount as Qe, Fragment as G, createElementVNode as B, mergeProps as P, toDisplayString as W, withDirectives as oe, vShow as se, createBlock as N, resolveDynamicComponent as X, normalizeProps as j, guardReactiveProps as Y, createCommentVNode as le, watchEffect as ae, useCssModule as et, renderList as Q, markRaw as K, inject as L, provide as O, reactive as tt, readonly as nt, withCtx as F } from "vue";
2
+ import { _ as H } from "./_plugin-vue_export-helper.js";
3
+ import { IconLoading as Ie, IconAtom as ot, IconArrowDown as Se, IconPlugin as ve, IconError as st, IconCancelled as rt, IconWarning as lt, IconClose as at } from "@opentiny/tiny-robot-svgs";
4
+ import { l as ct, j as he, w as ut, g as it, u as ye } from "./index4.js";
5
+ function xe(e, t) {
6
+ const n = U(e, (o, r) => {
7
+ r === !0 && o === !1 && (t(), n());
8
8
  });
9
9
  return n;
10
10
  }
11
- function rt(t, e, n) {
12
- const { scrollOnMount: o = !0, bottomThreshold: l = 20, scrollThrottle: i = 0 } = n ?? {}, r = M(!0);
13
- let a = !1;
14
- const u = /* @__PURE__ */ new Set(), p = () => st(t), { y: _, isScrolling: h, arrivedState: y } = tt(p, { throttle: i }), m = (s) => s.scrollHeight - s.scrollTop - s.clientHeight <= l, c = async (s = "auto") => {
15
- const d = k(p);
16
- if (d && (await te(), d.scrollTo({ top: d.scrollHeight, behavior: s }), s === "smooth" && !m(d))) {
17
- const g = _e(h, () => {
18
- d.scrollTo({ top: d.scrollHeight, behavior: "auto" }), u.delete(g);
11
+ function dt(e) {
12
+ if (typeof e != "object" || e === null) return !1;
13
+ const t = Object.getPrototypeOf(e);
14
+ return (t === Object.prototype || t === null) && "scrollRef" in e && "contentRef" in e;
15
+ }
16
+ function bt(e, t, n) {
17
+ let o, r, a, s;
18
+ arguments.length === 1 && dt(e) ? (o = e.scrollRef, r = e.contentRef, a = void 0, s = e) : (o = e, r = n == null ? void 0 : n.contentTarget, a = t, s = n);
19
+ const { scrollOnMount: l = !0, bottomThreshold: u = 20, scrollThrottle: b = 0, enabled: m = !0 } = s ?? {}, x = $(!0);
20
+ let v = null;
21
+ const d = /* @__PURE__ */ new Set(), f = () => ye(o), E = () => r ? ye(r) : null, i = () => S(m), { y: _, isScrolling: c, arrivedState: g } = ct(f, { throttle: b }), h = (C) => C.scrollHeight - C.scrollTop - C.clientHeight <= u, p = async (C = "auto") => {
22
+ x.value = !0;
23
+ const w = S(f);
24
+ if (w && (await re(), w.scrollTo({ top: w.scrollHeight, behavior: C }), C === "smooth" && !h(w))) {
25
+ const q = xe(c, () => {
26
+ w.scrollTo({ top: w.scrollHeight, behavior: "auto" }), d.delete(q);
19
27
  });
20
- u.add(g);
28
+ d.add(q);
21
29
  }
22
- }, f = () => {
23
- a || !r.value || (a = !0, requestAnimationFrame(async () => {
24
- a = !1, await c("auto");
30
+ }, T = () => {
31
+ v !== null || !i() || !x.value || (v = requestAnimationFrame(async () => {
32
+ v = null, !(!i() || !x.value) && await p("auto");
25
33
  }));
34
+ }, D = () => {
35
+ let C = !1;
36
+ return () => {
37
+ !C && (C = !0, !l) || T();
38
+ };
26
39
  };
27
40
  return U(
28
41
  _,
29
- () => {
30
- const s = k(p);
31
- s && (r.value = m(s));
42
+ (C, w) => {
43
+ const q = S(f);
44
+ q && (h(q) ? x.value = !0 : C < w && (x.value = !1));
32
45
  },
33
46
  { flush: "post" }
34
- ), nt(
35
- e,
36
- () => {
37
- f();
47
+ ), he(E, D()), he(f, D()), a !== void 0 && ut(a, T, { flush: "post", throttle: 100 }), U(
48
+ i,
49
+ (C) => {
50
+ C && x.value && T();
38
51
  },
39
- { flush: "post", throttle: 100 }
40
- ), xe(() => {
41
- o && c("smooth");
42
- }), We(() => {
43
- u.forEach((s) => {
44
- s();
45
- }), u.clear();
46
- }), ot("keydown", (s) => {
47
- if (s.key === "End" && !r.value) {
48
- const d = _e(h, () => {
49
- c("auto"), u.delete(d);
52
+ { flush: "post" }
53
+ ), ke(() => {
54
+ l && i() && p("smooth");
55
+ }), Ze(() => {
56
+ v !== null && (cancelAnimationFrame(v), v = null), d.forEach((C) => {
57
+ C();
58
+ }), d.clear();
59
+ }), it("keydown", (C) => {
60
+ if (C.key === "End" && !x.value) {
61
+ const w = xe(c, () => {
62
+ p("auto"), d.delete(w);
50
63
  });
51
- u.add(d);
64
+ d.add(w);
52
65
  }
53
66
  }), {
54
- scrollToBottom: c,
55
- arrivedState: y
67
+ scrollToBottom: p,
68
+ arrivedState: g
56
69
  };
57
70
  }
58
- const Ee = Symbol("bubble-message-group"), Ce = Symbol("bubble-box-renderer-matches"), ke = Symbol("bubble-box-fallback-renderer"), Ie = Symbol("bubble-box-attributes"), Se = Symbol(
71
+ const Ae = Symbol("bubble-message-group"), Me = Symbol("bubble-box-renderer-matches"), Te = Symbol("bubble-box-fallback-renderer"), we = Symbol("bubble-box-attributes"), Le = Symbol(
59
72
  "bubble-box-prop-fallback-renderer"
60
- ), Te = Symbol("bubble-content-renderer-matches"), Ae = Symbol(
73
+ ), $e = Symbol("bubble-content-renderer-matches"), Ne = Symbol(
61
74
  "bubble-content-fallback-renderer"
62
- ), Me = Symbol("bubble-content-attributes"), Le = Symbol(
75
+ ), Oe = Symbol("bubble-content-attributes"), Fe = Symbol(
63
76
  "bubble-content-prop-fallback-renderer"
64
- ), re = Symbol("bubble-store"), $e = Symbol("bubble-event-fn"), we = Symbol("bubble-list-context"), K = {
77
+ ), ie = Symbol("bubble-store"), Pe = Symbol("bubble-event-fn"), De = Symbol("bubble-list-context"), J = {
65
78
  LOADING: -1,
66
79
  NORMAL: 0,
67
80
  CONTENT: 10,
68
81
  ROLE: 20
69
- }, at = {
82
+ }, ft = {
70
83
  class: "tr-bubble__box",
71
84
  "data-box-type": "box"
72
- }, lt = /* @__PURE__ */ I({
85
+ }, pt = /* @__PURE__ */ M({
73
86
  __name: "Box",
74
87
  props: {
75
88
  placement: {},
76
89
  shape: {}
77
90
  },
78
- setup(t) {
79
- return (e, n) => (v(), E("div", at, [
80
- C(e.$slots, "default", {}, void 0, !0)
91
+ setup(e) {
92
+ return (t, n) => (y(), I("div", ft, [
93
+ A(t.$slots, "default", {}, void 0, !0)
81
94
  ]));
82
95
  }
83
- }), le = /* @__PURE__ */ O(lt, [["__scopeId", "data-v-98101726"]]), ct = ["src", "alt"], ut = /* @__PURE__ */ I({
96
+ }), de = /* @__PURE__ */ H(pt, [["__scopeId", "data-v-98101726"]]), mt = ["src", "alt"], _t = /* @__PURE__ */ M({
84
97
  __name: "Image",
85
98
  props: {
86
99
  message: {},
87
100
  contentIndex: {}
88
101
  },
89
- setup(t) {
90
- const e = t, n = M(!1), o = M(!1), { content: l } = fe(e), i = x(() => l.value ? typeof l.value.image_url == "string" ? l.value.image_url : l.value.image_url.url : null);
91
- U(i, () => {
102
+ setup(e) {
103
+ const t = e, n = $(!1), o = $(!1), { content: r } = ge(t), a = R(() => r.value ? typeof r.value.image_url == "string" ? r.value.image_url : r.value.image_url.url : null);
104
+ U(a, () => {
92
105
  n.value = !1, o.value = !1;
93
106
  });
94
- const r = () => {
107
+ const s = () => {
95
108
  n.value = !0, o.value = !1;
96
- }, a = () => {
109
+ }, l = () => {
97
110
  o.value = !0, n.value = !0;
98
111
  };
99
- return (u, p) => {
100
- var _;
101
- return v(), E("img", {
102
- class: G(["tr-bubble__image", { loading: !n.value }]),
103
- src: i.value,
104
- alt: (_ = R(l)) == null ? void 0 : _.text,
112
+ return (u, b) => {
113
+ var m;
114
+ return y(), I("img", {
115
+ class: z(["tr-bubble__image", { loading: !n.value }]),
116
+ src: a.value,
117
+ alt: (m = k(r)) == null ? void 0 : m.text,
105
118
  loading: "lazy",
106
- onLoad: r,
107
- onError: a,
119
+ onLoad: s,
120
+ onError: l,
108
121
  "data-type": "image"
109
- }, null, 42, ct);
122
+ }, null, 42, mt);
110
123
  };
111
124
  }
112
- }), Oe = /* @__PURE__ */ O(ut, [["__scopeId", "data-v-e59794cb"]]), it = {
125
+ }), Ue = /* @__PURE__ */ H(_t, [["__scopeId", "data-v-e59794cb"]]), gt = {
113
126
  class: "tr-bubble__loading",
114
127
  "data-type": "loading"
115
- }, dt = /* @__PURE__ */ I({
128
+ }, vt = /* @__PURE__ */ M({
116
129
  __name: "Loading",
117
130
  props: {
118
131
  message: {},
119
132
  contentIndex: {}
120
133
  },
121
- setup(t) {
122
- return (e, n) => (v(), E("div", it, [
123
- V(R(Be))
134
+ setup(e) {
135
+ return (t, n) => (y(), I("div", gt, [
136
+ ee(k(Ie))
124
137
  ]));
125
138
  }
126
- }), Ne = /* @__PURE__ */ O(dt, [["__scopeId", "data-v-bc1b5ff4"]]), bt = { class: "title" }, ft = { class: "detail" }, pt = /* @__PURE__ */ I({
139
+ }), He = /* @__PURE__ */ H(vt, [["__scopeId", "data-v-bc1b5ff4"]]), ht = { class: "title" }, yt = { class: "detail" }, xt = /* @__PURE__ */ M({
127
140
  inheritAttrs: !1,
128
141
  __name: "Reasoning",
129
142
  props: {
130
143
  message: {},
131
144
  contentIndex: {}
132
145
  },
133
- setup(t) {
134
- const e = t, { restMessage: n, restProps: o } = je(e, ["reasoning_content"]), l = ue(n, e.contentIndex), i = M(!0), r = M(e.message.reasoning_content ?? ""), a = M(null);
146
+ setup(e) {
147
+ const t = e, { restMessage: n, restProps: o } = qe(t, ["reasoning_content"]), r = fe(n, t.contentIndex), a = $(!0), s = $(t.message.reasoning_content ?? ""), l = $(null);
135
148
  let u = null;
136
- const p = () => {
137
- !i.value || !a.value || (a.value.scrollTop = a.value.scrollHeight);
138
- }, _ = () => {
149
+ const b = () => {
150
+ !a.value || !l.value || (l.value.scrollTop = l.value.scrollHeight);
151
+ }, m = () => {
139
152
  if (typeof window > "u" || typeof window.requestAnimationFrame != "function") {
140
- r.value = e.message.reasoning_content ?? "";
153
+ s.value = t.message.reasoning_content ?? "";
141
154
  return;
142
155
  }
143
156
  u === null && (u = window.requestAnimationFrame(() => {
144
- u = null, r.value = e.message.reasoning_content ?? "", te(p);
157
+ u = null, s.value = t.message.reasoning_content ?? "", re(b);
145
158
  }));
146
159
  };
147
160
  U(
148
161
  () => {
149
- var m;
150
- return (m = e.message.state) == null ? void 0 : m.open;
162
+ var d;
163
+ return (d = t.message.state) == null ? void 0 : d.open;
151
164
  },
152
- (m) => {
153
- i.value = m ?? !0, i.value && _();
165
+ (d) => {
166
+ a.value = d ?? !0, a.value && m();
154
167
  },
155
168
  { immediate: !0 }
156
- ), U(() => e.message.reasoning_content, _, { immediate: !0 });
157
- const h = ie(), y = () => {
158
- i.value = !i.value, i.value && _(), h({
169
+ ), U(() => t.message.reasoning_content, m, { immediate: !0 });
170
+ const x = pe(), v = () => {
171
+ a.value = !a.value, a.value && m(), x({
159
172
  name: "state:update",
160
173
  payload: {
161
174
  key: "open",
162
- value: i.value
175
+ value: a.value
163
176
  }
164
177
  });
165
178
  };
166
- return Ve(() => {
179
+ return Qe(() => {
167
180
  u !== null && typeof window < "u" && (window.cancelAnimationFrame(u), u = null);
168
- }), (m, c) => {
169
- var f, s;
170
- return v(), E(D, null, [
171
- B("div", w({
181
+ }), (d, f) => {
182
+ var E, i;
183
+ return y(), I(G, null, [
184
+ B("div", P({
172
185
  class: "tr-bubble__reasoning",
173
186
  "data-type": "reasoning"
174
- }, m.$attrs), [
187
+ }, d.$attrs), [
175
188
  B("div", {
176
189
  class: "header",
177
- onClick: y
190
+ onClick: v
178
191
  }, [
179
192
  B("div", {
180
- class: G(["icon-and-text", { thinking: (f = e.message.state) == null ? void 0 : f.thinking }])
193
+ class: z(["icon-and-text", { thinking: (E = t.message.state) == null ? void 0 : E.thinking }])
181
194
  }, [
182
- V(R(Ze)),
183
- B("span", bt, z((s = e.message.state) != null && s.thinking ? "正在思考" : "已思考"), 1)
195
+ ee(k(ot)),
196
+ B("span", ht, W((i = t.message.state) != null && i.thinking ? "正在思考" : "已思考"), 1)
184
197
  ], 2),
185
- V(R(Re), {
186
- class: G(["expand-icon", { "-rotate-90": !i.value }])
198
+ ee(k(Se), {
199
+ class: z(["expand-icon", { "-rotate-90": !a.value }])
187
200
  }, null, 8, ["class"])
188
201
  ]),
189
- Q(B("div", ft, [
190
- c[0] || (c[0] = B("div", { class: "side-border" }, [
202
+ oe(B("div", yt, [
203
+ f[0] || (f[0] = B("div", { class: "side-border" }, [
191
204
  B("div", { class: "dot-wrapper" }, [
192
205
  B("div", { class: "dot" })
193
206
  ]),
@@ -196,342 +209,351 @@ const Ee = Symbol("bubble-message-group"), Ce = Symbol("bubble-box-renderer-matc
196
209
  B("p", {
197
210
  class: "detail-content",
198
211
  ref_key: "detailRef",
199
- ref: a
200
- }, z(r.value), 513)
212
+ ref: l
213
+ }, W(s.value), 513)
201
214
  ], 512), [
202
- [ee, i.value]
215
+ [se, a.value]
203
216
  ])
204
217
  ], 16),
205
- (v(), A(J(R(l).renderer), P(H({ ...R(l).attributes, ...R(o) })), null, 16))
218
+ (y(), N(X(k(r).renderer), j(Y({ ...k(r).attributes, ...k(o) })), null, 16))
206
219
  ], 64);
207
220
  };
208
221
  }
209
- }), Fe = /* @__PURE__ */ O(pt, [["__scopeId", "data-v-4e9abfba"]]), mt = {
222
+ }), Ke = /* @__PURE__ */ H(xt, [["__scopeId", "data-v-4e9abfba"]]), Rt = {
210
223
  key: 0,
211
224
  class: "tr-bubble__text",
212
225
  "data-type": "text"
213
- }, _t = /* @__PURE__ */ I({
226
+ }, Bt = /* @__PURE__ */ M({
214
227
  __name: "Text",
215
228
  props: {
216
229
  message: {},
217
230
  contentIndex: {}
218
231
  },
219
- setup(t) {
220
- const e = t, { contentText: n } = fe(e);
221
- return (o, l) => R(n) ? (v(), E("p", mt, z(R(n)), 1)) : ae("", !0);
232
+ setup(e) {
233
+ const t = e, { contentText: n } = ge(t);
234
+ return (o, r) => k(n) ? (y(), I("p", Rt, W(k(n)), 1)) : le("", !0);
222
235
  }
223
- }), ce = /* @__PURE__ */ O(_t, [["__scopeId", "data-v-93592ecb"]]), De = /* @__PURE__ */ I({
236
+ }), be = /* @__PURE__ */ H(Bt, [["__scopeId", "data-v-93592ecb"]]), Ge = /* @__PURE__ */ M({
224
237
  __name: "ToolRole",
225
238
  props: {
226
239
  message: {},
227
240
  contentIndex: {}
228
241
  },
229
- setup(t) {
230
- const e = t, n = be();
231
- return ne(() => {
232
- e.message.tool_call_id && (n.toolCallResults || (n.toolCallResults = {}), n.toolCallResults[e.message.tool_call_id] = e.message.content ?? "");
233
- }), (o, l) => ae("", !0);
242
+ setup(e) {
243
+ const t = e, n = _e();
244
+ return ae(() => {
245
+ t.message.tool_call_id && (n.toolCallResults || (n.toolCallResults = {}), n.toolCallResults[t.message.tool_call_id] = t.message.content ?? "");
246
+ }), (o, r) => le("", !0);
234
247
  }
235
- }), gt = {
248
+ }), Et = {
236
249
  class: "tr-bubble__tool-call",
237
250
  "data-type": "tool-call"
238
- }, vt = { class: "header" }, ht = { class: "header-left" }, yt = { class: "title" }, xt = { class: "header-right" }, Bt = { class: "divider" }, Rt = ["innerHTML"], Et = /* @__PURE__ */ I({
251
+ }, Ct = { class: "header" }, kt = { class: "header-left" }, It = { class: "tool-info" }, St = { class: "title" }, At = {
252
+ key: 0,
253
+ class: "description"
254
+ }, Mt = { class: "header-right" }, Tt = { class: "divider" }, wt = ["innerHTML"], Lt = /* @__PURE__ */ M({
239
255
  __name: "Tool",
240
256
  props: {
241
257
  message: {},
242
258
  contentIndex: {},
243
259
  toolCallIndex: {}
244
260
  },
245
- setup(t) {
246
- const e = t, { toolCall: n, toolCallWithResult: o, state: l } = Ht(e), i = /* @__PURE__ */ new Map([
247
- ["running", { text: "正在调用", icon: Be }],
248
- ["success", { text: "已调用", icon: me }],
249
- ["failed", { text: "调用失败", icon: Qe }],
250
- ["cancelled", { text: "已取消", icon: et }]
251
- ]), r = x(() => {
252
- var d;
253
- return i.get(((d = l.value) == null ? void 0 : d.status) || "") || { text: "", icon: me };
254
- }), a = (d, g = 2) => {
255
- let b = "";
261
+ setup(e) {
262
+ const t = e, { toolCall: n, toolCallWithResult: o, state: r } = Xt(t), a = /* @__PURE__ */ new Map([
263
+ ["running", { text: "正在调用", icon: Ie }],
264
+ ["success", { text: "已调用", icon: ve }],
265
+ ["failed", { text: "调用失败", icon: st }],
266
+ ["cancelled", { text: "已取消", icon: rt }],
267
+ ["awaiting-approval", { text: "等待确认", icon: lt }],
268
+ ["denied", { text: "已拒绝", icon: at }]
269
+ ]), s = R(() => {
270
+ var g;
271
+ const c = ((g = r.value) == null ? void 0 : g.status) || "";
272
+ return a.get(c) || { text: "", icon: ve };
273
+ }), l = R(() => typeof r.value.description == "string" ? r.value.description : ""), u = (c, g = 2) => {
274
+ let h = "";
256
275
  try {
257
- typeof d == "string" ? b = JSON.stringify(JSON.parse(d), null, g) : b = JSON.stringify(d, null, g);
276
+ typeof c == "string" ? h = JSON.stringify(JSON.parse(c), null, g) : h = JSON.stringify(c, null, g);
258
277
  } catch {
259
278
  }
260
- return b;
261
- }, u = ze(), p = (d) => d.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), _ = (d) => {
262
- if (!d)
279
+ return h;
280
+ }, b = et(), m = (c) => c.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), x = (c) => {
281
+ if (!c)
263
282
  return "";
264
- let g = p(d);
283
+ let g = m(c);
265
284
  return g = g.replace(
266
285
  /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g,
267
- (b) => {
268
- let S = "number";
269
- return /^"/.test(b) ? S = /:$/.test(b) ? "key" : "string" : /true|false/.test(b) ? S = "boolean" : /null/.test(b) && (S = "null"), `<span class="${u[S]}">${b}</span>`;
286
+ (h) => {
287
+ let p = "number";
288
+ return /^"/.test(h) ? p = /:$/.test(h) ? "key" : "string" : /true|false/.test(h) ? p = "boolean" : /null/.test(h) && (p = "null"), `<span class="${b[p]}">${h}</span>`;
270
289
  }
271
290
  ), g;
272
- }, h = x(() => a(o.value, 2)), y = x(() => _(h.value)), m = M(null);
273
- U(h, (d, g) => {
274
- g === "" || g === "{}" || te(() => {
275
- m.value && m.value.scrollTo({
276
- top: m.value.scrollHeight,
291
+ }, v = R(() => u(o.value, 2)), d = R(() => x(v.value)), f = $(null);
292
+ U(v, (c, g) => {
293
+ g === "" || g === "{}" || re(() => {
294
+ f.value && f.value.scrollTo({
295
+ top: f.value.scrollHeight,
277
296
  behavior: "smooth"
278
297
  });
279
298
  });
280
299
  });
281
- const c = M(!1);
282
- ne(() => {
283
- c.value = l.value.open ?? !1;
300
+ const E = $(!1);
301
+ ae(() => {
302
+ E.value = r.value.open ?? !1;
284
303
  });
285
- const f = ie(), s = () => {
286
- var g, b;
287
- c.value = !c.value;
288
- const d = (g = n.value) == null ? void 0 : g.id;
289
- d && f({
304
+ const i = pe(), _ = () => {
305
+ var g, h;
306
+ E.value = !E.value;
307
+ const c = (g = n.value) == null ? void 0 : g.id;
308
+ c && i({
290
309
  name: "state:update",
291
310
  payload: {
292
311
  key: "toolCall",
293
312
  value: {
294
- ...(b = e.message.state) == null ? void 0 : b.toolCall,
295
- [d]: { ...l.value, open: c.value }
313
+ ...(h = t.message.state) == null ? void 0 : h.toolCall,
314
+ [c]: { ...r.value, open: E.value }
296
315
  }
297
316
  }
298
317
  });
299
318
  };
300
- return (d, g) => {
301
- var b;
302
- return v(), E("div", gt, [
303
- B("div", vt, [
304
- B("div", ht, [
305
- (v(), A(J(r.value.icon), {
306
- class: G(["header-icon", `icon-${R(l).status}`])
319
+ return (c, g) => {
320
+ var h;
321
+ return y(), I("div", Et, [
322
+ B("div", Ct, [
323
+ B("div", kt, [
324
+ (y(), N(X(s.value.icon), {
325
+ class: z(["header-icon", `icon-${k(r).status}`])
307
326
  }, null, 8, ["class"])),
308
- B("span", null, [
309
- B("span", null, z(r.value.text) + " ", 1),
310
- B("span", yt, z(((b = R(n)) == null ? void 0 : b.function.name) || "Untitled"), 1)
327
+ B("div", It, [
328
+ B("div", null, [
329
+ B("span", null, W(s.value.text) + " ", 1),
330
+ B("span", St, W(((h = k(n)) == null ? void 0 : h.function.name) || "Untitled"), 1)
331
+ ]),
332
+ l.value ? (y(), I("div", At, W(l.value), 1)) : le("", !0)
311
333
  ])
312
334
  ]),
313
- B("div", xt, [
314
- V(R(Re), {
315
- class: G(["expand-icon", { "-rotate-90": !c.value }]),
316
- onClick: s
335
+ B("div", Mt, [
336
+ ee(k(Se), {
337
+ class: z(["expand-icon", { "-rotate-90": !E.value }]),
338
+ onClick: _
317
339
  }, null, 8, ["class"])
318
340
  ])
319
341
  ]),
320
- Q(B("div", Bt, null, 512), [
321
- [ee, c.value]
342
+ oe(B("div", Tt, null, 512), [
343
+ [se, E.value]
322
344
  ]),
323
- Q(B("div", {
345
+ oe(B("div", {
324
346
  class: "detail",
325
- innerHTML: y.value,
347
+ innerHTML: d.value,
326
348
  ref_key: "detailRef",
327
- ref: m
328
- }, null, 8, Rt), [
329
- [ee, c.value]
349
+ ref: f
350
+ }, null, 8, wt), [
351
+ [se, E.value]
330
352
  ])
331
353
  ]);
332
354
  };
333
355
  }
334
- }), Ct = "_key_1b448_2", kt = "_number_1b448_6", It = "_string_1b448_10", St = "_boolean_1b448_14", Tt = {
335
- key: Ct,
336
- number: kt,
337
- string: It,
338
- boolean: St,
356
+ }), $t = "_key_1b448_2", Nt = "_number_1b448_6", Ot = "_string_1b448_10", Ft = "_boolean_1b448_14", Pt = {
357
+ key: $t,
358
+ number: Nt,
359
+ string: Ot,
360
+ boolean: Ft,
339
361
  null: "_null_1b448_18"
340
- }, At = {
341
- $style: Tt
342
- }, Pe = /* @__PURE__ */ O(Et, [["__cssModules", At], ["__scopeId", "data-v-00014a8b"]]), Ue = /* @__PURE__ */ I({
362
+ }, Dt = {
363
+ $style: Pt
364
+ }, je = /* @__PURE__ */ H(Lt, [["__cssModules", Dt], ["__scopeId", "data-v-f33174de"]]), Ye = /* @__PURE__ */ M({
343
365
  inheritAttrs: !1,
344
366
  __name: "Tools",
345
367
  props: {
346
368
  message: {},
347
369
  contentIndex: {}
348
370
  },
349
- setup(t) {
350
- const e = t, { restMessage: n, restProps: o } = je(e, ["tool_calls"]), l = ue(n, e.contentIndex);
351
- return (i, r) => (v(), E(D, null, [
352
- (v(), A(J(R(l).renderer), P(H({ ...R(l).attributes, ...R(o) })), null, 16)),
353
- B("div", w({ class: "tr-bubble__tools" }, i.$attrs), [
354
- (v(!0), E(D, null, W(e.message.tool_calls, (a, u) => (v(), A(Pe, w({
355
- key: a.id
356
- }, { ref_for: !0 }, e, { "tool-call-index": u }), null, 16, ["tool-call-index"]))), 128))
371
+ setup(e) {
372
+ const t = e, { restMessage: n, restProps: o } = qe(t, ["tool_calls"]), r = fe(n, t.contentIndex);
373
+ return (a, s) => (y(), I(G, null, [
374
+ (y(), N(X(k(r).renderer), j(Y({ ...k(r).attributes, ...k(o) })), null, 16)),
375
+ B("div", P({ class: "tr-bubble__tools" }, a.$attrs), [
376
+ (y(!0), I(G, null, Q(t.message.tool_calls, (l, u) => (y(), N(je, P({
377
+ key: l.id
378
+ }, { ref_for: !0 }, t, { "tool-call-index": u }), null, 16, ["tool-call-index"]))), 128))
357
379
  ], 16)
358
380
  ], 64));
359
381
  }
360
- }), He = [
382
+ }), Je = [
361
383
  {
362
- find: (t, e) => (e == null ? void 0 : e.type) === "image_url",
363
- renderer: F(le),
364
- priority: K.NORMAL,
384
+ find: (e, t) => (t == null ? void 0 : t.type) === "image_url",
385
+ renderer: K(de),
386
+ priority: J.NORMAL,
365
387
  attributes: { "data-box-type": "image" }
366
388
  }
367
- ], Ke = [
389
+ ], We = [
368
390
  {
369
- find: (t) => !!t.loading,
370
- renderer: F(Ne),
371
- priority: K.LOADING
391
+ find: (e) => !!e.loading,
392
+ renderer: K(He),
393
+ priority: J.LOADING
372
394
  },
373
395
  {
374
- find: (t) => typeof t.reasoning_content == "string" && t.reasoning_content.trim() !== "",
375
- renderer: F(Fe),
376
- priority: K.NORMAL
396
+ find: (e) => typeof e.reasoning_content == "string" && e.reasoning_content.trim() !== "",
397
+ renderer: K(Ke),
398
+ priority: J.NORMAL
377
399
  },
378
400
  {
379
- find: (t) => Array.isArray(t.tool_calls) && t.tool_calls.length > 0,
380
- renderer: F(Ue),
381
- priority: K.NORMAL
401
+ find: (e) => Array.isArray(e.tool_calls) && e.tool_calls.length > 0,
402
+ renderer: K(Ye),
403
+ priority: J.NORMAL
382
404
  },
383
405
  {
384
- find: (t, e) => e.type === "image_url",
385
- renderer: F(Oe),
386
- priority: K.CONTENT
406
+ find: (e, t) => t.type === "image_url",
407
+ renderer: K(Ue),
408
+ priority: J.CONTENT
387
409
  },
388
410
  {
389
- find: (t) => t.role === "tool",
390
- renderer: F(De),
391
- priority: K.ROLE
411
+ find: (e) => e.role === "tool",
412
+ renderer: K(Ge),
413
+ priority: J.ROLE
392
414
  }
393
- ], Ge = F(le), Ye = F(ce), ge = Symbol("BUBBLE_CONTENT_RESOLVER_KEY"), oe = (t) => {
394
- const e = T(ge, void 0), n = e ?? t;
395
- return !e && t && L(ge, t), n ? (l) => {
396
- const i = k(n);
397
- return i == null ? void 0 : i(l);
398
- } : (l) => l.content;
415
+ ], ze = K(de), Ve = K(be), Re = Symbol("BUBBLE_CONTENT_RESOLVER_KEY"), ce = (e) => {
416
+ const t = L(Re, void 0), n = t ?? e;
417
+ return !t && e && O(Re, e), n ? (r) => {
418
+ const a = S(n);
419
+ return a == null ? void 0 : a(r);
420
+ } : (r) => r.content;
399
421
  };
400
- function Mt(t) {
401
- const { boxRendererMatches: e, boxAttributes: n, fallbackBoxRenderer: o } = t;
402
- e && L(Ce, e), n && L(Ie, n), o && L(ke, o);
422
+ function Ut(e) {
423
+ const { boxRendererMatches: t, boxAttributes: n, fallbackBoxRenderer: o } = e;
424
+ t && O(Me, t), n && O(we, n), o && O(Te, o);
403
425
  }
404
- function Lt(t) {
405
- const { fallbackBoxRenderer: e } = t;
406
- e && L(Se, e);
426
+ function Ht(e) {
427
+ const { fallbackBoxRenderer: t } = e;
428
+ t && O(Le, t);
407
429
  }
408
- function $t(t, e) {
409
- const n = T(Ce, He), o = T(Ie, void 0), l = T(ke, void 0), i = T(Se, void 0), r = oe();
410
- if (typeof e == "number" && k(t).length !== 1)
430
+ function Kt(e, t) {
431
+ const n = L(Me, Je), o = L(we, void 0), r = L(Te, void 0), a = L(Le, void 0), s = ce();
432
+ if (typeof t == "number" && S(e).length !== 1)
411
433
  throw new Error("[BubbleBoxRenderer] When contentIndex is a number, messages array length must be 1");
412
- const a = (p) => {
413
- if (p.length !== 1)
434
+ const l = (b) => {
435
+ if (b.length !== 1)
414
436
  return { content: void 0, index: void 0 };
415
- const _ = r(p.at(0));
437
+ const m = s(b.at(0));
416
438
  return {
417
- content: Array.isArray(_) ? _.at(e ?? 0) : { type: "text", text: _ || "" },
418
- index: e ?? 0
439
+ content: Array.isArray(m) ? m.at(t ?? 0) : { type: "text", text: m || "" },
440
+ index: t ?? 0
419
441
  };
420
- }, u = (p, _, h, y) => typeof p.attributes == "function" ? p.attributes(_, h, y) : p.attributes;
421
- return x(() => {
422
- const p = k(t), { content: _, index: h } = a(p), y = (() => {
423
- const c = k(o);
424
- if (c)
425
- return typeof c == "function" ? c(p, _, h) : c;
426
- })(), m = k(n).find((c) => c.find(p, _, h));
427
- return m ? {
428
- renderer: m.renderer,
442
+ }, u = (b, m, x, v) => typeof b.attributes == "function" ? b.attributes(m, x, v) : b.attributes;
443
+ return R(() => {
444
+ const b = S(e), { content: m, index: x } = l(b), v = (() => {
445
+ const f = S(o);
446
+ if (f)
447
+ return typeof f == "function" ? f(b, m, x) : f;
448
+ })(), d = S(n).find((f) => f.find(b, m, x));
449
+ return d ? {
450
+ renderer: d.renderer,
429
451
  attributes: {
430
- ...y,
431
- ...u(m, p, _, h)
452
+ ...v,
453
+ ...u(d, b, m, x)
432
454
  }
433
455
  } : {
434
- renderer: k(i) || k(l) || Ge,
435
- attributes: y
456
+ renderer: S(a) || S(r) || ze,
457
+ attributes: v
436
458
  };
437
459
  });
438
460
  }
439
- function wt(t) {
440
- const { contentRendererMatches: e, contentAttributes: n, fallbackContentRenderer: o } = t;
441
- e && L(Te, e), n && L(Me, n), o && L(Ae, o);
461
+ function Gt(e) {
462
+ const { contentRendererMatches: t, contentAttributes: n, fallbackContentRenderer: o } = e;
463
+ t && O($e, t), n && O(Oe, n), o && O(Ne, o);
442
464
  }
443
- function Ot(t) {
444
- const { fallbackContentRenderer: e } = t;
445
- e && L(Le, e);
465
+ function jt(e) {
466
+ const { fallbackContentRenderer: t } = e;
467
+ t && O(Fe, t);
446
468
  }
447
- function ue(t, e) {
448
- const n = T(Te, Ke), o = T(Me, void 0), l = T(Ae, void 0), i = T(Le, void 0), r = oe();
449
- return x(() => {
450
- const a = k(t), u = r(a), p = Array.isArray(u) ? u.at(e ?? 0) : { type: "text", text: u || "" }, _ = (() => {
451
- const y = k(o);
452
- if (y)
453
- return typeof y == "function" ? y(a, p, e) : y;
454
- })(), h = k(n).find((y) => y.find(a, p, e));
455
- return h ? {
456
- renderer: h.renderer,
469
+ function fe(e, t) {
470
+ const n = L($e, We), o = L(Oe, void 0), r = L(Ne, void 0), a = L(Fe, void 0), s = ce();
471
+ return R(() => {
472
+ const l = S(e), u = s(l), b = Array.isArray(u) ? u.at(t ?? 0) : { type: "text", text: u || "" }, m = (() => {
473
+ const v = S(o);
474
+ if (v)
475
+ return typeof v == "function" ? v(l, b, t) : v;
476
+ })(), x = S(n).find((v) => v.find(l, b, t));
477
+ return x ? {
478
+ renderer: x.renderer,
457
479
  attributes: {
458
- ..._,
459
- ...h.attributes
480
+ ...m,
481
+ ...x.attributes
460
482
  }
461
483
  } : {
462
- renderer: k(i) || k(l) || Ye,
463
- attributes: _
484
+ renderer: S(a) || S(r) || Ve,
485
+ attributes: m
464
486
  };
465
487
  });
466
488
  }
467
- function Nt(t) {
468
- L($e, t);
489
+ function Yt(e) {
490
+ O(Pe, e);
469
491
  }
470
- function ie() {
471
- return T($e, (t) => {
472
- console.warn(`[Bubble] Event function not found for event: ${t.name}`);
492
+ function pe() {
493
+ return L(Pe, (e) => {
494
+ console.warn(`[Bubble] Event function not found for event: ${e.name}`);
473
495
  });
474
496
  }
475
- function ln() {
476
- const t = ie();
477
- return (e, n) => {
478
- t({
497
+ function gn() {
498
+ const e = pe();
499
+ return (t, n) => {
500
+ e({
479
501
  name: "state:update",
480
- payload: { key: e, value: n }
502
+ payload: { key: t, value: n }
481
503
  });
482
504
  };
483
505
  }
484
- function de(t) {
485
- const e = T(re, void 0);
486
- if (e)
487
- return e;
488
- const n = Xe(t || {});
489
- return L(re, n), n;
506
+ function me(e) {
507
+ const t = L(ie, void 0);
508
+ if (t)
509
+ return t;
510
+ const n = tt(e || {});
511
+ return O(ie, n), n;
490
512
  }
491
- function be() {
492
- return T(re, {});
513
+ function _e() {
514
+ return L(ie, {});
493
515
  }
494
- function Je(t) {
516
+ function Xe(e) {
495
517
  U(
496
- t,
497
- (e, n, o) => {
498
- if (!e) return;
499
- const l = (i) => {
518
+ e,
519
+ (t, n, o) => {
520
+ if (!t) return;
521
+ const r = (a) => {
500
522
  var u;
501
- const r = window.getSelection();
502
- if (!e.contains((r == null ? void 0 : r.anchorNode) || null)) return;
503
- i.preventDefault();
504
- const a = (r == null ? void 0 : r.toString().replace(/\n{2,}/g, `
523
+ const s = window.getSelection();
524
+ if (!t.contains((s == null ? void 0 : s.anchorNode) || null)) return;
525
+ a.preventDefault();
526
+ const l = (s == null ? void 0 : s.toString().replace(/\n{2,}/g, `
505
527
  `)) || "";
506
- (u = i.clipboardData) == null || u.setData("text/plain", a);
528
+ (u = a.clipboardData) == null || u.setData("text/plain", l);
507
529
  };
508
- e.addEventListener("copy", l), o(() => e.removeEventListener("copy", l));
530
+ t.addEventListener("copy", r), o(() => t.removeEventListener("copy", r));
509
531
  },
510
532
  { immediate: !0, flush: "post" }
511
533
  );
512
534
  }
513
- const fe = (t) => {
514
- const e = oe(), n = x(() => {
515
- const l = e(t.message);
516
- return Array.isArray(l) ? l.at(t.contentIndex) : { type: "text", text: l || "" };
517
- }), o = x(() => n.value.type === "text" ? String(n.value.text) : "");
535
+ const ge = (e) => {
536
+ const t = ce(), n = R(() => {
537
+ const r = t(e.message);
538
+ return Array.isArray(r) ? r.at(e.contentIndex) : { type: "text", text: r || "" };
539
+ }), o = R(() => n.value.type === "text" ? String(n.value.text) : "");
518
540
  return {
519
541
  content: n,
520
542
  contentText: o
521
543
  };
522
544
  };
523
- function Ft(t) {
524
- L(Ee, t);
545
+ function Jt(e) {
546
+ O(Ae, e);
525
547
  }
526
- function Dt() {
527
- return T(Ee, void 0);
548
+ function Wt() {
549
+ return L(Ae, void 0);
528
550
  }
529
- function je(t, e) {
530
- const n = x(() => {
531
- const l = Object.entries(t.message).filter(([i]) => !e.includes(i));
532
- return Object.fromEntries(l);
533
- }), o = x(() => ({
534
- ...t,
551
+ function qe(e, t) {
552
+ const n = R(() => {
553
+ const r = Object.entries(e.message).filter(([a]) => !t.includes(a));
554
+ return Object.fromEntries(r);
555
+ }), o = R(() => ({
556
+ ...e,
535
557
  message: n.value
536
558
  }));
537
559
  return {
@@ -539,64 +561,64 @@ function je(t, e) {
539
561
  restProps: o
540
562
  };
541
563
  }
542
- let se = null;
543
- const Pt = () => (se || (se = import("./index5.js")), se);
544
- let j = null;
545
- const Ut = async () => {
546
- if (j)
547
- return j;
564
+ let ue = null;
565
+ const zt = () => (ue || (ue = import("./index5.js")), ue);
566
+ let Z = null;
567
+ const Vt = async () => {
568
+ if (Z)
569
+ return Z;
548
570
  try {
549
- const [t, e] = await Promise.all([import("markdown-it"), import("dompurify")]);
550
- return j = { markdown: t.default, dompurify: e.default }, j;
571
+ const [e, t] = await Promise.all([import("markdown-it"), import("dompurify")]);
572
+ return Z = { markdown: e.default, dompurify: t.default }, Z;
551
573
  } catch {
552
- return console.warn("[BubbleMarkdownRenderer] install markdown-it and dompurify to use markdown renderer"), j = null, null;
574
+ return console.warn("[BubbleMarkdownRenderer] install markdown-it and dompurify to use markdown renderer"), Z = null, null;
553
575
  }
554
- }, ve = ["running", "success", "failed", "cancelled"], Ht = (t) => {
555
- const e = x(() => {
556
- var r, a;
557
- return (a = (r = t.message) == null ? void 0 : r.tool_calls) == null ? void 0 : a[t.toolCallIndex];
558
- }), n = be(), o = x(() => {
559
- var _, h, y;
560
- let r = n.toolCallDefaultStatus;
561
- r && !ve.includes(r) && (r = void 0);
562
- const a = n.toolCallDefaultOpen;
576
+ }, Be = ["running", "success", "failed", "cancelled", "awaiting-approval", "denied"], Xt = (e) => {
577
+ const t = R(() => {
578
+ var s, l;
579
+ return (l = (s = e.message) == null ? void 0 : s.tool_calls) == null ? void 0 : l[e.toolCallIndex];
580
+ }), n = _e(), o = R(() => {
581
+ var m, x, v;
582
+ let s = n.toolCallDefaultStatus;
583
+ s && !Be.includes(s) && (s = void 0);
584
+ const l = n.toolCallDefaultOpen;
563
585
  let u = {
564
- status: r,
565
- open: a
586
+ status: s,
587
+ open: l
566
588
  };
567
- const p = (_ = e.value) == null ? void 0 : _.id;
568
- if (p) {
569
- const m = (y = (h = t.message.state) == null ? void 0 : h.toolCall) == null ? void 0 : y[p];
570
- if (m) {
571
- const { status: c, open: f, ...s } = m;
572
- c && ve.includes(c) && (u.status = c), f !== void 0 && (u.open = f), u = { ...u, ...s };
589
+ const b = (m = t.value) == null ? void 0 : m.id;
590
+ if (b) {
591
+ const d = (v = (x = e.message.state) == null ? void 0 : x.toolCall) == null ? void 0 : v[b];
592
+ if (d) {
593
+ const { status: f, open: E, ...i } = d;
594
+ f && Be.includes(f) && (u.status = f), E !== void 0 && (u.open = E), u = { ...u, ...i };
573
595
  }
574
596
  }
575
597
  return u;
576
- }), l = x(() => {
577
- var a, u;
578
- const r = (a = e.value) == null ? void 0 : a.id;
579
- if (r)
580
- return (u = n.toolCallResults) == null ? void 0 : u[r];
581
- }), i = M({});
582
- return ne(() => {
598
+ }), r = R(() => {
599
+ var l, u;
600
+ const s = (l = t.value) == null ? void 0 : l.id;
601
+ if (s)
602
+ return (u = n.toolCallResults) == null ? void 0 : u[s];
603
+ }), a = $({});
604
+ return ae(() => {
583
605
  var u;
584
- const r = (u = e.value) == null ? void 0 : u.function.arguments, a = l.value;
585
- Pt().then(({ jsonrepair: p }) => {
586
- const _ = p(typeof r == "string" ? r || "{}" : JSON.stringify(r));
587
- i.value = {
588
- arguments: JSON.parse(_),
589
- result: a ? JSON.parse(p(a || "{}")) : void 0
606
+ const s = (u = t.value) == null ? void 0 : u.function.arguments, l = r.value;
607
+ zt().then(({ jsonrepair: b }) => {
608
+ const m = b(typeof s == "string" ? s || "{}" : JSON.stringify(s));
609
+ a.value = {
610
+ arguments: JSON.parse(m),
611
+ result: l ? JSON.parse(b(l || "{}")) : void 0
590
612
  };
591
- }).catch((p) => {
592
- console.warn(p);
613
+ }).catch((b) => {
614
+ console.warn(b);
593
615
  });
594
616
  }), {
595
- toolCall: e,
596
- toolCallWithResult: qe(i),
617
+ toolCall: t,
618
+ toolCallWithResult: nt(a),
597
619
  state: o
598
620
  };
599
- }, he = /* @__PURE__ */ I({
621
+ }, Ee = /* @__PURE__ */ M({
600
622
  __name: "BubbleBoxWrapper",
601
623
  props: {
602
624
  role: {},
@@ -605,49 +627,49 @@ const Ut = async () => {
605
627
  messages: {},
606
628
  contentIndex: {}
607
629
  },
608
- setup(t) {
609
- const e = t, n = $t(() => e.messages, e.contentIndex);
610
- return (o, l) => (v(), A(J(R(n).renderer), w(R(n).attributes, {
611
- "data-role": e.role,
612
- "data-placement": e.placement,
613
- "data-shape": e.shape
630
+ setup(e) {
631
+ const t = e, n = Kt(() => t.messages, t.contentIndex);
632
+ return (o, r) => (y(), N(X(k(n).renderer), P(k(n).attributes, {
633
+ "data-role": t.role,
634
+ "data-placement": t.placement,
635
+ "data-shape": t.shape
614
636
  }), {
615
- default: $(() => [
616
- C(o.$slots, "default")
637
+ default: F(() => [
638
+ A(o.$slots, "default")
617
639
  ]),
618
640
  _: 3
619
641
  }, 16, ["data-role", "data-placement", "data-shape"]));
620
642
  }
621
- }), ye = /* @__PURE__ */ I({
643
+ }), Ce = /* @__PURE__ */ M({
622
644
  __name: "BubbleContentWrapper",
623
645
  props: {
624
646
  message: {},
625
647
  contentIndex: {}
626
648
  },
627
649
  emits: ["state-change", "bubble-event"],
628
- setup(t, { emit: e }) {
629
- const n = t, o = ue(() => n.message, n.contentIndex), l = x(() => ({
650
+ setup(e, { emit: t }) {
651
+ const n = e, o = fe(() => n.message, n.contentIndex), r = R(() => ({
630
652
  ...o.value.attributes,
631
653
  message: n.message,
632
654
  contentIndex: n.contentIndex
633
- })), i = e;
634
- return Nt((a) => {
635
- if (i("bubble-event", {
636
- ...a,
655
+ })), a = t;
656
+ return Yt((l) => {
657
+ if (a("bubble-event", {
658
+ ...l,
637
659
  contentIndex: n.contentIndex
638
- }), a.name === "state:update") {
639
- const u = a.payload;
660
+ }), l.name === "state:update") {
661
+ const u = l.payload;
640
662
  if (!u || typeof u != "object" || !("key" in u) || typeof u.key != "string" || !("value" in u))
641
663
  return;
642
- i("state-change", {
664
+ a("state-change", {
643
665
  key: u.key,
644
666
  value: u.value,
645
667
  contentIndex: n.contentIndex
646
668
  });
647
669
  }
648
- }), (a, u) => (v(), A(J(R(o).renderer), P(H(l.value)), null, 16));
670
+ }), (l, u) => (y(), N(X(k(o).renderer), j(Y(r.value)), null, 16));
649
671
  }
650
- }), Kt = ["data-role", "data-placement"], Gt = { class: "tr-bubble__body" }, Yt = { class: "tr-bubble__content" }, Jt = { class: "tr-bubble__after" }, jt = /* @__PURE__ */ I({
672
+ }), qt = ["data-role", "data-placement"], Zt = { class: "tr-bubble__body" }, Qt = { class: "tr-bubble__content" }, en = { class: "tr-bubble__after" }, tn = /* @__PURE__ */ M({
651
673
  __name: "Bubble",
652
674
  props: {
653
675
  content: {},
@@ -664,120 +686,120 @@ const Ut = async () => {
664
686
  placement: { default: "start" },
665
687
  shape: { default: "corner" },
666
688
  contentRenderMode: { default: "single" },
667
- contentResolver: { type: Function, default: (t) => t.content },
689
+ contentResolver: { type: Function, default: (e) => e.content },
668
690
  fallbackBoxRenderer: {},
669
691
  fallbackContentRenderer: {}
670
692
  },
671
693
  emits: ["state-change", "bubble-event"],
672
- setup(t, { emit: e }) {
673
- const n = t, o = oe(() => n.contentResolver), l = e;
674
- de();
675
- const i = Dt(), r = x(() => k(i)), a = x(() => {
676
- var Z;
677
- if ((Z = r.value) != null && Z.messages.length)
678
- return r.value.messages;
679
- const { role: m, content: c, reasoning_content: f, tool_calls: s, tool_call_id: d, name: g, id: b, loading: S, state: N } = n;
680
- return [{ role: m, content: c, reasoning_content: f, tool_calls: s, tool_call_id: d, name: g, id: b, loading: S, state: N }];
681
- }), u = (m) => {
682
- const c = o(m);
683
- return Array.isArray(c) ? c : [{ type: "text", text: c || "" }];
694
+ setup(e, { emit: t }) {
695
+ const n = e, o = ce(() => n.contentResolver), r = t;
696
+ me();
697
+ const a = Wt(), s = R(() => S(a)), l = R(() => {
698
+ var T;
699
+ if ((T = s.value) != null && T.messages.length)
700
+ return s.value.messages;
701
+ const { role: d, content: f, reasoning_content: E, tool_calls: i, tool_call_id: _, name: c, id: g, loading: h, state: p } = n;
702
+ return [{ role: d, content: f, reasoning_content: E, tool_calls: i, tool_call_id: _, name: c, id: g, loading: h, state: p }];
703
+ }), u = (d) => {
704
+ const f = o(d);
705
+ return Array.isArray(f) ? f : [{ type: "text", text: f || "" }];
684
706
  };
685
- Lt({ fallbackBoxRenderer: () => n.fallbackBoxRenderer }), Ot({ fallbackContentRenderer: () => n.fallbackContentRenderer });
686
- const p = x(() => a.value.length === 0 ? !0 : n.hidden), _ = x(() => {
687
- if (n.contentRenderMode === "split" && a.value.length === 1) {
688
- const m = o(a.value.at(0));
689
- if (Array.isArray(m))
690
- return m;
707
+ Ht({ fallbackBoxRenderer: () => n.fallbackBoxRenderer }), jt({ fallbackContentRenderer: () => n.fallbackContentRenderer });
708
+ const b = R(() => l.value.length === 0 ? !0 : n.hidden), m = R(() => {
709
+ if (n.contentRenderMode === "split" && l.value.length === 1) {
710
+ const d = o(l.value.at(0));
711
+ if (Array.isArray(d))
712
+ return d;
691
713
  }
692
714
  return null;
693
- }), h = T(we, !1), y = M(null);
694
- return h || Je(y), (m, c) => Q((v(), E("div", {
715
+ }), x = L(De, !1), v = $(null);
716
+ return x || Xe(v), (d, f) => oe((y(), I("div", {
695
717
  class: "tr-bubble",
696
718
  ref_key: "bubbleRef",
697
- ref: y,
719
+ ref: v,
698
720
  "data-role": n.role,
699
721
  "data-placement": n.placement
700
722
  }, [
701
- C(m.$slots, "prefix", {
702
- messages: a.value,
703
- role: t.role
723
+ A(d.$slots, "prefix", {
724
+ messages: l.value,
725
+ role: e.role
704
726
  }, void 0, !0),
705
- B("div", Gt, [
706
- n.avatar ? (v(), A(J(n.avatar), {
727
+ B("div", Zt, [
728
+ n.avatar ? (y(), N(X(n.avatar), {
707
729
  key: 0,
708
- class: G(["tr-bubble__avatar", m.$style["tr-bubble__avatar"]])
709
- }, null, 8, ["class"])) : ae("", !0),
710
- B("div", Yt, [
711
- _.value ? (v(!0), E(D, { key: 0 }, W(_.value, (f, s) => (v(), A(he, {
712
- key: s,
730
+ class: z(["tr-bubble__avatar", d.$style["tr-bubble__avatar"]])
731
+ }, null, 8, ["class"])) : le("", !0),
732
+ B("div", Qt, [
733
+ m.value ? (y(!0), I(G, { key: 0 }, Q(m.value, (E, i) => (y(), N(Ee, {
734
+ key: i,
713
735
  class: "tr-bubble__box",
714
736
  role: n.role,
715
737
  placement: n.placement,
716
738
  shape: n.shape,
717
- messages: a.value,
718
- "content-index": s
739
+ messages: l.value,
740
+ "content-index": i
719
741
  }, {
720
- default: $(() => [
721
- V(ye, {
722
- message: a.value.at(0),
723
- "content-index": s,
724
- onStateChange: c[0] || (c[0] = (d) => l("state-change", { ...d, messageIndex: 0 })),
725
- onBubbleEvent: c[1] || (c[1] = (d) => l("bubble-event", { ...d, messageIndex: 0 }))
742
+ default: F(() => [
743
+ ee(Ce, {
744
+ message: l.value.at(0),
745
+ "content-index": i,
746
+ onStateChange: f[0] || (f[0] = (_) => r("state-change", { ..._, messageIndex: 0 })),
747
+ onBubbleEvent: f[1] || (f[1] = (_) => r("bubble-event", { ..._, messageIndex: 0 }))
726
748
  }, null, 8, ["message", "content-index"]),
727
- C(m.$slots, "content-footer", {
728
- messages: a.value,
749
+ A(d.$slots, "content-footer", {
750
+ messages: l.value,
729
751
  role: n.role,
730
- contentIndex: s
752
+ contentIndex: i
731
753
  }, void 0, !0)
732
754
  ]),
733
755
  _: 2
734
- }, 1032, ["role", "placement", "shape", "messages", "content-index"]))), 128)) : (v(), A(he, {
756
+ }, 1032, ["role", "placement", "shape", "messages", "content-index"]))), 128)) : (y(), N(Ee, {
735
757
  key: 1,
736
758
  role: n.role,
737
759
  placement: n.placement,
738
760
  shape: n.shape,
739
- messages: a.value
761
+ messages: l.value
740
762
  }, {
741
- default: $(() => [
742
- (v(!0), E(D, null, W(a.value, (f, s) => (v(), E(D, {
743
- key: `message-${s}`
763
+ default: F(() => [
764
+ (y(!0), I(G, null, Q(l.value, (E, i) => (y(), I(G, {
765
+ key: `message-${i}`
744
766
  }, [
745
- (v(!0), E(D, null, W(u(f), (d, g) => (v(), A(ye, {
746
- key: `content-${g}`,
747
- message: f,
748
- "content-index": g,
749
- onStateChange: (b) => l("state-change", { ...b, messageIndex: s }),
750
- onBubbleEvent: (b) => l("bubble-event", { ...b, messageIndex: s })
767
+ (y(!0), I(G, null, Q(u(E), (_, c) => (y(), N(Ce, {
768
+ key: `content-${c}`,
769
+ message: E,
770
+ "content-index": c,
771
+ onStateChange: (g) => r("state-change", { ...g, messageIndex: i }),
772
+ onBubbleEvent: (g) => r("bubble-event", { ...g, messageIndex: i })
751
773
  }, null, 8, ["message", "content-index", "onStateChange", "onBubbleEvent"]))), 128))
752
774
  ], 64))), 128)),
753
- C(m.$slots, "content-footer", {
754
- messages: a.value,
775
+ A(d.$slots, "content-footer", {
776
+ messages: l.value,
755
777
  role: n.role
756
778
  }, void 0, !0)
757
779
  ]),
758
780
  _: 3
759
781
  }, 8, ["role", "placement", "shape", "messages"]))
760
782
  ]),
761
- B("div", Jt, [
762
- C(m.$slots, "after", {
763
- messages: a.value,
764
- role: t.role
783
+ B("div", en, [
784
+ A(d.$slots, "after", {
785
+ messages: l.value,
786
+ role: e.role
765
787
  }, void 0, !0)
766
788
  ])
767
789
  ]),
768
- C(m.$slots, "suffix", {
769
- messages: a.value,
770
- role: t.role
790
+ A(d.$slots, "suffix", {
791
+ messages: l.value,
792
+ role: e.role
771
793
  }, void 0, !0)
772
- ], 8, Kt)), [
773
- [ee, !p.value]
794
+ ], 8, qt)), [
795
+ [se, !b.value]
774
796
  ]);
775
797
  }
776
- }), Wt = {
798
+ }), nn = {
777
799
  "tr-bubble__avatar": "_tr-bubble__avatar_1r87c_2"
778
- }, Vt = {
779
- $style: Wt
780
- }, Y = /* @__PURE__ */ O(jt, [["__cssModules", Vt], ["__scopeId", "data-v-d68ceaad"]]), zt = /* @__PURE__ */ I({
800
+ }, on = {
801
+ $style: nn
802
+ }, V = /* @__PURE__ */ H(tn, [["__cssModules", on], ["__scopeId", "data-v-d68ceaad"]]), sn = /* @__PURE__ */ M({
781
803
  __name: "BubbleItem",
782
804
  props: {
783
805
  messageGroup: {},
@@ -786,31 +808,31 @@ const Ut = async () => {
786
808
  contentResolver: { type: Function }
787
809
  },
788
810
  emits: ["state-change", "bubble-event"],
789
- setup(t, { emit: e }) {
790
- const n = t, o = e;
791
- return Ft(() => n.messageGroup), (l, i) => (v(), A(Y, w(t.roleConfig, {
792
- role: t.messageGroup.role,
793
- "content-render-mode": t.contentRenderMode,
794
- "content-resolver": t.contentResolver,
795
- onStateChange: i[0] || (i[0] = (r) => o("state-change", r)),
796
- onBubbleEvent: i[1] || (i[1] = (r) => o("bubble-event", r))
811
+ setup(e, { emit: t }) {
812
+ const n = e, o = t;
813
+ return Jt(() => n.messageGroup), (r, a) => (y(), N(V, P(e.roleConfig, {
814
+ role: e.messageGroup.role,
815
+ "content-render-mode": e.contentRenderMode,
816
+ "content-resolver": e.contentResolver,
817
+ onStateChange: a[0] || (a[0] = (s) => o("state-change", s)),
818
+ onBubbleEvent: a[1] || (a[1] = (s) => o("bubble-event", s))
797
819
  }), {
798
- prefix: $((r) => [
799
- C(l.$slots, "prefix", P(H(r)))
820
+ prefix: F((s) => [
821
+ A(r.$slots, "prefix", j(Y(s)))
800
822
  ]),
801
- suffix: $((r) => [
802
- C(l.$slots, "suffix", P(H(r)))
823
+ suffix: F((s) => [
824
+ A(r.$slots, "suffix", j(Y(s)))
803
825
  ]),
804
- "content-footer": $((r) => [
805
- C(l.$slots, "content-footer", P(H(r)))
826
+ "content-footer": F((s) => [
827
+ A(r.$slots, "content-footer", j(Y(s)))
806
828
  ]),
807
- after: $((r) => [
808
- C(l.$slots, "after", P(H(r)))
829
+ after: F((s) => [
830
+ A(r.$slots, "after", j(Y(s)))
809
831
  ]),
810
832
  _: 3
811
833
  }, 16, ["role", "content-render-mode", "content-resolver"]));
812
834
  }
813
- }), Xt = /* @__PURE__ */ I({
835
+ }), rn = /* @__PURE__ */ M({
814
836
  __name: "BubbleList",
815
837
  props: {
816
838
  messages: {},
@@ -819,131 +841,128 @@ const Ut = async () => {
819
841
  fallbackRole: { default: "assistant" },
820
842
  roleConfigs: {},
821
843
  contentRenderMode: {},
822
- contentResolver: { type: Function, default: (t) => t.content },
844
+ contentResolver: { type: Function, default: (e) => e.content },
823
845
  autoScroll: { type: Boolean }
824
846
  },
825
847
  emits: ["state-change", "bubble-event"],
826
- setup(t, { expose: e, emit: n }) {
827
- const o = t, l = n;
828
- de(), L(we, !0);
829
- const i = (c) => {
830
- var f, s;
831
- return c ? !!((s = (f = o.roleConfigs) == null ? void 0 : f[c]) != null && s.hidden) : !1;
832
- }, r = M(null);
833
- let a = async () => {
834
- };
835
- if (o.autoScroll) {
836
- const c = x(() => o.messages.at(-1)), { scrollToBottom: f } = rt(r, () => {
837
- var s, d;
838
- return [
839
- o.messages.length,
840
- (s = c.value) == null ? void 0 : s.content,
841
- (d = c.value) == null ? void 0 : d.reasoning_content
842
- ];
843
- });
844
- a = f, U(
845
- () => {
846
- var s;
847
- return (s = c.value) == null ? void 0 : s.role;
848
- },
849
- async (s) => {
850
- s === "user" && (await te(), f("smooth"));
851
- }
852
- );
853
- }
854
- Je(r);
855
- const u = (c) => {
856
- const f = [];
857
- let s = !1;
858
- for (const [d, g] of c.entries()) {
859
- const b = f[f.length - 1], S = g.role || "", N = i(g.role);
860
- b && (s && N || b.role === S && s === N) ? (b.messages.push(g), b.messageIndexes.push(d)) : f.push({
861
- role: S,
862
- messages: [g],
863
- messageIndexes: [d]
864
- }), s = N;
848
+ setup(e, { expose: t, emit: n }) {
849
+ const o = e, r = n;
850
+ me(), O(De, !0);
851
+ const a = (i) => {
852
+ var _, c;
853
+ return i ? !!((c = (_ = o.roleConfigs) == null ? void 0 : _[i]) != null && c.hidden) : !1;
854
+ }, s = $(null), l = $(null), u = R(() => o.messages.at(-1)), { scrollToBottom: b } = bt({
855
+ scrollRef: s,
856
+ contentRef: l,
857
+ enabled: () => o.autoScroll
858
+ });
859
+ U(
860
+ () => {
861
+ var i;
862
+ return (i = u.value) == null ? void 0 : i.role;
863
+ },
864
+ async (i) => {
865
+ o.autoScroll && i === "user" && (await re(), b("smooth"));
865
866
  }
866
- return f;
867
- }, p = (c, f) => {
868
- const s = [];
869
- let d = !1;
870
- for (const [g, b] of c.entries()) {
871
- const S = s[s.length - 1], N = b.role === f, Z = b.role || "", pe = i(b.role);
872
- S && // divider 消息(分割角色)永远不与任何组进行合并
873
- !N && // divider 组(分割角色)不允许被追加消息,确保 divider 组永远只有 1 条 message
874
- S.role !== f && // hidden / 非 hidden 分组隔离
875
- d === pe ? (S.messages.push(b), S.messageIndexes.push(g)) : s.push({
876
- role: N ? f : Z,
877
- messages: [b],
867
+ ), Xe(s);
868
+ const m = (i) => {
869
+ const _ = [];
870
+ let c = !1;
871
+ for (const [g, h] of i.entries()) {
872
+ const p = _[_.length - 1], T = h.role || "", D = a(h.role);
873
+ p && (c && D || p.role === T && c === D) ? (p.messages.push(h), p.messageIndexes.push(g)) : _.push({
874
+ role: T,
875
+ messages: [h],
878
876
  messageIndexes: [g]
879
- }), d = pe;
877
+ }), c = D;
880
878
  }
881
- return s;
882
- }, _ = x(() => o.messages.length === 0 ? [] : typeof o.groupStrategy == "function" ? o.groupStrategy(o.messages, o.dividerRole) : o.groupStrategy === "consecutive" ? u(o.messages) : p(o.messages, o.dividerRole)), h = (c, f) => {
883
- const s = c.messageIndexes[f];
884
- if (s === void 0) {
879
+ return _;
880
+ }, x = (i, _) => {
881
+ const c = [];
882
+ let g = !1;
883
+ for (const [h, p] of i.entries()) {
884
+ const T = c[c.length - 1], D = p.role === _, C = p.role || "", w = a(p.role);
885
+ T && // divider 消息(分割角色)永远不与任何组进行合并
886
+ !D && // divider 组(分割角色)不允许被追加消息,确保 divider 组永远只有 1 条 message
887
+ T.role !== _ && // hidden / 非 hidden 分组隔离
888
+ g === w ? (T.messages.push(p), T.messageIndexes.push(h)) : c.push({
889
+ role: D ? _ : C,
890
+ messages: [p],
891
+ messageIndexes: [h]
892
+ }), g = w;
893
+ }
894
+ return c;
895
+ }, v = R(() => o.messages.length === 0 ? [] : typeof o.groupStrategy == "function" ? o.groupStrategy(o.messages, o.dividerRole) : o.groupStrategy === "consecutive" ? m(o.messages) : x(o.messages, o.dividerRole)), d = (i, _) => {
896
+ const c = i.messageIndexes[_];
897
+ if (c === void 0) {
885
898
  console.warn(
886
899
  "[BubbleList] Missing messageIndexes mapping; event was not emitted. Ensure custom groupStrategy returns messageIndexes aligned with messages.",
887
900
  {
888
- messageIndex: f,
889
- messageIndexes: c.messageIndexes
901
+ messageIndex: _,
902
+ messageIndexes: i.messageIndexes
890
903
  }
891
904
  );
892
905
  return;
893
906
  }
894
- return s;
895
- }, y = (c, f) => {
896
- const s = h(c, f.messageIndex);
897
- s !== void 0 && l("state-change", { ...f, messageIndex: s });
898
- }, m = (c, f) => {
899
- const s = h(c, f.messageIndex);
900
- s !== void 0 && l("bubble-event", { ...f, messageIndex: s });
907
+ return c;
908
+ }, f = (i, _) => {
909
+ const c = d(i, _.messageIndex);
910
+ c !== void 0 && r("state-change", { ..._, messageIndex: c });
911
+ }, E = (i, _) => {
912
+ const c = d(i, _.messageIndex);
913
+ c !== void 0 && r("bubble-event", { ..._, messageIndex: c });
901
914
  };
902
- return e({
903
- scrollToBottom: a
904
- }), (c, f) => (v(), E("div", {
915
+ return t({
916
+ scrollToBottom: b
917
+ }), (i, _) => (y(), I("div", {
905
918
  class: "tr-bubble-list",
906
- ref_key: "listRef",
907
- ref: r
919
+ ref_key: "scrollContainerRef",
920
+ ref: s
908
921
  }, [
909
- (v(!0), E(D, null, W(_.value, (s, d) => {
910
- var g;
911
- return v(), A(zt, {
912
- key: d,
913
- role: s.role || o.fallbackRole,
914
- "role-config": (g = o.roleConfigs) == null ? void 0 : g[s.role || o.fallbackRole],
915
- "message-group": s,
916
- "content-render-mode": o.contentRenderMode,
917
- "content-resolver": o.contentResolver,
918
- onStateChange: (b) => y(s, b),
919
- onBubbleEvent: (b) => m(s, b)
920
- }, {
921
- prefix: $((b) => [
922
- C(c.$slots, "prefix", w({ ref_for: !0 }, b, {
923
- messageIndexes: s.messageIndexes
924
- }), void 0, !0)
925
- ]),
926
- suffix: $((b) => [
927
- C(c.$slots, "suffix", w({ ref_for: !0 }, b, {
928
- messageIndexes: s.messageIndexes
929
- }), void 0, !0)
930
- ]),
931
- "content-footer": $((b) => [
932
- C(c.$slots, "content-footer", w({ ref_for: !0 }, b, {
933
- messageIndexes: s.messageIndexes
934
- }), void 0, !0)
935
- ]),
936
- after: $((b) => [
937
- C(c.$slots, "after", w({ ref_for: !0 }, b, {
938
- messageIndexes: s.messageIndexes
939
- }), void 0, !0)
940
- ]),
941
- _: 2
942
- }, 1032, ["role", "role-config", "message-group", "content-render-mode", "content-resolver", "onStateChange", "onBubbleEvent"]);
943
- }), 128))
922
+ B("div", {
923
+ class: "tr-bubble-list__content",
924
+ ref_key: "contentRef",
925
+ ref: l
926
+ }, [
927
+ (y(!0), I(G, null, Q(v.value, (c, g) => {
928
+ var h;
929
+ return y(), N(sn, {
930
+ key: g,
931
+ role: c.role || o.fallbackRole,
932
+ "role-config": (h = o.roleConfigs) == null ? void 0 : h[c.role || o.fallbackRole],
933
+ "message-group": c,
934
+ "content-render-mode": o.contentRenderMode,
935
+ "content-resolver": o.contentResolver,
936
+ onStateChange: (p) => f(c, p),
937
+ onBubbleEvent: (p) => E(c, p)
938
+ }, {
939
+ prefix: F((p) => [
940
+ A(i.$slots, "prefix", P({ ref_for: !0 }, p, {
941
+ messageIndexes: c.messageIndexes
942
+ }), void 0, !0)
943
+ ]),
944
+ suffix: F((p) => [
945
+ A(i.$slots, "suffix", P({ ref_for: !0 }, p, {
946
+ messageIndexes: c.messageIndexes
947
+ }), void 0, !0)
948
+ ]),
949
+ "content-footer": F((p) => [
950
+ A(i.$slots, "content-footer", P({ ref_for: !0 }, p, {
951
+ messageIndexes: c.messageIndexes
952
+ }), void 0, !0)
953
+ ]),
954
+ after: F((p) => [
955
+ A(i.$slots, "after", P({ ref_for: !0 }, p, {
956
+ messageIndexes: c.messageIndexes
957
+ }), void 0, !0)
958
+ ]),
959
+ _: 2
960
+ }, 1032, ["role", "role-config", "message-group", "content-render-mode", "content-resolver", "onStateChange", "onBubbleEvent"]);
961
+ }), 128))
962
+ ], 512)
944
963
  ], 512));
945
964
  }
946
- }), X = /* @__PURE__ */ O(Xt, [["__scopeId", "data-v-1d84cbfe"]]), q = /* @__PURE__ */ I({
965
+ }), te = /* @__PURE__ */ H(rn, [["__scopeId", "data-v-d51c5aeb"]]), ne = /* @__PURE__ */ M({
947
966
  __name: "BubbleProvider",
948
967
  props: {
949
968
  boxRendererMatches: {},
@@ -954,85 +973,85 @@ const Ut = async () => {
954
973
  fallbackContentRenderer: { type: [Object, Function] },
955
974
  store: {}
956
975
  },
957
- setup(t) {
958
- const e = t;
959
- de(e.store);
960
- const n = x(() => (e.boxRendererMatches || []).concat(He).sort((r, a) => (r.priority ?? 0) - (a.priority ?? 0))), o = x(() => (e.contentRendererMatches || []).concat(Ke).sort((r, a) => (r.priority ?? 0) - (a.priority ?? 0))), l = x(() => e.fallbackBoxRenderer || Ge), i = x(() => e.fallbackContentRenderer || Ye);
961
- return Mt({
976
+ setup(e) {
977
+ const t = e;
978
+ me(t.store);
979
+ const n = R(() => (t.boxRendererMatches || []).concat(Je).sort((s, l) => (s.priority ?? 0) - (l.priority ?? 0))), o = R(() => (t.contentRendererMatches || []).concat(We).sort((s, l) => (s.priority ?? 0) - (l.priority ?? 0))), r = R(() => t.fallbackBoxRenderer || ze), a = R(() => t.fallbackContentRenderer || Ve);
980
+ return Ut({
962
981
  boxRendererMatches: n,
963
- boxAttributes: () => e.boxAttributes,
964
- fallbackBoxRenderer: l
965
- }), wt({
982
+ boxAttributes: () => t.boxAttributes,
983
+ fallbackBoxRenderer: r
984
+ }), Gt({
966
985
  contentRendererMatches: o,
967
- contentAttributes: () => e.contentAttributes,
968
- fallbackContentRenderer: i
969
- }), (r, a) => C(r.$slots, "default");
986
+ contentAttributes: () => t.contentAttributes,
987
+ fallbackContentRenderer: a
988
+ }), (s, l) => A(s.$slots, "default");
970
989
  }
971
- }), qt = ["innerHTML"], Zt = /* @__PURE__ */ I({
990
+ }), ln = ["innerHTML"], an = /* @__PURE__ */ M({
972
991
  __name: "Markdown",
973
992
  props: {
974
993
  message: {},
975
994
  contentIndex: {}
976
995
  },
977
- setup(t) {
978
- const e = t, { contentText: n } = fe(e), o = M(null);
979
- xe(async () => {
980
- o.value = await Ut();
996
+ setup(e) {
997
+ const t = e, { contentText: n } = ge(t), o = $(null);
998
+ ke(async () => {
999
+ o.value = await Vt();
981
1000
  });
982
- const { mdConfig: l, dompurifyConfig: i } = be(), r = M("");
983
- return ne(() => {
1001
+ const { mdConfig: r, dompurifyConfig: a } = _e(), s = $("");
1002
+ return ae(() => {
984
1003
  if (o.value) {
985
- const { markdown: a, dompurify: u } = o.value, p = a(l || {}).render(n.value);
986
- r.value = u.sanitize(p, i);
1004
+ const { markdown: l, dompurify: u } = o.value, b = l(r || {}).render(n.value);
1005
+ s.value = u.sanitize(b, a);
987
1006
  }
988
- }), (a, u) => r.value ? (v(), E("div", {
1007
+ }), (l, u) => s.value ? (y(), I("div", {
989
1008
  key: 0,
990
1009
  class: "tr-bubble__markdown markdown-body",
991
1010
  "data-type": "markdown",
992
- innerHTML: r.value
993
- }, null, 8, qt)) : (v(), A(ce, P(w({ key: 1 }, e)), null, 16));
1011
+ innerHTML: s.value
1012
+ }, null, 8, ln)) : (y(), N(be, j(P({ key: 1 }, t)), null, 16));
994
1013
  }
995
- }), Qt = /* @__PURE__ */ O(Zt, [["__scopeId", "data-v-eb1c196f"]]), cn = {
996
- Box: le,
997
- Image: Oe,
998
- Loading: Ne,
999
- Markdown: Qt,
1000
- Reasoning: Fe,
1001
- Text: ce,
1002
- Tool: Pe,
1003
- ToolRole: De,
1004
- Tools: Ue
1014
+ }), cn = /* @__PURE__ */ H(an, [["__scopeId", "data-v-eb1c196f"]]), vn = {
1015
+ Box: de,
1016
+ Image: Ue,
1017
+ Loading: He,
1018
+ Markdown: cn,
1019
+ Reasoning: Ke,
1020
+ Text: be,
1021
+ Tool: je,
1022
+ ToolRole: Ge,
1023
+ Tools: Ye
1005
1024
  };
1006
- Y.name = "TrBubble";
1007
- const en = function(t) {
1008
- t.component(Y.name, Y);
1025
+ V.name = "TrBubble";
1026
+ const un = function(e) {
1027
+ e.component(V.name, V);
1009
1028
  };
1010
- Y.install = en;
1011
- const un = Y;
1012
- X.name = "TrBubbleList";
1013
- const tn = function(t) {
1014
- t.component(X.name, X);
1029
+ V.install = un;
1030
+ const hn = V;
1031
+ te.name = "TrBubbleList";
1032
+ const dn = function(e) {
1033
+ e.component(te.name, te);
1015
1034
  };
1016
- X.install = tn;
1017
- const dn = X;
1018
- q.name = "TrBubbleProvider";
1019
- const nn = function(t) {
1020
- t.component(q.name, q);
1035
+ te.install = dn;
1036
+ const yn = te;
1037
+ ne.name = "TrBubbleProvider";
1038
+ const bn = function(e) {
1039
+ e.component(ne.name, ne);
1021
1040
  };
1022
- q.install = nn;
1023
- const bn = q;
1041
+ ne.install = bn;
1042
+ const xn = ne;
1024
1043
  export {
1025
- un as B,
1026
- dn as a,
1027
- bn as b,
1028
- K as c,
1029
- cn as d,
1030
- $t as e,
1031
- ue as f,
1032
- ie as g,
1033
- ln as h,
1034
- fe as i,
1035
- je as j,
1036
- Ht as k,
1037
- rt as u
1044
+ hn as B,
1045
+ yn as a,
1046
+ xn as b,
1047
+ J as c,
1048
+ vn as d,
1049
+ Kt as e,
1050
+ fe as f,
1051
+ pe as g,
1052
+ gn as h,
1053
+ ge as i,
1054
+ qe as j,
1055
+ Xt as k,
1056
+ bt as u
1038
1057
  };