teodor-new-chat-ui 4.3.652 → 4.3.654

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
@@ -4,7 +4,7 @@ var qs = (e, t, n) => vp(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { clsx as Nc } from "clsx";
5
5
  import { twMerge as jc } from "tailwind-merge";
6
6
  import * as b from "react";
7
- import te, { createContext as Tr, useContext as kr, useState as fe, useRef as Te, useCallback as ie, useEffect as De, useMemo as Ne, useReducer as wp, createElement as Oo, memo as oo, useImperativeHandle as Sp, useLayoutEffect as Cp } from "react";
7
+ import te, { createContext as Tr, useContext as kr, useState as fe, useRef as Te, useCallback as ie, useEffect as Be, useMemo as Ne, useReducer as wp, createElement as Oo, memo as oo, useImperativeHandle as Sp, useLayoutEffect as Cp } from "react";
8
8
  import { Slot as Tp, createSlot as qr } from "@radix-ui/react-slot";
9
9
  import { cva as _c } from "class-variance-authority";
10
10
  import * as Pc from "react-dom";
@@ -2250,18 +2250,18 @@ function Ig() {
2250
2250
  if (vt && oe && typeof vt.stack == "string") {
2251
2251
  for (var Ee = vt.stack.split(`
2252
2252
  `), qe = oe.stack.split(`
2253
- `), Be = Ee.length - 1, Ze = qe.length - 1; Be >= 1 && Ze >= 0 && Ee[Be] !== qe[Ze]; )
2253
+ `), ze = Ee.length - 1, Ze = qe.length - 1; ze >= 1 && Ze >= 0 && Ee[ze] !== qe[Ze]; )
2254
2254
  Ze--;
2255
- for (; Be >= 1 && Ze >= 0; Be--, Ze--)
2256
- if (Ee[Be] !== qe[Ze]) {
2257
- if (Be !== 1 || Ze !== 1)
2255
+ for (; ze >= 1 && Ze >= 0; ze--, Ze--)
2256
+ if (Ee[ze] !== qe[Ze]) {
2257
+ if (ze !== 1 || Ze !== 1)
2258
2258
  do
2259
- if (Be--, Ze--, Ze < 0 || Ee[Be] !== qe[Ze]) {
2259
+ if (ze--, Ze--, Ze < 0 || Ee[ze] !== qe[Ze]) {
2260
2260
  var $t = `
2261
- ` + Ee[Be].replace(" at new ", " at ");
2261
+ ` + Ee[ze].replace(" at new ", " at ");
2262
2262
  return k.displayName && $t.includes("<anonymous>") && ($t = $t.replace("<anonymous>", k.displayName)), typeof k == "function" && J.set(k, $t), $t;
2263
2263
  }
2264
- while (Be >= 1 && Ze >= 0);
2264
+ while (ze >= 1 && Ze >= 0);
2265
2265
  break;
2266
2266
  }
2267
2267
  }
@@ -2327,8 +2327,8 @@ function Ig() {
2327
2327
  throw qe.name = "Invariant Violation", qe;
2328
2328
  }
2329
2329
  Ee = k[we](M, we, oe, V, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
2330
- } catch (Be) {
2331
- Ee = Be;
2330
+ } catch (ze) {
2331
+ Ee = ze;
2332
2332
  }
2333
2333
  Ee && !(Ee instanceof Error) && (Ue(ue), v("%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).", oe || "React class", V, we, typeof Ee), Ue(null)), Ee instanceof Error && !(Ee.message in Xe) && (Xe[Ee.message] = !0, Ue(ue), v("Failed %s type: %s", V, Ee.message), Ue(null));
2334
2334
  }
