teodor-new-chat-ui 2.0.26 → 2.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as c, jsxs as R, Fragment as De } from "react/jsx-runtime";
2
2
  import * as l from "react";
3
- import Qe, { useState as ce, useRef as rt, useCallback as Ce, useEffect as we, useReducer as Du, useMemo as nt, createContext as ca, useContext as la, useLayoutEffect as Lu } from "react";
3
+ import Je, { useState as ce, useRef as rt, useCallback as Ce, useEffect as we, useReducer as Du, useMemo as nt, createContext as ca, useContext as la, useLayoutEffect as Lu } from "react";
4
4
  import { ChevronUp as Wt, ChevronDown as Tt, Copy as ns, Edit as rs, RotateCcw as Wr, GitBranch as ua, ChevronLeft as Fu, ChevronRight as da, Bot as os, Wrench as $u, User as Bu, Image as Uu, Check as mo, Circle as zu, X as Kt, Edit3 as fa, Paperclip as ss, Plus as Hu, Square as Wu, Send as Vu, MessageSquarePlus as ju, MessageSquare as Ku, Calendar as Gu, Trash2 as qu, PanelLeft as Xu, Settings as Yu, Server as Ju, EyeOff as Zu, Eye as Qu, Layout as ed, MessageCircle as td, Save as nd } from "lucide-react";
5
5
  import { Slot as Dt, createSlot as _t, createSlottable as rd } from "@radix-ui/react-slot";
6
6
  import { cva as rn } from "class-variance-authority";
@@ -1238,9 +1238,9 @@ const Ia = (e) => {
1238
1238
  onDownloadProgress: C,
1239
1239
  onUploadProgress: I,
1240
1240
  responseType: N,
1241
- headers: L,
1242
- withCredentials: M = "same-origin",
1243
- fetchOptions: D
1241
+ headers: F,
1242
+ withCredentials: D = "same-origin",
1243
+ fetchOptions: L
1244
1244
  } = Ia(m), j = t || fetch;
1245
1245
  N = N ? (N + "").toLowerCase() : "text";
1246
1246
  let K = Nf([y, x && x.toAbortSignal()], E), W = null;
@@ -1249,44 +1249,44 @@ const Ia = (e) => {
1249
1249
  });
1250
1250
  let q;
