teodor-new-chat-ui 4.3.474 → 4.3.475

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
@@ -395,14 +395,14 @@ function yx() {
395
395
  }
396
396
  return null;
397
397
  }
398
- var I = Object.assign, G = 0, K, B, _, k, H, V, j;
398
+ var I = Object.assign, G = 0, K, z, _, k, H, V, j;
399
399
  function M() {
400
400
  }
401
401
  M.__reactDisabledLog = !0;
402
402
  function P() {
403
403
  {
404
404
  if (G === 0) {
405
- K = console.log, B = console.info, _ = console.warn, k = console.error, H = console.group, V = console.groupCollapsed, j = console.groupEnd;
405
+ K = console.log, z = console.info, _ = console.warn, k = console.error, H = console.group, V = console.groupCollapsed, j = console.groupEnd;
406
406
  var R = {
407
407
  configurable: !0,
408
408
  enumerable: !0,
@@ -435,7 +435,7 @@ function yx() {
435
435
  value: K
436
436
  }),
437
437
  info: I({}, R, {
438
- value: B
438
+ value: z
439
439
  }),
440
440
  warn: I({}, R, {
441
441
  value: _
@@ -457,18 +457,18 @@ function yx() {
457
457
  G < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
458
458
  }
459
459
  }
460
- var Q = b.ReactCurrentDispatcher, z;
460
+ var Q = b.ReactCurrentDispatcher, B;
461
461
  function $(R, ne, le) {
462
462
  {
463
- if (z === void 0)
463
+ if (B === void 0)
464
464
  try {
465
465
  throw Error();
466
466
  } catch (Ze) {
467
467
  var Re = Ze.stack.trim().match(/\n( *(at )?)/);
468
- z = Re && Re[1] || "";
468
+ B = Re && Re[1] || "";
469
469
  }
470
470
  return `
471
- ` + z + R;
471
+ ` + B + R;
472
472
  }
473
473
  }
474
474
  var Z = !1, Y;
@@ -2223,7 +2223,7 @@ const cd = (e) => {
2223
2223
  }
2224
2224
  }
2225
2225
  W.isString(A) || (A = A ? "include" : "omit");
2226
- const K = s && "credentials" in n.prototype, B = {
2226
+ const K = s && "credentials" in n.prototype, z = {
2227
2227
  ...D,
2228
2228
  signal: U,
2229
2229
  method: x.toUpperCase(),
@@ -2232,8 +2232,8 @@ const cd = (e) => {
2232
2232
  duplex: "half",
2233
2233
  credentials: K ? A : void 0
2234
2234
  };
2235
- q = s && new n(g, B);
2236
- let _ = await (s ? F(q, D) : F(g, B));
2235
+ q = s && new n(g, z);
2236
+ let _ = await (s ? F(q, D) : F(g, z));
2237
2237
  const k = d && (E === "stream" || E === "response");
2238
2238
  if (d && (S || k && I)) {
2239
2239
  const V = {};
@@ -3064,8 +3064,8 @@ function uw(e = {}) {
3064
3064
  messageId: null,
3065
3065
  lastSeq: null,
3066
3066
  lastText: ""
3067
- }), q = ie((B) => {
3068
- o(B);
3067
+ }), q = ie((z) => {
3068
+ o(z);
3069
3069
  }, []), I = ie(() => {
3070
3070
  h(""), v(null), d(null), A.current = null, D.current = null, F.current = null, C(null), U.current = {
3071
3071
  messageId: null,
@@ -3075,15 +3075,15 @@ function uw(e = {}) {
3075
3075
  }, []), G = ie(() => {
3076
3076
  var H;
3077
3077
  console.debug("[use-chat] stop() invoked - aborting stream");
3078
- const B = (H = N.current) == null ? void 0 : H.threadId, _ = () => {
3078
+ const z = (H = N.current) == null ? void 0 : H.threadId, _ = () => {
3079
3079
  var V;
3080
3080
  (V = S.current) == null || V.abort(), S.current = null, N.current = null, l(!1), w(!1), E.current = 0, x(0);
3081
3081
  };
3082
- (B ? Mn.cancelRun(B).catch((V) => {
3082
+ (z ? Mn.cancelRun(z).catch((V) => {
3083
3083
  console.warn("[use-chat] cancel run failed:", V);
3084
3084
  }) : Promise.resolve()).finally(_);
3085
3085
  }, []), K = ie(
3086
- (B, _, k) => {
3086
+ (z, _, k) => {
3087
3087
  S.current && (S.current.abort(), S.current = null), l(!0), d(null), e.autoAppendAssistant !== !1 && h(""), v(null), A.current = null, D.current = null, F.current = null, C(null), U.current = {
3088
3088
  messageId: null,
3089
3089
  lastSeq: null,
@@ -3093,10 +3093,10 @@ function uw(e = {}) {
3093
3093
  S.current = H;
3094
3094
  let V = null, j = null, M = !1;
3095
3095
  return N.current = {
3096
- threadId: B.threadId ?? null,
3096
+ threadId: z.threadId ?? null,
3097
3097
  headers: {}
3098
3098
  }, (async () => {
3099
- var L, Q, z, $, Z, Y, ee, X, ae, xe, ue, me, Se, Ce, Ae, ht, ut, He;
3099
+ var L, Q, B, $, Z, Y, ee, X, ae, xe, ue, me, Se, Ce, Ae, ht, ut, He;
3100
3100
  const P = (ze) => {
3101
3101
  var De;
3102
3102
  try {
@@ -3119,7 +3119,7 @@ function uw(e = {}) {
3119
3119
  let J = null;
3120
3120
  try {
3121
3121
  const Ke = (Q = window.localStorage) == null ? void 0 : Q.getItem("chat-settings");
3122
- Ke && (J = ((z = JSON.parse(Ke)) == null ? void 0 : z.apiKey) || null);
3122
+ Ke && (J = ((B = JSON.parse(Ke)) == null ? void 0 : B.apiKey) || null);
3123
3123
  } catch {
3124
3124
  }
3125
3125
  const ce = Ge || _t || J || null;
@@ -3130,7 +3130,7 @@ function uw(e = {}) {
3130
3130
  console.debug(
3131
3131
  "[use-chat] POST",
3132
3132
  t + n,
3133
- P(B)
3133
+ P(z)
3134
3134
  );
3135
3135
  let De = {};
3136
3136
  if (typeof window < "u")
@@ -3150,7 +3150,7 @@ function uw(e = {}) {
3150
3150
  }, Le = await fetch(t + n, {
3151
3151
  method: "POST",
3152
3152
  headers: Pe,
3153
- body: JSON.stringify(B),
3153
+ body: JSON.stringify(z),
3154
3154
  signal: H.signal,
3155
3155
  credentials: a
3156
3156
  });
@@ -3349,8 +3349,8 @@ function uw(e = {}) {
3349
3349
  [t, n, r, e.autoAppendAssistant]
3350
3350
  );
3351
3351
  return Qe(() => () => {
3352
- var B;
3353
- T.current = !1, (B = S.current) == null || B.abort();
3352
+ var z;
3353
+ T.current = !1, (z = S.current) == null || z.abort();
3354
3354
  }, []), {
3355
3355
  isStreaming: i,
3356
3356
  error: c,
@@ -3539,7 +3539,7 @@ function pw({
3539
3539
  }) : M);
3540
3540
  return V ? j : (console.debug("[useThreadsState] thread_info: adding thread to list", k.threadId), [k, ...H]);
3541
3541
  });
3542
- }, []), B = ie(() => y(null), []);
3542
+ }, []), z = ie(() => y(null), []);
3543
3543
  return {
3544
3544
  threads: s,
3545
3545
  currentThreadId: i,
@@ -3553,7 +3553,7 @@ function pw({
3553
3553
  addThreadFromEvent: K,
3554
3554
  shareInFlight: C,
3555
3555
  shareStatus: w,
3556
- clearShareStatus: B
3556
+ clearShareStatus: z
3557
3557
  };
3558
3558
  }
3559
3559
  const wd = Or(null);
@@ -4106,7 +4106,7 @@ function jw({
4106
4106
  const [p, h] = fe(null), v = $e(
4107
4107
  () => Xn(p),
4108
4108
  [p]
4109
- ).checkpoints, g = dx(v), x = g.timeline, [b, w] = fe(!1), [y, C] = fe(null), [S, T] = fe(!1), [E, N] = fe(!1), [A, D] = fe(!1), [F, U] = fe(null), q = Oe(o), I = Oe(null), G = Oe(null), K = Oe(null), B = Oe(null), _ = Oe(null), k = Oe(/* @__PURE__ */ new Map()), H = Oe(null);
4109
+ ).checkpoints, g = dx(v), x = g.timeline, [b, w] = fe(!1), [y, C] = fe(null), [S, T] = fe(!1), [E, N] = fe(!1), [A, D] = fe(!1), [F, U] = fe(null), q = Oe(o), I = Oe(null), G = Oe(null), K = Oe(null), z = Oe(null), _ = Oe(null), k = Oe(/* @__PURE__ */ new Map()), H = Oe(null);
4110
4110
  Qe(() => {
4111
4111
  q.current = o;
4112
4112
  }, [o]);
@@ -4174,14 +4174,14 @@ function jw({
4174
4174
  [e, t, V]
4175
4175
  ), M = ie(
4176
4176
  async (X, ae) => {
4177
- B.current = X;
4177
+ z.current = X;
4178
4178
  try {
4179
4179
  await j(X, ae);
4180
4180
  } catch (xe) {
4181
4181
  if (!hc(xe))
4182
4182
  throw xe;
4183
4183
  } finally {
4184
- B.current === X && (B.current = null);
4184
+ z.current === X && (z.current = null);
4185
4185
  }
4186
4186
  },
4187
4187
  [j]
@@ -4204,7 +4204,7 @@ function jw({
4204
4204
  }), h(X), w(!!(ue != null && ue.nextCursor)), C((ue == null ? void 0 : ue.nextCursor) ?? null), _.current = `${ae}:latest`, G.current = null, K.current === ae && (K.current = null);
4205
4205
  },
4206
4206
  [t, c]
4207
- ), z = ie(
4207
+ ), B = ie(
4208
4208
  async (X, ae) => {
4209
4209
  const xe = q.current;
4210
4210
  await V({
@@ -4280,8 +4280,8 @@ function jw({
4280
4280
  I.current = o;
4281
4281
  return;
4282
4282
  }
4283
- if (B.current === o) {
4284
- B.current = null, I.current = o;
4283
+ if (z.current === o) {
4284
+ z.current = null, I.current = o;
4285
4285
  return;
4286
4286
  }
4287
4287
  if (I.current === o)
@@ -4302,7 +4302,7 @@ function jw({
4302
4302
  M
4303
4303
  ]);
4304
4304
  const ee = ie(() => {
4305
- h(null), w(!1), C(null), T(!1), N(!1), D(!1), U(null), G.current = null, K.current = null, I.current = null, _.current = null, B.current = null;
4305
+ h(null), w(!1), C(null), T(!1), N(!1), D(!1), U(null), G.current = null, K.current = null, I.current = null, _.current = null, z.current = null;
4306
4306
  }, []);
4307
4307
  return {
4308
4308
  threadCheckpoints: v,
@@ -4314,7 +4314,7 @@ function jw({
4314
4314
  threadStateError: F,
4315
4315
  hasMoreHistory: b,
4316
4316
  loadThread: M,
4317
- navigateToCheckpoint: z,
4317
+ navigateToCheckpoint: B,
4318
4318
  loadOlderMessages: Y,
4319
4319
  setCurrentCheckpointId: $,
4320
4320
  returnToLatest: Z,
@@ -4379,7 +4379,7 @@ function Pw({
4379
4379
  () => async () => {
4380
4380
  throw new Error("clearThread is not ready");
4381
4381
  }
4382
- ), [B, _] = fe(
4382
+ ), [z, _] = fe(
4383
4383
  () => async () => {
4384
4384
  throw new Error("respondToInterrupt is not ready");
4385
4385
  }
@@ -4418,7 +4418,7 @@ function Pw({
4418
4418
  returnToLatest: D,
4419
4419
  loadThread: T,
4420
4420
  clearThread: G,
4421
- respondToInterrupt: B,
4421
+ respondToInterrupt: z,
4422
4422
  messagePreviews: x.messagePreviews,
4423
4423
  handleStateHistoryEvent: F,
4424
4424
  markSkipNextLoad: U,
@@ -4445,7 +4445,7 @@ function Pw({
4445
4445
  A,
4446
4446
  D,
4447
4447
  T,
4448
- B,
4448
+ z,
4449
4449
  x.messagePreviews,
4450
4450
  F,
4451
4451
  U,
@@ -4560,18 +4560,18 @@ function $w({
4560
4560
  pushUser: S,
4561
4561
  onEvent: T
4562
4562
  } = $s(), { registerClearThread: E, registerRespondToInterrupt: N } = _w(), A = ie(
4563
- (B) => {
4564
- v(B), f.current !== B.threadId && ((B.created ?? !f.current) && w(B.threadId), y(B.threadId), h(B.threadId));
4563
+ (z) => {
4564
+ v(z), f.current !== z.threadId && ((z.created ?? !f.current) && w(z.threadId), y(z.threadId), h(z.threadId));
4565
4565
  },
4566
4566
  [v, w, y, h, f]
4567
4567
  ), D = ie(
4568
- (B) => {
4569
- B.type === "thread_info" ? A(B) : B.type === "state_history" ? b(B) : B.type === "tool.end" ? a == null || a(B) : T(B);
4568
+ (z) => {
4569
+ z.type === "thread_info" ? A(z) : z.type === "state_history" ? b(z) : z.type === "tool.end" ? a == null || a(z) : T(z);
4570
4570
  },
4571
4571
  [A, b, T, a]
4572
4572
  ), F = ie(
4573
- (B) => {
4574
- i(B, D, {
4573
+ (z) => {
4574
+ i(z, D, {
4575
4575
  onError: (_) => {
4576
4576
  console.error("[StreamingProvider] Stream error:", _), r == null || r(_);
4577
4577
  },
@@ -4589,7 +4589,7 @@ function $w({
4589
4589
  U.current = g;
4590
4590
  }, [g]);
4591
4591
  const q = ie(
4592
- async (B, _, k) => {
4592
+ async (z, _, k) => {
4593
4593
  const H = f.current;
4594
4594
  if (!H)
4595
4595
  throw new Error("No active thread to handle interrupt");
@@ -4608,19 +4608,14 @@ function $w({
4608
4608
  }, [q, N]);
4609
4609
  const I = ie(async () => {
4610
4610
  l(), C(), h(null);
4611
- try {
4612
- await t.getAgent("default");
4613
- } catch (B) {
4614
- console.warn("[StreamingProvider] Failed to refetch agent after clearing thread:", B);
4615
- }
4616
- }, [t, C, h, l]);
4611
+ }, [C, h, l]);
4617
4612
  Qe(() => {
4618
4613
  E(I);
4619
4614
  }, [I, E]);
4620
4615
  const G = ie(
4621
- async (B, _) => {
4616
+ async (z, _) => {
4622
4617
  let k = f.current;
4623
- const H = (B == null ? void 0 : B.text) ?? "", V = (B == null ? void 0 : B.attachments) ?? [], j = (H == null ? void 0 : H.trim()) ?? "", M = { ...(B == null ? void 0 : B.payload) ?? {} }, P = Array.isArray(M.messages) ? M.messages : void 0;
4618
+ const H = (z == null ? void 0 : z.text) ?? "", V = (z == null ? void 0 : z.attachments) ?? [], j = (H == null ? void 0 : H.trim()) ?? "", M = { ...(z == null ? void 0 : z.payload) ?? {} }, P = Array.isArray(M.messages) ? M.messages : void 0;
4624
4619
  P && delete M.messages;
4625
4620
  const L = !!(P && P.length);
4626
4621
  if (!k && !j && V.length === 0 && !L) return;
@@ -4628,7 +4623,7 @@ function $w({
4628
4623
  const Ce = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), Ae = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
4629
4624
  k = `${Ce}${Ae}`, w(k), h(k);
4630
4625
  }
4631
- const { contentParts: Q, filesInfo: z } = await sw(V), $ = [...Q];
4626
+ const { contentParts: Q, filesInfo: B } = await sw(V), $ = [...Q];
4632
4627
  j && $.push({ type: "text", text: H });
4633
4628
  const Z = _ == null ? void 0 : _.originalMessageId, Y = !!(_ != null && _.edit && Z), ee = !L && $.length > 0;
4634
4629
  let X = null;
@@ -4640,7 +4635,7 @@ function $w({
4640
4635
  }, Y ? S(X, Z) : S(X));
4641
4636
  const ae = L ? P : X ? [X] : [], xe = {
4642
4637
  ...M,
4643
- ...z.length ? { files_info: z } : {}
4638
+ ...B.length ? { files_info: B } : {}
4644
4639
  };
4645
4640
  ae.length ? xe.messages = ae : "messages" in xe || (xe.messages = []);
4646
4641
  let ue = (_ == null ? void 0 : _.checkpointId) ?? g.id ?? void 0, me = (_ == null ? void 0 : _.checkpointNs) ?? g.namespace ?? void 0;
@@ -5675,14 +5670,14 @@ const jb = (e) => ({
5675
5670
  }, f = Wi(o), v = Ui(f), g = await a.getDimensions(c), x = f === "y", b = x ? "top" : "left", w = x ? "bottom" : "right", y = x ? "clientHeight" : "clientWidth", C = s.reference[v] + s.reference[f] - h[f] - s.floating[v], S = h[f] - s.reference[f], T = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(c));
5676
5671
  let E = T ? T[y] : 0;
5677
5672
  (!E || !await (a.isElement == null ? void 0 : a.isElement(T))) && (E = i.floating[y] || s.floating[v]);
5678
- const N = C / 2 - S / 2, A = E / 2 - g[v] / 2 - 1, D = Ln(p[b], A), F = Ln(p[w], A), U = D, q = E - g[v] - F, I = E / 2 - g[v] / 2 + N, G = ni(U, I, q), K = !l.arrow && Br(o) != null && I !== G && s.reference[v] / 2 - (I < U ? D : F) - g[v] / 2 < 0, B = K ? I < U ? I - U : I - q : 0;
5673
+ const N = C / 2 - S / 2, A = E / 2 - g[v] / 2 - 1, D = Ln(p[b], A), F = Ln(p[w], A), U = D, q = E - g[v] - F, I = E / 2 - g[v] / 2 + N, G = ni(U, I, q), K = !l.arrow && Br(o) != null && I !== G && s.reference[v] / 2 - (I < U ? D : F) - g[v] / 2 < 0, z = K ? I < U ? I - U : I - q : 0;
5679
5674
  return {
5680
- [f]: h[f] + B,
5675
+ [f]: h[f] + z,
5681
5676
  data: {
5682
5677
  [f]: G,
5683
- centerOffset: I - G - B,
5678
+ centerOffset: I - G - z,
5684
5679
  ...K && {
5685
- alignmentOffset: B
5680
+ alignmentOffset: z
5686
5681
  }
5687
5682
  },
5688
5683
  reset: K
@@ -5738,12 +5733,12 @@ const jb = (e) => ({
5738
5733
  placement: G
5739
5734
  }
5740
5735
  };
5741
- let K = (U = D.filter((B) => B.overflows[0] <= 0).sort((B, _) => B.overflows[1] - _.overflows[1])[0]) == null ? void 0 : U.placement;
5736
+ let K = (U = D.filter((z) => z.overflows[0] <= 0).sort((z, _) => z.overflows[1] - _.overflows[1])[0]) == null ? void 0 : U.placement;
5742
5737
  if (!K)
5743
5738
  switch (f) {
5744
5739
  case "bestFit": {
5745
5740
  var q;
5746
- const B = (q = D.filter((_) => {
5741
+ const z = (q = D.filter((_) => {
5747
5742
  if (T) {
5748
5743
  const k = Sn(_.placement);
5749
5744
  return k === w || // Create a bias to the `y` side axis due to horizontal
@@ -5752,7 +5747,7 @@ const jb = (e) => ({
5752
5747
  }
5753
5748
  return !0;
5754
5749
  }).map((_) => [_.placement, _.overflows.filter((k) => k > 0).reduce((k, H) => k + H, 0)]).sort((_, k) => _[1] - k[1])[0]) == null ? void 0 : q[0];
5755
- B && (K = B);
5750
+ z && (K = z);
5756
5751
  break;
5757
5752
  }
5758
5753
  case "initialPlacement":
@@ -6629,7 +6624,7 @@ function by(e) {
6629
6624
  }), [w, y]), K = m.useMemo(() => ({
6630
6625
  reference: C,
6631
6626
  floating: S
6632
- }), [C, S]), B = m.useMemo(() => {
6627
+ }), [C, S]), z = m.useMemo(() => {
6633
6628
  const _ = {
6634
6629
  position: n,
6635
6630
  left: 0,
@@ -6655,8 +6650,8 @@ function by(e) {
6655
6650
  update: q,
6656
6651
  refs: G,
6657
6652
  elements: K,
6658
- floatingStyles: B
6659
- }), [d, q, G, K, B]);
6653
+ floatingStyles: z
6654
+ }), [d, q, G, K, z]);
6660
6655
  }
6661
6656
  const yy = (e) => {
6662
6657
  function t(n) {
@@ -6757,7 +6752,7 @@ var Zd = "PopperAnchor", Qd = m.forwardRef(
6757
6752
  Qd.displayName = Zd;
6758
6753
  var Yi = "PopperContent", [_y, Py] = Yd(Yi), ef = m.forwardRef(
6759
6754
  (e, t) => {
6760
- var z, $, Z, Y, ee, X;
6755
+ var B, $, Z, Y, ee, X;
6761
6756
  const {
6762
6757
  __scopePopper: n,
6763
6758
  side: r = "bottom",
@@ -6778,7 +6773,7 @@ var Yi = "PopperContent", [_y, Py] = Yd(Yi), ef = m.forwardRef(
6778
6773
  boundary: F.filter(Oy),
6779
6774
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
6780
6775
  altBoundary: U
6781
- }, { refs: I, floatingStyles: G, placement: K, isPositioned: B, middlewareData: _ } = by({
6776
+ }, { refs: I, floatingStyles: G, placement: K, isPositioned: z, middlewareData: _ } = by({
6782
6777
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
6783
6778
  strategy: "fixed",
6784
6779
  placement: A,
@@ -6810,9 +6805,9 @@ var Yi = "PopperContent", [_y, Py] = Yd(Yi), ef = m.forwardRef(
6810
6805
  ]
6811
6806
  }), [k, H] = rf(K), V = wt(v);
6812
6807
  Nt(() => {
6813
- B && (V == null || V());
6814
- }, [B, V]);
6815
- const j = (z = _.arrow) == null ? void 0 : z.x, M = ($ = _.arrow) == null ? void 0 : $.y, P = ((Z = _.arrow) == null ? void 0 : Z.centerOffset) !== 0, [L, Q] = m.useState();
6808
+ z && (V == null || V());
6809
+ }, [z, V]);
6810
+ const j = (B = _.arrow) == null ? void 0 : B.x, M = ($ = _.arrow) == null ? void 0 : $.y, P = ((Z = _.arrow) == null ? void 0 : Z.centerOffset) !== 0, [L, Q] = m.useState();
6816
6811
  return Nt(() => {
6817
6812
  b && Q(window.getComputedStyle(b).zIndex);
6818
6813
  }, [b]), /* @__PURE__ */ u.jsx(
@@ -6822,7 +6817,7 @@ var Yi = "PopperContent", [_y, Py] = Yd(Yi), ef = m.forwardRef(
6822
6817
  "data-radix-popper-content-wrapper": "",
6823
6818
  style: {
6824
6819
  ...G,
6825
- transform: B ? G.transform : "translate(0, -200%)",
6820
+ transform: z ? G.transform : "translate(0, -200%)",
6826
6821
  // keep off the page when measuring
6827
6822
  minWidth: "max-content",
6828
6823
  zIndex: L,
@@ -6859,7 +6854,7 @@ var Yi = "PopperContent", [_y, Py] = Yd(Yi), ef = m.forwardRef(
6859
6854
  ...g.style,
6860
6855
  // if the PopperContent hasn't been placed yet (not all measurements done)
6861
6856
  // we prevent animations so that users's animation don't kick in too early referring wrong sides
6862
- animation: B ? void 0 : "none"
6857
+ animation: z ? void 0 : "none"
6863
6858
  }
6864
6859
  }
6865
6860
  )
@@ -7809,9 +7804,9 @@ var sn = "MenuContent", [G0, rl] = pr(sn), Ef = m.forwardRef(
7809
7804
  onDismiss: f,
7810
7805
  disableOutsideScroll: v,
7811
7806
  ...g
7812
- } = e, x = hr(sn, n), b = jo(sn, n), w = Gs(n), y = yf(n), C = H0(n), [S, T] = m.useState(null), E = m.useRef(null), N = Be(t, E, x.onContentChange), A = m.useRef(0), D = m.useRef(""), F = m.useRef(0), U = m.useRef(null), q = m.useRef("right"), I = m.useRef(0), G = v ? qs : m.Fragment, K = v ? { as: J0, allowPinchZoom: !0 } : void 0, B = (k) => {
7813
- var z, $;
7814
- const H = D.current + k, V = C().filter((Z) => !Z.disabled), j = document.activeElement, M = (z = V.find((Z) => Z.ref.current === j)) == null ? void 0 : z.textValue, P = V.map((Z) => Z.textValue), L = cS(P, H, M), Q = ($ = V.find((Z) => Z.textValue === L)) == null ? void 0 : $.ref.current;
7807
+ } = e, x = hr(sn, n), b = jo(sn, n), w = Gs(n), y = yf(n), C = H0(n), [S, T] = m.useState(null), E = m.useRef(null), N = Be(t, E, x.onContentChange), A = m.useRef(0), D = m.useRef(""), F = m.useRef(0), U = m.useRef(null), q = m.useRef("right"), I = m.useRef(0), G = v ? qs : m.Fragment, K = v ? { as: J0, allowPinchZoom: !0 } : void 0, z = (k) => {
7808
+ var B, $;
7809
+ const H = D.current + k, V = C().filter((Z) => !Z.disabled), j = document.activeElement, M = (B = V.find((Z) => Z.ref.current === j)) == null ? void 0 : B.textValue, P = V.map((Z) => Z.textValue), L = cS(P, H, M), Q = ($ = V.find((Z) => Z.textValue === L)) == null ? void 0 : $.ref.current;
7815
7810
  (function Z(Y) {
7816
7811
  D.current = Y, window.clearTimeout(A.current), Y !== "" && (A.current = window.setTimeout(() => Z(""), 1e3));
7817
7812
  })(H), Q && setTimeout(() => Q.focus());
@@ -7897,11 +7892,11 @@ var sn = "MenuContent", [G0, rl] = pr(sn), Ef = m.forwardRef(
7897
7892
  style: { outline: "none", ...g.style },
7898
7893
  onKeyDown: se(g.onKeyDown, (k) => {
7899
7894
  const V = k.target.closest("[data-radix-menu-content]") === k.currentTarget, j = k.ctrlKey || k.altKey || k.metaKey, M = k.key.length === 1;
7900
- V && (k.key === "Tab" && k.preventDefault(), !j && M && B(k.key));
7895
+ V && (k.key === "Tab" && k.preventDefault(), !j && M && z(k.key));
7901
7896
  const P = E.current;
7902
7897
  if (k.target !== P || !F0.includes(k.key)) return;
7903
7898
  k.preventDefault();
7904
- const Q = C().filter((z) => !z.disabled).map((z) => z.ref.current);
7899
+ const Q = C().filter((B) => !B.disabled).map((B) => B.ref.current);
7905
7900
  wf.includes(k.key) && Q.reverse(), iS(Q);
7906
7901
  }),
7907
7902
  onBlur: se(e.onBlur, (k) => {
@@ -8612,7 +8607,7 @@ function eT({
8612
8607
  const P = (C ?? "").trim();
8613
8608
  D.current !== P && G(P);
8614
8609
  }, [C, F, G]);
8615
- const B = O.useCallback(
8610
+ const z = O.useCallback(
8616
8611
  (P, { fromUser: L }) => {
8617
8612
  b || y(P), L && (i == null || i(P));
8618
8613
  },
@@ -8628,7 +8623,7 @@ function eT({
8628
8623
  id: Q,
8629
8624
  shouldClear: !0
8630
8625
  }, T(() => {
8631
- var z, $, Z;
8626
+ var B, $, Z;
8632
8627
  try {
8633
8628
  const Y = l(L);
8634
8629
  Y && typeof Y.then == "function" ? Y.then(() => {
@@ -8637,7 +8632,7 @@ function eT({
8637
8632
  }).catch(() => {
8638
8633
  var ee;
8639
8634
  ((ee = A.current) == null ? void 0 : ee.id) === Q && (A.current = null);
8640
- }) : (((z = A.current) == null ? void 0 : z.id) === Q && A.current.shouldClear && (b || (y(""), E.current && (E.current.style.height = "auto"), i == null || i(""))), (($ = A.current) == null ? void 0 : $.id) === Q && (A.current = null));
8635
+ }) : (((B = A.current) == null ? void 0 : B.id) === Q && A.current.shouldClear && (b || (y(""), E.current && (E.current.style.height = "auto"), i == null || i(""))), (($ = A.current) == null ? void 0 : $.id) === Q && (A.current = null));
8641
8636
  } catch {
8642
8637
  ((Z = A.current) == null ? void 0 : Z.id) === Q && (A.current = null);
8643
8638
  }
@@ -8646,8 +8641,8 @@ function eT({
8646
8641
  [C, l, f, b, i, G]
8647
8642
  ), k = O.useCallback((P) => {
8648
8643
  const L = P.target.value;
8649
- B(L, { fromUser: !0 }), A.current && (A.current.shouldClear = !1), E.current && (E.current.style.height = "auto", E.current.style.height = `${E.current.scrollHeight}px`), F && G(L.trim());
8650
- }, [B, G, F]), H = O.useCallback(
8644
+ z(L, { fromUser: !0 }), A.current && (A.current.shouldClear = !1), E.current && (E.current.style.height = "auto", E.current.style.height = `${E.current.scrollHeight}px`), F && G(L.trim());
8645
+ }, [z, G, F]), H = O.useCallback(
8651
8646
  (P) => {
8652
8647
  P.key === "Enter" && !P.shiftKey ? (P.preventDefault(), _()) : P.key === "Escape" && t && (P.preventDefault(), c == null || c());
8653
8648
  },
@@ -8723,17 +8718,17 @@ function nT({
8723
8718
  }) {
8724
8719
  const [w, y] = fe([]), C = Oe(null), S = Oe(null), [T, E] = fe(0), [N, A] = fe(0), [D, F] = fe(!1), [U, q] = fe(null), [I, G] = fe(null), K = ie(() => {
8725
8720
  C.current && (C.current.value = ""), S.current && (S.current.value = ""), E((P) => P + 1), A((P) => P + 1);
8726
- }, []), B = ie((P) => {
8721
+ }, []), z = ie((P) => {
8727
8722
  y((L) => [...L, ...P]);
8728
8723
  }, []), _ = ie(
8729
8724
  (P) => {
8730
8725
  const L = Array.from(P.target.files || []);
8731
- B(L), P.target.value = "";
8726
+ z(L), P.target.value = "";
8732
8727
  },
8733
- [B]
8728
+ [z]
8734
8729
  ), k = ie((P) => {
8735
8730
  y((L) => {
8736
- const Q = L.filter((z, $) => $ !== P);
8731
+ const Q = L.filter((B, $) => $ !== P);
8737
8732
  return Q.length === 0 && K(), Q;
8738
8733
  });
8739
8734
  }, [K]), H = ie(
@@ -8744,8 +8739,8 @@ function nT({
8744
8739
  try {
8745
8740
  await v(L), q(`Uploaded ${L.name} - processing through chat stream`);
8746
8741
  } catch (Q) {
8747
- const z = Q instanceof Error ? Q.message : "Failed to upload Excel file";
8748
- G(z), g == null || g(z);
8742
+ const B = Q instanceof Error ? Q.message : "Failed to upload Excel file";
8743
+ G(B), g == null || g(B);
8749
8744
  } finally {
8750
8745
  F(!1), P.target.value = "", K();
8751
8746
  }
@@ -9739,8 +9734,8 @@ const RT = {
9739
9734
  const q = Zn(T.sizeTree);
9740
9735
  return F !== S && q.shift(), q.reduce(
9741
9736
  (I, { k: G, v: K }) => {
9742
- let B = I.ranges;
9743
- return I.prevSize !== 0 && (B = [
9737
+ let z = I.ranges;
9738
+ return I.prevSize !== 0 && (z = [
9744
9739
  ...I.ranges,
9745
9740
  {
9746
9741
  endIndex: G + S - 1,
@@ -9750,7 +9745,7 @@ const RT = {
9750
9745
  ]), {
9751
9746
  prevIndex: G + S,
9752
9747
  prevSize: K,
9753
- ranges: B
9748
+ ranges: z
9754
9749
  };
9755
9750
  },
9756
9751
  {
@@ -9937,13 +9932,13 @@ const _o = Je(
9937
9932
  q,
9938
9933
  I
9939
9934
  ]) => {
9940
- const G = Rp(C), { align: K, behavior: B, offset: _ } = G, k = E - 1, H = Ep(G, S, k);
9935
+ const G = Rp(C), { align: K, behavior: z, offset: _ } = G, k = E - 1, H = Ep(G, S, k);
9941
9936
  let V = ho(H, S.offsetTree, U) + A;
9942
9937
  K === "end" ? (V += q + hn(S.sizeTree, H)[1] - T + I, H === k && (V += D)) : K === "center" ? V += (q + hn(S.sizeTree, H)[1] - T + I) / 2 : V -= N, _ && (V += _);
9943
9938
  const j = (M) => {
9944
9939
  y(), M ? (F("retrying to scroll to", { location: C }, qt.DEBUG), _e(f, C)) : (_e(v, !0), F("list did not change, scroll successful", {}, qt.DEBUG));
9945
9940
  };
9946
- if (y(), B === "smooth") {
9941
+ if (y(), z === "smooth") {
9947
9942
  let M = !1;
9948
9943
  w = et(t, (P) => {
9949
9944
  M = M || P;
@@ -9954,7 +9949,7 @@ const _o = Je(
9954
9949
  x = dn(te(t, AT(150)), j);
9955
9950
  return b = setTimeout(() => {
9956
9951
  y();
9957
- }, 1200), _e(l, !0), F("scrolling from index to", { behavior: B, index: H, top: V }, qt.DEBUG), { behavior: B, top: V };
9952
+ }, 1200), _e(l, !0), F("scrolling from index to", { behavior: z, index: H, top: V }, qt.DEBUG), { behavior: z, top: V };
9958
9953
  }
9959
9954
  )
9960
9955
  ),
@@ -10367,7 +10362,7 @@ const gr = Je(
10367
10362
  I,
10368
10363
  G
10369
10364
  ]) => {
10370
- const K = A, { offsetTree: B, sizeTree: _ } = K, k = vt(x);
10365
+ const K = A, { offsetTree: z, sizeTree: _ } = K, k = vt(x);
10371
10366
  if (N === 0)
10372
10367
  return { ...Da, totalCount: N };
10373
10368
  if (T === 0 && E === 0)
@@ -10384,25 +10379,25 @@ const gr = Je(
10384
10379
  const H = [];
10385
10380
  if (U.length > 0) {
10386
10381
  const L = U[0], Q = U[U.length - 1];
10387
- let z = 0;
10382
+ let B = 0;
10388
10383
  for (const $ of ea(_, L, Q)) {
10389
10384
  const Z = $.value, Y = Math.max($.start, L), ee = Math.min($.end, Q);
10390
10385
  for (let X = Y; X <= ee; X++)
10391
- H.push({ data: G == null ? void 0 : G[X], index: X, offset: z, size: Z }), z += Z;
10386
+ H.push({ data: G == null ? void 0 : G[X], index: X, offset: B, size: Z }), B += Z;
10392
10387
  }
10393
10388
  }
10394
10389
  if (!F)
10395
10390
  return is([], H, N, I, K, q);
10396
- const V = U.length > 0 ? U[U.length - 1] + 1 : 0, j = ST(B, T, E, V);
10391
+ const V = U.length > 0 ? U[U.length - 1] + 1 : 0, j = ST(z, T, E, V);
10397
10392
  if (j.length === 0)
10398
10393
  return null;
10399
10394
  const M = N - 1, P = Qs([], (L) => {
10400
10395
  for (const Q of j) {
10401
- const z = Q.value;
10402
- let $ = z.offset, Z = Q.start;
10403
- const Y = z.size;
10404
- if (z.offset < T) {
10405
- Z += Math.floor((T - z.offset + I) / (Y + I));
10396
+ const B = Q.value;
10397
+ let $ = B.offset, Z = Q.start;
10398
+ const Y = B.size;
10399
+ if (B.offset < T) {
10400
+ Z += Math.floor((T - B.offset + I) / (Y + I));
10406
10401
  const X = Z - Q.start;
10407
10402
  $ += X * Y + X * I;
10408
10403
  }
@@ -11574,7 +11569,7 @@ const vC = /* @__PURE__ */ Je(
11574
11569
  { customScrollParent: x, useWindowScroll: b, windowScrollContainerState: w, windowScrollTo: y, windowViewportRect: C },
11575
11570
  S
11576
11571
  ]) => {
11577
- const T = oe(0), E = oe(0), N = oe(uu), A = oe({ height: 0, width: 0 }), D = oe({ height: 0, width: 0 }), F = Ve(), U = Ve(), q = oe(0), I = oe(null), G = oe({ column: 0, row: 0 }), K = Ve(), B = Ve(), _ = oe(!1), k = oe(0), H = oe(!0), V = oe(!1), j = oe(!1);
11572
+ const T = oe(0), E = oe(0), N = oe(uu), A = oe({ height: 0, width: 0 }), D = oe({ height: 0, width: 0 }), F = Ve(), U = Ve(), q = oe(0), I = oe(null), G = oe({ column: 0, row: 0 }), K = Ve(), z = Ve(), _ = oe(!1), k = oe(0), H = oe(!0), V = oe(!1), j = oe(!1);
11578
11573
  et(
11579
11574
  te(
11580
11575
  v,
@@ -11598,7 +11593,7 @@ const vC = /* @__PURE__ */ Je(
11598
11593
  }
11599
11594
  ), we(
11600
11595
  te(
11601
- B,
11596
+ z,
11602
11597
  ke(($) => $ != null && $.scrollTop > 0),
11603
11598
  bn(0)
11604
11599
  ),
@@ -11606,7 +11601,7 @@ const vC = /* @__PURE__ */ Je(
11606
11601
  ), et(
11607
11602
  te(
11608
11603
  v,
11609
- Fe(B),
11604
+ Fe(z),
11610
11605
  ke(([, $]) => $ != null)
11611
11606
  ),
11612
11607
  ([, $]) => {
@@ -11754,7 +11749,7 @@ const vC = /* @__PURE__ */ Je(
11754
11749
  ),
11755
11750
  l
11756
11751
  );
11757
- const z = Dt(
11752
+ const B = Dt(
11758
11753
  te(
11759
11754
  N,
11760
11755
  de(($) => $.offsetBottom + $.bottom)
@@ -11779,7 +11774,7 @@ const vC = /* @__PURE__ */ Je(
11779
11774
  initialItemCount: E,
11780
11775
  itemDimensions: D,
11781
11776
  overscan: n,
11782
- restoreStateFrom: B,
11777
+ restoreStateFrom: z,
11783
11778
  scrollBy: a,
11784
11779
  scrollContainerState: i,
11785
11780
  scrollHeight: U,
@@ -11798,7 +11793,7 @@ const vC = /* @__PURE__ */ Je(
11798
11793
  gridState: N,
11799
11794
  horizontalDirection: j,
11800
11795
  initialTopMostItemIndex: k,
11801
- totalListHeight: z,
11796
+ totalListHeight: B,
11802
11797
  ...h,
11803
11798
  endReached: P,
11804
11799
  propsReady: g,
@@ -14916,7 +14911,7 @@ function AE({
14916
14911
  ), K = $e(
14917
14912
  () => G.map((M) => M.text ?? "").join(""),
14918
14913
  [G]
14919
- ), B = $e(() => {
14914
+ ), z = $e(() => {
14920
14915
  if (!h)
14921
14916
  return null;
14922
14917
  const M = jE(K);
@@ -14925,13 +14920,13 @@ function AE({
14925
14920
  tailPart: K.slice(M)
14926
14921
  };
14927
14922
  }, [K, h]), _ = $e(() => {
14928
- if (!B) return null;
14929
- const { stablePart: M, tailPart: P } = B;
14923
+ if (!z) return null;
14924
+ const { stablePart: M, tailPart: P } = z;
14930
14925
  return !M && !P ? null : /* @__PURE__ */ u.jsxs("div", { className: "space-y-2", children: [
14931
14926
  M ? /* @__PURE__ */ u.jsx(or, { content: M, allowHtml: !1 }) : null,
14932
14927
  P ? /* @__PURE__ */ u.jsx(or, { content: P, allowHtml: !1 }) : null
14933
14928
  ] });
14934
- }, [B]), k = $e(() => {
14929
+ }, [z]), k = $e(() => {
14935
14930
  if (!h)
14936
14931
  return I;
14937
14932
  const M = [];
@@ -14952,8 +14947,8 @@ function AE({
14952
14947
  if (M.type === "text") {
14953
14948
  if (h)
14954
14949
  return null;
14955
- const L = M.text ?? "", Q = L.trim(), z = ko(Q);
14956
- return z && y !== "tool" ? /* @__PURE__ */ u.jsx(hi, { data: z }, P) : y === "user" && C && Q.length > S ? /* @__PURE__ */ u.jsx(
14950
+ const L = M.text ?? "", Q = L.trim(), B = ko(Q);
14951
+ return B && y !== "tool" ? /* @__PURE__ */ u.jsx(hi, { data: B }, P) : y === "user" && C && Q.length > S ? /* @__PURE__ */ u.jsx(
14957
14952
  wE,
14958
14953
  {
14959
14954
  text: Q,
@@ -14983,7 +14978,7 @@ function AE({
14983
14978
  "a",
14984
14979
  {
14985
14980
  href: L.url,
14986
- onClick: (z) => v(z, L, P),
14981
+ onClick: (B) => v(B, L, P),
14987
14982
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
14988
14983
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
14989
14984
  children: [
@@ -15000,7 +14995,7 @@ function AE({
15000
14995
  if (M.type === "interrupt") {
15001
14996
  const L = M, Q = ns(
15002
14997
  (L == null ? void 0 : L.id) ?? (L == null ? void 0 : L.interrupt_id)
15003
- ), z = !!(A && Q && Q === A), $ = z ? D ?? (L == null ? void 0 : L.value) : L == null ? void 0 : L.value, Z = Q ? { ...L, id: Q, interrupt_id: Q } : L;
14998
+ ), B = !!(A && Q && Q === A), $ = B ? D ?? (L == null ? void 0 : L.value) : L == null ? void 0 : L.value, Z = Q ? { ...L, id: Q, interrupt_id: Q } : L;
15004
14999
  return /* @__PURE__ */ u.jsx(
15005
15000
  mE,
15006
15001
  {
@@ -15008,7 +15003,7 @@ function AE({
15008
15003
  onApprove: x,
15009
15004
  onReject: b,
15010
15005
  disabled: w,
15011
- isActive: z,
15006
+ isActive: B,
15012
15007
  payload: $
15013
15008
  },
15014
15009
  P
@@ -15283,13 +15278,13 @@ const Pl = Fg(function({
15283
15278
  onSelectCheckpoint: A,
15284
15279
  attemptMetas: D = []
15285
15280
  }) {
15286
- const [F, U] = fe(!1), [q, I] = fe("preview"), [G, K] = fe(!1), { currentThreadId: B } = Eo(), { respondToInterrupt: _ } = $s(), k = l === "phone" || l === "half-screen", H = t.role, V = H === "tool", j = $e(() => t.role === "default_message" ? t : null, [t]), M = !!j, P = !(r && H !== "user"), {
15281
+ const [F, U] = fe(!1), [q, I] = fe("preview"), [G, K] = fe(!1), { currentThreadId: z } = Eo(), { respondToInterrupt: _ } = $s(), k = l === "phone" || l === "half-screen", H = t.role, V = H === "tool", j = $e(() => t.role === "default_message" ? t : null, [t]), M = !!j, P = !(r && H !== "user"), {
15287
15282
  uploadingFiles: L,
15288
15283
  handleFileClick: Q,
15289
- fileViewerOpen: z,
15284
+ fileViewerOpen: B,
15290
15285
  currentFileInfo: $,
15291
15286
  closeFileViewer: Z
15292
- } = yE({ allowFileOpen: P, currentThreadId: B }), Y = $e(() => {
15287
+ } = yE({ allowFileOpen: P, currentThreadId: z }), Y = $e(() => {
15293
15288
  switch (H) {
15294
15289
  case "user":
15295
15290
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -15580,7 +15575,7 @@ const Pl = Fg(function({
15580
15575
  $ && /* @__PURE__ */ u.jsx(
15581
15576
  KC,
15582
15577
  {
15583
- isOpen: z,
15578
+ isOpen: B,
15584
15579
  onClose: Z,
15585
15580
  fileId: $.id,
15586
15581
  fileName: $.name,
@@ -15637,10 +15632,10 @@ const Rh = O.forwardRef(({
15637
15632
  createSyntheticThinkingMessage: D = !0,
15638
15633
  forceSyntheticThinking: F = !1
15639
15634
  }, U) => {
15640
- const q = Oe(null), I = Oe(null), G = Oe(!1), K = Oe(!1), B = $e(() => w ? e.some((Y) => Y.role === "default_message" ? !1 : Array.isArray(Y == null ? void 0 : Y.content) && Y.content.some(
15635
+ const q = Oe(null), I = Oe(null), G = Oe(!1), K = Oe(!1), z = $e(() => w ? e.some((Y) => Y.role === "default_message" ? !1 : Array.isArray(Y == null ? void 0 : Y.content) && Y.content.some(
15641
15636
  (ee) => ee && ee.type === "interrupt" && (ee.id ?? ee.interrupt_id) === w.id
15642
15637
  )) : !1, [w, e]), _ = $e(() => {
15643
- if (!w || B)
15638
+ if (!w || z)
15644
15639
  return null;
15645
15640
  const Y = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
15646
15641
  let ee;
@@ -15662,7 +15657,7 @@ const Rh = O.forwardRef(({
15662
15657
  }
15663
15658
  ]
15664
15659
  };
15665
- }, [w, B]), k = $e(() => _ ? [...e, _] : e, [e, _]), H = $e(() => {
15660
+ }, [w, z]), k = $e(() => _ ? [...e, _] : e, [e, _]), H = $e(() => {
15666
15661
  const Y = n && k.some((X) => X.id === n);
15667
15662
  return D && (t || F) && !Y && k.length > 0 ? [
15668
15663
  ...k,
@@ -15697,7 +15692,7 @@ const Rh = O.forwardRef(({
15697
15692
  content: Y,
15698
15693
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
15699
15694
  };
15700
- }, [f, V]), Q = ["flex h-full flex-col md:flex-row", p].filter(Boolean).join(" "), z = () => L ? /* @__PURE__ */ u.jsx("div", { className: "p-6 h-full overflow-y-auto", children: /* @__PURE__ */ u.jsx("div", { className: "w-full max-w-full", children: /* @__PURE__ */ u.jsx(
15695
+ }, [f, V]), Q = ["flex h-full flex-col md:flex-row", p].filter(Boolean).join(" "), B = () => L ? /* @__PURE__ */ u.jsx("div", { className: "p-6 h-full overflow-y-auto", children: /* @__PURE__ */ u.jsx("div", { className: "w-full max-w-full", children: /* @__PURE__ */ u.jsx(
15701
15696
  Pl,
15702
15697
  {
15703
15698
  message: L,
@@ -15796,7 +15791,7 @@ const Rh = O.forwardRef(({
15796
15791
  }
15797
15792
  )
15798
15793
  }
15799
- ) : z() }) });
15794
+ ) : B() }) });
15800
15795
  });
15801
15796
  Rh.displayName = "MessageList";
15802
15797
  const ku = {
@@ -15833,7 +15828,7 @@ function oo({
15833
15828
  interrupt: F,
15834
15829
  metadata: U,
15835
15830
  checkpointIndex: q
15836
- } = $s(), { isStreaming: I, error: G, connectionState: K, submit: B, stop: _ } = Fw(), k = y ?? w ?? null, H = (A == null ? void 0 : A.id) ?? null, V = (A == null ? void 0 : A.namespace) ?? null, j = (U == null ? void 0 : U.assemblingMessageId) ?? null, M = F, [P, L] = fe(!1), [Q, z] = fe(!1);
15831
+ } = $s(), { isStreaming: I, error: G, connectionState: K, submit: z, stop: _ } = Fw(), k = y ?? w ?? null, H = (A == null ? void 0 : A.id) ?? null, V = (A == null ? void 0 : A.namespace) ?? null, j = (U == null ? void 0 : U.assemblingMessageId) ?? null, M = F, [P, L] = fe(!1), [Q, B] = fe(!1);
15837
15832
  Qe(() => {
15838
15833
  M || L(!1);
15839
15834
  }, [M]);
@@ -15850,9 +15845,9 @@ function oo({
15850
15845
  [tt]
15851
15846
  );
15852
15847
  Qe(() => {
15853
- I || z(!1);
15848
+ I || B(!1);
15854
15849
  }, [I]), Qe(() => {
15855
- U != null && U.assemblingMessageId && z(!1);
15850
+ U != null && U.assemblingMessageId && B(!1);
15856
15851
  }, [U == null ? void 0 : U.assemblingMessageId]);
15857
15852
  const [Et, Rt] = fe("desktop");
15858
15853
  Qe(() => {
@@ -15896,7 +15891,7 @@ function oo({
15896
15891
  if (!(!Me && ye.length === 0))
15897
15892
  try {
15898
15893
  const Ye = ee ? (ue == null ? void 0 : ue.checkpointId) ?? H ?? void 0 : H ?? void 0, dt = ee ? (ue == null ? void 0 : ue.checkpointNs) ?? V ?? void 0 : V ?? void 0;
15899
- await B(
15894
+ await z(
15900
15895
  {
15901
15896
  text: Me || "",
15902
15897
  attachments: ye,
@@ -15908,14 +15903,14 @@ function oo({
15908
15903
  edit: !!ee,
15909
15904
  originalMessageId: ee ?? void 0
15910
15905
  }
15911
- ), f == null || f(Me), z(!0), tt(""), Ce(null), X(null), xe(""), me(null);
15906
+ ), f == null || f(Me), B(!0), tt(""), Ce(null), X(null), xe(""), me(null);
15912
15907
  } catch (Ye) {
15913
15908
  const dt = (Ye == null ? void 0 : Ye.message) || "Failed to send message";
15914
- Ce(dt), g == null || g(dt), z(!1);
15909
+ Ce(dt), g == null || g(dt), B(!1);
15915
15910
  }
15916
15911
  }, jt = ie(
15917
15912
  async (he) => {
15918
- await B(
15913
+ await z(
15919
15914
  { attachments: [he], payload: p },
15920
15915
  {
15921
15916
  checkpointId: H ?? void 0,
@@ -15923,7 +15918,7 @@ function oo({
15923
15918
  }
15924
15919
  ), v == null || v({ file: he });
15925
15920
  },
15926
- [H, V, p, v, B]
15921
+ [H, V, p, v, z]
15927
15922
  ), zt = O.useCallback(
15928
15923
  (he, ye, Me) => {
15929
15924
  c && (Le.current = De, X(he), xe(ye), tt(ye), Ce(null), me({
@@ -15954,7 +15949,7 @@ function oo({
15954
15949
  return String(Me);
15955
15950
  }
15956
15951
  })();
15957
- dt && B(
15952
+ dt && z(
15958
15953
  { text: dt, payload: p },
15959
15954
  {
15960
15955
  checkpointId: H ?? void 0,
@@ -15963,7 +15958,7 @@ function oo({
15963
15958
  originalMessageId: ye.id
15964
15959
  }
15965
15960
  );
15966
- }, [C, B, H, V, p]), _t = async (he) => {
15961
+ }, [C, z, H, V, p]), _t = async (he) => {
15967
15962
  if (w) {
15968
15963
  it(!0);
15969
15964
  try {
@@ -16129,7 +16124,7 @@ var Jr = '[cmdk-group=""]', Va = '[cmdk-group-items=""]', VE = '[cmdk-group-head
16129
16124
  T(6, q);
16130
16125
  }, []);
16131
16126
  let E = m.useMemo(() => ({ subscribe: (j) => (a.current.add(j), () => a.current.delete(j)), snapshot: () => n.current, setState: (j, M, P) => {
16132
- var L, Q, z, $;
16127
+ var L, Q, B, $;
16133
16128
  if (!Object.is(n.current[j], M)) {
16134
16129
  if (n.current[j] = M, j === "search") U(), D(), T(1, F);
16135
16130
  else if (j === "value") {
@@ -16142,7 +16137,7 @@ var Jr = '[cmdk-group=""]', Va = '[cmdk-group-items=""]', VE = '[cmdk-group-head
16142
16137
  n.current.selectedItemId = (Z = I()) == null ? void 0 : Z.id, E.emit();
16143
16138
  }), P || T(5, q), ((Q = i.current) == null ? void 0 : Q.value) !== void 0) {
16144
16139
  let Z = M ?? "";
16145
- ($ = (z = i.current).onValueChange) == null || $.call(z, Z);
16140
+ ($ = (B = i.current).onValueChange) == null || $.call(B, Z);
16146
16141
  return;
16147
16142
  }
16148
16143
  }
@@ -16175,24 +16170,24 @@ var Jr = '[cmdk-group=""]', Va = '[cmdk-group-items=""]', VE = '[cmdk-group-head
16175
16170
  if (!n.current.search || i.current.shouldFilter === !1) return;
16176
16171
  let j = n.current.filtered.items, M = [];
16177
16172
  n.current.filtered.groups.forEach((L) => {
16178
- let Q = o.current.get(L), z = 0;
16173
+ let Q = o.current.get(L), B = 0;
16179
16174
  Q.forEach(($) => {
16180
16175
  let Z = j.get($);
16181
- z = Math.max(Z, z);
16182
- }), M.push([L, z]);
16176
+ B = Math.max(Z, B);
16177
+ }), M.push([L, B]);
16183
16178
  });
16184
16179
  let P = S.current;
16185
16180
  G().sort((L, Q) => {
16186
- var z, $;
16181
+ var B, $;
16187
16182
  let Z = L.getAttribute("id"), Y = Q.getAttribute("id");
16188
- return ((z = j.get(Y)) != null ? z : 0) - (($ = j.get(Z)) != null ? $ : 0);
16183
+ return ((B = j.get(Y)) != null ? B : 0) - (($ = j.get(Z)) != null ? $ : 0);
16189
16184
  }).forEach((L) => {
16190
16185
  let Q = L.closest(Va);
16191
16186
  Q ? Q.appendChild(L.parentElement === Q ? L : L.closest(`${Va} > *`)) : P.appendChild(L.parentElement === P ? L : L.closest(`${Va} > *`));
16192
16187
  }), M.sort((L, Q) => Q[1] - L[1]).forEach((L) => {
16193
16188
  var Q;
16194
- let z = (Q = S.current) == null ? void 0 : Q.querySelector(`${Jr}[${Sr}="${encodeURIComponent(L[0])}"]`);
16195
- z == null || z.parentElement.appendChild(z);
16189
+ let B = (Q = S.current) == null ? void 0 : Q.querySelector(`${Jr}[${Sr}="${encodeURIComponent(L[0])}"]`);
16190
+ B == null || B.parentElement.appendChild(B);
16196
16191
  });
16197
16192
  }
16198
16193
  function F() {
@@ -16207,12 +16202,12 @@ var Jr = '[cmdk-group=""]', Va = '[cmdk-group-items=""]', VE = '[cmdk-group-head
16207
16202
  }
16208
16203
  n.current.filtered.groups = /* @__PURE__ */ new Set();
16209
16204
  let Q = 0;
16210
- for (let z of r.current) {
16211
- let $ = (M = (j = s.current.get(z)) == null ? void 0 : j.value) != null ? M : "", Z = (L = (P = s.current.get(z)) == null ? void 0 : P.keywords) != null ? L : [], Y = A($, Z);
16212
- n.current.filtered.items.set(z, Y), Y > 0 && Q++;
16205
+ for (let B of r.current) {
16206
+ let $ = (M = (j = s.current.get(B)) == null ? void 0 : j.value) != null ? M : "", Z = (L = (P = s.current.get(B)) == null ? void 0 : P.keywords) != null ? L : [], Y = A($, Z);
16207
+ n.current.filtered.items.set(B, Y), Y > 0 && Q++;
16213
16208
  }
16214
- for (let [z, $] of o.current) for (let Z of $) if (n.current.filtered.items.get(Z) > 0) {
16215
- n.current.filtered.groups.add(z);
16209
+ for (let [B, $] of o.current) for (let Z of $) if (n.current.filtered.items.get(Z) > 0) {
16210
+ n.current.filtered.groups.add(B);
16216
16211
  break;
16217
16212
  }
16218
16213
  n.current.filtered.count = Q;
@@ -16234,20 +16229,20 @@ var Jr = '[cmdk-group=""]', Va = '[cmdk-group-items=""]', VE = '[cmdk-group-head
16234
16229
  let M = G()[j];
16235
16230
  M && E.setState("value", M.getAttribute(Sr));
16236
16231
  }
16237
- function B(j) {
16232
+ function z(j) {
16238
16233
  var M;
16239
- let P = I(), L = G(), Q = L.findIndex(($) => $ === P), z = L[Q + j];
16240
- (M = i.current) != null && M.loop && (z = Q + j < 0 ? L[L.length - 1] : Q + j === L.length ? L[0] : L[Q + j]), z && E.setState("value", z.getAttribute(Sr));
16234
+ let P = I(), L = G(), Q = L.findIndex(($) => $ === P), B = L[Q + j];
16235
+ (M = i.current) != null && M.loop && (B = Q + j < 0 ? L[L.length - 1] : Q + j === L.length ? L[0] : L[Q + j]), B && E.setState("value", B.getAttribute(Sr));
16241
16236
  }
16242
16237
  function _(j) {
16243
16238
  let M = I(), P = M == null ? void 0 : M.closest(Jr), L;
16244
16239
  for (; P && !L; ) P = j > 0 ? tk(P, Jr) : nk(P, Jr), L = P == null ? void 0 : P.querySelector(Nu);
16245
- L ? E.setState("value", L.getAttribute(Sr)) : B(j);
16240
+ L ? E.setState("value", L.getAttribute(Sr)) : z(j);
16246
16241
  }
16247
16242
  let k = () => K(G().length - 1), H = (j) => {
16248
- j.preventDefault(), j.metaKey ? k() : j.altKey ? _(1) : B(1);
16243
+ j.preventDefault(), j.metaKey ? k() : j.altKey ? _(1) : z(1);
16249
16244
  }, V = (j) => {
16250
- j.preventDefault(), j.metaKey ? K(0) : j.altKey ? _(-1) : B(-1);
16245
+ j.preventDefault(), j.metaKey ? K(0) : j.altKey ? _(-1) : z(-1);
16251
16246
  };
16252
16247
  return m.createElement(ge.div, { ref: t, tabIndex: -1, ...b, "cmdk-root": "", onKeyDown: (j) => {
16253
16248
  var M;
@@ -17219,7 +17214,7 @@ function vi({
17219
17214
  shareInFlight: F,
17220
17215
  shareStatus: U,
17221
17216
  clearShareStatus: q
17222
- } = Eo(), { createThread: I, deleteThread: G, renameThread: K, shareThread: B } = D, { loadThread: _ } = $s(), k = a ?? T, [H, V] = fe(Array.isArray(C) ? C : []), j = Oe(H.length > 0), M = Oe(null), P = Oe(0), [L, Q] = fe(null), [z, $] = fe(""), [Z, Y] = fe(!1), [ee, X] = fe(!1), [ae, xe] = fe(null), [ue, me] = fe(""), Se = v && v.length > 0 ? v : Rk, Ce = kk({ defaultView: h }), Ae = g ?? Ce, ht = p ?? Ae.view, ut = ie(
17217
+ } = Eo(), { createThread: I, deleteThread: G, renameThread: K, shareThread: z } = D, { loadThread: _ } = $s(), k = a ?? T, [H, V] = fe(Array.isArray(C) ? C : []), j = Oe(H.length > 0), M = Oe(null), P = Oe(0), [L, Q] = fe(null), [B, $] = fe(""), [Z, Y] = fe(!1), [ee, X] = fe(!1), [ae, xe] = fe(null), [ue, me] = fe(""), Se = v && v.length > 0 ? v : Rk, Ce = kk({ defaultView: h }), Ae = g ?? Ce, ht = p ?? Ae.view, ut = ie(
17223
17218
  (J) => {
17224
17219
  p || Ae.setView(J), f == null || f(J);
17225
17220
  },
@@ -17232,12 +17227,12 @@ function vi({
17232
17227
  async (J) => {
17233
17228
  if (!(!ae || F) && J.id)
17234
17229
  try {
17235
- await B(ae, J.id), setTimeout(() => De(), 600);
17230
+ await z(ae, J.id), setTimeout(() => De(), 600);
17236
17231
  } catch (ce) {
17237
17232
  console.error("Failed to share thread:", ce);
17238
17233
  }
17239
17234
  },
17240
- [De, F, ae, B]
17235
+ [De, F, ae, z]
17241
17236
  ), Pe = $e(() => {
17242
17237
  const J = b ?? [], ce = ue.trim().toLowerCase();
17243
17238
  return ce ? y ? J.filter((Ke) => y(Ke, ce)) : J.filter((Ke) => `${Ke.label} ${Ke.secondaryLabel ?? ""}`.toLowerCase().includes(ce)) : J;
@@ -17298,9 +17293,9 @@ function vi({
17298
17293
  }, jt = (J, ce) => {
17299
17294
  ce.stopPropagation(), Q(J.threadId), $(J.title || `Thread ${J.threadId.slice(0, 8)}`);
17300
17295
  }, zt = async (J) => {
17301
- if (z.trim())
17296
+ if (B.trim())
17302
17297
  try {
17303
- await K(J, z.trim()), Q(null), $("");
17298
+ await K(J, B.trim()), Q(null), $("");
17304
17299
  } catch (ce) {
17305
17300
  console.error("Failed to update title:", ce);
17306
17301
  }
@@ -17388,7 +17383,7 @@ function vi({
17388
17383
  thread: J,
17389
17384
  isActive: k === J.threadId,
17390
17385
  editingThreadId: L,
17391
- editingTitle: z,
17386
+ editingTitle: B,
17392
17387
  onSelect: Et,
17393
17388
  onStartEditing: jt,
17394
17389
  onEditingTitleChange: (ce) => $(ce),
@@ -17771,11 +17766,11 @@ var Pk = la, Mk = [" ", "Enter", "ArrowUp", "ArrowDown"], Ok = [" ", "Enter"], d
17771
17766
  {
17772
17767
  scope: e.__scopeSelect,
17773
17768
  onNativeOptionAdd: m.useCallback((K) => {
17774
- I((B) => new Set(B).add(K));
17769
+ I((z) => new Set(z).add(K));
17775
17770
  }, []),
17776
17771
  onNativeOptionRemove: m.useCallback((K) => {
17777
- I((B) => {
17778
- const _ = new Set(B);
17772
+ I((z) => {
17773
+ const _ = new Set(z);
17779
17774
  return _.delete(K), _;
17780
17775
  });
17781
17776
  }, []),
@@ -17914,62 +17909,62 @@ var un = 10, [xm, qn] = Vr(fr), Hk = "SelectContentImpl", Uk = Ir("SelectContent
17914
17909
  avoidCollisions: x,
17915
17910
  //
17916
17911
  ...b
17917
- } = e, w = Kn(fr, n), [y, C] = m.useState(null), [S, T] = m.useState(null), E = Be(t, (z) => C(z)), [N, A] = m.useState(null), [D, F] = m.useState(
17912
+ } = e, w = Kn(fr, n), [y, C] = m.useState(null), [S, T] = m.useState(null), E = Be(t, (B) => C(B)), [N, A] = m.useState(null), [D, F] = m.useState(
17918
17913
  null
17919
17914
  ), U = ua(n), [q, I] = m.useState(!1), G = m.useRef(!1);
17920
17915
  m.useEffect(() => {
17921
17916
  if (y) return el(y);
17922
17917
  }, [y]), zi();
17923
17918
  const K = m.useCallback(
17924
- (z) => {
17919
+ (B) => {
17925
17920
  const [$, ...Z] = U().map((X) => X.ref.current), [Y] = Z.slice(-1), ee = document.activeElement;
17926
- for (const X of z)
17921
+ for (const X of B)
17927
17922
  if (X === ee || (X == null || X.scrollIntoView({ block: "nearest" }), X === $ && S && (S.scrollTop = 0), X === Y && S && (S.scrollTop = S.scrollHeight), X == null || X.focus(), document.activeElement !== ee)) return;
17928
17923
  },
17929
17924
  [U, S]
17930
- ), B = m.useCallback(
17925
+ ), z = m.useCallback(
17931
17926
  () => K([N, y]),
17932
17927
  [K, N, y]
17933
17928
  );
17934
17929
  m.useEffect(() => {
17935
- q && B();
17936
- }, [q, B]);
17930
+ q && z();
17931
+ }, [q, z]);
17937
17932
  const { onOpenChange: _, triggerPointerDownPosRef: k } = w;
17938
17933
  m.useEffect(() => {
17939
17934
  if (y) {
17940
- let z = { x: 0, y: 0 };
17935
+ let B = { x: 0, y: 0 };
17941
17936
  const $ = (Y) => {
17942
17937
  var ee, X;
17943
- z = {
17938
+ B = {
17944
17939
  x: Math.abs(Math.round(Y.pageX) - (((ee = k.current) == null ? void 0 : ee.x) ?? 0)),
17945
17940
  y: Math.abs(Math.round(Y.pageY) - (((X = k.current) == null ? void 0 : X.y) ?? 0))
17946
17941
  };
17947
17942
  }, Z = (Y) => {
17948
- z.x <= 10 && z.y <= 10 ? Y.preventDefault() : y.contains(Y.target) || _(!1), document.removeEventListener("pointermove", $), k.current = null;
17943
+ B.x <= 10 && B.y <= 10 ? Y.preventDefault() : y.contains(Y.target) || _(!1), document.removeEventListener("pointermove", $), k.current = null;
17949
17944
  };
17950
17945
  return k.current !== null && (document.addEventListener("pointermove", $), document.addEventListener("pointerup", Z, { capture: !0, once: !0 })), () => {
17951
17946
  document.removeEventListener("pointermove", $), document.removeEventListener("pointerup", Z, { capture: !0 });
17952
17947
  };
17953
17948
  }
17954
17949
  }, [y, _, k]), m.useEffect(() => {
17955
- const z = () => _(!1);
17956
- return window.addEventListener("blur", z), window.addEventListener("resize", z), () => {
17957
- window.removeEventListener("blur", z), window.removeEventListener("resize", z);
17950
+ const B = () => _(!1);
17951
+ return window.addEventListener("blur", B), window.addEventListener("resize", B), () => {
17952
+ window.removeEventListener("blur", B), window.removeEventListener("resize", B);
17958
17953
  };
17959
17954
  }, [_]);
17960
- const [H, V] = Om((z) => {
17961
- const $ = U().filter((ee) => !ee.disabled), Z = $.find((ee) => ee.ref.current === document.activeElement), Y = Dm($, z, Z);
17955
+ const [H, V] = Om((B) => {
17956
+ const $ = U().filter((ee) => !ee.disabled), Z = $.find((ee) => ee.ref.current === document.activeElement), Y = Dm($, B, Z);
17962
17957
  Y && setTimeout(() => Y.ref.current.focus());
17963
17958
  }), j = m.useCallback(
17964
- (z, $, Z) => {
17959
+ (B, $, Z) => {
17965
17960
  const Y = !G.current && !Z;
17966
- (w.value !== void 0 && w.value === $ || Y) && (A(z), Y && (G.current = !0));
17961
+ (w.value !== void 0 && w.value === $ || Y) && (A(B), Y && (G.current = !0));
17967
17962
  },
17968
17963
  [w.value]
17969
17964
  ), M = m.useCallback(() => y == null ? void 0 : y.focus(), [y]), P = m.useCallback(
17970
- (z, $, Z) => {
17965
+ (B, $, Z) => {
17971
17966
  const Y = !G.current && !Z;
17972
- (w.value !== void 0 && w.value === $ || Y) && F(z);
17967
+ (w.value !== void 0 && w.value === $ || Y) && F(B);
17973
17968
  },
17974
17969
  [w.value]
17975
17970
  ), L = r === "popper" ? wi : wm, Q = L === wi ? {
@@ -17995,7 +17990,7 @@ var un = 10, [xm, qn] = Vr(fr), Hk = "SelectContentImpl", Uk = Ir("SelectContent
17995
17990
  selectedItem: N,
17996
17991
  onItemLeave: M,
17997
17992
  itemTextRefCallback: P,
17998
- focusSelectedItem: B,
17993
+ focusSelectedItem: z,
17999
17994
  selectedItemText: D,
18000
17995
  position: r,
18001
17996
  isPositioned: q,
@@ -18005,12 +18000,12 @@ var un = 10, [xm, qn] = Vr(fr), Hk = "SelectContentImpl", Uk = Ir("SelectContent
18005
18000
  {
18006
18001
  asChild: !0,
18007
18002
  trapped: w.open,
18008
- onMountAutoFocus: (z) => {
18009
- z.preventDefault();
18003
+ onMountAutoFocus: (B) => {
18004
+ B.preventDefault();
18010
18005
  },
18011
- onUnmountAutoFocus: se(o, (z) => {
18006
+ onUnmountAutoFocus: se(o, (B) => {
18012
18007
  var $;
18013
- ($ = w.trigger) == null || $.focus({ preventScroll: !0 }), z.preventDefault();
18008
+ ($ = w.trigger) == null || $.focus({ preventScroll: !0 }), B.preventDefault();
18014
18009
  }),
18015
18010
  children: /* @__PURE__ */ u.jsx(
18016
18011
  Fr,
@@ -18019,7 +18014,7 @@ var un = 10, [xm, qn] = Vr(fr), Hk = "SelectContentImpl", Uk = Ir("SelectContent
18019
18014
  disableOutsidePointerEvents: !0,
18020
18015
  onEscapeKeyDown: s,
18021
18016
  onPointerDownOutside: a,
18022
- onFocusOutside: (z) => z.preventDefault(),
18017
+ onFocusOutside: (B) => B.preventDefault(),
18023
18018
  onDismiss: () => w.onOpenChange(!1),
18024
18019
  children: /* @__PURE__ */ u.jsx(
18025
18020
  L,
@@ -18028,7 +18023,7 @@ var un = 10, [xm, qn] = Vr(fr), Hk = "SelectContentImpl", Uk = Ir("SelectContent
18028
18023
  id: w.contentId,
18029
18024
  "data-state": w.open ? "open" : "closed",
18030
18025
  dir: w.dir,
18031
- onContextMenu: (z) => z.preventDefault(),
18026
+ onContextMenu: (B) => B.preventDefault(),
18032
18027
  ...b,
18033
18028
  ...Q,
18034
18029
  onPlaced: () => I(!0),
@@ -18041,15 +18036,15 @@ var un = 10, [xm, qn] = Vr(fr), Hk = "SelectContentImpl", Uk = Ir("SelectContent
18041
18036
  outline: "none",
18042
18037
  ...b.style
18043
18038
  },
18044
- onKeyDown: se(b.onKeyDown, (z) => {
18045
- const $ = z.ctrlKey || z.altKey || z.metaKey;
18046
- if (z.key === "Tab" && z.preventDefault(), !$ && z.key.length === 1 && V(z.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(z.key)) {
18039
+ onKeyDown: se(b.onKeyDown, (B) => {
18040
+ const $ = B.ctrlKey || B.altKey || B.metaKey;
18041
+ if (B.key === "Tab" && B.preventDefault(), !$ && B.key.length === 1 && V(B.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(B.key)) {
18047
18042
  let Y = U().filter((ee) => !ee.disabled).map((ee) => ee.ref.current);
18048
- if (["ArrowUp", "End"].includes(z.key) && (Y = Y.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(z.key)) {
18049
- const ee = z.target, X = Y.indexOf(ee);
18043
+ if (["ArrowUp", "End"].includes(B.key) && (Y = Y.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(B.key)) {
18044
+ const ee = B.target, X = Y.indexOf(ee);
18050
18045
  Y = Y.slice(X + 1);
18051
18046
  }
18052
- setTimeout(() => K(Y)), z.preventDefault();
18047
+ setTimeout(() => K(Y)), B.preventDefault();
18053
18048
  }
18054
18049
  })
18055
18050
  }
@@ -18085,14 +18080,14 @@ var Wk = "SelectItemAlignedPosition", wm = m.forwardRef((e, t) => {
18085
18080
  ]);
18086
18081
  i.style.minWidth = xe + "px", i.style.right = Se + "px";
18087
18082
  }
18088
- const F = h(), U = window.innerHeight - un * 2, q = g.scrollHeight, I = window.getComputedStyle(c), G = parseInt(I.borderTopWidth, 10), K = parseInt(I.paddingTop, 10), B = parseInt(I.borderBottomWidth, 10), _ = parseInt(I.paddingBottom, 10), k = G + K + q + _ + B, H = Math.min(x.offsetHeight * 5, k), V = window.getComputedStyle(g), j = parseInt(V.paddingTop, 10), M = parseInt(V.paddingBottom, 10), P = E.top + E.height / 2 - un, L = U - P, Q = x.offsetHeight / 2, z = x.offsetTop + Q, $ = G + K + z, Z = k - $;
18083
+ const F = h(), U = window.innerHeight - un * 2, q = g.scrollHeight, I = window.getComputedStyle(c), G = parseInt(I.borderTopWidth, 10), K = parseInt(I.paddingTop, 10), z = parseInt(I.borderBottomWidth, 10), _ = parseInt(I.paddingBottom, 10), k = G + K + q + _ + z, H = Math.min(x.offsetHeight * 5, k), V = window.getComputedStyle(g), j = parseInt(V.paddingTop, 10), M = parseInt(V.paddingBottom, 10), P = E.top + E.height / 2 - un, L = U - P, Q = x.offsetHeight / 2, B = x.offsetTop + Q, $ = G + K + B, Z = k - $;
18089
18084
  if ($ <= P) {
18090
18085
  const ee = F.length > 0 && x === F[F.length - 1].ref.current;
18091
18086
  i.style.bottom = "0px";
18092
18087
  const X = c.clientHeight - g.offsetTop - g.offsetHeight, ae = Math.max(
18093
18088
  L,
18094
18089
  Q + // viewport might have padding bottom, include it to avoid a scrollable viewport
18095
- (ee ? M : 0) + X + B
18090
+ (ee ? M : 0) + X + z
18096
18091
  ), xe = $ + ae;
18097
18092
  i.style.height = xe + "px";
18098
18093
  } else {
@@ -19419,8 +19414,8 @@ var [rI, oI] = cg($o, {
19419
19414
  const G = () => {
19420
19415
  U(E.current), c == null || c();
19421
19416
  }, K = () => {
19422
- const B = (/* @__PURE__ */ new Date()).getTime() - T.current;
19423
- E.current = E.current - B, window.clearTimeout(N.current), l == null || l();
19417
+ const z = (/* @__PURE__ */ new Date()).getTime() - T.current;
19418
+ E.current = E.current - z, window.clearTimeout(N.current), l == null || l();
19424
19419
  };
19425
19420
  return I.addEventListener(ki, K), I.addEventListener(Ri, G), () => {
19426
19421
  I.removeEventListener(ki, K), I.removeEventListener(Ri, G);
@@ -19465,8 +19460,8 @@ var [rI, oI] = cg($o, {
19465
19460
  }),
19466
19461
  onPointerMove: se(e.onPointerMove, (I) => {
19467
19462
  if (!y.current) return;
19468
- const G = I.clientX - y.current.x, K = I.clientY - y.current.y, B = !!C.current, _ = ["left", "right"].includes(g.swipeDirection), k = ["left", "up"].includes(g.swipeDirection) ? Math.min : Math.max, H = _ ? k(0, G) : 0, V = _ ? 0 : k(0, K), j = I.pointerType === "touch" ? 10 : 2, M = { x: H, y: V }, P = { originalEvent: I, delta: M };
19469
- B ? (C.current = M, Yo(eI, p, P, {
19463
+ const G = I.clientX - y.current.x, K = I.clientY - y.current.y, z = !!C.current, _ = ["left", "right"].includes(g.swipeDirection), k = ["left", "up"].includes(g.swipeDirection) ? Math.min : Math.max, H = _ ? k(0, G) : 0, V = _ ? 0 : k(0, K), j = I.pointerType === "touch" ? 10 : 2, M = { x: H, y: V }, P = { originalEvent: I, delta: M };
19464
+ z ? (C.current = M, Yo(eI, p, P, {
19470
19465
  discrete: !1
19471
19466
  })) : Pu(M, g.swipeDirection, j) ? (C.current = M, Yo(QR, d, P, {
19472
19467
  discrete: !1
@@ -19475,7 +19470,7 @@ var [rI, oI] = cg($o, {
19475
19470
  onPointerUp: se(e.onPointerUp, (I) => {
19476
19471
  const G = C.current, K = I.target;
19477
19472
  if (K.hasPointerCapture(I.pointerId) && K.releasePointerCapture(I.pointerId), C.current = null, y.current = null, G) {
19478
- const B = I.currentTarget, _ = { originalEvent: I, delta: G };
19473
+ const z = I.currentTarget, _ = { originalEvent: I, delta: G };
19479
19474
  Pu(G, g.swipeDirection, g.swipeThreshold) ? Yo(nI, f, _, {
19480
19475
  discrete: !0
19481
19476
  }) : Yo(
@@ -19485,7 +19480,7 @@ var [rI, oI] = cg($o, {
19485
19480
  {
19486
19481
  discrete: !0
19487
19482
  }
19488
- ), B.addEventListener("click", (k) => k.preventDefault(), {
19483
+ ), z.addEventListener("click", (k) => k.preventDefault(), {
19489
19484
  once: !0
19490
19485
  });
19491
19486
  }
@@ -19823,7 +19818,7 @@ function UI(e) {
19823
19818
  }
19824
19819
  var WI = (e) => {
19825
19820
  var t, n, r, o, s, a, i, l, c, d, p;
19826
- let { invert: h, toast: f, unstyled: v, interacting: g, setHeights: x, visibleToasts: b, heights: w, index: y, toasts: C, expanded: S, removeToast: T, defaultRichColors: E, closeButton: N, style: A, cancelButtonStyle: D, actionButtonStyle: F, className: U = "", descriptionClassName: q = "", duration: I, position: G, gap: K, loadingIcon: B, expandByDefault: _, classNames: k, icons: H, closeButtonAriaLabel: V = "Close toast", pauseWhenPageIsHidden: j } = e, [M, P] = O.useState(null), [L, Q] = O.useState(null), [z, $] = O.useState(!1), [Z, Y] = O.useState(!1), [ee, X] = O.useState(!1), [ae, xe] = O.useState(!1), [ue, me] = O.useState(!1), [Se, Ce] = O.useState(0), [Ae, ht] = O.useState(0), ut = O.useRef(f.duration || I || Mu), He = O.useRef(null), ze = O.useRef(null), De = y === 0, Xe = y + 1 <= b, Pe = f.type, Le = f.dismissible !== !1, tt = f.className || "", At = f.descriptionClassName || "", it = O.useMemo(() => w.findIndex((ve) => ve.toastId === f.id) || 0, [w, f.id]), Tt = O.useMemo(() => {
19821
+ let { invert: h, toast: f, unstyled: v, interacting: g, setHeights: x, visibleToasts: b, heights: w, index: y, toasts: C, expanded: S, removeToast: T, defaultRichColors: E, closeButton: N, style: A, cancelButtonStyle: D, actionButtonStyle: F, className: U = "", descriptionClassName: q = "", duration: I, position: G, gap: K, loadingIcon: z, expandByDefault: _, classNames: k, icons: H, closeButtonAriaLabel: V = "Close toast", pauseWhenPageIsHidden: j } = e, [M, P] = O.useState(null), [L, Q] = O.useState(null), [B, $] = O.useState(!1), [Z, Y] = O.useState(!1), [ee, X] = O.useState(!1), [ae, xe] = O.useState(!1), [ue, me] = O.useState(!1), [Se, Ce] = O.useState(0), [Ae, ht] = O.useState(0), ut = O.useRef(f.duration || I || Mu), He = O.useRef(null), ze = O.useRef(null), De = y === 0, Xe = y + 1 <= b, Pe = f.type, Le = f.dismissible !== !1, tt = f.className || "", At = f.descriptionClassName || "", it = O.useMemo(() => w.findIndex((ve) => ve.toastId === f.id) || 0, [w, f.id]), Tt = O.useMemo(() => {
19827
19822
  var ve;
19828
19823
  return (ve = f.closeButton) != null ? ve : N;
19829
19824
  }, [f.closeButton, N]), Ct = O.useMemo(() => f.duration || I || Mu, [f.duration, I]), Et = O.useRef(0), Rt = O.useRef(0), en = O.useRef(0), jt = O.useRef(null), [zt, It] = G.split("-"), Ue = O.useMemo(() => w.reduce((ve, he, ye) => ye >= it ? ve : ve + he.height, 0), [w, it]), Ge = II(), _t = f.invert || h, J = Pe === "loading";
@@ -19838,12 +19833,12 @@ var WI = (e) => {
19838
19833
  return ht(he), x((ye) => [{ toastId: f.id, height: he, position: f.position }, ...ye]), () => x((ye) => ye.filter((Me) => Me.toastId !== f.id));
19839
19834
  }
19840
19835
  }, [x, f.id]), O.useLayoutEffect(() => {
19841
- if (!z) return;
19836
+ if (!B) return;
19842
19837
  let ve = ze.current, he = ve.style.height;
19843
19838
  ve.style.height = "auto";
19844
19839
  let ye = ve.getBoundingClientRect().height;
19845
19840
  ve.style.height = he, ht(ye), x((Me) => Me.find((Ye) => Ye.toastId === f.id) ? Me.map((Ye) => Ye.toastId === f.id ? { ...Ye, height: ye } : Ye) : [{ toastId: f.id, height: ye, position: f.position }, ...Me]);
19846
- }, [z, f.title, f.description, x, f.id]);
19841
+ }, [B, f.title, f.description, x, f.id]);
19847
19842
  let ce = O.useCallback(() => {
19848
19843
  Y(!0), Ce(Rt.current), x((ve) => ve.filter((he) => he.toastId !== f.id)), setTimeout(() => {
19849
19844
  T(f);
@@ -19867,9 +19862,9 @@ var WI = (e) => {
19867
19862
  }, [ce, f.delete]);
19868
19863
  function Ke() {
19869
19864
  var ve, he, ye;
19870
- return H != null && H.loading ? O.createElement("div", { className: cn(k == null ? void 0 : k.loader, (ve = f == null ? void 0 : f.classNames) == null ? void 0 : ve.loader, "sonner-loader"), "data-visible": Pe === "loading" }, H.loading) : B ? O.createElement("div", { className: cn(k == null ? void 0 : k.loader, (he = f == null ? void 0 : f.classNames) == null ? void 0 : he.loader, "sonner-loader"), "data-visible": Pe === "loading" }, B) : O.createElement(SI, { className: cn(k == null ? void 0 : k.loader, (ye = f == null ? void 0 : f.classNames) == null ? void 0 : ye.loader), visible: Pe === "loading" });
19865
+ return H != null && H.loading ? O.createElement("div", { className: cn(k == null ? void 0 : k.loader, (ve = f == null ? void 0 : f.classNames) == null ? void 0 : ve.loader, "sonner-loader"), "data-visible": Pe === "loading" }, H.loading) : z ? O.createElement("div", { className: cn(k == null ? void 0 : k.loader, (he = f == null ? void 0 : f.classNames) == null ? void 0 : he.loader, "sonner-loader"), "data-visible": Pe === "loading" }, z) : O.createElement(SI, { className: cn(k == null ? void 0 : k.loader, (ye = f == null ? void 0 : f.classNames) == null ? void 0 : ye.loader), visible: Pe === "loading" });
19871
19866
  }
19872
- return O.createElement("li", { tabIndex: 0, ref: ze, className: cn(U, tt, k == null ? void 0 : k.toast, (t = f == null ? void 0 : f.classNames) == null ? void 0 : t.toast, k == null ? void 0 : k.default, k == null ? void 0 : k[Pe], (n = f == null ? void 0 : f.classNames) == null ? void 0 : n[Pe]), "data-sonner-toast": "", "data-rich-colors": (r = f.richColors) != null ? r : E, "data-styled": !(f.jsx || f.unstyled || v), "data-mounted": z, "data-promise": !!f.promise, "data-swiped": ue, "data-removed": Z, "data-visible": Xe, "data-y-position": zt, "data-x-position": It, "data-index": y, "data-front": De, "data-swiping": ee, "data-dismissible": Le, "data-type": Pe, "data-invert": _t, "data-swipe-out": ae, "data-swipe-direction": L, "data-expanded": !!(S || _ && z), style: { "--index": y, "--toasts-before": y, "--z-index": C.length - y, "--offset": `${Z ? Se : Rt.current}px`, "--initial-height": _ ? "auto" : `${Ae}px`, ...A, ...f.style }, onDragEnd: () => {
19867
+ return O.createElement("li", { tabIndex: 0, ref: ze, className: cn(U, tt, k == null ? void 0 : k.toast, (t = f == null ? void 0 : f.classNames) == null ? void 0 : t.toast, k == null ? void 0 : k.default, k == null ? void 0 : k[Pe], (n = f == null ? void 0 : f.classNames) == null ? void 0 : n[Pe]), "data-sonner-toast": "", "data-rich-colors": (r = f.richColors) != null ? r : E, "data-styled": !(f.jsx || f.unstyled || v), "data-mounted": B, "data-promise": !!f.promise, "data-swiped": ue, "data-removed": Z, "data-visible": Xe, "data-y-position": zt, "data-x-position": It, "data-index": y, "data-front": De, "data-swiping": ee, "data-dismissible": Le, "data-type": Pe, "data-invert": _t, "data-swipe-out": ae, "data-swipe-direction": L, "data-expanded": !!(S || _ && B), style: { "--index": y, "--toasts-before": y, "--z-index": C.length - y, "--offset": `${Z ? Se : Rt.current}px`, "--initial-height": _ ? "auto" : `${Ae}px`, ...A, ...f.style }, onDragEnd: () => {
19873
19868
  X(!1), P(null), jt.current = null;
19874
19869
  }, onPointerDown: (ve) => {
19875
19870
  J || !Le || (He.current = /* @__PURE__ */ new Date(), Ce(Rt.current), ve.target.setPointerCapture(ve.pointerId), ve.target.tagName !== "BUTTON" && (X(!0), jt.current = { x: ve.clientX, y: ve.clientY }));
@@ -19922,7 +19917,7 @@ function VI(e, t) {
19922
19917
  }), n;
19923
19918
  }
19924
19919
  var KI = zg(function(e, t) {
19925
- let { invert: n, position: r = "bottom-right", hotkey: o = ["altKey", "KeyT"], expand: s, closeButton: a, className: i, offset: l, mobileOffset: c, theme: d = "light", richColors: p, duration: h, style: f, visibleToasts: v = DI, toastOptions: g, dir: x = Ou(), gap: b = BI, loadingIcon: w, icons: y, containerAriaLabel: C = "Notifications", pauseWhenPageIsHidden: S } = e, [T, E] = O.useState([]), N = O.useMemo(() => Array.from(new Set([r].concat(T.filter((j) => j.position).map((j) => j.position)))), [T, r]), [A, D] = O.useState([]), [F, U] = O.useState(!1), [q, I] = O.useState(!1), [G, K] = O.useState(d !== "system" ? d : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), B = O.useRef(null), _ = o.join("+").replace(/Key/g, "").replace(/Digit/g, ""), k = O.useRef(null), H = O.useRef(!1), V = O.useCallback((j) => {
19920
+ let { invert: n, position: r = "bottom-right", hotkey: o = ["altKey", "KeyT"], expand: s, closeButton: a, className: i, offset: l, mobileOffset: c, theme: d = "light", richColors: p, duration: h, style: f, visibleToasts: v = DI, toastOptions: g, dir: x = Ou(), gap: b = BI, loadingIcon: w, icons: y, containerAriaLabel: C = "Notifications", pauseWhenPageIsHidden: S } = e, [T, E] = O.useState([]), N = O.useMemo(() => Array.from(new Set([r].concat(T.filter((j) => j.position).map((j) => j.position)))), [T, r]), [A, D] = O.useState([]), [F, U] = O.useState(!1), [q, I] = O.useState(!1), [G, K] = O.useState(d !== "system" ? d : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), z = O.useRef(null), _ = o.join("+").replace(/Key/g, "").replace(/Digit/g, ""), k = O.useRef(null), H = O.useRef(!1), V = O.useCallback((j) => {
19926
19921
  E((M) => {
19927
19922
  var P;
19928
19923
  return (P = M.find((L) => L.id === j.id)) != null && P.delete || Wt.dismiss(j.id), M.filter(({ id: L }) => L !== j.id);
@@ -19966,27 +19961,27 @@ var KI = zg(function(e, t) {
19966
19961
  }, [T]), O.useEffect(() => {
19967
19962
  let j = (M) => {
19968
19963
  var P, L;
19969
- o.every((Q) => M[Q] || M.code === Q) && (U(!0), (P = B.current) == null || P.focus()), M.code === "Escape" && (document.activeElement === B.current || (L = B.current) != null && L.contains(document.activeElement)) && U(!1);
19964
+ o.every((Q) => M[Q] || M.code === Q) && (U(!0), (P = z.current) == null || P.focus()), M.code === "Escape" && (document.activeElement === z.current || (L = z.current) != null && L.contains(document.activeElement)) && U(!1);
19970
19965
  };
19971
19966
  return document.addEventListener("keydown", j), () => document.removeEventListener("keydown", j);
19972
19967
  }, [o]), O.useEffect(() => {
19973
- if (B.current) return () => {
19968
+ if (z.current) return () => {
19974
19969
  k.current && (k.current.focus({ preventScroll: !0 }), k.current = null, H.current = !1);
19975
19970
  };
19976
- }, [B.current]), O.createElement("section", { ref: t, "aria-label": `${C} ${_}`, tabIndex: -1, "aria-live": "polite", "aria-relevant": "additions text", "aria-atomic": "false", suppressHydrationWarning: !0 }, N.map((j, M) => {
19971
+ }, [z.current]), O.createElement("section", { ref: t, "aria-label": `${C} ${_}`, tabIndex: -1, "aria-live": "polite", "aria-relevant": "additions text", "aria-atomic": "false", suppressHydrationWarning: !0 }, N.map((j, M) => {
19977
19972
  var P;
19978
19973
  let [L, Q] = j.split("-");
19979
- return T.length ? O.createElement("ol", { key: j, dir: x === "auto" ? Ou() : x, tabIndex: -1, ref: B, className: i, "data-sonner-toaster": !0, "data-theme": G, "data-y-position": L, "data-lifted": F && T.length > 1 && !s, "data-x-position": Q, style: { "--front-toast-height": `${((P = A[0]) == null ? void 0 : P.height) || 0}px`, "--width": `${FI}px`, "--gap": `${b}px`, ...f, ...VI(l, c) }, onBlur: (z) => {
19980
- H.current && !z.currentTarget.contains(z.relatedTarget) && (H.current = !1, k.current && (k.current.focus({ preventScroll: !0 }), k.current = null));
19981
- }, onFocus: (z) => {
19982
- z.target instanceof HTMLElement && z.target.dataset.dismissible === "false" || H.current || (H.current = !0, k.current = z.relatedTarget);
19974
+ return T.length ? O.createElement("ol", { key: j, dir: x === "auto" ? Ou() : x, tabIndex: -1, ref: z, className: i, "data-sonner-toaster": !0, "data-theme": G, "data-y-position": L, "data-lifted": F && T.length > 1 && !s, "data-x-position": Q, style: { "--front-toast-height": `${((P = A[0]) == null ? void 0 : P.height) || 0}px`, "--width": `${FI}px`, "--gap": `${b}px`, ...f, ...VI(l, c) }, onBlur: (B) => {
19975
+ H.current && !B.currentTarget.contains(B.relatedTarget) && (H.current = !1, k.current && (k.current.focus({ preventScroll: !0 }), k.current = null));
19976
+ }, onFocus: (B) => {
19977
+ B.target instanceof HTMLElement && B.target.dataset.dismissible === "false" || H.current || (H.current = !0, k.current = B.relatedTarget);
19983
19978
  }, onMouseEnter: () => U(!0), onMouseMove: () => U(!0), onMouseLeave: () => {
19984
19979
  q || U(!1);
19985
- }, onDragEnd: () => U(!1), onPointerDown: (z) => {
19986
- z.target instanceof HTMLElement && z.target.dataset.dismissible === "false" || I(!0);
19987
- }, onPointerUp: () => I(!1) }, T.filter((z) => !z.position && M === 0 || z.position === j).map((z, $) => {
19980
+ }, onDragEnd: () => U(!1), onPointerDown: (B) => {
19981
+ B.target instanceof HTMLElement && B.target.dataset.dismissible === "false" || I(!0);
19982
+ }, onPointerUp: () => I(!1) }, T.filter((B) => !B.position && M === 0 || B.position === j).map((B, $) => {
19988
19983
  var Z, Y;
19989
- return O.createElement(WI, { key: z.id, icons: y, index: $, toast: z, defaultRichColors: p, duration: (Z = g == null ? void 0 : g.duration) != null ? Z : h, className: g == null ? void 0 : g.className, descriptionClassName: g == null ? void 0 : g.descriptionClassName, invert: n, visibleToasts: v, closeButton: (Y = g == null ? void 0 : g.closeButton) != null ? Y : a, interacting: q, position: j, style: g == null ? void 0 : g.style, unstyled: g == null ? void 0 : g.unstyled, classNames: g == null ? void 0 : g.classNames, cancelButtonStyle: g == null ? void 0 : g.cancelButtonStyle, actionButtonStyle: g == null ? void 0 : g.actionButtonStyle, removeToast: V, toasts: T.filter((ee) => ee.position == z.position), heights: A.filter((ee) => ee.position == z.position), setHeights: D, expandByDefault: s, gap: b, loadingIcon: w, expanded: F, pauseWhenPageIsHidden: S, swipeDirections: e.swipeDirections });
19984
+ return O.createElement(WI, { key: B.id, icons: y, index: $, toast: B, defaultRichColors: p, duration: (Z = g == null ? void 0 : g.duration) != null ? Z : h, className: g == null ? void 0 : g.className, descriptionClassName: g == null ? void 0 : g.descriptionClassName, invert: n, visibleToasts: v, closeButton: (Y = g == null ? void 0 : g.closeButton) != null ? Y : a, interacting: q, position: j, style: g == null ? void 0 : g.style, unstyled: g == null ? void 0 : g.unstyled, classNames: g == null ? void 0 : g.classNames, cancelButtonStyle: g == null ? void 0 : g.cancelButtonStyle, actionButtonStyle: g == null ? void 0 : g.actionButtonStyle, removeToast: V, toasts: T.filter((ee) => ee.position == B.position), heights: A.filter((ee) => ee.position == B.position), setHeights: D, expandByDefault: s, gap: b, loadingIcon: w, expanded: F, pauseWhenPageIsHidden: S, swipeDirections: e.swipeDirections });
19990
19985
  })) : null;
19991
19986
  }));
19992
19987
  });