teodor-new-chat-ui 4.3.746 → 4.3.747

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
@@ -94,14 +94,14 @@ function zh() {
94
94
  var w = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
95
95
  function y(R) {
96
96
  {
97
- for (var q = arguments.length, Q = new Array(q > 1 ? q - 1 : 0), M = 1; M < q; M++)
98
- Q[M - 1] = arguments[M];
97
+ for (var q = arguments.length, Q = new Array(q > 1 ? q - 1 : 0), D = 1; D < q; D++)
98
+ Q[D - 1] = arguments[D];
99
99
  C("error", R, Q);
100
100
  }
101
101
  }
102
102
  function C(R, q, Q) {
103
103
  {
104
- var M = w.ReactDebugCurrentFrame, X = M.getStackAddendum();
104
+ var D = w.ReactDebugCurrentFrame, X = D.getStackAddendum();
105
105
  X !== "" && (q += "%s", Q = Q.concat([X]));
106
106
  var oe = Q.map(function(se) {
107
107
  return String(se);
@@ -118,17 +118,17 @@ function zh() {
118
118
  // with.
119
119
  R.$$typeof === N || R.getModuleId !== void 0));
120
120
  }
121
- function P(R, q, Q) {
122
- var M = R.displayName;
123
- if (M)
124
- return M;
121
+ function O(R, q, Q) {
122
+ var D = R.displayName;
123
+ if (D)
124
+ return D;
125
125
  var X = q.displayName || q.name || "";
126
126
  return X !== "" ? Q + "(" + X + ")" : Q;
127
127
  }
128
128
  function H(R) {
129
129
  return R.displayName || "Context";
130
130
  }
131
- function F(R) {
131
+ function $(R) {
132
132
  if (R == null)
133
133
  return null;
134
134
  if (typeof R.tag == "number" && y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof R == "function")
@@ -158,14 +158,14 @@ function zh() {
158
158
  var Q = R;
159
159
  return H(Q._context) + ".Provider";
160
160
  case c:
161
- return P(R, R.render, "ForwardRef");
161
+ return O(R, R.render, "ForwardRef");
162
162
  case f:
163
- var M = R.displayName || null;
164
- return M !== null ? M : F(R.type) || "Memo";
163
+ var D = R.displayName || null;
164
+ return D !== null ? D : $(R.type) || "Memo";
165
165
  case p: {
166
166
  var X = R, oe = X._payload, se = X._init;
167
167
  try {
168
- return F(se(oe));
168
+ return $(se(oe));
169
169
  } catch {
170
170
  return null;
171
171
  }
@@ -173,18 +173,18 @@ function zh() {
173
173
  }
174
174
  return null;
175
175
  }
176
- var I = Object.assign, Y = 0, G, te, B, W, ne, $, j;
177
- function D() {
176
+ var I = Object.assign, Y = 0, G, te, B, W, ne, F, j;
177
+ function P() {
178
178
  }
179
- D.__reactDisabledLog = !0;
179
+ P.__reactDisabledLog = !0;
180
180
  function _() {
181
181
  {
182
182
  if (Y === 0) {
183
- G = console.log, te = console.info, B = console.warn, W = console.error, ne = console.group, $ = console.groupCollapsed, j = console.groupEnd;
183
+ G = console.log, te = console.info, B = console.warn, W = console.error, ne = console.group, F = console.groupCollapsed, j = console.groupEnd;
184
184
  var R = {
185
185
  configurable: !0,
186
186
  enumerable: !0,
187
- value: D,
187
+ value: P,
188
188
  writable: !0
189
189
  };
190
190
  Object.defineProperties(console, {
@@ -225,7 +225,7 @@ function zh() {
225
225
  value: ne
226
226
  }),
227
227
  groupCollapsed: I({}, R, {
228
- value: $
228
+ value: F
229
229
  }),
230
230
  groupEnd: I({}, R, {
231
231
  value: j
@@ -236,14 +236,14 @@ function zh() {
236
236
  }
237
237
  }
238
238
  var U = w.ReactCurrentDispatcher, K;
239
- function O(R, q, Q) {
239
+ function M(R, q, Q) {
240
240
  {
241
241
  if (K === void 0)
242
242
  try {
243
243
  throw Error();
244
244
  } catch (X) {
245
- var M = X.stack.trim().match(/\n( *(at )?)/);
246
- K = M && M[1] || "";
245
+ var D = X.stack.trim().match(/\n( *(at )?)/);
246
+ K = D && D[1] || "";
247
247
  }
248
248
  return `
249
249
  ` + K + R;
@@ -262,7 +262,7 @@ function zh() {
262
262
  if (Q !== void 0)
263
263
  return Q;
264
264
  }
265
- var M;
265
+ var D;
266
266
  V = !0;
267
267
  var X = Error.prepareStackTrace;
268
268
  Error.prepareStackTrace = void 0;
@@ -281,14 +281,14 @@ function zh() {
281
281
  try {
282
282
  Reflect.construct(se, []);
283
283
  } catch (De) {
284
- M = De;
284
+ D = De;
285
285
  }
286
286
  Reflect.construct(R, [], se);
287
287
  } else {
288
288
  try {
289
289
  se.call();
290
290
  } catch (De) {
291
- M = De;
291
+ D = De;
292
292
  }
293
293
  R.call(se.prototype);
294
294
  }
@@ -296,14 +296,14 @@ function zh() {
296
296
  try {
297
297
  throw Error();
298
298
  } catch (De) {
299
- M = De;
299
+ D = De;
300
300
  }
301
301
  R();
302
302
  }
303
303
  } catch (De) {
304
- if (De && M && typeof De.stack == "string") {
304
+ if (De && D && typeof De.stack == "string") {
305
305
  for (var we = De.stack.split(`
306
- `), Ze = M.stack.split(`
306
+ `), Ze = D.stack.split(`
307
307
  `), Ue = we.length - 1, Ae = Ze.length - 1; Ue >= 1 && Ae >= 0 && we[Ue] !== Ze[Ae]; )
308
308
  Ae--;
309
309
  for (; Ue >= 1 && Ae >= 0; Ue--, Ae--)
@@ -322,7 +322,7 @@ function zh() {
322
322
  } finally {
323
323
  V = !1, U.current = oe, L(), Error.prepareStackTrace = X;
324
324
  }
325
- var Fe = R ? R.displayName || R.name : "", Pe = Fe ? O(Fe) : "";
325
+ var Fe = R ? R.displayName || R.name : "", Pe = Fe ? M(Fe) : "";
326
326
  return typeof R == "function" && re.set(R, Pe), Pe;
327
327
  }
328
328
  function ge(R, q, Q) {
@@ -338,12 +338,12 @@ function zh() {
338
338
  if (typeof R == "function")
339
339
  return he(R, Ne(R));
340
340
  if (typeof R == "string")
341
- return O(R);
341
+ return M(R);
342
342
  switch (R) {
343
343
  case l:
344
- return O("Suspense");
344
+ return M("Suspense");
345
345
  case u:
346
- return O("SuspenseList");
346
+ return M("SuspenseList");
347
347
  }
348
348
  if (typeof R == "object")
349
349
  switch (R.$$typeof) {
@@ -352,7 +352,7 @@ function zh() {
352
352
  case f:
353
353
  return ke(R.type, q, Q);
354
354
  case p: {
355
- var M = R, X = M._payload, oe = M._init;
355
+ var D = R, X = D._payload, oe = D._init;
356
356
  try {
357
357
  return ke(oe(X), q, Q);
358
358
  } catch {
@@ -369,7 +369,7 @@ function zh() {
369
369
  } else
370
370
  $e.setExtraStackFrame(null);
371
371
  }
372
- function ft(R, q, Q, M, X) {
372
+ function ft(R, q, Q, D, X) {
373
373
  {
374
374
  var oe = Function.call.bind(Ye);
375
375
  for (var se in R)
@@ -377,14 +377,14 @@ function zh() {
377
377
  var we = void 0;
378
378
  try {
379
379
  if (typeof R[se] != "function") {
380
- var Ze = Error((M || "React class") + ": " + Q + " type `" + se + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[se] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
380
+ var Ze = Error((D || "React class") + ": " + Q + " type `" + se + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[se] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
381
381
  throw Ze.name = "Invariant Violation", Ze;
382
382
  }
383
- we = R[se](q, se, M, Q, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
383
+ we = R[se](q, se, D, Q, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
384
384
  } catch (Ue) {
385
385
  we = Ue;
386
386
  }
387
- we && !(we instanceof Error) && (Ve(X), y("%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).", M || "React class", Q, se, typeof we), Ve(null)), we instanceof Error && !(we.message in tt) && (tt[we.message] = !0, Ve(X), y("Failed %s type: %s", Q, we.message), Ve(null));
387
+ we && !(we instanceof Error) && (Ve(X), y("%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).", D || "React class", Q, se, typeof we), Ve(null)), we instanceof Error && !(we.message in tt) && (tt[we.message] = !0, Ve(X), y("Failed %s type: %s", Q, we.message), Ve(null));
388
388
  }
389
389
  }
390
390
  }
@@ -459,7 +459,7 @@ function zh() {
459
459
  });
460
460
  }
461
461
  }
462
- var Bn = function(R, q, Q, M, X, oe, se) {
462
+ var Bn = function(R, q, Q, D, X, oe, se) {
463
463
  var we = {
464
464
  // This tag allows us to uniquely identify this as a React Element
465
465
  $$typeof: t,
@@ -480,7 +480,7 @@ function zh() {
480
480
  configurable: !1,
481
481
  enumerable: !1,
482
482
  writable: !1,
483
- value: M
483
+ value: D
484
484
  }), Object.defineProperty(we, "_source", {
485
485
  configurable: !1,
486
486
  enumerable: !1,
@@ -488,7 +488,7 @@ function zh() {
488
488
  value: X
489
489
  }), Object.freeze && (Object.freeze(we.props), Object.freeze(we)), we;
490
490
  };
491
- function Hn(R, q, Q, M, X) {
491
+ function Hn(R, q, Q, D, X) {
492
492
  {
493
493
  var oe, se = {}, we = null, Ze = null;
494
494
  Q !== void 0 && (Ct(Q), we = "" + Q), Ot(q) && (Ct(q.key), we = "" + q.key), Pt(q) && (Ze = q.ref, Mt(q, X));
@@ -503,7 +503,7 @@ function zh() {
503
503
  var Ae = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
504
504
  we && zn(se, Ae), Ze && _r(se, Ae);
505
505
  }
506
- return Bn(R, we, Ze, X, M, Xe.current, se);
506
+ return Bn(R, we, Ze, X, D, Xe.current, se);
507
507
  }
508
508
  }
509
509
  var Un = w.ReactCurrentOwner, nt = w.ReactDebugCurrentFrame;
@@ -522,7 +522,7 @@ function zh() {
522
522
  function Vt() {
523
523
  {
524
524
  if (Un.current) {
525
- var R = F(Un.current.type);
525
+ var R = $(Un.current.type);
526
526
  if (R)
527
527
  return `
528
528
 
@@ -556,8 +556,8 @@ Check the top-level render call using <` + Q + ">.");
556
556
  if (Cn[Q])
557
557
  return;
558
558
  Cn[Q] = !0;
559
- var M = "";
560
- R && R._owner && R._owner !== Un.current && (M = " It was passed a child from " + F(R._owner.type) + "."), Je(R), y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', Q, M), Je(null);
559
+ var D = "";
560
+ R && R._owner && R._owner !== Un.current && (D = " It was passed a child from " + $(R._owner.type) + "."), Je(R), y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', Q, D), Je(null);
561
561
  }
562
562
  }
563
563
  function Tn(R, q) {
@@ -566,8 +566,8 @@ Check the top-level render call using <` + Q + ">.");
566
566
  return;
567
567
  if (mt(R))
568
568
  for (var Q = 0; Q < R.length; Q++) {
569
- var M = R[Q];
570
- Wt(M) && Wn(M, q);
569
+ var D = R[Q];
570
+ Wt(D) && Wn(D, q);
571
571
  }
572
572
  else if (Wt(R))
573
573
  R._store && (R._store.validated = !0);
@@ -594,11 +594,11 @@ Check the top-level render call using <` + Q + ">.");
594
594
  else
595
595
  return;
596
596
  if (Q) {
597
- var M = F(q);
598
- ft(Q, R.props, "prop", M, R);
597
+ var D = $(q);
598
+ ft(Q, R.props, "prop", D, R);
599
599
  } else if (q.PropTypes !== void 0 && !rn) {
600
600
  rn = !0;
601
- var X = F(q);
601
+ var X = $(q);
602
602
  y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", X || "Unknown");
603
603
  }
604
604
  typeof q.getDefaultProps == "function" && !q.getDefaultProps.isReactClassApproved && y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
@@ -607,9 +607,9 @@ Check the top-level render call using <` + Q + ">.");
607
607
  function kn(R) {
608
608
  {
609
609
  for (var q = Object.keys(R.props), Q = 0; Q < q.length; Q++) {
610
- var M = q[Q];
611
- if (M !== "children" && M !== "key") {
612
- Je(R), y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", M), Je(null);
610
+ var D = q[Q];
611
+ if (D !== "children" && D !== "key") {
612
+ Je(R), y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", D), Je(null);
613
613
  break;
614
614
  }
615
615
  }
@@ -617,7 +617,7 @@ Check the top-level render call using <` + Q + ">.");
617
617
  }
618
618
  }
619
619
  var Tt = {};
620
- function En(R, q, Q, M, X, oe) {
620
+ function En(R, q, Q, D, X, oe) {
621
621
  {
622
622
  var se = A(R);
623
623
  if (!se) {
@@ -626,7 +626,7 @@ Check the top-level render call using <` + Q + ">.");
626
626
  var Ze = Sn();
627
627
  Ze ? we += Ze : we += Vt();
628
628
  var Ue;
629
- R === null ? Ue = "null" : mt(R) ? Ue = "array" : R !== void 0 && R.$$typeof === t ? (Ue = "<" + (F(R.type) || "Unknown") + " />", we = " Did you accidentally export a JSX literal instead of a component?") : Ue = typeof R, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Ue, we);
629
+ R === null ? Ue = "null" : mt(R) ? Ue = "array" : R !== void 0 && R.$$typeof === t ? (Ue = "<" + ($(R.type) || "Unknown") + " />", we = " Did you accidentally export a JSX literal instead of a component?") : Ue = typeof R, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Ue, we);
630
630
  }
631
631
  var Ae = Hn(R, q, Q, X, oe);
632
632
  if (Ae == null)
@@ -634,7 +634,7 @@ Check the top-level render call using <` + Q + ">.");
634
634
  if (se) {
635
635
  var xe = q.children;
636
636
  if (xe !== void 0)
637
- if (M)
637
+ if (D)
638
638
  if (mt(xe)) {
639
639
  for (var Fe = 0; Fe < xe.length; Fe++)
640
640
  Tn(xe[Fe], R);
@@ -645,7 +645,7 @@ Check the top-level render call using <` + Q + ">.");
645
645
  Tn(xe, R);
646
646
  }
647
647
  if (Ye.call(q, "key")) {
648
- var Pe = F(R), De = Object.keys(q).filter(function(Kn) {
648
+ var Pe = $(R), De = Object.keys(q).filter(function(Kn) {
649
649
  return Kn !== "key";
650
650
  }), xt = De.length > 0 ? "{key: someKey, " + De.join(": ..., ") + ": ...}" : "{key: someKey}";
651
651
  if (!Tt[Pe + xt]) {
@@ -2279,26 +2279,26 @@ const Qc = (e) => {
2279
2279
  headers: E,
2280
2280
  withCredentials: N = "same-origin",
2281
2281
  fetchOptions: A
2282
- } = Qc(m), P = t || fetch;
2282
+ } = Qc(m), O = t || fetch;
2283
2283
  T = T ? (T + "").toLowerCase() : "text";
2284
- let H = yg([y, C && C.toAbortSignal()], k), F = null;
2284
+ let H = yg([y, C && C.toAbortSignal()], k), $ = null;
2285
2285
  const I = H && H.unsubscribe && (() => {
2286
2286
  H.unsubscribe();
2287
2287
  });
2288
2288
  let Y;
2289
2289
  try {
2290
2290
  if (S && l && g !== "get" && g !== "head" && (Y = await h(E, w)) !== 0) {
2291
- let $ = new n(v, {
2291
+ let F = new n(v, {
2292
2292
  method: "POST",
2293
2293
  body: w,
2294
2294
  duplex: "half"
2295
2295
  }), j;
2296
- if (z.isFormData(w) && (j = $.headers.get("content-type")) && E.setContentType(j), $.body) {
2297
- const [D, _] = rl(
2296
+ if (z.isFormData(w) && (j = F.headers.get("content-type")) && E.setContentType(j), F.body) {
2297
+ const [P, _] = rl(
2298
2298
  Y,
2299
2299
  Jo(ol(S))
2300
2300
  );
2301
- w = il($.body, al, D, _);
2301
+ w = il(F.body, al, P, _);
2302
2302
  }
2303
2303
  }
2304
2304
  z.isString(N) || (N = N ? "include" : "omit");
@@ -2311,44 +2311,44 @@ const Qc = (e) => {
2311
2311
  duplex: "half",
2312
2312
  credentials: G ? N : void 0
2313
2313
  };
2314
- F = s && new n(v, te);
2315
- let B = await (s ? P(F, A) : P(v, te));
2314
+ $ = s && new n(v, te);
2315
+ let B = await (s ? O($, A) : O(v, te));
2316
2316
  const W = u && (T === "stream" || T === "response");
2317
2317
  if (u && (b || W && I)) {
2318
- const $ = {};
2318
+ const F = {};
2319
2319
  ["status", "statusText", "headers"].forEach((L) => {
2320
- $[L] = B[L];
2320
+ F[L] = B[L];
2321
2321
  });
2322
- const j = z.toFiniteNumber(B.headers.get("content-length")), [D, _] = b && rl(
2322
+ const j = z.toFiniteNumber(B.headers.get("content-length")), [P, _] = b && rl(
2323
2323
  j,
2324
2324
  Jo(ol(b), !0)
2325
2325
  ) || [];
2326
2326
  B = new r(
2327
- il(B.body, al, D, () => {
2327
+ il(B.body, al, P, () => {
2328
2328
  _ && _(), I && I();
2329
2329
  }),
2330
- $
2330
+ F
2331
2331
  );
2332
2332
  }
2333
2333
  T = T || "text";
2334
2334
  let ne = await f[z.findKey(f, T) || "text"](B, m);
2335
- return !W && I && I(), await new Promise(($, j) => {
2336
- Jc($, j, {
2335
+ return !W && I && I(), await new Promise((F, j) => {
2336
+ Jc(F, j, {
2337
2337
  data: ne,
2338
2338
  headers: Nt.from(B.headers),
2339
2339
  status: B.status,
2340
2340
  statusText: B.statusText,
2341
2341
  config: m,
2342
- request: F
2342
+ request: $
2343
2343
  });
2344
2344
  });
2345
2345
  } catch (G) {
2346
2346
  throw I && I(), G && G.name === "TypeError" && /Load failed|fetch/i.test(G.message) ? Object.assign(
2347
- new Ee("Network Error", Ee.ERR_NETWORK, m, F),
2347
+ new Ee("Network Error", Ee.ERR_NETWORK, m, $),
2348
2348
  {
2349
2349
  cause: G.cause || G
2350
2350
  }
2351
- ) : Ee.from(G, G && G.code, m, F);
2351
+ ) : Ee.from(G, G && G.code, m, $);
2352
2352
  }
2353
2353
  };
2354
2354
  }, Eg = /* @__PURE__ */ new Map(), eu = (e) => {
@@ -3135,25 +3135,25 @@ function Bg({
3135
3135
  const A = ie(
3136
3136
  async (B, W) => {
3137
3137
  try {
3138
- const ne = W && typeof W == "object" ? { id: W.id, name: W.name ?? "" } : void 0, $ = await e.createThread(B, ne);
3139
- return c($.threadId), await E(), $.threadId;
3138
+ const ne = W && typeof W == "object" ? { id: W.id, name: W.name ?? "" } : void 0, F = await e.createThread(B, ne);
3139
+ return c(F.threadId), await E(), F.threadId;
3140
3140
  } catch (ne) {
3141
- const $ = String(ne);
3142
- return n == null || n($), null;
3141
+ const F = String(ne);
3142
+ return n == null || n(F), null;
3143
3143
  }
3144
3144
  },
3145
3145
  [e, n, E]
3146
- ), P = ie(
3146
+ ), O = ie(
3147
3147
  async (B) => {
3148
3148
  const W = s;
3149
- i(($) => $.filter((j) => j.threadId !== B));
3149
+ i((F) => F.filter((j) => j.threadId !== B));
3150
3150
  const ne = new AbortController();
3151
3151
  T.current.set(B, ne);
3152
3152
  try {
3153
3153
  await e.deleteThread(B), S.current === B && (c(null), o == null || o());
3154
- } catch ($) {
3154
+ } catch (F) {
3155
3155
  i(W);
3156
- const j = String($);
3156
+ const j = String(F);
3157
3157
  n == null || n(j);
3158
3158
  } finally {
3159
3159
  T.current.delete(B);
@@ -3169,14 +3169,14 @@ function Bg({
3169
3169
  }
3170
3170
  },
3171
3171
  [e, n, E]
3172
- ), F = ie(
3172
+ ), $ = ie(
3173
3173
  async (B, W) => {
3174
3174
  b(!0), C("Sharing thread…");
3175
3175
  try {
3176
3176
  await e.shareThread(B, W), await N(), C("Shared successfully");
3177
3177
  } catch (ne) {
3178
- const $ = zg(ne);
3179
- throw n == null || n($), C(`Failed to share: ${$}`), new Error($);
3178
+ const F = zg(ne);
3179
+ throw n == null || n(F), C(`Failed to share: ${F}`), new Error(F);
3180
3180
  } finally {
3181
3181
  b(!1);
3182
3182
  }
@@ -3187,22 +3187,22 @@ function Bg({
3187
3187
  try {
3188
3188
  await e.unshareThread(B, W), await N();
3189
3189
  } catch (ne) {
3190
- const $ = String(ne);
3191
- throw n == null || n($), ne;
3190
+ const F = String(ne);
3191
+ throw n == null || n(F), ne;
3192
3192
  }
3193
3193
  },
3194
3194
  [e, n, N]
3195
3195
  ), Y = ze(
3196
3196
  () => ({
3197
3197
  createThread: A,
3198
- deleteThread: P,
3198
+ deleteThread: O,
3199
3199
  renameThread: H,
3200
3200
  refreshThreads: E,
3201
3201
  refreshSharedThreads: N,
3202
- shareThread: F,
3202
+ shareThread: $,
3203
3203
  unshareThread: I
3204
3204
  }),
3205
- [A, P, H, E, N, F, I]
3205
+ [A, O, H, E, N, $, I]
3206
3206
  ), G = ie((B) => {
3207
3207
  if (!(B != null && B.threadId)) return;
3208
3208
  const W = {
@@ -3214,15 +3214,15 @@ function Bg({
3214
3214
  messageCount: B.messageCount ?? 1
3215
3215
  };
3216
3216
  i((ne) => {
3217
- let $ = !1;
3218
- const j = ne.map((D) => D.threadId === W.threadId ? ($ = !0, console.debug("[useThreadsState] thread_info: updating existing thread", W.threadId), {
3219
- ...D,
3220
- title: W.title ?? D.title,
3221
- project: W.project ?? D.project,
3222
- updatedAt: W.updatedAt ?? D.updatedAt,
3223
- messageCount: W.messageCount ?? D.messageCount
3224
- }) : D);
3225
- return $ ? j : (console.debug("[useThreadsState] thread_info: adding thread to list", W.threadId), [W, ...ne]);
3217
+ let F = !1;
3218
+ const j = ne.map((P) => P.threadId === W.threadId ? (F = !0, console.debug("[useThreadsState] thread_info: updating existing thread", W.threadId), {
3219
+ ...P,
3220
+ title: W.title ?? P.title,
3221
+ project: W.project ?? P.project,
3222
+ updatedAt: W.updatedAt ?? P.updatedAt,
3223
+ messageCount: W.messageCount ?? P.messageCount
3224
+ }) : P);
3225
+ return F ? j : (console.debug("[useThreadsState] thread_info: adding thread to list", W.threadId), [W, ...ne]);
3226
3226
  });
3227
3227
  }, []), te = ie(() => C(null), []);
3228
3228
  return {
@@ -3848,7 +3848,7 @@ function dx({
3848
3848
  const [u, f] = ue(null), h = ze(
3849
3849
  () => xr(u),
3850
3850
  [u]
3851
- ).checkpoints, m = ux(h), v = m.timeline, [g, w] = ue(!1), [y, C] = ue(!1), [k, b] = ue(null), S = Se(r), T = Se(null), E = Se(null), N = Se(null), A = Se(null), P = Se(null), H = Se(/* @__PURE__ */ new Map()), F = Se(null);
3851
+ ).checkpoints, m = ux(h), v = m.timeline, [g, w] = ue(!1), [y, C] = ue(!1), [k, b] = ue(null), S = Se(r), T = Se(null), E = Se(null), N = Se(null), A = Se(null), O = Se(null), H = Se(/* @__PURE__ */ new Map()), $ = Se(null);
3852
3852
  We(() => {
3853
3853
  S.current = r;
3854
3854
  }, [r]);
@@ -3860,12 +3860,12 @@ function dx({
3860
3860
  (U = _.onStart) == null || U.call(_), _.setLoading(!0);
3861
3861
  try {
3862
3862
  await _.action(L);
3863
- } catch (O) {
3864
- if (!hl(O) && S.current === L) {
3865
- const re = String(O);
3863
+ } catch (M) {
3864
+ if (!hl(M) && S.current === L) {
3865
+ const re = String(M);
3866
3866
  (K = _.handleError) == null || K.call(_, re), n == null || n(re);
3867
3867
  }
3868
- throw O;
3868
+ throw M;
3869
3869
  } finally {
3870
3870
  _.setLoading(!1);
3871
3871
  }
@@ -3878,9 +3878,9 @@ function dx({
3878
3878
  const U = `${_}:${L ?? "latest"}`, K = H.current.get(U);
3879
3879
  if (K)
3880
3880
  return K;
3881
- (re = F.current) == null || re.abort();
3882
- const O = new AbortController();
3883
- F.current = O;
3881
+ (re = $.current) == null || re.abort();
3882
+ const M = new AbortController();
3883
+ $.current = M;
3884
3884
  const V = I({
3885
3885
  threadId: _,
3886
3886
  setLoading: w,
@@ -3890,7 +3890,7 @@ function dx({
3890
3890
  const he = await e.getStateHistory({
3891
3891
  threadId: ce,
3892
3892
  checkpointId: L ?? void 0,
3893
- signal: O.signal
3893
+ signal: M.signal
3894
3894
  });
3895
3895
  if (S.current !== ce) {
3896
3896
  console.log(
@@ -3910,9 +3910,9 @@ function dx({
3910
3910
  try {
3911
3911
  await V;
3912
3912
  } finally {
3913
- H.current.delete(U), F.current === O && (F.current = null);
3913
+ H.current.delete(U), $.current === M && ($.current = null);
3914
3914
  }
3915
- return S.current === _ && (P.current = U), V;
3915
+ return S.current === _ && (O.current = U), V;
3916
3916
  },
3917
3917
  [e, t, I]
3918
3918
  ), G = ie(
@@ -3940,12 +3940,12 @@ function dx({
3940
3940
  const { checkpoints: U, latest: K } = xr(_);
3941
3941
  if (!U.length)
3942
3942
  return;
3943
- const O = K, V = N.current === L;
3944
- !c && !V && t((O == null ? void 0 : O.messages) ?? [], {
3945
- checkpointId: (O == null ? void 0 : O.checkpointId) ?? null,
3946
- checkpointNs: (O == null ? void 0 : O.checkpointNs) ?? null,
3947
- pendingInterrupt: (O == null ? void 0 : O.interrupt) ?? null
3948
- }), f(_), P.current = `${L}:latest`, E.current = null, N.current === L && (N.current = null);
3943
+ const M = K, V = N.current === L;
3944
+ (!c || V) && t((M == null ? void 0 : M.messages) ?? [], {
3945
+ checkpointId: (M == null ? void 0 : M.checkpointId) ?? null,
3946
+ checkpointNs: (M == null ? void 0 : M.checkpointNs) ?? null,
3947
+ pendingInterrupt: (M == null ? void 0 : M.interrupt) ?? null
3948
+ }), f(_), O.current = `${L}:latest`, E.current = null, N.current === L && (N.current = null);
3949
3949
  },
3950
3950
  [t, c]
3951
3951
  ), ne = ie(
@@ -3955,21 +3955,21 @@ function dx({
3955
3955
  threadId: U,
3956
3956
  setLoading: C,
3957
3957
  action: async (K) => {
3958
- const O = await e.getStateHistory({
3958
+ const M = await e.getStateHistory({
3959
3959
  threadId: K,
3960
3960
  checkpointId: _,
3961
3961
  checkpointNs: L ?? void 0
3962
3962
  });
3963
3963
  if (S.current !== K)
3964
3964
  return;
3965
- const { checkpoints: V } = xr(O), re = V.find(
3965
+ const { checkpoints: V } = xr(M), re = V.find(
3966
3966
  (ce) => ce.checkpointId === _ && (L ? ce.checkpointNs === L : !0)
3967
3967
  );
3968
3968
  if (!re) {
3969
3969
  console.warn("[useThreadHistoryState] Requested checkpoint not found:", { checkpointId: _, checkpointNs: L });
3970
3970
  return;
3971
3971
  }
3972
- f(O), t(re.messages ?? [], {
3972
+ f(M), t(re.messages ?? [], {
3973
3973
  checkpointId: re.checkpointId ?? null,
3974
3974
  checkpointNs: re.checkpointNs ?? null
3975
3975
  });
@@ -3978,7 +3978,7 @@ function dx({
3978
3978
  });
3979
3979
  },
3980
3980
  [e, t, I]
3981
- ), $ = ie(
3981
+ ), F = ie(
3982
3982
  (_, L) => {
3983
3983
  t(l(), {
3984
3984
  checkpointId: _ ?? null,
@@ -4009,7 +4009,7 @@ function dx({
4009
4009
  T.current = r;
4010
4010
  let _;
4011
4011
  const L = `${r}:latest`;
4012
- P.current !== L && G(r, _);
4012
+ O.current !== L && G(r, _);
4013
4013
  }, [
4014
4014
  a,
4015
4015
  r,
@@ -4020,8 +4020,8 @@ function dx({
4020
4020
  c,
4021
4021
  G
4022
4022
  ]);
4023
- const D = ie(() => {
4024
- f(null), w(!1), C(!1), b(null), E.current = null, N.current = null, T.current = null, P.current = null, A.current = null;
4023
+ const P = ie(() => {
4024
+ f(null), w(!1), C(!1), b(null), E.current = null, N.current = null, T.current = null, O.current = null, A.current = null;
4025
4025
  }, []);
4026
4026
  return {
4027
4027
  threadCheckpoints: h,
@@ -4032,13 +4032,13 @@ function dx({
4032
4032
  threadStateError: k,
4033
4033
  loadThread: G,
4034
4034
  navigateToCheckpoint: ne,
4035
- setCurrentCheckpointId: $,
4035
+ setCurrentCheckpointId: F,
4036
4036
  returnToLatest: j,
4037
4037
  handleStateHistoryEvent: W,
4038
4038
  markSkipNextLoad: te,
4039
4039
  markStreamPendingThread: B,
4040
- resetHistoryState: D,
4041
- clearState: D
4040
+ resetHistoryState: P,
4041
+ clearState: P
4042
4042
  };
4043
4043
  }
4044
4044
  function fx(e, t, n) {
@@ -4105,30 +4105,30 @@ function hx({
4105
4105
  We(() => {
4106
4106
  c || (u([], {}), A());
4107
4107
  }, [c, u, A]);
4108
- const P = Se(null), H = ie(
4109
- ($) => {
4110
- P.current = $;
4108
+ const O = Se(null), H = ie(
4109
+ (F) => {
4110
+ O.current = F;
4111
4111
  },
4112
4112
  []
4113
- ), F = Se(null), I = ie(
4114
- ($) => {
4115
- F.current = $;
4113
+ ), $ = Se(null), I = ie(
4114
+ (F) => {
4115
+ $.current = F;
4116
4116
  },
4117
4117
  []
4118
4118
  ), Y = ze(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), G = ie(
4119
- ($, j) => {
4120
- const D = du($, "user");
4119
+ (F, j) => {
4120
+ const P = du(F, "user");
4121
4121
  return p({
4122
4122
  type: "user_message",
4123
4123
  payload: {
4124
- message: D,
4124
+ message: P,
4125
4125
  editingMessageId: j == null ? void 0 : j.editingMessageId
4126
4126
  }
4127
- }), D;
4127
+ }), P;
4128
4128
  },
4129
4129
  [p]
4130
4130
  ), te = ie(async () => {
4131
- P.current ? await P.current() : (u([], {}), A());
4131
+ O.current ? await O.current() : (u([], {}), A());
4132
4132
  }, [u, A]), B = ze(() => Qh(l.messages), [l.messages]), W = ze(
4133
4133
  () => ({
4134
4134
  threadId: c,
@@ -4149,23 +4149,23 @@ function hx({
4149
4149
  loadOlder: async () => {
4150
4150
  },
4151
4151
  // Placeholder
4152
- seedFromSnapshot: ($) => {
4153
- u($.messages, {
4154
- checkpointId: $.checkpointId,
4155
- checkpointNs: $.checkpointNs,
4156
- pendingInterrupt: $.interrupt
4152
+ seedFromSnapshot: (F) => {
4153
+ u(F.messages, {
4154
+ checkpointId: F.checkpointId,
4155
+ checkpointNs: F.checkpointNs,
4156
+ pendingInterrupt: F.interrupt
4157
4157
  });
4158
4158
  },
4159
4159
  clearState: te,
4160
4160
  navigateToCheckpoint: k,
4161
4161
  setCurrentCheckpointId: b,
4162
4162
  returnToLatest: S,
4163
- loadThread: async ($, j, D) => {
4164
- await C($, j, { clearProgress: !1 });
4163
+ loadThread: async (F, j, P) => {
4164
+ await C(F, j, { clearProgress: !1 });
4165
4165
  },
4166
4166
  clearThread: te,
4167
- respondToInterrupt: async ($, j, D) => {
4168
- F.current && await F.current($, j, D);
4167
+ respondToInterrupt: async (F, j, P) => {
4168
+ $.current && await $.current(F, j, P);
4169
4169
  },
4170
4170
  messagePreviews: v.messagePreviews,
4171
4171
  handleStateHistoryEvent: T,
@@ -4346,61 +4346,61 @@ function gu(e = {}) {
4346
4346
  We(() => {
4347
4347
  a.current = e;
4348
4348
  }, [e]);
4349
- const c = ie((D) => {
4350
- var U, K, O, V, re, ce, he, ge, Ne, ke;
4349
+ const c = ie((P) => {
4350
+ var U, K, M, V, re, ce, he, ge, Ne, ke;
4351
4351
  const _ = a.current;
4352
4352
  if (!_) return;
4353
- if (D.type === "thread_info") {
4354
- (U = _.onThreadInfo) == null || U.call(_, D);
4353
+ if (P.type === "thread_info") {
4354
+ (U = _.onThreadInfo) == null || U.call(_, P);
4355
4355
  return;
4356
4356
  }
4357
- if (D.type === "state_history") {
4358
- (K = _.handleStateHistoryEvent) == null || K.call(_, D);
4357
+ if (P.type === "state_history") {
4358
+ (K = _.handleStateHistoryEvent) == null || K.call(_, P);
4359
4359
  return;
4360
4360
  }
4361
- if (D.type === "metadata") {
4362
- (O = _.onMetadataEvent) == null || O.call(_, D);
4361
+ if (P.type === "metadata") {
4362
+ (M = _.onMetadataEvent) == null || M.call(_, P);
4363
4363
  return;
4364
4364
  }
4365
- if (typeof D.type == "string" && (D.type === "custom" || D.type.startsWith("custom."))) {
4366
- (V = _.onCustomEvent) == null || V.call(_, D);
4365
+ if (typeof P.type == "string" && (P.type === "custom" || P.type.startsWith("custom."))) {
4366
+ (V = _.onCustomEvent) == null || V.call(_, P);
4367
4367
  return;
4368
4368
  }
4369
- (re = _.onEvent) == null || re.call(_, D), D.type === "updates" && ((ce = _.onUpdateEvent) == null || ce.call(_, D)), D.type === "tool.end" ? (he = _.onToolEnd) == null || he.call(_, D) : D.type === "tool.start" && ((ge = _.onToolStart) == null || ge.call(_, D)), D.type === "heartbeat" && ((Ne = _.onHeartbeat) == null || Ne.call(_, D)), D.type === "token" && ((ke = _.onToken) == null || ke.call(_, D.token));
4370
- }, []), [l, u] = ue(!1), [f, p] = ue(null), [h, m] = ue(""), [v, g] = ue(null), [w, y] = ue(0), [C, k] = ue(!1), [b, S] = ue({}), [T, E] = ue(null), [N, A] = ue({}), P = Se(null), H = Se(!0), F = Se(0), I = Se(null), Y = Se(null), G = Se(null), te = Se(null), B = Se({
4369
+ (re = _.onEvent) == null || re.call(_, P), P.type === "updates" && ((ce = _.onUpdateEvent) == null || ce.call(_, P)), P.type === "tool.end" ? (he = _.onToolEnd) == null || he.call(_, P) : P.type === "tool.start" && ((ge = _.onToolStart) == null || ge.call(_, P)), P.type === "heartbeat" && ((Ne = _.onHeartbeat) == null || Ne.call(_, P)), P.type === "token" && ((ke = _.onToken) == null || ke.call(_, P.token));
4370
+ }, []), [l, u] = ue(!1), [f, p] = ue(null), [h, m] = ue(""), [v, g] = ue(null), [w, y] = ue(0), [C, k] = ue(!1), [b, S] = ue({}), [T, E] = ue(null), [N, A] = ue({}), O = Se(null), H = Se(!0), $ = Se(0), I = Se(null), Y = Se(null), G = Se(null), te = Se(null), B = Se({
4371
4371
  messageId: null,
4372
4372
  lastSeq: null,
4373
4373
  lastText: ""
4374
- }), W = ie((D) => {
4375
- o(D);
4374
+ }), W = ie((P) => {
4375
+ o(P);
4376
4376
  }, []), ne = ie(() => {
4377
4377
  m(""), g(null), p(null), Y.current = null, G.current = null, te.current = null, S({}), E(null), A({}), B.current = {
4378
4378
  messageId: null,
4379
4379
  lastSeq: null,
4380
4380
  lastText: ""
4381
4381
  };
4382
- }, []), $ = ie(() => {
4382
+ }, []), F = ie(() => {
4383
4383
  var U;
4384
4384
  console.debug("[use-chat] stop() invoked - aborting stream");
4385
- const D = (U = I.current) == null ? void 0 : U.threadId, _ = () => {
4385
+ const P = (U = I.current) == null ? void 0 : U.threadId, _ = () => {
4386
4386
  var K;
4387
- (K = P.current) == null || K.abort(), P.current = null, I.current = null, u(!1), k(!1), F.current = 0, y(0);
4387
+ (K = O.current) == null || K.abort(), O.current = null, I.current = null, u(!1), k(!1), $.current = 0, y(0);
4388
4388
  };
4389
- (D ? au.cancelRun(D).catch((K) => {
4389
+ (P ? au.cancelRun(P).catch((K) => {
4390
4390
  console.warn("[use-chat] cancel run failed:", K);
4391
4391
  }) : Promise.resolve()).finally(_);
4392
4392
  }, []), j = ie(
4393
- (D, _) => {
4393
+ (P, _) => {
4394
4394
  var V, re;
4395
- P.current && (P.current.abort(), P.current = null);
4395
+ O.current && (O.current.abort(), O.current = null);
4396
4396
  const L = {
4397
- text: typeof D.content == "string" ? D.content : D.text,
4398
- threadId: D.threadId,
4399
- attachments: D.attachments,
4400
- payload: D.payload,
4401
- config: D.options,
4402
- checkpointId: (V = D.payload) == null ? void 0 : V.checkpointId,
4403
- checkpointNs: ((re = D.payload) == null ? void 0 : re.checkpointNs) || void 0,
4397
+ text: typeof P.content == "string" ? P.content : P.text,
4398
+ threadId: P.threadId,
4399
+ attachments: P.attachments,
4400
+ payload: P.payload,
4401
+ config: P.options,
4402
+ checkpointId: (V = P.payload) == null ? void 0 : V.checkpointId,
4403
+ checkpointNs: ((re = P.payload) == null ? void 0 : re.checkpointNs) || void 0,
4404
4404
  edit: _ == null ? void 0 : _.edit
4405
4405
  };
4406
4406
  u(!0), p(null), m(""), g(null), Y.current = null, G.current = null, te.current = null, S({}), E(null), A({}), B.current = {
@@ -4409,8 +4409,8 @@ function gu(e = {}) {
4409
4409
  lastText: ""
4410
4410
  };
4411
4411
  const U = new AbortController();
4412
- P.current = U;
4413
- let K = null, O = !1;
4412
+ O.current = U;
4413
+ let K = null, M = !1;
4414
4414
  return I.current = {
4415
4415
  threadId: L.threadId ?? null,
4416
4416
  headers: {},
@@ -4471,7 +4471,7 @@ function gu(e = {}) {
4471
4471
  k(!0);
4472
4472
  const He = Xe.body.getReader(), ut = new TextDecoder();
4473
4473
  let gt = "", Pt = [];
4474
- F.current = 0, y(0);
4474
+ $.current = 0, y(0);
4475
4475
  let Ot = 0, Mt = null;
4476
4476
  const zn = () => {
4477
4477
  if (Pt.length) {
@@ -4544,7 +4544,7 @@ function gu(e = {}) {
4544
4544
  console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Dt, lastProcessedSeq: Ot, type: Me.type });
4545
4545
  continue;
4546
4546
  }
4547
- Ot > 0 && Dt > Ot + 1, Ot = Dt, F.current = Dt, y(Dt);
4547
+ Ot > 0 && Dt > Ot + 1, Ot = Dt, $.current = Dt, y(Dt);
4548
4548
  }
4549
4549
  if (Me.type === "checkpoint")
4550
4550
  Y.current = Me.checkpointId ?? null, G.current = Me.checkpointNs ?? null, g(Me.checkpointId ?? null);
@@ -4563,11 +4563,11 @@ function gu(e = {}) {
4563
4563
  var Q;
4564
4564
  let q = T;
4565
4565
  if (!q) {
4566
- const M = Object.values(R).filter((X) => X.role === "assistant");
4567
- M.length > 0 && (q = M[M.length - 1].id);
4566
+ const D = Object.values(R).filter((X) => X.role === "assistant");
4567
+ D.length > 0 && (q = D[D.length - 1].id);
4568
4568
  }
4569
4569
  if (q && R[q]) {
4570
- const M = R[q], X = [...M.toolCalls || []], oe = X.findIndex((we) => we.id === Ke);
4570
+ const D = R[q], X = [...D.toolCalls || []], oe = X.findIndex((we) => we.id === Ke);
4571
4571
  let se = Ce.content || Ce.status || "Processing...";
4572
4572
  return Me.type === "tool.start" ? se = `Starting ${(((Q = Ce.additionalKwargs) == null ? void 0 : Q.agentName) ?? Ce.name) || Ce.tool || "tool"}...` : Me.type === "tool.end" && Ce.error && (se = `Error: ${Ce.error}`), oe >= 0 ? X[oe] = {
4573
4573
  ...X[oe],
@@ -4581,7 +4581,7 @@ function gu(e = {}) {
4581
4581
  status: Me.type === "tool.end" ? Ce.error ? "failed" : "completed" : "running",
4582
4582
  content: se,
4583
4583
  artifact: Ce.artifact
4584
- }), { ...R, [q]: { ...M, toolCalls: X } };
4584
+ }), { ...R, [q]: { ...D, toolCalls: X } };
4585
4585
  }
4586
4586
  return R;
4587
4587
  });
@@ -4590,7 +4590,7 @@ function gu(e = {}) {
4590
4590
  if (Array.isArray(Ke) && Ke.length > 0) {
4591
4591
  const R = Ke.find((Q) => Q.type === "ai"), q = Ke.find((Q) => Q.type === "tool");
4592
4592
  if (R) {
4593
- const Q = R.id, M = R.content ?? "";
4593
+ const Q = R.id, D = R.content ?? "";
4594
4594
  if (B.current.messageId !== Q) {
4595
4595
  const oe = R.name ?? ((ke = R.additionalKwargs) == null ? void 0 : ke.agentName) ?? "assistant";
4596
4596
  B.current = {
@@ -4604,7 +4604,7 @@ function gu(e = {}) {
4604
4604
  name: oe,
4605
4605
  model: oe,
4606
4606
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
4607
- content: [{ type: "text", text: M }]
4607
+ content: [{ type: "text", text: D }]
4608
4608
  });
4609
4609
  S((we) => ({ ...we, [Q]: se })), E(Q);
4610
4610
  } else
@@ -4614,24 +4614,24 @@ function gu(e = {}) {
4614
4614
  ...oe,
4615
4615
  [Q]: {
4616
4616
  ...se,
4617
- content: [{ type: "text", text: M }]
4617
+ content: [{ type: "text", text: D }]
4618
4618
  }
4619
4619
  } : oe;
4620
4620
  });
4621
4621
  const X = B.current.lastText || "";
4622
- if (M.length > X.length) {
4623
- const oe = M.slice(X.length);
4624
- B.current.lastText = M, Pt.push(oe), _r();
4622
+ if (D.length > X.length) {
4623
+ const oe = D.slice(X.length);
4624
+ B.current.lastText = D, Pt.push(oe), _r();
4625
4625
  }
4626
4626
  }
4627
4627
  if (q) {
4628
- const Q = q.id || `tool-${Date.now()}`, M = Yo({
4628
+ const Q = q.id || `tool-${Date.now()}`, D = Yo({
4629
4629
  ...q,
4630
4630
  id: Q,
4631
4631
  role: "tool",
4632
4632
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4633
4633
  });
4634
- S((X) => ({ ...X, [Q]: M }));
4634
+ S((X) => ({ ...X, [Q]: D }));
4635
4635
  }
4636
4636
  }
4637
4637
  } else if (Me.type === "heartbeat") {
@@ -4679,10 +4679,10 @@ function gu(e = {}) {
4679
4679
  K = K ?? "aborted";
4680
4680
  else {
4681
4681
  const it = Be.message || String(Be);
4682
- K = "error", p(it), O || (O = !0, (mt = e.onConnectionError) == null || mt.call(e, it));
4682
+ K = "error", p(it), M || (M = !0, (mt = e.onConnectionError) == null || mt.call(e, it));
4683
4683
  }
4684
4684
  } finally {
4685
- const Be = F.current, it = Y.current, at = G.current, Ct = te.current;
4685
+ const Be = $.current, it = Y.current, at = G.current, Ct = te.current;
4686
4686
  try {
4687
4687
  if (e.onFinish) {
4688
4688
  const Xe = {
@@ -4696,15 +4696,15 @@ function gu(e = {}) {
4696
4696
  } catch (Xe) {
4697
4697
  console.warn("[use-chat] onClosed callback failed", Xe);
4698
4698
  }
4699
- u(!1), k(!1), P.current = null, F.current = 0, y(0), I.current = null;
4699
+ u(!1), k(!1), O.current = null, $.current = 0, y(0), I.current = null;
4700
4700
  }
4701
4701
  })(), Promise.resolve();
4702
4702
  },
4703
4703
  [t, n, r, e]
4704
4704
  );
4705
4705
  return We(() => () => {
4706
- var D;
4707
- H.current = !1, (D = P.current) == null || D.abort();
4706
+ var P;
4707
+ H.current = !1, (P = O.current) == null || P.abort();
4708
4708
  }, []), {
4709
4709
  isStreaming: l,
4710
4710
  error: f,
@@ -4715,7 +4715,7 @@ function gu(e = {}) {
4715
4715
  lastSeq: w,
4716
4716
  connected: C,
4717
4717
  stream: j,
4718
- stop: $,
4718
+ stop: F,
4719
4719
  clear: ne,
4720
4720
  setToken: W,
4721
4721
  values: N,
@@ -4775,7 +4775,7 @@ function Tx({
4775
4775
  onMetadataEvent: p,
4776
4776
  onFinish: h
4777
4777
  }) {
4778
- const { chatApi: m, baseUrl: v } = uo(), g = v, [w, y] = ue(!1), C = vn(s), k = vn(i), b = vn(c), S = vn(a), T = vn(l), E = vn(u), N = vn(f), A = vn(p), P = vn(h), H = ze(
4778
+ const { chatApi: m, baseUrl: v } = uo(), g = v, [w, y] = ue(!1), C = vn(s), k = vn(i), b = vn(c), S = vn(a), T = vn(l), E = vn(u), N = vn(f), A = vn(p), O = vn(h), H = ze(
4779
4779
  () => ({
4780
4780
  onError: C,
4781
4781
  onAuthError: k,
@@ -4784,7 +4784,7 @@ function Tx({
4784
4784
  onCustomEvent: N,
4785
4785
  onUpdateEvent: E,
4786
4786
  onToolEnd: T,
4787
- onFinish: P
4787
+ onFinish: O
4788
4788
  }),
4789
4789
  [
4790
4790
  C,
@@ -4794,7 +4794,7 @@ function Tx({
4794
4794
  N,
4795
4795
  E,
4796
4796
  T,
4797
- P
4797
+ O
4798
4798
  ]
4799
4799
  );
4800
4800
  return /* @__PURE__ */ d.jsx(
@@ -4846,16 +4846,16 @@ function kx({
4846
4846
  onEvent: w,
4847
4847
  messages: y
4848
4848
  } = co(), { registerClearThread: C, registerRespondToInterrupt: k } = px(), b = ie(
4849
- ($) => {
4850
- a($), i.current !== $.threadId && (($.created ?? !i.current) && h($.threadId), m($.threadId), s($.threadId));
4849
+ (F) => {
4850
+ a(F), m(F.threadId), i.current !== F.threadId && ((F.created ?? !i.current) && h(F.threadId), s(F.threadId));
4851
4851
  },
4852
4852
  [a, h, m, s, i]
4853
4853
  ), S = gu({
4854
4854
  baseUrl: n,
4855
4855
  onEvent: w,
4856
- onError: ($) => {
4856
+ onError: (F) => {
4857
4857
  var j;
4858
- (j = r.onError) == null || j.call(r, ($ == null ? void 0 : $.message) ?? String($));
4858
+ (j = r.onError) == null || j.call(r, (F == null ? void 0 : F.message) ?? String(F));
4859
4859
  },
4860
4860
  onAuthError: r.onAuthError,
4861
4861
  onConnectionError: r.onConnectionError,
@@ -4870,13 +4870,13 @@ function kx({
4870
4870
  We(() => {
4871
4871
  o(S.isStreaming);
4872
4872
  }, [S.isStreaming, o]);
4873
- const { stream: T, stop: E, clear: N, isStreaming: A, error: P, connected: H, streamedMessages: F } = S;
4873
+ const { stream: T, stop: E, clear: N, isStreaming: A, error: O, connected: H, streamedMessages: $ } = S;
4874
4874
  We(() => {
4875
4875
  c !== void 0 && N();
4876
4876
  }, [c, N]);
4877
4877
  const I = ie(
4878
- async ($, j) => {
4879
- await T($, j);
4878
+ async (F, j) => {
4879
+ await T(F, j);
4880
4880
  },
4881
4881
  [T]
4882
4882
  ), Y = Se(u);
@@ -4884,16 +4884,16 @@ function kx({
4884
4884
  Y.current = u;
4885
4885
  }, [u]);
4886
4886
  const G = ie(
4887
- async ($, j, D) => {
4887
+ async (F, j, P) => {
4888
4888
  const _ = i.current;
4889
4889
  if (!_)
4890
4890
  throw new Error("No active thread to handle interrupt");
4891
- const L = $ ? j ?? !0 : !1, U = Y.current, K = {
4891
+ const L = F ? j ?? !0 : !1, U = Y.current, K = {
4892
4892
  threadId: _,
4893
4893
  checkpointId: U.id ?? void 0,
4894
4894
  checkpointNs: U.namespace ?? void 0,
4895
4895
  command: { kind: "resume", value: L },
4896
- payload: D == null ? void 0 : D.payload
4896
+ payload: P == null ? void 0 : P.payload
4897
4897
  };
4898
4898
  I(K);
4899
4899
  },
@@ -4909,19 +4909,19 @@ function kx({
4909
4909
  C(te);
4910
4910
  }, [te, C]);
4911
4911
  const B = ie(
4912
- async ($, j) => {
4912
+ async (F, j) => {
4913
4913
  A && E();
4914
- let D = i.current;
4915
- const _ = ($ == null ? void 0 : $.text) ?? "", L = ($ == null ? void 0 : $.attachments) ?? [], U = (_ == null ? void 0 : _.trim()) ?? "", K = { ...($ == null ? void 0 : $.payload) ?? {} }, O = Array.isArray(K.messages) ? K.messages : void 0;
4916
- O && delete K.messages;
4917
- const V = !!(O && O.length), re = !!($.contentParts && $.contentParts.length > 0);
4918
- if (!D && !U && L.length === 0 && !V && !re) return;
4919
- if (!D) {
4914
+ let P = i.current;
4915
+ const _ = (F == null ? void 0 : F.text) ?? "", L = (F == null ? void 0 : F.attachments) ?? [], U = (_ == null ? void 0 : _.trim()) ?? "", K = { ...(F == null ? void 0 : F.payload) ?? {} }, M = Array.isArray(K.messages) ? K.messages : void 0;
4916
+ M && delete K.messages;
4917
+ const V = !!(M && M.length), re = !!(F.contentParts && F.contentParts.length > 0);
4918
+ if (!P && !U && L.length === 0 && !V && !re) return;
4919
+ if (!P) {
4920
4920
  const Be = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), it = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
4921
- D = `${Be}${it}`, h(D), s(D);
4921
+ P = `${Be}${it}`, h(P), s(P);
4922
4922
  }
4923
4923
  let ce = null;
4924
- $.contentParts && $.contentParts.length > 0 && (ce = $.contentParts);
4924
+ F.contentParts && F.contentParts.length > 0 && (ce = F.contentParts);
4925
4925
  const { contentParts: he, filesInfo: ge } = ce ? { contentParts: ce, filesInfo: [] } : await Uh(L), Ne = [...he];
4926
4926
  U && Ne.push({ type: "text", text: _ });
4927
4927
  const ke = j == null ? void 0 : j.originalMessageId, Ye = !!(j != null && j.edit && ke), tt = !V && Ne.length > 0;
@@ -4935,7 +4935,7 @@ function kx({
4935
4935
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4936
4936
  }, "user"), Ye ? g($e, { editingMessageId: ke }) : g($e);
4937
4937
  }
4938
- const Ve = V ? O : $e ? [$e] : [], ft = {
4938
+ const Ve = V ? M : $e ? [$e] : [], ft = {
4939
4939
  ...K,
4940
4940
  ...ge.length ? { files_info: ge } : {}
4941
4941
  };
@@ -4943,8 +4943,8 @@ function kx({
4943
4943
  let ht = (j == null ? void 0 : j.checkpointId) ?? u.id ?? void 0;
4944
4944
  Ye && ke && (ht = Sx(f, ke).checkpointId);
4945
4945
  const mt = {
4946
- threadId: D,
4947
- content: $ == null ? void 0 : $.text,
4946
+ threadId: P,
4947
+ content: F == null ? void 0 : F.text,
4948
4948
  payload: {
4949
4949
  ...ft,
4950
4950
  checkpointId: ht
@@ -4955,28 +4955,29 @@ function kx({
4955
4955
  },
4956
4956
  [u, i, A, h, g, I, E, f]
4957
4957
  ), W = ze(() => {
4958
- if (!A || Object.keys(F).length === 0)
4958
+ const F = Object.keys($).length > 0;
4959
+ if (!A && !F)
4959
4960
  return y;
4960
- const $ = /* @__PURE__ */ new Map();
4961
- return y.forEach((j) => $.set(j.id, j)), Object.values(F).forEach((j) => {
4962
- $.set(j.id, j);
4963
- }), Array.from($.values());
4964
- }, [A, F, y]), ne = ze(
4961
+ const j = /* @__PURE__ */ new Map();
4962
+ return y.forEach((P) => j.set(P.id, P)), Object.values($).forEach((P) => {
4963
+ j.set(P.id, P);
4964
+ }), Array.from(j.values());
4965
+ }, [A, $, y]), ne = ze(
4965
4966
  () => ({
4966
4967
  isStreaming: A,
4967
- error: P,
4968
- connectionState: P ? "error" : A ? H ? "connected" : "connecting" : "idle",
4968
+ error: O,
4969
+ connectionState: O ? "error" : A ? H ? "connected" : "connecting" : "idle",
4969
4970
  messages: W,
4970
4971
  submit: B,
4971
4972
  stop: E,
4972
4973
  interrupt: l,
4973
4974
  resume: () => Promise.resolve(),
4974
- goto: ($, j) => Promise.resolve(),
4975
+ goto: (F, j) => Promise.resolve(),
4975
4976
  clearError: () => {
4976
4977
  }
4977
4978
  // TODO: Implement error clearing
4978
4979
  }),
4979
- [A, P, B, E, l, H, W]
4980
+ [A, O, B, E, l, H, W]
4980
4981
  );
4981
4982
  return /* @__PURE__ */ d.jsx(xu.Provider, { value: ne, children: e });
4982
4983
  }
@@ -5780,7 +5781,7 @@ const Jx = {
5780
5781
  ye((b) => b.length > 0),
5781
5782
  Ie(v, h),
5782
5783
  ae(([b, S, T]) => {
5783
- const E = b.reduce((N, A, P) => Ft(N, A, Yr(A, S.offsetTree, T) || P), wr());
5784
+ const E = b.reduce((N, A, O) => Ft(N, A, Yr(A, S.offsetTree, T) || O), wr());
5784
5785
  return {
5785
5786
  ...S,
5786
5787
  groupIndices: b,
@@ -5867,8 +5868,8 @@ const Jx = {
5867
5868
  const T = S.groupIndices.length > 0, E = [], N = S.lastSize;
5868
5869
  if (T) {
5869
5870
  const A = qr(S.sizeTree, 0);
5870
- let P = 0, H = 0;
5871
- for (; P < b; ) {
5871
+ let O = 0, H = 0;
5872
+ for (; O < b; ) {
5872
5873
  const I = S.groupIndices[H], Y = S.groupIndices.length === H + 1 ? 1 / 0 : S.groupIndices[H + 1] - I - 1;
5873
5874
  E.push({
5874
5875
  endIndex: I,
@@ -5878,10 +5879,10 @@ const Jx = {
5878
5879
  endIndex: I + 1 + Y - 1,
5879
5880
  size: N,
5880
5881
  startIndex: I + 1
5881
- }), H++, P += Y + 1;
5882
+ }), H++, O += Y + 1;
5882
5883
  }
5883
- const F = Gn(S.sizeTree);
5884
- return P !== b && F.shift(), F.reduce(
5884
+ const $ = Gn(S.sizeTree);
5885
+ return O !== b && $.shift(), $.reduce(
5885
5886
  (I, { k: Y, v: G }) => {
5886
5887
  let te = I.ranges;
5887
5888
  return I.prevSize !== 0 && (te = [
@@ -5905,10 +5906,10 @@ const Jx = {
5905
5906
  ).ranges;
5906
5907
  }
5907
5908
  return Gn(S.sizeTree).reduce(
5908
- (A, { k: P, v: H }) => ({
5909
- prevIndex: P + b,
5909
+ (A, { k: O, v: H }) => ({
5910
+ prevIndex: O + b,
5910
5911
  prevSize: H,
5911
- ranges: [...A.ranges, { endIndex: P + b - 1, size: A.prevSize, startIndex: A.prevIndex }]
5912
+ ranges: [...A.ranges, { endIndex: O + b - 1, size: A.prevSize, startIndex: A.prevIndex }]
5912
5913
  }),
5913
5914
  {
5914
5915
  prevIndex: 0,
@@ -5940,15 +5941,15 @@ const Jx = {
5940
5941
  return S;
5941
5942
  let E = wr();
5942
5943
  const N = lt(g);
5943
- let A = 0, P = 0, H = 0;
5944
+ let A = 0, O = 0, H = 0;
5944
5945
  for (; A < -b; ) {
5945
- H = N[P];
5946
- const F = N[P + 1] - H - 1;
5947
- P++, A += F + 1;
5946
+ H = N[O];
5947
+ const $ = N[O + 1] - H - 1;
5948
+ O++, A += $ + 1;
5948
5949
  }
5949
- if (E = Gn(S.sizeTree).reduce((F, { k: I, v: Y }) => Ft(F, Math.max(0, I + b), Y), E), A !== -b) {
5950
- const F = qr(S.sizeTree, H);
5951
- E = Ft(E, 0, F);
5950
+ if (E = Gn(S.sizeTree).reduce(($, { k: I, v: Y }) => Ft($, Math.max(0, I + b), Y), E), A !== -b) {
5951
+ const $ = qr(S.sizeTree, H);
5952
+ E = Ft(E, 0, $);
5952
5953
  const I = Zt(S.sizeTree, -b + 1)[1];
5953
5954
  E = Ft(E, 1, I);
5954
5955
  }
@@ -5958,7 +5959,7 @@ const Jx = {
5958
5959
  ...Ii(S.offsetTree, 0, E, T)
5959
5960
  };
5960
5961
  } else {
5961
- const E = Gn(S.sizeTree).reduce((N, { k: A, v: P }) => Ft(N, Math.max(0, A + b), P), wr());
5962
+ const E = Gn(S.sizeTree).reduce((N, { k: A, v: O }) => Ft(N, Math.max(0, A + b), O), wr());
5962
5963
  return {
5963
5964
  ...S,
5964
5965
  sizeTree: E,
@@ -6076,29 +6077,29 @@ const fo = Oe(
6076
6077
  Ie(e, s, o),
6077
6078
  ae(
6078
6079
  ([
6079
- [k, b, S, T, E, N, A, P],
6080
+ [k, b, S, T, E, N, A, O],
6080
6081
  H,
6081
- F,
6082
+ $,
6082
6083
  I
6083
6084
  ]) => {
6084
6085
  const Y = Pu(k), { align: G, behavior: te, offset: B } = Y, W = T - 1, ne = ju(Y, b, W);
6085
- let $ = Yr(ne, b.offsetTree, H) + N;
6086
- G === "end" ? ($ += F + Zt(b.sizeTree, ne)[1] - S + I, ne === W && ($ += A)) : G === "center" ? $ += (F + Zt(b.sizeTree, ne)[1] - S + I) / 2 : $ -= E, B && ($ += B);
6087
- const j = (D) => {
6088
- C(), D ? (P("retrying to scroll to", { location: k }, jt.DEBUG), Re(h, k)) : (Re(m, !0), P("list did not change, scroll successful", {}, jt.DEBUG));
6086
+ let F = Yr(ne, b.offsetTree, H) + N;
6087
+ G === "end" ? (F += $ + Zt(b.sizeTree, ne)[1] - S + I, ne === W && (F += A)) : G === "center" ? F += ($ + Zt(b.sizeTree, ne)[1] - S + I) / 2 : F -= E, B && (F += B);
6088
+ const j = (P) => {
6089
+ C(), P ? (O("retrying to scroll to", { location: k }, jt.DEBUG), Re(h, k)) : (Re(m, !0), O("list did not change, scroll successful", {}, jt.DEBUG));
6089
6090
  };
6090
6091
  if (C(), te === "smooth") {
6091
- let D = !1;
6092
+ let P = !1;
6092
6093
  y = Le(t, (_) => {
6093
- D = D || _;
6094
+ P = P || _;
6094
6095
  }), g = Jt(u, () => {
6095
- j(D);
6096
+ j(P);
6096
6097
  });
6097
6098
  } else
6098
6099
  g = Jt(J(t, ev(150)), j);
6099
6100
  return w = setTimeout(() => {
6100
6101
  C();
6101
- }, 1200), Re(c, !0), P("scrolling from index to", { behavior: te, index: ne, top: $ }, jt.DEBUG), { behavior: te, top: $ };
6102
+ }, 1200), Re(c, !0), O("scrolling from index to", { behavior: te, index: ne, top: F }, jt.DEBUG), { behavior: te, top: F };
6102
6103
  }
6103
6104
  )
6104
6105
  ),
@@ -6216,18 +6217,18 @@ const Xr = "up", zr = "down", tv = "none", nv = {
6216
6217
  viewportHeight: b
6217
6218
  };
6218
6219
  if (N) {
6219
- let H, F;
6220
- return k > y.state.scrollTop ? (H = "SCROLLED_DOWN", F = y.state.scrollTop - k) : (H = "SIZE_DECREASED", F = y.state.scrollTop - k || y.scrollTopDelta), {
6220
+ let H, $;
6221
+ return k > y.state.scrollTop ? (H = "SCROLLED_DOWN", $ = y.state.scrollTop - k) : (H = "SIZE_DECREASED", $ = y.state.scrollTop - k || y.scrollTopDelta), {
6221
6222
  atBottom: !0,
6222
6223
  atBottomBecause: H,
6223
- scrollTopDelta: F,
6224
+ scrollTopDelta: $,
6224
6225
  state: A
6225
6226
  };
6226
6227
  }
6227
- let P;
6228
- return A.scrollHeight > y.state.scrollHeight ? P = "SIZE_INCREASED" : b < y.state.viewportHeight ? P = "VIEWPORT_HEIGHT_DECREASING" : k < y.state.scrollTop ? P = "SCROLLING_UPWARDS" : P = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
6228
+ let O;
6229
+ return A.scrollHeight > y.state.scrollHeight ? O = "SIZE_INCREASED" : b < y.state.viewportHeight ? O = "VIEWPORT_HEIGHT_DECREASING" : k < y.state.scrollTop ? O = "SCROLLING_UPWARDS" : O = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
6229
6230
  atBottom: !1,
6230
- notAtBottomBecause: P,
6231
+ notAtBottomBecause: O,
6231
6232
  state: A
6232
6233
  };
6233
6234
  }, nv),
@@ -6505,9 +6506,9 @@ const ar = Oe(
6505
6506
  E,
6506
6507
  N,
6507
6508
  A,
6508
- P,
6509
+ O,
6509
6510
  H,
6510
- F,
6511
+ $,
6511
6512
  I,
6512
6513
  Y
6513
6514
  ]) => {
@@ -6515,7 +6516,7 @@ const ar = Oe(
6515
6516
  if (E === 0)
6516
6517
  return { ...Js, totalCount: E };
6517
6518
  if (S === 0 && T === 0)
6518
- return W === 0 ? { ...Js, totalCount: E } : Mu(W, A, N, F, I, Y || []);
6519
+ return W === 0 ? { ...Js, totalCount: E } : Mu(W, A, N, $, I, Y || []);
6519
6520
  if (qe(B))
6520
6521
  return W > 0 ? null : Fo(
6521
6522
  ov(Qi(A, E), G, Y),
@@ -6523,40 +6524,40 @@ const ar = Oe(
6523
6524
  E,
6524
6525
  I,
6525
6526
  G,
6526
- F
6527
+ $
6527
6528
  );
6528
6529
  const ne = [];
6529
6530
  if (H.length > 0) {
6530
6531
  const L = H[0], U = H[H.length - 1];
6531
6532
  let K = 0;
6532
- for (const O of Ts(B, L, U)) {
6533
- const V = O.value, re = Math.max(O.start, L), ce = Math.min(O.end, U);
6533
+ for (const M of Ts(B, L, U)) {
6534
+ const V = M.value, re = Math.max(M.start, L), ce = Math.min(M.end, U);
6534
6535
  for (let he = re; he <= ce; he++)
6535
6536
  ne.push({ data: Y == null ? void 0 : Y[he], index: he, offset: K, size: V }), K += V;
6536
6537
  }
6537
6538
  }
6538
- if (!P)
6539
- return Fo([], ne, E, I, G, F);
6540
- const $ = H.length > 0 ? H[H.length - 1] + 1 : 0, j = Kx(te, S, T, $);
6539
+ if (!O)
6540
+ return Fo([], ne, E, I, G, $);
6541
+ const F = H.length > 0 ? H[H.length - 1] + 1 : 0, j = Kx(te, S, T, F);
6541
6542
  if (j.length === 0)
6542
6543
  return null;
6543
- const D = E - 1, _ = Cs([], (L) => {
6544
+ const P = E - 1, _ = Cs([], (L) => {
6544
6545
  for (const U of j) {
6545
6546
  const K = U.value;
6546
- let O = K.offset, V = U.start;
6547
+ let M = K.offset, V = U.start;
6547
6548
  const re = K.size;
6548
6549
  if (K.offset < S) {
6549
6550
  V += Math.floor((S - K.offset + I) / (re + I));
6550
6551
  const he = V - U.start;
6551
- O += he * re + he * I;
6552
+ M += he * re + he * I;
6552
6553
  }
6553
- V < $ && (O += ($ - V) * re, V = $);
6554
- const ce = Math.min(U.end, D);
6555
- for (let he = V; he <= ce && !(O >= T); he++)
6556
- L.push({ data: Y == null ? void 0 : Y[he], index: he, offset: O, size: re }), O += re + I;
6554
+ V < F && (M += (F - V) * re, V = F);
6555
+ const ce = Math.min(U.end, P);
6556
+ for (let he = V; he <= ce && !(M >= T); he++)
6557
+ L.push({ data: Y == null ? void 0 : Y[he], index: he, offset: M, size: re }), M += re + I;
6557
6558
  }
6558
6559
  });
6559
- return Fo(_, ne, E, I, G, F);
6560
+ return Fo(_, ne, E, I, G, $);
6560
6561
  }
6561
6562
  ),
6562
6563
  //@ts-expect-error filter needs to be fixed
@@ -6690,11 +6691,11 @@ const ar = Oe(
6690
6691
  Ie(t, c, n, s, o, r, a),
6691
6692
  Ie(e),
6692
6693
  ae(([[f, p, h, m, v, g, w, y], C]) => {
6693
- const { align: k, behavior: b, calculateViewLocation: S = iv, done: T, ...E } = f, N = ju(f, p, m - 1), A = Yr(N, p.offsetTree, C) + v + g, P = A + Zt(p.sizeTree, N)[1], H = y + g, F = y + h - w, I = S({
6694
- itemBottom: P,
6694
+ const { align: k, behavior: b, calculateViewLocation: S = iv, done: T, ...E } = f, N = ju(f, p, m - 1), A = Yr(N, p.offsetTree, C) + v + g, O = A + Zt(p.sizeTree, N)[1], H = y + g, $ = y + h - w, I = S({
6695
+ itemBottom: O,
6695
6696
  itemTop: A,
6696
6697
  locationParams: { align: k, behavior: b, ...E },
6697
- viewportBottom: F,
6698
+ viewportBottom: $,
6698
6699
  viewportTop: H
6699
6700
  });
6700
6701
  return I ? T && Jt(
@@ -6747,8 +6748,8 @@ const av = (e, t) => typeof e == "function" ? _l(e(t)) : t && _l(e), lv = Oe(
6747
6748
  dt(J(ve(t), tr(1)), c),
6748
6749
  Ie(ve(m), s, a, f),
6749
6750
  ae(([[b, S], T, E, N, A]) => {
6750
- let P = S && N, H = "auto";
6751
- return P && (H = av(T, E || A), P = P && !!H), { followOutputBehavior: H, shouldFollow: P, totalCount: b };
6751
+ let O = S && N, H = "auto";
6752
+ return O && (H = av(T, E || A), O = O && !!H), { followOutputBehavior: H, shouldFollow: O, totalCount: b };
6752
6753
  }),
6753
6754
  ye(({ shouldFollow: b }) => b)
6754
6755
  ),
@@ -7044,8 +7045,8 @@ const hv = zu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
7044
7045
  let N = 0, A = 0;
7045
7046
  for (; N < w; ) {
7046
7047
  N++, T += E;
7047
- let P = y.length === A + 1 ? 1 / 0 : y[A + 1] - y[A] - 1;
7048
- N + P > w && (T -= E, P = w - N + 1), N += P, T += S(P), A++;
7048
+ let O = y.length === A + 1 ? 1 / 0 : y[A + 1] - y[A] - 1;
7049
+ N + O > w && (T -= E, O = w - N + 1), N += O, T += S(O), A++;
7049
7050
  }
7050
7051
  return T;
7051
7052
  }
@@ -7375,17 +7376,17 @@ const wv = /* @__PURE__ */ Oe(() => {
7375
7376
  oa("deviation", (I) => {
7376
7377
  w !== I && y(I);
7377
7378
  });
7378
- const C = Te("EmptyPlaceholder"), k = Te("ScrollSeekPlaceholder") || bv, b = Te("ListComponent"), S = Te("ItemComponent"), T = Te("GroupComponent"), E = Te("computeItemKey"), N = Te("isSeeking"), A = Te("groupIndices").length > 0, P = Te("alignToBottom"), H = Te("initialItemFinalLocationReached"), F = e ? {} : {
7379
+ const C = Te("EmptyPlaceholder"), k = Te("ScrollSeekPlaceholder") || bv, b = Te("ListComponent"), S = Te("ItemComponent"), T = Te("GroupComponent"), E = Te("computeItemKey"), N = Te("isSeeking"), A = Te("groupIndices").length > 0, O = Te("alignToBottom"), H = Te("initialItemFinalLocationReached"), $ = e ? {} : {
7379
7380
  boxSizing: "border-box",
7380
7381
  ...v ? {
7381
7382
  display: "inline-block",
7382
7383
  height: "100%",
7383
- marginLeft: w !== 0 ? w : P ? "auto" : 0,
7384
+ marginLeft: w !== 0 ? w : O ? "auto" : 0,
7384
7385
  paddingLeft: t.offsetTop,
7385
7386
  paddingRight: t.offsetBottom,
7386
7387
  whiteSpace: "nowrap"
7387
7388
  } : {
7388
- marginTop: w !== 0 ? w : P ? "auto" : 0,
7389
+ marginTop: w !== 0 ? w : O ? "auto" : 0,
7389
7390
  paddingBottom: t.offsetBottom,
7390
7391
  paddingTop: t.offsetTop
7391
7392
  },
@@ -7397,7 +7398,7 @@ const wv = /* @__PURE__ */ Oe(() => {
7397
7398
  ...yt(b, l),
7398
7399
  "data-testid": e ? "virtuoso-top-item-list" : "virtuoso-item-list",
7399
7400
  ref: g,
7400
- style: F,
7401
+ style: $,
7401
7402
  children: (e ? t.topItems : t.items).map((I) => {
7402
7403
  const Y = I.originalIndex, G = E(Y + t.firstItemIndex, I.data, l);
7403
7404
  return N ? /* @__PURE__ */ No(
@@ -7718,24 +7719,24 @@ const Hv = /* @__PURE__ */ Oe(
7718
7719
  { customScrollParent: g, useWindowScroll: w, windowScrollContainerState: y, windowScrollTo: C, windowViewportRect: k },
7719
7720
  b
7720
7721
  ]) => {
7721
- const S = ee(0), T = ee(0), E = ee(Ml), N = ee({ height: 0, width: 0 }), A = ee({ height: 0, width: 0 }), P = _e(), H = _e(), F = ee(0), I = ee(null), Y = ee({ column: 0, row: 0 }), G = _e(), te = _e(), B = ee(!1), W = ee(0), ne = ee(!0), $ = ee(!1), j = ee(!1);
7722
+ const S = ee(0), T = ee(0), E = ee(Ml), N = ee({ height: 0, width: 0 }), A = ee({ height: 0, width: 0 }), O = _e(), H = _e(), $ = ee(0), I = ee(null), Y = ee({ column: 0, row: 0 }), G = _e(), te = _e(), B = ee(!1), W = ee(0), ne = ee(!0), F = ee(!1), j = ee(!1);
7722
7723
  Le(
7723
7724
  J(
7724
7725
  m,
7725
7726
  Ie(W),
7726
- ye(([O, V]) => !!V)
7727
+ ye(([M, V]) => !!V)
7727
7728
  ),
7728
7729
  () => {
7729
7730
  Re(ne, !1);
7730
7731
  }
7731
7732
  ), Le(
7732
7733
  J(
7733
- dt(m, ne, A, N, W, $),
7734
- ye(([O, V, re, ce, , he]) => O && !V && re.height !== 0 && ce.height !== 0 && !he)
7734
+ dt(m, ne, A, N, W, F),
7735
+ ye(([M, V, re, ce, , he]) => M && !V && re.height !== 0 && ce.height !== 0 && !he)
7735
7736
  ),
7736
- ([, , , , O]) => {
7737
- Re($, !0), Zi(1, () => {
7738
- Re(P, O);
7737
+ ([, , , , M]) => {
7738
+ Re(F, !0), Zi(1, () => {
7739
+ Re(O, M);
7739
7740
  }), Jt(J(l), () => {
7740
7741
  Re(t, [0, 0]), Re(ne, !0);
7741
7742
  });
@@ -7743,7 +7744,7 @@ const Hv = /* @__PURE__ */ Oe(
7743
7744
  ), de(
7744
7745
  J(
7745
7746
  te,
7746
- ye((O) => O != null && O.scrollTop > 0),
7747
+ ye((M) => M != null && M.scrollTop > 0),
7747
7748
  an(0)
7748
7749
  ),
7749
7750
  T
@@ -7751,17 +7752,17 @@ const Hv = /* @__PURE__ */ Oe(
7751
7752
  J(
7752
7753
  m,
7753
7754
  Ie(te),
7754
- ye(([, O]) => O != null)
7755
+ ye(([, M]) => M != null)
7755
7756
  ),
7756
- ([, O]) => {
7757
- O && (Re(N, O.viewport), Re(A, O.item), Re(Y, O.gap), O.scrollTop > 0 && (Re(B, !0), Jt(J(l, tr(1)), (V) => {
7757
+ ([, M]) => {
7758
+ M && (Re(N, M.viewport), Re(A, M.item), Re(Y, M.gap), M.scrollTop > 0 && (Re(B, !0), Jt(J(l, tr(1)), (V) => {
7758
7759
  Re(B, !1);
7759
- }), Re(c, { top: O.scrollTop })));
7760
+ }), Re(c, { top: M.scrollTop })));
7760
7761
  }
7761
7762
  ), de(
7762
7763
  J(
7763
7764
  N,
7764
- ae(({ height: O }) => O)
7765
+ ae(({ height: M }) => M)
7765
7766
  ),
7766
7767
  f
7767
7768
  ), de(
@@ -7769,14 +7770,14 @@ const Hv = /* @__PURE__ */ Oe(
7769
7770
  dt(
7770
7771
  ve(N, So),
7771
7772
  ve(A, So),
7772
- ve(Y, (O, V) => O && O.column === V.column && O.row === V.row),
7773
+ ve(Y, (M, V) => M && M.column === V.column && M.row === V.row),
7773
7774
  ve(l)
7774
7775
  ),
7775
- ae(([O, V, re, ce]) => ({
7776
+ ae(([M, V, re, ce]) => ({
7776
7777
  gap: re,
7777
7778
  item: V,
7778
7779
  scrollTop: ce,
7779
- viewport: O
7780
+ viewport: M
7780
7781
  }))
7781
7782
  ),
7782
7783
  G
@@ -7794,10 +7795,10 @@ const Hv = /* @__PURE__ */ Oe(
7794
7795
  ve(ne),
7795
7796
  ve(W)
7796
7797
  ),
7797
- ye(([, , , , , , , O]) => !O),
7798
+ ye(([, , , , , , , M]) => !M),
7798
7799
  ae(
7799
7800
  ([
7800
- O,
7801
+ M,
7801
7802
  [V, re],
7802
7803
  ce,
7803
7804
  he,
@@ -7809,16 +7810,16 @@ const Hv = /* @__PURE__ */ Oe(
7809
7810
  tt
7810
7811
  ]) => {
7811
7812
  const { column: $e, row: Ve } = ce, { height: ft, width: ht } = he, { width: mt } = ge;
7812
- if (ke === 0 && (O === 0 || mt === 0))
7813
+ if (ke === 0 && (M === 0 || mt === 0))
7813
7814
  return Ml;
7814
7815
  if (ht === 0) {
7815
- const Pt = Qi(tt, O), Ot = Pt + Math.max(ke - 1, 0);
7816
+ const Pt = Qi(tt, M), Ot = Pt + Math.max(ke - 1, 0);
7816
7817
  return zv($l(Pt, Ot, Ne));
7817
7818
  }
7818
7819
  const Be = Xu(mt, ht, $e);
7819
7820
  let it, at;
7820
- Ye ? V === 0 && re === 0 && ke > 0 ? (it = 0, at = ke - 1) : (it = Be * ns((V + Ve) / (ft + Ve)), at = Be * Dl((re + Ve) / (ft + Ve)) - 1, at = ei(O - 1, Br(at, Be - 1)), it = ei(at, Br(0, it))) : (it = 0, at = -1);
7821
- const Ct = $l(it, at, Ne), { bottom: Xe, top: He } = Fl(ge, ce, he, Ct), ut = Dl(O / Be), gt = ut * ft + (ut - 1) * Ve - Xe;
7821
+ Ye ? V === 0 && re === 0 && ke > 0 ? (it = 0, at = ke - 1) : (it = Be * ns((V + Ve) / (ft + Ve)), at = Be * Dl((re + Ve) / (ft + Ve)) - 1, at = ei(M - 1, Br(at, Be - 1)), it = ei(at, Br(0, it))) : (it = 0, at = -1);
7822
+ const Ct = $l(it, at, Ne), { bottom: Xe, top: He } = Fl(ge, ce, he, Ct), ut = Dl(M / Be), gt = ut * ft + (ut - 1) * Ve - Xe;
7822
7823
  return { bottom: Xe, itemHeight: ft, items: Ct, itemWidth: ht, offsetBottom: gt, offsetTop: He, top: He };
7823
7824
  }
7824
7825
  )
@@ -7827,47 +7828,47 @@ const Hv = /* @__PURE__ */ Oe(
7827
7828
  ), de(
7828
7829
  J(
7829
7830
  I,
7830
- ye((O) => O !== null),
7831
- ae((O) => O.length)
7831
+ ye((M) => M !== null),
7832
+ ae((M) => M.length)
7832
7833
  ),
7833
7834
  S
7834
7835
  ), de(
7835
7836
  J(
7836
7837
  dt(N, A, E, Y),
7837
- ye(([O, V, { items: re }]) => re.length > 0 && V.height !== 0 && O.height !== 0),
7838
- ae(([O, V, { items: re }, ce]) => {
7839
- const { bottom: he, top: ge } = Fl(O, ce, V, re);
7838
+ ye(([M, V, { items: re }]) => re.length > 0 && V.height !== 0 && M.height !== 0),
7839
+ ae(([M, V, { items: re }, ce]) => {
7840
+ const { bottom: he, top: ge } = Fl(M, ce, V, re);
7840
7841
  return [ge, he];
7841
7842
  }),
7842
7843
  Qe(Gr)
7843
7844
  ),
7844
7845
  t
7845
7846
  );
7846
- const D = ee(!1);
7847
+ const P = ee(!1);
7847
7848
  de(
7848
7849
  J(
7849
7850
  l,
7850
- Ie(D),
7851
- ae(([O, V]) => V || O !== 0)
7851
+ Ie(P),
7852
+ ae(([M, V]) => V || M !== 0)
7852
7853
  ),
7853
- D
7854
+ P
7854
7855
  );
7855
7856
  const _ = zt(
7856
7857
  J(
7857
7858
  dt(E, S),
7858
- ye(([{ items: O }]) => O.length > 0),
7859
- Ie(D),
7860
- ye(([[O, V], re]) => {
7861
- const ce = O.items[O.items.length - 1].index === V - 1;
7862
- return (re || O.bottom > 0 && O.itemHeight > 0 && O.offsetBottom === 0 && O.items.length === V) && ce;
7859
+ ye(([{ items: M }]) => M.length > 0),
7860
+ Ie(P),
7861
+ ye(([[M, V], re]) => {
7862
+ const ce = M.items[M.items.length - 1].index === V - 1;
7863
+ return (re || M.bottom > 0 && M.itemHeight > 0 && M.offsetBottom === 0 && M.items.length === V) && ce;
7863
7864
  }),
7864
- ae(([[, O]]) => O - 1),
7865
+ ae(([[, M]]) => M - 1),
7865
7866
  Qe()
7866
7867
  )
7867
7868
  ), L = zt(
7868
7869
  J(
7869
7870
  ve(E),
7870
- ye(({ items: O }) => O.length > 0 && O[0].index === 0),
7871
+ ye(({ items: M }) => M.length > 0 && M[0].index === 0),
7871
7872
  an(0),
7872
7873
  Qe()
7873
7874
  )
@@ -7875,10 +7876,10 @@ const Hv = /* @__PURE__ */ Oe(
7875
7876
  J(
7876
7877
  ve(E),
7877
7878
  Ie(B),
7878
- ye(([{ items: O }, V]) => O.length > 0 && !V),
7879
- ae(([{ items: O }]) => ({
7880
- endIndex: O[O.length - 1].index,
7881
- startIndex: O[0].index
7879
+ ye(([{ items: M }, V]) => M.length > 0 && !V),
7880
+ ae(([{ items: M }]) => ({
7881
+ endIndex: M[M.length - 1].index,
7882
+ startIndex: M[0].index
7882
7883
  })),
7883
7884
  Qe(Iu),
7884
7885
  wn(0)
@@ -7886,10 +7887,10 @@ const Hv = /* @__PURE__ */ Oe(
7886
7887
  );
7887
7888
  de(U, h.scrollSeekRangeChanged), de(
7888
7889
  J(
7889
- P,
7890
+ O,
7890
7891
  Ie(N, A, S, Y),
7891
- ae(([O, V, re, ce, he]) => {
7892
- const ge = Pu(O), { align: Ne, behavior: ke, offset: Ye } = ge;
7892
+ ae(([M, V, re, ce, he]) => {
7893
+ const ge = Pu(M), { align: Ne, behavior: ke, offset: Ye } = ge;
7893
7894
  let tt = ge.index;
7894
7895
  tt === "LAST" && (tt = ce - 1), tt = Br(0, tt, ei(ce - 1, tt));
7895
7896
  let $e = Ai(V, he, re, tt);
@@ -7901,21 +7902,21 @@ const Hv = /* @__PURE__ */ Oe(
7901
7902
  const K = St(
7902
7903
  J(
7903
7904
  E,
7904
- ae((O) => O.offsetBottom + O.bottom)
7905
+ ae((M) => M.offsetBottom + M.bottom)
7905
7906
  ),
7906
7907
  0
7907
7908
  );
7908
7909
  return de(
7909
7910
  J(
7910
7911
  k,
7911
- ae((O) => ({ height: O.visibleHeight, width: O.visibleWidth }))
7912
+ ae((M) => ({ height: M.visibleHeight, width: M.visibleWidth }))
7912
7913
  ),
7913
7914
  N
7914
7915
  ), {
7915
7916
  customScrollParent: g,
7916
7917
  // input
7917
7918
  data: I,
7918
- deviation: F,
7919
+ deviation: $,
7919
7920
  footerHeight: o,
7920
7921
  gap: Y,
7921
7922
  headerHeight: s,
@@ -7928,7 +7929,7 @@ const Hv = /* @__PURE__ */ Oe(
7928
7929
  scrollContainerState: a,
7929
7930
  scrollHeight: H,
7930
7931
  scrollTo: c,
7931
- scrollToIndex: P,
7932
+ scrollToIndex: O,
7932
7933
  scrollTop: l,
7933
7934
  smoothScrollTargetReached: u,
7934
7935
  totalCount: S,
@@ -8278,24 +8279,24 @@ function ti({
8278
8279
  contentOverride: i = null
8279
8280
  }) {
8280
8281
  var H;
8281
- const { toolRenderers: a, toolArtifactRenderers: c } = r ?? {}, l = Pc(e), u = s ?? e.artifact ?? null, f = Array.isArray(i) ? i : e.content, p = ow(e), h = f.length > 0 ? f[0] : void 0, m = (F) => {
8282
- if (F == null) return null;
8283
- const I = typeof F == "string" ? F : (() => {
8282
+ const { toolRenderers: a, toolArtifactRenderers: c } = r ?? {}, l = Pc(e), u = s ?? e.artifact ?? null, f = Array.isArray(i) ? i : e.content, p = ow(e), h = f.length > 0 ? f[0] : void 0, m = ($) => {
8283
+ if ($ == null) return null;
8284
+ const I = typeof $ == "string" ? $ : (() => {
8284
8285
  try {
8285
- return JSON.stringify(F, null, 2);
8286
+ return JSON.stringify($, null, 2);
8286
8287
  } catch {
8287
- return String(F);
8288
+ return String($);
8288
8289
  }
8289
8290
  })();
8290
8291
  return /* @__PURE__ */ d.jsx("pre", { className: "whitespace-pre-wrap break-words font-sans text-xs text-muted-foreground/80 bg-muted/30 p-2 rounded border border-border/50", children: I });
8291
- }, v = (F) => m(F), g = () => {
8292
+ }, v = ($) => m($), g = () => {
8292
8293
  if ((p == null ? void 0 : p.kind) === "generic")
8293
8294
  return v(p.value);
8294
8295
  if (!h)
8295
8296
  return null;
8296
8297
  if (h.type === "text") {
8297
- const F = h.text ?? "";
8298
- return F ? v(F) : null;
8298
+ const $ = h.text ?? "";
8299
+ return $ ? v($) : null;
8299
8300
  }
8300
8301
  return v(h);
8301
8302
  }, w = () => (p == null ? void 0 : p.kind) === "dict" ? v(p.data) : g(), C = (() => {
@@ -8306,9 +8307,9 @@ function ti({
8306
8307
  if (I)
8307
8308
  return I;
8308
8309
  }
8309
- const F = p == null ? void 0 : p.kind;
8310
- if (F) {
8311
- const I = a[F];
8310
+ const $ = p == null ? void 0 : p.kind;
8311
+ if ($) {
8312
+ const I = a[$];
8312
8313
  if (I)
8313
8314
  return I;
8314
8315
  }
@@ -8322,9 +8323,9 @@ function ti({
8322
8323
  }) : null) ?? null, E = (() => {
8323
8324
  if (!c)
8324
8325
  return;
8325
- const F = u == null ? void 0 : u.type;
8326
- if (typeof F == "string") {
8327
- const I = c[F];
8326
+ const $ = u == null ? void 0 : u.type;
8327
+ if (typeof $ == "string") {
8328
+ const I = c[$];
8328
8329
  if (I)
8329
8330
  return I;
8330
8331
  }
@@ -8334,7 +8335,7 @@ function ti({
8334
8335
  message: e,
8335
8336
  toolPayload: p,
8336
8337
  isStreaming: n
8337
- }) : null, A = S ?? k, P = E ? N : null;
8338
+ }) : null, A = S ?? k, O = E ? N : null;
8338
8339
  return /* @__PURE__ */ d.jsxs("div", { className: "space-y-2", children: [
8339
8340
  n && /* @__PURE__ */ d.jsx(
8340
8341
  Qv,
@@ -8343,7 +8344,7 @@ function ti({
8343
8344
  showPartialData: !1
8344
8345
  }
8345
8346
  ),
8346
- u && P,
8347
+ u && O,
8347
8348
  b && (((H = r == null ? void 0 : r.getShowContent) == null ? void 0 : H.call(r, e)) ?? !0) ? A : null
8348
8349
  ] });
8349
8350
  }
@@ -10427,12 +10428,12 @@ const Rs = to(function({
10427
10428
  };
10428
10429
  }, [C, k]), S = ze(() => {
10429
10430
  if (!b) return null;
10430
- const { stablePart: H, tailPart: F } = b;
10431
- return !H && !F ? null : /* @__PURE__ */ d.jsxs("div", { className: "space-y-2", children: [
10431
+ const { stablePart: H, tailPart: $ } = b;
10432
+ return !H && !$ ? null : /* @__PURE__ */ d.jsxs("div", { className: "space-y-2", children: [
10432
10433
  H ? /* @__PURE__ */ d.jsx(Bo, { content: H, allowHtml: !1 }) : null,
10433
- F ? /* @__PURE__ */ d.jsx(Bo, { content: F, allowHtml: !1 }) : null
10434
+ $ ? /* @__PURE__ */ d.jsx(Bo, { content: $, allowHtml: !1 }) : null
10434
10435
  ] });
10435
- }, [b]), T = () => !r || r.length === 0 ? null : /* @__PURE__ */ d.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: r.map((H, F) => {
10436
+ }, [b]), T = () => !r || r.length === 0 ? null : /* @__PURE__ */ d.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: r.map((H, $) => {
10436
10437
  const I = H;
10437
10438
  return /* @__PURE__ */ d.jsx("div", { className: "relative group", children: /* @__PURE__ */ d.jsx(
10438
10439
  "img",
@@ -10443,11 +10444,11 @@ const Rs = to(function({
10443
10444
  onClick: () => window.open(I.image_url.url, "_blank"),
10444
10445
  className: "h-20 w-20 object-cover rounded-md border border-border/50 cursor-pointer hover:opacity-90 transition-opacity"
10445
10446
  }
10446
- ) }, `img-${F}`);
10447
- }) }), E = (H, F) => {
10447
+ ) }, `img-${$}`);
10448
+ }) }), E = (H, $) => {
10448
10449
  if (H.type === "text") {
10449
10450
  const I = H.text ?? "", Y = I.trim(), G = hs(Y);
10450
- return G && s !== "tool" ? /* @__PURE__ */ d.jsx(tw, { data: G }, F) : s === "user" && a && Y.length > c && !l ? /* @__PURE__ */ d.jsx(
10451
+ return G && s !== "tool" ? /* @__PURE__ */ d.jsx(tw, { data: G }, $) : s === "user" && a && Y.length > c && !l ? /* @__PURE__ */ d.jsx(
10451
10452
  kw,
10452
10453
  {
10453
10454
  text: Y,
@@ -10457,16 +10458,16 @@ const Rs = to(function({
10457
10458
  previewLength: c,
10458
10459
  isCompact: i
10459
10460
  },
10460
- F
10461
- ) : /* @__PURE__ */ d.jsx(Bo, { content: I, allowHtml: !1 }, F);
10461
+ $
10462
+ ) : /* @__PURE__ */ d.jsx(Bo, { content: I, allowHtml: !1 }, $);
10462
10463
  }
10463
10464
  if (H.type === "file") {
10464
- const I = H, Y = I.name || "file", G = f[F];
10465
+ const I = H, Y = I.name || "file", G = f[$];
10465
10466
  return /* @__PURE__ */ d.jsxs(
10466
10467
  "a",
10467
10468
  {
10468
10469
  href: I.url,
10469
- onClick: (te) => p == null ? void 0 : p(te, I, F),
10470
+ onClick: (te) => p == null ? void 0 : p(te, I, $),
10470
10471
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
10471
10472
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
10472
10473
  children: [
@@ -10477,16 +10478,16 @@ const Rs = to(function({
10477
10478
  ] })
10478
10479
  ]
10479
10480
  },
10480
- F
10481
+ $
10481
10482
  );
10482
10483
  }
10483
10484
  return null;
10484
10485
  }, N = k ? C : n;
10485
10486
  if (!(N.trim().length > 0 || r.length > 0 || o.length > 0) && !h) return null;
10486
- const P = k ? w.filter((H) => H.type !== "text") : w;
10487
+ const O = k ? w.filter((H) => H.type !== "text") : w;
10487
10488
  return /* @__PURE__ */ d.jsxs("div", { className: "space-y-2", children: [
10488
10489
  k ? S : null,
10489
- P.filter((H) => H.type === "text" || H.type === "file").map((H, F) => E(H, F)),
10490
+ O.filter((H) => H.type === "text" || H.type === "file").map((H, $) => E(H, $)),
10490
10491
  T(),
10491
10492
  h && N.trim().length > 0 && /* @__PURE__ */ d.jsx(
10492
10493
  "span",
@@ -10614,10 +10615,10 @@ const hd = to(function({
10614
10615
  renderArtifactsInline: E,
10615
10616
  streamingDebounceMs: N,
10616
10617
  onRegenerate: A,
10617
- getInterruptOptions: P,
10618
+ getInterruptOptions: O,
10618
10619
  showToolMessages: H,
10619
- messageCustomStyles: F
10620
- } = Ki(), I = l ?? T, Y = a ?? S, G = m ?? E, te = o ?? N ?? 0, B = f ?? A, W = h ?? P, ne = c ?? H ?? !0, $ = v ?? ne, j = g ?? ne, D = { ...(F == null ? void 0 : F(t)) || {}, ...u }, _ = p, [L, U] = ue(!1), { respondToInterrupt: K, interrupt: O } = co(), [V, re] = ue(!1), ce = Y === "phone" || Y === "half-screen", {
10620
+ messageCustomStyles: $
10621
+ } = Ki(), I = l ?? T, Y = a ?? S, G = m ?? E, te = o ?? N ?? 0, B = f ?? A, W = h ?? O, ne = c ?? H ?? !0, F = v ?? ne, j = g ?? ne, P = { ...($ == null ? void 0 : $(t)) || {}, ...u }, _ = p, [L, U] = ue(!1), { respondToInterrupt: K, interrupt: M } = co(), [V, re] = ue(!1), ce = Y === "phone" || Y === "half-screen", {
10621
10622
  contentParts: he,
10622
10623
  textContent: ge,
10623
10624
  imageParts: Ne,
@@ -10632,7 +10633,7 @@ const hd = to(function({
10632
10633
  }
10633
10634
  }, [ge, _]), $e = ie(
10634
10635
  async (He, ut) => {
10635
- if (!(!O || !O.id)) {
10636
+ if (!(!M || !M.id)) {
10636
10637
  re(!0);
10637
10638
  try {
10638
10639
  const Pt = W == null ? void 0 : W(t);
@@ -10642,10 +10643,10 @@ const hd = to(function({
10642
10643
  }
10643
10644
  }
10644
10645
  },
10645
- [O, t, W, K]
10646
+ [M, t, W, K]
10646
10647
  ), Ve = ie(() => {
10647
10648
  B == null || B(n);
10648
- }, [B, n]), ft = !w && (C ?? ((Ct = I == null ? void 0 : I.getShowHeader) == null ? void 0 : Ct.call(I, t)) ?? !0), ht = !k && t.role === "assistant" && $ ? /* @__PURE__ */ d.jsx(
10649
+ }, [B, n]), ft = !w && (C ?? ((Ct = I == null ? void 0 : I.getShowHeader) == null ? void 0 : Ct.call(I, t)) ?? !0), ht = !k && t.role === "assistant" && F ? /* @__PURE__ */ d.jsx(
10649
10650
  sw,
10650
10651
  {
10651
10652
  messages: [...y, t],
@@ -10678,7 +10679,7 @@ const hd = to(function({
10678
10679
  },
10679
10680
  messageCreatedAt: t.createdAt,
10680
10681
  copied: L,
10681
- customActionsClass: D.actions
10682
+ customActionsClass: P.actions
10682
10683
  }
10683
10684
  ), Be = t.role === "tool", it = Be ? /* @__PURE__ */ d.jsx(
10684
10685
  ti,
@@ -10742,7 +10743,7 @@ const hd = to(function({
10742
10743
  message: t,
10743
10744
  isStreamingMessage: r,
10744
10745
  toolConfig: I,
10745
- interrupt: O,
10746
+ interrupt: M,
10746
10747
  onApprove: () => $e(!0),
10747
10748
  onReject: () => $e(!1),
10748
10749
  onSelectAlternative: (He, ut) => $e(!0, { alternativeId: ut == null ? void 0 : ut.id }),
@@ -10762,7 +10763,7 @@ const hd = to(function({
10762
10763
  status: ht,
10763
10764
  content: at,
10764
10765
  isCompactLayout: ce,
10765
- customStyles: D
10766
+ customStyles: P
10766
10767
  }
10767
10768
  );
10768
10769
  });
@@ -10781,23 +10782,23 @@ const md = to(function({
10781
10782
  const [u, f] = ue(!1), [p, h] = ue(!1), m = n === "phone" || n === "half-screen", { contentParts: v, textContent: g, imageParts: w, fileParts: y } = aa(t), C = ie(async () => {
10782
10783
  try {
10783
10784
  await navigator.clipboard.writeText(g), f(!0), setTimeout(() => f(!1), 2e3);
10784
- } catch (F) {
10785
- console.error("Failed to copy user message:", F);
10785
+ } catch ($) {
10786
+ console.error("Failed to copy user message:", $);
10786
10787
  }
10787
10788
  }, [g]), k = ie(() => {
10788
10789
  if (!i || !t.id) return;
10789
- const F = {
10790
+ const $ = {
10790
10791
  checkpointId: t.checkpointId ?? null,
10791
10792
  checkpointNs: t.checkpointNs ?? null
10792
10793
  };
10793
- i(t.id, g, F);
10794
+ i(t.id, g, $);
10794
10795
  }, [i, t, g]), { attemptCount: b, attemptIndex: S, attempts: T } = ze(() => a ? cx(t.id, t.checkpointId, a) : { attemptCount: 1, attemptIndex: 0, attempts: [] }, [t.id, t.checkpointId, a]), E = b > 1 && !!c, N = ie(() => {
10795
- const F = T[S + 1];
10796
- F && c && c(F.id, void 0, !!F.isLatestAttempt);
10796
+ const $ = T[S + 1];
10797
+ $ && c && c($.id, void 0, !!$.isLatestAttempt);
10797
10798
  }, [T, S, c]), A = ie(() => {
10798
- const F = T[S - 1];
10799
- F && c && c(F.id, void 0, !!F.isLatestAttempt);
10800
- }, [T, S, c]), P = /* @__PURE__ */ d.jsx(
10799
+ const $ = T[S - 1];
10800
+ $ && c && c($.id, void 0, !!$.isLatestAttempt);
10801
+ }, [T, S, c]), O = /* @__PURE__ */ d.jsx(
10801
10802
  fd,
10802
10803
  {
10803
10804
  showTimestamp: !0,
@@ -10844,7 +10845,7 @@ const md = to(function({
10844
10845
  Is,
10845
10846
  {
10846
10847
  role: "user",
10847
- header: P,
10848
+ header: O,
10848
10849
  content: H,
10849
10850
  isCompactLayout: m,
10850
10851
  customStyles: l
@@ -10913,7 +10914,7 @@ const xd = Z.forwardRef(({
10913
10914
  };
10914
10915
  }, [n]), C = ze(() => !u || p ? !1 : "auto", [u, p]), k = e.length === 0 && s, b = ["flex flex-1 flex-col min-h-0 min-w-0", r].filter(Boolean).join(" "), S = () => k ? /* @__PURE__ */ d.jsx("div", { className: "h-full w-full", children: s }) : /* @__PURE__ */ d.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: "No messages yet. Start a conversation!" }), T = e.length, E = T > 0;
10915
10916
  We(() => {
10916
- var A, P;
10917
+ var A, O;
10917
10918
  if (T === 0) {
10918
10919
  g.current = !1;
10919
10920
  return;
@@ -10921,27 +10922,27 @@ const xd = Z.forwardRef(({
10921
10922
  if (!g.current)
10922
10923
  if (g.current = !0, h.current && e.length > 0) {
10923
10924
  const H = e.length - 1;
10924
- (P = (A = h.current).scrollToIndex) == null || P.call(A, { index: H, align: "end", behavior: "auto" });
10925
+ (O = (A = h.current).scrollToIndex) == null || O.call(A, { index: H, align: "end", behavior: "auto" });
10925
10926
  } else m.current && (m.current.scrollTop = m.current.scrollHeight);
10926
10927
  }, [T, e.length]), ah(l, () => ({
10927
10928
  scrollToLatest: () => {
10928
- var A, P;
10929
+ var A, O;
10929
10930
  if (h.current && e.length > 0) {
10930
10931
  const H = e.length - 1;
10931
- (P = (A = h.current).scrollToIndex) == null || P.call(A, { index: H, align: "end", behavior: "auto" });
10932
+ (O = (A = h.current).scrollToIndex) == null || O.call(A, { index: H, align: "end", behavior: "auto" });
10932
10933
  } else m.current && (m.current.scrollTop = m.current.scrollHeight);
10933
10934
  },
10934
10935
  scrollToTop: () => {
10935
- var A, P;
10936
- h.current && e.length > 0 ? (P = (A = h.current).scrollToIndex) == null || P.call(A, { index: 0, align: "start", behavior: "auto" }) : m.current && (m.current.scrollTop = 0);
10936
+ var A, O;
10937
+ h.current && e.length > 0 ? (O = (A = h.current).scrollToIndex) == null || O.call(A, { index: 0, align: "start", behavior: "auto" }) : m.current && (m.current.scrollTop = 0);
10937
10938
  }
10938
10939
  }), [e]);
10939
- const N = ie((A, P) => A.role === "user" ? /* @__PURE__ */ d.jsx(md, { message: A, messageIndex: P }) : A.role === "system" ? /* @__PURE__ */ d.jsx(gd, { message: A }) : /* @__PURE__ */ d.jsx(
10940
+ const N = ie((A, O) => A.role === "user" ? /* @__PURE__ */ d.jsx(md, { message: A, messageIndex: O }) : A.role === "system" ? /* @__PURE__ */ d.jsx(gd, { message: A }) : /* @__PURE__ */ d.jsx(
10940
10941
  hd,
10941
10942
  {
10942
10943
  message: A,
10943
- messageIndex: P,
10944
- isStreamingMessage: t && P === e.length - 1
10944
+ messageIndex: O,
10945
+ isStreamingMessage: t && O === e.length - 1
10945
10946
  }
10946
10947
  ), [t, e.length]);
10947
10948
  return /* @__PURE__ */ d.jsx("div", { className: b, style: o, children: /* @__PURE__ */ d.jsx("div", { className: "relative flex-1 min-h-0 min-w-0", children: E ? /* @__PURE__ */ d.jsx(
@@ -10959,8 +10960,8 @@ const xd = Z.forwardRef(({
10959
10960
  },
10960
10961
  atBottomStateChange: w,
10961
10962
  style: { height: "100%", width: "100%", overscrollBehavior: "contain" },
10962
- computeItemKey: (A, P) => P.id || A,
10963
- itemContent: (A, P) => c ? c(P, A) : N(P, A)
10963
+ computeItemKey: (A, O) => O.id || A,
10964
+ itemContent: (A, O) => c ? c(O, A) : N(O, A)
10964
10965
  }
10965
10966
  ) : S() }) });
10966
10967
  });
@@ -11750,7 +11751,7 @@ const dy = (e) => ({
11750
11751
  }, h = pa(o), m = fa(h), v = await i.getDimensions(l), g = h === "y", w = g ? "top" : "left", y = g ? "bottom" : "right", C = g ? "clientHeight" : "clientWidth", k = s.reference[m] + s.reference[h] - p[h] - s.floating[m], b = p[h] - s.reference[h], S = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(l));
11751
11752
  let T = S ? S[C] : 0;
11752
11753
  (!T || !await (i.isElement == null ? void 0 : i.isElement(S))) && (T = a.floating[C] || s.floating[m]);
11753
- const E = k / 2 - b / 2, N = T / 2 - v[m] / 2 - 1, A = Pn(f[w], N), P = Pn(f[y], N), H = A, F = T - v[m] - P, I = T / 2 - v[m] / 2 + E, Y = _i(H, I, F), G = !c.arrow && Nr(o) != null && I !== Y && s.reference[m] / 2 - (I < H ? A : P) - v[m] / 2 < 0, te = G ? I < H ? I - H : I - F : 0;
11754
+ const E = k / 2 - b / 2, N = T / 2 - v[m] / 2 - 1, A = Pn(f[w], N), O = Pn(f[y], N), H = A, $ = T - v[m] - O, I = T / 2 - v[m] / 2 + E, Y = _i(H, I, $), G = !c.arrow && Nr(o) != null && I !== Y && s.reference[m] / 2 - (I < H ? A : O) - v[m] / 2 < 0, te = G ? I < H ? I - H : I - $ : 0;
11754
11755
  return {
11755
11756
  [h]: p[h] + te,
11756
11757
  data: {
@@ -11799,8 +11800,8 @@ const dy = (e) => ({
11799
11800
  placement: o,
11800
11801
  overflows: N
11801
11802
  }], !N.every((I) => I <= 0)) {
11802
- var P, H;
11803
- const I = (((P = s.flip) == null ? void 0 : P.index) || 0) + 1, Y = T[I];
11803
+ var O, H;
11804
+ const I = (((O = s.flip) == null ? void 0 : O.index) || 0) + 1, Y = T[I];
11804
11805
  if (Y && (!(f === "alignment" ? y !== un(Y) : !1) || // We leave the current main axis only if every placement on that axis
11805
11806
  // overflows the main axis.
11806
11807
  A.every((B) => un(B.placement) === y ? B.overflows[0] > 0 : !0)))
@@ -11817,8 +11818,8 @@ const dy = (e) => ({
11817
11818
  if (!G)
11818
11819
  switch (h) {
11819
11820
  case "bestFit": {
11820
- var F;
11821
- const te = (F = A.filter((B) => {
11821
+ var $;
11822
+ const te = ($ = A.filter((B) => {
11822
11823
  if (S) {
11823
11824
  const W = un(B.placement);
11824
11825
  return W === y || // Create a bias to the `y` side axis due to horizontal
@@ -11826,7 +11827,7 @@ const dy = (e) => ({
11826
11827
  W === "y";
11827
11828
  }
11828
11829
  return !0;
11829
- }).map((B) => [B.placement, B.overflows.filter((W) => W > 0).reduce((W, ne) => W + ne, 0)]).sort((B, W) => B[1] - W[1])[0]) == null ? void 0 : F[0];
11830
+ }).map((B) => [B.placement, B.overflows.filter((W) => W > 0).reduce((W, ne) => W + ne, 0)]).sort((B, W) => B[1] - W[1])[0]) == null ? void 0 : $[0];
11830
11831
  te && (G = te);
11831
11832
  break;
11832
11833
  }
@@ -12069,8 +12070,8 @@ const my = function(e) {
12069
12070
  const y = v - u.top - u.bottom, C = m - u.left - u.right, k = Pn(v - u[g], y), b = Pn(m - u[w], C), S = !t.middlewareData.shift;
12070
12071
  let T = k, E = b;
12071
12072
  if ((n = t.middlewareData.shift) != null && n.enabled.x && (E = C), (r = t.middlewareData.shift) != null && r.enabled.y && (T = y), S && !p) {
12072
- const A = $t(u.left, 0), P = $t(u.right, 0), H = $t(u.top, 0), F = $t(u.bottom, 0);
12073
- h ? E = m - 2 * (A !== 0 || P !== 0 ? A + P : $t(u.left, u.right)) : T = v - 2 * (H !== 0 || F !== 0 ? H + F : $t(u.top, u.bottom));
12073
+ const A = $t(u.left, 0), O = $t(u.right, 0), H = $t(u.top, 0), $ = $t(u.bottom, 0);
12074
+ h ? E = m - 2 * (A !== 0 || O !== 0 ? A + O : $t(u.left, u.right)) : T = v - 2 * (H !== 0 || $ !== 0 ? H + $ : $t(u.top, u.bottom));
12074
12075
  }
12075
12076
  await c({
12076
12077
  ...t,
@@ -12658,7 +12659,7 @@ function eb(e) {
12658
12659
  B !== S.current && (S.current = B, v(B));
12659
12660
  }, []), C = x.useCallback((B) => {
12660
12661
  B !== T.current && (T.current = B, w(B));
12661
- }, []), k = s || m, b = i || g, S = x.useRef(null), T = x.useRef(null), E = x.useRef(u), N = c != null, A = ii(c), P = ii(o), H = ii(l), F = x.useCallback(() => {
12662
+ }, []), k = s || m, b = i || g, S = x.useRef(null), T = x.useRef(null), E = x.useRef(u), N = c != null, A = ii(c), O = ii(o), H = ii(l), $ = x.useCallback(() => {
12662
12663
  if (!S.current || !T.current)
12663
12664
  return;
12664
12665
  const B = {
@@ -12666,7 +12667,7 @@ function eb(e) {
12666
12667
  strategy: n,
12667
12668
  middleware: p
12668
12669
  };
12669
- P.current && (B.platform = P.current), Jy(S.current, T.current, B).then((W) => {
12670
+ O.current && (B.platform = O.current), Jy(S.current, T.current, B).then((W) => {
12670
12671
  const ne = {
12671
12672
  ...W,
12672
12673
  // The floating element's position may be recomputed while it's closed
@@ -12679,7 +12680,7 @@ function eb(e) {
12679
12680
  f(ne);
12680
12681
  }));
12681
12682
  });
12682
- }, [p, t, n, P, H]);
12683
+ }, [p, t, n, O, H]);
12683
12684
  Ho(() => {
12684
12685
  l === !1 && E.current.isPositioned && (E.current.isPositioned = !1, f((B) => ({
12685
12686
  ...B,
@@ -12692,10 +12693,10 @@ function eb(e) {
12692
12693
  }), []), Ho(() => {
12693
12694
  if (k && (S.current = k), b && (T.current = b), k && b) {
12694
12695
  if (A.current)
12695
- return A.current(k, b, F);
12696
- F();
12696
+ return A.current(k, b, $);
12697
+ $();
12697
12698
  }
12698
- }, [k, b, F, A, N]);
12699
+ }, [k, b, $, A, N]);
12699
12700
  const Y = x.useMemo(() => ({
12700
12701
  reference: S,
12701
12702
  floating: T,
@@ -12727,11 +12728,11 @@ function eb(e) {
12727
12728
  }, [n, a, G.floating, u.x, u.y]);
12728
12729
  return x.useMemo(() => ({
12729
12730
  ...u,
12730
- update: F,
12731
+ update: $,
12731
12732
  refs: Y,
12732
12733
  elements: G,
12733
12734
  floatingStyles: te
12734
- }), [u, F, Y, G, te]);
12735
+ }), [u, $, Y, G, te]);
12735
12736
  }
12736
12737
  const tb = (e) => {
12737
12738
  function t(n) {
@@ -12832,7 +12833,7 @@ var zd = "PopperAnchor", Bd = x.forwardRef(
12832
12833
  Bd.displayName = zd;
12833
12834
  var va = "PopperContent", [pb, hb] = Dd(va), Hd = x.forwardRef(
12834
12835
  (e, t) => {
12835
- var K, O, V, re, ce, he;
12836
+ var K, M, V, re, ce, he;
12836
12837
  const {
12837
12838
  __scopePopper: n,
12838
12839
  side: r = "bottom",
@@ -12848,9 +12849,9 @@ var va = "PopperContent", [pb, hb] = Dd(va), Hd = x.forwardRef(
12848
12849
  updatePositionStrategy: h = "optimized",
12849
12850
  onPlaced: m,
12850
12851
  ...v
12851
- } = e, g = $d(va, n), [w, y] = x.useState(null), C = ot(t, (ge) => y(ge)), [k, b] = x.useState(null), S = db(k), T = (S == null ? void 0 : S.width) ?? 0, E = (S == null ? void 0 : S.height) ?? 0, N = r + (s !== "center" ? "-" + s : ""), A = typeof u == "number" ? u : { top: 0, right: 0, bottom: 0, left: 0, ...u }, P = Array.isArray(l) ? l : [l], H = P.length > 0, F = {
12852
+ } = e, g = $d(va, n), [w, y] = x.useState(null), C = ot(t, (ge) => y(ge)), [k, b] = x.useState(null), S = db(k), T = (S == null ? void 0 : S.width) ?? 0, E = (S == null ? void 0 : S.height) ?? 0, N = r + (s !== "center" ? "-" + s : ""), A = typeof u == "number" ? u : { top: 0, right: 0, bottom: 0, left: 0, ...u }, O = Array.isArray(l) ? l : [l], H = O.length > 0, $ = {
12852
12853
  padding: A,
12853
- boundary: P.filter(gb),
12854
+ boundary: O.filter(gb),
12854
12855
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
12855
12856
  altBoundary: H
12856
12857
  }, { refs: I, floatingStyles: Y, placement: G, isPositioned: te, middlewareData: B } = eb({
@@ -12869,11 +12870,11 @@ var va = "PopperContent", [pb, hb] = Dd(va), Hd = x.forwardRef(
12869
12870
  mainAxis: !0,
12870
12871
  crossAxis: !1,
12871
12872
  limiter: f === "partial" ? ob() : void 0,
12872
- ...F
12873
+ ...$
12873
12874
  }),
12874
- c && sb({ ...F }),
12875
+ c && sb({ ...$ }),
12875
12876
  ib({
12876
- ...F,
12877
+ ...$,
12877
12878
  apply: ({ elements: ge, rects: Ne, availableWidth: ke, availableHeight: Ye }) => {
12878
12879
  const { width: tt, height: $e } = Ne.reference, Ve = ge.floating.style;
12879
12880
  Ve.setProperty("--radix-popper-available-width", `${ke}px`), Ve.setProperty("--radix-popper-available-height", `${Ye}px`), Ve.setProperty("--radix-popper-anchor-width", `${tt}px`), Ve.setProperty("--radix-popper-anchor-height", `${$e}px`);
@@ -12881,13 +12882,13 @@ var va = "PopperContent", [pb, hb] = Dd(va), Hd = x.forwardRef(
12881
12882
  }),
12882
12883
  k && lb({ element: k, padding: a }),
12883
12884
  xb({ arrowWidth: T, arrowHeight: E }),
12884
- p && ab({ strategy: "referenceHidden", ...F })
12885
+ p && ab({ strategy: "referenceHidden", ...$ })
12885
12886
  ]
12886
- }), [W, ne] = Vd(G), $ = bt(m);
12887
+ }), [W, ne] = Vd(G), F = bt(m);
12887
12888
  fn(() => {
12888
- te && ($ == null || $());
12889
- }, [te, $]);
12890
- const j = (K = B.arrow) == null ? void 0 : K.x, D = (O = B.arrow) == null ? void 0 : O.y, _ = ((V = B.arrow) == null ? void 0 : V.centerOffset) !== 0, [L, U] = x.useState();
12889
+ te && (F == null || F());
12890
+ }, [te, F]);
12891
+ const j = (K = B.arrow) == null ? void 0 : K.x, P = (M = B.arrow) == null ? void 0 : M.y, _ = ((V = B.arrow) == null ? void 0 : V.centerOffset) !== 0, [L, U] = x.useState();
12891
12892
  return fn(() => {
12892
12893
  w && U(window.getComputedStyle(w).zIndex);
12893
12894
  }, [w]), /* @__PURE__ */ d.jsx(
@@ -12921,7 +12922,7 @@ var va = "PopperContent", [pb, hb] = Dd(va), Hd = x.forwardRef(
12921
12922
  placedSide: W,
12922
12923
  onArrowChange: b,
12923
12924
  arrowX: j,
12924
- arrowY: D,
12925
+ arrowY: P,
12925
12926
  shouldHideArrow: _,
12926
12927
  children: /* @__PURE__ */ d.jsx(
12927
12928
  je.div,
@@ -13152,7 +13153,7 @@ var jb = x.forwardRef((e, t) => {
13152
13153
  if (E.target === E.currentTarget && N && !w) {
13153
13154
  const A = new CustomEvent(ai, Eb);
13154
13155
  if (E.currentTarget.dispatchEvent(A), !A.defaultPrevented) {
13155
- const P = k().filter((G) => G.focusable), H = P.find((G) => G.active), F = P.find((G) => G.id === v), Y = [H, F, ...P].filter(
13156
+ const O = k().filter((G) => G.focusable), H = O.find((G) => G.active), $ = O.find((G) => G.id === v), Y = [H, $, ...O].filter(
13156
13157
  Boolean
13157
13158
  ).map((G) => G.ref.current);
13158
13159
  Jd(Y, u);
@@ -13884,17 +13885,17 @@ var Yt = "MenuContent", [P0, Ca] = cr(Yt), hf = x.forwardRef(
13884
13885
  onDismiss: h,
13885
13886
  disableOutsideScroll: m,
13886
13887
  ...v
13887
- } = e, g = ur(Yt, n), w = vo(Yt, n), y = Ms(n), C = uf(n), k = R0(n), [b, S] = x.useState(null), T = x.useRef(null), E = ot(t, T, g.onContentChange), N = x.useRef(0), A = x.useRef(""), P = x.useRef(0), H = x.useRef(null), F = x.useRef("right"), I = x.useRef(0), Y = m ? ya : x.Fragment, G = m ? { as: D0, allowPinchZoom: !0 } : void 0, te = (W) => {
13888
- var K, O;
13889
- const ne = A.current + W, $ = k().filter((V) => !V.disabled), j = document.activeElement, D = (K = $.find((V) => V.ref.current === j)) == null ? void 0 : K.textValue, _ = $.map((V) => V.textValue), L = G0(_, ne, D), U = (O = $.find((V) => V.textValue === L)) == null ? void 0 : O.ref.current;
13888
+ } = e, g = ur(Yt, n), w = vo(Yt, n), y = Ms(n), C = uf(n), k = R0(n), [b, S] = x.useState(null), T = x.useRef(null), E = ot(t, T, g.onContentChange), N = x.useRef(0), A = x.useRef(""), O = x.useRef(0), H = x.useRef(null), $ = x.useRef("right"), I = x.useRef(0), Y = m ? ya : x.Fragment, G = m ? { as: D0, allowPinchZoom: !0 } : void 0, te = (W) => {
13889
+ var K, M;
13890
+ const ne = A.current + W, F = k().filter((V) => !V.disabled), j = document.activeElement, P = (K = F.find((V) => V.ref.current === j)) == null ? void 0 : K.textValue, _ = F.map((V) => V.textValue), L = G0(_, ne, P), U = (M = F.find((V) => V.textValue === L)) == null ? void 0 : M.ref.current;
13890
13891
  (function V(re) {
13891
13892
  A.current = re, window.clearTimeout(N.current), re !== "" && (N.current = window.setTimeout(() => V(""), 1e3));
13892
13893
  })(ne), U && setTimeout(() => U.focus());
13893
13894
  };
13894
13895
  x.useEffect(() => () => window.clearTimeout(N.current), []), Sd();
13895
13896
  const B = x.useCallback((W) => {
13896
- var $, j;
13897
- return F.current === (($ = H.current) == null ? void 0 : $.side) && X0(W, (j = H.current) == null ? void 0 : j.area);
13897
+ var F, j;
13898
+ return $.current === ((F = H.current) == null ? void 0 : F.side) && X0(W, (j = H.current) == null ? void 0 : j.area);
13898
13899
  }, []);
13899
13900
  return /* @__PURE__ */ d.jsx(
13900
13901
  P0,
@@ -13920,7 +13921,7 @@ var Yt = "MenuContent", [P0, Ca] = cr(Yt), hf = x.forwardRef(
13920
13921
  },
13921
13922
  [B]
13922
13923
  ),
13923
- pointerGraceTimerRef: P,
13924
+ pointerGraceTimerRef: O,
13924
13925
  onPointerGraceIntentChange: x.useCallback((W) => {
13925
13926
  H.current = W;
13926
13927
  }, []),
@@ -13971,8 +13972,8 @@ var Yt = "MenuContent", [P0, Ca] = cr(Yt), hf = x.forwardRef(
13971
13972
  ref: E,
13972
13973
  style: { outline: "none", ...v.style },
13973
13974
  onKeyDown: be(v.onKeyDown, (W) => {
13974
- const $ = W.target.closest("[data-radix-menu-content]") === W.currentTarget, j = W.ctrlKey || W.altKey || W.metaKey, D = W.key.length === 1;
13975
- $ && (W.key === "Tab" && W.preventDefault(), !j && D && te(W.key));
13975
+ const F = W.target.closest("[data-radix-menu-content]") === W.currentTarget, j = W.ctrlKey || W.altKey || W.metaKey, P = W.key.length === 1;
13976
+ F && (W.key === "Tab" && W.preventDefault(), !j && P && te(W.key));
13976
13977
  const _ = T.current;
13977
13978
  if (W.target !== _ || !T0.includes(W.key)) return;
13978
13979
  W.preventDefault();
@@ -13985,10 +13986,10 @@ var Yt = "MenuContent", [P0, Ca] = cr(Yt), hf = x.forwardRef(
13985
13986
  onPointerMove: be(
13986
13987
  e.onPointerMove,
13987
13988
  eo((W) => {
13988
- const ne = W.target, $ = I.current !== W.clientX;
13989
- if (W.currentTarget.contains(ne) && $) {
13989
+ const ne = W.target, F = I.current !== W.clientX;
13990
+ if (W.currentTarget.contains(ne) && F) {
13990
13991
  const j = W.clientX > I.current ? "right" : "left";
13991
- F.current = j, I.current = W.clientX;
13992
+ $.current = j, I.current = W.clientX;
13992
13993
  }
13993
13994
  })
13994
13995
  )
@@ -14669,10 +14670,10 @@ function FS({
14669
14670
  _ ? T.current.style.height = `${L}px` : (T.current.style.height = "auto", T.current.style.height = `${Math.max(T.current.scrollHeight, L)}px`);
14670
14671
  }
14671
14672
  }, [e, t, w]);
14672
- const [P, H] = Z.useState(null), F = Z.useCallback(
14673
+ const [O, H] = Z.useState(null), $ = Z.useCallback(
14673
14674
  (_) => _.length > s ? `Message too long (${_.length}/${s} characters)` : null,
14674
14675
  [s]
14675
- ), I = Z.useMemo(() => v ?? F, [v, F]), Y = Z.useCallback(
14676
+ ), I = Z.useMemo(() => v ?? $, [v, $]), Y = Z.useCallback(
14676
14677
  (_) => {
14677
14678
  const L = I(_);
14678
14679
  return H(L), g == null || g(L), A.current = _, L;
@@ -14693,11 +14694,11 @@ function FS({
14693
14694
  Z.useEffect(() => {
14694
14695
  G();
14695
14696
  }, [G, k]), Z.useEffect(() => {
14696
- if (!P)
14697
+ if (!O)
14697
14698
  return;
14698
14699
  const _ = (k ?? "").trim();
14699
14700
  A.current !== _ && Y(_);
14700
- }, [k, P, Y]);
14701
+ }, [k, O, Y]);
14701
14702
  const te = Z.useCallback(
14702
14703
  (_, { fromUser: L }) => {
14703
14704
  w || C(_), L && (a == null || a(_));
@@ -14714,7 +14715,7 @@ function FS({
14714
14715
  id: U,
14715
14716
  shouldClear: !0
14716
14717
  }, S(() => {
14717
- var K, O, V;
14718
+ var K, M, V;
14718
14719
  try {
14719
14720
  const re = c(L);
14720
14721
  re && typeof re.then == "function" ? re.then(() => {
@@ -14723,7 +14724,7 @@ function FS({
14723
14724
  }).catch(() => {
14724
14725
  var ce;
14725
14726
  ((ce = N.current) == null ? void 0 : ce.id) === U && (N.current = null);
14726
- }) : (((K = N.current) == null ? void 0 : K.id) === U && N.current.shouldClear && (w || (C(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((O = N.current) == null ? void 0 : O.id) === U && (N.current = null));
14727
+ }) : (((K = N.current) == null ? void 0 : K.id) === U && N.current.shouldClear && (w || (C(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((M = N.current) == null ? void 0 : M.id) === U && (N.current = null));
14727
14728
  } catch {
14728
14729
  ((V = N.current) == null ? void 0 : V.id) === U && (N.current = null);
14729
14730
  }
@@ -14732,13 +14733,13 @@ function FS({
14732
14733
  [k, c, h, w, a, Y]
14733
14734
  ), W = Z.useCallback((_) => {
14734
14735
  const L = _.target.value;
14735
- te(L, { fromUser: !0 }), N.current && (N.current.shouldClear = !1), T.current && (T.current.style.height = "auto", T.current.style.height = `${T.current.scrollHeight}px`), P && Y(L.trim());
14736
- }, [te, Y, P]), ne = Z.useCallback(
14736
+ te(L, { fromUser: !0 }), N.current && (N.current.shouldClear = !1), T.current && (T.current.style.height = "auto", T.current.style.height = `${T.current.scrollHeight}px`), O && Y(L.trim());
14737
+ }, [te, Y, O]), ne = Z.useCallback(
14737
14738
  (_) => {
14738
14739
  _.key === "Enter" && !_.shiftKey ? (_.preventDefault(), B()) : _.key === "Escape" && t && (_.preventDefault(), l == null || l());
14739
14740
  },
14740
14741
  [B, t, l]
14741
- ), D = `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${t ? "border-[hsl(var(--ring))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))] dark:bg-[hsl(var(--card))] dark:text-[hsl(var(--card-foreground))]" : ""} ${p}`;
14742
+ ), P = `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${t ? "border-[hsl(var(--ring))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))] dark:bg-[hsl(var(--card))] dark:text-[hsl(var(--card-foreground))]" : ""} ${p}`;
14742
14743
  return /* @__PURE__ */ d.jsx("div", { className: `w-full ${f}`, children: /* @__PURE__ */ d.jsxs("div", { className: "flex items-end gap-2", children: [
14743
14744
  /* @__PURE__ */ d.jsxs("div", { className: "flex-1", children: [
14744
14745
  /* @__PURE__ */ d.jsx(
@@ -14749,7 +14750,7 @@ function FS({
14749
14750
  onChange: W,
14750
14751
  onKeyDown: ne,
14751
14752
  placeholder: t ? "Edit your message..." : n,
14752
- className: D,
14753
+ className: P,
14753
14754
  disabled: o,
14754
14755
  maxLength: s,
14755
14756
  rows: 1,
@@ -14757,7 +14758,7 @@ function FS({
14757
14758
  autoCorrect: "off"
14758
14759
  }
14759
14760
  ),
14760
- P && /* @__PURE__ */ d.jsx("p", { className: "mt-1 text-xs text-destructive font-medium", children: P })
14761
+ O && /* @__PURE__ */ d.jsx("p", { className: "mt-1 text-xs text-destructive font-medium", children: O })
14761
14762
  ] }),
14762
14763
  /* @__PURE__ */ d.jsx("div", { children: r ? /* @__PURE__ */ d.jsx(
14763
14764
  st,
@@ -14809,7 +14810,7 @@ function np({
14809
14810
  allowEmptySend: w = !1,
14810
14811
  inputError: y = null
14811
14812
  }) {
14812
- const [C, k] = ue([]), b = Se(null), S = Se(null), [T, E] = ue(0), [N, A] = ue(0), [P, H] = ue(!1), [F, I] = ue(null), [Y, G] = ue(null), te = ie(() => {
14813
+ const [C, k] = ue([]), b = Se(null), S = Se(null), [T, E] = ue(0), [N, A] = ue(0), [O, H] = ue(!1), [$, I] = ue(null), [Y, G] = ue(null), te = ie(() => {
14813
14814
  b.current && (b.current.value = ""), S.current && (S.current.value = ""), E((L) => L + 1), A((L) => L + 1);
14814
14815
  }, []), B = ie((L) => {
14815
14816
  k((U) => {
@@ -14824,10 +14825,10 @@ function np({
14824
14825
  [B]
14825
14826
  ), ne = ie((L) => {
14826
14827
  k((U) => {
14827
- const K = U.filter((O, V) => V !== L);
14828
+ const K = U.filter((M, V) => V !== L);
14828
14829
  return K.length === 0 && te(), v == null || v(K), K;
14829
14830
  });
14830
- }, [v, te]), $ = ie(
14831
+ }, [v, te]), F = ie(
14831
14832
  async (L) => {
14832
14833
  const U = (L.target.files || [])[0];
14833
14834
  if (U && (I(null), G(null), !!m)) {
@@ -14835,15 +14836,15 @@ function np({
14835
14836
  try {
14836
14837
  await m(U), I(`Uploaded ${U.name} - processing through chat stream`);
14837
14838
  } catch (K) {
14838
- const O = K instanceof Error ? K.message : "Failed to upload Excel file";
14839
- G(O), g == null || g(O);
14839
+ const M = K instanceof Error ? K.message : "Failed to upload Excel file";
14840
+ G(M), g == null || g(M);
14840
14841
  } finally {
14841
14842
  H(!1), L.target.value = "", te();
14842
14843
  }
14843
14844
  }
14844
14845
  },
14845
14846
  [m, g, te]
14846
- ), j = ze(() => w || C.length > 0, [w, C]), D = ie(
14847
+ ), j = ze(() => w || C.length > 0, [w, C]), P = ie(
14847
14848
  async (L) => {
14848
14849
  const K = await n(L, C);
14849
14850
  return C.length > 0 && (k([]), v == null || v([]), te()), K;
@@ -14894,17 +14895,17 @@ function np({
14894
14895
  ref: S,
14895
14896
  type: "file",
14896
14897
  accept: ".xls,.xlsx,.xlsm",
14897
- onChange: $,
14898
+ onChange: F,
14898
14899
  className: "hidden"
14899
14900
  },
14900
14901
  N
14901
14902
  ),
14902
- P && /* @__PURE__ */ d.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
14903
+ O && /* @__PURE__ */ d.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
14903
14904
  /* @__PURE__ */ d.jsx(Yn, { className: "h-4 w-4 animate-spin" }),
14904
14905
  " Uploading Excel file..."
14905
14906
  ] }),
14906
- F && !P && /* @__PURE__ */ d.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: F }),
14907
- Y && !P && /* @__PURE__ */ d.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Y })
14907
+ $ && !O && /* @__PURE__ */ d.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: $ }),
14908
+ Y && !O && /* @__PURE__ */ d.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Y })
14908
14909
  ] })
14909
14910
  ] }),
14910
14911
  /* @__PURE__ */ d.jsxs("div", { className: "flex items-end gap-2", children: [
@@ -14941,9 +14942,9 @@ function np({
14941
14942
  {
14942
14943
  onClick: () => {
14943
14944
  var L;
14944
- P || (L = S.current) == null || L.click();
14945
+ O || (L = S.current) == null || L.click();
14945
14946
  },
14946
- className: `cursor-pointer ${P ? "opacity-60 pointer-events-none" : ""}`,
14947
+ className: `cursor-pointer ${O ? "opacity-60 pointer-events-none" : ""}`,
14947
14948
  children: [
14948
14949
  /* @__PURE__ */ d.jsx(Ih, { className: "h-4 w-4 mr-2" }),
14949
14950
  " Upload Excel file"
@@ -14962,7 +14963,7 @@ function np({
14962
14963
  placeholder: s ? "Edit your message..." : a,
14963
14964
  isStreaming: c,
14964
14965
  disabled: l,
14965
- onSend: D,
14966
+ onSend: P,
14966
14967
  onCancelEdit: r,
14967
14968
  onStop: o,
14968
14969
  allowEmptySend: j,
@@ -14989,34 +14990,34 @@ function BS({
14989
14990
  onEvent: f,
14990
14991
  activeThreadId: p
14991
14992
  }) {
14992
- const { messages: h } = vu(), [m, v] = ue(null), [g, w] = ue(""), [y, C] = ue(null), [k, b] = ue(null), [S, T] = ue(!1), [E, N] = ue(""), A = Se(E), P = Se(null);
14993
+ const { messages: h } = vu(), [m, v] = ue(null), [g, w] = ue(""), [y, C] = ue(null), [k, b] = ue(null), [S, T] = ue(!1), [E, N] = ue(""), A = Se(E), O = Se(null);
14993
14994
  We(() => {
14994
14995
  if (!m)
14995
14996
  if (p) {
14996
- const $ = localStorage.getItem(Ys(p));
14997
- N($ || "");
14997
+ const F = localStorage.getItem(Ys(p));
14998
+ N(F || "");
14998
14999
  } else
14999
15000
  N("");
15000
15001
  }, [p, m]);
15001
- const H = ie(($) => {
15002
- N($), !m && p && localStorage.setItem(Ys(p), $);
15002
+ const H = ie((F) => {
15003
+ N(F), !m && p && localStorage.setItem(Ys(p), F);
15003
15004
  }, [p, m]);
15004
15005
  We(() => {
15005
15006
  A.current = E;
15006
15007
  }, [E]), We(() => {
15007
15008
  if (!m) {
15008
- P.current = null;
15009
+ O.current = null;
15009
15010
  return;
15010
15011
  }
15011
- P.current === null && (P.current = A.current), H(g ?? "");
15012
+ O.current === null && (O.current = A.current), H(g ?? "");
15012
15013
  }, [g, m, H]);
15013
- const F = ie(
15014
- ($) => {
15015
- H($);
15014
+ const $ = ie(
15015
+ (F) => {
15016
+ H(F);
15016
15017
  },
15017
15018
  [H]
15018
- ), I = async ($, j) => {
15019
- const D = Array.isArray(j) ? { files: j } : j ?? {}, _ = D.files ?? [], L = D.contentParts ?? [], U = $.trim();
15019
+ ), I = async (F, j) => {
15020
+ const P = Array.isArray(j) ? { files: j } : j ?? {}, _ = P.files ?? [], L = P.contentParts ?? [], U = F.trim();
15020
15021
  if (!(!U && _.length === 0 && L.length === 0))
15021
15022
  try {
15022
15023
  const K = _.map(async (ge) => {
@@ -15057,16 +15058,16 @@ function BS({
15057
15058
  }
15058
15059
  ), o == null || o(U), l(!0), p && localStorage.removeItem(Ys(p)), H(""), b(null), v(null), w(""), C(null);
15059
15060
  } catch (K) {
15060
- const O = (K == null ? void 0 : K.message) || "Failed to send message";
15061
- b(O), i == null || i(O), l(!1);
15061
+ const M = (K == null ? void 0 : K.message) || "Failed to send message";
15062
+ b(M), i == null || i(M), l(!1);
15062
15063
  }
15063
- }, Y = ($, j) => {
15064
- j || I($, { files: [] });
15064
+ }, Y = (F, j) => {
15065
+ j || I(F, { files: [] });
15065
15066
  }, G = ie(
15066
- async ($) => {
15067
+ async (F) => {
15067
15068
  await e(
15068
15069
  {
15069
- attachments: [$],
15070
+ attachments: [F],
15070
15071
  payload: t.payload
15071
15072
  },
15072
15073
  {
@@ -15076,34 +15077,34 @@ function BS({
15076
15077
  config: t.config,
15077
15078
  onEvent: f
15078
15079
  }
15079
- ), s == null || s({ file: $ });
15080
+ ), s == null || s({ file: F });
15080
15081
  },
15081
15082
  [n, r, t, s, e]
15082
15083
  ), te = ie(
15083
- ($, j, D) => {
15084
- a && (P.current = E, v($), w(j), C({
15085
- checkpointId: (D == null ? void 0 : D.checkpointId) ?? null,
15086
- checkpointNs: (D == null ? void 0 : D.checkpointNs) ?? null
15084
+ (F, j, P) => {
15085
+ a && (O.current = E, v(F), w(j), C({
15086
+ checkpointId: (P == null ? void 0 : P.checkpointId) ?? null,
15087
+ checkpointNs: (P == null ? void 0 : P.checkpointNs) ?? null
15087
15088
  }), b(null));
15088
15089
  },
15089
15090
  [E, a]
15090
15091
  ), B = ie(() => {
15091
15092
  v(null), w(""), C(null), b(null);
15092
- const $ = P.current;
15093
- $ !== null && N($), P.current = null;
15094
- }, []), W = ie(($) => {
15093
+ const F = O.current;
15094
+ F !== null && N(F), O.current = null;
15095
+ }, []), W = ie((F) => {
15095
15096
  let j = null;
15096
- for (let U = $ - 1; U >= 0; U--)
15097
+ for (let U = F - 1; U >= 0; U--)
15097
15098
  if (c[U].role === "user") {
15098
15099
  j = c[U];
15099
15100
  break;
15100
15101
  }
15101
15102
  if (!j) return;
15102
- const D = Array.isArray(j.content) ? j.content : [], L = D.filter((U) => (U == null ? void 0 : U.type) === "text").map((U) => U.text).join("") || (() => {
15103
+ const P = Array.isArray(j.content) ? j.content : [], L = P.filter((U) => (U == null ? void 0 : U.type) === "text").map((U) => U.text).join("") || (() => {
15103
15104
  try {
15104
- return JSON.stringify(D, null, 2);
15105
+ return JSON.stringify(P, null, 2);
15105
15106
  } catch {
15106
- return String(D);
15107
+ return String(P);
15107
15108
  }
15108
15109
  })();
15109
15110
  L && e(
@@ -15126,7 +15127,7 @@ function BS({
15126
15127
  dismissError: S,
15127
15128
  setDismissError: T,
15128
15129
  composerValue: E,
15129
- handleComposerChange: F,
15130
+ handleComposerChange: $,
15130
15131
  handleSendMessage: I,
15131
15132
  handleQuickPrompt: Y,
15132
15133
  handleExcelUpload: G,
@@ -15463,7 +15464,7 @@ var $a = "ScrollArea", [Tp, zT] = Fn($a), [nC, Xt] = Tp($a), kp = x.forwardRef(
15463
15464
  dir: o,
15464
15465
  scrollHideDelay: s = 600,
15465
15466
  ...i
15466
- } = e, [a, c] = x.useState(null), [l, u] = x.useState(null), [f, p] = x.useState(null), [h, m] = x.useState(null), [v, g] = x.useState(null), [w, y] = x.useState(0), [C, k] = x.useState(0), [b, S] = x.useState(!1), [T, E] = x.useState(!1), N = ot(t, (P) => c(P)), A = la(o);
15467
+ } = e, [a, c] = x.useState(null), [l, u] = x.useState(null), [f, p] = x.useState(null), [h, m] = x.useState(null), [v, g] = x.useState(null), [w, y] = x.useState(0), [C, k] = x.useState(0), [b, S] = x.useState(!1), [T, E] = x.useState(!1), N = ot(t, (O) => c(O)), A = la(o);
15467
15468
  return /* @__PURE__ */ d.jsx(
15468
15469
  nC,
15469
15470
  {
@@ -15788,14 +15789,14 @@ var rC = x.forwardRef((e, t) => {
15788
15789
  } = e, h = Xt(gn, n), [m, v] = x.useState(null), g = ot(t, (N) => v(N)), w = x.useRef(null), y = x.useRef(""), C = h.viewport, k = r.content - r.viewport, b = bt(u), S = bt(c), T = Bs(f, 10);
15789
15790
  function E(N) {
15790
15791
  if (w.current) {
15791
- const A = N.clientX - w.current.left, P = N.clientY - w.current.top;
15792
- l({ x: A, y: P });
15792
+ const A = N.clientX - w.current.left, O = N.clientY - w.current.top;
15793
+ l({ x: A, y: O });
15793
15794
  }
15794
15795
  }
15795
15796
  return x.useEffect(() => {
15796
15797
  const N = (A) => {
15797
- const P = A.target;
15798
- (m == null ? void 0 : m.contains(P)) && b(A, k);
15798
+ const O = A.target;
15799
+ (m == null ? void 0 : m.contains(O)) && b(A, k);
15799
15800
  };
15800
15801
  return document.addEventListener("wheel", N, { passive: !1 }), () => document.removeEventListener("wheel", N, { passive: !1 });
15801
15802
  }, [C, m, k, b]), x.useEffect(S, [r, S]), Tr(m, T), Tr(h.content, T), /* @__PURE__ */ d.jsx(
@@ -16054,7 +16055,7 @@ function Vo({
16054
16055
  renderArtifactsInline: y = !0,
16055
16056
  emptyMessage: C
16056
16057
  }) {
16057
- var U, K, O;
16058
+ var U, K, M;
16058
16059
  const { currentThreadId: k } = ao(), b = co(), S = gu(), T = vu(), E = BS({
16059
16060
  submit: T.submit,
16060
16061
  chatRequest: { payload: p },
@@ -16069,22 +16070,22 @@ function Vo({
16069
16070
  },
16070
16071
  // Handled by stream state
16071
16072
  activeThreadId: k ?? null
16072
- }), N = b.interrupt, [A, P] = ue(!1), [H, F] = ue("desktop"), [I, Y] = ue(!1), [G, te] = ue(null), B = Se(null);
16073
+ }), N = b.interrupt, [A, O] = ue(!1), [H, $] = ue("desktop"), [I, Y] = ue(!1), [G, te] = ue(null), B = Se(null);
16073
16074
  We(() => {
16074
16075
  const V = () => {
16075
16076
  const re = window.innerWidth;
16076
- F(re < 640 ? "phone" : re < 1024 ? "tablet" : "desktop");
16077
+ $(re < 640 ? "phone" : re < 1024 ? "tablet" : "desktop");
16077
16078
  };
16078
16079
  return V(), window.addEventListener("resize", V), () => window.removeEventListener("resize", V);
16079
16080
  }, []);
16080
16081
  const W = ie(
16081
16082
  async (V, re, ce) => {
16082
16083
  try {
16083
- P(!0), await b.respondToInterrupt(V, re, ce);
16084
+ O(!0), await b.respondToInterrupt(V, re, ce);
16084
16085
  } catch (he) {
16085
16086
  console.error("Failed to respond to interrupt:", he);
16086
16087
  } finally {
16087
- P(!1);
16088
+ O(!1);
16088
16089
  }
16089
16090
  },
16090
16091
  [b]
@@ -16104,15 +16105,15 @@ function Vo({
16104
16105
  }
16105
16106
  },
16106
16107
  [b]
16107
- ), $ = Z.useMemo(
16108
+ ), F = Z.useMemo(
16108
16109
  () => l ?? {
16109
16110
  toolRenderers: u,
16110
16111
  toolArtifactRenderers: f,
16111
16112
  getToolExpandable: (V) => V.name !== "ask_user_choice"
16112
16113
  },
16113
16114
  [l, u, f]
16114
- ), j = !!N || A, D = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${h.container || ""}`, _ = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 ${N ? "pb-32" : ""} bg-transparent ${h.messagesArea || ""}`, L = `relative flex-shrink-0 w-full border-t p-4 bg-transparent ${h.inputArea || ""}`;
16115
- return /* @__PURE__ */ d.jsxs("div", { className: D, children: [
16115
+ ), j = !!N || A, P = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${h.container || ""}`, _ = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 ${N ? "pb-32" : ""} bg-transparent ${h.messagesArea || ""}`, L = `relative flex-shrink-0 w-full border-t p-4 bg-transparent ${h.inputArea || ""}`;
16116
+ return /* @__PURE__ */ d.jsxs("div", { className: P, children: [
16116
16117
  !!S.error && !E.dismissError && /* @__PURE__ */ d.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: [
16117
16118
  /* @__PURE__ */ d.jsx("span", { children: S.error }),
16118
16119
  /* @__PURE__ */ d.jsx(st, { variant: "ghost", size: "sm", onClick: () => E.setDismissError(!0), className: "text-red-800 hover:bg-red-100", children: /* @__PURE__ */ d.jsx(Go, { size: 16 }) })
@@ -16131,9 +16132,9 @@ function Vo({
16131
16132
  followNewMessages: o,
16132
16133
  showThinkingIndicator: S.isStreaming,
16133
16134
  streamingDebounceMs: r,
16134
- toolConfig: $,
16135
+ toolConfig: F,
16135
16136
  checkpointIndex: b.checkpointIndex,
16136
- activeCheckpointId: (O = b.checkpoint) == null ? void 0 : O.id,
16137
+ activeCheckpointId: (M = b.checkpoint) == null ? void 0 : M.id,
16137
16138
  onSelectCheckpoint: ne,
16138
16139
  pendingInterrupt: N,
16139
16140
  onEdit: E.startEditing,
@@ -16236,8 +16237,8 @@ function CC(e, t, n) {
16236
16237
  }
16237
16238
  var Lr = '[cmdk-group=""]', hi = '[cmdk-group-items=""]', TC = '[cmdk-group-heading=""]', Fp = '[cmdk-item=""]', Sc = `${Fp}:not([aria-disabled="true"])`, Fi = "cmdk-item-select", mr = "data-value", kC = (e, t, n) => CC(e, t, n), zp = x.createContext(void 0), wo = () => x.useContext(zp), Bp = x.createContext(void 0), Ua = () => x.useContext(Bp), Hp = x.createContext(void 0), Up = x.forwardRef((e, t) => {
16238
16239
  let n = gr(() => {
16239
- var j, D;
16240
- return { search: "", value: (D = (j = e.value) != null ? j : e.defaultValue) != null ? D : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
16240
+ var j, P;
16241
+ return { search: "", value: (P = (j = e.value) != null ? j : e.defaultValue) != null ? P : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
16241
16242
  }), r = gr(() => /* @__PURE__ */ new Set()), o = gr(() => /* @__PURE__ */ new Map()), s = gr(() => /* @__PURE__ */ new Map()), i = gr(() => /* @__PURE__ */ new Set()), a = Wp(e), { label: c, children: l, value: u, onValueChange: f, filter: p, shouldFilter: h, loop: m, disablePointerSelection: v = !1, vimBindings: g = !0, ...w } = e, y = Bt(), C = Bt(), k = Bt(), b = x.useRef(null), S = DC();
16242
16243
  or(() => {
16243
16244
  if (u !== void 0) {
@@ -16245,12 +16246,12 @@ var Lr = '[cmdk-group=""]', hi = '[cmdk-group-items=""]', TC = '[cmdk-group-head
16245
16246
  n.current.value = j, T.emit();
16246
16247
  }
16247
16248
  }, [u]), or(() => {
16248
- S(6, F);
16249
+ S(6, $);
16249
16250
  }, []);
16250
- let T = x.useMemo(() => ({ subscribe: (j) => (i.current.add(j), () => i.current.delete(j)), snapshot: () => n.current, setState: (j, D, _) => {
16251
- var L, U, K, O;
16252
- if (!Object.is(n.current[j], D)) {
16253
- if (n.current[j] = D, j === "search") H(), A(), S(1, P);
16251
+ let T = x.useMemo(() => ({ subscribe: (j) => (i.current.add(j), () => i.current.delete(j)), snapshot: () => n.current, setState: (j, P, _) => {
16252
+ var L, U, K, M;
16253
+ if (!Object.is(n.current[j], P)) {
16254
+ if (n.current[j] = P, j === "search") H(), A(), S(1, O);
16254
16255
  else if (j === "value") {
16255
16256
  if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
16256
16257
  let V = document.getElementById(k);
@@ -16259,9 +16260,9 @@ var Lr = '[cmdk-group=""]', hi = '[cmdk-group-items=""]', TC = '[cmdk-group-head
16259
16260
  if (S(7, () => {
16260
16261
  var V;
16261
16262
  n.current.selectedItemId = (V = I()) == null ? void 0 : V.id, T.emit();
16262
- }), _ || S(5, F), ((U = a.current) == null ? void 0 : U.value) !== void 0) {
16263
- let V = D ?? "";
16264
- (O = (K = a.current).onValueChange) == null || O.call(K, V);
16263
+ }), _ || S(5, $), ((U = a.current) == null ? void 0 : U.value) !== void 0) {
16264
+ let V = P ?? "";
16265
+ (M = (K = a.current).onValueChange) == null || M.call(K, V);
16265
16266
  return;
16266
16267
  }
16267
16268
  }
@@ -16269,57 +16270,57 @@ var Lr = '[cmdk-group=""]', hi = '[cmdk-group-items=""]', TC = '[cmdk-group-head
16269
16270
  }
16270
16271
  }, emit: () => {
16271
16272
  i.current.forEach((j) => j());
16272
- } }), []), E = x.useMemo(() => ({ value: (j, D, _) => {
16273
+ } }), []), E = x.useMemo(() => ({ value: (j, P, _) => {
16273
16274
  var L;
16274
- D !== ((L = s.current.get(j)) == null ? void 0 : L.value) && (s.current.set(j, { value: D, keywords: _ }), n.current.filtered.items.set(j, N(D, _)), S(2, () => {
16275
+ P !== ((L = s.current.get(j)) == null ? void 0 : L.value) && (s.current.set(j, { value: P, keywords: _ }), n.current.filtered.items.set(j, N(P, _)), S(2, () => {
16275
16276
  A(), T.emit();
16276
16277
  }));
16277
- }, item: (j, D) => (r.current.add(j), D && (o.current.has(D) ? o.current.get(D).add(j) : o.current.set(D, /* @__PURE__ */ new Set([j]))), S(3, () => {
16278
- H(), A(), n.current.value || P(), T.emit();
16278
+ }, item: (j, P) => (r.current.add(j), P && (o.current.has(P) ? o.current.get(P).add(j) : o.current.set(P, /* @__PURE__ */ new Set([j]))), S(3, () => {
16279
+ H(), A(), n.current.value || O(), T.emit();
16279
16280
  }), () => {
16280
16281
  s.current.delete(j), r.current.delete(j), n.current.filtered.items.delete(j);
16281
16282
  let _ = I();
16282
16283
  S(4, () => {
16283
- H(), (_ == null ? void 0 : _.getAttribute("id")) === j && P(), T.emit();
16284
+ H(), (_ == null ? void 0 : _.getAttribute("id")) === j && O(), T.emit();
16284
16285
  });
16285
16286
  }), group: (j) => (o.current.has(j) || o.current.set(j, /* @__PURE__ */ new Set()), () => {
16286
16287
  s.current.delete(j), o.current.delete(j);
16287
16288
  }), filter: () => a.current.shouldFilter, label: c || e["aria-label"], getDisablePointerSelection: () => a.current.disablePointerSelection, listId: y, inputId: k, labelId: C, listInnerRef: b }), []);
16288
- function N(j, D) {
16289
+ function N(j, P) {
16289
16290
  var _, L;
16290
16291
  let U = (L = (_ = a.current) == null ? void 0 : _.filter) != null ? L : kC;
16291
- return j ? U(j, n.current.search, D) : 0;
16292
+ return j ? U(j, n.current.search, P) : 0;
16292
16293
  }
16293
16294
  function A() {
16294
16295
  if (!n.current.search || a.current.shouldFilter === !1) return;
16295
- let j = n.current.filtered.items, D = [];
16296
+ let j = n.current.filtered.items, P = [];
16296
16297
  n.current.filtered.groups.forEach((L) => {
16297
16298
  let U = o.current.get(L), K = 0;
16298
- U.forEach((O) => {
16299
- let V = j.get(O);
16299
+ U.forEach((M) => {
16300
+ let V = j.get(M);
16300
16301
  K = Math.max(V, K);
16301
- }), D.push([L, K]);
16302
+ }), P.push([L, K]);
16302
16303
  });
16303
16304
  let _ = b.current;
16304
16305
  Y().sort((L, U) => {
16305
- var K, O;
16306
+ var K, M;
16306
16307
  let V = L.getAttribute("id"), re = U.getAttribute("id");
16307
- return ((K = j.get(re)) != null ? K : 0) - ((O = j.get(V)) != null ? O : 0);
16308
+ return ((K = j.get(re)) != null ? K : 0) - ((M = j.get(V)) != null ? M : 0);
16308
16309
  }).forEach((L) => {
16309
16310
  let U = L.closest(hi);
16310
16311
  U ? U.appendChild(L.parentElement === U ? L : L.closest(`${hi} > *`)) : _.appendChild(L.parentElement === _ ? L : L.closest(`${hi} > *`));
16311
- }), D.sort((L, U) => U[1] - L[1]).forEach((L) => {
16312
+ }), P.sort((L, U) => U[1] - L[1]).forEach((L) => {
16312
16313
  var U;
16313
16314
  let K = (U = b.current) == null ? void 0 : U.querySelector(`${Lr}[${mr}="${encodeURIComponent(L[0])}"]`);
16314
16315
  K == null || K.parentElement.appendChild(K);
16315
16316
  });
16316
16317
  }
16317
- function P() {
16318
- let j = Y().find((_) => _.getAttribute("aria-disabled") !== "true"), D = j == null ? void 0 : j.getAttribute(mr);
16319
- T.setState("value", D || void 0);
16318
+ function O() {
16319
+ let j = Y().find((_) => _.getAttribute("aria-disabled") !== "true"), P = j == null ? void 0 : j.getAttribute(mr);
16320
+ T.setState("value", P || void 0);
16320
16321
  }
16321
16322
  function H() {
16322
- var j, D, _, L;
16323
+ var j, P, _, L;
16323
16324
  if (!n.current.search || a.current.shouldFilter === !1) {
16324
16325
  n.current.filtered.count = r.current.size;
16325
16326
  return;
@@ -16327,19 +16328,19 @@ var Lr = '[cmdk-group=""]', hi = '[cmdk-group-items=""]', TC = '[cmdk-group-head
16327
16328
  n.current.filtered.groups = /* @__PURE__ */ new Set();
16328
16329
  let U = 0;
16329
16330
  for (let K of r.current) {
16330
- let O = (D = (j = s.current.get(K)) == null ? void 0 : j.value) != null ? D : "", V = (L = (_ = s.current.get(K)) == null ? void 0 : _.keywords) != null ? L : [], re = N(O, V);
16331
+ let M = (P = (j = s.current.get(K)) == null ? void 0 : j.value) != null ? P : "", V = (L = (_ = s.current.get(K)) == null ? void 0 : _.keywords) != null ? L : [], re = N(M, V);
16331
16332
  n.current.filtered.items.set(K, re), re > 0 && U++;
16332
16333
  }
16333
- for (let [K, O] of o.current) for (let V of O) if (n.current.filtered.items.get(V) > 0) {
16334
+ for (let [K, M] of o.current) for (let V of M) if (n.current.filtered.items.get(V) > 0) {
16334
16335
  n.current.filtered.groups.add(K);
16335
16336
  break;
16336
16337
  }
16337
16338
  n.current.filtered.count = U;
16338
16339
  }
16339
- function F() {
16340
- var j, D, _;
16340
+ function $() {
16341
+ var j, P, _;
16341
16342
  let L = I();
16342
- L && (((j = L.parentElement) == null ? void 0 : j.firstChild) === L && ((_ = (D = L.closest(Lr)) == null ? void 0 : D.querySelector(TC)) == null || _.scrollIntoView({ block: "nearest" })), L.scrollIntoView({ block: "nearest" }));
16343
+ L && (((j = L.parentElement) == null ? void 0 : j.firstChild) === L && ((_ = (P = L.closest(Lr)) == null ? void 0 : P.querySelector(TC)) == null || _.scrollIntoView({ block: "nearest" })), L.scrollIntoView({ block: "nearest" }));
16343
16344
  }
16344
16345
  function I() {
16345
16346
  var j;
@@ -16350,27 +16351,27 @@ var Lr = '[cmdk-group=""]', hi = '[cmdk-group-items=""]', TC = '[cmdk-group-head
16350
16351
  return Array.from(((j = b.current) == null ? void 0 : j.querySelectorAll(Sc)) || []);
16351
16352
  }
16352
16353
  function G(j) {
16353
- let D = Y()[j];
16354
- D && T.setState("value", D.getAttribute(mr));
16354
+ let P = Y()[j];
16355
+ P && T.setState("value", P.getAttribute(mr));
16355
16356
  }
16356
16357
  function te(j) {
16357
- var D;
16358
- let _ = I(), L = Y(), U = L.findIndex((O) => O === _), K = L[U + j];
16359
- (D = a.current) != null && D.loop && (K = U + j < 0 ? L[L.length - 1] : U + j === L.length ? L[0] : L[U + j]), K && T.setState("value", K.getAttribute(mr));
16358
+ var P;
16359
+ let _ = I(), L = Y(), U = L.findIndex((M) => M === _), K = L[U + j];
16360
+ (P = a.current) != null && P.loop && (K = U + j < 0 ? L[L.length - 1] : U + j === L.length ? L[0] : L[U + j]), K && T.setState("value", K.getAttribute(mr));
16360
16361
  }
16361
16362
  function B(j) {
16362
- let D = I(), _ = D == null ? void 0 : D.closest(Lr), L;
16363
+ let P = I(), _ = P == null ? void 0 : P.closest(Lr), L;
16363
16364
  for (; _ && !L; ) _ = j > 0 ? OC(_, Lr) : MC(_, Lr), L = _ == null ? void 0 : _.querySelector(Sc);
16364
16365
  L ? T.setState("value", L.getAttribute(mr)) : te(j);
16365
16366
  }
16366
16367
  let W = () => G(Y().length - 1), ne = (j) => {
16367
16368
  j.preventDefault(), j.metaKey ? W() : j.altKey ? B(1) : te(1);
16368
- }, $ = (j) => {
16369
+ }, F = (j) => {
16369
16370
  j.preventDefault(), j.metaKey ? G(0) : j.altKey ? B(-1) : te(-1);
16370
16371
  };
16371
16372
  return x.createElement(je.div, { ref: t, tabIndex: -1, ...w, "cmdk-root": "", onKeyDown: (j) => {
16372
- var D;
16373
- (D = w.onKeyDown) == null || D.call(w, j);
16373
+ var P;
16374
+ (P = w.onKeyDown) == null || P.call(w, j);
16374
16375
  let _ = j.nativeEvent.isComposing || j.keyCode === 229;
16375
16376
  if (!(j.defaultPrevented || _)) switch (j.key) {
16376
16377
  case "n":
@@ -16384,11 +16385,11 @@ var Lr = '[cmdk-group=""]', hi = '[cmdk-group-items=""]', TC = '[cmdk-group-head
16384
16385
  }
16385
16386
  case "p":
16386
16387
  case "k": {
16387
- g && j.ctrlKey && $(j);
16388
+ g && j.ctrlKey && F(j);
16388
16389
  break;
16389
16390
  }
16390
16391
  case "ArrowUp": {
16391
- $(j);
16392
+ F(j);
16392
16393
  break;
16393
16394
  }
16394
16395
  case "Home": {
@@ -16865,16 +16866,16 @@ function zi({
16865
16866
  }) {
16866
16867
  const { chatApi: E, authApi: N } = uo(), {
16867
16868
  threads: A,
16868
- sharedThreads: P,
16869
+ sharedThreads: O,
16869
16870
  currentThreadId: H,
16870
- setCurrentThreadId: F,
16871
+ setCurrentThreadId: $,
16871
16872
  isLoading: I,
16872
16873
  isLoadingSharedThreads: Y,
16873
16874
  actions: G,
16874
16875
  shareInFlight: te,
16875
16876
  shareStatus: B,
16876
16877
  clearShareStatus: W
16877
- } = ao(), { createThread: ne, deleteThread: $, renameThread: j, shareThread: D } = G, { loadThread: _ } = co(), L = c ?? H, [U, K] = ue(Array.isArray(A) ? A : []), O = Se(U.length > 0), V = Se(null), re = Se(0), [ce, he] = ue(null), [ge, Ne] = ue(""), [ke, Ye] = ue(!1), [tt, $e] = ue(!1), [Ve, ft] = ue(null), [ht, mt] = ue(""), [Be, it] = ue([]), [at, Ct] = ue(!1), Xe = ie((M) => Ne(M), []);
16878
+ } = ao(), { createThread: ne, deleteThread: F, renameThread: j, shareThread: P } = G, { loadThread: _ } = co(), L = c ?? H, [U, K] = ue(Array.isArray(A) ? A : []), M = Se(U.length > 0), V = Se(null), re = Se(0), [ce, he] = ue(null), [ge, Ne] = ue(""), [ke, Ye] = ue(!1), [tt, $e] = ue(!1), [Ve, ft] = ue(null), [ht, mt] = ue(""), [Be, it] = ue([]), [at, Ct] = ue(!1), Xe = ie((D) => Ne(D), []);
16878
16879
  We(() => {
16879
16880
  tt && !C && Be.length === 0 && !at && (async () => {
16880
16881
  Ct(!0);
@@ -16895,30 +16896,30 @@ function zi({
16895
16896
  })();
16896
16897
  }, [tt, C, Be.length, at, E]);
16897
16898
  const He = C ?? Be, ut = k ?? at, gt = g && g.length > 0 ? g : XC, Pt = YC({ defaultView: m }), Ot = w ?? Pt, Mt = h ?? Ot.view, zn = ie(
16898
- (M) => {
16899
- h || Ot.setView(M), v == null || v(M);
16899
+ (D) => {
16900
+ h || Ot.setView(D), v == null || v(D);
16900
16901
  },
16901
16902
  [h, v, Ot]
16902
- ), _r = gt.find((M) => M.key === Mt) ?? gt[0], Bn = (M) => {
16903
- ft(M), mt(""), $e(!0);
16903
+ ), _r = gt.find((D) => D.key === Mt) ?? gt[0], Bn = (D) => {
16904
+ ft(D), mt(""), $e(!0);
16904
16905
  }, Hn = () => {
16905
16906
  $e(!1), ft(null), mt(""), W();
16906
16907
  }, Un = ie(
16907
- async (M) => {
16908
- if (!(!Ve || te) && M.id)
16908
+ async (D) => {
16909
+ if (!(!Ve || te) && D.id)
16909
16910
  try {
16910
- await D(Ve, M.id), setTimeout(() => Hn(), 600);
16911
+ await P(Ve, D.id), setTimeout(() => Hn(), 600);
16911
16912
  } catch (X) {
16912
16913
  console.error("Failed to share thread:", X);
16913
16914
  }
16914
16915
  },
16915
- [Hn, te, Ve, D]
16916
+ [Hn, te, Ve, P]
16916
16917
  ), nt = ze(() => {
16917
- const M = He, X = ht.trim().toLowerCase();
16918
- return X ? b ? M.filter((oe) => b(oe, X)) : M.filter((oe) => `${oe.label} ${oe.secondaryLabel ?? ""}`.toLowerCase().includes(X)) : M;
16919
- }, [C, ht, b]), Je = Mt === "shared", rn = Je ? P : U, Wt = T ? rn.filter(T) : rn, Vt = ze(() => {
16920
- const M = Array.isArray(S) ? S : [];
16921
- if (M.length === 0 || Je) return null;
16918
+ const D = He, X = ht.trim().toLowerCase();
16919
+ return X ? b ? D.filter((oe) => b(oe, X)) : D.filter((oe) => `${oe.label} ${oe.secondaryLabel ?? ""}`.toLowerCase().includes(X)) : D;
16920
+ }, [C, ht, b]), Je = Mt === "shared", rn = Je ? O : U, Wt = T ? rn.filter(T) : rn, Vt = ze(() => {
16921
+ const D = Array.isArray(S) ? S : [];
16922
+ if (D.length === 0 || Je) return null;
16922
16923
  const X = "Default", oe = (xe) => {
16923
16924
  if (!xe) return "Older";
16924
16925
  try {
@@ -16963,92 +16964,92 @@ function zi({
16963
16964
  return;
16964
16965
  }
16965
16966
  Object.values(xe).forEach(Ue);
16966
- }, Ae = Ze(Wt, M);
16967
+ }, Ae = Ze(Wt, D);
16967
16968
  return Ue(Ae), { kind: "nested", groups: Ae };
16968
- }, [Wt, S, Je]), Sn = Je ? Y : I, Cn = Je ? "No shared conversations yet" : "No conversations yet", dr = (M) => {
16969
- const X = M.sharedAt ? ` • ${Dt(M.sharedAt)}` : "";
16970
- return `Shared by ${M.sharedByUserId}${X}`;
16971
- }, Wn = (M) => "sharedByUserId" in M;
16969
+ }, [Wt, S, Je]), Sn = Je ? Y : I, Cn = Je ? "No shared conversations yet" : "No conversations yet", dr = (D) => {
16970
+ const X = D.sharedAt ? ` • ${Dt(D.sharedAt)}` : "";
16971
+ return `Shared by ${D.sharedByUserId}${X}`;
16972
+ }, Wn = (D) => "sharedByUserId" in D;
16972
16973
  We(() => {
16973
- const M = Array.isArray(A) ? A : [];
16974
- if (M.length > 0) {
16975
- O.current = !0, K(M);
16974
+ const D = Array.isArray(A) ? A : [];
16975
+ if (D.length > 0) {
16976
+ M.current = !0, K(D);
16976
16977
  return;
16977
16978
  }
16978
- I || (O.current = !1, K(M));
16979
+ I || (M.current = !1, K(D));
16979
16980
  }, [A, I]), We(() => {
16980
16981
  if (!V.current) return;
16981
- const M = V.current.querySelector(
16982
+ const D = V.current.querySelector(
16982
16983
  "[data-radix-scroll-area-viewport]"
16983
16984
  );
16984
- if (!M) return;
16985
+ if (!D) return;
16985
16986
  let X = null, oe = null;
16986
16987
  return X = requestAnimationFrame(() => {
16987
16988
  oe = requestAnimationFrame(() => {
16988
- M.scrollTop = re.current;
16989
+ D.scrollTop = re.current;
16989
16990
  });
16990
16991
  }), () => {
16991
16992
  X !== null && cancelAnimationFrame(X), oe !== null && cancelAnimationFrame(oe);
16992
16993
  };
16993
16994
  }, [U]);
16994
- const Tn = async (M) => {
16995
+ const Tn = async (D) => {
16995
16996
  try {
16996
- F(M), await _(M), l == null || l(M), u == null || u(M);
16997
+ $(D), await _(D), l == null || l(D), u == null || u(D);
16997
16998
  } catch (X) {
16998
16999
  console.error("Failed to select thread:", X);
16999
17000
  }
17000
17001
  }, Vn = async () => {
17001
17002
  try {
17002
17003
  Ye(!0);
17003
- const M = await ne();
17004
- M && (f == null || f(M), l == null || l(M));
17005
- } catch (M) {
17006
- console.error("Failed to create thread:", M);
17004
+ const D = await ne();
17005
+ D && (f == null || f(D), l == null || l(D));
17006
+ } catch (D) {
17007
+ console.error("Failed to create thread:", D);
17007
17008
  } finally {
17008
17009
  Ye(!1);
17009
17010
  }
17010
- }, kn = async (M, X) => {
17011
- const oe = M.threadId;
17011
+ }, kn = async (D, X) => {
17012
+ const oe = D.threadId;
17012
17013
  if (confirm("Delete this thread?")) {
17013
17014
  if (V.current) {
17014
17015
  const se = V.current.querySelector("[data-radix-scroll-area-viewport]");
17015
17016
  se && (re.current = se.scrollTop);
17016
17017
  }
17017
17018
  try {
17018
- await $(oe), p == null || p(oe);
17019
+ await F(oe), p == null || p(oe);
17019
17020
  } catch (se) {
17020
17021
  console.error("Failed to delete thread:", se);
17021
17022
  }
17022
17023
  }
17023
- }, Tt = (M, X) => {
17024
- X == null || X.stopPropagation(), he(M.threadId), Ne(M.title || `Thread ${M.threadId.slice(0, 8)}`);
17025
- }, En = async (M) => {
17026
- const X = typeof M == "string" ? M : M.threadId;
17024
+ }, Tt = (D, X) => {
17025
+ X == null || X.stopPropagation(), he(D.threadId), Ne(D.title || `Thread ${D.threadId.slice(0, 8)}`);
17026
+ }, En = async (D) => {
17027
+ const X = typeof D == "string" ? D : D.threadId;
17027
17028
  if (ge.trim())
17028
17029
  try {
17029
17030
  await j(X, ge.trim()), he(null), Ne("");
17030
17031
  } catch (oe) {
17031
17032
  console.error("Failed to update title:", oe);
17032
17033
  }
17033
- }, Me = (M) => {
17034
+ }, Me = (D) => {
17034
17035
  he(null), Ne("");
17035
- }, Dt = (M) => {
17036
- if (!M) return "";
17036
+ }, Dt = (D) => {
17037
+ if (!D) return "";
17037
17038
  try {
17038
- const X = M.endsWith("Z") || M.includes("+") ? M : `${M}Z`, oe = new Date(X), we = (/* @__PURE__ */ new Date()).getTime() - oe.getTime(), Ze = Math.floor(we / (1e3 * 60 * 60 * 24));
17039
+ const X = D.endsWith("Z") || D.includes("+") ? D : `${D}Z`, oe = new Date(X), we = (/* @__PURE__ */ new Date()).getTime() - oe.getTime(), Ze = Math.floor(we / (1e3 * 60 * 60 * 24));
17039
17040
  return Ze === 0 ? oe.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : Ze === 1 ? "Yesterday" : Ze < 7 ? `${Ze} days ago` : oe.toLocaleDateString();
17040
17041
  } catch {
17041
17042
  return "";
17042
17043
  }
17043
- }, Ce = (M) => M.title || `Thread ${M.threadId.slice(0, 8)}`, Ke = (M) => {
17044
- const X = Ce(M);
17044
+ }, Ce = (D) => D.title || `Thread ${D.threadId.slice(0, 8)}`, Ke = (D) => {
17045
+ const X = Ce(D);
17045
17046
  return X.length <= Tc ? X : `${X.slice(0, Tc)}...`;
17046
- }, R = (M) => Array.isArray(M) ? M.length : Object.values(M).reduce((X, oe) => Array.isArray(oe) ? X + oe.length : X + R(oe), 0), q = (M) => {
17047
- const oe = ["Today", "Yesterday", "Last 7 Days", "Older"].indexOf(M);
17047
+ }, R = (D) => Array.isArray(D) ? D.length : Object.values(D).reduce((X, oe) => Array.isArray(oe) ? X + oe.length : X + R(oe), 0), q = (D) => {
17048
+ const oe = ["Today", "Yesterday", "Last 7 Days", "Older"].indexOf(D);
17048
17049
  return oe === -1 ? null : oe;
17049
- }, Q = (M, X, oe) => {
17050
- if (Array.isArray(M))
17051
- return M.map((Ae) => /* @__PURE__ */ d.jsx(
17050
+ }, Q = (D, X, oe) => {
17051
+ if (Array.isArray(D))
17052
+ return D.map((Ae) => /* @__PURE__ */ d.jsx(
17052
17053
  Cc,
17053
17054
  {
17054
17055
  thread: Ae,
@@ -17078,7 +17079,7 @@ function zi({
17078
17079
  "flex items-center w-full px-2 py-1 text-xs font-semibold text-slate-600 hover:text-slate-900 dark:hover:text-slate-200",
17079
17080
  "flex items-center w-full px-2 py-1 text-[11px] font-medium text-slate-500 hover:text-slate-800 dark:hover:text-slate-200",
17080
17081
  "flex items-center w-full px-2 py-1 text-[10px] font-medium text-slate-400 hover:text-slate-600 dark:hover:text-slate-300"
17081
- ], we = "pl-2 border-l border-slate-100 dark:border-slate-800 ml-1.5 my-1 space-y-1", Ze = se[X] ?? se[se.length - 1], Ue = Object.entries(M);
17082
+ ], we = "pl-2 border-l border-slate-100 dark:border-slate-800 ml-1.5 my-1 space-y-1", Ze = se[X] ?? se[se.length - 1], Ue = Object.entries(D);
17082
17083
  if (Ue.length === 1) {
17083
17084
  const [Ae, xe] = Ue[0];
17084
17085
  return Q(
@@ -17146,19 +17147,19 @@ function zi({
17146
17147
  children: _r.label
17147
17148
  }
17148
17149
  ) }),
17149
- /* @__PURE__ */ d.jsx($s, { align: "start", sideOffset: 6, className: "w-40", children: gt.map((M) => /* @__PURE__ */ d.jsxs(
17150
+ /* @__PURE__ */ d.jsx($s, { align: "start", sideOffset: 6, className: "w-40", children: gt.map((D) => /* @__PURE__ */ d.jsxs(
17150
17151
  Qn,
17151
17152
  {
17152
17153
  className: "justify-between text-[12px]",
17153
17154
  onClick: (X) => {
17154
- X.preventDefault(), zn(M.key);
17155
+ X.preventDefault(), zn(D.key);
17155
17156
  },
17156
17157
  children: [
17157
- /* @__PURE__ */ d.jsx("span", { children: M.label }),
17158
- Mt === M.key && /* @__PURE__ */ d.jsx(Nc, { className: "h-3 w-3" })
17158
+ /* @__PURE__ */ d.jsx("span", { children: D.label }),
17159
+ Mt === D.key && /* @__PURE__ */ d.jsx(Nc, { className: "h-3 w-3" })
17159
17160
  ]
17160
17161
  },
17161
- M.key
17162
+ D.key
17162
17163
  )) })
17163
17164
  ] })
17164
17165
  ] })
@@ -17181,11 +17182,11 @@ function zi({
17181
17182
  Vt.groups,
17182
17183
  0,
17183
17184
  "group"
17184
- ) : Wt.slice().sort((M, X) => new Date(X.updatedAt || X.createdAt || "").getTime() - new Date(M.updatedAt || M.createdAt || "").getTime()).map((M) => /* @__PURE__ */ d.jsx(
17185
+ ) : Wt.slice().sort((D, X) => new Date(X.updatedAt || X.createdAt || "").getTime() - new Date(D.updatedAt || D.createdAt || "").getTime()).map((D) => /* @__PURE__ */ d.jsx(
17185
17186
  Cc,
17186
17187
  {
17187
- thread: M,
17188
- isActive: L === M.threadId,
17188
+ thread: D,
17189
+ isActive: L === D.threadId,
17189
17190
  editingThreadId: ce,
17190
17191
  editingTitle: ge,
17191
17192
  onSelect: Tn,
@@ -17201,15 +17202,15 @@ function zi({
17201
17202
  onMenuAction: s,
17202
17203
  formatDate: Dt,
17203
17204
  getDisplayThreadTitle: Ke,
17204
- secondaryLine: Je && Wn(M) ? dr(M) : void 0,
17205
+ secondaryLine: Je && Wn(D) ? dr(D) : void 0,
17205
17206
  itemClassName: a.threadItem,
17206
17207
  activeItemClassName: a.activeThread
17207
17208
  },
17208
- M.threadId
17209
+ D.threadId
17209
17210
  )) })
17210
17211
  }
17211
17212
  ),
17212
- /* @__PURE__ */ d.jsx(bp, { open: tt, onOpenChange: (M) => !M && Hn(), children: /* @__PURE__ */ d.jsxs(Ma, { className: "max-w-md p-0", children: [
17213
+ /* @__PURE__ */ d.jsx(bp, { open: tt, onOpenChange: (D) => !D && Hn(), children: /* @__PURE__ */ d.jsxs(Ma, { className: "max-w-md p-0", children: [
17213
17214
  /* @__PURE__ */ d.jsx(Da, { children: /* @__PURE__ */ d.jsx(La, { children: "Share thread" }) }),
17214
17215
  /* @__PURE__ */ d.jsxs(Kp, { children: [
17215
17216
  /* @__PURE__ */ d.jsx(
@@ -17217,7 +17218,7 @@ function zi({
17217
17218
  {
17218
17219
  autoFocus: !0,
17219
17220
  value: ht,
17220
- onValueChange: (M) => mt(M),
17221
+ onValueChange: (D) => mt(D),
17221
17222
  placeholder: "Search for recipients..."
17222
17223
  }
17223
17224
  ),
@@ -17236,10 +17237,10 @@ function zi({
17236
17237
  /* @__PURE__ */ d.jsx(Yn, { className: "h-4 w-4 animate-spin" }),
17237
17238
  "Loading recipients…"
17238
17239
  ] }) : "No matching recipients found" }),
17239
- nt.length > 0 && /* @__PURE__ */ d.jsx(Xp, { heading: "Recipients", children: nt.map((M) => /* @__PURE__ */ d.jsx(Jp, { onSelect: () => Un(M), children: /* @__PURE__ */ d.jsxs("div", { className: "flex flex-col items-start text-sm", children: [
17240
- /* @__PURE__ */ d.jsx("span", { className: "font-medium", children: M.label }),
17241
- M.secondaryLabel && /* @__PURE__ */ d.jsx("span", { className: "text-xs text-muted-foreground", children: M.secondaryLabel })
17242
- ] }) }, M.id)) })
17240
+ nt.length > 0 && /* @__PURE__ */ d.jsx(Xp, { heading: "Recipients", children: nt.map((D) => /* @__PURE__ */ d.jsx(Jp, { onSelect: () => Un(D), children: /* @__PURE__ */ d.jsxs("div", { className: "flex flex-col items-start text-sm", children: [
17241
+ /* @__PURE__ */ d.jsx("span", { className: "font-medium", children: D.label }),
17242
+ D.secondaryLabel && /* @__PURE__ */ d.jsx("span", { className: "text-xs text-muted-foreground", children: D.secondaryLabel })
17243
+ ] }) }, D.id)) })
17243
17244
  ] })
17244
17245
  ] })
17245
17246
  ] }) })