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