teodor-new-chat-ui 3.0.70 → 3.0.72

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/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as f from "react";
2
- import K, { useState as fe, useRef as at, useCallback as We, useEffect as Ve, useReducer as Dp, useMemo as wn, createContext as vc, useContext as bc, createElement as ro, useLayoutEffect as Lp } from "react";
2
+ import K, { useState as de, useRef as at, useCallback as We, useEffect as Ge, useReducer as Dp, useMemo as wn, createContext as vc, useContext as bc, createElement as ro, useLayoutEffect as Lp } from "react";
3
3
  import * as Ho from "react-dom";
4
4
  import wc from "react-dom";
5
5
  import { Square as Fp, Send as Bp, X as Vn, ExternalLink as Hp, Download as $p, Image as yc, FileText as Ua, Loader as zp, ChevronUp as pr, ChevronDown as Wn, Copy as Wa, Edit as Va, RotateCcw as Zs, Bot as Ga, Wrench as Up, User as Wp, ChevronRight as Vp, Check as Di, Circle as Gp, Edit3 as Sc, Paperclip as Ka, Loader2 as Kp, Plus as Yp, FileSpreadsheet as qp, MessageSquarePlus as Xp, MessageSquare as Jp, Calendar as Zp, Trash2 as Qp, PanelLeft as em, Settings as tm, Server as nm, EyeOff as rm, Eye as om, Layout as sm, MessageCircle as im, Save as am } from "lucide-react";
