teodor-new-chat-ui 4.1.0 → 4.1.2

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
@@ -64,8 +64,8 @@ function om() {
64
64
  }
65
65
  function y(T, B, Q) {
66
66
  {
67
- var Ce = x.ReactDebugCurrentFrame, Ke = Ce.getStackAddendum();
68
- Ke !== "" && (B += "%s", Q = Q.concat([Ke]));
67
+ var Ce = x.ReactDebugCurrentFrame, Ve = Ce.getStackAddendum();
68
+ Ve !== "" && (B += "%s", Q = Q.concat([Ve]));
69
69
  var Je = Q.map(function($e) {
70
70
  return String($e);
71
71
  });
@@ -85,8 +85,8 @@ function om() {
85
85
  var Ce = T.displayName;
86
86
  if (Ce)
87
87
  return Ce;
88
- var Ke = B.displayName || B.name || "";
89
- return Ke !== "" ? Q + "(" + Ke + ")" : Q;
88
+ var Ve = B.displayName || B.name || "";
89
+ return Ve !== "" ? Q + "(" + Ve + ")" : Q;
90
90
  }
91
91
  function M(T) {
92
92
  return T.displayName || "Context";
@@ -126,7 +126,7 @@ function om() {
126
126
  var Ce = T.displayName || null;
127
127
  return Ce !== null ? Ce : D(T.type) || "Memo";
128
128
  case h: {
129
- var Ke = T, Je = Ke._payload, $e = Ke._init;
129
+ var Ve = T, Je = Ve._payload, $e = Ve._init;
130
130
  try {
131
131
  return D($e(Je));
132
132
  } catch {
@@ -204,8 +204,8 @@ function om() {
204
204
  if (z === void 0)
205
205
  try {
206
206
  throw Error();
207
- } catch (Ke) {
208
- var Ce = Ke.stack.trim().match(/\n( *(at )?)/);
207
+ } catch (Ve) {
208
+ var Ce = Ve.stack.trim().match(/\n( *(at )?)/);
209
209
  z = Ce && Ce[1] || "";
210
210
  }
211
211
  return `
@@ -227,7 +227,7 @@ function om() {
227
227
  }
228
228
  var Ce;
229
229
  V = !0;
230
- var Ke = Error.prepareStackTrace;
230
+ var Ve = Error.prepareStackTrace;
231
231
  Error.prepareStackTrace = void 0;
232
232
  var Je;
233
233
  Je = ue.current, ue.current = null, fe();
@@ -283,7 +283,7 @@ function om() {
283
283
  }
284
284
  }
285
285
  } finally {
286
- V = !1, ue.current = Je, Re(), Error.prepareStackTrace = Ke;
286
+ V = !1, ue.current = Je, Re(), Error.prepareStackTrace = Ve;
287
287
  }
288
288
  var sr = T ? T.displayName || T.name : "", Fn = sr ? P(sr) : "";
289
289
  return typeof T == "function" && X.set(T, Fn), Fn;
@@ -315,16 +315,16 @@ function om() {
315
315
  case f:
316
316
  return et(T.type, B, Q);
317
317
  case h: {
318
- var Ce = T, Ke = Ce._payload, Je = Ce._init;
318
+ var Ce = T, Ve = Ce._payload, Je = Ce._init;
319
319
  try {
320
- return et(Je(Ke), B, Q);
320
+ return et(Je(Ve), B, Q);
321
321
  } catch {
322
322
  }
323
323
  }
324
324
  }
325
325
  return "";
326
326
  }
327
- var we = Object.prototype.hasOwnProperty, je = {}, Ye = x.ReactDebugCurrentFrame;
327
+ var be = Object.prototype.hasOwnProperty, je = {}, Ye = x.ReactDebugCurrentFrame;
328
328
  function Fe(T) {
329
329
  if (T) {
330
330
  var B = T._owner, Q = et(T.type, T._source, B ? B.type : null);
@@ -332,9 +332,9 @@ function om() {
332
332
  } else
333
333
  Ye.setExtraStackFrame(null);
334
334
  }
335
- function st(T, B, Q, Ce, Ke) {
335
+ function st(T, B, Q, Ce, Ve) {
336
336
  {
337
- var Je = Function.call.bind(we);
337
+ var Je = Function.call.bind(be);
338
338
  for (var $e in T)
339
339
  if (Je(T, $e)) {
340
340
  var Pe = void 0;
@@ -347,7 +347,7 @@ function om() {
347
347
  } catch (ct) {
348
348
  Pe = ct;
349
349
  }
350
- Pe && !(Pe instanceof Error) && (Fe(Ke), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Ce || "React class", Q, $e, typeof Pe), Fe(null)), Pe instanceof Error && !(Pe.message in je) && (je[Pe.message] = !0, Fe(Ke), b("Failed %s type: %s", Q, Pe.message), Fe(null));
350
+ Pe && !(Pe instanceof Error) && (Fe(Ve), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Ce || "React class", Q, $e, typeof Pe), Fe(null)), Pe instanceof Error && !(Pe.message in je) && (je[Pe.message] = !0, Fe(Ve), b("Failed %s type: %s", Q, Pe.message), Fe(null));
351
351
  }
352
352
  }
353
353
  }
@@ -371,7 +371,7 @@ function om() {
371
371
  function Se(T) {
372
372
  return "" + T;
373
373
  }
374
- function be(T) {
374
+ function ve(T) {
375
375
  if (pe(T))
376
376
  return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ae(T)), Se(T);
377
377
  }
@@ -382,7 +382,7 @@ function om() {
382
382
  __source: !0
383
383
  }, Ue, lt;
384
384
  function Et(T) {
385
- if (we.call(T, "ref")) {
385
+ if (be.call(T, "ref")) {
386
386
  var B = Object.getOwnPropertyDescriptor(T, "ref").get;
387
387
  if (B && B.isReactWarning)
388
388
  return !1;
@@ -390,7 +390,7 @@ function om() {
390
390
  return T.ref !== void 0;
391
391
  }
392
392
  function yn(T) {
393
- if (we.call(T, "key")) {
393
+ if (be.call(T, "key")) {
394
394
  var B = Object.getOwnPropertyDescriptor(T, "key").get;
395
395
  if (B && B.isReactWarning)
396
396
  return !1;
@@ -422,7 +422,7 @@ function om() {
422
422
  });
423
423
  }
424
424
  }
425
- var We = function(T, B, Q, Ce, Ke, Je, $e) {
425
+ var We = function(T, B, Q, Ce, Ve, Je, $e) {
426
426
  var Pe = {
427
427
  // This tag allows us to uniquely identify this as a React Element
428
428
  $$typeof: t,
@@ -448,15 +448,15 @@ function om() {
448
448
  configurable: !1,
449
449
  enumerable: !1,
450
450
  writable: !1,
451
- value: Ke
451
+ value: Ve
452
452
  }), Object.freeze && (Object.freeze(Pe.props), Object.freeze(Pe)), Pe;
453
453
  };
454
- function Ve(T, B, Q, Ce, Ke) {
454
+ function qe(T, B, Q, Ce, Ve) {
455
455
  {
456
456
  var Je, $e = {}, Pe = null, Ct = null;
457
- Q !== void 0 && (be(Q), Pe = "" + Q), yn(B) && (be(B.key), Pe = "" + B.key), Et(B) && (Ct = B.ref, G(B, Ke));
457
+ Q !== void 0 && (ve(Q), Pe = "" + Q), yn(B) && (ve(B.key), Pe = "" + B.key), Et(B) && (Ct = B.ref, G(B, Ve));
458
458
  for (Je in B)
459
- we.call(B, Je) && !Xe.hasOwnProperty(Je) && ($e[Je] = B[Je]);
459
+ be.call(B, Je) && !Xe.hasOwnProperty(Je) && ($e[Je] = B[Je]);
460
460
  if (T && T.defaultProps) {
461
461
  var ct = T.defaultProps;
462
462
  for (Je in ct)
@@ -466,7 +466,7 @@ function om() {
466
466
  var ft = typeof T == "function" ? T.displayName || T.name || "Unknown" : T;
467
467
  Pe && le($e, ft), Ct && Ee($e, ft);
468
468
  }
469
- return We(T, Pe, Ct, Ke, Ce, Ie.current, $e);
469
+ return We(T, Pe, Ct, Ve, Ce, Ie.current, $e);
470
470
  }
471
471
  }
472
472
  var kt = x.ReactCurrentOwner, Sn = x.ReactDebugCurrentFrame;
@@ -535,9 +535,9 @@ Check the top-level render call using <` + Q + ">.");
535
535
  else if (Dn(T))
536
536
  T._store && (T._store.validated = !0);
537
537
  else if (T) {
538
- var Ke = g(T);
539
- if (typeof Ke == "function" && Ke !== T.entries)
540
- for (var Je = Ke.call(T), $e; !($e = Je.next()).done; )
538
+ var Ve = g(T);
539
+ if (typeof Ve == "function" && Ve !== T.entries)
540
+ for (var Je = Ve.call(T), $e; !($e = Je.next()).done; )
541
541
  Dn($e.value) && ee($e.value, B);
542
542
  }
543
543
  }
@@ -561,8 +561,8 @@ Check the top-level render call using <` + Q + ">.");
561
561
  st(Q, T.props, "prop", Ce, T);
562
562
  } else if (B.PropTypes !== void 0 && !Mn) {
563
563
  Mn = !0;
564
- var Ke = D(B);
565
- b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Ke || "Unknown");
564
+ var Ve = D(B);
565
+ b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Ve || "Unknown");
566
566
  }
567
567
  typeof B.getDefaultProps == "function" && !B.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
568
568
  }
@@ -580,7 +580,7 @@ Check the top-level render call using <` + Q + ">.");
580
580
  }
581
581
  }
582
582
  var _t = {};
583
- function tn(T, B, Q, Ce, Ke, Je) {
583
+ function tn(T, B, Q, Ce, Ve, Je) {
584
584
  {
585
585
  var $e = N(T);
586
586
  if (!$e) {
@@ -591,7 +591,7 @@ Check the top-level render call using <` + Q + ">.");
591
591
  var ct;
592
592
  T === null ? ct = "null" : Z(T) ? ct = "array" : T !== void 0 && T.$$typeof === t ? (ct = "<" + (D(T.type) || "Unknown") + " />", Pe = " Did you accidentally export a JSX literal instead of a component?") : ct = typeof T, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ct, Pe);
593
593
  }
594
- var ft = Ve(T, B, Q, Ke, Je);
594
+ var ft = qe(T, B, Q, Ve, Je);
595
595
  if (ft == null)
596
596
  return ft;
597
597
  if ($e) {
@@ -607,7 +607,7 @@ Check the top-level render call using <` + Q + ">.");
607
607
  else
608
608
  he($t, T);
609
609
  }
610
- if (we.call(B, "key")) {
610
+ if (be.call(B, "key")) {
611
611
  var Fn = D(T), It = Object.keys(B).filter(function(kp) {
612
612
  return kp !== "key";
613
613
  }), Fs = It.length > 0 ? "{key: someKey, " + It.join(": ..., ") + ": ...}" : "{key: someKey}";
@@ -2900,7 +2900,7 @@ function Zg(e = {}) {
2900
2900
  o(N);
2901
2901
  }, []), E = ze(() => {
2902
2902
  var N;
2903
- (N = y.current) == null || N.abort(), y.current = null, l(!1), b(!1);
2903
+ (N = y.current) == null || N.abort(), y.current = null, l(!1), b(!1), S.current = 0, g(0);
2904
2904
  }, []), I = ze(() => {
2905
2905
  h(""), w(null), d(null);
2906
2906
  }, []), j = ze(
@@ -2957,22 +2957,24 @@ function Zg(e = {}) {
2957
2957
  credentials: i
2958
2958
  });
2959
2959
  if (!fe.ok || !fe.body) {
2960
- const we = await fe.text().catch(() => "");
2960
+ const be = await fe.text().catch(() => "");
2961
2961
  throw console.debug(
2962
2962
  "[use-chat] non-OK response",
2963
2963
  fe.status,
2964
- we == null ? void 0 : we.slice(0, 500)
2964
+ be == null ? void 0 : be.slice(0, 500)
2965
2965
  ), new Error(
2966
- `stream ${fe.status}${we ? ": " + we : ""}`
2966
+ `stream ${fe.status}${be ? ": " + be : ""}`
2967
2967
  );
2968
2968
  }
2969
2969
  b(!0);
2970
2970
  const Re = fe.body.getReader(), ue = new TextDecoder();
2971
- let z = "", P = [], V = S.current, X = null;
2971
+ let z = "", P = [];
2972
+ S.current = 0, g(0);
2973
+ let V = 0, X = null;
2972
2974
  const se = () => {
2973
2975
  if (P.length) {
2974
- const we = P.join("");
2975
- P = [], R.current && h((je) => je + we);
2976
+ const be = P.join("");
2977
+ P = [], R.current && h((je) => je + be);
2976
2978
  }
2977
2979
  X = null;
2978
2980
  }, ne = () => {
@@ -2980,14 +2982,14 @@ function Zg(e = {}) {
2980
2982
  };
2981
2983
  let Le = Date.now();
2982
2984
  const Ge = setInterval(() => {
2983
- var we;
2984
- if (Date.now() - Le > 2e4) {
2985
+ var be;
2986
+ if (Date.now() - Le > 6e4) {
2985
2987
  const je = "Stream idle timeout";
2986
- d(je), D.abort(), (we = M == null ? void 0 : M.onError) == null || we.call(M, je);
2988
+ d(je), D.abort(), (be = M == null ? void 0 : M.onError) == null || be.call(M, je);
2987
2989
  }
2988
2990
  }, 5e3), et = 1024 * 1024;
2989
2991
  try {
2990
- const we = fe.headers.get("X-Thread-Id") || fe.headers.get("x-thread-id"), je = fe.headers.get("X-Thread-Created") || fe.headers.get("x-thread-created"), Ye = we ?? null, Fe = String(je ?? "").toLowerCase() === "true";
2992
+ const be = fe.headers.get("X-Thread-Id") || fe.headers.get("x-thread-id"), je = fe.headers.get("X-Thread-Created") || fe.headers.get("x-thread-created"), Ye = be ?? null, Fe = String(je ?? "").toLowerCase() === "true";
2991
2993
  for ((L = M == null ? void 0 : M.onOpen) == null || L.call(M, { threadId: Ye, created: Fe }); ; ) {
2992
2994
  const { value: st, done: at } = await Re.read();
2993
2995
  if (at) break;
@@ -3007,29 +3009,28 @@ function Zg(e = {}) {
3007
3009
  console.debug("[use-chat] malformed SSE:", pe.slice(0, 200));
3008
3010
  continue;
3009
3011
  }
3010
- const be = Qg(Se) ? Se.data : Se;
3012
+ const ve = Qg(Se) ? Se.data : Se;
3011
3013
  Le = Date.now();
3012
- const Ie = be.seq;
3014
+ const Ie = ve.seq;
3013
3015
  if (Ie !== void 0) {
3014
3016
  if (Ie <= V) {
3015
- console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Ie, lastProcessedSeq: V, type: be.type });
3017
+ console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Ie, lastProcessedSeq: V, type: ve.type });
3016
3018
  continue;
3017
3019
  }
3018
3020
  V > 0 && Ie > V + 1 && ((k = M == null ? void 0 : M.onGap) == null || k.call(M, { from: V, to: Ie })), V = Ie, S.current = Ie, g(Ie);
3019
3021
  }
3020
- if (O == null || O(be), be.type === "token" && e.autoAppendAssistant !== !1)
3021
- P.push(be.content), ne();
3022
- else if (be.type === "message_delta") {
3023
- const Xe = be.delta.filter((Ue) => Ue.type === "text").map((Ue) => Ue.text).join("");
3022
+ if (O == null || O(ve), ve.type === "token" && e.autoAppendAssistant !== !1)
3023
+ P.push(ve.content), ne();
3024
+ else if (ve.type === "message_delta") {
3025
+ const Xe = ve.delta.filter((Ue) => Ue.type === "text").map((Ue) => Ue.text).join("");
3024
3026
  Xe && e.autoAppendAssistant !== !1 && (P.push(Xe), ne());
3025
- } else
3026
- X !== null && cancelAnimationFrame(X), se(), be.type === "checkpoint" ? w(be.checkpointId) : be.type === "error" && d(be.message);
3027
+ } else ve.type === "heartbeat" ? console.debug("[use-chat] heartbeat received") : (X !== null && cancelAnimationFrame(X), se(), ve.type === "checkpoint" ? w(ve.checkpointId) : ve.type === "error" && d(ve.message));
3027
3028
  }
3028
3029
  }
3029
3030
  se();
3030
- } catch (we) {
3031
- if (we.name !== "AbortError") {
3032
- const je = we.message || String(we);
3031
+ } catch (be) {
3032
+ if (be.name !== "AbortError") {
3033
+ const je = be.message || String(be);
3033
3034
  d(je), (U = M == null ? void 0 : M.onError) == null || U.call(M, je);
3034
3035
  }
3035
3036
  } finally {
@@ -3039,7 +3040,7 @@ function Zg(e = {}) {
3039
3040
  } finally {
3040
3041
  (Y = Re.releaseLock) == null || Y.call(Re);
3041
3042
  }
3042
- X !== null && typeof window < "u" && window.cancelAnimationFrame(X), clearInterval(Ge), l(!1), b(!1), y.current = null;
3043
+ X !== null && typeof window < "u" && window.cancelAnimationFrame(X), clearInterval(Ge), l(!1), b(!1), y.current = null, S.current = 0, g(0);
3043
3044
  }
3044
3045
  } catch (oe) {
3045
3046
  if (oe.name !== "AbortError") {
@@ -3047,7 +3048,7 @@ function Zg(e = {}) {
3047
3048
  d(fe), (de = M == null ? void 0 : M.onError) == null || de.call(M, fe);
3048
3049
  }
3049
3050
  } finally {
3050
- l(!1), b(!1), y.current = null;
3051
+ l(!1), b(!1), y.current = null, S.current = 0, g(0);
3051
3052
  }
3052
3053
  })(), { close: () => D.abort() };
3053
3054
  },
