super-agent-sdk 1.0.9 → 1.0.11

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