@@ -137,7 +137,7 @@ function fm() {
137
137
  function F() {
138
138
  }
139
139
  F.__reactDisabledLog = !0;
140
- function Q() {
140
+ function ee() {
141
141
  {
142
142
  if ($ === 0) {
143
143
  L = console.log, q = console.info, O = console.warn, _ = console.error, z = console.group, X = console.groupCollapsed, oe = console.groupEnd;
@@ -160,7 +160,7 @@ function fm() {
160
160
  $++;
161
161
  }
162
162
  }
163
- function de() {
163
+ function he() {
164
164
  {
165
165
  if ($--, $ === 0) {
166
166
  var T = {
@@ -214,7 +214,7 @@ function fm() {
214
214
  var le = typeof WeakMap == "function" ? WeakMap : Map;
215
215
  ne = new le();
216
216
  }
217
- function se(T, U) {
217
+ function ie(T, U) {
218
218
  if (!T || Z)
219
219
  return "";
220
220
  {
@@ -227,7 +227,7 @@ function fm() {
227
227
  var _e = Error.prepareStackTrace;
228
228
  Error.prepareStackTrace = void 0;
229
229
  var Me;
230
- Me = be.current, be.current = null, Q();
230
+ Me = be.current, be.current = null, ee();
231
231
  try {
232
232
  if (U) {
233
233
  var Ie = function() {
@@ -280,13 +280,13 @@ function fm() {
280
280
  }
281
281
  }
282
282
  } finally {
283
- Z = !1, be.current = Me, de(), Error.prepareStackTrace = _e;
283
+ Z = !1, be.current = Me, he(), Error.prepareStackTrace = _e;
284
284
  }
285
285
  var Fn = T ? T.displayName || T.name : "", za = Fn ? P(Fn) : "";
286
286
  return typeof T == "function" && ne.set(T, za), za;
287
287
  }
288
288
  function ke(T, U, te) {
289
- return se(T, !1);
289
+ return ie(T, !1);
290
290
  }
291
291
  function Fe(T) {
292
292
  var U = T.prototype;
@@ -296,7 +296,7 @@ function fm() {
296
296
  if (T == null)
297
297
  return "";
298
298
  if (typeof T == "function")
299
- return se(T, Fe(T));
299
+ return ie(T, Fe(T));
300
300
  if (typeof T == "string")
301
301
  return P(T);
302
302
  switch (T) {
@@ -321,7 +321,7 @@ function fm() {
321
321
  }
322
322
  return "";
323
323
  }
324
- var ce = Object.prototype.hasOwnProperty, je = {}, xe = b.ReactDebugCurrentFrame;
324
+ var ue = Object.prototype.hasOwnProperty, je = {}, xe = b.ReactDebugCurrentFrame;
325
325
  function H(T) {
326
326
  if (T) {
327
327
  var U = T._owner, te = Le(T.type, T._source, U ? U.type : null);
@@ -331,7 +331,7 @@ function fm() {
331
331
  }
332
332
  function ae(T, U, te, ge, _e) {
333
333
  {
334
- var Me = Function.call.bind(ce);
334
+ var Me = Function.call.bind(ue);
335
335
  for (var Ie in T)
336
336
  if (Me(T, Ie)) {
337
337
  var Te = void 0;
@@ -372,14 +372,14 @@ function fm() {
372
372
  if (rt(T))
373
373
  return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", dt(T)), Qe(T);
374
374
  }
375
- var Ge = b.ReactCurrentOwner, st = {
375
+ var Ve = b.ReactCurrentOwner, st = {
376
376
  key: !0,
377
377
  ref: !0,
378
378
  __self: !0,
379
379
  __source: !0
380
380
  }, Ke, it;
381
381
  function Pt(T) {
382
- if (ce.call(T, "ref")) {
382
+ if (ue.call(T, "ref")) {
383
383
  var U = Object.getOwnPropertyDescriptor(T, "ref").get;
384
384
  if (U && U.isReactWarning)
385
385
  return !1;
@@ -387,7 +387,7 @@ function fm() {
387
387
  return T.ref !== void 0;
388
388
  }
389
389
  function vn(T) {
390
- if (ce.call(T, "key")) {
390
+ if (ue.call(T, "key")) {
391
391
  var U = Object.getOwnPropertyDescriptor(T, "key").get;
392
392
  if (U && U.isReactWarning)
393
393
  return !1;
@@ -395,7 +395,7 @@ function fm() {
395
395
  return T.key !== void 0;
396
396
  }
397
397
  function Dn(T, U) {
398
- typeof T.ref == "string" && Ge.current;
398
+ typeof T.ref == "string" && Ve.current;
399
399
  }
400
400
  function Ue(T, U) {
401
401
  {
@@ -453,7 +453,7 @@ function fm() {
453
453
  var Me, Ie = {}, Te = null, ft = null;
454
454
  te !== void 0 && (Ct(te), Te = "" + te), vn(U) && (Ct(U.key), Te = "" + U.key), Pt(U) && (ft = U.ref, Dn(U, _e));
455
455
  for (Me in U)
456
- ce.call(U, Me) && !st.hasOwnProperty(Me) && (Ie[Me] = U[Me]);
456
+ ue.call(U, Me) && !st.hasOwnProperty(Me) && (Ie[Me] = U[Me]);
457
457
  if (T && T.defaultProps) {
458
458
  var Ye = T.defaultProps;
459
459
  for (Me in Ye)
@@ -463,16 +463,16 @@ function fm() {
463
463
  var Je = typeof T == "function" ? T.displayName || T.name || "Unknown" : T;
464
464
  Te && Ue(Ie, Je), ft && ur(Ie, Je);
465
465
  }
466
- return Rs(T, Te, ft, _e, ge, Ge.current, Ie);
466
+ return Rs(T, Te, ft, _e, ge, Ve.current, Ie);
467
467
  }
468
468
  }
469
- var J = b.ReactCurrentOwner, ie = b.ReactDebugCurrentFrame;
469
+ var J = b.ReactCurrentOwner, se = b.ReactDebugCurrentFrame;
470
470
  function Re(T) {
471
471
  if (T) {
472
472
  var U = T._owner, te = Le(T.type, T._source, U ? U.type : null);
473
- ie.setExtraStackFrame(te);
473
+ se.setExtraStackFrame(te);
474
474
  } else
475
- ie.setExtraStackFrame(null);
475
+ se.setExtraStackFrame(null);
476
476
  }
477
477
  var Pe;
478
478
  Pe = !1;
@@ -1864,11 +1864,11 @@ const $c = (e) => {
1864
1864
  duplex: "half"
1865
1865
  }), oe;
1866
1866
  if (j.isFormData(b) && (oe = X.headers.get("content-type")) && I.setContentType(oe), X.body) {
1867
- const [F, Q] = tl(
1867
+ const [F, ee] = tl(
1868
1868
  $,
1869
1869
  Co(nl(C))
1870
1870
  );
1871
- b = ol(X.body, sl, F, Q);
1871
+ b = ol(X.body, sl, F, ee);
1872
1872
  }
1873
1873
  }
1874
1874
  j.isString(A) || (A = A ? "include" : "omit");
@@ -1886,16 +1886,16 @@ const $c = (e) => {
1886
1886
  const _ = d && (R === "stream" || R === "response");
1887
1887
  if (d && (S || _ && N)) {
1888
1888
  const X = {};
1889
- ["status", "statusText", "headers"].forEach((de) => {
1890
- X[de] = O[de];
1889
+ ["status", "statusText", "headers"].forEach((he) => {
1890
+ X[he] = O[he];
1891
1891
  });
1892
- const oe = j.toFiniteNumber(O.headers.get("content-length")), [F, Q] = S && tl(
1892
+ const oe = j.toFiniteNumber(O.headers.get("content-length")), [F, ee] = S && tl(
1893
1893
  oe,
1894
1894
  Co(nl(S), !0)
1895
1895
  ) || [];
1896
1896
  O = new r(
1897
1897
  ol(O.body, sl, F, () => {
1898
- Q && Q(), N && N();
1898
+ ee && ee(), N && N();
1899
1899
  }),
1900
1900
  X
1901
1901
  );
@@ -2504,7 +2504,7 @@ class Gg {
2504
2504
  }
2505
2505
  const En = new Gg();
2506
2506
  function Kg(e = {}) {
2507
- const t = e.baseUrl ?? "/api/chat", n = e.streamPath ?? "/runs/stream", [r, o] = fe(e.token ?? null), s = at(e.headers ?? {}), [i, a] = fe(!1), [c, u] = fe(null), [d, h] = fe(""), [p, v] = fe(null), g = at(null), x = We((y) => {
2507
+ const t = e.baseUrl ?? "/api/chat", n = e.streamPath ?? "/runs/stream", [r, o] = de(e.token ?? null), s = at(e.headers ?? {}), [i, a] = de(!1), [c, u] = de(null), [d, h] = de(""), [p, v] = de(null), g = at(null), x = We((y) => {
2508
2508
  o(y);
2509
2509
  }, []), m = We(() => {
2510
2510
  var y;
@@ -2545,8 +2545,8 @@ function Kg(e = {}) {
2545
2545
  const z = window.__AUTH_TOKEN__, X = ((A = window.localStorage) == null ? void 0 : A.getItem("authToken")) || null;
2546
2546
  let oe = null;
2547
2547
  try {
2548
- const Q = (k = window.localStorage) == null ? void 0 : k.getItem("chat-settings");
2549
- Q && (oe = ((M = JSON.parse(Q)) == null ? void 0 : M.apiKey) || null);
2548
+ const ee = (k = window.localStorage) == null ? void 0 : k.getItem("chat-settings");
2549
+ ee && (oe = ((M = JSON.parse(ee)) == null ? void 0 : M.apiKey) || null);
2550
2550
  } catch {
2551
2551
  }
2552
2552
  const F = z || X || oe || null;
@@ -2594,20 +2594,20 @@ function Kg(e = {}) {
2594
2594
  O = O.slice(X + 2);
2595
2595
  const F = qg(oe);
2596
2596
  if (!F) continue;
2597
- let Q;
2597
+ let ee;
2598
2598
  try {
2599
- Q = JSON.parse(F);
2599
+ ee = JSON.parse(F);
2600
2600
  } catch {
2601
2601
  R && console.debug("[use-chat] skip malformed SSE data:", F == null ? void 0 : F.slice(0, 200));
2602
2602
  continue;
2603
2603
  }
2604
- const de = Yg(Q) ? Q.data : Q;
2605
- if (R && console.debug("[use-chat] event:", de == null ? void 0 : de.type, de), E == null || E(de), de.type === "token")
2606
- e.autoAppendAssistant !== !1 && h((be) => be + de.content);
2607
- else if (de.type === "message_delta") {
2608
- const be = de.delta.filter((Y) => Y.type === "text").map((Y) => Y.text).join("");
2604
+ const he = Yg(ee) ? ee.data : ee;
2605
+ if (R && console.debug("[use-chat] event:", he == null ? void 0 : he.type, he), E == null || E(he), he.type === "token")
2606
+ e.autoAppendAssistant !== !1 && h((be) => be + he.content);
2607
+ else if (he.type === "message_delta") {
2608
+ const be = he.delta.filter((Y) => Y.type === "text").map((Y) => Y.text).join("");
2609
2609
  be && e.autoAppendAssistant !== !1 && h((Y) => Y + be);
2610
- } else de.type === "checkpoint" ? v(de.checkpointId) : de.type === "error" && u(de.message);
2610
+ } else he.type === "checkpoint" ? v(he.checkpointId) : he.type === "error" && u(he.message);
2611
2611
  }
2612
2612
  }
2613
2613
  } catch (N) {
@@ -2621,7 +2621,7 @@ function Kg(e = {}) {
2621
2621
  },
2622
2622
  [t, r, e.autoAppendAssistant]
2623
2623
  );
2624
- return Ve(() => () => {
2624
+ return Ge(() => () => {
2625
2625
  var y;
2626
2626
  return (y = g.current) == null ? void 0 : y.abort();
2627
2627
  }, []), {
@@ -2705,7 +2705,7 @@ function Zg(e = []) {
2705
2705
  }, [i]), c = We((d) => {
2706
2706
  r.current.push(d), a();
2707
2707
  }, [a]);
2708
- Ve(() => () => {
2708
+ Ge(() => () => {
2709
2709
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
2710
2710
  }, []);
2711
2711
  const u = wn(() => ({
@@ -2923,7 +2923,7 @@ async function ix(e, t = [], n, r, o, s) {
2923
2923
  const Kc = vc(null);
2924
2924
  function ao({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialThreadId: o = null, historyPageSize: s, autoLoadInitial: i = !0, enableFileAgentRouting: a = !1, fileAgentId: c = "invoice_reader" }) {
2925
2925
  const u = En;
2926
- Ve(() => {
2926
+ Ge(() => {
2927
2927
  t && u.updateConfig({
2928
2928
  baseUrl: t.baseUrl,
2929
2929
  authToken: t.apiKey
@@ -2937,8 +2937,8 @@ function ao({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2937
2937
  // any extra headers caller wants
2938
2938
  // Ensure the path matches the chat endpoint
2939
2939
  streamPath: "/chat/runs/stream"
2940
- }), [x, m] = fe(() => typeof u.getAuthToken == "function" ? u.getAuthToken() : null);
2941
- Ve(() => {
2940
+ }), [x, m] = de(() => typeof u.getAuthToken == "function" ? u.getAuthToken() : null);
2941
+ Ge(() => {
2942
2942
  g(typeof u.getAuthToken == "function" ? u.getAuthToken() : null);
2943
2943
  const H = u.onTokenChange((ae) => {
2944
2944
  m(ae), g(ae);
@@ -2949,16 +2949,16 @@ function ao({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2949
2949
  }, [u, g]);
2950
2950
  const b = We((H) => {
2951
2951
  u.setAuthToken(H);
2952
- }, [u]), { state: w, seed: y, prepend: E, pushUser: S, onEvent: C, reset: R } = Zg(), I = s && s > 0 ? s : 6, [A, k] = fe(!1), [M, W] = fe(!1), [G, N] = fe(null), [$, L] = fe(void 0), q = We(
2952
+ }, [u]), { state: w, seed: y, prepend: E, pushUser: S, onEvent: C, reset: R } = Zg(), I = s && s > 0 ? s : 6, [A, k] = de(!1), [M, W] = de(!1), [G, N] = de(null), [$, L] = de(void 0), q = We(
2953
2953
  (H, ae) => {
2954
2954
  const Be = Array.isArray(H == null ? void 0 : H.messages) ? H.messages : [];
2955
2955
  ae === "replace" ? y(Be) : ae === "prepend" && Be.length && E(Be), N((H == null ? void 0 : H.nextCursor) ?? null), k(!!(H != null && H.hasMore)), L((nt) => (H == null ? void 0 : H.checkpointId) ?? nt ?? void 0);
2956
2956
  },
2957
2957
  [y, E]
2958
- ), [O, _] = fe([]), [z, X] = fe(null), oe = We(async () => {
2958
+ ), [O, _] = de([]), [z, X] = de(null), oe = We(async () => {
2959
2959
  const H = await u.listThreads();
2960
2960
  _(H);
2961
- }, [u]), [F, Q] = fe(!1), de = We(
2961
+ }, [u]), [F, ee] = de(!1), he = We(
2962
2962
  async (H) => {
2963
2963
  const ae = (H == null ? void 0 : H.maxAttempts) ?? 5, Be = (H == null ? void 0 : H.baseDelayMs) ?? 500, nt = (H == null ? void 0 : H.timeoutMs) ?? 2e3;
2964
2964
  if (!u.baseUrl) return !1;
@@ -2969,38 +2969,38 @@ function ao({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2969
2969
  // root
2970
2970
  "/api/v2/health",
2971
2971
  "/api/v2/chat/health"
2972
- ], Qe = async (Ge) => {
2972
+ ], Qe = async (Ve) => {
2973
2973
  try {
2974
- const st = new AbortController(), Ke = setTimeout(() => st.abort(), nt), it = await fetch(Ge, { method: "GET", signal: st.signal });
2974
+ const st = new AbortController(), Ke = setTimeout(() => st.abort(), nt), it = await fetch(Ve, { method: "GET", signal: st.signal });
2975
2975
  return clearTimeout(Ke), it.ok;
2976
2976
  } catch {
2977
2977
  return !1;
2978
2978
  }
2979
- }, Ct = async (Ge) => {
2979
+ }, Ct = async (Ve) => {
2980
2980
  try {
2981
- const st = new AbortController(), Ke = setTimeout(() => st.abort(), nt), it = await fetch(Ge, { method: "HEAD", signal: st.signal });
2981
+ const st = new AbortController(), Ke = setTimeout(() => st.abort(), nt), it = await fetch(Ve, { method: "HEAD", signal: st.signal });
2982
2982
  return clearTimeout(Ke), it.ok;
2983
2983
  } catch {
2984
2984
  return !1;
2985
2985
  }
2986
2986
  };
2987
- for (let Ge = 0; Ge < ae; Ge++) {
2988
- console.debug(`[ChatProvider] health-check attempt ${Ge + 1}/${ae}`);
2987
+ for (let Ve = 0; Ve < ae; Ve++) {
2988
+ console.debug(`[ChatProvider] health-check attempt ${Ve + 1}/${ae}`);
2989
2989
  for (const Ke of rt) {
2990
2990
  let it = Ke;
2991
2991
  dt.endsWith("/api") && Ke.startsWith("/api") && (it = Ke.replace(/^\/api/, "") || "/");
2992
2992
  const Pt = it === "/" ? dt + "/" : dt + it;
2993
2993
  if (console.debug(`[ChatProvider] checking ${Pt}`), await Qe(Pt) || Ke === "/" && await Ct(dt + "/"))
2994
- return Q(!0), !0;
2994
+ return ee(!0), !0;
2995
2995
  }
2996
- const st = Be * Math.pow(2, Ge);
2996
+ const st = Be * Math.pow(2, Ve);
2997
2997
  await new Promise((Ke) => setTimeout(Ke, st));
2998
2998
  }
2999
- return Q(!1), !1;
2999
+ return ee(!1), !1;
3000
3000
  },
3001
3001
  [u.baseUrl]
3002
3002
  );
3003
- Ve(() => {
3003
+ Ge(() => {
3004
3004
  let H = !0;
3005
3005
  if (!u.baseUrl) {
3006
3006
  console.debug("[ChatProvider] skipping initial refreshThreads: api.baseUrl not configured");
@@ -3008,7 +3008,7 @@ function ao({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3008
3008
  }
3009
3009
  return (async () => {
3010
3010
  try {
3011
- const ae = await de();
3011
+ const ae = await he();
3012
3012
  if (!H) return;
3013
3013
  ae ? oe().catch(() => {
3014
3014
  }) : console.warn("[ChatProvider] backend health-check failed — skipping initial loads");
@@ -3017,11 +3017,11 @@ function ao({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3017
3017
  })(), () => {
3018
3018
  H = !1;
3019
3019
  };
3020
- }, [oe, u.baseUrl, de]), Ve(() => {
3020
+ }, [oe, u.baseUrl, he]), Ge(() => {
3021
3021
  r == null || r(z);
3022
3022
  }, [z, r]);
3023
3023
  const be = at(null);
3024
- Ve(() => {
3024
+ Ge(() => {
3025
3025
  if (o && i) {
3026
3026
  if (!u.baseUrl) {
3027
3027
  console.debug("[ChatProvider] skipping initial load: api.baseUrl not configured");
@@ -3073,10 +3073,10 @@ function ao({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3073
3073
  }, [u, z, q, I]), le = We(async () => {
3074
3074
  if (!z) throw new Error("No active thread");
3075
3075
  await P(z);
3076
- }, [z, P]), se = at(!1);
3077
- Ve(() => {
3078
- const H = se.current;
3079
- if (se.current = d, H && !d && z) {
3076
+ }, [z, P]), ie = at(!1);
3077
+ Ge(() => {
3078
+ const H = ie.current;
3079
+ if (ie.current = d, H && !d && z) {
3080
3080
  const ae = w.lastCheckpointId ?? void 0;
3081
3081
  (async () => {
3082
3082
  try {
@@ -3102,7 +3102,7 @@ function ao({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3102
3102
  await u.deleteThread(H), await oe(), z === H && (X(null), R([]), k(!1), N(null), L(void 0));
3103
3103
  }, [u, oe, z, R]), Le = We(async (H, ae) => {
3104
3104
  await u.updateThread(H, ae), await oe();
3105
- }, [u, oe]), ce = We(async (H, ae) => {
3105
+ }, [u, oe]), ue = We(async (H, ae) => {
3106
3106
  var Dn;
3107
3107
  const Be = (ae == null ? void 0 : ae.attachments) || [], { contentParts: nt, filesInfo: dt } = await ix(
3108
3108
  u,
@@ -3125,14 +3125,14 @@ function ao({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3125
3125
  const Ct = {
3126
3126
  ...Qe,
3127
3127
  content: Qe.content.filter((Ue) => Ue.type === "text" || Ue.type === "image_url" || Ue.type === "file")
3128
- }, Ge = { ...(ae == null ? void 0 : ae.payloadExtras) ?? {} }, st = !!Ge.edit, Ke = Ge.originalMessageId, it = typeof Ke == "string" ? Ke : void 0, Pt = Be && Be.length > 0, vn = {
3128
+ }, Ve = { ...(ae == null ? void 0 : ae.payloadExtras) ?? {} }, st = !!Ve.edit, Ke = Ve.originalMessageId, it = typeof Ke == "string" ? Ke : void 0, Pt = Be && Be.length > 0, vn = {
3129
3129
  ...z ? { threadId: z } : {},
3130
3130
  payload: {
3131
3131
  messages: [Ct],
3132
3132
  attachments: Qe.content.filter((Ue) => Ue.type === "file").map((Ue) => ({ type: "file", url: Ue.url, mimeType: Ue.mimeType, name: Ue.name, size: Ue.size })),
3133
3133
  files_info: dt,
3134
3134
  ...a && Pt && c ? { active_agent: c } : {},
3135
- ...Ge
3135
+ ...Ve
3136
3136
  },
3137
3137
  checkpointId: (ae == null ? void 0 : ae.checkpointId) ?? w.lastCheckpointId ?? void 0,
3138
3138
  checkpointNs: ae == null ? void 0 : ae.checkpointNs,
@@ -3198,7 +3198,7 @@ function ao({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3198
3198
  deleteThread: Fe,
3199
3199
  renameThread: Le,
3200
3200
  loadThread: P,
3201
- send: ce,
3201
+ send: ue,
3202
3202
  stop: v
3203
3203
  };
3204
3204
  return /* @__PURE__ */ l.jsx(Kc.Provider, { value: xe, children: e });
@@ -3255,7 +3255,7 @@ function zi(e) {
3255
3255
  function qe(e) {
3256
3256
  return e(Yc);
3257
3257
  }
3258
- function ue(e, t) {
3258
+ function ce(e, t) {
3259
3259
  return Oe(e, lx(t, Go));
3260
3260
  }
3261
3261
  function Mt(e, t) {
@@ -3376,7 +3376,7 @@ function V(e) {
3376
3376
  };
3377
3377
  }
3378
3378
  function ut(e, t) {
3379
- return Ko(V(t), (n) => ue(e, n));
3379
+ return Ko(V(t), (n) => ce(e, n));
3380
3380
  }
3381
3381
  function Ee() {
3382
3382
  const e = [];
@@ -3399,7 +3399,7 @@ function Ee() {
3399
3399
  };
3400
3400
  }
3401
3401
  function yt(e) {
3402
- return Ko(Ee(), (t) => ue(e, t));
3402
+ return Ko(Ee(), (t) => ce(e, t));
3403
3403
  }
3404
3404
  function Ne(e, t = [], { singleton: n } = { singleton: !0 }) {
3405
3405
  return {
@@ -3439,7 +3439,7 @@ function Ze(...e) {
3439
3439
  }
3440
3440
  };
3441
3441
  }
3442
- function he(e, t = Xc) {
3442
+ function fe(e, t = Xc) {
3443
3443
  return B(e, He(t));
3444
3444
  }
3445
3445
  function li(...e) {
@@ -3589,19 +3589,19 @@ function Jc(e, t, n) {
3589
3589
  const ht = Ne(
3590
3590
  () => {
3591
3591
  const e = Ee(), t = Ee(), n = V(0), r = Ee(), o = V(0), s = Ee(), i = Ee(), a = V(0), c = V(0), u = V(0), d = V(0), h = Ee(), p = Ee(), v = V(!1), g = V(!1), x = V(!1);
3592
- return ue(
3592
+ return ce(
3593
3593
  B(
3594
3594
  e,
3595
3595
  re(({ scrollTop: m }) => m)
3596
3596
  ),
3597
3597
  t
3598
- ), ue(
3598
+ ), ce(
3599
3599
  B(
3600
3600
  e,
3601
3601
  re(({ scrollHeight: m }) => m)
3602
3602
  ),
3603
3603
  i
3604
- ), ue(t, o), {
3604
+ ), ce(t, o), {
3605
3605
  deviation: n,
3606
3606
  fixedFooterHeight: u,
3607
3607
  fixedHeaderHeight: c,
@@ -3951,7 +3951,7 @@ const Ax = {
3951
3951
  ),
3952
3952
  []
3953
3953
  );
3954
- ue(
3954
+ ce(
3955
3955
  B(
3956
3956
  c,
3957
3957
  pe((S) => S.length > 0),
@@ -3966,7 +3966,7 @@ const Ax = {
3966
3966
  })
3967
3967
  ),
3968
3968
  x
3969
- ), ue(
3969
+ ), ce(
3970
3970
  B(
3971
3971
  r,
3972
3972
  Se(x),
@@ -3980,7 +3980,7 @@ const Ax = {
3980
3980
  ])
3981
3981
  ),
3982
3982
  n
3983
- ), ue(u, d);
3983
+ ), ce(u, d);
3984
3984
  const b = ut(
3985
3985
  B(
3986
3986
  u,
@@ -3988,7 +3988,7 @@ const Ax = {
3988
3988
  ),
3989
3989
  !0
3990
3990
  );
3991
- ue(
3991
+ ce(
3992
3992
  B(
3993
3993
  d,
3994
3994
  pe((S) => S !== void 0 && De(qe(x).sizeTree)),
@@ -4036,7 +4036,7 @@ const Ax = {
4036
4036
  );
4037
4037
  });
4038
4038
  const y = yt(s);
4039
- ue(
4039
+ ce(
4040
4040
  B(
4041
4041
  s,
4042
4042
  Se(x),
@@ -4107,7 +4107,7 @@ const Ax = {
4107
4107
  })
4108
4108
  )
4109
4109
  );
4110
- return ue(
4110
+ return ce(
4111
4111
  B(
4112
4112
  i,
4113
4113
  Se(x, v),
@@ -4182,19 +4182,19 @@ function kx(e) {
4182
4182
  const au = Ne(
4183
4183
  ([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
4184
4184
  const s = Ee(), i = Ee(), a = yt(B(s, re(kx)));
4185
- return ue(
4185
+ return ce(
4186
4186
  B(
4187
4187
  a,
4188
4188
  re((c) => c.totalCount)
4189
4189
  ),
4190
4190
  n
4191
- ), ue(
4191
+ ), ce(
4192
4192
  B(
4193
4193
  a,
4194
4194
  re((c) => c.groupIndices)
4195
4195
  ),
4196
4196
  e
4197
- ), ue(
4197
+ ), ce(
4198
4198
  B(
4199
4199
  Ze(o, t, r),
4200
4200
  pe(([c, u]) => qo(u)),
@@ -4246,7 +4246,7 @@ const Fr = Ne(
4246
4246
  function y() {
4247
4247
  m && (m(), m = null), w && (w(), w = null), b && (clearTimeout(b), b = null), ye(c, !1);
4248
4248
  }
4249
- return ue(
4249
+ return ce(
4250
4250
  B(
4251
4251
  v,
4252
4252
  Se(n, h, r, x, a, i, p),
@@ -4266,8 +4266,8 @@ const Fr = Ne(
4266
4266
  };
4267
4267
  if (y(), q === "smooth") {
4268
4268
  let F = !1;
4269
- w = Oe(t, (Q) => {
4270
- F = F || Q;
4269
+ w = Oe(t, (ee) => {
4270
+ F = F || ee;
4271
4271
  }), m = Mt(d, () => {
4272
4272
  oe(F);
4273
4273
  });
@@ -4311,7 +4311,7 @@ function Ki(e, t) {
4311
4311
  const Br = Ne(
4312
4312
  ([{ defaultItemSize: e, listRefresh: t, sizes: n }, { scrollTop: r }, { scrollTargetReached: o, scrollToIndex: s }, { didMount: i }]) => {
4313
4313
  const a = V(!0), c = V(0), u = V(!0);
4314
- return ue(
4314
+ return ce(
4315
4315
  B(
4316
4316
  i,
4317
4317
  Se(c),
@@ -4319,7 +4319,7 @@ const Br = Ne(
4319
4319
  Wt(!1)
4320
4320
  ),
4321
4321
  a
4322
- ), ue(
4322
+ ), ce(
4323
4323
  B(
4324
4324
  i,
4325
4325
  Se(c),
@@ -4367,7 +4367,7 @@ const Er = "up", xr = "down", Ox = "none", Mx = {
4367
4367
  }, Dx = 0, Hr = Ne(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
4368
4368
  const i = V(!1), a = V(!0), c = Ee(), u = Ee(), d = V(4), h = V(Dx), p = ut(
4369
4369
  B(
4370
- li(B(he(o), In(1), Wt(!0)), B(he(o), In(1), Wt(!1), vl(100))),
4370
+ li(B(fe(o), In(1), Wt(!0)), B(fe(o), In(1), Wt(!1), vl(100))),
4371
4371
  He()
4372
4372
  ),
4373
4373
  !1
@@ -4375,17 +4375,17 @@ const Er = "up", xr = "down", Ox = "none", Mx = {
4375
4375
  B(li(B(n, Wt(!0)), B(n, Wt(!1), vl(200))), He()),
4376
4376
  !1
4377
4377
  );
4378
- ue(
4378
+ ce(
4379
4379
  B(
4380
- Ze(he(o), he(h)),
4380
+ Ze(fe(o), fe(h)),
4381
4381
  re(([w, y]) => w <= y),
4382
4382
  He()
4383
4383
  ),
4384
4384
  a
4385
- ), ue(B(a, tn(50)), u);
4385
+ ), ce(B(a, tn(50)), u);
4386
4386
  const g = yt(
4387
4387
  B(
4388
- Ze(r, he(s), he(t), he(e), he(d)),
4388
+ Ze(r, fe(s), fe(t), fe(e), fe(d)),
4389
4389
  Gt((w, [{ scrollHeight: y, scrollTop: E }, S, C, R, I]) => {
4390
4390
  const A = E + S - y > -I, k = {
4391
4391
  scrollHeight: y,
@@ -4444,15 +4444,15 @@ const Er = "up", xr = "down", Ox = "none", Mx = {
4444
4444
  ),
4445
4445
  0
4446
4446
  );
4447
- ue(
4447
+ ce(
4448
4448
  B(
4449
4449
  g,
4450
4450
  re((w) => w.atBottom)
4451
4451
  ),
4452
4452
  i
4453
- ), ue(B(i, tn(50)), c);
4453
+ ), ce(B(i, tn(50)), c);
4454
4454
  const m = V(xr);
4455
- ue(
4455
+ ce(
4456
4456
  B(
4457
4457
  r,
4458
4458
  re(({ scrollTop: w }) => w),
@@ -4464,16 +4464,16 @@ const Er = "up", xr = "down", Ox = "none", Mx = {
4464
4464
  re((w) => w.direction)
4465
4465
  ),
4466
4466
  m
4467
- ), ue(B(r, tn(50), Wt(Ox)), m);
4467
+ ), ce(B(r, tn(50), Wt(Ox)), m);
4468
4468
  const b = V(0);
4469
- return ue(
4469
+ return ce(
4470
4470
  B(
4471
4471
  p,
4472
4472
  pe((w) => !w),
4473
4473
  Wt(0)
4474
4474
  ),
4475
4475
  b
4476
- ), ue(
4476
+ ), ce(
4477
4477
  B(
4478
4478
  o,
4479
4479
  tn(100),
@@ -4509,15 +4509,15 @@ const Yi = Ne(
4509
4509
  const s = Ee(), i = V(0), a = V(0), c = V(0), u = ut(
4510
4510
  B(
4511
4511
  Ze(
4512
- he(r),
4513
- he(o),
4514
- he(n),
4515
- he(s, Tr),
4516
- he(c),
4517
- he(i),
4518
- he(t),
4519
- he(e),
4520
- he(a)
4512
+ fe(r),
4513
+ fe(o),
4514
+ fe(n),
4515
+ fe(s, Tr),
4516
+ fe(c),
4517
+ fe(i),
4518
+ fe(t),
4519
+ fe(e),
4520
+ fe(a)
4521
4521
  ),
4522
4522
  re(
4523
4523
  ([
@@ -4654,20 +4654,20 @@ const _n = Ne(
4654
4654
  { recalcInProgress: g }
4655
4655
  ]) => {
4656
4656
  const x = V([]), m = V(0), b = Ee();
4657
- ue(s.topItemsIndexes, x);
4657
+ ce(s.topItemsIndexes, x);
4658
4658
  const w = ut(
4659
4659
  B(
4660
4660
  Ze(
4661
4661
  v,
4662
4662
  g,
4663
- he(c, Tr),
4664
- he(o),
4665
- he(r),
4666
- he(u),
4663
+ fe(c, Tr),
4664
+ fe(o),
4665
+ fe(r),
4666
+ fe(u),
4667
4667
  d,
4668
- he(x),
4669
- he(t),
4670
- he(n),
4668
+ fe(x),
4669
+ fe(t),
4670
+ fe(n),
4671
4671
  e
4672
4672
  ),
4673
4673
  pe(([C, R, , I, , , , , , , A]) => {
@@ -4704,12 +4704,12 @@ const _n = Ne(
4704
4704
  );
4705
4705
  const z = [];
4706
4706
  if (W.length > 0) {
4707
- const de = W[0], be = W[W.length - 1];
4707
+ const he = W[0], be = W[W.length - 1];
4708
4708
  let Y = 0;
4709
- for (const P of Yo(O, de, be)) {
4710
- const Z = P.value, ne = Math.max(P.start, de), le = Math.min(P.end, be);
4711
- for (let se = ne; se <= le; se++)
4712
- z.push({ data: $ == null ? void 0 : $[se], index: se, offset: Y, size: Z }), Y += Z;
4709
+ for (const P of Yo(O, he, be)) {
4710
+ const Z = P.value, ne = Math.max(P.start, he), le = Math.min(P.end, be);
4711
+ for (let ie = ne; ie <= le; ie++)
4712
+ z.push({ data: $ == null ? void 0 : $[ie], index: ie, offset: Y, size: Z }), Y += Z;
4713
4713
  }
4714
4714
  }
4715
4715
  if (!M)
@@ -4717,23 +4717,23 @@ const _n = Ne(
4717
4717
  const X = W.length > 0 ? W[W.length - 1] + 1 : 0, oe = Rx(q, C, R, X);
4718
4718
  if (oe.length === 0)
4719
4719
  return null;
4720
- const F = I - 1, Q = Ko([], (de) => {
4720
+ const F = I - 1, ee = Ko([], (he) => {
4721
4721
  for (const be of oe) {
4722
4722
  const Y = be.value;
4723
4723
  let P = Y.offset, Z = be.start;
4724
4724
  const ne = Y.size;
4725
4725
  if (Y.offset < C) {
4726
4726
  Z += Math.floor((C - Y.offset + N) / (ne + N));
4727
- const se = Z - be.start;
4728
- P += se * ne + se * N;
4727
+ const ie = Z - be.start;
4728
+ P += ie * ne + ie * N;
4729
4729
  }
4730
4730
  Z < X && (P += (X - Z) * ne, Z = X);
4731
4731
  const le = Math.min(be.end, F);
4732
- for (let se = Z; se <= le && !(P >= R); se++)
4733
- de.push({ data: $ == null ? void 0 : $[se], index: se, offset: P, size: ne }), P += ne + N;
4732
+ for (let ie = Z; ie <= le && !(P >= R); ie++)
4733
+ he.push({ data: $ == null ? void 0 : $[ie], index: ie, offset: P, size: ne }), P += ne + N;
4734
4734
  }
4735
4735
  });
4736
- return co(Q, z, I, N, L, G);
4736
+ return co(ee, z, I, N, L, G);
4737
4737
  }
4738
4738
  ),
4739
4739
  //@ts-expect-error filter needs to be fixed
@@ -4742,26 +4742,26 @@ const _n = Ne(
4742
4742
  ),
4743
4743
  _s
4744
4744
  );
4745
- ue(
4745
+ ce(
4746
4746
  B(
4747
4747
  e,
4748
4748
  pe($i),
4749
4749
  re((C) => C == null ? void 0 : C.length)
4750
4750
  ),
4751
4751
  o
4752
- ), ue(
4752
+ ), ce(
4753
4753
  B(
4754
4754
  w,
4755
4755
  re((C) => C.topListHeight)
4756
4756
  ),
4757
4757
  h
4758
- ), ue(h, a), ue(
4758
+ ), ce(h, a), ce(
4759
4759
  B(
4760
4760
  w,
4761
4761
  re((C) => [C.top, C.bottom])
4762
4762
  ),
4763
4763
  i
4764
- ), ue(
4764
+ ), ce(
4765
4765
  B(
4766
4766
  w,
4767
4767
  re((C) => C.items)
@@ -4826,7 +4826,7 @@ const _n = Ne(
4826
4826
  ),
4827
4827
  0
4828
4828
  );
4829
- return ue(he(i), s), { totalListHeight: i, totalListHeightChanged: s };
4829
+ return ce(fe(i), s), { totalListHeight: i, totalListHeightChanged: s };
4830
4830
  },
4831
4831
  $e(ht, _n),
4832
4832
  { singleton: !0 }
@@ -4861,7 +4861,7 @@ const _n = Ne(
4861
4861
  { scrollToIndex: u }
4862
4862
  ]) => {
4863
4863
  const d = Ee();
4864
- return ue(
4864
+ return ce(
4865
4865
  B(
4866
4866
  d,
4867
4867
  Se(t, c, n, s, o, r, a),
@@ -4921,8 +4921,8 @@ const Hx = (e, t) => typeof e == "function" ? El(e(t)) : t && El(e), $x = Ne(
4921
4921
  }
4922
4922
  Oe(
4923
4923
  B(
4924
- Ze(B(he(t), In(1)), c),
4925
- Se(he(g), s, a, h),
4924
+ Ze(B(fe(t), In(1)), c),
4925
+ Se(fe(g), s, a, h),
4926
4926
  re(([[S, C], R, I, A, k]) => {
4927
4927
  let M = C && A, W = "auto";
4928
4928
  return M && (W = Hx(R, I || k), M = M && !!W), { followOutputBehavior: W, shouldFollow: M, totalCount: S };
@@ -4945,7 +4945,7 @@ const Hx = (e, t) => typeof e == "function" ? El(e(t)) : t && El(e), $x = Ne(
4945
4945
  }
4946
4946
  Oe(
4947
4947
  B(
4948
- Ze(he(g), t, u),
4948
+ Ze(fe(g), t, u),
4949
4949
  pe(([S, , C]) => S && C),
4950
4950
  Gt(
4951
4951
  ({ value: S }, [, C]) => ({ refreshed: S === C, value: C }),
@@ -4959,26 +4959,26 @@ const Hx = (e, t) => typeof e == "function" ? El(e(t)) : t && El(e), $x = Ne(
4959
4959
  }
4960
4960
  ), Oe(x, () => {
4961
4961
  w(qe(g) !== !1);
4962
- }), Oe(Ze(he(g), o), ([S, C]) => {
4962
+ }), Oe(Ze(fe(g), o), ([S, C]) => {
4963
4963
  S && !C.atBottom && C.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && b("auto");
4964
4964
  });
4965
4965
  const y = V(null), E = Ee();
4966
- return ue(
4966
+ return ce(
4967
4967
  li(
4968
4968
  B(
4969
- he(r),
4969
+ fe(r),
4970
4970
  re((S) => {
4971
4971
  var C;
4972
4972
  return (C = S == null ? void 0 : S.length) != null ? C : 0;
4973
4973
  })
4974
4974
  ),
4975
- B(he(t))
4975
+ B(fe(t))
4976
4976
  ),
4977
4977
  E
4978
4978
  ), Oe(
4979
4979
  B(
4980
4980
  Ze(B(E, In(1)), c),
4981
- Se(he(y), a, h, p),
4981
+ Se(fe(y), a, h, p),
4982
4982
  re(([[S, C], R, I, A, k]) => C && I && (R == null ? void 0 : R({ context: k, totalCount: S, scrollingInProgress: A }))),
4983
4983
  pe((S) => !!S),
4984
4984
  tn(0)
@@ -5004,7 +5004,7 @@ const Hx = (e, t) => typeof e == "function" ? El(e(t)) : t && El(e), $x = Ne(
5004
5004
  hu
5005
5005
  )
5006
5006
  ), zx = Ne(
5007
- ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (ue(
5007
+ ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (ce(
5008
5008
  B(
5009
5009
  a,
5010
5010
  Se(s),
@@ -5049,7 +5049,7 @@ const Hx = (e, t) => typeof e == "function" ? El(e(t)) : t && El(e), $x = Ne(
5049
5049
  ), pu = Ne(
5050
5050
  ([{ scrollVelocity: e }]) => {
5051
5051
  const t = V(!1), n = Ee(), r = V(!1);
5052
- return ue(
5052
+ return ce(
5053
5053
  B(
5054
5054
  e,
5055
5055
  Se(r, t, n),
@@ -5077,7 +5077,7 @@ const Hx = (e, t) => typeof e == "function" ? El(e(t)) : t && El(e), $x = Ne(
5077
5077
  { singleton: !0 }
5078
5078
  ), qi = Ne(([{ scrollContainerState: e, scrollTo: t }]) => {
5079
5079
  const n = Ee(), r = Ee(), o = Ee(), s = V(!1), i = V(void 0);
5080
- return ue(
5080
+ return ce(
5081
5081
  B(
5082
5082
  Ze(n, r),
5083
5083
  re(([{ scrollHeight: a, scrollTop: c, viewportHeight: u }, { offsetTop: d }]) => ({
@@ -5087,7 +5087,7 @@ const Hx = (e, t) => typeof e == "function" ? El(e(t)) : t && El(e), $x = Ne(
5087
5087
  }))
5088
5088
  ),
5089
5089
  e
5090
- ), ue(
5090
+ ), ce(
5091
5091
  B(
5092
5092
  t,
5093
5093
  Se(r),
@@ -5116,7 +5116,7 @@ const Hx = (e, t) => typeof e == "function" ? El(e(t)) : t && El(e), $x = Ne(
5116
5116
  { useWindowScroll: i, windowScrollContainerState: a, windowViewportRect: c }
5117
5117
  ]) => {
5118
5118
  const u = Ee(), d = V(void 0), h = V(null), p = V(null);
5119
- return ue(a, h), ue(c, p), Oe(
5119
+ return ce(a, h), ce(c, p), Oe(
5120
5120
  B(
5121
5121
  u,
5122
5122
  Se(t, r, i, h, p, n)
@@ -5125,7 +5125,7 @@ const Hx = (e, t) => typeof e == "function" ? El(e(t)) : t && El(e), $x = Ne(
5125
5125
  const E = Ix(g.sizeTree);
5126
5126
  m && b !== null && w !== null && (x = b.scrollTop - w.offsetTop), x -= y, v({ ranges: E, scrollTop: x });
5127
5127
  }
5128
- ), ue(B(d, pe($i), re(Vx)), o), ue(
5128
+ ), ce(B(d, pe($i), re(Vx)), o), ce(
5129
5129
  B(
5130
5130
  s,
5131
5131
  Se(d),
@@ -5146,7 +5146,7 @@ function Vx(e) {
5146
5146
  }
5147
5147
  const Gx = Ne(([{ topItemsIndexes: e }]) => {
5148
5148
  const t = V(0);
5149
- return ue(
5149
+ return ce(
5150
5150
  B(
5151
5151
  t,
5152
5152
  pe((n) => n >= 0),
@@ -5199,7 +5199,7 @@ const Kx = mu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5199
5199
  tn(1)
5200
5200
  ),
5201
5201
  m
5202
- ), ue(
5202
+ ), ce(
5203
5203
  B(
5204
5204
  h,
5205
5205
  re((b) => ({ top: -b }))
@@ -5303,7 +5303,7 @@ const Kx = mu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5303
5303
  { topItemCount: R },
5304
5304
  { groupCounts: I },
5305
5305
  A
5306
- ]) => (ue(E.rangeChanged, A.scrollSeekRangeChanged), ue(
5306
+ ]) => (ce(E.rangeChanged, A.scrollSeekRangeChanged), ce(
5307
5307
  B(
5308
5308
  A.windowViewportRect,
5309
5309
  re((k) => k.visibleHeight)
@@ -5908,7 +5908,7 @@ const yv = /* @__PURE__ */ Ne(
5908
5908
  ), Oe(
5909
5909
  B(
5910
5910
  Ze(g, z, k, A, _, X),
5911
- pe(([P, Z, ne, le, , se]) => P && !Z && ne.height !== 0 && le.height !== 0 && !se)
5911
+ pe(([P, Z, ne, le, , ie]) => P && !Z && ne.height !== 0 && le.height !== 0 && !ie)
5912
5912
  ),
5913
5913
  ([, , , , P]) => {
5914
5914
  ye(X, !0), Gi(1, () => {
@@ -5917,7 +5917,7 @@ const yv = /* @__PURE__ */ Ne(
5917
5917
  ye(t, [0, 0]), ye(z, !0);
5918
5918
  });
5919
5919
  }
5920
- ), ue(
5920
+ ), ce(
5921
5921
  B(
5922
5922
  q,
5923
5923
  pe((P) => P != null && P.scrollTop > 0),
@@ -5935,19 +5935,19 @@ const yv = /* @__PURE__ */ Ne(
5935
5935
  ye(O, !1);
5936
5936
  }), ye(c, { top: P.scrollTop })));
5937
5937
  }
5938
- ), ue(
5938
+ ), ce(
5939
5939
  B(
5940
5940
  A,
5941
5941
  re(({ height: P }) => P)
5942
5942
  ),
5943
5943
  h
5944
- ), ue(
5944
+ ), ce(
5945
5945
  B(
5946
5946
  Ze(
5947
- he(A, Yr),
5948
- he(k, Yr),
5949
- he($, (P, Z) => P && P.column === Z.column && P.row === Z.row),
5950
- he(u)
5947
+ fe(A, Yr),
5948
+ fe(k, Yr),
5949
+ fe($, (P, Z) => P && P.column === Z.column && P.row === Z.row),
5950
+ fe(u)
5951
5951
  ),
5952
5952
  re(([P, Z, ne, le]) => ({
5953
5953
  gap: ne,
@@ -5957,19 +5957,19 @@ const yv = /* @__PURE__ */ Ne(
5957
5957
  }))
5958
5958
  ),
5959
5959
  L
5960
- ), ue(
5960
+ ), ce(
5961
5961
  B(
5962
5962
  Ze(
5963
- he(C),
5963
+ fe(C),
5964
5964
  r,
5965
- he($, wv),
5966
- he(k, Yr),
5967
- he(A, Yr),
5968
- he(N),
5969
- he(R),
5970
- he(O),
5971
- he(z),
5972
- he(_)
5965
+ fe($, wv),
5966
+ fe(k, Yr),
5967
+ fe(A, Yr),
5968
+ fe(N),
5969
+ fe(R),
5970
+ fe(O),
5971
+ fe(z),
5972
+ fe(_)
5973
5973
  ),
5974
5974
  pe(([, , , , , , , P]) => !P),
5975
5975
  re(
@@ -5977,15 +5977,15 @@ const yv = /* @__PURE__ */ Ne(
5977
5977
  P,
5978
5978
  [Z, ne],
5979
5979
  le,
5980
- se,
5980
+ ie,
5981
5981
  ke,
5982
5982
  Fe,
5983
5983
  Le,
5984
5984
  ,
5985
- ce,
5985
+ ue,
5986
5986
  je
5987
5987
  ]) => {
5988
- const { column: xe, row: H } = le, { height: ae, width: Be } = se, { width: nt } = ke;
5988
+ const { column: xe, row: H } = le, { height: ae, width: Be } = ie, { width: nt } = ke;
5989
5989
  if (Le === 0 && (P === 0 || nt === 0))
5990
5990
  return jl;
5991
5991
  if (Be === 0) {
@@ -5994,34 +5994,34 @@ const yv = /* @__PURE__ */ Ne(
5994
5994
  }
5995
5995
  const dt = Ru(nt, Be, xe);
5996
5996
  let rt, Qe;
5997
- ce ? Z === 0 && ne === 0 && Le > 0 ? (rt = 0, Qe = Le - 1) : (rt = dt * No((Z + H) / (ae + H)), Qe = dt * Al((ne + H) / (ae + H)) - 1, Qe = Ds(P - 1, vr(Qe, dt - 1)), rt = Ds(Qe, vr(0, rt))) : (rt = 0, Qe = -1);
5998
- const Ct = Pl(rt, Qe, Fe), { bottom: Ge, top: st } = _l(ke, le, se, Ct), Ke = Al(P / dt), it = Ke * ae + (Ke - 1) * H - Ge;
5999
- return { bottom: Ge, itemHeight: ae, items: Ct, itemWidth: Be, offsetBottom: it, offsetTop: st, top: st };
5997
+ ue ? Z === 0 && ne === 0 && Le > 0 ? (rt = 0, Qe = Le - 1) : (rt = dt * No((Z + H) / (ae + H)), Qe = dt * Al((ne + H) / (ae + H)) - 1, Qe = Ds(P - 1, vr(Qe, dt - 1)), rt = Ds(Qe, vr(0, rt))) : (rt = 0, Qe = -1);
5998
+ const Ct = Pl(rt, Qe, Fe), { bottom: Ve, top: st } = _l(ke, le, ie, Ct), Ke = Al(P / dt), it = Ke * ae + (Ke - 1) * H - Ve;
5999
+ return { bottom: Ve, itemHeight: ae, items: Ct, itemWidth: Be, offsetBottom: it, offsetTop: st, top: st };
6000
6000
  }
6001
6001
  )
6002
6002
  ),
6003
6003
  I
6004
- ), ue(
6004
+ ), ce(
6005
6005
  B(
6006
6006
  N,
6007
6007
  pe((P) => P !== null),
6008
6008
  re((P) => P.length)
6009
6009
  ),
6010
6010
  C
6011
- ), ue(
6011
+ ), ce(
6012
6012
  B(
6013
6013
  Ze(A, k, I, $),
6014
6014
  pe(([P, Z, { items: ne }]) => ne.length > 0 && Z.height !== 0 && P.height !== 0),
6015
6015
  re(([P, Z, { items: ne }, le]) => {
6016
- const { bottom: se, top: ke } = _l(P, le, Z, ne);
6017
- return [ke, se];
6016
+ const { bottom: ie, top: ke } = _l(P, le, Z, ne);
6017
+ return [ke, ie];
6018
6018
  }),
6019
6019
  He(Tr)
6020
6020
  ),
6021
6021
  t
6022
6022
  );
6023
6023
  const F = V(!1);
6024
- ue(
6024
+ ce(
6025
6025
  B(
6026
6026
  u,
6027
6027
  Se(F),
@@ -6029,7 +6029,7 @@ const yv = /* @__PURE__ */ Ne(
6029
6029
  ),
6030
6030
  F
6031
6031
  );
6032
- const Q = yt(
6032
+ const ee = yt(
6033
6033
  B(
6034
6034
  Ze(I, C),
6035
6035
  pe(([{ items: P }]) => P.length > 0),
@@ -6041,16 +6041,16 @@ const yv = /* @__PURE__ */ Ne(
6041
6041
  re(([[, P]]) => P - 1),
6042
6042
  He()
6043
6043
  )
6044
- ), de = yt(
6044
+ ), he = yt(
6045
6045
  B(
6046
- he(I),
6046
+ fe(I),
6047
6047
  pe(({ items: P }) => P.length > 0 && P[0].index === 0),
6048
6048
  Wt(0),
6049
6049
  He()
6050
6050
  )
6051
6051
  ), be = yt(
6052
6052
  B(
6053
- he(I),
6053
+ fe(I),
6054
6054
  Se(O),
6055
6055
  pe(([{ items: P }, Z]) => P.length > 0 && !Z),
6056
6056
  re(([{ items: P }]) => ({
@@ -6061,16 +6061,16 @@ const yv = /* @__PURE__ */ Ne(
6061
6061
  tn(0)
6062
6062
  )
6063
6063
  );
6064
- ue(be, v.scrollSeekRangeChanged), ue(
6064
+ ce(be, v.scrollSeekRangeChanged), ce(
6065
6065
  B(
6066
6066
  M,
6067
6067
  Se(A, k, C, $),
6068
- re(([P, Z, ne, le, se]) => {
6069
- const ke = lu(P), { align: Fe, behavior: Le, offset: ce } = ke;
6068
+ re(([P, Z, ne, le, ie]) => {
6069
+ const ke = lu(P), { align: Fe, behavior: Le, offset: ue } = ke;
6070
6070
  let je = ke.index;
6071
6071
  je === "LAST" && (je = le - 1), je = vr(0, je, Ds(le - 1, je));
6072
- let xe = hi(Z, se, ne, je);
6073
- return Fe === "end" ? xe = kl(xe - Z.height + ne.height) : Fe === "center" && (xe = kl(xe - Z.height / 2 + ne.height / 2)), ce && (xe += ce), { behavior: Le, top: xe };
6072
+ let xe = hi(Z, ie, ne, je);
6073
+ return Fe === "end" ? xe = kl(xe - Z.height + ne.height) : Fe === "center" && (xe = kl(xe - Z.height / 2 + ne.height / 2)), ue && (xe += ue), { behavior: Le, top: xe };
6074
6074
  })
6075
6075
  ),
6076
6076
  c
@@ -6082,7 +6082,7 @@ const yv = /* @__PURE__ */ Ne(
6082
6082
  ),
6083
6083
  0
6084
6084
  );
6085
- return ue(
6085
+ return ce(
6086
6086
  B(
6087
6087
  E,
6088
6088
  re((P) => ({ height: P.visibleHeight, width: P.visibleWidth }))
@@ -6121,10 +6121,10 @@ const yv = /* @__PURE__ */ Ne(
6121
6121
  initialTopMostItemIndex: _,
6122
6122
  totalListHeight: Y,
6123
6123
  ...p,
6124
- endReached: Q,
6124
+ endReached: ee,
6125
6125
  propsReady: x,
6126
6126
  rangeChanged: be,
6127
- startReached: de,
6127
+ startReached: he,
6128
6128
  stateChanged: L,
6129
6129
  stateRestoreInProgress: O,
6130
6130
  ...S
@@ -6155,7 +6155,7 @@ const Sv = /* @__PURE__ */ Ne(() => {
6155
6155
  ),
6156
6156
  p
6157
6157
  ), u = V(!1), d = V(!1);
6158
- return ue(he(d), u), {
6158
+ return ce(fe(d), u), {
6159
6159
  components: t,
6160
6160
  computeItemKey: s,
6161
6161
  context: n,
@@ -6497,7 +6497,7 @@ const Ov = K.memo(_v), Mv = _r(
6497
6497
  function Nu({ className: e, variant: t, ...n }) {
6498
6498
  return /* @__PURE__ */ l.jsx("div", { className: D(Mv({ variant: t }), e), ...n });
6499
6499
  }
6500
- function ee(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
6500
+ function Q(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
6501
6501
  return function(o) {
6502
6502
  if (e == null || e(o), n === !1 || !o.defaultPrevented)
6503
6503
  return t == null ? void 0 : t(o);
@@ -6793,7 +6793,7 @@ var ku = "CollapsibleTrigger", Pu = f.forwardRef(
6793
6793
  disabled: o.disabled,
6794
6794
  ...r,
6795
6795
  ref: t,
6796
- onClick: ee(e.onClick, o.onOpenToggle)
6796
+ onClick: Q(e.onClick, o.onOpenToggle)
6797
6797
  }
6798
6798
  );
6799
6799
  }
@@ -6981,8 +6981,8 @@ function sb(e) {
6981
6981
  return `${e.length}:${t}:${n}`;
6982
6982
  }
6983
6983
  function Jr({ content: e, className: t = "", fallback: n = /* @__PURE__ */ l.jsx("div", { "aria-busy": !0, children: "Rendering…" }) }) {
6984
- const r = sb(e), [o, s] = fe(() => Bn.get(r) ?? null);
6985
- Ve(() => {
6984
+ const r = sb(e), [o, s] = de(() => Bn.get(r) ?? null);
6985
+ Ge(() => {
6986
6986
  if (Bn.has(r)) {
6987
6987
  const g = Bn.get(r) ?? null;
6988
6988
  s(g);
@@ -7251,9 +7251,9 @@ var hb = "DismissableLayer", xi = "dismissableLayer.update", pb = "dismissableLa
7251
7251
  pointerEvents: y ? E ? "auto" : "none" : void 0,
7252
7252
  ...e.style
7253
7253
  },
7254
- onFocusCapture: ee(e.onFocusCapture, C.onFocusCapture),
7255
- onBlurCapture: ee(e.onBlurCapture, C.onBlurCapture),
7256
- onPointerDownCapture: ee(
7254
+ onFocusCapture: Q(e.onFocusCapture, C.onFocusCapture),
7255
+ onBlurCapture: Q(e.onBlurCapture, C.onBlurCapture),
7256
+ onPointerDownCapture: Q(
7257
7257
  e.onPointerDownCapture,
7258
7258
  S.onPointerDownCapture
7259
7259
  )
@@ -7502,7 +7502,7 @@ function Us(e, t) {
7502
7502
  return typeof e == "function" ? e(t) : e && (e.current = t), e;
7503
7503
  }
7504
7504
  function kb(e, t) {
7505
- var n = fe(function() {
7505
+ var n = de(function() {
7506
7506
  return {
7507
7507
  // value
7508
7508
  value: e,
@@ -8040,7 +8040,7 @@ var qu = "DialogTrigger", Xu = f.forwardRef(
8040
8040
  "data-state": ca(o.open),
8041
8041
  ...r,
8042
8042
  ref: s,
8043
- onClick: ee(e.onClick, o.onOpenToggle)
8043
+ onClick: Q(e.onClick, o.onOpenToggle)
8044
8044
  }
8045
8045
  );
8046
8046
  }
@@ -8097,15 +8097,15 @@ var xw = f.forwardRef(
8097
8097
  ref: o,
8098
8098
  trapFocus: n.open,
8099
8099
  disableOutsidePointerEvents: !0,
8100
- onCloseAutoFocus: ee(e.onCloseAutoFocus, (s) => {
8100
+ onCloseAutoFocus: Q(e.onCloseAutoFocus, (s) => {
8101
8101
  var i;
8102
8102
  s.preventDefault(), (i = n.triggerRef.current) == null || i.focus();
8103
8103
  }),
8104
- onPointerDownOutside: ee(e.onPointerDownOutside, (s) => {
8104
+ onPointerDownOutside: Q(e.onPointerDownOutside, (s) => {
8105
8105
  const i = s.detail.originalEvent, a = i.button === 0 && i.ctrlKey === !0;
8106
8106
  (i.button === 2 || a) && s.preventDefault();
8107
8107
  }),
8108
- onFocusOutside: ee(
8108
+ onFocusOutside: Q(
8109
8109
  e.onFocusOutside,
8110
8110
  (s) => s.preventDefault()
8111
8111
  )
@@ -8191,7 +8191,7 @@ var sd = "DialogClose", id = f.forwardRef(
8191
8191
  type: "button",
8192
8192
  ...r,
8193
8193
  ref: t,
8194
- onClick: ee(e.onClick, () => o.onOpenChange(!1))
8194
+ onClick: Q(e.onClick, () => o.onOpenChange(!1))
8195
8195
  }
8196
8196
  );
8197
8197
  }
@@ -8309,8 +8309,8 @@ const Rw = f.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
8309
8309
  ));
8310
8310
  Rw.displayName = is.displayName;
8311
8311
  function Ew({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
8312
- const [s, i] = fe(!1), [a, c] = fe(null), [u, d] = fe(null), { toast: h } = oa();
8313
- Ve(() => {
8312
+ const [s, i] = de(!1), [a, c] = de(null), [u, d] = de(null), { toast: h } = oa();
8313
+ Ge(() => {
8314
8314
  e && n && p();
8315
8315
  }, [e, n]);
8316
8316
  const p = async () => {
@@ -8418,8 +8418,8 @@ function Ew({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
8418
8418
  }
8419
8419
  const mo = "prose prose-sm max-w-none break-words dark:prose-invert prose-headings:break-words prose-p:break-words prose-li:break-words prose-td:break-words prose-th:break-words prose-a:break-all prose-code:break-words prose-blockquote:break-words";
8420
8420
  function Iw({ className: e }) {
8421
- const [t, n] = fe(0);
8422
- return Ve(() => {
8421
+ const [t, n] = de(0);
8422
+ return Ge(() => {
8423
8423
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
8424
8424
  return () => clearInterval(r);
8425
8425
  }, []), /* @__PURE__ */ l.jsxs(
@@ -8438,7 +8438,7 @@ const Nw = K.memo(function({
8438
8438
  message: t,
8439
8439
  messageIndex: n,
8440
8440
  isStreamingMessage: r = !1,
8441
- streamingDebounceMs: o = 40,
8441
+ streamingDebounceMs: o = 120,
8442
8442
  isEditing: s = !1,
8443
8443
  showActions: i = !0,
8444
8444
  showTimestamp: a = !0,
@@ -8454,9 +8454,9 @@ const Nw = K.memo(function({
8454
8454
  onCancelEdit: b,
8455
8455
  onCopy: w
8456
8456
  }) {
8457
- const [y, E] = fe(!1), [S, C] = fe(!1), [R, I] = fe(!1), [A, k] = fe(!1), { currentThreadId: M } = Hi();
8457
+ const [y, E] = de(!1), [S, C] = de(!1), [R, I] = de(!1), [A, k] = de(!1), { currentThreadId: M } = Hi();
8458
8458
  oa();
8459
- const [W, G] = fe({}), [N, $] = fe(!1), [L, q] = fe(null), O = u === "phone" || u === "half-screen", _ = t.role, z = _ === "tool", X = K.useMemo(() => {
8459
+ const [W, G] = de({}), [N, $] = de(!1), [L, q] = de(null), O = u === "phone" || u === "half-screen", _ = t.role, z = _ === "tool", X = K.useMemo(() => {
8460
8460
  switch (_) {
8461
8461
  case "user":
8462
8462
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -8469,28 +8469,17 @@ const Nw = K.memo(function({
8469
8469
  default:
8470
8470
  return "text-[hsl(var(--chat-bubble-ai-text))]";
8471
8471
  }
8472
- }, [_]), oe = wn(() => jw(t.content), [t.content]), F = wn(() => Ow(t.content), [t.content]), Q = wn(() => t.content.filter((ce) => ce.type === "image_url"), [t.content]), de = wn(() => t.content.filter((ce) => ce.type === "file"), [t.content]);
8473
- Ve(() => {
8474
- console.log("[DEBUG] MessageComponent render:", {
8475
- messageId: t.id,
8476
- role: t.role,
8477
- contentLength: t.content.length,
8478
- filePartsCount: de.length,
8479
- imagePartsCount: Q.length,
8480
- fileParts: de.map((ce) => ({ type: ce.type, name: ce.name, url: ce.url }))
8481
- });
8482
- }, [t.id, t.content, de, Q]);
8483
- const be = Dw(oe, r ? o : 0), Y = async () => {
8472
+ }, [_]), oe = wn(() => jw(t.content), [t.content]), F = wn(() => Ow(t.content), [t.content]), ee = wn(() => t.content.filter((ue) => ue.type === "image_url"), [t.content]), he = wn(() => t.content.filter((ue) => ue.type === "file"), [t.content]), be = Dw(oe, r ? o : 0), Y = async () => {
8484
8473
  try {
8485
- const ce = z ? Un(t.content) : oe;
8486
- await navigator.clipboard.writeText(ce), E(!0), setTimeout(() => E(!1), 2e3), w == null || w(ce);
8487
- } catch (ce) {
8488
- console.error("Failed to copy:", ce);
8474
+ const ue = z ? Un(t.content) : oe;
8475
+ await navigator.clipboard.writeText(ue), E(!0), setTimeout(() => E(!1), 2e3), w == null || w(ue);
8476
+ } catch (ue) {
8477
+ console.error("Failed to copy:", ue);
8489
8478
  }
8490
8479
  }, P = () => {
8491
8480
  if (!x) return;
8492
- const ce = z ? Un(t.content) : oe;
8493
- x(t.id, ce);
8481
+ const ue = z ? Un(t.content) : oe;
8482
+ x(t.id, ue);
8494
8483
  }, Z = () => m == null ? void 0 : m(n), ne = () => {
8495
8484
  const je = D(O ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", X);
8496
8485
  switch (_) {
@@ -8504,53 +8493,53 @@ const Nw = K.memo(function({
8504
8493
  return /* @__PURE__ */ l.jsx(Ga, { className: je });
8505
8494
  }
8506
8495
  }, le = () => {
8507
- const ce = "group relative mb-4 flex w-full";
8496
+ const ue = "group relative mb-4 flex w-full";
8508
8497
  switch (_) {
8509
8498
  case "user":
8510
- return D(ce, "justify-end");
8499
+ return D(ue, "justify-end");
8511
8500
  case "assistant":
8512
8501
  case "tool":
8513
8502
  case "system":
8514
- return D(ce, "justify-start");
8503
+ return D(ue, "justify-start");
8515
8504
  default:
8516
- return ce;
8505
+ return ue;
8517
8506
  }
8518
- }, se = () => {
8519
- const ce = D(
8507
+ }, ie = () => {
8508
+ const ue = D(
8520
8509
  "rounded-lg px-4 py-3 relative transition-all duration-200 min-w-0 max-w-full break-words",
8521
8510
  O && "px-3 py-2 text-sm"
8522
8511
  );
8523
8512
  switch (_) {
8524
8513
  case "user":
8525
8514
  return D(
8526
- ce,
8515
+ ue,
8527
8516
  "w-full md:max-w-[95%]",
8528
8517
  "bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
8529
8518
  "border border-transparent"
8530
8519
  );
8531
8520
  case "assistant":
8532
8521
  return D(
8533
- ce,
8522
+ ue,
8534
8523
  "w-full md:max-w-[95%]",
8535
8524
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
8536
8525
  "border border-border/60 dark:border-border/40"
8537
8526
  );
8538
8527
  case "tool":
8539
- return D(ce, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
8528
+ return D(ue, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
8540
8529
  case "system":
8541
- return D(ce, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
8530
+ return D(ue, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
8542
8531
  default:
8543
8532
  return D(
8544
- ce,
8533
+ ue,
8545
8534
  "w-full md:max-w-[95%]",
8546
8535
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
8547
8536
  "border border-border/60 dark:border-border/40"
8548
8537
  );
8549
8538
  }
8550
- }, ke = (ce) => {
8551
- if (!ce) return "";
8539
+ }, ke = (ue) => {
8540
+ if (!ue) return "";
8552
8541
  try {
8553
- return new Date(ce).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
8542
+ return new Date(ue).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
8554
8543
  } catch {
8555
8544
  return "";
8556
8545
  }
@@ -8593,7 +8582,7 @@ const Nw = K.memo(function({
8593
8582
  const H = Un(t.content);
8594
8583
  return /* @__PURE__ */ l.jsx("div", { className: "font-mono text-sm text-current", children: /* @__PURE__ */ l.jsx("pre", { className: D("whitespace-pre-wrap break-words text-current", O && "text-xs"), children: H }) });
8595
8584
  }
8596
- const ce = Q.length > 0 && _ !== "tool", je = de.length > 0 && _ !== "tool" && !1;
8585
+ const ue = ee.length > 0 && _ !== "tool", je = he.length > 0 && _ !== "tool" && !1;
8597
8586
  return /* @__PURE__ */ l.jsxs("div", { children: [
8598
8587
  r ? /* @__PURE__ */ l.jsxs("div", { className: "relative", children: [
8599
8588
  (() => {
@@ -8633,7 +8622,7 @@ const Nw = K.memo(function({
8633
8622
  }
8634
8623
  return /* @__PURE__ */ l.jsx(Jr, { content: oe.trim() });
8635
8624
  })(),
8636
- ce && /* @__PURE__ */ l.jsx("div", { className: "mt-2 grid grid-cols-2 gap-2", children: Q.map((xe, H) => /* @__PURE__ */ l.jsxs("div", { className: "relative border rounded overflow-hidden", children: [
8625
+ ue && /* @__PURE__ */ l.jsx("div", { className: "mt-2 grid grid-cols-2 gap-2", children: ee.map((xe, H) => /* @__PURE__ */ l.jsxs("div", { className: "relative border rounded overflow-hidden", children: [
8637
8626
  /* @__PURE__ */ l.jsx("img", { src: xe.url, alt: xe.alt ?? "image", className: "w-full h-auto" }),
8638
8627
  /* @__PURE__ */ l.jsxs("div", { className: "absolute top-1 right-1 bg-background/70 rounded px-1 py-0.5 text-[10px] flex items-center gap-1", children: [
8639
8628
  /* @__PURE__ */ l.jsx(yc, { className: "h-3 w-3" }),
@@ -8644,7 +8633,7 @@ const Nw = K.memo(function({
8644
8633
  ] });
8645
8634
  }, Le = wn(() => Mw(t), [t]);
8646
8635
  return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
8647
- /* @__PURE__ */ l.jsx("div", { className: D(le(), g.container), children: /* @__PURE__ */ l.jsxs("div", { className: D(se(), g.content), children: [
8636
+ /* @__PURE__ */ l.jsx("div", { className: D(le(), g.container), children: /* @__PURE__ */ l.jsxs("div", { className: D(ie(), g.content), children: [
8648
8637
  (a || c || z) && /* @__PURE__ */ l.jsxs(
8649
8638
  "div",
8650
8639
  {
@@ -8668,7 +8657,7 @@ const Nw = K.memo(function({
8668
8657
  "border border-current/40",
8669
8658
  O && "text-xs h-4"
8670
8659
  ),
8671
- onClick: () => I((ce) => !ce),
8660
+ onClick: () => I((ue) => !ue),
8672
8661
  children: [
8673
8662
  /* @__PURE__ */ l.jsx("span", { children: F.name }),
8674
8663
  /* @__PURE__ */ l.jsx("span", { className: "inline-flex items-center", children: R ? /* @__PURE__ */ l.jsx(pr, { className: "h-3 w-3" }) : /* @__PURE__ */ l.jsx(Wn, { className: "h-3 w-3" }) })
@@ -8681,7 +8670,7 @@ const Nw = K.memo(function({
8681
8670
  variant: "ghost",
8682
8671
  size: "sm",
8683
8672
  className: D("h-6 px-1", X, "hover:bg-foreground/10"),
8684
- onClick: () => I((ce) => !ce),
8673
+ onClick: () => I((ue) => !ue),
8685
8674
  children: /* @__PURE__ */ l.jsxs("span", { className: "text-xs flex items-center gap-1", children: [
8686
8675
  "Tool Output ",
8687
8676
  R ? /* @__PURE__ */ l.jsx(pr, { className: "h-3 w-3" }) : /* @__PURE__ */ l.jsx(Wn, { className: "h-3 w-3" })
@@ -8939,8 +8928,8 @@ function Mw(e) {
8939
8928
  return e.name && e.name.trim() ? e.name : e.model && e.model.includes("/") ? e.model.split("/").pop() || null : e.model || null;
8940
8929
  }
8941
8930
  function Dw(e, t) {
8942
- const [n, r] = fe(e);
8943
- return Ve(() => {
8931
+ const [n, r] = de(e);
8932
+ return Ge(() => {
8944
8933
  if (!t) {
8945
8934
  r(e);
8946
8935
  return;
@@ -10490,7 +10479,7 @@ var Od = "PopperAnchor", Md = f.forwardRef(
10490
10479
  Md.displayName = Od;
10491
10480
  var va = "PopperContent", [rS, oS] = kd(va), Dd = f.forwardRef(
10492
10481
  (e, t) => {
10493
- var Y, P, Z, ne, le, se;
10482
+ var Y, P, Z, ne, le, ie;
10494
10483
  const {
10495
10484
  __scopePopper: n,
10496
10485
  side: r = "bottom",
@@ -10532,9 +10521,9 @@ var va = "PopperContent", [rS, oS] = kd(va), Dd = f.forwardRef(
10532
10521
  c && Xy({ ...G }),
10533
10522
  Jy({
10534
10523
  ...G,
10535
- apply: ({ elements: ke, rects: Fe, availableWidth: Le, availableHeight: ce }) => {
10524
+ apply: ({ elements: ke, rects: Fe, availableWidth: Le, availableHeight: ue }) => {
10536
10525
  const { width: je, height: xe } = Fe.reference, H = ke.floating.style;
10537
- H.setProperty("--radix-popper-available-width", `${Le}px`), H.setProperty("--radix-popper-available-height", `${ce}px`), H.setProperty("--radix-popper-anchor-width", `${je}px`), H.setProperty("--radix-popper-anchor-height", `${xe}px`);
10526
+ H.setProperty("--radix-popper-available-width", `${Le}px`), H.setProperty("--radix-popper-available-height", `${ue}px`), H.setProperty("--radix-popper-anchor-width", `${je}px`), H.setProperty("--radix-popper-anchor-height", `${xe}px`);
10538
10527
  }
10539
10528
  }),
10540
10529
  E && Qy({ element: E, padding: a }),
@@ -10545,7 +10534,7 @@ var va = "PopperContent", [rS, oS] = kd(va), Dd = f.forwardRef(
10545
10534
  tt(() => {
10546
10535
  q && (X == null || X());
10547
10536
  }, [q, X]);
10548
- const oe = (Y = O.arrow) == null ? void 0 : Y.x, F = (P = O.arrow) == null ? void 0 : P.y, Q = ((Z = O.arrow) == null ? void 0 : Z.centerOffset) !== 0, [de, be] = f.useState();
10537
+ const oe = (Y = O.arrow) == null ? void 0 : Y.x, F = (P = O.arrow) == null ? void 0 : P.y, ee = ((Z = O.arrow) == null ? void 0 : Z.centerOffset) !== 0, [he, be] = f.useState();
10549
10538
  return tt(() => {
10550
10539
  b && be(window.getComputedStyle(b).zIndex);
10551
10540
  }, [b]), /* @__PURE__ */ l.jsx(
@@ -10558,7 +10547,7 @@ var va = "PopperContent", [rS, oS] = kd(va), Dd = f.forwardRef(
10558
10547
  transform: q ? $.transform : "translate(0, -200%)",
10559
10548
  // keep off the page when measuring
10560
10549
  minWidth: "max-content",
10561
- zIndex: de,
10550
+ zIndex: he,
10562
10551
  "--radix-popper-transform-origin": [
10563
10552
  (ne = O.transformOrigin) == null ? void 0 : ne.x,
10564
10553
  (le = O.transformOrigin) == null ? void 0 : le.y
@@ -10566,7 +10555,7 @@ var va = "PopperContent", [rS, oS] = kd(va), Dd = f.forwardRef(
10566
10555
  // hide the content if using the hide middleware and should be hidden
10567
10556
  // set visibility to hidden and disable pointer events so the UI behaves
10568
10557
  // as if the PopperContent isn't there at all
10569
- ...((se = O.hide) == null ? void 0 : se.referenceHidden) && {
10558
+ ...((ie = O.hide) == null ? void 0 : ie.referenceHidden) && {
10570
10559
  visibility: "hidden",
10571
10560
  pointerEvents: "none"
10572
10561
  }
@@ -10580,7 +10569,7 @@ var va = "PopperContent", [rS, oS] = kd(va), Dd = f.forwardRef(
10580
10569
  onArrowChange: S,
10581
10570
  arrowX: oe,
10582
10571
  arrowY: F,
10583
- shouldHideArrow: Q,
10572
+ shouldHideArrow: ee,
10584
10573
  children: /* @__PURE__ */ l.jsx(
10585
10574
  me.div,
10586
10575
  {
@@ -10729,10 +10718,10 @@ var hS = f.forwardRef((e, t) => {
10729
10718
  ...h,
10730
10719
  ref: v,
10731
10720
  style: { outline: "none", ...e.style },
10732
- onMouseDown: ee(e.onMouseDown, () => {
10721
+ onMouseDown: Q(e.onMouseDown, () => {
10733
10722
  S.current = !0;
10734
10723
  }),
10735
- onFocus: ee(e.onFocus, (I) => {
10724
+ onFocus: Q(e.onFocus, (I) => {
10736
10725
  const A = !S.current;
10737
10726
  if (I.target === I.currentTarget && A && !b) {
10738
10727
  const k = new CustomEvent(Xs, lS);
@@ -10745,7 +10734,7 @@ var hS = f.forwardRef((e, t) => {
10745
10734
  }
10746
10735
  S.current = !1;
10747
10736
  }),
10748
- onBlur: ee(e.onBlur, () => w(!1))
10737
+ onBlur: Q(e.onBlur, () => w(!1))
10749
10738
  }
10750
10739
  )
10751
10740
  }
@@ -10777,11 +10766,11 @@ var hS = f.forwardRef((e, t) => {
10777
10766
  "data-orientation": d.orientation,
10778
10767
  ...a,
10779
10768
  ref: t,
10780
- onMouseDown: ee(e.onMouseDown, (m) => {
10769
+ onMouseDown: Q(e.onMouseDown, (m) => {
10781
10770
  r ? d.onItemFocus(u) : m.preventDefault();
10782
10771
  }),
10783
- onFocus: ee(e.onFocus, () => d.onItemFocus(u)),
10784
- onKeyDown: ee(e.onKeyDown, (m) => {
10772
+ onFocus: Q(e.onFocus, () => d.onItemFocus(u)),
10773
+ onKeyDown: Q(e.onKeyDown, (m) => {
10785
10774
  if (m.key === "Tab" && m.shiftKey) {
10786
10775
  d.onItemShiftTab();
10787
10776
  return;
@@ -10910,7 +10899,7 @@ var jt = "MenuContent", [AS, Ra] = On(jt), Zd = f.forwardRef(
10910
10899
  trapFocus: n.open,
10911
10900
  disableOutsidePointerEvents: n.open,
10912
10901
  disableOutsideScroll: !0,
10913
- onFocusOutside: ee(
10902
+ onFocusOutside: Q(
10914
10903
  e.onFocusOutside,
10915
10904
  (s) => s.preventDefault(),
10916
10905
  { checkForDefaultPrevented: !1 }
@@ -10951,7 +10940,7 @@ var jt = "MenuContent", [AS, Ra] = On(jt), Zd = f.forwardRef(
10951
10940
  ...x
10952
10941
  } = e, m = Mn(jt, n), b = Vr(jt, n), w = fs(n), y = Yd(n), E = TS(n), [S, C] = f.useState(null), R = f.useRef(null), I = Ce(t, R, m.onContentChange), A = f.useRef(0), k = f.useRef(""), M = f.useRef(0), W = f.useRef(null), G = f.useRef("right"), N = f.useRef(0), $ = g ? ns : f.Fragment, L = g ? { as: _S, allowPinchZoom: !0 } : void 0, q = (_) => {
10953
10942
  var Y, P;
10954
- const z = k.current + _, X = E().filter((Z) => !Z.disabled), oe = document.activeElement, F = (Y = X.find((Z) => Z.ref.current === oe)) == null ? void 0 : Y.textValue, Q = X.map((Z) => Z.textValue), de = VS(Q, z, F), be = (P = X.find((Z) => Z.textValue === de)) == null ? void 0 : P.ref.current;
10943
+ const z = k.current + _, X = E().filter((Z) => !Z.disabled), oe = document.activeElement, F = (Y = X.find((Z) => Z.ref.current === oe)) == null ? void 0 : Y.textValue, ee = X.map((Z) => Z.textValue), he = VS(ee, z, F), be = (P = X.find((Z) => Z.textValue === he)) == null ? void 0 : P.ref.current;
10955
10944
  (function Z(ne) {
10956
10945
  k.current = ne, window.clearTimeout(A.current), ne !== "" && (A.current = window.setTimeout(() => Z(""), 1e3));
10957
10946
  })(z), be && setTimeout(() => be.focus());
@@ -10994,7 +10983,7 @@ var jt = "MenuContent", [AS, Ra] = On(jt), Zd = f.forwardRef(
10994
10983
  {
10995
10984
  asChild: !0,
10996
10985
  trapped: o,
10997
- onMountAutoFocus: ee(s, (_) => {
10986
+ onMountAutoFocus: Q(s, (_) => {
10998
10987
  var z;
10999
10988
  _.preventDefault(), (z = R.current) == null || z.focus({ preventScroll: !0 });
11000
10989
  }),
@@ -11019,7 +11008,7 @@ var jt = "MenuContent", [AS, Ra] = On(jt), Zd = f.forwardRef(
11019
11008
  loop: r,
11020
11009
  currentTabStopId: S,
11021
11010
  onCurrentTabStopIdChange: C,
11022
- onEntryFocus: ee(c, (_) => {
11011
+ onEntryFocus: Q(c, (_) => {
11023
11012
  b.isUsingKeyboardRef.current || _.preventDefault();
11024
11013
  }),
11025
11014
  preventScrollOnEntryFocus: !0,
@@ -11035,19 +11024,19 @@ var jt = "MenuContent", [AS, Ra] = On(jt), Zd = f.forwardRef(
11035
11024
  ...x,
11036
11025
  ref: I,
11037
11026
  style: { outline: "none", ...x.style },
11038
- onKeyDown: ee(x.onKeyDown, (_) => {
11027
+ onKeyDown: Q(x.onKeyDown, (_) => {
11039
11028
  const X = _.target.closest("[data-radix-menu-content]") === _.currentTarget, oe = _.ctrlKey || _.altKey || _.metaKey, F = _.key.length === 1;
11040
11029
  X && (_.key === "Tab" && _.preventDefault(), !oe && F && q(_.key));
11041
- const Q = R.current;
11042
- if (_.target !== Q || !yS.includes(_.key)) return;
11030
+ const ee = R.current;
11031
+ if (_.target !== ee || !yS.includes(_.key)) return;
11043
11032
  _.preventDefault();
11044
11033
  const be = E().filter((Y) => !Y.disabled).map((Y) => Y.ref.current);
11045
11034
  Gd.includes(_.key) && be.reverse(), US(be);
11046
11035
  }),
11047
- onBlur: ee(e.onBlur, (_) => {
11036
+ onBlur: Q(e.onBlur, (_) => {
11048
11037
  _.currentTarget.contains(_.target) || (window.clearTimeout(A.current), k.current = "");
11049
11038
  }),
11050
- onPointerMove: ee(
11039
+ onPointerMove: Q(
11051
11040
  e.onPointerMove,
11052
11041
  Ar((_) => {
11053
11042
  const z = _.target, X = N.current !== _.clientX;
@@ -11099,16 +11088,16 @@ var Mo = "MenuItem", fc = "menu.itemSelect", hs = f.forwardRef(
11099
11088
  ...o,
11100
11089
  ref: c,
11101
11090
  disabled: n,
11102
- onClick: ee(e.onClick, d),
11091
+ onClick: Q(e.onClick, d),
11103
11092
  onPointerDown: (h) => {
11104
11093
  var p;
11105
11094
  (p = e.onPointerDown) == null || p.call(e, h), u.current = !0;
11106
11095
  },
11107
- onPointerUp: ee(e.onPointerUp, (h) => {
11096
+ onPointerUp: Q(e.onPointerUp, (h) => {
11108
11097
  var p;
11109
11098
  u.current || (p = h.currentTarget) == null || p.click();
11110
11099
  }),
11111
- onKeyDown: ee(e.onKeyDown, (h) => {
11100
+ onKeyDown: Q(e.onKeyDown, (h) => {
11112
11101
  const p = a.searchRef.current !== "";
11113
11102
  n || p && h.key === " " || Ci.includes(h.key) && (h.currentTarget.click(), h.preventDefault());
11114
11103
  })
@@ -11138,18 +11127,18 @@ var ef = f.forwardRef(
11138
11127
  "data-disabled": r ? "" : void 0,
11139
11128
  ...s,
11140
11129
  ref: u,
11141
- onPointerMove: ee(
11130
+ onPointerMove: Q(
11142
11131
  e.onPointerMove,
11143
11132
  Ar((g) => {
11144
11133
  r ? i.onItemLeave(g) : (i.onItemEnter(g), g.defaultPrevented || g.currentTarget.focus({ preventScroll: !0 }));
11145
11134
  })
11146
11135
  ),
11147
- onPointerLeave: ee(
11136
+ onPointerLeave: Q(
11148
11137
  e.onPointerLeave,
11149
11138
  Ar((g) => i.onItemLeave(g))
11150
11139
  ),
11151
- onFocus: ee(e.onFocus, () => h(!0)),
11152
- onBlur: ee(e.onBlur, () => h(!1))
11140
+ onFocus: Q(e.onFocus, () => h(!0)),
11141
+ onBlur: Q(e.onBlur, () => h(!1))
11153
11142
  }
11154
11143
  ) })
11155
11144
  }
@@ -11166,7 +11155,7 @@ var ef = f.forwardRef(
11166
11155
  ...o,
11167
11156
  ref: t,
11168
11157
  "data-state": ja(n),
11169
- onSelect: ee(
11158
+ onSelect: Q(
11170
11159
  o.onSelect,
11171
11160
  () => r == null ? void 0 : r(Do(n) ? !0 : !n),
11172
11161
  { checkForDefaultPrevented: !1 }
@@ -11198,7 +11187,7 @@ var of = "MenuRadioItem", sf = f.forwardRef(
11198
11187
  ...r,
11199
11188
  ref: t,
11200
11189
  "data-state": ja(s),
11201
- onSelect: ee(
11190
+ onSelect: Q(
11202
11191
  r.onSelect,
11203
11192
  () => {
11204
11193
  var i;
@@ -11280,7 +11269,7 @@ var zS = "MenuSub", [uR, df] = On(zS), mr = "MenuSubTrigger", ff = f.forwardRef(
11280
11269
  var p;
11281
11270
  (p = e.onClick) == null || p.call(e, h), !(e.disabled || h.defaultPrevented) && (h.currentTarget.focus(), n.open || n.onOpenChange(!0));
11282
11271
  },
11283
- onPointerMove: ee(
11272
+ onPointerMove: Q(
11284
11273
  e.onPointerMove,
11285
11274
  Ar((h) => {
11286
11275
  s.onItemEnter(h), !h.defaultPrevented && !e.disabled && !n.open && !i.current && (s.onPointerGraceIntentChange(null), i.current = window.setTimeout(() => {
@@ -11288,7 +11277,7 @@ var zS = "MenuSub", [uR, df] = On(zS), mr = "MenuSubTrigger", ff = f.forwardRef(
11288
11277
  }, 100));
11289
11278
  })
11290
11279
  ),
11291
- onPointerLeave: ee(
11280
+ onPointerLeave: Q(
11292
11281
  e.onPointerLeave,
11293
11282
  Ar((h) => {
11294
11283
  var v, g;
@@ -11317,7 +11306,7 @@ var zS = "MenuSub", [uR, df] = On(zS), mr = "MenuSubTrigger", ff = f.forwardRef(
11317
11306
  }
11318
11307
  })
11319
11308
  ),
11320
- onKeyDown: ee(e.onKeyDown, (h) => {
11309
+ onKeyDown: Q(e.onKeyDown, (h) => {
11321
11310
  var v;
11322
11311
  const p = s.searchRef.current !== "";
11323
11312
  e.disabled || p && h.key === " " || SS[r.dir].includes(h.key) && (n.onOpenChange(!0), (v = n.content) == null || v.focus(), h.preventDefault());
@@ -11347,13 +11336,13 @@ var hf = "MenuSubContent", pf = f.forwardRef(
11347
11336
  i.isUsingKeyboardRef.current && ((h = c.current) == null || h.focus()), d.preventDefault();
11348
11337
  },
11349
11338
  onCloseAutoFocus: (d) => d.preventDefault(),
11350
- onFocusOutside: ee(e.onFocusOutside, (d) => {
11339
+ onFocusOutside: Q(e.onFocusOutside, (d) => {
11351
11340
  d.target !== a.trigger && s.onOpenChange(!1);
11352
11341
  }),
11353
- onEscapeKeyDown: ee(e.onEscapeKeyDown, (d) => {
11342
+ onEscapeKeyDown: Q(e.onEscapeKeyDown, (d) => {
11354
11343
  i.onClose(), d.preventDefault();
11355
11344
  }),
11356
- onKeyDown: ee(e.onKeyDown, (d) => {
11345
+ onKeyDown: Q(e.onKeyDown, (d) => {
11357
11346
  var v;
11358
11347
  const h = d.currentTarget.contains(d.target), p = CS[i.dir].includes(d.key);
11359
11348
  h && p && (s.onOpenChange(!1), (v = a.trigger) == null || v.focus(), d.preventDefault());
@@ -11456,10 +11445,10 @@ var vf = "DropdownMenuTrigger", bf = f.forwardRef(
11456
11445
  disabled: r,
11457
11446
  ...o,
11458
11447
  ref: Qi(t, s.triggerRef),
11459
- onPointerDown: ee(e.onPointerDown, (a) => {
11448
+ onPointerDown: Q(e.onPointerDown, (a) => {
11460
11449
  !r && a.button === 0 && a.ctrlKey === !1 && (s.onOpenToggle(), s.open || a.preventDefault());
11461
11450
  }),
11462
- onKeyDown: ee(e.onKeyDown, (a) => {
11451
+ onKeyDown: Q(e.onKeyDown, (a) => {
11463
11452
  r || (["Enter", " "].includes(a.key) && s.onOpenToggle(), a.key === "ArrowDown" && s.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(a.key) && a.preventDefault());
11464
11453
  })
11465
11454
  }
@@ -11483,11 +11472,11 @@ var yf = "DropdownMenuContent", Sf = f.forwardRef(
11483
11472
  ...s,
11484
11473
  ...r,
11485
11474
  ref: t,
11486
- onCloseAutoFocus: ee(e.onCloseAutoFocus, (a) => {
11475
+ onCloseAutoFocus: Q(e.onCloseAutoFocus, (a) => {
11487
11476
  var c;
11488
11477
  i.current || (c = o.triggerRef.current) == null || c.focus(), i.current = !1, a.preventDefault();
11489
11478
  }),
11490
- onInteractOutside: ee(e.onInteractOutside, (a) => {
11479
+ onInteractOutside: Q(e.onInteractOutside, (a) => {
11491
11480
  const c = a.detail.originalEvent, u = c.button === 0 && c.ctrlKey === !0, d = c.button === 2 || u;
11492
11481
  (!o.modal || d) && (i.current = !0);
11493
11482
  }),
@@ -11698,7 +11687,7 @@ function vo({
11698
11687
  placeholder: t = "Type your message...",
11699
11688
  autoFocus: n = !0,
11700
11689
  maxHeight: r = void 0,
11701
- streamingDebounceMs: o = 40,
11690
+ streamingDebounceMs: o = 120,
11702
11691
  enableFileUpload: s = !0,
11703
11692
  enableExcelUpload: i = !1,
11704
11693
  enableMessageEditing: a = !0,
@@ -11723,47 +11712,47 @@ function vo({
11723
11712
  isLoadingHistory: I,
11724
11713
  loadOlderMessages: A,
11725
11714
  api: k
11726
- } = Hi(), [M, W] = fe(null), [G, N] = fe(""), [$, L] = fe(null), [q, O] = fe([]), [_, z] = fe(!1), [X, oe] = fe(null), [F, Q] = fe(null), [de, be] = fe(!1), [Y, P] = fe(null), [Z, ne] = fe([]), [le, se] = fe(null);
11715
+ } = Hi(), [M, W] = de(null), [G, N] = de(""), [$, L] = de(null), [q, O] = de([]), [_, z] = de(!1), [X, oe] = de(null), [F, ee] = de(null), [he, be] = de(!1), [Y, P] = de(null), [Z, ne] = de([]), [le, ie] = de(null);
11727
11716
  at(null);
11728
- const ke = at(null), Fe = at(null), Le = at(null), ce = at(!1), je = at(!0), xe = at(0), H = at(null), [ae, Be] = fe("desktop");
11729
- Ve(() => {
11717
+ const ke = at(null), Fe = at(null), Le = at(null), ue = at(!1), je = at(!0), xe = at(0), H = at(null), [ae, Be] = de("desktop");
11718
+ Ge(() => {
11730
11719
  const J = () => {
11731
- const ie = window.innerWidth;
11732
- Be(ie < 640 ? "phone" : ie < 1024 ? "tablet" : "desktop");
11720
+ const se = window.innerWidth;
11721
+ Be(se < 640 ? "phone" : se < 1024 ? "tablet" : "desktop");
11733
11722
  };
11734
11723
  return J(), window.addEventListener("resize", J), () => window.removeEventListener("resize", J);
11735
- }, []), Ve(() => {
11724
+ }, []), Ge(() => {
11736
11725
  let J = !1;
11737
11726
  if (!p) {
11738
- ne([]), se(null), H.current = null;
11727
+ ne([]), ie(null), H.current = null;
11739
11728
  return;
11740
11729
  }
11741
- const ie = {
11730
+ const se = {
11742
11731
  threadId: p,
11743
11732
  checkpointId: y ?? null
11744
11733
  }, Re = H.current;
11745
- if (!(Re && Re.threadId === ie.threadId && Re.checkpointId === ie.checkpointId))
11734
+ if (!(Re && Re.threadId === se.threadId && Re.checkpointId === se.checkpointId))
11746
11735
  return E(p).then((Pe) => {
11747
11736
  if (J) return;
11748
11737
  const Qt = ((Pe == null ? void 0 : Pe.checkpoints) ?? []).slice().sort((on, Ln) => new Date(Ln.createdAt).getTime() - new Date(on.createdAt).getTime());
11749
- ne(Qt), se((on) => {
11738
+ ne(Qt), ie((on) => {
11750
11739
  var Ln;
11751
11740
  return on ?? ((Ln = Qt[0]) == null ? void 0 : Ln.checkpointId) ?? null;
11752
- }), H.current = ie;
11741
+ }), H.current = se;
11753
11742
  }).catch((Pe) => {
11754
11743
  console.error("ChatInterface - listCheckpoints error:", Pe), J || (ne([]), H.current = null);
11755
11744
  }), () => {
11756
11745
  J = !0;
11757
11746
  };
11758
- }, [p, y, E]), Ve(() => {
11759
- y && se(y);
11747
+ }, [p, y, E]), Ge(() => {
11748
+ y && ie(y);
11760
11749
  }, [y]);
11761
11750
  const nt = We(async () => {
11762
11751
  if (!R || I) return;
11763
11752
  const J = Le.current;
11764
11753
  if (!J) return;
11765
- const ie = J.scrollHeight, Re = J.scrollTop;
11766
- ce.current = !0;
11754
+ const se = J.scrollHeight, Re = J.scrollTop;
11755
+ ue.current = !0;
11767
11756
  try {
11768
11757
  await A();
11769
11758
  } catch (Pe) {
@@ -11772,93 +11761,93 @@ function vo({
11772
11761
  requestAnimationFrame(() => {
11773
11762
  const Pe = Le.current;
11774
11763
  if (!Pe) {
11775
- ce.current = !1;
11764
+ ue.current = !1;
11776
11765
  return;
11777
11766
  }
11778
11767
  const Qt = Pe.scrollHeight;
11779
- Pe.scrollTop = Re + (Qt - ie);
11768
+ Pe.scrollTop = Re + (Qt - se);
11780
11769
  const on = Qt - Pe.scrollTop - Pe.clientHeight;
11781
- je.current = on <= 32, ce.current = !1;
11770
+ je.current = on <= 32, ue.current = !1;
11782
11771
  });
11783
11772
  }
11784
11773
  }, [R, I, A]);
11785
- Ve(() => {
11774
+ Ge(() => {
11786
11775
  v.length < xe.current && (je.current = !0), xe.current = v.length;
11787
- }, [v.length]), Ve(() => {
11776
+ }, [v.length]), Ge(() => {
11788
11777
  const J = Le.current;
11789
- J && (ce.current || je.current && (J.scrollTop = J.scrollHeight, je.current = !0));
11790
- }, [v]), Ve(() => {
11778
+ J && (ue.current || je.current && (J.scrollTop = J.scrollHeight, je.current = !0));
11779
+ }, [v]), Ge(() => {
11791
11780
  (async () => {
11792
11781
  try {
11793
- const ie = await k.getAgent("default");
11794
- P(ie.uiDefaultMessage || null);
11795
- } catch (ie) {
11796
- console.warn("Failed to fetch default message:", ie), P(null);
11782
+ const se = await k.getAgent("default");
11783
+ P(se.uiDefaultMessage || null);
11784
+ } catch (se) {
11785
+ console.warn("Failed to fetch default message:", se), P(null);
11797
11786
  }
11798
11787
  })();
11799
- }, [k]), Ve(() => {
11800
- m && !de && (h == null || h(m));
11801
- }, [m, de, h]);
11788
+ }, [k]), Ge(() => {
11789
+ m && !he && (h == null || h(m));
11790
+ }, [m, he, h]);
11802
11791
  const dt = (J) => {
11803
11792
  if (J.length > go)
11804
11793
  return `Message too long (${J.length}/${go} characters)`;
11805
11794
  try {
11806
11795
  return zw(J), null;
11807
- } catch (ie) {
11808
- return (ie == null ? void 0 : ie.message) || "Invalid message";
11796
+ } catch (se) {
11797
+ return (se == null ? void 0 : se.message) || "Invalid message";
11809
11798
  }
11810
11799
  }, rt = (J) => {
11811
- const ie = J.content || [], Re = ie.filter((Pe) => Pe.type === "text").map((Pe) => Pe.text).join("");
11800
+ const se = J.content || [], Re = se.filter((Pe) => Pe.type === "text").map((Pe) => Pe.text).join("");
11812
11801
  if (Re) return Re;
11813
11802
  try {
11814
- return JSON.stringify(ie, null, 2);
11803
+ return JSON.stringify(se, null, 2);
11815
11804
  } catch {
11816
- return String(ie);
11805
+ return String(se);
11817
11806
  }
11818
11807
  }, Qe = async (J) => {
11819
- const ie = J.trim();
11820
- if (!(!ie && q.length === 0)) {
11821
- if (ie) {
11822
- const Re = dt(ie);
11808
+ const se = J.trim();
11809
+ if (!(!se && q.length === 0)) {
11810
+ if (se) {
11811
+ const Re = dt(se);
11823
11812
  if (Re) {
11824
11813
  L(Re);
11825
11814
  return;
11826
11815
  }
11827
11816
  }
11828
11817
  try {
11829
- await b(ie, { checkpointId: le || y || void 0, payloadExtras: M ? { edit: !0, originalMessageId: M } : void 0, attachments: q }), u == null || u(ie), L(null), O([]), W(null), N("");
11818
+ await b(se, { checkpointId: le || y || void 0, payloadExtras: M ? { edit: !0, originalMessageId: M } : void 0, attachments: q }), u == null || u(se), L(null), O([]), W(null), N("");
11830
11819
  } catch (Re) {
11831
11820
  const Pe = (Re == null ? void 0 : Re.message) || "Failed to send message";
11832
11821
  L(Pe), h == null || h(Pe);
11833
11822
  }
11834
11823
  }
11835
- }, Ct = K.useCallback((J, ie) => {
11836
- a && (W(J), N(ie), L(null));
11837
- }, [a]), Ge = K.useCallback(() => {
11824
+ }, Ct = K.useCallback((J, se) => {
11825
+ a && (W(J), N(se), L(null));
11826
+ }, [a]), Ve = K.useCallback(() => {
11838
11827
  W(null), N(""), L(null);
11839
- }, []), st = We((J, ie) => {
11840
- Ct(J, ie);
11828
+ }, []), st = We((J, se) => {
11829
+ Ct(J, se);
11841
11830
  }, [Ct]), Ke = We((J) => {
11842
- for (let ie = J - 1; ie >= 0; ie--)
11843
- if (v[ie].role === "user") {
11844
- const Re = rt(v[ie]);
11831
+ for (let se = J - 1; se >= 0; se--)
11832
+ if (v[se].role === "user") {
11833
+ const Re = rt(v[se]);
11845
11834
  Re && b(Re, { checkpointId: le || y || void 0 });
11846
11835
  break;
11847
11836
  }
11848
11837
  }, [v, b, le, y, rt]), it = (J) => {
11849
- const ie = Array.from(J.target.files || []);
11850
- O((Re) => [...Re, ...ie]);
11851
- }, Pt = (J) => O((ie) => ie.filter((Re, Pe) => J !== Pe)), vn = async (J) => {
11852
- const ie = (J.target.files || [])[0];
11853
- if (ie) {
11854
- oe(null), Q(null), z(!0);
11838
+ const se = Array.from(J.target.files || []);
11839
+ O((Re) => [...Re, ...se]);
11840
+ }, Pt = (J) => O((se) => se.filter((Re, Pe) => J !== Pe)), vn = async (J) => {
11841
+ const se = (J.target.files || [])[0];
11842
+ if (se) {
11843
+ oe(null), ee(null), z(!0);
11855
11844
  try {
11856
11845
  await b("", {
11857
11846
  checkpointId: le || y || void 0,
11858
- attachments: [ie]
11847
+ attachments: [se]
11859
11848
  });
11860
- const Re = `Uploaded ${ie.name} - processing through chat stream`;
11861
- Q(Re);
11849
+ const Re = `Uploaded ${se.name} - processing through chat stream`;
11850
+ ee(Re);
11862
11851
  } catch (Re) {
11863
11852
  const Pe = Re instanceof Error ? Re.message : "Failed to upload Excel file";
11864
11853
  console.error("Excel upload failed", Re), oe(Pe), h == null || h(Pe);
@@ -11868,19 +11857,19 @@ function vo({
11868
11857
  }
11869
11858
  }, Dn = (J) => {
11870
11859
  if (!J) return "Unknown";
11871
- const ie = Date.parse(J);
11872
- return Number.isNaN(ie) ? J : new Date(ie).toLocaleString();
11860
+ const se = Date.parse(J);
11861
+ return Number.isNaN(se) ? J : new Date(se).toLocaleString();
11873
11862
  }, Ue = async (J) => {
11874
11863
  if (p) {
11875
11864
  if (!J) {
11876
- await C(), se(null);
11865
+ await C(), ie(null);
11877
11866
  return;
11878
11867
  }
11879
- await S(J), se(J);
11868
+ await S(J), ie(J);
11880
11869
  }
11881
11870
  }, ur = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${c.container || ""}`, Rs = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-y-auto overflow-x-auto overscroll-contain break-words break-anywhere p-4 space-y-4 bg-transparent ${c.messagesArea || ""}`, Es = `flex-shrink-0 w-full border-t p-4 bg-transparent ${c.inputArea || ""}`;
11882
11871
  return /* @__PURE__ */ l.jsxs("div", { className: ur, children: [
11883
- !!m && !de && /* @__PURE__ */ l.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
11872
+ !!m && !he && /* @__PURE__ */ l.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
11884
11873
  /* @__PURE__ */ l.jsx("span", { children: m }),
11885
11874
  /* @__PURE__ */ l.jsx(
11886
11875
  Ae,
@@ -11902,8 +11891,8 @@ function vo({
11902
11891
  className: "border border-border rounded px-2 py-1 text-xs bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring dark:bg-secondary",
11903
11892
  value: le ?? "",
11904
11893
  onChange: (J) => {
11905
- const ie = J.target.value || null;
11906
- Ue(ie);
11894
+ const se = J.target.value || null;
11895
+ Ue(se);
11907
11896
  },
11908
11897
  children: [
11909
11898
  /* @__PURE__ */ l.jsx("option", { value: "", children: "Latest" }),
@@ -11924,35 +11913,36 @@ function vo({
11924
11913
  gv,
11925
11914
  {
11926
11915
  data: v,
11927
- followOutput: "smooth",
11916
+ followOutput: g ? "auto" : "smooth",
11928
11917
  overscan: 120,
11929
11918
  increaseViewportBy: { top: 200, bottom: 200 },
11930
11919
  startReached: () => {
11931
11920
  nt();
11932
11921
  },
11933
11922
  style: { height: "100%", overscrollBehavior: "contain" },
11923
+ computeItemKey: (J, se) => se.id ?? `message-${J}`,
11934
11924
  components: {
11935
- Scroller: K.forwardRef((J, ie) => /* @__PURE__ */ l.jsx(
11925
+ Scroller: K.forwardRef((J, se) => /* @__PURE__ */ l.jsx(
11936
11926
  "div",
11937
11927
  {
11938
11928
  ...J,
11939
- ref: ie,
11929
+ ref: se,
11940
11930
  style: {
11941
- overflowAnchor: "auto",
11931
+ overflowAnchor: "none",
11942
11932
  willChange: "transform",
11943
11933
  ...(J == null ? void 0 : J.style) ?? {}
11944
11934
  }
11945
11935
  }
11946
11936
  ))
11947
11937
  },
11948
- itemContent: (J, ie) => /* @__PURE__ */ l.jsx(
11938
+ itemContent: (J, se) => /* @__PURE__ */ l.jsx(
11949
11939
  Nw,
11950
11940
  {
11951
- message: ie,
11941
+ message: se,
11952
11942
  messageIndex: J,
11953
- isStreamingMessage: g && x === ie.id,
11943
+ isStreamingMessage: g && x === se.id,
11954
11944
  streamingDebounceMs: o,
11955
- isEditing: M === ie.id,
11945
+ isEditing: M === se.id,
11956
11946
  showActions: a,
11957
11947
  showTimestamp: !1,
11958
11948
  showAgentName: !0,
@@ -11961,9 +11951,9 @@ function vo({
11961
11951
  toolMessagePreviewLength: 200,
11962
11952
  onEdit: st,
11963
11953
  onRegenerate: () => Ke(J),
11964
- onCancelEdit: Ge
11954
+ onCancelEdit: Ve
11965
11955
  },
11966
- ie.id ?? `msg-${ie.role}-${J}-${ie.createdAt ?? ""}`
11956
+ se.id ?? `msg-${se.role}-${J}-${se.createdAt ?? ""}`
11967
11957
  )
11968
11958
  }
11969
11959
  )
@@ -11980,7 +11970,7 @@ function vo({
11980
11970
  {
11981
11971
  variant: "ghost",
11982
11972
  size: "sm",
11983
- onClick: Ge,
11973
+ onClick: Ve,
11984
11974
  className: "text-blue-600 hover:bg-blue-100",
11985
11975
  children: /* @__PURE__ */ l.jsx(Vn, { size: 16 })
11986
11976
  }
@@ -11998,7 +11988,7 @@ function vo({
11998
11988
  className: "hidden"
11999
11989
  }
12000
11990
  ),
12001
- q.length > 0 && /* @__PURE__ */ l.jsx("div", { className: "flex flex-wrap gap-2", children: q.map((J, ie) => /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
11991
+ q.length > 0 && /* @__PURE__ */ l.jsx("div", { className: "flex flex-wrap gap-2", children: q.map((J, se) => /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
12002
11992
  /* @__PURE__ */ l.jsx(Ka, { size: 14 }),
12003
11993
  /* @__PURE__ */ l.jsx("span", { className: "truncate max-w-[150px]", children: J.name }),
12004
11994
  /* @__PURE__ */ l.jsx(
@@ -12006,13 +11996,13 @@ function vo({
12006
11996
  {
12007
11997
  variant: "ghost",
12008
11998
  size: "sm",
12009
- onClick: () => Pt(ie),
11999
+ onClick: () => Pt(se),
12010
12000
  className: "h-4 w-4 p-0 text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400",
12011
12001
  "aria-label": `Remove ${J.name}`,
12012
12002
  children: /* @__PURE__ */ l.jsx(Vn, { size: 12 })
12013
12003
  }
12014
12004
  )
12015
- ] }, ie)) })
12005
+ ] }, se)) })
12016
12006
  ] }),
12017
12007
  i && /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
12018
12008
  /* @__PURE__ */ l.jsx(
@@ -12082,7 +12072,7 @@ function vo({
12082
12072
  disabled: !1,
12083
12073
  maxLength: go,
12084
12074
  onSend: Qe,
12085
- onCancelEdit: Ge,
12075
+ onCancelEdit: Ve,
12086
12076
  onStop: w,
12087
12077
  allowEmptySend: q.length > 0,
12088
12078
  textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${M ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${$ ? "border-red-400" : ""} ${c.textarea || ""}`
@@ -12278,8 +12268,8 @@ var B0 = f.forwardRef((e, t) => {
12278
12268
  "data-state": a === "hidden" ? "hidden" : "visible",
12279
12269
  ...r,
12280
12270
  ref: t,
12281
- onPointerEnter: ee(e.onPointerEnter, () => c("POINTER_ENTER")),
12282
- onPointerLeave: ee(e.onPointerLeave, () => c("POINTER_LEAVE"))
12271
+ onPointerEnter: Q(e.onPointerEnter, () => c("POINTER_ENTER")),
12272
+ onPointerLeave: Q(e.onPointerLeave, () => c("POINTER_LEAVE"))
12283
12273
  }
12284
12274
  ) });
12285
12275
  }), Vf = f.forwardRef((e, t) => {
@@ -12472,11 +12462,11 @@ var B0 = f.forwardRef((e, t) => {
12472
12462
  ...p,
12473
12463
  ref: m,
12474
12464
  style: { position: "absolute", ...p.style },
12475
- onPointerDown: ee(e.onPointerDown, (A) => {
12465
+ onPointerDown: Q(e.onPointerDown, (A) => {
12476
12466
  A.button === 0 && (A.target.setPointerCapture(A.pointerId), b.current = g.getBoundingClientRect(), w.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", v.viewport && (v.viewport.style.scrollBehavior = "auto"), I(A));
12477
12467
  }),
12478
- onPointerMove: ee(e.onPointerMove, I),
12479
- onPointerUp: ee(e.onPointerUp, (A) => {
12468
+ onPointerMove: Q(e.onPointerMove, I),
12469
+ onPointerUp: Q(e.onPointerUp, (A) => {
12480
12470
  const k = A.target;
12481
12471
  k.hasPointerCapture(A.pointerId) && k.releasePointerCapture(A.pointerId), document.body.style.webkitUserSelect = w.current, v.viewport && (v.viewport.style.scrollBehavior = ""), b.current = null;
12482
12472
  })
@@ -12519,11 +12509,11 @@ var B0 = f.forwardRef((e, t) => {
12519
12509
  height: "var(--radix-scroll-area-thumb-height)",
12520
12510
  ...r
12521
12511
  },
12522
- onPointerDownCapture: ee(e.onPointerDownCapture, (h) => {
12512
+ onPointerDownCapture: Q(e.onPointerDownCapture, (h) => {
12523
12513
  const v = h.target.getBoundingClientRect(), g = h.clientX - v.left, x = h.clientY - v.top;
12524
12514
  i.onThumbPointerDown({ x: g, y: x });
12525
12515
  }),
12526
- onPointerUp: ee(e.onPointerUp, i.onThumbPointerUp)
12516
+ onPointerUp: Q(e.onPointerUp, i.onThumbPointerUp)
12527
12517
  }
12528
12518
  );
12529
12519
  }
@@ -12672,15 +12662,15 @@ function Ei({
12672
12662
  createThread: x,
12673
12663
  deleteThread: m,
12674
12664
  renameThread: b
12675
- } = Hi(), [w, y] = fe(p ?? []), [E, S] = fe(!1), [C, R] = fe(null), [I, A] = fe(null), [k, M] = fe(""), [W, G] = fe(!1);
12676
- Ve(() => {
12665
+ } = Hi(), [w, y] = de(p ?? []), [E, S] = de(!1), [C, R] = de(null), [I, A] = de(null), [k, M] = de(""), [W, G] = de(!1);
12666
+ Ge(() => {
12677
12667
  y(p ?? []);
12678
12668
  }, [p]);
12679
12669
  const N = async (F) => {
12680
12670
  try {
12681
12671
  await h(F), a == null || a(F), c == null || c(F);
12682
- } catch (Q) {
12683
- console.error("Failed to select thread:", Q);
12672
+ } catch (ee) {
12673
+ console.error("Failed to select thread:", ee);
12684
12674
  }
12685
12675
  }, $ = async () => {
12686
12676
  try {
@@ -12692,31 +12682,31 @@ function Ei({
12692
12682
  } finally {
12693
12683
  G(!1);
12694
12684
  }
12695
- }, L = async (F, Q) => {
12696
- if (Q.stopPropagation(), !!confirm("Delete this thread?"))
12685
+ }, L = async (F, ee) => {
12686
+ if (ee.stopPropagation(), !!confirm("Delete this thread?"))
12697
12687
  try {
12698
12688
  await m(F), d == null || d(F);
12699
- } catch (de) {
12700
- console.error("Failed to delete thread:", de);
12689
+ } catch (he) {
12690
+ console.error("Failed to delete thread:", he);
12701
12691
  }
12702
- }, q = (F, Q) => {
12703
- Q.stopPropagation(), A(F.threadId), M(F.title || `Thread ${F.threadId.slice(0, 8)}`);
12692
+ }, q = (F, ee) => {
12693
+ ee.stopPropagation(), A(F.threadId), M(F.title || `Thread ${F.threadId.slice(0, 8)}`);
12704
12694
  }, O = async (F) => {
12705
12695
  if (k.trim())
12706
12696
  try {
12707
12697
  await b(F, k.trim()), A(null), M("");
12708
- } catch (Q) {
12709
- console.error("Failed to update title:", Q);
12698
+ } catch (ee) {
12699
+ console.error("Failed to update title:", ee);
12710
12700
  }
12711
12701
  }, _ = () => {
12712
12702
  A(null), M("");
12713
- }, z = (F, Q) => {
12714
- F.key === "Enter" ? O(Q) : F.key === "Escape" && _();
12703
+ }, z = (F, ee) => {
12704
+ F.key === "Enter" ? O(ee) : F.key === "Escape" && _();
12715
12705
  }, X = (F) => {
12716
12706
  if (!F) return "";
12717
12707
  try {
12718
- const Q = new Date(F), be = (/* @__PURE__ */ new Date()).getTime() - Q.getTime(), Y = Math.floor(be / (1e3 * 60 * 60 * 24));
12719
- return Y === 0 ? Q.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : Y === 1 ? "Yesterday" : Y < 7 ? `${Y} days ago` : Q.toLocaleDateString();
12708
+ const ee = new Date(F), be = (/* @__PURE__ */ new Date()).getTime() - ee.getTime(), Y = Math.floor(be / (1e3 * 60 * 60 * 24));
12709
+ return Y === 0 ? ee.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : Y === 1 ? "Yesterday" : Y < 7 ? `${Y} days ago` : ee.toLocaleDateString();
12720
12710
  } catch {
12721
12711
  return "";
12722
12712
  }
@@ -12742,15 +12732,15 @@ function Ei({
12742
12732
  children: /* @__PURE__ */ l.jsx("div", { className: "p-2 space-y-1 pb-4", children: E ? /* @__PURE__ */ l.jsx("div", { className: "text-center py-8 text-slate-400", children: "Loading…" }) : w.length === 0 ? /* @__PURE__ */ l.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
12743
12733
  /* @__PURE__ */ l.jsx(Jp, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
12744
12734
  /* @__PURE__ */ l.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
12745
- ] }) : w.slice().sort((F, Q) => new Date(Q.updatedAt || Q.createdAt || "").getTime() - new Date(F.updatedAt || F.createdAt || "").getTime()).map((F) => /* @__PURE__ */ l.jsxs(
12735
+ ] }) : w.slice().sort((F, ee) => new Date(ee.updatedAt || ee.createdAt || "").getTime() - new Date(F.updatedAt || F.createdAt || "").getTime()).map((F) => /* @__PURE__ */ l.jsxs(
12746
12736
  "div",
12747
12737
  {
12748
12738
  onClick: () => N(F.threadId),
12749
12739
  className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? g) === F.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
12750
12740
  children: [
12751
12741
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
12752
- /* @__PURE__ */ l.jsx("div", { className: "flex-1 min-w-0", children: I === F.threadId ? /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2", onClick: (Q) => Q.stopPropagation(), children: [
12753
- /* @__PURE__ */ l.jsx(kr, { value: k, onChange: (Q) => M(Q.target.value), onKeyDown: (Q) => z(Q, F.threadId), className: "h-6 text-sm", autoFocus: !0 }),
12742
+ /* @__PURE__ */ l.jsx("div", { className: "flex-1 min-w-0", children: I === F.threadId ? /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2", onClick: (ee) => ee.stopPropagation(), children: [
12743
+ /* @__PURE__ */ l.jsx(kr, { value: k, onChange: (ee) => M(ee.target.value), onKeyDown: (ee) => z(ee, F.threadId), className: "h-6 text-sm", autoFocus: !0 }),
12754
12744
  /* @__PURE__ */ l.jsx(Ae, { variant: "ghost", size: "sm", onClick: () => O(F.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(Di, { size: 12 }) }),
12755
12745
  /* @__PURE__ */ l.jsx(Ae, { variant: "ghost", size: "sm", onClick: _, className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(Vn, { size: 12 }) })
12756
12746
  ] }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
@@ -12761,13 +12751,13 @@ function Ei({
12761
12751
  ] })
12762
12752
  ] }) }),
12763
12753
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
12764
- r && I !== F.threadId && /* @__PURE__ */ l.jsx(Ae, { variant: "ghost", size: "sm", onClick: (Q) => q(F, Q), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ l.jsx(Sc, { size: 12 }) }),
12754
+ r && I !== F.threadId && /* @__PURE__ */ l.jsx(Ae, { variant: "ghost", size: "sm", onClick: (ee) => q(F, ee), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ l.jsx(Sc, { size: 12 }) }),
12765
12755
  n && /* @__PURE__ */ l.jsx(
12766
12756
  Ae,
12767
12757
  {
12768
12758
  variant: "ghost",
12769
12759
  size: "sm",
12770
- onClick: (Q) => L(F.threadId, Q),
12760
+ onClick: (ee) => L(F.threadId, ee),
12771
12761
  className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
12772
12762
  title: "Delete thread",
12773
12763
  children: /* @__PURE__ */ l.jsx(Qp, { size: 12 })
@@ -13139,20 +13129,20 @@ var Ni = "TooltipTrigger", vh = f.forwardRef(
13139
13129
  "data-state": o.stateAttribute,
13140
13130
  ...r,
13141
13131
  ref: c,
13142
- onPointerMove: ee(e.onPointerMove, (p) => {
13132
+ onPointerMove: Q(e.onPointerMove, (p) => {
13143
13133
  p.pointerType !== "touch" && !d.current && !s.isPointerInTransitRef.current && (o.onTriggerEnter(), d.current = !0);
13144
13134
  }),
13145
- onPointerLeave: ee(e.onPointerLeave, () => {
13135
+ onPointerLeave: Q(e.onPointerLeave, () => {
13146
13136
  o.onTriggerLeave(), d.current = !1;
13147
13137
  }),
13148
- onPointerDown: ee(e.onPointerDown, () => {
13138
+ onPointerDown: Q(e.onPointerDown, () => {
13149
13139
  o.open && o.onClose(), u.current = !0, document.addEventListener("pointerup", h, { once: !0 });
13150
13140
  }),
13151
- onFocus: ee(e.onFocus, () => {
13141
+ onFocus: Q(e.onFocus, () => {
13152
13142
  u.current || o.onOpen();
13153
13143
  }),
13154
- onBlur: ee(e.onBlur, o.onClose),
13155
- onClick: ee(e.onClick, o.onClose)
13144
+ onBlur: Q(e.onBlur, o.onClose),
13145
+ onClick: Q(e.onClick, o.onClose)
13156
13146
  }
13157
13147
  ) });
13158
13148
  }
@@ -13959,7 +13949,7 @@ var ys = "Switch", [ZC, wR] = $t(ys), [QC, eT] = ZC(ys), Hh = f.forwardRef(
13959
13949
  value: c,
13960
13950
  ...h,
13961
13951
  ref: g,
13962
- onClick: ee(e.onClick, (y) => {
13952
+ onClick: Q(e.onClick, (y) => {
13963
13953
  w((E) => !E), m && (x.current = y.isPropagationStopped(), x.current || y.stopPropagation());
13964
13954
  })
13965
13955
  }
@@ -14180,15 +14170,15 @@ var Kh = "SelectTrigger", Yh = f.forwardRef(
14180
14170
  "data-placeholder": xp(i.value) ? "" : void 0,
14181
14171
  ...o,
14182
14172
  ref: c,
14183
- onClick: ee(o.onClick, (x) => {
14173
+ onClick: Q(o.onClick, (x) => {
14184
14174
  x.currentTarget.focus(), d.current !== "mouse" && g(x);
14185
14175
  }),
14186
- onPointerDown: ee(o.onPointerDown, (x) => {
14176
+ onPointerDown: Q(o.onPointerDown, (x) => {
14187
14177
  d.current = x.pointerType;
14188
14178
  const m = x.target;
14189
14179
  m.hasPointerCapture(x.pointerId) && m.releasePointerCapture(x.pointerId), x.button === 0 && x.ctrlKey === !1 && x.pointerType === "mouse" && (g(x), x.preventDefault());
14190
14180
  }),
14191
- onKeyDown: ee(o.onKeyDown, (x) => {
14181
+ onKeyDown: Q(o.onKeyDown, (x) => {
14192
14182
  const m = h.current !== "";
14193
14183
  !(x.ctrlKey || x.altKey || x.metaKey) && x.key.length === 1 && p(x.key), !(m && x.key === " ") && rT.includes(x.key) && (g(), x.preventDefault());
14194
14184
  })
@@ -14269,9 +14259,9 @@ var Ot = 10, [ep, xn] = cr(kn), dT = "SelectContentImpl", fT = Xn("SelectContent
14269
14259
  }, [y]), sa();
14270
14260
  const L = f.useCallback(
14271
14261
  (Y) => {
14272
- const [P, ...Z] = W().map((se) => se.ref.current), [ne] = Z.slice(-1), le = document.activeElement;
14273
- for (const se of Y)
14274
- if (se === le || (se == null || se.scrollIntoView({ block: "nearest" }), se === P && S && (S.scrollTop = 0), se === ne && S && (S.scrollTop = S.scrollHeight), se == null || se.focus(), document.activeElement !== le)) return;
14262
+ const [P, ...Z] = W().map((ie) => ie.ref.current), [ne] = Z.slice(-1), le = document.activeElement;
14263
+ for (const ie of Y)
14264
+ if (ie === le || (ie == null || ie.scrollIntoView({ block: "nearest" }), ie === P && S && (S.scrollTop = 0), ie === ne && S && (S.scrollTop = S.scrollHeight), ie == null || ie.focus(), document.activeElement !== le)) return;
14275
14265
  },
14276
14266
  [W, S]
14277
14267
  ), q = f.useCallback(
@@ -14286,10 +14276,10 @@ var Ot = 10, [ep, xn] = cr(kn), dT = "SelectContentImpl", fT = Xn("SelectContent
14286
14276
  if (y) {
14287
14277
  let Y = { x: 0, y: 0 };
14288
14278
  const P = (ne) => {
14289
- var le, se;
14279
+ var le, ie;
14290
14280
  Y = {
14291
14281
  x: Math.abs(Math.round(ne.pageX) - (((le = _.current) == null ? void 0 : le.x) ?? 0)),
14292
- y: Math.abs(Math.round(ne.pageY) - (((se = _.current) == null ? void 0 : se.y) ?? 0))
14282
+ y: Math.abs(Math.round(ne.pageY) - (((ie = _.current) == null ? void 0 : ie.y) ?? 0))
14293
14283
  };
14294
14284
  }, Z = (ne) => {
14295
14285
  Y.x <= 10 && Y.y <= 10 ? ne.preventDefault() : y.contains(ne.target) || O(!1), document.removeEventListener("pointermove", P), _.current = null;
@@ -14313,13 +14303,13 @@ var Ot = 10, [ep, xn] = cr(kn), dT = "SelectContentImpl", fT = Xn("SelectContent
14313
14303
  (w.value !== void 0 && w.value === P || ne) && (A(Y), ne && ($.current = !0));
14314
14304
  },
14315
14305
  [w.value]
14316
- ), F = f.useCallback(() => y == null ? void 0 : y.focus(), [y]), Q = f.useCallback(
14306
+ ), F = f.useCallback(() => y == null ? void 0 : y.focus(), [y]), ee = f.useCallback(
14317
14307
  (Y, P, Z) => {
14318
14308
  const ne = !$.current && !Z;
14319
14309
  (w.value !== void 0 && w.value === P || ne) && M(Y);
14320
14310
  },
14321
14311
  [w.value]
14322
- ), de = r === "popper" ? ji : np, be = de === ji ? {
14312
+ ), he = r === "popper" ? ji : np, be = he === ji ? {
14323
14313
  side: a,
14324
14314
  sideOffset: c,
14325
14315
  align: u,
@@ -14341,7 +14331,7 @@ var Ot = 10, [ep, xn] = cr(kn), dT = "SelectContentImpl", fT = Xn("SelectContent
14341
14331
  itemRefCallback: oe,
14342
14332
  selectedItem: I,
14343
14333
  onItemLeave: F,
14344
- itemTextRefCallback: Q,
14334
+ itemTextRefCallback: ee,
14345
14335
  focusSelectedItem: q,
14346
14336
  selectedItemText: k,
14347
14337
  position: r,
@@ -14355,7 +14345,7 @@ var Ot = 10, [ep, xn] = cr(kn), dT = "SelectContentImpl", fT = Xn("SelectContent
14355
14345
  onMountAutoFocus: (Y) => {
14356
14346
  Y.preventDefault();
14357
14347
  },
14358
- onUnmountAutoFocus: ee(o, (Y) => {
14348
+ onUnmountAutoFocus: Q(o, (Y) => {
14359
14349
  var P;
14360
14350
  (P = w.trigger) == null || P.focus({ preventScroll: !0 }), Y.preventDefault();
14361
14351
  }),
@@ -14369,7 +14359,7 @@ var Ot = 10, [ep, xn] = cr(kn), dT = "SelectContentImpl", fT = Xn("SelectContent
14369
14359
  onFocusOutside: (Y) => Y.preventDefault(),
14370
14360
  onDismiss: () => w.onOpenChange(!1),
14371
14361
  children: /* @__PURE__ */ l.jsx(
14372
- de,
14362
+ he,
14373
14363
  {
14374
14364
  role: "listbox",
14375
14365
  id: w.contentId,
@@ -14388,13 +14378,13 @@ var Ot = 10, [ep, xn] = cr(kn), dT = "SelectContentImpl", fT = Xn("SelectContent
14388
14378
  outline: "none",
14389
14379
  ...b.style
14390
14380
  },
14391
- onKeyDown: ee(b.onKeyDown, (Y) => {
14381
+ onKeyDown: Q(b.onKeyDown, (Y) => {
14392
14382
  const P = Y.ctrlKey || Y.altKey || Y.metaKey;
14393
14383
  if (Y.key === "Tab" && Y.preventDefault(), !P && Y.key.length === 1 && X(Y.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(Y.key)) {
14394
14384
  let ne = W().filter((le) => !le.disabled).map((le) => le.ref.current);
14395
14385
  if (["ArrowUp", "End"].includes(Y.key) && (ne = ne.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(Y.key)) {
14396
- const le = Y.target, se = ne.indexOf(le);
14397
- ne = ne.slice(se + 1);
14386
+ const le = Y.target, ie = ne.indexOf(le);
14387
+ ne = ne.slice(ie + 1);
14398
14388
  }
14399
14389
  setTimeout(() => L(ne)), Y.preventDefault();
14400
14390
  }
@@ -14415,42 +14405,42 @@ var hT = "SelectItemAlignedPosition", np = f.forwardRef((e, t) => {
14415
14405
  if (s.trigger && s.valueNode && a && u && x && m && b) {
14416
14406
  const R = s.trigger.getBoundingClientRect(), I = u.getBoundingClientRect(), A = s.valueNode.getBoundingClientRect(), k = b.getBoundingClientRect();
14417
14407
  if (s.dir !== "rtl") {
14418
- const le = k.left - I.left, se = A.left - le, ke = R.left - se, Fe = R.width + ke, Le = Math.max(Fe, I.width), ce = window.innerWidth - Ot, je = Ri(se, [
14408
+ const le = k.left - I.left, ie = A.left - le, ke = R.left - ie, Fe = R.width + ke, Le = Math.max(Fe, I.width), ue = window.innerWidth - Ot, je = Ri(ie, [
14419
14409
  Ot,
14420
14410
  // Prevents the content from going off the starting edge of the
14421
14411
  // viewport. It may still go off the ending edge, but this can be
14422
14412
  // controlled by the user since they may want to manage overflow in a
14423
14413
  // specific way.
14424
14414
  // https://github.com/radix-ui/primitives/issues/2049
14425
- Math.max(Ot, ce - Le)
14415
+ Math.max(Ot, ue - Le)
14426
14416
  ]);
14427
14417
  a.style.minWidth = Fe + "px", a.style.left = je + "px";
14428
14418
  } else {
14429
- const le = I.right - k.right, se = window.innerWidth - A.right - le, ke = window.innerWidth - R.right - se, Fe = R.width + ke, Le = Math.max(Fe, I.width), ce = window.innerWidth - Ot, je = Ri(se, [
14419
+ const le = I.right - k.right, ie = window.innerWidth - A.right - le, ke = window.innerWidth - R.right - ie, Fe = R.width + ke, Le = Math.max(Fe, I.width), ue = window.innerWidth - Ot, je = Ri(ie, [
14430
14420
  Ot,
14431
- Math.max(Ot, ce - Le)
14421
+ Math.max(Ot, ue - Le)
14432
14422
  ]);
14433
14423
  a.style.minWidth = Fe + "px", a.style.right = je + "px";
14434
14424
  }
14435
- const M = p(), W = window.innerHeight - Ot * 2, G = x.scrollHeight, N = window.getComputedStyle(u), $ = parseInt(N.borderTopWidth, 10), L = parseInt(N.paddingTop, 10), q = parseInt(N.borderBottomWidth, 10), O = parseInt(N.paddingBottom, 10), _ = $ + L + G + O + q, z = Math.min(m.offsetHeight * 5, _), X = window.getComputedStyle(x), oe = parseInt(X.paddingTop, 10), F = parseInt(X.paddingBottom, 10), Q = R.top + R.height / 2 - Ot, de = W - Q, be = m.offsetHeight / 2, Y = m.offsetTop + be, P = $ + L + Y, Z = _ - P;
14436
- if (P <= Q) {
14425
+ const M = p(), W = window.innerHeight - Ot * 2, G = x.scrollHeight, N = window.getComputedStyle(u), $ = parseInt(N.borderTopWidth, 10), L = parseInt(N.paddingTop, 10), q = parseInt(N.borderBottomWidth, 10), O = parseInt(N.paddingBottom, 10), _ = $ + L + G + O + q, z = Math.min(m.offsetHeight * 5, _), X = window.getComputedStyle(x), oe = parseInt(X.paddingTop, 10), F = parseInt(X.paddingBottom, 10), ee = R.top + R.height / 2 - Ot, he = W - ee, be = m.offsetHeight / 2, Y = m.offsetTop + be, P = $ + L + Y, Z = _ - P;
14426
+ if (P <= ee) {
14437
14427
  const le = M.length > 0 && m === M[M.length - 1].ref.current;
14438
14428
  a.style.bottom = "0px";
14439
- const se = u.clientHeight - x.offsetTop - x.offsetHeight, ke = Math.max(
14440
- de,
14429
+ const ie = u.clientHeight - x.offsetTop - x.offsetHeight, ke = Math.max(
14430
+ he,
14441
14431
  be + // viewport might have padding bottom, include it to avoid a scrollable viewport
14442
- (le ? F : 0) + se + q
14432
+ (le ? F : 0) + ie + q
14443
14433
  ), Fe = P + ke;
14444
14434
  a.style.height = Fe + "px";
14445
14435
  } else {
14446
14436
  const le = M.length > 0 && m === M[0].ref.current;
14447
14437
  a.style.top = "0px";
14448
14438
  const ke = Math.max(
14449
- Q,
14439
+ ee,
14450
14440
  $ + x.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
14451
14441
  (le ? oe : 0) + be
14452
14442
  ) + Z;
14453
- a.style.height = ke + "px", x.scrollTop = P - Q + x.offsetTop;
14443
+ a.style.height = ke + "px", x.scrollTop = P - ee + x.offsetTop;
14454
14444
  }
14455
14445
  a.style.margin = `${Ot}px 0`, a.style.minHeight = z + "px", a.style.maxHeight = W + "px", r == null || r(), requestAnimationFrame(() => v.current = !0);
14456
14446
  }
@@ -14577,7 +14567,7 @@ var [mT, La] = cr(kn, {}), Ai = "SelectViewport", rp = f.forwardRef(
14577
14567
  overflow: "hidden auto",
14578
14568
  ...o.style
14579
14569
  },
14580
- onScroll: ee(o.onScroll, (u) => {
14570
+ onScroll: Q(o.onScroll, (u) => {
14581
14571
  const d = u.currentTarget, { contentWrapper: h, shouldExpandOnScrollRef: p } = i;
14582
14572
  if (p != null && p.current && h) {
14583
14573
  const v = Math.abs(c.current - d.scrollTop);
@@ -14663,26 +14653,26 @@ var Bo = "SelectItem", [bT, ap] = cr(Bo), lp = f.forwardRef(
14663
14653
  tabIndex: o ? void 0 : -1,
14664
14654
  ...i,
14665
14655
  ref: g,
14666
- onFocus: ee(i.onFocus, () => v(!0)),
14667
- onBlur: ee(i.onBlur, () => v(!1)),
14668
- onClick: ee(i.onClick, () => {
14656
+ onFocus: Q(i.onFocus, () => v(!0)),
14657
+ onBlur: Q(i.onBlur, () => v(!1)),
14658
+ onClick: Q(i.onClick, () => {
14669
14659
  m.current !== "mouse" && b();
14670
14660
  }),
14671
- onPointerUp: ee(i.onPointerUp, () => {
14661
+ onPointerUp: Q(i.onPointerUp, () => {
14672
14662
  m.current === "mouse" && b();
14673
14663
  }),
14674
- onPointerDown: ee(i.onPointerDown, (w) => {
14664
+ onPointerDown: Q(i.onPointerDown, (w) => {
14675
14665
  m.current = w.pointerType;
14676
14666
  }),
14677
- onPointerMove: ee(i.onPointerMove, (w) => {
14667
+ onPointerMove: Q(i.onPointerMove, (w) => {
14678
14668
  var y;
14679
14669
  m.current = w.pointerType, o ? (y = c.onItemLeave) == null || y.call(c) : m.current === "mouse" && w.currentTarget.focus({ preventScroll: !0 });
14680
14670
  }),
14681
- onPointerLeave: ee(i.onPointerLeave, (w) => {
14671
+ onPointerLeave: Q(i.onPointerLeave, (w) => {
14682
14672
  var y;
14683
14673
  w.currentTarget === document.activeElement && ((y = c.onItemLeave) == null || y.call(c));
14684
14674
  }),
14685
- onKeyDown: ee(i.onKeyDown, (w) => {
14675
+ onKeyDown: Q(i.onKeyDown, (w) => {
14686
14676
  var E;
14687
14677
  ((E = c.searchRef) == null ? void 0 : E.current) !== "" && w.key === " " || (oT.includes(w.key) && b(), w.key === " " && w.preventDefault());
14688
14678
  })
@@ -14786,14 +14776,14 @@ var pp = f.forwardRef((e, t) => {
14786
14776
  ...o,
14787
14777
  ref: t,
14788
14778
  style: { flexShrink: 0, ...o.style },
14789
- onPointerDown: ee(o.onPointerDown, () => {
14779
+ onPointerDown: Q(o.onPointerDown, () => {
14790
14780
  i.current === null && (i.current = window.setInterval(r, 50));
14791
14781
  }),
14792
- onPointerMove: ee(o.onPointerMove, () => {
14782
+ onPointerMove: Q(o.onPointerMove, () => {
14793
14783
  var u;
14794
14784
  (u = s.onItemLeave) == null || u.call(s), i.current === null && (i.current = window.setInterval(r, 50));
14795
14785
  }),
14796
- onPointerLeave: ee(o.onPointerLeave, () => {
14786
+ onPointerLeave: Q(o.onPointerLeave, () => {
14797
14787
  c();
14798
14788
  })
14799
14789
  }
@@ -15045,11 +15035,11 @@ const MT = {
15045
15035
  }
15046
15036
  };
15047
15037
  function SR({ settings: e, onSettingsChange: t, className: n = "" }) {
15048
- const [r, o] = fe(!1), [s, i] = fe(!1), [a, c] = fe(e), [u, d] = fe(!1), { toast: h } = oa();
15049
- Ve(() => {
15038
+ const [r, o] = de(!1), [s, i] = de(!1), [a, c] = de(e), [u, d] = de(!1), { toast: h } = oa();
15039
+ Ge(() => {
15050
15040
  const m = JSON.stringify(a) !== JSON.stringify(e);
15051
15041
  d(m);
15052
- }, [a, e]), Ve(() => {
15042
+ }, [a, e]), Ge(() => {
15053
15043
  c(e);
15054
15044
  }, [e]);
15055
15045
  const p = () => {