super-agent-sdk 1.0.8 → 1.0.9

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,677 +1,837 @@
1
- import V, { useState as M, useRef as _, useCallback as C, useEffect as B, createContext as ge, useMemo as J, useContext as xe } from "react";
2
- import { createRoot as be } from "react-dom/client";
3
- import { jsx as e, jsxs as d, Fragment as q } from "react/jsx-runtime";
4
- function ve(t) {
5
- const { sdk: a, sessionId: s, onSessionCreated: n, onStreamStart: r, onStreamEnd: i, onError: o, onMessageSend: l } = t, [c, p] = M([]), [f, h] = M("ready"), [w, u] = M(null), m = _(null), v = _(!1), S = _(null), T = _(s), A = _(!0);
6
- T.current = s, A.current = c.length === 0;
7
- const x = C((N) => {
8
- if (v.current) return;
9
- v.current = !0, l == null || l(N);
10
- const R = {
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 = {
11
11
  id: `user_${Date.now()}`,
12
12
  role: "user",
13
- parts: [{ type: "text", content: N }],
13
+ parts: [{ type: "text", content: w }],
14
14
  timestamp: Date.now()
15
- }, y = `assistant_${Date.now()}`, g = {
16
- id: y,
15
+ }, $ = `assistant_${Date.now()}`, L = {
16
+ id: $,
17
17
  role: "assistant",
18
18
  parts: [],
19
19
  timestamp: Date.now()
20
- }, E = A.current;
21
- p((k) => [...k, R, g]), h("submitted"), u(null);
22
- const L = (k) => {
23
- let O = "", b = "", H = [], j = !1;
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
24
  const W = () => {
25
- const D = [...H];
26
- if (O) {
27
- const F = D.findIndex((U) => U.type === "thinking");
28
- F >= 0 ? D[F] = { type: "thinking", content: O } : D.unshift({ type: "thinking", content: O });
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 });
29
29
  }
30
- if (b) {
31
- const F = D[D.length - 1];
32
- (F == null ? void 0 : F.type) === "text" ? D[D.length - 1] = { type: "text", content: b } : D.push({ type: "text", content: b });
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 });
33
33
  }
34
34
  p(
35
- (F) => F.map((U) => U.id === y ? { ...U, parts: D } : U)
35
+ (Y) => Y.map((j) => j.id === $ ? { ...j, parts: T } : j)
36
36
  );
37
37
  };
38
- m.current = a.chat({
39
- sessionId: k,
40
- message: N,
38
+ x.current = a.chat({
39
+ sessionId: I,
40
+ message: w,
41
41
  stream: !0,
42
- onMessage: (D) => {
43
- switch (j || (j = !0, h("streaming")), D.type) {
42
+ onMessage: (T) => {
43
+ switch (O || (O = !0, g("streaming")), T.type) {
44
44
  case "thinking":
45
- O += D.content;
45
+ F += T.content;
46
46
  break;
47
47
  case "ai":
48
- b += D.content;
48
+ h += T.content;
49
49
  break;
50
50
  case "tool_call":
51
- b && (H.push({ type: "text", content: b }), b = ""), H.push({
51
+ h && (_.push({ type: "text", content: h }), h = ""), _.push({
52
52
  type: "tool_call",
53
- toolName: D.toolName,
54
- toolCallId: D.toolCallId,
55
- args: D.args ?? "{}"
53
+ toolName: T.toolName,
54
+ toolCallId: T.toolCallId,
55
+ args: T.args ?? "{}"
56
56
  });
57
57
  break;
58
58
  case "tool_result":
59
- b && (H.push({ type: "text", content: b }), b = ""), H.push({
59
+ h && (_.push({ type: "text", content: h }), h = ""), _.push({
60
60
  type: "tool_result",
61
- toolName: D.toolName ?? "",
62
- toolCallId: D.toolCallId,
63
- content: D.content,
64
- artifacts: D.artifacts,
65
- renderMode: D.renderMode,
66
- html: D.html
61
+ toolName: T.toolName ?? "",
62
+ toolCallId: T.toolCallId,
63
+ content: T.content,
64
+ artifacts: T.artifacts,
65
+ renderMode: T.renderMode,
66
+ html: T.html
67
67
  });
68
68
  break;
69
69
  case "interrupt":
70
- b && (H.push({ type: "text", content: b }), b = ""), D.interrupt && H.push({
70
+ h && (_.push({ type: "text", content: h }), h = ""), T.interrupt && _.push({
71
71
  type: "interrupt",
72
- interrupt: D.interrupt,
72
+ interrupt: T.interrupt,
73
73
  resolved: !1
74
74
  });
75
75
  break;
76
76
  case "stop":
77
- D.content && (b = D.content), W();
77
+ T.content && (h = T.content), W();
78
78
  return;
79
79
  }
80
80
  W();
81
81
  },
82
- onDone: (D) => {
83
- (b || H.length > 0 || O) && W(), D.sessionId && D.sessionId !== T.current && (n == null || n(D.sessionId));
84
- const F = () => {
85
- S.current && (clearTimeout(S.current), S.current = null), i == null || i(D.sessionId || k), h("ready"), v.current = !1, m.current = null;
82
+ onDone: (T) => {
83
+ (h || _.length > 0 || F) && W(), T.sessionId && T.sessionId !== z.current && (s == null || s(T.sessionId));
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;
86
86
  };
87
- if (E) {
88
- const U = N.slice(0, 30), he = D.sessionId || k;
89
- a.renameConversation(he, U).catch(() => {
90
- }).finally(F);
87
+ if (v) {
88
+ const j = w.slice(0, 30), q = T.sessionId || I;
89
+ a.renameConversation(q, j).catch(() => {
90
+ }).finally(Y);
91
91
  } else
92
- F();
92
+ Y();
93
93
  },
94
- onError: (D) => {
95
- H.push({ type: "error", content: D.message }), W(), S.current && (clearTimeout(S.current), S.current = null), u(D), h("error"), o == null || o(D), v.current = !1, m.current = null;
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;
96
96
  }
97
- }), r == null || r(k);
97
+ }), r == null || r(I);
98
98
  };
99
- T.current ? L(T.current) : a.createSession().then((k) => {
100
- T.current = k, n == null || n(k), L(k);
101
- }).catch((k) => {
102
- u(k instanceof Error ? k : new Error(String(k))), h("error"), o == null || o(k instanceof Error ? k : new Error(String(k))), v.current = !1;
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;
103
103
  });
104
- }, [a, n, r, i, o, l]), z = C(() => {
105
- const N = T.current;
106
- N && (S.current && clearTimeout(S.current), S.current = setTimeout(() => {
107
- var R;
108
- S.current = null, (R = m.current) == null || R.abort(), m.current = null, v.current = !1, h("ready");
109
- }, 8e3), a.stopGeneration(N).catch(() => {
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");
109
+ }, 8e3), a.stopGeneration(w).catch(() => {
110
110
  }));
111
- }, [a]), $ = C(() => {
112
- if (v.current) return;
113
- const N = c.findLastIndex((y) => y.role === "user");
114
- if (N < 0) return;
115
- const R = c[N].parts.filter((y) => y.type === "text").map((y) => y.content).join("");
116
- p((y) => y.slice(0, N)), x(R);
117
- }, [c, x]), P = C((N, R) => {
111
+ }, [a]), S = N(() => {
112
+ if (f.current) return;
113
+ const w = d.findLastIndex(($) => $.role === "user");
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
118
  p(
119
- (b) => b.map((H) => ({
120
- ...H,
121
- parts: H.parts.map(
122
- (j) => j.type === "interrupt" && j.interrupt.interruptId === N ? { ...j, resolved: !0, response: R } : j
119
+ (h) => h.map((_) => ({
120
+ ..._,
121
+ parts: _.parts.map(
122
+ (O) => O.type === "interrupt" && O.interrupt.interruptId === w ? { ...O, resolved: !0, response: M } : O
123
123
  )
124
124
  }))
125
125
  );
126
- const y = T.current;
127
- if (!y) return;
128
- let g = 0;
129
- p((b) => b.length > 0 && b[b.length - 1].role === "assistant" ? (g = b[b.length - 1].parts.length, b) : (g = 0, [...b, { id: `assistant_${Date.now()}`, role: "assistant", parts: [], timestamp: Date.now() }])), h("streaming");
130
- let E = "", L = "", k = [];
131
- const O = () => {
132
- const b = [...k];
133
- if (E) {
134
- const H = b.findIndex((j) => j.type === "thinking");
135
- H >= 0 ? b[H] = { type: "thinking", content: E } : b.unshift({ type: "thinking", content: E });
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 });
136
136
  }
137
- if (L) {
138
- const H = b[b.length - 1];
139
- (H == null ? void 0 : H.type) === "text" ? b[b.length - 1] = { type: "text", content: L } : b.push({ type: "text", content: L });
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 });
140
140
  }
141
- p((H) => {
142
- const j = H.findLastIndex((W) => W.role === "assistant");
143
- return j < 0 ? H : H.map(
144
- (W, D) => D === j ? { ...W, parts: [...W.parts.slice(0, g), ...b] } : W
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
145
145
  );
146
146
  });
147
147
  };
148
148
  a.respondInterrupt(
149
- N,
150
- y,
151
- R,
152
- (b) => {
153
- switch (b.type) {
149
+ w,
150
+ $,
151
+ M,
152
+ (h) => {
153
+ switch (h.type) {
154
154
  case "thinking":
155
- E += b.content;
155
+ v += h.content;
156
156
  break;
157
157
  case "ai":
158
- L += b.content;
158
+ A += h.content;
159
159
  break;
160
160
  case "tool_call":
161
- L && (k.push({ type: "text", content: L }), L = ""), k.push({
161
+ A && (I.push({ type: "text", content: A }), A = ""), I.push({
162
162
  type: "tool_call",
163
- toolName: b.toolName,
164
- toolCallId: b.toolCallId,
165
- args: b.args ?? "{}"
163
+ toolName: h.toolName,
164
+ toolCallId: h.toolCallId,
165
+ args: h.args ?? "{}"
166
166
  });
167
167
  break;
168
168
  case "tool_result":
169
- L && (k.push({ type: "text", content: L }), L = ""), k.push({
169
+ A && (I.push({ type: "text", content: A }), A = ""), I.push({
170
170
  type: "tool_result",
171
- toolName: b.toolName ?? "",
172
- toolCallId: b.toolCallId,
173
- content: b.content,
174
- artifacts: b.artifacts,
175
- renderMode: b.renderMode,
176
- html: b.html
171
+ toolName: h.toolName ?? "",
172
+ toolCallId: h.toolCallId,
173
+ content: h.content,
174
+ artifacts: h.artifacts,
175
+ renderMode: h.renderMode,
176
+ html: h.html
177
177
  });
178
178
  break;
179
179
  case "interrupt":
180
- L && (k.push({ type: "text", content: L }), L = ""), b.interrupt && k.push({ type: "interrupt", interrupt: b.interrupt, resolved: !1 });
180
+ A && (I.push({ type: "text", content: A }), A = ""), h.interrupt && I.push({ type: "interrupt", interrupt: h.interrupt, resolved: !1 });
181
181
  break;
182
182
  case "done":
183
- i == null || i(y), h("ready");
183
+ i == null || i($), g("ready");
184
184
  break;
185
185
  }
186
- O();
186
+ F();
187
187
  },
188
- (b) => {
189
- k.push({ type: "error", content: b.message }), O(), u(b), h("error"), o == null || o(b);
188
+ (h) => {
189
+ I.push({ type: "error", content: h.message }), F(), m(h), g("error"), o == null || o(h);
190
190
  }
191
- ).catch((b) => {
192
- o == null || o(b instanceof Error ? b : new Error(String(b))), h("error");
191
+ ).catch((h) => {
192
+ o == null || o(h instanceof Error ? h : new Error(String(h))), g("error");
193
193
  });
194
194
  }, [a, o, i]);
195
- return { messages: c, status: f, error: w, sendMessage: x, stop: z, regenerate: $, setMessages: p, respondToInterrupt: P };
195
+ return { messages: d, status: u, error: b, sendMessage: k, stop: C, regenerate: S, setMessages: p, respondToInterrupt: D };
196
196
  }
197
- const ie = "sa_active_conversation", Q = 20;
198
- function ee(t) {
197
+ const Te = "sa_active_conversation", de = 20;
198
+ function ve(t) {
199
199
  try {
200
- return localStorage.getItem(`${ie}_${t}`);
200
+ return localStorage.getItem(`${Te}_${t}`);
201
201
  } catch {
202
202
  return null;
203
203
  }
204
204
  }
205
- function we(t, a) {
205
+ function Ge(t, a) {
206
206
  try {
207
- const s = `${ie}_${t}`;
208
- a ? localStorage.setItem(s, a) : localStorage.removeItem(s);
207
+ const n = `${Te}_${t}`;
208
+ a ? localStorage.setItem(n, a) : localStorage.removeItem(n);
209
209
  } catch {
210
210
  }
211
211
  }
212
- function ye(t) {
213
- const { sdk: a, onConversationChange: s } = t, n = a.botId, [r, i] = M([]), [o, l] = M(
214
- () => ee(n)
215
- ), [c, p] = M(!1), [f, h] = M(!0), w = _(!0), u = _(1), m = _(!1);
216
- B(() => () => {
217
- w.current = !1;
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;
218
218
  }, []);
219
- const v = C((N) => {
220
- l(N), we(n, N), N && (s == null || s(N));
221
- }, [n, s]), S = C(async () => {
222
- if (!m.current) {
223
- m.current = !0, p(!0);
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);
224
224
  try {
225
- u.current = 1;
226
- const N = await a.listConversations({ page: 1, size: Q });
227
- if (!w.current) return;
228
- i(N.items), h(N.items.length < N.total);
229
- const R = ee(n);
230
- R && !N.items.find((y) => y.sessionId === R) && v(null);
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);
231
231
  } catch {
232
232
  } finally {
233
- m.current = !1, w.current && p(!1);
233
+ x.current = !1, b.current && p(!1);
234
234
  }
235
235
  }
236
- }, [a, v]), T = C(async () => {
237
- if (!(m.current || !f)) {
238
- m.current = !0, p(!0);
236
+ }, [a, f]), z = N(async () => {
237
+ if (!(x.current || !u)) {
238
+ x.current = !0, p(!0);
239
239
  try {
240
- const N = u.current + 1, R = await a.listConversations({ page: N, size: Q });
241
- if (!w.current) return;
242
- u.current = N, i((g) => {
243
- const E = new Set(g.map((k) => k.sessionId)), L = R.items.filter((k) => !E.has(k.sessionId));
244
- return [...g, ...L];
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];
245
245
  });
246
- const y = u.current * Q;
247
- h(y < R.total);
246
+ const $ = m.current * de;
247
+ g($ < M.total);
248
248
  } catch {
249
249
  } finally {
250
- m.current = !1, w.current && p(!1);
250
+ x.current = !1, b.current && p(!1);
251
251
  }
252
252
  }
253
- }, [a, f]), A = C(async (N) => (v(N), await a.getMessages(N)), [a, v]), x = C(async () => {
253
+ }, [a, u]), H = N(async (w) => (f(w), await a.getMessages(w)), [a, f]), k = N(async () => {
254
254
  try {
255
- const N = await a.createSession(), R = (/* @__PURE__ */ new Date()).toISOString();
256
- i((y) => [
257
- { sessionId: N, botId: 0, title: "新对话", createTime: R, updateTime: R },
258
- ...y
259
- ]), v(N);
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);
260
260
  } catch {
261
- v(null);
261
+ f(null);
262
262
  }
263
- }, [a, v]), z = C(async (N) => {
264
- i((R) => R.filter((y) => y.sessionId !== N)), o === N && v(null);
263
+ }, [a, f]), C = N(async (w) => {
264
+ i((M) => M.filter(($) => $.sessionId !== w)), o === w && f(null);
265
265
  try {
266
- await a.deleteConversation(N);
266
+ await a.deleteConversation(w);
267
267
  } catch {
268
268
  }
269
- }, [a, o, v]), $ = C(async (N, R) => {
270
- await a.renameConversation(N, R), i(
271
- (y) => y.map((g) => g.sessionId === N ? { ...g, title: R } : g)
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)
272
272
  );
273
- }, [a]), { enabled: P = !0 } = t;
274
- return B(() => {
275
- P && S();
276
- }, [P, S]), {
273
+ }, [a]), { enabled: D = !0 } = t;
274
+ return P(() => {
275
+ D && y();
276
+ }, [D, y]), {
277
277
  conversations: r,
278
278
  activeConversationId: o,
279
- loading: c,
280
- hasMore: f,
281
- loadConversations: S,
282
- loadMore: T,
283
- switchConversation: A,
284
- newConversation: x,
285
- deleteConversation: z,
286
- renameConversation: $,
287
- setActiveConversationId: v
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
288
288
  };
289
289
  }
290
- function oe(t) {
290
+ function Me(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 le(t) {
293
+ function Ee(t) {
294
294
  return t === "pdf" ? "PDF" : t === "docx" ? "DOC" : t === "html" ? "HTM" : t.slice(0, 3).toUpperCase() || "FILE";
295
295
  }
296
- function ce(t) {
296
+ function Se(t) {
297
297
  if (!t) return [];
298
298
  const a = [];
299
- for (const s of t)
300
- s.type === "file" && s.data && a.push({
301
- id: s.data.id ?? "",
302
- type: s.data.fileType ?? s.data.type ?? "",
303
- filename: s.data.name ?? s.data.filename ?? "",
304
- url: s.data.url ?? "",
305
- mime: s.data.mime,
306
- size: s.data.size,
307
- summary: s.data.summary
299
+ for (const n of t)
300
+ n.type === "file" && n.data && a.push({
301
+ id: n.data.id ?? "",
302
+ type: n.data.fileType ?? n.data.type ?? "",
303
+ filename: n.data.name ?? n.data.filename ?? "",
304
+ url: n.data.url ?? "",
305
+ mime: n.data.mime,
306
+ size: n.data.size,
307
+ summary: n.data.summary
308
308
  });
309
309
  return a;
310
310
  }
311
- async function Z(t) {
311
+ async function ie(t) {
312
312
  try {
313
313
  const a = await fetch(t.url);
314
314
  if (!a.ok) throw new Error(`HTTP ${a.status}`);
315
- const s = await a.blob(), n = URL.createObjectURL(s), r = document.createElement("a");
316
- r.href = n, r.download = t.filename, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 4e3);
315
+ const n = await a.blob(), s = URL.createObjectURL(n), r = document.createElement("a");
316
+ r.href = s, r.download = t.filename, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(s), 4e3);
317
317
  } catch {
318
318
  const a = document.createElement("a");
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 de = ge(null);
323
- function Y() {
324
- const t = xe(de);
322
+ const Ae = je(null);
323
+ function Z() {
324
+ const t = Pe(Ae);
325
325
  if (!t) throw new Error("useChatContext must be used within ChatProvider");
326
326
  return t;
327
327
  }
328
- function te({ sdk: t, hooks: a, children: s }) {
329
- const [n, r] = M(!1), [i, o] = M(!1), [l, c] = M(null), [p, f] = M(!1), [h, w] = M(!1);
330
- B(() => {
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(() => {
331
331
  t.getToken().then(() => {
332
- f(!0);
332
+ u(!0);
333
333
  }).catch(() => {
334
- f(!0);
334
+ u(!0);
335
335
  });
336
336
  }, [t]);
337
- const u = ye({
337
+ const m = Xe({
338
338
  sdk: t,
339
339
  onConversationChange: a == null ? void 0 : a.onConversationChange,
340
340
  enabled: p
341
- }), m = ve({
341
+ }), x = Ye({
342
342
  sdk: t,
343
- sessionId: u.activeConversationId,
344
- onSessionCreated: (g) => {
345
- u.setActiveConversationId(g);
343
+ sessionId: m.activeConversationId,
344
+ onSessionCreated: (v) => {
345
+ m.setActiveConversationId(v);
346
346
  },
347
347
  onStreamStart: a == null ? void 0 : a.onStreamStart,
348
- onStreamEnd: (g) => {
349
- var E;
350
- (E = a == null ? void 0 : a.onStreamEnd) == null || E.call(a, g), u.loadConversations();
348
+ onStreamEnd: (v) => {
349
+ var A;
350
+ (A = a == null ? void 0 : a.onStreamEnd) == null || A.call(a, v), m.loadConversations();
351
351
  },
352
352
  onError: a == null ? void 0 : a.onError,
353
353
  onMessageSend: a == null ? void 0 : a.onMessageSend
354
- }), v = C(async (g) => {
355
- w(!0);
354
+ }), f = N(async (v) => {
355
+ b(!0);
356
356
  try {
357
- const E = await u.switchConversation(g);
358
- m.setMessages(E), r(!1);
357
+ const A = await m.switchConversation(v);
358
+ x.setMessages(A);
359
359
  } finally {
360
- w(!1);
360
+ b(!1);
361
361
  }
362
- }, [u, m]), S = C(async () => {
363
- m.setMessages([]), r(!1), await u.newConversation();
364
- }, [u, m]), T = C(async (g) => {
365
- u.activeConversationId === g && m.setMessages([]), await u.deleteConversation(g);
366
- }, [u, m]);
367
- B(() => {
368
- u.activeConversationId && m.messages.length === 0 && (w(!0), t.getMessages(u.activeConversationId).then((g) => {
369
- m.setMessages(g);
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);
370
370
  }).catch(() => {
371
- }).finally(() => w(!1)));
371
+ }).finally(() => b(!1)));
372
372
  }, []);
373
- const A = C(() => {
374
- r((g) => !g);
375
- }, []), x = C(() => {
376
- o((g) => !g), c((g) => null);
377
- }, []), z = C((g) => {
378
- c(g), o(!0);
379
- }, []), $ = J(() => {
380
- const g = /* @__PURE__ */ new Set(), E = [];
381
- for (const L of m.messages)
382
- for (const k of L.parts)
383
- if (k.type === "tool_result" && k.artifacts)
384
- for (const O of ce(k.artifacts)) {
385
- const b = O.id || `${O.url}:${O.filename}`;
386
- g.has(b) || (g.add(b), E.push(O));
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));
387
389
  }
388
- return E;
389
- }, [m.messages]), P = C(async () => {
390
- const g = u.activeConversationId;
391
- if (!g) return null;
390
+ return A;
391
+ }, [x.messages]), w = N(async () => {
392
+ const v = m.activeConversationId;
393
+ if (!v) return null;
392
394
  try {
393
- const E = await t.getMessages(g);
394
- m.setMessages(E);
395
- const L = E.findLast((k) => k.role === "assistant");
396
- return (L == null ? void 0 : L.id) ?? null;
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;
397
399
  } catch {
398
400
  return null;
399
401
  }
400
- }, [t, u.activeConversationId, m]), N = C((g, E, L) => {
401
- if (/^\d+$/.test(g)) {
402
- t.feedback(g, E, L).catch(() => {
402
+ }, [t, m.activeConversationId, x]), M = N((v, A, I) => {
403
+ if (/^\d+$/.test(v)) {
404
+ t.feedback(v, A, I).catch(() => {
403
405
  });
404
406
  return;
405
407
  }
406
- P().then((k) => {
407
- k && t.feedback(k, E, L).catch(() => {
408
+ w().then((F) => {
409
+ F && t.feedback(F, A, I).catch(() => {
408
410
  });
409
411
  });
410
- }, [t, P]), R = C((g) => {
411
- if (/^\d+$/.test(g)) {
412
- t.cancelFeedback(g).catch(() => {
412
+ }, [t, w]), $ = N((v) => {
413
+ if (/^\d+$/.test(v)) {
414
+ t.cancelFeedback(v).catch(() => {
413
415
  });
414
416
  return;
415
417
  }
416
- P().then((E) => {
417
- E && t.cancelFeedback(E).catch(() => {
418
+ w().then((A) => {
419
+ A && t.cancelFeedback(A).catch(() => {
418
420
  });
419
421
  });
420
- }, [t, P]), y = J(() => ({
422
+ }, [t, w]), L = re(() => ({
421
423
  sdk: t,
422
- status: m.status,
423
- error: m.error,
424
- messages: m.messages,
425
- conversations: u.conversations,
426
- activeConversationId: u.activeConversationId,
427
- isThreadListOpen: n,
424
+ status: x.status,
425
+ error: x.error,
426
+ messages: x.messages,
427
+ conversations: m.conversations,
428
+ activeConversationId: m.activeConversationId,
429
+ isThreadListOpen: s,
428
430
  isArtifactDrawerOpen: i,
429
- allArtifacts: $,
431
+ allArtifacts: D,
430
432
  activePreviewArtifact: l,
431
- hasMore: u.hasMore,
432
- conversationsLoading: u.loading,
433
- messagesLoading: h,
434
- sendMessage: m.sendMessage,
435
- stop: m.stop,
436
- regenerate: m.regenerate,
437
- switchConversation: v,
438
- newConversation: S,
439
- deleteConversation: T,
440
- renameConversation: u.renameConversation,
441
- loadMoreConversations: u.loadMore,
442
- toggleThreadList: A,
443
- toggleArtifactDrawer: x,
444
- openArtifactPreview: z,
445
- feedback: N,
446
- cancelFeedback: R,
447
- respondToInterrupt: m.respondToInterrupt
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
448
451
  }), [
449
452
  t,
450
- m.status,
451
- m.error,
452
- m.messages,
453
- m.sendMessage,
454
- m.stop,
455
- m.regenerate,
456
- m.respondToInterrupt,
457
- u.conversations,
458
- u.activeConversationId,
459
- u.renameConversation,
460
- u.hasMore,
461
- u.loadMore,
462
- u.loading,
463
- n,
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,
466
+ s,
464
467
  i,
465
- $,
468
+ D,
466
469
  l,
467
- h,
468
- v,
469
- S,
470
- T,
471
- A,
472
- x,
470
+ g,
471
+ f,
472
+ y,
473
473
  z,
474
- N,
475
- R
474
+ H,
475
+ k,
476
+ C,
477
+ S,
478
+ M,
479
+ $
476
480
  ]);
477
- return /* @__PURE__ */ e(de.Provider, { value: y, children: s });
481
+ return /* @__PURE__ */ e(Ae.Provider, { value: L, children: n });
478
482
  }
479
- const ke = "https://at.alicdn.com/t/c/font_5210396_pffyg5g21kn.js";
480
- let ae = !1;
481
- function Ne(t = ke) {
482
- if (ae || typeof document > "u") return;
483
- ae = !0;
484
- const a = t.split("?")[0].split("/").pop();
485
- if (a && document.querySelector(`script[src*="${a}"]`)) return;
486
- const s = document.createElement("script");
487
- s.src = t, document.head.appendChild(s);
483
+ const G = "https://ehr-web.netease.com/ehr-web/erh-super-agent", X = {
484
+ recently: `${G}/recently.svg`,
485
+ home: `${G}/home.svg`,
486
+ mergeWindow: `${G}/merge_window.svg`,
487
+ spiltWindow: `${G}/spilt_window.svg`,
488
+ close: `${G}/close.svg`,
489
+ message: `${G}/message.svg`,
490
+ messageCreate: `${G}/message_create.svg`,
491
+ customerService: `${G}/customer_service.svg`,
492
+ sendSolid: `${G}/send_solid.svg`,
493
+ capabilityIcons: [
494
+ `${G}/icon1.png`,
495
+ `${G}/icon2.png`,
496
+ `${G}/icon3.png`
497
+ ],
498
+ triggerLogo: `${G}/HRlogo.png`,
499
+ logo: `${G}/HRlogo2.png`,
500
+ assistantAvatarGenerating: `${G}/profile0.gif`,
501
+ assistantAvatar: `${G}/profile1.png`
502
+ }, U = {
503
+ TRIGGER_SIZE: 56,
504
+ TRIGGER_RIGHT: 20,
505
+ TRIGGER_BOTTOM: 80,
506
+ DEFAULT_WIDTH: 400,
507
+ DEFAULT_HEIGHT: 648,
508
+ MIN_WIDTH: 360,
509
+ MAX_WIDTH: 800,
510
+ /** 高度上限占视口比例(渲染钳制与默认定位统一使用) */
511
+ MAX_HEIGHT_RATIO: 0.95
512
+ };
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);
521
+ }, []);
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: _ });
527
+ }
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))
538
+ }));
539
+ }, O = () => {
540
+ k.current = !1, W();
541
+ }, W = () => {
542
+ document.removeEventListener("mousemove", _), document.removeEventListener("mouseup", O), w.current = null;
543
+ };
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();
553
+ return;
554
+ }
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;
560
+ };
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);
566
+ }, [t]);
567
+ return {
568
+ // 状态
569
+ width: s,
570
+ position: i,
571
+ hasCustomPosition: l,
572
+ isMaximized: p,
573
+ lockedHeight: g,
574
+ viewport: m,
575
+ defaultHeight: a,
576
+ /** 真实渲染几何(含侧边栏宽度 / 自适应高度,统一在 hook 内钳制) */
577
+ totalWidth: L,
578
+ windowHeight: $,
579
+ // 交互
580
+ startWindowDrag: v,
581
+ startResize: A,
582
+ toggleMaximize: I,
583
+ setIsMaximized: u,
584
+ setLockedHeight: b,
585
+ setHasCustomPosition: d,
586
+ reset: F
587
+ };
588
+ }
589
+ function Ke(t) {
590
+ const { enabled: a, contentSelector: n, defaultHeight: s, onHeightChange: r } = t, i = R(null);
591
+ return P(() => {
592
+ 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);
602
+ };
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();
608
+ });
609
+ return u.observe(l, { childList: !0, subtree: !0, characterData: !0 }), () => {
610
+ p.disconnect(), u.disconnect();
611
+ };
612
+ }, [a, n, s, r]), i;
488
613
  }
489
- Ne();
490
- function I({ name: t, size: a = 16, color: s = "currentColor", className: n, style: r }) {
614
+ function Ve({ isOpen: t, onClick: a, triggerLogo: n }) {
491
615
  return /* @__PURE__ */ e(
492
- "svg",
616
+ "button",
493
617
  {
494
- className: n,
495
- style: { width: a, height: a, fill: s, verticalAlign: "middle", ...r },
496
- "aria-hidden": "true",
497
- children: /* @__PURE__ */ e("use", { href: `#icon-${t}` })
618
+ type: "button",
619
+ 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,
627
+ "aria-label": "打开 AI 助手",
628
+ title: "AI 助手",
629
+ children: /* @__PURE__ */ e("img", { src: n || X.triggerLogo, alt: "AI 助手", className: "block h-14 w-14", draggable: !1 })
498
630
  }
499
631
  );
500
632
  }
501
- function Ce({ isOpen: t, onClick: a }) {
502
- return /* @__PURE__ */ e("button", { className: `sa-trigger ${t ? "sa-trigger-open" : ""}`, onClick: a, children: t ? /* @__PURE__ */ e(I, { name: "x", size: 24, color: "#fff" }) : /* @__PURE__ */ e(I, { name: "message-square", size: 24, color: "#fff" }) });
633
+ function te({
634
+ tooltip: t,
635
+ onClick: a,
636
+ children: n
637
+ }) {
638
+ return /* @__PURE__ */ e(
639
+ "button",
640
+ {
641
+ type: "button",
642
+ className: "sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white active:bg-[#F5F5F5]",
643
+ "data-tooltip": t,
644
+ "aria-label": t,
645
+ onClick: a,
646
+ children: n
647
+ }
648
+ );
503
649
  }
504
- function ze({ title: t, onClose: a, onToggleThreadList: s, showClose: n = !0, artifactCount: r = 0, onToggleArtifactDrawer: i }) {
505
- return /* @__PURE__ */ d("div", { className: "sa-header", children: [
506
- /* @__PURE__ */ d("div", { className: "sa-header-left", children: [
507
- /* @__PURE__ */ e("div", { className: "sa-header-avatar", children: "A" }),
508
- /* @__PURE__ */ d("div", { className: "sa-header-info", children: [
509
- /* @__PURE__ */ e("div", { className: "sa-header-title", children: t }),
510
- /* @__PURE__ */ e("div", { className: "sa-header-status", children: "● Online" })
511
- ] })
650
+ function qe({
651
+ onClose: t,
652
+ onToggleThreadList: a,
653
+ isMaximized: n = !1,
654
+ onToggleMaximize: s,
655
+ showHome: r = !1,
656
+ onHome: i,
657
+ showClose: o = !0,
658
+ artifactCount: l = 0,
659
+ onToggleArtifactDrawer: d
660
+ }) {
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 }) })
512
665
  ] }),
513
- /* @__PURE__ */ d("div", { className: "sa-header-actions", children: [
514
- r > 0 && i && /* @__PURE__ */ d("button", { className: "sa-header-btn sa-header-btn-artifact", onClick: i, title: "会话产物", children: [
515
- /* @__PURE__ */ d("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
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: [
516
669
  /* @__PURE__ */ e("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
517
670
  /* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" })
518
671
  ] }),
519
- /* @__PURE__ */ e("span", { children: "产物" })
520
- ] }),
521
- /* @__PURE__ */ e("button", { className: "sa-header-btn", onClick: s, title: "会话列表", children: /* @__PURE__ */ e(I, { name: "menu", size: 16 }) }),
522
- n && /* @__PURE__ */ e("button", { className: "sa-header-btn", onClick: a, title: "关闭", children: /* @__PURE__ */ e(I, { name: "x", size: 16 }) })
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 })
673
+ ] }) }),
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 }) })
523
676
  ] })
524
677
  ] });
525
678
  }
526
- const G = (t) => String(t).padStart(2, "0");
527
- function pe(t) {
679
+ const ae = (t) => String(t).padStart(2, "0");
680
+ function Ze(t) {
528
681
  if (!t) return "";
529
682
  const a = new Date(t);
530
- return isNaN(a.getTime()) ? "" : `${a.getFullYear()}-${G(a.getMonth() + 1)}-${G(a.getDate())} ${G(a.getHours())}:${G(a.getMinutes())}:${G(a.getSeconds())}`;
683
+ return isNaN(a.getTime()) ? "" : `${a.getFullYear()}-${ae(a.getMonth() + 1)}-${ae(a.getDate())} ${ae(a.getHours())}:${ae(a.getMinutes())}:${ae(a.getSeconds())}`;
531
684
  }
532
- function Ie(t) {
533
- const a = /* @__PURE__ */ new Date(), s = new Date(
534
- a.getFullYear(),
535
- a.getMonth(),
536
- a.getDate()
537
- ).getTime(), n = s - 6 * 864e5, r = [], i = [], o = [];
538
- for (const c of t) {
539
- const p = new Date(c.updateTime).getTime();
540
- p >= s ? r.push(c) : p >= n ? i.push(c) : o.push(c);
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);
541
690
  }
542
691
  const l = [];
543
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;
544
693
  }
545
- function Se() {
694
+ function ke({ width: t }) {
546
695
  const {
547
- conversations: t,
548
- activeConversationId: a,
696
+ conversations: a,
697
+ activeConversationId: n,
549
698
  switchConversation: s,
550
- newConversation: n,
551
- deleteConversation: r,
552
- renameConversation: i,
553
- isThreadListOpen: o,
554
- toggleThreadList: l,
555
- hasMore: c,
556
- loadMoreConversations: p,
557
- conversationsLoading: f
558
- } = Y(), [h, w] = M(null), [u, m] = M(""), v = _(null), S = C(
559
- (z, $) => {
560
- w(z), m($ ?? "");
561
- },
562
- []
563
- ), T = C(
564
- (z) => {
565
- u.trim() && i(z, u.trim()), w(null);
566
- },
567
- [u, i]
568
- ), A = C(() => {
569
- const z = v.current;
570
- !z || !c || z.scrollHeight - z.scrollTop - z.clientHeight < 50 && p();
571
- }, [c, p]), x = J(() => Ie(t), [t]);
572
- return o ? /* @__PURE__ */ d(q, { children: [
573
- /* @__PURE__ */ e("div", { className: "sa-thread-list-overlay", onClick: l }),
574
- /* @__PURE__ */ d("div", { className: "sa-thread-list", children: [
575
- /* @__PURE__ */ d("div", { className: "sa-thread-list-header", children: [
576
- /* @__PURE__ */ e("span", { className: "sa-thread-list-title", children: "会话记录" }),
577
- /* @__PURE__ */ d("button", { className: "sa-thread-list-new", onClick: n, children: [
578
- /* @__PURE__ */ e(I, { name: "plus", size: 14 }),
579
- " 新会话"
580
- ] })
581
- ] }),
582
- /* @__PURE__ */ d(
583
- "div",
584
- {
585
- className: "sa-thread-list-items",
586
- ref: v,
587
- onScroll: A,
588
- children: [
589
- f && t.length === 0 && /* @__PURE__ */ e("div", { className: "sa-thread-list-loading", children: "加载中..." }),
590
- !f && t.length === 0 && /* @__PURE__ */ e("div", { className: "sa-thread-list-empty", children: "暂无会话" }),
591
- x.map((z) => /* @__PURE__ */ d("div", { className: "sa-thread-group", children: [
592
- /* @__PURE__ */ e("div", { className: "sa-thread-group-label", children: z.label }),
593
- z.items.map(($) => /* @__PURE__ */ d(
594
- "div",
595
- {
596
- className: `sa-thread-item ${$.sessionId === a ? "active" : ""}`,
597
- onClick: () => {
598
- h !== $.sessionId && s($.sessionId);
599
- },
600
- children: [
601
- h === $.sessionId ? /* @__PURE__ */ e(
602
- "input",
699
+ newConversation: r,
700
+ 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(
714
+ "div",
715
+ {
716
+ className: "relative z-[5] flex shrink-0 flex-col overflow-visible border-r border-[#ECECEC] bg-[#FAFAFA] p-3 animate-sa-history-in",
717
+ style: { width: t ?? 200 },
718
+ children: [
719
+ /* @__PURE__ */ c(
720
+ "button",
721
+ {
722
+ type: "button",
723
+ 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
+ onClick: r,
725
+ children: [
726
+ /* @__PURE__ */ e("img", { src: X.messageCreate, alt: "", width: 18, height: 18 }),
727
+ /* @__PURE__ */ e("span", { className: "sa-new-chat-text whitespace-nowrap", children: "新建对话" })
728
+ ]
729
+ }
730
+ ),
731
+ /* @__PURE__ */ c("div", { className: "px-1 pb-2.5", children: [
732
+ /* @__PURE__ */ e("div", { className: "mb-1 text-[14px] font-semibold text-[#333]", children: "历史对话" }),
733
+ /* @__PURE__ */ e("div", { className: "text-[11px] text-[#999]", children: "展示最近的会话记录" })
734
+ ] }),
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(
741
+ "div",
742
+ {
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]"}`,
744
+ onClick: () => {
745
+ u !== D.sessionId && s(D.sessionId);
746
+ },
747
+ 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 });
751
+ },
752
+ onMouseLeave: () => f(null),
753
+ children: u === D.sessionId ? /* @__PURE__ */ e(
754
+ "input",
755
+ {
756
+ 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),
760
+ onKeyDown: (w) => {
761
+ w.key === "Enter" && H(D.sessionId), w.key === "Escape" && g(null);
762
+ },
763
+ onClick: (w) => w.stopPropagation(),
764
+ autoFocus: !0
765
+ }
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: [
770
+ /* @__PURE__ */ e(
771
+ "button",
603
772
  {
604
- className: "sa-thread-item-edit",
605
- value: u,
606
- onChange: (P) => m(P.target.value),
607
- onBlur: () => T($.sessionId),
608
- onKeyDown: (P) => {
609
- P.key === "Enter" && T($.sessionId), P.key === "Escape" && w(null);
773
+ type: "button",
774
+ className: "flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[var(--sa-primary)]",
775
+ onClick: (w) => {
776
+ w.stopPropagation(), z(D.sessionId, D.title);
610
777
  },
611
- onClick: (P) => P.stopPropagation(),
612
- autoFocus: !0
778
+ title: "重命名",
779
+ 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" }) })
613
780
  }
614
- ) : /* @__PURE__ */ d("div", { className: "sa-thread-item-info", children: [
615
- /* @__PURE__ */ e("span", { className: "sa-thread-item-title", children: $.title || "新会话" }),
616
- /* @__PURE__ */ e("span", { className: "sa-thread-item-time", children: pe($.updateTime) })
617
- ] }),
618
- /* @__PURE__ */ d("div", { className: "sa-thread-item-actions", children: [
619
- /* @__PURE__ */ e(
620
- "button",
621
- {
622
- className: "sa-thread-item-action-btn",
623
- onClick: (P) => {
624
- P.stopPropagation(), S($.sessionId, $.title);
625
- },
626
- title: "重命名",
627
- children: /* @__PURE__ */ e(I, { name: "pen", size: 13 })
628
- }
629
- ),
630
- /* @__PURE__ */ e(
631
- "button",
632
- {
633
- className: "sa-thread-item-action-btn",
634
- onClick: (P) => {
635
- P.stopPropagation(), r($.sessionId);
636
- },
637
- title: "删除",
638
- children: /* @__PURE__ */ e(I, { name: "trash2", size: 13 })
639
- }
640
- )
641
- ] })
642
- ]
643
- },
644
- $.sessionId
645
- ))
646
- ] }, z.label)),
647
- f && t.length > 0 && /* @__PURE__ */ e("div", { className: "sa-thread-list-loading", children: c ? "加载更多..." : "加载中..." }),
648
- !f && c && /* @__PURE__ */ e("div", { className: "sa-thread-list-hint", children: "向下滚动加载更多" })
649
- ]
650
- }
651
- )
652
- ] })
653
- ] }) : null;
781
+ ),
782
+ /* @__PURE__ */ e(
783
+ "button",
784
+ {
785
+ type: "button",
786
+ className: "flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[#ef4444]",
787
+ onClick: (w) => {
788
+ w.stopPropagation(), i(D.sessionId);
789
+ },
790
+ title: "删除",
791
+ 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" }) })
792
+ }
793
+ )
794
+ ] })
795
+ ] })
796
+ },
797
+ D.sessionId
798
+ ))
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: "向下滚动加载更多" })
802
+ ] }),
803
+ x && /* @__PURE__ */ e(
804
+ "div",
805
+ {
806
+ 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
809
+ }
810
+ )
811
+ ]
812
+ }
813
+ );
654
814
  }