1251
1251
  try {
1252
- if (I && f && b !== "get" && b !== "head" && (q = await v(L, w)) !== 0) {
1252
+ if (I && f && b !== "get" && b !== "head" && (q = await v(F, w)) !== 0) {
1253
1253
  let O = new n(h, {
1254
1254
  method: "POST",
1255
1255
  body: w,
1256
1256
  duplex: "half"
1257
- }), X;
1258
- if (S.isFormData(w) && (X = O.headers.get("content-type")) && L.setContentType(X), O.body) {
1259
- const [$, z] = ds(
1257
+ }), Y;
1258
+ if (S.isFormData(w) && (Y = O.headers.get("content-type")) && F.setContentType(Y), O.body) {
1259
+ const [M, z] = ds(
1260
1260
  q,
1261
1261
  Ln(fs(I))
1262
1262
  );
1263
- w = hs(O.body, ms, $, z);
1263
+ w = hs(O.body, ms, M, z);
1264
1264
  }
1265
1265
  }
1266
- S.isString(M) || (M = M ? "include" : "omit");
1267
- const F = s && "credentials" in n.prototype, G = {
1268
- ...D,
1266
+ S.isString(D) || (D = D ? "include" : "omit");
1267
+ const $ = s && "credentials" in n.prototype, G = {
1268
+ ...L,
1269
1269
  signal: K,
1270
1270
  method: b.toUpperCase(),
1271
- headers: L.normalize().toJSON(),
1271
+ headers: F.normalize().toJSON(),
1272
1272
  body: w,
1273
1273
  duplex: "half",
1274
- credentials: F ? M : void 0
1274
+ credentials: $ ? D : void 0
1275
1275
  };
1276
1276
  W = s && new n(h, G);
1277
- let T = await (s ? j(W, D) : j(h, G));
1277
+ let T = await (s ? j(W, L) : j(h, G));
1278
1278
  const P = d && (N === "stream" || N === "response");
1279
1279
  if (d && (C || P && B)) {
1280
1280
  const O = {};
1281
1281
  ["status", "statusText", "headers"].forEach((le) => {
1282
1282
  O[le] = T[le];
1283
1283
  });
1284
- const X = S.toFiniteNumber(T.headers.get("content-length")), [$, z] = C && ds(
1285
- X,
1284
+ const Y = S.toFiniteNumber(T.headers.get("content-length")), [M, z] = C && ds(
1285
+ Y,
1286
1286
  Ln(fs(C), !0)
1287
1287
  ) || [];
1288
1288
  T = new r(
1289
- hs(T.body, ms, $, () => {
1289
+ hs(T.body, ms, M, () => {
1290
1290
  z && z(), B && B();
1291
1291
  }),
1292
1292
  O
@@ -1294,8 +1294,8 @@ const Ia = (e) => {
1294
1294
  }
1295
1295
  N = N || "text";
1296
1296
  let _ = await p[S.findKey(p, N) || "text"](T, m);
1297
- return !P && B && B(), await new Promise((O, X) => {
1298
- Pa(O, X, {
1297
+ return !P && B && B(), await new Promise((O, Y) => {
1298
+ Pa(O, Y, {
1299
1299
  data: _,
1300
1300
  headers: Te.from(T.headers),
1301
1301
  status: T.status,
@@ -1304,13 +1304,13 @@ const Ia = (e) => {
1304
1304
  request: W
1305
1305
  });
1306
1306
  });
1307
- } catch (F) {
1308
- throw B && B(), F && F.name === "TypeError" && /Load failed|fetch/i.test(F.message) ? Object.assign(
1307
+ } catch ($) {
1308
+ throw B && B(), $ && $.name === "TypeError" && /Load failed|fetch/i.test($.message) ? Object.assign(
1309
1309
  new ee("Network Error", ee.ERR_NETWORK, m, W),
1310
1310
  {
1311
- cause: F.cause || F
1311
+ cause: $.cause || $
1312
1312
  }
1313
- ) : ee.from(F, F && F.code, m, W);
1313
+ ) : ee.from($, $ && $.code, m, W);
1314
1314
  }
1315
1315
  };
1316
1316
  }, Of = /* @__PURE__ */ new Map(), Oa = (e) => {
@@ -1723,26 +1723,26 @@ function La(e) {
1723
1723
  return La(ft(e, o));
1724
1724
  }, n;
1725
1725
  }
1726
- const me = La(cn);
1727
- me.Axios = dt;
1728
- me.CanceledError = Ft;
1729
- me.CancelToken = Df;
1730
- me.isCancel = Aa;
1731
- me.VERSION = ka;
1732
- me.toFormData = Zn;
1733
- me.AxiosError = ee;
1734
- me.Cancel = me.CanceledError;
1735
- me.all = function(t) {
1726
+ const ge = La(cn);
1727
+ ge.Axios = dt;
1728
+ ge.CanceledError = Ft;
1729
+ ge.CancelToken = Df;
1730
+ ge.isCancel = Aa;
1731
+ ge.VERSION = ka;
1732
+ ge.toFormData = Zn;
1733
+ ge.AxiosError = ee;
1734
+ ge.Cancel = ge.CanceledError;
1735
+ ge.all = function(t) {
1736
1736
  return Promise.all(t);
1737
1737
  };
1738
- me.spread = Lf;
1739
- me.isAxiosError = Ff;
1740
- me.mergeConfig = ft;
1741
- me.AxiosHeaders = Te;
1742
- me.formToJSON = (e) => Ta(S.isHTMLForm(e) ? new FormData(e) : e);
1743
- me.getAdapter = Ma.getAdapter;
1744
- me.HttpStatusCode = qr;
1745
- me.default = me;
1738
+ ge.spread = Lf;
1739
+ ge.isAxiosError = Ff;
1740
+ ge.mergeConfig = ft;
1741
+ ge.AxiosHeaders = Te;
1742
+ ge.formToJSON = (e) => Ta(S.isHTMLForm(e) ? new FormData(e) : e);
1743
+ ge.getAdapter = Ma.getAdapter;
1744
+ ge.HttpStatusCode = qr;
1745
+ ge.default = ge;
1746
1746
  const {
1747
1747
  Axios: oy,
1748
1748
  AxiosError: sy,
@@ -1760,7 +1760,7 @@ const {
1760
1760
  formToJSON: by,
1761
1761
  getAdapter: vy,
1762
1762
  mergeConfig: wy
1763
- } = me, Tr = {};
1763
+ } = ge, Tr = {};
1764
1764
  function Gt() {
1765
1765
  var e;
1766
1766
  try {
@@ -1782,7 +1782,7 @@ function Cs(e) {
1782
1782
  function $f(e) {
1783
1783
  return Xr.add(e), () => Xr.delete(e);
1784
1784
  }
1785
- const Ge = me.create({
1785
+ const Ge = ge.create({
1786
1786
  baseURL: Fa || "http://localhost:8000",
1787
1787
  // Fallback base URL
1788
1788
  timeout: 3e4,
@@ -1952,7 +1952,7 @@ function Hf(e = {}) {
1952
1952
  m.current && (m.current.abort(), m.current = null), i(!0), f(null), e.autoAppendAssistant !== !1 && p("");
1953
1953
  const I = new AbortController();
1954
1954
  return m.current = I, (async () => {
1955
- var M, D, j, K;
1955
+ var D, L, j, K;
1956
1956
  const N = (() => {
1957
1957
  var W;
1958
1958
  try {
@@ -1960,13 +1960,13 @@ function Hf(e = {}) {
1960
1960
  } catch {
1961
1961
  return !1;
1962
1962
  }
1963
- })(), L = (W) => {
1963
+ })(), F = (W) => {
1964
1964
  var B;
1965
1965
  try {
1966
1966
  const q = JSON.parse(JSON.stringify(W));
1967
- return (B = q == null ? void 0 : q.payload) != null && B.files_info && Array.isArray(q.payload.files_info) && (q.payload.files_info = q.payload.files_info.map((F) => ({
1968
- ...F,
1969
- data: F != null && F.data ? `<base64 ${String(F.data).length} chars>` : F == null ? void 0 : F.data
1967
+ return (B = q == null ? void 0 : q.payload) != null && B.files_info && Array.isArray(q.payload.files_info) && (q.payload.files_info = q.payload.files_info.map(($) => ({
1968
+ ...$,
1969
+ data: $ != null && $.data ? `<base64 ${String($.data).length} chars>` : $ == null ? void 0 : $.data
1970
1970
  }))), q;
1971
1971
  } catch {
1972
1972
  return W;
@@ -1978,19 +1978,19 @@ function Hf(e = {}) {
1978
1978
  if (r)
1979
1979
  W = { Authorization: `Bearer ${r}` };
1980
1980
  else if (typeof window < "u") {
1981
- const P = window.__AUTH_TOKEN__, _ = ((M = window.localStorage) == null ? void 0 : M.getItem("authToken")) || null;
1981
+ const P = window.__AUTH_TOKEN__, _ = ((D = window.localStorage) == null ? void 0 : D.getItem("authToken")) || null;
1982
1982
  let O = null;
1983
1983
  try {
1984
- const $ = (D = window.localStorage) == null ? void 0 : D.getItem("chat-settings");
1985
- $ && (O = ((j = JSON.parse($)) == null ? void 0 : j.apiKey) || null);
1984
+ const M = (L = window.localStorage) == null ? void 0 : L.getItem("chat-settings");
1985
+ M && (O = ((j = JSON.parse(M)) == null ? void 0 : j.apiKey) || null);
1986
1986
  } catch {
1987
1987
  }
1988
- const X = P || _ || O || null;
1989
- X && (W = { Authorization: `Bearer ${X}` });
1988
+ const Y = P || _ || O || null;
1989
+ Y && (W = { Authorization: `Bearer ${Y}` });
1990
1990
  }
1991
1991
  } catch {
1992
1992
  }
1993
- N && console.debug("[use-chat] POST", t + n, L(x));
1993
+ N && console.debug("[use-chat] POST", t + n, F(x));
1994
1994
  const B = await fetch(t + n, {
1995
1995
  method: "POST",
1996
1996
  headers: {
@@ -2006,33 +2006,33 @@ function Hf(e = {}) {
2006
2006
  const T = await B.text().catch(() => "");
2007
2007
  throw N && console.debug("[use-chat] non-OK response", B.status, T == null ? void 0 : T.slice(0, 500)), new Error(`stream ${B.status}${T ? ": " + T : ""}`);
2008
2008
  }
2009
- const q = B.body.getReader(), F = new TextDecoder();
2009
+ const q = B.body.getReader(), $ = new TextDecoder();
2010
2010
  let G = "";
2011
2011
  for (; ; ) {
2012
2012
  const { value: T, done: P } = await q.read();
2013
2013
  if (P) break;
2014
- G += F.decode(T, { stream: !0 });
2014
+ G += $.decode(T, { stream: !0 });
2015
2015
  let _;
2016
2016
  for (; (_ = G.indexOf(`
2017
2017
 
2018
2018
  `)) >= 0; ) {
2019
2019
  const O = G.slice(0, _);
2020
2020
  G = G.slice(_ + 2);
2021
- const X = Vf(O);
2022
- if (!X) continue;
2023
- let $;
2021
+ const Y = Vf(O);
2022
+ if (!Y) continue;
2023
+ let M;
2024
2024
  try {
2025
- $ = JSON.parse(X);
2025
+ M = JSON.parse(Y);
2026
2026
  } catch {
2027
- N && console.debug("[use-chat] skip malformed SSE data:", X == null ? void 0 : X.slice(0, 200));
2027
+ N && console.debug("[use-chat] skip malformed SSE data:", Y == null ? void 0 : Y.slice(0, 200));
2028
2028
  continue;
2029
2029
  }
2030
- const z = Wf($) ? $.data : $;
2030
+ const z = Wf(M) ? M.data : M;
2031
2031
  if (N && console.debug("[use-chat] event:", z == null ? void 0 : z.type, z), E == null || E(z), z.type === "token")
2032
2032
  e.autoAppendAssistant !== !1 && p((le) => le + z.content);
2033
2033
  else if (z.type === "message_delta") {
2034
- const le = z.delta.filter((ae) => ae.type === "text").map((ae) => ae.text).join("");
2035
- le && e.autoAppendAssistant !== !1 && p((ae) => ae + le);
2034
+ const le = z.delta.filter((se) => se.type === "text").map((se) => se.text).join("");
2035
+ le && e.autoAppendAssistant !== !1 && p((se) => se + le);
2036
2036
  } else z.type === "checkpoint" ? v(z.checkpointId) : z.type === "error" && f(z.message);
2037
2037
  }
2038
2038
  }
@@ -2274,21 +2274,21 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2274
2274
  }, [N]), we(() => {
2275
2275
  r == null || r(C);
2276
2276
  }, [C, r]);
2277
- const L = rt(null);
2277
+ const F = rt(null);
2278
2278
  we(() => {
2279
- o && L.current !== o && (L.current = o, D(o).catch(() => {
2279
+ o && F.current !== o && (F.current = o, L(o).catch(() => {
2280
2280
  }));
2281
2281
  }, [o]);
2282
- const M = rt(null), D = Ce(
2283
- async (_, O, X) => {
2284
- var $;
2285
- if (M.current !== _) {
2286
- M.current = _;
2282
+ const D = rt(null), L = Ce(
2283
+ async (_, O, Y) => {
2284
+ var M;
2285
+ if (D.current !== _) {
2286
+ D.current = _;
2287
2287
  try {
2288
- const z = O ?? (($ = (await s.listCheckpoints(_)).checkpoints.slice().sort((ae, V) => new Date(V.createdAt).getTime() - new Date(ae.createdAt).getTime())[0]) == null ? void 0 : $.checkpointId), le = await s.getMessages({ threadId: _, checkpointId: z, checkpointNs: X });
2288
+ const z = O ?? ((M = (await s.listCheckpoints(_)).checkpoints.slice().sort((se, V) => new Date(V.createdAt).getTime() - new Date(se.createdAt).getTime())[0]) == null ? void 0 : M.checkpointId), le = await s.getMessages({ threadId: _, checkpointId: z, checkpointNs: Y });
2289
2289
  I(_), h(le.messages);
2290
2290
  } finally {
2291
- M.current = null;
2291
+ D.current = null;
2292
2292
  }
2293
2293
  }
2294
2294
  },
@@ -2299,16 +2299,16 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2299
2299
  h(O.messages);
2300
2300
  }, [s, C, h]), W = Ce(async () => {
2301
2301
  if (!C) throw new Error("No active thread");
2302
- await D(C);
2303
- }, [C, D]), B = rt(!1);
2302
+ await L(C);
2303
+ }, [C, L]), B = rt(!1);
2304
2304
  we(() => {
2305
2305
  const _ = B.current;
2306
2306
  if (B.current = a, _ && !a && C) {
2307
2307
  const O = m.lastCheckpointId ?? void 0;
2308
2308
  (async () => {
2309
2309
  try {
2310
- const X = await s.getMessages({ threadId: C, checkpointId: O });
2311
- h(X.messages);
2310
+ const Y = await s.getMessages({ threadId: C, checkpointId: O });
2311
+ h(Y.messages);
2312
2312
  } catch {
2313
2313
  }
2314
2314
  try {
@@ -2320,40 +2320,40 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2320
2320
  }, [a, C, m.lastCheckpointId, s, h, N]);
2321
2321
  const q = Ce(async (_) => {
2322
2322
  const O = await s.createThread(_);
2323
- return await N(), await D(O.threadId), O.threadId;
2324
- }, [s, N, D]), F = Ce(async (_) => {
2323
+ return await N(), await L(O.threadId), O.threadId;
2324
+ }, [s, N, L]), $ = Ce(async (_) => {
2325
2325
  await s.deleteThread(_), await N(), C === _ && (I(null), y([]));
2326
2326
  }, [s, N, C, y]), G = Ce(async (_, O) => {
2327
2327
  await s.updateThread(_, O), await N();
2328
2328
  }, [s, N]), T = Ce(async (_, O) => {
2329
- var se;
2329
+ var oe;
2330
2330
  if (!C) throw new Error("No active thread");
2331
- async function X(H) {
2331
+ async function Y(H) {
2332
2332
  return await new Promise((Z, de) => {
2333
- const pe = new FileReader();
2334
- pe.onload = () => Z(String(pe.result)), pe.onerror = (Y) => de(Y), pe.readAsDataURL(H);
2333
+ const he = new FileReader();
2334
+ he.onload = () => Z(String(he.result)), he.onerror = (me) => de(me), he.readAsDataURL(H);
2335
2335
  });
2336
2336
  }
2337
- async function $(H) {
2337
+ async function M(H) {
2338
2338
  return await new Promise((Z, de) => {
2339
- const pe = new FileReader();
2340
- pe.onload = () => {
2339
+ const he = new FileReader();
2340
+ he.onload = () => {
2341
2341
  try {
2342
- const Y = pe.result;
2343
- let ge = "";
2344
- const te = new Uint8Array(Y), he = te.byteLength;
2345
- for (let ve = 0; ve < he; ve++) ge += String.fromCharCode(te[ve]);
2346
- Z(btoa(ge));
2347
- } catch (Y) {
2348
- de(Y);
2342
+ const me = he.result;
2343
+ let Q = "";
2344
+ const ve = new Uint8Array(me), ae = ve.byteLength;
2345
+ for (let fe = 0; fe < ae; fe++) Q += String.fromCharCode(ve[fe]);
2346
+ Z(btoa(Q));
2347
+ } catch (me) {
2348
+ de(me);
2349
2349
  }
2350
- }, pe.onerror = (Y) => de(Y), pe.readAsArrayBuffer(H);
2350
+ }, he.onerror = (me) => de(me), he.readAsArrayBuffer(H);
2351
2351
  });
2352
2352
  }
2353
2353
  const z = [];
2354
2354
  _ && z.push({ type: "text", text: _ });
2355
2355
  const le = (O == null ? void 0 : O.attachments) || [];
2356
- let ae = [];
2356
+ let se = [];
2357
2357
  if (le.length > 0)
2358
2358
  for (const H of le)
2359
2359
  if (H.type && H.type.startsWith("image/")) {
@@ -2365,7 +2365,7 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2365
2365
  }
2366
2366
  if (!Z)
2367
2367
  try {
2368
- Z = await X(H);
2368
+ Z = await Y(H);
2369
2369
  } catch {
2370
2370
  Z = null;
2371
2371
  }
@@ -2374,34 +2374,34 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2374
2374
  z.push(de);
2375
2375
  }
2376
2376
  try {
2377
- ae.push({ filename: H.name, data: await $(H), mime_type: H.type || "application/octet-stream" });
2377
+ se.push({ filename: H.name, data: await M(H), mime_type: H.type || "application/octet-stream" });
2378
2378
  } catch {
2379
2379
  }
2380
2380
  } else {
2381
- const Z = await X(H).catch(() => null), de = { type: "file", url: String(Z), mimeType: H.type || void 0, name: H.name, size: H.size };
2381
+ const Z = await Y(H).catch(() => null), de = { type: "file", url: String(Z), mimeType: H.type || void 0, name: H.name, size: H.size };
2382
2382
  z.push(de);
2383
2383
  try {
2384
- ae.push({ filename: H.name, data: await $(H), mime_type: H.type || "application/octet-stream" });
2384
+ se.push({ filename: H.name, data: await M(H), mime_type: H.type || "application/octet-stream" });
2385
2385
  } catch {
2386
2386
  }
2387
2387
  }
2388
2388
  const V = {
2389
- id: ((se = crypto.randomUUID) == null ? void 0 : se.call(crypto)) || `user-${Date.now()}`,
2389
+ id: ((oe = crypto.randomUUID) == null ? void 0 : oe.call(crypto)) || `user-${Date.now()}`,
2390
2390
  role: "user",
2391
2391
  content: z,
2392
2392
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2393
2393
  checkpointId: (O == null ? void 0 : O.checkpointId) ?? m.lastCheckpointId ?? void 0
2394
2394
  };
2395
2395
  b(V);
2396
- const oe = {
2396
+ const re = {
2397
2397
  ...V,
2398
2398
  content: V.content.filter((H) => H.type === "text" || H.type === "image_url")
2399
2399
  }, ie = {
2400
2400
  threadId: C,
2401
2401
  payload: {
2402
- messages: [oe],
2402
+ messages: [re],
2403
2403
  attachments: V.content.filter((H) => H.type === "file").map((H) => ({ type: "file", url: H.url, mimeType: H.mimeType, name: H.name, size: H.size })),
2404
- files_info: ae,
2404
+ files_info: se,
2405
2405
  ...(O == null ? void 0 : O.payloadExtras) ?? {}
2406
2406
  },
2407
2407
  checkpointId: (O == null ? void 0 : O.checkpointId) ?? m.lastCheckpointId ?? void 0,
@@ -2425,9 +2425,9 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2425
2425
  streamingAssistantId: m.assemblingId,
2426
2426
  refreshThreads: N,
2427
2427
  createThread: q,
2428
- deleteThread: F,
2428
+ deleteThread: $,
2429
2429
  renameThread: G,
2430
- loadThread: D,
2430
+ loadThread: L,
2431
2431
  listCheckpoints: j,
2432
2432
  navigateToCheckpoint: K,
2433
2433
  returnToLatest: W,
@@ -2468,7 +2468,7 @@ const Zf = rn(
2468
2468
  size: "default"
2469
2469
  }
2470
2470
  }
2471
- ), fe = l.forwardRef(
2471
+ ), pe = l.forwardRef(
2472
2472
  ({ className: e, variant: t, size: n, asChild: r = !1, ...o }, s) => /* @__PURE__ */ c(
2473
2473
  r ? Dt : "button",
2474
2474
  {
@@ -2478,7 +2478,7 @@ const Zf = rn(
2478
2478
  }
2479
2479
  )
2480
2480
  );
2481
- fe.displayName = "Button";
2481
+ pe.displayName = "Button";
2482
2482
  const za = l.forwardRef(
2483
2483
  ({ className: e, ...t }, n) => /* @__PURE__ */ c(
2484
2484
  "textarea",
@@ -2653,7 +2653,7 @@ function wo(...e) {
2653
2653
  };
2654
2654
  };
2655
2655
  }
2656
- function ne(...e) {
2656
+ function te(...e) {
2657
2657
  return l.useCallback(wo(...e), e);
2658
2658
  }
2659
2659
  var sp = [
@@ -2688,7 +2688,7 @@ function ap(e, t) {
2688
2688
  return l.useReducer((n, r) => t[n][r] ?? n, e);
2689
2689
  }
2690
2690
  var Ae = (e) => {
2691
- const { present: t, children: n } = e, r = ip(t), o = typeof n == "function" ? n({ present: r.isPresent }) : l.Children.only(n), s = ne(r.ref, cp(o));
2691
+ const { present: t, children: n } = e, r = ip(t), o = typeof n == "function" ? n({ present: r.isPresent }) : l.Children.only(n), s = te(r.ref, cp(o));
2692
2692
  return typeof n == "function" || r.isPresent ? l.cloneElement(o, { ref: s }) : null;
2693
2693
  };
2694
2694
  Ae.displayName = "Presence";
@@ -2822,7 +2822,7 @@ var xo = "CollapsibleContent", pp = l.forwardRef(
2822
2822
  );
2823
2823
  pp.displayName = xo;
2824
2824
  var hp = l.forwardRef((e, t) => {
2825
- const { __scopeCollapsible: n, present: r, children: o, ...s } = e, a = yo(xo, n), [i, u] = l.useState(r), f = l.useRef(null), d = ne(t, f), p = l.useRef(0), g = p.current, v = l.useRef(0), m = v.current, h = a.open || i, b = l.useRef(h), w = l.useRef(void 0);
2825
+ const { __scopeCollapsible: n, present: r, children: o, ...s } = e, a = yo(xo, n), [i, u] = l.useState(r), f = l.useRef(null), d = te(t, f), p = l.useRef(0), g = p.current, v = l.useRef(0), m = v.current, h = a.open || i, b = l.useRef(h), w = l.useRef(void 0);
2826
2826
  return l.useEffect(() => {
2827
2827
  const y = requestAnimationFrame(() => b.current = !1);
2828
2828
  return () => cancelAnimationFrame(y);
@@ -2887,53 +2887,66 @@ function gp({
2887
2887
  onEdit: C,
2888
2888
  onRegenerate: I,
2889
2889
  onEditFromCheckpoint: N,
2890
- onCancelEdit: L,
2891
- onCopy: M
2890
+ onCancelEdit: F,
2891
+ onCopy: D
2892
2892
  }) {
2893
- const [D, j] = ce(!1), [K, W] = ce(!1), [B, q] = ce(!1), [F, G] = ce(!1), T = u === "phone" || u === "half-screen", P = e.role, _ = P === "tool", O = nt(() => bp(e.content), [e.content]), X = nt(() => Cp(e.content), [e.content]), $ = nt(() => e.content.filter((Y) => Y.type === "image_url"), [e.content]), z = nt(() => e.content.filter((Y) => Y.type === "file"), [e.content]), le = Np(O, n ? r : 0), ae = async () => {
2893
+ const [L, j] = ce(!1), [K, W] = ce(!1), [B, q] = ce(!1), [$, G] = ce(!1), T = u === "phone" || u === "half-screen", P = e.role, _ = P === "tool", O = Je.useMemo(() => {
2894
+ switch (P) {
2895
+ case "user":
2896
+ return "text-[hsl(var(--chat-bubble-user-text))]";
2897
+ case "assistant":
2898
+ return "text-[hsl(var(--chat-bubble-ai-text))]";
2899
+ case "tool":
2900
+ return "text-secondary-foreground";
2901
+ case "system":
2902
+ return "text-muted-foreground";
2903
+ default:
2904
+ return "text-foreground";
2905
+ }
2906
+ }, [P]), Y = nt(() => bp(e.content), [e.content]), M = nt(() => Cp(e.content), [e.content]), z = nt(() => e.content.filter((Q) => Q.type === "image_url"), [e.content]), le = nt(() => e.content.filter((Q) => Q.type === "file"), [e.content]), se = Np(Y, n ? r : 0), V = async () => {
2894
2907
  try {
2895
- const Y = _ ? St(e.content) : O;
2896
- await navigator.clipboard.writeText(Y), j(!0), setTimeout(() => j(!1), 2e3), M == null || M(Y);
2897
- } catch (Y) {
2898
- console.error("Failed to copy:", Y);
2908
+ const Q = _ ? St(e.content) : Y;
2909
+ await navigator.clipboard.writeText(Q), j(!0), setTimeout(() => j(!1), 2e3), D == null || D(Q);
2910
+ } catch (Q) {
2911
+ console.error("Failed to copy:", Q);
2899
2912
  }
2900
- }, V = () => {
2913
+ }, re = () => {
2901
2914
  if (!C) return;
2902
- const Y = _ ? St(e.content) : O;
2903
- C(e.id, Y);
2904
- }, oe = () => I == null ? void 0 : I(t), ie = () => {
2905
- const ge = A(T ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0 text-current dark:text-primary-foreground");
2915
+ const Q = _ ? St(e.content) : Y;
2916
+ C(e.id, Q);
2917
+ }, ie = () => I == null ? void 0 : I(t), oe = () => {
2918
+ const ve = A(T ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", O);
2906
2919
  switch (P) {
2907
2920
  case "user":
2908
- return /* @__PURE__ */ c(Bu, { className: ge });
2921
+ return /* @__PURE__ */ c(Bu, { className: ve });
2909
2922
  case "assistant":
2910
- return /* @__PURE__ */ c(os, { className: ge });
2923
+ return /* @__PURE__ */ c(os, { className: ve });
2911
2924
  case "tool":
2912
- return /* @__PURE__ */ c($u, { className: ge });
2925
+ return /* @__PURE__ */ c($u, { className: ve });
2913
2926
  default:
2914
- return /* @__PURE__ */ c(os, { className: ge });
2927
+ return /* @__PURE__ */ c(os, { className: ve });
2915
2928
  }
2916
- }, se = () => {
2917
- const Y = "group relative mb-4 max-w-full";
2929
+ }, H = () => {
2930
+ const Q = "group relative mb-4 max-w-full";
2918
2931
  switch (P) {
2919
2932
  case "user":
2920
- return A(Y, "flex justify-end");
2933
+ return A(Q, "flex justify-end");
2921
2934
  case "assistant":
2922
2935
  case "tool":
2923
2936
  case "system":
2924
- return A(Y, "flex justify-start");
2937
+ return A(Q, "flex justify-start");
2925
2938
  default:
2926
- return Y;
2939
+ return Q;
2927
2940
  }
2928
- }, H = () => {
2929
- const Y = A(
2941
+ }, Z = () => {
2942
+ const Q = A(
2930
2943
  "rounded-lg px-4 py-3 relative transition-all duration-200 min-w-0 break-words",
2931
2944
  T && "px-3 py-2 text-sm"
2932
2945
  );
2933
2946
  switch (P) {
2934
2947
  case "user":
2935
2948
  return A(
2936
- Y,
2949
+ Q,
2937
2950
  "max-w-[95%]",
2938
2951
  u === "phone" && "max-w-[98%]",
2939
2952
  "bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
@@ -2941,165 +2954,180 @@ function gp({
2941
2954
  );
2942
2955
  case "assistant":
2943
2956
  return A(
2944
- Y,
2957
+ Q,
2945
2958
  "max-w-[95%]",
2946
2959
  u === "phone" && "max-w-[98%]",
2947
2960
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
2948
2961
  "border border-border/60 dark:border-border/40"
2949
2962
  );
2950
2963
  case "tool":
2951
- return A(Y, "bg-secondary/50 text-secondary-foreground border border-dashed max-w-[95%]", u === "phone" && "max-w-[98%]");
2964
+ return A(Q, "bg-secondary/50 text-secondary-foreground border border-dashed max-w-[95%]", u === "phone" && "max-w-[98%]");
2952
2965
  case "system":
2953
- return A(Y, "bg-accent/40 text-muted-foreground max-w-[85%] border");
2966
+ return A(Q, "bg-accent/40 text-muted-foreground max-w-[85%] border");
2954
2967
  default:
2955
- return Y;
2968
+ return Q;
2956
2969
  }
2957
- }, Z = (Y) => {
2958
- if (!Y) return "";
2970
+ }, de = (Q) => {
2971
+ if (!Q) return "";
2959
2972
  try {
2960
- return new Date(Y).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2973
+ return new Date(Q).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2961
2974
  } catch {
2962
2975
  return "";
2963
2976
  }
2964
- }, de = () => {
2977
+ }, he = () => {
2965
2978
  if (e.model === "reflection") {
2966
- const te = O.trim(), he = Pr(te);
2967
- if (he && typeof he == "object")
2968
- return /* @__PURE__ */ c(Tp, { data: he });
2979
+ const ae = Y.trim(), fe = Pr(ae);
2980
+ if (fe && typeof fe == "object")
2981
+ return /* @__PURE__ */ c(Tp, { data: fe });
2969
2982
  }
2970
- if (_ && X.name === "get_issues") {
2971
- const te = e.content.find((k) => k.type === "tool_result"), he = (te == null ? void 0 : te.output) ?? St(e.content), ve = Ga(he);
2972
- if (ve) return /* @__PURE__ */ c(Ap, { issues: ve });
2983
+ if (_ && M.name === "get_issues") {
2984
+ const ae = e.content.find((X) => X.type === "tool_result"), fe = (ae == null ? void 0 : ae.output) ?? St(e.content), k = Ga(fe);
2985
+ if (k) return /* @__PURE__ */ c(Ap, { issues: k });
2973
2986
  }
2974
2987
  if (_ && !B) {
2975
- const te = St(e.content).slice(0, 80).replace(/\s+/g, " ");
2988
+ const ae = St(e.content).slice(0, 80).replace(/\s+/g, " ");
2976
2989
  return /* @__PURE__ */ c("div", { className: A("text-xs font-mono opacity-70 flex items-center justify-between gap-2 text-current", T && "text-[10px]"), children: /* @__PURE__ */ R("span", { className: "truncate max-w-full text-current", children: [
2977
- te,
2978
- te.length >= 80 ? "…" : ""
2990
+ ae,
2991
+ ae.length >= 80 ? "…" : ""
2979
2992
  ] }) });
2980
2993
  }
2981
2994
  if (_ && f) {
2982
- const te = St(e.content), he = te.length > d;
2995
+ const ae = St(e.content), fe = ae.length > d;
2983
2996
  return /* @__PURE__ */ c(As, { open: K, onOpenChange: W, children: /* @__PURE__ */ R("div", { className: "font-mono text-sm text-current", children: [
2984
- /* @__PURE__ */ c("pre", { className: A("whitespace-pre-wrap break-words text-current", T && "text-xs"), children: he && !K ? te.substring(0, d) + "..." : te }),
2985
- he && /* @__PURE__ */ c(Ps, { asChild: !0, children: /* @__PURE__ */ c(fe, { variant: "ghost", size: "sm", className: "h-6 text-xs text-current", children: K ? /* @__PURE__ */ R(De, { children: [
2997
+ /* @__PURE__ */ c("pre", { className: A("whitespace-pre-wrap break-words text-current", T && "text-xs"), children: fe && !K ? ae.substring(0, d) + "..." : ae }),
2998
+ fe && /* @__PURE__ */ c(Ps, { asChild: !0, children: /* @__PURE__ */ c(pe, { variant: "ghost", size: "sm", className: "h-6 text-xs text-current", children: K ? /* @__PURE__ */ R(De, { children: [
2986
2999
  /* @__PURE__ */ c(Wt, { className: "h-3 w-3 mr-1" }),
2987
3000
  "Show less"
2988
3001
  ] }) : /* @__PURE__ */ R(De, { children: [
2989
3002
  /* @__PURE__ */ c(Tt, { className: "h-3 w-3 mr-1" }),
2990
3003
  "Show more (",
2991
- te.length - d,
3004
+ ae.length - d,
2992
3005
  " chars)"
2993
3006
  ] }) }) })
2994
3007
  ] }) });
2995
3008
  }
2996
3009
  if (_ && B && !f) {
2997
- const te = Sp(e.content);
2998
- if (te && vp(te))
2999
- return /* @__PURE__ */ c(gn, { content: te.trim() });
3000
- const he = St(e.content);
3001
- return /* @__PURE__ */ c("div", { className: "font-mono text-sm text-current", children: /* @__PURE__ */ c("pre", { className: A("whitespace-pre-wrap break-words text-current", T && "text-xs"), children: he }) });
3010
+ const ae = Sp(e.content);
3011
+ if (ae && vp(ae))
3012
+ return /* @__PURE__ */ c(gn, { content: ae.trim() });
3013
+ const fe = St(e.content);
3014
+ return /* @__PURE__ */ c("div", { className: "font-mono text-sm text-current", children: /* @__PURE__ */ c("pre", { className: A("whitespace-pre-wrap break-words text-current", T && "text-xs"), children: fe }) });
3002
3015
  }
3003
- const Y = $.length > 0 && P !== "tool", ge = z.length > 0 && P !== "tool";
3016
+ const Q = z.length > 0 && P !== "tool", ve = le.length > 0 && P !== "tool";
3004
3017
  return /* @__PURE__ */ R("div", { children: [
3005
3018
  n ? /* @__PURE__ */ R("div", { className: "relative", children: [
3006
3019
  (() => {
3007
- const te = Pr(le);
3008
- return te !== null ? /* @__PURE__ */ c(_s, { data: te }) : /* @__PURE__ */ c(gn, { content: yp(wp(le)) });
3020
+ const ae = Pr(se);
3021
+ return ae !== null ? /* @__PURE__ */ c(_s, { data: ae }) : /* @__PURE__ */ c(gn, { content: yp(wp(se)) });
3009
3022
  })(),
3010
3023
  /* @__PURE__ */ c("span", { className: "inline-block w-[6px] h-[14px] align-baseline ml-0.5 bg-foreground/40 animate-pulse", style: { verticalAlign: "text-bottom" } })
3011
3024
  ] }) : (() => {
3012
- const te = Pr(O.trim());
3013
- if (te !== null) return /* @__PURE__ */ c(_s, { data: te });
3025
+ const ae = Pr(Y.trim());
3026
+ if (ae !== null) return /* @__PURE__ */ c(_s, { data: ae });
3014
3027
  if (P === "user" && p) {
3015
- const he = O.trim();
3016
- if (he.length > g)
3017
- return /* @__PURE__ */ R(As, { open: F, onOpenChange: G, children: [
3018
- /* @__PURE__ */ c("div", { className: A("text-sm text-[hsl(var(--chat-bubble-user-text))]", T && "text-xs"), children: F ? /* @__PURE__ */ c(gn, { content: he }) : /* @__PURE__ */ R("pre", { className: A("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]", T && "text-xs"), children: [
3019
- he.substring(0, g),
3028
+ const fe = Y.trim();
3029
+ if (fe.length > g)
3030
+ return /* @__PURE__ */ R(As, { open: $, onOpenChange: G, children: [
3031
+ /* @__PURE__ */ c("div", { className: A("text-sm text-[hsl(var(--chat-bubble-user-text))]", T && "text-xs"), children: $ ? /* @__PURE__ */ c(gn, { content: fe }) : /* @__PURE__ */ R("pre", { className: A("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]", T && "text-xs"), children: [
3032
+ fe.substring(0, g),
3020
3033
  "..."
3021
3034
  ] }) }),
3022
3035
  /* @__PURE__ */ c(Ps, { asChild: !0, children: /* @__PURE__ */ c(
3023
- fe,
3036
+ pe,
3024
3037
  {
3025
3038
  variant: "ghost",
3026
3039
  size: "sm",
3027
3040
  className: "h-6 text-xs !text-[hsl(var(--chat-bubble-user-text))]",
3028
- children: F ? /* @__PURE__ */ R(De, { children: [
3041
+ children: $ ? /* @__PURE__ */ R(De, { children: [
3029
3042
  /* @__PURE__ */ c(Wt, { className: "h-3 w-3 mr-1" }),
3030
3043
  " Show less"
3031
3044
  ] }) : /* @__PURE__ */ R(De, { children: [
3032
3045
  /* @__PURE__ */ c(Tt, { className: "h-3 w-3 mr-1" }),
3033
3046
  " Show more (",
3034
- he.length - g,
3047
+ fe.length - g,
3035
3048
  " chars)"
3036
3049
  ] })
3037
3050
  }
3038
3051
  ) })
3039
3052
  ] });
3040
3053
  }
3041
- return /* @__PURE__ */ c(gn, { content: O.trim() });
3054
+ return /* @__PURE__ */ c(gn, { content: Y.trim() });
3042
3055
  })(),
3043
- Y && /* @__PURE__ */ c("div", { className: "mt-2 grid grid-cols-2 gap-2", children: $.map((te, he) => /* @__PURE__ */ R("div", { className: "relative border rounded overflow-hidden", children: [
3044
- /* @__PURE__ */ c("img", { src: te.url, alt: te.alt ?? "image", className: "w-full h-auto" }),
3056
+ Q && /* @__PURE__ */ c("div", { className: "mt-2 grid grid-cols-2 gap-2", children: z.map((ae, fe) => /* @__PURE__ */ R("div", { className: "relative border rounded overflow-hidden", children: [
3057
+ /* @__PURE__ */ c("img", { src: ae.url, alt: ae.alt ?? "image", className: "w-full h-auto" }),
3045
3058
  /* @__PURE__ */ R("div", { className: "absolute top-1 right-1 bg-background/70 rounded px-1 py-0.5 text-[10px] flex items-center gap-1", children: [
3046
3059
  /* @__PURE__ */ c(Uu, { className: "h-3 w-3" }),
3047
3060
  /* @__PURE__ */ c("span", { children: "image" })
3048
3061
  ] })
3049
- ] }, he)) }),
3050
- ge && /* @__PURE__ */ c("div", { className: "mt-2 flex flex-wrap gap-2", children: z.map((te, he) => {
3051
- const ve = te, k = ve.name || "file";
3062
+ ] }, fe)) }),
3063
+ ve && /* @__PURE__ */ c("div", { className: "mt-2 flex flex-wrap gap-2", children: le.map((ae, fe) => {
3064
+ const k = ae, X = k.name || "file";
3052
3065
  return /* @__PURE__ */ R(
3053
3066
  "a",
3054
3067
  {
3055
- href: ve.url,
3056
- download: k,
3068
+ href: k.url,
3069
+ download: X,
3057
3070
  target: "_blank",
3058
3071
  rel: "noreferrer",
3059
3072
  className: "inline-flex items-center gap-2 bg-gray-100 border border-gray-200 rounded px-2 py-1 text-xs hover:bg-gray-200",
3060
- title: k,
3073
+ title: X,
3061
3074
  children: [
3062
3075
  /* @__PURE__ */ c("span", { className: "inline-block w-1.5 h-1.5 rounded-full bg-gray-400" }),
3063
- /* @__PURE__ */ c("span", { className: "truncate max-w-[180px]", children: k })
3076
+ /* @__PURE__ */ c("span", { className: "truncate max-w-[180px]", children: X })
3064
3077
  ]
3065
3078
  },
3066
- he
3079
+ fe
3067
3080
  );
3068
3081
  }) })
3069
3082
  ] });
3070
- }, pe = nt(() => Ep(e), [e]);
3071
- return nt(() => Rp(e, h), [e, h]), /* @__PURE__ */ c("div", { className: A(se(), v.container), children: /* @__PURE__ */ R("div", { className: A(H(), v.content), children: [
3083
+ }, me = nt(() => Ep(e), [e]);
3084
+ return nt(() => Rp(e, h), [e, h]), /* @__PURE__ */ c("div", { className: A(H(), v.container), children: /* @__PURE__ */ R("div", { className: A(Z(), v.content), children: [
3072
3085
  (a || i || _) && /* @__PURE__ */ R(
3073
3086
  "div",
3074
3087
  {
3075
3088
  className: A(
3076
3089
  "flex items-center justify-between mb-2 pb-2 border-b border-current/10",
3077
3090
  T && "mb-1 pb-1",
3091
+ O,
3078
3092
  v.header
3079
3093
  ),
3080
3094
  children: [
3081
3095
  /* @__PURE__ */ R("div", { className: "flex items-center gap-2", children: [
3082
- ie(),
3083
- i && pe && /* @__PURE__ */ c("span", { className: A("font-medium", T ? "text-xs" : "text-sm"), children: pe }),
3084
- _ && X.name && /* @__PURE__ */ R(
3096
+ oe(),
3097
+ i && me && /* @__PURE__ */ c("span", { className: A("font-medium", T ? "text-xs" : "text-sm"), children: me }),
3098
+ _ && M.name && /* @__PURE__ */ R(
3085
3099
  Ha,
3086
3100
  {
3087
3101
  variant: "outline",
3088
- className: A("text-xs flex items-center gap-1 cursor-pointer text-current", T && "text-xs h-4"),
3089
- onClick: () => q((Y) => !Y),
3102
+ className: A(
3103
+ "text-xs flex items-center gap-1 cursor-pointer",
3104
+ O,
3105
+ "border border-current/40",
3106
+ T && "text-xs h-4"
3107
+ ),
3108
+ onClick: () => q((Q) => !Q),
3090
3109
  children: [
3091
- /* @__PURE__ */ c("span", { children: X.name }),
3110
+ /* @__PURE__ */ c("span", { children: M.name }),
3092
3111
  /* @__PURE__ */ c("span", { className: "inline-flex items-center", children: B ? /* @__PURE__ */ c(Wt, { className: "h-3 w-3" }) : /* @__PURE__ */ c(Tt, { className: "h-3 w-3" }) })
3093
3112
  ]
3094
3113
  }
3095
3114
  ),
3096
- _ && !X.name && /* @__PURE__ */ c(fe, { variant: "ghost", size: "sm", className: "h-6 px-1 text-current", onClick: () => q((Y) => !Y), children: /* @__PURE__ */ R("span", { className: "text-xs flex items-center gap-1", children: [
3097
- "Tool Output ",
3098
- B ? /* @__PURE__ */ c(Wt, { className: "h-3 w-3" }) : /* @__PURE__ */ c(Tt, { className: "h-3 w-3" })
3099
- ] }) })
3115
+ _ && !M.name && /* @__PURE__ */ c(
3116
+ pe,
3117
+ {
3118
+ variant: "ghost",
3119
+ size: "sm",
3120
+ className: A("h-6 px-1", O, "hover:bg-foreground/10"),
3121
+ onClick: () => q((Q) => !Q),
3122
+ children: /* @__PURE__ */ R("span", { className: "text-xs flex items-center gap-1", children: [
3123
+ "Tool Output ",
3124
+ B ? /* @__PURE__ */ c(Wt, { className: "h-3 w-3" }) : /* @__PURE__ */ c(Tt, { className: "h-3 w-3" })
3125
+ ] })
3126
+ }
3127
+ )
3100
3128
  ] }),
3101
3129
  /* @__PURE__ */ R("div", { className: "flex items-center gap-2", children: [
3102
- a && /* @__PURE__ */ c("span", { className: A("text-xs opacity-60", T && "text-xs"), children: Z(e.createdAt) }),
3130
+ a && /* @__PURE__ */ c("span", { className: A("text-xs opacity-60", O, T && "text-xs"), children: de(e.createdAt) }),
3103
3131
  s && !o && /* @__PURE__ */ R(
3104
3132
  "div",
3105
3133
  {
@@ -3110,33 +3138,41 @@ function gp({
3110
3138
  ),
3111
3139
  children: [
3112
3140
  /* @__PURE__ */ c(
3113
- fe,
3141
+ pe,
3114
3142
  {
3115
3143
  variant: "ghost",
3116
3144
  size: "sm",
3117
- onClick: ae,
3118
- className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3119
- children: /* @__PURE__ */ c(ns, { className: A(D ? "text-success" : "text-current", T ? "h-3 w-3" : "h-4 w-4") })
3145
+ onClick: V,
3146
+ className: A("h-6 w-6 p-0 hover:bg-foreground/10", O, T && "h-5 w-5"),
3147
+ children: /* @__PURE__ */ c(
3148
+ ns,
3149
+ {
3150
+ className: A(
3151
+ L ? "text-success" : O,
3152
+ T ? "h-3 w-3" : "h-4 w-4"
3153
+ )
3154
+ }
3155
+ )
3120
3156
  }
3121
3157
  ),
3122
3158
  P === "user" && C && /* @__PURE__ */ c(
3123
- fe,
3159
+ pe,
3124
3160
  {
3125
3161
  variant: "ghost",
3126
3162
  size: "sm",
3127
- onClick: V,
3128
- className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3129
- children: /* @__PURE__ */ c(rs, { className: A("text-current", T ? "h-3 w-3" : "h-4 w-4") })
3163
+ onClick: re,
3164
+ className: A("h-6 w-6 p-0 hover:bg-foreground/10", O, T && "h-5 w-5"),
3165
+ children: /* @__PURE__ */ c(rs, { className: A(O, T ? "h-3 w-3" : "h-4 w-4") })
3130
3166
  }
3131
3167
  ),
3132
3168
  P === "assistant" && I && /* @__PURE__ */ c(
3133
- fe,
3169
+ pe,
3134
3170
  {
3135
3171
  variant: "ghost",
3136
3172
  size: "sm",
3137
- onClick: oe,
3138
- className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3139
- children: /* @__PURE__ */ c(Wr, { className: A("text-current", T ? "h-3 w-3" : "h-4 w-4") })
3173
+ onClick: ie,
3174
+ className: A("h-6 w-6 p-0 hover:bg-foreground/10", O, T && "h-5 w-5"),
3175
+ children: /* @__PURE__ */ c(Wr, { className: A(O, T ? "h-3 w-3" : "h-4 w-4") })
3140
3176
  }
3141
3177
  )
3142
3178
  ]
@@ -3146,15 +3182,15 @@ function gp({
3146
3182
  ]
3147
3183
  }
3148
3184
  ),
3149
- /* @__PURE__ */ c("div", { className: "relative", children: de() }),
3150
- _ && B && (X.toolCallId || X.name) && /* @__PURE__ */ R("div", { className: A("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", T && "text-xs"), children: [
3151
- X.name && /* @__PURE__ */ R("div", { children: [
3185
+ /* @__PURE__ */ c("div", { className: "relative", children: he() }),
3186
+ _ && B && (M.toolCallId || M.name) && /* @__PURE__ */ R("div", { className: A("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", T && "text-xs"), children: [
3187
+ M.name && /* @__PURE__ */ R("div", { children: [
3152
3188
  "Function: ",
3153
- X.name
3189
+ M.name
3154
3190
  ] }),
3155
- X.toolCallId && /* @__PURE__ */ R("div", { children: [
3191
+ M.toolCallId && /* @__PURE__ */ R("div", { children: [
3156
3192
  "Call ID: ",
3157
- X.toolCallId
3193
+ M.toolCallId
3158
3194
  ] })
3159
3195
  ] }),
3160
3196
  s && P === "user" && y && y.totalBranches > 1 && /* @__PURE__ */ R("div", { className: "flex items-center gap-2 mt-2 p-2 bg-muted/30 rounded border", children: [
@@ -3167,27 +3203,27 @@ function gp({
3167
3203
  ] }),
3168
3204
  /* @__PURE__ */ R("div", { className: "flex items-center gap-1", children: [
3169
3205
  /* @__PURE__ */ c(
3170
- fe,
3206
+ pe,
3171
3207
  {
3172
3208
  variant: "ghost",
3173
3209
  size: "sm",
3174
- className: "h-6 w-6 p-0 text-current",
3210
+ className: A("h-6 w-6 p-0", O),
3175
3211
  disabled: !y.canGoBack,
3176
3212
  onClick: () => x == null ? void 0 : x(),
3177
3213
  title: "Go back to previous branch",
3178
- children: /* @__PURE__ */ c(Fu, { className: "h-3 w-3 text-current" })
3214
+ children: /* @__PURE__ */ c(Fu, { className: A("h-3 w-3", O) })
3179
3215
  }
3180
3216
  ),
3181
3217
  /* @__PURE__ */ c(
3182
- fe,
3218
+ pe,
3183
3219
  {
3184
3220
  variant: "ghost",
3185
3221
  size: "sm",
3186
- className: "h-6 w-6 p-0 text-current",
3222
+ className: A("h-6 w-6 p-0", O),
3187
3223
  disabled: !y.canGoForward,
3188
3224
  onClick: () => E == null ? void 0 : E(),
3189
3225
  title: "Go forward to next branch",
3190
- children: /* @__PURE__ */ c(da, { className: "h-3 w-3 text-current" })
3226
+ children: /* @__PURE__ */ c(da, { className: A("h-3 w-3", O) })
3191
3227
  }
3192
3228
  )
3193
3229
  ] })
@@ -3202,31 +3238,31 @@ function gp({
3202
3238
  ),
3203
3239
  children: [
3204
3240
  /* @__PURE__ */ c(
3205
- fe,
3241
+ pe,
3206
3242
  {
3207
3243
  variant: "ghost",
3208
3244
  size: "sm",
3209
- onClick: ae,
3245
+ onClick: V,
3210
3246
  className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3211
- children: /* @__PURE__ */ c(ns, { className: A(D ? "text-success" : "text-current", T ? "h-3 w-3" : "h-4 w-4") })
3247
+ children: /* @__PURE__ */ c(ns, { className: A(L ? "text-success" : "text-current", T ? "h-3 w-3" : "h-4 w-4") })
3212
3248
  }
3213
3249
  ),
3214
3250
  P === "user" && C && /* @__PURE__ */ c(
3215
- fe,
3251
+ pe,
3216
3252
  {
3217
3253
  variant: "ghost",
3218
3254
  size: "sm",
3219
- onClick: V,
3255
+ onClick: re,
3220
3256
  className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3221
3257
  children: /* @__PURE__ */ c(rs, { className: A("text-current", T ? "h-3 w-3" : "h-4 w-4") })
3222
3258
  }
3223
3259
  ),
3224
3260
  P === "assistant" && I && /* @__PURE__ */ c(
3225
- fe,
3261
+ pe,
3226
3262
  {
3227
3263
  variant: "ghost",
3228
3264
  size: "sm",
3229
- onClick: oe,
3265
+ onClick: ie,
3230
3266
  className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3231
3267
  children: /* @__PURE__ */ c(Wr, { className: A("text-current", T ? "h-3 w-3" : "h-4 w-4") })
3232
3268
  }
@@ -3481,27 +3517,27 @@ function Co(e) {
3481
3517
  t,
3482
3518
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
3483
3519
  ), a = (h) => {
3484
- const { scope: b, children: w } = h, y = Qe.useRef(null), x = Qe.useRef(/* @__PURE__ */ new Map()).current;
3520
+ const { scope: b, children: w } = h, y = Je.useRef(null), x = Je.useRef(/* @__PURE__ */ new Map()).current;
3485
3521
  return /* @__PURE__ */ c(o, { scope: b, itemMap: x, collectionRef: y, children: w });
3486
3522
  };
3487
3523
  a.displayName = t;
3488
- const i = e + "CollectionSlot", u = _t(i), f = Qe.forwardRef(
3524
+ const i = e + "CollectionSlot", u = _t(i), f = Je.forwardRef(
3489
3525
  (h, b) => {
3490
- const { scope: w, children: y } = h, x = s(i, w), E = ne(b, x.collectionRef);
3526
+ const { scope: w, children: y } = h, x = s(i, w), E = te(b, x.collectionRef);
3491
3527
  return /* @__PURE__ */ c(u, { ref: E, children: y });
3492
3528
  }
3493
3529
  );
3494
3530
  f.displayName = i;
3495
- const d = e + "CollectionItemSlot", p = "data-radix-collection-item", g = _t(d), v = Qe.forwardRef(
3531
+ const d = e + "CollectionItemSlot", p = "data-radix-collection-item", g = _t(d), v = Je.forwardRef(
3496
3532
  (h, b) => {
3497
- const { scope: w, children: y, ...x } = h, E = Qe.useRef(null), C = ne(b, E), I = s(d, w);
3498
- return Qe.useEffect(() => (I.itemMap.set(E, { ref: E, ...x }), () => void I.itemMap.delete(E))), /* @__PURE__ */ c(g, { [p]: "", ref: C, children: y });
3533
+ const { scope: w, children: y, ...x } = h, E = Je.useRef(null), C = te(b, E), I = s(d, w);
3534
+ return Je.useEffect(() => (I.itemMap.set(E, { ref: E, ...x }), () => void I.itemMap.delete(E))), /* @__PURE__ */ c(g, { [p]: "", ref: C, children: y });
3499
3535
  }
3500
3536
  );
3501
3537
  v.displayName = d;
3502
3538
  function m(h) {
3503
3539
  const b = s(e + "CollectionConsumer", h);
3504
- return Qe.useCallback(() => {
3540
+ return Je.useCallback(() => {
3505
3541
  const y = b.collectionRef.current;
3506
3542
  if (!y) return [];
3507
3543
  const x = Array.from(y.querySelectorAll(`[${p}]`));
@@ -3553,12 +3589,12 @@ var kp = "DismissableLayer", Yr = "dismissableLayer.update", Dp = "dismissableLa
3553
3589
  onInteractOutside: a,
3554
3590
  onDismiss: i,
3555
3591
  ...u
3556
- } = e, f = l.useContext(qa), [d, p] = l.useState(null), g = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, v] = l.useState({}), m = ne(t, (N) => p(N)), h = Array.from(f.layers), [b] = [...f.layersWithOutsidePointerEventsDisabled].slice(-1), w = h.indexOf(b), y = d ? h.indexOf(d) : -1, x = f.layersWithOutsidePointerEventsDisabled.size > 0, E = y >= w, C = Bp((N) => {
3557
- const L = N.target, M = [...f.branches].some((D) => D.contains(L));
3558
- !E || M || (o == null || o(N), a == null || a(N), N.defaultPrevented || i == null || i());
3592
+ } = e, f = l.useContext(qa), [d, p] = l.useState(null), g = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, v] = l.useState({}), m = te(t, (N) => p(N)), h = Array.from(f.layers), [b] = [...f.layersWithOutsidePointerEventsDisabled].slice(-1), w = h.indexOf(b), y = d ? h.indexOf(d) : -1, x = f.layersWithOutsidePointerEventsDisabled.size > 0, E = y >= w, C = Bp((N) => {
3593
+ const F = N.target, D = [...f.branches].some((L) => L.contains(F));
3594
+ !E || D || (o == null || o(N), a == null || a(N), N.defaultPrevented || i == null || i());
3559
3595
  }, g), I = Up((N) => {
3560
- const L = N.target;
3561
- [...f.branches].some((D) => D.contains(L)) || (s == null || s(N), a == null || a(N), N.defaultPrevented || i == null || i());
3596
+ const F = N.target;
3597
+ [...f.branches].some((L) => L.contains(F)) || (s == null || s(N), a == null || a(N), N.defaultPrevented || i == null || i());
3562
3598
  }, g);
3563
3599
  return Mp((N) => {
3564
3600
  y === f.layers.size - 1 && (r == null || r(N), !N.defaultPrevented && i && (N.preventDefault(), i()));
@@ -3593,7 +3629,7 @@ var kp = "DismissableLayer", Yr = "dismissableLayer.update", Dp = "dismissableLa
3593
3629
  );
3594
3630
  ln.displayName = kp;
3595
3631
  var Fp = "DismissableLayerBranch", $p = l.forwardRef((e, t) => {
3596
- const n = l.useContext(qa), r = l.useRef(null), o = ne(t, r);
3632
+ const n = l.useContext(qa), r = l.useRef(null), o = te(t, r);
3597
3633
  return l.useEffect(() => {
3598
3634
  const s = r.current;
3599
3635
  if (s)
@@ -3675,7 +3711,7 @@ var Ir = "focusScope.autoFocusOnMount", Or = "focusScope.autoFocusOnUnmount", ks
3675
3711
  onMountAutoFocus: o,
3676
3712
  onUnmountAutoFocus: s,
3677
3713
  ...a
3678
- } = e, [i, u] = l.useState(null), f = ye(o), d = ye(s), p = l.useRef(null), g = ne(t, (h) => u(h)), v = l.useRef({
3714
+ } = e, [i, u] = l.useState(null), f = ye(o), d = ye(s), p = l.useRef(null), g = te(t, (h) => u(h)), v = l.useRef({
3679
3715
  paused: !1,
3680
3716
  pause() {
3681
3717
  this.paused = !0;
@@ -3812,10 +3848,10 @@ const qp = ["top", "right", "bottom", "left"], st = Math.min, Pe = Math.max, $n
3812
3848
  function Jr(e, t, n) {
3813
3849
  return Pe(e, st(t, n));
3814
3850
  }
3815
- function Je(e, t) {
3851
+ function Ze(e, t) {
3816
3852
  return typeof e == "function" ? e(t) : e;
3817
3853
  }
3818
- function Ze(e) {
3854
+ function Qe(e) {
3819
3855
  return e.split("-")[0];
3820
3856
  }
3821
3857
  function $t(e) {
@@ -3829,7 +3865,7 @@ function No(e) {
3829
3865
  }
3830
3866
  const Jp = /* @__PURE__ */ new Set(["top", "bottom"]);
3831
3867
  function je(e) {
3832
- return Jp.has(Ze(e)) ? "y" : "x";
3868
+ return Jp.has(Qe(e)) ? "y" : "x";
3833
3869
  }
3834
3870
  function To(e) {
3835
3871
  return Ro(je(e));
@@ -3862,7 +3898,7 @@ function nh(e, t, n) {
3862
3898
  }
3863
3899
  function rh(e, t, n, r) {
3864
3900
  const o = $t(e);
3865
- let s = nh(Ze(e), n === "start", r);
3901
+ let s = nh(Qe(e), n === "start", r);
3866
3902
  return o && (s = s.map((a) => a + "-" + o), t && (s = s.concat(s.map(Zr)))), s;
3867
3903
  }
3868
3904
  function Bn(e) {
@@ -3908,7 +3944,7 @@ function Us(e, t, n) {
3908
3944
  reference: r,
3909
3945
  floating: o
3910
3946
  } = e;
3911
- const s = je(t), a = To(t), i = No(a), u = Ze(t), f = s === "y", d = r.x + r.width / 2 - o.width / 2, p = r.y + r.height / 2 - o.height / 2, g = r[i] / 2 - o[i] / 2;
3947
+ const s = je(t), a = To(t), i = No(a), u = Qe(t), f = s === "y", d = r.x + r.width / 2 - o.width / 2, p = r.y + r.height / 2 - o.height / 2, g = r[i] / 2 - o[i] / 2;
3912
3948
  let v;
3913
3949
  switch (u) {
3914
3950
  case "top":
@@ -4028,7 +4064,7 @@ async function Jt(e, t) {
4028
4064
  elementContext: p = "floating",
4029
4065
  altBoundary: g = !1,
4030
4066
  padding: v = 0
4031
- } = Je(t, e), m = Ja(v), b = i[g ? p === "floating" ? "reference" : "floating" : p], w = Un(await s.getClippingRect({
4067
+ } = Ze(t, e), m = Ja(v), b = i[g ? p === "floating" ? "reference" : "floating" : p], w = Un(await s.getClippingRect({
4032
4068
  element: (n = await (s.isElement == null ? void 0 : s.isElement(b))) == null || n ? b : b.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(i.floating)),
4033
4069
  boundary: f,
4034
4070
  rootBoundary: d,
@@ -4072,7 +4108,7 @@ const ah = (e) => ({
4072
4108
  } = t, {
4073
4109
  element: f,
4074
4110
  padding: d = 0
4075
- } = Je(e, t) || {};
4111
+ } = Ze(e, t) || {};
4076
4112
  if (f == null)
4077
4113
  return {};
4078
4114
  const p = Ja(d), g = {
@@ -4081,17 +4117,17 @@ const ah = (e) => ({
4081
4117
  }, v = To(o), m = No(v), h = await a.getDimensions(f), b = v === "y", w = b ? "top" : "left", y = b ? "bottom" : "right", x = b ? "clientHeight" : "clientWidth", E = s.reference[m] + s.reference[v] - g[v] - s.floating[m], C = g[v] - s.reference[v], I = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(f));
4082
4118
  let N = I ? I[x] : 0;
4083
4119
  (!N || !await (a.isElement == null ? void 0 : a.isElement(I))) && (N = i.floating[x] || s.floating[m]);
4084
- const L = E / 2 - C / 2, M = N / 2 - h[m] / 2 - 1, D = st(p[w], M), j = st(p[y], M), K = D, W = N - h[m] - j, B = N / 2 - h[m] / 2 + L, q = Jr(K, B, W), F = !u.arrow && $t(o) != null && B !== q && s.reference[m] / 2 - (B < K ? D : j) - h[m] / 2 < 0, G = F ? B < K ? B - K : B - W : 0;
4120
+ const F = E / 2 - C / 2, D = N / 2 - h[m] / 2 - 1, L = st(p[w], D), j = st(p[y], D), K = L, W = N - h[m] - j, B = N / 2 - h[m] / 2 + F, q = Jr(K, B, W), $ = !u.arrow && $t(o) != null && B !== q && s.reference[m] / 2 - (B < K ? L : j) - h[m] / 2 < 0, G = $ ? B < K ? B - K : B - W : 0;
4085
4121
  return {
4086
4122
  [v]: g[v] + G,
4087
4123
  data: {
4088
4124
  [v]: q,
4089
4125
  centerOffset: B - q - G,
4090
- ...F && {
4126
+ ...$ && {
4091
4127
  alignmentOffset: G
4092
4128
  }
4093
4129
  },
4094
- reset: F
4130
+ reset: $
4095
4131
  };
4096
4132
  }
4097
4133
  }), ih = function(e) {
@@ -4115,41 +4151,41 @@ const ah = (e) => ({
4115
4151
  fallbackAxisSideDirection: m = "none",
4116
4152
  flipAlignment: h = !0,
4117
4153
  ...b
4118
- } = Je(e, t);
4154
+ } = Ze(e, t);
4119
4155
  if ((n = s.arrow) != null && n.alignmentOffset)
4120
4156
  return {};
4121
- const w = Ze(o), y = je(i), x = Ze(i) === i, E = await (u.isRTL == null ? void 0 : u.isRTL(f.floating)), C = g || (x || !h ? [Bn(i)] : Qp(i)), I = m !== "none";
4157
+ const w = Qe(o), y = je(i), x = Qe(i) === i, E = await (u.isRTL == null ? void 0 : u.isRTL(f.floating)), C = g || (x || !h ? [Bn(i)] : Qp(i)), I = m !== "none";
4122
4158
  !g && I && C.push(...rh(i, h, m, E));
4123
- const N = [i, ...C], L = await Jt(t, b), M = [];
4124
- let D = ((r = s.flip) == null ? void 0 : r.overflows) || [];
4125
- if (d && M.push(L[w]), p) {
4159
+ const N = [i, ...C], F = await Jt(t, b), D = [];
4160
+ let L = ((r = s.flip) == null ? void 0 : r.overflows) || [];
4161
+ if (d && D.push(F[w]), p) {
4126
4162
  const B = Zp(o, a, E);
4127
- M.push(L[B[0]], L[B[1]]);
4163
+ D.push(F[B[0]], F[B[1]]);
4128
4164
  }
4129
- if (D = [...D, {
4165
+ if (L = [...L, {
4130
4166
  placement: o,
4131
- overflows: M
4132
- }], !M.every((B) => B <= 0)) {
4167
+ overflows: D
4168
+ }], !D.every((B) => B <= 0)) {
4133
4169
  var j, K;
4134
4170
  const B = (((j = s.flip) == null ? void 0 : j.index) || 0) + 1, q = N[B];
4135
4171
  if (q && (!(p === "alignment" ? y !== je(q) : !1) || // We leave the current main axis only if every placement on that axis
4136
4172
  // overflows the main axis.
4137
- D.every((T) => je(T.placement) === y ? T.overflows[0] > 0 : !0)))
4173
+ L.every((T) => je(T.placement) === y ? T.overflows[0] > 0 : !0)))
4138
4174
  return {
4139
4175
  data: {
4140
4176
  index: B,
4141
- overflows: D
4177
+ overflows: L
4142
4178
  },
4143
4179
  reset: {
4144
4180
  placement: q
4145
4181
  }
4146
4182
  };
4147
- let F = (K = D.filter((G) => G.overflows[0] <= 0).sort((G, T) => G.overflows[1] - T.overflows[1])[0]) == null ? void 0 : K.placement;
4148
- if (!F)
4183
+ let $ = (K = L.filter((G) => G.overflows[0] <= 0).sort((G, T) => G.overflows[1] - T.overflows[1])[0]) == null ? void 0 : K.placement;
4184
+ if (!$)
4149
4185
  switch (v) {
4150
4186
  case "bestFit": {
4151
4187
  var W;
4152
- const G = (W = D.filter((T) => {
4188
+ const G = (W = L.filter((T) => {
4153
4189
  if (I) {
4154
4190
  const P = je(T.placement);
4155
4191
  return P === y || // Create a bias to the `y` side axis due to horizontal
@@ -4158,17 +4194,17 @@ const ah = (e) => ({
4158
4194
  }
4159
4195
  return !0;
4160
4196
  }).map((T) => [T.placement, T.overflows.filter((P) => P > 0).reduce((P, _) => P + _, 0)]).sort((T, P) => T[1] - P[1])[0]) == null ? void 0 : W[0];
4161
- G && (F = G);
4197
+ G && ($ = G);
4162
4198
  break;
4163
4199
  }
4164
4200
  case "initialPlacement":
4165
- F = i;
4201
+ $ = i;
4166
4202
  break;
4167
4203
  }
4168
- if (o !== F)
4204
+ if (o !== $)
4169
4205
  return {
4170
4206
  reset: {
4171
- placement: F
4207
+ placement: $
4172
4208
  }
4173
4209
  };
4174
4210
  }
@@ -4197,7 +4233,7 @@ const ch = function(e) {
4197
4233
  } = t, {
4198
4234
  strategy: r = "referenceHidden",
4199
4235
  ...o
4200
- } = Je(e, t);
4236
+ } = Ze(e, t);
4201
4237
  switch (r) {
4202
4238
  case "referenceHidden": {
4203
4239
  const s = await Jt(t, {
@@ -4234,7 +4270,7 @@ async function lh(e, t) {
4234
4270
  placement: n,
4235
4271
  platform: r,
4236
4272
  elements: o
4237
- } = e, s = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), a = Ze(n), i = $t(n), u = je(n) === "y", f = Za.has(a) ? -1 : 1, d = s && u ? -1 : 1, p = Je(t, e);
4273
+ } = e, s = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), a = Qe(n), i = $t(n), u = je(n) === "y", f = Za.has(a) ? -1 : 1, d = s && u ? -1 : 1, p = Ze(t, e);
4238
4274
  let {
4239
4275
  mainAxis: g,
4240
4276
  crossAxis: v,
@@ -4303,10 +4339,10 @@ const uh = function(e) {
4303
4339
  }
4304
4340
  },
4305
4341
  ...u
4306
- } = Je(e, t), f = {
4342
+ } = Ze(e, t), f = {
4307
4343
  x: n,
4308
4344
  y: r
4309
- }, d = await Jt(t, u), p = je(Ze(o)), g = Ro(p);
4345
+ }, d = await Jt(t, u), p = je(Qe(o)), g = Ro(p);
4310
4346
  let v = f[g], m = f[p];
4311
4347
  if (s) {
4312
4348
  const b = g === "y" ? "top" : "left", w = g === "y" ? "bottom" : "right", y = v + d[b], x = v - d[w];
@@ -4348,12 +4384,12 @@ const uh = function(e) {
4348
4384
  offset: i = 0,
4349
4385
  mainAxis: u = !0,
4350
4386
  crossAxis: f = !0
4351
- } = Je(e, t), d = {
4387
+ } = Ze(e, t), d = {
4352
4388
  x: n,
4353
4389
  y: r
4354
4390
  }, p = je(o), g = Ro(p);
4355
4391
  let v = d[g], m = d[p];
4356
- const h = Je(i, t), b = typeof h == "number" ? {
4392
+ const h = Ze(i, t), b = typeof h == "number" ? {
4357
4393
  mainAxis: h,
4358
4394
  crossAxis: 0
4359
4395
  } : {
@@ -4367,7 +4403,7 @@ const uh = function(e) {
4367
4403
  }
4368
4404
  if (f) {
4369
4405
  var w, y;
4370
- const x = g === "y" ? "width" : "height", E = Za.has(Ze(o)), C = s.reference[p] - s.floating[x] + (E && ((w = a.offset) == null ? void 0 : w[p]) || 0) + (E ? 0 : b.crossAxis), I = s.reference[p] + s.reference[x] + (E ? 0 : ((y = a.offset) == null ? void 0 : y[p]) || 0) - (E ? b.crossAxis : 0);
4406
+ const x = g === "y" ? "width" : "height", E = Za.has(Qe(o)), C = s.reference[p] - s.floating[x] + (E && ((w = a.offset) == null ? void 0 : w[p]) || 0) + (E ? 0 : b.crossAxis), I = s.reference[p] + s.reference[x] + (E ? 0 : ((y = a.offset) == null ? void 0 : y[p]) || 0) - (E ? b.crossAxis : 0);
4371
4407
  m < C ? m = C : m > I && (m = I);
4372
4408
  }
4373
4409
  return {
@@ -4391,25 +4427,25 @@ const uh = function(e) {
4391
4427
  apply: u = () => {
4392
4428
  },
4393
4429
  ...f
4394
- } = Je(e, t), d = await Jt(t, f), p = Ze(o), g = $t(o), v = je(o) === "y", {
4430
+ } = Ze(e, t), d = await Jt(t, f), p = Qe(o), g = $t(o), v = je(o) === "y", {
4395
4431
  width: m,
4396
4432
  height: h
4397
4433
  } = s.floating;
4398
4434
  let b, w;
4399
4435
  p === "top" || p === "bottom" ? (b = p, w = g === (await (a.isRTL == null ? void 0 : a.isRTL(i.floating)) ? "start" : "end") ? "left" : "right") : (w = p, b = g === "end" ? "top" : "bottom");
4400
4436
  const y = h - d.top - d.bottom, x = m - d.left - d.right, E = st(h - d[b], y), C = st(m - d[w], x), I = !t.middlewareData.shift;
4401
- let N = E, L = C;
4402
- if ((n = t.middlewareData.shift) != null && n.enabled.x && (L = x), (r = t.middlewareData.shift) != null && r.enabled.y && (N = y), I && !g) {
4403
- const D = Pe(d.left, 0), j = Pe(d.right, 0), K = Pe(d.top, 0), W = Pe(d.bottom, 0);
4404
- v ? L = m - 2 * (D !== 0 || j !== 0 ? D + j : Pe(d.left, d.right)) : N = h - 2 * (K !== 0 || W !== 0 ? K + W : Pe(d.top, d.bottom));
4437
+ let N = E, F = C;
4438
+ if ((n = t.middlewareData.shift) != null && n.enabled.x && (F = x), (r = t.middlewareData.shift) != null && r.enabled.y && (N = y), I && !g) {
4439
+ const L = Pe(d.left, 0), j = Pe(d.right, 0), K = Pe(d.top, 0), W = Pe(d.bottom, 0);
4440
+ v ? F = m - 2 * (L !== 0 || j !== 0 ? L + j : Pe(d.left, d.right)) : N = h - 2 * (K !== 0 || W !== 0 ? K + W : Pe(d.top, d.bottom));
4405
4441
  }
4406
4442
  await u({
4407
4443
  ...t,
4408
- availableWidth: L,
4444
+ availableWidth: F,
4409
4445
  availableHeight: N
4410
4446
  });
4411
- const M = await a.getDimensions(i.floating);
4412
- return m !== M.width || h !== M.height ? {
4447
+ const D = await a.getDimensions(i.floating);
4448
+ return m !== D.width || h !== D.height ? {
4413
4449
  reset: {
4414
4450
  rects: !0
4415
4451
  }
@@ -4989,7 +5025,7 @@ function Xh(e) {
4989
5025
  T !== I.current && (I.current = T, h(T));
4990
5026
  }, []), x = l.useCallback((T) => {
4991
5027
  T !== N.current && (N.current = T, w(T));
4992
- }, []), E = s || m, C = a || b, I = l.useRef(null), N = l.useRef(null), L = l.useRef(d), M = u != null, D = kr(u), j = kr(o), K = kr(f), W = l.useCallback(() => {
5028
+ }, []), E = s || m, C = a || b, I = l.useRef(null), N = l.useRef(null), F = l.useRef(d), D = u != null, L = kr(u), j = kr(o), K = kr(f), W = l.useCallback(() => {
4993
5029
  if (!I.current || !N.current)
4994
5030
  return;
4995
5031
  const T = {
@@ -5006,13 +5042,13 @@ function Xh(e) {
5006
5042
  // setting it to `true` when `open === false` (must be specified).
5007
5043
  isPositioned: K.current !== !1
5008
5044
  };
5009
- B.current && !zn(L.current, _) && (L.current = _, qn.flushSync(() => {
5045
+ B.current && !zn(F.current, _) && (F.current = _, qn.flushSync(() => {
5010
5046
  p(_);
5011
5047
  }));
5012
5048
  });
5013
5049
  }, [g, t, n, j, K]);
5014
5050
  Nn(() => {
5015
- f === !1 && L.current.isPositioned && (L.current.isPositioned = !1, p((T) => ({
5051
+ f === !1 && F.current.isPositioned && (F.current.isPositioned = !1, p((T) => ({
5016
5052
  ...T,
5017
5053
  isPositioned: !1
5018
5054
  })));
@@ -5022,17 +5058,17 @@ function Xh(e) {
5022
5058
  B.current = !1;
5023
5059
  }), []), Nn(() => {
5024
5060
  if (E && (I.current = E), C && (N.current = C), E && C) {
5025
- if (D.current)
5026
- return D.current(E, C, W);
5061
+ if (L.current)
5062
+ return L.current(E, C, W);
5027
5063
  W();
5028
5064
  }
5029
- }, [E, C, W, D, M]);
5065
+ }, [E, C, W, L, D]);
5030
5066
  const q = l.useMemo(() => ({
5031
5067
  reference: I,
5032
5068
  floating: N,
5033
5069
  setReference: y,
5034
5070
  setFloating: x
5035
- }), [y, x]), F = l.useMemo(() => ({
5071
+ }), [y, x]), $ = l.useMemo(() => ({
5036
5072
  reference: E,
5037
5073
  floating: C
5038
5074
  }), [E, C]), G = l.useMemo(() => {
@@ -5041,13 +5077,13 @@ function Xh(e) {
5041
5077
  left: 0,
5042
5078
  top: 0
5043
5079
  };
5044
- if (!F.floating)
5080
+ if (!$.floating)
5045
5081
  return T;
5046
- const P = qs(F.floating, d.x), _ = qs(F.floating, d.y);
5082
+ const P = qs($.floating, d.x), _ = qs($.floating, d.y);
5047
5083
  return i ? {
5048
5084
  ...T,
5049
5085
  transform: "translate(" + P + "px, " + _ + "px)",
5050
- ...ii(F.floating) >= 1.5 && {
5086
+ ...ii($.floating) >= 1.5 && {
5051
5087
  willChange: "transform"
5052
5088
  }
5053
5089
  } : {
@@ -5055,14 +5091,14 @@ function Xh(e) {
5055
5091
  left: P,
5056
5092
  top: _
5057
5093
  };
5058
- }, [n, i, F.floating, d.x, d.y]);
5094
+ }, [n, i, $.floating, d.x, d.y]);
5059
5095
  return l.useMemo(() => ({
5060
5096
  ...d,
5061
5097
  update: W,
5062
5098
  refs: q,
5063
- elements: F,
5099
+ elements: $,
5064
5100
  floatingStyles: G
5065
- }), [d, W, q, F, G]);
5101
+ }), [d, W, q, $, G]);
5066
5102
  }
5067
5103
  const Yh = (e) => {
5068
5104
  function t(n) {
@@ -5153,7 +5189,7 @@ var Io = "Popper", [ui, Ut] = Ue(Io), [am, di] = ui(Io), fi = (e) => {
5153
5189
  fi.displayName = Io;
5154
5190
  var pi = "PopperAnchor", hi = l.forwardRef(
5155
5191
  (e, t) => {
5156
- const { __scopePopper: n, virtualRef: r, ...o } = e, s = di(pi, n), a = l.useRef(null), i = ne(t, a), u = l.useRef(null);
5192
+ const { __scopePopper: n, virtualRef: r, ...o } = e, s = di(pi, n), a = l.useRef(null), i = te(t, a), u = l.useRef(null);
5157
5193
  return l.useEffect(() => {
5158
5194
  const f = u.current;
5159
5195
  u.current = (r == null ? void 0 : r.current) || a.current, f !== u.current && s.onAnchorChange(u.current);
@@ -5163,7 +5199,7 @@ var pi = "PopperAnchor", hi = l.forwardRef(
5163
5199
  hi.displayName = pi;
5164
5200
  var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5165
5201
  (e, t) => {
5166
- var V, oe, ie, se, H, Z;
5202
+ var V, re, ie, oe, H, Z;
5167
5203
  const {
5168
5204
  __scopePopper: n,
5169
5205
  side: r = "bottom",
@@ -5179,15 +5215,15 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5179
5215
  updatePositionStrategy: v = "optimized",
5180
5216
  onPlaced: m,
5181
5217
  ...h
5182
- } = e, b = di(Oo, n), [w, y] = l.useState(null), x = ne(t, (de) => y(de)), [E, C] = l.useState(null), I = li(E), N = (I == null ? void 0 : I.width) ?? 0, L = (I == null ? void 0 : I.height) ?? 0, M = r + (s !== "center" ? "-" + s : ""), D = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, j = Array.isArray(f) ? f : [f], K = j.length > 0, W = {
5183
- padding: D,
5218
+ } = e, b = di(Oo, n), [w, y] = l.useState(null), x = te(t, (de) => y(de)), [E, C] = l.useState(null), I = li(E), N = (I == null ? void 0 : I.width) ?? 0, F = (I == null ? void 0 : I.height) ?? 0, D = r + (s !== "center" ? "-" + s : ""), L = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, j = Array.isArray(f) ? f : [f], K = j.length > 0, W = {
5219
+ padding: L,
5184
5220
  boundary: j.filter(um),
5185
5221
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
5186
5222
  altBoundary: K
5187
- }, { refs: B, floatingStyles: q, placement: F, isPositioned: G, middlewareData: T } = Xh({
5223
+ }, { refs: B, floatingStyles: q, placement: $, isPositioned: G, middlewareData: T } = Xh({
5188
5224
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
5189
5225
  strategy: "fixed",
5190
- placement: M,
5226
+ placement: D,
5191
5227
  whileElementsMounted: (...de) => Bh(...de, {
5192
5228
  animationFrame: v === "always"
5193
5229
  }),
@@ -5195,7 +5231,7 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5195
5231
  reference: b.anchor
5196
5232
  },
5197
5233
  middleware: [
5198
- Jh({ mainAxis: o + L, alignmentAxis: a }),
5234
+ Jh({ mainAxis: o + F, alignmentAxis: a }),
5199
5235
  u && Zh({
5200
5236
  mainAxis: !0,
5201
5237
  crossAxis: !1,
@@ -5205,22 +5241,22 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5205
5241
  u && em({ ...W }),
5206
5242
  tm({
5207
5243
  ...W,
5208
- apply: ({ elements: de, rects: pe, availableWidth: Y, availableHeight: ge }) => {
5209
- const { width: te, height: he } = pe.reference, ve = de.floating.style;
5210
- ve.setProperty("--radix-popper-available-width", `${Y}px`), ve.setProperty("--radix-popper-available-height", `${ge}px`), ve.setProperty("--radix-popper-anchor-width", `${te}px`), ve.setProperty("--radix-popper-anchor-height", `${he}px`);
5244
+ apply: ({ elements: de, rects: he, availableWidth: me, availableHeight: Q }) => {
5245
+ const { width: ve, height: ae } = he.reference, fe = de.floating.style;
5246
+ fe.setProperty("--radix-popper-available-width", `${me}px`), fe.setProperty("--radix-popper-available-height", `${Q}px`), fe.setProperty("--radix-popper-anchor-width", `${ve}px`), fe.setProperty("--radix-popper-anchor-height", `${ae}px`);
5211
5247
  }
5212
5248
  }),
5213
5249
  E && rm({ element: E, padding: i }),
5214
- dm({ arrowWidth: N, arrowHeight: L }),
5250
+ dm({ arrowWidth: N, arrowHeight: F }),
5215
5251
  g && nm({ strategy: "referenceHidden", ...W })
5216
5252
  ]
5217
- }), [P, _] = vi(F), O = ye(m);
5253
+ }), [P, _] = vi($), O = ye(m);
5218
5254
  be(() => {
5219
5255
  G && (O == null || O());
5220
5256
  }, [G, O]);
5221
- const X = (V = T.arrow) == null ? void 0 : V.x, $ = (oe = T.arrow) == null ? void 0 : oe.y, z = ((ie = T.arrow) == null ? void 0 : ie.centerOffset) !== 0, [le, ae] = l.useState();
5257
+ const Y = (V = T.arrow) == null ? void 0 : V.x, M = (re = T.arrow) == null ? void 0 : re.y, z = ((ie = T.arrow) == null ? void 0 : ie.centerOffset) !== 0, [le, se] = l.useState();
5222
5258
  return be(() => {
5223
- w && ae(window.getComputedStyle(w).zIndex);
5259
+ w && se(window.getComputedStyle(w).zIndex);
5224
5260
  }, [w]), /* @__PURE__ */ c(
5225
5261
  "div",
5226
5262
  {
@@ -5233,7 +5269,7 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5233
5269
  minWidth: "max-content",
5234
5270
  zIndex: le,
5235
5271
  "--radix-popper-transform-origin": [
5236
- (se = T.transformOrigin) == null ? void 0 : se.x,
5272
+ (oe = T.transformOrigin) == null ? void 0 : oe.x,
5237
5273
  (H = T.transformOrigin) == null ? void 0 : H.y
5238
5274
  ].join(" "),
5239
5275
  // hide the content if using the hide middleware and should be hidden
@@ -5251,8 +5287,8 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5251
5287
  scope: n,
5252
5288
  placedSide: P,
5253
5289
  onArrowChange: C,
5254
- arrowX: X,
5255
- arrowY: $,
5290
+ arrowX: Y,
5291
+ arrowY: M,
5256
5292
  shouldHideArrow: z,
5257
5293
  children: /* @__PURE__ */ c(
5258
5294
  J.div,
@@ -5371,16 +5407,16 @@ var vm = l.forwardRef((e, t) => {
5371
5407
  onEntryFocus: f,
5372
5408
  preventScrollOnEntryFocus: d = !1,
5373
5409
  ...p
5374
- } = e, g = l.useRef(null), v = ne(t, g), m = tr(s), [h, b] = ot({
5410
+ } = e, g = l.useRef(null), v = te(t, g), m = tr(s), [h, b] = ot({
5375
5411
  prop: a,
5376
5412
  defaultProp: i ?? null,
5377
5413
  onChange: u,
5378
5414
  caller: dn
5379
5415
  }), [w, y] = l.useState(!1), x = ye(f), E = wi(n), C = l.useRef(!1), [I, N] = l.useState(0);
5380
5416
  return l.useEffect(() => {
5381
- const L = g.current;
5382
- if (L)
5383
- return L.addEventListener(Dr, x), () => L.removeEventListener(Dr, x);
5417
+ const F = g.current;
5418
+ if (F)
5419
+ return F.addEventListener(Dr, x), () => F.removeEventListener(Dr, x);
5384
5420
  }, [x]), /* @__PURE__ */ c(
5385
5421
  gm,
5386
5422
  {
@@ -5390,16 +5426,16 @@ var vm = l.forwardRef((e, t) => {
5390
5426
  loop: o,
5391
5427
  currentTabStopId: h,
5392
5428
  onItemFocus: l.useCallback(
5393
- (L) => b(L),
5429
+ (F) => b(F),
5394
5430
  [b]
5395
5431
  ),
5396
5432
  onItemShiftTab: l.useCallback(() => y(!0), []),
5397
5433
  onFocusableItemAdd: l.useCallback(
5398
- () => N((L) => L + 1),
5434
+ () => N((F) => F + 1),
5399
5435
  []
5400
5436
  ),
5401
5437
  onFocusableItemRemove: l.useCallback(
5402
- () => N((L) => L - 1),
5438
+ () => N((F) => F - 1),
5403
5439
  []
5404
5440
  ),
5405
5441
  children: /* @__PURE__ */ c(
@@ -5413,14 +5449,14 @@ var vm = l.forwardRef((e, t) => {
5413
5449
  onMouseDown: U(e.onMouseDown, () => {
5414
5450
  C.current = !0;
5415
5451
  }),
5416
- onFocus: U(e.onFocus, (L) => {
5417
- const M = !C.current;
5418
- if (L.target === L.currentTarget && M && !w) {
5419
- const D = new CustomEvent(Dr, pm);
5420
- if (L.currentTarget.dispatchEvent(D), !D.defaultPrevented) {
5421
- const j = E().filter((F) => F.focusable), K = j.find((F) => F.active), W = j.find((F) => F.id === h), q = [K, W, ...j].filter(
5452
+ onFocus: U(e.onFocus, (F) => {
5453
+ const D = !C.current;
5454
+ if (F.target === F.currentTarget && D && !w) {
5455
+ const L = new CustomEvent(Dr, pm);
5456
+ if (F.currentTarget.dispatchEvent(L), !L.defaultPrevented) {
5457
+ const j = E().filter(($) => $.focusable), K = j.find(($) => $.active), W = j.find(($) => $.id === h), q = [K, W, ...j].filter(
5422
5458
  Boolean
5423
- ).map((F) => F.ref.current);
5459
+ ).map(($) => $.ref.current);
5424
5460
  Ei(q, d);
5425
5461
  }
5426
5462
  }
@@ -5967,15 +6003,15 @@ function ig(e) {
5967
6003
  var w = xn(h), y = n.current, x = "deltaX" in h ? h.deltaX : y[0] - w[0], E = "deltaY" in h ? h.deltaY : y[1] - w[1], C, I = h.target, N = Math.abs(x) > Math.abs(E) ? "h" : "v";
5968
6004
  if ("touches" in h && N === "h" && I.type === "range")
5969
6005
  return !1;
5970
- var L = Js(N, I);
5971
- if (!L)
6006
+ var F = Js(N, I);
6007
+ if (!F)
5972
6008
  return !0;
5973
- if (L ? C = N : (C = N === "v" ? "h" : "v", L = Js(N, I)), !L)
6009
+ if (F ? C = N : (C = N === "v" ? "h" : "v", F = Js(N, I)), !F)
5974
6010
  return !1;
5975
6011
  if (!r.current && "changedTouches" in h && (x || E) && (r.current = C), !C)
5976
6012
  return !0;
5977
- var M = r.current || C;
5978
- return rg(M, b, h, M === "h" ? x : E);
6013
+ var D = r.current || C;
6014
+ return rg(D, b, h, D === "h" ? x : E);
5979
6015
  }, []), u = l.useCallback(function(h) {
5980
6016
  var b = h;
5981
6017
  if (!(!Rt.length || Rt[Rt.length - 1] !== s)) {
@@ -6099,7 +6135,7 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
6099
6135
  }
6100
6136
  ), xg = l.forwardRef(
6101
6137
  (e, t) => {
6102
- const n = wt(Oe, e.__scopeMenu), r = l.useRef(null), o = ne(t, r);
6138
+ const n = wt(Oe, e.__scopeMenu), r = l.useRef(null), o = te(t, r);
6103
6139
  return l.useEffect(() => {
6104
6140
  const s = r.current;
6105
6141
  if (s) return Fo(s);
@@ -6150,23 +6186,23 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
6150
6186
  onDismiss: v,
6151
6187
  disableOutsideScroll: m,
6152
6188
  ...h
6153
- } = e, b = wt(Oe, n), w = pn(Oe, n), y = ur(n), x = Di(n), E = hg(n), [C, I] = l.useState(null), N = l.useRef(null), L = ne(t, N, b.onContentChange), M = l.useRef(0), D = l.useRef(""), j = l.useRef(0), K = l.useRef(null), W = l.useRef("right"), B = l.useRef(0), q = m ? lr : l.Fragment, F = m ? { as: Cg, allowPinchZoom: !0 } : void 0, G = (P) => {
6154
- var V, oe;
6155
- const _ = D.current + P, O = E().filter((ie) => !ie.disabled), X = document.activeElement, $ = (V = O.find((ie) => ie.ref.current === X)) == null ? void 0 : V.textValue, z = O.map((ie) => ie.textValue), le = Dg(z, _, $), ae = (oe = O.find((ie) => ie.textValue === le)) == null ? void 0 : oe.ref.current;
6156
- (function ie(se) {
6157
- D.current = se, window.clearTimeout(M.current), se !== "" && (M.current = window.setTimeout(() => ie(""), 1e3));
6158
- })(_), ae && setTimeout(() => ae.focus());
6189
+ } = e, b = wt(Oe, n), w = pn(Oe, n), y = ur(n), x = Di(n), E = hg(n), [C, I] = l.useState(null), N = l.useRef(null), F = te(t, N, b.onContentChange), D = l.useRef(0), L = l.useRef(""), j = l.useRef(0), K = l.useRef(null), W = l.useRef("right"), B = l.useRef(0), q = m ? lr : l.Fragment, $ = m ? { as: Cg, allowPinchZoom: !0 } : void 0, G = (P) => {
6190
+ var V, re;
6191
+ const _ = L.current + P, O = E().filter((ie) => !ie.disabled), Y = document.activeElement, M = (V = O.find((ie) => ie.ref.current === Y)) == null ? void 0 : V.textValue, z = O.map((ie) => ie.textValue), le = Dg(z, _, M), se = (re = O.find((ie) => ie.textValue === le)) == null ? void 0 : re.ref.current;
6192
+ (function ie(oe) {
6193
+ L.current = oe, window.clearTimeout(D.current), oe !== "" && (D.current = window.setTimeout(() => ie(""), 1e3));
6194
+ })(_), se && setTimeout(() => se.focus());
6159
6195
  };
6160
- l.useEffect(() => () => window.clearTimeout(M.current), []), Eo();
6196
+ l.useEffect(() => () => window.clearTimeout(D.current), []), Eo();
6161
6197
  const T = l.useCallback((P) => {
6162
- var O, X;
6163
- return W.current === ((O = K.current) == null ? void 0 : O.side) && Fg(P, (X = K.current) == null ? void 0 : X.area);
6198
+ var O, Y;
6199
+ return W.current === ((O = K.current) == null ? void 0 : O.side) && Fg(P, (Y = K.current) == null ? void 0 : Y.area);
6164
6200
  }, []);
6165
6201
  return /* @__PURE__ */ c(
6166
6202
  yg,
6167
6203
  {
6168
6204
  scope: n,
6169
- searchRef: D,
6205
+ searchRef: L,
6170
6206
  onItemEnter: l.useCallback(
6171
6207
  (P) => {
6172
6208
  T(P) && P.preventDefault();
@@ -6190,7 +6226,7 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
6190
6226
  onPointerGraceIntentChange: l.useCallback((P) => {
6191
6227
  K.current = P;
6192
6228
  }, []),
6193
- children: /* @__PURE__ */ c(q, { ...F, children: /* @__PURE__ */ c(
6229
+ children: /* @__PURE__ */ c(q, { ...$, children: /* @__PURE__ */ c(
6194
6230
  nr,
6195
6231
  {
6196
6232
  asChild: !0,
@@ -6234,27 +6270,27 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
6234
6270
  dir: w.dir,
6235
6271
  ...y,
6236
6272
  ...h,
6237
- ref: L,
6273
+ ref: F,
6238
6274
  style: { outline: "none", ...h.style },
6239
6275
  onKeyDown: U(h.onKeyDown, (P) => {
6240
- const O = P.target.closest("[data-radix-menu-content]") === P.currentTarget, X = P.ctrlKey || P.altKey || P.metaKey, $ = P.key.length === 1;
6241
- O && (P.key === "Tab" && P.preventDefault(), !X && $ && G(P.key));
6276
+ const O = P.target.closest("[data-radix-menu-content]") === P.currentTarget, Y = P.ctrlKey || P.altKey || P.metaKey, M = P.key.length === 1;
6277
+ O && (P.key === "Tab" && P.preventDefault(), !Y && M && G(P.key));
6242
6278
  const z = N.current;
6243
6279
  if (P.target !== z || !dg.includes(P.key)) return;
6244
6280
  P.preventDefault();
6245
- const ae = E().filter((V) => !V.disabled).map((V) => V.ref.current);
6246
- Mi.includes(P.key) && ae.reverse(), Mg(ae);
6281
+ const se = E().filter((V) => !V.disabled).map((V) => V.ref.current);
6282
+ Mi.includes(P.key) && se.reverse(), Mg(se);
6247
6283
  }),
6248
6284
  onBlur: U(e.onBlur, (P) => {
6249
- P.currentTarget.contains(P.target) || (window.clearTimeout(M.current), D.current = "");
6285
+ P.currentTarget.contains(P.target) || (window.clearTimeout(D.current), L.current = "");
6250
6286
  }),
6251
6287
  onPointerMove: U(
6252
6288
  e.onPointerMove,
6253
6289
  en((P) => {
6254
6290
  const _ = P.target, O = B.current !== P.clientX;
6255
6291
  if (P.currentTarget.contains(_) && O) {
6256
- const X = P.clientX > B.current ? "right" : "left";
6257
- W.current = X, B.current = P.clientX;
6292
+ const Y = P.clientX > B.current ? "right" : "left";
6293
+ W.current = Y, B.current = P.clientX;
6258
6294
  }
6259
6295
  })
6260
6296
  )
@@ -6287,7 +6323,7 @@ var Rg = "MenuLabel", Ui = l.forwardRef(
6287
6323
  Ui.displayName = Rg;
6288
6324
  var Hn = "MenuItem", ea = "menu.itemSelect", dr = l.forwardRef(
6289
6325
  (e, t) => {
6290
- const { disabled: n = !1, onSelect: r, ...o } = e, s = l.useRef(null), a = pn(Hn, e.__scopeMenu), i = Uo(Hn, e.__scopeMenu), u = ne(t, s), f = l.useRef(!1), d = () => {
6326
+ const { disabled: n = !1, onSelect: r, ...o } = e, s = l.useRef(null), a = pn(Hn, e.__scopeMenu), i = Uo(Hn, e.__scopeMenu), u = te(t, s), f = l.useRef(!1), d = () => {
6291
6327
  const p = s.current;
6292
6328
  if (!n && p) {
6293
6329
  const g = new CustomEvent(ea, { bubbles: !0, cancelable: !0 });
@@ -6320,7 +6356,7 @@ var Hn = "MenuItem", ea = "menu.itemSelect", dr = l.forwardRef(
6320
6356
  dr.displayName = Hn;
6321
6357
  var zi = l.forwardRef(
6322
6358
  (e, t) => {
6323
- const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, a = Uo(Hn, n), i = Di(n), u = l.useRef(null), f = ne(t, u), [d, p] = l.useState(!1), [g, v] = l.useState("");
6359
+ const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, a = Uo(Hn, n), i = Di(n), u = l.useRef(null), f = te(t, u), [d, p] = l.useState(!1), [g, v] = l.useState("");
6324
6360
  return l.useEffect(() => {
6325
6361
  const m = u.current;
6326
6362
  m && v((m.textContent ?? "").trim());
@@ -6530,7 +6566,7 @@ var Og = "MenuSub", [Sy, Ji] = vt(Og), Vt = "MenuSubTrigger", Zi = l.forwardRef(
6530
6566
  Zi.displayName = Vt;
6531
6567
  var Qi = "MenuSubContent", ec = l.forwardRef(
6532
6568
  (e, t) => {
6533
- const n = Fi(Oe, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = wt(Oe, e.__scopeMenu), a = pn(Oe, e.__scopeMenu), i = Ji(Qi, e.__scopeMenu), u = l.useRef(null), f = ne(t, u);
6569
+ const n = Fi(Oe, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = wt(Oe, e.__scopeMenu), a = pn(Oe, e.__scopeMenu), i = Ji(Qi, e.__scopeMenu), u = l.useRef(null), f = te(t, u);
6534
6570
  return /* @__PURE__ */ c(Qt.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ c(Ae, { present: r || s.open, children: /* @__PURE__ */ c(Qt.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ c(
6535
6571
  zo,
6536
6572
  {
@@ -6918,11 +6954,11 @@ function Pn({
6918
6954
  listCheckpoints: y,
6919
6955
  navigateToCheckpoint: x,
6920
6956
  returnToLatest: E
6921
- } = Ua(), [C, I] = ce(""), [N, L] = ce(null), [M, D] = ce(null), [j, K] = ce([]), [W, B] = ce(!1), [q, F] = ce([]), [G, T] = ce(null), P = rt(null), _ = rt(null), O = rt(null), [X, $] = ce("desktop");
6957
+ } = Ua(), [C, I] = ce(""), [N, F] = ce(null), [D, L] = ce(null), [j, K] = ce([]), [W, B] = ce(!1), [q, $] = ce([]), [G, T] = ce(null), P = rt(null), _ = rt(null), O = rt(null), [Y, M] = ce("desktop");
6922
6958
  we(() => {
6923
6959
  const k = () => {
6924
- const Q = window.innerWidth;
6925
- $(Q < 640 ? "phone" : Q < 1024 ? "tablet" : "desktop");
6960
+ const X = window.innerWidth;
6961
+ M(X < 640 ? "phone" : X < 1024 ? "tablet" : "desktop");
6926
6962
  };
6927
6963
  return k(), window.addEventListener("resize", k), () => window.removeEventListener("resize", k);
6928
6964
  }, []), we(() => {
@@ -6936,15 +6972,15 @@ function Pn({
6936
6972
  }, [m, W, f]), we(() => {
6937
6973
  let k = !0;
6938
6974
  if (!d) {
6939
- F([]), T(null);
6975
+ $([]), T(null);
6940
6976
  return;
6941
6977
  }
6942
- return y(d).then((Q) => {
6978
+ return y(d).then((X) => {
6943
6979
  var Re;
6944
6980
  if (!k) return;
6945
- const re = Q.checkpoints || [];
6946
- F(re);
6947
- const ue = ((Re = re.slice().sort(
6981
+ const ne = X.checkpoints || [];
6982
+ $(ne);
6983
+ const ue = ((Re = ne.slice().sort(
6948
6984
  (yt, Se) => new Date(Se.createdAt).getTime() - new Date(yt.createdAt).getTime()
6949
6985
  )[0]) == null ? void 0 : Re.checkpointId) || null;
6950
6986
  T((yt) => yt ?? ue);
@@ -6960,23 +6996,23 @@ function Pn({
6960
6996
  return `Message too long (${k.length}/${Nt} characters)`;
6961
6997
  try {
6962
6998
  return Ip(k), null;
6963
- } catch (Q) {
6964
- return (Q == null ? void 0 : Q.message) || "Invalid message";
6999
+ } catch (X) {
7000
+ return (X == null ? void 0 : X.message) || "Invalid message";
6965
7001
  }
6966
7002
  }, le = (k) => {
6967
- const Q = k.content || [], re = Q.filter((ue) => ue.type === "text").map((ue) => ue.text).join("");
6968
- if (re) return re;
7003
+ const X = k.content || [], ne = X.filter((ue) => ue.type === "text").map((ue) => ue.text).join("");
7004
+ if (ne) return ne;
6969
7005
  try {
6970
- return JSON.stringify(Q, null, 2);
7006
+ return JSON.stringify(X, null, 2);
6971
7007
  } catch {
6972
- return String(Q);
7008
+ return String(X);
6973
7009
  }
6974
- }, ae = (k) => {
7010
+ }, se = (k) => {
6975
7011
  var yt;
6976
7012
  if (!q.length)
6977
7013
  return [];
6978
- const re = (((yt = p[k]) == null ? void 0 : yt.role) ?? "user") === "user", ue = re ? k + 2 : k + 1;
6979
- return q.filter((Se) => (Se.messagesLen ?? -1) >= (re ? ue : 0)).filter((Se) => re ? (Se.messagesLen ?? 0) >= ue : (Se.messagesLen ?? 0) === ue).map((Se) => ({
7014
+ const ne = (((yt = p[k]) == null ? void 0 : yt.role) ?? "user") === "user", ue = ne ? k + 2 : k + 1;
7015
+ return q.filter((Se) => (Se.messagesLen ?? -1) >= (ne ? ue : 0)).filter((Se) => ne ? (Se.messagesLen ?? 0) >= ue : (Se.messagesLen ?? 0) === ue).map((Se) => ({
6980
7016
  checkpoint_id: Se.checkpointId,
6981
7017
  checkpoint_ns: Se.checkpointNs,
6982
7018
  message_count: Se.messagesLen ?? 0,
@@ -6987,58 +7023,58 @@ function Pn({
6987
7023
  }, V = (k) => {
6988
7024
  if (k === void 0)
6989
7025
  return { canGoBack: !1, canGoForward: !1, currentIndex: 0, totalBranches: 0 };
6990
- const Q = ae(k);
6991
- if (Q.length <= 1)
6992
- return { canGoBack: !1, canGoForward: !1, currentIndex: 0, totalBranches: Q.length };
6993
- const re = Math.max(0, Q.findIndex((ue) => ue.isCurrent));
6994
- return { canGoBack: re > 0, canGoForward: re < Q.length - 1, currentIndex: re, totalBranches: Q.length };
6995
- }, oe = async () => {
7026
+ const X = se(k);
7027
+ if (X.length <= 1)
7028
+ return { canGoBack: !1, canGoForward: !1, currentIndex: 0, totalBranches: X.length };
7029
+ const ne = Math.max(0, X.findIndex((ue) => ue.isCurrent));
7030
+ return { canGoBack: ne > 0, canGoForward: ne < X.length - 1, currentIndex: ne, totalBranches: X.length };
7031
+ }, re = async () => {
6996
7032
  const k = C.trim();
6997
7033
  if (!k && j.length === 0) return;
6998
- const Q = z(k);
6999
- if (Q) {
7000
- D(Q);
7034
+ const X = z(k);
7035
+ if (X) {
7036
+ L(X);
7001
7037
  return;
7002
7038
  }
7003
7039
  try {
7004
- const re = window.__editingCheckpointId || G || void 0;
7005
- await h(k, { checkpointId: re, payloadExtras: N ? { edit: !0, originalMessageId: N } : void 0, attachments: j }), u == null || u(k), I(""), D(null), K([]), delete window.__editingCheckpointId, L(null), _.current && (_.current.style.height = "auto");
7006
- } catch (re) {
7007
- const ue = (re == null ? void 0 : re.message) || "Failed to send message";
7008
- D(ue), f == null || f(ue);
7009
- }
7010
- }, ie = (k, Q) => {
7011
- a && (L(k), I(Q), D(null), setTimeout(() => {
7040
+ const ne = window.__editingCheckpointId || G || void 0;
7041
+ await h(k, { checkpointId: ne, payloadExtras: N ? { edit: !0, originalMessageId: N } : void 0, attachments: j }), u == null || u(k), I(""), L(null), K([]), delete window.__editingCheckpointId, F(null), _.current && (_.current.style.height = "auto");
7042
+ } catch (ne) {
7043
+ const ue = (ne == null ? void 0 : ne.message) || "Failed to send message";
7044
+ L(ue), f == null || f(ue);
7045
+ }
7046
+ }, ie = (k, X) => {
7047
+ a && (F(k), I(X), L(null), setTimeout(() => {
7012
7048
  _.current && (_.current.focus(), _.current.style.height = "auto", _.current.style.height = _.current.scrollHeight + "px");
7013
7049
  }, 0));
7014
- }, se = async (k, Q) => {
7015
- const re = p.find((Re) => Re.id === k);
7016
- if (!re) {
7017
- D("Message not found");
7050
+ }, oe = async (k, X) => {
7051
+ const ne = p.find((Re) => Re.id === k);
7052
+ if (!ne) {
7053
+ L("Message not found");
7018
7054
  return;
7019
7055
  }
7020
- const ue = le(re);
7021
- L(k), I(ue), window.__editingCheckpointId = Q, setTimeout(() => {
7056
+ const ue = le(ne);
7057
+ F(k), I(ue), window.__editingCheckpointId = X, setTimeout(() => {
7022
7058
  var Re;
7023
7059
  return (Re = _.current) == null ? void 0 : Re.focus();
7024
7060
  }, 0);
7025
7061
  }, H = () => {
7026
- L(null), I(""), D(null), delete window.__editingCheckpointId, _.current && (_.current.style.height = "auto");
7062
+ F(null), I(""), L(null), delete window.__editingCheckpointId, _.current && (_.current.style.height = "auto");
7027
7063
  }, Z = (k) => {
7028
- k.key === "Enter" && !k.shiftKey ? (k.preventDefault(), oe()) : k.key === "Escape" && N && (k.preventDefault(), H());
7064
+ k.key === "Enter" && !k.shiftKey ? (k.preventDefault(), re()) : k.key === "Escape" && N && (k.preventDefault(), H());
7029
7065
  }, de = (k) => {
7030
- const Q = Array.from(k.target.files || []);
7031
- K((re) => [...re, ...Q]);
7032
- }, pe = (k) => K((Q) => Q.filter((re, ue) => k !== ue)), Y = async (k) => {
7066
+ const X = Array.from(k.target.files || []);
7067
+ K((ne) => [...ne, ...X]);
7068
+ }, he = (k) => K((X) => X.filter((ne, ue) => k !== ue)), me = async (k) => {
7033
7069
  d && (await x(k), T(k));
7034
- }, ge = async () => {
7070
+ }, Q = async () => {
7035
7071
  await E(), T(null);
7036
- }, te = `flex flex-col h-full min-w-0 bg-transparent ${e} ${i.container || ""}`, he = `flex-1 min-h-0 min-w-0 overflow-y-auto p-4 space-y-4 bg-transparent ${i.messagesArea || ""}`, ve = `flex-shrink-0 border-t p-4 bg-transparent ${i.inputArea || ""}`;
7037
- return /* @__PURE__ */ R("div", { className: te, children: [
7072
+ }, ve = `flex flex-col h-full min-w-0 bg-transparent ${e} ${i.container || ""}`, ae = `flex-1 min-h-0 min-w-0 overflow-y-auto p-4 space-y-4 bg-transparent ${i.messagesArea || ""}`, fe = `flex-shrink-0 border-t p-4 bg-transparent ${i.inputArea || ""}`;
7073
+ return /* @__PURE__ */ R("div", { className: ve, children: [
7038
7074
  !!m && !W && /* @__PURE__ */ R("div", { className: "bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
7039
7075
  /* @__PURE__ */ c("span", { children: m }),
7040
7076
  /* @__PURE__ */ c(
7041
- fe,
7077
+ pe,
7042
7078
  {
7043
7079
  variant: "ghost",
7044
7080
  size: "sm",
@@ -7058,12 +7094,12 @@ function Pn({
7058
7094
  className: "border rounded px-2 py-1 text-xs",
7059
7095
  value: G ?? "",
7060
7096
  onChange: (k) => {
7061
- const Q = k.target.value || null;
7062
- Q ? Y(Q) : ge();
7097
+ const X = k.target.value || null;
7098
+ X ? me(X) : Q();
7063
7099
  },
7064
7100
  children: [
7065
7101
  /* @__PURE__ */ c("option", { value: "", children: "Latest" }),
7066
- q.slice().sort((k, Q) => new Date(Q.createdAt).getTime() - new Date(k.createdAt).getTime()).map((k) => /* @__PURE__ */ R("option", { value: k.checkpointId, children: [
7102
+ q.slice().sort((k, X) => new Date(X.createdAt).getTime() - new Date(k.createdAt).getTime()).map((k) => /* @__PURE__ */ R("option", { value: k.checkpointId, children: [
7067
7103
  new Date(k.createdAt).toLocaleString(),
7068
7104
  k.preview ? ` — ${k.preview.slice(0, 30)}` : ""
7069
7105
  ] }, k.checkpointId))
@@ -7071,54 +7107,54 @@ function Pn({
7071
7107
  }
7072
7108
  )
7073
7109
  ] }),
7074
- /* @__PURE__ */ R("div", { className: he, style: r ? { maxHeight: r } : void 0, children: [
7075
- p.length === 0 ? /* @__PURE__ */ c("div", { className: "flex items-center justify-center py-8 text-muted-foreground", children: "No messages yet. Start a conversation!" }) : p.map((k, Q) => /* @__PURE__ */ c(
7110
+ /* @__PURE__ */ R("div", { className: ae, style: r ? { maxHeight: r } : void 0, children: [
7111
+ p.length === 0 ? /* @__PURE__ */ c("div", { className: "flex items-center justify-center py-8 text-muted-foreground", children: "No messages yet. Start a conversation!" }) : p.map((k, X) => /* @__PURE__ */ c(
7076
7112
  gp,
7077
7113
  {
7078
7114
  message: k,
7079
- messageIndex: Q,
7115
+ messageIndex: X,
7080
7116
  isStreamingMessage: g && v === k.id,
7081
7117
  streamingDebounceMs: o,
7082
7118
  isEditing: N === k.id,
7083
7119
  showActions: a,
7084
7120
  showTimestamp: !1,
7085
7121
  showAgentName: !0,
7086
- layoutSize: X,
7122
+ layoutSize: Y,
7087
7123
  truncateToolMessages: !1,
7088
7124
  toolMessagePreviewLength: 200,
7089
- checkpointBranches: ae(Q),
7125
+ checkpointBranches: se(X),
7090
7126
  currentCheckpointId: G ?? void 0,
7091
- temporalNavigation: V(Q),
7092
- onSwitchToCheckpoint: Y,
7093
- onReturnToMainThread: ge,
7127
+ temporalNavigation: V(X),
7128
+ onSwitchToCheckpoint: me,
7129
+ onReturnToMainThread: Q,
7094
7130
  onNavigateToPreviousBranch: () => {
7095
- const re = ae(Q), ue = Math.max(0, re.findIndex((Re) => Re.isCurrent));
7096
- ue > 0 && Y(re[ue - 1].checkpoint_id);
7131
+ const ne = se(X), ue = Math.max(0, ne.findIndex((Re) => Re.isCurrent));
7132
+ ue > 0 && me(ne[ue - 1].checkpoint_id);
7097
7133
  },
7098
7134
  onNavigateToNextBranch: () => {
7099
- const re = ae(Q), ue = Math.max(0, re.findIndex((Re) => Re.isCurrent));
7100
- ue >= 0 && ue < re.length - 1 && Y(re[ue + 1].checkpoint_id);
7135
+ const ne = se(X), ue = Math.max(0, ne.findIndex((Re) => Re.isCurrent));
7136
+ ue >= 0 && ue < ne.length - 1 && me(ne[ue + 1].checkpoint_id);
7101
7137
  },
7102
- onEdit: (re, ue) => ie(re, ue),
7103
- onEditFromCheckpoint: se,
7138
+ onEdit: (ne, ue) => ie(ne, ue),
7139
+ onEditFromCheckpoint: oe,
7104
7140
  onRegenerate: () => {
7105
- const re = [...p].reverse().find((Re) => Re.role === "user"), ue = re ? le(re) : "";
7141
+ const ne = [...p].reverse().find((Re) => Re.role === "user"), ue = ne ? le(ne) : "";
7106
7142
  ue && h(ue, { checkpointId: G ?? void 0 });
7107
7143
  },
7108
7144
  onCancelEdit: H
7109
7145
  },
7110
- k.id || Q
7146
+ k.id || X
7111
7147
  )),
7112
7148
  /* @__PURE__ */ c("div", { ref: P })
7113
7149
  ] }),
7114
- /* @__PURE__ */ R("div", { className: ve, children: [
7150
+ /* @__PURE__ */ R("div", { className: fe, children: [
7115
7151
  N && /* @__PURE__ */ c("div", { className: "mb-3 p-3 bg-blue-50 border border-blue-200 rounded-lg", children: /* @__PURE__ */ R("div", { className: "flex items-center justify-between", children: [
7116
7152
  /* @__PURE__ */ R("div", { className: "flex items-center gap-2", children: [
7117
7153
  /* @__PURE__ */ c(fa, { size: 16, className: "text-blue-600" }),
7118
7154
  /* @__PURE__ */ c("span", { className: "text-sm font-medium text-blue-800", children: "Editing message" })
7119
7155
  ] }),
7120
7156
  /* @__PURE__ */ c(
7121
- fe,
7157
+ pe,
7122
7158
  {
7123
7159
  variant: "ghost",
7124
7160
  size: "sm",
@@ -7139,27 +7175,27 @@ function Pn({
7139
7175
  className: "hidden"
7140
7176
  }
7141
7177
  ),
7142
- j.length > 0 && /* @__PURE__ */ c("div", { className: "mb-3 flex flex-wrap gap-2", children: j.map((k, Q) => /* @__PURE__ */ R("div", { className: "flex items-center gap-2 bg-gray-100 rounded-lg px-3 py-2 text-sm", children: [
7178
+ j.length > 0 && /* @__PURE__ */ c("div", { className: "mb-3 flex flex-wrap gap-2", children: j.map((k, X) => /* @__PURE__ */ R("div", { className: "flex items-center gap-2 bg-gray-100 rounded-lg px-3 py-2 text-sm", children: [
7143
7179
  /* @__PURE__ */ c(ss, { size: 14 }),
7144
7180
  /* @__PURE__ */ c("span", { className: "truncate max-w-[150px]", children: k.name }),
7145
7181
  /* @__PURE__ */ c(
7146
- fe,
7182
+ pe,
7147
7183
  {
7148
7184
  variant: "ghost",
7149
7185
  size: "sm",
7150
- onClick: () => pe(Q),
7186
+ onClick: () => he(X),
7151
7187
  className: "h-4 w-4 p-0 text-gray-500 hover:text-red-500",
7152
7188
  "aria-label": `Remove ${k.name}`,
7153
7189
  children: /* @__PURE__ */ c(Kt, { size: 12 })
7154
7190
  }
7155
7191
  )
7156
- ] }, Q)) })
7192
+ ] }, X)) })
7157
7193
  ] }),
7158
- M && /* @__PURE__ */ c("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: M }),
7194
+ D && /* @__PURE__ */ c("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: D }),
7159
7195
  /* @__PURE__ */ R("div", { className: "flex items-end gap-2", children: [
7160
7196
  s && /* @__PURE__ */ R(wb, { children: [
7161
7197
  /* @__PURE__ */ c(yb, { asChild: !0, children: /* @__PURE__ */ c(
7162
- fe,
7198
+ pe,
7163
7199
  {
7164
7200
  type: "button",
7165
7201
  size: "icon",
@@ -7184,18 +7220,18 @@ function Pn({
7184
7220
  ref: _,
7185
7221
  value: C,
7186
7222
  onChange: (k) => {
7187
- I(k.target.value), D(null), _.current && (_.current.style.height = "auto", _.current.style.height = `${_.current.scrollHeight}px`);
7223
+ I(k.target.value), L(null), _.current && (_.current.style.height = "auto", _.current.style.height = `${_.current.scrollHeight}px`);
7188
7224
  },
7189
7225
  onKeyDown: Z,
7190
7226
  placeholder: N ? "Edit your message..." : t,
7191
- className: `resize-none min-h-[44px] max-h-[20rem] w-full ${N ? "border-blue-400 bg-blue-50" : ""} ${M ? "border-red-400" : ""} ${i.textarea || ""}`,
7227
+ className: `resize-none min-h-[44px] max-h-[20rem] w-full ${N ? "border-blue-400 bg-blue-50" : ""} ${D ? "border-red-400" : ""} ${i.textarea || ""}`,
7192
7228
  disabled: !1,
7193
7229
  maxLength: Nt,
7194
7230
  rows: 1
7195
7231
  }
7196
7232
  ) }),
7197
7233
  /* @__PURE__ */ c("div", { children: g ? /* @__PURE__ */ c(
7198
- fe,
7234
+ pe,
7199
7235
  {
7200
7236
  type: "button",
7201
7237
  onClick: b,
@@ -7206,10 +7242,10 @@ function Pn({
7206
7242
  children: /* @__PURE__ */ c(Wu, { size: 16 })
7207
7243
  }
7208
7244
  ) : /* @__PURE__ */ c(
7209
- fe,
7245
+ pe,
7210
7246
  {
7211
7247
  type: "button",
7212
- onClick: oe,
7248
+ onClick: re,
7213
7249
  size: "icon",
7214
7250
  disabled: !C.trim() && j.length === 0,
7215
7251
  className: `shrink-0 ${i.sendButton || ""}`,
@@ -7255,13 +7291,13 @@ var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, Me] = Ac(jo), Pc = l.forwardRef(
7255
7291
  dir: o,
7256
7292
  scrollHideDelay: s = 600,
7257
7293
  ...a
7258
- } = e, [i, u] = l.useState(null), [f, d] = l.useState(null), [p, g] = l.useState(null), [v, m] = l.useState(null), [h, b] = l.useState(null), [w, y] = l.useState(0), [x, E] = l.useState(0), [C, I] = l.useState(!1), [N, L] = l.useState(!1), M = ne(t, (j) => u(j)), D = tr(o);
7294
+ } = e, [i, u] = l.useState(null), [f, d] = l.useState(null), [p, g] = l.useState(null), [v, m] = l.useState(null), [h, b] = l.useState(null), [w, y] = l.useState(0), [x, E] = l.useState(0), [C, I] = l.useState(!1), [N, F] = l.useState(!1), D = te(t, (j) => u(j)), L = tr(o);
7259
7295
  return /* @__PURE__ */ c(
7260
7296
  Ab,
7261
7297
  {
7262
7298
  scope: n,
7263
7299
  type: r,
7264
- dir: D,
7300
+ dir: L,
7265
7301
  scrollHideDelay: s,
7266
7302
  scrollArea: i,
7267
7303
  viewport: f,
@@ -7275,15 +7311,15 @@ var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, Me] = Ac(jo), Pc = l.forwardRef(
7275
7311
  scrollbarY: h,
7276
7312
  onScrollbarYChange: b,
7277
7313
  scrollbarYEnabled: N,
7278
- onScrollbarYEnabledChange: L,
7314
+ onScrollbarYEnabledChange: F,
7279
7315
  onCornerWidthChange: y,
7280
7316
  onCornerHeightChange: E,
7281
7317
  children: /* @__PURE__ */ c(
7282
7318
  J.div,
7283
7319
  {
7284
- dir: D,
7320
+ dir: L,
7285
7321
  ...a,
7286
- ref: M,
7322
+ ref: D,
7287
7323
  style: {
7288
7324
  position: "relative",
7289
7325
  // Pass corner sizes as CSS vars to reduce re-renders of context consumers
@@ -7300,7 +7336,7 @@ var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, Me] = Ac(jo), Pc = l.forwardRef(
7300
7336
  Pc.displayName = jo;
7301
7337
  var _c = "ScrollAreaViewport", Ic = l.forwardRef(
7302
7338
  (e, t) => {
7303
- const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, a = Me(_c, n), i = l.useRef(null), u = ne(t, i, a.onViewportChange);
7339
+ const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, a = Me(_c, n), i = l.useRef(null), u = te(t, i, a.onViewportChange);
7304
7340
  return /* @__PURE__ */ R(De, { children: [
7305
7341
  /* @__PURE__ */ c(
7306
7342
  "style",
@@ -7486,7 +7522,7 @@ var Pb = l.forwardRef((e, t) => {
7486
7522
  }
7487
7523
  ) : null;
7488
7524
  }), Ib = l.forwardRef((e, t) => {
7489
- const { sizes: n, onSizesChange: r, ...o } = e, s = Me(Ye, e.__scopeScrollArea), [a, i] = l.useState(), u = l.useRef(null), f = ne(t, u, s.onScrollbarXChange);
7525
+ const { sizes: n, onSizesChange: r, ...o } = e, s = Me(Ye, e.__scopeScrollArea), [a, i] = l.useState(), u = l.useRef(null), f = te(t, u, s.onScrollbarXChange);
7490
7526
  return l.useEffect(() => {
7491
7527
  u.current && i(getComputedStyle(u.current));
7492
7528
  }, [u]), /* @__PURE__ */ c(
@@ -7525,7 +7561,7 @@ var Pb = l.forwardRef((e, t) => {
7525
7561
  }
7526
7562
  );
7527
7563
  }), Ob = l.forwardRef((e, t) => {
7528
- const { sizes: n, onSizesChange: r, ...o } = e, s = Me(Ye, e.__scopeScrollArea), [a, i] = l.useState(), u = l.useRef(null), f = ne(t, u, s.onScrollbarYChange);
7564
+ const { sizes: n, onSizesChange: r, ...o } = e, s = Me(Ye, e.__scopeScrollArea), [a, i] = l.useState(), u = l.useRef(null), f = te(t, u, s.onScrollbarYChange);
7529
7565
  return l.useEffect(() => {
7530
7566
  u.current && i(getComputedStyle(u.current));
7531
7567
  }, [u]), /* @__PURE__ */ c(
@@ -7577,19 +7613,19 @@ var Pb = l.forwardRef((e, t) => {
7577
7613
  onWheelScroll: d,
7578
7614
  onResize: p,
7579
7615
  ...g
7580
- } = e, v = Me(Ye, n), [m, h] = l.useState(null), b = ne(t, (M) => h(M)), w = l.useRef(null), y = l.useRef(""), x = v.viewport, E = r.content - r.viewport, C = ye(d), I = ye(u), N = hr(p, 10);
7581
- function L(M) {
7616
+ } = e, v = Me(Ye, n), [m, h] = l.useState(null), b = te(t, (D) => h(D)), w = l.useRef(null), y = l.useRef(""), x = v.viewport, E = r.content - r.viewport, C = ye(d), I = ye(u), N = hr(p, 10);
7617
+ function F(D) {
7582
7618
  if (w.current) {
7583
- const D = M.clientX - w.current.left, j = M.clientY - w.current.top;
7584
- f({ x: D, y: j });
7619
+ const L = D.clientX - w.current.left, j = D.clientY - w.current.top;
7620
+ f({ x: L, y: j });
7585
7621
  }
7586
7622
  }
7587
7623
  return l.useEffect(() => {
7588
- const M = (D) => {
7589
- const j = D.target;
7590
- (m == null ? void 0 : m.contains(j)) && C(D, E);
7624
+ const D = (L) => {
7625
+ const j = L.target;
7626
+ (m == null ? void 0 : m.contains(j)) && C(L, E);
7591
7627
  };
7592
- return document.addEventListener("wheel", M, { passive: !1 }), () => document.removeEventListener("wheel", M, { passive: !1 });
7628
+ return document.addEventListener("wheel", D, { passive: !1 }), () => document.removeEventListener("wheel", D, { passive: !1 });
7593
7629
  }, [x, m, E, C]), l.useEffect(I, [r, I]), Mt(m, N), Mt(v.content, N), /* @__PURE__ */ c(
7594
7630
  Mb,
7595
7631
  {
@@ -7606,13 +7642,13 @@ var Pb = l.forwardRef((e, t) => {
7606
7642
  ...g,
7607
7643
  ref: b,
7608
7644
  style: { position: "absolute", ...g.style },
7609
- onPointerDown: U(e.onPointerDown, (M) => {
7610
- M.button === 0 && (M.target.setPointerCapture(M.pointerId), w.current = m.getBoundingClientRect(), y.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", v.viewport && (v.viewport.style.scrollBehavior = "auto"), L(M));
7645
+ onPointerDown: U(e.onPointerDown, (D) => {
7646
+ D.button === 0 && (D.target.setPointerCapture(D.pointerId), w.current = m.getBoundingClientRect(), y.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", v.viewport && (v.viewport.style.scrollBehavior = "auto"), F(D));
7611
7647
  }),
7612
- onPointerMove: U(e.onPointerMove, L),
7613
- onPointerUp: U(e.onPointerUp, (M) => {
7614
- const D = M.target;
7615
- D.hasPointerCapture(M.pointerId) && D.releasePointerCapture(M.pointerId), document.body.style.webkitUserSelect = y.current, v.viewport && (v.viewport.style.scrollBehavior = ""), w.current = null;
7648
+ onPointerMove: U(e.onPointerMove, F),
7649
+ onPointerUp: U(e.onPointerUp, (D) => {
7650
+ const L = D.target;
7651
+ L.hasPointerCapture(D.pointerId) && L.releasePointerCapture(D.pointerId), document.body.style.webkitUserSelect = y.current, v.viewport && (v.viewport.style.scrollBehavior = ""), w.current = null;
7616
7652
  })
7617
7653
  }
7618
7654
  )
@@ -7625,7 +7661,7 @@ var Pb = l.forwardRef((e, t) => {
7625
7661
  }
7626
7662
  ), kb = l.forwardRef(
7627
7663
  (e, t) => {
7628
- const { __scopeScrollArea: n, style: r, ...o } = e, s = Me(Vn, n), a = Mc(Vn, n), { onThumbPositionChange: i } = a, u = ne(
7664
+ const { __scopeScrollArea: n, style: r, ...o } = e, s = Me(Vn, n), a = Mc(Vn, n), { onThumbPositionChange: i } = a, u = te(
7629
7665
  t,
7630
7666
  (p) => a.onThumbChange(p)
7631
7667
  ), f = l.useRef(void 0), d = hr(() => {
@@ -7806,58 +7842,58 @@ function oo({
7806
7842
  createThread: h,
7807
7843
  deleteThread: b,
7808
7844
  renameThread: w
7809
- } = Ua(), [y, x] = ce(g ?? []), [E, C] = ce(!1), [I, N] = ce(null), [L, M] = ce(null), [D, j] = ce(""), [K, W] = ce(!1);
7845
+ } = Ua(), [y, x] = ce(g ?? []), [E, C] = ce(!1), [I, N] = ce(null), [F, D] = ce(null), [L, j] = ce(""), [K, W] = ce(!1);
7810
7846
  we(() => {
7811
7847
  x(g ?? []);
7812
7848
  }, [g]);
7813
- const B = async ($) => {
7849
+ const B = async (M) => {
7814
7850
  try {
7815
- await p($), i == null || i($), u == null || u($);
7851
+ await p(M), i == null || i(M), u == null || u(M);
7816
7852
  } catch (z) {
7817
7853
  console.error("Failed to select thread:", z);
7818
7854
  }
7819
7855
  }, q = async () => {
7820
7856
  try {
7821
7857
  W(!0);
7822
- const $ = await h();
7823
- f == null || f($), i == null || i($);
7824
- } catch ($) {
7825
- console.error("Failed to create thread:", $);
7858
+ const M = await h();
7859
+ f == null || f(M), i == null || i(M);
7860
+ } catch (M) {
7861
+ console.error("Failed to create thread:", M);
7826
7862
  } finally {
7827
7863
  W(!1);
7828
7864
  }
7829
- }, F = async ($, z) => {
7865
+ }, $ = async (M, z) => {
7830
7866
  if (z.stopPropagation(), !!confirm("Delete this thread?"))
7831
7867
  try {
7832
- await b($), d == null || d($);
7868
+ await b(M), d == null || d(M);
7833
7869
  } catch (le) {
7834
7870
  console.error("Failed to delete thread:", le);
7835
7871
  }
7836
- }, G = ($, z) => {
7837
- z.stopPropagation(), M($.threadId), j($.title || `Thread ${$.threadId.slice(0, 8)}`);
7838
- }, T = async ($) => {
7839
- if (D.trim())
7872
+ }, G = (M, z) => {
7873
+ z.stopPropagation(), D(M.threadId), j(M.title || `Thread ${M.threadId.slice(0, 8)}`);
7874
+ }, T = async (M) => {
7875
+ if (L.trim())
7840
7876
  try {
7841
- await w($, D.trim()), M(null), j("");
7877
+ await w(M, L.trim()), D(null), j("");
7842
7878
  } catch (z) {
7843
7879
  console.error("Failed to update title:", z);
7844
7880
  }
7845
7881
  }, P = () => {
7846
- M(null), j("");
7847
- }, _ = ($, z) => {
7848
- $.key === "Enter" ? T(z) : $.key === "Escape" && P();
7849
- }, O = ($) => {
7850
- if (!$) return "";
7882
+ D(null), j("");
7883
+ }, _ = (M, z) => {
7884
+ M.key === "Enter" ? T(z) : M.key === "Escape" && P();
7885
+ }, O = (M) => {
7886
+ if (!M) return "";
7851
7887
  try {
7852
- const z = new Date($), ae = (/* @__PURE__ */ new Date()).getTime() - z.getTime(), V = Math.floor(ae / (1e3 * 60 * 60 * 24));
7888
+ const z = new Date(M), se = (/* @__PURE__ */ new Date()).getTime() - z.getTime(), V = Math.floor(se / (1e3 * 60 * 60 * 24));
7853
7889
  return V === 0 ? z.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : V === 1 ? "Yesterday" : V < 7 ? `${V} days ago` : z.toLocaleDateString();
7854
7890
  } catch {
7855
7891
  return "";
7856
7892
  }
7857
- }, X = ($) => $.title || `Thread ${$.threadId.slice(0, 8)}`;
7893
+ }, Y = (M) => M.title || `Thread ${M.threadId.slice(0, 8)}`;
7858
7894
  return /* @__PURE__ */ R("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
7859
7895
  t && /* @__PURE__ */ c("div", { className: s.header || "flex-shrink-0 p-2 border-b bg-slate-800 border-slate-700 text-slate-100 flex justify-end", children: /* @__PURE__ */ c(
7860
- fe,
7896
+ pe,
7861
7897
  {
7862
7898
  onClick: q,
7863
7899
  disabled: K || E,
@@ -7871,32 +7907,32 @@ function oo({
7871
7907
  /* @__PURE__ */ c(zc, { className: `flex-1 ${s.threadList || ""}`, style: { maxHeight: o }, children: /* @__PURE__ */ c("div", { className: "p-2 space-y-1 pb-4", children: E ? /* @__PURE__ */ c("div", { className: "text-center py-8 text-slate-400", children: "Loading…" }) : y.length === 0 ? /* @__PURE__ */ R("div", { className: "text-center py-8 text-slate-400", children: [
7872
7908
  /* @__PURE__ */ c(Ku, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
7873
7909
  /* @__PURE__ */ c("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
7874
- ] }) : y.slice().sort(($, z) => new Date(z.updatedAt || z.createdAt || "").getTime() - new Date($.updatedAt || $.createdAt || "").getTime()).map(($) => /* @__PURE__ */ R(
7910
+ ] }) : y.slice().sort((M, z) => new Date(z.updatedAt || z.createdAt || "").getTime() - new Date(M.updatedAt || M.createdAt || "").getTime()).map((M) => /* @__PURE__ */ R(
7875
7911
  "div",
7876
7912
  {
7877
- onClick: () => B($.threadId),
7878
- className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(a ?? m) === $.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
7913
+ onClick: () => B(M.threadId),
7914
+ className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(a ?? m) === M.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
7879
7915
  children: [
7880
7916
  /* @__PURE__ */ R("div", { className: "flex items-center justify-between", children: [
7881
- /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: L === $.threadId ? /* @__PURE__ */ R("div", { className: "flex items-center gap-2", onClick: (z) => z.stopPropagation(), children: [
7882
- /* @__PURE__ */ c(tn, { value: D, onChange: (z) => j(z.target.value), onKeyDown: (z) => _(z, $.threadId), className: "h-6 text-sm", autoFocus: !0 }),
7883
- /* @__PURE__ */ c(fe, { variant: "ghost", size: "sm", onClick: () => T($.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ c(mo, { size: 12 }) }),
7884
- /* @__PURE__ */ c(fe, { variant: "ghost", size: "sm", onClick: P, className: "h-6 w-6 p-0", children: /* @__PURE__ */ c(Kt, { size: 12 }) })
7917
+ /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: F === M.threadId ? /* @__PURE__ */ R("div", { className: "flex items-center gap-2", onClick: (z) => z.stopPropagation(), children: [
7918
+ /* @__PURE__ */ c(tn, { value: L, onChange: (z) => j(z.target.value), onKeyDown: (z) => _(z, M.threadId), className: "h-6 text-sm", autoFocus: !0 }),
7919
+ /* @__PURE__ */ c(pe, { variant: "ghost", size: "sm", onClick: () => T(M.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ c(mo, { size: 12 }) }),
7920
+ /* @__PURE__ */ c(pe, { variant: "ghost", size: "sm", onClick: P, className: "h-6 w-6 p-0", children: /* @__PURE__ */ c(Kt, { size: 12 }) })
7885
7921
  ] }) : /* @__PURE__ */ R(De, { children: [
7886
- /* @__PURE__ */ c("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: X($) }),
7922
+ /* @__PURE__ */ c("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Y(M) }),
7887
7923
  /* @__PURE__ */ R("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
7888
7924
  /* @__PURE__ */ c(Gu, { size: 10 }),
7889
- /* @__PURE__ */ c("span", { children: O($.updatedAt || $.createdAt) })
7925
+ /* @__PURE__ */ c("span", { children: O(M.updatedAt || M.createdAt) })
7890
7926
  ] })
7891
7927
  ] }) }),
7892
7928
  /* @__PURE__ */ R("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
7893
- r && L !== $.threadId && /* @__PURE__ */ c(fe, { variant: "ghost", size: "sm", onClick: (z) => G($, z), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ c(fa, { size: 12 }) }),
7929
+ r && F !== M.threadId && /* @__PURE__ */ c(pe, { variant: "ghost", size: "sm", onClick: (z) => G(M, z), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ c(fa, { size: 12 }) }),
7894
7930
  n && /* @__PURE__ */ c(
7895
- fe,
7931
+ pe,
7896
7932
  {
7897
7933
  variant: "ghost",
7898
7934
  size: "sm",
7899
- onClick: (z) => F($.threadId, z),
7935
+ onClick: (z) => $(M.threadId, z),
7900
7936
  className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
7901
7937
  title: "Delete thread",
7902
7938
  children: /* @__PURE__ */ c(qu, { size: 12 })
@@ -7904,10 +7940,10 @@ function oo({
7904
7940
  )
7905
7941
  ] })
7906
7942
  ] }),
7907
- a === $.threadId && /* @__PURE__ */ c("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
7943
+ a === M.threadId && /* @__PURE__ */ c("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
7908
7944
  ]
7909
7945
  },
7910
- $.threadId
7946
+ M.threadId
7911
7947
  )) }) })
7912
7948
  ] });
7913
7949
  }
@@ -8070,7 +8106,7 @@ var mr = "Dialog", [Gc, Py] = Ue(mr), [Yb, ze] = Gc(mr), qc = (e) => {
8070
8106
  qc.displayName = mr;
8071
8107
  var Xc = "DialogTrigger", Yc = l.forwardRef(
8072
8108
  (e, t) => {
8073
- const { __scopeDialog: n, ...r } = e, o = ze(Xc, n), s = ne(t, o.triggerRef);
8109
+ const { __scopeDialog: n, ...r } = e, o = ze(Xc, n), s = te(t, o.triggerRef);
8074
8110
  return /* @__PURE__ */ c(
8075
8111
  J.button,
8076
8112
  {
@@ -8127,7 +8163,7 @@ var Zb = _t("DialogOverlay.RemoveScroll"), Qb = l.forwardRef(
8127
8163
  el.displayName = mt;
8128
8164
  var ev = l.forwardRef(
8129
8165
  (e, t) => {
8130
- const n = ze(mt, e.__scopeDialog), r = l.useRef(null), o = ne(t, n.contentRef, r);
8166
+ const n = ze(mt, e.__scopeDialog), r = l.useRef(null), o = te(t, n.contentRef, r);
8131
8167
  return l.useEffect(() => {
8132
8168
  const s = r.current;
8133
8169
  if (s) return Fo(s);
@@ -8178,7 +8214,7 @@ var ev = l.forwardRef(
8178
8214
  }
8179
8215
  ), tl = l.forwardRef(
8180
8216
  (e, t) => {
8181
- const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...a } = e, i = ze(mt, n), u = l.useRef(null), f = ne(t, u);
8217
+ const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...a } = e, i = ze(mt, n), u = l.useRef(null), f = te(t, u);
8182
8218
  return Eo(), /* @__PURE__ */ R(De, { children: [
8183
8219
  /* @__PURE__ */ c(
8184
8220
  nr,
@@ -8465,7 +8501,7 @@ var nn = "Tooltip", [gv, vr] = gr(nn), Sl = (e) => {
8465
8501
  Sl.displayName = nn;
8466
8502
  var ao = "TooltipTrigger", Cl = l.forwardRef(
8467
8503
  (e, t) => {
8468
- const { __scopeTooltip: n, ...r } = e, o = vr(ao, n), s = es(ao, n), a = br(n), i = l.useRef(null), u = ne(t, i, o.onTriggerChange), f = l.useRef(!1), d = l.useRef(!1), p = l.useCallback(() => f.current = !1, []);
8504
+ const { __scopeTooltip: n, ...r } = e, o = vr(ao, n), s = es(ao, n), a = br(n), i = l.useRef(null), u = te(t, i, o.onTriggerChange), f = l.useRef(!1), d = l.useRef(!1), p = l.useCallback(() => f.current = !1, []);
8469
8505
  return l.useEffect(() => () => document.removeEventListener("pointerup", p), [p]), /* @__PURE__ */ c(ko, { asChild: !0, ...a, children: /* @__PURE__ */ c(
8470
8506
  J.button,
8471
8507
  {
@@ -8500,7 +8536,7 @@ var bv = "TooltipPortal", [Oy, vv] = gr(bv, {
8500
8536
  return /* @__PURE__ */ c(Ae, { present: r || a.open, children: a.disableHoverableContent ? /* @__PURE__ */ c(Rl, { side: o, ...s, ref: t }) : /* @__PURE__ */ c(wv, { side: o, ...s, ref: t }) });
8501
8537
  }
8502
8538
  ), wv = l.forwardRef((e, t) => {
8503
- const n = vr(kt, e.__scopeTooltip), r = es(kt, e.__scopeTooltip), o = l.useRef(null), s = ne(t, o), [a, i] = l.useState(null), { trigger: u, onClose: f } = n, d = o.current, { onPointerInTransitChange: p } = r, g = l.useCallback(() => {
8539
+ const n = vr(kt, e.__scopeTooltip), r = es(kt, e.__scopeTooltip), o = l.useRef(null), s = te(t, o), [a, i] = l.useState(null), { trigger: u, onClose: f } = n, d = o.current, { onPointerInTransitChange: p } = r, g = l.useCallback(() => {
8504
8540
  i(null), p(!1);
8505
8541
  }, [p]), v = l.useCallback(
8506
8542
  (m, h) => {
@@ -8840,7 +8876,7 @@ Il.displayName = "Sidebar";
8840
8876
  const Ol = l.forwardRef(({ className: e, onClick: t, ...n }, r) => {
8841
8877
  const { toggleSidebar: o } = wr();
8842
8878
  return /* @__PURE__ */ R(
8843
- fe,
8879
+ pe,
8844
8880
  {
8845
8881
  ref: r,
8846
8882
  "data-sidebar": "trigger",
@@ -9261,7 +9297,7 @@ var yr = "Switch", [nw, ky] = Ue(yr), [rw, ow] = nw(yr), jl = l.forwardRef(
9261
9297
  onCheckedChange: f,
9262
9298
  form: d,
9263
9299
  ...p
9264
- } = e, [g, v] = l.useState(null), m = ne(t, (x) => v(x)), h = l.useRef(!1), b = g ? d || !!g.closest("form") : !0, [w, y] = ot({
9300
+ } = e, [g, v] = l.useState(null), m = te(t, (x) => v(x)), h = l.useRef(!1), b = g ? d || !!g.closest("form") : !0, [w, y] = ot({
9265
9301
  prop: o,
9266
9302
  defaultProp: s ?? !1,
9267
9303
  onChange: f,
@@ -9327,7 +9363,7 @@ var sw = "SwitchBubbleInput", ql = l.forwardRef(
9327
9363
  bubbles: r = !0,
9328
9364
  ...o
9329
9365
  }, s) => {
9330
- const a = l.useRef(null), i = ne(a, s), u = Vl(n), f = li(t);
9366
+ const a = l.useRef(null), i = te(a, s), u = Vl(n), f = li(t);
9331
9367
  return l.useEffect(() => {
9332
9368
  const d = a.current;
9333
9369
  if (!d) return;
@@ -9404,17 +9440,17 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
9404
9440
  disabled: g,
9405
9441
  required: v,
9406
9442
  form: m
9407
- } = e, h = Cr(t), [b, w] = l.useState(null), [y, x] = l.useState(null), [E, C] = l.useState(!1), I = tr(f), [N, L] = ot({
9443
+ } = e, h = Cr(t), [b, w] = l.useState(null), [y, x] = l.useState(null), [E, C] = l.useState(!1), I = tr(f), [N, F] = ot({
9408
9444
  prop: r,
9409
9445
  defaultProp: o ?? !1,
9410
9446
  onChange: s,
9411
9447
  caller: gt
9412
- }), [M, D] = ot({
9448
+ }), [D, L] = ot({
9413
9449
  prop: a,
9414
9450
  defaultProp: i,
9415
9451
  onChange: u,
9416
9452
  caller: gt
9417
- }), j = l.useRef(null), K = b ? m || !!b.closest("form") : !0, [W, B] = l.useState(/* @__PURE__ */ new Set()), q = Array.from(W).map((F) => F.props.value).join(";");
9453
+ }), j = l.useRef(null), K = b ? m || !!b.closest("form") : !0, [W, B] = l.useState(/* @__PURE__ */ new Set()), q = Array.from(W).map(($) => $.props.value).join(";");
9418
9454
  return /* @__PURE__ */ c(Mo, { ...h, children: /* @__PURE__ */ R(
9419
9455
  uw,
9420
9456
  {
@@ -9427,10 +9463,10 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
9427
9463
  valueNodeHasChildren: E,
9428
9464
  onValueNodeHasChildrenChange: C,
9429
9465
  contentId: Le(),
9430
- value: M,
9431
- onValueChange: D,
9466
+ value: D,
9467
+ onValueChange: L,
9432
9468
  open: N,
9433
- onOpenChange: L,
9469
+ onOpenChange: F,
9434
9470
  dir: I,
9435
9471
  triggerPointerDownPosRef: j,
9436
9472
  disabled: g,
@@ -9439,13 +9475,13 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
9439
9475
  dw,
9440
9476
  {
9441
9477
  scope: e.__scopeSelect,
9442
- onNativeOptionAdd: l.useCallback((F) => {
9443
- B((G) => new Set(G).add(F));
9478
+ onNativeOptionAdd: l.useCallback(($) => {
9479
+ B((G) => new Set(G).add($));
9444
9480
  }, []),
9445
- onNativeOptionRemove: l.useCallback((F) => {
9481
+ onNativeOptionRemove: l.useCallback(($) => {
9446
9482
  B((G) => {
9447
9483
  const T = new Set(G);
9448
- return T.delete(F), T;
9484
+ return T.delete($), T;
9449
9485
  });
9450
9486
  }, []),
9451
9487
  children: n
@@ -9459,12 +9495,12 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
9459
9495
  tabIndex: -1,
9460
9496
  name: d,
9461
9497
  autoComplete: p,
9462
- value: M,
9463
- onChange: (F) => D(F.target.value),
9498
+ value: D,
9499
+ onChange: ($) => L($.target.value),
9464
9500
  disabled: g,
9465
9501
  form: m,
9466
9502
  children: [
9467
- M === void 0 ? /* @__PURE__ */ c("option", { value: "" }) : null,
9503
+ D === void 0 ? /* @__PURE__ */ c("option", { value: "" }) : null,
9468
9504
  Array.from(W)
9469
9505
  ]
9470
9506
  },
@@ -9477,7 +9513,7 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
9477
9513
  Jl.displayName = gt;
9478
9514
  var Zl = "SelectTrigger", Ql = l.forwardRef(
9479
9515
  (e, t) => {
9480
- const { __scopeSelect: n, disabled: r = !1, ...o } = e, s = Cr(n), a = it(Zl, n), i = a.disabled || r, u = ne(t, a.onTriggerChange), f = Sr(n), d = l.useRef("touch"), [p, g, v] = Cu((h) => {
9516
+ const { __scopeSelect: n, disabled: r = !1, ...o } = e, s = Cr(n), a = it(Zl, n), i = a.disabled || r, u = te(t, a.onTriggerChange), f = Sr(n), d = l.useRef("touch"), [p, g, v] = Cu((h) => {
9481
9517
  const b = f().filter((x) => !x.disabled), w = b.find((x) => x.value === a.value), y = Eu(b, h, w);
9482
9518
  y !== void 0 && a.onValueChange(y.value);
9483
9519
  }), m = (h) => {
@@ -9521,7 +9557,7 @@ var Zl = "SelectTrigger", Ql = l.forwardRef(
9521
9557
  Ql.displayName = Zl;
9522
9558
  var eu = "SelectValue", tu = l.forwardRef(
9523
9559
  (e, t) => {
9524
- const { __scopeSelect: n, className: r, style: o, children: s, placeholder: a = "", ...i } = e, u = it(eu, n), { onValueNodeHasChildrenChange: f } = u, d = s !== void 0, p = ne(t, u.onValueNodeChange);
9560
+ const { __scopeSelect: n, className: r, style: o, children: s, placeholder: a = "", ...i } = e, u = it(eu, n), { onValueNodeHasChildrenChange: f } = u, d = s !== void 0, p = te(t, u.onValueNodeChange);
9525
9561
  return be(() => {
9526
9562
  f(d);
9527
9563
  }, [f, d]), /* @__PURE__ */ c(
@@ -9583,22 +9619,22 @@ var ke = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9583
9619
  avoidCollisions: b,
9584
9620
  //
9585
9621
  ...w
9586
- } = e, y = it(bt, n), [x, E] = l.useState(null), [C, I] = l.useState(null), N = ne(t, (V) => E(V)), [L, M] = l.useState(null), [D, j] = l.useState(
9622
+ } = e, y = it(bt, n), [x, E] = l.useState(null), [C, I] = l.useState(null), N = te(t, (V) => E(V)), [F, D] = l.useState(null), [L, j] = l.useState(
9587
9623
  null
9588
9624
  ), K = Sr(n), [W, B] = l.useState(!1), q = l.useRef(!1);
9589
9625
  l.useEffect(() => {
9590
9626
  if (x) return Fo(x);
9591
9627
  }, [x]), Eo();
9592
- const F = l.useCallback(
9628
+ const $ = l.useCallback(
9593
9629
  (V) => {
9594
- const [oe, ...ie] = K().map((Z) => Z.ref.current), [se] = ie.slice(-1), H = document.activeElement;
9630
+ const [re, ...ie] = K().map((Z) => Z.ref.current), [oe] = ie.slice(-1), H = document.activeElement;
9595
9631
  for (const Z of V)
9596
- if (Z === H || (Z == null || Z.scrollIntoView({ block: "nearest" }), Z === oe && C && (C.scrollTop = 0), Z === se && C && (C.scrollTop = C.scrollHeight), Z == null || Z.focus(), document.activeElement !== H)) return;
9632
+ if (Z === H || (Z == null || Z.scrollIntoView({ block: "nearest" }), Z === re && C && (C.scrollTop = 0), Z === oe && C && (C.scrollTop = C.scrollHeight), Z == null || Z.focus(), document.activeElement !== H)) return;
9597
9633
  },
9598
9634
  [K, C]
9599
9635
  ), G = l.useCallback(
9600
- () => F([L, x]),
9601
- [F, L, x]
9636
+ () => $([F, x]),
9637
+ [$, F, x]
9602
9638
  );
9603
9639
  l.useEffect(() => {
9604
9640
  W && G();
@@ -9607,17 +9643,17 @@ var ke = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9607
9643
  l.useEffect(() => {
9608
9644
  if (x) {
9609
9645
  let V = { x: 0, y: 0 };
9610
- const oe = (se) => {
9646
+ const re = (oe) => {
9611
9647
  var H, Z;
9612
9648
  V = {
9613
- x: Math.abs(Math.round(se.pageX) - (((H = P.current) == null ? void 0 : H.x) ?? 0)),
9614
- y: Math.abs(Math.round(se.pageY) - (((Z = P.current) == null ? void 0 : Z.y) ?? 0))
9649
+ x: Math.abs(Math.round(oe.pageX) - (((H = P.current) == null ? void 0 : H.x) ?? 0)),
9650
+ y: Math.abs(Math.round(oe.pageY) - (((Z = P.current) == null ? void 0 : Z.y) ?? 0))
9615
9651
  };
9616
- }, ie = (se) => {
9617
- V.x <= 10 && V.y <= 10 ? se.preventDefault() : x.contains(se.target) || T(!1), document.removeEventListener("pointermove", oe), P.current = null;
9652
+ }, ie = (oe) => {
9653
+ V.x <= 10 && V.y <= 10 ? oe.preventDefault() : x.contains(oe.target) || T(!1), document.removeEventListener("pointermove", re), P.current = null;
9618
9654
  };
9619
- return P.current !== null && (document.addEventListener("pointermove", oe), document.addEventListener("pointerup", ie, { capture: !0, once: !0 })), () => {
9620
- document.removeEventListener("pointermove", oe), document.removeEventListener("pointerup", ie, { capture: !0 });
9655
+ return P.current !== null && (document.addEventListener("pointermove", re), document.addEventListener("pointerup", ie, { capture: !0, once: !0 })), () => {
9656
+ document.removeEventListener("pointermove", re), document.removeEventListener("pointerup", ie, { capture: !0 });
9621
9657
  };
9622
9658
  }
9623
9659
  }, [x, T, P]), l.useEffect(() => {
@@ -9627,21 +9663,21 @@ var ke = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9627
9663
  };
9628
9664
  }, [T]);
9629
9665
  const [_, O] = Cu((V) => {
9630
- const oe = K().filter((H) => !H.disabled), ie = oe.find((H) => H.ref.current === document.activeElement), se = Eu(oe, V, ie);
9631
- se && setTimeout(() => se.ref.current.focus());
9632
- }), X = l.useCallback(
9633
- (V, oe, ie) => {
9634
- const se = !q.current && !ie;
9635
- (y.value !== void 0 && y.value === oe || se) && (M(V), se && (q.current = !0));
9666
+ const re = K().filter((H) => !H.disabled), ie = re.find((H) => H.ref.current === document.activeElement), oe = Eu(re, V, ie);
9667
+ oe && setTimeout(() => oe.ref.current.focus());
9668
+ }), Y = l.useCallback(
9669
+ (V, re, ie) => {
9670
+ const oe = !q.current && !ie;
9671
+ (y.value !== void 0 && y.value === re || oe) && (D(V), oe && (q.current = !0));
9636
9672
  },
9637
9673
  [y.value]
9638
- ), $ = l.useCallback(() => x == null ? void 0 : x.focus(), [x]), z = l.useCallback(
9639
- (V, oe, ie) => {
9640
- const se = !q.current && !ie;
9641
- (y.value !== void 0 && y.value === oe || se) && j(V);
9674
+ ), M = l.useCallback(() => x == null ? void 0 : x.focus(), [x]), z = l.useCallback(
9675
+ (V, re, ie) => {
9676
+ const oe = !q.current && !ie;
9677
+ (y.value !== void 0 && y.value === re || oe) && j(V);
9642
9678
  },
9643
9679
  [y.value]
9644
- ), le = r === "popper" ? io : iu, ae = le === io ? {
9680
+ ), le = r === "popper" ? io : iu, se = le === io ? {
9645
9681
  side: i,
9646
9682
  sideOffset: u,
9647
9683
  align: f,
@@ -9660,12 +9696,12 @@ var ke = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9660
9696
  content: x,
9661
9697
  viewport: C,
9662
9698
  onViewportChange: I,
9663
- itemRefCallback: X,
9664
- selectedItem: L,
9665
- onItemLeave: $,
9699
+ itemRefCallback: Y,
9700
+ selectedItem: F,
9701
+ onItemLeave: M,
9666
9702
  itemTextRefCallback: z,
9667
9703
  focusSelectedItem: G,
9668
- selectedItemText: D,
9704
+ selectedItemText: L,
9669
9705
  position: r,
9670
9706
  isPositioned: W,
9671
9707
  searchRef: _,
@@ -9678,8 +9714,8 @@ var ke = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9678
9714
  V.preventDefault();
9679
9715
  },
9680
9716
  onUnmountAutoFocus: U(o, (V) => {
9681
- var oe;
9682
- (oe = y.trigger) == null || oe.focus({ preventScroll: !0 }), V.preventDefault();
9717
+ var re;
9718
+ (re = y.trigger) == null || re.focus({ preventScroll: !0 }), V.preventDefault();
9683
9719
  }),
9684
9720
  children: /* @__PURE__ */ c(
9685
9721
  ln,
@@ -9699,7 +9735,7 @@ var ke = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9699
9735
  dir: y.dir,
9700
9736
  onContextMenu: (V) => V.preventDefault(),
9701
9737
  ...w,
9702
- ...ae,
9738
+ ...se,
9703
9739
  onPlaced: () => B(!0),
9704
9740
  ref: N,
9705
9741
  style: {
@@ -9711,14 +9747,14 @@ var ke = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9711
9747
  ...w.style
9712
9748
  },
9713
9749
  onKeyDown: U(w.onKeyDown, (V) => {
9714
- const oe = V.ctrlKey || V.altKey || V.metaKey;
9715
- if (V.key === "Tab" && V.preventDefault(), !oe && V.key.length === 1 && O(V.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(V.key)) {
9716
- let se = K().filter((H) => !H.disabled).map((H) => H.ref.current);
9717
- if (["ArrowUp", "End"].includes(V.key) && (se = se.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(V.key)) {
9718
- const H = V.target, Z = se.indexOf(H);
9719
- se = se.slice(Z + 1);
9750
+ const re = V.ctrlKey || V.altKey || V.metaKey;
9751
+ if (V.key === "Tab" && V.preventDefault(), !re && V.key.length === 1 && O(V.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(V.key)) {
9752
+ let oe = K().filter((H) => !H.disabled).map((H) => H.ref.current);
9753
+ if (["ArrowUp", "End"].includes(V.key) && (oe = oe.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(V.key)) {
9754
+ const H = V.target, Z = oe.indexOf(H);
9755
+ oe = oe.slice(Z + 1);
9720
9756
  }
9721
- setTimeout(() => F(se)), V.preventDefault();
9757
+ setTimeout(() => $(oe)), V.preventDefault();
9722
9758
  }
9723
9759
  })
9724
9760
  }
@@ -9733,46 +9769,46 @@ var ke = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9733
9769
  );
9734
9770
  au.displayName = mw;
9735
9771
  var bw = "SelectItemAlignedPosition", iu = l.forwardRef((e, t) => {
9736
- const { __scopeSelect: n, onPlaced: r, ...o } = e, s = it(bt, n), a = ct(bt, n), [i, u] = l.useState(null), [f, d] = l.useState(null), p = ne(t, (N) => d(N)), g = Sr(n), v = l.useRef(!1), m = l.useRef(!0), { viewport: h, selectedItem: b, selectedItemText: w, focusSelectedItem: y } = a, x = l.useCallback(() => {
9772
+ const { __scopeSelect: n, onPlaced: r, ...o } = e, s = it(bt, n), a = ct(bt, n), [i, u] = l.useState(null), [f, d] = l.useState(null), p = te(t, (N) => d(N)), g = Sr(n), v = l.useRef(!1), m = l.useRef(!0), { viewport: h, selectedItem: b, selectedItemText: w, focusSelectedItem: y } = a, x = l.useCallback(() => {
9737
9773
  if (s.trigger && s.valueNode && i && f && h && b && w) {
9738
- const N = s.trigger.getBoundingClientRect(), L = f.getBoundingClientRect(), M = s.valueNode.getBoundingClientRect(), D = w.getBoundingClientRect();
9774
+ const N = s.trigger.getBoundingClientRect(), F = f.getBoundingClientRect(), D = s.valueNode.getBoundingClientRect(), L = w.getBoundingClientRect();
9739
9775
  if (s.dir !== "rtl") {
9740
- const H = D.left - L.left, Z = M.left - H, de = N.left - Z, pe = N.width + de, Y = Math.max(pe, L.width), ge = window.innerWidth - ke, te = ro(Z, [
9776
+ const H = L.left - F.left, Z = D.left - H, de = N.left - Z, he = N.width + de, me = Math.max(he, F.width), Q = window.innerWidth - ke, ve = ro(Z, [
9741
9777
  ke,
9742
9778
  // Prevents the content from going off the starting edge of the
9743
9779
  // viewport. It may still go off the ending edge, but this can be
9744
9780
  // controlled by the user since they may want to manage overflow in a
9745
9781
  // specific way.
9746
9782
  // https://github.com/radix-ui/primitives/issues/2049
9747
- Math.max(ke, ge - Y)
9783
+ Math.max(ke, Q - me)
9748
9784
  ]);
9749
- i.style.minWidth = pe + "px", i.style.left = te + "px";
9785
+ i.style.minWidth = he + "px", i.style.left = ve + "px";
9750
9786
  } else {
9751
- const H = L.right - D.right, Z = window.innerWidth - M.right - H, de = window.innerWidth - N.right - Z, pe = N.width + de, Y = Math.max(pe, L.width), ge = window.innerWidth - ke, te = ro(Z, [
9787
+ const H = F.right - L.right, Z = window.innerWidth - D.right - H, de = window.innerWidth - N.right - Z, he = N.width + de, me = Math.max(he, F.width), Q = window.innerWidth - ke, ve = ro(Z, [
9752
9788
  ke,
9753
- Math.max(ke, ge - Y)
9789
+ Math.max(ke, Q - me)
9754
9790
  ]);
9755
- i.style.minWidth = pe + "px", i.style.right = te + "px";
9791
+ i.style.minWidth = he + "px", i.style.right = ve + "px";
9756
9792
  }
9757
- const j = g(), K = window.innerHeight - ke * 2, W = h.scrollHeight, B = window.getComputedStyle(f), q = parseInt(B.borderTopWidth, 10), F = parseInt(B.paddingTop, 10), G = parseInt(B.borderBottomWidth, 10), T = parseInt(B.paddingBottom, 10), P = q + F + W + T + G, _ = Math.min(b.offsetHeight * 5, P), O = window.getComputedStyle(h), X = parseInt(O.paddingTop, 10), $ = parseInt(O.paddingBottom, 10), z = N.top + N.height / 2 - ke, le = K - z, ae = b.offsetHeight / 2, V = b.offsetTop + ae, oe = q + F + V, ie = P - oe;
9758
- if (oe <= z) {
9793
+ const j = g(), K = window.innerHeight - ke * 2, W = h.scrollHeight, B = window.getComputedStyle(f), q = parseInt(B.borderTopWidth, 10), $ = parseInt(B.paddingTop, 10), G = parseInt(B.borderBottomWidth, 10), T = parseInt(B.paddingBottom, 10), P = q + $ + W + T + G, _ = Math.min(b.offsetHeight * 5, P), O = window.getComputedStyle(h), Y = parseInt(O.paddingTop, 10), M = parseInt(O.paddingBottom, 10), z = N.top + N.height / 2 - ke, le = K - z, se = b.offsetHeight / 2, V = b.offsetTop + se, re = q + $ + V, ie = P - re;
9794
+ if (re <= z) {
9759
9795
  const H = j.length > 0 && b === j[j.length - 1].ref.current;
9760
9796
  i.style.bottom = "0px";
9761
9797
  const Z = f.clientHeight - h.offsetTop - h.offsetHeight, de = Math.max(
9762
9798
  le,
9763
- ae + // viewport might have padding bottom, include it to avoid a scrollable viewport
9764
- (H ? $ : 0) + Z + G
9765
- ), pe = oe + de;
9766
- i.style.height = pe + "px";
9799
+ se + // viewport might have padding bottom, include it to avoid a scrollable viewport
9800
+ (H ? M : 0) + Z + G
9801
+ ), he = re + de;
9802
+ i.style.height = he + "px";
9767
9803
  } else {
9768
9804
  const H = j.length > 0 && b === j[0].ref.current;
9769
9805
  i.style.top = "0px";
9770
9806
  const de = Math.max(
9771
9807
  z,
9772
9808
  q + h.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
9773
- (H ? X : 0) + ae
9809
+ (H ? Y : 0) + se
9774
9810
  ) + ie;
9775
- i.style.height = de + "px", h.scrollTop = oe - z + h.offsetTop;
9811
+ i.style.height = de + "px", h.scrollTop = re - z + h.offsetTop;
9776
9812
  }
9777
9813
  i.style.margin = `${ke}px 0`, i.style.minHeight = _ + "px", i.style.maxHeight = K + "px", r == null || r(), requestAnimationFrame(() => v.current = !0);
9778
9814
  }
@@ -9868,7 +9904,7 @@ var vw = "SelectPopperPosition", io = l.forwardRef((e, t) => {
9868
9904
  io.displayName = vw;
9869
9905
  var [ww, ts] = zt(bt, {}), co = "SelectViewport", cu = l.forwardRef(
9870
9906
  (e, t) => {
9871
- const { __scopeSelect: n, nonce: r, ...o } = e, s = ct(co, n), a = ts(co, n), i = ne(t, s.onViewportChange), u = l.useRef(0);
9907
+ const { __scopeSelect: n, nonce: r, ...o } = e, s = ct(co, n), a = ts(co, n), i = te(t, s.onViewportChange), u = l.useRef(0);
9872
9908
  return /* @__PURE__ */ R(De, { children: [
9873
9909
  /* @__PURE__ */ c(
9874
9910
  "style",
@@ -9941,7 +9977,7 @@ var Gn = "SelectItem", [Cw, fu] = zt(Gn), pu = l.forwardRef(
9941
9977
  disabled: o = !1,
9942
9978
  textValue: s,
9943
9979
  ...a
9944
- } = e, i = it(Gn, n), u = ct(Gn, n), f = i.value === r, [d, p] = l.useState(s ?? ""), [g, v] = l.useState(!1), m = ne(
9980
+ } = e, i = it(Gn, n), u = ct(Gn, n), f = i.value === r, [d, p] = l.useState(s ?? ""), [g, v] = l.useState(!1), m = te(
9945
9981
  t,
9946
9982
  (y) => {
9947
9983
  var x;
@@ -10019,7 +10055,7 @@ var Gn = "SelectItem", [Cw, fu] = zt(Gn), pu = l.forwardRef(
10019
10055
  pu.displayName = Gn;
10020
10056
  var jt = "SelectItemText", hu = l.forwardRef(
10021
10057
  (e, t) => {
10022
- const { __scopeSelect: n, className: r, style: o, ...s } = e, a = it(jt, n), i = ct(jt, n), u = fu(jt, n), f = fw(jt, n), [d, p] = l.useState(null), g = ne(
10058
+ const { __scopeSelect: n, className: r, style: o, ...s } = e, a = it(jt, n), i = ct(jt, n), u = fu(jt, n), f = fw(jt, n), [d, p] = l.useState(null), g = te(
10023
10059
  t,
10024
10060
  (w) => p(w),
10025
10061
  u.onItemTextChange,
@@ -10046,7 +10082,7 @@ var mu = "SelectItemIndicator", gu = l.forwardRef(
10046
10082
  );
10047
10083
  gu.displayName = mu;
10048
10084
  var lo = "SelectScrollUpButton", bu = l.forwardRef((e, t) => {
10049
- const n = ct(lo, e.__scopeSelect), r = ts(lo, e.__scopeSelect), [o, s] = l.useState(!1), a = ne(t, r.onScrollButtonChange);
10085
+ const n = ct(lo, e.__scopeSelect), r = ts(lo, e.__scopeSelect), [o, s] = l.useState(!1), a = te(t, r.onScrollButtonChange);
10050
10086
  return be(() => {
10051
10087
  if (n.viewport && n.isPositioned) {
10052
10088
  let i = function() {
@@ -10070,7 +10106,7 @@ var lo = "SelectScrollUpButton", bu = l.forwardRef((e, t) => {
10070
10106
  });
10071
10107
  bu.displayName = lo;
10072
10108
  var uo = "SelectScrollDownButton", vu = l.forwardRef((e, t) => {
10073
- const n = ct(uo, e.__scopeSelect), r = ts(uo, e.__scopeSelect), [o, s] = l.useState(!1), a = ne(t, r.onScrollButtonChange);
10109
+ const n = ct(uo, e.__scopeSelect), r = ts(uo, e.__scopeSelect), [o, s] = l.useState(!1), a = te(t, r.onScrollButtonChange);
10074
10110
  return be(() => {
10075
10111
  if (n.viewport && n.isPositioned) {
10076
10112
  let i = function() {
@@ -10136,7 +10172,7 @@ var fo = "SelectArrow", Rw = l.forwardRef(
10136
10172
  Rw.displayName = fo;
10137
10173
  var Nw = "SelectBubbleInput", xu = l.forwardRef(
10138
10174
  ({ __scopeSelect: e, value: t, ...n }, r) => {
10139
- const o = l.useRef(null), s = ne(r, o), a = Vl(t);
10175
+ const o = l.useRef(null), s = te(r, o), a = Vl(t);
10140
10176
  return l.useEffect(() => {
10141
10177
  const i = o.current;
10142
10178
  if (!i) return;
@@ -10493,7 +10529,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
10493
10529
  }
10494
10530
  };
10495
10531
  return /* @__PURE__ */ R(pl, { open: r, onOpenChange: o, children: [
10496
- /* @__PURE__ */ c(lv, { asChild: !0, children: /* @__PURE__ */ R(fe, { variant: "outline", size: "sm", className: n, children: [
10532
+ /* @__PURE__ */ c(lv, { asChild: !0, children: /* @__PURE__ */ R(pe, { variant: "outline", size: "sm", className: n, children: [
10497
10533
  /* @__PURE__ */ c(Yu, { className: "h-4 w-4 mr-2" }),
10498
10534
  "Settings",
10499
10535
  f && /* @__PURE__ */ c(Ha, { variant: "destructive", className: "ml-2 h-4 w-4 p-0" })
@@ -10525,7 +10561,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
10525
10561
  placeholder: "http://localhost:8000/api"
10526
10562
  }
10527
10563
  ),
10528
- /* @__PURE__ */ c(fe, { variant: "outline", onClick: h, children: "Test" })
10564
+ /* @__PURE__ */ c(pe, { variant: "outline", onClick: h, children: "Test" })
10529
10565
  ] })
10530
10566
  ] }),
10531
10567
  /* @__PURE__ */ R("div", { className: "flex items-center justify-between", children: [
@@ -10559,7 +10595,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
10559
10595
  }
10560
10596
  ),
10561
10597
  /* @__PURE__ */ c(
10562
- fe,
10598
+ pe,
10563
10599
  {
10564
10600
  variant: "outline",
10565
10601
  size: "icon",
@@ -10727,13 +10763,13 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
10727
10763
  ] })
10728
10764
  ] }),
10729
10765
  /* @__PURE__ */ R("div", { className: "flex items-center justify-between pt-6 border-t", children: [
10730
- /* @__PURE__ */ R(fe, { variant: "outline", onClick: v, children: [
10766
+ /* @__PURE__ */ R(pe, { variant: "outline", onClick: v, children: [
10731
10767
  /* @__PURE__ */ c(Wr, { className: "h-4 w-4 mr-2" }),
10732
10768
  "Reset"
10733
10769
  ] }),
10734
10770
  /* @__PURE__ */ R("div", { className: "flex gap-2", children: [
10735
- /* @__PURE__ */ c(fe, { variant: "outline", onClick: m, children: "Cancel" }),
10736
- /* @__PURE__ */ R(fe, { onClick: g, disabled: !f, children: [
10771
+ /* @__PURE__ */ c(pe, { variant: "outline", onClick: m, children: "Cancel" }),
10772
+ /* @__PURE__ */ R(pe, { onClick: g, disabled: !f, children: [
10737
10773
  /* @__PURE__ */ c(nd, { className: "h-4 w-4 mr-2" }),
10738
10774
  "Save Changes"
10739
10775
  ] })
@@ -10767,7 +10803,7 @@ function Fy({
10767
10803
  "--chat-sidebar-width": f === "phone" ? "100%" : f === "tablet" ? "280px" : f === "half-screen" ? "240px" : "320px",
10768
10804
  "--chat-message-max-width": f === "phone" ? "95%" : f === "tablet" ? "90%" : f === "half-screen" ? "85%" : "80%",
10769
10805
  "--chat-input-height": f === "phone" ? "120px" : "100px"
10770
- }), u = Qe.useCallback((f) => {
10806
+ }), u = Je.useCallback((f) => {
10771
10807
  var d;
10772
10808
  (d = s.onThreadChange) == null || d.call(s, f);
10773
10809
  }, [s.onThreadChange]);