super-agent-sdk 1.0.9 → 1.0.10

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/widget.mjs CHANGED
@@ -1,299 +1,299 @@
1
- import Q, { useState as E, useRef as R, useCallback as N, useEffect as P, createContext as je, useMemo as re, useContext as Pe } from "react";
2
- import { createRoot as We } from "react-dom/client";
3
- import { jsx as e, jsxs as c, Fragment as V } from "react/jsx-runtime";
4
- function Ye(t) {
5
- const { sdk: a, sessionId: n, onSessionCreated: s, onStreamStart: r, onStreamEnd: i, onError: o, onMessageSend: l } = t, [d, p] = E([]), [u, g] = E("ready"), [b, m] = E(null), x = R(null), f = R(!1), y = R(null), z = R(n), H = R(!0);
6
- z.current = n, H.current = d.length === 0;
7
- const k = N((w) => {
8
- if (f.current) return;
9
- f.current = !0, l == null || l(w);
10
- const M = {
1
+ import Q, { useState as E, useRef as _, useCallback as k, useEffect as j, createContext as Ve, useMemo as re, useContext as Ke, isValidElement as qe, cloneElement as Ze, createElement as Je } from "react";
2
+ import { createRoot as Qe } from "react-dom/client";
3
+ import { jsx as e, jsxs as g, Fragment as K } from "react/jsx-runtime";
4
+ function et(t) {
5
+ const { sdk: a, sessionId: n, onSessionCreated: s, onStreamStart: r, onStreamEnd: i, onError: d, onMessageSend: o } = t, [l, c] = E([]), [f, h] = E("ready"), [x, b] = E(null), y = _(null), p = _(!1), m = _(null), C = _(n), A = _(!0);
6
+ C.current = n, A.current = l.length === 0;
7
+ const v = k((w) => {
8
+ if (p.current) return;
9
+ p.current = !0, o == null || o(w);
10
+ const I = {
11
11
  id: `user_${Date.now()}`,
12
12
  role: "user",
13
13
  parts: [{ type: "text", content: w }],
14
14
  timestamp: Date.now()
15
- }, $ = `assistant_${Date.now()}`, L = {
16
- id: $,
15
+ }, L = `assistant_${Date.now()}`, R = {
16
+ id: L,
17
17
  role: "assistant",
18
18
  parts: [],
19
19
  timestamp: Date.now()
20
- }, v = H.current;
21
- p((I) => [...I, M, L]), g("submitted"), m(null);
22
- const A = (I) => {
23
- let F = "", h = "", _ = [], O = !1;
24
- const W = () => {
25
- const T = [..._];
26
- if (F) {
27
- const Y = T.findIndex((j) => j.type === "thinking");
28
- Y >= 0 ? T[Y] = { type: "thinking", content: F } : T.unshift({ type: "thinking", content: F });
20
+ }, F = A.current;
21
+ c((D) => [...D, I, R]), h("submitted"), b(null);
22
+ const P = (D) => {
23
+ let S = "", u = "", T = [], B = !1;
24
+ const O = () => {
25
+ const z = [...T];
26
+ if (S) {
27
+ const Y = z.findIndex((W) => W.type === "thinking");
28
+ Y >= 0 ? z[Y] = { type: "thinking", content: S } : z.unshift({ type: "thinking", content: S });
29
29
  }
30
- if (h) {
31
- const Y = T[T.length - 1];
32
- (Y == null ? void 0 : Y.type) === "text" ? T[T.length - 1] = { type: "text", content: h } : T.push({ type: "text", content: h });
30
+ if (u) {
31
+ const Y = z[z.length - 1];
32
+ (Y == null ? void 0 : Y.type) === "text" ? z[z.length - 1] = { type: "text", content: u } : z.push({ type: "text", content: u });
33
33
  }
34
- p(
35
- (Y) => Y.map((j) => j.id === $ ? { ...j, parts: T } : j)
34
+ c(
35
+ (Y) => Y.map((W) => W.id === L ? { ...W, parts: z } : W)
36
36
  );
37
37
  };
38
- x.current = a.chat({
39
- sessionId: I,
38
+ y.current = a.chat({
39
+ sessionId: D,
40
40
  message: w,
41
41
  stream: !0,
42
- onMessage: (T) => {
43
- switch (O || (O = !0, g("streaming")), T.type) {
42
+ onMessage: (z) => {
43
+ switch (B || (B = !0, h("streaming")), z.type) {
44
44
  case "thinking":
45
- F += T.content;
45
+ S += z.content;
46
46
  break;
47
47
  case "ai":
48
- h += T.content;
48
+ u += z.content;
49
49
  break;
50
50
  case "tool_call":
51
- h && (_.push({ type: "text", content: h }), h = ""), _.push({
51
+ u && (T.push({ type: "text", content: u }), u = ""), T.push({
52
52
  type: "tool_call",
53
- toolName: T.toolName,
54
- toolCallId: T.toolCallId,
55
- args: T.args ?? "{}"
53
+ toolName: z.toolName,
54
+ toolCallId: z.toolCallId,
55
+ args: z.args ?? "{}"
56
56
  });
57
57
  break;
58
58
  case "tool_result":
59
- h && (_.push({ type: "text", content: h }), h = ""), _.push({
59
+ u && (T.push({ type: "text", content: u }), u = ""), T.push({
60
60
  type: "tool_result",
61
- toolName: T.toolName ?? "",
62
- toolCallId: T.toolCallId,
63
- content: T.content,
64
- artifacts: T.artifacts,
65
- renderMode: T.renderMode,
66
- html: T.html
61
+ toolName: z.toolName ?? "",
62
+ toolCallId: z.toolCallId,
63
+ content: z.content,
64
+ artifacts: z.artifacts,
65
+ renderMode: z.renderMode,
66
+ html: z.html
67
67
  });
68
68
  break;
69
69
  case "interrupt":
70
- h && (_.push({ type: "text", content: h }), h = ""), T.interrupt && _.push({
70
+ u && (T.push({ type: "text", content: u }), u = ""), z.interrupt && T.push({
71
71
  type: "interrupt",
72
- interrupt: T.interrupt,
72
+ interrupt: z.interrupt,
73
73
  resolved: !1
74
74
  });
75
75
  break;
76
76
  case "stop":
77
- T.content && (h = T.content), W();
77
+ z.content && (u = z.content), O();
78
78
  return;
79
79
  }
80
- W();
80
+ O();
81
81
  },
82
- onDone: (T) => {
83
- (h || _.length > 0 || F) && W(), T.sessionId && T.sessionId !== z.current && (s == null || s(T.sessionId));
82
+ onDone: (z) => {
83
+ (u || T.length > 0 || S) && O(), z.sessionId && z.sessionId !== C.current && (s == null || s(z.sessionId));
84
84
  const Y = () => {
85
- y.current && (clearTimeout(y.current), y.current = null), i == null || i(T.sessionId || I), g("ready"), f.current = !1, x.current = null;
85
+ m.current && (clearTimeout(m.current), m.current = null), i == null || i(z.sessionId || D), h("ready"), p.current = !1, y.current = null;
86
86
  };
87
- if (v) {
88
- const j = w.slice(0, 30), q = T.sessionId || I;
89
- a.renameConversation(q, j).catch(() => {
87
+ if (F) {
88
+ const W = w.slice(0, 30), V = z.sessionId || D;
89
+ a.renameConversation(V, W).catch(() => {
90
90
  }).finally(Y);
91
91
  } else
92
92
  Y();
93
93
  },
94
- onError: (T) => {
95
- _.push({ type: "error", content: T.message }), W(), y.current && (clearTimeout(y.current), y.current = null), m(T), g("error"), o == null || o(T), f.current = !1, x.current = null;
94
+ onError: (z) => {
95
+ T.push({ type: "error", content: z.message }), O(), m.current && (clearTimeout(m.current), m.current = null), b(z), h("error"), d == null || d(z), p.current = !1, y.current = null;
96
96
  }
97
- }), r == null || r(I);
97
+ }), r == null || r(D);
98
98
  };
99
- z.current ? A(z.current) : a.createSession().then((I) => {
100
- z.current = I, s == null || s(I), A(I);
101
- }).catch((I) => {
102
- m(I instanceof Error ? I : new Error(String(I))), g("error"), o == null || o(I instanceof Error ? I : new Error(String(I))), f.current = !1;
99
+ C.current ? P(C.current) : a.createSession().then((D) => {
100
+ C.current = D, s == null || s(D), P(D);
101
+ }).catch((D) => {
102
+ b(D instanceof Error ? D : new Error(String(D))), h("error"), d == null || d(D instanceof Error ? D : new Error(String(D))), p.current = !1;
103
103
  });
104
- }, [a, s, r, i, o, l]), C = N(() => {
105
- const w = z.current;
106
- w && (y.current && clearTimeout(y.current), y.current = setTimeout(() => {
107
- var M;
108
- y.current = null, (M = x.current) == null || M.abort(), x.current = null, f.current = !1, g("ready");
104
+ }, [a, s, r, i, d, o]), N = k(() => {
105
+ const w = C.current;
106
+ w && (m.current && clearTimeout(m.current), m.current = setTimeout(() => {
107
+ var I;
108
+ m.current = null, (I = y.current) == null || I.abort(), y.current = null, p.current = !1, h("ready");
109
109
  }, 8e3), a.stopGeneration(w).catch(() => {
110
110
  }));
111
- }, [a]), S = N(() => {
112
- if (f.current) return;
113
- const w = d.findLastIndex(($) => $.role === "user");
111
+ }, [a]), $ = k(() => {
112
+ if (p.current) return;
113
+ const w = l.findLastIndex((L) => L.role === "user");
114
114
  if (w < 0) return;
115
- const M = d[w].parts.filter(($) => $.type === "text").map(($) => $.content).join("");
116
- p(($) => $.slice(0, w)), k(M);
117
- }, [d, k]), D = N((w, M) => {
118
- p(
119
- (h) => h.map((_) => ({
120
- ..._,
121
- parts: _.parts.map(
122
- (O) => O.type === "interrupt" && O.interrupt.interruptId === w ? { ...O, resolved: !0, response: M } : O
115
+ const I = l[w].parts.filter((L) => L.type === "text").map((L) => L.content).join("");
116
+ c((L) => L.slice(0, w)), v(I);
117
+ }, [l, v]), M = k((w, I) => {
118
+ c(
119
+ (u) => u.map((T) => ({
120
+ ...T,
121
+ parts: T.parts.map(
122
+ (B) => B.type === "interrupt" && B.interrupt.interruptId === w ? { ...B, resolved: !0, response: I } : B
123
123
  )
124
124
  }))
125
125
  );
126
- const $ = z.current;
127
- if (!$) return;
128
- let L = 0;
129
- p((h) => h.length > 0 && h[h.length - 1].role === "assistant" ? (L = h[h.length - 1].parts.length, h) : (L = 0, [...h, { id: `assistant_${Date.now()}`, role: "assistant", parts: [], timestamp: Date.now() }])), g("streaming");
130
- let v = "", A = "", I = [];
131
- const F = () => {
132
- const h = [...I];
133
- if (v) {
134
- const _ = h.findIndex((O) => O.type === "thinking");
135
- _ >= 0 ? h[_] = { type: "thinking", content: v } : h.unshift({ type: "thinking", content: v });
126
+ const L = C.current;
127
+ if (!L) return;
128
+ let R = 0;
129
+ c((u) => u.length > 0 && u[u.length - 1].role === "assistant" ? (R = u[u.length - 1].parts.length, u) : (R = 0, [...u, { id: `assistant_${Date.now()}`, role: "assistant", parts: [], timestamp: Date.now() }])), h("streaming");
130
+ let F = "", P = "", D = [];
131
+ const S = () => {
132
+ const u = [...D];
133
+ if (F) {
134
+ const T = u.findIndex((B) => B.type === "thinking");
135
+ T >= 0 ? u[T] = { type: "thinking", content: F } : u.unshift({ type: "thinking", content: F });
136
136
  }
137
- if (A) {
138
- const _ = h[h.length - 1];
139
- (_ == null ? void 0 : _.type) === "text" ? h[h.length - 1] = { type: "text", content: A } : h.push({ type: "text", content: A });
137
+ if (P) {
138
+ const T = u[u.length - 1];
139
+ (T == null ? void 0 : T.type) === "text" ? u[u.length - 1] = { type: "text", content: P } : u.push({ type: "text", content: P });
140
140
  }
141
- p((_) => {
142
- const O = _.findLastIndex((W) => W.role === "assistant");
143
- return O < 0 ? _ : _.map(
144
- (W, T) => T === O ? { ...W, parts: [...W.parts.slice(0, L), ...h] } : W
141
+ c((T) => {
142
+ const B = T.findLastIndex((O) => O.role === "assistant");
143
+ return B < 0 ? T : T.map(
144
+ (O, z) => z === B ? { ...O, parts: [...O.parts.slice(0, R), ...u] } : O
145
145
  );
146
146
  });
147
147
  };
148
148
  a.respondInterrupt(
149
149
  w,
150
- $,
151
- M,
152
- (h) => {
153
- switch (h.type) {
150
+ L,
151
+ I,
152
+ (u) => {
153
+ switch (u.type) {
154
154
  case "thinking":
155
- v += h.content;
155
+ F += u.content;
156
156
  break;
157
157
  case "ai":
158
- A += h.content;
158
+ P += u.content;
159
159
  break;
160
160
  case "tool_call":
161
- A && (I.push({ type: "text", content: A }), A = ""), I.push({
161
+ P && (D.push({ type: "text", content: P }), P = ""), D.push({
162
162
  type: "tool_call",
163
- toolName: h.toolName,
164
- toolCallId: h.toolCallId,
165
- args: h.args ?? "{}"
163
+ toolName: u.toolName,
164
+ toolCallId: u.toolCallId,
165
+ args: u.args ?? "{}"
166
166
  });
167
167
  break;
168
168
  case "tool_result":
169
- A && (I.push({ type: "text", content: A }), A = ""), I.push({
169
+ P && (D.push({ type: "text", content: P }), P = ""), D.push({
170
170
  type: "tool_result",
171
- toolName: h.toolName ?? "",
172
- toolCallId: h.toolCallId,
173
- content: h.content,
174
- artifacts: h.artifacts,
175
- renderMode: h.renderMode,
176
- html: h.html
171
+ toolName: u.toolName ?? "",
172
+ toolCallId: u.toolCallId,
173
+ content: u.content,
174
+ artifacts: u.artifacts,
175
+ renderMode: u.renderMode,
176
+ html: u.html
177
177
  });
178
178
  break;
179
179
  case "interrupt":
180
- A && (I.push({ type: "text", content: A }), A = ""), h.interrupt && I.push({ type: "interrupt", interrupt: h.interrupt, resolved: !1 });
180
+ P && (D.push({ type: "text", content: P }), P = ""), u.interrupt && D.push({ type: "interrupt", interrupt: u.interrupt, resolved: !1 });
181
181
  break;
182
182
  case "done":
183
- i == null || i($), g("ready");
183
+ i == null || i(L), h("ready");
184
184
  break;
185
185
  }
186
- F();
186
+ S();
187
187
  },
188
- (h) => {
189
- I.push({ type: "error", content: h.message }), F(), m(h), g("error"), o == null || o(h);
188
+ (u) => {
189
+ D.push({ type: "error", content: u.message }), S(), b(u), h("error"), d == null || d(u);
190
190
  }
191
- ).catch((h) => {
192
- o == null || o(h instanceof Error ? h : new Error(String(h))), g("error");
191
+ ).catch((u) => {
192
+ d == null || d(u instanceof Error ? u : new Error(String(u))), h("error");
193
193
  });
194
- }, [a, o, i]);
195
- return { messages: d, status: u, error: b, sendMessage: k, stop: C, regenerate: S, setMessages: p, respondToInterrupt: D };
194
+ }, [a, d, i]);
195
+ return { messages: l, status: f, error: x, sendMessage: v, stop: N, regenerate: $, setMessages: c, respondToInterrupt: M };
196
196
  }
197
- const Te = "sa_active_conversation", de = 20;
198
- function ve(t) {
197
+ const $e = "sa_active_conversation", ue = 20;
198
+ function ze(t) {
199
199
  try {
200
- return localStorage.getItem(`${Te}_${t}`);
200
+ return localStorage.getItem(`${$e}_${t}`);
201
201
  } catch {
202
202
  return null;
203
203
  }
204
204
  }
205
- function Ge(t, a) {
205
+ function tt(t, a) {
206
206
  try {
207
- const n = `${Te}_${t}`;
207
+ const n = `${$e}_${t}`;
208
208
  a ? localStorage.setItem(n, a) : localStorage.removeItem(n);
209
209
  } catch {
210
210
  }
211
211
  }
212
- function Xe(t) {
213
- const { sdk: a, onConversationChange: n } = t, s = a.botId, [r, i] = E([]), [o, l] = E(
214
- () => ve(s)
215
- ), [d, p] = E(!1), [u, g] = E(!0), b = R(!0), m = R(1), x = R(!1);
216
- P(() => () => {
217
- b.current = !1;
212
+ function at(t) {
213
+ const { sdk: a, onConversationChange: n } = t, s = a.botId, [r, i] = E([]), [d, o] = E(
214
+ () => ze(s)
215
+ ), [l, c] = E(!1), [f, h] = E(!0), x = _(!0), b = _(1), y = _(!1);
216
+ j(() => () => {
217
+ x.current = !1;
218
218
  }, []);
219
- const f = N((w) => {
220
- l(w), Ge(s, w), w && (n == null || n(w));
221
- }, [s, n]), y = N(async () => {
222
- if (!x.current) {
223
- x.current = !0, p(!0);
219
+ const p = k((w) => {
220
+ o(w), tt(s, w), w && (n == null || n(w));
221
+ }, [s, n]), m = k(async () => {
222
+ if (!y.current) {
223
+ y.current = !0, c(!0);
224
224
  try {
225
- m.current = 1;
226
- const w = await a.listConversations({ page: 1, size: de });
227
- if (!b.current) return;
228
- i(w.items), g(w.items.length < w.total);
229
- const M = ve(s);
230
- M && !w.items.find(($) => $.sessionId === M) && f(null);
225
+ b.current = 1;
226
+ const w = await a.listConversations({ page: 1, size: ue });
227
+ if (!x.current) return;
228
+ i(w.items), h(w.items.length < w.total);
229
+ const I = ze(s);
230
+ I && !w.items.find((L) => L.sessionId === I) && p(null);
231
231
  } catch {
232
232
  } finally {
233
- x.current = !1, b.current && p(!1);
233
+ y.current = !1, x.current && c(!1);
234
234
  }
235
235
  }
236
- }, [a, f]), z = N(async () => {
237
- if (!(x.current || !u)) {
238
- x.current = !0, p(!0);
236
+ }, [a, p]), C = k(async () => {
237
+ if (!(y.current || !f)) {
238
+ y.current = !0, c(!0);
239
239
  try {
240
- const w = m.current + 1, M = await a.listConversations({ page: w, size: de });
241
- if (!b.current) return;
242
- m.current = w, i((L) => {
243
- const v = new Set(L.map((I) => I.sessionId)), A = M.items.filter((I) => !v.has(I.sessionId));
244
- return [...L, ...A];
240
+ const w = b.current + 1, I = await a.listConversations({ page: w, size: ue });
241
+ if (!x.current) return;
242
+ b.current = w, i((R) => {
243
+ const F = new Set(R.map((D) => D.sessionId)), P = I.items.filter((D) => !F.has(D.sessionId));
244
+ return [...R, ...P];
245
245
  });
246
- const $ = m.current * de;
247
- g($ < M.total);
246
+ const L = b.current * ue;
247
+ h(L < I.total);
248
248
  } catch {
249
249
  } finally {
250
- x.current = !1, b.current && p(!1);
250
+ y.current = !1, x.current && c(!1);
251
251
  }
252
252
  }
253
- }, [a, u]), H = N(async (w) => (f(w), await a.getMessages(w)), [a, f]), k = N(async () => {
253
+ }, [a, f]), A = k(async (w) => (p(w), await a.getMessages(w)), [a, p]), v = k(async () => {
254
254
  try {
255
- const w = await a.createSession(), M = (/* @__PURE__ */ new Date()).toISOString();
256
- i(($) => [
257
- { sessionId: w, botId: 0, title: "新对话", createTime: M, updateTime: M },
258
- ...$
259
- ]), f(w);
255
+ const w = await a.createSession(), I = (/* @__PURE__ */ new Date()).toISOString();
256
+ i((L) => [
257
+ { sessionId: w, botId: 0, title: "新对话", createTime: I, updateTime: I },
258
+ ...L
259
+ ]), p(w);
260
260
  } catch {
261
- f(null);
261
+ p(null);
262
262
  }
263
- }, [a, f]), C = N(async (w) => {
264
- i((M) => M.filter(($) => $.sessionId !== w)), o === w && f(null);
263
+ }, [a, p]), N = k(async (w) => {
264
+ i((I) => I.filter((L) => L.sessionId !== w)), d === w && p(null);
265
265
  try {
266
266
  await a.deleteConversation(w);
267
267
  } catch {
268
268
  }
269
- }, [a, o, f]), S = N(async (w, M) => {
270
- await a.renameConversation(w, M), i(
271
- ($) => $.map((L) => L.sessionId === w ? { ...L, title: M } : L)
269
+ }, [a, d, p]), $ = k(async (w, I) => {
270
+ await a.renameConversation(w, I), i(
271
+ (L) => L.map((R) => R.sessionId === w ? { ...R, title: I } : R)
272
272
  );
273
- }, [a]), { enabled: D = !0 } = t;
274
- return P(() => {
275
- D && y();
276
- }, [D, y]), {
273
+ }, [a]), { enabled: M = !0 } = t;
274
+ return j(() => {
275
+ M && m();
276
+ }, [M, m]), {
277
277
  conversations: r,
278
- activeConversationId: o,
279
- loading: d,
280
- hasMore: u,
281
- loadConversations: y,
282
- loadMore: z,
283
- switchConversation: H,
284
- newConversation: k,
285
- deleteConversation: C,
286
- renameConversation: S,
287
- setActiveConversationId: f
278
+ activeConversationId: d,
279
+ loading: l,
280
+ hasMore: f,
281
+ loadConversations: m,
282
+ loadMore: C,
283
+ switchConversation: A,
284
+ newConversation: v,
285
+ deleteConversation: N,
286
+ renameConversation: $,
287
+ setActiveConversationId: p
288
288
  };
289
289
  }
290
- function Me(t) {
290
+ function De(t) {
291
291
  return !t && t !== 0 ? "" : t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / 1024 / 1024).toFixed(1)} MB`;
292
292
  }
293
- function Ee(t) {
293
+ function Le(t) {
294
294
  return t === "pdf" ? "PDF" : t === "docx" ? "DOC" : t === "html" ? "HTM" : t.slice(0, 3).toUpperCase() || "FILE";
295
295
  }
296
- function Se(t) {
296
+ function Re(t) {
297
297
  if (!t) return [];
298
298
  const a = [];
299
299
  for (const n of t)
@@ -308,7 +308,7 @@ function Se(t) {
308
308
  });
309
309
  return a;
310
310
  }
311
- async function ie(t) {
311
+ async function de(t) {
312
312
  try {
313
313
  const a = await fetch(t.url);
314
314
  if (!a.ok) throw new Error(`HTTP ${a.status}`);
@@ -319,168 +319,180 @@ async function ie(t) {
319
319
  a.href = t.url, a.download = t.filename, a.target = "_blank", document.body.appendChild(a), a.click(), a.remove();
320
320
  }
321
321
  }
322
- const Ae = je(null);
323
- function Z() {
324
- const t = Pe(Ae);
322
+ const _e = Ve(null);
323
+ function J() {
324
+ const t = Ke(_e);
325
325
  if (!t) throw new Error("useChatContext must be used within ChatProvider");
326
326
  return t;
327
327
  }
328
- function ye({ sdk: t, hooks: a, children: n }) {
329
- const [s, r] = E(!1), [i, o] = E(!1), [l, d] = E(null), [p, u] = E(!1), [g, b] = E(!1);
330
- P(() => {
328
+ function Te({ sdk: t, hooks: a, children: n }) {
329
+ const [s, r] = E(!1), [i, d] = E(!1), [o, l] = E(null), [c, f] = E(null), [h, x] = E(!1), [b, y] = E(!1);
330
+ j(() => {
331
331
  t.getToken().then(() => {
332
- u(!0);
332
+ x(!0);
333
333
  }).catch(() => {
334
- u(!0);
334
+ x(!0);
335
335
  });
336
336
  }, [t]);
337
- const m = Xe({
337
+ const p = at({
338
338
  sdk: t,
339
339
  onConversationChange: a == null ? void 0 : a.onConversationChange,
340
- enabled: p
341
- }), x = Ye({
340
+ enabled: h
341
+ }), m = et({
342
342
  sdk: t,
343
- sessionId: m.activeConversationId,
344
- onSessionCreated: (v) => {
345
- m.setActiveConversationId(v);
343
+ sessionId: p.activeConversationId,
344
+ onSessionCreated: (u) => {
345
+ p.setActiveConversationId(u);
346
346
  },
347
347
  onStreamStart: a == null ? void 0 : a.onStreamStart,
348
- onStreamEnd: (v) => {
349
- var A;
350
- (A = a == null ? void 0 : a.onStreamEnd) == null || A.call(a, v), m.loadConversations();
348
+ onStreamEnd: (u) => {
349
+ var T;
350
+ (T = a == null ? void 0 : a.onStreamEnd) == null || T.call(a, u), p.loadConversations();
351
351
  },
352
352
  onError: a == null ? void 0 : a.onError,
353
353
  onMessageSend: a == null ? void 0 : a.onMessageSend
354
- }), f = N(async (v) => {
355
- b(!0);
354
+ }), C = k((u) => {
355
+ if (u.type === "link") {
356
+ window.open(u.url, u.target ?? "_blank", "noopener");
357
+ return;
358
+ }
359
+ f(u);
360
+ }, []), A = k(() => f(null), []), v = k(async (u) => {
361
+ y(!0);
356
362
  try {
357
- const A = await m.switchConversation(v);
358
- x.setMessages(A);
363
+ const T = await p.switchConversation(u);
364
+ m.setMessages(T);
359
365
  } finally {
360
- b(!1);
366
+ y(!1);
361
367
  }
362
- }, [m, x]), y = N(async () => {
363
- x.setMessages([]), await m.newConversation();
364
- }, [m, x]), z = N(async (v) => {
365
- m.activeConversationId === v && x.setMessages([]), await m.deleteConversation(v);
366
- }, [m, x]);
367
- P(() => {
368
- m.activeConversationId && x.messages.length === 0 && (b(!0), t.getMessages(m.activeConversationId).then((v) => {
369
- x.setMessages(v);
368
+ }, [p, m]), N = k(async () => {
369
+ m.setMessages([]), await p.newConversation();
370
+ }, [p, m]), $ = k(async (u) => {
371
+ p.activeConversationId === u && m.setMessages([]), await p.deleteConversation(u);
372
+ }, [p, m]);
373
+ j(() => {
374
+ p.activeConversationId && m.messages.length === 0 && (y(!0), t.getMessages(p.activeConversationId).then((u) => {
375
+ m.setMessages(u);
370
376
  }).catch(() => {
371
- }).finally(() => b(!1)));
377
+ }).finally(() => y(!1)));
372
378
  }, []);
373
- const H = N(() => {
374
- r((v) => !v);
375
- }, []), k = N((v) => {
376
- r(v);
377
- }, []), C = N(() => {
378
- o((v) => !v), d((v) => null);
379
- }, []), S = N((v) => {
380
- d(v), o(!0);
381
- }, []), D = re(() => {
382
- const v = /* @__PURE__ */ new Set(), A = [];
383
- for (const I of x.messages)
384
- for (const F of I.parts)
385
- if (F.type === "tool_result" && F.artifacts)
386
- for (const h of Se(F.artifacts)) {
387
- const _ = h.id || `${h.url}:${h.filename}`;
388
- v.has(_) || (v.add(_), A.push(h));
379
+ const M = k(() => {
380
+ r((u) => !u);
381
+ }, []), w = k((u) => {
382
+ r(u);
383
+ }, []), I = k(() => {
384
+ d((u) => !u), l((u) => null);
385
+ }, []), L = k((u) => {
386
+ l(u), d(!0);
387
+ }, []), R = re(() => {
388
+ const u = /* @__PURE__ */ new Set(), T = [];
389
+ for (const B of m.messages)
390
+ for (const O of B.parts)
391
+ if (O.type === "tool_result" && O.artifacts)
392
+ for (const z of Re(O.artifacts)) {
393
+ const Y = z.id || `${z.url}:${z.filename}`;
394
+ u.has(Y) || (u.add(Y), T.push(z));
389
395
  }
390
- return A;
391
- }, [x.messages]), w = N(async () => {
392
- const v = m.activeConversationId;
393
- if (!v) return null;
396
+ return T;
397
+ }, [m.messages]), F = k(async () => {
398
+ const u = p.activeConversationId;
399
+ if (!u) return null;
394
400
  try {
395
- const A = await t.getMessages(v);
396
- x.setMessages(A);
397
- const I = A.findLast((F) => F.role === "assistant");
398
- return (I == null ? void 0 : I.id) ?? null;
401
+ const T = await t.getMessages(u);
402
+ m.setMessages(T);
403
+ const B = T.findLast((O) => O.role === "assistant");
404
+ return (B == null ? void 0 : B.id) ?? null;
399
405
  } catch {
400
406
  return null;
401
407
  }
402
- }, [t, m.activeConversationId, x]), M = N((v, A, I) => {
403
- if (/^\d+$/.test(v)) {
404
- t.feedback(v, A, I).catch(() => {
408
+ }, [t, p.activeConversationId, m]), P = k((u, T, B) => {
409
+ if (/^\d+$/.test(u)) {
410
+ t.feedback(u, T, B).catch(() => {
405
411
  });
406
412
  return;
407
413
  }
408
- w().then((F) => {
409
- F && t.feedback(F, A, I).catch(() => {
414
+ F().then((O) => {
415
+ O && t.feedback(O, T, B).catch(() => {
410
416
  });
411
417
  });
412
- }, [t, w]), $ = N((v) => {
413
- if (/^\d+$/.test(v)) {
414
- t.cancelFeedback(v).catch(() => {
418
+ }, [t, F]), D = k((u) => {
419
+ if (/^\d+$/.test(u)) {
420
+ t.cancelFeedback(u).catch(() => {
415
421
  });
416
422
  return;
417
423
  }
418
- w().then((A) => {
419
- A && t.cancelFeedback(A).catch(() => {
424
+ F().then((T) => {
425
+ T && t.cancelFeedback(T).catch(() => {
420
426
  });
421
427
  });
422
- }, [t, w]), L = re(() => ({
428
+ }, [t, F]), S = re(() => ({
423
429
  sdk: t,
424
- status: x.status,
425
- error: x.error,
426
- messages: x.messages,
427
- conversations: m.conversations,
428
- activeConversationId: m.activeConversationId,
430
+ status: m.status,
431
+ error: m.error,
432
+ messages: m.messages,
433
+ conversations: p.conversations,
434
+ activeConversationId: p.activeConversationId,
429
435
  isThreadListOpen: s,
430
436
  isArtifactDrawerOpen: i,
431
- allArtifacts: D,
432
- activePreviewArtifact: l,
433
- hasMore: m.hasMore,
434
- conversationsLoading: m.loading,
435
- messagesLoading: g,
436
- sendMessage: x.sendMessage,
437
- stop: x.stop,
438
- regenerate: x.regenerate,
439
- switchConversation: f,
440
- newConversation: y,
441
- deleteConversation: z,
442
- renameConversation: m.renameConversation,
443
- loadMoreConversations: m.loadMore,
444
- toggleThreadList: H,
445
- setThreadListOpen: k,
446
- toggleArtifactDrawer: C,
447
- openArtifactPreview: S,
448
- feedback: M,
449
- cancelFeedback: $,
450
- respondToInterrupt: x.respondToInterrupt
437
+ allArtifacts: R,
438
+ activePreviewArtifact: o,
439
+ activePanel: c,
440
+ hasMore: p.hasMore,
441
+ conversationsLoading: p.loading,
442
+ messagesLoading: b,
443
+ sendMessage: m.sendMessage,
444
+ stop: m.stop,
445
+ regenerate: m.regenerate,
446
+ switchConversation: v,
447
+ newConversation: N,
448
+ deleteConversation: $,
449
+ renameConversation: p.renameConversation,
450
+ loadMoreConversations: p.loadMore,
451
+ toggleThreadList: M,
452
+ setThreadListOpen: w,
453
+ toggleArtifactDrawer: I,
454
+ openArtifactPreview: L,
455
+ openPanel: C,
456
+ closePanel: A,
457
+ feedback: P,
458
+ cancelFeedback: D,
459
+ respondToInterrupt: m.respondToInterrupt
451
460
  }), [
452
461
  t,
453
- x.status,
454
- x.error,
455
- x.messages,
456
- x.sendMessage,
457
- x.stop,
458
- x.regenerate,
459
- x.respondToInterrupt,
460
- m.conversations,
461
- m.activeConversationId,
462
- m.renameConversation,
463
- m.hasMore,
464
- m.loadMore,
465
- m.loading,
462
+ m.status,
463
+ m.error,
464
+ m.messages,
465
+ m.sendMessage,
466
+ m.stop,
467
+ m.regenerate,
468
+ m.respondToInterrupt,
469
+ p.conversations,
470
+ p.activeConversationId,
471
+ p.renameConversation,
472
+ p.hasMore,
473
+ p.loadMore,
474
+ p.loading,
466
475
  s,
467
476
  i,
468
- D,
469
- l,
470
- g,
471
- f,
472
- y,
473
- z,
474
- H,
475
- k,
476
- C,
477
- S,
477
+ R,
478
+ o,
479
+ c,
480
+ b,
481
+ v,
482
+ N,
483
+ $,
478
484
  M,
479
- $
485
+ w,
486
+ I,
487
+ L,
488
+ C,
489
+ A,
490
+ P,
491
+ D
480
492
  ]);
481
- return /* @__PURE__ */ e(Ae.Provider, { value: L, children: n });
493
+ return /* @__PURE__ */ e(_e.Provider, { value: S, children: n });
482
494
  }
483
- const G = "https://ehr-web.netease.com/ehr-web/erh-super-agent", X = {
495
+ const G = "https://ehr-web.netease.com/ehr-web/erh-super-agent", U = {
484
496
  recently: `${G}/recently.svg`,
485
497
  home: `${G}/home.svg`,
486
498
  mergeWindow: `${G}/merge_window.svg`,
@@ -499,7 +511,7 @@ const G = "https://ehr-web.netease.com/ehr-web/erh-super-agent", X = {
499
511
  logo: `${G}/HRlogo2.png`,
500
512
  assistantAvatarGenerating: `${G}/profile0.gif`,
501
513
  assistantAvatar: `${G}/profile1.png`
502
- }, U = {
514
+ }, X = {
503
515
  TRIGGER_SIZE: 56,
504
516
  TRIGGER_RIGHT: 20,
505
517
  TRIGGER_BOTTOM: 80,
@@ -510,123 +522,156 @@ const G = "https://ehr-web.netease.com/ehr-web/erh-super-agent", X = {
510
522
  /** 高度上限占视口比例(渲染钳制与默认定位统一使用) */
511
523
  MAX_HEIGHT_RATIO: 0.95
512
524
  };
513
- function Ue({ defaultWidth: t = U.DEFAULT_WIDTH, defaultHeight: a = U.DEFAULT_HEIGHT, sidebarWidth: n = 0 } = {}) {
514
- const [s, r] = E(t), [i, o] = E({ x: 0, y: 0 }), [l, d] = E(!1), [p, u] = E(!1), [g, b] = E(null), [m, x] = E(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), f = R(!1), y = R(0), z = R(s), H = R("right"), k = R(!1), C = R({ x: 0, y: 0 }), S = R({ x: 0, y: 0 }), D = R(!1), w = R(null);
515
- P(() => {
516
- const h = () => x({ width: window.innerWidth, height: window.innerHeight });
517
- return window.addEventListener("resize", h), () => window.removeEventListener("resize", h);
518
- }, []), P(() => () => {
519
- var h;
520
- (h = w.current) == null || h.call(w);
525
+ function rt({ defaultWidth: t = X.DEFAULT_WIDTH, defaultHeight: a = X.DEFAULT_HEIGHT, sidebarWidth: n = 0 } = {}) {
526
+ const [s, r] = E(t), [i, d] = E({ x: 0, y: 0 }), [o, l] = E(!1), [c, f] = E(!1), [h, x] = E(null), [b, y] = E(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), p = _(!1), m = _(0), C = _(s), A = _(!1), v = _({ x: 0, y: 0 }), N = _({ x: 0, y: 0 }), $ = _(!1), M = _(null);
527
+ j(() => {
528
+ const S = () => y({ width: window.innerWidth, height: window.innerHeight });
529
+ return window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
530
+ }, []), j(() => () => {
531
+ var S;
532
+ (S = M.current) == null || S.call(M);
521
533
  }, []);
522
- const M = Math.floor(m.height * U.MAX_HEIGHT_RATIO), $ = Math.min(g || a, M), L = s + n;
523
- P(() => {
524
- if (!l) {
525
- const h = m.width - L - 20, _ = m.height - $ - 20;
526
- o((O) => O.x === h && O.y === _ ? O : { x: h, y: _ });
534
+ const w = Math.floor(b.height * X.MAX_HEIGHT_RATIO), I = Math.min(h || a, w), L = s + n;
535
+ j(() => {
536
+ if (!o) {
537
+ const S = b.width - L - 20, u = b.height - I - 20;
538
+ d((T) => T.x === S && T.y === u ? T : { x: S, y: u });
527
539
  }
528
- }, [l, L, $, m]);
529
- const v = N((h) => {
530
- if (p || h.target.closest("button, input, textarea")) return;
531
- k.current = !0, D.current = !1, C.current = { x: h.clientX, y: h.clientY }, S.current = { ...i };
532
- const _ = (T) => {
533
- if (!k.current) return;
534
- const Y = T.clientX - C.current.x, j = T.clientY - C.current.y;
535
- (Math.abs(Y) > 3 || Math.abs(j) > 3) && (D.current = !0), D.current && (d(!0), o({
536
- x: Math.max(-200, Math.min(S.current.x + Y, window.innerWidth - 100)),
537
- y: Math.max(0, Math.min(S.current.y + j, window.innerHeight - 48))
540
+ }, [o, L, I, b]);
541
+ const R = k((S) => {
542
+ if (c || S.target.closest("button, input, textarea")) return;
543
+ A.current = !0, $.current = !1, v.current = { x: S.clientX, y: S.clientY }, N.current = { ...i };
544
+ const u = (O) => {
545
+ if (!A.current) return;
546
+ const z = O.clientX - v.current.x, Y = O.clientY - v.current.y;
547
+ (Math.abs(z) > 3 || Math.abs(Y) > 3) && ($.current = !0), $.current && (l(!0), d({
548
+ x: Math.max(-200, Math.min(N.current.x + z, window.innerWidth - 100)),
549
+ y: Math.max(0, Math.min(N.current.y + Y, window.innerHeight - 48))
538
550
  }));
539
- }, O = () => {
540
- k.current = !1, W();
541
- }, W = () => {
542
- document.removeEventListener("mousemove", _), document.removeEventListener("mouseup", O), w.current = null;
551
+ }, T = () => {
552
+ A.current = !1, B();
553
+ }, B = () => {
554
+ document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", T), M.current = null;
543
555
  };
544
- document.addEventListener("mousemove", _), document.addEventListener("mouseup", O), w.current = W;
545
- }, [p, i]), A = N((h, _) => {
546
- h.preventDefault(), h.stopPropagation(), f.current = !0, y.current = h.clientX, z.current = s, H.current = _;
547
- const O = (Y) => {
548
- if (!f.current) return;
549
- const j = Y.clientX - y.current;
550
- let q = H.current === "right" ? z.current + j : z.current - j;
551
- if (q > U.MAX_WIDTH) {
552
- f.current = !1, u(!0), T();
556
+ document.addEventListener("mousemove", u), document.addEventListener("mouseup", T), M.current = B;
557
+ }, [c, i]), F = k((S) => {
558
+ S.preventDefault(), S.stopPropagation(), p.current = !0, m.current = S.clientX, C.current = s;
559
+ const u = i.x + s, T = i.y, B = (Y) => {
560
+ if (!p.current) return;
561
+ const W = Y.clientX - m.current;
562
+ let V = C.current - W;
563
+ if (V > X.MAX_WIDTH) {
564
+ p.current = !1, f(!0), z();
553
565
  return;
554
566
  }
555
- q = Math.max(U.MIN_WIDTH, q), r(q);
556
- }, W = () => {
557
- f.current = !1, T();
558
- }, T = () => {
559
- document.removeEventListener("mousemove", O), document.removeEventListener("mouseup", W), w.current = null;
567
+ V = Math.max(X.MIN_WIDTH, V), r(V), d({ x: u - V, y: T });
568
+ }, O = () => {
569
+ p.current = !1, z();
570
+ }, z = () => {
571
+ document.removeEventListener("mousemove", B), document.removeEventListener("mouseup", O), M.current = null;
560
572
  };
561
- document.addEventListener("mousemove", O), document.addEventListener("mouseup", W), w.current = T;
562
- }, [s]), I = N(() => {
563
- p && r(t), u((h) => !h);
564
- }, [p, t]), F = N(() => {
565
- u(!1), r(t), d(!1), b(null);
573
+ document.addEventListener("mousemove", B), document.addEventListener("mouseup", O), M.current = z;
574
+ }, [s, i]), P = k(() => {
575
+ c && r(t), f((S) => !S);
576
+ }, [c, t]), D = k(() => {
577
+ f(!1), r(t), l(!1), x(null);
566
578
  }, [t]);
567
579
  return {
568
580
  // 状态
569
581
  width: s,
570
582
  position: i,
571
- hasCustomPosition: l,
572
- isMaximized: p,
573
- lockedHeight: g,
574
- viewport: m,
583
+ hasCustomPosition: o,
584
+ isMaximized: c,
585
+ lockedHeight: h,
586
+ viewport: b,
575
587
  defaultHeight: a,
576
588
  /** 真实渲染几何(含侧边栏宽度 / 自适应高度,统一在 hook 内钳制) */
577
589
  totalWidth: L,
578
- windowHeight: $,
590
+ windowHeight: I,
579
591
  // 交互
580
- startWindowDrag: v,
581
- startResize: A,
582
- toggleMaximize: I,
583
- setIsMaximized: u,
584
- setLockedHeight: b,
585
- setHasCustomPosition: d,
586
- reset: F
592
+ startWindowDrag: R,
593
+ startResize: F,
594
+ toggleMaximize: P,
595
+ setIsMaximized: f,
596
+ setLockedHeight: x,
597
+ setHasCustomPosition: l,
598
+ reset: D
587
599
  };
588
600
  }
589
- function Ke(t) {
590
- const { enabled: a, contentSelector: n, defaultHeight: s, onHeightChange: r } = t, i = R(null);
591
- return P(() => {
601
+ function nt(t) {
602
+ const { enabled: a, contentSelector: n, defaultHeight: s, onHeightChange: r } = t, i = _(null);
603
+ return j(() => {
592
604
  if (!a || !i.current) return;
593
- const l = i.current.querySelector(n);
594
- if (!l) return;
595
- const d = () => {
596
- const g = i.current;
597
- if (!g) return;
598
- const b = g.querySelector(n);
599
- if (!b) return;
600
- const m = g.offsetHeight - b.clientHeight, x = b.scrollHeight + m, f = Math.floor(window.innerHeight * U.MAX_HEIGHT_RATIO), y = Math.max(s, Math.min(x, f));
601
- r((z) => z === y ? z : y);
605
+ const o = i.current.querySelector(n);
606
+ if (!o) return;
607
+ const l = () => {
608
+ const h = i.current;
609
+ if (!h) return;
610
+ const x = h.querySelector(n);
611
+ if (!x) return;
612
+ const b = h.offsetHeight - x.clientHeight, y = x.scrollHeight + b, p = Math.floor(window.innerHeight * X.MAX_HEIGHT_RATIO), m = Math.max(s, Math.min(y, p));
613
+ r((C) => C === m ? C : m);
602
614
  };
603
- d();
604
- const p = new ResizeObserver(() => d());
605
- Array.from(l.children).forEach((g) => p.observe(g));
606
- const u = new MutationObserver(() => {
607
- Array.from(l.children).forEach((g) => p.observe(g)), d();
615
+ l();
616
+ const c = new ResizeObserver(() => l());
617
+ Array.from(o.children).forEach((h) => c.observe(h));
618
+ const f = new MutationObserver(() => {
619
+ Array.from(o.children).forEach((h) => c.observe(h)), l();
608
620
  });
609
- return u.observe(l, { childList: !0, subtree: !0, characterData: !0 }), () => {
610
- p.disconnect(), u.disconnect();
621
+ return f.observe(o, { childList: !0, subtree: !0, characterData: !0 }), () => {
622
+ c.disconnect(), f.disconnect();
611
623
  };
612
624
  }, [a, n, s, r]), i;
613
625
  }
614
- function Ve({ isOpen: t, onClick: a, triggerLogo: n }) {
626
+ function st(t, a) {
627
+ const n = X.TRIGGER_SIZE;
628
+ return {
629
+ x: Math.max(8, Math.min(t, window.innerWidth - n - 8)),
630
+ y: Math.max(8, Math.min(a, window.innerHeight - n - 8))
631
+ };
632
+ }
633
+ function it({ isOpen: t, onClick: a, triggerLogo: n }) {
634
+ const [s, r] = E(null), i = _(!1), d = _(!1), o = _({ x: 0, y: 0 }), l = _({ x: 0, y: 0 }), c = _(null);
635
+ j(() => () => {
636
+ var b;
637
+ (b = c.current) == null || b.call(c);
638
+ }, []);
639
+ const f = k((b) => {
640
+ if (b.button !== 0) return;
641
+ i.current = !0, d.current = !1, o.current = { x: b.clientX, y: b.clientY };
642
+ const y = b.currentTarget.getBoundingClientRect();
643
+ l.current = { x: y.left, y: y.top };
644
+ const p = (C) => {
645
+ if (!i.current) return;
646
+ const A = C.clientX - o.current.x, v = C.clientY - o.current.y;
647
+ (Math.abs(A) > 4 || Math.abs(v) > 4) && (d.current = !0), d.current && r(st(l.current.x + A, l.current.y + v));
648
+ }, m = () => {
649
+ i.current = !1, document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", m), c.current = null;
650
+ };
651
+ document.addEventListener("mousemove", p), document.addEventListener("mouseup", m), c.current = m;
652
+ }, []), h = k(() => {
653
+ if (d.current) {
654
+ d.current = !1;
655
+ return;
656
+ }
657
+ a();
658
+ }, [a]), x = s ? { left: s.x, top: s.y, width: X.TRIGGER_SIZE, height: X.TRIGGER_SIZE } : {
659
+ right: X.TRIGGER_RIGHT,
660
+ bottom: X.TRIGGER_BOTTOM,
661
+ width: X.TRIGGER_SIZE,
662
+ height: X.TRIGGER_SIZE
663
+ };
615
664
  return /* @__PURE__ */ e(
616
665
  "button",
617
666
  {
618
667
  type: "button",
619
668
  className: `fixed z-[10000] flex items-center justify-center border-none bg-transparent p-0 transition-transform duration-200 ease-out hover:scale-[1.08] active:scale-95 ${t ? "pointer-events-none scale-50 opacity-0" : "opacity-100"}`,
620
- style: {
621
- right: U.TRIGGER_RIGHT,
622
- bottom: U.TRIGGER_BOTTOM,
623
- width: U.TRIGGER_SIZE,
624
- height: U.TRIGGER_SIZE
625
- },
626
- onClick: a,
669
+ style: x,
670
+ onMouseDown: f,
671
+ onClick: h,
627
672
  "aria-label": "打开 AI 助手",
628
673
  title: "AI 助手",
629
- children: /* @__PURE__ */ e("img", { src: n || X.triggerLogo, alt: "AI 助手", className: "block h-14 w-14", draggable: !1 })
674
+ children: /* @__PURE__ */ e("img", { src: n || U.triggerLogo, alt: "AI 助手", className: "block h-full w-full", draggable: !1 })
630
675
  }
631
676
  );
632
677
  }
@@ -647,133 +692,133 @@ function te({
647
692
  }
648
693
  );
649
694
  }
650
- function qe({
695
+ function ot({
651
696
  onClose: t,
652
697
  onToggleThreadList: a,
653
698
  isMaximized: n = !1,
654
699
  onToggleMaximize: s,
655
700
  showHome: r = !1,
656
701
  onHome: i,
657
- showClose: o = !0,
658
- artifactCount: l = 0,
659
- onToggleArtifactDrawer: d
702
+ showClose: d = !0,
703
+ artifactCount: o = 0,
704
+ onToggleArtifactDrawer: l
660
705
  }) {
661
- return /* @__PURE__ */ c("div", { className: "relative z-20 flex h-9 shrink-0 select-none items-center justify-between px-[15px]", children: [
662
- /* @__PURE__ */ c("div", { className: "flex items-center gap-3", children: [
663
- /* @__PURE__ */ e(te, { tooltip: "历史记录", onClick: a, children: /* @__PURE__ */ e("img", { src: X.recently, alt: "", width: 20, height: 20 }) }),
664
- r && i && /* @__PURE__ */ e(te, { tooltip: "回到首页", onClick: i, children: /* @__PURE__ */ e("img", { src: X.home, alt: "", width: 20, height: 20 }) })
706
+ return /* @__PURE__ */ g("div", { className: "relative z-20 flex h-9 shrink-0 select-none items-center justify-between px-[15px]", children: [
707
+ /* @__PURE__ */ g("div", { className: "flex items-center gap-3", children: [
708
+ /* @__PURE__ */ e(te, { tooltip: "历史记录", onClick: a, children: /* @__PURE__ */ e("img", { src: U.recently, alt: "", width: 20, height: 20 }) }),
709
+ r && i && /* @__PURE__ */ e(te, { tooltip: "回到首页", onClick: i, children: /* @__PURE__ */ e("img", { src: U.home, alt: "", width: 20, height: 20 }) })
665
710
  ] }),
666
- /* @__PURE__ */ c("div", { className: "flex items-center gap-2.5", children: [
667
- l > 0 && d && /* @__PURE__ */ e(te, { tooltip: "会话产物", onClick: d, children: /* @__PURE__ */ c("span", { className: "relative flex items-center gap-1", children: [
668
- /* @__PURE__ */ c("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
711
+ /* @__PURE__ */ g("div", { className: "flex items-center gap-2.5", children: [
712
+ o > 0 && l && /* @__PURE__ */ e(te, { tooltip: "会话产物", onClick: l, children: /* @__PURE__ */ g("span", { className: "relative flex items-center gap-1", children: [
713
+ /* @__PURE__ */ g("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
669
714
  /* @__PURE__ */ e("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
670
715
  /* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" })
671
716
  ] }),
672
- l > 0 && /* @__PURE__ */ e("span", { className: "absolute -right-2 -top-1.5 min-w-[14px] rounded-full bg-[var(--sa-primary)] px-0.5 text-center text-[9px] font-medium leading-[14px] text-white", children: l > 99 ? "99+" : l })
717
+ o > 0 && /* @__PURE__ */ e("span", { className: "absolute -right-2 -top-1.5 min-w-[14px] rounded-full bg-[var(--sa-primary)] px-0.5 text-center text-[9px] font-medium leading-[14px] text-white", children: o > 99 ? "99+" : o })
673
718
  ] }) }),
674
- s && /* @__PURE__ */ e(te, { tooltip: n ? "小窗" : "大窗", onClick: s, children: /* @__PURE__ */ e("img", { src: n ? X.spiltWindow : X.mergeWindow, alt: "", width: 20, height: 20 }) }),
675
- o && /* @__PURE__ */ e(te, { tooltip: "关闭", onClick: t, children: /* @__PURE__ */ e("img", { src: X.close, alt: "", width: 20, height: 20 }) })
719
+ s && /* @__PURE__ */ e(te, { tooltip: n ? "小窗" : "大窗", onClick: s, children: /* @__PURE__ */ e("img", { src: n ? U.spiltWindow : U.mergeWindow, alt: "", width: 20, height: 20 }) }),
720
+ d && /* @__PURE__ */ e(te, { tooltip: "关闭", onClick: t, children: /* @__PURE__ */ e("img", { src: U.close, alt: "", width: 20, height: 20 }) })
676
721
  ] })
677
722
  ] });
678
723
  }
679
724
  const ae = (t) => String(t).padStart(2, "0");
680
- function Ze(t) {
725
+ function lt(t) {
681
726
  if (!t) return "";
682
727
  const a = new Date(t);
683
728
  return isNaN(a.getTime()) ? "" : `${a.getFullYear()}-${ae(a.getMonth() + 1)}-${ae(a.getDate())} ${ae(a.getHours())}:${ae(a.getMinutes())}:${ae(a.getSeconds())}`;
684
729
  }
685
- function De(t) {
686
- const a = /* @__PURE__ */ new Date(), n = new Date(a.getFullYear(), a.getMonth(), a.getDate()).getTime(), s = n - 6 * 864e5, r = [], i = [], o = [];
687
- for (const d of t) {
688
- const p = new Date(d.updateTime).getTime();
689
- p >= n ? r.push(d) : p >= s ? i.push(d) : o.push(d);
690
- }
691
- const l = [];
692
- return r.length && l.push({ label: "今天", items: r }), i.length && l.push({ label: "最近 7 天", items: i }), o.length && l.push({ label: "更早", items: o }), l;
730
+ function Fe(t) {
731
+ const a = /* @__PURE__ */ new Date(), n = new Date(a.getFullYear(), a.getMonth(), a.getDate()).getTime(), s = n - 6 * 864e5, r = [], i = [], d = [];
732
+ for (const l of t) {
733
+ const c = new Date(l.updateTime).getTime();
734
+ c >= n ? r.push(l) : c >= s ? i.push(l) : d.push(l);
735
+ }
736
+ const o = [];
737
+ return r.length && o.push({ label: "今天", items: r }), i.length && o.push({ label: "最近 7 天", items: i }), d.length && o.push({ label: "更早", items: d }), o;
693
738
  }
694
- function ke({ width: t }) {
739
+ function Ie({ width: t }) {
695
740
  const {
696
741
  conversations: a,
697
742
  activeConversationId: n,
698
743
  switchConversation: s,
699
744
  newConversation: r,
700
745
  deleteConversation: i,
701
- renameConversation: o,
702
- hasMore: l,
703
- loadMoreConversations: d,
704
- conversationsLoading: p
705
- } = Z(), [u, g] = E(null), [b, m] = E(""), [x, f] = E(null), y = R(null), z = N((S, D) => {
706
- g(S), m(D ?? "");
707
- }, []), H = N((S) => {
708
- b.trim() && o(S, b.trim()), g(null);
709
- }, [b, o]), k = N(() => {
710
- const S = y.current;
711
- !S || !l || S.scrollHeight - S.scrollTop - S.clientHeight < 50 && d();
712
- }, [l, d]), C = re(() => De(a), [a]);
713
- return /* @__PURE__ */ c(
746
+ renameConversation: d,
747
+ hasMore: o,
748
+ loadMoreConversations: l,
749
+ conversationsLoading: c
750
+ } = J(), [f, h] = E(null), [x, b] = E(""), [y, p] = E(null), m = _(null), C = k(($, M) => {
751
+ h($), b(M ?? "");
752
+ }, []), A = k(($) => {
753
+ x.trim() && d($, x.trim()), h(null);
754
+ }, [x, d]), v = k(() => {
755
+ const $ = m.current;
756
+ !$ || !o || $.scrollHeight - $.scrollTop - $.clientHeight < 50 && l();
757
+ }, [o, l]), N = re(() => Fe(a), [a]);
758
+ return /* @__PURE__ */ g(
714
759
  "div",
715
760
  {
716
- className: "relative z-[5] flex shrink-0 flex-col overflow-visible border-r border-[#ECECEC] bg-[#FAFAFA] p-3 animate-sa-history-in",
761
+ className: "relative z-[5] flex h-full shrink-0 flex-col overflow-visible border-r border-[#ECECEC] bg-[#FAFAFA] p-3 animate-sa-history-in",
717
762
  style: { width: t ?? 200 },
718
763
  children: [
719
- /* @__PURE__ */ c(
764
+ /* @__PURE__ */ g(
720
765
  "button",
721
766
  {
722
767
  type: "button",
723
768
  className: "sa-new-chat mb-4 flex h-8 w-full shrink-0 items-center justify-center gap-2 rounded-md text-[14px] font-medium transition-colors",
724
769
  onClick: r,
725
770
  children: [
726
- /* @__PURE__ */ e("img", { src: X.messageCreate, alt: "", width: 18, height: 18 }),
771
+ /* @__PURE__ */ e("img", { src: U.messageCreate, alt: "", width: 18, height: 18 }),
727
772
  /* @__PURE__ */ e("span", { className: "sa-new-chat-text whitespace-nowrap", children: "新建对话" })
728
773
  ]
729
774
  }
730
775
  ),
731
- /* @__PURE__ */ c("div", { className: "px-1 pb-2.5", children: [
776
+ /* @__PURE__ */ g("div", { className: "px-1 pb-2.5", children: [
732
777
  /* @__PURE__ */ e("div", { className: "mb-1 text-[14px] font-semibold text-[#333]", children: "历史对话" }),
733
778
  /* @__PURE__ */ e("div", { className: "text-[11px] text-[#999]", children: "展示最近的会话记录" })
734
779
  ] }),
735
- /* @__PURE__ */ c("div", { ref: y, className: "flex-1 overflow-y-auto", onScroll: k, children: [
736
- p && a.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "加载中..." }),
737
- !p && a.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "暂无记录" }),
738
- C.map((S) => /* @__PURE__ */ c("div", { className: "mb-1", children: [
739
- /* @__PURE__ */ e("div", { className: "px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]", children: S.label }),
740
- S.items.map((D) => /* @__PURE__ */ e(
780
+ /* @__PURE__ */ g("div", { ref: m, className: "flex-1 overflow-y-auto", onScroll: v, children: [
781
+ c && a.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "加载中..." }),
782
+ !c && a.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "暂无记录" }),
783
+ N.map(($) => /* @__PURE__ */ g("div", { className: "mb-1", children: [
784
+ /* @__PURE__ */ e("div", { className: "px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]", children: $.label }),
785
+ $.items.map((M) => /* @__PURE__ */ e(
741
786
  "div",
742
787
  {
743
- className: `group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${D.sessionId === n ? "bg-[#E8F1FE]" : "hover:bg-[#E8F1FE]"}`,
788
+ className: `group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${M.sessionId === n ? "bg-[#E8F1FE]" : "hover:bg-[#E8F1FE]"}`,
744
789
  onClick: () => {
745
- u !== D.sessionId && s(D.sessionId);
790
+ f !== M.sessionId && s(M.sessionId);
746
791
  },
747
792
  onMouseEnter: (w) => {
748
- if (u === D.sessionId) return;
749
- const M = w.currentTarget.getBoundingClientRect();
750
- f({ text: D.title || "新会话", x: M.right + 8, y: M.top + M.height / 2 });
793
+ if (f === M.sessionId) return;
794
+ const I = w.currentTarget.getBoundingClientRect();
795
+ p({ text: M.title || "新会话", x: I.right + 8, y: I.top + I.height / 2 });
751
796
  },
752
- onMouseLeave: () => f(null),
753
- children: u === D.sessionId ? /* @__PURE__ */ e(
797
+ onMouseLeave: () => p(null),
798
+ children: f === M.sessionId ? /* @__PURE__ */ e(
754
799
  "input",
755
800
  {
756
801
  className: "w-full rounded border border-[var(--sa-primary)] bg-white px-1.5 py-0.5 text-[12px] outline-none",
757
- value: b,
758
- onChange: (w) => m(w.target.value),
759
- onBlur: () => H(D.sessionId),
802
+ value: x,
803
+ onChange: (w) => b(w.target.value),
804
+ onBlur: () => A(M.sessionId),
760
805
  onKeyDown: (w) => {
761
- w.key === "Enter" && H(D.sessionId), w.key === "Escape" && g(null);
806
+ w.key === "Enter" && A(M.sessionId), w.key === "Escape" && h(null);
762
807
  },
763
808
  onClick: (w) => w.stopPropagation(),
764
809
  autoFocus: !0
765
810
  }
766
- ) : /* @__PURE__ */ c(V, { children: [
767
- /* @__PURE__ */ e("img", { src: X.message, alt: "", width: 16, height: 16, className: "shrink-0 opacity-60" }),
768
- /* @__PURE__ */ e("span", { className: "flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]", children: D.title || "新会话" }),
769
- /* @__PURE__ */ c("span", { className: "hidden shrink-0 items-center gap-0.5 group-hover:flex", children: [
811
+ ) : /* @__PURE__ */ g(K, { children: [
812
+ /* @__PURE__ */ e("img", { src: U.message, alt: "", width: 16, height: 16, className: "shrink-0 opacity-60" }),
813
+ /* @__PURE__ */ e("span", { className: "flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]", children: M.title || "新会话" }),
814
+ /* @__PURE__ */ g("span", { className: "hidden shrink-0 items-center gap-0.5 group-hover:flex", children: [
770
815
  /* @__PURE__ */ e(
771
816
  "button",
772
817
  {
773
818
  type: "button",
774
819
  className: "flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[var(--sa-primary)]",
775
820
  onClick: (w) => {
776
- w.stopPropagation(), z(D.sessionId, D.title);
821
+ w.stopPropagation(), C(M.sessionId, M.title);
777
822
  },
778
823
  title: "重命名",
779
824
  children: /* @__PURE__ */ e("svg", { width: 12, height: 12, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" }) })
@@ -785,7 +830,7 @@ function ke({ width: t }) {
785
830
  type: "button",
786
831
  className: "flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[#ef4444]",
787
832
  onClick: (w) => {
788
- w.stopPropagation(), i(D.sessionId);
833
+ w.stopPropagation(), i(M.sessionId);
789
834
  },
790
835
  title: "删除",
791
836
  children: /* @__PURE__ */ e("svg", { width: 12, height: 12, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }) })
@@ -794,50 +839,50 @@ function ke({ width: t }) {
794
839
  ] })
795
840
  ] })
796
841
  },
797
- D.sessionId
842
+ M.sessionId
798
843
  ))
799
- ] }, S.label)),
800
- p && a.length > 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: l ? "加载更多..." : "加载中..." }),
801
- !p && l && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-center text-[11px] text-[#C0C0C0]", children: "向下滚动加载更多" })
844
+ ] }, $.label)),
845
+ c && a.length > 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: o ? "加载更多..." : "加载中..." }),
846
+ !c && o && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-center text-[11px] text-[#C0C0C0]", children: "向下滚动加载更多" })
802
847
  ] }),
803
- x && /* @__PURE__ */ e(
848
+ y && /* @__PURE__ */ e(
804
849
  "div",
805
850
  {
806
851
  className: "pointer-events-none fixed z-[10001] whitespace-nowrap rounded border border-[#E8E8E8] bg-white px-2.5 py-1.5 text-[12px] leading-[1.4] text-[#333] shadow-[0_2px_8px_rgba(0,0,0,0.12)]",
807
- style: { left: x.x, top: x.y, transform: "translateY(-50%)" },
808
- children: x.text
852
+ style: { left: y.x, top: y.y, transform: "translateY(-50%)" },
853
+ children: y.text
809
854
  }
810
855
  )
811
856
  ]
812
857
  }
813
858
  );
814
859
  }
815
- function Je(t) {
816
- const a = R(null), n = R(!1), s = R(0), r = N(() => {
817
- const o = a.current;
818
- if (!o) return;
819
- const { scrollTop: l, scrollHeight: d, clientHeight: p } = o, u = d - l - p < 40;
820
- l < s.current && !u && (n.current = !0), u && (n.current = !1), s.current = l;
860
+ function dt(t) {
861
+ const a = _(null), n = _(!1), s = _(0), r = k(() => {
862
+ const d = a.current;
863
+ if (!d) return;
864
+ const { scrollTop: o, scrollHeight: l, clientHeight: c } = d, f = l - o - c < 40;
865
+ o < s.current && !f && (n.current = !0), f && (n.current = !1), s.current = o;
821
866
  }, []);
822
- P(() => {
823
- const o = a.current;
824
- if (o)
825
- return o.addEventListener("scroll", r, { passive: !0 }), () => o.removeEventListener("scroll", r);
826
- }, [r]), P(() => {
867
+ j(() => {
868
+ const d = a.current;
869
+ if (d)
870
+ return d.addEventListener("scroll", r, { passive: !0 }), () => d.removeEventListener("scroll", r);
871
+ }, [r]), j(() => {
827
872
  if (n.current) return;
828
- const o = a.current;
829
- o && requestAnimationFrame(() => {
830
- o.scrollTop = o.scrollHeight;
873
+ const d = a.current;
874
+ d && requestAnimationFrame(() => {
875
+ d.scrollTop = d.scrollHeight;
831
876
  });
832
877
  }, t);
833
- const i = N(() => {
878
+ const i = k(() => {
834
879
  n.current = !1;
835
- const o = a.current;
836
- o && (o.scrollTop = o.scrollHeight);
880
+ const d = a.current;
881
+ d && (d.scrollTop = d.scrollHeight);
837
882
  }, []);
838
883
  return { containerRef: a, scrollToBottom: i };
839
884
  }
840
- function K(t) {
885
+ function Z(t) {
841
886
  return t.value++;
842
887
  }
843
888
  function ee(t, a) {
@@ -846,133 +891,133 @@ function ee(t, a) {
846
891
  };
847
892
  let i = 0;
848
893
  for (; i < t.length; ) {
849
- const o = t[i];
850
- if (o === "`") {
851
- const l = t.indexOf("`", i + 1);
852
- if (l !== -1) {
894
+ const d = t[i];
895
+ if (d === "`") {
896
+ const o = t.indexOf("`", i + 1);
897
+ if (o !== -1) {
853
898
  r(), n.push(
854
- /* @__PURE__ */ e("code", { className: "sa-inline-code", children: t.slice(i + 1, l) }, K(a))
855
- ), i = l + 1;
899
+ /* @__PURE__ */ e("code", { className: "sa-inline-code", children: t.slice(i + 1, o) }, Z(a))
900
+ ), i = o + 1;
856
901
  continue;
857
902
  }
858
- } else if (o === "*" && t[i + 1] === "*") {
859
- const l = t.indexOf("**", i + 2);
860
- if (l !== -1) {
903
+ } else if (d === "*" && t[i + 1] === "*") {
904
+ const o = t.indexOf("**", i + 2);
905
+ if (o !== -1) {
861
906
  r(), n.push(
862
- /* @__PURE__ */ e("strong", { children: ee(t.slice(i + 2, l), a) }, K(a))
863
- ), i = l + 2;
907
+ /* @__PURE__ */ e("strong", { children: ee(t.slice(i + 2, o), a) }, Z(a))
908
+ ), i = o + 2;
864
909
  continue;
865
910
  }
866
- } else if (o === "*") {
867
- const l = t.indexOf("*", i + 1);
868
- if (l !== -1) {
911
+ } else if (d === "*") {
912
+ const o = t.indexOf("*", i + 1);
913
+ if (o !== -1) {
869
914
  r(), n.push(
870
- /* @__PURE__ */ e("em", { children: ee(t.slice(i + 1, l), a) }, K(a))
871
- ), i = l + 1;
915
+ /* @__PURE__ */ e("em", { children: ee(t.slice(i + 1, o), a) }, Z(a))
916
+ ), i = o + 1;
872
917
  continue;
873
918
  }
874
- } else if (o === "[") {
875
- const l = t.indexOf("]", i + 1);
876
- if (l !== -1 && t[l + 1] === "(") {
877
- const d = t.indexOf(")", l + 2);
878
- if (d !== -1) {
879
- const p = t.slice(i + 1, l), u = t.slice(l + 2, d);
919
+ } else if (d === "[") {
920
+ const o = t.indexOf("]", i + 1);
921
+ if (o !== -1 && t[o + 1] === "(") {
922
+ const l = t.indexOf(")", o + 2);
923
+ if (l !== -1) {
924
+ const c = t.slice(i + 1, o), f = t.slice(o + 2, l);
880
925
  r(), n.push(
881
926
  /* @__PURE__ */ e(
882
927
  "a",
883
928
  {
884
- href: u,
929
+ href: f,
885
930
  target: "_blank",
886
931
  rel: "noreferrer",
887
- children: ee(p, a)
932
+ children: ee(c, a)
888
933
  },
889
- K(a)
934
+ Z(a)
890
935
  )
891
- ), i = d + 1;
936
+ ), i = l + 1;
892
937
  continue;
893
938
  }
894
939
  }
895
940
  }
896
- s.push(o), i++;
941
+ s.push(d), i++;
897
942
  }
898
943
  return r(), n;
899
944
  }
900
- function Qe(t, a) {
945
+ function ct(t, a) {
901
946
  const n = [], s = t.split(`
902
947
  `);
903
948
  let r = 0;
904
- const i = (d) => d.trim() === "", o = (d) => /^#{1,6}\s+\S/.test(d.trim()), l = (d) => /^(?:[-*+]|\d+[.)])\s+\S/.test(d.trim());
949
+ const i = (l) => l.trim() === "", d = (l) => /^#{1,6}\s+\S/.test(l.trim()), o = (l) => /^(?:[-*+]|\d+[.)])\s+\S/.test(l.trim());
905
950
  for (; r < s.length; ) {
906
- const d = s[r], p = d.trim();
907
- if (i(d)) {
951
+ const l = s[r], c = l.trim();
952
+ if (i(l)) {
908
953
  r++;
909
954
  continue;
910
955
  }
911
- if (o(d)) {
912
- const g = p.match(/^(#{1,6})\s+(.*)$/);
913
- if (g) {
914
- const m = `h${Math.min(g[1].length, 6)}`;
956
+ if (d(l)) {
957
+ const h = c.match(/^(#{1,6})\s+(.*)$/);
958
+ if (h) {
959
+ const b = `h${Math.min(h[1].length, 6)}`;
915
960
  n.push(
916
961
  Q.createElement(
917
- m,
918
- { key: K(a) },
919
- ee(g[2], a)
962
+ b,
963
+ { key: Z(a) },
964
+ ee(h[2], a)
920
965
  )
921
966
  );
922
967
  }
923
968
  r++;
924
969
  continue;
925
970
  }
926
- if (l(d)) {
927
- const g = /^\d+[.)]/.test(p), b = [];
928
- for (; r < s.length && l(s[r]); ) {
929
- const m = s[r].trim().match(/^(?:[-*+]|\d+[.)])\s+(.*)$/);
930
- m && b.push(
931
- /* @__PURE__ */ e("li", { children: ee(m[1], a) }, K(a))
971
+ if (o(l)) {
972
+ const h = /^\d+[.)]/.test(c), x = [];
973
+ for (; r < s.length && o(s[r]); ) {
974
+ const b = s[r].trim().match(/^(?:[-*+]|\d+[.)])\s+(.*)$/);
975
+ b && x.push(
976
+ /* @__PURE__ */ e("li", { children: ee(b[1], a) }, Z(a))
932
977
  ), r++;
933
978
  }
934
979
  n.push(
935
- g ? /* @__PURE__ */ e("ol", { className: "sa-list", children: b }, K(a)) : /* @__PURE__ */ e("ul", { className: "sa-list", children: b }, K(a))
980
+ h ? /* @__PURE__ */ e("ol", { className: "sa-list", children: x }, Z(a)) : /* @__PURE__ */ e("ul", { className: "sa-list", children: x }, Z(a))
936
981
  );
937
982
  continue;
938
983
  }
939
- const u = [];
940
- for (; r < s.length && !i(s[r]) && !o(s[r]) && !l(s[r]); )
941
- u.push(s[r]), r++;
984
+ const f = [];
985
+ for (; r < s.length && !i(s[r]) && !d(s[r]) && !o(s[r]); )
986
+ f.push(s[r]), r++;
942
987
  n.push(
943
- /* @__PURE__ */ e("p", { className: "sa-text-paragraph", children: ee(u.join(" "), a) }, K(a))
988
+ /* @__PURE__ */ e("p", { className: "sa-text-paragraph", children: ee(f.join(" "), a) }, Z(a))
944
989
  );
945
990
  }
946
991
  return n;
947
992
  }
948
- function et(t) {
993
+ function pt(t) {
949
994
  const a = { value: 0 }, n = [], s = t.split("```");
950
995
  for (let r = 0; r < s.length; r++)
951
996
  if (r % 2 === 0)
952
- n.push(...Qe(s[r], a));
997
+ n.push(...ct(s[r], a));
953
998
  else if (s[r].trim() !== "") {
954
999
  let i = s[r].replace(/^\r?\n/, "");
955
1000
  i = i.replace(/^[a-zA-Z0-9_+#.-]+\r?\n/, ""), i = i.replace(/\r?\n$/, ""), n.push(
956
- /* @__PURE__ */ e("pre", { className: "sa-code-block", children: /* @__PURE__ */ e("code", { children: i }) }, K(a))
1001
+ /* @__PURE__ */ e("pre", { className: "sa-code-block", children: /* @__PURE__ */ e("code", { children: i }) }, Z(a))
957
1002
  );
958
1003
  }
959
1004
  return n;
960
1005
  }
961
- function tt({ content: t }) {
962
- return /* @__PURE__ */ e("div", { className: "sa-text-part", children: et(t) });
1006
+ function ut({ content: t }) {
1007
+ return /* @__PURE__ */ e("div", { className: "sa-text-part", children: pt(t) });
963
1008
  }
964
- const at = "https://at.alicdn.com/t/c/font_5210396_pffyg5g21kn.js";
965
- let Ce = !1;
966
- function rt(t = at) {
967
- if (Ce || typeof document > "u") return;
968
- Ce = !0;
1009
+ const gt = "https://at.alicdn.com/t/c/font_5210396_pffyg5g21kn.js";
1010
+ let Ee = !1;
1011
+ function ft(t = gt) {
1012
+ if (Ee || typeof document > "u") return;
1013
+ Ee = !0;
969
1014
  const a = t.split("?")[0].split("/").pop();
970
1015
  if (a && document.querySelector(`script[src*="${a}"]`)) return;
971
1016
  const n = document.createElement("script");
972
1017
  n.src = t, document.head.appendChild(n);
973
1018
  }
974
- rt();
975
- function B({ name: t, size: a = 16, color: n = "currentColor", className: s, style: r }) {
1019
+ ft();
1020
+ function H({ name: t, size: a = 16, color: n = "currentColor", className: s, style: r }) {
976
1021
  return /* @__PURE__ */ e(
977
1022
  "svg",
978
1023
  {
@@ -983,67 +1028,67 @@ function B({ name: t, size: a = 16, color: n = "currentColor", className: s, sty
983
1028
  }
984
1029
  );
985
1030
  }
986
- function nt({ content: t }) {
1031
+ function ht({ content: t }) {
987
1032
  const [a, n] = E(!1);
988
- return /* @__PURE__ */ c("div", { className: "sa-thinking-part", onClick: () => n(!a), children: [
989
- /* @__PURE__ */ c("div", { className: "sa-thinking-header", children: [
990
- /* @__PURE__ */ e("span", { className: "sa-thinking-icon", children: /* @__PURE__ */ e(B, { name: "brain", size: 14 }) }),
1033
+ return /* @__PURE__ */ g("div", { className: "sa-thinking-part", onClick: () => n(!a), children: [
1034
+ /* @__PURE__ */ g("div", { className: "sa-thinking-header", children: [
1035
+ /* @__PURE__ */ e("span", { className: "sa-thinking-icon", children: /* @__PURE__ */ e(H, { name: "brain", size: 14 }) }),
991
1036
  /* @__PURE__ */ e("span", { className: "sa-thinking-label", children: "思考过程" }),
992
- /* @__PURE__ */ e("span", { className: `sa-thinking-arrow ${a ? "expanded" : ""}`, children: /* @__PURE__ */ e(B, { name: "chevron-right", size: 12 }) })
1037
+ /* @__PURE__ */ e("span", { className: `sa-thinking-arrow ${a ? "expanded" : ""}`, children: /* @__PURE__ */ e(H, { name: "chevron-right", size: 12 }) })
993
1038
  ] }),
994
1039
  a && /* @__PURE__ */ e("div", { className: "sa-thinking-content", children: t })
995
1040
  ] });
996
1041
  }
997
- function st({ toolName: t, toolCallId: a, args: n }) {
998
- const [s, r] = E(!1), [i, o] = E(!1);
999
- let l = n;
1042
+ function mt({ toolName: t, toolCallId: a, args: n }) {
1043
+ const [s, r] = E(!1), [i, d] = E(!1);
1044
+ let o = n;
1000
1045
  try {
1001
- l = JSON.stringify(JSON.parse(n), null, 2);
1046
+ o = JSON.stringify(JSON.parse(n), null, 2);
1002
1047
  } catch {
1003
1048
  }
1004
- const d = N(() => {
1005
- var p;
1006
- (p = navigator.clipboard) == null || p.writeText(l).then(() => {
1007
- o(!0), setTimeout(() => o(!1), 2e3);
1049
+ const l = k(() => {
1050
+ var c;
1051
+ (c = navigator.clipboard) == null || c.writeText(o).then(() => {
1052
+ d(!0), setTimeout(() => d(!1), 2e3);
1008
1053
  }).catch(() => {
1009
1054
  });
1010
- }, [l]);
1011
- return /* @__PURE__ */ c("div", { className: "sa-tool-call-part", children: [
1012
- /* @__PURE__ */ c("div", { className: "sa-tool-call-header", onClick: () => r(!s), children: [
1013
- /* @__PURE__ */ e("span", { className: "sa-tool-icon", children: /* @__PURE__ */ e(B, { name: "zap", size: 14 }) }),
1014
- /* @__PURE__ */ c("span", { className: "sa-tool-name", children: [
1055
+ }, [o]);
1056
+ return /* @__PURE__ */ g("div", { className: "sa-tool-call-part", children: [
1057
+ /* @__PURE__ */ g("div", { className: "sa-tool-call-header", onClick: () => r(!s), children: [
1058
+ /* @__PURE__ */ e("span", { className: "sa-tool-icon", children: /* @__PURE__ */ e(H, { name: "zap", size: 14 }) }),
1059
+ /* @__PURE__ */ g("span", { className: "sa-tool-name", children: [
1015
1060
  "调用工具: ",
1016
1061
  t
1017
1062
  ] }),
1018
- /* @__PURE__ */ e("span", { className: `sa-thinking-arrow ${s ? "expanded" : ""}`, children: /* @__PURE__ */ e(B, { name: "chevron-right", size: 12 }) })
1063
+ /* @__PURE__ */ e("span", { className: `sa-thinking-arrow ${s ? "expanded" : ""}`, children: /* @__PURE__ */ e(H, { name: "chevron-right", size: 12 }) })
1019
1064
  ] }),
1020
- s && /* @__PURE__ */ c(V, { children: [
1021
- /* @__PURE__ */ e("pre", { className: "sa-tool-args", children: l }),
1022
- /* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ c("button", { className: "sa-action-btn", onClick: d, title: "复制", children: [
1023
- /* @__PURE__ */ e(B, { name: i ? "circle-check" : "copy", size: 14 }),
1065
+ s && /* @__PURE__ */ g(K, { children: [
1066
+ /* @__PURE__ */ e("pre", { className: "sa-tool-args", children: o }),
1067
+ /* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ g("button", { className: "sa-action-btn", onClick: l, title: "复制", children: [
1068
+ /* @__PURE__ */ e(H, { name: i ? "circle-check" : "copy", size: 14 }),
1024
1069
  " ",
1025
1070
  i ? "已复制" : "复制"
1026
1071
  ] }) })
1027
1072
  ] })
1028
1073
  ] });
1029
1074
  }
1030
- function Ne({ text: t }) {
1075
+ function Me({ text: t }) {
1031
1076
  const [a, n] = E(!1);
1032
- return /* @__PURE__ */ c("button", { className: "sa-action-btn", onClick: () => {
1077
+ return /* @__PURE__ */ g("button", { className: "sa-action-btn", onClick: () => {
1033
1078
  var r;
1034
1079
  (r = navigator.clipboard) == null || r.writeText(t).then(() => {
1035
1080
  n(!0), setTimeout(() => n(!1), 2e3);
1036
1081
  }).catch(() => {
1037
1082
  });
1038
1083
  }, title: "复制", children: [
1039
- /* @__PURE__ */ e(B, { name: a ? "circle-check" : "copy", size: 14 }),
1084
+ /* @__PURE__ */ e(H, { name: a ? "circle-check" : "copy", size: 14 }),
1040
1085
  " ",
1041
1086
  a ? "已复制" : "复制"
1042
1087
  ] });
1043
1088
  }
1044
- function it({ html: t }) {
1089
+ function xt({ html: t }) {
1045
1090
  const [a, n] = E(null);
1046
- return P(() => {
1091
+ return j(() => {
1047
1092
  let s = !1;
1048
1093
  return import("./purify.es-C-6FFqDW.js").then((r) => {
1049
1094
  s || n(r.default.sanitize(t, { FORCE_BODY: !0, ADD_ATTR: ["target"] }));
@@ -1052,97 +1097,97 @@ function it({ html: t }) {
1052
1097
  };
1053
1098
  }, [t]), a === null ? null : /* @__PURE__ */ e("div", { className: "sa-tool-result-html-scroll", children: /* @__PURE__ */ e("div", { className: "sa-tool-result-html sa-text-part", dangerouslySetInnerHTML: { __html: a } }) });
1054
1099
  }
1055
- function ot({ toolName: t, content: a, artifacts: n, renderMode: s, html: r, artifactPreview: i }) {
1056
- const { openArtifactPreview: o } = Z(), l = Se(n);
1057
- return /* @__PURE__ */ c("div", { className: "sa-tool-result-part", children: [
1058
- /* @__PURE__ */ c("div", { className: "sa-tool-result-header", children: [
1059
- /* @__PURE__ */ e("span", { className: "sa-tool-icon", children: /* @__PURE__ */ e(B, { name: "circle-check", size: 14, color: "#10b981" }) }),
1100
+ function wt({ toolName: t, content: a, artifacts: n, renderMode: s, html: r, artifactPreview: i }) {
1101
+ const { openArtifactPreview: d } = J(), o = Re(n);
1102
+ return /* @__PURE__ */ g("div", { className: "sa-tool-result-part", children: [
1103
+ /* @__PURE__ */ g("div", { className: "sa-tool-result-header", children: [
1104
+ /* @__PURE__ */ e("span", { className: "sa-tool-icon", children: /* @__PURE__ */ e(H, { name: "circle-check", size: 14, color: "#10b981" }) }),
1060
1105
  /* @__PURE__ */ e("span", { className: "sa-tool-result-label", children: t || "工具返回" })
1061
1106
  ] }),
1062
- s === "html" && r ? /* @__PURE__ */ c(V, { children: [
1063
- /* @__PURE__ */ e(it, { html: r }),
1064
- /* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ e(Ne, { text: r }) })
1065
- ] }) : a ? /* @__PURE__ */ c(V, { children: [
1107
+ s === "html" && r ? /* @__PURE__ */ g(K, { children: [
1108
+ /* @__PURE__ */ e(xt, { html: r }),
1109
+ /* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ e(Me, { text: r }) })
1110
+ ] }) : a ? /* @__PURE__ */ g(K, { children: [
1066
1111
  /* @__PURE__ */ e("pre", { className: "sa-tool-result-content", children: a }),
1067
- /* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ e(Ne, { text: a }) })
1112
+ /* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ e(Me, { text: a }) })
1068
1113
  ] }) : /* @__PURE__ */ e("pre", { className: "sa-tool-result-content", children: "—" }),
1069
- l.length > 0 && /* @__PURE__ */ e("ul", { className: "sa-artifact-file-list", role: "list", children: l.map((d, p) => /* @__PURE__ */ c(
1114
+ o.length > 0 && /* @__PURE__ */ e("ul", { className: "sa-artifact-file-list", role: "list", children: o.map((l, c) => /* @__PURE__ */ g(
1070
1115
  "li",
1071
1116
  {
1072
1117
  className: "sa-artifact-file-card",
1073
- onClick: i ? () => o(d) : void 0,
1074
- onKeyDown: i ? (u) => {
1075
- (u.key === "Enter" || u.key === " ") && (u.preventDefault(), o(d));
1118
+ onClick: i ? () => d(l) : void 0,
1119
+ onKeyDown: i ? (f) => {
1120
+ (f.key === "Enter" || f.key === " ") && (f.preventDefault(), d(l));
1076
1121
  } : void 0,
1077
1122
  tabIndex: i ? 0 : void 0,
1078
1123
  role: i ? "button" : void 0,
1079
- "aria-label": i ? `预览 ${d.filename}` : void 0,
1124
+ "aria-label": i ? `预览 ${l.filename}` : void 0,
1080
1125
  style: i ? { cursor: "pointer" } : void 0,
1081
1126
  children: [
1082
- /* @__PURE__ */ e("div", { className: "sa-artifact-file-icon", children: /* @__PURE__ */ e("span", { className: "sa-artifact-chip-type", children: Ee(d.type) }) }),
1083
- /* @__PURE__ */ c("div", { className: "sa-artifact-file-info", children: [
1084
- /* @__PURE__ */ e("span", { className: "sa-artifact-file-name", children: d.filename }),
1085
- d.size != null && /* @__PURE__ */ e("span", { className: "sa-artifact-file-size", children: Me(d.size) })
1127
+ /* @__PURE__ */ e("div", { className: "sa-artifact-file-icon", children: /* @__PURE__ */ e("span", { className: "sa-artifact-chip-type", children: Le(l.type) }) }),
1128
+ /* @__PURE__ */ g("div", { className: "sa-artifact-file-info", children: [
1129
+ /* @__PURE__ */ e("span", { className: "sa-artifact-file-name", children: l.filename }),
1130
+ l.size != null && /* @__PURE__ */ e("span", { className: "sa-artifact-file-size", children: De(l.size) })
1086
1131
  ] }),
1087
1132
  i && /* @__PURE__ */ e(
1088
1133
  "button",
1089
1134
  {
1090
1135
  className: "sa-artifact-file-download",
1091
1136
  title: "下载",
1092
- "aria-label": `下载 ${d.filename}`,
1093
- onClick: (u) => {
1094
- u.stopPropagation(), ie(d);
1137
+ "aria-label": `下载 ${l.filename}`,
1138
+ onClick: (f) => {
1139
+ f.stopPropagation(), de(l);
1095
1140
  },
1096
1141
  children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" }) })
1097
1142
  }
1098
1143
  )
1099
1144
  ]
1100
1145
  },
1101
- d.id || `art-${p}`
1146
+ l.id || `art-${c}`
1102
1147
  )) })
1103
1148
  ] });
1104
1149
  }
1105
- function lt({ content: t, onRetry: a }) {
1106
- return /* @__PURE__ */ c("div", { className: "sa-error-part", children: [
1107
- /* @__PURE__ */ c("div", { className: "sa-error-content", children: [
1108
- /* @__PURE__ */ e("span", { className: "sa-error-icon", children: /* @__PURE__ */ e(B, { name: "triangle-alert", size: 14 }) }),
1150
+ function bt({ content: t, onRetry: a }) {
1151
+ return /* @__PURE__ */ g("div", { className: "sa-error-part", children: [
1152
+ /* @__PURE__ */ g("div", { className: "sa-error-content", children: [
1153
+ /* @__PURE__ */ e("span", { className: "sa-error-icon", children: /* @__PURE__ */ e(H, { name: "triangle-alert", size: 14 }) }),
1109
1154
  /* @__PURE__ */ e("span", { children: t || "发生错误" })
1110
1155
  ] }),
1111
1156
  a && /* @__PURE__ */ e("button", { className: "sa-error-retry", onClick: a, children: "重试" })
1112
1157
  ] });
1113
1158
  }
1114
- function dt({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
1115
- var l, d;
1116
- const r = t.options, i = (typeof (r == null ? void 0 : r[0]) == "string" ? r[0] : (l = r == null ? void 0 : r[0]) == null ? void 0 : l.label) || "确认", o = (typeof (r == null ? void 0 : r[1]) == "string" ? r[1] : (d = r == null ? void 0 : r[1]) == null ? void 0 : d.label) || "取消";
1117
- return /* @__PURE__ */ c("div", { className: "sa-interrupt-card", children: [
1118
- /* @__PURE__ */ c("div", { className: "sa-interrupt-content", children: [
1119
- /* @__PURE__ */ e(B, { name: "circle-alert", size: 16, color: "#f59e0b" }),
1159
+ function vt({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
1160
+ var o, l;
1161
+ const r = t.options, i = (typeof (r == null ? void 0 : r[0]) == "string" ? r[0] : (o = r == null ? void 0 : r[0]) == null ? void 0 : o.label) || "确认", d = (typeof (r == null ? void 0 : r[1]) == "string" ? r[1] : (l = r == null ? void 0 : r[1]) == null ? void 0 : l.label) || "取消";
1162
+ return /* @__PURE__ */ g("div", { className: "sa-interrupt-card", children: [
1163
+ /* @__PURE__ */ g("div", { className: "sa-interrupt-content", children: [
1164
+ /* @__PURE__ */ e(H, { name: "circle-alert", size: 16, color: "#f59e0b" }),
1120
1165
  /* @__PURE__ */ e("span", { children: t.content })
1121
1166
  ] }),
1122
- /* @__PURE__ */ c("div", { className: "sa-interrupt-actions", children: [
1123
- /* @__PURE__ */ c(
1167
+ /* @__PURE__ */ g("div", { className: "sa-interrupt-actions", children: [
1168
+ /* @__PURE__ */ g(
1124
1169
  "button",
1125
1170
  {
1126
1171
  className: `sa-interrupt-btn sa-interrupt-btn-primary ${s === "confirm" ? "sa-interrupt-btn-answered" : ""}`,
1127
1172
  disabled: n,
1128
1173
  onClick: () => a({ action: "confirm" }),
1129
1174
  children: [
1130
- /* @__PURE__ */ e(B, { name: "check", size: 14 }),
1175
+ /* @__PURE__ */ e(H, { name: "check", size: 14 }),
1131
1176
  " ",
1132
1177
  i
1133
1178
  ]
1134
1179
  }
1135
1180
  ),
1136
- /* @__PURE__ */ c(
1181
+ /* @__PURE__ */ g(
1137
1182
  "button",
1138
1183
  {
1139
1184
  className: `sa-interrupt-btn sa-interrupt-btn-secondary ${s === "cancel" ? "sa-interrupt-btn-answered" : ""}`,
1140
1185
  disabled: n,
1141
1186
  onClick: () => a({ action: "cancel" }),
1142
1187
  children: [
1143
- /* @__PURE__ */ e(B, { name: "x", size: 14 }),
1188
+ /* @__PURE__ */ e(H, { name: "x", size: 14 }),
1144
1189
  " ",
1145
- o
1190
+ d
1146
1191
  ]
1147
1192
  }
1148
1193
  )
@@ -1150,51 +1195,51 @@ function dt({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
1150
1195
  n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1151
1196
  ] });
1152
1197
  }
1153
- function ct({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
1154
- var p, u, g, b;
1155
- const r = t.options, i = (typeof (r == null ? void 0 : r[0]) == "string" ? r[0] : (p = r == null ? void 0 : r[0]) == null ? void 0 : p.label) || "批准", o = (typeof (r == null ? void 0 : r[1]) == "string" ? r[1] : (u = r == null ? void 0 : r[1]) == null ? void 0 : u.label) || "拒绝", l = (typeof (r == null ? void 0 : r[2]) == "string" ? r[2] : (g = r == null ? void 0 : r[2]) == null ? void 0 : g.label) || "跳过", d = ((b = t.metadata) == null ? void 0 : b.showSkip) !== !1;
1156
- return /* @__PURE__ */ c("div", { className: "sa-interrupt-card", children: [
1157
- /* @__PURE__ */ c("div", { className: "sa-interrupt-content", children: [
1158
- /* @__PURE__ */ e(B, { name: "circle-alert", size: 16, color: "#f59e0b" }),
1198
+ function yt({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
1199
+ var c, f, h, x;
1200
+ const r = t.options, i = (typeof (r == null ? void 0 : r[0]) == "string" ? r[0] : (c = r == null ? void 0 : r[0]) == null ? void 0 : c.label) || "批准", d = (typeof (r == null ? void 0 : r[1]) == "string" ? r[1] : (f = r == null ? void 0 : r[1]) == null ? void 0 : f.label) || "拒绝", o = (typeof (r == null ? void 0 : r[2]) == "string" ? r[2] : (h = r == null ? void 0 : r[2]) == null ? void 0 : h.label) || "跳过", l = ((x = t.metadata) == null ? void 0 : x.showSkip) !== !1;
1201
+ return /* @__PURE__ */ g("div", { className: "sa-interrupt-card", children: [
1202
+ /* @__PURE__ */ g("div", { className: "sa-interrupt-content", children: [
1203
+ /* @__PURE__ */ e(H, { name: "circle-alert", size: 16, color: "#f59e0b" }),
1159
1204
  /* @__PURE__ */ e("span", { children: t.content })
1160
1205
  ] }),
1161
- /* @__PURE__ */ c("div", { className: "sa-interrupt-actions", children: [
1162
- /* @__PURE__ */ c(
1206
+ /* @__PURE__ */ g("div", { className: "sa-interrupt-actions", children: [
1207
+ /* @__PURE__ */ g(
1163
1208
  "button",
1164
1209
  {
1165
1210
  className: `sa-interrupt-btn sa-interrupt-btn-primary ${s === "approve" ? "sa-interrupt-btn-answered" : ""}`,
1166
1211
  disabled: n,
1167
1212
  onClick: () => a({ action: "approve" }),
1168
1213
  children: [
1169
- /* @__PURE__ */ e(B, { name: "check", size: 14 }),
1214
+ /* @__PURE__ */ e(H, { name: "check", size: 14 }),
1170
1215
  " ",
1171
1216
  i
1172
1217
  ]
1173
1218
  }
1174
1219
  ),
1175
- /* @__PURE__ */ c(
1220
+ /* @__PURE__ */ g(
1176
1221
  "button",
1177
1222
  {
1178
1223
  className: `sa-interrupt-btn sa-interrupt-btn-danger ${s === "reject" ? "sa-interrupt-btn-answered" : ""}`,
1179
1224
  disabled: n,
1180
1225
  onClick: () => a({ action: "reject" }),
1181
1226
  children: [
1182
- /* @__PURE__ */ e(B, { name: "x", size: 14 }),
1227
+ /* @__PURE__ */ e(H, { name: "x", size: 14 }),
1183
1228
  " ",
1184
- o
1229
+ d
1185
1230
  ]
1186
1231
  }
1187
1232
  ),
1188
- d && /* @__PURE__ */ c(
1233
+ l && /* @__PURE__ */ g(
1189
1234
  "button",
1190
1235
  {
1191
1236
  className: `sa-interrupt-btn sa-interrupt-btn-secondary ${s === "skip" ? "sa-interrupt-btn-answered" : ""}`,
1192
1237
  disabled: n,
1193
1238
  onClick: () => a({ action: "skip" }),
1194
1239
  children: [
1195
- /* @__PURE__ */ e(B, { name: "chevron-right", size: 14 }),
1240
+ /* @__PURE__ */ e(H, { name: "chevron-right", size: 14 }),
1196
1241
  " ",
1197
- l
1242
+ o
1198
1243
  ]
1199
1244
  }
1200
1245
  )
@@ -1202,27 +1247,27 @@ function ct({ interrupt: t, onRespond: a, disabled: n, answeredAction: s }) {
1202
1247
  n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1203
1248
  ] });
1204
1249
  }
1205
- function pt(t) {
1250
+ function kt(t) {
1206
1251
  return typeof t == "string" ? { value: t, label: t } : t;
1207
1252
  }
1208
- function ut({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1209
- const r = (t.options ?? []).map(pt);
1210
- return /* @__PURE__ */ c("div", { className: "sa-interrupt-card", children: [
1211
- /* @__PURE__ */ c("div", { className: "sa-interrupt-content", children: [
1212
- /* @__PURE__ */ e(B, { name: "list", size: 16, color: "#6366f1" }),
1253
+ function Ct({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1254
+ const r = (t.options ?? []).map(kt);
1255
+ return /* @__PURE__ */ g("div", { className: "sa-interrupt-card", children: [
1256
+ /* @__PURE__ */ g("div", { className: "sa-interrupt-content", children: [
1257
+ /* @__PURE__ */ e(H, { name: "list", size: 16, color: "#6366f1" }),
1213
1258
  /* @__PURE__ */ e("span", { children: t.content })
1214
1259
  ] }),
1215
1260
  /* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((i) => {
1216
- const o = s === i.value;
1217
- return /* @__PURE__ */ c(
1261
+ const d = s === i.value;
1262
+ return /* @__PURE__ */ g(
1218
1263
  "button",
1219
1264
  {
1220
- className: `sa-interrupt-option ${i.danger ? "sa-interrupt-option-danger" : ""} ${o ? "sa-interrupt-option-selected" : ""}`,
1265
+ className: `sa-interrupt-option ${i.danger ? "sa-interrupt-option-danger" : ""} ${d ? "sa-interrupt-option-selected" : ""}`,
1221
1266
  disabled: n,
1222
1267
  onClick: () => a({ action: "select", value: i.value }),
1223
1268
  children: [
1224
- /* @__PURE__ */ e(B, { name: o ? "circle-check" : "circle", size: 14 }),
1225
- i.icon && /* @__PURE__ */ e(B, { name: i.icon, size: 14 }),
1269
+ /* @__PURE__ */ e(H, { name: d ? "circle-check" : "circle", size: 14 }),
1270
+ i.icon && /* @__PURE__ */ e(H, { name: i.icon, size: 14 }),
1226
1271
  /* @__PURE__ */ e("span", { children: i.label }),
1227
1272
  i.description && /* @__PURE__ */ e("span", { className: "sa-interrupt-option-desc", children: i.description })
1228
1273
  ]
@@ -1233,44 +1278,44 @@ function ut({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1233
1278
  n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1234
1279
  ] });
1235
1280
  }
1236
- function gt(t) {
1281
+ function Nt(t) {
1237
1282
  return typeof t == "string" ? { value: t, label: t } : t;
1238
1283
  }
1239
- function ft({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1240
- const r = (t.options ?? []).map(gt), [i, o] = E(
1284
+ function zt({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1285
+ const r = (t.options ?? []).map(Nt), [i, d] = E(
1241
1286
  () => new Set(Array.isArray(s) ? s : [])
1242
- ), l = (d) => {
1243
- n || o((p) => {
1244
- const u = new Set(p);
1245
- return u.has(d) ? u.delete(d) : u.add(d), u;
1287
+ ), o = (l) => {
1288
+ n || d((c) => {
1289
+ const f = new Set(c);
1290
+ return f.has(l) ? f.delete(l) : f.add(l), f;
1246
1291
  });
1247
1292
  };
1248
- return /* @__PURE__ */ c("div", { className: "sa-interrupt-card", children: [
1249
- /* @__PURE__ */ c("div", { className: "sa-interrupt-content", children: [
1250
- /* @__PURE__ */ e(B, { name: "list-checks", size: 16, color: "#6366f1" }),
1293
+ return /* @__PURE__ */ g("div", { className: "sa-interrupt-card", children: [
1294
+ /* @__PURE__ */ g("div", { className: "sa-interrupt-content", children: [
1295
+ /* @__PURE__ */ e(H, { name: "list-checks", size: 16, color: "#6366f1" }),
1251
1296
  /* @__PURE__ */ e("span", { children: t.content })
1252
1297
  ] }),
1253
- /* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((d) => /* @__PURE__ */ c(
1298
+ /* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((l) => /* @__PURE__ */ g(
1254
1299
  "button",
1255
1300
  {
1256
- className: `sa-interrupt-option ${i.has(d.value) ? "sa-interrupt-option-selected" : ""}`,
1301
+ className: `sa-interrupt-option ${i.has(l.value) ? "sa-interrupt-option-selected" : ""}`,
1257
1302
  disabled: n,
1258
- onClick: () => l(d.value),
1303
+ onClick: () => o(l.value),
1259
1304
  children: [
1260
- /* @__PURE__ */ e(B, { name: i.has(d.value) ? "square-check" : "square", size: 14 }),
1261
- /* @__PURE__ */ e("span", { children: d.label })
1305
+ /* @__PURE__ */ e(H, { name: i.has(l.value) ? "square-check" : "square", size: 14 }),
1306
+ /* @__PURE__ */ e("span", { children: l.label })
1262
1307
  ]
1263
1308
  },
1264
- d.value
1309
+ l.value
1265
1310
  )) }),
1266
- !n && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */ c(
1311
+ !n && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */ g(
1267
1312
  "button",
1268
1313
  {
1269
1314
  className: "sa-interrupt-btn sa-interrupt-btn-primary",
1270
1315
  disabled: i.size === 0,
1271
1316
  onClick: () => a({ action: "submit", value: Array.from(i) }),
1272
1317
  children: [
1273
- /* @__PURE__ */ e(B, { name: "check", size: 14 }),
1318
+ /* @__PURE__ */ e(H, { name: "check", size: 14 }),
1274
1319
  " 确认 (",
1275
1320
  i.size,
1276
1321
  ")"
@@ -1280,21 +1325,21 @@ function ft({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1280
1325
  n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1281
1326
  ] });
1282
1327
  }
1283
- function ht({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1284
- const [r, i] = E(s ?? ""), o = t.inputType ?? "text", l = o === "textarea", d = () => {
1328
+ function Tt({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1329
+ const [r, i] = E(s ?? ""), d = t.inputType ?? "text", o = d === "textarea", l = () => {
1285
1330
  n || t.required && !r.trim() || a({ action: "submit", value: r.trim() });
1286
1331
  };
1287
- return /* @__PURE__ */ c("div", { className: "sa-interrupt-card", children: [
1288
- /* @__PURE__ */ c("div", { className: "sa-interrupt-content", children: [
1289
- /* @__PURE__ */ e(B, { name: "text-cursor-input", size: 16, color: "#6366f1" }),
1332
+ return /* @__PURE__ */ g("div", { className: "sa-interrupt-card", children: [
1333
+ /* @__PURE__ */ g("div", { className: "sa-interrupt-content", children: [
1334
+ /* @__PURE__ */ e(H, { name: "text-cursor-input", size: 16, color: "#6366f1" }),
1290
1335
  /* @__PURE__ */ e("span", { children: t.content })
1291
1336
  ] }),
1292
- /* @__PURE__ */ e("div", { className: "sa-interrupt-input-area", children: l ? /* @__PURE__ */ e(
1337
+ /* @__PURE__ */ e("div", { className: "sa-interrupt-input-area", children: o ? /* @__PURE__ */ e(
1293
1338
  "textarea",
1294
1339
  {
1295
1340
  className: "sa-interrupt-textarea",
1296
1341
  value: r,
1297
- onChange: (p) => i(p.target.value),
1342
+ onChange: (c) => i(c.target.value),
1298
1343
  placeholder: t.placeholder,
1299
1344
  maxLength: t.maxLength,
1300
1345
  rows: 3,
@@ -1304,23 +1349,23 @@ function ht({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1304
1349
  "input",
1305
1350
  {
1306
1351
  className: "sa-interrupt-input",
1307
- type: o,
1352
+ type: d,
1308
1353
  value: r,
1309
- onChange: (p) => i(p.target.value),
1354
+ onChange: (c) => i(c.target.value),
1310
1355
  placeholder: t.placeholder,
1311
1356
  maxLength: t.maxLength,
1312
- onKeyDown: (p) => p.key === "Enter" && d(),
1357
+ onKeyDown: (c) => c.key === "Enter" && l(),
1313
1358
  disabled: n
1314
1359
  }
1315
1360
  ) }),
1316
- !n && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */ c(
1361
+ !n && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */ g(
1317
1362
  "button",
1318
1363
  {
1319
1364
  className: "sa-interrupt-btn sa-interrupt-btn-primary",
1320
1365
  disabled: t.required ? !r.trim() : !1,
1321
- onClick: d,
1366
+ onClick: l,
1322
1367
  children: [
1323
- /* @__PURE__ */ e(B, { name: "check", size: 14 }),
1368
+ /* @__PURE__ */ e(H, { name: "check", size: 14 }),
1324
1369
  " 提交"
1325
1370
  ]
1326
1371
  }
@@ -1328,32 +1373,32 @@ function ht({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1328
1373
  n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1329
1374
  ] });
1330
1375
  }
1331
- function mt({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1332
- const r = t.fields ?? [], [i, o] = E(() => {
1333
- const u = {};
1334
- for (const g of r)
1335
- u[g.name] = (s == null ? void 0 : s[g.name]) ?? g.defaultValue ?? "";
1336
- return u;
1337
- }), l = (u, g) => {
1338
- n || o((b) => ({ ...b, [u]: g }));
1339
- }, d = !n && r.every((u) => !u.required || i[u.name]), p = () => {
1340
- d && a({ action: "submit", value: i });
1376
+ function It({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1377
+ const r = t.fields ?? [], [i, d] = E(() => {
1378
+ const f = {};
1379
+ for (const h of r)
1380
+ f[h.name] = (s == null ? void 0 : s[h.name]) ?? h.defaultValue ?? "";
1381
+ return f;
1382
+ }), o = (f, h) => {
1383
+ n || d((x) => ({ ...x, [f]: h }));
1384
+ }, l = !n && r.every((f) => !f.required || i[f.name]), c = () => {
1385
+ l && a({ action: "submit", value: i });
1341
1386
  };
1342
- return /* @__PURE__ */ c("div", { className: "sa-interrupt-card", children: [
1343
- /* @__PURE__ */ c("div", { className: "sa-interrupt-content", children: [
1344
- /* @__PURE__ */ e(B, { name: "file-text", size: 16, color: "#6366f1" }),
1387
+ return /* @__PURE__ */ g("div", { className: "sa-interrupt-card", children: [
1388
+ /* @__PURE__ */ g("div", { className: "sa-interrupt-content", children: [
1389
+ /* @__PURE__ */ e(H, { name: "file-text", size: 16, color: "#6366f1" }),
1345
1390
  /* @__PURE__ */ e("span", { children: t.content })
1346
1391
  ] }),
1347
- /* @__PURE__ */ e("div", { className: "sa-interrupt-form", children: r.map((u) => /* @__PURE__ */ c("div", { className: "sa-interrupt-form-field", children: [
1348
- /* @__PURE__ */ c("label", { className: "sa-interrupt-form-label", children: [
1349
- u.label,
1350
- u.required && /* @__PURE__ */ e("span", { className: "sa-interrupt-form-required", children: "*" })
1392
+ /* @__PURE__ */ e("div", { className: "sa-interrupt-form", children: r.map((f) => /* @__PURE__ */ g("div", { className: "sa-interrupt-form-field", children: [
1393
+ /* @__PURE__ */ g("label", { className: "sa-interrupt-form-label", children: [
1394
+ f.label,
1395
+ f.required && /* @__PURE__ */ e("span", { className: "sa-interrupt-form-required", children: "*" })
1351
1396
  ] }),
1352
- xt(u, i[u.name], (g) => l(u.name, g), n)
1353
- ] }, u.name)) }),
1354
- !n && /* @__PURE__ */ c("div", { className: "sa-interrupt-actions", children: [
1355
- /* @__PURE__ */ c("button", { className: "sa-interrupt-btn sa-interrupt-btn-primary", disabled: !d, onClick: p, children: [
1356
- /* @__PURE__ */ e(B, { name: "check", size: 14 }),
1397
+ Et(f, i[f.name], (h) => o(f.name, h), n)
1398
+ ] }, f.name)) }),
1399
+ !n && /* @__PURE__ */ g("div", { className: "sa-interrupt-actions", children: [
1400
+ /* @__PURE__ */ g("button", { className: "sa-interrupt-btn sa-interrupt-btn-primary", disabled: !l, onClick: c, children: [
1401
+ /* @__PURE__ */ e(H, { name: "check", size: 14 }),
1357
1402
  " 提交"
1358
1403
  ] }),
1359
1404
  /* @__PURE__ */ e("button", { className: "sa-interrupt-btn sa-interrupt-btn-secondary", onClick: () => a({ action: "cancel" }), children: "取消" })
@@ -1361,34 +1406,34 @@ function mt({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1361
1406
  n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1362
1407
  ] });
1363
1408
  }
1364
- function ze(t) {
1409
+ function Se(t) {
1365
1410
  return typeof t == "string" ? { value: t, label: t } : t;
1366
1411
  }
1367
- function xt(t, a, n, s) {
1412
+ function Et(t, a, n, s) {
1368
1413
  switch (t.type) {
1369
1414
  case "textarea":
1370
1415
  return /* @__PURE__ */ e("textarea", { className: "sa-interrupt-textarea", value: a, onChange: (r) => n(r.target.value), placeholder: t.placeholder, rows: 3, disabled: s });
1371
1416
  case "select": {
1372
- const r = (t.options ?? []).map(ze);
1373
- return /* @__PURE__ */ c("select", { className: "sa-interrupt-select", value: a, onChange: (i) => n(i.target.value), disabled: s, children: [
1417
+ const r = (t.options ?? []).map(Se);
1418
+ return /* @__PURE__ */ g("select", { className: "sa-interrupt-select", value: a, onChange: (i) => n(i.target.value), disabled: s, children: [
1374
1419
  /* @__PURE__ */ e("option", { value: "", children: "请选择" }),
1375
1420
  r.map((i) => /* @__PURE__ */ e("option", { value: i.value, children: i.label }, i.value))
1376
1421
  ] });
1377
1422
  }
1378
1423
  case "multiSelect": {
1379
- const r = (t.options ?? []).map(ze), i = Array.isArray(a) ? a : [], o = (l) => {
1380
- s || n(i.includes(l) ? i.filter((d) => d !== l) : [...i, l]);
1424
+ const r = (t.options ?? []).map(Se), i = Array.isArray(a) ? a : [], d = (o) => {
1425
+ s || n(i.includes(o) ? i.filter((l) => l !== o) : [...i, o]);
1381
1426
  };
1382
- return /* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((l) => /* @__PURE__ */ e(
1427
+ return /* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((o) => /* @__PURE__ */ e(
1383
1428
  "button",
1384
1429
  {
1385
1430
  type: "button",
1386
- className: `sa-interrupt-option ${i.includes(l.value) ? "sa-interrupt-option-selected" : ""}`,
1431
+ className: `sa-interrupt-option ${i.includes(o.value) ? "sa-interrupt-option-selected" : ""}`,
1387
1432
  disabled: s,
1388
- onClick: () => o(l.value),
1389
- children: l.label
1433
+ onClick: () => d(o.value),
1434
+ children: o.label
1390
1435
  },
1391
- l.value
1436
+ o.value
1392
1437
  )) });
1393
1438
  }
1394
1439
  case "password":
@@ -1397,29 +1442,29 @@ function xt(t, a, n, s) {
1397
1442
  return /* @__PURE__ */ e("input", { className: "sa-interrupt-input", type: t.type === "number" ? "number" : t.type === "date" ? "date" : "text", value: a, onChange: (r) => n(r.target.value), placeholder: t.placeholder, disabled: s });
1398
1443
  }
1399
1444
  }
1400
- function wt({ interrupt: t, resolved: a, response: n, onRespond: s }) {
1445
+ function Mt({ interrupt: t, resolved: a, response: n, onRespond: s }) {
1401
1446
  const r = a, i = n == null ? void 0 : n.value;
1402
1447
  switch (t.interruptType) {
1403
1448
  case "confirm":
1404
- return /* @__PURE__ */ e(dt, { interrupt: t, onRespond: s, disabled: r, answeredAction: n == null ? void 0 : n.action });
1449
+ return /* @__PURE__ */ e(vt, { interrupt: t, onRespond: s, disabled: r, answeredAction: n == null ? void 0 : n.action });
1405
1450
  case "approve":
1406
- return /* @__PURE__ */ e(ct, { interrupt: t, onRespond: s, disabled: r, answeredAction: n == null ? void 0 : n.action });
1451
+ return /* @__PURE__ */ e(yt, { interrupt: t, onRespond: s, disabled: r, answeredAction: n == null ? void 0 : n.action });
1407
1452
  case "select":
1408
- return /* @__PURE__ */ e(ut, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1453
+ return /* @__PURE__ */ e(Ct, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1409
1454
  case "multiSelect":
1410
- return /* @__PURE__ */ e(ft, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1455
+ return /* @__PURE__ */ e(zt, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1411
1456
  case "input":
1412
- return /* @__PURE__ */ e(ht, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1457
+ return /* @__PURE__ */ e(Tt, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1413
1458
  case "form":
1414
- return /* @__PURE__ */ e(mt, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1459
+ return /* @__PURE__ */ e(It, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1415
1460
  default:
1416
- return /* @__PURE__ */ c("div", { className: "sa-interrupt-unknown", children: [
1461
+ return /* @__PURE__ */ g("div", { className: "sa-interrupt-unknown", children: [
1417
1462
  "未知的交互类型: ",
1418
1463
  t.interruptType
1419
1464
  ] });
1420
1465
  }
1421
1466
  }
1422
- const bt = [
1467
+ const St = [
1423
1468
  { value: 1, label: "事实错误" },
1424
1469
  { value: 2, label: "逻辑问题" },
1425
1470
  { value: 3, label: "不相关" },
@@ -1427,78 +1472,78 @@ const bt = [
1427
1472
  { value: 5, label: "冗长啰嗦" },
1428
1473
  { value: 6, label: "难以理解" }
1429
1474
  ];
1430
- function vt({ message: t, onCopy: a, onRegenerate: n, onFeedback: s }) {
1431
- const { status: r, cancelFeedback: i } = Z(), [o, l] = E(null), [d, p] = E(!1), [u, g] = E(!1), b = R(null), m = N(() => {
1432
- a(), p(!0), setTimeout(() => p(!1), 2e3);
1433
- }, [a]), x = N(() => {
1434
- o === "like" ? (l(null), i(t.id)) : (l("like"), g(!1), s == null || s(t.id, "like"));
1435
- }, [o, t.id, s, i]), f = N(() => {
1436
- o === "dislike" ? (l(null), g(!1), i(t.id)) : g(!0);
1437
- }, [o, t.id, i]), y = N((H, k) => {
1438
- l("dislike"), g(!1), s == null || s(t.id, "dislike", { reason: H, remark: (k == null ? void 0 : k.trim()) || void 0 });
1439
- }, [t.id, s]), z = N(() => {
1440
- g(!1);
1475
+ function At({ message: t, onCopy: a, onRegenerate: n, onFeedback: s }) {
1476
+ const { status: r, cancelFeedback: i } = J(), [d, o] = E(null), [l, c] = E(!1), [f, h] = E(!1), x = _(null), b = k(() => {
1477
+ a(), c(!0), setTimeout(() => c(!1), 2e3);
1478
+ }, [a]), y = k(() => {
1479
+ d === "like" ? (o(null), i(t.id)) : (o("like"), h(!1), s == null || s(t.id, "like"));
1480
+ }, [d, t.id, s, i]), p = k(() => {
1481
+ d === "dislike" ? (o(null), h(!1), i(t.id)) : h(!0);
1482
+ }, [d, t.id, i]), m = k((A, v) => {
1483
+ o("dislike"), h(!1), s == null || s(t.id, "dislike", { reason: A, remark: (v == null ? void 0 : v.trim()) || void 0 });
1484
+ }, [t.id, s]), C = k(() => {
1485
+ h(!1);
1441
1486
  }, []);
1442
- return P(() => {
1443
- if (!u) return;
1444
- const H = (C) => {
1445
- b.current && !b.current.contains(C.target) && g(!1);
1446
- }, k = (C) => {
1447
- C.key === "Escape" && g(!1);
1487
+ return j(() => {
1488
+ if (!f) return;
1489
+ const A = (N) => {
1490
+ x.current && !x.current.contains(N.target) && h(!1);
1491
+ }, v = (N) => {
1492
+ N.key === "Escape" && h(!1);
1448
1493
  };
1449
- return document.addEventListener("mousedown", H), document.addEventListener("keydown", k), () => {
1450
- document.removeEventListener("mousedown", H), document.removeEventListener("keydown", k);
1494
+ return document.addEventListener("mousedown", A), document.addEventListener("keydown", v), () => {
1495
+ document.removeEventListener("mousedown", A), document.removeEventListener("keydown", v);
1451
1496
  };
1452
- }, [u]), r !== "ready" && r !== "error" ? null : /* @__PURE__ */ c("div", { className: "sa-action-bar", children: [
1453
- /* @__PURE__ */ c("button", { className: "sa-action-btn", onClick: m, title: "复制", children: [
1454
- /* @__PURE__ */ e(B, { name: d ? "circle-check" : "copy", size: 14 }),
1497
+ }, [f]), r !== "ready" && r !== "error" ? null : /* @__PURE__ */ g("div", { className: "sa-action-bar", children: [
1498
+ /* @__PURE__ */ g("button", { className: "sa-action-btn", onClick: b, title: "复制", children: [
1499
+ /* @__PURE__ */ e(H, { name: l ? "circle-check" : "copy", size: 14 }),
1455
1500
  " ",
1456
- d ? "已复制" : "复制"
1501
+ l ? "已复制" : "复制"
1457
1502
  ] }),
1458
- n && /* @__PURE__ */ c("button", { className: "sa-action-btn", onClick: n, title: "重新生成", children: [
1459
- /* @__PURE__ */ e(B, { name: "refresh-cw", size: 14 }),
1503
+ n && /* @__PURE__ */ g("button", { className: "sa-action-btn", onClick: n, title: "重新生成", children: [
1504
+ /* @__PURE__ */ e(H, { name: "refresh-cw", size: 14 }),
1460
1505
  " 重新生成"
1461
1506
  ] }),
1462
- s && /* @__PURE__ */ c(V, { children: [
1507
+ s && /* @__PURE__ */ g(K, { children: [
1463
1508
  /* @__PURE__ */ e("span", { className: "sa-action-divider" }),
1464
1509
  /* @__PURE__ */ e(
1465
1510
  "button",
1466
1511
  {
1467
- className: `sa-action-btn ${o === "like" ? "sa-action-btn-active" : ""}`,
1468
- onClick: x,
1512
+ className: `sa-action-btn ${d === "like" ? "sa-action-btn-active" : ""}`,
1513
+ onClick: y,
1469
1514
  title: "有用",
1470
1515
  "aria-label": "点赞",
1471
- children: /* @__PURE__ */ e(B, { name: "thumbs-up", size: 14 })
1516
+ children: /* @__PURE__ */ e(H, { name: "thumbs-up", size: 14 })
1472
1517
  }
1473
1518
  ),
1474
1519
  /* @__PURE__ */ e(
1475
1520
  "button",
1476
1521
  {
1477
- className: `sa-action-btn ${o === "dislike" ? "sa-action-btn-active" : ""}`,
1478
- onClick: f,
1522
+ className: `sa-action-btn ${d === "dislike" ? "sa-action-btn-active" : ""}`,
1523
+ onClick: p,
1479
1524
  title: "无用",
1480
1525
  "aria-label": "踩",
1481
- "aria-expanded": u,
1526
+ "aria-expanded": f,
1482
1527
  "aria-haspopup": "dialog",
1483
- children: /* @__PURE__ */ e(B, { name: "thumbs-down", size: 14 })
1528
+ children: /* @__PURE__ */ e(H, { name: "thumbs-down", size: 14 })
1484
1529
  }
1485
1530
  )
1486
1531
  ] }),
1487
- u && /* @__PURE__ */ e("div", { ref: b, children: /* @__PURE__ */ e(yt, { onSubmit: y, onCancel: z }) })
1532
+ f && /* @__PURE__ */ e("div", { ref: x, children: /* @__PURE__ */ e($t, { onSubmit: m, onCancel: C }) })
1488
1533
  ] });
1489
1534
  }
1490
- function yt({ onSubmit: t, onCancel: a }) {
1535
+ function $t({ onSubmit: t, onCancel: a }) {
1491
1536
  const [n, s] = E(void 0), [r, i] = E("");
1492
- return /* @__PURE__ */ c("div", { className: "sa-dislike-panel", children: [
1537
+ return /* @__PURE__ */ g("div", { className: "sa-dislike-panel", children: [
1493
1538
  /* @__PURE__ */ e("div", { className: "sa-dislike-panel-title", children: "请选择不满意的原因(可选)" }),
1494
- /* @__PURE__ */ e("div", { className: "sa-dislike-reasons", children: bt.map((o) => /* @__PURE__ */ e(
1539
+ /* @__PURE__ */ e("div", { className: "sa-dislike-reasons", children: St.map((d) => /* @__PURE__ */ e(
1495
1540
  "button",
1496
1541
  {
1497
- className: `sa-dislike-reason-btn ${n === o.value ? "active" : ""}`,
1498
- onClick: () => s(n === o.value ? void 0 : o.value),
1499
- children: o.label
1542
+ className: `sa-dislike-reason-btn ${n === d.value ? "active" : ""}`,
1543
+ onClick: () => s(n === d.value ? void 0 : d.value),
1544
+ children: d.label
1500
1545
  },
1501
- o.value
1546
+ d.value
1502
1547
  )) }),
1503
1548
  /* @__PURE__ */ e(
1504
1549
  "textarea",
@@ -1507,233 +1552,247 @@ function yt({ onSubmit: t, onCancel: a }) {
1507
1552
  placeholder: "补充描述(选填,≤500 字)",
1508
1553
  maxLength: 500,
1509
1554
  value: r,
1510
- onChange: (o) => i(o.target.value),
1555
+ onChange: (d) => i(d.target.value),
1511
1556
  rows: 2
1512
1557
  }
1513
1558
  ),
1514
- /* @__PURE__ */ c("div", { className: "sa-dislike-actions", children: [
1559
+ /* @__PURE__ */ g("div", { className: "sa-dislike-actions", children: [
1515
1560
  /* @__PURE__ */ e("button", { className: "sa-dislike-submit", onClick: () => t(n, r || void 0), children: "提交" }),
1516
1561
  /* @__PURE__ */ e("button", { className: "sa-dislike-cancel", onClick: a, children: "取消" })
1517
1562
  ] })
1518
1563
  ] });
1519
1564
  }
1520
- const kt = /^(https?:\/\/|data:|blob:|\/\/|\/|\.\/|\.\.\/)/;
1521
- function Ie({ src: t, alt: a }) {
1522
- return t ? kt.test(t) ? /* @__PURE__ */ e("img", { src: t, alt: a ?? "", className: "sa-msg-avatar", draggable: !1 }) : /* @__PURE__ */ e("span", { className: "sa-msg-avatar sa-msg-avatar-text", children: t }) : null;
1565
+ const Dt = /^(https?:\/\/|data:|blob:|\/\/|\/|\.\/|\.\.\/)/;
1566
+ function Ae({ src: t, alt: a }) {
1567
+ return t ? Dt.test(t) ? /* @__PURE__ */ e("img", { src: t, alt: a ?? "", className: "sa-msg-avatar", draggable: !1 }) : /* @__PURE__ */ e("span", { className: "sa-msg-avatar sa-msg-avatar-text", children: t }) : null;
1523
1568
  }
1524
- function Ct({
1569
+ function Lt({
1525
1570
  message: t,
1526
1571
  isStreaming: a,
1527
1572
  isLast: n,
1528
1573
  slots: s,
1529
1574
  avatar: r,
1530
1575
  artifactPreview: i,
1531
- showTimestamp: o
1576
+ showTimestamp: d
1532
1577
  }) {
1533
- const { regenerate: l, feedback: d, respondToInterrupt: p } = Z(), u = N(() => {
1534
- var S;
1535
- const C = t.parts.filter((D) => D.type === "text").map((D) => D.content).join(`
1578
+ const { regenerate: o, feedback: l, respondToInterrupt: c } = J(), f = k(() => {
1579
+ var $;
1580
+ const N = t.parts.filter((M) => M.type === "text").map((M) => M.content).join(`
1536
1581
  `);
1537
- (S = navigator.clipboard) == null || S.writeText(C).catch(() => {
1582
+ ($ = navigator.clipboard) == null || $.writeText(N).catch(() => {
1538
1583
  });
1539
- }, [t]), g = t.role === "user", b = s.Message;
1540
- if (b)
1584
+ }, [t]), h = t.role === "user", x = s.Message;
1585
+ if (x)
1541
1586
  return /* @__PURE__ */ e(
1542
- b,
1587
+ x,
1543
1588
  {
1544
1589
  message: t,
1545
1590
  isStreaming: a,
1546
1591
  isLast: n,
1547
1592
  avatar: r,
1548
1593
  slots: s,
1549
- onCopy: u,
1550
- onRegenerate: l,
1551
- onFeedback: d,
1552
- showTimestamp: o
1594
+ onCopy: f,
1595
+ onRegenerate: o,
1596
+ onFeedback: l,
1597
+ showTimestamp: d
1553
1598
  }
1554
1599
  );
1555
- const m = s.TextPart ?? tt, x = s.ThinkingPart ?? nt, f = s.ToolCallPart ?? st, y = s.ToolResultPart ?? ot, z = s.ErrorPart ?? lt, H = s.ActionBar ?? vt, k = !g && t.parts.some((C) => C.type === "text" && C.content);
1556
- return /* @__PURE__ */ c(
1600
+ const b = s.TextPart ?? ut, y = s.ThinkingPart ?? ht, p = s.ToolCallPart ?? mt, m = s.ToolResultPart ?? wt, C = s.ErrorPart ?? bt, A = s.ActionBar ?? At, v = !h && t.parts.some((N) => N.type === "text" && N.content);
1601
+ return /* @__PURE__ */ g(
1557
1602
  "div",
1558
1603
  {
1559
- className: `sa-message ${g ? "sa-message-user" : "sa-message-assistant"}`,
1604
+ className: `sa-message ${h ? "sa-message-user" : "sa-message-assistant"}`,
1560
1605
  children: [
1561
- !g && /* @__PURE__ */ e(
1562
- Ie,
1606
+ !h && /* @__PURE__ */ e(
1607
+ Ae,
1563
1608
  {
1564
- src: (r == null ? void 0 : r.assistant) || (a && n ? X.assistantAvatarGenerating : X.assistantAvatar),
1609
+ src: (r == null ? void 0 : r.assistant) || (a && n ? U.assistantAvatarGenerating : U.assistantAvatar),
1565
1610
  alt: "AI"
1566
1611
  }
1567
1612
  ),
1568
- /* @__PURE__ */ c("div", { className: "sa-message-content", children: [
1569
- o && /* @__PURE__ */ e(
1613
+ /* @__PURE__ */ g("div", { className: "sa-message-content", children: [
1614
+ d && /* @__PURE__ */ e(
1570
1615
  "span",
1571
1616
  {
1572
- className: `sa-message-time ${g ? "sa-message-time-right" : ""}`,
1573
- children: Ze(t.timestamp)
1617
+ className: `sa-message-time ${h ? "sa-message-time-right" : ""}`,
1618
+ children: lt(t.timestamp)
1574
1619
  }
1575
1620
  ),
1576
- /* @__PURE__ */ c("div", { className: "sa-message-body", children: [
1577
- t.parts.map((C, S) => {
1578
- switch (C.type) {
1621
+ /* @__PURE__ */ g("div", { className: "sa-message-body", children: [
1622
+ t.parts.map((N, $) => {
1623
+ switch (N.type) {
1579
1624
  case "text":
1580
- return /* @__PURE__ */ e(m, { content: C.content }, S);
1625
+ return /* @__PURE__ */ e(b, { content: N.content }, $);
1581
1626
  case "thinking":
1582
- return /* @__PURE__ */ e(x, { content: C.content }, S);
1627
+ return /* @__PURE__ */ e(y, { content: N.content }, $);
1583
1628
  case "tool_call":
1584
1629
  return /* @__PURE__ */ e(
1585
- f,
1630
+ p,
1586
1631
  {
1587
- toolName: C.toolName,
1588
- toolCallId: C.toolCallId,
1589
- args: C.args
1632
+ toolName: N.toolName,
1633
+ toolCallId: N.toolCallId,
1634
+ args: N.args
1590
1635
  },
1591
- S
1636
+ $
1592
1637
  );
1593
1638
  case "tool_result":
1594
1639
  return /* @__PURE__ */ e(
1595
- y,
1640
+ m,
1596
1641
  {
1597
- toolName: C.toolName,
1598
- toolCallId: C.toolCallId,
1599
- content: C.content,
1600
- artifacts: C.artifacts,
1601
- renderMode: C.renderMode,
1602
- html: C.html,
1642
+ toolName: N.toolName,
1643
+ toolCallId: N.toolCallId,
1644
+ content: N.content,
1645
+ artifacts: N.artifacts,
1646
+ renderMode: N.renderMode,
1647
+ html: N.html,
1603
1648
  artifactPreview: i
1604
1649
  },
1605
- S
1650
+ $
1606
1651
  );
1607
1652
  case "error":
1608
1653
  return /* @__PURE__ */ e(
1609
- z,
1654
+ C,
1610
1655
  {
1611
- content: C.content,
1612
- onRetry: l
1656
+ content: N.content,
1657
+ onRetry: o
1613
1658
  },
1614
- S
1659
+ $
1615
1660
  );
1616
1661
  case "interrupt":
1617
1662
  return /* @__PURE__ */ e(
1618
- wt,
1663
+ Mt,
1619
1664
  {
1620
- interrupt: C.interrupt,
1621
- resolved: C.resolved ?? !1,
1622
- response: C.response,
1623
- onRespond: (D) => p(C.interrupt.interruptId, D)
1665
+ interrupt: N.interrupt,
1666
+ resolved: N.resolved ?? !1,
1667
+ response: N.response,
1668
+ onRespond: (M) => c(N.interrupt.interruptId, M)
1624
1669
  },
1625
- S
1670
+ $
1626
1671
  );
1627
1672
  default:
1628
1673
  return null;
1629
1674
  }
1630
1675
  }),
1631
- a && n && !g && !k && /* @__PURE__ */ e("span", { className: "sa-thinking-indicator", children: "思考中…" }),
1632
- !g && !a && k && /* @__PURE__ */ e(
1633
- H,
1676
+ a && n && !h && !v && /* @__PURE__ */ e("span", { className: "sa-thinking-indicator", children: "思考中…" }),
1677
+ !h && !a && v && /* @__PURE__ */ e(
1678
+ A,
1634
1679
  {
1635
1680
  message: t,
1636
- onCopy: u,
1637
- onRegenerate: n ? l : void 0,
1638
- onFeedback: d
1681
+ onCopy: f,
1682
+ onRegenerate: n ? o : void 0,
1683
+ onFeedback: l
1639
1684
  }
1640
1685
  )
1641
1686
  ] })
1642
1687
  ] }),
1643
- g && (r == null ? void 0 : r.user) && /* @__PURE__ */ e(Ie, { src: r.user, alt: "用户" })
1688
+ h && (r == null ? void 0 : r.user) && /* @__PURE__ */ e(Ae, { src: r.user, alt: "用户" })
1644
1689
  ]
1645
1690
  }
1646
1691
  );
1647
1692
  }
1648
- function Nt({ message: t, suggestedPrompts: a, onPromptClick: n, capabilities: s, quickLinks: r, logo: i }) {
1649
- return /* @__PURE__ */ c("div", { className: "flex flex-col gap-8 py-2", children: [
1650
- /* @__PURE__ */ c("div", { className: "flex flex-col items-center gap-1 opacity-0 animate-sa-home-fade-in", children: [
1651
- /* @__PURE__ */ e("img", { src: i || X.logo, alt: "AI 助手", className: "block max-w-16 shrink-0 animate-sa-logo-float", draggable: !1 }),
1693
+ function Rt({ message: t, suggestedPrompts: a, onPromptClick: n, capabilities: s, quickLinks: r, logo: i, openPanel: d }) {
1694
+ const o = (l) => {
1695
+ if (l.onClick) {
1696
+ l.onClick();
1697
+ return;
1698
+ }
1699
+ const c = l.action;
1700
+ if (!c) {
1701
+ l.prompt && n(l.prompt);
1702
+ return;
1703
+ }
1704
+ d == null || d(c.type === "link" ? c : { ...c, title: c.title ?? l.label });
1705
+ };
1706
+ return /* @__PURE__ */ g("div", { className: "flex flex-col gap-8 py-2", children: [
1707
+ /* @__PURE__ */ g("div", { className: "flex flex-col items-center gap-1 opacity-0 animate-sa-home-fade-in", children: [
1708
+ /* @__PURE__ */ e("img", { src: i || U.logo, alt: "AI 助手", className: "block max-w-16 shrink-0 animate-sa-logo-float", draggable: !1 }),
1652
1709
  /* @__PURE__ */ e("h3", { className: "sa-shimmer-text m-0 mb-1 text-[18px] font-bold leading-[1.3] text-[#333] animate-sa-title-shimmer", children: t || "你好!有什么可以帮你的?" })
1653
1710
  ] }),
1654
- s && s.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-col items-start gap-4 opacity-0 animate-sa-home-fade-in", style: { animationDelay: "150ms" }, children: s.map((o) => /* @__PURE__ */ c("div", { className: "inline-flex w-full max-w-full min-w-0 items-center gap-[7px]", children: [
1655
- o.icon && /* @__PURE__ */ e("img", { src: o.icon, alt: "", className: "h-[18px] w-[18px] shrink-0 object-contain", draggable: !1 }),
1656
- /* @__PURE__ */ e("span", { className: "shrink-0 text-[14px] leading-[1.4] text-[#333]", children: o.label }),
1657
- o.desc && /* @__PURE__ */ c(V, { children: [
1711
+ s && s.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-col items-start gap-4 opacity-0 animate-sa-home-fade-in", style: { animationDelay: "150ms" }, children: s.map((l) => /* @__PURE__ */ g("div", { className: "inline-flex w-full max-w-full min-w-0 items-center gap-[7px]", children: [
1712
+ l.icon && /* @__PURE__ */ e("img", { src: l.icon, alt: "", className: "h-[18px] w-[18px] shrink-0 object-contain", draggable: !1 }),
1713
+ /* @__PURE__ */ e("span", { className: "shrink-0 text-[14px] leading-[1.4] text-[#333]", children: l.label }),
1714
+ l.desc && /* @__PURE__ */ g(K, { children: [
1658
1715
  /* @__PURE__ */ e("span", { className: "h-[13px] w-px shrink-0 bg-[#DCDCDC]" }),
1659
- /* @__PURE__ */ e("span", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-[14px] leading-[1.4] text-[#9A9A9A]", children: o.desc })
1716
+ /* @__PURE__ */ e("span", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-[14px] leading-[1.4] text-[#9A9A9A]", children: l.desc })
1660
1717
  ] })
1661
- ] }, o.label)) }),
1662
- a && a.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-col items-start gap-3", children: a.map((o, l) => /* @__PURE__ */ c(
1718
+ ] }, l.label)) }),
1719
+ a && a.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-col items-start gap-3", children: a.map((l, c) => /* @__PURE__ */ g(
1663
1720
  "button",
1664
1721
  {
1665
1722
  type: "button",
1666
1723
  className: "sa-chip inline-flex h-7 items-center gap-1 rounded-md px-3 text-[14px] leading-none text-[#333] opacity-0 transition-colors animate-sa-chip-in",
1667
- style: { animationDelay: `${300 + l * 130}ms` },
1668
- onClick: () => n(o),
1724
+ style: { animationDelay: `${300 + c * 130}ms` },
1725
+ onClick: () => n(l),
1669
1726
  children: [
1670
- /* @__PURE__ */ e("span", { className: "sa-chip-text overflow-hidden text-ellipsis whitespace-nowrap", children: o }),
1727
+ /* @__PURE__ */ e("span", { className: "sa-chip-text overflow-hidden text-ellipsis whitespace-nowrap", children: l }),
1671
1728
  /* @__PURE__ */ e("svg", { width: 13, height: 13, viewBox: "0 0 14 14", fill: "none", className: "shrink-0 text-[#9A9A9A]", "aria-hidden": "true", children: /* @__PURE__ */ e("path", { d: "M5 3L9 7L5 11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
1672
1729
  ]
1673
1730
  },
1674
- `${o}-${l}`
1731
+ `${l}-${c}`
1675
1732
  )) }),
1676
- r && r.length > 0 && /* @__PURE__ */ c("div", { className: "opacity-0 animate-sa-home-fade-in", style: { animationDelay: "420ms" }, children: [
1733
+ r && r.length > 0 && /* @__PURE__ */ g("div", { className: "opacity-0 animate-sa-home-fade-in", style: { animationDelay: "420ms" }, children: [
1677
1734
  /* @__PURE__ */ e("div", { className: "mb-3 text-[14px] leading-none text-[#A0A0A0]", children: "快速查看" }),
1678
- /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-[22px]", children: r.map((o) => /* @__PURE__ */ c(
1735
+ /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-[22px]", children: r.map((l) => /* @__PURE__ */ g(
1679
1736
  "button",
1680
1737
  {
1681
1738
  type: "button",
1682
1739
  className: "inline-flex items-center gap-[7px] rounded-md px-1 py-1 transition-colors hover:bg-[#F5F5F5]",
1683
- onClick: () => {
1684
- o.onClick ? o.onClick() : o.prompt && n(o.prompt);
1685
- },
1740
+ onClick: () => o(l),
1686
1741
  children: [
1687
- o.icon && /* @__PURE__ */ e("span", { className: "flex h-[18px] w-[18px] shrink-0 items-center justify-center opacity-70", children: /* @__PURE__ */ e("img", { src: o.icon, alt: "", width: 18, height: 18, draggable: !1 }) }),
1688
- /* @__PURE__ */ e("span", { className: "text-[14px] leading-none text-[#333] transition-colors hover:text-[#1881F0]", children: o.label })
1742
+ l.icon && /* @__PURE__ */ e("span", { className: "flex h-[18px] w-[18px] shrink-0 items-center justify-center opacity-70", children: /* @__PURE__ */ e("img", { src: l.icon, alt: "", width: 18, height: 18, draggable: !1 }) }),
1743
+ /* @__PURE__ */ e("span", { className: "text-[14px] leading-none text-[#333] transition-colors hover:text-[#1881F0]", children: l.label })
1689
1744
  ]
1690
1745
  },
1691
- o.label
1746
+ l.label
1692
1747
  )) })
1693
1748
  ] })
1694
1749
  ] });
1695
1750
  }
1696
- function $e({ slots: t, welcomeMessage: a, suggestedPrompts: n, avatar: s, artifactPreview: r, capabilities: i, quickLinks: o, logo: l, showTimestamp: d }) {
1697
- const { messages: p, status: u, sendMessage: g } = Z(), { containerRef: b } = Je([p]), m = u === "streaming", x = t.WelcomeScreen ?? Nt;
1698
- return p.length === 0 ? /* @__PURE__ */ e("div", { className: "sa-thread", ref: b, children: /* @__PURE__ */ e(
1699
- x,
1700
- {
1701
- message: a,
1702
- suggestedPrompts: n,
1703
- onPromptClick: g,
1704
- capabilities: i,
1705
- quickLinks: o,
1706
- logo: l
1707
- }
1708
- ) }) : /* @__PURE__ */ e("div", { className: "sa-thread", ref: b, children: p.map((f, y) => /* @__PURE__ */ e(
1709
- Ct,
1751
+ function He({ slots: t, welcomeMessage: a, suggestedPrompts: n, avatar: s, artifactPreview: r, capabilities: i, quickLinks: d, logo: o, showTimestamp: l }) {
1752
+ const { messages: c, status: f, sendMessage: h, openPanel: x } = J(), { containerRef: b } = dt([c]), y = f === "streaming", p = t.WelcomeScreen ?? Rt, m = t.AppendContainer;
1753
+ return c.length === 0 ? /* @__PURE__ */ g("div", { className: "sa-thread", ref: b, children: [
1754
+ /* @__PURE__ */ e(
1755
+ p,
1756
+ {
1757
+ message: a,
1758
+ suggestedPrompts: n,
1759
+ onPromptClick: h,
1760
+ capabilities: i,
1761
+ quickLinks: d,
1762
+ logo: o,
1763
+ openPanel: x
1764
+ }
1765
+ ),
1766
+ m && /* @__PURE__ */ e(m, { openPanel: x })
1767
+ ] }) : /* @__PURE__ */ e("div", { className: "sa-thread", ref: b, children: c.map((C, A) => /* @__PURE__ */ e(
1768
+ Lt,
1710
1769
  {
1711
- message: f,
1712
- isStreaming: m,
1713
- isLast: y === p.length - 1,
1770
+ message: C,
1771
+ isStreaming: y,
1772
+ isLast: A === c.length - 1,
1714
1773
  slots: t,
1715
1774
  avatar: s,
1716
1775
  artifactPreview: r,
1717
- showTimestamp: d
1776
+ showTimestamp: l
1718
1777
  },
1719
- f.id
1778
+ C.id
1720
1779
  )) });
1721
1780
  }
1722
- function zt({ items: t, activeIndex: a, onSelect: n }) {
1723
- const s = R(null);
1724
- return P(() => {
1781
+ function _t({ items: t, activeIndex: a, onSelect: n }) {
1782
+ const s = _(null);
1783
+ return j(() => {
1725
1784
  var i;
1726
1785
  const r = (i = s.current) == null ? void 0 : i.children[a];
1727
1786
  r == null || r.scrollIntoView({ block: "nearest" });
1728
- }, [a]), t.length === 0 ? /* @__PURE__ */ e("div", { className: "sa-slash-menu", children: /* @__PURE__ */ e("div", { className: "sa-slash-menu-empty", children: "没有匹配的技能" }) }) : /* @__PURE__ */ e("div", { className: "sa-slash-menu", ref: s, children: t.map((r, i) => /* @__PURE__ */ c(
1787
+ }, [a]), t.length === 0 ? /* @__PURE__ */ e("div", { className: "sa-slash-menu", children: /* @__PURE__ */ e("div", { className: "sa-slash-menu-empty", children: "没有匹配的技能" }) }) : /* @__PURE__ */ e("div", { className: "sa-slash-menu", ref: s, children: t.map((r, i) => /* @__PURE__ */ g(
1729
1788
  "div",
1730
1789
  {
1731
1790
  className: `sa-slash-menu-item${i === a ? " sa-slash-menu-item--active" : ""}`,
1732
- onMouseDown: (o) => {
1733
- o.preventDefault(), n(r);
1791
+ onMouseDown: (d) => {
1792
+ d.preventDefault(), n(r);
1734
1793
  },
1735
1794
  children: [
1736
- /* @__PURE__ */ c("span", { className: "sa-slash-menu-item-name", children: [
1795
+ /* @__PURE__ */ g("span", { className: "sa-slash-menu-item-name", children: [
1737
1796
  "/",
1738
1797
  r.name
1739
1798
  ] }),
@@ -1743,97 +1802,97 @@ function zt({ items: t, activeIndex: a, onSelect: n }) {
1743
1802
  r.code
1744
1803
  )) });
1745
1804
  }
1746
- function It({ sdk: t, input: a, onSelect: n }) {
1747
- const [s, r] = E([]), [i, o] = E(!1), [l, d] = E(0), p = R(!1);
1748
- P(() => {
1749
- p.current || (p.current = !0, t.listSkills().then(r).catch(() => r([])));
1805
+ function Ft({ sdk: t, input: a, onSelect: n }) {
1806
+ const [s, r] = E([]), [i, d] = E(!1), [o, l] = E(0), c = _(!1);
1807
+ j(() => {
1808
+ c.current || (c.current = !0, t.listSkills().then(r).catch(() => r([])));
1750
1809
  }, [t]);
1751
- const u = /^\/\S*$/.test(a);
1752
- P(() => {
1753
- o(u);
1754
- }, [u]), P(() => {
1755
- u && d(0);
1756
- }, [a, u]);
1757
- const g = a.startsWith("/") ? a.slice(1).toLowerCase() : "", b = re(
1810
+ const f = /^\/\S*$/.test(a);
1811
+ j(() => {
1812
+ d(f);
1813
+ }, [f]), j(() => {
1814
+ f && l(0);
1815
+ }, [a, f]);
1816
+ const h = a.startsWith("/") ? a.slice(1).toLowerCase() : "", x = re(
1758
1817
  () => s.filter(
1759
- (k) => !g || k.code.toLowerCase().includes(g) || k.name.toLowerCase().includes(g) || k.displayName && k.displayName.toLowerCase().includes(g)
1818
+ (v) => !h || v.code.toLowerCase().includes(h) || v.name.toLowerCase().includes(h) || v.displayName && v.displayName.toLowerCase().includes(h)
1760
1819
  ),
1761
- [s, g]
1762
- ), m = R(i), x = R(b), f = R(l), y = R(n);
1763
- m.current = i, x.current = b, f.current = l, y.current = n;
1764
- const z = N((k) => {
1765
- if (!m.current || x.current.length === 0) return !1;
1766
- switch (k.key) {
1820
+ [s, h]
1821
+ ), b = _(i), y = _(x), p = _(o), m = _(n);
1822
+ b.current = i, y.current = x, p.current = o, m.current = n;
1823
+ const C = k((v) => {
1824
+ if (!b.current || y.current.length === 0) return !1;
1825
+ switch (v.key) {
1767
1826
  case "ArrowDown":
1768
- return k.preventDefault(), d((C) => (C + 1) % x.current.length), !0;
1827
+ return v.preventDefault(), l((N) => (N + 1) % y.current.length), !0;
1769
1828
  case "ArrowUp":
1770
- return k.preventDefault(), d((C) => (C - 1 + x.current.length) % x.current.length), !0;
1829
+ return v.preventDefault(), l((N) => (N - 1 + y.current.length) % y.current.length), !0;
1771
1830
  case "Enter":
1772
1831
  case "Tab":
1773
- return k.preventDefault(), y.current(x.current[f.current]), o(!1), !0;
1832
+ return v.preventDefault(), m.current(y.current[p.current]), d(!1), !0;
1774
1833
  case "Escape":
1775
- return k.preventDefault(), o(!1), !0;
1834
+ return v.preventDefault(), d(!1), !0;
1776
1835
  default:
1777
1836
  return !1;
1778
1837
  }
1779
- }, []), H = N(() => o(!1), []);
1780
- return { isOpen: i, items: b, activeIndex: l, handleKeyDown: z, close: H };
1781
- }
1782
- function Le() {
1783
- const { status: t, sendMessage: a, stop: n, sdk: s } = Z(), [r, i] = E(""), o = R(null), l = t === "streaming" || t === "submitted", d = !!r.trim() || l, p = N((f) => {
1784
- i(`/${f.name} `), setTimeout(() => {
1785
- const y = o.current;
1786
- y && (y.focus(), y.selectionStart = y.selectionEnd = y.value.length);
1838
+ }, []), A = k(() => d(!1), []);
1839
+ return { isOpen: i, items: x, activeIndex: o, handleKeyDown: C, close: A };
1840
+ }
1841
+ function Pe() {
1842
+ const { status: t, sendMessage: a, stop: n, sdk: s } = J(), [r, i] = E(""), d = _(null), o = t === "streaming" || t === "submitted", l = !!r.trim() || o, c = k((p) => {
1843
+ i(`/${p.name} `), setTimeout(() => {
1844
+ const m = d.current;
1845
+ m && (m.focus(), m.selectionStart = m.selectionEnd = m.value.length);
1787
1846
  }, 0);
1788
- }, []), u = It({
1847
+ }, []), f = Ft({
1789
1848
  sdk: s,
1790
1849
  input: r,
1791
- onSelect: p
1792
- }), g = N(() => {
1793
- const f = r.trim();
1794
- !f || l || (a(f), i(""), o.current && (o.current.style.height = "auto"));
1795
- }, [r, l, a]), b = N((f) => {
1796
- u.handleKeyDown(f) || f.key === "Enter" && !f.shiftKey && (f.preventDefault(), g());
1797
- }, [g, u.handleKeyDown]), m = N((f) => {
1798
- i(f.target.value);
1799
- const y = f.target;
1800
- y.style.height = "auto", y.style.height = Math.min(y.scrollHeight, 90) + "px";
1801
- }, []), x = N(() => {
1802
- var f;
1803
- l || (f = o.current) == null || f.focus();
1804
- }, [l]);
1805
- return /* @__PURE__ */ c("div", { className: "relative z-[2] shrink-0 px-[15px] pb-2.5", children: [
1806
- u.isOpen && /* @__PURE__ */ e(
1807
- zt,
1850
+ onSelect: c
1851
+ }), h = k(() => {
1852
+ const p = r.trim();
1853
+ !p || o || (a(p), i(""), d.current && (d.current.style.height = "auto"));
1854
+ }, [r, o, a]), x = k((p) => {
1855
+ f.handleKeyDown(p) || p.key === "Enter" && !p.shiftKey && (p.preventDefault(), h());
1856
+ }, [h, f.handleKeyDown]), b = k((p) => {
1857
+ i(p.target.value);
1858
+ const m = p.target;
1859
+ m.style.height = "auto", m.style.height = Math.min(m.scrollHeight, 90) + "px";
1860
+ }, []), y = k(() => {
1861
+ var p;
1862
+ o || (p = d.current) == null || p.focus();
1863
+ }, [o]);
1864
+ return /* @__PURE__ */ g("div", { className: "relative z-[2] shrink-0 px-[15px] pb-2.5", children: [
1865
+ f.isOpen && /* @__PURE__ */ e(
1866
+ _t,
1808
1867
  {
1809
- items: u.items,
1810
- activeIndex: u.activeIndex,
1811
- onSelect: p
1868
+ items: f.items,
1869
+ activeIndex: f.activeIndex,
1870
+ onSelect: c
1812
1871
  }
1813
1872
  ),
1814
- /* @__PURE__ */ c(
1873
+ /* @__PURE__ */ g(
1815
1874
  "form",
1816
1875
  {
1817
- className: `sa-input-form flex min-h-[70px] cursor-text items-start gap-2 rounded-[5px] p-2 ${d ? "sa-input-form-active" : ""}`,
1818
- onClick: x,
1819
- onSubmit: (f) => {
1820
- f.preventDefault(), g();
1876
+ className: `sa-input-form flex min-h-[70px] cursor-text items-start gap-2 rounded-[5px] p-2 ${l ? "sa-input-form-active" : ""}`,
1877
+ onClick: y,
1878
+ onSubmit: (p) => {
1879
+ p.preventDefault(), h();
1821
1880
  },
1822
1881
  children: [
1823
1882
  /* @__PURE__ */ e(
1824
1883
  "textarea",
1825
1884
  {
1826
- ref: o,
1885
+ ref: d,
1827
1886
  className: "sa-input-field flex-1 resize-none border-none bg-transparent p-0 text-[14px] leading-[1.5] text-[#333] outline-none placeholder:text-[#B8B8B8]",
1828
1887
  value: r,
1829
- onChange: m,
1830
- onKeyDown: b,
1888
+ onChange: b,
1889
+ onKeyDown: x,
1831
1890
  placeholder: "请输入你想要了解的关键词",
1832
1891
  rows: 1,
1833
- disabled: l
1892
+ disabled: o
1834
1893
  }
1835
1894
  ),
1836
- l ? /* @__PURE__ */ e(
1895
+ o ? /* @__PURE__ */ e(
1837
1896
  "button",
1838
1897
  {
1839
1898
  type: "button",
@@ -1850,7 +1909,7 @@ function Le() {
1850
1909
  className: `sa-send-btn ${r.trim() ? "sa-send-btn-active" : ""}`,
1851
1910
  "aria-label": "发送",
1852
1911
  title: "发送",
1853
- children: /* @__PURE__ */ e("img", { src: X.sendSolid, alt: "发送", width: 14, height: 14, draggable: !1 })
1912
+ children: /* @__PURE__ */ e("img", { src: U.sendSolid, alt: "发送", width: 14, height: 14, draggable: !1 })
1854
1913
  }
1855
1914
  )
1856
1915
  ]
@@ -1859,353 +1918,426 @@ function Le() {
1859
1918
  /* @__PURE__ */ e("div", { className: "mt-3 text-center text-[11px] leading-none text-[#B8B8B8]", children: "所有内容均由AI生成仅供参考" })
1860
1919
  ] });
1861
1920
  }
1862
- function Tt({ artifact: t }) {
1863
- const [a, n] = Q.useState(null), [s, r] = Q.useState(!0), [i, o] = Q.useState(null);
1921
+ function Ht({ artifact: t }) {
1922
+ const [a, n] = Q.useState(null), [s, r] = Q.useState(!0), [i, d] = Q.useState(null);
1864
1923
  return Q.useEffect(() => {
1865
- let l = !1;
1866
- r(!0), o(null), n(null);
1867
- async function d() {
1924
+ let o = !1;
1925
+ r(!0), d(null), n(null);
1926
+ async function l() {
1868
1927
  try {
1869
1928
  if (t.type === "pdf") {
1870
- l || r(!1);
1929
+ o || r(!1);
1871
1930
  return;
1872
1931
  }
1873
1932
  if (t.type === "html") {
1874
- const p = await fetch(t.url);
1875
- if (!p.ok) throw new Error(`HTTP ${p.status}`);
1876
- const u = await p.text(), g = (await import("./purify.es-C-6FFqDW.js")).default;
1877
- l || (n(g.sanitize(u, { FORCE_BODY: !0, ADD_ATTR: ["target"] })), r(!1));
1933
+ const c = await fetch(t.url);
1934
+ if (!c.ok) throw new Error(`HTTP ${c.status}`);
1935
+ const f = await c.text(), h = (await import("./purify.es-C-6FFqDW.js")).default;
1936
+ o || (n(h.sanitize(f, { FORCE_BODY: !0, ADD_ATTR: ["target"] })), r(!1));
1878
1937
  return;
1879
1938
  }
1880
1939
  if (t.type === "docx") {
1881
- const p = await fetch(t.url);
1882
- if (!p.ok) throw new Error(`HTTP ${p.status}`);
1883
- const u = await p.arrayBuffer(), b = await (await import("./mammoth.browser-COPV53yV.js").then((x) => x.m)).convertToHtml({ arrayBuffer: u }), m = (await import("./purify.es-C-6FFqDW.js")).default;
1884
- l || (n(m.sanitize(b.value, { FORCE_BODY: !0, ADD_ATTR: ["target"] })), r(!1));
1940
+ const c = await fetch(t.url);
1941
+ if (!c.ok) throw new Error(`HTTP ${c.status}`);
1942
+ const f = await c.arrayBuffer(), x = await (await import("./mammoth.browser-COPV53yV.js").then((y) => y.m)).convertToHtml({ arrayBuffer: f }), b = (await import("./purify.es-C-6FFqDW.js")).default;
1943
+ o || (n(b.sanitize(x.value, { FORCE_BODY: !0, ADD_ATTR: ["target"] })), r(!1));
1885
1944
  return;
1886
1945
  }
1887
- l || (r(!1), o(`不支持预览「${t.type}」类型`));
1888
- } catch (p) {
1889
- l || (r(!1), o(p instanceof Error ? p.message : "加载失败"));
1946
+ o || (r(!1), d(`不支持预览「${t.type}」类型`));
1947
+ } catch (c) {
1948
+ o || (r(!1), d(c instanceof Error ? c.message : "加载失败"));
1890
1949
  }
1891
1950
  }
1892
- return d(), () => {
1893
- l = !0;
1951
+ return l(), () => {
1952
+ o = !0;
1894
1953
  };
1895
- }, [t]), s ? /* @__PURE__ */ e("div", { className: "sa-drawer-preview-loading", children: "加载中" }) : i ? /* @__PURE__ */ c("div", { className: "sa-drawer-preview-error", children: [
1954
+ }, [t]), s ? /* @__PURE__ */ e("div", { className: "sa-drawer-preview-loading", children: "加载中" }) : i ? /* @__PURE__ */ g("div", { className: "sa-drawer-preview-error", children: [
1896
1955
  i,
1897
- /* @__PURE__ */ e("button", { className: "sa-drawer-btn-sm", onClick: () => void ie(t), children: "下载查看" })
1898
- ] }) : t.type === "pdf" ? /* @__PURE__ */ e("iframe", { src: t.url, title: t.filename, className: "sa-drawer-preview-iframe", sandbox: "allow-scripts" }) : a !== null ? /* @__PURE__ */ e("iframe", { srcDoc: a, title: t.filename, className: "sa-drawer-preview-iframe", sandbox: "allow-same-origin" }) : null;
1956
+ /* @__PURE__ */ e("button", { className: "sa-drawer-btn-sm", onClick: () => void de(t), children: "下载查看" })
1957
+ ] }) : t.type === "pdf" ? /* @__PURE__ */ e("iframe", { src: t.url, title: t.filename, className: "sa-drawer-preview-iframe", sandbox: "allow-scripts" }) : a !== null ? /* @__PURE__ */ e("div", { className: "sa-drawer-preview-html-scroll", children: /* @__PURE__ */ e("div", { className: "sa-drawer-preview-html sa-text-part", dangerouslySetInnerHTML: { __html: a } }) }) : null;
1899
1958
  }
1900
- function _e({ artifacts: t, initialArtifact: a, onClose: n }) {
1959
+ function Pt({ artifacts: t, initialArtifact: a, onClose: n }) {
1901
1960
  const [s, r] = E(
1902
1961
  a ? { mode: "preview", artifact: a } : { mode: "list" }
1903
- ), [i, o] = E(!1), l = R(null), [d, p] = E(340), u = R(null);
1904
- P(() => {
1905
- a && (l.current && (clearTimeout(l.current), l.current = null, o(!1)), r({ mode: "preview", artifact: a }));
1962
+ ), [i, d] = E(!1), o = _(null), [l, c] = E(340), f = _(null);
1963
+ j(() => {
1964
+ a && (o.current && (clearTimeout(o.current), o.current = null, d(!1)), r({ mode: "preview", artifact: a }));
1906
1965
  }, [a]);
1907
- const g = N(() => {
1908
- o(!0), l.current = setTimeout(() => {
1909
- l.current = null, n();
1966
+ const h = k(() => {
1967
+ d(!0), o.current = setTimeout(() => {
1968
+ o.current = null, n();
1910
1969
  }, 240);
1911
1970
  }, [n]);
1912
- P(() => () => {
1913
- var f;
1914
- l.current && clearTimeout(l.current), (f = u.current) == null || f.call(u);
1971
+ j(() => () => {
1972
+ var p;
1973
+ o.current && clearTimeout(o.current), (p = f.current) == null || p.call(f);
1915
1974
  }, []);
1916
- const b = N((f) => {
1917
- r({ mode: "preview", artifact: f });
1918
- }, []), m = N(() => {
1975
+ const x = k((p) => {
1976
+ r({ mode: "preview", artifact: p });
1977
+ }, []), b = k(() => {
1919
1978
  r({ mode: "list" });
1920
1979
  }, []);
1921
- P(() => {
1922
- const f = (y) => {
1923
- y.key === "Escape" && g();
1980
+ j(() => {
1981
+ const p = (m) => {
1982
+ m.key === "Escape" && h();
1924
1983
  };
1925
- return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
1926
- }, [g]);
1927
- const x = N((f) => {
1928
- f.preventDefault();
1929
- const y = f.clientX, z = d, H = (C) => {
1930
- const S = y - C.clientX;
1931
- p(Math.max(240, Math.min(window.innerWidth * 0.7, z + S)));
1932
- }, k = () => {
1933
- document.removeEventListener("mousemove", H), document.removeEventListener("mouseup", k), document.body.style.cursor = "", document.body.style.userSelect = "", u.current = null;
1984
+ return document.addEventListener("keydown", p), () => document.removeEventListener("keydown", p);
1985
+ }, [h]);
1986
+ const y = k((p) => {
1987
+ p.preventDefault();
1988
+ const m = p.clientX, C = l, A = (N) => {
1989
+ const $ = m - N.clientX;
1990
+ c(Math.max(240, Math.min(window.innerWidth * 0.7, C + $)));
1991
+ }, v = () => {
1992
+ document.removeEventListener("mousemove", A), document.removeEventListener("mouseup", v), document.body.style.cursor = "", document.body.style.userSelect = "", f.current = null;
1934
1993
  };
1935
- document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", H), document.addEventListener("mouseup", k), u.current = k;
1936
- }, [d]);
1937
- return /* @__PURE__ */ c("div", { className: `sa-artifact-drawer ${i ? "sa-drawer-closing" : ""}`, style: { width: d }, children: [
1938
- /* @__PURE__ */ e("div", { className: "sa-drawer-resize-handle", onMouseDown: x }),
1939
- /* @__PURE__ */ c("div", { className: "sa-artifact-drawer-header", children: [
1940
- s.mode === "preview" ? /* @__PURE__ */ c(V, { children: [
1941
- /* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: m, title: "返回列表", "aria-label": "返回列表", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M15 18l-6-6 6-6" }) }) }),
1994
+ document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", A), document.addEventListener("mouseup", v), f.current = v;
1995
+ }, [l]);
1996
+ return /* @__PURE__ */ g("div", { className: `sa-artifact-drawer ${i ? "sa-drawer-closing" : ""}`, style: { width: l }, children: [
1997
+ /* @__PURE__ */ e("div", { className: "sa-drawer-resize-handle", onMouseDown: y }),
1998
+ /* @__PURE__ */ g("div", { className: "sa-artifact-drawer-header", children: [
1999
+ s.mode === "preview" ? /* @__PURE__ */ g(K, { children: [
2000
+ /* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: b, title: "返回列表", "aria-label": "返回列表", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M15 18l-6-6 6-6" }) }) }),
1942
2001
  /* @__PURE__ */ e("span", { className: "sa-artifact-drawer-title", children: s.artifact.filename })
1943
- ] }) : /* @__PURE__ */ c(V, { children: [
1944
- /* @__PURE__ */ c("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", style: { flexShrink: 0 }, children: [
2002
+ ] }) : /* @__PURE__ */ g(K, { children: [
2003
+ /* @__PURE__ */ g("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", style: { flexShrink: 0 }, children: [
1945
2004
  /* @__PURE__ */ e("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1946
2005
  /* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" })
1947
2006
  ] }),
1948
2007
  /* @__PURE__ */ e("span", { className: "sa-artifact-drawer-title", children: "会话产物" })
1949
2008
  ] }),
1950
2009
  /* @__PURE__ */ e("div", { style: { flex: 1 } }),
1951
- s.mode === "preview" && /* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: () => void ie(s.artifact), title: "下载", "aria-label": "下载", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" }) }) }),
1952
- /* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: g, title: "关闭", "aria-label": "关闭", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M18 6L6 18M6 6l12 12" }) }) })
2010
+ s.mode === "preview" && /* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: () => void de(s.artifact), title: "下载", "aria-label": "下载", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" }) }) }),
2011
+ /* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: h, title: "关闭", "aria-label": "关闭", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M18 6L6 18M6 6l12 12" }) }) })
1953
2012
  ] }),
1954
- /* @__PURE__ */ e("div", { className: "sa-artifact-drawer-body", children: s.mode === "list" ? t.length === 0 ? /* @__PURE__ */ e("div", { className: "sa-drawer-empty", children: "暂无产物" }) : /* @__PURE__ */ e("ul", { className: "sa-drawer-file-list", role: "list", children: t.map((f, y) => /* @__PURE__ */ c(
2013
+ /* @__PURE__ */ e("div", { className: "sa-artifact-drawer-body", children: s.mode === "list" ? t.length === 0 ? /* @__PURE__ */ e("div", { className: "sa-drawer-empty", children: "暂无产物" }) : /* @__PURE__ */ e("ul", { className: "sa-drawer-file-list", role: "list", children: t.map((p, m) => /* @__PURE__ */ g(
1955
2014
  "li",
1956
2015
  {
1957
2016
  className: "sa-drawer-file-card",
1958
- onClick: () => b(f),
1959
- onKeyDown: (z) => {
1960
- (z.key === "Enter" || z.key === " ") && (z.preventDefault(), b(f));
2017
+ onClick: () => x(p),
2018
+ onKeyDown: (C) => {
2019
+ (C.key === "Enter" || C.key === " ") && (C.preventDefault(), x(p));
1961
2020
  },
1962
2021
  tabIndex: 0,
1963
2022
  role: "button",
1964
- "aria-label": `预览 ${f.filename}`,
2023
+ "aria-label": `预览 ${p.filename}`,
1965
2024
  children: [
1966
- /* @__PURE__ */ e("div", { className: "sa-drawer-file-icon", children: /* @__PURE__ */ e("span", { className: "sa-artifact-chip-type", children: Ee(f.type) }) }),
1967
- /* @__PURE__ */ c("div", { className: "sa-drawer-file-info", children: [
1968
- /* @__PURE__ */ e("span", { className: "sa-drawer-file-name", children: f.filename }),
1969
- /* @__PURE__ */ e("span", { className: "sa-drawer-file-size", children: Me(f.size) })
2025
+ /* @__PURE__ */ e("div", { className: "sa-drawer-file-icon", children: /* @__PURE__ */ e("span", { className: "sa-artifact-chip-type", children: Le(p.type) }) }),
2026
+ /* @__PURE__ */ g("div", { className: "sa-drawer-file-info", children: [
2027
+ /* @__PURE__ */ e("span", { className: "sa-drawer-file-name", children: p.filename }),
2028
+ /* @__PURE__ */ e("span", { className: "sa-drawer-file-size", children: De(p.size) })
1970
2029
  ] }),
1971
2030
  /* @__PURE__ */ e(
1972
2031
  "button",
1973
2032
  {
1974
2033
  className: "sa-drawer-btn",
1975
2034
  title: "下载",
1976
- "aria-label": `下载 ${f.filename}`,
1977
- onClick: (z) => {
1978
- z.stopPropagation(), ie(f);
2035
+ "aria-label": `下载 ${p.filename}`,
2036
+ onClick: (C) => {
2037
+ C.stopPropagation(), de(p);
1979
2038
  },
1980
2039
  children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" }) })
1981
2040
  }
1982
2041
  )
1983
2042
  ]
1984
2043
  },
1985
- f.id || `artifact-${y}`
1986
- )) }) : /* @__PURE__ */ e("div", { className: "sa-drawer-view-enter", children: /* @__PURE__ */ e(Tt, { artifact: s.artifact }) }) })
2044
+ p.id || `artifact-${m}`
2045
+ )) }) : /* @__PURE__ */ e("div", { className: "sa-drawer-view-enter", children: /* @__PURE__ */ e(Ht, { artifact: s.artifact }) }) })
2046
+ ] });
2047
+ }
2048
+ function Bt({ page: t, onBack: a, centered: n }) {
2049
+ j(() => {
2050
+ const r = (i) => {
2051
+ i.key === "Escape" && a();
2052
+ };
2053
+ return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
2054
+ }, [a]);
2055
+ const s = qe(t.component) ? Ze(t.component, { close: a }) : Je(t.component, { close: a });
2056
+ return /* @__PURE__ */ g("div", { className: `sa-page-overlay ${n ? "sa-page-overlay-centered" : ""}`, children: [
2057
+ /* @__PURE__ */ g("div", { className: "sa-page-overlay-bar", children: [
2058
+ /* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: a, title: "返回", "aria-label": "返回", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("path", { d: "M15 18l-6-6 6-6" }) }) }),
2059
+ t.title && /* @__PURE__ */ e("span", { className: "sa-page-overlay-title", children: t.title })
2060
+ ] }),
2061
+ /* @__PURE__ */ e("div", { className: "sa-page-overlay-body", children: s })
1987
2062
  ] });
1988
2063
  }
1989
- function Mt({
2064
+ const Ot = "mx-auto w-full max-w-[800px]";
2065
+ function Be({
2066
+ contentClassName: t,
2067
+ centered: a,
2068
+ composerClassName: n,
2069
+ thread: s,
2070
+ composer: r,
2071
+ artifactPreview: i
2072
+ }) {
2073
+ const {
2074
+ activePanel: d,
2075
+ closePanel: o,
2076
+ messagesLoading: l,
2077
+ isArtifactDrawerOpen: c,
2078
+ allArtifacts: f,
2079
+ activePreviewArtifact: h,
2080
+ toggleArtifactDrawer: x
2081
+ } = J();
2082
+ if (d)
2083
+ return /* @__PURE__ */ e(Bt, { page: d, onBack: o, centered: a });
2084
+ const b = a ? Ot : "";
2085
+ return /* @__PURE__ */ g(K, { children: [
2086
+ /* @__PURE__ */ g("div", { className: `${t} ${b}`, children: [
2087
+ l ? /* @__PURE__ */ g("div", { className: "sa-messages-loading", children: [
2088
+ /* @__PURE__ */ e("span", { className: "sa-loading-spinner" }),
2089
+ "加载对话..."
2090
+ ] }) : s,
2091
+ i && c && /* @__PURE__ */ e(
2092
+ Pt,
2093
+ {
2094
+ artifacts: f,
2095
+ initialArtifact: h,
2096
+ onClose: x
2097
+ }
2098
+ )
2099
+ ] }),
2100
+ n ? /* @__PURE__ */ e("div", { className: `${n} ${b}`, children: r }) : r
2101
+ ] });
2102
+ }
2103
+ function jt({
1990
2104
  isOpen: t,
1991
2105
  onClose: a,
1992
2106
  title: n,
1993
2107
  slots: s,
1994
2108
  welcomeMessage: r,
1995
2109
  suggestedPrompts: i,
1996
- avatar: o,
1997
- artifactPreview: l,
1998
- capabilities: d,
1999
- quickLinks: p,
2000
- logo: u,
2001
- defaultWidth: g,
2002
- defaultHeight: b,
2003
- showTimestamp: m
2110
+ avatar: d,
2111
+ artifactPreview: o,
2112
+ capabilities: l,
2113
+ quickLinks: c,
2114
+ logo: f,
2115
+ defaultWidth: h,
2116
+ defaultHeight: x,
2117
+ showTimestamp: b
2004
2118
  }) {
2005
2119
  const {
2006
- status: x,
2007
- sendMessage: f,
2008
- stop: y,
2009
- toggleThreadList: z,
2010
- setThreadListOpen: H,
2011
- isThreadListOpen: k,
2012
- toggleArtifactDrawer: C,
2013
- isArtifactDrawerOpen: S,
2014
- allArtifacts: D,
2015
- activePreviewArtifact: w,
2016
- messages: M,
2017
- messagesLoading: $,
2018
- conversations: L,
2019
- activeConversationId: v,
2020
- switchConversation: A,
2021
- newConversation: I,
2022
- deleteConversation: F,
2023
- renameConversation: h,
2024
- hasMore: _,
2025
- loadMoreConversations: O
2026
- } = Z(), {
2027
- width: W,
2028
- position: T,
2120
+ status: y,
2121
+ sendMessage: p,
2122
+ stop: m,
2123
+ toggleThreadList: C,
2124
+ setThreadListOpen: A,
2125
+ isThreadListOpen: v,
2126
+ toggleArtifactDrawer: N,
2127
+ allArtifacts: $,
2128
+ activePanel: M,
2129
+ closePanel: w,
2130
+ messages: I,
2131
+ messagesLoading: L,
2132
+ conversations: R,
2133
+ activeConversationId: F,
2134
+ switchConversation: P,
2135
+ newConversation: D,
2136
+ deleteConversation: S,
2137
+ renameConversation: u,
2138
+ hasMore: T,
2139
+ loadMoreConversations: B
2140
+ } = J(), {
2141
+ width: O,
2142
+ position: z,
2029
2143
  hasCustomPosition: Y,
2030
- isMaximized: j,
2144
+ isMaximized: W,
2031
2145
  // 统一由 hook 计算的真实渲染几何(含侧边栏宽度、自适应高度、视口钳制)
2032
- totalWidth: q,
2033
- windowHeight: ce,
2034
- startWindowDrag: He,
2035
- startResize: pe,
2036
- toggleMaximize: Fe,
2037
- reset: ue,
2038
- setLockedHeight: oe
2039
- } = Ue({
2040
- defaultWidth: g ?? U.DEFAULT_WIDTH,
2041
- defaultHeight: b ?? U.DEFAULT_HEIGHT,
2146
+ totalWidth: V,
2147
+ windowHeight: ge,
2148
+ startWindowDrag: Oe,
2149
+ startResize: je,
2150
+ toggleMaximize: We,
2151
+ reset: fe,
2152
+ setLockedHeight: ce
2153
+ } = rt({
2154
+ defaultWidth: h ?? X.DEFAULT_WIDTH,
2155
+ defaultHeight: x ?? X.DEFAULT_HEIGHT,
2042
2156
  // 大窗不消费窗口几何,无需区分 isMaximized(避免与 hook 状态循环依赖)
2043
- sidebarWidth: k ? 200 : 0
2044
- }), ge = R(null), fe = R(null), le = !$ && M.length === 0, ne = !$ && M.length > 0;
2045
- P(() => {
2046
- t || ue();
2047
- }, [t, ue]), P(() => {
2048
- H(j ? ge.current ?? !0 : fe.current ?? !1);
2049
- }, [j, H]), P(() => {
2050
- ne || oe(null);
2051
- }, [ne, oe]);
2052
- const Re = Ke({
2053
- enabled: t && ne && !j,
2157
+ sidebarWidth: 0
2158
+ }), he = _(null), me = _(null), pe = !L && I.length === 0, ne = !L && I.length > 0, se = !!M;
2159
+ j(() => {
2160
+ t || (fe(), w());
2161
+ }, [t, fe, w]), j(() => {
2162
+ A(W ? he.current ?? !0 : me.current ?? !1);
2163
+ }, [W, A]), j(() => {
2164
+ ne || ce(null);
2165
+ }, [ne, ce]);
2166
+ const Ye = nt({
2167
+ enabled: t && ne && !W && !se,
2054
2168
  contentSelector: ".sa-panel-content",
2055
- defaultHeight: b ?? U.DEFAULT_HEIGHT,
2056
- onHeightChange: oe
2169
+ defaultHeight: x ?? X.DEFAULT_HEIGHT,
2170
+ onHeightChange: ce
2057
2171
  });
2058
2172
  if (!t) return null;
2059
- const he = s.Header, me = s.Composer, se = s.ThreadList, Be = () => {
2060
- const J = !k;
2061
- z(), j ? ge.current = J : fe.current = J;
2062
- }, Oe = Y ? { width: `${q}px`, height: `${ce}px`, left: `${T.x}px`, top: `${T.y}px` } : { width: `${q}px`, height: `${ce}px`, right: "20px", bottom: "20px" }, xe = {
2173
+ const xe = s.Header, we = s.Composer, ie = s.ThreadList, Ge = () => {
2174
+ const le = !v;
2175
+ C(), W ? he.current = le : me.current = le;
2176
+ }, be = 200, ve = v && !W, q = "var(--sa-radius, 16px)", ye = ve ? `0px ${q} ${q} 0px` : `${q} ${q} ${q} ${q}`, Xe = Y ? z.x : window.innerWidth - V - 20, oe = Math.min(be, Math.max(0, Xe - 1)), Ue = Y ? { width: `${V}px`, height: `${ge}px`, left: `${z.x}px`, top: `${z.y}px` } : { width: `${V}px`, height: `${ge}px`, right: "20px", bottom: "20px" }, ke = {
2063
2177
  title: n,
2064
2178
  onClose: a,
2065
- onToggleThreadList: Be,
2066
- isMaximized: j,
2067
- onToggleMaximize: Fe,
2068
- showHome: ne,
2069
- onHome: I,
2070
- artifactCount: l ? D.length : 0,
2071
- onToggleArtifactDrawer: l ? C : void 0
2072
- }, we = {
2073
- conversations: L,
2074
- activeSessionId: v,
2075
- onSwitch: A,
2076
- onNew: I,
2077
- onDelete: F,
2078
- onRename: h,
2079
- hasMore: _,
2080
- onLoadMore: O
2081
- }, be = /* @__PURE__ */ c(
2179
+ onToggleThreadList: Ge,
2180
+ isMaximized: W,
2181
+ onToggleMaximize: We,
2182
+ // 整屏容器态隐藏「回到首页」与产物入口:返回按钮已接管退出,抽屉也随内容区一并被替换
2183
+ showHome: ne && !se,
2184
+ onHome: D,
2185
+ artifactCount: se || !o ? 0 : $.length,
2186
+ onToggleArtifactDrawer: se || !o ? void 0 : N
2187
+ }, Ce = {
2188
+ conversations: R,
2189
+ activeSessionId: F,
2190
+ onSwitch: P,
2191
+ onNew: D,
2192
+ onDelete: S,
2193
+ onRename: u,
2194
+ hasMore: T,
2195
+ onLoadMore: B
2196
+ }, Ne = /* @__PURE__ */ g(
2082
2197
  "div",
2083
2198
  {
2084
- className: `relative flex min-w-0 flex-col bg-white ${j ? "flex-1" : "h-full shrink-0"}`,
2085
- style: j ? void 0 : { width: `${W}px` },
2199
+ className: `relative flex min-w-0 flex-col bg-white ${W ? "flex-1" : "h-full shrink-0"}`,
2200
+ style: W ? void 0 : { width: `${O}px`, borderRadius: ye, overflow: "hidden" },
2086
2201
  children: [
2087
- le && /* @__PURE__ */ c(V, { children: [
2202
+ pe && /* @__PURE__ */ g(K, { children: [
2088
2203
  /* @__PURE__ */ e("div", { className: "sa-home-gradient pointer-events-none absolute inset-x-0 top-0 z-0 h-[238px] opacity-10" }),
2089
2204
  /* @__PURE__ */ e("div", { className: "sa-home-gradient-fade pointer-events-none absolute inset-x-0 top-0 z-[1] h-[238px]" })
2090
2205
  ] }),
2091
2206
  /* @__PURE__ */ e(
2092
2207
  "div",
2093
2208
  {
2094
- className: `relative z-20 ${le || j ? "" : "bg-white"} ${j ? "cursor-default" : "cursor-grab active:cursor-grabbing"}`,
2095
- onMouseDown: j ? void 0 : He,
2096
- children: he ? /* @__PURE__ */ e(he, { ...xe }) : /* @__PURE__ */ e(qe, { ...xe })
2209
+ className: `relative z-20 ${pe || W ? "" : "bg-white"} ${W ? "cursor-default" : "cursor-grab active:cursor-grabbing"}`,
2210
+ onMouseDown: W ? void 0 : Oe,
2211
+ children: xe ? /* @__PURE__ */ e(xe, { ...ke }) : /* @__PURE__ */ e(ot, { ...ke })
2097
2212
  }
2098
2213
  ),
2099
- /* @__PURE__ */ c("div", { className: `sa-panel-content relative z-[2] ${le ? "sa-home-view" : ""} ${j ? "mx-auto w-full max-w-[800px]" : ""}`, children: [
2100
- $ ? /* @__PURE__ */ c("div", { className: "sa-messages-loading", children: [
2101
- /* @__PURE__ */ e("span", { className: "sa-loading-spinner" }),
2102
- "加载对话..."
2103
- ] }) : /* @__PURE__ */ e(
2104
- $e,
2105
- {
2106
- slots: s,
2107
- welcomeMessage: r,
2108
- suggestedPrompts: i,
2109
- avatar: o,
2110
- artifactPreview: l,
2111
- capabilities: d,
2112
- quickLinks: p,
2113
- logo: u,
2114
- showTimestamp: m
2115
- }
2116
- ),
2117
- l && S && /* @__PURE__ */ e(_e, { artifacts: D, initialArtifact: w, onClose: C })
2118
- ] }),
2119
- /* @__PURE__ */ e("div", { className: `shrink-0 ${j ? "mx-auto w-full max-w-[800px]" : ""}`, children: me ? /* @__PURE__ */ e(me, { status: x, onSend: f, onStop: y }) : /* @__PURE__ */ e(Le, {}) })
2214
+ /* @__PURE__ */ e(
2215
+ Be,
2216
+ {
2217
+ contentClassName: `sa-panel-content relative z-[2] ${pe ? "sa-home-view" : ""}`,
2218
+ centered: W,
2219
+ composerClassName: "shrink-0",
2220
+ artifactPreview: o,
2221
+ thread: /* @__PURE__ */ e(
2222
+ He,
2223
+ {
2224
+ slots: s,
2225
+ welcomeMessage: r,
2226
+ suggestedPrompts: i,
2227
+ avatar: d,
2228
+ artifactPreview: o,
2229
+ capabilities: l,
2230
+ quickLinks: c,
2231
+ logo: f,
2232
+ showTimestamp: b
2233
+ }
2234
+ ),
2235
+ composer: we ? /* @__PURE__ */ e(we, { status: y, onSend: p, onStop: m }) : /* @__PURE__ */ e(Pe, {})
2236
+ }
2237
+ )
2120
2238
  ]
2121
2239
  }
2122
2240
  );
2123
- return j ? /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[var(--sa-z-index,9999)] flex animate-sa-fade-in flex-col justify-end bg-black/30", children: /* @__PURE__ */ c("div", { className: "flex h-[calc(100%_-_48px)] w-full animate-sa-slide-up-full flex-row overflow-hidden rounded-t-2xl bg-[#F5F5F5] shadow-[0_-12px_48px_rgba(0,0,0,0.25)]", children: [
2124
- k && (se ? /* @__PURE__ */ e(se, { ...we }) : /* @__PURE__ */ e(ke, { width: 220 })),
2125
- be
2126
- ] }) }) : /* @__PURE__ */ c(
2241
+ return W ? /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[var(--sa-z-index,9999)] flex animate-sa-fade-in flex-col justify-end bg-black/30", children: /* @__PURE__ */ g(
2242
+ "div",
2243
+ {
2244
+ className: "flex h-[calc(100%_-_48px)] w-full animate-sa-slide-up-full flex-row overflow-hidden bg-[#F5F5F5] shadow-[0_-12px_48px_rgba(0,0,0,0.25)]",
2245
+ style: { borderRadius: "var(--sa-radius, 16px) var(--sa-radius, 16px) 0px 0px" },
2246
+ children: [
2247
+ v && (ie ? /* @__PURE__ */ e(ie, { ...Ce }) : /* @__PURE__ */ e(Ie, { width: 220 })),
2248
+ Ne
2249
+ ]
2250
+ }
2251
+ ) }) : /* @__PURE__ */ g(
2127
2252
  "div",
2128
2253
  {
2129
- ref: Re,
2130
- className: "fixed z-[var(--sa-z-index,9999)] flex animate-sa-window-in flex-row overflow-hidden rounded-xl border border-[#DADADA] bg-white shadow-[0_12px_36px_rgba(0,0,0,0.18)]",
2131
- style: Oe,
2254
+ ref: Ye,
2255
+ className: "fixed z-[var(--sa-z-index,9999)] flex animate-sa-window-in flex-row overflow-visible border border-[#DADADA] bg-white shadow-[0_12px_36px_rgba(0,0,0,0.18)]",
2256
+ style: { ...Ue, borderRadius: ye },
2132
2257
  children: [
2133
2258
  /* @__PURE__ */ e(
2134
2259
  "div",
2135
2260
  {
2136
- className: "sa-resize-handle absolute bottom-0 left-[-3px] top-0 z-10 w-[6px] cursor-col-resize",
2137
- onMouseDown: (J) => pe(J, "left")
2261
+ className: "sa-resize-handle absolute bottom-0 left-[-3px] top-0 z-20 w-[6px] cursor-col-resize",
2262
+ onMouseDown: (le) => je(le)
2138
2263
  }
2139
2264
  ),
2140
- /* @__PURE__ */ e(
2265
+ ve && (ie ? /* @__PURE__ */ e(
2141
2266
  "div",
2142
2267
  {
2143
- className: "sa-resize-handle absolute bottom-0 right-[-3px] top-0 z-10 w-[6px] cursor-col-resize",
2144
- onMouseDown: (J) => pe(J, "right")
2268
+ className: "absolute -top-px -bottom-px -left-px z-10 overflow-hidden border border-r-0 border-[#DADADA] bg-[#FAFAFA] shadow-[0_12px_36px_rgba(0,0,0,0.18)]",
2269
+ style: { width: oe, transform: `translateX(-${oe}px)`, borderRadius: `${q} 0px 0px ${q}` },
2270
+ children: /* @__PURE__ */ e(ie, { ...Ce })
2145
2271
  }
2146
- ),
2147
- k && (se ? /* @__PURE__ */ e(se, { ...we }) : /* @__PURE__ */ e(ke, { width: 200 })),
2148
- be
2272
+ ) : /* @__PURE__ */ e(
2273
+ "div",
2274
+ {
2275
+ className: "absolute -top-px -bottom-px -left-px z-10 overflow-hidden border border-r-0 border-[#DADADA] bg-[#FAFAFA] shadow-[0_12px_36px_rgba(0,0,0,0.18)]",
2276
+ style: { width: oe, transform: `translateX(-${oe}px)`, borderRadius: `${q} 0px 0px ${q}` },
2277
+ children: /* @__PURE__ */ e(Ie, { width: be })
2278
+ }
2279
+ )),
2280
+ Ne
2149
2281
  ]
2150
2282
  }
2151
2283
  );
2152
2284
  }
2153
- const Et = () => {
2285
+ const Wt = () => {
2154
2286
  };
2155
- function St({
2287
+ function Yt({
2156
2288
  conversations: t,
2157
2289
  activeSessionId: a,
2158
2290
  onSwitch: n,
2159
2291
  onNew: s,
2160
2292
  onDelete: r,
2161
2293
  onRename: i,
2162
- isCollapsed: o,
2163
- onToggleCollapse: l,
2164
- hasMore: d,
2165
- onLoadMore: p,
2166
- conversationsLoading: u
2294
+ isCollapsed: d,
2295
+ onToggleCollapse: o,
2296
+ hasMore: l,
2297
+ onLoadMore: c,
2298
+ conversationsLoading: f
2167
2299
  }) {
2168
- const [g, b] = E(null), [m, x] = E(null), [f, y] = E(""), [z, H] = E(null), k = R(null);
2169
- P(
2300
+ const [h, x] = E(null), [b, y] = E(null), [p, m] = E(""), [C, A] = E(null), v = _(null);
2301
+ j(
2170
2302
  () => () => {
2171
- k.current && clearTimeout(k.current);
2303
+ v.current && clearTimeout(v.current);
2172
2304
  },
2173
2305
  []
2174
2306
  );
2175
- const C = N(
2176
- (L, v) => {
2177
- v.stopPropagation(), g === L ? (r(L), b(null)) : (b(L), k.current && clearTimeout(k.current), k.current = setTimeout(
2178
- () => b(null),
2307
+ const N = k(
2308
+ (R, F) => {
2309
+ F.stopPropagation(), h === R ? (r(R), x(null)) : (x(R), v.current && clearTimeout(v.current), v.current = setTimeout(
2310
+ () => x(null),
2179
2311
  3e3
2180
2312
  ));
2181
2313
  },
2182
- [g, r]
2183
- ), S = N(
2184
- (L, v, A) => {
2185
- A.stopPropagation(), x(L), y(v ?? "");
2314
+ [h, r]
2315
+ ), $ = k(
2316
+ (R, F, P) => {
2317
+ P.stopPropagation(), y(R), m(F ?? "");
2186
2318
  },
2187
2319
  []
2188
- ), D = N(
2189
- (L) => {
2190
- f.trim() && i(L, f.trim()), x(null);
2320
+ ), M = k(
2321
+ (R) => {
2322
+ p.trim() && i(R, p.trim()), y(null);
2191
2323
  },
2192
- [f, i]
2193
- ), w = R(null), M = N(() => {
2194
- const L = w.current;
2195
- !L || !d || !p || L.scrollHeight - L.scrollTop - L.clientHeight < 50 && p();
2196
- }, [d, p]), $ = re(
2197
- () => De(t),
2324
+ [p, i]
2325
+ ), w = _(null), I = k(() => {
2326
+ const R = w.current;
2327
+ !R || !l || !c || R.scrollHeight - R.scrollTop - R.clientHeight < 50 && c();
2328
+ }, [l, c]), L = re(
2329
+ () => Fe(t),
2198
2330
  [t]
2199
2331
  );
2200
- return o ? /* @__PURE__ */ c("div", { className: "flex w-12 shrink-0 flex-col items-center gap-1 border-r border-[#ECECEC] bg-[#FAFAFA] py-3", children: [
2332
+ return d ? /* @__PURE__ */ g("div", { className: "flex w-12 shrink-0 flex-col items-center gap-1 border-r border-[#ECECEC] bg-[#FAFAFA] py-3", children: [
2201
2333
  /* @__PURE__ */ e(
2202
2334
  "button",
2203
2335
  {
2204
2336
  type: "button",
2205
2337
  className: "sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white",
2206
2338
  "data-tooltip": "展开",
2207
- onClick: l,
2208
- children: /* @__PURE__ */ e(B, { name: "panel-left", size: 18 })
2339
+ onClick: o,
2340
+ children: /* @__PURE__ */ e(H, { name: "panel-left", size: 18 })
2209
2341
  }
2210
2342
  ),
2211
2343
  /* @__PURE__ */ e(
@@ -2215,21 +2347,21 @@ function St({
2215
2347
  className: "sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white",
2216
2348
  "data-tooltip": "新建对话",
2217
2349
  onClick: () => {
2218
- s(), l();
2350
+ s(), o();
2219
2351
  },
2220
- children: /* @__PURE__ */ e("img", { src: X.messageCreate, alt: "", width: 18, height: 18 })
2352
+ children: /* @__PURE__ */ e("img", { src: U.messageCreate, alt: "", width: 18, height: 18 })
2221
2353
  }
2222
2354
  )
2223
- ] }) : /* @__PURE__ */ c("div", { className: "relative flex w-[220px] shrink-0 flex-col border-r border-[#ECECEC] bg-[#FAFAFA] p-3", children: [
2224
- /* @__PURE__ */ c("div", { className: "mb-4 flex shrink-0 items-center gap-1.5", children: [
2225
- /* @__PURE__ */ c(
2355
+ ] }) : /* @__PURE__ */ g("div", { className: "relative flex w-[220px] shrink-0 flex-col border-r border-[#ECECEC] bg-[#FAFAFA] p-3", children: [
2356
+ /* @__PURE__ */ g("div", { className: "mb-4 flex shrink-0 items-center gap-1.5", children: [
2357
+ /* @__PURE__ */ g(
2226
2358
  "button",
2227
2359
  {
2228
2360
  type: "button",
2229
2361
  className: "sa-new-chat flex h-8 flex-1 items-center justify-center gap-2 rounded-md text-[14px] font-medium transition-colors",
2230
2362
  onClick: s,
2231
2363
  children: [
2232
- /* @__PURE__ */ e("img", { src: X.messageCreate, alt: "", width: 18, height: 18 }),
2364
+ /* @__PURE__ */ e("img", { src: U.messageCreate, alt: "", width: 18, height: 18 }),
2233
2365
  /* @__PURE__ */ e("span", { className: "sa-new-chat-text whitespace-nowrap", children: "新建对话" })
2234
2366
  ]
2235
2367
  }
@@ -2240,92 +2372,92 @@ function St({
2240
2372
  type: "button",
2241
2373
  className: "sa-tip relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white",
2242
2374
  "data-tooltip": "收起侧边栏",
2243
- onClick: l,
2244
- children: /* @__PURE__ */ e(B, { name: "panel-left-close", size: 16 })
2375
+ onClick: o,
2376
+ children: /* @__PURE__ */ e(H, { name: "panel-left-close", size: 16 })
2245
2377
  }
2246
2378
  )
2247
2379
  ] }),
2248
- /* @__PURE__ */ c("div", { className: "px-1 pb-2.5", children: [
2380
+ /* @__PURE__ */ g("div", { className: "px-1 pb-2.5", children: [
2249
2381
  /* @__PURE__ */ e("div", { className: "mb-1 text-[14px] font-semibold text-[#333]", children: "历史对话" }),
2250
2382
  /* @__PURE__ */ e("div", { className: "text-[11px] text-[#999]", children: "展示最近的会话记录" })
2251
2383
  ] }),
2252
- /* @__PURE__ */ c(
2384
+ /* @__PURE__ */ g(
2253
2385
  "div",
2254
2386
  {
2255
2387
  ref: w,
2256
2388
  className: "flex-1 overflow-y-auto",
2257
- onScroll: M,
2389
+ onScroll: I,
2258
2390
  children: [
2259
- u && t.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "加载中..." }),
2260
- !u && t.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "暂无记录" }),
2261
- $.map((L) => /* @__PURE__ */ c("div", { className: "mb-1", children: [
2262
- /* @__PURE__ */ e("div", { className: "px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]", children: L.label }),
2263
- L.items.map((v) => {
2264
- const A = v.sessionId === a, I = g === v.sessionId;
2391
+ f && t.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "加载中..." }),
2392
+ !f && t.length === 0 && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-[12px] text-[#999]", children: "暂无记录" }),
2393
+ L.map((R) => /* @__PURE__ */ g("div", { className: "mb-1", children: [
2394
+ /* @__PURE__ */ e("div", { className: "px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]", children: R.label }),
2395
+ R.items.map((F) => {
2396
+ const P = F.sessionId === a, D = h === F.sessionId;
2265
2397
  return /* @__PURE__ */ e(
2266
2398
  "div",
2267
2399
  {
2268
- className: `group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${A ? "bg-[#E8F1FE]" : "hover:bg-[#E8F1FE]"}`,
2400
+ className: `group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${P ? "bg-[#E8F1FE]" : "hover:bg-[#E8F1FE]"}`,
2269
2401
  onClick: () => {
2270
- m !== v.sessionId && n(v.sessionId);
2402
+ b !== F.sessionId && n(F.sessionId);
2271
2403
  },
2272
- onMouseEnter: (F) => {
2273
- if (m === v.sessionId) return;
2274
- const h = F.currentTarget.getBoundingClientRect();
2275
- H({
2276
- text: v.title || "新会话",
2277
- x: h.right + 8,
2278
- y: h.top + h.height / 2
2404
+ onMouseEnter: (S) => {
2405
+ if (b === F.sessionId) return;
2406
+ const u = S.currentTarget.getBoundingClientRect();
2407
+ A({
2408
+ text: F.title || "新会话",
2409
+ x: u.right + 8,
2410
+ y: u.top + u.height / 2
2279
2411
  });
2280
2412
  },
2281
- onMouseLeave: () => H(null),
2282
- children: m === v.sessionId ? /* @__PURE__ */ e(
2413
+ onMouseLeave: () => A(null),
2414
+ children: b === F.sessionId ? /* @__PURE__ */ e(
2283
2415
  "input",
2284
2416
  {
2285
2417
  className: "w-full rounded border border-[var(--sa-primary)] bg-white px-1.5 py-0.5 text-[12px] outline-none",
2286
- value: f,
2287
- onChange: (F) => y(F.target.value),
2288
- onBlur: () => D(v.sessionId),
2289
- onKeyDown: (F) => {
2290
- F.key === "Enter" && D(v.sessionId), F.key === "Escape" && x(null);
2418
+ value: p,
2419
+ onChange: (S) => m(S.target.value),
2420
+ onBlur: () => M(F.sessionId),
2421
+ onKeyDown: (S) => {
2422
+ S.key === "Enter" && M(F.sessionId), S.key === "Escape" && y(null);
2291
2423
  },
2292
- onClick: (F) => F.stopPropagation(),
2424
+ onClick: (S) => S.stopPropagation(),
2293
2425
  autoFocus: !0
2294
2426
  }
2295
- ) : /* @__PURE__ */ c(V, { children: [
2427
+ ) : /* @__PURE__ */ g(K, { children: [
2296
2428
  /* @__PURE__ */ e(
2297
2429
  "img",
2298
2430
  {
2299
- src: X.message,
2431
+ src: U.message,
2300
2432
  alt: "",
2301
2433
  width: 16,
2302
2434
  height: 16,
2303
2435
  className: "shrink-0 opacity-60"
2304
2436
  }
2305
2437
  ),
2306
- /* @__PURE__ */ e("span", { className: "flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]", children: v.title || "新会话" }),
2307
- /* @__PURE__ */ c("span", { className: "hidden shrink-0 items-center gap-0.5 group-hover:flex", children: [
2438
+ /* @__PURE__ */ e("span", { className: "flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]", children: F.title || "新会话" }),
2439
+ /* @__PURE__ */ g("span", { className: "hidden shrink-0 items-center gap-0.5 group-hover:flex", children: [
2308
2440
  /* @__PURE__ */ e(
2309
2441
  "button",
2310
2442
  {
2311
2443
  type: "button",
2312
2444
  className: "flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[var(--sa-primary)]",
2313
- onClick: (F) => S(v.sessionId, v.title, F),
2445
+ onClick: (S) => $(F.sessionId, F.title, S),
2314
2446
  title: "重命名",
2315
- children: /* @__PURE__ */ e(B, { name: "pen", size: 12 })
2447
+ children: /* @__PURE__ */ e(H, { name: "pen", size: 12 })
2316
2448
  }
2317
2449
  ),
2318
2450
  /* @__PURE__ */ e(
2319
2451
  "button",
2320
2452
  {
2321
2453
  type: "button",
2322
- className: `flex h-5 w-5 items-center justify-center rounded ${I ? "bg-[#fee2e2] text-[#ef4444]" : "text-[#999] hover:bg-white/70 hover:text-[#ef4444]"}`,
2323
- onClick: (F) => C(v.sessionId, F),
2324
- title: I ? "确认删除" : "删除",
2454
+ className: `flex h-5 w-5 items-center justify-center rounded ${D ? "bg-[#fee2e2] text-[#ef4444]" : "text-[#999] hover:bg-white/70 hover:text-[#ef4444]"}`,
2455
+ onClick: (S) => N(F.sessionId, S),
2456
+ title: D ? "确认删除" : "删除",
2325
2457
  children: /* @__PURE__ */ e(
2326
- B,
2458
+ H,
2327
2459
  {
2328
- name: I ? "x" : "trash2",
2460
+ name: D ? "x" : "trash2",
2329
2461
  size: 12
2330
2462
  }
2331
2463
  )
@@ -2334,116 +2466,117 @@ function St({
2334
2466
  ] })
2335
2467
  ] })
2336
2468
  },
2337
- v.sessionId
2469
+ F.sessionId
2338
2470
  );
2339
2471
  })
2340
- ] }, L.label)),
2341
- d && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-center text-[11px] text-[#C0C0C0]", children: "向下滚动加载更多" })
2472
+ ] }, R.label)),
2473
+ l && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-center text-[11px] text-[#C0C0C0]", children: "向下滚动加载更多" })
2342
2474
  ]
2343
2475
  }
2344
2476
  ),
2345
- z && /* @__PURE__ */ e(
2477
+ C && /* @__PURE__ */ e(
2346
2478
  "div",
2347
2479
  {
2348
2480
  className: "pointer-events-none fixed z-[10001] whitespace-nowrap rounded border border-[#E8E8E8] bg-white px-2.5 py-1.5 text-[12px] leading-[1.4] text-[#333] shadow-[0_2px_8px_rgba(0,0,0,0.12)]",
2349
2481
  style: {
2350
- left: z.x,
2351
- top: z.y,
2482
+ left: C.x,
2483
+ top: C.y,
2352
2484
  transform: "translateY(-50%)"
2353
2485
  },
2354
- children: z.text
2486
+ children: C.text
2355
2487
  }
2356
2488
  )
2357
2489
  ] });
2358
2490
  }
2359
- function At({
2491
+ function Gt({
2360
2492
  title: t,
2361
2493
  slots: a,
2362
2494
  welcomeMessage: n,
2363
2495
  suggestedPrompts: s,
2364
2496
  capabilities: r,
2365
2497
  quickLinks: i,
2366
- logo: o,
2367
- sidebarDefaultOpen: l = !0,
2368
- onClose: d,
2369
- avatar: p,
2370
- artifactPreview: u,
2371
- showTimestamp: g
2498
+ logo: d,
2499
+ sidebarDefaultOpen: o = !0,
2500
+ onClose: l,
2501
+ avatar: c,
2502
+ artifactPreview: f,
2503
+ showTimestamp: h
2372
2504
  }) {
2373
2505
  const {
2374
- status: b,
2375
- sendMessage: m,
2376
- stop: x,
2377
- conversations: f,
2378
- activeConversationId: y,
2379
- switchConversation: z,
2380
- newConversation: H,
2381
- deleteConversation: k,
2382
- renameConversation: C,
2383
- toggleArtifactDrawer: S,
2384
- isArtifactDrawerOpen: D,
2385
- allArtifacts: w,
2386
- activePreviewArtifact: M,
2387
- hasMore: $,
2388
- loadMoreConversations: L,
2389
- conversationsLoading: v,
2390
- messagesLoading: A
2391
- } = Z(), [I, F] = E(l), h = N(() => F((T) => !T), []), _ = a.ThreadList, O = a.Composer, W = a.Header;
2392
- return /* @__PURE__ */ c("div", { className: "sa-fullpage", children: [
2393
- _ ? /* @__PURE__ */ e(
2506
+ status: x,
2507
+ sendMessage: b,
2508
+ stop: y,
2509
+ conversations: p,
2510
+ activeConversationId: m,
2511
+ switchConversation: C,
2512
+ newConversation: A,
2513
+ deleteConversation: v,
2514
+ renameConversation: N,
2515
+ toggleArtifactDrawer: $,
2516
+ allArtifacts: M,
2517
+ activePanel: w,
2518
+ closePanel: I,
2519
+ hasMore: L,
2520
+ loadMoreConversations: R,
2521
+ conversationsLoading: F
2522
+ } = J(), [P, D] = E(o), S = k(() => D((z) => !z), []), u = !!w;
2523
+ j(() => () => I(), [I]);
2524
+ const T = a.ThreadList, B = a.Composer, O = a.Header;
2525
+ return /* @__PURE__ */ g("div", { className: "sa-fullpage", children: [
2526
+ T ? /* @__PURE__ */ e(
2394
2527
  "div",
2395
2528
  {
2396
- className: `sa-fp-sidebar-wrapper ${I ? "" : "sa-fp-sidebar-wrapper-collapsed"}`,
2529
+ className: `sa-fp-sidebar-wrapper ${P ? "" : "sa-fp-sidebar-wrapper-collapsed"}`,
2397
2530
  children: /* @__PURE__ */ e(
2398
- _,
2531
+ T,
2399
2532
  {
2400
- conversations: f,
2401
- activeSessionId: y,
2402
- onSwitch: z,
2403
- onNew: H,
2404
- onDelete: k,
2405
- onRename: C,
2406
- hasMore: $,
2407
- onLoadMore: L
2533
+ conversations: p,
2534
+ activeSessionId: m,
2535
+ onSwitch: C,
2536
+ onNew: A,
2537
+ onDelete: v,
2538
+ onRename: N,
2539
+ hasMore: L,
2540
+ onLoadMore: R
2408
2541
  }
2409
2542
  )
2410
2543
  }
2411
2544
  ) : /* @__PURE__ */ e(
2412
- St,
2545
+ Yt,
2413
2546
  {
2414
- conversations: f,
2415
- activeSessionId: y,
2416
- onSwitch: z,
2417
- onNew: H,
2418
- onDelete: k,
2419
- onRename: C,
2420
- isCollapsed: !I,
2421
- onToggleCollapse: h,
2422
- hasMore: $,
2423
- onLoadMore: L,
2424
- conversationsLoading: v
2547
+ conversations: p,
2548
+ activeSessionId: m,
2549
+ onSwitch: C,
2550
+ onNew: A,
2551
+ onDelete: v,
2552
+ onRename: N,
2553
+ isCollapsed: !P,
2554
+ onToggleCollapse: S,
2555
+ hasMore: L,
2556
+ onLoadMore: R,
2557
+ conversationsLoading: F
2425
2558
  }
2426
2559
  ),
2427
- /* @__PURE__ */ c("div", { className: "sa-fp-main", children: [
2428
- W ? /* @__PURE__ */ e(
2429
- W,
2560
+ /* @__PURE__ */ g("div", { className: "sa-fp-main", children: [
2561
+ O ? /* @__PURE__ */ e(
2562
+ O,
2430
2563
  {
2431
2564
  title: t,
2432
- onClose: d ?? Et,
2433
- onToggleThreadList: h,
2434
- artifactCount: u ? w.length : 0,
2435
- onToggleArtifactDrawer: u ? S : void 0
2565
+ onClose: l ?? Wt,
2566
+ onToggleThreadList: S,
2567
+ artifactCount: u || !f ? 0 : M.length,
2568
+ onToggleArtifactDrawer: u || !f ? void 0 : $
2436
2569
  }
2437
- ) : /* @__PURE__ */ c("div", { className: "sa-fp-header", children: [
2570
+ ) : /* @__PURE__ */ g("div", { className: "sa-fp-header", children: [
2438
2571
  /* @__PURE__ */ e("div", { className: "sa-fp-header-title", children: t }),
2439
- /* @__PURE__ */ e("div", { className: "sa-fp-header-actions", children: u && w.length > 0 && /* @__PURE__ */ c(
2572
+ /* @__PURE__ */ e("div", { className: "sa-fp-header-actions", children: !u && f && M.length > 0 && /* @__PURE__ */ g(
2440
2573
  "button",
2441
2574
  {
2442
2575
  className: "sa-fp-header-btn sa-header-btn-artifact",
2443
- onClick: S,
2576
+ onClick: $,
2444
2577
  title: "会话产物",
2445
2578
  children: [
2446
- /* @__PURE__ */ c(
2579
+ /* @__PURE__ */ g(
2447
2580
  "svg",
2448
2581
  {
2449
2582
  width: "14",
@@ -2463,109 +2596,103 @@ function At({
2463
2596
  }
2464
2597
  ) })
2465
2598
  ] }),
2466
- /* @__PURE__ */ c("div", { className: "sa-fp-content-row", children: [
2467
- A ? /* @__PURE__ */ c("div", { className: "sa-messages-loading", children: [
2468
- /* @__PURE__ */ e("span", { className: "sa-loading-spinner" }),
2469
- "加载对话..."
2470
- ] }) : /* @__PURE__ */ e(
2471
- $e,
2472
- {
2473
- slots: a,
2474
- welcomeMessage: n,
2475
- suggestedPrompts: s,
2476
- capabilities: r,
2477
- quickLinks: i,
2478
- logo: o,
2479
- avatar: p,
2480
- artifactPreview: u,
2481
- showTimestamp: g
2482
- }
2483
- ),
2484
- u && D && /* @__PURE__ */ e(
2485
- _e,
2486
- {
2487
- artifacts: w,
2488
- initialArtifact: M,
2489
- onClose: S
2490
- }
2491
- )
2492
- ] }),
2493
- O ? /* @__PURE__ */ e(O, { status: b, onSend: m, onStop: x }) : /* @__PURE__ */ e(Le, {})
2599
+ /* @__PURE__ */ e(
2600
+ Be,
2601
+ {
2602
+ contentClassName: "sa-fp-content-row",
2603
+ artifactPreview: f,
2604
+ thread: /* @__PURE__ */ e(
2605
+ He,
2606
+ {
2607
+ slots: a,
2608
+ welcomeMessage: n,
2609
+ suggestedPrompts: s,
2610
+ capabilities: r,
2611
+ quickLinks: i,
2612
+ logo: d,
2613
+ avatar: c,
2614
+ artifactPreview: f,
2615
+ showTimestamp: h
2616
+ }
2617
+ ),
2618
+ composer: B ? /* @__PURE__ */ e(B, { status: x, onSend: b, onStop: y }) : /* @__PURE__ */ e(Pe, {})
2619
+ }
2620
+ )
2494
2621
  ] })
2495
2622
  ] });
2496
2623
  }
2497
- function Dt(t) {
2624
+ function Xt(t) {
2498
2625
  const {
2499
2626
  sdk: a,
2500
2627
  mode: n = "floating",
2501
2628
  slots: s = {},
2502
2629
  hooks: r = {},
2503
2630
  welcomeMessage: i,
2504
- suggestedPrompts: o,
2505
- title: l = "AI Assistant",
2506
- initialOpen: d = !1,
2507
- onOpenChange: p,
2508
- sidebarDefaultOpen: u,
2509
- avatar: g,
2510
- artifactPreview: b,
2511
- capabilities: m,
2512
- quickLinks: x,
2513
- logo: f,
2514
- triggerLogo: y,
2515
- theme: z,
2516
- showTimestamp: H
2517
- } = t, [k, C] = E(d);
2518
- P(() => {
2519
- C(d);
2520
- }, [d]);
2521
- const S = N(() => {
2522
- var $, L;
2523
- const M = !k;
2524
- C(M), p == null || p(M), M ? ($ = r.onOpen) == null || $.call(r) : (L = r.onClose) == null || L.call(r);
2525
- }, [k, r, p]), D = N(() => {
2526
- var M;
2527
- C(!1), p == null || p(!1), (M = r.onClose) == null || M.call(r);
2528
- }, [r, p]), w = s.Trigger ?? Ve;
2529
- return n === "fullpage" ? k ? /* @__PURE__ */ e(ye, { sdk: a, hooks: r, children: /* @__PURE__ */ e(
2530
- At,
2631
+ suggestedPrompts: d,
2632
+ title: o = "AI Assistant",
2633
+ initialOpen: l = !1,
2634
+ onOpenChange: c,
2635
+ sidebarDefaultOpen: f,
2636
+ avatar: h,
2637
+ artifactPreview: x,
2638
+ capabilities: b,
2639
+ quickLinks: y,
2640
+ logo: p,
2641
+ triggerLogo: m,
2642
+ theme: C,
2643
+ showTimestamp: A
2644
+ } = t, [v, N] = E(l);
2645
+ j(() => {
2646
+ N(l);
2647
+ }, [l]);
2648
+ const $ = k(() => {
2649
+ var L, R;
2650
+ const I = !v;
2651
+ N(I), c == null || c(I), I ? (L = r.onOpen) == null || L.call(r) : (R = r.onClose) == null || R.call(r);
2652
+ }, [v, r, c]), M = k(() => {
2653
+ var I;
2654
+ N(!1), c == null || c(!1), (I = r.onClose) == null || I.call(r);
2655
+ }, [r, c]), w = s.Trigger ?? it;
2656
+ return n === "fullpage" ? v ? /* @__PURE__ */ e(Te, { sdk: a, hooks: r, children: /* @__PURE__ */ e(
2657
+ Gt,
2531
2658
  {
2532
- title: l,
2659
+ title: o,
2533
2660
  slots: s,
2534
2661
  welcomeMessage: i,
2535
- suggestedPrompts: o,
2536
- capabilities: m,
2537
- quickLinks: x,
2538
- logo: f,
2539
- sidebarDefaultOpen: u,
2540
- onClose: D,
2541
- avatar: g,
2542
- artifactPreview: b,
2543
- showTimestamp: H
2662
+ suggestedPrompts: d,
2663
+ capabilities: b,
2664
+ quickLinks: y,
2665
+ logo: p,
2666
+ sidebarDefaultOpen: f,
2667
+ onClose: M,
2668
+ avatar: h,
2669
+ artifactPreview: x,
2670
+ showTimestamp: A
2544
2671
  }
2545
- ) }) : null : /* @__PURE__ */ c(ye, { sdk: a, hooks: r, children: [
2546
- /* @__PURE__ */ e(w, { isOpen: k, onClick: S, triggerLogo: y }),
2672
+ ) }) : null : /* @__PURE__ */ g(Te, { sdk: a, hooks: r, children: [
2673
+ /* @__PURE__ */ e(w, { isOpen: v, onClick: $, triggerLogo: m }),
2547
2674
  /* @__PURE__ */ e(
2548
- Mt,
2675
+ jt,
2549
2676
  {
2550
- isOpen: k,
2551
- onClose: D,
2552
- title: l,
2677
+ isOpen: v,
2678
+ onClose: M,
2679
+ title: o,
2553
2680
  slots: s,
2554
2681
  welcomeMessage: i,
2555
- suggestedPrompts: o,
2556
- avatar: g,
2557
- artifactPreview: b,
2558
- capabilities: m,
2559
- quickLinks: x,
2560
- logo: f,
2561
- defaultWidth: z == null ? void 0 : z.panelWidth,
2562
- defaultHeight: z == null ? void 0 : z.panelHeight,
2563
- showTimestamp: H
2682
+ suggestedPrompts: d,
2683
+ avatar: h,
2684
+ artifactPreview: x,
2685
+ capabilities: b,
2686
+ quickLinks: y,
2687
+ logo: p,
2688
+ defaultWidth: C == null ? void 0 : C.panelWidth,
2689
+ defaultHeight: C == null ? void 0 : C.panelHeight,
2690
+ showTimestamp: A
2564
2691
  }
2565
2692
  )
2566
2693
  ] });
2567
2694
  }
2568
- const $t = `
2695
+ const Ut = `
2569
2696
  [data-super-agent-widget] {
2570
2697
  --sa-primary-dark: color-mix(in srgb, var(--sa-primary) 82%, #000);
2571
2698
  --sa-primary-light: color-mix(in srgb, var(--sa-primary) 10%, #fff);
@@ -2583,16 +2710,32 @@ const $t = `
2583
2710
  text-rendering: optimizeLegibility;
2584
2711
  }
2585
2712
 
2713
+ /* 迷你 preflight(scoped):Tailwind preflight 已禁用(避免污染宿主页),
2714
+ 但 border 工具类只输出 border-width、无 border-style(CSS 初始值 none → 边框不渲染),
2715
+ button/ul 也会吃到浏览器原生样式。此处补齐等价复位:
2716
+ - 特异性 (0,1,0),低于 scoped utility (0,2,0),靠源顺序让位于后置的 sa-* plain 类
2717
+ - 两条注入顺序固定为 widgetStyles + tailwindStyles(mount.ts),utility 恒在其后 */
2586
2718
  [data-super-agent-widget] *,
2587
2719
  [data-super-agent-widget] *::before,
2588
2720
  [data-super-agent-widget] *::after {
2589
2721
  box-sizing: border-box;
2590
2722
  margin: 0;
2591
2723
  padding: 0;
2724
+ border-width: 0;
2725
+ border-style: solid;
2726
+ border-color: var(--sa-border, #e5e7eb);
2592
2727
  }
2593
2728
 
2594
- [data-super-agent-widget] button {
2729
+ /* :where() 零特异性贡献:plain-CSS 组件类(如 .sa-new-chat 的渐变底)不受影响 */
2730
+ [data-super-agent-widget] :where(button) {
2595
2731
  font-family: inherit;
2732
+ background-color: transparent;
2733
+ background-image: none;
2734
+ cursor: pointer;
2735
+ }
2736
+
2737
+ [data-super-agent-widget] :where(ul, ol) {
2738
+ list-style: none;
2596
2739
  }
2597
2740
 
2598
2741
  /* ── Trigger / Panel / Header(浮窗框架已改用 Tailwind 实现,见 tailwind.css) ── */
@@ -3543,26 +3686,6 @@ const $t = `
3543
3686
  padding: 24px 24px;
3544
3687
  }
3545
3688
 
3546
- .sa-fp-main .sa-composer {
3547
- margin: 0 auto;
3548
- width: 100%;
3549
- padding: 12px 24px 20px;
3550
- border-top: none;
3551
- background: transparent;
3552
- }
3553
-
3554
- .sa-fp-main .sa-composer-input {
3555
- background: #f7f7f8;
3556
- border: 1px solid #e4e4e7;
3557
- box-shadow: none;
3558
- }
3559
-
3560
- .sa-fp-main .sa-composer-input:focus {
3561
- background: #fff;
3562
- border-color: #d4d4d8;
3563
- box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
3564
- }
3565
-
3566
3689
  /* ── Artifact file cards (in ToolResultPart) ── */
3567
3690
  .sa-artifact-file-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
3568
3691
  .sa-artifact-file-card {
@@ -3648,7 +3771,8 @@ const $t = `
3648
3771
  transition: background 0.15s ease, border-color 0.15s ease;
3649
3772
  }
3650
3773
  .sa-drawer-btn-sm:hover { background: var(--sa-surface); border-color: var(--sa-primary); }
3651
- .sa-artifact-drawer-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
3774
+ /* flex 列容器:让 .sa-drawer-view-enter(flex:1)与内层滚动/iframe 有真实高度链 */
3775
+ .sa-artifact-drawer-body { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
3652
3776
  .sa-drawer-empty { padding: 48px 24px; text-align: center; color: var(--sa-text-muted); font-size: 14px; }
3653
3777
  .sa-drawer-file-list { list-style: none; margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
3654
3778
  .sa-drawer-file-card {
@@ -3671,6 +3795,9 @@ const $t = `
3671
3795
 
3672
3796
  /* ── Drawer preview ── */
3673
3797
  .sa-drawer-preview-iframe { width: 100%; height: 100%; border: none; background: #fff; animation: sa-fade-in 0.3s ease both; }
3798
+ /* html/docx 内联预览:与消息流 ToolResultPart 一致(无 iframe) */
3799
+ .sa-drawer-preview-html-scroll { flex: 1; min-height: 0; overflow: auto; padding: 12px; background: #fff; animation: sa-fade-in 0.3s ease both; }
3800
+ .sa-drawer-preview-html { max-width: none; }
3674
3801
  .sa-drawer-preview-loading {
3675
3802
  display: flex; flex-direction: column; align-items: center; justify-content: center;
3676
3803
  height: 100%; gap: 12px; color: var(--sa-text-muted); font-size: 14px;
@@ -3687,7 +3814,9 @@ const $t = `
3687
3814
  }
3688
3815
 
3689
3816
  /* ── Drawer view transition ── */
3690
- .sa-drawer-view-enter { animation: sa-drawer-view-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) both; }
3817
+ /* flex 列 + flex:1 撑满 drawer body,让内层 .sa-drawer-preview-html-scroll 的
3818
+ flex:1/min-height:0 与 pdf iframe 的 height:100% 有真实高度链 */
3819
+ .sa-drawer-view-enter { display: flex; flex-direction: column; flex: 1; min-height: 0; animation: sa-drawer-view-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) both; }
3691
3820
 
3692
3821
  /* ── Layout helpers for drawer alongside thread ── */
3693
3822
  .sa-panel-content { display: flex; flex: 1; min-height: 0; overflow: hidden; }
@@ -3696,6 +3825,24 @@ const $t = `
3696
3825
  .sa-fp-content-row { display: flex; flex: 1; min-height: 0; overflow: hidden; }
3697
3826
  .sa-fp-content-row .sa-thread { flex: 1; min-width: 0; transition: flex 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
3698
3827
 
3828
+ /* ── Page overlay(面板级整屏页面:替换内容区 + 输入区,Header 保留) ── */
3829
+ .sa-page-overlay {
3830
+ display: flex; flex-direction: column; flex: 1; min-height: 0;
3831
+ position: relative; z-index: 2; background: #fff; overflow: hidden;
3832
+ animation: sa-page-in 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
3833
+ }
3834
+ /* 大窗态与内容区/输入区一致的 800px 居中 */
3835
+ .sa-page-overlay-centered { width: 100%; max-width: 800px; margin: 0 auto; }
3836
+ .sa-page-overlay-bar {
3837
+ display: flex; align-items: center; gap: 8px; flex-shrink: 0;
3838
+ padding: 10px 14px; border-bottom: 1px solid var(--sa-border);
3839
+ background: var(--sa-surface); color: var(--sa-text);
3840
+ font-size: 15px; font-weight: 600;
3841
+ }
3842
+ .sa-page-overlay-back-label { font-size: 13px; font-weight: 400; }
3843
+ .sa-page-overlay-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3844
+ /* 滚动归 SDK,业务页不写滚动容器 */
3845
+ .sa-page-overlay-body { flex: 1; min-height: 0; overflow-y: auto; }
3699
3846
  /* ── Artifact keyframes ── */
3700
3847
  @keyframes sa-slide-in-right {
3701
3848
  from { opacity: 0; transform: translateX(100%); }
@@ -3724,7 +3871,11 @@ const $t = `
3724
3871
  from { opacity: 0; transform: translateX(12px); }
3725
3872
  to { opacity: 1; transform: translateX(0); }
3726
3873
  }
3727
- `, Lt = '[data-super-agent-widget] .pointer-events-none{pointer-events:none}[data-super-agent-widget] .collapse{visibility:collapse}[data-super-agent-widget] .fixed{position:fixed}[data-super-agent-widget] .absolute{position:absolute}[data-super-agent-widget] .relative{position:relative}[data-super-agent-widget] .inset-0{top:0;right:0;bottom:0;left:0}[data-super-agent-widget] .inset-x-0{left:0;right:0}[data-super-agent-widget] .-right-2{right:-.5rem}[data-super-agent-widget] .-top-1\\.5{top:-.375rem}[data-super-agent-widget] .bottom-0{bottom:0}[data-super-agent-widget] .left-\\[-3px\\]{left:-3px}[data-super-agent-widget] .right-\\[-3px\\]{right:-3px}[data-super-agent-widget] .top-0{top:0}[data-super-agent-widget] .z-0{z-index:0}[data-super-agent-widget] .z-10{z-index:10}[data-super-agent-widget] .z-20{z-index:20}[data-super-agent-widget] .z-\\[10000\\]{z-index:10000}[data-super-agent-widget] .z-\\[10001\\]{z-index:10001}[data-super-agent-widget] .z-\\[1\\]{z-index:1}[data-super-agent-widget] .z-\\[2\\]{z-index:2}[data-super-agent-widget] .z-\\[5\\]{z-index:5}[data-super-agent-widget] .z-\\[var\\(--sa-z-index\\,9999\\)\\]{z-index:var(--sa-z-index,9999)}[data-super-agent-widget] .m-0{margin:0}[data-super-agent-widget] .mx-auto{margin-left:auto;margin-right:auto}[data-super-agent-widget] .mb-0\\.5{margin-bottom:.125rem}[data-super-agent-widget] .mb-1{margin-bottom:.25rem}[data-super-agent-widget] .mb-3{margin-bottom:.75rem}[data-super-agent-widget] .mb-4{margin-bottom:1rem}[data-super-agent-widget] .mt-3{margin-top:.75rem}[data-super-agent-widget] .block{display:block}[data-super-agent-widget] .inline{display:inline}[data-super-agent-widget] .flex{display:flex}[data-super-agent-widget] .inline-flex{display:inline-flex}[data-super-agent-widget] .table{display:table}[data-super-agent-widget] .hidden{display:none}[data-super-agent-widget] .h-14{height:3.5rem}[data-super-agent-widget] .h-5{height:1.25rem}[data-super-agent-widget] .h-7{height:1.75rem}[data-super-agent-widget] .h-8{height:2rem}[data-super-agent-widget] .h-9{height:2.25rem}[data-super-agent-widget] .h-\\[13px\\]{height:13px}[data-super-agent-widget] .h-\\[18px\\]{height:18px}[data-super-agent-widget] .h-\\[238px\\]{height:238px}[data-super-agent-widget] .h-\\[calc\\(100\\%_-_48px\\)\\]{height:calc(100% - 48px)}[data-super-agent-widget] .h-full{height:100%}[data-super-agent-widget] .min-h-\\[70px\\]{min-height:70px}[data-super-agent-widget] .w-12{width:3rem}[data-super-agent-widget] .w-14{width:3.5rem}[data-super-agent-widget] .w-5{width:1.25rem}[data-super-agent-widget] .w-7{width:1.75rem}[data-super-agent-widget] .w-\\[18px\\]{width:18px}[data-super-agent-widget] .w-\\[220px\\]{width:220px}[data-super-agent-widget] .w-\\[6px\\]{width:6px}[data-super-agent-widget] .w-full{width:100%}[data-super-agent-widget] .w-px{width:1px}[data-super-agent-widget] .min-w-0{min-width:0px}[data-super-agent-widget] .min-w-\\[14px\\]{min-width:14px}[data-super-agent-widget] .max-w-16{max-width:4rem}[data-super-agent-widget] .max-w-\\[800px\\]{max-width:800px}[data-super-agent-widget] .max-w-full{max-width:100%}[data-super-agent-widget] .flex-1{flex:1 1 0%}[data-super-agent-widget] .flex-shrink{flex-shrink:1}[data-super-agent-widget] .shrink-0{flex-shrink:0}[data-super-agent-widget] .border-collapse{border-collapse:collapse}[data-super-agent-widget] .scale-50{--tw-scale-x: .5;--tw-scale-y: .5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .cursor-col-resize{cursor:col-resize}[data-super-agent-widget] .cursor-default{cursor:default}[data-super-agent-widget] .cursor-grab{cursor:grab}[data-super-agent-widget] .cursor-pointer{cursor:pointer}[data-super-agent-widget] .cursor-text{cursor:text}[data-super-agent-widget] .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-super-agent-widget] .resize-none{resize:none}[data-super-agent-widget] .resize{resize:both}[data-super-agent-widget] .flex-row{flex-direction:row}[data-super-agent-widget] .flex-col{flex-direction:column}[data-super-agent-widget] .flex-wrap{flex-wrap:wrap}[data-super-agent-widget] .items-start{align-items:flex-start}[data-super-agent-widget] .items-center{align-items:center}[data-super-agent-widget] .justify-end{justify-content:flex-end}[data-super-agent-widget] .justify-center{justify-content:center}[data-super-agent-widget] .justify-between{justify-content:space-between}[data-super-agent-widget] .gap-0\\.5{gap:.125rem}[data-super-agent-widget] .gap-1{gap:.25rem}[data-super-agent-widget] .gap-1\\.5{gap:.375rem}[data-super-agent-widget] .gap-2{gap:.5rem}[data-super-agent-widget] .gap-2\\.5{gap:.625rem}[data-super-agent-widget] .gap-3{gap:.75rem}[data-super-agent-widget] .gap-4{gap:1rem}[data-super-agent-widget] .gap-8{gap:2rem}[data-super-agent-widget] .gap-\\[22px\\]{gap:22px}[data-super-agent-widget] .gap-\\[7px\\]{gap:7px}[data-super-agent-widget] .overflow-hidden{overflow:hidden}[data-super-agent-widget] .overflow-visible{overflow:visible}[data-super-agent-widget] .overflow-y-auto{overflow-y:auto}[data-super-agent-widget] .text-ellipsis{text-overflow:ellipsis}[data-super-agent-widget] .whitespace-nowrap{white-space:nowrap}[data-super-agent-widget] .rounded{border-radius:.25rem}[data-super-agent-widget] .rounded-\\[5px\\]{border-radius:5px}[data-super-agent-widget] .rounded-full{border-radius:9999px}[data-super-agent-widget] .rounded-md{border-radius:.375rem}[data-super-agent-widget] .rounded-xl{border-radius:.75rem}[data-super-agent-widget] .rounded-t-2xl{border-top-left-radius:1rem;border-top-right-radius:1rem}[data-super-agent-widget] .border{border-width:1px}[data-super-agent-widget] .border-r{border-right-width:1px}[data-super-agent-widget] .border-none{border-style:none}[data-super-agent-widget] .border-\\[\\#DADADA\\]{--tw-border-opacity: 1;border-color:rgb(218 218 218 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#E8E8E8\\]{--tw-border-opacity: 1;border-color:rgb(232 232 232 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#ECECEC\\]{--tw-border-opacity: 1;border-color:rgb(236 236 236 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[var\\(--sa-primary\\)\\]{border-color:var(--sa-primary)}[data-super-agent-widget] .bg-\\[\\#DCDCDC\\]{--tw-bg-opacity: 1;background-color:rgb(220 220 220 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#E8F1FE\\]{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#F5F5F5\\]{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#FAFAFA\\]{--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#fee2e2\\]{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[var\\(--sa-primary\\)\\]{background-color:var(--sa-primary)}[data-super-agent-widget] .bg-black\\/30{background-color:#0000004d}[data-super-agent-widget] .bg-transparent{background-color:transparent}[data-super-agent-widget] .bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .object-contain{-o-object-fit:contain;object-fit:contain}[data-super-agent-widget] .p-0{padding:0}[data-super-agent-widget] .p-2{padding:.5rem}[data-super-agent-widget] .p-3{padding:.75rem}[data-super-agent-widget] .px-0\\.5{padding-left:.125rem;padding-right:.125rem}[data-super-agent-widget] .px-1{padding-left:.25rem;padding-right:.25rem}[data-super-agent-widget] .px-1\\.5{padding-left:.375rem;padding-right:.375rem}[data-super-agent-widget] .px-2\\.5{padding-left:.625rem;padding-right:.625rem}[data-super-agent-widget] .px-3{padding-left:.75rem;padding-right:.75rem}[data-super-agent-widget] .px-\\[15px\\]{padding-left:15px;padding-right:15px}[data-super-agent-widget] .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}[data-super-agent-widget] .py-1{padding-top:.25rem;padding-bottom:.25rem}[data-super-agent-widget] .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}[data-super-agent-widget] .py-2{padding-top:.5rem;padding-bottom:.5rem}[data-super-agent-widget] .py-3{padding-top:.75rem;padding-bottom:.75rem}[data-super-agent-widget] .pb-1{padding-bottom:.25rem}[data-super-agent-widget] .pb-2\\.5{padding-bottom:.625rem}[data-super-agent-widget] .pt-2{padding-top:.5rem}[data-super-agent-widget] .text-left{text-align:left}[data-super-agent-widget] .text-center{text-align:center}[data-super-agent-widget] .text-\\[11px\\]{font-size:11px}[data-super-agent-widget] .text-\\[12px\\]{font-size:12px}[data-super-agent-widget] .text-\\[13px\\]{font-size:13px}[data-super-agent-widget] .text-\\[14px\\]{font-size:14px}[data-super-agent-widget] .text-\\[18px\\]{font-size:18px}[data-super-agent-widget] .text-\\[9px\\]{font-size:9px}[data-super-agent-widget] .font-bold{font-weight:700}[data-super-agent-widget] .font-medium{font-weight:500}[data-super-agent-widget] .font-semibold{font-weight:600}[data-super-agent-widget] .italic{font-style:italic}[data-super-agent-widget] .leading-\\[1\\.3\\]{line-height:1.3}[data-super-agent-widget] .leading-\\[1\\.4\\]{line-height:1.4}[data-super-agent-widget] .leading-\\[1\\.5\\]{line-height:1.5}[data-super-agent-widget] .leading-\\[14px\\]{line-height:14px}[data-super-agent-widget] .leading-none{line-height:1}[data-super-agent-widget] .text-\\[\\#333\\]{--tw-text-opacity: 1;color:rgb(51 51 51 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#666\\]{--tw-text-opacity: 1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#999\\]{--tw-text-opacity: 1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#9A9A9A\\]{--tw-text-opacity: 1;color:rgb(154 154 154 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#A0A0A0\\]{--tw-text-opacity: 1;color:rgb(160 160 160 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#B8B8B8\\]{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#C0C0C0\\]{--tw-text-opacity: 1;color:rgb(192 192 192 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#ef4444\\]{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .underline{text-decoration-line:underline}[data-super-agent-widget] .antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[data-super-agent-widget] .opacity-0{opacity:0}[data-super-agent-widget] .opacity-10{opacity:.1}[data-super-agent-widget] .opacity-100{opacity:1}[data-super-agent-widget] .opacity-60{opacity:.6}[data-super-agent-widget] .opacity-70{opacity:.7}[data-super-agent-widget] .shadow-\\[0_-12px_48px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: 0 -12px 48px rgba(0,0,0,.25);--tw-shadow-colored: 0 -12px 48px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .shadow-\\[0_12px_36px_rgba\\(0\\,0\\,0\\,0\\.18\\)\\]{--tw-shadow: 0 12px 36px rgba(0,0,0,.18);--tw-shadow-colored: 0 12px 36px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .shadow-\\[0_2px_8px_rgba\\(0\\,0\\,0\\,0\\.12\\)\\]{--tw-shadow: 0 2px 8px rgba(0,0,0,.12);--tw-shadow-colored: 0 2px 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .outline-none{outline:2px solid transparent;outline-offset:2px}[data-super-agent-widget] .outline{outline-style:solid}[data-super-agent-widget] .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .duration-200{transition-duration:.2s}[data-super-agent-widget] .ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}[data-super-agent-widget] .ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes sa-window-in{0%{opacity:0;transform:translateY(20px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes sa-slide-up-full{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes sa-home-fade-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-chip-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-logo-float{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}@keyframes sa-title-shimmer{0%{background-position:100% 0}to{background-position:-100% 0}}@keyframes sa-history-in{0%{opacity:0;transform:translate(-10px)}to{opacity:1;transform:translate(0)}}[data-super-agent-widget] .animate-sa-window-in{animation:sa-window-in .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-slide-up-full{animation:sa-slide-up-full .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-fade-in{animation:sa-fade-in .2s ease}[data-super-agent-widget] .animate-sa-home-fade-in{animation:sa-home-fade-in .4s ease forwards}[data-super-agent-widget] .animate-sa-chip-in{animation:sa-chip-in .4s cubic-bezier(.22,1,.36,1) forwards}[data-super-agent-widget] .animate-sa-logo-float{animation:sa-logo-float 3s ease-in-out infinite}[data-super-agent-widget] .animate-sa-title-shimmer{animation:sa-title-shimmer 2.5s ease forwards}[data-super-agent-widget] .animate-sa-history-in{animation:sa-history-in .2s ease}[data-super-agent-widget] .sa-tip{position:relative}[data-super-agent-widget] .sa-tip:before,[data-super-agent-widget] .sa-tip:after{position:absolute;top:100%;left:50%;pointer-events:none;opacity:0;transition:opacity .15s ease;z-index:100}[data-super-agent-widget] .sa-tip:before{content:attr(data-tooltip);transform:translate(-50%);margin-top:6px;padding:4px 8px;background:#fff;color:#333;font-size:12px;line-height:1.4;white-space:nowrap;border-radius:4px;box-shadow:0 2px 8px #0000001f;border:1px solid #e8e8e8}[data-super-agent-widget] .sa-tip:after{content:"";transform:translate(-50%);margin-top:2px;border:4px solid transparent;border-bottom-color:#fff;filter:drop-shadow(0 -1px 1px rgba(0,0,0,.06))}[data-super-agent-widget] .sa-tip:hover:before,[data-super-agent-widget] .sa-tip:hover:after{opacity:1}[data-super-agent-widget] .sa-chip{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(#e0e0e0,#e0e0e0) border-box;border:1px solid transparent}[data-super-agent-widget] .sa-chip:hover{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7) border-box}[data-super-agent-widget] .sa-chip:hover .sa-chip-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-shimmer-text{background:linear-gradient(90deg,#333,#333 35%,#00d4ff 40%,#1881f0,#2b52ee,#d116ea,#ff2e7e 56%,#333 61%,#333);background-size:300% 100%;background-position:100% 0;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-new-chat{background:linear-gradient(258deg,#ff2e7e1a -4%,#d116ea1a 16%,#2b52ee1a 53%,#1881f01a 81%,#00d4ff1a 106%)}[data-super-agent-widget] .sa-new-chat:hover{background:linear-gradient(258deg,#ff2e7e29 -4%,#d116ea29 16%,#2b52ee29 53%,#1881f029 81%,#00d4ff29 106%)}[data-super-agent-widget] .sa-new-chat .sa-new-chat-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-home-gradient{background:linear-gradient(239deg,#ff2e7e -3%,#d116ea 17%,#2b52ee 54%,#1881f0 82%,#00d4ff 107%)}[data-super-agent-widget] .sa-home-gradient-fade{background:linear-gradient(180deg,#fff0,#fff)}[data-super-agent-widget] .sa-home-view .sa-thread{background:transparent}[data-super-agent-widget] .sa-resize-handle:hover{background:color-mix(in srgb,var(--sa-primary) 30%,transparent)}[data-super-agent-widget] .sa-input-form{border:1px solid transparent;background-color:#fff;background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);background-origin:border-box;background-clip:padding-box,border-box;transition:background .15s ease}[data-super-agent-widget] .sa-input-form-active,[data-super-agent-widget] .sa-input-form:focus-within{background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-send-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border:none;border-radius:9999px;background:linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);cursor:pointer;flex-shrink:0;align-self:flex-end;transition:background .15s ease,opacity .15s ease}[data-super-agent-widget] .sa-send-btn-active,[data-super-agent-widget] .sa-input-form:focus-within .sa-send-btn{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-send-btn:hover{opacity:.9}[data-super-agent-widget] .sa-send-btn:active{opacity:.7}[data-super-agent-widget] .sa-send-btn img{display:block;width:14px;height:14px;filter:brightness(0) invert(1)}[data-super-agent-widget] .sa-stop-icon{display:block;width:8px;height:8px;border-radius:2px;background:#fff}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:scale-\\[1\\.08\\]:hover{--tw-scale-x: 1.08;--tw-scale-y: 1.08;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .hover\\:bg-\\[\\#E8F1FE\\]:hover{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-\\[\\#F5F5F5\\]:hover{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white\\/70:hover{background-color:#ffffffb3}[data-super-agent-widget] .hover\\:text-\\[\\#1881F0\\]:hover{--tw-text-opacity: 1;color:rgb(24 129 240 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[\\#ef4444\\]:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[var\\(--sa-primary\\)\\]:hover{color:var(--sa-primary)}[data-super-agent-widget] .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .active\\:cursor-grabbing:active{cursor:grabbing}[data-super-agent-widget] .active\\:bg-\\[\\#F5F5F5\\]:active{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] :is(.group:hover .group-hover\\:flex){display:flex}', _t = {
3874
+ @keyframes sa-page-in {
3875
+ from { opacity: 0; transform: translateY(10px); }
3876
+ to { opacity: 1; transform: translateY(0); }
3877
+ }
3878
+ `, Vt = '[data-super-agent-widget] .pointer-events-none{pointer-events:none}[data-super-agent-widget] .collapse{visibility:collapse}[data-super-agent-widget] .fixed{position:fixed}[data-super-agent-widget] .absolute{position:absolute}[data-super-agent-widget] .relative{position:relative}[data-super-agent-widget] .inset-0{top:0;right:0;bottom:0;left:0}[data-super-agent-widget] .inset-x-0{left:0;right:0}[data-super-agent-widget] .-bottom-px{bottom:-1px}[data-super-agent-widget] .-left-px{left:-1px}[data-super-agent-widget] .-right-2{right:-.5rem}[data-super-agent-widget] .-top-1\\.5{top:-.375rem}[data-super-agent-widget] .-top-px{top:-1px}[data-super-agent-widget] .bottom-0{bottom:0}[data-super-agent-widget] .left-\\[-3px\\]{left:-3px}[data-super-agent-widget] .top-0{top:0}[data-super-agent-widget] .z-0{z-index:0}[data-super-agent-widget] .z-10{z-index:10}[data-super-agent-widget] .z-20{z-index:20}[data-super-agent-widget] .z-\\[10000\\]{z-index:10000}[data-super-agent-widget] .z-\\[10001\\]{z-index:10001}[data-super-agent-widget] .z-\\[1\\]{z-index:1}[data-super-agent-widget] .z-\\[2\\]{z-index:2}[data-super-agent-widget] .z-\\[5\\]{z-index:5}[data-super-agent-widget] .z-\\[var\\(--sa-z-index\\,9999\\)\\]{z-index:var(--sa-z-index,9999)}[data-super-agent-widget] .m-0{margin:0}[data-super-agent-widget] .mx-auto{margin-left:auto;margin-right:auto}[data-super-agent-widget] .mb-0\\.5{margin-bottom:.125rem}[data-super-agent-widget] .mb-1{margin-bottom:.25rem}[data-super-agent-widget] .mb-3{margin-bottom:.75rem}[data-super-agent-widget] .mb-4{margin-bottom:1rem}[data-super-agent-widget] .mt-3{margin-top:.75rem}[data-super-agent-widget] .block{display:block}[data-super-agent-widget] .inline{display:inline}[data-super-agent-widget] .flex{display:flex}[data-super-agent-widget] .inline-flex{display:inline-flex}[data-super-agent-widget] .table{display:table}[data-super-agent-widget] .hidden{display:none}[data-super-agent-widget] .h-5{height:1.25rem}[data-super-agent-widget] .h-7{height:1.75rem}[data-super-agent-widget] .h-8{height:2rem}[data-super-agent-widget] .h-9{height:2.25rem}[data-super-agent-widget] .h-\\[13px\\]{height:13px}[data-super-agent-widget] .h-\\[18px\\]{height:18px}[data-super-agent-widget] .h-\\[238px\\]{height:238px}[data-super-agent-widget] .h-\\[calc\\(100\\%_-_48px\\)\\]{height:calc(100% - 48px)}[data-super-agent-widget] .h-full{height:100%}[data-super-agent-widget] .min-h-\\[70px\\]{min-height:70px}[data-super-agent-widget] .w-12{width:3rem}[data-super-agent-widget] .w-5{width:1.25rem}[data-super-agent-widget] .w-7{width:1.75rem}[data-super-agent-widget] .w-\\[18px\\]{width:18px}[data-super-agent-widget] .w-\\[220px\\]{width:220px}[data-super-agent-widget] .w-\\[6px\\]{width:6px}[data-super-agent-widget] .w-full{width:100%}[data-super-agent-widget] .w-px{width:1px}[data-super-agent-widget] .min-w-0{min-width:0px}[data-super-agent-widget] .min-w-\\[14px\\]{min-width:14px}[data-super-agent-widget] .max-w-16{max-width:4rem}[data-super-agent-widget] .max-w-\\[800px\\]{max-width:800px}[data-super-agent-widget] .max-w-full{max-width:100%}[data-super-agent-widget] .flex-1{flex:1 1 0%}[data-super-agent-widget] .flex-shrink{flex-shrink:1}[data-super-agent-widget] .shrink-0{flex-shrink:0}[data-super-agent-widget] .border-collapse{border-collapse:collapse}[data-super-agent-widget] .scale-50{--tw-scale-x: .5;--tw-scale-y: .5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .cursor-col-resize{cursor:col-resize}[data-super-agent-widget] .cursor-default{cursor:default}[data-super-agent-widget] .cursor-grab{cursor:grab}[data-super-agent-widget] .cursor-pointer{cursor:pointer}[data-super-agent-widget] .cursor-text{cursor:text}[data-super-agent-widget] .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-super-agent-widget] .resize-none{resize:none}[data-super-agent-widget] .resize{resize:both}[data-super-agent-widget] .flex-row{flex-direction:row}[data-super-agent-widget] .flex-col{flex-direction:column}[data-super-agent-widget] .flex-wrap{flex-wrap:wrap}[data-super-agent-widget] .items-start{align-items:flex-start}[data-super-agent-widget] .items-center{align-items:center}[data-super-agent-widget] .justify-end{justify-content:flex-end}[data-super-agent-widget] .justify-center{justify-content:center}[data-super-agent-widget] .justify-between{justify-content:space-between}[data-super-agent-widget] .gap-0\\.5{gap:.125rem}[data-super-agent-widget] .gap-1{gap:.25rem}[data-super-agent-widget] .gap-1\\.5{gap:.375rem}[data-super-agent-widget] .gap-2{gap:.5rem}[data-super-agent-widget] .gap-2\\.5{gap:.625rem}[data-super-agent-widget] .gap-3{gap:.75rem}[data-super-agent-widget] .gap-4{gap:1rem}[data-super-agent-widget] .gap-8{gap:2rem}[data-super-agent-widget] .gap-\\[22px\\]{gap:22px}[data-super-agent-widget] .gap-\\[7px\\]{gap:7px}[data-super-agent-widget] .overflow-hidden{overflow:hidden}[data-super-agent-widget] .overflow-visible{overflow:visible}[data-super-agent-widget] .overflow-y-auto{overflow-y:auto}[data-super-agent-widget] .text-ellipsis{text-overflow:ellipsis}[data-super-agent-widget] .whitespace-nowrap{white-space:nowrap}[data-super-agent-widget] .rounded{border-radius:.25rem}[data-super-agent-widget] .rounded-\\[5px\\]{border-radius:5px}[data-super-agent-widget] .rounded-full{border-radius:9999px}[data-super-agent-widget] .rounded-md{border-radius:.375rem}[data-super-agent-widget] .border{border-width:1px}[data-super-agent-widget] .border-r{border-right-width:1px}[data-super-agent-widget] .border-r-0{border-right-width:0px}[data-super-agent-widget] .border-none{border-style:none}[data-super-agent-widget] .border-\\[\\#DADADA\\]{--tw-border-opacity: 1;border-color:rgb(218 218 218 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#E8E8E8\\]{--tw-border-opacity: 1;border-color:rgb(232 232 232 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#ECECEC\\]{--tw-border-opacity: 1;border-color:rgb(236 236 236 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[var\\(--sa-primary\\)\\]{border-color:var(--sa-primary)}[data-super-agent-widget] .bg-\\[\\#DCDCDC\\]{--tw-bg-opacity: 1;background-color:rgb(220 220 220 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#E8F1FE\\]{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#F5F5F5\\]{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#FAFAFA\\]{--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#fee2e2\\]{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[var\\(--sa-primary\\)\\]{background-color:var(--sa-primary)}[data-super-agent-widget] .bg-black\\/30{background-color:#0000004d}[data-super-agent-widget] .bg-transparent{background-color:transparent}[data-super-agent-widget] .bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .object-contain{-o-object-fit:contain;object-fit:contain}[data-super-agent-widget] .p-0{padding:0}[data-super-agent-widget] .p-2{padding:.5rem}[data-super-agent-widget] .p-3{padding:.75rem}[data-super-agent-widget] .px-0\\.5{padding-left:.125rem;padding-right:.125rem}[data-super-agent-widget] .px-1{padding-left:.25rem;padding-right:.25rem}[data-super-agent-widget] .px-1\\.5{padding-left:.375rem;padding-right:.375rem}[data-super-agent-widget] .px-2\\.5{padding-left:.625rem;padding-right:.625rem}[data-super-agent-widget] .px-3{padding-left:.75rem;padding-right:.75rem}[data-super-agent-widget] .px-\\[15px\\]{padding-left:15px;padding-right:15px}[data-super-agent-widget] .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}[data-super-agent-widget] .py-1{padding-top:.25rem;padding-bottom:.25rem}[data-super-agent-widget] .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}[data-super-agent-widget] .py-2{padding-top:.5rem;padding-bottom:.5rem}[data-super-agent-widget] .py-3{padding-top:.75rem;padding-bottom:.75rem}[data-super-agent-widget] .pb-1{padding-bottom:.25rem}[data-super-agent-widget] .pb-2\\.5{padding-bottom:.625rem}[data-super-agent-widget] .pt-2{padding-top:.5rem}[data-super-agent-widget] .text-left{text-align:left}[data-super-agent-widget] .text-center{text-align:center}[data-super-agent-widget] .text-\\[11px\\]{font-size:11px}[data-super-agent-widget] .text-\\[12px\\]{font-size:12px}[data-super-agent-widget] .text-\\[13px\\]{font-size:13px}[data-super-agent-widget] .text-\\[14px\\]{font-size:14px}[data-super-agent-widget] .text-\\[18px\\]{font-size:18px}[data-super-agent-widget] .text-\\[9px\\]{font-size:9px}[data-super-agent-widget] .font-bold{font-weight:700}[data-super-agent-widget] .font-medium{font-weight:500}[data-super-agent-widget] .font-semibold{font-weight:600}[data-super-agent-widget] .italic{font-style:italic}[data-super-agent-widget] .leading-\\[1\\.3\\]{line-height:1.3}[data-super-agent-widget] .leading-\\[1\\.4\\]{line-height:1.4}[data-super-agent-widget] .leading-\\[1\\.5\\]{line-height:1.5}[data-super-agent-widget] .leading-\\[14px\\]{line-height:14px}[data-super-agent-widget] .leading-none{line-height:1}[data-super-agent-widget] .text-\\[\\#333\\]{--tw-text-opacity: 1;color:rgb(51 51 51 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#666\\]{--tw-text-opacity: 1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#999\\]{--tw-text-opacity: 1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#9A9A9A\\]{--tw-text-opacity: 1;color:rgb(154 154 154 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#A0A0A0\\]{--tw-text-opacity: 1;color:rgb(160 160 160 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#B8B8B8\\]{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#C0C0C0\\]{--tw-text-opacity: 1;color:rgb(192 192 192 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#ef4444\\]{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .underline{text-decoration-line:underline}[data-super-agent-widget] .antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[data-super-agent-widget] .opacity-0{opacity:0}[data-super-agent-widget] .opacity-10{opacity:.1}[data-super-agent-widget] .opacity-100{opacity:1}[data-super-agent-widget] .opacity-60{opacity:.6}[data-super-agent-widget] .opacity-70{opacity:.7}[data-super-agent-widget] .shadow-\\[0_-12px_48px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: 0 -12px 48px rgba(0,0,0,.25);--tw-shadow-colored: 0 -12px 48px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .shadow-\\[0_12px_36px_rgba\\(0\\,0\\,0\\,0\\.18\\)\\]{--tw-shadow: 0 12px 36px rgba(0,0,0,.18);--tw-shadow-colored: 0 12px 36px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .shadow-\\[0_2px_8px_rgba\\(0\\,0\\,0\\,0\\.12\\)\\]{--tw-shadow: 0 2px 8px rgba(0,0,0,.12);--tw-shadow-colored: 0 2px 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .outline-none{outline:2px solid transparent;outline-offset:2px}[data-super-agent-widget] .outline{outline-style:solid}[data-super-agent-widget] .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .duration-200{transition-duration:.2s}[data-super-agent-widget] .ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}[data-super-agent-widget] .ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes sa-window-in{0%{opacity:0;transform:translateY(20px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes sa-slide-up-full{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes sa-home-fade-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-chip-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-logo-float{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}@keyframes sa-title-shimmer{0%{background-position:100% 0}to{background-position:-100% 0}}@keyframes sa-history-in{0%{opacity:0;transform:translate(-10px)}to{opacity:1;transform:translate(0)}}[data-super-agent-widget] .animate-sa-window-in{animation:sa-window-in .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-slide-up-full{animation:sa-slide-up-full .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-fade-in{animation:sa-fade-in .2s ease}[data-super-agent-widget] .animate-sa-home-fade-in{animation:sa-home-fade-in .4s ease forwards}[data-super-agent-widget] .animate-sa-chip-in{animation:sa-chip-in .4s cubic-bezier(.22,1,.36,1) forwards}[data-super-agent-widget] .animate-sa-logo-float{animation:sa-logo-float 3s ease-in-out infinite}[data-super-agent-widget] .animate-sa-title-shimmer{animation:sa-title-shimmer 2.5s ease forwards}[data-super-agent-widget] .animate-sa-history-in{animation:sa-history-in .2s ease}[data-super-agent-widget] .sa-tip{position:relative}[data-super-agent-widget] .sa-tip:before,[data-super-agent-widget] .sa-tip:after{position:absolute;top:100%;left:50%;pointer-events:none;opacity:0;transition:opacity .15s ease;z-index:100}[data-super-agent-widget] .sa-tip:before{content:attr(data-tooltip);transform:translate(-50%);margin-top:6px;padding:4px 8px;background:#fff;color:#333;font-size:12px;line-height:1.4;white-space:nowrap;border-radius:4px;box-shadow:0 2px 8px #0000001f;border:1px solid #e8e8e8}[data-super-agent-widget] .sa-tip:after{content:"";transform:translate(-50%);margin-top:2px;border:4px solid transparent;border-bottom-color:#fff;filter:drop-shadow(0 -1px 1px rgba(0,0,0,.06))}[data-super-agent-widget] .sa-tip:hover:before,[data-super-agent-widget] .sa-tip:hover:after{opacity:1}[data-super-agent-widget] .sa-chip{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(#e0e0e0,#e0e0e0) border-box;border:1px solid transparent}[data-super-agent-widget] .sa-chip:hover{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7) border-box}[data-super-agent-widget] .sa-chip:hover .sa-chip-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-shimmer-text{background:linear-gradient(90deg,#333,#333 35%,#00d4ff 40%,#1881f0,#2b52ee,#d116ea,#ff2e7e 56%,#333 61%,#333);background-size:300% 100%;background-position:100% 0;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-new-chat{background:linear-gradient(258deg,#ff2e7e1a -4%,#d116ea1a 16%,#2b52ee1a 53%,#1881f01a 81%,#00d4ff1a 106%)}[data-super-agent-widget] .sa-new-chat:hover{background:linear-gradient(258deg,#ff2e7e29 -4%,#d116ea29 16%,#2b52ee29 53%,#1881f029 81%,#00d4ff29 106%)}[data-super-agent-widget] .sa-new-chat .sa-new-chat-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-home-gradient{background:linear-gradient(239deg,#ff2e7e -3%,#d116ea 17%,#2b52ee 54%,#1881f0 82%,#00d4ff 107%)}[data-super-agent-widget] .sa-home-gradient-fade{background:linear-gradient(180deg,#fff0,#fff)}[data-super-agent-widget] .sa-home-view .sa-thread{background:transparent}[data-super-agent-widget] .sa-resize-handle:hover{background:color-mix(in srgb,var(--sa-primary) 30%,transparent)}[data-super-agent-widget] .sa-input-form{border:1px solid transparent;background-color:#fff;background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);background-origin:border-box;background-clip:padding-box,border-box;transition:background .15s ease}[data-super-agent-widget] .sa-input-form-active,[data-super-agent-widget] .sa-input-form:focus-within{background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-send-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border:none;border-radius:9999px;background:linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);cursor:pointer;flex-shrink:0;align-self:flex-end;transition:background .15s ease,opacity .15s ease}[data-super-agent-widget] .sa-send-btn-active,[data-super-agent-widget] .sa-input-form:focus-within .sa-send-btn{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-send-btn:hover{opacity:.9}[data-super-agent-widget] .sa-send-btn:active{opacity:.7}[data-super-agent-widget] .sa-send-btn img{display:block;width:14px;height:14px;filter:brightness(0) invert(1)}[data-super-agent-widget] .sa-stop-icon{display:block;width:8px;height:8px;border-radius:2px;background:#fff}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:scale-\\[1\\.08\\]:hover{--tw-scale-x: 1.08;--tw-scale-y: 1.08;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .hover\\:bg-\\[\\#E8F1FE\\]:hover{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-\\[\\#F5F5F5\\]:hover{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white\\/70:hover{background-color:#ffffffb3}[data-super-agent-widget] .hover\\:text-\\[\\#1881F0\\]:hover{--tw-text-opacity: 1;color:rgb(24 129 240 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[\\#ef4444\\]:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[var\\(--sa-primary\\)\\]:hover{color:var(--sa-primary)}[data-super-agent-widget] .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .active\\:cursor-grabbing:active{cursor:grabbing}[data-super-agent-widget] .active\\:bg-\\[\\#F5F5F5\\]:active{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] :is(.group:hover .group-hover\\:flex){display:flex}', Kt = {
3728
3879
  primaryColor: "#6366f1",
3729
3880
  backgroundColor: "#ffffff",
3730
3881
  fontFamily: "system-ui, -apple-system, sans-serif",
@@ -3734,16 +3885,16 @@ const $t = `
3734
3885
  panelHeight: 648,
3735
3886
  zIndex: 9999
3736
3887
  };
3737
- function Ht(t, a) {
3888
+ function qt(t, a) {
3738
3889
  const n = parseInt(t.slice(1, 3), 16), s = parseInt(t.slice(3, 5), 16), r = parseInt(t.slice(5, 7), 16), i = 1 - a;
3739
3890
  return `#${Math.round(n * i).toString(16).padStart(2, "0")}${Math.round(s * i).toString(16).padStart(2, "0")}${Math.round(r * i).toString(16).padStart(2, "0")}`;
3740
3891
  }
3741
- function Ft(t, a) {
3892
+ function Zt(t, a) {
3742
3893
  const n = parseInt(t.slice(1, 3), 16), s = parseInt(t.slice(3, 5), 16), r = parseInt(t.slice(5, 7), 16);
3743
3894
  return `#${Math.round(n + (255 - n) * a).toString(16).padStart(2, "0")}${Math.round(s + (255 - s) * a).toString(16).padStart(2, "0")}${Math.round(r + (255 - r) * a).toString(16).padStart(2, "0")}`;
3744
3895
  }
3745
- function Rt(t) {
3746
- const a = { ..._t, ...t }, n = a.primaryColor, s = a.backgroundColor;
3896
+ function Jt(t) {
3897
+ const a = { ...Kt, ...t }, n = a.primaryColor, s = a.backgroundColor;
3747
3898
  return [
3748
3899
  // 用户直接配置的变量
3749
3900
  `--sa-primary: ${n}`,
@@ -3754,8 +3905,8 @@ function Rt(t) {
3754
3905
  `--sa-panel-height: ${a.panelHeight}px`,
3755
3906
  `--sa-z-index: ${a.zIndex}`,
3756
3907
  // 从 primaryColor 自动派生
3757
- `--sa-primary-dark: ${Ht(n, 0.15)}`,
3758
- `--sa-primary-light: ${Ft(n, 0.9)}`,
3908
+ `--sa-primary-dark: ${qt(n, 0.15)}`,
3909
+ `--sa-primary-light: ${Zt(n, 0.9)}`,
3759
3910
  // 从 backgroundColor 自动派生的语义色
3760
3911
  `--sa-surface: ${s}`,
3761
3912
  "--sa-border: #e5e7eb",
@@ -3765,36 +3916,36 @@ function Rt(t) {
3765
3916
  "--sa-text-light: #6b7280"
3766
3917
  ].join("; ");
3767
3918
  }
3768
- function Pt(t, a) {
3919
+ function aa(t, a) {
3769
3920
  const n = typeof t == "string" ? document.querySelector(t) : t;
3770
3921
  if (!n)
3771
3922
  throw new Error(`Target element not found: ${t}`);
3772
3923
  const s = document.createElement("div");
3773
3924
  s.setAttribute("data-super-agent-widget", "");
3774
- const r = Rt(a.theme ?? {});
3925
+ const r = Jt(a.theme ?? {});
3775
3926
  if (s.setAttribute("style", `${r}; height: 100%;`), n.appendChild(s), !document.getElementById("sa-widget-styles")) {
3776
- const d = document.createElement("style");
3777
- d.id = "sa-widget-styles", d.textContent = `${$t}
3778
- ${Lt}`, document.head.appendChild(d);
3927
+ const l = document.createElement("style");
3928
+ l.id = "sa-widget-styles", l.textContent = `${Ut}
3929
+ ${Vt}`, document.head.appendChild(l);
3779
3930
  }
3780
- let i = We(s), o = !1;
3781
- const l = (d) => {
3931
+ let i = Qe(s), d = !1;
3932
+ const o = (l) => {
3782
3933
  i && i.render(
3783
- Q.createElement(Dt, {
3934
+ Q.createElement(Xt, {
3784
3935
  ...a,
3785
- initialOpen: d ?? o,
3786
- onOpenChange: (p) => {
3787
- o = p;
3936
+ initialOpen: l ?? d,
3937
+ onOpenChange: (c) => {
3938
+ d = c;
3788
3939
  }
3789
3940
  })
3790
3941
  );
3791
3942
  };
3792
- return l(!1), {
3943
+ return o(!1), {
3793
3944
  open() {
3794
- o = !0, l(!0);
3945
+ d = !0, o(!0);
3795
3946
  },
3796
3947
  close() {
3797
- o = !1, l(!1);
3948
+ d = !1, o(!1);
3798
3949
  },
3799
3950
  destroy() {
3800
3951
  i && (i.unmount(), i = null), s.remove();
@@ -3802,32 +3953,33 @@ ${Lt}`, document.head.appendChild(d);
3802
3953
  };
3803
3954
  }
3804
3955
  export {
3805
- X as ASSETS,
3806
- vt as ActionBar,
3807
- ye as ChatProvider,
3808
- Dt as ChatWidget,
3809
- Le as Composer,
3810
- lt as ErrorPart,
3811
- At as FullpageLayout,
3812
- qe as Header,
3813
- B as Icon,
3814
- wt as InterruptCard,
3815
- Ct as Message,
3816
- tt as TextPart,
3817
- nt as ThinkingPart,
3818
- $e as Thread,
3819
- ke as ThreadList,
3820
- st as ToolCallPart,
3821
- ot as ToolResultPart,
3822
- Ve as Trigger,
3823
- Nt as WelcomeScreen,
3824
- _t as defaultTheme,
3825
- rt as ensureIconFont,
3826
- Pt as mount,
3827
- Rt as themeToCSSVars,
3828
- Je as useAutoScroll,
3829
- Ye as useChat,
3830
- Z as useChatContext,
3831
- Xe as useConversations,
3832
- $t as widgetStyles
3956
+ U as ASSETS,
3957
+ At as ActionBar,
3958
+ Te as ChatProvider,
3959
+ Xt as ChatWidget,
3960
+ Pe as Composer,
3961
+ bt as ErrorPart,
3962
+ Gt as FullpageLayout,
3963
+ ot as Header,
3964
+ H as Icon,
3965
+ Mt as InterruptCard,
3966
+ Lt as Message,
3967
+ Bt as PageOverlay,
3968
+ ut as TextPart,
3969
+ ht as ThinkingPart,
3970
+ He as Thread,
3971
+ Ie as ThreadList,
3972
+ mt as ToolCallPart,
3973
+ wt as ToolResultPart,
3974
+ it as Trigger,
3975
+ Rt as WelcomeScreen,
3976
+ Kt as defaultTheme,
3977
+ ft as ensureIconFont,
3978
+ aa as mount,
3979
+ Jt as themeToCSSVars,
3980
+ dt as useAutoScroll,
3981
+ et as useChat,
3982
+ J as useChatContext,
3983
+ at as useConversations,
3984
+ Ut as widgetStyles
3833
3985
  };