655
- function Te(t) {
656
- const a = _(null), s = _(!1), n = _(0), r = C(() => {
815
+ function Je(t) {
816
+ const a = R(null), n = R(!1), s = R(0), r = N(() => {
657
817
  const o = a.current;
658
818
  if (!o) return;
659
- const { scrollTop: l, scrollHeight: c, clientHeight: p } = o, f = c - l - p < 40;
660
- l < n.current && !f && (s.current = !0), f && (s.current = !1), n.current = l;
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;
661
821
  }, []);
662
- B(() => {
822
+ P(() => {
663
823
  const o = a.current;
664
824
  if (o)
665
825
  return o.addEventListener("scroll", r, { passive: !0 }), () => o.removeEventListener("scroll", r);
666
- }, [r]), B(() => {
667
- if (s.current) return;
826
+ }, [r]), P(() => {
827
+ if (n.current) return;
668
828
  const o = a.current;
669
829
  o && requestAnimationFrame(() => {
670
830
  o.scrollTop = o.scrollHeight;
671
831
  });
672
832
  }, t);
673
- const i = C(() => {
674
- s.current = !1;
833
+ const i = N(() => {
834
+ n.current = !1;
675
835
  const o = a.current;
676
836
  o && (o.scrollTop = o.scrollHeight);
677
837
  }, []);
@@ -680,9 +840,9 @@ function Te(t) {
680
840
  function K(t) {
681
841
  return t.value++;
682
842
  }
683
- function X(t, a) {
684
- const s = [], n = [], r = () => {
685
- n.length > 0 && (s.push(n.join("")), n.length = 0);
843
+ function ee(t, a) {
844
+ const n = [], s = [], r = () => {
845
+ s.length > 0 && (n.push(s.join("")), s.length = 0);
686
846
  };
687
847
  let i = 0;
688
848
  for (; i < t.length; ) {
@@ -690,7 +850,7 @@ function X(t, a) {
690
850
  if (o === "`") {
691
851
  const l = t.indexOf("`", i + 1);
692
852
  if (l !== -1) {
693
- r(), s.push(
853
+ r(), n.push(
694
854
  /* @__PURE__ */ e("code", { className: "sa-inline-code", children: t.slice(i + 1, l) }, K(a))
695
855
  ), i = l + 1;
696
856
  continue;
@@ -698,349 +858,371 @@ function X(t, a) {
698
858
  } else if (o === "*" && t[i + 1] === "*") {
699
859
  const l = t.indexOf("**", i + 2);
700
860
  if (l !== -1) {
701
- r(), s.push(
702
- /* @__PURE__ */ e("strong", { children: X(t.slice(i + 2, l), a) }, K(a))
861
+ r(), n.push(
862
+ /* @__PURE__ */ e("strong", { children: ee(t.slice(i + 2, l), a) }, K(a))
703
863
  ), i = l + 2;
704
864
  continue;
705
865
  }
706
866
  } else if (o === "*") {
707
867
  const l = t.indexOf("*", i + 1);
708
868
  if (l !== -1) {
709
- r(), s.push(
710
- /* @__PURE__ */ e("em", { children: X(t.slice(i + 1, l), a) }, K(a))
869
+ r(), n.push(
870
+ /* @__PURE__ */ e("em", { children: ee(t.slice(i + 1, l), a) }, K(a))
711
871
  ), i = l + 1;
712
872
  continue;
713
873
  }
714
874
  } else if (o === "[") {
715
875
  const l = t.indexOf("]", i + 1);
716
876
  if (l !== -1 && t[l + 1] === "(") {
717
- const c = t.indexOf(")", l + 2);
718
- if (c !== -1) {
719
- const p = t.slice(i + 1, l), f = t.slice(l + 2, c);
720
- r(), s.push(
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);
880
+ r(), n.push(
721
881
  /* @__PURE__ */ e(
722
882
  "a",
723
883
  {
724
- href: f,
884
+ href: u,
725
885
  target: "_blank",
726
886
  rel: "noreferrer",
727
- children: X(p, a)
887
+ children: ee(p, a)
728
888
  },
729
889
  K(a)
730
890
  )
731
- ), i = c + 1;
891
+ ), i = d + 1;
732
892
  continue;
733
893
  }
734
894
  }
735
895
  }
736
- n.push(o), i++;
896
+ s.push(o), i++;
737
897
  }
738
- return r(), s;
898
+ return r(), n;
739
899
  }
740
- function Me(t, a) {
741
- const s = [], n = t.split(`
900
+ function Qe(t, a) {
901
+ const n = [], s = t.split(`
742
902
  `);
743
903
  let r = 0;
744
- const i = (c) => c.trim() === "", o = (c) => /^#{1,6}\s+\S/.test(c.trim()), l = (c) => /^(?:[-*+]|\d+[.)])\s+\S/.test(c.trim());
745
- for (; r < n.length; ) {
746
- const c = n[r], p = c.trim();
747
- if (i(c)) {
904
+ const i = (d) => d.trim() === "", o = (d) => /^#{1,6}\s+\S/.test(d.trim()), l = (d) => /^(?:[-*+]|\d+[.)])\s+\S/.test(d.trim());
905
+ for (; r < s.length; ) {
906
+ const d = s[r], p = d.trim();
907
+ if (i(d)) {
748
908
  r++;
749
909
  continue;
750
910
  }
751
- if (o(c)) {
752
- const h = p.match(/^(#{1,6})\s+(.*)$/);
753
- if (h) {
754
- const u = `h${Math.min(h[1].length, 6)}`;
755
- s.push(
756
- V.createElement(
757
- u,
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)}`;
915
+ n.push(
916
+ Q.createElement(
917
+ m,
758
918
  { key: K(a) },
759
- X(h[2], a)
919
+ ee(g[2], a)
760
920
  )
761
921
  );
762
922
  }
763
923
  r++;
764
924
  continue;
765
925
  }
766
- if (l(c)) {
767
- const h = /^\d+[.)]/.test(p), w = [];
768
- for (; r < n.length && l(n[r]); ) {
769
- const u = n[r].trim().match(/^(?:[-*+]|\d+[.)])\s+(.*)$/);
770
- u && w.push(
771
- /* @__PURE__ */ e("li", { children: X(u[1], a) }, K(a))
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))
772
932
  ), r++;
773
933
  }
774
- s.push(
775
- h ? /* @__PURE__ */ e("ol", { className: "sa-list", children: w }, K(a)) : /* @__PURE__ */ e("ul", { className: "sa-list", children: w }, K(a))
934
+ n.push(
935
+ g ? /* @__PURE__ */ e("ol", { className: "sa-list", children: b }, K(a)) : /* @__PURE__ */ e("ul", { className: "sa-list", children: b }, K(a))
776
936
  );
777
937
  continue;
778
938
  }
779
- const f = [];
780
- for (; r < n.length && !i(n[r]) && !o(n[r]) && !l(n[r]); )
781
- f.push(n[r]), r++;
782
- s.push(
783
- /* @__PURE__ */ e("p", { className: "sa-text-paragraph", children: X(f.join(" "), a) }, K(a))
939
+ const u = [];
940
+ for (; r < s.length && !i(s[r]) && !o(s[r]) && !l(s[r]); )
941
+ u.push(s[r]), r++;
942
+ n.push(
943
+ /* @__PURE__ */ e("p", { className: "sa-text-paragraph", children: ee(u.join(" "), a) }, K(a))
784
944
  );
785
945
  }
786
- return s;
946
+ return n;
787
947
  }
788
- function $e(t) {
789
- const a = { value: 0 }, s = [], n = t.split("```");
790
- for (let r = 0; r < n.length; r++)
948
+ function et(t) {
949
+ const a = { value: 0 }, n = [], s = t.split("```");
950
+ for (let r = 0; r < s.length; r++)
791
951
  if (r % 2 === 0)
792
- s.push(...Me(n[r], a));
793
- else if (n[r].trim() !== "") {
794
- let i = n[r].replace(/^\r?\n/, "");
795
- i = i.replace(/^[a-zA-Z0-9_+#.-]+\r?\n/, ""), i = i.replace(/\r?\n$/, ""), s.push(
952
+ n.push(...Qe(s[r], a));
953
+ else if (s[r].trim() !== "") {
954
+ let i = s[r].replace(/^\r?\n/, "");
955
+ i = i.replace(/^[a-zA-Z0-9_+#.-]+\r?\n/, ""), i = i.replace(/\r?\n$/, ""), n.push(
796
956
  /* @__PURE__ */ e("pre", { className: "sa-code-block", children: /* @__PURE__ */ e("code", { children: i }) }, K(a))
797
957
  );
798
958
  }
799
- return s;
959
+ return n;
960
+ }
961
+ function tt({ content: t }) {
962
+ return /* @__PURE__ */ e("div", { className: "sa-text-part", children: et(t) });
963
+ }
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;
969
+ const a = t.split("?")[0].split("/").pop();
970
+ if (a && document.querySelector(`script[src*="${a}"]`)) return;
971
+ const n = document.createElement("script");
972
+ n.src = t, document.head.appendChild(n);
800
973
  }
801
- function De({ content: t }) {
802
- return /* @__PURE__ */ e("div", { className: "sa-text-part", children: $e(t) });
974
+ rt();
975
+ function B({ name: t, size: a = 16, color: n = "currentColor", className: s, style: r }) {
976
+ return /* @__PURE__ */ e(
977
+ "svg",
978
+ {
979
+ className: s,
980
+ style: { width: a, height: a, fill: n, verticalAlign: "middle", ...r },
981
+ "aria-hidden": "true",
982
+ children: /* @__PURE__ */ e("use", { href: `#icon-${t}` })
983
+ }
984
+ );
803
985
  }
804
- function Le({ content: t }) {
805
- const [a, s] = M(!1);
806
- return /* @__PURE__ */ d("div", { className: "sa-thinking-part", onClick: () => s(!a), children: [
807
- /* @__PURE__ */ d("div", { className: "sa-thinking-header", children: [
808
- /* @__PURE__ */ e("span", { className: "sa-thinking-icon", children: /* @__PURE__ */ e(I, { name: "brain", size: 14 }) }),
986
+ function nt({ content: t }) {
987
+ 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 }) }),
809
991
  /* @__PURE__ */ e("span", { className: "sa-thinking-label", children: "思考过程" }),
810
- /* @__PURE__ */ e("span", { className: `sa-thinking-arrow ${a ? "expanded" : ""}`, children: /* @__PURE__ */ e(I, { name: "chevron-right", size: 12 }) })
992
+ /* @__PURE__ */ e("span", { className: `sa-thinking-arrow ${a ? "expanded" : ""}`, children: /* @__PURE__ */ e(B, { name: "chevron-right", size: 12 }) })
811
993
  ] }),
812
994
  a && /* @__PURE__ */ e("div", { className: "sa-thinking-content", children: t })
813
995
  ] });
814
996
  }
815
- function Ee({ toolName: t, toolCallId: a, args: s }) {
816
- const [n, r] = M(!1), [i, o] = M(!1);
817
- let l = s;
997
+ function st({ toolName: t, toolCallId: a, args: n }) {
998
+ const [s, r] = E(!1), [i, o] = E(!1);
999
+ let l = n;
818
1000
  try {
819
- l = JSON.stringify(JSON.parse(s), null, 2);
1001
+ l = JSON.stringify(JSON.parse(n), null, 2);
820
1002
  } catch {
821
1003
  }
822
- const c = C(() => {
1004
+ const d = N(() => {
823
1005
  var p;
824
1006
  (p = navigator.clipboard) == null || p.writeText(l).then(() => {
825
1007
  o(!0), setTimeout(() => o(!1), 2e3);
826
1008
  }).catch(() => {
827
1009
  });
828
1010
  }, [l]);
829
- return /* @__PURE__ */ d("div", { className: "sa-tool-call-part", children: [
830
- /* @__PURE__ */ d("div", { className: "sa-tool-call-header", onClick: () => r(!n), children: [
831
- /* @__PURE__ */ e("span", { className: "sa-tool-icon", children: /* @__PURE__ */ e(I, { name: "zap", size: 14 }) }),
832
- /* @__PURE__ */ d("span", { className: "sa-tool-name", children: [
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: [
833
1015
  "调用工具: ",
834
1016
  t
835
1017
  ] }),
836
- /* @__PURE__ */ e("span", { className: `sa-thinking-arrow ${n ? "expanded" : ""}`, children: /* @__PURE__ */ e(I, { name: "chevron-right", size: 12 }) })
1018
+ /* @__PURE__ */ e("span", { className: `sa-thinking-arrow ${s ? "expanded" : ""}`, children: /* @__PURE__ */ e(B, { name: "chevron-right", size: 12 }) })
837
1019
  ] }),
838
- n && /* @__PURE__ */ d(q, { children: [
1020
+ s && /* @__PURE__ */ c(V, { children: [
839
1021
  /* @__PURE__ */ e("pre", { className: "sa-tool-args", children: l }),
840
- /* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ d("button", { className: "sa-action-btn", onClick: c, title: "复制", children: [
841
- /* @__PURE__ */ e(I, { name: i ? "circle-check" : "copy", size: 14 }),
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 }),
842
1024
  " ",
843
1025
  i ? "已复制" : "复制"
844
1026
  ] }) })
845
1027
  ] })
846
1028
  ] });
847
1029
  }
848
- function re({ text: t }) {
849
- const [a, s] = M(!1);
850
- return /* @__PURE__ */ d("button", { className: "sa-action-btn", onClick: () => {
1030
+ function Ne({ text: t }) {
1031
+ const [a, n] = E(!1);
1032
+ return /* @__PURE__ */ c("button", { className: "sa-action-btn", onClick: () => {
851
1033
  var r;
852
1034
  (r = navigator.clipboard) == null || r.writeText(t).then(() => {
853
- s(!0), setTimeout(() => s(!1), 2e3);
1035
+ n(!0), setTimeout(() => n(!1), 2e3);
854
1036
  }).catch(() => {
855
1037
  });
856
1038
  }, title: "复制", children: [
857
- /* @__PURE__ */ e(I, { name: a ? "circle-check" : "copy", size: 14 }),
1039
+ /* @__PURE__ */ e(B, { name: a ? "circle-check" : "copy", size: 14 }),
858
1040
  " ",
859
1041
  a ? "已复制" : "复制"
860
1042
  ] });
861
1043
  }
862
- function Ae({ html: t }) {
863
- const [a, s] = M(null);
864
- return B(() => {
865
- let n = !1;
1044
+ function it({ html: t }) {
1045
+ const [a, n] = E(null);
1046
+ return P(() => {
1047
+ let s = !1;
866
1048
  return import("./purify.es-C-6FFqDW.js").then((r) => {
867
- n || s(r.default.sanitize(t, { FORCE_BODY: !0, ADD_ATTR: ["target"] }));
1049
+ s || n(r.default.sanitize(t, { FORCE_BODY: !0, ADD_ATTR: ["target"] }));
868
1050
  }), () => {
869
- n = !0;
1051
+ s = !0;
870
1052
  };
871
1053
  }, [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 } }) });
872
1054
  }
873
- function Re({ toolName: t, content: a, artifacts: s, renderMode: n, html: r, artifactPreview: i }) {
874
- const { openArtifactPreview: o } = Y(), l = ce(s);
875
- return /* @__PURE__ */ d("div", { className: "sa-tool-result-part", children: [
876
- /* @__PURE__ */ d("div", { className: "sa-tool-result-header", children: [
877
- /* @__PURE__ */ e("span", { className: "sa-tool-icon", children: /* @__PURE__ */ e(I, { name: "circle-check", size: 14, color: "#10b981" }) }),
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" }) }),
878
1060
  /* @__PURE__ */ e("span", { className: "sa-tool-result-label", children: t || "工具返回" })
879
1061
  ] }),
880
- n === "html" && r ? /* @__PURE__ */ d(q, { children: [
881
- /* @__PURE__ */ e(Ae, { html: r }),
882
- /* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ e(re, { text: r }) })
883
- ] }) : a ? /* @__PURE__ */ d(q, { children: [
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: [
884
1066
  /* @__PURE__ */ e("pre", { className: "sa-tool-result-content", children: a }),
885
- /* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ e(re, { text: a }) })
1067
+ /* @__PURE__ */ e("div", { className: "sa-tool-result-actions", children: /* @__PURE__ */ e(Ne, { text: a }) })
886
1068
  ] }) : /* @__PURE__ */ e("pre", { className: "sa-tool-result-content", children: "—" }),
887
- l.length > 0 && /* @__PURE__ */ e("ul", { className: "sa-artifact-file-list", role: "list", children: l.map((c, p) => /* @__PURE__ */ d(
1069
+ l.length > 0 && /* @__PURE__ */ e("ul", { className: "sa-artifact-file-list", role: "list", children: l.map((d, p) => /* @__PURE__ */ c(
888
1070
  "li",
889
1071
  {
890
1072
  className: "sa-artifact-file-card",
891
- onClick: i ? () => o(c) : void 0,
892
- onKeyDown: i ? (f) => {
893
- (f.key === "Enter" || f.key === " ") && (f.preventDefault(), o(c));
1073
+ onClick: i ? () => o(d) : void 0,
1074
+ onKeyDown: i ? (u) => {
1075
+ (u.key === "Enter" || u.key === " ") && (u.preventDefault(), o(d));
894
1076
  } : void 0,
895
1077
  tabIndex: i ? 0 : void 0,
896
1078
  role: i ? "button" : void 0,
897
- "aria-label": i ? `预览 ${c.filename}` : void 0,
1079
+ "aria-label": i ? `预览 ${d.filename}` : void 0,
898
1080
  style: i ? { cursor: "pointer" } : void 0,
899
1081
  children: [
900
- /* @__PURE__ */ e("div", { className: "sa-artifact-file-icon", children: /* @__PURE__ */ e("span", { className: "sa-artifact-chip-type", children: le(c.type) }) }),
901
- /* @__PURE__ */ d("div", { className: "sa-artifact-file-info", children: [
902
- /* @__PURE__ */ e("span", { className: "sa-artifact-file-name", children: c.filename }),
903
- c.size != null && /* @__PURE__ */ e("span", { className: "sa-artifact-file-size", children: oe(c.size) })
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) })
904
1086
  ] }),
905
1087
  i && /* @__PURE__ */ e(
906
1088
  "button",
907
1089
  {
908
1090
  className: "sa-artifact-file-download",
909
1091
  title: "下载",
910
- "aria-label": `下载 ${c.filename}`,
911
- onClick: (f) => {
912
- f.stopPropagation(), Z(c);
1092
+ "aria-label": `下载 ${d.filename}`,
1093
+ onClick: (u) => {
1094
+ u.stopPropagation(), ie(d);
913
1095
  },
914
1096
  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" }) })
915
1097
  }
916
1098
  )
917
1099
  ]
918
1100
  },
919
- c.id || `art-${p}`
1101
+ d.id || `art-${p}`
920
1102
  )) })
921
1103
  ] });
922
1104
  }
923
- function Oe({ content: t, onRetry: a }) {
924
- return /* @__PURE__ */ d("div", { className: "sa-error-part", children: [
925
- /* @__PURE__ */ d("div", { className: "sa-error-content", children: [
926
- /* @__PURE__ */ e("span", { className: "sa-error-icon", children: /* @__PURE__ */ e(I, { name: "triangle-alert", size: 14 }) }),
927
- /* @__PURE__ */ e("span", { children: t })
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 }) }),
1109
+ /* @__PURE__ */ e("span", { children: t || "发生错误" })
928
1110
  ] }),
929
1111
  a && /* @__PURE__ */ e("button", { className: "sa-error-retry", onClick: a, children: "重试" })
930
1112
  ] });
931
1113
  }
932
- function Pe({ interrupt: t, onRespond: a, disabled: s, answeredAction: n }) {
933
- var l, c;
934
- 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] : (c = r == null ? void 0 : r[1]) == null ? void 0 : c.label) || "取消";
935
- return /* @__PURE__ */ d("div", { className: "sa-interrupt-card", children: [
936
- /* @__PURE__ */ d("div", { className: "sa-interrupt-content", children: [
937
- /* @__PURE__ */ e(I, { name: "circle-alert", size: 16, color: "#f59e0b" }),
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" }),
938
1120
  /* @__PURE__ */ e("span", { children: t.content })
939
1121
  ] }),
940
- /* @__PURE__ */ d("div", { className: "sa-interrupt-actions", children: [
941
- /* @__PURE__ */ d(
1122
+ /* @__PURE__ */ c("div", { className: "sa-interrupt-actions", children: [
1123
+ /* @__PURE__ */ c(
942
1124
  "button",
943
1125
  {
944
- className: `sa-interrupt-btn sa-interrupt-btn-primary ${n === "confirm" ? "sa-interrupt-btn-answered" : ""}`,
945
- disabled: s,
1126
+ className: `sa-interrupt-btn sa-interrupt-btn-primary ${s === "confirm" ? "sa-interrupt-btn-answered" : ""}`,
1127
+ disabled: n,
946
1128
  onClick: () => a({ action: "confirm" }),
947
1129
  children: [
948
- /* @__PURE__ */ e(I, { name: "check", size: 14 }),
1130
+ /* @__PURE__ */ e(B, { name: "check", size: 14 }),
949
1131
  " ",
950
1132
  i
951
1133
  ]
952
1134
  }
953
1135
  ),
954
- /* @__PURE__ */ d(
1136
+ /* @__PURE__ */ c(
955
1137
  "button",
956
1138
  {
957
- className: `sa-interrupt-btn sa-interrupt-btn-secondary ${n === "cancel" ? "sa-interrupt-btn-answered" : ""}`,
958
- disabled: s,
1139
+ className: `sa-interrupt-btn sa-interrupt-btn-secondary ${s === "cancel" ? "sa-interrupt-btn-answered" : ""}`,
1140
+ disabled: n,
959
1141
  onClick: () => a({ action: "cancel" }),
960
1142
  children: [
961
- /* @__PURE__ */ e(I, { name: "x", size: 14 }),
1143
+ /* @__PURE__ */ e(B, { name: "x", size: 14 }),
962
1144
  " ",
963
1145
  o
964
1146
  ]
965
1147
  }
966
1148
  )
967
1149
  ] }),
968
- s && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1150
+ n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
969
1151
  ] });
970
1152
  }
971
- function He({ interrupt: t, onRespond: a, disabled: s, answeredAction: n }) {
972
- var p, f, h, w;
973
- 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] : (f = r == null ? void 0 : r[1]) == null ? void 0 : f.label) || "拒绝", l = (typeof (r == null ? void 0 : r[2]) == "string" ? r[2] : (h = r == null ? void 0 : r[2]) == null ? void 0 : h.label) || "跳过", c = ((w = t.metadata) == null ? void 0 : w.showSkip) !== !1;
974
- return /* @__PURE__ */ d("div", { className: "sa-interrupt-card", children: [
975
- /* @__PURE__ */ d("div", { className: "sa-interrupt-content", children: [
976
- /* @__PURE__ */ e(I, { name: "circle-alert", size: 16, color: "#f59e0b" }),
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" }),
977
1159
  /* @__PURE__ */ e("span", { children: t.content })
978
1160
  ] }),
979
- /* @__PURE__ */ d("div", { className: "sa-interrupt-actions", children: [
980
- /* @__PURE__ */ d(
1161
+ /* @__PURE__ */ c("div", { className: "sa-interrupt-actions", children: [
1162
+ /* @__PURE__ */ c(
981
1163
  "button",
982
1164
  {
983
- className: `sa-interrupt-btn sa-interrupt-btn-primary ${n === "approve" ? "sa-interrupt-btn-answered" : ""}`,
984
- disabled: s,
1165
+ className: `sa-interrupt-btn sa-interrupt-btn-primary ${s === "approve" ? "sa-interrupt-btn-answered" : ""}`,
1166
+ disabled: n,
985
1167
  onClick: () => a({ action: "approve" }),
986
1168
  children: [
987
- /* @__PURE__ */ e(I, { name: "check", size: 14 }),
1169
+ /* @__PURE__ */ e(B, { name: "check", size: 14 }),
988
1170
  " ",
989
1171
  i
990
1172
  ]
991
1173
  }
992
1174
  ),
993
- /* @__PURE__ */ d(
1175
+ /* @__PURE__ */ c(
994
1176
  "button",
995
1177
  {
996
- className: `sa-interrupt-btn sa-interrupt-btn-danger ${n === "reject" ? "sa-interrupt-btn-answered" : ""}`,
997
- disabled: s,
1178
+ className: `sa-interrupt-btn sa-interrupt-btn-danger ${s === "reject" ? "sa-interrupt-btn-answered" : ""}`,
1179
+ disabled: n,
998
1180
  onClick: () => a({ action: "reject" }),
999
1181
  children: [
1000
- /* @__PURE__ */ e(I, { name: "x", size: 14 }),
1182
+ /* @__PURE__ */ e(B, { name: "x", size: 14 }),
1001
1183
  " ",
1002
1184
  o
1003
1185
  ]
1004
1186
  }
1005
1187
  ),
1006
- c && /* @__PURE__ */ d(
1188
+ d && /* @__PURE__ */ c(
1007
1189
  "button",
1008
1190
  {
1009
- className: `sa-interrupt-btn sa-interrupt-btn-secondary ${n === "skip" ? "sa-interrupt-btn-answered" : ""}`,
1010
- disabled: s,
1191
+ className: `sa-interrupt-btn sa-interrupt-btn-secondary ${s === "skip" ? "sa-interrupt-btn-answered" : ""}`,
1192
+ disabled: n,
1011
1193
  onClick: () => a({ action: "skip" }),
1012
1194
  children: [
1013
- /* @__PURE__ */ e(I, { name: "chevron-right", size: 14 }),
1195
+ /* @__PURE__ */ e(B, { name: "chevron-right", size: 14 }),
1014
1196
  " ",
1015
1197
  l
1016
1198
  ]
1017
1199
  }
1018
1200
  )
1019
1201
  ] }),
1020
- s && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1202
+ n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1021
1203
  ] });
1022
1204
  }
1023
- function _e(t) {
1205
+ function pt(t) {
1024
1206
  return typeof t == "string" ? { value: t, label: t } : t;
1025
1207
  }
1026
- function Be({ interrupt: t, onRespond: a, disabled: s, initialValue: n }) {
1027
- const r = (t.options ?? []).map(_e);
1028
- return /* @__PURE__ */ d("div", { className: "sa-interrupt-card", children: [
1029
- /* @__PURE__ */ d("div", { className: "sa-interrupt-content", children: [
1030
- /* @__PURE__ */ e(I, { name: "list", size: 16, color: "#6366f1" }),
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" }),
1031
1213
  /* @__PURE__ */ e("span", { children: t.content })
1032
1214
  ] }),
1033
1215
  /* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((i) => {
1034
- const o = n === i.value;
1035
- return /* @__PURE__ */ d(
1216
+ const o = s === i.value;
1217
+ return /* @__PURE__ */ c(
1036
1218
  "button",
1037
1219
  {
1038
1220
  className: `sa-interrupt-option ${i.danger ? "sa-interrupt-option-danger" : ""} ${o ? "sa-interrupt-option-selected" : ""}`,
1039
- disabled: s,
1221
+ disabled: n,
1040
1222
  onClick: () => a({ action: "select", value: i.value }),
1041
1223
  children: [
1042
- /* @__PURE__ */ e(I, { name: o ? "circle-check" : "circle", size: 14 }),
1043
- i.icon && /* @__PURE__ */ e(I, { name: i.icon, size: 14 }),
1224
+ /* @__PURE__ */ e(B, { name: o ? "circle-check" : "circle", size: 14 }),
1225
+ i.icon && /* @__PURE__ */ e(B, { name: i.icon, size: 14 }),
1044
1226
  /* @__PURE__ */ e("span", { children: i.label }),
1045
1227
  i.description && /* @__PURE__ */ e("span", { className: "sa-interrupt-option-desc", children: i.description })
1046
1228
  ]
@@ -1048,63 +1230,63 @@ function Be({ interrupt: t, onRespond: a, disabled: s, initialValue: n }) {
1048
1230
  i.value
1049
1231
  );
1050
1232
  }) }),
1051
- s && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1233
+ n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1052
1234
  ] });
1053
1235
  }
1054
- function je(t) {
1236
+ function gt(t) {
1055
1237
  return typeof t == "string" ? { value: t, label: t } : t;
1056
1238
  }
1057
- function Fe({ interrupt: t, onRespond: a, disabled: s, initialValue: n }) {
1058
- const r = (t.options ?? []).map(je), [i, o] = M(
1059
- () => new Set(Array.isArray(n) ? n : [])
1060
- ), l = (c) => {
1061
- s || o((p) => {
1062
- const f = new Set(p);
1063
- return f.has(c) ? f.delete(c) : f.add(c), f;
1239
+ function ft({ interrupt: t, onRespond: a, disabled: n, initialValue: s }) {
1240
+ const r = (t.options ?? []).map(gt), [i, o] = E(
1241
+ () => 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;
1064
1246
  });
1065
1247
  };
1066
- return /* @__PURE__ */ d("div", { className: "sa-interrupt-card", children: [
1067
- /* @__PURE__ */ d("div", { className: "sa-interrupt-content", children: [
1068
- /* @__PURE__ */ e(I, { name: "list-checks", size: 16, color: "#6366f1" }),
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" }),
1069
1251
  /* @__PURE__ */ e("span", { children: t.content })
1070
1252
  ] }),
1071
- /* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((c) => /* @__PURE__ */ d(
1253
+ /* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((d) => /* @__PURE__ */ c(
1072
1254
  "button",
1073
1255
  {
1074
- className: `sa-interrupt-option ${i.has(c.value) ? "sa-interrupt-option-selected" : ""}`,
1075
- disabled: s,
1076
- onClick: () => l(c.value),
1256
+ className: `sa-interrupt-option ${i.has(d.value) ? "sa-interrupt-option-selected" : ""}`,
1257
+ disabled: n,
1258
+ onClick: () => l(d.value),
1077
1259
  children: [
1078
- /* @__PURE__ */ e(I, { name: i.has(c.value) ? "square-check" : "square", size: 14 }),
1079
- /* @__PURE__ */ e("span", { children: c.label })
1260
+ /* @__PURE__ */ e(B, { name: i.has(d.value) ? "square-check" : "square", size: 14 }),
1261
+ /* @__PURE__ */ e("span", { children: d.label })
1080
1262
  ]
1081
1263
  },
1082
- c.value
1264
+ d.value
1083
1265
  )) }),
1084
- !s && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */ d(
1266
+ !n && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */ c(
1085
1267
  "button",
1086
1268
  {
1087
1269
  className: "sa-interrupt-btn sa-interrupt-btn-primary",
1088
1270
  disabled: i.size === 0,
1089
1271
  onClick: () => a({ action: "submit", value: Array.from(i) }),
1090
1272
  children: [
1091
- /* @__PURE__ */ e(I, { name: "check", size: 14 }),
1273
+ /* @__PURE__ */ e(B, { name: "check", size: 14 }),
1092
1274
  " 确认 (",
1093
1275
  i.size,
1094
1276
  ")"
1095
1277
  ]
1096
1278
  }
1097
1279
  ) }),
1098
- s && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1280
+ n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1099
1281
  ] });
1100
1282
  }
1101
- function We({ interrupt: t, onRespond: a, disabled: s, initialValue: n }) {
1102
- const [r, i] = M(n ?? ""), o = t.inputType ?? "text", l = o === "textarea", c = () => {
1103
- s || t.required && !r.trim() || a({ action: "submit", value: r.trim() });
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 = () => {
1285
+ n || t.required && !r.trim() || a({ action: "submit", value: r.trim() });
1104
1286
  };
1105
- return /* @__PURE__ */ d("div", { className: "sa-interrupt-card", children: [
1106
- /* @__PURE__ */ d("div", { className: "sa-interrupt-content", children: [
1107
- /* @__PURE__ */ e(I, { name: "text-cursor-input", size: 16, color: "#6366f1" }),
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" }),
1108
1290
  /* @__PURE__ */ e("span", { children: t.content })
1109
1291
  ] }),
1110
1292
  /* @__PURE__ */ e("div", { className: "sa-interrupt-input-area", children: l ? /* @__PURE__ */ e(
@@ -1116,7 +1298,7 @@ function We({ interrupt: t, onRespond: a, disabled: s, initialValue: n }) {
1116
1298
  placeholder: t.placeholder,
1117
1299
  maxLength: t.maxLength,
1118
1300
  rows: 3,
1119
- disabled: s
1301
+ disabled: n
1120
1302
  }
1121
1303
  ) : /* @__PURE__ */ e(
1122
1304
  "input",
@@ -1127,82 +1309,82 @@ function We({ interrupt: t, onRespond: a, disabled: s, initialValue: n }) {
1127
1309
  onChange: (p) => i(p.target.value),
1128
1310
  placeholder: t.placeholder,
1129
1311
  maxLength: t.maxLength,
1130
- onKeyDown: (p) => p.key === "Enter" && c(),
1131
- disabled: s
1312
+ onKeyDown: (p) => p.key === "Enter" && d(),
1313
+ disabled: n
1132
1314
  }
1133
1315
  ) }),
1134
- !s && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */ d(
1316
+ !n && /* @__PURE__ */ e("div", { className: "sa-interrupt-actions", children: /* @__PURE__ */ c(
1135
1317
  "button",
1136
1318
  {
1137
1319
  className: "sa-interrupt-btn sa-interrupt-btn-primary",
1138
1320
  disabled: t.required ? !r.trim() : !1,
1139
- onClick: c,
1321
+ onClick: d,
1140
1322
  children: [
1141
- /* @__PURE__ */ e(I, { name: "check", size: 14 }),
1323
+ /* @__PURE__ */ e(B, { name: "check", size: 14 }),
1142
1324
  " 提交"
1143
1325
  ]
1144
1326
  }
1145
1327
  ) }),
1146
- s && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1328
+ n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1147
1329
  ] });
1148
1330
  }
1149
- function Ke({ interrupt: t, onRespond: a, disabled: s, initialValue: n }) {
1150
- const r = t.fields ?? [], [i, o] = M(() => {
1151
- const f = {};
1152
- for (const h of r)
1153
- f[h.name] = (n == null ? void 0 : n[h.name]) ?? h.defaultValue ?? "";
1154
- return f;
1155
- }), l = (f, h) => {
1156
- s || o((w) => ({ ...w, [f]: h }));
1157
- }, c = !s && r.every((f) => !f.required || i[f.name]), p = () => {
1158
- c && a({ action: "submit", value: i });
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 });
1159
1341
  };
1160
- return /* @__PURE__ */ d("div", { className: "sa-interrupt-card", children: [
1161
- /* @__PURE__ */ d("div", { className: "sa-interrupt-content", children: [
1162
- /* @__PURE__ */ e(I, { name: "file-text", size: 16, color: "#6366f1" }),
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" }),
1163
1345
  /* @__PURE__ */ e("span", { children: t.content })
1164
1346
  ] }),
1165
- /* @__PURE__ */ e("div", { className: "sa-interrupt-form", children: r.map((f) => /* @__PURE__ */ d("div", { className: "sa-interrupt-form-field", children: [
1166
- /* @__PURE__ */ d("label", { className: "sa-interrupt-form-label", children: [
1167
- f.label,
1168
- f.required && /* @__PURE__ */ e("span", { className: "sa-interrupt-form-required", children: "*" })
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: "*" })
1169
1351
  ] }),
1170
- Ye(f, i[f.name], (h) => l(f.name, h), s)
1171
- ] }, f.name)) }),
1172
- !s && /* @__PURE__ */ d("div", { className: "sa-interrupt-actions", children: [
1173
- /* @__PURE__ */ d("button", { className: "sa-interrupt-btn sa-interrupt-btn-primary", disabled: !c, onClick: p, children: [
1174
- /* @__PURE__ */ e(I, { name: "check", size: 14 }),
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 }),
1175
1357
  " 提交"
1176
1358
  ] }),
1177
1359
  /* @__PURE__ */ e("button", { className: "sa-interrupt-btn sa-interrupt-btn-secondary", onClick: () => a({ action: "cancel" }), children: "取消" })
1178
1360
  ] }),
1179
- s && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1361
+ n && /* @__PURE__ */ e("div", { className: "sa-interrupt-submitted", children: "已提交" })
1180
1362
  ] });
1181
1363
  }
1182
- function se(t) {
1364
+ function ze(t) {
1183
1365
  return typeof t == "string" ? { value: t, label: t } : t;
1184
1366
  }
1185
- function Ye(t, a, s, n) {
1367
+ function xt(t, a, n, s) {
1186
1368
  switch (t.type) {
1187
1369
  case "textarea":
1188
- return /* @__PURE__ */ e("textarea", { className: "sa-interrupt-textarea", value: a, onChange: (r) => s(r.target.value), placeholder: t.placeholder, rows: 3, disabled: n });
1370
+ return /* @__PURE__ */ e("textarea", { className: "sa-interrupt-textarea", value: a, onChange: (r) => n(r.target.value), placeholder: t.placeholder, rows: 3, disabled: s });
1189
1371
  case "select": {
1190
- const r = (t.options ?? []).map(se);
1191
- return /* @__PURE__ */ d("select", { className: "sa-interrupt-select", value: a, onChange: (i) => s(i.target.value), disabled: n, children: [
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: [
1192
1374
  /* @__PURE__ */ e("option", { value: "", children: "请选择" }),
1193
1375
  r.map((i) => /* @__PURE__ */ e("option", { value: i.value, children: i.label }, i.value))
1194
1376
  ] });
1195
1377
  }
1196
1378
  case "multiSelect": {
1197
- const r = (t.options ?? []).map(se), i = Array.isArray(a) ? a : [], o = (l) => {
1198
- n || s(i.includes(l) ? i.filter((c) => c !== l) : [...i, l]);
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]);
1199
1381
  };
1200
1382
  return /* @__PURE__ */ e("div", { className: "sa-interrupt-options", children: r.map((l) => /* @__PURE__ */ e(
1201
1383
  "button",
1202
1384
  {
1203
1385
  type: "button",
1204
1386
  className: `sa-interrupt-option ${i.includes(l.value) ? "sa-interrupt-option-selected" : ""}`,
1205
- disabled: n,
1387
+ disabled: s,
1206
1388
  onClick: () => o(l.value),
1207
1389
  children: l.label
1208
1390
  },
@@ -1210,34 +1392,34 @@ function Ye(t, a, s, n) {
1210
1392
  )) });
1211
1393
  }
1212
1394
  case "password":
1213
- return /* @__PURE__ */ e("input", { className: "sa-interrupt-input", type: "password", value: a, onChange: (r) => s(r.target.value), placeholder: t.placeholder, disabled: n });
1395
+ return /* @__PURE__ */ e("input", { className: "sa-interrupt-input", type: "password", value: a, onChange: (r) => n(r.target.value), placeholder: t.placeholder, disabled: s });
1214
1396
  default:
1215
- return /* @__PURE__ */ e("input", { className: "sa-interrupt-input", type: t.type === "number" ? "number" : t.type === "date" ? "date" : "text", value: a, onChange: (r) => s(r.target.value), placeholder: t.placeholder, disabled: n });
1397
+ 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 });
1216
1398
  }
1217
1399
  }
1218
- function Ue({ interrupt: t, resolved: a, response: s, onRespond: n }) {
1219
- const r = a, i = s == null ? void 0 : s.value;
1400
+ function wt({ interrupt: t, resolved: a, response: n, onRespond: s }) {
1401
+ const r = a, i = n == null ? void 0 : n.value;
1220
1402
  switch (t.interruptType) {
1221
1403
  case "confirm":
1222
- return /* @__PURE__ */ e(Pe, { interrupt: t, onRespond: n, disabled: r, answeredAction: s == null ? void 0 : s.action });
1404
+ return /* @__PURE__ */ e(dt, { interrupt: t, onRespond: s, disabled: r, answeredAction: n == null ? void 0 : n.action });
1223
1405
  case "approve":
1224
- return /* @__PURE__ */ e(He, { interrupt: t, onRespond: n, disabled: r, answeredAction: s == null ? void 0 : s.action });
1406
+ return /* @__PURE__ */ e(ct, { interrupt: t, onRespond: s, disabled: r, answeredAction: n == null ? void 0 : n.action });
1225
1407
  case "select":
1226
- return /* @__PURE__ */ e(Be, { interrupt: t, onRespond: n, disabled: r, initialValue: i });
1408
+ return /* @__PURE__ */ e(ut, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1227
1409
  case "multiSelect":
1228
- return /* @__PURE__ */ e(Fe, { interrupt: t, onRespond: n, disabled: r, initialValue: i });
1410
+ return /* @__PURE__ */ e(ft, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1229
1411
  case "input":
1230
- return /* @__PURE__ */ e(We, { interrupt: t, onRespond: n, disabled: r, initialValue: i });
1412
+ return /* @__PURE__ */ e(ht, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1231
1413
  case "form":
1232
- return /* @__PURE__ */ e(Ke, { interrupt: t, onRespond: n, disabled: r, initialValue: i });
1414
+ return /* @__PURE__ */ e(mt, { interrupt: t, onRespond: s, disabled: r, initialValue: i });
1233
1415
  default:
1234
- return /* @__PURE__ */ d("div", { className: "sa-interrupt-unknown", children: [
1416
+ return /* @__PURE__ */ c("div", { className: "sa-interrupt-unknown", children: [
1235
1417
  "未知的交互类型: ",
1236
1418
  t.interruptType
1237
1419
  ] });
1238
1420
  }
1239
1421
  }
1240
- const qe = [
1422
+ const bt = [
1241
1423
  { value: 1, label: "事实错误" },
1242
1424
  { value: 2, label: "逻辑问题" },
1243
1425
  { value: 3, label: "不相关" },
@@ -1245,75 +1427,75 @@ const qe = [
1245
1427
  { value: 5, label: "冗长啰嗦" },
1246
1428
  { value: 6, label: "难以理解" }
1247
1429
  ];
1248
- function Ve({ message: t, onCopy: a, onRegenerate: s, onFeedback: n }) {
1249
- const { status: r, cancelFeedback: i } = Y(), [o, l] = M(null), [c, p] = M(!1), [f, h] = M(!1), w = _(null), u = C(() => {
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(() => {
1250
1432
  a(), p(!0), setTimeout(() => p(!1), 2e3);
1251
- }, [a]), m = C(() => {
1252
- o === "like" ? (l(null), i(t.id)) : (l("like"), h(!1), n == null || n(t.id, "like"));
1253
- }, [o, t.id, n, i]), v = C(() => {
1254
- o === "dislike" ? (l(null), h(!1), i(t.id)) : h(!0);
1255
- }, [o, t.id, i]), S = C((A, x) => {
1256
- l("dislike"), h(!1), n == null || n(t.id, "dislike", { reason: A, remark: (x == null ? void 0 : x.trim()) || void 0 });
1257
- }, [t.id, n]), T = C(() => {
1258
- h(!1);
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);
1259
1441
  }, []);
1260
- return B(() => {
1261
- if (!f) return;
1262
- const A = (z) => {
1263
- w.current && !w.current.contains(z.target) && h(!1);
1264
- }, x = (z) => {
1265
- z.key === "Escape" && h(!1);
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);
1266
1448
  };
1267
- return document.addEventListener("mousedown", A), document.addEventListener("keydown", x), () => {
1268
- document.removeEventListener("mousedown", A), document.removeEventListener("keydown", x);
1449
+ return document.addEventListener("mousedown", H), document.addEventListener("keydown", k), () => {
1450
+ document.removeEventListener("mousedown", H), document.removeEventListener("keydown", k);
1269
1451
  };
1270
- }, [f]), r !== "ready" && r !== "error" ? null : /* @__PURE__ */ d("div", { className: "sa-action-bar", children: [
1271
- /* @__PURE__ */ d("button", { className: "sa-action-btn", onClick: u, title: "复制", children: [
1272
- /* @__PURE__ */ e(I, { name: c ? "circle-check" : "copy", size: 14 }),
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 }),
1273
1455
  " ",
1274
- c ? "已复制" : "复制"
1456
+ d ? "已复制" : "复制"
1275
1457
  ] }),
1276
- s && /* @__PURE__ */ d("button", { className: "sa-action-btn", onClick: s, title: "重新生成", children: [
1277
- /* @__PURE__ */ e(I, { name: "refresh-cw", size: 14 }),
1458
+ n && /* @__PURE__ */ c("button", { className: "sa-action-btn", onClick: n, title: "重新生成", children: [
1459
+ /* @__PURE__ */ e(B, { name: "refresh-cw", size: 14 }),
1278
1460
  " 重新生成"
1279
1461
  ] }),
1280
- n && /* @__PURE__ */ d(q, { children: [
1462
+ s && /* @__PURE__ */ c(V, { children: [
1281
1463
  /* @__PURE__ */ e("span", { className: "sa-action-divider" }),
1282
1464
  /* @__PURE__ */ e(
1283
1465
  "button",
1284
1466
  {
1285
1467
  className: `sa-action-btn ${o === "like" ? "sa-action-btn-active" : ""}`,
1286
- onClick: m,
1468
+ onClick: x,
1287
1469
  title: "有用",
1288
1470
  "aria-label": "点赞",
1289
- children: /* @__PURE__ */ e(I, { name: "thumbs-up", size: 14 })
1471
+ children: /* @__PURE__ */ e(B, { name: "thumbs-up", size: 14 })
1290
1472
  }
1291
1473
  ),
1292
1474
  /* @__PURE__ */ e(
1293
1475
  "button",
1294
1476
  {
1295
1477
  className: `sa-action-btn ${o === "dislike" ? "sa-action-btn-active" : ""}`,
1296
- onClick: v,
1478
+ onClick: f,
1297
1479
  title: "无用",
1298
1480
  "aria-label": "踩",
1299
- "aria-expanded": f,
1481
+ "aria-expanded": u,
1300
1482
  "aria-haspopup": "dialog",
1301
- children: /* @__PURE__ */ e(I, { name: "thumbs-down", size: 14 })
1483
+ children: /* @__PURE__ */ e(B, { name: "thumbs-down", size: 14 })
1302
1484
  }
1303
1485
  )
1304
1486
  ] }),
1305
- f && /* @__PURE__ */ e("div", { ref: w, children: /* @__PURE__ */ e(Xe, { onSubmit: S, onCancel: T }) })
1487
+ u && /* @__PURE__ */ e("div", { ref: b, children: /* @__PURE__ */ e(yt, { onSubmit: y, onCancel: z }) })
1306
1488
  ] });
1307
1489
  }
1308
- function Xe({ onSubmit: t, onCancel: a }) {
1309
- const [s, n] = M(void 0), [r, i] = M("");
1310
- return /* @__PURE__ */ d("div", { className: "sa-dislike-panel", children: [
1490
+ function yt({ onSubmit: t, onCancel: a }) {
1491
+ const [n, s] = E(void 0), [r, i] = E("");
1492
+ return /* @__PURE__ */ c("div", { className: "sa-dislike-panel", children: [
1311
1493
  /* @__PURE__ */ e("div", { className: "sa-dislike-panel-title", children: "请选择不满意的原因(可选)" }),
1312
- /* @__PURE__ */ e("div", { className: "sa-dislike-reasons", children: qe.map((o) => /* @__PURE__ */ e(
1494
+ /* @__PURE__ */ e("div", { className: "sa-dislike-reasons", children: bt.map((o) => /* @__PURE__ */ e(
1313
1495
  "button",
1314
1496
  {
1315
- className: `sa-dislike-reason-btn ${s === o.value ? "active" : ""}`,
1316
- onClick: () => n(s === o.value ? void 0 : o.value),
1497
+ className: `sa-dislike-reason-btn ${n === o.value ? "active" : ""}`,
1498
+ onClick: () => s(n === o.value ? void 0 : o.value),
1317
1499
  children: o.label
1318
1500
  },
1319
1501
  o.value
@@ -1329,196 +1511,229 @@ function Xe({ onSubmit: t, onCancel: a }) {
1329
1511
  rows: 2
1330
1512
  }
1331
1513
  ),
1332
- /* @__PURE__ */ d("div", { className: "sa-dislike-actions", children: [
1333
- /* @__PURE__ */ e("button", { className: "sa-dislike-submit", onClick: () => t(s, r || void 0), children: "提交" }),
1514
+ /* @__PURE__ */ c("div", { className: "sa-dislike-actions", children: [
1515
+ /* @__PURE__ */ e("button", { className: "sa-dislike-submit", onClick: () => t(n, r || void 0), children: "提交" }),
1334
1516
  /* @__PURE__ */ e("button", { className: "sa-dislike-cancel", onClick: a, children: "取消" })
1335
1517
  ] })
1336
1518
  ] });
1337
1519
  }
1338
- function ne({ src: t, role: a }) {
1339
- const s = a === "assistant" ? "A" : "U";
1340
- return t ? t.startsWith("http") || t.startsWith("/") || t.startsWith("data:") ? /* @__PURE__ */ e("div", { className: `sa-avatar sa-avatar-${a}`, children: /* @__PURE__ */ e(
1341
- "img",
1342
- {
1343
- src: t,
1344
- alt: a,
1345
- style: {
1346
- width: "100%",
1347
- height: "100%",
1348
- borderRadius: "inherit",
1349
- objectFit: "cover"
1350
- }
1351
- }
1352
- ) }) : /* @__PURE__ */ e("div", { className: `sa-avatar sa-avatar-${a}`, children: t }) : /* @__PURE__ */ e("div", { className: `sa-avatar sa-avatar-${a}`, children: s });
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;
1353
1523
  }
1354
- function Ge({
1524
+ function Ct({
1355
1525
  message: t,
1356
1526
  isStreaming: a,
1357
- isLast: s,
1358
- slots: n,
1527
+ isLast: n,
1528
+ slots: s,
1359
1529
  avatar: r,
1360
- artifactPreview: i
1530
+ artifactPreview: i,
1531
+ showTimestamp: o
1361
1532
  }) {
1362
- const { regenerate: o, feedback: l, respondToInterrupt: c } = Y(), p = C(() => {
1363
- var z;
1364
- const x = t.parts.filter(($) => $.type === "text").map(($) => $.content).join(`
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(`
1365
1536
  `);
1366
- (z = navigator.clipboard) == null || z.writeText(x).catch(() => {
1537
+ (S = navigator.clipboard) == null || S.writeText(C).catch(() => {
1367
1538
  });
1368
- }, [t]), f = t.role === "user", h = n.Message;
1369
- if (h)
1539
+ }, [t]), g = t.role === "user", b = s.Message;
1540
+ if (b)
1370
1541
  return /* @__PURE__ */ e(
1371
- h,
1542
+ b,
1372
1543
  {
1373
1544
  message: t,
1374
1545
  isStreaming: a,
1375
- isLast: s,
1546
+ isLast: n,
1376
1547
  avatar: r,
1377
- slots: n,
1378
- onCopy: p,
1379
- onRegenerate: o,
1380
- onFeedback: l
1548
+ slots: s,
1549
+ onCopy: u,
1550
+ onRegenerate: l,
1551
+ onFeedback: d,
1552
+ showTimestamp: o
1381
1553
  }
1382
1554
  );
1383
- const w = n.TextPart ?? De, u = n.ThinkingPart ?? Le, m = n.ToolCallPart ?? Ee, v = n.ToolResultPart ?? Re, S = n.ErrorPart ?? Oe, T = n.ActionBar ?? Ve, A = !f && t.parts.some((x) => x.type === "text" && x.content);
1384
- return /* @__PURE__ */ d(
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(
1385
1557
  "div",
1386
1558
  {
1387
- className: `sa-message ${f ? "sa-message-user" : "sa-message-assistant"}`,
1559
+ className: `sa-message ${g ? "sa-message-user" : "sa-message-assistant"}`,
1388
1560
  children: [
1389
- !f && /* @__PURE__ */ e(ne, { src: r == null ? void 0 : r.assistant, role: "assistant" }),
1390
- /* @__PURE__ */ d("div", { className: "sa-message-content", children: [
1391
- /* @__PURE__ */ e(
1561
+ !g && /* @__PURE__ */ e(
1562
+ Ie,
1563
+ {
1564
+ src: (r == null ? void 0 : r.assistant) || (a && n ? X.assistantAvatarGenerating : X.assistantAvatar),
1565
+ alt: "AI"
1566
+ }
1567
+ ),
1568
+ /* @__PURE__ */ c("div", { className: "sa-message-content", children: [
1569
+ o && /* @__PURE__ */ e(
1392
1570
  "span",
1393
1571
  {
1394
- className: `sa-message-time ${f ? "sa-message-time-right" : ""}`,
1395
- children: pe(t.timestamp)
1572
+ className: `sa-message-time ${g ? "sa-message-time-right" : ""}`,
1573
+ children: Ze(t.timestamp)
1396
1574
  }
1397
1575
  ),
1398
- /* @__PURE__ */ d("div", { className: "sa-message-body", children: [
1399
- t.parts.map((x, z) => {
1400
- switch (x.type) {
1576
+ /* @__PURE__ */ c("div", { className: "sa-message-body", children: [
1577
+ t.parts.map((C, S) => {
1578
+ switch (C.type) {
1401
1579
  case "text":
1402
- return /* @__PURE__ */ e(w, { content: x.content }, z);
1580
+ return /* @__PURE__ */ e(m, { content: C.content }, S);
1403
1581
  case "thinking":
1404
- return /* @__PURE__ */ e(u, { content: x.content }, z);
1582
+ return /* @__PURE__ */ e(x, { content: C.content }, S);
1405
1583
  case "tool_call":
1406
1584
  return /* @__PURE__ */ e(
1407
- m,
1585
+ f,
1408
1586
  {
1409
- toolName: x.toolName,
1410
- toolCallId: x.toolCallId,
1411
- args: x.args
1587
+ toolName: C.toolName,
1588
+ toolCallId: C.toolCallId,
1589
+ args: C.args
1412
1590
  },
1413
- z
1591
+ S
1414
1592
  );
1415
1593
  case "tool_result":
1416
1594
  return /* @__PURE__ */ e(
1417
- v,
1595
+ y,
1418
1596
  {
1419
- toolName: x.toolName,
1420
- toolCallId: x.toolCallId,
1421
- content: x.content,
1422
- artifacts: x.artifacts,
1423
- renderMode: x.renderMode,
1424
- html: x.html,
1597
+ toolName: C.toolName,
1598
+ toolCallId: C.toolCallId,
1599
+ content: C.content,
1600
+ artifacts: C.artifacts,
1601
+ renderMode: C.renderMode,
1602
+ html: C.html,
1425
1603
  artifactPreview: i
1426
1604
  },
1427
- z
1605
+ S
1428
1606
  );
1429
1607
  case "error":
1430
1608
  return /* @__PURE__ */ e(
1431
- S,
1609
+ z,
1432
1610
  {
1433
- content: x.content,
1434
- onRetry: o
1611
+ content: C.content,
1612
+ onRetry: l
1435
1613
  },
1436
- z
1614
+ S
1437
1615
  );
1438
1616
  case "interrupt":
1439
1617
  return /* @__PURE__ */ e(
1440
- Ue,
1618
+ wt,
1441
1619
  {
1442
- interrupt: x.interrupt,
1443
- resolved: x.resolved ?? !1,
1444
- response: x.response,
1445
- onRespond: ($) => c(x.interrupt.interruptId, $)
1620
+ interrupt: C.interrupt,
1621
+ resolved: C.resolved ?? !1,
1622
+ response: C.response,
1623
+ onRespond: (D) => p(C.interrupt.interruptId, D)
1446
1624
  },
1447
- z
1625
+ S
1448
1626
  );
1449
1627
  default:
1450
1628
  return null;
1451
1629
  }
1452
1630
  }),
1453
- a && s && !f && /* @__PURE__ */ e("span", { className: "sa-streaming-cursor", children: "|" }),
1454
- !f && !a && A && /* @__PURE__ */ e(
1455
- T,
1631
+ a && n && !g && !k && /* @__PURE__ */ e("span", { className: "sa-thinking-indicator", children: "思考中…" }),
1632
+ !g && !a && k && /* @__PURE__ */ e(
1633
+ H,
1456
1634
  {
1457
1635
  message: t,
1458
- onCopy: p,
1459
- onRegenerate: s ? o : void 0,
1460
- onFeedback: l
1636
+ onCopy: u,
1637
+ onRegenerate: n ? l : void 0,
1638
+ onFeedback: d
1461
1639
  }
1462
1640
  )
1463
1641
  ] })
1464
1642
  ] }),
1465
- f && /* @__PURE__ */ e(ne, { src: r == null ? void 0 : r.user, role: "user" })
1643
+ g && (r == null ? void 0 : r.user) && /* @__PURE__ */ e(Ie, { src: r.user, alt: "用户" })
1466
1644
  ]
1467
1645
  }
1468
1646
  );
1469
1647
  }
1470
- function Je({ message: t, suggestedPrompts: a, onPromptClick: s }) {
1471
- return /* @__PURE__ */ d("div", { className: "sa-welcome", children: [
1472
- /* @__PURE__ */ e("div", { className: "sa-welcome-icon", children: /* @__PURE__ */ e(I, { name: "sparkles", size: 40 }) }),
1473
- /* @__PURE__ */ e("p", { className: "sa-welcome-message", children: t || "你好!有什么可以帮你的?" }),
1474
- a && a.length > 0 && /* @__PURE__ */ e("div", { className: "sa-welcome-prompts", children: a.map((n, r) => /* @__PURE__ */ e(
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 }),
1652
+ /* @__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
+ ] }),
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: [
1658
+ /* @__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 })
1660
+ ] })
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(
1475
1663
  "button",
1476
1664
  {
1477
- className: "sa-welcome-prompt",
1478
- onClick: () => s(n),
1479
- children: n
1665
+ type: "button",
1666
+ 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),
1669
+ children: [
1670
+ /* @__PURE__ */ e("span", { className: "sa-chip-text overflow-hidden text-ellipsis whitespace-nowrap", children: o }),
1671
+ /* @__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
+ ]
1480
1673
  },
1481
- r
1482
- )) })
1674
+ `${o}-${l}`
1675
+ )) }),
1676
+ r && r.length > 0 && /* @__PURE__ */ c("div", { className: "opacity-0 animate-sa-home-fade-in", style: { animationDelay: "420ms" }, children: [
1677
+ /* @__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(
1679
+ "button",
1680
+ {
1681
+ type: "button",
1682
+ 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
+ },
1686
+ 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 })
1689
+ ]
1690
+ },
1691
+ o.label
1692
+ )) })
1693
+ ] })
1483
1694
  ] });
1484
1695
  }
1485
- function fe({ slots: t, welcomeMessage: a, suggestedPrompts: s, avatar: n, artifactPreview: r }) {
1486
- const { messages: i, status: o, sendMessage: l } = Y(), { containerRef: c } = Te([i]), p = o === "streaming", f = t.WelcomeScreen ?? Je;
1487
- return i.length === 0 ? /* @__PURE__ */ e("div", { className: "sa-thread", ref: c, children: /* @__PURE__ */ e(
1488
- f,
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,
1489
1700
  {
1490
1701
  message: a,
1491
- suggestedPrompts: s,
1492
- onPromptClick: l
1702
+ suggestedPrompts: n,
1703
+ onPromptClick: g,
1704
+ capabilities: i,
1705
+ quickLinks: o,
1706
+ logo: l
1493
1707
  }
1494
- ) }) : /* @__PURE__ */ e("div", { className: "sa-thread", ref: c, children: i.map((h, w) => /* @__PURE__ */ e(
1495
- Ge,
1708
+ ) }) : /* @__PURE__ */ e("div", { className: "sa-thread", ref: b, children: p.map((f, y) => /* @__PURE__ */ e(
1709
+ Ct,
1496
1710
  {
1497
- message: h,
1498
- isStreaming: p,
1499
- isLast: w === i.length - 1,
1711
+ message: f,
1712
+ isStreaming: m,
1713
+ isLast: y === p.length - 1,
1500
1714
  slots: t,
1501
- avatar: n,
1502
- artifactPreview: r
1715
+ avatar: s,
1716
+ artifactPreview: r,
1717
+ showTimestamp: d
1503
1718
  },
1504
- h.id
1719
+ f.id
1505
1720
  )) });
1506
1721
  }
1507
- function Ze({ items: t, activeIndex: a, onSelect: s }) {
1508
- const n = _(null);
1509
- return B(() => {
1722
+ function zt({ items: t, activeIndex: a, onSelect: n }) {
1723
+ const s = R(null);
1724
+ return P(() => {
1510
1725
  var i;
1511
- const r = (i = n.current) == null ? void 0 : i.children[a];
1726
+ const r = (i = s.current) == null ? void 0 : i.children[a];
1512
1727
  r == null || r.scrollIntoView({ block: "nearest" });
1513
- }, [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: n, children: t.map((r, i) => /* @__PURE__ */ d(
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(
1514
1729
  "div",
1515
1730
  {
1516
1731
  className: `sa-slash-menu-item${i === a ? " sa-slash-menu-item--active" : ""}`,
1517
1732
  onMouseDown: (o) => {
1518
- o.preventDefault(), s(r);
1733
+ o.preventDefault(), n(r);
1519
1734
  },
1520
1735
  children: [
1521
- /* @__PURE__ */ d("span", { className: "sa-slash-menu-item-name", children: [
1736
+ /* @__PURE__ */ c("span", { className: "sa-slash-menu-item-name", children: [
1522
1737
  "/",
1523
1738
  r.name
1524
1739
  ] }),
@@ -1528,102 +1743,128 @@ function Ze({ items: t, activeIndex: a, onSelect: s }) {
1528
1743
  r.code
1529
1744
  )) });
1530
1745
  }
1531
- function Qe({ sdk: t, input: a, onSelect: s }) {
1532
- const [n, r] = M([]), [i, o] = M(!1), [l, c] = M(0), p = _(!1);
1533
- B(() => {
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(() => {
1534
1749
  p.current || (p.current = !0, t.listSkills().then(r).catch(() => r([])));
1535
1750
  }, [t]);
1536
- const f = /^\/\S*$/.test(a);
1537
- B(() => {
1538
- o(f);
1539
- }, [f]), B(() => {
1540
- f && c(0);
1541
- }, [a, f]);
1542
- const h = a.startsWith("/") ? a.slice(1).toLowerCase() : "", w = J(
1543
- () => n.filter(
1544
- (x) => !h || x.code.toLowerCase().includes(h) || x.name.toLowerCase().includes(h) || x.displayName && x.displayName.toLowerCase().includes(h)
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(
1758
+ () => s.filter(
1759
+ (k) => !g || k.code.toLowerCase().includes(g) || k.name.toLowerCase().includes(g) || k.displayName && k.displayName.toLowerCase().includes(g)
1545
1760
  ),
1546
- [n, h]
1547
- ), u = _(i), m = _(w), v = _(l), S = _(s);
1548
- u.current = i, m.current = w, v.current = l, S.current = s;
1549
- const T = C((x) => {
1550
- if (!u.current || m.current.length === 0) return !1;
1551
- switch (x.key) {
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) {
1552
1767
  case "ArrowDown":
1553
- return x.preventDefault(), c((z) => (z + 1) % m.current.length), !0;
1768
+ return k.preventDefault(), d((C) => (C + 1) % x.current.length), !0;
1554
1769
  case "ArrowUp":
1555
- return x.preventDefault(), c((z) => (z - 1 + m.current.length) % m.current.length), !0;
1770
+ return k.preventDefault(), d((C) => (C - 1 + x.current.length) % x.current.length), !0;
1556
1771
  case "Enter":
1557
1772
  case "Tab":
1558
- return x.preventDefault(), S.current(m.current[v.current]), o(!1), !0;
1773
+ return k.preventDefault(), y.current(x.current[f.current]), o(!1), !0;
1559
1774
  case "Escape":
1560
- return x.preventDefault(), o(!1), !0;
1775
+ return k.preventDefault(), o(!1), !0;
1561
1776
  default:
1562
1777
  return !1;
1563
1778
  }
1564
- }, []), A = C(() => o(!1), []);
1565
- return { isOpen: i, items: w, activeIndex: l, handleKeyDown: T, close: A };
1779
+ }, []), H = N(() => o(!1), []);
1780
+ return { isOpen: i, items: b, activeIndex: l, handleKeyDown: z, close: H };
1566
1781
  }
1567
- function ue() {
1568
- const { status: t, sendMessage: a, stop: s, sdk: n } = Y(), [r, i] = M(""), o = _(null), l = t === "streaming" || t === "submitted", c = C((u) => {
1569
- i(`/${u.name} `), setTimeout(() => {
1570
- const m = o.current;
1571
- m && (m.focus(), m.selectionStart = m.selectionEnd = m.value.length);
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);
1572
1787
  }, 0);
1573
- }, []), p = Qe({
1574
- sdk: n,
1788
+ }, []), u = It({
1789
+ sdk: s,
1575
1790
  input: r,
1576
- onSelect: c
1577
- }), f = C(() => {
1578
- const u = r.trim();
1579
- !u || l || (a(u), i(""), o.current && (o.current.style.height = "auto"));
1580
- }, [r, l, a]), h = C((u) => {
1581
- p.handleKeyDown(u) || u.key === "Enter" && !u.shiftKey && (u.preventDefault(), f());
1582
- }, [f, p.handleKeyDown]), w = C((u) => {
1583
- i(u.target.value);
1584
- const m = u.target;
1585
- m.style.height = "auto", m.style.height = Math.min(m.scrollHeight, 120) + "px";
1586
- }, []);
1587
- return /* @__PURE__ */ d("div", { className: "sa-composer", children: [
1588
- p.isOpen && /* @__PURE__ */ e(
1589
- Ze,
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,
1590
1808
  {
1591
- items: p.items,
1592
- activeIndex: p.activeIndex,
1593
- onSelect: c
1809
+ items: u.items,
1810
+ activeIndex: u.activeIndex,
1811
+ onSelect: p
1594
1812
  }
1595
1813
  ),
1596
- /* @__PURE__ */ e(
1597
- "textarea",
1814
+ /* @__PURE__ */ c(
1815
+ "form",
1598
1816
  {
1599
- ref: o,
1600
- className: "sa-composer-input",
1601
- value: r,
1602
- onChange: w,
1603
- onKeyDown: h,
1604
- placeholder: l ? "回答生成中..." : "输入消息,按 / 选择技能...",
1605
- rows: 1,
1606
- disabled: l
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();
1821
+ },
1822
+ children: [
1823
+ /* @__PURE__ */ e(
1824
+ "textarea",
1825
+ {
1826
+ ref: o,
1827
+ 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
+ value: r,
1829
+ onChange: m,
1830
+ onKeyDown: b,
1831
+ placeholder: "请输入你想要了解的关键词",
1832
+ rows: 1,
1833
+ disabled: l
1834
+ }
1835
+ ),
1836
+ l ? /* @__PURE__ */ e(
1837
+ "button",
1838
+ {
1839
+ type: "button",
1840
+ className: "sa-send-btn sa-send-btn-active",
1841
+ "aria-label": "停止生成",
1842
+ title: "停止生成",
1843
+ onClick: n,
1844
+ children: /* @__PURE__ */ e("span", { className: "sa-stop-icon" })
1845
+ }
1846
+ ) : /* @__PURE__ */ e(
1847
+ "button",
1848
+ {
1849
+ type: "submit",
1850
+ className: `sa-send-btn ${r.trim() ? "sa-send-btn-active" : ""}`,
1851
+ "aria-label": "发送",
1852
+ title: "发送",
1853
+ children: /* @__PURE__ */ e("img", { src: X.sendSolid, alt: "发送", width: 14, height: 14, draggable: !1 })
1854
+ }
1855
+ )
1856
+ ]
1607
1857
  }
1608
1858
  ),
1609
- l ? /* @__PURE__ */ e("button", { className: "sa-composer-stop", onClick: s, title: "停止", children: /* @__PURE__ */ e(I, { name: "circle-stop", size: 16, color: "#fff" }) }) : /* @__PURE__ */ e(
1610
- "button",
1611
- {
1612
- className: "sa-composer-send",
1613
- onClick: f,
1614
- disabled: !r.trim(),
1615
- title: "发送",
1616
- children: /* @__PURE__ */ e(I, { name: "arrow-up", size: 16, color: "#fff" })
1617
- }
1618
- )
1859
+ /* @__PURE__ */ e("div", { className: "mt-3 text-center text-[11px] leading-none text-[#B8B8B8]", children: "所有内容均由AI生成仅供参考" })
1619
1860
  ] });
1620
1861
  }
1621
- function et({ artifact: t }) {
1622
- const [a, s] = V.useState(null), [n, r] = V.useState(!0), [i, o] = V.useState(null);
1623
- return V.useEffect(() => {
1862
+ function Tt({ artifact: t }) {
1863
+ const [a, n] = Q.useState(null), [s, r] = Q.useState(!0), [i, o] = Q.useState(null);
1864
+ return Q.useEffect(() => {
1624
1865
  let l = !1;
1625
- r(!0), o(null), s(null);
1626
- async function c() {
1866
+ r(!0), o(null), n(null);
1867
+ async function d() {
1627
1868
  try {
1628
1869
  if (t.type === "pdf") {
1629
1870
  l || r(!1);
@@ -1632,15 +1873,15 @@ function et({ artifact: t }) {
1632
1873
  if (t.type === "html") {
1633
1874
  const p = await fetch(t.url);
1634
1875
  if (!p.ok) throw new Error(`HTTP ${p.status}`);
1635
- const f = await p.text(), h = (await import("./purify.es-C-6FFqDW.js")).default;
1636
- l || (s(h.sanitize(f, { FORCE_BODY: !0, ADD_ATTR: ["target"] })), r(!1));
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));
1637
1878
  return;
1638
1879
  }
1639
1880
  if (t.type === "docx") {
1640
1881
  const p = await fetch(t.url);
1641
1882
  if (!p.ok) throw new Error(`HTTP ${p.status}`);
1642
- const f = await p.arrayBuffer(), w = await (await import("./mammoth.browser-COPV53yV.js").then((m) => m.m)).convertToHtml({ arrayBuffer: f }), u = (await import("./purify.es-C-6FFqDW.js")).default;
1643
- l || (s(u.sanitize(w.value, { FORCE_BODY: !0, ADD_ATTR: ["target"] })), r(!1));
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));
1644
1885
  return;
1645
1886
  }
1646
1887
  l || (r(!1), o(`不支持预览「${t.type}」类型`));
@@ -1648,469 +1889,683 @@ function et({ artifact: t }) {
1648
1889
  l || (r(!1), o(p instanceof Error ? p.message : "加载失败"));
1649
1890
  }
1650
1891
  }
1651
- return c(), () => {
1892
+ return d(), () => {
1652
1893
  l = !0;
1653
1894
  };
1654
- }, [t]), n ? /* @__PURE__ */ e("div", { className: "sa-drawer-preview-loading", children: "加载中" }) : i ? /* @__PURE__ */ d("div", { className: "sa-drawer-preview-error", children: [
1895
+ }, [t]), s ? /* @__PURE__ */ e("div", { className: "sa-drawer-preview-loading", children: "加载中" }) : i ? /* @__PURE__ */ c("div", { className: "sa-drawer-preview-error", children: [
1655
1896
  i,
1656
- /* @__PURE__ */ e("button", { className: "sa-drawer-btn-sm", onClick: () => void Z(t), children: "下载查看" })
1897
+ /* @__PURE__ */ e("button", { className: "sa-drawer-btn-sm", onClick: () => void ie(t), children: "下载查看" })
1657
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;
1658
1899
  }
1659
- function me({ artifacts: t, initialArtifact: a, onClose: s }) {
1660
- const [n, r] = M(
1900
+ function _e({ artifacts: t, initialArtifact: a, onClose: n }) {
1901
+ const [s, r] = E(
1661
1902
  a ? { mode: "preview", artifact: a } : { mode: "list" }
1662
- ), [i, o] = M(!1), l = _(null), [c, p] = M(340), f = _(null);
1663
- B(() => {
1903
+ ), [i, o] = E(!1), l = R(null), [d, p] = E(340), u = R(null);
1904
+ P(() => {
1664
1905
  a && (l.current && (clearTimeout(l.current), l.current = null, o(!1)), r({ mode: "preview", artifact: a }));
1665
1906
  }, [a]);
1666
- const h = C(() => {
1907
+ const g = N(() => {
1667
1908
  o(!0), l.current = setTimeout(() => {
1668
- l.current = null, s();
1909
+ l.current = null, n();
1669
1910
  }, 240);
1670
- }, [s]);
1671
- B(() => () => {
1672
- var v;
1673
- l.current && clearTimeout(l.current), (v = f.current) == null || v.call(f);
1911
+ }, [n]);
1912
+ P(() => () => {
1913
+ var f;
1914
+ l.current && clearTimeout(l.current), (f = u.current) == null || f.call(u);
1674
1915
  }, []);
1675
- const w = C((v) => {
1676
- r({ mode: "preview", artifact: v });
1677
- }, []), u = C(() => {
1916
+ const b = N((f) => {
1917
+ r({ mode: "preview", artifact: f });
1918
+ }, []), m = N(() => {
1678
1919
  r({ mode: "list" });
1679
1920
  }, []);
1680
- B(() => {
1681
- const v = (S) => {
1682
- S.key === "Escape" && h();
1921
+ P(() => {
1922
+ const f = (y) => {
1923
+ y.key === "Escape" && g();
1683
1924
  };
1684
- return document.addEventListener("keydown", v), () => document.removeEventListener("keydown", v);
1685
- }, [h]);
1686
- const m = C((v) => {
1687
- v.preventDefault();
1688
- const S = v.clientX, T = c, A = (z) => {
1689
- const $ = S - z.clientX;
1690
- p(Math.max(240, Math.min(window.innerWidth * 0.7, T + $)));
1691
- }, x = () => {
1692
- document.removeEventListener("mousemove", A), document.removeEventListener("mouseup", x), document.body.style.cursor = "", document.body.style.userSelect = "", f.current = null;
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;
1693
1934
  };
1694
- document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", A), document.addEventListener("mouseup", x), f.current = x;
1695
- }, [c]);
1696
- return /* @__PURE__ */ d("div", { className: `sa-artifact-drawer ${i ? "sa-drawer-closing" : ""}`, style: { width: c }, children: [
1697
- /* @__PURE__ */ e("div", { className: "sa-drawer-resize-handle", onMouseDown: m }),
1698
- /* @__PURE__ */ d("div", { className: "sa-artifact-drawer-header", children: [
1699
- n.mode === "preview" ? /* @__PURE__ */ d(q, { children: [
1700
- /* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: u, 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" }) }) }),
1701
- /* @__PURE__ */ e("span", { className: "sa-artifact-drawer-title", children: n.artifact.filename })
1702
- ] }) : /* @__PURE__ */ d(q, { children: [
1703
- /* @__PURE__ */ d("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", style: { flexShrink: 0 }, children: [
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" }) }) }),
1942
+ /* @__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: [
1704
1945
  /* @__PURE__ */ e("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1705
1946
  /* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" })
1706
1947
  ] }),
1707
1948
  /* @__PURE__ */ e("span", { className: "sa-artifact-drawer-title", children: "会话产物" })
1708
1949
  ] }),
1709
1950
  /* @__PURE__ */ e("div", { style: { flex: 1 } }),
1710
- n.mode === "preview" && /* @__PURE__ */ e("button", { className: "sa-drawer-btn", onClick: () => void Z(n.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" }) }) }),
1711
- /* @__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" }) }) })
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" }) }) })
1712
1953
  ] }),
1713
- /* @__PURE__ */ e("div", { className: "sa-artifact-drawer-body", children: n.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((v, S) => /* @__PURE__ */ d(
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(
1714
1955
  "li",
1715
1956
  {
1716
1957
  className: "sa-drawer-file-card",
1717
- onClick: () => w(v),
1718
- onKeyDown: (T) => {
1719
- (T.key === "Enter" || T.key === " ") && (T.preventDefault(), w(v));
1958
+ onClick: () => b(f),
1959
+ onKeyDown: (z) => {
1960
+ (z.key === "Enter" || z.key === " ") && (z.preventDefault(), b(f));
1720
1961
  },
1721
1962
  tabIndex: 0,
1722
1963
  role: "button",
1723
- "aria-label": `预览 ${v.filename}`,
1964
+ "aria-label": `预览 ${f.filename}`,
1724
1965
  children: [
1725
- /* @__PURE__ */ e("div", { className: "sa-drawer-file-icon", children: /* @__PURE__ */ e("span", { className: "sa-artifact-chip-type", children: le(v.type) }) }),
1726
- /* @__PURE__ */ d("div", { className: "sa-drawer-file-info", children: [
1727
- /* @__PURE__ */ e("span", { className: "sa-drawer-file-name", children: v.filename }),
1728
- /* @__PURE__ */ e("span", { className: "sa-drawer-file-size", children: oe(v.size) })
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) })
1729
1970
  ] }),
1730
1971
  /* @__PURE__ */ e(
1731
1972
  "button",
1732
1973
  {
1733
1974
  className: "sa-drawer-btn",
1734
1975
  title: "下载",
1735
- "aria-label": `下载 ${v.filename}`,
1736
- onClick: (T) => {
1737
- T.stopPropagation(), Z(v);
1976
+ "aria-label": `下载 ${f.filename}`,
1977
+ onClick: (z) => {
1978
+ z.stopPropagation(), ie(f);
1738
1979
  },
1739
1980
  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" }) })
1740
1981
  }
1741
1982
  )
1742
1983
  ]
1743
1984
  },
1744
- v.id || `artifact-${S}`
1745
- )) }) : /* @__PURE__ */ e("div", { className: "sa-drawer-view-enter", children: /* @__PURE__ */ e(et, { artifact: n.artifact }) }) })
1985
+ f.id || `artifact-${y}`
1986
+ )) }) : /* @__PURE__ */ e("div", { className: "sa-drawer-view-enter", children: /* @__PURE__ */ e(Tt, { artifact: s.artifact }) }) })
1746
1987
  ] });
1747
1988
  }
1748
- function tt({ isOpen: t, onClose: a, title: s, slots: n, welcomeMessage: r, suggestedPrompts: i, avatar: o, artifactPreview: l }) {
1749
- const { status: c, sendMessage: p, stop: f, toggleThreadList: h, toggleArtifactDrawer: w, conversations: u, activeConversationId: m, switchConversation: v, newConversation: S, deleteConversation: T, renameConversation: A, isThreadListOpen: x, isArtifactDrawerOpen: z, allArtifacts: $, activePreviewArtifact: P, messagesLoading: N } = Y();
1989
+ function Mt({
1990
+ isOpen: t,
1991
+ onClose: a,
1992
+ title: n,
1993
+ slots: s,
1994
+ welcomeMessage: r,
1995
+ 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
2004
+ }) {
2005
+ 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,
2029
+ hasCustomPosition: Y,
2030
+ isMaximized: j,
2031
+ // 统一由 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,
2042
+ // 大窗不消费窗口几何,无需区分 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,
2054
+ contentSelector: ".sa-panel-content",
2055
+ defaultHeight: b ?? U.DEFAULT_HEIGHT,
2056
+ onHeightChange: oe
2057
+ });
1750
2058
  if (!t) return null;
1751
- const R = n.Header, y = n.Composer, g = n.ThreadList;
1752
- return /* @__PURE__ */ d("div", { className: "sa-panel", children: [
1753
- R ? /* @__PURE__ */ e(R, { title: s, onClose: a, onToggleThreadList: h }) : /* @__PURE__ */ e(
1754
- ze,
1755
- {
1756
- title: s,
1757
- onClose: a,
1758
- onToggleThreadList: h,
1759
- artifactCount: l ? $.length : 0,
1760
- onToggleArtifactDrawer: l ? w : void 0
1761
- }
1762
- ),
1763
- g && x ? /* @__PURE__ */ e(
1764
- g,
1765
- {
1766
- conversations: u,
1767
- activeSessionId: m,
1768
- onSwitch: v,
1769
- onNew: S,
1770
- onDelete: T,
1771
- onRename: A
1772
- }
1773
- ) : /* @__PURE__ */ e(Se, {}),
1774
- /* @__PURE__ */ d("div", { className: "sa-panel-content", children: [
1775
- N ? /* @__PURE__ */ d("div", { className: "sa-messages-loading", children: [
1776
- /* @__PURE__ */ e("span", { className: "sa-loading-spinner" }),
1777
- "加载对话..."
1778
- ] }) : /* @__PURE__ */ e(fe, { slots: n, welcomeMessage: r, suggestedPrompts: i, avatar: o, artifactPreview: l }),
1779
- l && z && /* @__PURE__ */ e(me, { artifacts: $, initialArtifact: P, onClose: w })
1780
- ] }),
1781
- y ? /* @__PURE__ */ e(y, { status: c, onSend: p, onStop: f }) : /* @__PURE__ */ e(ue, {})
1782
- ] });
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 = {
2063
+ title: n,
2064
+ 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(
2082
+ "div",
2083
+ {
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` },
2086
+ children: [
2087
+ le && /* @__PURE__ */ c(V, { children: [
2088
+ /* @__PURE__ */ e("div", { className: "sa-home-gradient pointer-events-none absolute inset-x-0 top-0 z-0 h-[238px] opacity-10" }),
2089
+ /* @__PURE__ */ e("div", { className: "sa-home-gradient-fade pointer-events-none absolute inset-x-0 top-0 z-[1] h-[238px]" })
2090
+ ] }),
2091
+ /* @__PURE__ */ e(
2092
+ "div",
2093
+ {
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 })
2097
+ }
2098
+ ),
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, {}) })
2120
+ ]
2121
+ }
2122
+ );
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(
2127
+ "div",
2128
+ {
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,
2132
+ children: [
2133
+ /* @__PURE__ */ e(
2134
+ "div",
2135
+ {
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")
2138
+ }
2139
+ ),
2140
+ /* @__PURE__ */ e(
2141
+ "div",
2142
+ {
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")
2145
+ }
2146
+ ),
2147
+ k && (se ? /* @__PURE__ */ e(se, { ...we }) : /* @__PURE__ */ e(ke, { width: 200 })),
2148
+ be
2149
+ ]
2150
+ }
2151
+ );
1783
2152
  }
1784
- function at({
2153
+ const Et = () => {
2154
+ };
2155
+ function St({
1785
2156
  conversations: t,
1786
2157
  activeSessionId: a,
1787
- onSwitch: s,
1788
- onNew: n,
2158
+ onSwitch: n,
2159
+ onNew: s,
1789
2160
  onDelete: r,
1790
2161
  onRename: i,
1791
2162
  isCollapsed: o,
1792
2163
  onToggleCollapse: l,
1793
- hasMore: c,
2164
+ hasMore: d,
1794
2165
  onLoadMore: p,
1795
- conversationsLoading: f
2166
+ conversationsLoading: u
1796
2167
  }) {
1797
- const [h, w] = M(null), [u, m] = M(null), [v, S] = M(null), [T, A] = M(""), x = C(
1798
- (y, g) => {
1799
- g.stopPropagation(), u === y ? (r(y), m(null)) : (m(y), setTimeout(() => m(null), 3e3));
2168
+ const [g, b] = E(null), [m, x] = E(null), [f, y] = E(""), [z, H] = E(null), k = R(null);
2169
+ P(
2170
+ () => () => {
2171
+ k.current && clearTimeout(k.current);
2172
+ },
2173
+ []
2174
+ );
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),
2179
+ 3e3
2180
+ ));
1800
2181
  },
1801
- [u, r]
1802
- ), z = C(
1803
- (y, g, E) => {
1804
- E.stopPropagation(), S(y), A(g ?? "");
2182
+ [g, r]
2183
+ ), S = N(
2184
+ (L, v, A) => {
2185
+ A.stopPropagation(), x(L), y(v ?? "");
1805
2186
  },
1806
2187
  []
1807
- ), $ = C(
1808
- (y) => {
1809
- T.trim() && i(y, T.trim()), S(null);
2188
+ ), D = N(
2189
+ (L) => {
2190
+ f.trim() && i(L, f.trim()), x(null);
1810
2191
  },
1811
- [T, i]
1812
- ), P = _(null), N = C(() => {
1813
- const y = P.current;
1814
- !y || !c || !p || y.scrollHeight - y.scrollTop - y.clientHeight < 50 && p();
1815
- }, [c, p]), R = (() => {
1816
- const y = Date.now(), g = [], E = [], L = [];
1817
- for (const O of t) {
1818
- const b = y - new Date(O.updateTime).getTime();
1819
- b < 864e5 ? g.push(O) : b < 6048e5 ? E.push(O) : L.push(O);
1820
- }
1821
- const k = [];
1822
- return g.length && k.push({ label: "今天", items: g }), E.length && k.push({ label: "最近 7 天", items: E }), L.length && k.push({ label: "更早", items: L }), k;
1823
- })();
1824
- return o ? /* @__PURE__ */ d("div", { className: "sa-fp-sidebar sa-fp-sidebar-collapsed", children: [
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),
2198
+ [t]
2199
+ );
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: [
1825
2201
  /* @__PURE__ */ e(
1826
2202
  "button",
1827
2203
  {
1828
- className: "sa-fp-sidebar-toggle",
2204
+ type: "button",
2205
+ className: "sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white",
2206
+ "data-tooltip": "展开",
1829
2207
  onClick: l,
1830
- title: "展开",
1831
- children: /* @__PURE__ */ e(I, { name: "panel-left", size: 18 })
2208
+ children: /* @__PURE__ */ e(B, { name: "panel-left", size: 18 })
1832
2209
  }
1833
2210
  ),
1834
2211
  /* @__PURE__ */ e(
1835
2212
  "button",
1836
2213
  {
1837
- className: "sa-fp-sidebar-toggle",
2214
+ type: "button",
2215
+ className: "sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white",
2216
+ "data-tooltip": "新建对话",
1838
2217
  onClick: () => {
1839
- n(), l();
2218
+ s(), l();
1840
2219
  },
1841
- title: "新会话",
1842
- style: { marginTop: 4 },
1843
- children: /* @__PURE__ */ e(I, { name: "plus", size: 18 })
2220
+ children: /* @__PURE__ */ e("img", { src: X.messageCreate, alt: "", width: 18, height: 18 })
1844
2221
  }
1845
2222
  )
1846
- ] }) : /* @__PURE__ */ d("div", { className: "sa-fp-sidebar", children: [
1847
- /* @__PURE__ */ d("div", { className: "sa-fp-sidebar-header", children: [
1848
- /* @__PURE__ */ d("button", { className: "sa-fp-sidebar-new", onClick: n, children: [
1849
- /* @__PURE__ */ e(I, { name: "plus", size: 15 }),
1850
- " ",
1851
- /* @__PURE__ */ e("span", { children: "新会话" })
1852
- ] }),
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(
2226
+ "button",
2227
+ {
2228
+ type: "button",
2229
+ className: "sa-new-chat flex h-8 flex-1 items-center justify-center gap-2 rounded-md text-[14px] font-medium transition-colors",
2230
+ onClick: s,
2231
+ children: [
2232
+ /* @__PURE__ */ e("img", { src: X.messageCreate, alt: "", width: 18, height: 18 }),
2233
+ /* @__PURE__ */ e("span", { className: "sa-new-chat-text whitespace-nowrap", children: "新建对话" })
2234
+ ]
2235
+ }
2236
+ ),
1853
2237
  /* @__PURE__ */ e(
1854
2238
  "button",
1855
2239
  {
1856
- className: "sa-fp-sidebar-toggle",
2240
+ type: "button",
2241
+ 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
+ "data-tooltip": "收起侧边栏",
1857
2243
  onClick: l,
1858
- title: "收起侧边栏",
1859
- children: /* @__PURE__ */ e(I, { name: "panel-left-close", size: 18 })
2244
+ children: /* @__PURE__ */ e(B, { name: "panel-left-close", size: 16 })
1860
2245
  }
1861
2246
  )
1862
2247
  ] }),
1863
- /* @__PURE__ */ d("div", { className: "sa-fp-sidebar-list", ref: P, onScroll: N, children: [
1864
- f && t.length === 0 && /* @__PURE__ */ e("div", { className: "sa-thread-list-loading", children: "加载中..." }),
1865
- !f && t.length === 0 && /* @__PURE__ */ e("div", { className: "sa-fp-sidebar-empty", children: "开始你的第一个对话" }),
1866
- R.map((y) => /* @__PURE__ */ d("div", { children: [
1867
- /* @__PURE__ */ e("div", { className: "sa-fp-sidebar-group", children: y.label }),
1868
- y.items.map((g) => {
1869
- const E = g.sessionId === a, L = h === g.sessionId, k = u === g.sessionId;
1870
- return /* @__PURE__ */ d(
1871
- "div",
1872
- {
1873
- className: `sa-fp-sidebar-item ${E ? "active" : ""}`,
1874
- onClick: () => {
1875
- v !== g.sessionId && s(g.sessionId);
1876
- },
1877
- onMouseEnter: () => w(g.sessionId),
1878
- onMouseLeave: () => w(null),
1879
- children: [
1880
- v === g.sessionId ? /* @__PURE__ */ e(
1881
- "input",
1882
- {
1883
- className: "sa-fp-sidebar-item-edit",
1884
- value: T,
1885
- onChange: (O) => A(O.target.value),
1886
- onBlur: () => $(g.sessionId),
1887
- onKeyDown: (O) => {
1888
- O.key === "Enter" && $(g.sessionId), O.key === "Escape" && S(null);
1889
- },
1890
- onClick: (O) => O.stopPropagation(),
1891
- autoFocus: !0
1892
- }
1893
- ) : /* @__PURE__ */ e("span", { className: "sa-fp-sidebar-item-title", children: g.title || "新会话" }),
1894
- /* @__PURE__ */ d(
1895
- "div",
1896
- {
1897
- className: `sa-fp-sidebar-item-actions ${L && v !== g.sessionId ? "visible" : ""}`,
1898
- children: [
2248
+ /* @__PURE__ */ c("div", { className: "px-1 pb-2.5", children: [
2249
+ /* @__PURE__ */ e("div", { className: "mb-1 text-[14px] font-semibold text-[#333]", children: "历史对话" }),
2250
+ /* @__PURE__ */ e("div", { className: "text-[11px] text-[#999]", children: "展示最近的会话记录" })
2251
+ ] }),
2252
+ /* @__PURE__ */ c(
2253
+ "div",
2254
+ {
2255
+ ref: w,
2256
+ className: "flex-1 overflow-y-auto",
2257
+ onScroll: M,
2258
+ 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;
2265
+ return /* @__PURE__ */ e(
2266
+ "div",
2267
+ {
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]"}`,
2269
+ onClick: () => {
2270
+ m !== v.sessionId && n(v.sessionId);
2271
+ },
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
2279
+ });
2280
+ },
2281
+ onMouseLeave: () => H(null),
2282
+ children: m === v.sessionId ? /* @__PURE__ */ e(
2283
+ "input",
2284
+ {
2285
+ 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);
2291
+ },
2292
+ onClick: (F) => F.stopPropagation(),
2293
+ autoFocus: !0
2294
+ }
2295
+ ) : /* @__PURE__ */ c(V, { children: [
2296
+ /* @__PURE__ */ e(
2297
+ "img",
2298
+ {
2299
+ src: X.message,
2300
+ alt: "",
2301
+ width: 16,
2302
+ height: 16,
2303
+ className: "shrink-0 opacity-60"
2304
+ }
2305
+ ),
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: [
1899
2308
  /* @__PURE__ */ e(
1900
2309
  "button",
1901
2310
  {
1902
- className: "sa-fp-sidebar-item-action",
1903
- onClick: (O) => z(g.sessionId, g.title, O),
2311
+ type: "button",
2312
+ 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),
1904
2314
  title: "重命名",
1905
- children: /* @__PURE__ */ e(I, { name: "pen", size: 14 })
2315
+ children: /* @__PURE__ */ e(B, { name: "pen", size: 12 })
1906
2316
  }
1907
2317
  ),
1908
2318
  /* @__PURE__ */ e(
1909
2319
  "button",
1910
2320
  {
1911
- className: `sa-fp-sidebar-item-action ${k ? "danger" : ""}`,
1912
- onClick: (O) => x(g.sessionId, O),
1913
- title: k ? "确认删除" : "删除",
1914
- children: /* @__PURE__ */ e(I, { name: k ? "x" : "trash2", size: 14 })
2321
+ 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 ? "确认删除" : "删除",
2325
+ children: /* @__PURE__ */ e(
2326
+ B,
2327
+ {
2328
+ name: I ? "x" : "trash2",
2329
+ size: 12
2330
+ }
2331
+ )
1915
2332
  }
1916
2333
  )
1917
- ]
1918
- }
1919
- )
1920
- ]
1921
- },
1922
- g.sessionId
1923
- );
1924
- })
1925
- ] }, y.label)),
1926
- c && /* @__PURE__ */ e("div", { className: "sa-thread-list-loading", children: "加载更多..." })
1927
- ] })
2334
+ ] })
2335
+ ] })
2336
+ },
2337
+ v.sessionId
2338
+ );
2339
+ })
2340
+ ] }, L.label)),
2341
+ d && /* @__PURE__ */ e("div", { className: "px-0.5 py-2 text-center text-[11px] text-[#C0C0C0]", children: "向下滚动加载更多" })
2342
+ ]
2343
+ }
2344
+ ),
2345
+ z && /* @__PURE__ */ e(
2346
+ "div",
2347
+ {
2348
+ 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
+ style: {
2350
+ left: z.x,
2351
+ top: z.y,
2352
+ transform: "translateY(-50%)"
2353
+ },
2354
+ children: z.text
2355
+ }
2356
+ )
1928
2357
  ] });
1929
2358
  }
1930
- function rt({
2359
+ function At({
1931
2360
  title: t,
1932
2361
  slots: a,
1933
- welcomeMessage: s,
1934
- suggestedPrompts: n,
1935
- sidebarDefaultOpen: r = !0,
1936
- onClose: i,
1937
- avatar: o,
1938
- artifactPreview: l
2362
+ welcomeMessage: n,
2363
+ suggestedPrompts: s,
2364
+ capabilities: r,
2365
+ quickLinks: i,
2366
+ logo: o,
2367
+ sidebarDefaultOpen: l = !0,
2368
+ onClose: d,
2369
+ avatar: p,
2370
+ artifactPreview: u,
2371
+ showTimestamp: g
1939
2372
  }) {
1940
2373
  const {
1941
- status: c,
1942
- sendMessage: p,
1943
- stop: f,
1944
- conversations: h,
1945
- activeConversationId: w,
1946
- switchConversation: u,
1947
- newConversation: m,
1948
- deleteConversation: v,
1949
- renameConversation: S,
1950
- toggleArtifactDrawer: T,
1951
- isArtifactDrawerOpen: A,
1952
- allArtifacts: x,
1953
- activePreviewArtifact: z,
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,
1954
2387
  hasMore: $,
1955
- loadMoreConversations: P,
1956
- conversationsLoading: N,
1957
- messagesLoading: R
1958
- } = Y(), [y, g] = M(r), E = C(() => g((O) => !O), []), L = a.ThreadList, k = a.Composer;
1959
- return /* @__PURE__ */ d("div", { className: "sa-fullpage", children: [
1960
- L ? /* @__PURE__ */ e(
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(
1961
2394
  "div",
1962
2395
  {
1963
- className: `sa-fp-sidebar-wrapper ${y ? "" : "sa-fp-sidebar-wrapper-collapsed"}`,
2396
+ className: `sa-fp-sidebar-wrapper ${I ? "" : "sa-fp-sidebar-wrapper-collapsed"}`,
1964
2397
  children: /* @__PURE__ */ e(
1965
- L,
2398
+ _,
1966
2399
  {
1967
- conversations: h,
1968
- activeSessionId: w,
1969
- onSwitch: u,
1970
- onNew: m,
1971
- onDelete: v,
1972
- onRename: S,
2400
+ conversations: f,
2401
+ activeSessionId: y,
2402
+ onSwitch: z,
2403
+ onNew: H,
2404
+ onDelete: k,
2405
+ onRename: C,
1973
2406
  hasMore: $,
1974
- onLoadMore: P
2407
+ onLoadMore: L
1975
2408
  }
1976
2409
  )
1977
2410
  }
1978
2411
  ) : /* @__PURE__ */ e(
1979
- at,
2412
+ St,
1980
2413
  {
1981
- conversations: h,
1982
- activeSessionId: w,
1983
- onSwitch: u,
1984
- onNew: m,
1985
- onDelete: v,
1986
- onRename: S,
1987
- isCollapsed: !y,
1988
- onToggleCollapse: E,
2414
+ conversations: f,
2415
+ activeSessionId: y,
2416
+ onSwitch: z,
2417
+ onNew: H,
2418
+ onDelete: k,
2419
+ onRename: C,
2420
+ isCollapsed: !I,
2421
+ onToggleCollapse: h,
1989
2422
  hasMore: $,
1990
- onLoadMore: P,
1991
- conversationsLoading: N
2423
+ onLoadMore: L,
2424
+ conversationsLoading: v
1992
2425
  }
1993
2426
  ),
1994
- /* @__PURE__ */ d("div", { className: "sa-fp-main", children: [
1995
- /* @__PURE__ */ d("div", { className: "sa-fp-header", children: [
1996
- !y && !L && /* @__PURE__ */ e(
2427
+ /* @__PURE__ */ c("div", { className: "sa-fp-main", children: [
2428
+ W ? /* @__PURE__ */ e(
2429
+ W,
2430
+ {
2431
+ title: t,
2432
+ onClose: d ?? Et,
2433
+ onToggleThreadList: h,
2434
+ artifactCount: u ? w.length : 0,
2435
+ onToggleArtifactDrawer: u ? S : void 0
2436
+ }
2437
+ ) : /* @__PURE__ */ c("div", { className: "sa-fp-header", children: [
2438
+ /* @__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(
1997
2440
  "button",
1998
2441
  {
1999
- className: "sa-fp-header-btn",
2000
- onClick: E,
2001
- title: "展开侧边栏",
2002
- children: /* @__PURE__ */ e(I, { name: "panel-left", size: 18 })
2003
- }
2004
- ),
2005
- /* @__PURE__ */ e("div", { className: "sa-fp-header-title", children: t }),
2006
- /* @__PURE__ */ d("div", { className: "sa-fp-header-actions", children: [
2007
- l && x.length > 0 && /* @__PURE__ */ d(
2008
- "button",
2009
- {
2010
- className: "sa-fp-header-btn sa-header-btn-artifact",
2011
- onClick: T,
2012
- title: "会话产物",
2013
- children: [
2014
- /* @__PURE__ */ d(
2015
- "svg",
2016
- {
2017
- width: "14",
2018
- height: "14",
2019
- viewBox: "0 0 24 24",
2020
- fill: "none",
2021
- stroke: "currentColor",
2022
- strokeWidth: "2",
2023
- children: [
2024
- /* @__PURE__ */ e("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
2025
- /* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" })
2026
- ]
2027
- }
2028
- ),
2029
- /* @__PURE__ */ e("span", { children: "产物" })
2030
- ]
2031
- }
2032
- ),
2033
- i && /* @__PURE__ */ e(
2034
- "button",
2035
- {
2036
- className: "sa-fp-header-btn",
2037
- onClick: i,
2038
- title: "关闭",
2039
- children: /* @__PURE__ */ e(I, { name: "x", size: 18 })
2040
- }
2041
- )
2042
- ] })
2442
+ className: "sa-fp-header-btn sa-header-btn-artifact",
2443
+ onClick: S,
2444
+ title: "会话产物",
2445
+ children: [
2446
+ /* @__PURE__ */ c(
2447
+ "svg",
2448
+ {
2449
+ width: "14",
2450
+ height: "14",
2451
+ viewBox: "0 0 24 24",
2452
+ fill: "none",
2453
+ stroke: "currentColor",
2454
+ strokeWidth: "2",
2455
+ children: [
2456
+ /* @__PURE__ */ e("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
2457
+ /* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" })
2458
+ ]
2459
+ }
2460
+ ),
2461
+ /* @__PURE__ */ e("span", { children: "产物" })
2462
+ ]
2463
+ }
2464
+ ) })
2043
2465
  ] }),
2044
- /* @__PURE__ */ d("div", { className: "sa-fp-content-row", children: [
2045
- R ? /* @__PURE__ */ d("div", { className: "sa-messages-loading", children: [
2466
+ /* @__PURE__ */ c("div", { className: "sa-fp-content-row", children: [
2467
+ A ? /* @__PURE__ */ c("div", { className: "sa-messages-loading", children: [
2046
2468
  /* @__PURE__ */ e("span", { className: "sa-loading-spinner" }),
2047
2469
  "加载对话..."
2048
2470
  ] }) : /* @__PURE__ */ e(
2049
- fe,
2471
+ $e,
2050
2472
  {
2051
2473
  slots: a,
2052
- welcomeMessage: s,
2053
- suggestedPrompts: n,
2054
- avatar: o,
2055
- artifactPreview: l
2474
+ welcomeMessage: n,
2475
+ suggestedPrompts: s,
2476
+ capabilities: r,
2477
+ quickLinks: i,
2478
+ logo: o,
2479
+ avatar: p,
2480
+ artifactPreview: u,
2481
+ showTimestamp: g
2056
2482
  }
2057
2483
  ),
2058
- l && A && /* @__PURE__ */ e(
2059
- me,
2484
+ u && D && /* @__PURE__ */ e(
2485
+ _e,
2060
2486
  {
2061
- artifacts: x,
2062
- initialArtifact: z,
2063
- onClose: T
2487
+ artifacts: w,
2488
+ initialArtifact: M,
2489
+ onClose: S
2064
2490
  }
2065
2491
  )
2066
2492
  ] }),
2067
- k ? /* @__PURE__ */ e(k, { status: c, onSend: p, onStop: f }) : /* @__PURE__ */ e(ue, {})
2493
+ O ? /* @__PURE__ */ e(O, { status: b, onSend: m, onStop: x }) : /* @__PURE__ */ e(Le, {})
2068
2494
  ] })
2069
2495
  ] });
2070
2496
  }
2071
- function st(t) {
2072
- const { sdk: a, mode: s = "floating", slots: n = {}, hooks: r = {}, welcomeMessage: i, suggestedPrompts: o, title: l = "AI Assistant", initialOpen: c = !1, onOpenChange: p, sidebarDefaultOpen: f, avatar: h, artifactPreview: w } = t, [u, m] = M(c);
2073
- B(() => {
2074
- m(c);
2075
- }, [c]);
2076
- const v = C(() => {
2077
- var x, z;
2078
- const A = !u;
2079
- m(A), p == null || p(A), A ? (x = r.onOpen) == null || x.call(r) : (z = r.onClose) == null || z.call(r);
2080
- }, [u, r, p]), S = C(() => {
2081
- var A;
2082
- m(!1), p == null || p(!1), (A = r.onClose) == null || A.call(r);
2083
- }, [r, p]), T = n.Trigger ?? Ce;
2084
- return s === "fullpage" ? u ? /* @__PURE__ */ e(te, { sdk: a, hooks: r, children: /* @__PURE__ */ e(
2085
- rt,
2497
+ function Dt(t) {
2498
+ const {
2499
+ sdk: a,
2500
+ mode: n = "floating",
2501
+ slots: s = {},
2502
+ hooks: r = {},
2503
+ 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,
2086
2531
  {
2087
2532
  title: l,
2088
- slots: n,
2533
+ slots: s,
2089
2534
  welcomeMessage: i,
2090
2535
  suggestedPrompts: o,
2091
- sidebarDefaultOpen: f,
2092
- onClose: S,
2093
- avatar: h,
2094
- artifactPreview: w
2536
+ capabilities: m,
2537
+ quickLinks: x,
2538
+ logo: f,
2539
+ sidebarDefaultOpen: u,
2540
+ onClose: D,
2541
+ avatar: g,
2542
+ artifactPreview: b,
2543
+ showTimestamp: H
2095
2544
  }
2096
- ) }) : null : /* @__PURE__ */ d(te, { sdk: a, hooks: r, children: [
2097
- /* @__PURE__ */ e(T, { isOpen: u, onClick: v }),
2545
+ ) }) : null : /* @__PURE__ */ c(ye, { sdk: a, hooks: r, children: [
2546
+ /* @__PURE__ */ e(w, { isOpen: k, onClick: S, triggerLogo: y }),
2098
2547
  /* @__PURE__ */ e(
2099
- tt,
2548
+ Mt,
2100
2549
  {
2101
- isOpen: u,
2102
- onClose: S,
2550
+ isOpen: k,
2551
+ onClose: D,
2103
2552
  title: l,
2104
- slots: n,
2553
+ slots: s,
2105
2554
  welcomeMessage: i,
2106
2555
  suggestedPrompts: o,
2107
- avatar: h,
2108
- artifactPreview: w
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
2109
2564
  }
2110
2565
  )
2111
2566
  ] });
2112
2567
  }
2113
- const nt = `
2568
+ const $t = `
2114
2569
  [data-super-agent-widget] {
2115
2570
  --sa-primary-dark: color-mix(in srgb, var(--sa-primary) 82%, #000);
2116
2571
  --sa-primary-light: color-mix(in srgb, var(--sa-primary) 10%, #fff);
@@ -2140,135 +2595,7 @@ const nt = `
2140
2595
  font-family: inherit;
2141
2596
  }
2142
2597
 
2143
- /* ── Trigger ─────────────────────────────────────────────── */
2144
-
2145
- .sa-trigger {
2146
- position: fixed;
2147
- bottom: 24px;
2148
- right: 24px;
2149
- width: 56px;
2150
- height: 56px;
2151
- border: none;
2152
- border-radius: 50%;
2153
- cursor: pointer;
2154
- display: flex;
2155
- align-items: center;
2156
- justify-content: center;
2157
- background: linear-gradient(135deg, var(--sa-primary), var(--sa-primary-dark));
2158
- color: #ffffff;
2159
- font-size: 24px;
2160
- box-shadow: 0 8px 24px color-mix(in srgb, var(--sa-primary) 35%, transparent);
2161
- z-index: var(--sa-z-index, 9999);
2162
- transition: transform 0.2s ease, box-shadow 0.2s ease;
2163
- }
2164
-
2165
- .sa-trigger:hover {
2166
- transform: scale(1.08);
2167
- box-shadow: 0 12px 32px color-mix(in srgb, var(--sa-primary) 45%, transparent);
2168
- }
2169
-
2170
- .sa-trigger:active {
2171
- transform: scale(0.94);
2172
- }
2173
-
2174
- .sa-trigger-open {
2175
- transform: rotate(90deg);
2176
- }
2177
-
2178
- /* ── Panel ───────────────────────────────────────────────── */
2179
-
2180
- .sa-panel {
2181
- position: fixed;
2182
- bottom: 96px;
2183
- right: 24px;
2184
- width: var(--sa-panel-width, 380px);
2185
- height: var(--sa-panel-height, 520px);
2186
- max-height: calc(100vh - 120px);
2187
- display: flex;
2188
- flex-direction: column;
2189
- overflow: hidden;
2190
- background: var(--sa-bg);
2191
- border: 1px solid var(--sa-border);
2192
- border-radius: var(--sa-radius, 16px);
2193
- box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
2194
- z-index: var(--sa-z-index, 9999);
2195
- animation: sa-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
2196
- }
2197
-
2198
- /* ── Header ──────────────────────────────────────────────── */
2199
-
2200
- .sa-header {
2201
- display: flex;
2202
- align-items: center;
2203
- gap: 10px;
2204
- padding: 14px 16px;
2205
- color: #ffffff;
2206
- background: linear-gradient(135deg, var(--sa-primary), var(--sa-primary-dark));
2207
- flex-shrink: 0;
2208
- }
2209
-
2210
- .sa-header-left {
2211
- display: flex;
2212
- align-items: center;
2213
- gap: 10px;
2214
- flex: 1;
2215
- }
2216
-
2217
- .sa-header-avatar {
2218
- width: 28px;
2219
- height: 28px;
2220
- border-radius: 50%;
2221
- background: rgba(255,255,255,0.2);
2222
- display: flex;
2223
- align-items: center;
2224
- justify-content: center;
2225
- font-size: 12px;
2226
- font-weight: 600;
2227
- }
2228
-
2229
- .sa-header-info {
2230
- display: flex;
2231
- flex-direction: column;
2232
- }
2233
-
2234
- .sa-header-status {
2235
- font-size: 11px;
2236
- opacity: 0.8;
2237
- color: #a5f3a6;
2238
- }
2239
-
2240
- .sa-header-actions {
2241
- display: flex;
2242
- gap: 4px;
2243
- }
2244
-
2245
- .sa-header-title {
2246
- flex: 1;
2247
- font-size: 16px;
2248
- font-weight: 600;
2249
- white-space: nowrap;
2250
- overflow: hidden;
2251
- text-overflow: ellipsis;
2252
- }
2253
-
2254
- .sa-header-btn {
2255
- width: 30px;
2256
- height: 30px;
2257
- border: none;
2258
- border-radius: 8px;
2259
- background: transparent;
2260
- color: #ffffff;
2261
- font-size: 16px;
2262
- cursor: pointer;
2263
- display: flex;
2264
- align-items: center;
2265
- justify-content: center;
2266
- transition: background 0.15s ease;
2267
- }
2268
-
2269
- .sa-header-btn:hover {
2270
- background: rgba(255, 255, 255, 0.18);
2271
- }
2598
+ /* ── Trigger / Panel / Header(浮窗框架已改用 Tailwind 实现,见 tailwind.css) ── */
2272
2599
 
2273
2600
  /* ── Thread / messages ───────────────────────────────────── */
2274
2601
 
@@ -2276,7 +2603,7 @@ const nt = `
2276
2603
  flex: 1;
2277
2604
  display: flex;
2278
2605
  flex-direction: column;
2279
- gap: 14px;
2606
+ gap: 16px;
2280
2607
  overflow-y: auto;
2281
2608
  padding: 16px;
2282
2609
  background: var(--sa-surface);
@@ -2296,6 +2623,9 @@ const nt = `
2296
2623
  background: rgba(0, 0, 0, 0.24);
2297
2624
  }
2298
2625
 
2626
+ /* ── Message:浮窗默认 hr-for-help 风格(AI 头像独占一行);
2627
+ fullpage 模式在 .sa-fp-content-row 下恢复原横排布局,互不影响 ── */
2628
+
2299
2629
  .sa-message {
2300
2630
  display: flex;
2301
2631
  align-items: flex-start;
@@ -2307,6 +2637,13 @@ const nt = `
2307
2637
  justify-content: flex-end;
2308
2638
  }
2309
2639
 
2640
+ /* AI 消息:列布局,头像独占一行(仅浮窗,对齐 hr-for-help msgAi) */
2641
+ .sa-message-assistant {
2642
+ flex-direction: column;
2643
+ align-items: flex-start;
2644
+ gap: 6px;
2645
+ }
2646
+
2310
2647
  .sa-message-content {
2311
2648
  max-width: 78%;
2312
2649
  display: flex;
@@ -2314,33 +2651,42 @@ const nt = `
2314
2651
  gap: 4px;
2315
2652
  }
2316
2653
 
2654
+ .sa-message-user .sa-message-content {
2655
+ max-width: 90%;
2656
+ }
2657
+
2658
+ .sa-message-assistant .sa-message-content {
2659
+ max-width: 100%;
2660
+ min-width: 0;
2661
+ width: 100%;
2662
+ }
2663
+
2317
2664
  .sa-message-body {
2318
2665
  display: flex;
2319
2666
  flex-direction: column;
2320
2667
  gap: 4px;
2321
2668
  }
2322
2669
 
2670
+ /* 浮窗气泡:用户浅蓝、AI 白底描边(对齐 hr-for-help) */
2323
2671
  .sa-message-user .sa-message-body {
2324
- padding: 10px 14px;
2325
- border-radius: 16px;
2326
- border-bottom-right-radius: 4px;
2327
- background: var(--sa-primary);
2328
- color: #ffffff;
2672
+ padding: 8px 12px;
2673
+ border-radius: 8px 8px 0 8px;
2674
+ background: #E8F1FE;
2675
+ color: #333333;
2329
2676
  font-size: 14px;
2330
- line-height: 1.55;
2677
+ line-height: 1.6;
2331
2678
  word-break: break-word;
2332
2679
  }
2333
2680
 
2334
2681
  .sa-message-assistant .sa-message-body {
2335
- padding: 10px 14px;
2336
- border-radius: 16px;
2337
- border-bottom-left-radius: 4px;
2682
+ padding: 10px 12px;
2683
+ border-radius: 8px;
2338
2684
  background: #ffffff;
2685
+ border: 1px solid #E0E0E0;
2339
2686
  color: var(--sa-text);
2340
2687
  font-size: 14px;
2341
- line-height: 1.55;
2688
+ line-height: 1.5;
2342
2689
  word-break: break-word;
2343
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
2344
2690
  }
2345
2691
 
2346
2692
  .sa-message-time {
@@ -2353,26 +2699,72 @@ const nt = `
2353
2699
  text-align: right;
2354
2700
  }
2355
2701
 
2356
- .sa-avatar {
2357
- width: 28px;
2358
- height: 28px;
2359
- flex-shrink: 0;
2702
+ /* 消息头像:裸展示,无背景色(对齐 hr-for-help msgAvatar) */
2703
+ .sa-msg-avatar {
2704
+ width: 24px;
2705
+ height: 24px;
2360
2706
  border-radius: 50%;
2361
- display: flex;
2707
+ object-fit: cover;
2708
+ flex-shrink: 0;
2709
+ display: block;
2710
+ }
2711
+
2712
+ .sa-msg-avatar-text {
2713
+ display: inline-flex;
2362
2714
  align-items: center;
2363
2715
  justify-content: center;
2364
- color: #ffffff;
2365
- font-size: 12px;
2366
- font-weight: 600;
2367
- overflow: hidden;
2716
+ font-size: 18px;
2717
+ font-weight: 400;
2368
2718
  }
2369
2719
 
2370
- .sa-avatar-assistant {
2371
- background: linear-gradient(135deg, var(--sa-primary), var(--sa-primary-dark));
2720
+ /* ── fullpage 覆盖:恢复横排头像 + 经典气泡(不受浮窗 hr-for-help 改版影响) ── */
2721
+
2722
+ .sa-fp-content-row .sa-message-assistant {
2723
+ flex-direction: row;
2724
+ gap: 10px;
2725
+ }
2726
+
2727
+ .sa-fp-content-row .sa-message-assistant .sa-message-content {
2728
+ max-width: 88%;
2729
+ width: auto;
2730
+ }
2731
+
2732
+ .sa-fp-content-row .sa-message-user .sa-message-content {
2733
+ max-width: 78%;
2734
+ }
2735
+
2736
+ // .sa-fp-content-row .sa-message-user .sa-message-body {
2737
+ // padding: 10px 14px;
2738
+ // border-radius: 16px;
2739
+ // border-bottom-right-radius: 4px;
2740
+ // background: var(--sa-primary);
2741
+ // color: #ffffff;
2742
+ // font-size: 14px;
2743
+ // line-height: 1.55;
2744
+ // word-break: break-word;
2745
+ // }
2746
+
2747
+ .sa-fp-content-row .sa-message-assistant .sa-message-body {
2748
+ padding: 10px 14px;
2749
+ border-radius: 16px;
2750
+ background: #ffffff;
2751
+ color: var(--sa-text);
2752
+ font-size: 14px;
2753
+ line-height: 1.55;
2754
+ word-break: break-word;
2755
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
2756
+ }
2757
+
2758
+ .sa-fp-content-row .sa-msg-avatar {
2759
+ width: 24px;
2760
+ height: 24px;
2372
2761
  }
2373
2762
 
2374
- .sa-avatar-user {
2375
- background: linear-gradient(135deg, #64748b, #475569);
2763
+ .sa-fp-content-row .sa-msg-avatar-text {
2764
+ background: linear-gradient(135deg, var(--sa-primary), var(--sa-primary-dark));
2765
+ color: #ffffff;
2766
+ font-size: 12px;
2767
+ font-weight: 600;
2376
2768
  }
2377
2769
 
2378
2770
  /* ── Text part (markdown) ────────────────────────────────── */
@@ -2748,84 +3140,7 @@ const nt = `
2748
3140
  }
2749
3141
  .sa-dislike-cancel:hover { background: var(--sa-surface); }
2750
3142
 
2751
- /* ── Composer ────────────────────────────────────────────── */
2752
-
2753
- .sa-composer {
2754
- position: relative;
2755
- display: flex;
2756
- align-items: flex-end;
2757
- gap: 10px;
2758
- padding: 12px 14px;
2759
- border-top: 1px solid var(--sa-border);
2760
- background: var(--sa-bg);
2761
- flex-shrink: 0;
2762
- }
2763
-
2764
- .sa-composer-input {
2765
- flex: 1;
2766
- min-height: 38px;
2767
- max-height: 120px;
2768
- padding: 9px 14px;
2769
- border: 1px solid var(--sa-border);
2770
- border-radius: 19px;
2771
- background: var(--sa-surface);
2772
- color: var(--sa-text);
2773
- font-family: var(--sa-font);
2774
- font-size: 14px;
2775
- line-height: 1.5;
2776
- resize: none;
2777
- outline: none;
2778
- transition: border-color 0.2s ease, background 0.2s ease;
2779
- }
2780
-
2781
- .sa-composer-input::placeholder {
2782
- color: #9ca3af;
2783
- }
2784
-
2785
- .sa-composer-input:focus {
2786
- border-color: var(--sa-primary);
2787
- background: #ffffff;
2788
- }
2789
-
2790
- .sa-composer-send,
2791
- .sa-composer-stop {
2792
- width: 38px;
2793
- height: 38px;
2794
- flex-shrink: 0;
2795
- border: none;
2796
- border-radius: 50%;
2797
- cursor: pointer;
2798
- display: flex;
2799
- align-items: center;
2800
- justify-content: center;
2801
- color: #ffffff;
2802
- font-size: 16px;
2803
- transition: transform 0.15s ease, background 0.2s ease;
2804
- }
2805
-
2806
- .sa-composer-send {
2807
- background: var(--sa-primary);
2808
- }
2809
-
2810
- .sa-composer-send:hover {
2811
- background: var(--sa-primary-dark);
2812
- transform: scale(1.05);
2813
- }
2814
-
2815
- .sa-composer-send:disabled {
2816
- opacity: 0.5;
2817
- cursor: not-allowed;
2818
- transform: none;
2819
- }
2820
-
2821
- .sa-composer-stop {
2822
- background: #ef4444;
2823
- }
2824
-
2825
- .sa-composer-stop:hover {
2826
- background: #dc2626;
2827
- transform: scale(1.05);
2828
- }
3143
+ /* ── Composer(输入区改用 Tailwind 实现,见 tailwind.css 的 .sa-input-form/.sa-send-btn) ── */
2829
3144
 
2830
3145
  /* ── Slash Menu ─────────────────────────────────────────── */
2831
3146
 
@@ -2883,89 +3198,7 @@ const nt = `
2883
3198
  min-width: 0;
2884
3199
  }
2885
3200
 
2886
- /* ── Thread list ─────────────────────────────────────────── */
2887
-
2888
- .sa-thread-list-overlay {
2889
- position: absolute;
2890
- inset: 0;
2891
- background: rgba(0,0,0,0.3);
2892
- z-index: 19;
2893
- }
2894
-
2895
- .sa-thread-list {
2896
- position: absolute;
2897
- top: 0;
2898
- left: 0;
2899
- bottom: 0;
2900
- width: 100%;
2901
- display: flex;
2902
- flex-direction: column;
2903
- background: #ffffff;
2904
- z-index: 20;
2905
- box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
2906
- animation: sa-slide-in-left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
2907
- }
2908
-
2909
- .sa-thread-list-header {
2910
- display: flex;
2911
- align-items: center;
2912
- justify-content: space-between;
2913
- padding: 20px 20px 16px;
2914
- flex-shrink: 0;
2915
- }
2916
-
2917
- .sa-thread-list-title {
2918
- font-size: 17px;
2919
- font-weight: 700;
2920
- color: #18181b;
2921
- letter-spacing: -0.2px;
2922
- }
2923
-
2924
- .sa-thread-list-new {
2925
- display: flex;
2926
- align-items: center;
2927
- gap: 6px;
2928
- padding: 8px 16px;
2929
- border: none;
2930
- border-radius: 20px;
2931
- background: #f4f4f5;
2932
- color: #3f3f46;
2933
- font-size: 13px;
2934
- font-weight: 500;
2935
- cursor: pointer;
2936
- transition: background 0.15s;
2937
- }
2938
-
2939
- .sa-thread-list-new:hover {
2940
- background: #e4e4e7;
2941
- }
2942
-
2943
- .sa-thread-list-items {
2944
- flex: 1;
2945
- overflow-y: auto;
2946
- padding: 0 12px 12px;
2947
- }
2948
-
2949
- .sa-thread-list-empty {
2950
- padding: 48px 16px;
2951
- text-align: center;
2952
- color: var(--sa-text-muted);
2953
- font-size: 14px;
2954
- }
2955
-
2956
- .sa-thread-list-loading {
2957
- padding: 12px 16px;
2958
- text-align: center;
2959
- color: #9ca3af;
2960
- font-size: 13px;
2961
- }
2962
-
2963
- .sa-thread-list-hint {
2964
- padding: 8px 16px 12px;
2965
- text-align: center;
2966
- color: #d1d5db;
2967
- font-size: 12px;
2968
- }
3201
+ /* ── Thread list(内嵌侧边栏改用 Tailwind 实现,见 FullpageLayout.tsx / ThreadList.tsx) ── */
2969
3202
 
2970
3203
  /* 消息区加载态 */
2971
3204
  .sa-messages-loading {
@@ -2992,155 +3225,12 @@ const nt = `
2992
3225
  to { transform: rotate(360deg); }
2993
3226
  }
2994
3227
 
2995
- .sa-thread-group-label {
2996
- padding: 16px 8px 6px;
2997
- font-size: 12px;
2998
- font-weight: 500;
2999
- color: #a1a1aa;
3000
- }
3001
-
3002
- .sa-thread-item {
3003
- display: flex;
3004
- align-items: center;
3005
- justify-content: space-between;
3006
- gap: 8px;
3007
- padding: 10px 12px;
3008
- margin: 2px 0;
3009
- border-radius: 8px;
3010
- color: #374151;
3011
- font-size: 14px;
3012
- cursor: pointer;
3013
- transition: background 0.15s ease;
3014
- }
3015
-
3016
- .sa-thread-item:hover {
3017
- background: #f9fafb;
3018
- }
3019
-
3020
- .sa-thread-item.active {
3021
- background: var(--sa-primary-light);
3022
- color: var(--sa-primary-dark);
3023
- font-weight: 500;
3024
- }
3025
-
3026
- .sa-thread-item-info {
3027
- flex: 1;
3028
- overflow: hidden;
3029
- display: flex;
3030
- flex-direction: column;
3031
- gap: 2px;
3032
- }
3033
-
3034
- .sa-thread-item-title {
3035
- overflow: hidden;
3036
- white-space: nowrap;
3037
- text-overflow: ellipsis;
3038
- }
3039
-
3040
- .sa-thread-item-time {
3041
- font-size: 11px;
3042
- color: var(--sa-text-light);
3043
- white-space: nowrap;
3044
- }
3045
-
3046
- .sa-thread-item-edit {
3047
- width: 100%;
3048
- padding: 4px 8px;
3049
- border: 1px solid var(--sa-primary);
3050
- border-radius: 6px;
3051
- font-size: 13px;
3052
- outline: none;
3053
- background: var(--sa-bg);
3054
- color: var(--sa-text);
3055
- }
3056
-
3057
- /* 操作按钮组:始终占位(visibility 控制),hover 时显示,高度不变 */
3058
- .sa-thread-item-actions {
3059
- display: flex;
3060
- gap: 2px;
3061
- flex-shrink: 0;
3062
- visibility: hidden;
3063
- }
3064
-
3065
- .sa-thread-item:hover .sa-thread-item-actions {
3066
- visibility: visible;
3067
- }
3068
-
3069
- .sa-thread-item-action-btn {
3070
- border: none;
3071
- background: transparent;
3072
- color: var(--sa-text-muted);
3073
- cursor: pointer;
3074
- padding: 2px;
3075
- border-radius: 4px;
3076
- display: inline-flex;
3077
- align-items: center;
3078
- transition: color 0.15s ease, background 0.15s ease;
3079
- }
3080
-
3081
- .sa-thread-item-action-btn:hover {
3082
- color: var(--sa-primary);
3083
- background: rgba(99,102,241,0.08);
3084
- }
3228
+ /* ── Welcome(首页改用 Tailwind 实现,见 tailwind.css) ── */
3085
3229
 
3086
- /* ── Welcome ─────────────────────────────────────────────── */
3087
-
3088
- .sa-welcome {
3089
- flex: 1;
3090
- display: flex;
3091
- flex-direction: column;
3092
- align-items: center;
3093
- justify-content: center;
3094
- padding: 24px;
3095
- text-align: center;
3096
- }
3097
-
3098
- .sa-welcome-icon {
3099
- font-size: 40px;
3100
- margin-bottom: 12px;
3101
- }
3102
-
3103
- .sa-welcome-message {
3104
- margin-bottom: 20px;
3230
+ .sa-thinking-indicator {
3231
+ color: #9ca3af;
3105
3232
  font-size: 14px;
3106
- color: var(--sa-text-muted);
3107
- line-height: 1.6;
3108
- }
3109
-
3110
- .sa-welcome-prompts {
3111
- display: flex;
3112
- flex-direction: column;
3113
- gap: 8px;
3114
- width: 100%;
3115
- }
3116
-
3117
- .sa-welcome-prompt {
3118
- padding: 10px 16px;
3119
- border: 1px solid var(--sa-border);
3120
- border-radius: 999px;
3121
- background: #ffffff;
3122
- color: #374151;
3123
- font-size: 13px;
3124
- cursor: pointer;
3125
- transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
3126
- }
3127
-
3128
- .sa-welcome-prompt:hover {
3129
- border-color: var(--sa-primary);
3130
- background: var(--sa-primary-light);
3131
- color: var(--sa-primary-dark);
3132
- }
3133
-
3134
- /* ── Streaming cursor ────────────────────────────────────── */
3135
-
3136
- .sa-streaming-cursor {
3137
- display: inline-block;
3138
- width: 2px;
3139
- height: 1em;
3140
- margin-left: 2px;
3141
- background: var(--sa-primary);
3142
- vertical-align: text-bottom;
3143
- animation: sa-blink 1s steps(2, start) infinite;
3233
+ animation: sa-blink 1.2s ease-in-out infinite;
3144
3234
  }
3145
3235
 
3146
3236
  /* ── Interrupt cards ──────────────────────────────────────── */
@@ -3357,17 +3447,6 @@ const nt = `
3357
3447
 
3358
3448
  /* ── Animations ──────────────────────────────────────────── */
3359
3449
 
3360
- @keyframes sa-slide-up {
3361
- from {
3362
- opacity: 0;
3363
- transform: translateY(16px) scale(0.98);
3364
- }
3365
- to {
3366
- opacity: 1;
3367
- transform: translateY(0) scale(1);
3368
- }
3369
- }
3370
-
3371
3450
  @keyframes sa-blink {
3372
3451
  0%,
3373
3452
  100% {
@@ -3378,17 +3457,6 @@ const nt = `
3378
3457
  }
3379
3458
  }
3380
3459
 
3381
- @keyframes sa-slide-in-left {
3382
- from {
3383
- opacity: 0;
3384
- transform: translateX(-100%);
3385
- }
3386
- to {
3387
- opacity: 1;
3388
- transform: translateX(0);
3389
- }
3390
- }
3391
-
3392
3460
  /* ── Fullpage Layout (DeepSeek-style) ────────────────────────── */
3393
3461
 
3394
3462
  .sa-fullpage {
@@ -3399,208 +3467,21 @@ const nt = `
3399
3467
  background: var(--sa-bg, #ffffff);
3400
3468
  }
3401
3469
 
3402
- /* Sidebar */
3403
- .sa-fp-sidebar {
3404
- width: 260px;
3405
- display: flex;
3406
- flex-direction: column;
3407
- background: var(--sa-surface, #ffffff);
3408
- flex-shrink: 0;
3409
- transition: width 0.2s cubic-bezier(0.16,1,0.3,1);
3410
- overflow: hidden;
3411
- border-right: 1px solid #e8e8ea;
3412
- }
3413
-
3414
- .sa-fp-sidebar-collapsed {
3415
- width: 52px;
3416
- align-items: center;
3417
- padding-top: 12px;
3418
- gap: 4px;
3419
- border-right: 1px solid #e8e8ea;
3420
- }
3421
-
3422
- .sa-fp-sidebar-header {
3423
- display: flex;
3424
- align-items: center;
3425
- gap: 8px;
3426
- padding: 12px 12px 8px;
3427
- flex-shrink: 0;
3428
- }
3429
-
3430
- .sa-fp-sidebar-toggle {
3431
- width: 32px;
3432
- height: 32px;
3433
- border: none;
3434
- border-radius: 8px;
3435
- background: transparent;
3436
- color: #71717a;
3437
- cursor: pointer;
3438
- display: flex;
3439
- align-items: center;
3440
- justify-content: center;
3441
- transition: background 0.12s, color 0.12s;
3442
- flex-shrink: 0;
3443
- }
3444
-
3445
- .sa-fp-sidebar-toggle:hover {
3446
- background: #e4e4e7;
3447
- color: #18181b;
3448
- }
3449
-
3450
- .sa-fp-sidebar-new {
3451
- flex: 1;
3452
- padding: 7px 12px;
3453
- border: 1px solid #d4d4d8;
3454
- border-radius: 8px;
3455
- background: #fff;
3456
- color: #3f3f46;
3457
- font-size: 13px;
3458
- font-weight: 500;
3459
- cursor: pointer;
3460
- display: flex;
3461
- align-items: center;
3462
- gap: 6px;
3463
- transition: border-color 0.12s, box-shadow 0.12s;
3464
- }
3465
-
3466
- .sa-fp-sidebar-new:hover {
3467
- border-color: #a1a1aa;
3468
- box-shadow: 0 1px 3px rgba(0,0,0,0.06);
3469
- }
3470
-
3471
- .sa-fp-sidebar-new span {
3472
- font-size: 13px;
3473
- }
3474
-
3475
- .sa-fp-sidebar-list {
3476
- flex: 1;
3477
- overflow-y: auto;
3478
- padding: 4px 8px 12px;
3479
- }
3480
-
3481
- .sa-fp-sidebar-list::-webkit-scrollbar {
3482
- width: 4px;
3483
- }
3484
-
3485
- .sa-fp-sidebar-list::-webkit-scrollbar-thumb {
3486
- background: rgba(0,0,0,0.08);
3487
- border-radius: 2px;
3488
- }
3489
-
3490
- .sa-fp-sidebar-list::-webkit-scrollbar-thumb:hover {
3491
- background: rgba(0,0,0,0.15);
3492
- }
3493
-
3494
- .sa-fp-sidebar-group {
3495
- padding: 12px 8px 4px;
3496
- font-size: 11px;
3497
- font-weight: 500;
3498
- color: #a1a1aa;
3499
- letter-spacing: 0.3px;
3500
- }
3501
-
3502
- .sa-fp-sidebar-item {
3503
- display: flex;
3504
- align-items: center;
3505
- gap: 8px;
3506
- padding: 8px 10px;
3507
- margin: 1px 0;
3508
- border-radius: 8px;
3509
- cursor: pointer;
3510
- color: #3f3f46;
3511
- font-size: 13px;
3512
- line-height: 1.4;
3513
- transition: background 0.1s;
3514
- }
3515
-
3516
- .sa-fp-sidebar-item:hover {
3517
- background: #e8e8ea;
3518
- }
3519
-
3520
- .sa-fp-sidebar-item.active {
3521
- background: #e4e4e7;
3522
- color: #18181b;
3523
- font-weight: 500;
3524
- }
3525
-
3526
- .sa-fp-sidebar-item-title {
3527
- flex: 1;
3528
- overflow: hidden;
3529
- white-space: nowrap;
3530
- text-overflow: ellipsis;
3531
- }
3532
-
3533
- .sa-fp-sidebar-item-edit {
3534
- flex: 1;
3535
- min-width: 0;
3536
- padding: 2px 6px;
3537
- border: 1px solid var(--sa-primary, #6366f1);
3538
- border-radius: 4px;
3539
- font-size: 13px;
3540
- color: #27272a;
3541
- background: #fff;
3542
- outline: none;
3543
- }
3544
-
3545
- .sa-fp-sidebar-item-actions {
3546
- display: flex;
3547
- gap: 2px;
3548
- flex-shrink: 0;
3549
- visibility: hidden;
3550
- }
3551
-
3552
- .sa-fp-sidebar-item-actions.visible {
3553
- visibility: visible;
3554
- }
3555
-
3556
- .sa-fp-sidebar-item-action {
3557
- width: 24px;
3558
- height: 24px;
3559
- border: none;
3560
- border-radius: 6px;
3561
- background: transparent;
3562
- color: #a1a1aa;
3563
- cursor: pointer;
3564
- display: flex;
3565
- align-items: center;
3566
- justify-content: center;
3567
- flex-shrink: 0;
3568
- transition: color 0.1s, background 0.1s;
3569
- }
3570
-
3571
- .sa-fp-sidebar-item-action:hover {
3572
- color: #71717a;
3573
- background: rgba(0,0,0,0.05);
3574
- }
3575
-
3576
- .sa-fp-sidebar-item-action.danger {
3577
- color: #ef4444;
3578
- }
3579
-
3580
- .sa-fp-sidebar-item-action.danger:hover {
3581
- color: #dc2626;
3582
- background: rgba(239,68,68,0.08);
3583
- }
3584
-
3585
- .sa-fp-sidebar-empty {
3586
- padding: 32px 12px;
3587
- text-align: center;
3588
- color: #a1a1aa;
3589
- font-size: 13px;
3590
- }
3470
+ /* Sidebar(fullpage 默认侧边栏改用 Tailwind 实现,对齐浮窗历史对话样式,见 FullpageLayout.tsx) */
3591
3471
 
3592
- /* Sidebar wrapper (for custom ThreadList slot) */
3472
+ /* Sidebar wrapper (for custom ThreadList slot):宽度与默认侧边栏 220px 对齐 */
3593
3473
  .sa-fp-sidebar-wrapper {
3594
- width: 260px;
3474
+ width: 220px;
3595
3475
  flex-shrink: 0;
3596
3476
  overflow: hidden;
3597
- border-right: 1px solid #e8e8ea;
3598
- background: #f2f2f3;
3477
+ border-right: 1px solid #ECECEC;
3478
+ background: #FAFAFA;
3599
3479
  transition: width 0.2s cubic-bezier(0.16,1,0.3,1);
3600
3480
  }
3601
3481
 
3602
3482
  .sa-fp-sidebar-wrapper-collapsed {
3603
3483
  width: 0;
3484
+ border-right: none;
3604
3485
  }
3605
3486
 
3606
3487
  /* Main area */
@@ -3843,39 +3724,40 @@ const nt = `
3843
3724
  from { opacity: 0; transform: translateX(12px); }
3844
3725
  to { opacity: 1; transform: translateX(0); }
3845
3726
  }
3846
- `, it = {
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 = {
3847
3728
  primaryColor: "#6366f1",
3848
3729
  backgroundColor: "#ffffff",
3849
3730
  fontFamily: "system-ui, -apple-system, sans-serif",
3850
3731
  borderRadius: 16,
3851
- panelWidth: 380,
3852
- panelHeight: 520,
3732
+ // 与浮窗默认几何常量一致(hooks/useFloatingWindow.ts FLOATING_CONSTANTS)
3733
+ panelWidth: 400,
3734
+ panelHeight: 648,
3853
3735
  zIndex: 9999
3854
3736
  };
3855
- function ot(t, a) {
3856
- const s = parseInt(t.slice(1, 3), 16), n = parseInt(t.slice(3, 5), 16), r = parseInt(t.slice(5, 7), 16), i = 1 - a;
3857
- return `#${Math.round(s * i).toString(16).padStart(2, "0")}${Math.round(n * i).toString(16).padStart(2, "0")}${Math.round(r * i).toString(16).padStart(2, "0")}`;
3737
+ function Ht(t, a) {
3738
+ 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
+ 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")}`;
3858
3740
  }
3859
- function lt(t, a) {
3860
- const s = parseInt(t.slice(1, 3), 16), n = parseInt(t.slice(3, 5), 16), r = parseInt(t.slice(5, 7), 16);
3861
- return `#${Math.round(s + (255 - s) * a).toString(16).padStart(2, "0")}${Math.round(n + (255 - n) * a).toString(16).padStart(2, "0")}${Math.round(r + (255 - r) * a).toString(16).padStart(2, "0")}`;
3741
+ function Ft(t, a) {
3742
+ const n = parseInt(t.slice(1, 3), 16), s = parseInt(t.slice(3, 5), 16), r = parseInt(t.slice(5, 7), 16);
3743
+ 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")}`;
3862
3744
  }
3863
- function ct(t) {
3864
- const a = { ...it, ...t }, s = a.primaryColor, n = a.backgroundColor;
3745
+ function Rt(t) {
3746
+ const a = { ..._t, ...t }, n = a.primaryColor, s = a.backgroundColor;
3865
3747
  return [
3866
3748
  // 用户直接配置的变量
3867
- `--sa-primary: ${s}`,
3868
- `--sa-bg: ${n}`,
3749
+ `--sa-primary: ${n}`,
3750
+ `--sa-bg: ${s}`,
3869
3751
  `--sa-font: ${a.fontFamily}`,
3870
3752
  `--sa-radius: ${a.borderRadius}px`,
3871
3753
  `--sa-panel-width: ${a.panelWidth}px`,
3872
3754
  `--sa-panel-height: ${a.panelHeight}px`,
3873
3755
  `--sa-z-index: ${a.zIndex}`,
3874
3756
  // 从 primaryColor 自动派生
3875
- `--sa-primary-dark: ${ot(s, 0.15)}`,
3876
- `--sa-primary-light: ${lt(s, 0.9)}`,
3757
+ `--sa-primary-dark: ${Ht(n, 0.15)}`,
3758
+ `--sa-primary-light: ${Ft(n, 0.9)}`,
3877
3759
  // 从 backgroundColor 自动派生的语义色
3878
- `--sa-surface: ${n}`,
3760
+ `--sa-surface: ${s}`,
3879
3761
  "--sa-border: #e5e7eb",
3880
3762
  "--sa-hover: #f4f4f5",
3881
3763
  "--sa-text: #374151",
@@ -3883,23 +3765,24 @@ function ct(t) {
3883
3765
  "--sa-text-light: #6b7280"
3884
3766
  ].join("; ");
3885
3767
  }
3886
- function ut(t, a) {
3887
- const s = typeof t == "string" ? document.querySelector(t) : t;
3888
- if (!s)
3768
+ function Pt(t, a) {
3769
+ const n = typeof t == "string" ? document.querySelector(t) : t;
3770
+ if (!n)
3889
3771
  throw new Error(`Target element not found: ${t}`);
3890
- const n = document.createElement("div");
3891
- n.setAttribute("data-super-agent-widget", "");
3892
- const r = ct(a.theme ?? {});
3893
- if (n.setAttribute("style", `${r}; height: 100%;`), s.appendChild(n), !document.getElementById("sa-widget-styles")) {
3894
- const c = document.createElement("style");
3895
- c.id = "sa-widget-styles", c.textContent = nt, document.head.appendChild(c);
3896
- }
3897
- let i = be(n), o = !1;
3898
- const l = (c) => {
3772
+ const s = document.createElement("div");
3773
+ s.setAttribute("data-super-agent-widget", "");
3774
+ const r = Rt(a.theme ?? {});
3775
+ 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);
3779
+ }
3780
+ let i = We(s), o = !1;
3781
+ const l = (d) => {
3899
3782
  i && i.render(
3900
- V.createElement(st, {
3783
+ Q.createElement(Dt, {
3901
3784
  ...a,
3902
- initialOpen: c ?? o,
3785
+ initialOpen: d ?? o,
3903
3786
  onOpenChange: (p) => {
3904
3787
  o = p;
3905
3788
  }
@@ -3914,36 +3797,37 @@ function ut(t, a) {
3914
3797
  o = !1, l(!1);
3915
3798
  },
3916
3799
  destroy() {
3917
- i && (i.unmount(), i = null), n.remove();
3800
+ i && (i.unmount(), i = null), s.remove();
3918
3801
  }
3919
3802
  };
3920
3803
  }
3921
3804
  export {
3922
- Ve as ActionBar,
3923
- te as ChatProvider,
3924
- st as ChatWidget,
3925
- ue as Composer,
3926
- Oe as ErrorPart,
3927
- rt as FullpageLayout,
3928
- ze as Header,
3929
- I as Icon,
3930
- Ue as InterruptCard,
3931
- Ge as Message,
3932
- De as TextPart,
3933
- Le as ThinkingPart,
3934
- fe as Thread,
3935
- Se as ThreadList,
3936
- Ee as ToolCallPart,
3937
- Re as ToolResultPart,
3938
- Ce as Trigger,
3939
- Je as WelcomeScreen,
3940
- it as defaultTheme,
3941
- Ne as ensureIconFont,
3942
- ut as mount,
3943
- ct as themeToCSSVars,
3944
- Te as useAutoScroll,
3945
- ve as useChat,
3946
- Y as useChatContext,
3947
- ye as useConversations,
3948
- nt as widgetStyles
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
3949
3833
  };