@@ -3166,7 +3167,7 @@ function ox({
3166
3167
  k.current = p;
3167
3168
  }, [p]);
3168
3169
  const U = it(!1), Y = it([]), de = it(null), oe = it(null), fe = it(!1), Re = ze((G, le) => new Promise((Ee, We) => {
3169
- const Ve = async () => {
3170
+ const qe = async () => {
3170
3171
  U.current = !0;
3171
3172
  try {
3172
3173
  await G(), Ee();
@@ -3179,7 +3180,7 @@ function ox({
3179
3180
  });
3180
3181
  }
3181
3182
  };
3182
- U.current ? Y.current.push(Ve) : Ve().catch((kt) => {
3183
+ U.current ? Y.current.push(qe) : qe().catch((kt) => {
3183
3184
  We(kt);
3184
3185
  });
3185
3186
  }), []), ue = ze(async () => {
@@ -3223,14 +3224,13 @@ function ox({
3223
3224
  (G) => {
3224
3225
  const le = G.threadId, Ee = !!G.created, We = !!G.ready;
3225
3226
  if (k.current !== le) {
3226
- const Ve = !k.current && D.messages.length <= 1;
3227
- Ve && (oe.current = le), w(le), (We || Ee || Ve) && V();
3227
+ !k.current && D.messages.length <= 1 && (oe.current = le), w(le), (We || Ee) && V();
3228
3228
  return;
3229
3229
  }
3230
3230
  (We || Ee) && V();
3231
3231
  },
3232
3232
  [V, D.messages.length]
3233
- ), { startStream: Ge, stop: et, isStreaming: we, error: je, setAuthToken: Ye } = tx({
3233
+ ), { startStream: Ge, stop: et, isStreaming: be, error: je, setAuthToken: Ye } = tx({
3234
3234
  baseUrl: d,
3235
3235
  onThreadInfo: Le,
3236
3236
  onMessageEvent: q,
@@ -3240,8 +3240,8 @@ function ox({
3240
3240
  onSequenceGap: ne
3241
3241
  });
3242
3242
  gt(() => {
3243
- P.current = we, we || z();
3244
- }, [z, we]), gt(() => {
3243
+ P.current = be, be || z();
3244
+ }, [z, be]), gt(() => {
3245
3245
  var Ee;
3246
3246
  const G = l.getAuthToken();
3247
3247
  Ye(G);
@@ -3280,16 +3280,16 @@ function ox({
3280
3280
  return;
3281
3281
  }
3282
3282
  if (!(de.current === G && !We)) {
3283
- w((Ve) => Ve === G ? Ve : G), de.current = G, b(!0);
3283
+ w((qe) => qe === G ? qe : G), de.current = G, b(!0);
3284
3284
  try {
3285
- const Ve = await l.getMessages({
3285
+ const qe = await l.getMessages({
3286
3286
  threadId: G,
3287
3287
  checkpointId: le,
3288
3288
  checkpointNs: Ee
3289
3289
  });
3290
- fe.current = !1, X(Ve, "replace"), N((Ve == null ? void 0 : Ve.checkpointId) ?? void 0), M((Ve == null ? void 0 : Ve.checkpointNs) ?? void 0);
3291
- } catch (Ve) {
3292
- throw i == null || i(String(Ve)), Ve;
3290
+ fe.current = !1, X(qe, "replace"), N((qe == null ? void 0 : qe.checkpointId) ?? void 0), M((qe == null ? void 0 : qe.checkpointNs) ?? void 0);
3291
+ } catch (qe) {
3292
+ throw i == null || i(String(qe)), qe;
3293
3293
  } finally {
3294
3294
  de.current = null, b(!1);
3295
3295
  }
@@ -3318,7 +3318,7 @@ function ox({
3318
3318
  await Z(k.current, G, le ?? void 0, !0);
3319
3319
  },
3320
3320
  [Z]
3321
- ), be = ze(async () => {
3321
+ ), ve = ze(async () => {
3322
3322
  if (!k.current) throw new Error("No active thread");
3323
3323
  await Z(k.current, void 0, void 0, !0);
3324
3324
  }, [Z]), Ie = ze(
@@ -3356,10 +3356,10 @@ function ox({
3356
3356
  var Ln;
3357
3357
  const Ee = k.current;
3358
3358
  !Ee && !(le != null && le.payloadExtras) && console.warn("[ChatSessionProvider] No thread ID - message will create new thread");
3359
- const We = (le == null ? void 0 : le.attachments) || [], { contentParts: Ve, filesInfo: kt } = await Bg(
3359
+ const We = (le == null ? void 0 : le.attachments) || [], { contentParts: qe, filesInfo: kt } = await Bg(
3360
3360
  l,
3361
3361
  We
3362
- ), Sn = [...Ve];
3362
+ ), Sn = [...qe];
3363
3363
  G && G.trim() && Sn.push({ type: "text", text: G.trim() });
3364
3364
  const qt = {
3365
3365
  id: ((Ln = crypto.randomUUID) == null ? void 0 : Ln.call(crypto)) || `user-${Date.now()}`,
@@ -3414,10 +3414,10 @@ function ox({
3414
3414
  if (!We)
3415
3415
  throw new Error("No active thread to handle interrupt");
3416
3416
  try {
3417
- const Ve = le ? Ee ?? !0 : !1;
3418
- await l.resume({ threadId: We, value: Ve });
3419
- } catch (Ve) {
3420
- throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${G}:`, Ve), Ve;
3417
+ const qe = le ? Ee ?? !0 : !1;
3418
+ await l.resume({ threadId: We, value: qe });
3419
+ } catch (qe) {
3420
+ throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${G}:`, qe), qe;
3421
3421
  }
3422
3422
  },
3423
3423
  [l]
@@ -3464,7 +3464,7 @@ function ox({
3464
3464
  clearCurrentThread: ae,
3465
3465
  listCheckpoints: pe,
3466
3466
  navigateToCheckpoint: Se,
3467
- returnToLatest: be
3467
+ returnToLatest: ve
3468
3468
  }),
3469
3469
  [
3470
3470
  ae,
@@ -3478,7 +3478,7 @@ function ox({
3478
3478
  Se,
3479
3479
  ue,
3480
3480
  at,
3481
- be,
3481
+ ve,
3482
3482
  f
3483
3483
  ]
3484
3484
  ), Et = pt(
@@ -3507,14 +3507,14 @@ function ox({
3507
3507
  ]
3508
3508
  ), yn = pt(
3509
3509
  () => ({
3510
- isStreaming: we,
3510
+ isStreaming: be,
3511
3511
  error: je,
3512
3512
  streamingAssistantId: D.assemblingId,
3513
3513
  lastCheckpointId: D.lastCheckpointId ?? null,
3514
3514
  lastCheckpointNs: D.lastCheckpointNs ?? null
3515
3515
  }),
3516
3516
  [
3517
- we,
3517
+ be,
3518
3518
  D.assemblingId,
3519
3519
  D.lastCheckpointId,
3520
3520
  D.lastCheckpointNs,
@@ -3749,7 +3749,7 @@ function fx(e, t) {
3749
3749
  function nt(...e) {
3750
3750
  return e;
3751
3751
  }
3752
- function qe(e, t) {
3752
+ function Ke(e, t) {
3753
3753
  return e(An, t);
3754
3754
  }
3755
3755
  function Ae(e, t) {
@@ -3762,7 +3762,7 @@ function ut(e) {
3762
3762
  return e(ru);
3763
3763
  }
3764
3764
  function ce(e, t) {
3765
- return qe(e, ux(t, cs));
3765
+ return Ke(e, ux(t, cs));
3766
3766
  }
3767
3767
  function Yt(e, t) {
3768
3768
  const n = e(An, (r) => {
@@ -3808,7 +3808,7 @@ function F(e, ...t) {
3808
3808
  Xi(e);
3809
3809
  return;
3810
3810
  case An:
3811
- return qe(e, n(o));
3811
+ return Ke(e, n(o));
3812
3812
  }
3813
3813
  };
3814
3814
  }
@@ -3836,7 +3836,7 @@ function _e(...e) {
3836
3836
  const o = Math.pow(2, e.length) - 1;
3837
3837
  return e.forEach((s, i) => {
3838
3838
  const a = Math.pow(2, i);
3839
- qe(s, (l) => {
3839
+ Ke(s, (l) => {
3840
3840
  const u = n;
3841
3841
  n = n | a, t[i] = l, u !== o && n === o && r && (r(), r = null);
3842
3842
  });
@@ -3856,7 +3856,7 @@ function px(e) {
3856
3856
  return function(o, s) {
3857
3857
  switch (o) {
3858
3858
  case An:
3859
- return s ? n === s ? void 0 : (r(), n = s, t = qe(e, s), t) : (r(), Sr);
3859
+ return s ? n === s ? void 0 : (r(), n = s, t = Ke(e, s), t) : (r(), Sr);
3860
3860
  case yr:
3861
3861
  r(), n = null;
3862
3862
  return;
@@ -3931,7 +3931,7 @@ function ht(...e) {
3931
3931
  const o = Math.pow(2, e.length) - 1;
3932
3932
  return e.forEach((s, i) => {
3933
3933
  const a = Math.pow(2, i);
3934
- qe(s, (l) => {
3934
+ Ke(s, (l) => {
3935
3935
  n[i] = l, r = r | a, r === o && Ae(t, n);
3936
3936
  });
3937
3937
  }), function(s, i) {
@@ -3941,11 +3941,11 @@ function ht(...e) {
3941
3941
  return;
3942
3942
  }
3943
3943
  case An:
3944
- return r === o && i(n), qe(t, i);
3944
+ return r === o && i(n), Ke(t, i);
3945
3945
  }
3946
3946
  };
3947
3947
  }
3948
- function ve(e, t = su) {
3948
+ function we(e, t = su) {
3949
3949
  return F(e, tt(t));
3950
3950
  }
3951
3951
  function bi(...e) {
@@ -3954,7 +3954,7 @@ function bi(...e) {
3954
3954
  case yr:
3955
3955
  return;
3956
3956
  case An:
3957
- return dx(...e.map((r) => qe(r, n)));
3957
+ return dx(...e.map((r) => Ke(r, n)));
3958
3958
  }
3959
3959
  };
3960
3960
  }
@@ -4516,7 +4516,7 @@ const _x = {
4516
4516
  te((S) => S.changed)
4517
4517
  )
4518
4518
  );
4519
- qe(
4519
+ Ke(
4520
4520
  F(
4521
4521
  a,
4522
4522
  sn(
@@ -4534,7 +4534,7 @@ const _x = {
4534
4534
  E.length > 0 && (S -= bl(-S, E)), Ae(i, S);
4535
4535
  }
4536
4536
  }
4537
- ), qe(F(a, _e(e)), ([S, C]) => {
4537
+ ), Ke(F(a, _e(e)), ([S, C]) => {
4538
4538
  S < 0 && C(
4539
4539
  "`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
4540
4540
  { firstItemIndex: a },
@@ -4721,7 +4721,7 @@ const gu = He(
4721
4721
  tt()
4722
4722
  )
4723
4723
  );
4724
- return qe(t, (r) => {
4724
+ return Ke(t, (r) => {
4725
4725
  r && ut(e)("props updated", {}, jt.DEBUG);
4726
4726
  }), { didMount: n, propsReady: t };
4727
4727
  },
@@ -4772,7 +4772,7 @@ const to = He(
4772
4772
  };
4773
4773
  if (y(), q === "smooth") {
4774
4774
  let oe = !1;
4775
- b = qe(t, (fe) => {
4775
+ b = Ke(t, (fe) => {
4776
4776
  oe = oe || fe;
4777
4777
  }), g = Yt(d, () => {
4778
4778
  de(oe);
@@ -4833,7 +4833,7 @@ const no = He(
4833
4833
  rn(!1)
4834
4834
  ),
4835
4835
  u
4836
- ), qe(
4836
+ ), Ke(
4837
4837
  F(
4838
4838
  ht(t, i),
4839
4839
  _e(a, n, e, u),
@@ -4873,7 +4873,7 @@ const Wr = "up", Or = "down", Dx = "none", Lx = {
4873
4873
  }, Fx = 0, ro = He(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
4874
4874
  const i = K(!1), a = K(!0), l = De(), u = De(), d = K(4), f = K(Fx), h = St(
4875
4875
  F(
4876
- bi(F(ve(o), qn(1), rn(!0)), F(ve(o), qn(1), rn(!1), xl(100))),
4876
+ bi(F(we(o), qn(1), rn(!0)), F(we(o), qn(1), rn(!1), xl(100))),
4877
4877
  tt()
4878
4878
  ),
4879
4879
  !1
@@ -4883,7 +4883,7 @@ const Wr = "up", Or = "down", Dx = "none", Lx = {
4883
4883
  );
4884
4884
  ce(
4885
4885
  F(
4886
- ht(ve(o), ve(f)),
4886
+ ht(we(o), we(f)),
4887
4887
  te(([b, y]) => b <= y),
4888
4888
  tt()
4889
4889
  ),
@@ -4891,7 +4891,7 @@ const Wr = "up", Or = "down", Dx = "none", Lx = {
4891
4891
  ), ce(F(a, xn(50)), u);
4892
4892
  const w = Dt(
4893
4893
  F(
4894
- ht(r, ve(s), ve(t), ve(e), ve(d)),
4894
+ ht(r, we(s), we(t), we(e), we(d)),
4895
4895
  sn((b, [{ scrollHeight: y, scrollTop: R }, S, C, E, I]) => {
4896
4896
  const j = R + S - y > -I, N = {
4897
4897
  scrollHeight: y,
@@ -5015,15 +5015,15 @@ const na = He(
5015
5015
  const s = De(), i = K(0), a = K(0), l = K(0), u = St(
5016
5016
  F(
5017
5017
  ht(
5018
- ve(r),
5019
- ve(o),
5020
- ve(n),
5021
- ve(s, Hr),
5022
- ve(l),
5023
- ve(i),
5024
- ve(t),
5025
- ve(e),
5026
- ve(a)
5018
+ we(r),
5019
+ we(o),
5020
+ we(n),
5021
+ we(s, Hr),
5022
+ we(l),
5023
+ we(i),
5024
+ we(t),
5025
+ we(e),
5026
+ we(a)
5027
5027
  ),
5028
5028
  te(
5029
5029
  ([
@@ -5166,14 +5166,14 @@ const er = He(
5166
5166
  ht(
5167
5167
  p,
5168
5168
  w,
5169
- ve(l, Hr),
5170
- ve(o),
5171
- ve(r),
5172
- ve(u),
5169
+ we(l, Hr),
5170
+ we(o),
5171
+ we(r),
5172
+ we(u),
5173
5173
  d,
5174
- ve(v),
5175
- ve(t),
5176
- ve(n),
5174
+ we(v),
5175
+ we(t),
5176
+ we(n),
5177
5177
  e
5178
5178
  ),
5179
5179
  ye(([C, E, , I, , , , , , , j]) => {
@@ -5332,7 +5332,7 @@ const er = He(
5332
5332
  ),
5333
5333
  0
5334
5334
  );
5335
- return ce(ve(i), s), { totalListHeight: i, totalListHeightChanged: s };
5335
+ return ce(we(i), s), { totalListHeight: i, totalListHeightChanged: s };
5336
5336
  },
5337
5337
  nt(Tt, er),
5338
5338
  { singleton: !0 }
@@ -5425,10 +5425,10 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5425
5425
  index: "LAST"
5426
5426
  });
5427
5427
  }
5428
- qe(
5428
+ Ke(
5429
5429
  F(
5430
- ht(F(ve(t), qn(1)), l),
5431
- _e(ve(w), s, a, f),
5430
+ ht(F(we(t), qn(1)), l),
5431
+ _e(we(w), s, a, f),
5432
5432
  te(([[S, C], E, I, j, N]) => {
5433
5433
  let O = C && j, M = "auto";
5434
5434
  return O && (M = Hx(E, I || N), O = O && !!M), { followOutputBehavior: M, shouldFollow: O, totalCount: S };
@@ -5449,9 +5449,9 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5449
5449
  });
5450
5450
  setTimeout(C, 100);
5451
5451
  }
5452
- qe(
5452
+ Ke(
5453
5453
  F(
5454
- ht(ve(w), t, u),
5454
+ ht(we(w), t, u),
5455
5455
  ye(([S, , C]) => S && C),
5456
5456
  sn(
5457
5457
  ({ value: S }, [, C]) => ({ refreshed: S === C, value: C }),
@@ -5463,28 +5463,28 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5463
5463
  ([, S]) => {
5464
5464
  ut(a) && b(S !== !1);
5465
5465
  }
5466
- ), qe(v, () => {
5466
+ ), Ke(v, () => {
5467
5467
  b(ut(w) !== !1);
5468
- }), qe(ht(ve(w), o), ([S, C]) => {
5468
+ }), Ke(ht(we(w), o), ([S, C]) => {
5469
5469
  S && !C.atBottom && C.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && x("auto");
5470
5470
  });
5471
5471
  const y = K(null), R = De();
5472
5472
  return ce(
5473
5473
  bi(
5474
5474
  F(
5475
- ve(r),
5475
+ we(r),
5476
5476
  te((S) => {
5477
5477
  var C;
5478
5478
  return (C = S == null ? void 0 : S.length) != null ? C : 0;
5479
5479
  })
5480
5480
  ),
5481
- F(ve(t))
5481
+ F(we(t))
5482
5482
  ),
5483
5483
  R
5484
- ), qe(
5484
+ ), Ke(
5485
5485
  F(
5486
5486
  ht(F(R, qn(1)), l),
5487
- _e(ve(y), a, f, h),
5487
+ _e(we(y), a, f, h),
5488
5488
  te(([[S, C], E, I, j, N]) => C && I && (E == null ? void 0 : E({ context: N, totalCount: S, scrollingInProgress: j }))),
5489
5489
  ye((S) => !!S),
5490
5490
  xn(0)
@@ -5525,7 +5525,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5525
5525
  ), Vx = He(
5526
5526
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
5527
5527
  const r = K(0);
5528
- return qe(
5528
+ return Ke(
5529
5529
  F(
5530
5530
  e,
5531
5531
  _e(r),
@@ -5572,7 +5572,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5572
5572
  tt()
5573
5573
  ),
5574
5574
  t
5575
- ), qe(
5575
+ ), Ke(
5576
5576
  F(ht(t, e, n), _e(r)),
5577
5577
  ([[o, s, i], a]) => {
5578
5578
  o && a && a.change && a.change(s, i);
@@ -5622,7 +5622,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5622
5622
  { useWindowScroll: i, windowScrollContainerState: a, windowViewportRect: l }
5623
5623
  ]) => {
5624
5624
  const u = De(), d = K(void 0), f = K(null), h = K(null);
5625
- return ce(a, f), ce(l, h), qe(
5625
+ return ce(a, f), ce(l, h), Ke(
5626
5626
  F(
5627
5627
  u,
5628
5628
  _e(t, r, i, f, h, n)
@@ -5695,9 +5695,9 @@ const Yx = Tu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5695
5695
  function g(x) {
5696
5696
  x > 0 ? (Ae(t, { behavior: "auto", top: -x }), Ae(e, 0)) : (Ae(e, 0), Ae(t, { behavior: "auto", top: -x }));
5697
5697
  }
5698
- return qe(F(v, _e(e, s)), ([x, b, y]) => {
5698
+ return Ke(F(v, _e(e, s)), ([x, b, y]) => {
5699
5699
  y && Yx() ? Ae(e, b - x) : g(-x);
5700
- }), qe(
5700
+ }), Ke(
5701
5701
  F(
5702
5702
  ht(St(s, !1), e, w),
5703
5703
  ye(([x, b, y]) => !x && !y && b !== 0),
@@ -5711,7 +5711,7 @@ const Yx = Tu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5711
5711
  te((x) => ({ top: -x }))
5712
5712
  ),
5713
5713
  t
5714
- ), qe(
5714
+ ), Ke(
5715
5715
  F(
5716
5716
  u,
5717
5717
  _e(h, d),
@@ -5901,7 +5901,7 @@ function Eu(e, t, n) {
5901
5901
  })), [S] = $.useState(gl(d, R));
5902
5902
  fo(() => {
5903
5903
  for (const E of i)
5904
- E in y && qe(S[E], y[E]);
5904
+ E in y && Ke(S[E], y[E]);
5905
5905
  return () => {
5906
5906
  Object.values(S).map(Xi);
5907
5907
  };
@@ -5920,7 +5920,7 @@ function Eu(e, t, n) {
5920
5920
  );
5921
5921
  }, p = (g) => {
5922
5922
  const x = $.useContext(a)[g], b = $.useCallback(
5923
- (y) => qe(x, y),
5923
+ (y) => Ke(x, y),
5924
5924
  [x]
5925
5925
  );
5926
5926
  return $.useSyncExternalStore(
@@ -5931,7 +5931,7 @@ function Eu(e, t, n) {
5931
5931
  }, w = (g) => {
5932
5932
  const x = $.useContext(a)[g], [b, y] = $.useState(gl(ut, x));
5933
5933
  return fo(
5934
- () => qe(x, (R) => {
5934
+ () => Ke(x, (R) => {
5935
5935
  R !== b && y(ml(R));
5936
5936
  }),
5937
5937
  [x, b]
@@ -5941,7 +5941,7 @@ function Eu(e, t, n) {
5941
5941
  Component: f,
5942
5942
  useEmitter: (g, x) => {
5943
5943
  const b = $.useContext(a)[g];
5944
- fo(() => qe(b, x), [x, b]);
5944
+ fo(() => Ke(b, x), [x, b]);
5945
5945
  },
5946
5946
  useEmitterValue: v,
5947
5947
  usePublisher: h
@@ -6402,7 +6402,7 @@ const Cv = /* @__PURE__ */ He(
6402
6402
  S
6403
6403
  ]) => {
6404
6404
  const C = K(0), E = K(0), I = K(Il), j = K({ height: 0, width: 0 }), N = K({ height: 0, width: 0 }), O = De(), M = De(), D = K(0), _ = K(null), W = K({ column: 0, row: 0 }), H = De(), q = De(), L = K(!1), k = K(0), U = K(!0), Y = K(!1), de = K(!1);
6405
- qe(
6405
+ Ke(
6406
6406
  F(
6407
6407
  w,
6408
6408
  _e(k),
@@ -6411,7 +6411,7 @@ const Cv = /* @__PURE__ */ He(
6411
6411
  () => {
6412
6412
  Ae(U, !1);
6413
6413
  }
6414
- ), qe(
6414
+ ), Ke(
6415
6415
  F(
6416
6416
  ht(w, U, N, j, k, Y),
6417
6417
  ye(([P, V, X, se, , ne]) => P && !V && X.height !== 0 && se.height !== 0 && !ne)
@@ -6430,7 +6430,7 @@ const Cv = /* @__PURE__ */ He(
6430
6430
  rn(0)
6431
6431
  ),
6432
6432
  E
6433
- ), qe(
6433
+ ), Ke(
6434
6434
  F(
6435
6435
  w,
6436
6436
  _e(q),
@@ -6450,10 +6450,10 @@ const Cv = /* @__PURE__ */ He(
6450
6450
  ), ce(
6451
6451
  F(
6452
6452
  ht(
6453
- ve(j, ho),
6454
- ve(N, ho),
6455
- ve(W, (P, V) => P && P.column === V.column && P.row === V.row),
6456
- ve(u)
6453
+ we(j, ho),
6454
+ we(N, ho),
6455
+ we(W, (P, V) => P && P.column === V.column && P.row === V.row),
6456
+ we(u)
6457
6457
  ),
6458
6458
  te(([P, V, X, se]) => ({
6459
6459
  gap: X,
@@ -6466,16 +6466,16 @@ const Cv = /* @__PURE__ */ He(
6466
6466
  ), ce(
6467
6467
  F(
6468
6468
  ht(
6469
- ve(C),
6469
+ we(C),
6470
6470
  r,
6471
- ve(W, Sv),
6472
- ve(N, ho),
6473
- ve(j, ho),
6474
- ve(_),
6475
- ve(E),
6476
- ve(L),
6477
- ve(U),
6478
- ve(k)
6471
+ we(W, Sv),
6472
+ we(N, ho),
6473
+ we(j, ho),
6474
+ we(_),
6475
+ we(E),
6476
+ we(L),
6477
+ we(U),
6478
+ we(k)
6479
6479
  ),
6480
6480
  ye(([, , , , , , , P]) => !P),
6481
6481
  te(
@@ -6488,7 +6488,7 @@ const Cv = /* @__PURE__ */ He(
6488
6488
  Ge,
6489
6489
  et,
6490
6490
  ,
6491
- we,
6491
+ be,
6492
6492
  je
6493
6493
  ]) => {
6494
6494
  const { column: Ye, row: Fe } = se, { height: st, width: at } = ne, { width: Z } = Le;
@@ -6500,9 +6500,9 @@ const Cv = /* @__PURE__ */ He(
6500
6500
  }
6501
6501
  const ae = Ou(Z, at, Ye);
6502
6502
  let pe, Se;
6503
- we ? V === 0 && X === 0 && et > 0 ? (pe = 0, Se = et - 1) : (pe = ae * Bo((V + Fe) / (st + Fe)), Se = ae * Nl((X + Fe) / (st + Fe)) - 1, Se = Xs(P - 1, Mr(Se, ae - 1)), pe = Xs(Se, Mr(0, pe))) : (pe = 0, Se = -1);
6504
- const be = jl(pe, Se, Ge), { bottom: Ie, top: Xe } = _l(Le, se, ne, be), Ue = Nl(P / ae), lt = Ue * st + (Ue - 1) * Fe - Ie;
6505
- return { bottom: Ie, itemHeight: st, items: be, itemWidth: at, offsetBottom: lt, offsetTop: Xe, top: Xe };
6503
+ be ? V === 0 && X === 0 && et > 0 ? (pe = 0, Se = et - 1) : (pe = ae * Bo((V + Fe) / (st + Fe)), Se = ae * Nl((X + Fe) / (st + Fe)) - 1, Se = Xs(P - 1, Mr(Se, ae - 1)), pe = Xs(Se, Mr(0, pe))) : (pe = 0, Se = -1);
6504
+ const ve = jl(pe, Se, Ge), { bottom: Ie, top: Xe } = _l(Le, se, ne, ve), Ue = Nl(P / ae), lt = Ue * st + (Ue - 1) * Fe - Ie;
6505
+ return { bottom: Ie, itemHeight: st, items: ve, itemWidth: at, offsetBottom: lt, offsetTop: Xe, top: Xe };
6506
6506
  }
6507
6507
  )
6508
6508
  ),
@@ -6549,14 +6549,14 @@ const Cv = /* @__PURE__ */ He(
6549
6549
  )
6550
6550
  ), Re = Dt(
6551
6551
  F(
6552
- ve(I),
6552
+ we(I),
6553
6553
  ye(({ items: P }) => P.length > 0 && P[0].index === 0),
6554
6554
  rn(0),
6555
6555
  tt()
6556
6556
  )
6557
6557
  ), ue = Dt(
6558
6558
  F(
6559
- ve(I),
6559
+ we(I),
6560
6560
  _e(L),
6561
6561
  ye(([{ items: P }, V]) => P.length > 0 && !V),
6562
6562
  te(([{ items: P }]) => ({
@@ -6572,11 +6572,11 @@ const Cv = /* @__PURE__ */ He(
6572
6572
  O,
6573
6573
  _e(j, N, C, W),
6574
6574
  te(([P, V, X, se, ne]) => {
6575
- const Le = xu(P), { align: Ge, behavior: et, offset: we } = Le;
6575
+ const Le = xu(P), { align: Ge, behavior: et, offset: be } = Le;
6576
6576
  let je = Le.index;
6577
6577
  je === "LAST" && (je = se - 1), je = Mr(0, je, Xs(se - 1, je));
6578
6578
  let Ye = Ri(V, ne, X, je);
6579
- return Ge === "end" ? Ye = Al(Ye - V.height + X.height) : Ge === "center" && (Ye = Al(Ye - V.height / 2 + X.height / 2)), we && (Ye += we), { behavior: et, top: Ye };
6579
+ return Ge === "end" ? Ye = Al(Ye - V.height + X.height) : Ge === "center" && (Ye = Al(Ye - V.height / 2 + X.height / 2)), be && (Ye += be), { behavior: et, top: Ye };
6580
6580
  })
6581
6581
  ),
6582
6582
  l
@@ -6661,7 +6661,7 @@ const Tv = /* @__PURE__ */ He(() => {
6661
6661
  ),
6662
6662
  h
6663
6663
  ), u = K(!1), d = K(!1);
6664
- return ce(ve(d), u), {
6664
+ return ce(we(d), u), {
6665
6665
  components: t,
6666
6666
  computeItemKey: s,
6667
6667
  context: n,
@@ -10390,13 +10390,13 @@ const Ub = $.memo(function({
10390
10390
  const P = pt(() => z.length <= $n ? z : `${z.slice(0, $n)}
10391
10391
  … [truncated ${z.length - $n} chars]`, [z]), V = $.useCallback(async (Z = "all") => {
10392
10392
  const pe = Z === "visible" && k ? P : k ? z : de;
10393
- async function Se(be) {
10393
+ async function Se(ve) {
10394
10394
  try {
10395
- await navigator.clipboard.writeText(be);
10395
+ await navigator.clipboard.writeText(ve);
10396
10396
  } catch {
10397
10397
  try {
10398
10398
  const Ie = document.createElement("textarea");
10399
- Ie.value = be, Ie.setAttribute("readonly", ""), Ie.style.position = "absolute", Ie.style.left = "-9999px", document.body.appendChild(Ie), Ie.select(), document.execCommand("copy"), document.body.removeChild(Ie);
10399
+ Ie.value = ve, Ie.setAttribute("readonly", ""), Ie.style.position = "absolute", Ie.style.left = "-9999px", document.body.appendChild(Ie), Ie.select(), document.execCommand("copy"), document.body.removeChild(Ie);
10400
10400
  } catch (Ie) {
10401
10401
  throw console.error("Failed to copy:", Ie), Ie;
10402
10402
  }
@@ -10404,8 +10404,8 @@ const Ub = $.memo(function({
10404
10404
  }
10405
10405
  try {
10406
10406
  await Se(pe), y(!0), setTimeout(() => y(!1), 2e3), x == null || x(pe);
10407
- } catch (be) {
10408
- console.error("Failed to copy:", be);
10407
+ } catch (ve) {
10408
+ console.error("Failed to copy:", ve);
10409
10409
  }
10410
10410
  }, [k, z, de, P, x]), X = $.useCallback(() => {
10411
10411
  if (!w) return;
@@ -10423,10 +10423,10 @@ const Ub = $.memo(function({
10423
10423
  return;
10424
10424
  }
10425
10425
  try {
10426
- const Se = String(ae.url ?? ""), be = Se.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
10427
- if (be) {
10426
+ const Se = String(ae.url ?? ""), ve = Se.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
10427
+ if (ve) {
10428
10428
  Z.preventDefault();
10429
- const Ie = be[1], Xe = ae.name || `file_${Ie}`, Ue = ae.mimeType || "application/octet-stream";
10429
+ const Ie = ve[1], Xe = ae.name || `file_${Ie}`, Ue = ae.mimeType || "application/octet-stream";
10430
10430
  H({ id: Ie, name: Xe, mimeType: Ue }), _(!0);
10431
10431
  return;
10432
10432
  }
@@ -10460,7 +10460,7 @@ const Ub = $.memo(function({
10460
10460
  }
10461
10461
  }
10462
10462
  } catch (Se) {
10463
- console.error("File click error:", Se), M((be) => ({ ...be, [pe]: !1 }));
10463
+ console.error("File click error:", Se), M((ve) => ({ ...ve, [pe]: !1 }));
10464
10464
  }
10465
10465
  }, [U, O, N, I]), Le = $.useCallback(() => {
10466
10466
  const ae = J(q ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", Y);
@@ -10518,7 +10518,7 @@ const Ub = $.memo(function({
10518
10518
  "border border-border/60 dark:border-border/40"
10519
10519
  );
10520
10520
  }
10521
- }, [q, L]), we = $.useCallback(async (Z) => {
10521
+ }, [q, L]), be = $.useCallback(async (Z) => {
10522
10522
  try {
10523
10523
  const ae = Z.id || `interrupt-${Date.now()}`;
10524
10524
  await j(ae, !0);
@@ -10534,8 +10534,8 @@ const Ub = $.memo(function({
10534
10534
  }
10535
10535
  }, [j]), Ye = $.useCallback(({ part: Z, i: ae }) => {
10536
10536
  if (Z.type === "text") {
10537
- const pe = Z.text ?? "", Se = pe.trim(), be = oc(Se);
10538
- return be && L !== "tool" ? /* @__PURE__ */ c.jsx(Wb, { data: be }, ae) : L === "user" && f && Se.length > h ? /* @__PURE__ */ c.jsxs(Ml, { open: C, onOpenChange: E, children: [
10537
+ const pe = Z.text ?? "", Se = pe.trim(), ve = oc(Se);
10538
+ return ve && L !== "tool" ? /* @__PURE__ */ c.jsx(Wb, { data: ve }, ae) : L === "user" && f && Se.length > h ? /* @__PURE__ */ c.jsxs(Ml, { open: C, onOpenChange: E, children: [
10539
10539
  /* @__PURE__ */ c.jsx("div", { className: J("text-sm text-[hsl(var(--chat-bubble-user-text))]", q && "text-xs"), children: C ? /* @__PURE__ */ c.jsx(Ul, { content: Se, allowHtml: !1 }) : /* @__PURE__ */ c.jsxs("pre", { className: J("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]", q && "text-xs"), children: [
10540
10540
  Se.substring(0, h),
10541
10541
  "..."
@@ -10577,7 +10577,7 @@ const Ub = $.memo(function({
10577
10577
  "a",
10578
10578
  {
10579
10579
  href: pe.url,
10580
- onClick: (be) => ne(be, pe, ae),
10580
+ onClick: (ve) => ne(ve, pe, ae),
10581
10581
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
10582
10582
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
10583
10583
  children: [
@@ -10595,7 +10595,7 @@ const Ub = $.memo(function({
10595
10595
  Kb,
10596
10596
  {
10597
10597
  interruptPart: Z,
10598
- onApprove: we,
10598
+ onApprove: be,
10599
10599
  onReject: je
10600
10600
  },
10601
10601
  ae
@@ -10603,7 +10603,7 @@ const Ub = $.memo(function({
10603
10603
  }, [
10604
10604
  ne,
10605
10605
  O,
10606
- we,
10606
+ be,
10607
10607
  je,
10608
10608
  L,
10609
10609
  f,
@@ -10623,15 +10623,15 @@ const Ub = $.memo(function({
10623
10623
  return /* @__PURE__ */ c.jsx(qb, { data: pe });
10624
10624
  }
10625
10625
  if (k && oe.name === "get_issues") {
10626
- const ae = t.content.find((be) => be.type === "tool_end"), pe = (ae == null ? void 0 : ae.output) ?? z, Se = jd(pe);
10626
+ const ae = t.content.find((ve) => ve.type === "tool_end"), pe = (ae == null ? void 0 : ae.output) ?? z, Se = jd(pe);
10627
10627
  if (Se) return /* @__PURE__ */ c.jsx(Gb, { issues: Se });
10628
10628
  }
10629
10629
  if (k) {
10630
10630
  const ae = Fb(t.content);
10631
10631
  if (ae.length > 0)
10632
10632
  return /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: ae.map((pe, Se) => {
10633
- const be = typeof pe.output == "string" ? pe.output : Ni(pe.output), Ie = be.length > $n ? `${be.slice(0, $n)}
10634
- … [truncated ${be.length - $n} chars]` : be, Xe = R === "expanded";
10633
+ const ve = typeof pe.output == "string" ? pe.output : Ni(pe.output), Ie = ve.length > $n ? `${ve.slice(0, $n)}
10634
+ … [truncated ${ve.length - $n} chars]` : ve, Xe = R === "expanded";
10635
10635
  return /* @__PURE__ */ c.jsxs(Ml, { open: Xe, onOpenChange: (Ue) => S(Ue ? "expanded" : "preview"), children: [
10636
10636
  /* @__PURE__ */ c.jsx("div", { className: "flex items-center gap-2 text-xs", children: /* @__PURE__ */ c.jsx(Ei, { variant: "outline", children: (pe.name ?? "tool") + (pe.toolCallId ? ` • ${pe.toolCallId.slice(0, 8)}` : "") }) }),
10637
10637
  /* @__PURE__ */ c.jsx("div", { className: "font-mono text-sm mt-1", children: /* @__PURE__ */ c.jsx("pre", { className: "whitespace-pre-wrap break-words", children: Xe ? Ie : Ie.slice(0, d) + (Ie.length > d ? "..." : "") }) }),
@@ -12574,9 +12574,9 @@ var Ia = "PopperContent", [f0, h0] = Kd(Ia), Jd = m.forwardRef(
12574
12574
  l && s0({ ...D }),
12575
12575
  i0({
12576
12576
  ...D,
12577
- apply: ({ elements: Le, rects: Ge, availableWidth: et, availableHeight: we }) => {
12577
+ apply: ({ elements: Le, rects: Ge, availableWidth: et, availableHeight: be }) => {
12578
12578
  const { width: je, height: Ye } = Ge.reference, Fe = Le.floating.style;
12579
- Fe.setProperty("--radix-popper-available-width", `${et}px`), Fe.setProperty("--radix-popper-available-height", `${we}px`), Fe.setProperty("--radix-popper-anchor-width", `${je}px`), Fe.setProperty("--radix-popper-anchor-height", `${Ye}px`);
12579
+ Fe.setProperty("--radix-popper-available-width", `${et}px`), Fe.setProperty("--radix-popper-available-height", `${be}px`), Fe.setProperty("--radix-popper-anchor-width", `${je}px`), Fe.setProperty("--radix-popper-anchor-height", `${Ye}px`);
12580
12580
  }
12581
12581
  }),
12582
12582
  R && l0({ element: R, padding: a }),
@@ -13770,8 +13770,8 @@ function ci({
13770
13770
  streamingAssistantId: M,
13771
13771
  lastCheckpointId: D,
13772
13772
  lastCheckpointNs: _
13773
- } = sx(), [W, H] = me(null), [q, L] = me(""), [k, U] = me(null), [Y, de] = me([]), [oe, fe] = me(0), [Re, ue] = me(0), [z, P] = me(!1), [V, X] = me(null), [se, ne] = me(null), [Le, Ge] = me(!1), [et, we] = me(null), [je, Ye] = me([]), [Fe, st] = me(null), [at, Z] = me(null), [ae, pe] = me(!1), Se = it(null), be = it(null), Ie = it(null), Xe = ze(() => {
13774
- Se.current && (Se.current.value = ""), be.current && (be.current.value = ""), fe((ee) => ee + 1), ue((ee) => ee + 1);
13773
+ } = sx(), [W, H] = me(null), [q, L] = me(""), [k, U] = me(null), [Y, de] = me([]), [oe, fe] = me(0), [Re, ue] = me(0), [z, P] = me(!1), [V, X] = me(null), [se, ne] = me(null), [Le, Ge] = me(!1), [et, be] = me(null), [je, Ye] = me([]), [Fe, st] = me(null), [at, Z] = me(null), [ae, pe] = me(!1), Se = it(null), ve = it(null), Ie = it(null), Xe = ze(() => {
13774
+ Se.current && (Se.current.value = ""), ve.current && (ve.current.value = ""), fe((ee) => ee + 1), ue((ee) => ee + 1);
13775
13775
  }, []), Ue = it(!1);
13776
13776
  gt(() => {
13777
13777
  Ue.current && !N && (de([]), Xe()), Ue.current = N;
@@ -13826,14 +13826,14 @@ function ci({
13826
13826
  gt(() => {
13827
13827
  (async () => {
13828
13828
  if (!w.baseUrl) {
13829
- we(null);
13829
+ be(null);
13830
13830
  return;
13831
13831
  }
13832
13832
  try {
13833
13833
  const he = await w.getAgent("default");
13834
- we(he.uiDefaultMessage || null);
13834
+ be(he.uiDefaultMessage || null);
13835
13835
  } catch (he) {
13836
- console.warn("Failed to fetch default message:", he), we(null);
13836
+ console.warn("Failed to fetch default message:", he), be(null);
13837
13837
  }
13838
13838
  })();
13839
13839
  }, [w]), gt(() => {
@@ -13873,7 +13873,7 @@ function ci({
13873
13873
  u && (H(ee), L(he), U(null));
13874
13874
  }, [u]), We = $.useCallback(() => {
13875
13875
  H(null), L(""), U(null);
13876
- }, []), Ve = ze((ee, he) => {
13876
+ }, []), qe = ze((ee, he) => {
13877
13877
  Ee(ee, he);
13878
13878
  }, [Ee]), kt = ze((ee) => {
13879
13879
  const he = (Me) => {
@@ -13998,7 +13998,7 @@ function ci({
13998
13998
  onStartReached: () => {
13999
13999
  yn();
14000
14000
  },
14001
- onEdit: Ve,
14001
+ onEdit: qe,
14002
14002
  onRegenerate: kt,
14003
14003
  onCancelEdit: We,
14004
14004
  emptyMessage: et ?? void 0,
@@ -14062,7 +14062,7 @@ function ci({
14062
14062
  /* @__PURE__ */ c.jsx(
14063
14063
  "input",
14064
14064
  {
14065
- ref: be,
14065
+ ref: ve,
14066
14066
  type: "file",
14067
14067
  accept: ".xls,.xlsx,.xlsm",
14068
14068
  onChange: Mn,
@@ -14106,7 +14106,7 @@ function ci({
14106
14106
  {
14107
14107
  onClick: () => {
14108
14108
  var ee;
14109
- z || (ee = be.current) == null || ee.click();
14109
+ z || (ee = ve.current) == null || ee.click();
14110
14110
  },
14111
14111
  className: `cursor-pointer ${z ? "opacity-60 pointer-events-none" : ""}`,
14112
14112
  children: [
@@ -15476,20 +15476,20 @@ var NC = "SelectItemAlignedPosition", Vh = m.forwardRef((e, t) => {
15476
15476
  if (s.trigger && s.valueNode && a && u && v && g && x) {
15477
15477
  const E = s.trigger.getBoundingClientRect(), I = u.getBoundingClientRect(), j = s.valueNode.getBoundingClientRect(), N = x.getBoundingClientRect();
15478
15478
  if (s.dir !== "rtl") {
15479
- const se = N.left - I.left, ne = j.left - se, Le = E.left - ne, Ge = E.width + Le, et = Math.max(Ge, I.width), we = window.innerWidth - Gt, je = Di(ne, [
15479
+ const se = N.left - I.left, ne = j.left - se, Le = E.left - ne, Ge = E.width + Le, et = Math.max(Ge, I.width), be = window.innerWidth - Gt, je = Di(ne, [
15480
15480
  Gt,
15481
15481
  // Prevents the content from going off the starting edge of the
15482
15482
  // viewport. It may still go off the ending edge, but this can be
15483
15483
  // controlled by the user since they may want to manage overflow in a
15484
15484
  // specific way.
15485
15485
  // https://github.com/radix-ui/primitives/issues/2049
15486
- Math.max(Gt, we - et)
15486
+ Math.max(Gt, be - et)
15487
15487
  ]);
15488
15488
  a.style.minWidth = Ge + "px", a.style.left = je + "px";
15489
15489
  } else {
15490
- const se = I.right - N.right, ne = window.innerWidth - j.right - se, Le = window.innerWidth - E.right - ne, Ge = E.width + Le, et = Math.max(Ge, I.width), we = window.innerWidth - Gt, je = Di(ne, [
15490
+ const se = I.right - N.right, ne = window.innerWidth - j.right - se, Le = window.innerWidth - E.right - ne, Ge = E.width + Le, et = Math.max(Ge, I.width), be = window.innerWidth - Gt, je = Di(ne, [
15491
15491
  Gt,
15492
- Math.max(Gt, we - et)
15492
+ Math.max(Gt, be - et)
15493
15493
  ]);
15494
15494
  a.style.minWidth = Ge + "px", a.style.right = je + "px";
15495
15495
  }