teodor-new-chat-ui 2.0.25 → 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 +782 -744
- package/dist/index.umd.js +11 -11
- package/package.json +1 -1
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
|
|
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";
|
|
@@ -111,14 +111,14 @@ const Nd = (e, t, n, { allOwnKeys: r } = {}) => (an(t, (o, s) => {
|
|
|
111
111
|
for (; t-- > 0; )
|
|
112
112
|
n[t] = e[t];
|
|
113
113
|
return n;
|
|
114
|
-
}, Od = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && go(Uint8Array)),
|
|
114
|
+
}, Od = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && go(Uint8Array)), Md = (e, t) => {
|
|
115
115
|
const r = (e && e[Xn]).call(e);
|
|
116
116
|
let o;
|
|
117
117
|
for (; (o = r.next()) && !o.done; ) {
|
|
118
118
|
const s = o.value;
|
|
119
119
|
t.call(e, s[0], s[1]);
|
|
120
120
|
}
|
|
121
|
-
},
|
|
121
|
+
}, kd = (e, t) => {
|
|
122
122
|
let n;
|
|
123
123
|
const r = [];
|
|
124
124
|
for (; (n = e.exec(t)) !== null; )
|
|
@@ -225,8 +225,8 @@ const Wd = (e) => {
|
|
|
225
225
|
kindOfTest: Be,
|
|
226
226
|
endsWith: _d,
|
|
227
227
|
toArray: Id,
|
|
228
|
-
forEachEntry:
|
|
229
|
-
matchAll:
|
|
228
|
+
forEachEntry: Md,
|
|
229
|
+
matchAll: kd,
|
|
230
230
|
isHTMLForm: Dd,
|
|
231
231
|
hasOwnProperty: as,
|
|
232
232
|
hasOwnProp: as,
|
|
@@ -1238,9 +1238,9 @@ const Ia = (e) => {
|
|
|
1238
1238
|
onDownloadProgress: C,
|
|
1239
1239
|
onUploadProgress: I,
|
|
1240
1240
|
responseType: N,
|
|
1241
|
-
headers:
|
|
1242
|
-
withCredentials:
|
|
1243
|
-
fetchOptions:
|
|
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(
|
|
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
|
-
}),
|
|
1258
|
-
if (S.isFormData(w) && (
|
|
1259
|
-
const [
|
|
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,
|
|
1263
|
+
w = hs(O.body, ms, M, z);
|
|
1264
1264
|
}
|
|
1265
1265
|
}
|
|
1266
|
-
S.isString(
|
|
1267
|
-
const
|
|
1268
|
-
...
|
|
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:
|
|
1271
|
+
headers: F.normalize().toJSON(),
|
|
1272
1272
|
body: w,
|
|
1273
1273
|
duplex: "half",
|
|
1274
|
-
credentials:
|
|
1274
|
+
credentials: $ ? D : void 0
|
|
1275
1275
|
};
|
|
1276
1276
|
W = s && new n(h, G);
|
|
1277
|
-
let T = await (s ? j(W,
|
|
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
|
|
1285
|
-
|
|
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,
|
|
1298
|
-
Pa(O,
|
|
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 (
|
|
1308
|
-
throw B && B(),
|
|
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:
|
|
1311
|
+
cause: $.cause || $
|
|
1312
1312
|
}
|
|
1313
|
-
) : ee.from(
|
|
1313
|
+
) : ee.from($, $ && $.code, m, W);
|
|
1314
1314
|
}
|
|
1315
1315
|
};
|
|
1316
1316
|
}, Of = /* @__PURE__ */ new Map(), Oa = (e) => {
|
|
@@ -1342,7 +1342,7 @@ S.forEach(Gr, (e, t) => {
|
|
|
1342
1342
|
Object.defineProperty(e, "adapterName", { value: t });
|
|
1343
1343
|
}
|
|
1344
1344
|
});
|
|
1345
|
-
const ws = (e) => `- ${e}`,
|
|
1345
|
+
const ws = (e) => `- ${e}`, Mf = (e) => S.isFunction(e) || e === null || e === !1, Ma = {
|
|
1346
1346
|
getAdapter: (e, t) => {
|
|
1347
1347
|
e = S.isArray(e) ? e : [e];
|
|
1348
1348
|
const { length: n } = e;
|
|
@@ -1351,7 +1351,7 @@ const ws = (e) => `- ${e}`, kf = (e) => S.isFunction(e) || e === null || e === !
|
|
|
1351
1351
|
for (let a = 0; a < n; a++) {
|
|
1352
1352
|
r = e[a];
|
|
1353
1353
|
let i;
|
|
1354
|
-
if (o = r, !
|
|
1354
|
+
if (o = r, !Mf(r) && (o = Gr[(i = String(r)).toLowerCase()], o === void 0))
|
|
1355
1355
|
throw new ee(`Unknown adapter '${i}'`);
|
|
1356
1356
|
if (o && (S.isFunction(o) || (o = o.get(t))))
|
|
1357
1357
|
break;
|
|
@@ -1381,7 +1381,7 @@ function ys(e) {
|
|
|
1381
1381
|
return Nr(e), e.headers = Te.from(e.headers), e.data = Rr.call(
|
|
1382
1382
|
e,
|
|
1383
1383
|
e.transformRequest
|
|
1384
|
-
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1),
|
|
1384
|
+
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Ma.getAdapter(e.adapter || cn.adapter, e)(e).then(function(r) {
|
|
1385
1385
|
return Nr(e), r.data = Rr.call(
|
|
1386
1386
|
e,
|
|
1387
1387
|
e.transformResponse,
|
|
@@ -1395,7 +1395,7 @@ function ys(e) {
|
|
|
1395
1395
|
), r.response.headers = Te.from(r.response.headers))), Promise.reject(r);
|
|
1396
1396
|
});
|
|
1397
1397
|
}
|
|
1398
|
-
const
|
|
1398
|
+
const ka = "1.12.2", Qn = {};
|
|
1399
1399
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
|
|
1400
1400
|
Qn[e] = function(r) {
|
|
1401
1401
|
return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
|
|
@@ -1404,7 +1404,7 @@ const Ma = "1.12.2", Qn = {};
|
|
|
1404
1404
|
const xs = {};
|
|
1405
1405
|
Qn.transitional = function(t, n, r) {
|
|
1406
1406
|
function o(s, a) {
|
|
1407
|
-
return "[Axios v" +
|
|
1407
|
+
return "[Axios v" + ka + "] Transitional option '" + s + "'" + a + (r ? ". " + r : "");
|
|
1408
1408
|
}
|
|
1409
1409
|
return (s, a, i) => {
|
|
1410
1410
|
if (t === !1)
|
|
@@ -1423,7 +1423,7 @@ Qn.transitional = function(t, n, r) {
|
|
|
1423
1423
|
Qn.spelling = function(t) {
|
|
1424
1424
|
return (n, r) => (console.warn(`${r} is likely a misspelling of ${t}`), !0);
|
|
1425
1425
|
};
|
|
1426
|
-
function
|
|
1426
|
+
function kf(e, t, n) {
|
|
1427
1427
|
if (typeof e != "object")
|
|
1428
1428
|
throw new ee("options must be an object", ee.ERR_BAD_OPTION_VALUE);
|
|
1429
1429
|
const r = Object.keys(e);
|
|
@@ -1441,7 +1441,7 @@ function Mf(e, t, n) {
|
|
|
1441
1441
|
}
|
|
1442
1442
|
}
|
|
1443
1443
|
const En = {
|
|
1444
|
-
assertOptions:
|
|
1444
|
+
assertOptions: kf,
|
|
1445
1445
|
validators: Qn
|
|
1446
1446
|
}, He = En.validators;
|
|
1447
1447
|
let dt = class {
|
|
@@ -1723,26 +1723,26 @@ function La(e) {
|
|
|
1723
1723
|
return La(ft(e, o));
|
|
1724
1724
|
}, n;
|
|
1725
1725
|
}
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
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
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
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
|
-
} =
|
|
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 =
|
|
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
|
|
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
|
-
})(),
|
|
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((
|
|
1968
|
-
|
|
1969
|
-
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__, _ = ((
|
|
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
|
|
1985
|
-
|
|
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
|
|
1989
|
-
|
|
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,
|
|
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(),
|
|
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 +=
|
|
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
|
|
2022
|
-
if (!
|
|
2023
|
-
let
|
|
2021
|
+
const Y = Vf(O);
|
|
2022
|
+
if (!Y) continue;
|
|
2023
|
+
let M;
|
|
2024
2024
|
try {
|
|
2025
|
-
|
|
2025
|
+
M = JSON.parse(Y);
|
|
2026
2026
|
} catch {
|
|
2027
|
-
N && console.debug("[use-chat] skip malformed SSE data:",
|
|
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(
|
|
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((
|
|
2035
|
-
le && e.autoAppendAssistant !== !1 && p((
|
|
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
|
|
2277
|
+
const F = rt(null);
|
|
2278
2278
|
we(() => {
|
|
2279
|
-
o &&
|
|
2279
|
+
o && F.current !== o && (F.current = o, L(o).catch(() => {
|
|
2280
2280
|
}));
|
|
2281
2281
|
}, [o]);
|
|
2282
|
-
const
|
|
2283
|
-
async (_, O,
|
|
2284
|
-
var
|
|
2285
|
-
if (
|
|
2286
|
-
|
|
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 ?? ((
|
|
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
|
-
|
|
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
|
|
2303
|
-
}, [C,
|
|
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
|
|
2311
|
-
h(
|
|
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
|
|
2324
|
-
}, [s, N,
|
|
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
|
|
2329
|
+
var oe;
|
|
2330
2330
|
if (!C) throw new Error("No active thread");
|
|
2331
|
-
async function
|
|
2331
|
+
async function Y(H) {
|
|
2332
2332
|
return await new Promise((Z, de) => {
|
|
2333
|
-
const
|
|
2334
|
-
|
|
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
|
|
2337
|
+
async function M(H) {
|
|
2338
2338
|
return await new Promise((Z, de) => {
|
|
2339
|
-
const
|
|
2340
|
-
|
|
2339
|
+
const he = new FileReader();
|
|
2340
|
+
he.onload = () => {
|
|
2341
2341
|
try {
|
|
2342
|
-
const
|
|
2343
|
-
let
|
|
2344
|
-
const
|
|
2345
|
-
for (let
|
|
2346
|
-
Z(btoa(
|
|
2347
|
-
} catch (
|
|
2348
|
-
de(
|
|
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
|
-
},
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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: ((
|
|
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
|
|
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: [
|
|
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:
|
|
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:
|
|
2428
|
+
deleteThread: $,
|
|
2429
2429
|
renameThread: G,
|
|
2430
|
-
loadThread:
|
|
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
|
-
),
|
|
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
|
-
|
|
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
|
|
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 =
|
|
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 =
|
|
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,217 +2887,247 @@ function gp({
|
|
|
2887
2887
|
onEdit: C,
|
|
2888
2888
|
onRegenerate: I,
|
|
2889
2889
|
onEditFromCheckpoint: N,
|
|
2890
|
-
onCancelEdit:
|
|
2891
|
-
onCopy:
|
|
2890
|
+
onCancelEdit: F,
|
|
2891
|
+
onCopy: D
|
|
2892
2892
|
}) {
|
|
2893
|
-
const [
|
|
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
|
|
2896
|
-
await navigator.clipboard.writeText(
|
|
2897
|
-
} catch (
|
|
2898
|
-
console.error("Failed to copy:",
|
|
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
|
-
},
|
|
2913
|
+
}, re = () => {
|
|
2901
2914
|
if (!C) return;
|
|
2902
|
-
const
|
|
2903
|
-
C(e.id,
|
|
2904
|
-
},
|
|
2905
|
-
const
|
|
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:
|
|
2921
|
+
return /* @__PURE__ */ c(Bu, { className: ve });
|
|
2909
2922
|
case "assistant":
|
|
2910
|
-
return /* @__PURE__ */ c(os, { className:
|
|
2923
|
+
return /* @__PURE__ */ c(os, { className: ve });
|
|
2911
2924
|
case "tool":
|
|
2912
|
-
return /* @__PURE__ */ c($u, { className:
|
|
2925
|
+
return /* @__PURE__ */ c($u, { className: ve });
|
|
2913
2926
|
default:
|
|
2914
|
-
return /* @__PURE__ */ c(os, { className:
|
|
2927
|
+
return /* @__PURE__ */ c(os, { className: ve });
|
|
2915
2928
|
}
|
|
2916
|
-
},
|
|
2917
|
-
const
|
|
2929
|
+
}, H = () => {
|
|
2930
|
+
const Q = "group relative mb-4 max-w-full";
|
|
2918
2931
|
switch (P) {
|
|
2919
2932
|
case "user":
|
|
2920
|
-
return A(
|
|
2933
|
+
return A(Q, "flex justify-end");
|
|
2921
2934
|
case "assistant":
|
|
2922
2935
|
case "tool":
|
|
2923
2936
|
case "system":
|
|
2924
|
-
return A(
|
|
2937
|
+
return A(Q, "flex justify-start");
|
|
2925
2938
|
default:
|
|
2926
|
-
return
|
|
2939
|
+
return Q;
|
|
2927
2940
|
}
|
|
2928
|
-
},
|
|
2929
|
-
const
|
|
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
|
-
|
|
2937
|
-
// Ensure width constraints
|
|
2949
|
+
Q,
|
|
2938
2950
|
"max-w-[95%]",
|
|
2939
2951
|
u === "phone" && "max-w-[98%]",
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
// Use Tailwind's `dark:` variants so the bubble adapts when the document root toggles the `dark` class.
|
|
2943
|
-
"bg-blue-50 text-gray-900 dark:bg-primary dark:text-primary-foreground",
|
|
2944
|
-
// Subtle blue border in light mode to separate from page background; remove in dark mode to keep the primary look.
|
|
2945
|
-
"border border-blue-100 dark:border-transparent"
|
|
2952
|
+
"bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
|
|
2953
|
+
"border border-transparent"
|
|
2946
2954
|
);
|
|
2947
2955
|
case "assistant":
|
|
2948
2956
|
return A(
|
|
2949
|
-
|
|
2957
|
+
Q,
|
|
2950
2958
|
"max-w-[95%]",
|
|
2951
2959
|
u === "phone" && "max-w-[98%]",
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
"bg-white text-gray-900 border border-gray-200 dark:bg-muted dark:text-muted-foreground dark:border-transparent"
|
|
2960
|
+
"bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
|
|
2961
|
+
"border border-border/60 dark:border-border/40"
|
|
2955
2962
|
);
|
|
2956
2963
|
case "tool":
|
|
2957
|
-
return A(
|
|
2964
|
+
return A(Q, "bg-secondary/50 text-secondary-foreground border border-dashed max-w-[95%]", u === "phone" && "max-w-[98%]");
|
|
2958
2965
|
case "system":
|
|
2959
|
-
return A(
|
|
2966
|
+
return A(Q, "bg-accent/40 text-muted-foreground max-w-[85%] border");
|
|
2960
2967
|
default:
|
|
2961
|
-
return
|
|
2968
|
+
return Q;
|
|
2962
2969
|
}
|
|
2963
|
-
},
|
|
2964
|
-
if (!
|
|
2970
|
+
}, de = (Q) => {
|
|
2971
|
+
if (!Q) return "";
|
|
2965
2972
|
try {
|
|
2966
|
-
return new Date(
|
|
2973
|
+
return new Date(Q).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
2967
2974
|
} catch {
|
|
2968
2975
|
return "";
|
|
2969
2976
|
}
|
|
2970
|
-
},
|
|
2977
|
+
}, he = () => {
|
|
2971
2978
|
if (e.model === "reflection") {
|
|
2972
|
-
const
|
|
2973
|
-
if (
|
|
2974
|
-
return /* @__PURE__ */ c(Tp, { data:
|
|
2979
|
+
const ae = Y.trim(), fe = Pr(ae);
|
|
2980
|
+
if (fe && typeof fe == "object")
|
|
2981
|
+
return /* @__PURE__ */ c(Tp, { data: fe });
|
|
2975
2982
|
}
|
|
2976
|
-
if (_ &&
|
|
2977
|
-
const
|
|
2978
|
-
if (
|
|
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 });
|
|
2979
2986
|
}
|
|
2980
2987
|
if (_ && !B) {
|
|
2981
|
-
const
|
|
2988
|
+
const ae = St(e.content).slice(0, 80).replace(/\s+/g, " ");
|
|
2982
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: [
|
|
2983
|
-
|
|
2984
|
-
|
|
2990
|
+
ae,
|
|
2991
|
+
ae.length >= 80 ? "…" : ""
|
|
2985
2992
|
] }) });
|
|
2986
2993
|
}
|
|
2987
2994
|
if (_ && f) {
|
|
2988
|
-
const
|
|
2995
|
+
const ae = St(e.content), fe = ae.length > d;
|
|
2989
2996
|
return /* @__PURE__ */ c(As, { open: K, onOpenChange: W, children: /* @__PURE__ */ R("div", { className: "font-mono text-sm text-current", children: [
|
|
2990
|
-
/* @__PURE__ */ c("pre", { className: A("whitespace-pre-wrap break-words text-current", T && "text-xs"), children:
|
|
2991
|
-
|
|
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: [
|
|
2992
2999
|
/* @__PURE__ */ c(Wt, { className: "h-3 w-3 mr-1" }),
|
|
2993
3000
|
"Show less"
|
|
2994
3001
|
] }) : /* @__PURE__ */ R(De, { children: [
|
|
2995
3002
|
/* @__PURE__ */ c(Tt, { className: "h-3 w-3 mr-1" }),
|
|
2996
3003
|
"Show more (",
|
|
2997
|
-
|
|
3004
|
+
ae.length - d,
|
|
2998
3005
|
" chars)"
|
|
2999
3006
|
] }) }) })
|
|
3000
3007
|
] }) });
|
|
3001
3008
|
}
|
|
3002
3009
|
if (_ && B && !f) {
|
|
3003
|
-
const
|
|
3004
|
-
if (
|
|
3005
|
-
return /* @__PURE__ */ c(gn, { content:
|
|
3006
|
-
const
|
|
3007
|
-
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:
|
|
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 }) });
|
|
3008
3015
|
}
|
|
3009
|
-
const
|
|
3016
|
+
const Q = z.length > 0 && P !== "tool", ve = le.length > 0 && P !== "tool";
|
|
3010
3017
|
return /* @__PURE__ */ R("div", { children: [
|
|
3011
3018
|
n ? /* @__PURE__ */ R("div", { className: "relative", children: [
|
|
3012
3019
|
(() => {
|
|
3013
|
-
const
|
|
3014
|
-
return
|
|
3020
|
+
const ae = Pr(se);
|
|
3021
|
+
return ae !== null ? /* @__PURE__ */ c(_s, { data: ae }) : /* @__PURE__ */ c(gn, { content: yp(wp(se)) });
|
|
3015
3022
|
})(),
|
|
3016
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" } })
|
|
3017
3024
|
] }) : (() => {
|
|
3018
|
-
const
|
|
3019
|
-
if (
|
|
3025
|
+
const ae = Pr(Y.trim());
|
|
3026
|
+
if (ae !== null) return /* @__PURE__ */ c(_s, { data: ae });
|
|
3020
3027
|
if (P === "user" && p) {
|
|
3021
|
-
const
|
|
3022
|
-
if (
|
|
3023
|
-
return /* @__PURE__ */ R(As, { open:
|
|
3024
|
-
/* @__PURE__ */ c("div", { className: A("text-sm text-
|
|
3025
|
-
|
|
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),
|
|
3026
3033
|
"..."
|
|
3027
3034
|
] }) }),
|
|
3028
|
-
/* @__PURE__ */ c(Ps, { asChild: !0, children: /* @__PURE__ */ c(
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3035
|
+
/* @__PURE__ */ c(Ps, { asChild: !0, children: /* @__PURE__ */ c(
|
|
3036
|
+
pe,
|
|
3037
|
+
{
|
|
3038
|
+
variant: "ghost",
|
|
3039
|
+
size: "sm",
|
|
3040
|
+
className: "h-6 text-xs !text-[hsl(var(--chat-bubble-user-text))]",
|
|
3041
|
+
children: $ ? /* @__PURE__ */ R(De, { children: [
|
|
3042
|
+
/* @__PURE__ */ c(Wt, { className: "h-3 w-3 mr-1" }),
|
|
3043
|
+
" Show less"
|
|
3044
|
+
] }) : /* @__PURE__ */ R(De, { children: [
|
|
3045
|
+
/* @__PURE__ */ c(Tt, { className: "h-3 w-3 mr-1" }),
|
|
3046
|
+
" Show more (",
|
|
3047
|
+
fe.length - g,
|
|
3048
|
+
" chars)"
|
|
3049
|
+
] })
|
|
3050
|
+
}
|
|
3051
|
+
) })
|
|
3037
3052
|
] });
|
|
3038
3053
|
}
|
|
3039
|
-
return /* @__PURE__ */ c(gn, { content:
|
|
3054
|
+
return /* @__PURE__ */ c(gn, { content: Y.trim() });
|
|
3040
3055
|
})(),
|
|
3041
|
-
|
|
3042
|
-
/* @__PURE__ */ c("img", { src:
|
|
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" }),
|
|
3043
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: [
|
|
3044
3059
|
/* @__PURE__ */ c(Uu, { className: "h-3 w-3" }),
|
|
3045
3060
|
/* @__PURE__ */ c("span", { children: "image" })
|
|
3046
3061
|
] })
|
|
3047
|
-
] },
|
|
3048
|
-
|
|
3049
|
-
const
|
|
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";
|
|
3050
3065
|
return /* @__PURE__ */ R(
|
|
3051
3066
|
"a",
|
|
3052
3067
|
{
|
|
3053
|
-
href:
|
|
3054
|
-
download:
|
|
3068
|
+
href: k.url,
|
|
3069
|
+
download: X,
|
|
3055
3070
|
target: "_blank",
|
|
3056
3071
|
rel: "noreferrer",
|
|
3057
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",
|
|
3058
|
-
title:
|
|
3073
|
+
title: X,
|
|
3059
3074
|
children: [
|
|
3060
3075
|
/* @__PURE__ */ c("span", { className: "inline-block w-1.5 h-1.5 rounded-full bg-gray-400" }),
|
|
3061
|
-
/* @__PURE__ */ c("span", { className: "truncate max-w-[180px]", children:
|
|
3076
|
+
/* @__PURE__ */ c("span", { className: "truncate max-w-[180px]", children: X })
|
|
3062
3077
|
]
|
|
3063
3078
|
},
|
|
3064
|
-
|
|
3079
|
+
fe
|
|
3065
3080
|
);
|
|
3066
3081
|
}) })
|
|
3067
3082
|
] });
|
|
3068
|
-
},
|
|
3069
|
-
return nt(() => Rp(e, h), [e, h]), /* @__PURE__ */ c("div", { className: A(
|
|
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: [
|
|
3070
3085
|
(a || i || _) && /* @__PURE__ */ R(
|
|
3071
3086
|
"div",
|
|
3072
3087
|
{
|
|
3073
3088
|
className: A(
|
|
3074
3089
|
"flex items-center justify-between mb-2 pb-2 border-b border-current/10",
|
|
3075
3090
|
T && "mb-1 pb-1",
|
|
3091
|
+
O,
|
|
3076
3092
|
v.header
|
|
3077
3093
|
),
|
|
3078
3094
|
children: [
|
|
3079
3095
|
/* @__PURE__ */ R("div", { className: "flex items-center gap-2", children: [
|
|
3080
|
-
|
|
3081
|
-
i &&
|
|
3082
|
-
_ &&
|
|
3096
|
+
oe(),
|
|
3097
|
+
i && me && /* @__PURE__ */ c("span", { className: A("font-medium", T ? "text-xs" : "text-sm"), children: me }),
|
|
3098
|
+
_ && M.name && /* @__PURE__ */ R(
|
|
3083
3099
|
Ha,
|
|
3084
3100
|
{
|
|
3085
3101
|
variant: "outline",
|
|
3086
|
-
className: A(
|
|
3087
|
-
|
|
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),
|
|
3088
3109
|
children: [
|
|
3089
|
-
/* @__PURE__ */ c("span", { children:
|
|
3110
|
+
/* @__PURE__ */ c("span", { children: M.name }),
|
|
3090
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" }) })
|
|
3091
3112
|
]
|
|
3092
3113
|
}
|
|
3093
3114
|
),
|
|
3094
|
-
_ && !
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
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
|
+
)
|
|
3098
3128
|
] }),
|
|
3099
3129
|
/* @__PURE__ */ R("div", { className: "flex items-center gap-2", children: [
|
|
3100
|
-
a && /* @__PURE__ */ c("span", { className: A("text-xs opacity-60", T && "text-xs"), children:
|
|
3130
|
+
a && /* @__PURE__ */ c("span", { className: A("text-xs opacity-60", O, T && "text-xs"), children: de(e.createdAt) }),
|
|
3101
3131
|
s && !o && /* @__PURE__ */ R(
|
|
3102
3132
|
"div",
|
|
3103
3133
|
{
|
|
@@ -3108,33 +3138,41 @@ function gp({
|
|
|
3108
3138
|
),
|
|
3109
3139
|
children: [
|
|
3110
3140
|
/* @__PURE__ */ c(
|
|
3111
|
-
|
|
3141
|
+
pe,
|
|
3112
3142
|
{
|
|
3113
3143
|
variant: "ghost",
|
|
3114
3144
|
size: "sm",
|
|
3115
|
-
onClick:
|
|
3116
|
-
className: A("h-6 w-6 p-0 hover:bg-
|
|
3117
|
-
children: /* @__PURE__ */ c(
|
|
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
|
+
)
|
|
3118
3156
|
}
|
|
3119
3157
|
),
|
|
3120
3158
|
P === "user" && C && /* @__PURE__ */ c(
|
|
3121
|
-
|
|
3159
|
+
pe,
|
|
3122
3160
|
{
|
|
3123
3161
|
variant: "ghost",
|
|
3124
3162
|
size: "sm",
|
|
3125
|
-
onClick:
|
|
3126
|
-
className: A("h-6 w-6 p-0 hover:bg-
|
|
3127
|
-
children: /* @__PURE__ */ c(rs, { className: A(
|
|
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") })
|
|
3128
3166
|
}
|
|
3129
3167
|
),
|
|
3130
3168
|
P === "assistant" && I && /* @__PURE__ */ c(
|
|
3131
|
-
|
|
3169
|
+
pe,
|
|
3132
3170
|
{
|
|
3133
3171
|
variant: "ghost",
|
|
3134
3172
|
size: "sm",
|
|
3135
|
-
onClick:
|
|
3136
|
-
className: A("h-6 w-6 p-0 hover:bg-
|
|
3137
|
-
children: /* @__PURE__ */ c(Wr, { className: A(
|
|
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") })
|
|
3138
3176
|
}
|
|
3139
3177
|
)
|
|
3140
3178
|
]
|
|
@@ -3144,15 +3182,15 @@ function gp({
|
|
|
3144
3182
|
]
|
|
3145
3183
|
}
|
|
3146
3184
|
),
|
|
3147
|
-
/* @__PURE__ */ c("div", { className: "relative", children:
|
|
3148
|
-
_ && B && (
|
|
3149
|
-
|
|
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: [
|
|
3150
3188
|
"Function: ",
|
|
3151
|
-
|
|
3189
|
+
M.name
|
|
3152
3190
|
] }),
|
|
3153
|
-
|
|
3191
|
+
M.toolCallId && /* @__PURE__ */ R("div", { children: [
|
|
3154
3192
|
"Call ID: ",
|
|
3155
|
-
|
|
3193
|
+
M.toolCallId
|
|
3156
3194
|
] })
|
|
3157
3195
|
] }),
|
|
3158
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: [
|
|
@@ -3165,27 +3203,27 @@ function gp({
|
|
|
3165
3203
|
] }),
|
|
3166
3204
|
/* @__PURE__ */ R("div", { className: "flex items-center gap-1", children: [
|
|
3167
3205
|
/* @__PURE__ */ c(
|
|
3168
|
-
|
|
3206
|
+
pe,
|
|
3169
3207
|
{
|
|
3170
3208
|
variant: "ghost",
|
|
3171
3209
|
size: "sm",
|
|
3172
|
-
className: "h-6 w-6 p-0
|
|
3210
|
+
className: A("h-6 w-6 p-0", O),
|
|
3173
3211
|
disabled: !y.canGoBack,
|
|
3174
3212
|
onClick: () => x == null ? void 0 : x(),
|
|
3175
3213
|
title: "Go back to previous branch",
|
|
3176
|
-
children: /* @__PURE__ */ c(Fu, { className: "h-3 w-3
|
|
3214
|
+
children: /* @__PURE__ */ c(Fu, { className: A("h-3 w-3", O) })
|
|
3177
3215
|
}
|
|
3178
3216
|
),
|
|
3179
3217
|
/* @__PURE__ */ c(
|
|
3180
|
-
|
|
3218
|
+
pe,
|
|
3181
3219
|
{
|
|
3182
3220
|
variant: "ghost",
|
|
3183
3221
|
size: "sm",
|
|
3184
|
-
className: "h-6 w-6 p-0
|
|
3222
|
+
className: A("h-6 w-6 p-0", O),
|
|
3185
3223
|
disabled: !y.canGoForward,
|
|
3186
3224
|
onClick: () => E == null ? void 0 : E(),
|
|
3187
3225
|
title: "Go forward to next branch",
|
|
3188
|
-
children: /* @__PURE__ */ c(da, { className: "h-3 w-3
|
|
3226
|
+
children: /* @__PURE__ */ c(da, { className: A("h-3 w-3", O) })
|
|
3189
3227
|
}
|
|
3190
3228
|
)
|
|
3191
3229
|
] })
|
|
@@ -3200,31 +3238,31 @@ function gp({
|
|
|
3200
3238
|
),
|
|
3201
3239
|
children: [
|
|
3202
3240
|
/* @__PURE__ */ c(
|
|
3203
|
-
|
|
3241
|
+
pe,
|
|
3204
3242
|
{
|
|
3205
3243
|
variant: "ghost",
|
|
3206
3244
|
size: "sm",
|
|
3207
|
-
onClick:
|
|
3245
|
+
onClick: V,
|
|
3208
3246
|
className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
|
|
3209
|
-
children: /* @__PURE__ */ c(ns, { className: A(
|
|
3247
|
+
children: /* @__PURE__ */ c(ns, { className: A(L ? "text-success" : "text-current", T ? "h-3 w-3" : "h-4 w-4") })
|
|
3210
3248
|
}
|
|
3211
3249
|
),
|
|
3212
3250
|
P === "user" && C && /* @__PURE__ */ c(
|
|
3213
|
-
|
|
3251
|
+
pe,
|
|
3214
3252
|
{
|
|
3215
3253
|
variant: "ghost",
|
|
3216
3254
|
size: "sm",
|
|
3217
|
-
onClick:
|
|
3255
|
+
onClick: re,
|
|
3218
3256
|
className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
|
|
3219
3257
|
children: /* @__PURE__ */ c(rs, { className: A("text-current", T ? "h-3 w-3" : "h-4 w-4") })
|
|
3220
3258
|
}
|
|
3221
3259
|
),
|
|
3222
3260
|
P === "assistant" && I && /* @__PURE__ */ c(
|
|
3223
|
-
|
|
3261
|
+
pe,
|
|
3224
3262
|
{
|
|
3225
3263
|
variant: "ghost",
|
|
3226
3264
|
size: "sm",
|
|
3227
|
-
onClick:
|
|
3265
|
+
onClick: ie,
|
|
3228
3266
|
className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
|
|
3229
3267
|
children: /* @__PURE__ */ c(Wr, { className: A("text-current", T ? "h-3 w-3" : "h-4 w-4") })
|
|
3230
3268
|
}
|
|
@@ -3479,27 +3517,27 @@ function Co(e) {
|
|
|
3479
3517
|
t,
|
|
3480
3518
|
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
3481
3519
|
), a = (h) => {
|
|
3482
|
-
const { scope: b, children: w } = h, y =
|
|
3520
|
+
const { scope: b, children: w } = h, y = Je.useRef(null), x = Je.useRef(/* @__PURE__ */ new Map()).current;
|
|
3483
3521
|
return /* @__PURE__ */ c(o, { scope: b, itemMap: x, collectionRef: y, children: w });
|
|
3484
3522
|
};
|
|
3485
3523
|
a.displayName = t;
|
|
3486
|
-
const i = e + "CollectionSlot", u = _t(i), f =
|
|
3524
|
+
const i = e + "CollectionSlot", u = _t(i), f = Je.forwardRef(
|
|
3487
3525
|
(h, b) => {
|
|
3488
|
-
const { scope: w, children: y } = h, x = s(i, w), E =
|
|
3526
|
+
const { scope: w, children: y } = h, x = s(i, w), E = te(b, x.collectionRef);
|
|
3489
3527
|
return /* @__PURE__ */ c(u, { ref: E, children: y });
|
|
3490
3528
|
}
|
|
3491
3529
|
);
|
|
3492
3530
|
f.displayName = i;
|
|
3493
|
-
const d = e + "CollectionItemSlot", p = "data-radix-collection-item", g = _t(d), v =
|
|
3531
|
+
const d = e + "CollectionItemSlot", p = "data-radix-collection-item", g = _t(d), v = Je.forwardRef(
|
|
3494
3532
|
(h, b) => {
|
|
3495
|
-
const { scope: w, children: y, ...x } = h, E =
|
|
3496
|
-
return
|
|
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 });
|
|
3497
3535
|
}
|
|
3498
3536
|
);
|
|
3499
3537
|
v.displayName = d;
|
|
3500
3538
|
function m(h) {
|
|
3501
3539
|
const b = s(e + "CollectionConsumer", h);
|
|
3502
|
-
return
|
|
3540
|
+
return Je.useCallback(() => {
|
|
3503
3541
|
const y = b.collectionRef.current;
|
|
3504
3542
|
if (!y) return [];
|
|
3505
3543
|
const x = Array.from(y.querySelectorAll(`[${p}]`));
|
|
@@ -3528,7 +3566,7 @@ function ye(e) {
|
|
|
3528
3566
|
return (r = t.current) == null ? void 0 : r.call(t, ...n);
|
|
3529
3567
|
}, []);
|
|
3530
3568
|
}
|
|
3531
|
-
function
|
|
3569
|
+
function Mp(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
3532
3570
|
const n = ye(e);
|
|
3533
3571
|
l.useEffect(() => {
|
|
3534
3572
|
const r = (o) => {
|
|
@@ -3537,7 +3575,7 @@ function kp(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
|
3537
3575
|
return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
|
|
3538
3576
|
}, [n, t]);
|
|
3539
3577
|
}
|
|
3540
|
-
var
|
|
3578
|
+
var kp = "DismissableLayer", Yr = "dismissableLayer.update", Dp = "dismissableLayer.pointerDownOutside", Lp = "dismissableLayer.focusOutside", Is, qa = l.createContext({
|
|
3541
3579
|
layers: /* @__PURE__ */ new Set(),
|
|
3542
3580
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
3543
3581
|
branches: /* @__PURE__ */ new Set()
|
|
@@ -3551,14 +3589,14 @@ var Mp = "DismissableLayer", Yr = "dismissableLayer.update", Dp = "dismissableLa
|
|
|
3551
3589
|
onInteractOutside: a,
|
|
3552
3590
|
onDismiss: i,
|
|
3553
3591
|
...u
|
|
3554
|
-
} = 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 =
|
|
3555
|
-
const
|
|
3556
|
-
!E ||
|
|
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());
|
|
3557
3595
|
}, g), I = Up((N) => {
|
|
3558
|
-
const
|
|
3559
|
-
[...f.branches].some((
|
|
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());
|
|
3560
3598
|
}, g);
|
|
3561
|
-
return
|
|
3599
|
+
return Mp((N) => {
|
|
3562
3600
|
y === f.layers.size - 1 && (r == null || r(N), !N.defaultPrevented && i && (N.preventDefault(), i()));
|
|
3563
3601
|
}, g), l.useEffect(() => {
|
|
3564
3602
|
if (d)
|
|
@@ -3589,9 +3627,9 @@ var Mp = "DismissableLayer", Yr = "dismissableLayer.update", Dp = "dismissableLa
|
|
|
3589
3627
|
);
|
|
3590
3628
|
}
|
|
3591
3629
|
);
|
|
3592
|
-
ln.displayName =
|
|
3630
|
+
ln.displayName = kp;
|
|
3593
3631
|
var Fp = "DismissableLayerBranch", $p = l.forwardRef((e, t) => {
|
|
3594
|
-
const n = l.useContext(qa), r = l.useRef(null), o =
|
|
3632
|
+
const n = l.useContext(qa), r = l.useRef(null), o = te(t, r);
|
|
3595
3633
|
return l.useEffect(() => {
|
|
3596
3634
|
const s = r.current;
|
|
3597
3635
|
if (s)
|
|
@@ -3657,23 +3695,23 @@ var _r = 0;
|
|
|
3657
3695
|
function Eo() {
|
|
3658
3696
|
l.useEffect(() => {
|
|
3659
3697
|
const e = document.querySelectorAll("[data-radix-focus-guard]");
|
|
3660
|
-
return document.body.insertAdjacentElement("afterbegin", e[0] ??
|
|
3698
|
+
return document.body.insertAdjacentElement("afterbegin", e[0] ?? Ms()), document.body.insertAdjacentElement("beforeend", e[1] ?? Ms()), _r++, () => {
|
|
3661
3699
|
_r === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), _r--;
|
|
3662
3700
|
};
|
|
3663
3701
|
}, []);
|
|
3664
3702
|
}
|
|
3665
|
-
function
|
|
3703
|
+
function Ms() {
|
|
3666
3704
|
const e = document.createElement("span");
|
|
3667
3705
|
return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
|
|
3668
3706
|
}
|
|
3669
|
-
var Ir = "focusScope.autoFocusOnMount", Or = "focusScope.autoFocusOnUnmount",
|
|
3707
|
+
var Ir = "focusScope.autoFocusOnMount", Or = "focusScope.autoFocusOnUnmount", ks = { bubbles: !1, cancelable: !0 }, zp = "FocusScope", nr = l.forwardRef((e, t) => {
|
|
3670
3708
|
const {
|
|
3671
3709
|
loop: n = !1,
|
|
3672
3710
|
trapped: r = !1,
|
|
3673
3711
|
onMountAutoFocus: o,
|
|
3674
3712
|
onUnmountAutoFocus: s,
|
|
3675
3713
|
...a
|
|
3676
|
-
} = e, [i, u] = l.useState(null), f = ye(o), d = ye(s), p = l.useRef(null), g =
|
|
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({
|
|
3677
3715
|
paused: !1,
|
|
3678
3716
|
pause() {
|
|
3679
3717
|
this.paused = !0;
|
|
@@ -3708,12 +3746,12 @@ var Ir = "focusScope.autoFocusOnMount", Or = "focusScope.autoFocusOnUnmount", Ms
|
|
|
3708
3746
|
Ls.add(v);
|
|
3709
3747
|
const h = document.activeElement;
|
|
3710
3748
|
if (!i.contains(h)) {
|
|
3711
|
-
const w = new CustomEvent(Ir,
|
|
3749
|
+
const w = new CustomEvent(Ir, ks);
|
|
3712
3750
|
i.addEventListener(Ir, f), i.dispatchEvent(w), w.defaultPrevented || (Hp(Gp(Ya(i)), { select: !0 }), document.activeElement === h && et(i));
|
|
3713
3751
|
}
|
|
3714
3752
|
return () => {
|
|
3715
3753
|
i.removeEventListener(Ir, f), setTimeout(() => {
|
|
3716
|
-
const w = new CustomEvent(Or,
|
|
3754
|
+
const w = new CustomEvent(Or, ks);
|
|
3717
3755
|
i.addEventListener(Or, d), i.dispatchEvent(w), w.defaultPrevented || et(h ?? document.body, { select: !0 }), i.removeEventListener(Or, d), Ls.remove(v);
|
|
3718
3756
|
}, 0);
|
|
3719
3757
|
};
|
|
@@ -3810,10 +3848,10 @@ const qp = ["top", "right", "bottom", "left"], st = Math.min, Pe = Math.max, $n
|
|
|
3810
3848
|
function Jr(e, t, n) {
|
|
3811
3849
|
return Pe(e, st(t, n));
|
|
3812
3850
|
}
|
|
3813
|
-
function
|
|
3851
|
+
function Ze(e, t) {
|
|
3814
3852
|
return typeof e == "function" ? e(t) : e;
|
|
3815
3853
|
}
|
|
3816
|
-
function
|
|
3854
|
+
function Qe(e) {
|
|
3817
3855
|
return e.split("-")[0];
|
|
3818
3856
|
}
|
|
3819
3857
|
function $t(e) {
|
|
@@ -3827,7 +3865,7 @@ function No(e) {
|
|
|
3827
3865
|
}
|
|
3828
3866
|
const Jp = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
3829
3867
|
function je(e) {
|
|
3830
|
-
return Jp.has(
|
|
3868
|
+
return Jp.has(Qe(e)) ? "y" : "x";
|
|
3831
3869
|
}
|
|
3832
3870
|
function To(e) {
|
|
3833
3871
|
return Ro(je(e));
|
|
@@ -3860,7 +3898,7 @@ function nh(e, t, n) {
|
|
|
3860
3898
|
}
|
|
3861
3899
|
function rh(e, t, n, r) {
|
|
3862
3900
|
const o = $t(e);
|
|
3863
|
-
let s = nh(
|
|
3901
|
+
let s = nh(Qe(e), n === "start", r);
|
|
3864
3902
|
return o && (s = s.map((a) => a + "-" + o), t && (s = s.concat(s.map(Zr)))), s;
|
|
3865
3903
|
}
|
|
3866
3904
|
function Bn(e) {
|
|
@@ -3906,7 +3944,7 @@ function Us(e, t, n) {
|
|
|
3906
3944
|
reference: r,
|
|
3907
3945
|
floating: o
|
|
3908
3946
|
} = e;
|
|
3909
|
-
const s = je(t), a = To(t), i = No(a), u =
|
|
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;
|
|
3910
3948
|
let v;
|
|
3911
3949
|
switch (u) {
|
|
3912
3950
|
case "top":
|
|
@@ -4026,7 +4064,7 @@ async function Jt(e, t) {
|
|
|
4026
4064
|
elementContext: p = "floating",
|
|
4027
4065
|
altBoundary: g = !1,
|
|
4028
4066
|
padding: v = 0
|
|
4029
|
-
} =
|
|
4067
|
+
} = Ze(t, e), m = Ja(v), b = i[g ? p === "floating" ? "reference" : "floating" : p], w = Un(await s.getClippingRect({
|
|
4030
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)),
|
|
4031
4069
|
boundary: f,
|
|
4032
4070
|
rootBoundary: d,
|
|
@@ -4070,7 +4108,7 @@ const ah = (e) => ({
|
|
|
4070
4108
|
} = t, {
|
|
4071
4109
|
element: f,
|
|
4072
4110
|
padding: d = 0
|
|
4073
|
-
} =
|
|
4111
|
+
} = Ze(e, t) || {};
|
|
4074
4112
|
if (f == null)
|
|
4075
4113
|
return {};
|
|
4076
4114
|
const p = Ja(d), g = {
|
|
@@ -4079,17 +4117,17 @@ const ah = (e) => ({
|
|
|
4079
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));
|
|
4080
4118
|
let N = I ? I[x] : 0;
|
|
4081
4119
|
(!N || !await (a.isElement == null ? void 0 : a.isElement(I))) && (N = i.floating[x] || s.floating[m]);
|
|
4082
|
-
const
|
|
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;
|
|
4083
4121
|
return {
|
|
4084
4122
|
[v]: g[v] + G,
|
|
4085
4123
|
data: {
|
|
4086
4124
|
[v]: q,
|
|
4087
4125
|
centerOffset: B - q - G,
|
|
4088
|
-
|
|
4126
|
+
...$ && {
|
|
4089
4127
|
alignmentOffset: G
|
|
4090
4128
|
}
|
|
4091
4129
|
},
|
|
4092
|
-
reset:
|
|
4130
|
+
reset: $
|
|
4093
4131
|
};
|
|
4094
4132
|
}
|
|
4095
4133
|
}), ih = function(e) {
|
|
@@ -4113,41 +4151,41 @@ const ah = (e) => ({
|
|
|
4113
4151
|
fallbackAxisSideDirection: m = "none",
|
|
4114
4152
|
flipAlignment: h = !0,
|
|
4115
4153
|
...b
|
|
4116
|
-
} =
|
|
4154
|
+
} = Ze(e, t);
|
|
4117
4155
|
if ((n = s.arrow) != null && n.alignmentOffset)
|
|
4118
4156
|
return {};
|
|
4119
|
-
const w =
|
|
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";
|
|
4120
4158
|
!g && I && C.push(...rh(i, h, m, E));
|
|
4121
|
-
const N = [i, ...C],
|
|
4122
|
-
let
|
|
4123
|
-
if (d &&
|
|
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) {
|
|
4124
4162
|
const B = Zp(o, a, E);
|
|
4125
|
-
|
|
4163
|
+
D.push(F[B[0]], F[B[1]]);
|
|
4126
4164
|
}
|
|
4127
|
-
if (
|
|
4165
|
+
if (L = [...L, {
|
|
4128
4166
|
placement: o,
|
|
4129
|
-
overflows:
|
|
4130
|
-
}], !
|
|
4167
|
+
overflows: D
|
|
4168
|
+
}], !D.every((B) => B <= 0)) {
|
|
4131
4169
|
var j, K;
|
|
4132
4170
|
const B = (((j = s.flip) == null ? void 0 : j.index) || 0) + 1, q = N[B];
|
|
4133
4171
|
if (q && (!(p === "alignment" ? y !== je(q) : !1) || // We leave the current main axis only if every placement on that axis
|
|
4134
4172
|
// overflows the main axis.
|
|
4135
|
-
|
|
4173
|
+
L.every((T) => je(T.placement) === y ? T.overflows[0] > 0 : !0)))
|
|
4136
4174
|
return {
|
|
4137
4175
|
data: {
|
|
4138
4176
|
index: B,
|
|
4139
|
-
overflows:
|
|
4177
|
+
overflows: L
|
|
4140
4178
|
},
|
|
4141
4179
|
reset: {
|
|
4142
4180
|
placement: q
|
|
4143
4181
|
}
|
|
4144
4182
|
};
|
|
4145
|
-
let
|
|
4146
|
-
if (
|
|
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 (!$)
|
|
4147
4185
|
switch (v) {
|
|
4148
4186
|
case "bestFit": {
|
|
4149
4187
|
var W;
|
|
4150
|
-
const G = (W =
|
|
4188
|
+
const G = (W = L.filter((T) => {
|
|
4151
4189
|
if (I) {
|
|
4152
4190
|
const P = je(T.placement);
|
|
4153
4191
|
return P === y || // Create a bias to the `y` side axis due to horizontal
|
|
@@ -4156,17 +4194,17 @@ const ah = (e) => ({
|
|
|
4156
4194
|
}
|
|
4157
4195
|
return !0;
|
|
4158
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];
|
|
4159
|
-
G && (
|
|
4197
|
+
G && ($ = G);
|
|
4160
4198
|
break;
|
|
4161
4199
|
}
|
|
4162
4200
|
case "initialPlacement":
|
|
4163
|
-
|
|
4201
|
+
$ = i;
|
|
4164
4202
|
break;
|
|
4165
4203
|
}
|
|
4166
|
-
if (o !==
|
|
4204
|
+
if (o !== $)
|
|
4167
4205
|
return {
|
|
4168
4206
|
reset: {
|
|
4169
|
-
placement:
|
|
4207
|
+
placement: $
|
|
4170
4208
|
}
|
|
4171
4209
|
};
|
|
4172
4210
|
}
|
|
@@ -4195,7 +4233,7 @@ const ch = function(e) {
|
|
|
4195
4233
|
} = t, {
|
|
4196
4234
|
strategy: r = "referenceHidden",
|
|
4197
4235
|
...o
|
|
4198
|
-
} =
|
|
4236
|
+
} = Ze(e, t);
|
|
4199
4237
|
switch (r) {
|
|
4200
4238
|
case "referenceHidden": {
|
|
4201
4239
|
const s = await Jt(t, {
|
|
@@ -4232,7 +4270,7 @@ async function lh(e, t) {
|
|
|
4232
4270
|
placement: n,
|
|
4233
4271
|
platform: r,
|
|
4234
4272
|
elements: o
|
|
4235
|
-
} = e, s = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), a =
|
|
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);
|
|
4236
4274
|
let {
|
|
4237
4275
|
mainAxis: g,
|
|
4238
4276
|
crossAxis: v,
|
|
@@ -4301,10 +4339,10 @@ const uh = function(e) {
|
|
|
4301
4339
|
}
|
|
4302
4340
|
},
|
|
4303
4341
|
...u
|
|
4304
|
-
} =
|
|
4342
|
+
} = Ze(e, t), f = {
|
|
4305
4343
|
x: n,
|
|
4306
4344
|
y: r
|
|
4307
|
-
}, d = await Jt(t, u), p = je(
|
|
4345
|
+
}, d = await Jt(t, u), p = je(Qe(o)), g = Ro(p);
|
|
4308
4346
|
let v = f[g], m = f[p];
|
|
4309
4347
|
if (s) {
|
|
4310
4348
|
const b = g === "y" ? "top" : "left", w = g === "y" ? "bottom" : "right", y = v + d[b], x = v - d[w];
|
|
@@ -4346,12 +4384,12 @@ const uh = function(e) {
|
|
|
4346
4384
|
offset: i = 0,
|
|
4347
4385
|
mainAxis: u = !0,
|
|
4348
4386
|
crossAxis: f = !0
|
|
4349
|
-
} =
|
|
4387
|
+
} = Ze(e, t), d = {
|
|
4350
4388
|
x: n,
|
|
4351
4389
|
y: r
|
|
4352
4390
|
}, p = je(o), g = Ro(p);
|
|
4353
4391
|
let v = d[g], m = d[p];
|
|
4354
|
-
const h =
|
|
4392
|
+
const h = Ze(i, t), b = typeof h == "number" ? {
|
|
4355
4393
|
mainAxis: h,
|
|
4356
4394
|
crossAxis: 0
|
|
4357
4395
|
} : {
|
|
@@ -4365,7 +4403,7 @@ const uh = function(e) {
|
|
|
4365
4403
|
}
|
|
4366
4404
|
if (f) {
|
|
4367
4405
|
var w, y;
|
|
4368
|
-
const x = g === "y" ? "width" : "height", E = Za.has(
|
|
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);
|
|
4369
4407
|
m < C ? m = C : m > I && (m = I);
|
|
4370
4408
|
}
|
|
4371
4409
|
return {
|
|
@@ -4389,25 +4427,25 @@ const uh = function(e) {
|
|
|
4389
4427
|
apply: u = () => {
|
|
4390
4428
|
},
|
|
4391
4429
|
...f
|
|
4392
|
-
} =
|
|
4430
|
+
} = Ze(e, t), d = await Jt(t, f), p = Qe(o), g = $t(o), v = je(o) === "y", {
|
|
4393
4431
|
width: m,
|
|
4394
4432
|
height: h
|
|
4395
4433
|
} = s.floating;
|
|
4396
4434
|
let b, w;
|
|
4397
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");
|
|
4398
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;
|
|
4399
|
-
let N = E,
|
|
4400
|
-
if ((n = t.middlewareData.shift) != null && n.enabled.x && (
|
|
4401
|
-
const
|
|
4402
|
-
v ?
|
|
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));
|
|
4403
4441
|
}
|
|
4404
4442
|
await u({
|
|
4405
4443
|
...t,
|
|
4406
|
-
availableWidth:
|
|
4444
|
+
availableWidth: F,
|
|
4407
4445
|
availableHeight: N
|
|
4408
4446
|
});
|
|
4409
|
-
const
|
|
4410
|
-
return m !==
|
|
4447
|
+
const D = await a.getDimensions(i.floating);
|
|
4448
|
+
return m !== D.width || h !== D.height ? {
|
|
4411
4449
|
reset: {
|
|
4412
4450
|
rects: !0
|
|
4413
4451
|
}
|
|
@@ -4727,7 +4765,7 @@ function Oh(e) {
|
|
|
4727
4765
|
y: u.top
|
|
4728
4766
|
};
|
|
4729
4767
|
}
|
|
4730
|
-
function
|
|
4768
|
+
function Mh(e) {
|
|
4731
4769
|
const {
|
|
4732
4770
|
width: t,
|
|
4733
4771
|
height: n
|
|
@@ -4737,7 +4775,7 @@ function kh(e) {
|
|
|
4737
4775
|
height: n
|
|
4738
4776
|
};
|
|
4739
4777
|
}
|
|
4740
|
-
function
|
|
4778
|
+
function kh(e, t, n) {
|
|
4741
4779
|
const r = qe(t), o = Xe(t), s = n === "fixed", a = ht(e, !0, s, t);
|
|
4742
4780
|
let i = {
|
|
4743
4781
|
scrollLeft: 0,
|
|
@@ -4761,7 +4799,7 @@ function Mh(e, t, n) {
|
|
|
4761
4799
|
height: a.height
|
|
4762
4800
|
};
|
|
4763
4801
|
}
|
|
4764
|
-
function
|
|
4802
|
+
function Mr(e) {
|
|
4765
4803
|
return $e(e).position === "static";
|
|
4766
4804
|
}
|
|
4767
4805
|
function Ks(e, t) {
|
|
@@ -4779,21 +4817,21 @@ function si(e, t) {
|
|
|
4779
4817
|
if (!qe(e)) {
|
|
4780
4818
|
let o = at(e);
|
|
4781
4819
|
for (; o && !Ot(o); ) {
|
|
4782
|
-
if (Fe(o) && !
|
|
4820
|
+
if (Fe(o) && !Mr(o))
|
|
4783
4821
|
return o;
|
|
4784
4822
|
o = at(o);
|
|
4785
4823
|
}
|
|
4786
4824
|
return n;
|
|
4787
4825
|
}
|
|
4788
4826
|
let r = Ks(e, t);
|
|
4789
|
-
for (; r && gh(r) &&
|
|
4827
|
+
for (; r && gh(r) && Mr(r); )
|
|
4790
4828
|
r = Ks(r, t);
|
|
4791
|
-
return r && Ot(r) &&
|
|
4829
|
+
return r && Ot(r) && Mr(r) && !Ao(r) ? n : r || xh(e) || n;
|
|
4792
4830
|
}
|
|
4793
4831
|
const Dh = async function(e) {
|
|
4794
4832
|
const t = this.getOffsetParent || si, n = this.getDimensions, r = await n(e.floating);
|
|
4795
4833
|
return {
|
|
4796
|
-
reference:
|
|
4834
|
+
reference: kh(e.reference, await t(e.floating), e.strategy),
|
|
4797
4835
|
floating: {
|
|
4798
4836
|
x: 0,
|
|
4799
4837
|
y: 0,
|
|
@@ -4812,7 +4850,7 @@ const Fh = {
|
|
|
4812
4850
|
getOffsetParent: si,
|
|
4813
4851
|
getElementRects: Dh,
|
|
4814
4852
|
getClientRects: Nh,
|
|
4815
|
-
getDimensions:
|
|
4853
|
+
getDimensions: Mh,
|
|
4816
4854
|
getScale: At,
|
|
4817
4855
|
isElement: Fe,
|
|
4818
4856
|
isRTL: Lh
|
|
@@ -4954,7 +4992,7 @@ function qs(e, t) {
|
|
|
4954
4992
|
const n = ii(e);
|
|
4955
4993
|
return Math.round(t * n) / n;
|
|
4956
4994
|
}
|
|
4957
|
-
function
|
|
4995
|
+
function kr(e) {
|
|
4958
4996
|
const t = l.useRef(e);
|
|
4959
4997
|
return Nn(() => {
|
|
4960
4998
|
t.current = e;
|
|
@@ -4987,7 +5025,7 @@ function Xh(e) {
|
|
|
4987
5025
|
T !== I.current && (I.current = T, h(T));
|
|
4988
5026
|
}, []), x = l.useCallback((T) => {
|
|
4989
5027
|
T !== N.current && (N.current = T, w(T));
|
|
4990
|
-
}, []), E = s || m, C = a || b, I = l.useRef(null), N = l.useRef(null),
|
|
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(() => {
|
|
4991
5029
|
if (!I.current || !N.current)
|
|
4992
5030
|
return;
|
|
4993
5031
|
const T = {
|
|
@@ -5004,13 +5042,13 @@ function Xh(e) {
|
|
|
5004
5042
|
// setting it to `true` when `open === false` (must be specified).
|
|
5005
5043
|
isPositioned: K.current !== !1
|
|
5006
5044
|
};
|
|
5007
|
-
B.current && !zn(
|
|
5045
|
+
B.current && !zn(F.current, _) && (F.current = _, qn.flushSync(() => {
|
|
5008
5046
|
p(_);
|
|
5009
5047
|
}));
|
|
5010
5048
|
});
|
|
5011
5049
|
}, [g, t, n, j, K]);
|
|
5012
5050
|
Nn(() => {
|
|
5013
|
-
f === !1 &&
|
|
5051
|
+
f === !1 && F.current.isPositioned && (F.current.isPositioned = !1, p((T) => ({
|
|
5014
5052
|
...T,
|
|
5015
5053
|
isPositioned: !1
|
|
5016
5054
|
})));
|
|
@@ -5020,17 +5058,17 @@ function Xh(e) {
|
|
|
5020
5058
|
B.current = !1;
|
|
5021
5059
|
}), []), Nn(() => {
|
|
5022
5060
|
if (E && (I.current = E), C && (N.current = C), E && C) {
|
|
5023
|
-
if (
|
|
5024
|
-
return
|
|
5061
|
+
if (L.current)
|
|
5062
|
+
return L.current(E, C, W);
|
|
5025
5063
|
W();
|
|
5026
5064
|
}
|
|
5027
|
-
}, [E, C, W,
|
|
5065
|
+
}, [E, C, W, L, D]);
|
|
5028
5066
|
const q = l.useMemo(() => ({
|
|
5029
5067
|
reference: I,
|
|
5030
5068
|
floating: N,
|
|
5031
5069
|
setReference: y,
|
|
5032
5070
|
setFloating: x
|
|
5033
|
-
}), [y, x]),
|
|
5071
|
+
}), [y, x]), $ = l.useMemo(() => ({
|
|
5034
5072
|
reference: E,
|
|
5035
5073
|
floating: C
|
|
5036
5074
|
}), [E, C]), G = l.useMemo(() => {
|
|
@@ -5039,13 +5077,13 @@ function Xh(e) {
|
|
|
5039
5077
|
left: 0,
|
|
5040
5078
|
top: 0
|
|
5041
5079
|
};
|
|
5042
|
-
if (
|
|
5080
|
+
if (!$.floating)
|
|
5043
5081
|
return T;
|
|
5044
|
-
const P = qs(
|
|
5082
|
+
const P = qs($.floating, d.x), _ = qs($.floating, d.y);
|
|
5045
5083
|
return i ? {
|
|
5046
5084
|
...T,
|
|
5047
5085
|
transform: "translate(" + P + "px, " + _ + "px)",
|
|
5048
|
-
...ii(
|
|
5086
|
+
...ii($.floating) >= 1.5 && {
|
|
5049
5087
|
willChange: "transform"
|
|
5050
5088
|
}
|
|
5051
5089
|
} : {
|
|
@@ -5053,14 +5091,14 @@ function Xh(e) {
|
|
|
5053
5091
|
left: P,
|
|
5054
5092
|
top: _
|
|
5055
5093
|
};
|
|
5056
|
-
}, [n, i,
|
|
5094
|
+
}, [n, i, $.floating, d.x, d.y]);
|
|
5057
5095
|
return l.useMemo(() => ({
|
|
5058
5096
|
...d,
|
|
5059
5097
|
update: W,
|
|
5060
5098
|
refs: q,
|
|
5061
|
-
elements:
|
|
5099
|
+
elements: $,
|
|
5062
5100
|
floatingStyles: G
|
|
5063
|
-
}), [d, W, q,
|
|
5101
|
+
}), [d, W, q, $, G]);
|
|
5064
5102
|
}
|
|
5065
5103
|
const Yh = (e) => {
|
|
5066
5104
|
function t(n) {
|
|
@@ -5151,7 +5189,7 @@ var Io = "Popper", [ui, Ut] = Ue(Io), [am, di] = ui(Io), fi = (e) => {
|
|
|
5151
5189
|
fi.displayName = Io;
|
|
5152
5190
|
var pi = "PopperAnchor", hi = l.forwardRef(
|
|
5153
5191
|
(e, t) => {
|
|
5154
|
-
const { __scopePopper: n, virtualRef: r, ...o } = e, s = di(pi, n), a = l.useRef(null), i =
|
|
5192
|
+
const { __scopePopper: n, virtualRef: r, ...o } = e, s = di(pi, n), a = l.useRef(null), i = te(t, a), u = l.useRef(null);
|
|
5155
5193
|
return l.useEffect(() => {
|
|
5156
5194
|
const f = u.current;
|
|
5157
5195
|
u.current = (r == null ? void 0 : r.current) || a.current, f !== u.current && s.onAnchorChange(u.current);
|
|
@@ -5161,7 +5199,7 @@ var pi = "PopperAnchor", hi = l.forwardRef(
|
|
|
5161
5199
|
hi.displayName = pi;
|
|
5162
5200
|
var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
|
|
5163
5201
|
(e, t) => {
|
|
5164
|
-
var V,
|
|
5202
|
+
var V, re, ie, oe, H, Z;
|
|
5165
5203
|
const {
|
|
5166
5204
|
__scopePopper: n,
|
|
5167
5205
|
side: r = "bottom",
|
|
@@ -5177,15 +5215,15 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
|
|
|
5177
5215
|
updatePositionStrategy: v = "optimized",
|
|
5178
5216
|
onPlaced: m,
|
|
5179
5217
|
...h
|
|
5180
|
-
} = e, b = di(Oo, n), [w, y] = l.useState(null), x =
|
|
5181
|
-
padding:
|
|
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,
|
|
5182
5220
|
boundary: j.filter(um),
|
|
5183
5221
|
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
5184
5222
|
altBoundary: K
|
|
5185
|
-
}, { refs: B, floatingStyles: q, placement:
|
|
5223
|
+
}, { refs: B, floatingStyles: q, placement: $, isPositioned: G, middlewareData: T } = Xh({
|
|
5186
5224
|
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
5187
5225
|
strategy: "fixed",
|
|
5188
|
-
placement:
|
|
5226
|
+
placement: D,
|
|
5189
5227
|
whileElementsMounted: (...de) => Bh(...de, {
|
|
5190
5228
|
animationFrame: v === "always"
|
|
5191
5229
|
}),
|
|
@@ -5193,7 +5231,7 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
|
|
|
5193
5231
|
reference: b.anchor
|
|
5194
5232
|
},
|
|
5195
5233
|
middleware: [
|
|
5196
|
-
Jh({ mainAxis: o +
|
|
5234
|
+
Jh({ mainAxis: o + F, alignmentAxis: a }),
|
|
5197
5235
|
u && Zh({
|
|
5198
5236
|
mainAxis: !0,
|
|
5199
5237
|
crossAxis: !1,
|
|
@@ -5203,22 +5241,22 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
|
|
|
5203
5241
|
u && em({ ...W }),
|
|
5204
5242
|
tm({
|
|
5205
5243
|
...W,
|
|
5206
|
-
apply: ({ elements: de, rects:
|
|
5207
|
-
const { width:
|
|
5208
|
-
|
|
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`);
|
|
5209
5247
|
}
|
|
5210
5248
|
}),
|
|
5211
5249
|
E && rm({ element: E, padding: i }),
|
|
5212
|
-
dm({ arrowWidth: N, arrowHeight:
|
|
5250
|
+
dm({ arrowWidth: N, arrowHeight: F }),
|
|
5213
5251
|
g && nm({ strategy: "referenceHidden", ...W })
|
|
5214
5252
|
]
|
|
5215
|
-
}), [P, _] = vi(
|
|
5253
|
+
}), [P, _] = vi($), O = ye(m);
|
|
5216
5254
|
be(() => {
|
|
5217
5255
|
G && (O == null || O());
|
|
5218
5256
|
}, [G, O]);
|
|
5219
|
-
const
|
|
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();
|
|
5220
5258
|
return be(() => {
|
|
5221
|
-
w &&
|
|
5259
|
+
w && se(window.getComputedStyle(w).zIndex);
|
|
5222
5260
|
}, [w]), /* @__PURE__ */ c(
|
|
5223
5261
|
"div",
|
|
5224
5262
|
{
|
|
@@ -5231,7 +5269,7 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
|
|
|
5231
5269
|
minWidth: "max-content",
|
|
5232
5270
|
zIndex: le,
|
|
5233
5271
|
"--radix-popper-transform-origin": [
|
|
5234
|
-
(
|
|
5272
|
+
(oe = T.transformOrigin) == null ? void 0 : oe.x,
|
|
5235
5273
|
(H = T.transformOrigin) == null ? void 0 : H.y
|
|
5236
5274
|
].join(" "),
|
|
5237
5275
|
// hide the content if using the hide middleware and should be hidden
|
|
@@ -5249,8 +5287,8 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
|
|
|
5249
5287
|
scope: n,
|
|
5250
5288
|
placedSide: P,
|
|
5251
5289
|
onArrowChange: C,
|
|
5252
|
-
arrowX:
|
|
5253
|
-
arrowY:
|
|
5290
|
+
arrowX: Y,
|
|
5291
|
+
arrowY: M,
|
|
5254
5292
|
shouldHideArrow: z,
|
|
5255
5293
|
children: /* @__PURE__ */ c(
|
|
5256
5294
|
J.div,
|
|
@@ -5342,7 +5380,7 @@ function vi(e) {
|
|
|
5342
5380
|
const [t, n = "center"] = e.split("-");
|
|
5343
5381
|
return [t, n];
|
|
5344
5382
|
}
|
|
5345
|
-
var
|
|
5383
|
+
var Mo = fi, ko = hi, Do = mi, Lo = bi, fm = "Portal", ir = l.forwardRef((e, t) => {
|
|
5346
5384
|
var i;
|
|
5347
5385
|
const { container: n, ...r } = e, [o, s] = l.useState(!1);
|
|
5348
5386
|
be(() => s(!0), []);
|
|
@@ -5369,16 +5407,16 @@ var vm = l.forwardRef((e, t) => {
|
|
|
5369
5407
|
onEntryFocus: f,
|
|
5370
5408
|
preventScrollOnEntryFocus: d = !1,
|
|
5371
5409
|
...p
|
|
5372
|
-
} = e, g = l.useRef(null), v =
|
|
5410
|
+
} = e, g = l.useRef(null), v = te(t, g), m = tr(s), [h, b] = ot({
|
|
5373
5411
|
prop: a,
|
|
5374
5412
|
defaultProp: i ?? null,
|
|
5375
5413
|
onChange: u,
|
|
5376
5414
|
caller: dn
|
|
5377
5415
|
}), [w, y] = l.useState(!1), x = ye(f), E = wi(n), C = l.useRef(!1), [I, N] = l.useState(0);
|
|
5378
5416
|
return l.useEffect(() => {
|
|
5379
|
-
const
|
|
5380
|
-
if (
|
|
5381
|
-
return
|
|
5417
|
+
const F = g.current;
|
|
5418
|
+
if (F)
|
|
5419
|
+
return F.addEventListener(Dr, x), () => F.removeEventListener(Dr, x);
|
|
5382
5420
|
}, [x]), /* @__PURE__ */ c(
|
|
5383
5421
|
gm,
|
|
5384
5422
|
{
|
|
@@ -5388,16 +5426,16 @@ var vm = l.forwardRef((e, t) => {
|
|
|
5388
5426
|
loop: o,
|
|
5389
5427
|
currentTabStopId: h,
|
|
5390
5428
|
onItemFocus: l.useCallback(
|
|
5391
|
-
(
|
|
5429
|
+
(F) => b(F),
|
|
5392
5430
|
[b]
|
|
5393
5431
|
),
|
|
5394
5432
|
onItemShiftTab: l.useCallback(() => y(!0), []),
|
|
5395
5433
|
onFocusableItemAdd: l.useCallback(
|
|
5396
|
-
() => N((
|
|
5434
|
+
() => N((F) => F + 1),
|
|
5397
5435
|
[]
|
|
5398
5436
|
),
|
|
5399
5437
|
onFocusableItemRemove: l.useCallback(
|
|
5400
|
-
() => N((
|
|
5438
|
+
() => N((F) => F - 1),
|
|
5401
5439
|
[]
|
|
5402
5440
|
),
|
|
5403
5441
|
children: /* @__PURE__ */ c(
|
|
@@ -5411,14 +5449,14 @@ var vm = l.forwardRef((e, t) => {
|
|
|
5411
5449
|
onMouseDown: U(e.onMouseDown, () => {
|
|
5412
5450
|
C.current = !0;
|
|
5413
5451
|
}),
|
|
5414
|
-
onFocus: U(e.onFocus, (
|
|
5415
|
-
const
|
|
5416
|
-
if (
|
|
5417
|
-
const
|
|
5418
|
-
if (
|
|
5419
|
-
const j = E().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(
|
|
5420
5458
|
Boolean
|
|
5421
|
-
).map((
|
|
5459
|
+
).map(($) => $.ref.current);
|
|
5422
5460
|
Ei(q, d);
|
|
5423
5461
|
}
|
|
5424
5462
|
}
|
|
@@ -5610,7 +5648,7 @@ function Im(e, t) {
|
|
|
5610
5648
|
return n.callback = t, n.facade;
|
|
5611
5649
|
}
|
|
5612
5650
|
var Om = typeof window < "u" ? l.useLayoutEffect : l.useEffect, Xs = /* @__PURE__ */ new WeakMap();
|
|
5613
|
-
function
|
|
5651
|
+
function Mm(e, t) {
|
|
5614
5652
|
var n = Im(null, function(r) {
|
|
5615
5653
|
return e.forEach(function(o) {
|
|
5616
5654
|
return Fr(o, r);
|
|
@@ -5629,11 +5667,11 @@ function km(e, t) {
|
|
|
5629
5667
|
Xs.set(n, e);
|
|
5630
5668
|
}, [e]), n;
|
|
5631
5669
|
}
|
|
5632
|
-
function
|
|
5670
|
+
function km(e) {
|
|
5633
5671
|
return e;
|
|
5634
5672
|
}
|
|
5635
5673
|
function Dm(e, t) {
|
|
5636
|
-
t === void 0 && (t =
|
|
5674
|
+
t === void 0 && (t = km);
|
|
5637
5675
|
var n = [], r = !1, o = {
|
|
5638
5676
|
read: function() {
|
|
5639
5677
|
if (r)
|
|
@@ -5711,7 +5749,7 @@ var Ai = Lm(), $r = function() {
|
|
|
5711
5749
|
onScrollCapture: $r,
|
|
5712
5750
|
onWheelCapture: $r,
|
|
5713
5751
|
onTouchMoveCapture: $r
|
|
5714
|
-
}), o = r[0], s = r[1], a = e.forwardProps, i = e.children, u = e.className, f = e.removeScrollBar, d = e.enabled, p = e.shards, g = e.sideCar, v = e.noRelative, m = e.noIsolation, h = e.inert, b = e.allowPinchZoom, w = e.as, y = w === void 0 ? "div" : w, x = e.gapMode, E = Ni(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), C = g, I =
|
|
5752
|
+
}), o = r[0], s = r[1], a = e.forwardProps, i = e.children, u = e.className, f = e.removeScrollBar, d = e.enabled, p = e.shards, g = e.sideCar, v = e.noRelative, m = e.noIsolation, h = e.inert, b = e.allowPinchZoom, w = e.as, y = w === void 0 ? "div" : w, x = e.gapMode, E = Ni(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), C = g, I = Mm([n, t]), N = Ve(Ve({}, E), o);
|
|
5715
5753
|
return l.createElement(
|
|
5716
5754
|
l.Fragment,
|
|
5717
5755
|
null,
|
|
@@ -5965,15 +6003,15 @@ function ig(e) {
|
|
|
5965
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";
|
|
5966
6004
|
if ("touches" in h && N === "h" && I.type === "range")
|
|
5967
6005
|
return !1;
|
|
5968
|
-
var
|
|
5969
|
-
if (!
|
|
6006
|
+
var F = Js(N, I);
|
|
6007
|
+
if (!F)
|
|
5970
6008
|
return !0;
|
|
5971
|
-
if (
|
|
6009
|
+
if (F ? C = N : (C = N === "v" ? "h" : "v", F = Js(N, I)), !F)
|
|
5972
6010
|
return !1;
|
|
5973
6011
|
if (!r.current && "changedTouches" in h && (x || E) && (r.current = C), !C)
|
|
5974
6012
|
return !0;
|
|
5975
|
-
var
|
|
5976
|
-
return rg(
|
|
6013
|
+
var D = r.current || C;
|
|
6014
|
+
return rg(D, b, h, D === "h" ? x : E);
|
|
5977
6015
|
}, []), u = l.useCallback(function(h) {
|
|
5978
6016
|
var b = h;
|
|
5979
6017
|
if (!(!Rt.length || Rt[Rt.length - 1] !== s)) {
|
|
@@ -6034,13 +6072,13 @@ var lr = l.forwardRef(function(e, t) {
|
|
|
6034
6072
|
return l.createElement(cr, Ve({}, e, { ref: t, sideCar: lg }));
|
|
6035
6073
|
});
|
|
6036
6074
|
lr.classNames = cr.classNames;
|
|
6037
|
-
var no = ["Enter", " "], ug = ["ArrowDown", "PageUp", "Home"],
|
|
6075
|
+
var no = ["Enter", " "], ug = ["ArrowDown", "PageUp", "Home"], Mi = ["ArrowUp", "PageDown", "End"], dg = [...ug, ...Mi], fg = {
|
|
6038
6076
|
ltr: [...no, "ArrowRight"],
|
|
6039
6077
|
rtl: [...no, "ArrowLeft"]
|
|
6040
6078
|
}, pg = {
|
|
6041
6079
|
ltr: ["ArrowLeft"],
|
|
6042
6080
|
rtl: ["ArrowRight"]
|
|
6043
|
-
}, fn = "Menu", [Qt, hg, mg] = Co(fn), [vt,
|
|
6081
|
+
}, fn = "Menu", [Qt, hg, mg] = Co(fn), [vt, ki] = Ue(fn, [
|
|
6044
6082
|
mg,
|
|
6045
6083
|
Ut,
|
|
6046
6084
|
yi
|
|
@@ -6053,7 +6091,7 @@ var no = ["Enter", " "], ug = ["ArrowDown", "PageUp", "Home"], ki = ["ArrowUp",
|
|
|
6053
6091
|
return document.addEventListener("keydown", v, { capture: !0 }), () => {
|
|
6054
6092
|
document.removeEventListener("keydown", v, { capture: !0 }), document.removeEventListener("pointerdown", m, { capture: !0 }), document.removeEventListener("pointermove", m, { capture: !0 });
|
|
6055
6093
|
};
|
|
6056
|
-
}, []), /* @__PURE__ */ c(
|
|
6094
|
+
}, []), /* @__PURE__ */ c(Mo, { ...i, children: /* @__PURE__ */ c(
|
|
6057
6095
|
gg,
|
|
6058
6096
|
{
|
|
6059
6097
|
scope: t,
|
|
@@ -6079,7 +6117,7 @@ Li.displayName = fn;
|
|
|
6079
6117
|
var vg = "MenuAnchor", $o = l.forwardRef(
|
|
6080
6118
|
(e, t) => {
|
|
6081
6119
|
const { __scopeMenu: n, ...r } = e, o = ur(n);
|
|
6082
|
-
return /* @__PURE__ */ c(
|
|
6120
|
+
return /* @__PURE__ */ c(ko, { ...o, ...r, ref: t });
|
|
6083
6121
|
}
|
|
6084
6122
|
);
|
|
6085
6123
|
$o.displayName = vg;
|
|
@@ -6097,7 +6135,7 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
|
|
|
6097
6135
|
}
|
|
6098
6136
|
), xg = l.forwardRef(
|
|
6099
6137
|
(e, t) => {
|
|
6100
|
-
const n = wt(Oe, e.__scopeMenu), r = l.useRef(null), o =
|
|
6138
|
+
const n = wt(Oe, e.__scopeMenu), r = l.useRef(null), o = te(t, r);
|
|
6101
6139
|
return l.useEffect(() => {
|
|
6102
6140
|
const s = r.current;
|
|
6103
6141
|
if (s) return Fo(s);
|
|
@@ -6148,23 +6186,23 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
|
|
|
6148
6186
|
onDismiss: v,
|
|
6149
6187
|
disableOutsideScroll: m,
|
|
6150
6188
|
...h
|
|
6151
|
-
} = 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),
|
|
6152
|
-
var V,
|
|
6153
|
-
const _ =
|
|
6154
|
-
(function ie(
|
|
6155
|
-
|
|
6156
|
-
})(_),
|
|
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());
|
|
6157
6195
|
};
|
|
6158
|
-
l.useEffect(() => () => window.clearTimeout(
|
|
6196
|
+
l.useEffect(() => () => window.clearTimeout(D.current), []), Eo();
|
|
6159
6197
|
const T = l.useCallback((P) => {
|
|
6160
|
-
var O,
|
|
6161
|
-
return W.current === ((O = K.current) == null ? void 0 : O.side) && Fg(P, (
|
|
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);
|
|
6162
6200
|
}, []);
|
|
6163
6201
|
return /* @__PURE__ */ c(
|
|
6164
6202
|
yg,
|
|
6165
6203
|
{
|
|
6166
6204
|
scope: n,
|
|
6167
|
-
searchRef:
|
|
6205
|
+
searchRef: L,
|
|
6168
6206
|
onItemEnter: l.useCallback(
|
|
6169
6207
|
(P) => {
|
|
6170
6208
|
T(P) && P.preventDefault();
|
|
@@ -6188,7 +6226,7 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
|
|
|
6188
6226
|
onPointerGraceIntentChange: l.useCallback((P) => {
|
|
6189
6227
|
K.current = P;
|
|
6190
6228
|
}, []),
|
|
6191
|
-
children: /* @__PURE__ */ c(q, {
|
|
6229
|
+
children: /* @__PURE__ */ c(q, { ...$, children: /* @__PURE__ */ c(
|
|
6192
6230
|
nr,
|
|
6193
6231
|
{
|
|
6194
6232
|
asChild: !0,
|
|
@@ -6232,27 +6270,27 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
|
|
|
6232
6270
|
dir: w.dir,
|
|
6233
6271
|
...y,
|
|
6234
6272
|
...h,
|
|
6235
|
-
ref:
|
|
6273
|
+
ref: F,
|
|
6236
6274
|
style: { outline: "none", ...h.style },
|
|
6237
6275
|
onKeyDown: U(h.onKeyDown, (P) => {
|
|
6238
|
-
const O = P.target.closest("[data-radix-menu-content]") === P.currentTarget,
|
|
6239
|
-
O && (P.key === "Tab" && P.preventDefault(), !
|
|
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));
|
|
6240
6278
|
const z = N.current;
|
|
6241
6279
|
if (P.target !== z || !dg.includes(P.key)) return;
|
|
6242
6280
|
P.preventDefault();
|
|
6243
|
-
const
|
|
6244
|
-
|
|
6281
|
+
const se = E().filter((V) => !V.disabled).map((V) => V.ref.current);
|
|
6282
|
+
Mi.includes(P.key) && se.reverse(), Mg(se);
|
|
6245
6283
|
}),
|
|
6246
6284
|
onBlur: U(e.onBlur, (P) => {
|
|
6247
|
-
P.currentTarget.contains(P.target) || (window.clearTimeout(
|
|
6285
|
+
P.currentTarget.contains(P.target) || (window.clearTimeout(D.current), L.current = "");
|
|
6248
6286
|
}),
|
|
6249
6287
|
onPointerMove: U(
|
|
6250
6288
|
e.onPointerMove,
|
|
6251
6289
|
en((P) => {
|
|
6252
6290
|
const _ = P.target, O = B.current !== P.clientX;
|
|
6253
6291
|
if (P.currentTarget.contains(_) && O) {
|
|
6254
|
-
const
|
|
6255
|
-
W.current =
|
|
6292
|
+
const Y = P.clientX > B.current ? "right" : "left";
|
|
6293
|
+
W.current = Y, B.current = P.clientX;
|
|
6256
6294
|
}
|
|
6257
6295
|
})
|
|
6258
6296
|
)
|
|
@@ -6285,7 +6323,7 @@ var Rg = "MenuLabel", Ui = l.forwardRef(
|
|
|
6285
6323
|
Ui.displayName = Rg;
|
|
6286
6324
|
var Hn = "MenuItem", ea = "menu.itemSelect", dr = l.forwardRef(
|
|
6287
6325
|
(e, t) => {
|
|
6288
|
-
const { disabled: n = !1, onSelect: r, ...o } = e, s = l.useRef(null), a = pn(Hn, e.__scopeMenu), i = Uo(Hn, e.__scopeMenu), u =
|
|
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 = () => {
|
|
6289
6327
|
const p = s.current;
|
|
6290
6328
|
if (!n && p) {
|
|
6291
6329
|
const g = new CustomEvent(ea, { bubbles: !0, cancelable: !0 });
|
|
@@ -6318,7 +6356,7 @@ var Hn = "MenuItem", ea = "menu.itemSelect", dr = l.forwardRef(
|
|
|
6318
6356
|
dr.displayName = Hn;
|
|
6319
6357
|
var zi = l.forwardRef(
|
|
6320
6358
|
(e, t) => {
|
|
6321
|
-
const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, a = Uo(Hn, n), i = Di(n), u = l.useRef(null), f =
|
|
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("");
|
|
6322
6360
|
return l.useEffect(() => {
|
|
6323
6361
|
const m = u.current;
|
|
6324
6362
|
m && v((m.textContent ?? "").trim());
|
|
@@ -6528,7 +6566,7 @@ var Og = "MenuSub", [Sy, Ji] = vt(Og), Vt = "MenuSubTrigger", Zi = l.forwardRef(
|
|
|
6528
6566
|
Zi.displayName = Vt;
|
|
6529
6567
|
var Qi = "MenuSubContent", ec = l.forwardRef(
|
|
6530
6568
|
(e, t) => {
|
|
6531
|
-
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 =
|
|
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);
|
|
6532
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(
|
|
6533
6571
|
zo,
|
|
6534
6572
|
{
|
|
@@ -6571,17 +6609,17 @@ function Wn(e) {
|
|
|
6571
6609
|
function Vo(e) {
|
|
6572
6610
|
return Wn(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
6573
6611
|
}
|
|
6574
|
-
function
|
|
6612
|
+
function Mg(e) {
|
|
6575
6613
|
const t = document.activeElement;
|
|
6576
6614
|
for (const n of e)
|
|
6577
6615
|
if (n === t || (n.focus(), document.activeElement !== t)) return;
|
|
6578
6616
|
}
|
|
6579
|
-
function
|
|
6617
|
+
function kg(e, t) {
|
|
6580
6618
|
return e.map((n, r) => e[(t + r) % e.length]);
|
|
6581
6619
|
}
|
|
6582
6620
|
function Dg(e, t, n) {
|
|
6583
6621
|
const o = t.length > 1 && Array.from(t).every((f) => f === t[0]) ? t[0] : t, s = n ? e.indexOf(n) : -1;
|
|
6584
|
-
let a =
|
|
6622
|
+
let a = kg(e, Math.max(s, 0));
|
|
6585
6623
|
o.length === 1 && (a = a.filter((f) => f !== n));
|
|
6586
6624
|
const u = a.find(
|
|
6587
6625
|
(f) => f.toLowerCase().startsWith(o.toLowerCase())
|
|
@@ -6607,8 +6645,8 @@ function en(e) {
|
|
|
6607
6645
|
}
|
|
6608
6646
|
var $g = Li, Bg = $o, Ug = $i, zg = Bi, Hg = Ho, Wg = Ui, Vg = dr, jg = Hi, Kg = Vi, Gg = Ki, qg = qi, Xg = Xi, Yg = Yi, Jg = Zi, Zg = ec, fr = "DropdownMenu", [Qg, Cy] = Ue(
|
|
6609
6647
|
fr,
|
|
6610
|
-
[
|
|
6611
|
-
), Ee =
|
|
6648
|
+
[ki]
|
|
6649
|
+
), Ee = ki(), [eb, nc] = Qg(fr), rc = (e) => {
|
|
6612
6650
|
const {
|
|
6613
6651
|
__scopeDropdownMenu: t,
|
|
6614
6652
|
children: n,
|
|
@@ -6916,127 +6954,127 @@ function Pn({
|
|
|
6916
6954
|
listCheckpoints: y,
|
|
6917
6955
|
navigateToCheckpoint: x,
|
|
6918
6956
|
returnToLatest: E
|
|
6919
|
-
} = Ua(), [C, I] = ce(""), [N,
|
|
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");
|
|
6920
6958
|
we(() => {
|
|
6921
|
-
const
|
|
6922
|
-
const
|
|
6923
|
-
|
|
6959
|
+
const k = () => {
|
|
6960
|
+
const X = window.innerWidth;
|
|
6961
|
+
M(X < 640 ? "phone" : X < 1024 ? "tablet" : "desktop");
|
|
6924
6962
|
};
|
|
6925
|
-
return
|
|
6963
|
+
return k(), window.addEventListener("resize", k), () => window.removeEventListener("resize", k);
|
|
6926
6964
|
}, []), we(() => {
|
|
6927
|
-
var
|
|
6928
|
-
(
|
|
6965
|
+
var k;
|
|
6966
|
+
(k = P.current) == null || k.scrollIntoView({ behavior: "smooth" });
|
|
6929
6967
|
}, [p]), we(() => {
|
|
6930
|
-
var
|
|
6931
|
-
n && ((
|
|
6968
|
+
var k;
|
|
6969
|
+
n && ((k = _.current) == null || k.focus());
|
|
6932
6970
|
}, [n]), we(() => {
|
|
6933
6971
|
m && !W && (f == null || f(m));
|
|
6934
6972
|
}, [m, W, f]), we(() => {
|
|
6935
|
-
let
|
|
6973
|
+
let k = !0;
|
|
6936
6974
|
if (!d) {
|
|
6937
|
-
|
|
6975
|
+
$([]), T(null);
|
|
6938
6976
|
return;
|
|
6939
6977
|
}
|
|
6940
|
-
return y(d).then((
|
|
6978
|
+
return y(d).then((X) => {
|
|
6941
6979
|
var Re;
|
|
6942
|
-
if (!
|
|
6943
|
-
const
|
|
6944
|
-
|
|
6945
|
-
const ue = ((Re =
|
|
6980
|
+
if (!k) return;
|
|
6981
|
+
const ne = X.checkpoints || [];
|
|
6982
|
+
$(ne);
|
|
6983
|
+
const ue = ((Re = ne.slice().sort(
|
|
6946
6984
|
(yt, Se) => new Date(Se.createdAt).getTime() - new Date(yt.createdAt).getTime()
|
|
6947
6985
|
)[0]) == null ? void 0 : Re.checkpointId) || null;
|
|
6948
6986
|
T((yt) => yt ?? ue);
|
|
6949
6987
|
}).catch(() => {
|
|
6950
6988
|
}), () => {
|
|
6951
|
-
|
|
6989
|
+
k = !1;
|
|
6952
6990
|
};
|
|
6953
6991
|
}, [d, y]), we(() => {
|
|
6954
6992
|
w && T(w);
|
|
6955
6993
|
}, [w]);
|
|
6956
|
-
const z = (
|
|
6957
|
-
if (
|
|
6958
|
-
return `Message too long (${
|
|
6994
|
+
const z = (k) => {
|
|
6995
|
+
if (k.length > Nt)
|
|
6996
|
+
return `Message too long (${k.length}/${Nt} characters)`;
|
|
6959
6997
|
try {
|
|
6960
|
-
return Ip(
|
|
6961
|
-
} catch (
|
|
6962
|
-
return (
|
|
6998
|
+
return Ip(k), null;
|
|
6999
|
+
} catch (X) {
|
|
7000
|
+
return (X == null ? void 0 : X.message) || "Invalid message";
|
|
6963
7001
|
}
|
|
6964
|
-
}, le = (
|
|
6965
|
-
const
|
|
6966
|
-
if (
|
|
7002
|
+
}, le = (k) => {
|
|
7003
|
+
const X = k.content || [], ne = X.filter((ue) => ue.type === "text").map((ue) => ue.text).join("");
|
|
7004
|
+
if (ne) return ne;
|
|
6967
7005
|
try {
|
|
6968
|
-
return JSON.stringify(
|
|
7006
|
+
return JSON.stringify(X, null, 2);
|
|
6969
7007
|
} catch {
|
|
6970
|
-
return String(
|
|
7008
|
+
return String(X);
|
|
6971
7009
|
}
|
|
6972
|
-
},
|
|
7010
|
+
}, se = (k) => {
|
|
6973
7011
|
var yt;
|
|
6974
7012
|
if (!q.length)
|
|
6975
7013
|
return [];
|
|
6976
|
-
const
|
|
6977
|
-
return q.filter((Se) => (Se.messagesLen ?? -1) >= (
|
|
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) => ({
|
|
6978
7016
|
checkpoint_id: Se.checkpointId,
|
|
6979
7017
|
checkpoint_ns: Se.checkpointNs,
|
|
6980
7018
|
message_count: Se.messagesLen ?? 0,
|
|
6981
7019
|
last_message_preview: Se.preview ?? void 0,
|
|
6982
7020
|
ts: new Date(Se.createdAt).getTime(),
|
|
6983
7021
|
isCurrent: Se.checkpointId === G
|
|
6984
|
-
})).sort((Se,
|
|
6985
|
-
}, V = (
|
|
6986
|
-
if (
|
|
7022
|
+
})).sort((Se, ku) => (Se.ts || 0) - (ku.ts || 0));
|
|
7023
|
+
}, V = (k) => {
|
|
7024
|
+
if (k === void 0)
|
|
6987
7025
|
return { canGoBack: !1, canGoForward: !1, currentIndex: 0, totalBranches: 0 };
|
|
6988
|
-
const
|
|
6989
|
-
if (
|
|
6990
|
-
return { canGoBack: !1, canGoForward: !1, currentIndex: 0, totalBranches:
|
|
6991
|
-
const
|
|
6992
|
-
return { canGoBack:
|
|
6993
|
-
},
|
|
6994
|
-
const
|
|
6995
|
-
if (!
|
|
6996
|
-
const
|
|
6997
|
-
if (
|
|
6998
|
-
|
|
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 () => {
|
|
7032
|
+
const k = C.trim();
|
|
7033
|
+
if (!k && j.length === 0) return;
|
|
7034
|
+
const X = z(k);
|
|
7035
|
+
if (X) {
|
|
7036
|
+
L(X);
|
|
6999
7037
|
return;
|
|
7000
7038
|
}
|
|
7001
7039
|
try {
|
|
7002
|
-
const
|
|
7003
|
-
await h(
|
|
7004
|
-
} catch (
|
|
7005
|
-
const ue = (
|
|
7006
|
-
|
|
7007
|
-
}
|
|
7008
|
-
}, ie = (
|
|
7009
|
-
a && (
|
|
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(() => {
|
|
7010
7048
|
_.current && (_.current.focus(), _.current.style.height = "auto", _.current.style.height = _.current.scrollHeight + "px");
|
|
7011
7049
|
}, 0));
|
|
7012
|
-
},
|
|
7013
|
-
const
|
|
7014
|
-
if (!
|
|
7015
|
-
|
|
7050
|
+
}, oe = async (k, X) => {
|
|
7051
|
+
const ne = p.find((Re) => Re.id === k);
|
|
7052
|
+
if (!ne) {
|
|
7053
|
+
L("Message not found");
|
|
7016
7054
|
return;
|
|
7017
7055
|
}
|
|
7018
|
-
const ue = le(
|
|
7019
|
-
|
|
7056
|
+
const ue = le(ne);
|
|
7057
|
+
F(k), I(ue), window.__editingCheckpointId = X, setTimeout(() => {
|
|
7020
7058
|
var Re;
|
|
7021
7059
|
return (Re = _.current) == null ? void 0 : Re.focus();
|
|
7022
7060
|
}, 0);
|
|
7023
7061
|
}, H = () => {
|
|
7024
|
-
|
|
7025
|
-
}, Z = (
|
|
7026
|
-
|
|
7027
|
-
}, de = (
|
|
7028
|
-
const
|
|
7029
|
-
K((
|
|
7030
|
-
},
|
|
7031
|
-
d && (await x(
|
|
7032
|
-
},
|
|
7062
|
+
F(null), I(""), L(null), delete window.__editingCheckpointId, _.current && (_.current.style.height = "auto");
|
|
7063
|
+
}, Z = (k) => {
|
|
7064
|
+
k.key === "Enter" && !k.shiftKey ? (k.preventDefault(), re()) : k.key === "Escape" && N && (k.preventDefault(), H());
|
|
7065
|
+
}, de = (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) => {
|
|
7069
|
+
d && (await x(k), T(k));
|
|
7070
|
+
}, Q = async () => {
|
|
7033
7071
|
await E(), T(null);
|
|
7034
|
-
},
|
|
7035
|
-
return /* @__PURE__ */ R("div", { className:
|
|
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: [
|
|
7036
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: [
|
|
7037
7075
|
/* @__PURE__ */ c("span", { children: m }),
|
|
7038
7076
|
/* @__PURE__ */ c(
|
|
7039
|
-
|
|
7077
|
+
pe,
|
|
7040
7078
|
{
|
|
7041
7079
|
variant: "ghost",
|
|
7042
7080
|
size: "sm",
|
|
@@ -7055,68 +7093,68 @@ function Pn({
|
|
|
7055
7093
|
{
|
|
7056
7094
|
className: "border rounded px-2 py-1 text-xs",
|
|
7057
7095
|
value: G ?? "",
|
|
7058
|
-
onChange: (
|
|
7059
|
-
const
|
|
7060
|
-
|
|
7096
|
+
onChange: (k) => {
|
|
7097
|
+
const X = k.target.value || null;
|
|
7098
|
+
X ? me(X) : Q();
|
|
7061
7099
|
},
|
|
7062
7100
|
children: [
|
|
7063
7101
|
/* @__PURE__ */ c("option", { value: "", children: "Latest" }),
|
|
7064
|
-
q.slice().sort((
|
|
7065
|
-
new Date(
|
|
7066
|
-
|
|
7067
|
-
] },
|
|
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: [
|
|
7103
|
+
new Date(k.createdAt).toLocaleString(),
|
|
7104
|
+
k.preview ? ` — ${k.preview.slice(0, 30)}` : ""
|
|
7105
|
+
] }, k.checkpointId))
|
|
7068
7106
|
]
|
|
7069
7107
|
}
|
|
7070
7108
|
)
|
|
7071
7109
|
] }),
|
|
7072
|
-
/* @__PURE__ */ R("div", { className:
|
|
7073
|
-
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((
|
|
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(
|
|
7074
7112
|
gp,
|
|
7075
7113
|
{
|
|
7076
|
-
message:
|
|
7077
|
-
messageIndex:
|
|
7078
|
-
isStreamingMessage: g && v ===
|
|
7114
|
+
message: k,
|
|
7115
|
+
messageIndex: X,
|
|
7116
|
+
isStreamingMessage: g && v === k.id,
|
|
7079
7117
|
streamingDebounceMs: o,
|
|
7080
|
-
isEditing: N ===
|
|
7118
|
+
isEditing: N === k.id,
|
|
7081
7119
|
showActions: a,
|
|
7082
7120
|
showTimestamp: !1,
|
|
7083
7121
|
showAgentName: !0,
|
|
7084
|
-
layoutSize:
|
|
7122
|
+
layoutSize: Y,
|
|
7085
7123
|
truncateToolMessages: !1,
|
|
7086
7124
|
toolMessagePreviewLength: 200,
|
|
7087
|
-
checkpointBranches:
|
|
7125
|
+
checkpointBranches: se(X),
|
|
7088
7126
|
currentCheckpointId: G ?? void 0,
|
|
7089
|
-
temporalNavigation: V(
|
|
7090
|
-
onSwitchToCheckpoint:
|
|
7091
|
-
onReturnToMainThread:
|
|
7127
|
+
temporalNavigation: V(X),
|
|
7128
|
+
onSwitchToCheckpoint: me,
|
|
7129
|
+
onReturnToMainThread: Q,
|
|
7092
7130
|
onNavigateToPreviousBranch: () => {
|
|
7093
|
-
const
|
|
7094
|
-
ue > 0 &&
|
|
7131
|
+
const ne = se(X), ue = Math.max(0, ne.findIndex((Re) => Re.isCurrent));
|
|
7132
|
+
ue > 0 && me(ne[ue - 1].checkpoint_id);
|
|
7095
7133
|
},
|
|
7096
7134
|
onNavigateToNextBranch: () => {
|
|
7097
|
-
const
|
|
7098
|
-
ue >= 0 && ue <
|
|
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);
|
|
7099
7137
|
},
|
|
7100
|
-
onEdit: (
|
|
7101
|
-
onEditFromCheckpoint:
|
|
7138
|
+
onEdit: (ne, ue) => ie(ne, ue),
|
|
7139
|
+
onEditFromCheckpoint: oe,
|
|
7102
7140
|
onRegenerate: () => {
|
|
7103
|
-
const
|
|
7141
|
+
const ne = [...p].reverse().find((Re) => Re.role === "user"), ue = ne ? le(ne) : "";
|
|
7104
7142
|
ue && h(ue, { checkpointId: G ?? void 0 });
|
|
7105
7143
|
},
|
|
7106
7144
|
onCancelEdit: H
|
|
7107
7145
|
},
|
|
7108
|
-
|
|
7146
|
+
k.id || X
|
|
7109
7147
|
)),
|
|
7110
7148
|
/* @__PURE__ */ c("div", { ref: P })
|
|
7111
7149
|
] }),
|
|
7112
|
-
/* @__PURE__ */ R("div", { className:
|
|
7150
|
+
/* @__PURE__ */ R("div", { className: fe, children: [
|
|
7113
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: [
|
|
7114
7152
|
/* @__PURE__ */ R("div", { className: "flex items-center gap-2", children: [
|
|
7115
7153
|
/* @__PURE__ */ c(fa, { size: 16, className: "text-blue-600" }),
|
|
7116
7154
|
/* @__PURE__ */ c("span", { className: "text-sm font-medium text-blue-800", children: "Editing message" })
|
|
7117
7155
|
] }),
|
|
7118
7156
|
/* @__PURE__ */ c(
|
|
7119
|
-
|
|
7157
|
+
pe,
|
|
7120
7158
|
{
|
|
7121
7159
|
variant: "ghost",
|
|
7122
7160
|
size: "sm",
|
|
@@ -7133,31 +7171,31 @@ function Pn({
|
|
|
7133
7171
|
ref: O,
|
|
7134
7172
|
type: "file",
|
|
7135
7173
|
multiple: !0,
|
|
7136
|
-
onChange: (
|
|
7174
|
+
onChange: (k) => de(k),
|
|
7137
7175
|
className: "hidden"
|
|
7138
7176
|
}
|
|
7139
7177
|
),
|
|
7140
|
-
j.length > 0 && /* @__PURE__ */ c("div", { className: "mb-3 flex flex-wrap gap-2", children: j.map((
|
|
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: [
|
|
7141
7179
|
/* @__PURE__ */ c(ss, { size: 14 }),
|
|
7142
|
-
/* @__PURE__ */ c("span", { className: "truncate max-w-[150px]", children:
|
|
7180
|
+
/* @__PURE__ */ c("span", { className: "truncate max-w-[150px]", children: k.name }),
|
|
7143
7181
|
/* @__PURE__ */ c(
|
|
7144
|
-
|
|
7182
|
+
pe,
|
|
7145
7183
|
{
|
|
7146
7184
|
variant: "ghost",
|
|
7147
7185
|
size: "sm",
|
|
7148
|
-
onClick: () =>
|
|
7186
|
+
onClick: () => he(X),
|
|
7149
7187
|
className: "h-4 w-4 p-0 text-gray-500 hover:text-red-500",
|
|
7150
|
-
"aria-label": `Remove ${
|
|
7188
|
+
"aria-label": `Remove ${k.name}`,
|
|
7151
7189
|
children: /* @__PURE__ */ c(Kt, { size: 12 })
|
|
7152
7190
|
}
|
|
7153
7191
|
)
|
|
7154
|
-
] },
|
|
7192
|
+
] }, X)) })
|
|
7155
7193
|
] }),
|
|
7156
|
-
|
|
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 }),
|
|
7157
7195
|
/* @__PURE__ */ R("div", { className: "flex items-end gap-2", children: [
|
|
7158
7196
|
s && /* @__PURE__ */ R(wb, { children: [
|
|
7159
7197
|
/* @__PURE__ */ c(yb, { asChild: !0, children: /* @__PURE__ */ c(
|
|
7160
|
-
|
|
7198
|
+
pe,
|
|
7161
7199
|
{
|
|
7162
7200
|
type: "button",
|
|
7163
7201
|
size: "icon",
|
|
@@ -7169,8 +7207,8 @@ function Pn({
|
|
|
7169
7207
|
}
|
|
7170
7208
|
) }),
|
|
7171
7209
|
/* @__PURE__ */ c(Nc, { align: "start", sideOffset: 6, className: "w-52", children: /* @__PURE__ */ R(Tc, { onClick: () => {
|
|
7172
|
-
var
|
|
7173
|
-
return (
|
|
7210
|
+
var k;
|
|
7211
|
+
return (k = O.current) == null ? void 0 : k.click();
|
|
7174
7212
|
}, className: "cursor-pointer", children: [
|
|
7175
7213
|
/* @__PURE__ */ c(ss, { className: "h-4 w-4 mr-2" }),
|
|
7176
7214
|
" Attach files or images"
|
|
@@ -7181,19 +7219,19 @@ function Pn({
|
|
|
7181
7219
|
{
|
|
7182
7220
|
ref: _,
|
|
7183
7221
|
value: C,
|
|
7184
|
-
onChange: (
|
|
7185
|
-
I(
|
|
7222
|
+
onChange: (k) => {
|
|
7223
|
+
I(k.target.value), L(null), _.current && (_.current.style.height = "auto", _.current.style.height = `${_.current.scrollHeight}px`);
|
|
7186
7224
|
},
|
|
7187
7225
|
onKeyDown: Z,
|
|
7188
7226
|
placeholder: N ? "Edit your message..." : t,
|
|
7189
|
-
className: `resize-none min-h-[44px] max-h-[20rem] w-full ${N ? "border-blue-400 bg-blue-50" : ""} ${
|
|
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 || ""}`,
|
|
7190
7228
|
disabled: !1,
|
|
7191
7229
|
maxLength: Nt,
|
|
7192
7230
|
rows: 1
|
|
7193
7231
|
}
|
|
7194
7232
|
) }),
|
|
7195
7233
|
/* @__PURE__ */ c("div", { children: g ? /* @__PURE__ */ c(
|
|
7196
|
-
|
|
7234
|
+
pe,
|
|
7197
7235
|
{
|
|
7198
7236
|
type: "button",
|
|
7199
7237
|
onClick: b,
|
|
@@ -7204,10 +7242,10 @@ function Pn({
|
|
|
7204
7242
|
children: /* @__PURE__ */ c(Wu, { size: 16 })
|
|
7205
7243
|
}
|
|
7206
7244
|
) : /* @__PURE__ */ c(
|
|
7207
|
-
|
|
7245
|
+
pe,
|
|
7208
7246
|
{
|
|
7209
7247
|
type: "button",
|
|
7210
|
-
onClick:
|
|
7248
|
+
onClick: re,
|
|
7211
7249
|
size: "icon",
|
|
7212
7250
|
disabled: !C.trim() && j.length === 0,
|
|
7213
7251
|
className: `shrink-0 ${i.sendButton || ""}`,
|
|
@@ -7245,7 +7283,7 @@ function ro(e, [t, n]) {
|
|
|
7245
7283
|
function Tb(e, t) {
|
|
7246
7284
|
return l.useReducer((n, r) => t[n][r] ?? n, e);
|
|
7247
7285
|
}
|
|
7248
|
-
var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab,
|
|
7286
|
+
var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, Me] = Ac(jo), Pc = l.forwardRef(
|
|
7249
7287
|
(e, t) => {
|
|
7250
7288
|
const {
|
|
7251
7289
|
__scopeScrollArea: n,
|
|
@@ -7253,13 +7291,13 @@ var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, ke] = Ac(jo), Pc = l.forwardRef(
|
|
|
7253
7291
|
dir: o,
|
|
7254
7292
|
scrollHideDelay: s = 600,
|
|
7255
7293
|
...a
|
|
7256
|
-
} = 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,
|
|
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);
|
|
7257
7295
|
return /* @__PURE__ */ c(
|
|
7258
7296
|
Ab,
|
|
7259
7297
|
{
|
|
7260
7298
|
scope: n,
|
|
7261
7299
|
type: r,
|
|
7262
|
-
dir:
|
|
7300
|
+
dir: L,
|
|
7263
7301
|
scrollHideDelay: s,
|
|
7264
7302
|
scrollArea: i,
|
|
7265
7303
|
viewport: f,
|
|
@@ -7273,15 +7311,15 @@ var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, ke] = Ac(jo), Pc = l.forwardRef(
|
|
|
7273
7311
|
scrollbarY: h,
|
|
7274
7312
|
onScrollbarYChange: b,
|
|
7275
7313
|
scrollbarYEnabled: N,
|
|
7276
|
-
onScrollbarYEnabledChange:
|
|
7314
|
+
onScrollbarYEnabledChange: F,
|
|
7277
7315
|
onCornerWidthChange: y,
|
|
7278
7316
|
onCornerHeightChange: E,
|
|
7279
7317
|
children: /* @__PURE__ */ c(
|
|
7280
7318
|
J.div,
|
|
7281
7319
|
{
|
|
7282
|
-
dir:
|
|
7320
|
+
dir: L,
|
|
7283
7321
|
...a,
|
|
7284
|
-
ref:
|
|
7322
|
+
ref: D,
|
|
7285
7323
|
style: {
|
|
7286
7324
|
position: "relative",
|
|
7287
7325
|
// Pass corner sizes as CSS vars to reduce re-renders of context consumers
|
|
@@ -7298,7 +7336,7 @@ var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, ke] = Ac(jo), Pc = l.forwardRef(
|
|
|
7298
7336
|
Pc.displayName = jo;
|
|
7299
7337
|
var _c = "ScrollAreaViewport", Ic = l.forwardRef(
|
|
7300
7338
|
(e, t) => {
|
|
7301
|
-
const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, a =
|
|
7339
|
+
const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, a = Me(_c, n), i = l.useRef(null), u = te(t, i, a.onViewportChange);
|
|
7302
7340
|
return /* @__PURE__ */ R(De, { children: [
|
|
7303
7341
|
/* @__PURE__ */ c(
|
|
7304
7342
|
"style",
|
|
@@ -7340,7 +7378,7 @@ var _c = "ScrollAreaViewport", Ic = l.forwardRef(
|
|
|
7340
7378
|
Ic.displayName = _c;
|
|
7341
7379
|
var Ye = "ScrollAreaScrollbar", Ko = l.forwardRef(
|
|
7342
7380
|
(e, t) => {
|
|
7343
|
-
const { forceMount: n, ...r } = e, o =
|
|
7381
|
+
const { forceMount: n, ...r } = e, o = Me(Ye, e.__scopeScrollArea), { onScrollbarXEnabledChange: s, onScrollbarYEnabledChange: a } = o, i = e.orientation === "horizontal";
|
|
7344
7382
|
return l.useEffect(() => (i ? s(!0) : a(!0), () => {
|
|
7345
7383
|
i ? s(!1) : a(!1);
|
|
7346
7384
|
}), [i, s, a]), o.type === "hover" ? /* @__PURE__ */ c(Pb, { ...r, ref: t, forceMount: n }) : o.type === "scroll" ? /* @__PURE__ */ c(_b, { ...r, ref: t, forceMount: n }) : o.type === "auto" ? /* @__PURE__ */ c(Oc, { ...r, ref: t, forceMount: n }) : o.type === "always" ? /* @__PURE__ */ c(Go, { ...r, ref: t }) : null;
|
|
@@ -7348,7 +7386,7 @@ var Ye = "ScrollAreaScrollbar", Ko = l.forwardRef(
|
|
|
7348
7386
|
);
|
|
7349
7387
|
Ko.displayName = Ye;
|
|
7350
7388
|
var Pb = l.forwardRef((e, t) => {
|
|
7351
|
-
const { forceMount: n, ...r } = e, o =
|
|
7389
|
+
const { forceMount: n, ...r } = e, o = Me(Ye, e.__scopeScrollArea), [s, a] = l.useState(!1);
|
|
7352
7390
|
return l.useEffect(() => {
|
|
7353
7391
|
const i = o.scrollArea;
|
|
7354
7392
|
let u = 0;
|
|
@@ -7371,7 +7409,7 @@ var Pb = l.forwardRef((e, t) => {
|
|
|
7371
7409
|
}
|
|
7372
7410
|
) });
|
|
7373
7411
|
}), _b = l.forwardRef((e, t) => {
|
|
7374
|
-
const { forceMount: n, ...r } = e, o =
|
|
7412
|
+
const { forceMount: n, ...r } = e, o = Me(Ye, e.__scopeScrollArea), s = e.orientation === "horizontal", a = hr(() => u("SCROLL_END"), 100), [i, u] = Tb("hidden", {
|
|
7375
7413
|
hidden: {
|
|
7376
7414
|
SCROLL: "scrolling"
|
|
7377
7415
|
},
|
|
@@ -7415,13 +7453,13 @@ var Pb = l.forwardRef((e, t) => {
|
|
|
7415
7453
|
}
|
|
7416
7454
|
) });
|
|
7417
7455
|
}), Oc = l.forwardRef((e, t) => {
|
|
7418
|
-
const n =
|
|
7456
|
+
const n = Me(Ye, e.__scopeScrollArea), { forceMount: r, ...o } = e, [s, a] = l.useState(!1), i = e.orientation === "horizontal", u = hr(() => {
|
|
7419
7457
|
if (n.viewport) {
|
|
7420
7458
|
const f = n.viewport.offsetWidth < n.viewport.scrollWidth, d = n.viewport.offsetHeight < n.viewport.scrollHeight;
|
|
7421
7459
|
a(i ? f : d);
|
|
7422
7460
|
}
|
|
7423
7461
|
}, 10);
|
|
7424
|
-
return
|
|
7462
|
+
return Mt(n.viewport, u), Mt(n.content, u), /* @__PURE__ */ c(Ae, { present: r || s, children: /* @__PURE__ */ c(
|
|
7425
7463
|
Go,
|
|
7426
7464
|
{
|
|
7427
7465
|
"data-state": s ? "visible" : "hidden",
|
|
@@ -7430,7 +7468,7 @@ var Pb = l.forwardRef((e, t) => {
|
|
|
7430
7468
|
}
|
|
7431
7469
|
) });
|
|
7432
7470
|
}), Go = l.forwardRef((e, t) => {
|
|
7433
|
-
const { orientation: n = "vertical", ...r } = e, o =
|
|
7471
|
+
const { orientation: n = "vertical", ...r } = e, o = Me(Ye, e.__scopeScrollArea), s = l.useRef(null), a = l.useRef(0), [i, u] = l.useState({
|
|
7434
7472
|
content: 0,
|
|
7435
7473
|
viewport: 0,
|
|
7436
7474
|
scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
|
|
@@ -7484,11 +7522,11 @@ var Pb = l.forwardRef((e, t) => {
|
|
|
7484
7522
|
}
|
|
7485
7523
|
) : null;
|
|
7486
7524
|
}), Ib = l.forwardRef((e, t) => {
|
|
7487
|
-
const { sizes: n, onSizesChange: r, ...o } = e, s =
|
|
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);
|
|
7488
7526
|
return l.useEffect(() => {
|
|
7489
7527
|
u.current && i(getComputedStyle(u.current));
|
|
7490
7528
|
}, [u]), /* @__PURE__ */ c(
|
|
7491
|
-
|
|
7529
|
+
kc,
|
|
7492
7530
|
{
|
|
7493
7531
|
"data-orientation": "horizontal",
|
|
7494
7532
|
...o,
|
|
@@ -7523,11 +7561,11 @@ var Pb = l.forwardRef((e, t) => {
|
|
|
7523
7561
|
}
|
|
7524
7562
|
);
|
|
7525
7563
|
}), Ob = l.forwardRef((e, t) => {
|
|
7526
|
-
const { sizes: n, onSizesChange: r, ...o } = e, s =
|
|
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);
|
|
7527
7565
|
return l.useEffect(() => {
|
|
7528
7566
|
u.current && i(getComputedStyle(u.current));
|
|
7529
7567
|
}, [u]), /* @__PURE__ */ c(
|
|
7530
|
-
|
|
7568
|
+
kc,
|
|
7531
7569
|
{
|
|
7532
7570
|
"data-orientation": "vertical",
|
|
7533
7571
|
...o,
|
|
@@ -7562,7 +7600,7 @@ var Pb = l.forwardRef((e, t) => {
|
|
|
7562
7600
|
}
|
|
7563
7601
|
}
|
|
7564
7602
|
);
|
|
7565
|
-
}), [
|
|
7603
|
+
}), [Mb, Mc] = Ac(Ye), kc = l.forwardRef((e, t) => {
|
|
7566
7604
|
const {
|
|
7567
7605
|
__scopeScrollArea: n,
|
|
7568
7606
|
sizes: r,
|
|
@@ -7575,21 +7613,21 @@ var Pb = l.forwardRef((e, t) => {
|
|
|
7575
7613
|
onWheelScroll: d,
|
|
7576
7614
|
onResize: p,
|
|
7577
7615
|
...g
|
|
7578
|
-
} = e, v =
|
|
7579
|
-
function
|
|
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) {
|
|
7580
7618
|
if (w.current) {
|
|
7581
|
-
const
|
|
7582
|
-
f({ x:
|
|
7619
|
+
const L = D.clientX - w.current.left, j = D.clientY - w.current.top;
|
|
7620
|
+
f({ x: L, y: j });
|
|
7583
7621
|
}
|
|
7584
7622
|
}
|
|
7585
7623
|
return l.useEffect(() => {
|
|
7586
|
-
const
|
|
7587
|
-
const j =
|
|
7588
|
-
(m == null ? void 0 : m.contains(j)) && C(
|
|
7624
|
+
const D = (L) => {
|
|
7625
|
+
const j = L.target;
|
|
7626
|
+
(m == null ? void 0 : m.contains(j)) && C(L, E);
|
|
7589
7627
|
};
|
|
7590
|
-
return document.addEventListener("wheel",
|
|
7591
|
-
}, [x, m, E, C]), l.useEffect(I, [r, I]),
|
|
7592
|
-
|
|
7628
|
+
return document.addEventListener("wheel", D, { passive: !1 }), () => document.removeEventListener("wheel", D, { passive: !1 });
|
|
7629
|
+
}, [x, m, E, C]), l.useEffect(I, [r, I]), Mt(m, N), Mt(v.content, N), /* @__PURE__ */ c(
|
|
7630
|
+
Mb,
|
|
7593
7631
|
{
|
|
7594
7632
|
scope: n,
|
|
7595
7633
|
scrollbar: m,
|
|
@@ -7604,13 +7642,13 @@ var Pb = l.forwardRef((e, t) => {
|
|
|
7604
7642
|
...g,
|
|
7605
7643
|
ref: b,
|
|
7606
7644
|
style: { position: "absolute", ...g.style },
|
|
7607
|
-
onPointerDown: U(e.onPointerDown, (
|
|
7608
|
-
|
|
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));
|
|
7609
7647
|
}),
|
|
7610
|
-
onPointerMove: U(e.onPointerMove,
|
|
7611
|
-
onPointerUp: U(e.onPointerUp, (
|
|
7612
|
-
const
|
|
7613
|
-
|
|
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;
|
|
7614
7652
|
})
|
|
7615
7653
|
}
|
|
7616
7654
|
)
|
|
@@ -7618,12 +7656,12 @@ var Pb = l.forwardRef((e, t) => {
|
|
|
7618
7656
|
);
|
|
7619
7657
|
}), Vn = "ScrollAreaThumb", Dc = l.forwardRef(
|
|
7620
7658
|
(e, t) => {
|
|
7621
|
-
const { forceMount: n, ...r } = e, o =
|
|
7622
|
-
return /* @__PURE__ */ c(Ae, { present: n || o.hasThumb, children: /* @__PURE__ */ c(
|
|
7659
|
+
const { forceMount: n, ...r } = e, o = Mc(Vn, e.__scopeScrollArea);
|
|
7660
|
+
return /* @__PURE__ */ c(Ae, { present: n || o.hasThumb, children: /* @__PURE__ */ c(kb, { ref: t, ...r }) });
|
|
7623
7661
|
}
|
|
7624
|
-
),
|
|
7662
|
+
), kb = l.forwardRef(
|
|
7625
7663
|
(e, t) => {
|
|
7626
|
-
const { __scopeScrollArea: n, style: r, ...o } = e, s =
|
|
7664
|
+
const { __scopeScrollArea: n, style: r, ...o } = e, s = Me(Vn, n), a = Mc(Vn, n), { onThumbPositionChange: i } = a, u = te(
|
|
7627
7665
|
t,
|
|
7628
7666
|
(p) => a.onThumbChange(p)
|
|
7629
7667
|
), f = l.useRef(void 0), d = hr(() => {
|
|
@@ -7663,18 +7701,18 @@ var Pb = l.forwardRef((e, t) => {
|
|
|
7663
7701
|
Dc.displayName = Vn;
|
|
7664
7702
|
var qo = "ScrollAreaCorner", Lc = l.forwardRef(
|
|
7665
7703
|
(e, t) => {
|
|
7666
|
-
const n =
|
|
7704
|
+
const n = Me(qo, e.__scopeScrollArea), r = !!(n.scrollbarX && n.scrollbarY);
|
|
7667
7705
|
return n.type !== "scroll" && r ? /* @__PURE__ */ c(Db, { ...e, ref: t }) : null;
|
|
7668
7706
|
}
|
|
7669
7707
|
);
|
|
7670
7708
|
Lc.displayName = qo;
|
|
7671
7709
|
var Db = l.forwardRef((e, t) => {
|
|
7672
|
-
const { __scopeScrollArea: n, ...r } = e, o =
|
|
7673
|
-
return
|
|
7710
|
+
const { __scopeScrollArea: n, ...r } = e, o = Me(qo, n), [s, a] = l.useState(0), [i, u] = l.useState(0), f = !!(s && i);
|
|
7711
|
+
return Mt(o.scrollbarX, () => {
|
|
7674
7712
|
var p;
|
|
7675
7713
|
const d = ((p = o.scrollbarX) == null ? void 0 : p.offsetHeight) || 0;
|
|
7676
7714
|
o.onCornerHeightChange(d), u(d);
|
|
7677
|
-
}),
|
|
7715
|
+
}), Mt(o.scrollbarY, () => {
|
|
7678
7716
|
var p;
|
|
7679
7717
|
const d = ((p = o.scrollbarY) == null ? void 0 : p.offsetWidth) || 0;
|
|
7680
7718
|
o.onCornerWidthChange(d), a(d);
|
|
@@ -7738,7 +7776,7 @@ function hr(e, t) {
|
|
|
7738
7776
|
window.clearTimeout(r.current), r.current = window.setTimeout(n, t);
|
|
7739
7777
|
}, [n, t]);
|
|
7740
7778
|
}
|
|
7741
|
-
function
|
|
7779
|
+
function Mt(e, t) {
|
|
7742
7780
|
const n = ye(t);
|
|
7743
7781
|
be(() => {
|
|
7744
7782
|
let r = 0;
|
|
@@ -7804,58 +7842,58 @@ function oo({
|
|
|
7804
7842
|
createThread: h,
|
|
7805
7843
|
deleteThread: b,
|
|
7806
7844
|
renameThread: w
|
|
7807
|
-
} = Ua(), [y, x] = ce(g ?? []), [E, C] = ce(!1), [I, N] = ce(null), [
|
|
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);
|
|
7808
7846
|
we(() => {
|
|
7809
7847
|
x(g ?? []);
|
|
7810
7848
|
}, [g]);
|
|
7811
|
-
const B = async (
|
|
7849
|
+
const B = async (M) => {
|
|
7812
7850
|
try {
|
|
7813
|
-
await p(
|
|
7851
|
+
await p(M), i == null || i(M), u == null || u(M);
|
|
7814
7852
|
} catch (z) {
|
|
7815
7853
|
console.error("Failed to select thread:", z);
|
|
7816
7854
|
}
|
|
7817
7855
|
}, q = async () => {
|
|
7818
7856
|
try {
|
|
7819
7857
|
W(!0);
|
|
7820
|
-
const
|
|
7821
|
-
f == null || f(
|
|
7822
|
-
} catch (
|
|
7823
|
-
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);
|
|
7824
7862
|
} finally {
|
|
7825
7863
|
W(!1);
|
|
7826
7864
|
}
|
|
7827
|
-
},
|
|
7865
|
+
}, $ = async (M, z) => {
|
|
7828
7866
|
if (z.stopPropagation(), !!confirm("Delete this thread?"))
|
|
7829
7867
|
try {
|
|
7830
|
-
await b(
|
|
7868
|
+
await b(M), d == null || d(M);
|
|
7831
7869
|
} catch (le) {
|
|
7832
7870
|
console.error("Failed to delete thread:", le);
|
|
7833
7871
|
}
|
|
7834
|
-
}, G = (
|
|
7835
|
-
z.stopPropagation(),
|
|
7836
|
-
}, T = async (
|
|
7837
|
-
if (
|
|
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())
|
|
7838
7876
|
try {
|
|
7839
|
-
await w(
|
|
7877
|
+
await w(M, L.trim()), D(null), j("");
|
|
7840
7878
|
} catch (z) {
|
|
7841
7879
|
console.error("Failed to update title:", z);
|
|
7842
7880
|
}
|
|
7843
7881
|
}, P = () => {
|
|
7844
|
-
|
|
7845
|
-
}, _ = (
|
|
7846
|
-
|
|
7847
|
-
}, O = (
|
|
7848
|
-
if (
|
|
7882
|
+
D(null), j("");
|
|
7883
|
+
}, _ = (M, z) => {
|
|
7884
|
+
M.key === "Enter" ? T(z) : M.key === "Escape" && P();
|
|
7885
|
+
}, O = (M) => {
|
|
7886
|
+
if (!M) return "";
|
|
7849
7887
|
try {
|
|
7850
|
-
const z = new Date(
|
|
7888
|
+
const z = new Date(M), se = (/* @__PURE__ */ new Date()).getTime() - z.getTime(), V = Math.floor(se / (1e3 * 60 * 60 * 24));
|
|
7851
7889
|
return V === 0 ? z.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : V === 1 ? "Yesterday" : V < 7 ? `${V} days ago` : z.toLocaleDateString();
|
|
7852
7890
|
} catch {
|
|
7853
7891
|
return "";
|
|
7854
7892
|
}
|
|
7855
|
-
},
|
|
7893
|
+
}, Y = (M) => M.title || `Thread ${M.threadId.slice(0, 8)}`;
|
|
7856
7894
|
return /* @__PURE__ */ R("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
|
|
7857
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(
|
|
7858
|
-
|
|
7896
|
+
pe,
|
|
7859
7897
|
{
|
|
7860
7898
|
onClick: q,
|
|
7861
7899
|
disabled: K || E,
|
|
@@ -7869,32 +7907,32 @@ function oo({
|
|
|
7869
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: [
|
|
7870
7908
|
/* @__PURE__ */ c(Ku, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
|
|
7871
7909
|
/* @__PURE__ */ c("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
|
|
7872
|
-
] }) : y.slice().sort((
|
|
7910
|
+
] }) : y.slice().sort((M, z) => new Date(z.updatedAt || z.createdAt || "").getTime() - new Date(M.updatedAt || M.createdAt || "").getTime()).map((M) => /* @__PURE__ */ R(
|
|
7873
7911
|
"div",
|
|
7874
7912
|
{
|
|
7875
|
-
onClick: () => B(
|
|
7876
|
-
className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(a ?? m) ===
|
|
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`,
|
|
7877
7915
|
children: [
|
|
7878
7916
|
/* @__PURE__ */ R("div", { className: "flex items-center justify-between", children: [
|
|
7879
|
-
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children:
|
|
7880
|
-
/* @__PURE__ */ c(tn, { value:
|
|
7881
|
-
/* @__PURE__ */ c(
|
|
7882
|
-
/* @__PURE__ */ c(
|
|
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 }) })
|
|
7883
7921
|
] }) : /* @__PURE__ */ R(De, { children: [
|
|
7884
|
-
/* @__PURE__ */ c("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children:
|
|
7922
|
+
/* @__PURE__ */ c("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Y(M) }),
|
|
7885
7923
|
/* @__PURE__ */ R("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
|
|
7886
7924
|
/* @__PURE__ */ c(Gu, { size: 10 }),
|
|
7887
|
-
/* @__PURE__ */ c("span", { children: O(
|
|
7925
|
+
/* @__PURE__ */ c("span", { children: O(M.updatedAt || M.createdAt) })
|
|
7888
7926
|
] })
|
|
7889
7927
|
] }) }),
|
|
7890
7928
|
/* @__PURE__ */ R("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
|
|
7891
|
-
r &&
|
|
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 }) }),
|
|
7892
7930
|
n && /* @__PURE__ */ c(
|
|
7893
|
-
|
|
7931
|
+
pe,
|
|
7894
7932
|
{
|
|
7895
7933
|
variant: "ghost",
|
|
7896
7934
|
size: "sm",
|
|
7897
|
-
onClick: (z) =>
|
|
7935
|
+
onClick: (z) => $(M.threadId, z),
|
|
7898
7936
|
className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
|
|
7899
7937
|
title: "Delete thread",
|
|
7900
7938
|
children: /* @__PURE__ */ c(qu, { size: 12 })
|
|
@@ -7902,10 +7940,10 @@ function oo({
|
|
|
7902
7940
|
)
|
|
7903
7941
|
] })
|
|
7904
7942
|
] }),
|
|
7905
|
-
a ===
|
|
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" })
|
|
7906
7944
|
]
|
|
7907
7945
|
},
|
|
7908
|
-
|
|
7946
|
+
M.threadId
|
|
7909
7947
|
)) }) })
|
|
7910
7948
|
] });
|
|
7911
7949
|
}
|
|
@@ -8068,7 +8106,7 @@ var mr = "Dialog", [Gc, Py] = Ue(mr), [Yb, ze] = Gc(mr), qc = (e) => {
|
|
|
8068
8106
|
qc.displayName = mr;
|
|
8069
8107
|
var Xc = "DialogTrigger", Yc = l.forwardRef(
|
|
8070
8108
|
(e, t) => {
|
|
8071
|
-
const { __scopeDialog: n, ...r } = e, o = ze(Xc, n), s =
|
|
8109
|
+
const { __scopeDialog: n, ...r } = e, o = ze(Xc, n), s = te(t, o.triggerRef);
|
|
8072
8110
|
return /* @__PURE__ */ c(
|
|
8073
8111
|
J.button,
|
|
8074
8112
|
{
|
|
@@ -8125,7 +8163,7 @@ var Zb = _t("DialogOverlay.RemoveScroll"), Qb = l.forwardRef(
|
|
|
8125
8163
|
el.displayName = mt;
|
|
8126
8164
|
var ev = l.forwardRef(
|
|
8127
8165
|
(e, t) => {
|
|
8128
|
-
const n = ze(mt, e.__scopeDialog), r = l.useRef(null), o =
|
|
8166
|
+
const n = ze(mt, e.__scopeDialog), r = l.useRef(null), o = te(t, n.contentRef, r);
|
|
8129
8167
|
return l.useEffect(() => {
|
|
8130
8168
|
const s = r.current;
|
|
8131
8169
|
if (s) return Fo(s);
|
|
@@ -8176,7 +8214,7 @@ var ev = l.forwardRef(
|
|
|
8176
8214
|
}
|
|
8177
8215
|
), tl = l.forwardRef(
|
|
8178
8216
|
(e, t) => {
|
|
8179
|
-
const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...a } = e, i = ze(mt, n), u = l.useRef(null), f =
|
|
8217
|
+
const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...a } = e, i = ze(mt, n), u = l.useRef(null), f = te(t, u);
|
|
8180
8218
|
return Eo(), /* @__PURE__ */ R(De, { children: [
|
|
8181
8219
|
/* @__PURE__ */ c(
|
|
8182
8220
|
nr,
|
|
@@ -8438,7 +8476,7 @@ var nn = "Tooltip", [gv, vr] = gr(nn), Sl = (e) => {
|
|
|
8438
8476
|
}, [h, y]);
|
|
8439
8477
|
return l.useEffect(() => () => {
|
|
8440
8478
|
v.current && (window.clearTimeout(v.current), v.current = 0);
|
|
8441
|
-
}, []), /* @__PURE__ */ c(
|
|
8479
|
+
}, []), /* @__PURE__ */ c(Mo, { ...f, children: /* @__PURE__ */ c(
|
|
8442
8480
|
gv,
|
|
8443
8481
|
{
|
|
8444
8482
|
scope: t,
|
|
@@ -8463,8 +8501,8 @@ var nn = "Tooltip", [gv, vr] = gr(nn), Sl = (e) => {
|
|
|
8463
8501
|
Sl.displayName = nn;
|
|
8464
8502
|
var ao = "TooltipTrigger", Cl = l.forwardRef(
|
|
8465
8503
|
(e, t) => {
|
|
8466
|
-
const { __scopeTooltip: n, ...r } = e, o = vr(ao, n), s = es(ao, n), a = br(n), i = l.useRef(null), u =
|
|
8467
|
-
return l.useEffect(() => () => document.removeEventListener("pointerup", p), [p]), /* @__PURE__ */ c(
|
|
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, []);
|
|
8505
|
+
return l.useEffect(() => () => document.removeEventListener("pointerup", p), [p]), /* @__PURE__ */ c(ko, { asChild: !0, ...a, children: /* @__PURE__ */ c(
|
|
8468
8506
|
J.button,
|
|
8469
8507
|
{
|
|
8470
8508
|
"aria-describedby": o.open ? o.contentId : void 0,
|
|
@@ -8492,13 +8530,13 @@ var ao = "TooltipTrigger", Cl = l.forwardRef(
|
|
|
8492
8530
|
Cl.displayName = ao;
|
|
8493
8531
|
var bv = "TooltipPortal", [Oy, vv] = gr(bv, {
|
|
8494
8532
|
forceMount: void 0
|
|
8495
|
-
}),
|
|
8533
|
+
}), kt = "TooltipContent", El = l.forwardRef(
|
|
8496
8534
|
(e, t) => {
|
|
8497
|
-
const n = vv(
|
|
8535
|
+
const n = vv(kt, e.__scopeTooltip), { forceMount: r = n.forceMount, side: o = "top", ...s } = e, a = vr(kt, e.__scopeTooltip);
|
|
8498
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 }) });
|
|
8499
8537
|
}
|
|
8500
8538
|
), wv = l.forwardRef((e, t) => {
|
|
8501
|
-
const n = vr(
|
|
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(() => {
|
|
8502
8540
|
i(null), p(!1);
|
|
8503
8541
|
}, [p]), v = l.useCallback(
|
|
8504
8542
|
(m, h) => {
|
|
@@ -8532,7 +8570,7 @@ var bv = "TooltipPortal", [Oy, vv] = gr(bv, {
|
|
|
8532
8570
|
onEscapeKeyDown: s,
|
|
8533
8571
|
onPointerDownOutside: a,
|
|
8534
8572
|
...i
|
|
8535
|
-
} = e, u = vr(
|
|
8573
|
+
} = e, u = vr(kt, n), f = br(n), { onClose: d } = u;
|
|
8536
8574
|
return l.useEffect(() => (document.addEventListener(so, d), () => document.removeEventListener(so, d)), [d]), l.useEffect(() => {
|
|
8537
8575
|
if (u.trigger) {
|
|
8538
8576
|
const p = (g) => {
|
|
@@ -8575,7 +8613,7 @@ var bv = "TooltipPortal", [Oy, vv] = gr(bv, {
|
|
|
8575
8613
|
);
|
|
8576
8614
|
}
|
|
8577
8615
|
);
|
|
8578
|
-
El.displayName =
|
|
8616
|
+
El.displayName = kt;
|
|
8579
8617
|
var Nl = "TooltipArrow", Cv = l.forwardRef(
|
|
8580
8618
|
(e, t) => {
|
|
8581
8619
|
const { __scopeTooltip: n, ...r } = e, o = br(n);
|
|
@@ -8679,7 +8717,7 @@ function Pv(e) {
|
|
|
8679
8717
|
return n.pop(), t.length === 1 && n.length === 1 && t[0].x === n[0].x && t[0].y === n[0].y ? t : t.concat(n);
|
|
8680
8718
|
}
|
|
8681
8719
|
var _v = xl, Iv = Sl, Ov = Cl, Tl = El;
|
|
8682
|
-
const
|
|
8720
|
+
const Mv = _v, kv = Iv, Dv = Ov, Al = l.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__PURE__ */ c(
|
|
8683
8721
|
Tl,
|
|
8684
8722
|
{
|
|
8685
8723
|
ref: r,
|
|
@@ -8734,7 +8772,7 @@ const _l = l.forwardRef(
|
|
|
8734
8772
|
}),
|
|
8735
8773
|
[b, v, m, u, f, d, h]
|
|
8736
8774
|
);
|
|
8737
|
-
return /* @__PURE__ */ c(Pl.Provider, { value: w, children: /* @__PURE__ */ c(
|
|
8775
|
+
return /* @__PURE__ */ c(Pl.Provider, { value: w, children: /* @__PURE__ */ c(Mv, { delayDuration: 0, children: /* @__PURE__ */ c(
|
|
8738
8776
|
"div",
|
|
8739
8777
|
{
|
|
8740
8778
|
style: {
|
|
@@ -8838,7 +8876,7 @@ Il.displayName = "Sidebar";
|
|
|
8838
8876
|
const Ol = l.forwardRef(({ className: e, onClick: t, ...n }, r) => {
|
|
8839
8877
|
const { toggleSidebar: o } = wr();
|
|
8840
8878
|
return /* @__PURE__ */ R(
|
|
8841
|
-
|
|
8879
|
+
pe,
|
|
8842
8880
|
{
|
|
8843
8881
|
ref: r,
|
|
8844
8882
|
"data-sidebar": "trigger",
|
|
@@ -8882,7 +8920,7 @@ const Hv = l.forwardRef(({ className: e, ...t }, n) => {
|
|
|
8882
8920
|
);
|
|
8883
8921
|
});
|
|
8884
8922
|
Hv.displayName = "SidebarRail";
|
|
8885
|
-
const
|
|
8923
|
+
const Ml = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
8886
8924
|
"main",
|
|
8887
8925
|
{
|
|
8888
8926
|
ref: n,
|
|
@@ -8894,7 +8932,7 @@ const kl = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
|
8894
8932
|
...t
|
|
8895
8933
|
}
|
|
8896
8934
|
));
|
|
8897
|
-
|
|
8935
|
+
Ml.displayName = "SidebarInset";
|
|
8898
8936
|
const Wv = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
8899
8937
|
tn,
|
|
8900
8938
|
{
|
|
@@ -8908,7 +8946,7 @@ const Wv = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
|
8908
8946
|
}
|
|
8909
8947
|
));
|
|
8910
8948
|
Wv.displayName = "SidebarInput";
|
|
8911
|
-
const
|
|
8949
|
+
const kl = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
8912
8950
|
"div",
|
|
8913
8951
|
{
|
|
8914
8952
|
ref: n,
|
|
@@ -8917,7 +8955,7 @@ const Ml = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
|
8917
8955
|
...t
|
|
8918
8956
|
}
|
|
8919
8957
|
));
|
|
8920
|
-
|
|
8958
|
+
kl.displayName = "SidebarHeader";
|
|
8921
8959
|
const Vv = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
8922
8960
|
"div",
|
|
8923
8961
|
{
|
|
@@ -9063,7 +9101,7 @@ const Gv = rn(
|
|
|
9063
9101
|
);
|
|
9064
9102
|
return o ? (typeof o == "string" && (o = {
|
|
9065
9103
|
children: o
|
|
9066
|
-
}), /* @__PURE__ */ R(
|
|
9104
|
+
}), /* @__PURE__ */ R(kv, { children: [
|
|
9067
9105
|
/* @__PURE__ */ c(Dv, { asChild: !0, children: p }),
|
|
9068
9106
|
/* @__PURE__ */ c(
|
|
9069
9107
|
Al,
|
|
@@ -9183,7 +9221,7 @@ const Qv = l.forwardRef(({ asChild: e = !1, size: t = "md", isActive: n, classNa
|
|
|
9183
9221
|
}
|
|
9184
9222
|
));
|
|
9185
9223
|
Qv.displayName = "SidebarMenuSubButton";
|
|
9186
|
-
function
|
|
9224
|
+
function My({
|
|
9187
9225
|
header: e,
|
|
9188
9226
|
sidebarTitle: t = "Threads",
|
|
9189
9227
|
showThreads: n = !0,
|
|
@@ -9194,7 +9232,7 @@ function ky({
|
|
|
9194
9232
|
}) {
|
|
9195
9233
|
return /* @__PURE__ */ c(Rn, { ...a, children: /* @__PURE__ */ R(_l, { className: `w-full ${r}`, children: [
|
|
9196
9234
|
/* @__PURE__ */ R(Il, { className: `border-r ${o}`, children: [
|
|
9197
|
-
/* @__PURE__ */ c(
|
|
9235
|
+
/* @__PURE__ */ c(kl, { children: /* @__PURE__ */ c(Bl, { children: /* @__PURE__ */ c(Ul, { children: /* @__PURE__ */ c(zl, { size: "lg", children: /* @__PURE__ */ c("span", { className: "font-semibold", children: t }) }) }) }) }),
|
|
9198
9236
|
/* @__PURE__ */ c(Dl, { children: n && /* @__PURE__ */ R(Ll, { children: [
|
|
9199
9237
|
/* @__PURE__ */ c(Fl, { children: "Conversations" }),
|
|
9200
9238
|
/* @__PURE__ */ c($l, { children: /* @__PURE__ */ c("div", { className: "px-2 py-1", children: /* @__PURE__ */ c(
|
|
@@ -9208,7 +9246,7 @@ function ky({
|
|
|
9208
9246
|
) }) })
|
|
9209
9247
|
] }) })
|
|
9210
9248
|
] }),
|
|
9211
|
-
/* @__PURE__ */ R(
|
|
9249
|
+
/* @__PURE__ */ R(Ml, { children: [
|
|
9212
9250
|
/* @__PURE__ */ R("header", { className: "h-14 border-b bg-background/60 backdrop-blur flex items-center gap-2 px-4", children: [
|
|
9213
9251
|
/* @__PURE__ */ c(Ol, {}),
|
|
9214
9252
|
/* @__PURE__ */ c("div", { className: "flex-1" }),
|
|
@@ -9246,7 +9284,7 @@ function Vl(e) {
|
|
|
9246
9284
|
const t = l.useRef({ value: e, previous: e });
|
|
9247
9285
|
return l.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
|
|
9248
9286
|
}
|
|
9249
|
-
var yr = "Switch", [nw,
|
|
9287
|
+
var yr = "Switch", [nw, ky] = Ue(yr), [rw, ow] = nw(yr), jl = l.forwardRef(
|
|
9250
9288
|
(e, t) => {
|
|
9251
9289
|
const {
|
|
9252
9290
|
__scopeSwitch: n,
|
|
@@ -9259,7 +9297,7 @@ var yr = "Switch", [nw, My] = Ue(yr), [rw, ow] = nw(yr), jl = l.forwardRef(
|
|
|
9259
9297
|
onCheckedChange: f,
|
|
9260
9298
|
form: d,
|
|
9261
9299
|
...p
|
|
9262
|
-
} = e, [g, v] = l.useState(null), m =
|
|
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({
|
|
9263
9301
|
prop: o,
|
|
9264
9302
|
defaultProp: s ?? !1,
|
|
9265
9303
|
onChange: f,
|
|
@@ -9325,7 +9363,7 @@ var sw = "SwitchBubbleInput", ql = l.forwardRef(
|
|
|
9325
9363
|
bubbles: r = !0,
|
|
9326
9364
|
...o
|
|
9327
9365
|
}, s) => {
|
|
9328
|
-
const a = l.useRef(null), i =
|
|
9366
|
+
const a = l.useRef(null), i = te(a, s), u = Vl(n), f = li(t);
|
|
9329
9367
|
return l.useEffect(() => {
|
|
9330
9368
|
const d = a.current;
|
|
9331
9369
|
if (!d) return;
|
|
@@ -9402,18 +9440,18 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
|
|
|
9402
9440
|
disabled: g,
|
|
9403
9441
|
required: v,
|
|
9404
9442
|
form: m
|
|
9405
|
-
} = e, h = Cr(t), [b, w] = l.useState(null), [y, x] = l.useState(null), [E, C] = l.useState(!1), I = tr(f), [N,
|
|
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({
|
|
9406
9444
|
prop: r,
|
|
9407
9445
|
defaultProp: o ?? !1,
|
|
9408
9446
|
onChange: s,
|
|
9409
9447
|
caller: gt
|
|
9410
|
-
}), [
|
|
9448
|
+
}), [D, L] = ot({
|
|
9411
9449
|
prop: a,
|
|
9412
9450
|
defaultProp: i,
|
|
9413
9451
|
onChange: u,
|
|
9414
9452
|
caller: gt
|
|
9415
|
-
}), j = l.useRef(null), K = b ? m || !!b.closest("form") : !0, [W, B] = l.useState(/* @__PURE__ */ new Set()), q = Array.from(W).map((
|
|
9416
|
-
return /* @__PURE__ */ c(
|
|
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(";");
|
|
9454
|
+
return /* @__PURE__ */ c(Mo, { ...h, children: /* @__PURE__ */ R(
|
|
9417
9455
|
uw,
|
|
9418
9456
|
{
|
|
9419
9457
|
required: v,
|
|
@@ -9425,10 +9463,10 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
|
|
|
9425
9463
|
valueNodeHasChildren: E,
|
|
9426
9464
|
onValueNodeHasChildrenChange: C,
|
|
9427
9465
|
contentId: Le(),
|
|
9428
|
-
value:
|
|
9429
|
-
onValueChange:
|
|
9466
|
+
value: D,
|
|
9467
|
+
onValueChange: L,
|
|
9430
9468
|
open: N,
|
|
9431
|
-
onOpenChange:
|
|
9469
|
+
onOpenChange: F,
|
|
9432
9470
|
dir: I,
|
|
9433
9471
|
triggerPointerDownPosRef: j,
|
|
9434
9472
|
disabled: g,
|
|
@@ -9437,13 +9475,13 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
|
|
|
9437
9475
|
dw,
|
|
9438
9476
|
{
|
|
9439
9477
|
scope: e.__scopeSelect,
|
|
9440
|
-
onNativeOptionAdd: l.useCallback((
|
|
9441
|
-
B((G) => new Set(G).add(
|
|
9478
|
+
onNativeOptionAdd: l.useCallback(($) => {
|
|
9479
|
+
B((G) => new Set(G).add($));
|
|
9442
9480
|
}, []),
|
|
9443
|
-
onNativeOptionRemove: l.useCallback((
|
|
9481
|
+
onNativeOptionRemove: l.useCallback(($) => {
|
|
9444
9482
|
B((G) => {
|
|
9445
9483
|
const T = new Set(G);
|
|
9446
|
-
return T.delete(
|
|
9484
|
+
return T.delete($), T;
|
|
9447
9485
|
});
|
|
9448
9486
|
}, []),
|
|
9449
9487
|
children: n
|
|
@@ -9457,12 +9495,12 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
|
|
|
9457
9495
|
tabIndex: -1,
|
|
9458
9496
|
name: d,
|
|
9459
9497
|
autoComplete: p,
|
|
9460
|
-
value:
|
|
9461
|
-
onChange: (
|
|
9498
|
+
value: D,
|
|
9499
|
+
onChange: ($) => L($.target.value),
|
|
9462
9500
|
disabled: g,
|
|
9463
9501
|
form: m,
|
|
9464
9502
|
children: [
|
|
9465
|
-
|
|
9503
|
+
D === void 0 ? /* @__PURE__ */ c("option", { value: "" }) : null,
|
|
9466
9504
|
Array.from(W)
|
|
9467
9505
|
]
|
|
9468
9506
|
},
|
|
@@ -9475,7 +9513,7 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
|
|
|
9475
9513
|
Jl.displayName = gt;
|
|
9476
9514
|
var Zl = "SelectTrigger", Ql = l.forwardRef(
|
|
9477
9515
|
(e, t) => {
|
|
9478
|
-
const { __scopeSelect: n, disabled: r = !1, ...o } = e, s = Cr(n), a = it(Zl, n), i = a.disabled || r, u =
|
|
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) => {
|
|
9479
9517
|
const b = f().filter((x) => !x.disabled), w = b.find((x) => x.value === a.value), y = Eu(b, h, w);
|
|
9480
9518
|
y !== void 0 && a.onValueChange(y.value);
|
|
9481
9519
|
}), m = (h) => {
|
|
@@ -9484,7 +9522,7 @@ var Zl = "SelectTrigger", Ql = l.forwardRef(
|
|
|
9484
9522
|
y: Math.round(h.pageY)
|
|
9485
9523
|
});
|
|
9486
9524
|
};
|
|
9487
|
-
return /* @__PURE__ */ c(
|
|
9525
|
+
return /* @__PURE__ */ c(ko, { asChild: !0, ...s, children: /* @__PURE__ */ c(
|
|
9488
9526
|
J.button,
|
|
9489
9527
|
{
|
|
9490
9528
|
type: "button",
|
|
@@ -9519,7 +9557,7 @@ var Zl = "SelectTrigger", Ql = l.forwardRef(
|
|
|
9519
9557
|
Ql.displayName = Zl;
|
|
9520
9558
|
var eu = "SelectValue", tu = l.forwardRef(
|
|
9521
9559
|
(e, t) => {
|
|
9522
|
-
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 =
|
|
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);
|
|
9523
9561
|
return be(() => {
|
|
9524
9562
|
f(d);
|
|
9525
9563
|
}, [f, d]), /* @__PURE__ */ c(
|
|
@@ -9559,7 +9597,7 @@ var bt = "SelectContent", ou = l.forwardRef(
|
|
|
9559
9597
|
}
|
|
9560
9598
|
);
|
|
9561
9599
|
ou.displayName = bt;
|
|
9562
|
-
var
|
|
9600
|
+
var ke = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent.RemoveScroll"), au = l.forwardRef(
|
|
9563
9601
|
(e, t) => {
|
|
9564
9602
|
const {
|
|
9565
9603
|
__scopeSelect: n,
|
|
@@ -9581,22 +9619,22 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
|
|
|
9581
9619
|
avoidCollisions: b,
|
|
9582
9620
|
//
|
|
9583
9621
|
...w
|
|
9584
|
-
} = e, y = it(bt, n), [x, E] = l.useState(null), [C, I] = l.useState(null), N =
|
|
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(
|
|
9585
9623
|
null
|
|
9586
9624
|
), K = Sr(n), [W, B] = l.useState(!1), q = l.useRef(!1);
|
|
9587
9625
|
l.useEffect(() => {
|
|
9588
9626
|
if (x) return Fo(x);
|
|
9589
9627
|
}, [x]), Eo();
|
|
9590
|
-
const
|
|
9628
|
+
const $ = l.useCallback(
|
|
9591
9629
|
(V) => {
|
|
9592
|
-
const [
|
|
9630
|
+
const [re, ...ie] = K().map((Z) => Z.ref.current), [oe] = ie.slice(-1), H = document.activeElement;
|
|
9593
9631
|
for (const Z of V)
|
|
9594
|
-
if (Z === H || (Z == null || Z.scrollIntoView({ block: "nearest" }), Z ===
|
|
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;
|
|
9595
9633
|
},
|
|
9596
9634
|
[K, C]
|
|
9597
9635
|
), G = l.useCallback(
|
|
9598
|
-
() =>
|
|
9599
|
-
[F,
|
|
9636
|
+
() => $([F, x]),
|
|
9637
|
+
[$, F, x]
|
|
9600
9638
|
);
|
|
9601
9639
|
l.useEffect(() => {
|
|
9602
9640
|
W && G();
|
|
@@ -9605,17 +9643,17 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
|
|
|
9605
9643
|
l.useEffect(() => {
|
|
9606
9644
|
if (x) {
|
|
9607
9645
|
let V = { x: 0, y: 0 };
|
|
9608
|
-
const
|
|
9646
|
+
const re = (oe) => {
|
|
9609
9647
|
var H, Z;
|
|
9610
9648
|
V = {
|
|
9611
|
-
x: Math.abs(Math.round(
|
|
9612
|
-
y: Math.abs(Math.round(
|
|
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))
|
|
9613
9651
|
};
|
|
9614
|
-
}, ie = (
|
|
9615
|
-
V.x <= 10 && V.y <= 10 ?
|
|
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;
|
|
9616
9654
|
};
|
|
9617
|
-
return P.current !== null && (document.addEventListener("pointermove",
|
|
9618
|
-
document.removeEventListener("pointermove",
|
|
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 });
|
|
9619
9657
|
};
|
|
9620
9658
|
}
|
|
9621
9659
|
}, [x, T, P]), l.useEffect(() => {
|
|
@@ -9625,21 +9663,21 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
|
|
|
9625
9663
|
};
|
|
9626
9664
|
}, [T]);
|
|
9627
9665
|
const [_, O] = Cu((V) => {
|
|
9628
|
-
const
|
|
9629
|
-
|
|
9630
|
-
}),
|
|
9631
|
-
(V,
|
|
9632
|
-
const
|
|
9633
|
-
(y.value !== void 0 && y.value ===
|
|
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));
|
|
9634
9672
|
},
|
|
9635
9673
|
[y.value]
|
|
9636
|
-
),
|
|
9637
|
-
(V,
|
|
9638
|
-
const
|
|
9639
|
-
(y.value !== void 0 && y.value ===
|
|
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);
|
|
9640
9678
|
},
|
|
9641
9679
|
[y.value]
|
|
9642
|
-
), le = r === "popper" ? io : iu,
|
|
9680
|
+
), le = r === "popper" ? io : iu, se = le === io ? {
|
|
9643
9681
|
side: i,
|
|
9644
9682
|
sideOffset: u,
|
|
9645
9683
|
align: f,
|
|
@@ -9658,12 +9696,12 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
|
|
|
9658
9696
|
content: x,
|
|
9659
9697
|
viewport: C,
|
|
9660
9698
|
onViewportChange: I,
|
|
9661
|
-
itemRefCallback:
|
|
9662
|
-
selectedItem:
|
|
9663
|
-
onItemLeave:
|
|
9699
|
+
itemRefCallback: Y,
|
|
9700
|
+
selectedItem: F,
|
|
9701
|
+
onItemLeave: M,
|
|
9664
9702
|
itemTextRefCallback: z,
|
|
9665
9703
|
focusSelectedItem: G,
|
|
9666
|
-
selectedItemText:
|
|
9704
|
+
selectedItemText: L,
|
|
9667
9705
|
position: r,
|
|
9668
9706
|
isPositioned: W,
|
|
9669
9707
|
searchRef: _,
|
|
@@ -9676,8 +9714,8 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
|
|
|
9676
9714
|
V.preventDefault();
|
|
9677
9715
|
},
|
|
9678
9716
|
onUnmountAutoFocus: U(o, (V) => {
|
|
9679
|
-
var
|
|
9680
|
-
(
|
|
9717
|
+
var re;
|
|
9718
|
+
(re = y.trigger) == null || re.focus({ preventScroll: !0 }), V.preventDefault();
|
|
9681
9719
|
}),
|
|
9682
9720
|
children: /* @__PURE__ */ c(
|
|
9683
9721
|
ln,
|
|
@@ -9697,7 +9735,7 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
|
|
|
9697
9735
|
dir: y.dir,
|
|
9698
9736
|
onContextMenu: (V) => V.preventDefault(),
|
|
9699
9737
|
...w,
|
|
9700
|
-
...
|
|
9738
|
+
...se,
|
|
9701
9739
|
onPlaced: () => B(!0),
|
|
9702
9740
|
ref: N,
|
|
9703
9741
|
style: {
|
|
@@ -9709,14 +9747,14 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
|
|
|
9709
9747
|
...w.style
|
|
9710
9748
|
},
|
|
9711
9749
|
onKeyDown: U(w.onKeyDown, (V) => {
|
|
9712
|
-
const
|
|
9713
|
-
if (V.key === "Tab" && V.preventDefault(), !
|
|
9714
|
-
let
|
|
9715
|
-
if (["ArrowUp", "End"].includes(V.key) && (
|
|
9716
|
-
const H = V.target, Z =
|
|
9717
|
-
|
|
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);
|
|
9718
9756
|
}
|
|
9719
|
-
setTimeout(() =>
|
|
9757
|
+
setTimeout(() => $(oe)), V.preventDefault();
|
|
9720
9758
|
}
|
|
9721
9759
|
})
|
|
9722
9760
|
}
|
|
@@ -9731,48 +9769,48 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
|
|
|
9731
9769
|
);
|
|
9732
9770
|
au.displayName = mw;
|
|
9733
9771
|
var bw = "SelectItemAlignedPosition", iu = l.forwardRef((e, t) => {
|
|
9734
|
-
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 =
|
|
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(() => {
|
|
9735
9773
|
if (s.trigger && s.valueNode && i && f && h && b && w) {
|
|
9736
|
-
const N = s.trigger.getBoundingClientRect(),
|
|
9774
|
+
const N = s.trigger.getBoundingClientRect(), F = f.getBoundingClientRect(), D = s.valueNode.getBoundingClientRect(), L = w.getBoundingClientRect();
|
|
9737
9775
|
if (s.dir !== "rtl") {
|
|
9738
|
-
const H =
|
|
9739
|
-
|
|
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, [
|
|
9777
|
+
ke,
|
|
9740
9778
|
// Prevents the content from going off the starting edge of the
|
|
9741
9779
|
// viewport. It may still go off the ending edge, but this can be
|
|
9742
9780
|
// controlled by the user since they may want to manage overflow in a
|
|
9743
9781
|
// specific way.
|
|
9744
9782
|
// https://github.com/radix-ui/primitives/issues/2049
|
|
9745
|
-
Math.max(
|
|
9783
|
+
Math.max(ke, Q - me)
|
|
9746
9784
|
]);
|
|
9747
|
-
i.style.minWidth =
|
|
9785
|
+
i.style.minWidth = he + "px", i.style.left = ve + "px";
|
|
9748
9786
|
} else {
|
|
9749
|
-
const H =
|
|
9750
|
-
|
|
9751
|
-
Math.max(
|
|
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, [
|
|
9788
|
+
ke,
|
|
9789
|
+
Math.max(ke, Q - me)
|
|
9752
9790
|
]);
|
|
9753
|
-
i.style.minWidth =
|
|
9791
|
+
i.style.minWidth = he + "px", i.style.right = ve + "px";
|
|
9754
9792
|
}
|
|
9755
|
-
const j = g(), K = window.innerHeight -
|
|
9756
|
-
if (
|
|
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) {
|
|
9757
9795
|
const H = j.length > 0 && b === j[j.length - 1].ref.current;
|
|
9758
9796
|
i.style.bottom = "0px";
|
|
9759
9797
|
const Z = f.clientHeight - h.offsetTop - h.offsetHeight, de = Math.max(
|
|
9760
9798
|
le,
|
|
9761
|
-
|
|
9762
|
-
(H ?
|
|
9763
|
-
),
|
|
9764
|
-
i.style.height =
|
|
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";
|
|
9765
9803
|
} else {
|
|
9766
9804
|
const H = j.length > 0 && b === j[0].ref.current;
|
|
9767
9805
|
i.style.top = "0px";
|
|
9768
9806
|
const de = Math.max(
|
|
9769
9807
|
z,
|
|
9770
9808
|
q + h.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
9771
|
-
(H ?
|
|
9809
|
+
(H ? Y : 0) + se
|
|
9772
9810
|
) + ie;
|
|
9773
|
-
i.style.height = de + "px", h.scrollTop =
|
|
9811
|
+
i.style.height = de + "px", h.scrollTop = re - z + h.offsetTop;
|
|
9774
9812
|
}
|
|
9775
|
-
i.style.margin = `${
|
|
9813
|
+
i.style.margin = `${ke}px 0`, i.style.minHeight = _ + "px", i.style.maxHeight = K + "px", r == null || r(), requestAnimationFrame(() => v.current = !0);
|
|
9776
9814
|
}
|
|
9777
9815
|
}, [
|
|
9778
9816
|
g,
|
|
@@ -9839,7 +9877,7 @@ var vw = "SelectPopperPosition", io = l.forwardRef((e, t) => {
|
|
|
9839
9877
|
const {
|
|
9840
9878
|
__scopeSelect: n,
|
|
9841
9879
|
align: r = "start",
|
|
9842
|
-
collisionPadding: o =
|
|
9880
|
+
collisionPadding: o = ke,
|
|
9843
9881
|
...s
|
|
9844
9882
|
} = e, a = Cr(n);
|
|
9845
9883
|
return /* @__PURE__ */ c(
|
|
@@ -9866,7 +9904,7 @@ var vw = "SelectPopperPosition", io = l.forwardRef((e, t) => {
|
|
|
9866
9904
|
io.displayName = vw;
|
|
9867
9905
|
var [ww, ts] = zt(bt, {}), co = "SelectViewport", cu = l.forwardRef(
|
|
9868
9906
|
(e, t) => {
|
|
9869
|
-
const { __scopeSelect: n, nonce: r, ...o } = e, s = ct(co, n), a = ts(co, n), i =
|
|
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);
|
|
9870
9908
|
return /* @__PURE__ */ R(De, { children: [
|
|
9871
9909
|
/* @__PURE__ */ c(
|
|
9872
9910
|
"style",
|
|
@@ -9902,7 +9940,7 @@ var [ww, ts] = zt(bt, {}), co = "SelectViewport", cu = l.forwardRef(
|
|
|
9902
9940
|
if (g != null && g.current && p) {
|
|
9903
9941
|
const v = Math.abs(u.current - d.scrollTop);
|
|
9904
9942
|
if (v > 0) {
|
|
9905
|
-
const m = window.innerHeight -
|
|
9943
|
+
const m = window.innerHeight - ke * 2, h = parseFloat(p.style.minHeight), b = parseFloat(p.style.height), w = Math.max(h, b);
|
|
9906
9944
|
if (w < m) {
|
|
9907
9945
|
const y = w + v, x = Math.min(m, y), E = y - x;
|
|
9908
9946
|
p.style.height = x + "px", p.style.bottom === "0px" && (d.scrollTop = E > 0 ? E : 0, p.style.justifyContent = "flex-end");
|
|
@@ -9939,7 +9977,7 @@ var Gn = "SelectItem", [Cw, fu] = zt(Gn), pu = l.forwardRef(
|
|
|
9939
9977
|
disabled: o = !1,
|
|
9940
9978
|
textValue: s,
|
|
9941
9979
|
...a
|
|
9942
|
-
} = e, i = it(Gn, n), u = ct(Gn, n), f = i.value === r, [d, p] = l.useState(s ?? ""), [g, v] = l.useState(!1), m =
|
|
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(
|
|
9943
9981
|
t,
|
|
9944
9982
|
(y) => {
|
|
9945
9983
|
var x;
|
|
@@ -10017,7 +10055,7 @@ var Gn = "SelectItem", [Cw, fu] = zt(Gn), pu = l.forwardRef(
|
|
|
10017
10055
|
pu.displayName = Gn;
|
|
10018
10056
|
var jt = "SelectItemText", hu = l.forwardRef(
|
|
10019
10057
|
(e, t) => {
|
|
10020
|
-
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 =
|
|
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(
|
|
10021
10059
|
t,
|
|
10022
10060
|
(w) => p(w),
|
|
10023
10061
|
u.onItemTextChange,
|
|
@@ -10044,7 +10082,7 @@ var mu = "SelectItemIndicator", gu = l.forwardRef(
|
|
|
10044
10082
|
);
|
|
10045
10083
|
gu.displayName = mu;
|
|
10046
10084
|
var lo = "SelectScrollUpButton", bu = l.forwardRef((e, t) => {
|
|
10047
|
-
const n = ct(lo, e.__scopeSelect), r = ts(lo, e.__scopeSelect), [o, s] = l.useState(!1), a =
|
|
10085
|
+
const n = ct(lo, e.__scopeSelect), r = ts(lo, e.__scopeSelect), [o, s] = l.useState(!1), a = te(t, r.onScrollButtonChange);
|
|
10048
10086
|
return be(() => {
|
|
10049
10087
|
if (n.viewport && n.isPositioned) {
|
|
10050
10088
|
let i = function() {
|
|
@@ -10068,7 +10106,7 @@ var lo = "SelectScrollUpButton", bu = l.forwardRef((e, t) => {
|
|
|
10068
10106
|
});
|
|
10069
10107
|
bu.displayName = lo;
|
|
10070
10108
|
var uo = "SelectScrollDownButton", vu = l.forwardRef((e, t) => {
|
|
10071
|
-
const n = ct(uo, e.__scopeSelect), r = ts(uo, e.__scopeSelect), [o, s] = l.useState(!1), a =
|
|
10109
|
+
const n = ct(uo, e.__scopeSelect), r = ts(uo, e.__scopeSelect), [o, s] = l.useState(!1), a = te(t, r.onScrollButtonChange);
|
|
10072
10110
|
return be(() => {
|
|
10073
10111
|
if (n.viewport && n.isPositioned) {
|
|
10074
10112
|
let i = function() {
|
|
@@ -10134,7 +10172,7 @@ var fo = "SelectArrow", Rw = l.forwardRef(
|
|
|
10134
10172
|
Rw.displayName = fo;
|
|
10135
10173
|
var Nw = "SelectBubbleInput", xu = l.forwardRef(
|
|
10136
10174
|
({ __scopeSelect: e, value: t, ...n }, r) => {
|
|
10137
|
-
const o = l.useRef(null), s =
|
|
10175
|
+
const o = l.useRef(null), s = te(r, o), a = Vl(t);
|
|
10138
10176
|
return l.useEffect(() => {
|
|
10139
10177
|
const i = o.current;
|
|
10140
10178
|
if (!i) return;
|
|
@@ -10187,7 +10225,7 @@ function Eu(e, t, n) {
|
|
|
10187
10225
|
function Tw(e, t) {
|
|
10188
10226
|
return e.map((n, r) => e[(t + r) % e.length]);
|
|
10189
10227
|
}
|
|
10190
|
-
var Aw = Jl, Ru = Ql, Pw = tu, _w = nu, Iw = ru, Nu = ou, Ow = cu, Tu = du, Au = pu,
|
|
10228
|
+
var Aw = Jl, Ru = Ql, Pw = tu, _w = nu, Iw = ru, Nu = ou, Ow = cu, Tu = du, Au = pu, Mw = hu, kw = gu, Pu = bu, _u = vu, Iu = yu;
|
|
10191
10229
|
const sa = Aw, aa = Pw, po = l.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ R(
|
|
10192
10230
|
Ru,
|
|
10193
10231
|
{
|
|
@@ -10217,7 +10255,7 @@ const Ou = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
|
10217
10255
|
}
|
|
10218
10256
|
));
|
|
10219
10257
|
Ou.displayName = Pu.displayName;
|
|
10220
|
-
const
|
|
10258
|
+
const Mu = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
10221
10259
|
_u,
|
|
10222
10260
|
{
|
|
10223
10261
|
ref: n,
|
|
@@ -10229,7 +10267,7 @@ const ku = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
|
10229
10267
|
children: /* @__PURE__ */ c(Tt, { className: "h-4 w-4" })
|
|
10230
10268
|
}
|
|
10231
10269
|
));
|
|
10232
|
-
|
|
10270
|
+
Mu.displayName = _u.displayName;
|
|
10233
10271
|
const ho = l.forwardRef(({ className: e, children: t, position: n = "popper", ...r }, o) => /* @__PURE__ */ c(Iw, { children: /* @__PURE__ */ R(
|
|
10234
10272
|
Nu,
|
|
10235
10273
|
{
|
|
@@ -10253,7 +10291,7 @@ const ho = l.forwardRef(({ className: e, children: t, position: n = "popper", ..
|
|
|
10253
10291
|
children: t
|
|
10254
10292
|
}
|
|
10255
10293
|
),
|
|
10256
|
-
/* @__PURE__ */ c(
|
|
10294
|
+
/* @__PURE__ */ c(Mu, {})
|
|
10257
10295
|
]
|
|
10258
10296
|
}
|
|
10259
10297
|
) }));
|
|
@@ -10277,8 +10315,8 @@ const lt = l.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
|
|
|
10277
10315
|
),
|
|
10278
10316
|
...n,
|
|
10279
10317
|
children: [
|
|
10280
|
-
/* @__PURE__ */ c("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ c(
|
|
10281
|
-
/* @__PURE__ */ c(
|
|
10318
|
+
/* @__PURE__ */ c("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ c(kw, { children: /* @__PURE__ */ c(mo, { className: "h-4 w-4" }) }) }),
|
|
10319
|
+
/* @__PURE__ */ c(Mw, { children: t })
|
|
10282
10320
|
]
|
|
10283
10321
|
}
|
|
10284
10322
|
));
|
|
@@ -10334,8 +10372,8 @@ const Fw = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
|
10334
10372
|
}
|
|
10335
10373
|
));
|
|
10336
10374
|
Fw.displayName = "CardDescription";
|
|
10337
|
-
const
|
|
10338
|
-
|
|
10375
|
+
const Mn = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c("div", { ref: n, className: A("p-6 pt-0", e), ...t }));
|
|
10376
|
+
Mn.displayName = "CardContent";
|
|
10339
10377
|
const $w = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
|
|
10340
10378
|
"div",
|
|
10341
10379
|
{
|
|
@@ -10397,10 +10435,10 @@ const Hr = /* @__PURE__ */ new Map(), ia = (e) => {
|
|
|
10397
10435
|
toasts: e.toasts.filter((n) => n.id !== t.toastId)
|
|
10398
10436
|
};
|
|
10399
10437
|
}
|
|
10400
|
-
},
|
|
10438
|
+
}, kn = [];
|
|
10401
10439
|
let Dn = { toasts: [] };
|
|
10402
10440
|
function Yt(e) {
|
|
10403
|
-
Dn = Hw(Dn, e),
|
|
10441
|
+
Dn = Hw(Dn, e), kn.forEach((t) => {
|
|
10404
10442
|
t(Dn);
|
|
10405
10443
|
});
|
|
10406
10444
|
}
|
|
@@ -10427,9 +10465,9 @@ function Ww({ ...e }) {
|
|
|
10427
10465
|
}
|
|
10428
10466
|
function Vw() {
|
|
10429
10467
|
const [e, t] = l.useState(Dn);
|
|
10430
|
-
return l.useEffect(() => (
|
|
10431
|
-
const n =
|
|
10432
|
-
n > -1 &&
|
|
10468
|
+
return l.useEffect(() => (kn.push(t), () => {
|
|
10469
|
+
const n = kn.indexOf(t);
|
|
10470
|
+
n > -1 && kn.splice(n, 1);
|
|
10433
10471
|
}), [e]), {
|
|
10434
10472
|
...e,
|
|
10435
10473
|
toast: Ww,
|
|
@@ -10491,7 +10529,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
|
|
|
10491
10529
|
}
|
|
10492
10530
|
};
|
|
10493
10531
|
return /* @__PURE__ */ R(pl, { open: r, onOpenChange: o, children: [
|
|
10494
|
-
/* @__PURE__ */ c(lv, { asChild: !0, children: /* @__PURE__ */ R(
|
|
10532
|
+
/* @__PURE__ */ c(lv, { asChild: !0, children: /* @__PURE__ */ R(pe, { variant: "outline", size: "sm", className: n, children: [
|
|
10495
10533
|
/* @__PURE__ */ c(Yu, { className: "h-4 w-4 mr-2" }),
|
|
10496
10534
|
"Settings",
|
|
10497
10535
|
f && /* @__PURE__ */ c(Ha, { variant: "destructive", className: "ml-2 h-4 w-4 p-0" })
|
|
@@ -10507,7 +10545,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
|
|
|
10507
10545
|
/* @__PURE__ */ c(Ju, { className: "h-5 w-5" }),
|
|
10508
10546
|
"API Configuration"
|
|
10509
10547
|
] }) }),
|
|
10510
|
-
/* @__PURE__ */ R(
|
|
10548
|
+
/* @__PURE__ */ R(Mn, { className: "space-y-4", children: [
|
|
10511
10549
|
/* @__PURE__ */ R("div", { className: "space-y-2", children: [
|
|
10512
10550
|
/* @__PURE__ */ c(Ie, { htmlFor: "api-url", children: "API Base URL" }),
|
|
10513
10551
|
/* @__PURE__ */ R("div", { className: "flex gap-2", children: [
|
|
@@ -10523,7 +10561,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
|
|
|
10523
10561
|
placeholder: "http://localhost:8000/api"
|
|
10524
10562
|
}
|
|
10525
10563
|
),
|
|
10526
|
-
/* @__PURE__ */ c(
|
|
10564
|
+
/* @__PURE__ */ c(pe, { variant: "outline", onClick: h, children: "Test" })
|
|
10527
10565
|
] })
|
|
10528
10566
|
] }),
|
|
10529
10567
|
/* @__PURE__ */ R("div", { className: "flex items-center justify-between", children: [
|
|
@@ -10557,7 +10595,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
|
|
|
10557
10595
|
}
|
|
10558
10596
|
),
|
|
10559
10597
|
/* @__PURE__ */ c(
|
|
10560
|
-
|
|
10598
|
+
pe,
|
|
10561
10599
|
{
|
|
10562
10600
|
variant: "outline",
|
|
10563
10601
|
size: "icon",
|
|
@@ -10574,7 +10612,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
|
|
|
10574
10612
|
/* @__PURE__ */ c(ed, { className: "h-5 w-5" }),
|
|
10575
10613
|
"Interface Settings"
|
|
10576
10614
|
] }) }),
|
|
10577
|
-
/* @__PURE__ */ R(
|
|
10615
|
+
/* @__PURE__ */ R(Mn, { className: "space-y-4", children: [
|
|
10578
10616
|
/* @__PURE__ */ R("div", { className: "space-y-2", children: [
|
|
10579
10617
|
/* @__PURE__ */ c(Ie, { htmlFor: "layout", children: "Layout Style" }),
|
|
10580
10618
|
/* @__PURE__ */ R(
|
|
@@ -10669,7 +10707,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
|
|
|
10669
10707
|
/* @__PURE__ */ c(td, { className: "h-5 w-5" }),
|
|
10670
10708
|
"Behavior Settings"
|
|
10671
10709
|
] }) }),
|
|
10672
|
-
/* @__PURE__ */ R(
|
|
10710
|
+
/* @__PURE__ */ R(Mn, { className: "space-y-4", children: [
|
|
10673
10711
|
/* @__PURE__ */ R("div", { className: "flex items-center justify-between", children: [
|
|
10674
10712
|
/* @__PURE__ */ R("div", { children: [
|
|
10675
10713
|
/* @__PURE__ */ c(Ie, { htmlFor: "auto-save", children: "Auto-save Conversations" }),
|
|
@@ -10725,13 +10763,13 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
|
|
|
10725
10763
|
] })
|
|
10726
10764
|
] }),
|
|
10727
10765
|
/* @__PURE__ */ R("div", { className: "flex items-center justify-between pt-6 border-t", children: [
|
|
10728
|
-
/* @__PURE__ */ R(
|
|
10766
|
+
/* @__PURE__ */ R(pe, { variant: "outline", onClick: v, children: [
|
|
10729
10767
|
/* @__PURE__ */ c(Wr, { className: "h-4 w-4 mr-2" }),
|
|
10730
10768
|
"Reset"
|
|
10731
10769
|
] }),
|
|
10732
10770
|
/* @__PURE__ */ R("div", { className: "flex gap-2", children: [
|
|
10733
|
-
/* @__PURE__ */ c(
|
|
10734
|
-
/* @__PURE__ */ R(
|
|
10771
|
+
/* @__PURE__ */ c(pe, { variant: "outline", onClick: m, children: "Cancel" }),
|
|
10772
|
+
/* @__PURE__ */ R(pe, { onClick: g, disabled: !f, children: [
|
|
10735
10773
|
/* @__PURE__ */ c(nd, { className: "h-4 w-4 mr-2" }),
|
|
10736
10774
|
"Save Changes"
|
|
10737
10775
|
] })
|
|
@@ -10765,7 +10803,7 @@ function Fy({
|
|
|
10765
10803
|
"--chat-sidebar-width": f === "phone" ? "100%" : f === "tablet" ? "280px" : f === "half-screen" ? "240px" : "320px",
|
|
10766
10804
|
"--chat-message-max-width": f === "phone" ? "95%" : f === "tablet" ? "90%" : f === "half-screen" ? "85%" : "80%",
|
|
10767
10805
|
"--chat-input-height": f === "phone" ? "120px" : "100px"
|
|
10768
|
-
}), u =
|
|
10806
|
+
}), u = Je.useCallback((f) => {
|
|
10769
10807
|
var d;
|
|
10770
10808
|
(d = s.onThreadChange) == null || d.call(s, f);
|
|
10771
10809
|
}, [s.onThreadChange]);
|
|
@@ -10819,7 +10857,7 @@ export {
|
|
|
10819
10857
|
zf as ApiClient,
|
|
10820
10858
|
zf as ChatApi,
|
|
10821
10859
|
Pn as ChatInterface,
|
|
10822
|
-
|
|
10860
|
+
My as ChatMainLayout,
|
|
10823
10861
|
Rn as ChatProvider,
|
|
10824
10862
|
Ry as ChatRoutingProvider,
|
|
10825
10863
|
Ly as ChatSettings,
|