@@ -2441,9 +2441,9 @@ function Ig() {
2441
2441
  for (ve in M)
2442
2442
  Ke.call(M, ve) && !It.hasOwnProperty(ve) && (we[ve] = M[ve]);
2443
2443
  if (k && k.defaultProps) {
2444
- var Be = k.defaultProps;
2445
- for (ve in Be)
2446
- we[ve] === void 0 && (we[ve] = Be[ve]);
2444
+ var ze = k.defaultProps;
2445
+ for (ve in ze)
2446
+ we[ve] === void 0 && (we[ve] = ze[ve]);
2447
2447
  }
2448
2448
  if (Ee || qe) {
2449
2449
  var Ze = typeof k == "function" ? k.displayName || k.name || "Unknown" : k;
@@ -2462,7 +2462,7 @@ function Ig() {
2462
2462
  }
2463
2463
  var $n;
2464
2464
  $n = !1;
2465
- function ze(k) {
2465
+ function Fe(k) {
2466
2466
  return typeof k == "object" && k !== null && k.$$typeof === t;
2467
2467
  }
2468
2468
  function Je() {
@@ -2513,15 +2513,15 @@ Check the top-level render call using <` + V + ">.");
2513
2513
  if (bt(k))
2514
2514
  for (var V = 0; V < k.length; V++) {
2515
2515
  var oe = k[V];
2516
- ze(oe) && Gt(oe, M);
2516
+ Fe(oe) && Gt(oe, M);
2517
2517
  }
2518
- else if (ze(k))
2518
+ else if (Fe(k))
2519
2519
  k._store && (k._store.validated = !0);
2520
2520
  else if (k) {
2521
2521
  var ue = x(k);
2522
2522
  if (typeof ue == "function" && ue !== k.entries)
2523
2523
  for (var ve = ue.call(k), we; !(we = ve.next()).done; )
2524
- ze(we.value) && Gt(we.value, M);
2524
+ Fe(we.value) && Gt(we.value, M);
2525
2525
  }
2526
2526
  }
2527
2527
  }
@@ -2571,8 +2571,8 @@ Check the top-level render call using <` + V + ">.");
2571
2571
  (k === void 0 || typeof k == "object" && k !== null && Object.keys(k).length === 0) && (Ee += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
2572
2572
  var qe = wn();
2573
2573
  qe ? Ee += qe : Ee += Je();
2574
- var Be;
2575
- k === null ? Be = "null" : bt(k) ? Be = "array" : k !== void 0 && k.$$typeof === t ? (Be = "<" + (Y(k.type) || "Unknown") + " />", Ee = " Did you accidentally export a JSX literal instead of a component?") : Be = typeof k, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Be, Ee);
2574
+ var ze;
2575
+ k === null ? ze = "null" : bt(k) ? ze = "array" : k !== void 0 && k.$$typeof === t ? (ze = "<" + (Y(k.type) || "Unknown") + " />", Ee = " Did you accidentally export a JSX literal instead of a component?") : ze = typeof k, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ze, Ee);
2576
2576
  }
2577
2577
  var Ze = vn(k, M, V, ue, ve);
2578
2578
  if (Ze == null)
@@ -3040,8 +3040,8 @@ function qg(e = {}) {
3040
3040
  let lt = {};
3041
3041
  if (typeof window < "u")
3042
3042
  try {
3043
- const ze = (se = window.localStorage) == null ? void 0 : se.getItem(Kn.authSessionId);
3044
- ze && (lt = { "X-Session-Id": ze });
3043
+ const Fe = (se = window.localStorage) == null ? void 0 : se.getItem(Kn.authSessionId);
3044
+ Fe && (lt = { "X-Session-Id": Fe });
3045
3045
  } catch {
3046
3046
  }
3047
3047
  const It = {
@@ -3060,13 +3060,13 @@ function qg(e = {}) {
3060
3060
  credentials: i
3061
3061
  });
3062
3062
  if (U.current && (U.current.headers = It), !et.ok || !et.body) {
3063
- const ze = await et.text().catch(() => "");
3063
+ const Fe = await et.text().catch(() => "");
3064
3064
  console.debug(
3065
3065
  "[use-chat] non-OK response",
3066
3066
  et.status,
3067
- ze == null ? void 0 : ze.slice(0, 500)
3067
+ Fe == null ? void 0 : Fe.slice(0, 500)
3068
3068
  );
3069
- const Je = `stream ${et.status}${ze ? ": " + ze : ""}`;
3069
+ const Je = `stream ${et.status}${Fe ? ": " + Fe : ""}`;
3070
3070
  throw (ge = N == null ? void 0 : N.onConnectionError) == null || ge.call(N, Je), O = !0, P = "error", W = Je, new Error(Je);
3071
3071
  }
3072
3072
  v(!0);
@@ -3076,8 +3076,8 @@ function qg(e = {}) {
3076
3076
  let Dt = 0, Vt = null;
3077
3077
  const vn = () => {
3078
3078
  if (tn.length) {
3079
- const ze = tn.join("");
3080
- tn = [], L.current && h((Je) => Je + ze);
3079
+ const Fe = tn.join("");
3080
+ tn = [], L.current && h((Je) => Je + Fe);
3081
3081
  }
3082
3082
  Vt = null;
3083
3083
  }, Lt = () => {
@@ -3085,14 +3085,14 @@ function qg(e = {}) {
3085
3085
  };
3086
3086
  let Kt = Date.now();
3087
3087
  const Et = setInterval(() => {
3088
- var ze;
3088
+ var Fe;
3089
3089
  if (Date.now() - Kt > 18e5) {
3090
3090
  const Je = "Stream idle timeout";
3091
- u(Je), P = "error", W = Je, D.abort(), (ze = N == null ? void 0 : N.onError) == null || ze.call(N, Je);
3091
+ u(Je), P = "error", W = Je, D.abort(), (Fe = N == null ? void 0 : N.onError) == null || Fe.call(N, Je);
3092
3092
  }
3093
3093
  }, 5e3), $n = 1024 * 1024;
3094
3094
  try {
3095
- const ze = et.headers.get("X-Thread-Id") || et.headers.get("x-thread-id"), Je = et.headers.get("X-Thread-Created") || et.headers.get("x-thread-created"), wn = ze ?? null, qt = String(Je ?? "").toLowerCase() === "true";
3095
+ const Fe = et.headers.get("X-Thread-Id") || et.headers.get("x-thread-id"), Je = et.headers.get("X-Thread-Created") || et.headers.get("x-thread-created"), wn = Fe ?? null, qt = String(Je ?? "").toLowerCase() === "true";
3096
3096
  for (U.current && !U.current.threadId && (U.current = {
3097
3097
  ...U.current,
3098
3098
  threadId: wn
@@ -3185,7 +3185,7 @@ function qg(e = {}) {
3185
3185
  lastSeq: null,
3186
3186
  lastText: ""
3187
3187
  };
3188
- const Be = Yi({
3188
+ const ze = Yi({
3189
3189
  id: ue,
3190
3190
  role: "assistant",
3191
3191
  name: qe,
@@ -3193,14 +3193,14 @@ function qg(e = {}) {
3193
3193
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3194
3194
  content: [{ type: "text", text: ve }]
3195
3195
  });
3196
- R((Ze) => ({ ...Ze, [ue]: Be })), w(ue);
3196
+ R((Ze) => ({ ...Ze, [ue]: ze })), w(ue);
3197
3197
  } else
3198
3198
  R((qe) => {
3199
- const Be = qe[ue];
3200
- return Be ? {
3199
+ const ze = qe[ue];
3200
+ return ze ? {
3201
3201
  ...qe,
3202
3202
  [ue]: {
3203
- ...Be,
3203
+ ...ze,
3204
3204
  content: [{ type: "text", text: ve }]
3205
3205
  }
3206
3206
  } : qe;
@@ -3272,11 +3272,11 @@ function qg(e = {}) {
3272
3272
  }
3273
3273
  }
3274
3274
  vn(), P === null && !D.signal.aborted && (P = "complete");
3275
- } catch (ze) {
3276
- if (ze.name === "AbortError")
3275
+ } catch (Fe) {
3276
+ if (Fe.name === "AbortError")
3277
3277
  P = P ?? "aborted";
3278
3278
  else {
3279
- const Je = ze.message || String(ze);
3279
+ const Je = Fe.message || String(Fe);
3280
3280
  P = "error", W = Je, u(Je), (mt = N == null ? void 0 : N.onError) == null || mt.call(N, Je);
3281
3281
  }
3282
3282
  } finally {
@@ -3315,7 +3315,7 @@ function qg(e = {}) {
3315
3315
  },
3316
3316
  [t, n, r, e.autoAppendAssistant]
3317
3317
  );
3318
- return De(() => () => {
3318
+ return Be(() => () => {
3319
3319
  var $;
3320
3320
  L.current = !1, ($ = j.current) == null || $.abort();
3321
3321
  }, []), {
@@ -3388,9 +3388,9 @@ function Xg({
3388
3388
  onCurrentThreadDeleted: o
3389
3389
  }) {
3390
3390
  const [s, i] = fe([]), [a, c] = fe(t), [l, u] = fe(!1), [f, h] = fe(null), [p, m] = fe([]), [g, x] = fe(!1), [, y] = fe(null), [v, C] = fe(null), [R, S] = fe(!1), w = Te(a), T = Te(/* @__PURE__ */ new Map());
3391
- De(() => {
3391
+ Be(() => {
3392
3392
  w.current = a;
3393
- }, [a]), De(() => {
3393
+ }, [a]), Be(() => {
3394
3394
  t !== void 0 && t !== w.current && c(t);
3395
3395
  }, [t]);
3396
3396
  const E = ie(async () => {
@@ -3416,11 +3416,11 @@ function Xg({
3416
3416
  x(!1);
3417
3417
  }
3418
3418
  }, [e, n]);
3419
- De(() => {
3419
+ Be(() => {
3420
3420
  E();
3421
- }, [E]), De(() => {
3421
+ }, [E]), Be(() => {
3422
3422
  j();
3423
- }, [j]), De(() => {
3423
+ }, [j]), Be(() => {
3424
3424
  r == null || r(a);
3425
3425
  }, [a, r]);
3426
3426
  const L = ie(
@@ -3969,7 +3969,7 @@ function wx(e = []) {
3969
3969
  }, [i]), c = ie((u) => {
3970
3970
  r.current.push(u), a();
3971
3971
  }, [a]);
3972
- De(() => () => {
3972
+ Be(() => () => {
3973
3973
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3974
3974
  }, []);
3975
3975
  const l = Ne(() => ({
@@ -4345,7 +4345,7 @@ function Px({
4345
4345
  () => mr(u),
4346
4346
  [u]
4347
4347
  ).checkpoints, m = _x(p), g = m.timeline, [x, y] = fe(!1), [v, C] = fe(!1), [R, S] = fe(null), w = Te(r), T = Te(null), E = Te(null), j = Te(null), L = Te(null), F = Te(null), U = Te(/* @__PURE__ */ new Map()), Y = Te(null);
4348
- De(() => {
4348
+ Be(() => {
4349
4349
  w.current = r;
4350
4350
  }, [r]);
4351
4351
  const _ = ie(
@@ -4485,7 +4485,7 @@ function Px({
4485
4485
  ), A = ie(async () => {
4486
4486
  w.current && await X(w.current);
4487
4487
  }, [X]);
4488
- De(() => {
4488
+ Be(() => {
4489
4489
  if (!a || !r || x || c)
4490
4490
  return;
4491
4491
  if (E.current === r) {
@@ -4585,7 +4585,7 @@ function Mx({
4585
4585
  isStreaming: s,
4586
4586
  getMessages: ie(() => l.messages, [l.messages])
4587
4587
  });
4588
- De(() => {
4588
+ Be(() => {
4589
4589
  c || (u([], {}), L());
4590
4590
  }, [c, u, L]);
4591
4591
  const F = Te(null), U = ie(
@@ -4738,7 +4738,7 @@ function Fx({
4738
4738
  onToolEnd: l
4739
4739
  }) {
4740
4740
  const { chatApi: u, baseUrl: f } = uo(), h = f, { stream: p, stop: m, clear: g, isStreaming: x, error: y, connected: v } = qg({ baseUrl: h }), [C, R] = fe(!1);
4741
- return De(() => {
4741
+ return Be(() => {
4742
4742
  R(x);
4743
4743
  }, [x]), /* @__PURE__ */ d.jsx(
4744
4744
  Jg,
@@ -4782,7 +4782,7 @@ function zx({
4782
4782
  onToolEnd: i
4783
4783
  }) {
4784
4784
  const { stream: a, stop: c, clear: l, isStreaming: u, error: f, connected: h } = n, { setCurrentThreadId: p, currentThreadIdRef: m, addThreadFromEvent: g, currentThreadId: x } = Ss();
4785
- De(() => {
4785
+ Be(() => {
4786
4786
  x !== void 0 && l();
4787
4787
  }, [x, l]);
4788
4788
  const {
@@ -4824,7 +4824,7 @@ function zx({
4824
4824
  },
4825
4825
  [a, _, r, o, s]
4826
4826
  ), X = Te(v);
4827
- De(() => {
4827
+ Be(() => {
4828
4828
  X.current = v;
4829
4829
  }, [v]);
4830
4830
  const ee = ie(
@@ -4843,13 +4843,13 @@ function zx({
4843
4843
  },
4844
4844
  [m, q]
4845
4845
  );
4846
- De(() => {
4846
+ Be(() => {
4847
4847
  U(ee);
4848
4848
  }, [ee, U]);
4849
4849
  const H = ie(async () => {
4850
4850
  c(), l(), T(), p(null);
4851
4851
  }, [l, T, p, c]);
4852
- De(() => {
4852
+ Be(() => {
4853
4853
  F(H);
4854
4854
  }, [H, F]);
4855
4855
  const B = ie(
@@ -4985,21 +4985,14 @@ function Bo({
4985
4985
  n,
4986
4986
  r,
4987
4987
  o,
4988
- s,
4989
- h,
4990
- p,
4991
- m,
4992
- g,
4993
- x
4988
+ s
4994
4989
  ]
4995
4990
  );
4996
4991
  return /* @__PURE__ */ d.jsx(Ng, { apiConfig: f, children: /* @__PURE__ */ d.jsx(Fx, { ...y, children: e }) });
4997
4992
  }
4998
4993
  function Dr(e) {
4999
4994
  const t = Te(e);
5000
- return De(() => {
5001
- t.current = e;
5002
- }, [e]), ie((...n) => {
4995
+ return t.current = e, ie((...n) => {
5003
4996
  const r = t.current;
5004
4997
  if (r)
5005
4998
  return r(...n);
@@ -5126,7 +5119,7 @@ const Gx = _c(
5126
5119
  size: "default"
5127
5120
  }
5128
5121
  }
5129
- ), $e = b.forwardRef(
5122
+ ), Le = b.forwardRef(
5130
5123
  ({ className: e, variant: t, size: n, asChild: r = !1, ...o }, s) => {
5131
5124
  const i = r ? Tp : "button";
5132
5125
  return /* @__PURE__ */ d.jsx(
@@ -5139,7 +5132,7 @@ const Gx = _c(
5139
5132
  );
5140
5133
  }
5141
5134
  );
5142
- $e.displayName = "Button";
5135
+ Le.displayName = "Button";
5143
5136
  const ks = 0, Pn = 1, Ar = 2, Nu = 4;
5144
5137
  function Il(e) {
5145
5138
  return () => e;
@@ -5570,15 +5563,15 @@ function Ou(e, t) {
5570
5563
  }
5571
5564
  return s.push({ end: 1 / 0, start: r, value: o }), s;
5572
5565
  }
5573
- function Le(e) {
5566
+ function De(e) {
5574
5567
  return e === Yr;
5575
5568
  }
5576
5569
  function Xr(e, t) {
5577
- if (!Le(e))
5570
+ if (!De(e))
5578
5571
  return t === e.k ? e.v : t < e.k ? Xr(e.l, t) : Xr(e.r, t);
5579
5572
  }
5580
5573
  function Xt(e, t, n = "k") {
5581
- if (Le(e))
5574
+ if (De(e))
5582
5575
  return [-1 / 0, void 0];
5583
5576
  if (Number(e[n]) === t)
5584
5577
  return [e.k, e.v];
@@ -5589,24 +5582,24 @@ function Xt(e, t, n = "k") {
5589
5582
  return Xt(e.l, t, n);
5590
5583
  }
5591
5584
  function jt(e, t, n) {
5592
- return Le(e) ? Lu(t, n, 1) : t === e.k ? st(e, { k: t, v: n }) : t < e.k ? jl(st(e, { l: jt(e.l, t, n) })) : jl(st(e, { r: jt(e.r, t, n) }));
5585
+ return De(e) ? Lu(t, n, 1) : t === e.k ? st(e, { k: t, v: n }) : t < e.k ? jl(st(e, { l: jt(e.l, t, n) })) : jl(st(e, { r: jt(e.r, t, n) }));
5593
5586
  }
5594
5587
  function xr() {
5595
5588
  return Yr;
5596
5589
  }
5597
5590
  function Is(e, t, n) {
5598
- if (Le(e))
5591
+ if (De(e))
5599
5592
  return [];
5600
5593
  const r = Xt(e, t)[0];
5601
5594
  return ay(Ai(e, r, n));
5602
5595
  }
5603
5596
  function Ei(e, t) {
5604
- if (Le(e)) return Yr;
5597
+ if (De(e)) return Yr;
5605
5598
  const { k: n, l: r, r: o } = e;
5606
5599
  if (t === n) {
5607
- if (Le(r))
5600
+ if (De(r))
5608
5601
  return o;
5609
- if (Le(o))
5602
+ if (De(o))
5610
5603
  return r;
5611
5604
  {
5612
5605
  const [s, i] = Du(r);
@@ -5615,10 +5608,10 @@ function Ei(e, t) {
5615
5608
  } else return t < n ? Ho(st(e, { l: Ei(r, t) })) : Ho(st(e, { r: Ei(o, t) }));
5616
5609
  }
5617
5610
  function Un(e) {
5618
- return Le(e) ? [] : [...Un(e.l), { k: e.k, v: e.v }, ...Un(e.r)];
5611
+ return De(e) ? [] : [...Un(e.l), { k: e.k, v: e.v }, ...Un(e.r)];
5619
5612
  }
5620
5613
  function Ai(e, t, n) {
5621
- if (Le(e))
5614
+ if (De(e))
5622
5615
  return [];
5623
5616
  const { k: r, l: o, r: s, v: i } = e;
5624
5617
  let a = [];
@@ -5631,7 +5624,7 @@ function Ho(e) {
5631
5624
  if (n > r.lvl + 1) {
5632
5625
  if (Zs(t))
5633
5626
  return $u(st(e, { lvl: n - 1 }));
5634
- if (!Le(t) && !Le(t.r))
5627
+ if (!De(t) && !De(t.r))
5635
5628
  return st(t.r, {
5636
5629
  l: st(t, { r: t.r.l }),
5637
5630
  lvl: n,
@@ -5644,7 +5637,7 @@ function Ho(e) {
5644
5637
  } else {
5645
5638
  if (Zs(e))
5646
5639
  return Ni(st(e, { lvl: n - 1 }));
5647
- if (!Le(r) && !Le(r.l)) {
5640
+ if (!De(r) && !De(r.l)) {
5648
5641
  const o = r.l, s = Zs(o) ? r.lvl - 1 : r.lvl;
5649
5642
  return st(o, {
5650
5643
  l: st(e, {
@@ -5668,13 +5661,13 @@ function st(e, t) {
5668
5661
  );
5669
5662
  }
5670
5663
  function Mu(e) {
5671
- return Le(e.r) ? e.l : Ho(st(e, { r: Mu(e.r) }));
5664
+ return De(e.r) ? e.l : Ho(st(e, { r: Mu(e.r) }));
5672
5665
  }
5673
5666
  function Zs(e) {
5674
- return Le(e) || e.lvl > e.r.lvl;
5667
+ return De(e) || e.lvl > e.r.lvl;
5675
5668
  }
5676
5669
  function Du(e) {
5677
- return Le(e.r) ? [e.k, e.v] : Du(e.r);
5670
+ return De(e.r) ? [e.k, e.v] : Du(e.r);
5678
5671
  }
5679
5672
  function Lu(e, t, n, r = Yr, o = Yr) {
5680
5673
  return { k: e, l: r, lvl: n, r: o, v: t };
@@ -5684,11 +5677,11 @@ function jl(e) {
5684
5677
  }
5685
5678
  function $u(e) {
5686
5679
  const { l: t } = e;
5687
- return !Le(t) && t.lvl === e.lvl ? st(t, { r: st(e, { l: t.r }) }) : e;
5680
+ return !De(t) && t.lvl === e.lvl ? st(t, { r: st(e, { l: t.r }) }) : e;
5688
5681
  }
5689
5682
  function Ni(e) {
5690
5683
  const { lvl: t, r: n } = e;
5691
- return !Le(n) && !Le(n.r) && n.lvl === t && n.r.lvl === t ? st(n, { l: st(e, { r: n.l }), lvl: t + 1 }) : e;
5684
+ return !De(n) && !De(n.r) && n.lvl === t && n.r.lvl === t ? st(n, { l: st(e, { r: n.l }), lvl: t + 1 }) : e;
5692
5685
  }
5693
5686
  function ay(e) {
5694
5687
  return Ou(e, ({ k: t, v: n }) => ({ index: t, value: n }));
@@ -5733,7 +5726,7 @@ function Rn(e, t) {
5733
5726
  return Math.round(e.getBoundingClientRect()[t]);
5734
5727
  }
5735
5728
  function Es(e) {
5736
- return !Le(e.groupOffsetTree);
5729
+ return !De(e.groupOffsetTree);
5737
5730
  }
5738
5731
  function sa({ index: e }, t) {
5739
5732
  return t === e ? 0 : t < e ? -1 : 1;
@@ -5750,10 +5743,10 @@ function cy() {
5750
5743
  };
5751
5744
  }
5752
5745
  function uy(e, t) {
5753
- let n = Le(e) ? 0 : 1 / 0;
5746
+ let n = De(e) ? 0 : 1 / 0;
5754
5747
  for (const r of t) {
5755
5748
  const { endIndex: o, size: s, startIndex: i } = r;
5756
- if (n = Math.min(n, i), Le(e)) {
5749
+ if (n = Math.min(n, i), De(e)) {
5757
5750
  e = jt(e, 0, s);
5758
5751
  continue;
5759
5752
  }
@@ -5803,7 +5796,7 @@ function py(e, [t, n, r, o]) {
5803
5796
  t.length > 0 && r("received item sizes", t, kt.DEBUG);
5804
5797
  const s = e.sizeTree;
5805
5798
  let i = s, a = 0;
5806
- if (n.length > 0 && Le(s) && t.length === 2) {
5799
+ if (n.length > 0 && De(s) && t.length === 2) {
5807
5800
  const h = t[0].size, p = t[1].size;
5808
5801
  i = n.reduce((m, g) => jt(jt(m, g, h), g + 1, p), i);
5809
5802
  } else
@@ -5923,7 +5916,7 @@ const yy = {
5923
5916
  he(
5924
5917
  Z(
5925
5918
  u,
5926
- ye((S) => S !== void 0 && Le(tt(g).sizeTree)),
5919
+ ye((S) => S !== void 0 && De(tt(g).sizeTree)),
5927
5920
  ae((S) => [{ endIndex: 0, size: S, startIndex: 0 }])
5928
5921
  ),
5929
5922
  n
@@ -6045,7 +6038,7 @@ const yy = {
6045
6038
  Ae(g, p),
6046
6039
  ae(([S, w, T]) => {
6047
6040
  if (w.groupIndices.length > 0) {
6048
- if (Le(w.sizeTree))
6041
+ if (De(w.sizeTree))
6049
6042
  return w;
6050
6043
  let E = xr();
6051
6044
  const j = tt(x);
@@ -6263,7 +6256,7 @@ const ho = Oe(
6263
6256
  Z(
6264
6257
  rt(t, i),
6265
6258
  Ae(a, n, e, l),
6266
- ye(([[, u], f, { sizeTree: h }, p, m]) => u && (!Le(h) || ta(p)) && !f && !m),
6259
+ ye(([[, u], f, { sizeTree: h }, p, m]) => u && (!De(h) || ta(p)) && !f && !m),
6267
6260
  Ae(c)
6268
6261
  ),
6269
6262
  ([, u]) => {
@@ -6625,7 +6618,7 @@ const or = Oe(
6625
6618
  return { ...Qs, totalCount: E };
6626
6619
  if (w === 0 && T === 0)
6627
6620
  return B === 0 ? { ...Qs, totalCount: E } : Ku(B, L, j, Y, _, q || []);
6628
- if (Le(H))
6621
+ if (De(H))
6629
6622
  return B > 0 ? null : Uo(
6630
6623
  ky(aa(L, E), X, q),
6631
6624
  [],
@@ -8509,7 +8502,7 @@ function pa({
8509
8502
  /* @__PURE__ */ d.jsx(hd, { className: "text-blue-700 dark:text-blue-300 text-sm", children: l })
8510
8503
  ] }),
8511
8504
  a ? /* @__PURE__ */ d.jsx(Oi, { className: "pt-0 pb-3", children: /* @__PURE__ */ d.jsx("div", { className: "space-y-2", children: a.alternatives.map((f) => /* @__PURE__ */ d.jsx(
8512
- $e,
8505
+ Le,
8513
8506
  {
8514
8507
  size: "sm",
8515
8508
  variant: "outline",
@@ -8525,7 +8518,7 @@ function pa({
8525
8518
  )) }) }) : u && /* @__PURE__ */ d.jsx(Oi, { className: "pt-0 pb-3", children: u }),
8526
8519
  !a && /* @__PURE__ */ d.jsx(pd, { className: "pt-0", children: /* @__PURE__ */ d.jsxs("div", { className: "flex gap-2 ml-auto", children: [
8527
8520
  /* @__PURE__ */ d.jsx(
8528
- $e,
8521
+ Le,
8529
8522
  {
8530
8523
  size: "sm",
8531
8524
  variant: "outline",
@@ -8536,7 +8529,7 @@ function pa({
8536
8529
  }
8537
8530
  ),
8538
8531
  /* @__PURE__ */ d.jsx(
8539
- $e,
8532
+ Le,
8540
8533
  {
8541
8534
  size: "sm",
8542
8535
  onClick: () => t(e),
@@ -8552,7 +8545,7 @@ function pa({
8552
8545
  }
8553
8546
  function md({ className: e }) {
8554
8547
  const t = Te(null);
8555
- return De(() => {
8548
+ return Be(() => {
8556
8549
  let n = 0;
8557
8550
  const r = () => {
8558
8551
  if (n = (n + 1) % 4, t.current) {
@@ -8621,7 +8614,7 @@ function bd(e) {
8621
8614
  return e.replace(Eb, (t, n) => (n = n.toLowerCase(), n === "colon" ? ":" : n.charAt(0) === "#" ? n.charAt(1) === "x" ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1)) : ""));
8622
8615
  }
8623
8616
  const Ab = /(^|[^\[])\^/g;
8624
- function Fe(e, t) {
8617
+ function $e(e, t) {
8625
8618
  e = typeof e == "string" ? e : e.source, t = t || "";
8626
8619
  const n = {
8627
8620
  replace: (r, o) => (o = o.source || o, o = o.replace(Ab, "$1"), e = e.replace(r, o), n),
@@ -9183,26 +9176,26 @@ const me = {
9183
9176
  };
9184
9177
  me._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
9185
9178
  me._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
9186
- me.def = Fe(me.def).replace("label", me._label).replace("title", me._title).getRegex();
9179
+ me.def = $e(me.def).replace("label", me._label).replace("title", me._title).getRegex();
9187
9180
  me.bullet = /(?:[*+-]|\d{1,9}[.)])/;
9188
- me.listItemStart = Fe(/^( *)(bull) */).replace("bull", me.bullet).getRegex();
9189
- me.list = Fe(me.list).replace(/bull/g, me.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + me.def.source + ")").getRegex();
9181
+ me.listItemStart = $e(/^( *)(bull) */).replace("bull", me.bullet).getRegex();
9182
+ me.list = $e(me.list).replace(/bull/g, me.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + me.def.source + ")").getRegex();
9190
9183
  me._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
9191
9184
  me._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
9192
- me.html = Fe(me.html, "i").replace("comment", me._comment).replace("tag", me._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
9193
- me.paragraph = Fe(me._paragraph).replace("hr", me.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", me._tag).getRegex();
9194
- me.blockquote = Fe(me.blockquote).replace("paragraph", me.paragraph).getRegex();
9185
+ me.html = $e(me.html, "i").replace("comment", me._comment).replace("tag", me._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
9186
+ me.paragraph = $e(me._paragraph).replace("hr", me.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", me._tag).getRegex();
9187
+ me.blockquote = $e(me.blockquote).replace("paragraph", me.paragraph).getRegex();
9195
9188
  me.normal = { ...me };
9196
9189
  me.gfm = {
9197
9190
  ...me.normal,
9198
9191
  table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
9199
9192
  // Cells
9200
9193
  };
9201
- me.gfm.table = Fe(me.gfm.table).replace("hr", me.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", me._tag).getRegex();
9202
- me.gfm.paragraph = Fe(me._paragraph).replace("hr", me.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", me.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", me._tag).getRegex();
9194
+ me.gfm.table = $e(me.gfm.table).replace("hr", me.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", me._tag).getRegex();
9195
+ me.gfm.paragraph = $e(me._paragraph).replace("hr", me.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", me.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", me._tag).getRegex();
9203
9196
  me.pedantic = {
9204
9197
  ...me.normal,
9205
- html: Fe(
9198
+ html: $e(
9206
9199
  `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
9207
9200
  ).replace("comment", me._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
9208
9201
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
@@ -9210,7 +9203,7 @@ me.pedantic = {
9210
9203
  fences: ss,
9211
9204
  // fences not supported
9212
9205
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
9213
- paragraph: Fe(me.normal._paragraph).replace("hr", me.hr).replace("heading", ` *#{1,6} *[^
9206
+ paragraph: $e(me.normal._paragraph).replace("hr", me.hr).replace("heading", ` *#{1,6} *[^
9214
9207
  ]`).replace("lheading", me.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
9215
9208
  };
9216
9209
  const le = {
@@ -9238,26 +9231,26 @@ const le = {
9238
9231
  punctuation: /^([\spunctuation])/
9239
9232
  };
9240
9233
  le._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
9241
- le.punctuation = Fe(le.punctuation).replace(/punctuation/g, le._punctuation).getRegex();
9234
+ le.punctuation = $e(le.punctuation).replace(/punctuation/g, le._punctuation).getRegex();
9242
9235
  le.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
9243
9236
  le.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
9244
- le._comment = Fe(me._comment).replace("(?:-->|$)", "-->").getRegex();
9245
- le.emStrong.lDelim = Fe(le.emStrong.lDelim).replace(/punct/g, le._punctuation).getRegex();
9246
- le.emStrong.rDelimAst = Fe(le.emStrong.rDelimAst, "g").replace(/punct/g, le._punctuation).getRegex();
9247
- le.emStrong.rDelimUnd = Fe(le.emStrong.rDelimUnd, "g").replace(/punct/g, le._punctuation).getRegex();
9237
+ le._comment = $e(me._comment).replace("(?:-->|$)", "-->").getRegex();
9238
+ le.emStrong.lDelim = $e(le.emStrong.lDelim).replace(/punct/g, le._punctuation).getRegex();
9239
+ le.emStrong.rDelimAst = $e(le.emStrong.rDelimAst, "g").replace(/punct/g, le._punctuation).getRegex();
9240
+ le.emStrong.rDelimUnd = $e(le.emStrong.rDelimUnd, "g").replace(/punct/g, le._punctuation).getRegex();
9248
9241
  le._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
9249
9242
  le._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
9250
9243
  le._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
9251
- le.autolink = Fe(le.autolink).replace("scheme", le._scheme).replace("email", le._email).getRegex();
9244
+ le.autolink = $e(le.autolink).replace("scheme", le._scheme).replace("email", le._email).getRegex();
9252
9245
  le._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
9253
- le.tag = Fe(le.tag).replace("comment", le._comment).replace("attribute", le._attribute).getRegex();
9246
+ le.tag = $e(le.tag).replace("comment", le._comment).replace("attribute", le._attribute).getRegex();
9254
9247
  le._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
9255
9248
  le._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
9256
9249
  le._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
9257
- le.link = Fe(le.link).replace("label", le._label).replace("href", le._href).replace("title", le._title).getRegex();
9258
- le.reflink = Fe(le.reflink).replace("label", le._label).replace("ref", me._label).getRegex();
9259
- le.nolink = Fe(le.nolink).replace("ref", me._label).getRegex();
9260
- le.reflinkSearch = Fe(le.reflinkSearch, "g").replace("reflink", le.reflink).replace("nolink", le.nolink).getRegex();
9250
+ le.link = $e(le.link).replace("label", le._label).replace("href", le._href).replace("title", le._title).getRegex();
9251
+ le.reflink = $e(le.reflink).replace("label", le._label).replace("ref", me._label).getRegex();
9252
+ le.nolink = $e(le.nolink).replace("ref", me._label).getRegex();
9253
+ le.reflinkSearch = $e(le.reflinkSearch, "g").replace("reflink", le.reflink).replace("nolink", le.nolink).getRegex();
9261
9254
  le.normal = { ...le };
9262
9255
  le.pedantic = {
9263
9256
  ...le.normal,
@@ -9273,23 +9266,23 @@ le.pedantic = {
9273
9266
  endAst: /\*(?!\*)/g,
9274
9267
  endUnd: /_(?!_)/g
9275
9268
  },
9276
- link: Fe(/^!?\[(label)\]\((.*?)\)/).replace("label", le._label).getRegex(),
9277
- reflink: Fe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", le._label).getRegex()
9269
+ link: $e(/^!?\[(label)\]\((.*?)\)/).replace("label", le._label).getRegex(),
9270
+ reflink: $e(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", le._label).getRegex()
9278
9271
  };
9279
9272
  le.gfm = {
9280
9273
  ...le.normal,
9281
- escape: Fe(le.escape).replace("])", "~|])").getRegex(),
9274
+ escape: $e(le.escape).replace("])", "~|])").getRegex(),
9282
9275
  _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
9283
9276
  url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
9284
9277
  _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
9285
9278
  del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
9286
9279
  text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
9287
9280
  };
9288
- le.gfm.url = Fe(le.gfm.url, "i").replace("email", le.gfm._extended_email).getRegex();
9281
+ le.gfm.url = $e(le.gfm.url, "i").replace("email", le.gfm._extended_email).getRegex();
9289
9282
  le.breaks = {
9290
9283
  ...le.gfm,
9291
- br: Fe(le.br).replace("{2,}", "*").getRegex(),
9292
- text: Fe(le.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
9284
+ br: $e(le.br).replace("{2,}", "*").getRegex(),
9285
+ text: $e(le.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
9293
9286
  };
9294
9287
  function Fb(e) {
9295
9288
  return e.replace(/---/g, "—").replace(/--/g, "–").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1‘").replace(/'/g, "’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1“").replace(/"/g, "”").replace(/\.{3}/g, "…");
@@ -10211,7 +10204,7 @@ function Cd({
10211
10204
  }
10212
10205
  ) }),
10213
10206
  /* @__PURE__ */ d.jsx(
10214
- $e,
10207
+ Le,
10215
10208
  {
10216
10209
  type: "button",
10217
10210
  variant: "ghost",
@@ -10378,7 +10371,7 @@ function xa(e) {
10378
10371
  }
10379
10372
  function Wb(e, t, n) {
10380
10373
  const [r, o] = fe(e), s = Te(e), i = Te(null);
10381
- return De(() => {
10374
+ return Be(() => {
10382
10375
  s.current = e;
10383
10376
  const a = () => {
10384
10377
  o(s.current), i.current && (clearTimeout(i.current), i.current = null);
@@ -10643,7 +10636,7 @@ const kd = oo(function({
10643
10636
  )
10644
10637
  ] }), q = !p && /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
10645
10638
  /* @__PURE__ */ d.jsx(
10646
- $e,
10639
+ Le,
10647
10640
  {
10648
10641
  variant: "ghost",
10649
10642
  size: "sm",
@@ -10653,7 +10646,7 @@ const kd = oo(function({
10653
10646
  }
10654
10647
  ),
10655
10648
  l && /* @__PURE__ */ d.jsx(
10656
- $e,
10649
+ Le,
10657
10650
  {
10658
10651
  variant: "ghost",
10659
10652
  size: "sm",
@@ -11066,7 +11059,7 @@ function ya({
11066
11059
  ),
11067
11060
  children: [
11068
11061
  /* @__PURE__ */ d.jsx("div", { className: "relative", children: /* @__PURE__ */ d.jsx(
11069
- $e,
11062
+ Le,
11070
11063
  {
11071
11064
  variant: "ghost",
11072
11065
  size: "sm",
@@ -11078,7 +11071,7 @@ function ya({
11078
11071
  }
11079
11072
  ) }),
11080
11073
  h === "user" && m && /* @__PURE__ */ d.jsx(
11081
- $e,
11074
+ Le,
11082
11075
  {
11083
11076
  variant: "ghost",
11084
11077
  size: "sm",
@@ -11089,7 +11082,7 @@ function ya({
11089
11082
  }
11090
11083
  ),
11091
11084
  h === "assistant" && g && /* @__PURE__ */ d.jsx(
11092
- $e,
11085
+ Le,
11093
11086
  {
11094
11087
  variant: "ghost",
11095
11088
  size: "sm",
@@ -11182,7 +11175,7 @@ const Id = oo(function({
11182
11175
  }
11183
11176
  ), Y = /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
11184
11177
  /* @__PURE__ */ d.jsx(
11185
- $e,
11178
+ Le,
11186
11179
  {
11187
11180
  variant: "ghost",
11188
11181
  size: "sm",
@@ -11192,7 +11185,7 @@ const Id = oo(function({
11192
11185
  }
11193
11186
  ),
11194
11187
  s && /* @__PURE__ */ d.jsx(
11195
- $e,
11188
+ Le,
11196
11189
  {
11197
11190
  variant: "ghost",
11198
11191
  size: "sm",
@@ -11411,7 +11404,7 @@ const Xb = Object.freeze({}), Ad = te.forwardRef(({
11411
11404
  }
11412
11405
  };
11413
11406
  }, [i]), $ = Ne(() => !p || m ? !1 : "auto", [p, m]), A = ee.length === 0 && h, N = ["flex h-full flex-col md:flex-row", u].filter(Boolean).join(" "), D = () => A ? /* @__PURE__ */ d.jsx("div", { className: "h-full w-full", children: h }) : /* @__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!" }), P = ee.length, W = P > 0;
11414
- return De(() => {
11407
+ return Be(() => {
11415
11408
  var O, I;
11416
11409
  if (P === 0) {
11417
11410
  _.current = !1;
@@ -15273,7 +15266,7 @@ function aC({
15273
15266
  F && /* @__PURE__ */ d.jsx("p", { className: "mt-1 text-xs text-destructive font-medium", children: F })
15274
15267
  ] }),
15275
15268
  /* @__PURE__ */ d.jsx("div", { children: r ? /* @__PURE__ */ d.jsx(
15276
- $e,
15269
+ Le,
15277
15270
  {
15278
15271
  type: "button",
15279
15272
  onClick: () => {
@@ -15287,7 +15280,7 @@ function aC({
15287
15280
  children: /* @__PURE__ */ d.jsx(Mp, { size: 16 })
15288
15281
  }
15289
15282
  ) : /* @__PURE__ */ d.jsx(
15290
- $e,
15283
+ Le,
15291
15284
  {
15292
15285
  type: "button",
15293
15286
  onClick: (D) => void H(D),
@@ -15385,7 +15378,7 @@ function ph({
15385
15378
  /* @__PURE__ */ d.jsx(el, { size: 14 }),
15386
15379
  /* @__PURE__ */ d.jsx("span", { className: "truncate max-w-[150px]", children: P.name }),
15387
15380
  /* @__PURE__ */ d.jsx(
15388
- $e,
15381
+ Le,
15389
15382
  {
15390
15383
  variant: "ghost",
15391
15384
  size: "sm",
@@ -15423,7 +15416,7 @@ function ph({
15423
15416
  /* @__PURE__ */ d.jsxs("div", { className: "flex items-end gap-2", children: [
15424
15417
  (h || p) && /* @__PURE__ */ d.jsxs(Fa, { children: [
15425
15418
  /* @__PURE__ */ d.jsx(za, { asChild: !0, children: /* @__PURE__ */ d.jsx(
15426
- $e,
15419
+ Le,
15427
15420
  {
15428
15421
  type: "button",
15429
15422
  size: "icon",
@@ -15503,7 +15496,7 @@ function cC({
15503
15496
  activeThreadId: h
15504
15497
  }) {
15505
15498
  const { messages: p } = ku(), [m, g] = fe(null), [x, y] = fe(""), [v, C] = fe(null), [R, S] = fe(null), [w, T] = fe(!1), [E, j] = fe(""), L = Te(E), F = Te(null);
15506
- De(() => {
15499
+ Be(() => {
15507
15500
  if (!m)
15508
15501
  if (h) {
15509
15502
  const $ = localStorage.getItem(Js(h));
@@ -15514,9 +15507,9 @@ function cC({
15514
15507
  const U = ie(($) => {
15515
15508
  j($), !m && h && localStorage.setItem(Js(h), $);
15516
15509
  }, [h, m]);
15517
- De(() => {
15510
+ Be(() => {
15518
15511
  L.current = E;
15519
- }, [E]), De(() => {
15512
+ }, [E]), Be(() => {
15520
15513
  if (!m) {
15521
15514
  F.current = null;
15522
15515
  return;
@@ -15687,7 +15680,7 @@ function Go({
15687
15680
  // Handled by stream state
15688
15681
  activeThreadId: R ?? null
15689
15682
  }), E = ((I = S.metadata) == null ? void 0 : I.assemblingMessageId) ?? null, j = S.interrupt, L = j ? xu(j.id) : null, F = L !== null ? { type: "interrupt", id: L } : null, [U, Y] = fe(!1), [_, q] = fe("desktop"), [X, ee] = fe(!1), H = Te(null);
15690
- De(() => {
15683
+ Be(() => {
15691
15684
  const J = () => {
15692
15685
  const se = window.innerWidth;
15693
15686
  q(se < 640 ? "phone" : se < 1024 ? "tablet" : "desktop");
@@ -15729,7 +15722,7 @@ function Go({
15729
15722
  return /* @__PURE__ */ d.jsxs("div", { className: N, children: [
15730
15723
  !!w.error && !T.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: [
15731
15724
  /* @__PURE__ */ d.jsx("span", { children: w.error }),
15732
- /* @__PURE__ */ d.jsx($e, { variant: "ghost", size: "sm", onClick: () => T.setDismissError(!0), className: "text-red-800 hover:bg-red-100", children: /* @__PURE__ */ d.jsx(Jo, { size: 16 }) })
15725
+ /* @__PURE__ */ d.jsx(Le, { variant: "ghost", size: "sm", onClick: () => T.setDismissError(!0), className: "text-red-800 hover:bg-red-100", children: /* @__PURE__ */ d.jsx(Jo, { size: 16 }) })
15733
15726
  ] }),
15734
15727
  /* @__PURE__ */ d.jsxs("div", { className: `relative ${D}`, style: n ? { maxHeight: n } : void 0, children: [
15735
15728
  /* @__PURE__ */ d.jsx(
@@ -15790,7 +15783,7 @@ function Go({
15790
15783
  /* @__PURE__ */ d.jsx(so, { size: 16, className: "text-blue-600" }),
15791
15784
  /* @__PURE__ */ d.jsx("span", { className: "text-sm font-medium text-blue-800", children: "Editing message" })
15792
15785
  ] }),
15793
- /* @__PURE__ */ d.jsx($e, { variant: "ghost", size: "sm", onClick: T.cancelEditing, className: "text-blue-600 hover:bg-blue-100", children: /* @__PURE__ */ d.jsx(Jo, { size: 16 }) })
15786
+ /* @__PURE__ */ d.jsx(Le, { variant: "ghost", size: "sm", onClick: T.cancelEditing, className: "text-blue-600 hover:bg-blue-100", children: /* @__PURE__ */ d.jsx(Jo, { size: 16 }) })
15794
15787
  ] }),
15795
15788
  T.inputError && /* @__PURE__ */ d.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: T.inputError }),
15796
15789
  /* @__PURE__ */ d.jsx(
@@ -17106,15 +17099,15 @@ function gi({
17106
17099
  p && e.updatedAt && /* @__PURE__ */ d.jsx("span", { className: "text-[10px] text-muted-foreground", children: p(e.updatedAt) })
17107
17100
  ] }),
17108
17101
  /* @__PURE__ */ d.jsx("div", { className: "flex items-center gap-1", children: v ? /* @__PURE__ */ d.jsxs("div", { className: "flex items-center gap-1", children: [
17109
- /* @__PURE__ */ d.jsx($e, { size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: (w) => {
17102
+ /* @__PURE__ */ d.jsx(Le, { size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: (w) => {
17110
17103
  w.stopPropagation(), a == null || a(e);
17111
17104
  }, children: "Save" }),
17112
- /* @__PURE__ */ d.jsx($e, { size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: (w) => {
17105
+ /* @__PURE__ */ d.jsx(Le, { size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: (w) => {
17113
17106
  w.stopPropagation(), c == null || c(e);
17114
17107
  }, children: "Cancel" })
17115
17108
  ] }) : /* @__PURE__ */ d.jsxs(Fa, { children: [
17116
17109
  /* @__PURE__ */ d.jsx(za, { asChild: !0, children: /* @__PURE__ */ d.jsxs(
17117
- $e,
17110
+ Le,
17118
17111
  {
17119
17112
  size: "sm",
17120
17113
  variant: "ghost",
@@ -17274,7 +17267,7 @@ function mT({
17274
17267
  defaultView: e
17275
17268
  } = {}) {
17276
17269
  const [t, n] = fe(() => pT() ?? e ?? "default");
17277
- De(() => {
17270
+ Be(() => {
17278
17271
  if (!(typeof window > "u"))
17279
17272
  try {
17280
17273
  window.localStorage.setItem(gp, t);
@@ -17326,7 +17319,7 @@ function Wi({
17326
17319
  shareStatus: X,
17327
17320
  clearShareStatus: ee
17328
17321
  } = Ss(), { createThread: H, deleteThread: B, renameThread: Q, shareThread: $ } = _, { loadThread: A } = Ts(), N = i ?? L, [D, P] = fe(Array.isArray(E) ? E : []), W = Te(D.length > 0), O = Te(null), I = Te(0), [K, J] = fe(null), [se, ge] = fe(""), [Ce, Pe] = fe(!1), [Ie, Ke] = fe(!1), [Xe, He] = fe(null), [Ue, it] = fe(""), [mt, bt] = fe([]), [gt, Qe] = fe(!1), ot = ie((G) => ge(G), []);
17329
- De(() => {
17322
+ Be(() => {
17330
17323
  Ie && !y && mt.length === 0 && !gt && (async () => {
17331
17324
  Qe(!0);
17332
17325
  try {
@@ -17405,18 +17398,18 @@ function Wi({
17405
17398
  (M, V) => new Date(V.updatedAt || V.createdAt || "").getTime() - new Date(M.updatedAt || M.createdAt || "").getTime()
17406
17399
  );
17407
17400
  }), { kind: "flat", groups: re };
17408
- }, [Kt, R, Lt]), $n = Lt ? Y : U, ze = Lt ? "No shared conversations yet" : "No conversations yet", Je = (G) => {
17401
+ }, [Kt, R, Lt]), $n = Lt ? Y : U, Fe = Lt ? "No shared conversations yet" : "No conversations yet", Je = (G) => {
17409
17402
  const de = G.sharedAt ? ` • ${rn(G.sharedAt)}` : "";
17410
17403
  return `Shared by ${G.sharedByUserId}${de}`;
17411
17404
  }, wn = (G) => "sharedByUserId" in G;
17412
- De(() => {
17405
+ Be(() => {
17413
17406
  const G = Array.isArray(E) ? E : [];
17414
17407
  if (G.length > 0) {
17415
17408
  W.current = !0, P(G);
17416
17409
  return;
17417
17410
  }
17418
17411
  U || (W.current = !1, P(G));
17419
- }, [E, U]), De(() => {
17412
+ }, [E, U]), Be(() => {
17420
17413
  if (!O.current) return;
17421
17414
  const G = O.current.querySelector(
17422
17415
  "[data-radix-scroll-area-viewport]"
@@ -17491,7 +17484,7 @@ function Wi({
17491
17484
  className: s.header || "flex flex-col gap-2 px-1 py-0 border border-slate-200 bg-white dark:border-slate-700 dark:bg-slate-900 shadow-sm",
17492
17485
  children: [
17493
17486
  t && /* @__PURE__ */ d.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ d.jsxs(
17494
- $e,
17487
+ Le,
17495
17488
  {
17496
17489
  onClick: Sn,
17497
17490
  disabled: Ce || U,
@@ -17509,7 +17502,7 @@ function Wi({
17509
17502
  /* @__PURE__ */ d.jsx("span", { children: "Current View" }),
17510
17503
  /* @__PURE__ */ d.jsxs(Fa, { children: [
17511
17504
  /* @__PURE__ */ d.jsx(za, { asChild: !0, children: /* @__PURE__ */ d.jsx(
17512
- $e,
17505
+ Le,
17513
17506
  {
17514
17507
  variant: "outline",
17515
17508
  size: "sm",
@@ -17547,7 +17540,7 @@ function Wi({
17547
17540
  /* @__PURE__ */ d.jsx("span", { className: "text-sm", children: "Loading threads…" })
17548
17541
  ] }) : Kt.length === 0 ? /* @__PURE__ */ d.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
17549
17542
  /* @__PURE__ */ d.jsx(Fc, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
17550
- /* @__PURE__ */ d.jsx("p", { className: "text-sm text-slate-500", children: ze })
17543
+ /* @__PURE__ */ d.jsx("p", { className: "text-sm text-slate-500", children: Fe })
17551
17544
  ] }) : Et ? Et.kind === "project-menu-date" ? Object.entries(Et.groups).sort(([G], [de]) => {
17552
17545
  const re = "Default";
17553
17546
  return G === re ? 1 : de === re ? -1 : G.localeCompare(de);
@@ -18024,7 +18017,7 @@ function fk({
18024
18017
  ] }),
18025
18018
  /* @__PURE__ */ d.jsxs("div", { className: "flex items-center gap-1", children: [
18026
18019
  /* @__PURE__ */ d.jsx(
18027
- $e,
18020
+ Le,
18028
18021
  {
18029
18022
  variant: "ghost",
18030
18023
  size: "sm",
@@ -18034,7 +18027,7 @@ function fk({
18034
18027
  }
18035
18028
  ),
18036
18029
  /* @__PURE__ */ d.jsx(
18037
- $e,
18030
+ Le,
18038
18031
  {
18039
18032
  variant: "ghost",
18040
18033
  size: "sm",
@@ -18044,7 +18037,7 @@ function fk({
18044
18037
  }
18045
18038
  ),
18046
18039
  /* @__PURE__ */ d.jsx(
18047
- $e,
18040
+ Le,
18048
18041
  {
18049
18042
  variant: "ghost",
18050
18043
  size: "sm",
@@ -18074,7 +18067,7 @@ function hk({
18074
18067
  ...s
18075
18068
  }) {
18076
18069
  return /* @__PURE__ */ d.jsxs(
18077
- $e,
18070
+ Le,
18078
18071
  {
18079
18072
  variant: r,
18080
18073
  size: o,