teodor-new-chat-ui 4.0.17 → 4.0.19
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 +403 -396
- package/dist/index.umd.js +14 -14
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ var Np = Object.defineProperty;
|
|
|
2
2
|
var Ap = (e, t, n) => t in e ? Np(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var Ba = (e, t, n) => Ap(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import * as p from "react";
|
|
5
|
-
import
|
|
5
|
+
import H, { createContext as ir, useContext as ar, useEffect as tt, useReducer as Cc, useState as fe, useRef as Xe, useCallback as Pe, useMemo as vt, createElement as go, useLayoutEffect as _p } from "react";
|
|
6
6
|
import { Square as jp, Send as Pp, X as Jn, ExternalLink as Op, Download as Mp, Image as Dp, FileText as Ha, Loader as Tc, Bot as Ua, Wrench as Lp, User as $p, ChevronUp as Cr, ChevronDown as Xn, Paperclip as ui, Copy as Wa, Edit as Va, RotateCcw as di, ChevronRight as Fp, Check as Wi, Circle as zp, Loader2 as fi, Edit3 as Rc, Plus as Bp, FileSpreadsheet as Hp, MessageSquarePlus as Up, MessageSquare as Wp, Calendar as Vp, Trash2 as Kp, Settings as qp, Server as Gp, EyeOff as Yp, Eye as Xp, Layout as Jp, MessageCircle as Zp, Save as Qp } from "lucide-react";
|
|
7
7
|
import { Slot as em, createSlot as nr } from "@radix-ui/react-slot";
|
|
8
8
|
import { cva as Xo } from "class-variance-authority";
|
|
@@ -24,7 +24,7 @@ var Ka;
|
|
|
24
24
|
function rm() {
|
|
25
25
|
if (Ka) return br;
|
|
26
26
|
Ka = 1;
|
|
27
|
-
var e =
|
|
27
|
+
var e = H, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
28
28
|
function i(a, c, u) {
|
|
29
29
|
var d, f = {}, h = null, m = null;
|
|
30
30
|
u !== void 0 && (h = "" + u), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (m = c.ref);
|
|
@@ -47,7 +47,7 @@ var yr = {};
|
|
|
47
47
|
var qa;
|
|
48
48
|
function om() {
|
|
49
49
|
return qa || (qa = 1, process.env.NODE_ENV !== "production" && function() {
|
|
50
|
-
var e =
|
|
50
|
+
var e = H, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), a = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), m = Symbol.for("react.offscreen"), w = Symbol.iterator, v = "@@iterator";
|
|
51
51
|
function g(T) {
|
|
52
52
|
if (T === null || typeof T != "object")
|
|
53
53
|
return null;
|
|
@@ -136,14 +136,14 @@ function om() {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
var P = Object.assign, W = 0, z, q, D, I, M,
|
|
139
|
+
var P = Object.assign, W = 0, z, q, D, I, M, B, J;
|
|
140
140
|
function Q() {
|
|
141
141
|
}
|
|
142
142
|
Q.__reactDisabledLog = !0;
|
|
143
143
|
function ce() {
|
|
144
144
|
{
|
|
145
145
|
if (W === 0) {
|
|
146
|
-
z = console.log, q = console.info, D = console.warn, I = console.error, M = console.group,
|
|
146
|
+
z = console.log, q = console.info, D = console.warn, I = console.error, M = console.group, B = console.groupCollapsed, J = console.groupEnd;
|
|
147
147
|
var T = {
|
|
148
148
|
configurable: !0,
|
|
149
149
|
enumerable: !0,
|
|
@@ -163,7 +163,7 @@ function om() {
|
|
|
163
163
|
W++;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function we() {
|
|
167
167
|
{
|
|
168
168
|
if (W--, W === 0) {
|
|
169
169
|
var T = {
|
|
@@ -188,10 +188,10 @@ function om() {
|
|
|
188
188
|
value: M
|
|
189
189
|
}),
|
|
190
190
|
groupCollapsed: P({}, T, {
|
|
191
|
-
value:
|
|
191
|
+
value: B
|
|
192
192
|
}),
|
|
193
193
|
groupEnd: P({}, T, {
|
|
194
|
-
value:
|
|
194
|
+
value: J
|
|
195
195
|
})
|
|
196
196
|
});
|
|
197
197
|
}
|
|
@@ -283,7 +283,7 @@ function om() {
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
} finally {
|
|
286
|
-
Y = !1, Ee.current = Ke,
|
|
286
|
+
Y = !1, Ee.current = Ke, we(), Error.prepareStackTrace = He;
|
|
287
287
|
}
|
|
288
288
|
var Kn = T ? T.displayName || T.name : "", Rn = Kn ? O(Kn) : "";
|
|
289
289
|
return typeof T == "function" && ee.set(T, Rn), Rn;
|
|
@@ -324,17 +324,17 @@ function om() {
|
|
|
324
324
|
}
|
|
325
325
|
return "";
|
|
326
326
|
}
|
|
327
|
-
var
|
|
327
|
+
var X = Object.prototype.hasOwnProperty, xe = {}, je = x.ReactDebugCurrentFrame;
|
|
328
328
|
function Ie(T) {
|
|
329
329
|
if (T) {
|
|
330
330
|
var U = T._owner, te = V(T.type, T._source, U ? U.type : null);
|
|
331
|
-
|
|
331
|
+
je.setExtraStackFrame(te);
|
|
332
332
|
} else
|
|
333
|
-
|
|
333
|
+
je.setExtraStackFrame(null);
|
|
334
334
|
}
|
|
335
335
|
function nt(T, U, te, Se, He) {
|
|
336
336
|
{
|
|
337
|
-
var Ke = Function.call.bind(
|
|
337
|
+
var Ke = Function.call.bind(X);
|
|
338
338
|
for (var $e in T)
|
|
339
339
|
if (Ke(T, $e)) {
|
|
340
340
|
var Oe = void 0;
|
|
@@ -347,7 +347,7 @@ function om() {
|
|
|
347
347
|
} catch (rt) {
|
|
348
348
|
Oe = rt;
|
|
349
349
|
}
|
|
350
|
-
Oe && !(Oe instanceof Error) && (Ie(He), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Se || "React class", te, $e, typeof Oe), Ie(null)), Oe instanceof Error && !(Oe.message in
|
|
350
|
+
Oe && !(Oe instanceof Error) && (Ie(He), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Se || "React class", te, $e, typeof Oe), Ie(null)), Oe instanceof Error && !(Oe.message in xe) && (xe[Oe.message] = !0, Ie(He), b("Failed %s type: %s", te, Oe.message), Ie(null));
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
}
|
|
@@ -382,7 +382,7 @@ function om() {
|
|
|
382
382
|
__source: !0
|
|
383
383
|
}, Ve, ct;
|
|
384
384
|
function jt(T) {
|
|
385
|
-
if (
|
|
385
|
+
if (X.call(T, "ref")) {
|
|
386
386
|
var U = Object.getOwnPropertyDescriptor(T, "ref").get;
|
|
387
387
|
if (U && U.isReactWarning)
|
|
388
388
|
return !1;
|
|
@@ -390,7 +390,7 @@ function om() {
|
|
|
390
390
|
return T.ref !== void 0;
|
|
391
391
|
}
|
|
392
392
|
function Vn(T) {
|
|
393
|
-
if (
|
|
393
|
+
if (X.call(T, "key")) {
|
|
394
394
|
var U = Object.getOwnPropertyDescriptor(T, "key").get;
|
|
395
395
|
if (U && U.isReactWarning)
|
|
396
396
|
return !1;
|
|
@@ -456,7 +456,7 @@ function om() {
|
|
|
456
456
|
var Ke, $e = {}, Oe = null, xt = null;
|
|
457
457
|
te !== void 0 && (Te(te), Oe = "" + te), Vn(U) && (Te(U.key), Oe = "" + U.key), jt(U) && (xt = U.ref, Ps(U, He));
|
|
458
458
|
for (Ke in U)
|
|
459
|
-
|
|
459
|
+
X.call(U, Ke) && !We.hasOwnProperty(Ke) && ($e[Ke] = U[Ke]);
|
|
460
460
|
if (T && T.defaultProps) {
|
|
461
461
|
var rt = T.defaultProps;
|
|
462
462
|
for (Ke in rt)
|
|
@@ -523,7 +523,7 @@ Check the top-level render call using <` + te + ">.");
|
|
|
523
523
|
T && T._owner && T._owner !== gr.current && (Se = " It was passed a child from " + $(T._owner.type) + "."), fn(T), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', te, Se), fn(null);
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function ve(T, U) {
|
|
527
527
|
{
|
|
528
528
|
if (typeof T != "object")
|
|
529
529
|
return;
|
|
@@ -600,14 +600,14 @@ Check the top-level render call using <` + te + ">.");
|
|
|
600
600
|
if (Se)
|
|
601
601
|
if (oe(Pt)) {
|
|
602
602
|
for (var Kn = 0; Kn < Pt.length; Kn++)
|
|
603
|
-
|
|
603
|
+
ve(Pt[Kn], T);
|
|
604
604
|
Object.freeze && Object.freeze(Pt);
|
|
605
605
|
} else
|
|
606
606
|
b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
607
607
|
else
|
|
608
|
-
|
|
608
|
+
ve(Pt, T);
|
|
609
609
|
}
|
|
610
|
-
if (
|
|
610
|
+
if (X.call(U, "key")) {
|
|
611
611
|
var Rn = $(T), yt = Object.keys(U).filter(function(Ip) {
|
|
612
612
|
return Ip !== "key";
|
|
613
613
|
}), $s = yt.length > 0 ? "{key: someKey, " + yt.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
@@ -1876,17 +1876,17 @@ const Vc = (e) => {
|
|
|
1876
1876
|
let W;
|
|
1877
1877
|
try {
|
|
1878
1878
|
if (C && u && g !== "get" && g !== "head" && (W = await m(k, x)) !== 0) {
|
|
1879
|
-
let
|
|
1879
|
+
let B = new n(v, {
|
|
1880
1880
|
method: "POST",
|
|
1881
1881
|
body: x,
|
|
1882
1882
|
duplex: "half"
|
|
1883
|
-
}),
|
|
1884
|
-
if (j.isFormData(x) && (
|
|
1883
|
+
}), J;
|
|
1884
|
+
if (j.isFormData(x) && (J = B.headers.get("content-type")) && k.setContentType(J), B.body) {
|
|
1885
1885
|
const [Q, ce] = Qa(
|
|
1886
1886
|
W,
|
|
1887
1887
|
_o(el(C))
|
|
1888
1888
|
);
|
|
1889
|
-
x = nl(
|
|
1889
|
+
x = nl(B.body, rl, Q, ce);
|
|
1890
1890
|
}
|
|
1891
1891
|
}
|
|
1892
1892
|
j.isString(N) || (N = N ? "include" : "omit");
|
|
@@ -1903,25 +1903,25 @@ const Vc = (e) => {
|
|
|
1903
1903
|
let D = await (s ? _($, A) : _(v, q));
|
|
1904
1904
|
const I = d && (E === "stream" || E === "response");
|
|
1905
1905
|
if (d && (S || I && P)) {
|
|
1906
|
-
const
|
|
1907
|
-
["status", "statusText", "headers"].forEach((
|
|
1908
|
-
|
|
1906
|
+
const B = {};
|
|
1907
|
+
["status", "statusText", "headers"].forEach((we) => {
|
|
1908
|
+
B[we] = D[we];
|
|
1909
1909
|
});
|
|
1910
|
-
const
|
|
1911
|
-
|
|
1910
|
+
const J = j.toFiniteNumber(D.headers.get("content-length")), [Q, ce] = S && Qa(
|
|
1911
|
+
J,
|
|
1912
1912
|
_o(el(S), !0)
|
|
1913
1913
|
) || [];
|
|
1914
1914
|
D = new r(
|
|
1915
1915
|
nl(D.body, rl, Q, () => {
|
|
1916
1916
|
ce && ce(), P && P();
|
|
1917
1917
|
}),
|
|
1918
|
-
|
|
1918
|
+
B
|
|
1919
1919
|
);
|
|
1920
1920
|
}
|
|
1921
1921
|
E = E || "text";
|
|
1922
1922
|
let M = await f[j.findKey(f, E) || "text"](D, w);
|
|
1923
|
-
return !I && P && P(), await new Promise((
|
|
1924
|
-
Uc(
|
|
1923
|
+
return !I && P && P(), await new Promise((B, J) => {
|
|
1924
|
+
Uc(B, J, {
|
|
1925
1925
|
data: M,
|
|
1926
1926
|
headers: Ct.from(D.headers),
|
|
1927
1927
|
status: D.status,
|
|
@@ -2675,27 +2675,27 @@ function qg({
|
|
|
2675
2675
|
tt(() => {
|
|
2676
2676
|
E.current = u;
|
|
2677
2677
|
}, [u]);
|
|
2678
|
-
const k = ar(tu), N =
|
|
2679
|
-
(M,
|
|
2678
|
+
const k = ar(tu), N = Pe(
|
|
2679
|
+
(M, B) => new Promise((J, Q) => {
|
|
2680
2680
|
const ce = async () => {
|
|
2681
2681
|
y.current = !0;
|
|
2682
2682
|
try {
|
|
2683
|
-
console.log(`[ThreadProvider] Executing operation: ${
|
|
2684
|
-
} catch (
|
|
2685
|
-
console.error(`[ThreadProvider] Operation "${
|
|
2683
|
+
console.log(`[ThreadProvider] Executing operation: ${B || "unnamed"}`), await M(), J();
|
|
2684
|
+
} catch (we) {
|
|
2685
|
+
console.error(`[ThreadProvider] Operation "${B}" failed:`, we), Q(we);
|
|
2686
2686
|
} finally {
|
|
2687
2687
|
y.current = !1;
|
|
2688
|
-
const
|
|
2689
|
-
|
|
2688
|
+
const we = R.current.shift();
|
|
2689
|
+
we && we().catch(() => {
|
|
2690
2690
|
});
|
|
2691
2691
|
}
|
|
2692
2692
|
};
|
|
2693
|
-
y.current ? (R.current.push(ce), console.log(`[ThreadProvider] Queued operation: ${
|
|
2694
|
-
Q(
|
|
2693
|
+
y.current ? (R.current.push(ce), console.log(`[ThreadProvider] Queued operation: ${B || "unnamed"}`)) : ce().catch((we) => {
|
|
2694
|
+
Q(we);
|
|
2695
2695
|
});
|
|
2696
2696
|
}),
|
|
2697
2697
|
[]
|
|
2698
|
-
), A =
|
|
2698
|
+
), A = Pe(async () => {
|
|
2699
2699
|
h(!0);
|
|
2700
2700
|
try {
|
|
2701
2701
|
const M = await i.listThreads();
|
|
@@ -2705,32 +2705,32 @@ function qg({
|
|
|
2705
2705
|
} finally {
|
|
2706
2706
|
h(!1);
|
|
2707
2707
|
}
|
|
2708
|
-
}, [i, s]), _ =
|
|
2708
|
+
}, [i, s]), _ = Pe(
|
|
2709
2709
|
async (M) => {
|
|
2710
|
-
const
|
|
2711
|
-
return await A(), d(
|
|
2710
|
+
const B = await i.createThread(M), J = typeof B == "string" ? B : B.threadId;
|
|
2711
|
+
return await A(), d(J), J;
|
|
2712
2712
|
},
|
|
2713
2713
|
[i, A]
|
|
2714
|
-
), L =
|
|
2714
|
+
), L = Pe(
|
|
2715
2715
|
async (M) => {
|
|
2716
2716
|
await i.deleteThread(M), u === M && (d(null), k == null || k.onThreadCleared()), await A();
|
|
2717
2717
|
},
|
|
2718
2718
|
[i, u, A, k]
|
|
2719
|
-
), $ =
|
|
2720
|
-
async (M,
|
|
2719
|
+
), $ = Pe(
|
|
2720
|
+
async (M, B) => {
|
|
2721
2721
|
try {
|
|
2722
|
-
await i.updateThread(M,
|
|
2723
|
-
(
|
|
2724
|
-
(Q) => Q.threadId === M ? { ...Q, title:
|
|
2722
|
+
await i.updateThread(M, B), c(
|
|
2723
|
+
(J) => J.map(
|
|
2724
|
+
(Q) => Q.threadId === M ? { ...Q, title: B } : Q
|
|
2725
2725
|
)
|
|
2726
2726
|
);
|
|
2727
|
-
} catch (
|
|
2728
|
-
throw await A(),
|
|
2727
|
+
} catch (J) {
|
|
2728
|
+
throw await A(), J;
|
|
2729
2729
|
}
|
|
2730
2730
|
},
|
|
2731
2731
|
[i, A]
|
|
2732
|
-
), P =
|
|
2733
|
-
async (M,
|
|
2732
|
+
), P = Pe(
|
|
2733
|
+
async (M, B, J, Q = !1) => {
|
|
2734
2734
|
await N(async () => {
|
|
2735
2735
|
if (C.current === M && !Q) {
|
|
2736
2736
|
console.log("[ThreadProvider] Skipping load for thread:", M), C.current = null;
|
|
@@ -2744,8 +2744,8 @@ function qg({
|
|
|
2744
2744
|
try {
|
|
2745
2745
|
const ce = await i.getMessages({
|
|
2746
2746
|
threadId: M,
|
|
2747
|
-
checkpointId:
|
|
2748
|
-
checkpointNs:
|
|
2747
|
+
checkpointId: B,
|
|
2748
|
+
checkpointNs: J
|
|
2749
2749
|
});
|
|
2750
2750
|
k == null || k.onThreadLoaded(M, ce), g((ce == null ? void 0 : ce.checkpointId) ?? void 0), b((ce == null ? void 0 : ce.checkpointNs) ?? void 0);
|
|
2751
2751
|
} finally {
|
|
@@ -2754,7 +2754,7 @@ function qg({
|
|
|
2754
2754
|
}, `loadThread-${M}`);
|
|
2755
2755
|
},
|
|
2756
2756
|
[i, N, k, d]
|
|
2757
|
-
), W =
|
|
2757
|
+
), W = Pe(async () => {
|
|
2758
2758
|
console.log("[ThreadProvider] 🔄 clearCurrentThread called"), await N(async () => {
|
|
2759
2759
|
u && (C.current = u), k == null || k.onThreadCleared(), d(null), g(void 0), b(void 0);
|
|
2760
2760
|
try {
|
|
@@ -2763,19 +2763,19 @@ function qg({
|
|
|
2763
2763
|
console.warn("[ThreadProvider] Failed to clear localStorage:", M);
|
|
2764
2764
|
}
|
|
2765
2765
|
}, "clearCurrentThread");
|
|
2766
|
-
}, [u, N, k]), z =
|
|
2766
|
+
}, [u, N, k]), z = Pe(
|
|
2767
2767
|
async (M) => {
|
|
2768
|
-
const
|
|
2769
|
-
return Wg(
|
|
2768
|
+
const B = await i.listCheckpoints(M);
|
|
2769
|
+
return Wg(B, M);
|
|
2770
2770
|
},
|
|
2771
2771
|
[i]
|
|
2772
|
-
), q =
|
|
2773
|
-
async (M,
|
|
2772
|
+
), q = Pe(
|
|
2773
|
+
async (M, B) => {
|
|
2774
2774
|
if (!u) throw new Error("No active thread");
|
|
2775
|
-
await P(u, M,
|
|
2775
|
+
await P(u, M, B ?? void 0, !0);
|
|
2776
2776
|
},
|
|
2777
2777
|
[u, P]
|
|
2778
|
-
), D =
|
|
2778
|
+
), D = Pe(async () => {
|
|
2779
2779
|
if (!u) throw new Error("No active thread");
|
|
2780
2780
|
await P(u, void 0, void 0, !0);
|
|
2781
2781
|
}, [u, P]);
|
|
@@ -2793,14 +2793,14 @@ function qg({
|
|
|
2793
2793
|
if (await A(), !M) return;
|
|
2794
2794
|
if (!r && !t)
|
|
2795
2795
|
try {
|
|
2796
|
-
const
|
|
2797
|
-
|
|
2798
|
-
} catch (
|
|
2799
|
-
console.warn("[ThreadProvider] Failed to restore from localStorage:",
|
|
2796
|
+
const J = localStorage.getItem("lastThreadId");
|
|
2797
|
+
J && (d(J), n && await P(J));
|
|
2798
|
+
} catch (J) {
|
|
2799
|
+
console.warn("[ThreadProvider] Failed to restore from localStorage:", J);
|
|
2800
2800
|
}
|
|
2801
2801
|
else t && n && await P(t);
|
|
2802
|
-
} catch (
|
|
2803
|
-
console.error("[ThreadProvider] Initialization failed:",
|
|
2802
|
+
} catch (J) {
|
|
2803
|
+
console.error("[ThreadProvider] Initialization failed:", J), s == null || s(String(J));
|
|
2804
2804
|
}
|
|
2805
2805
|
})(), () => {
|
|
2806
2806
|
M = !1;
|
|
@@ -2911,13 +2911,13 @@ function Jg(e, t) {
|
|
|
2911
2911
|
}
|
|
2912
2912
|
}
|
|
2913
2913
|
function Zg(e = []) {
|
|
2914
|
-
const [t, n] = Cc(Jg, { ...Xg, messages: e }), r = Xe([]), o = Xe(null), s = Xe(null), i =
|
|
2914
|
+
const [t, n] = Cc(Jg, { ...Xg, messages: e }), r = Xe([]), o = Xe(null), s = Xe(null), i = Pe(() => {
|
|
2915
2915
|
o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), o.current = null, s.current = null;
|
|
2916
2916
|
const d = r.current;
|
|
2917
2917
|
d.length && (r.current = [], n({ type: "batch", payload: { events: d } }));
|
|
2918
|
-
}, []), a =
|
|
2918
|
+
}, []), a = Pe(() => {
|
|
2919
2919
|
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => i())) : s.current === null && (s.current = setTimeout(i, 8));
|
|
2920
|
-
}, [i]), c =
|
|
2920
|
+
}, [i]), c = Pe((d) => {
|
|
2921
2921
|
r.current.push(d), a();
|
|
2922
2922
|
}, [a]);
|
|
2923
2923
|
tt(() => () => {
|
|
@@ -3144,7 +3144,7 @@ function lx({
|
|
|
3144
3144
|
onUnhandledEvent: n,
|
|
3145
3145
|
onSequenceGap: r
|
|
3146
3146
|
}) {
|
|
3147
|
-
const o = Xe(null), s =
|
|
3147
|
+
const o = Xe(null), s = Pe(
|
|
3148
3148
|
(a) => {
|
|
3149
3149
|
const c = a.seq;
|
|
3150
3150
|
if (c != null) {
|
|
@@ -3172,7 +3172,7 @@ function lx({
|
|
|
3172
3172
|
n == null || n(a);
|
|
3173
3173
|
},
|
|
3174
3174
|
[t, r, e, n]
|
|
3175
|
-
), i =
|
|
3175
|
+
), i = Pe(() => {
|
|
3176
3176
|
o.current = null;
|
|
3177
3177
|
}, []);
|
|
3178
3178
|
return { handleEvent: s, reset: i };
|
|
@@ -3181,46 +3181,46 @@ function cx(e = {}) {
|
|
|
3181
3181
|
const t = vt(() => {
|
|
3182
3182
|
const A = (e.baseUrl ?? "/api/chat").replace(/\/+$/, "");
|
|
3183
3183
|
return A.endsWith("/chat") ? A : `${A}/chat`;
|
|
3184
|
-
}, [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = fe(e.token ?? null), s = Xe(e.headers ?? {}), [i, a] = fe(!1), [c, u] = fe(null), [d, f] = fe(""), [h, m] = fe(null), [w, v] = fe(0), [g, x] = fe(!1), b = Xe(null), y = Xe(!0), R = Xe(0), S =
|
|
3184
|
+
}, [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = fe(e.token ?? null), s = Xe(e.headers ?? {}), [i, a] = fe(!1), [c, u] = fe(null), [d, f] = fe(""), [h, m] = fe(null), [w, v] = fe(0), [g, x] = fe(!1), b = Xe(null), y = Xe(!0), R = Xe(0), S = Pe((N) => {
|
|
3185
3185
|
o(N);
|
|
3186
|
-
}, []), C =
|
|
3186
|
+
}, []), C = Pe(() => {
|
|
3187
3187
|
var N;
|
|
3188
3188
|
(N = b.current) == null || N.abort(), b.current = null, a(!1), x(!1);
|
|
3189
|
-
}, []), E =
|
|
3189
|
+
}, []), E = Pe(() => {
|
|
3190
3190
|
f(""), m(null), u(null);
|
|
3191
|
-
}, []), k =
|
|
3191
|
+
}, []), k = Pe(
|
|
3192
3192
|
(N, A, _) => {
|
|
3193
3193
|
b.current && (b.current.abort(), b.current = null), a(!0), u(null), e.autoAppendAssistant !== !1 && f("");
|
|
3194
3194
|
const L = new AbortController();
|
|
3195
3195
|
return b.current = L, (async () => {
|
|
3196
|
-
var P, W, z, q, D, I, M,
|
|
3197
|
-
const $ = (
|
|
3196
|
+
var P, W, z, q, D, I, M, B;
|
|
3197
|
+
const $ = (J) => {
|
|
3198
3198
|
var Q;
|
|
3199
3199
|
try {
|
|
3200
|
-
const ce = JSON.parse(JSON.stringify(
|
|
3201
|
-
return (Q = ce == null ? void 0 : ce.payload) != null && Q.files_info && Array.isArray(ce.payload.files_info) && (ce.payload.files_info = ce.payload.files_info.map((
|
|
3202
|
-
...
|
|
3203
|
-
data:
|
|
3200
|
+
const ce = JSON.parse(JSON.stringify(J));
|
|
3201
|
+
return (Q = ce == null ? void 0 : ce.payload) != null && Q.files_info && Array.isArray(ce.payload.files_info) && (ce.payload.files_info = ce.payload.files_info.map((we) => ({
|
|
3202
|
+
...we,
|
|
3203
|
+
data: we != null && we.data ? `<base64 ${String(we.data).length} chars>` : we == null ? void 0 : we.data
|
|
3204
3204
|
}))), ce;
|
|
3205
3205
|
} catch {
|
|
3206
|
-
return
|
|
3206
|
+
return J;
|
|
3207
3207
|
}
|
|
3208
3208
|
};
|
|
3209
3209
|
try {
|
|
3210
|
-
let
|
|
3210
|
+
let J = {};
|
|
3211
3211
|
try {
|
|
3212
3212
|
if (r)
|
|
3213
|
-
|
|
3213
|
+
J = { Authorization: `Bearer ${r}` };
|
|
3214
3214
|
else if (typeof window < "u") {
|
|
3215
|
-
const
|
|
3216
|
-
let
|
|
3215
|
+
const X = window.__AUTH_TOKEN__, xe = ((P = window.localStorage) == null ? void 0 : P.getItem("authToken")) || null;
|
|
3216
|
+
let je = null;
|
|
3217
3217
|
try {
|
|
3218
3218
|
const nt = (W = window.localStorage) == null ? void 0 : W.getItem("chat-settings");
|
|
3219
|
-
nt && (
|
|
3219
|
+
nt && (je = ((z = JSON.parse(nt)) == null ? void 0 : z.apiKey) || null);
|
|
3220
3220
|
} catch {
|
|
3221
3221
|
}
|
|
3222
|
-
const Ie =
|
|
3223
|
-
Ie && (
|
|
3222
|
+
const Ie = X || xe || je || null;
|
|
3223
|
+
Ie && (J = { Authorization: `Bearer ${Ie}` });
|
|
3224
3224
|
}
|
|
3225
3225
|
} catch {
|
|
3226
3226
|
}
|
|
@@ -3234,7 +3234,7 @@ function cx(e = {}) {
|
|
|
3234
3234
|
headers: {
|
|
3235
3235
|
"Content-Type": "application/json",
|
|
3236
3236
|
Accept: "text/event-stream",
|
|
3237
|
-
...
|
|
3237
|
+
...J,
|
|
3238
3238
|
...s.current
|
|
3239
3239
|
},
|
|
3240
3240
|
body: JSON.stringify(N),
|
|
@@ -3251,12 +3251,12 @@ function cx(e = {}) {
|
|
|
3251
3251
|
);
|
|
3252
3252
|
}
|
|
3253
3253
|
x(!0);
|
|
3254
|
-
const ce = Q.body.getReader(),
|
|
3254
|
+
const ce = Q.body.getReader(), we = new TextDecoder();
|
|
3255
3255
|
let Ee = "", K = [], O = R.current, Y = null;
|
|
3256
3256
|
const ee = () => {
|
|
3257
3257
|
if (K.length) {
|
|
3258
3258
|
const V = K.join("");
|
|
3259
|
-
K = [], y.current && f((
|
|
3259
|
+
K = [], y.current && f((X) => X + V);
|
|
3260
3260
|
}
|
|
3261
3261
|
Y = null;
|
|
3262
3262
|
}, ue = () => {
|
|
@@ -3266,16 +3266,16 @@ function cx(e = {}) {
|
|
|
3266
3266
|
const Fe = setInterval(() => {
|
|
3267
3267
|
var V;
|
|
3268
3268
|
if (Date.now() - le > 2e4) {
|
|
3269
|
-
const
|
|
3270
|
-
u(
|
|
3269
|
+
const X = "Stream idle timeout";
|
|
3270
|
+
u(X), L.abort(), (V = _ == null ? void 0 : _.onError) == null || V.call(_, X);
|
|
3271
3271
|
}
|
|
3272
3272
|
}, 5e3), Ye = 1024 * 1024;
|
|
3273
3273
|
try {
|
|
3274
|
-
const V = Q.headers.get("X-Thread-Id") || Q.headers.get("x-thread-id"),
|
|
3275
|
-
for ((q = _ == null ? void 0 : _.onOpen) == null || q.call(_, { threadId:
|
|
3274
|
+
const V = Q.headers.get("X-Thread-Id") || Q.headers.get("x-thread-id"), X = Q.headers.get("X-Thread-Created") || Q.headers.get("x-thread-created"), xe = V ?? null, je = String(X ?? "").toLowerCase() === "true";
|
|
3275
|
+
for ((q = _ == null ? void 0 : _.onOpen) == null || q.call(_, { threadId: xe, created: je }); ; ) {
|
|
3276
3276
|
const { value: Ie, done: nt } = await ce.read();
|
|
3277
3277
|
if (nt) break;
|
|
3278
|
-
Ee +=
|
|
3278
|
+
Ee += we.decode(Ie, { stream: !0 }), Ee.length > Ye && (Ee = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3279
3279
|
let it;
|
|
3280
3280
|
for (; (it = Ee.indexOf(`
|
|
3281
3281
|
|
|
@@ -3313,8 +3313,8 @@ function cx(e = {}) {
|
|
|
3313
3313
|
ee();
|
|
3314
3314
|
} catch (V) {
|
|
3315
3315
|
if (V.name !== "AbortError") {
|
|
3316
|
-
const
|
|
3317
|
-
u(
|
|
3316
|
+
const X = V.message || String(V);
|
|
3317
|
+
u(X), (I = _ == null ? void 0 : _.onError) == null || I.call(_, X);
|
|
3318
3318
|
}
|
|
3319
3319
|
} finally {
|
|
3320
3320
|
try {
|
|
@@ -3325,10 +3325,10 @@ function cx(e = {}) {
|
|
|
3325
3325
|
}
|
|
3326
3326
|
Y !== null && typeof window < "u" && window.cancelAnimationFrame(Y), clearInterval(Fe), a(!1), x(!1), b.current = null;
|
|
3327
3327
|
}
|
|
3328
|
-
} catch (
|
|
3329
|
-
if (
|
|
3330
|
-
const Q =
|
|
3331
|
-
u(Q), (
|
|
3328
|
+
} catch (J) {
|
|
3329
|
+
if (J.name !== "AbortError") {
|
|
3330
|
+
const Q = J.message || String(J);
|
|
3331
|
+
u(Q), (B = _ == null ? void 0 : _.onError) == null || B.call(_, Q);
|
|
3332
3332
|
}
|
|
3333
3333
|
} finally {
|
|
3334
3334
|
a(!1), x(!1), b.current = null;
|
|
@@ -3373,23 +3373,30 @@ function fx({
|
|
|
3373
3373
|
fileAgentId: n = "invoice_reader",
|
|
3374
3374
|
onRegisterThreadCallbacks: r
|
|
3375
3375
|
}) {
|
|
3376
|
-
const { api: o, baseUrl: s } = Gi(), i =
|
|
3376
|
+
const { api: o, baseUrl: s } = Gi(), i = H.useMemo(() => {
|
|
3377
3377
|
const V = (s ?? "").replace(/\/+$/, "");
|
|
3378
3378
|
return V ? V.endsWith("/chat") ? V : `${V}/chat` : "/api/chat";
|
|
3379
3379
|
}, [s]), { currentThreadId: a, setCurrentThreadId: c, isLoadingThread: u } = rs(), d = Ug(), { state: f, dispatch: h, seed: m, prepend: w, pushUser: v, onEvent: g, reset: x } = Zg(), [b, y] = fe(!1), [R, S] = fe(!1), [C, E] = fe(null), [k, N] = fe(void 0), [A, _] = fe(void 0), L = 20, $ = Xe(a);
|
|
3380
3380
|
tt(() => {
|
|
3381
3381
|
$.current = a;
|
|
3382
3382
|
}, [a]);
|
|
3383
|
-
const P = Xe(null), W = Xe(!1), z =
|
|
3383
|
+
const P = Xe(null), W = Xe(!1), z = Pe(() => {
|
|
3384
3384
|
W.current = !0;
|
|
3385
|
-
}, []), { isStreaming: q, error: D, stream: I, stop: M, setToken:
|
|
3385
|
+
}, []), { isStreaming: q, error: D, stream: I, stop: M, setToken: B } = cx({
|
|
3386
3386
|
baseUrl: i,
|
|
3387
3387
|
token: null
|
|
3388
3388
|
});
|
|
3389
3389
|
tt(() => {
|
|
3390
|
+
var xe;
|
|
3390
3391
|
const V = o.getAuthToken();
|
|
3391
|
-
|
|
3392
|
-
|
|
3392
|
+
B(V);
|
|
3393
|
+
const X = (xe = o.onTokenChange) == null ? void 0 : xe.call(o, (je) => {
|
|
3394
|
+
B(je);
|
|
3395
|
+
});
|
|
3396
|
+
return () => {
|
|
3397
|
+
X == null || X();
|
|
3398
|
+
};
|
|
3399
|
+
}, [o, B]), tt(() => {
|
|
3393
3400
|
d(q ? { type: "STREAM_START", assistantId: f.assemblingId ?? void 0 } : { type: "STREAM_END" });
|
|
3394
3401
|
}, [q, f.assemblingId, d]), tt(() => {
|
|
3395
3402
|
d(D ? { type: "STREAM_ERROR", error: D } : { type: "CLEAR_ERROR" });
|
|
@@ -3405,57 +3412,57 @@ function fx({
|
|
|
3405
3412
|
assistantId: f.assemblingId
|
|
3406
3413
|
});
|
|
3407
3414
|
}, [f.assemblingId, d]);
|
|
3408
|
-
const
|
|
3409
|
-
(V,
|
|
3410
|
-
const
|
|
3411
|
-
|
|
3415
|
+
const J = Pe(
|
|
3416
|
+
(V, X) => {
|
|
3417
|
+
const xe = Array.isArray(V == null ? void 0 : V.messages) ? V.messages : [];
|
|
3418
|
+
X === "replace" ? (console.log("[MessagesProvider] Replacing messages, count:", xe.length), m(xe, {
|
|
3412
3419
|
checkpointId: (V == null ? void 0 : V.checkpointId) ?? null,
|
|
3413
3420
|
checkpointNs: (V == null ? void 0 : V.checkpointNs) ?? null
|
|
3414
|
-
})) :
|
|
3421
|
+
})) : X === "prepend" && xe.length && (console.log("[MessagesProvider] Prepending messages, count:", xe.length), w(xe)), E((V == null ? void 0 : V.nextCursor) ?? null), y(!!(V != null && V.hasMore)), N((je) => (V == null ? void 0 : V.checkpointId) ?? je ?? void 0), _((je) => (V == null ? void 0 : V.checkpointNs) ?? je ?? void 0);
|
|
3415
3422
|
},
|
|
3416
3423
|
[m, w]
|
|
3417
|
-
), Q =
|
|
3424
|
+
), Q = Pe(
|
|
3418
3425
|
(V) => {
|
|
3419
|
-
const
|
|
3420
|
-
if (a !==
|
|
3426
|
+
const X = V.threadId, xe = !!V.created, je = !!V.ready;
|
|
3427
|
+
if (a !== X) {
|
|
3421
3428
|
const Ie = !a && f.messages.length <= 1;
|
|
3422
|
-
Ie && (P.current =
|
|
3429
|
+
Ie && (P.current = X), c(X), (je || xe || Ie) && z();
|
|
3423
3430
|
return;
|
|
3424
3431
|
}
|
|
3425
|
-
(
|
|
3432
|
+
(je || xe) && z();
|
|
3426
3433
|
},
|
|
3427
3434
|
[a, f.messages.length, c, z]
|
|
3428
|
-
), ce =
|
|
3429
|
-
({ from: V, to:
|
|
3430
|
-
const
|
|
3431
|
-
|
|
3432
|
-
`[MessagesProvider] Stream sequence gap detected (${V} -> ${
|
|
3435
|
+
), ce = Pe(
|
|
3436
|
+
({ from: V, to: X }) => {
|
|
3437
|
+
const xe = $.current;
|
|
3438
|
+
xe && console.warn(
|
|
3439
|
+
`[MessagesProvider] Stream sequence gap detected (${V} -> ${X}) for thread ${xe}`
|
|
3433
3440
|
);
|
|
3434
3441
|
},
|
|
3435
3442
|
[]
|
|
3436
|
-
), { handleEvent:
|
|
3443
|
+
), { handleEvent: we, reset: Ee } = lx({
|
|
3437
3444
|
onThreadInfo: Q,
|
|
3438
3445
|
onMessageEvent: g,
|
|
3439
3446
|
onUnhandledEvent: (V) => {
|
|
3440
3447
|
console.warn(`[MessagesProvider] Unhandled stream event type: ${V.type}`, V);
|
|
3441
3448
|
},
|
|
3442
3449
|
onSequenceGap: ce
|
|
3443
|
-
}), K =
|
|
3450
|
+
}), K = Pe(
|
|
3444
3451
|
async (V) => {
|
|
3445
3452
|
if (!a) throw new Error("No active thread");
|
|
3446
3453
|
if (R || !b) return;
|
|
3447
|
-
const
|
|
3448
|
-
if (
|
|
3454
|
+
const X = C;
|
|
3455
|
+
if (X) {
|
|
3449
3456
|
S(!0);
|
|
3450
3457
|
try {
|
|
3451
|
-
const
|
|
3458
|
+
const xe = await o.getMessages({
|
|
3452
3459
|
threadId: a,
|
|
3453
3460
|
checkpointId: k,
|
|
3454
3461
|
checkpointNs: A,
|
|
3455
3462
|
limit: (V == null ? void 0 : V.limit) ?? L,
|
|
3456
|
-
beforeId:
|
|
3463
|
+
beforeId: X
|
|
3457
3464
|
});
|
|
3458
|
-
|
|
3465
|
+
J(xe, "prepend");
|
|
3459
3466
|
} finally {
|
|
3460
3467
|
S(!1);
|
|
3461
3468
|
}
|
|
@@ -3469,17 +3476,17 @@ function fx({
|
|
|
3469
3476
|
C,
|
|
3470
3477
|
b,
|
|
3471
3478
|
R,
|
|
3472
|
-
|
|
3479
|
+
J,
|
|
3473
3480
|
L
|
|
3474
3481
|
]
|
|
3475
|
-
), O =
|
|
3482
|
+
), O = Pe(() => {
|
|
3476
3483
|
console.log("[MessagesProvider] Clearing messages"), x([]), y(!1), S(!1), E(null), N(void 0), _(void 0);
|
|
3477
|
-
}, [x]), Y =
|
|
3478
|
-
(V,
|
|
3479
|
-
console.log("[MessagesProvider] Handling thread load for", V), W.current = !1, X
|
|
3484
|
+
}, [x]), Y = Pe(
|
|
3485
|
+
(V, X) => {
|
|
3486
|
+
console.log("[MessagesProvider] Handling thread load for", V), W.current = !1, J(X, "replace");
|
|
3480
3487
|
},
|
|
3481
|
-
[
|
|
3482
|
-
), ee =
|
|
3488
|
+
[J]
|
|
3489
|
+
), ee = Pe(() => {
|
|
3483
3490
|
console.log("[MessagesProvider] Handling thread clear"), W.current = !1, O();
|
|
3484
3491
|
}, [O]), ue = vt(
|
|
3485
3492
|
() => ({
|
|
@@ -3499,25 +3506,25 @@ function fx({
|
|
|
3499
3506
|
});
|
|
3500
3507
|
};
|
|
3501
3508
|
}, [r, ue]);
|
|
3502
|
-
const le =
|
|
3503
|
-
async (V,
|
|
3509
|
+
const le = Pe(
|
|
3510
|
+
async (V, X) => {
|
|
3504
3511
|
var Te;
|
|
3505
|
-
!a && !(
|
|
3506
|
-
const
|
|
3512
|
+
!a && !(X != null && X.payloadExtras) && console.warn("[MessagesProvider] No thread ID - message will create new thread");
|
|
3513
|
+
const xe = (X == null ? void 0 : X.attachments) || [], { contentParts: je, filesInfo: Ie } = await Kg(
|
|
3507
3514
|
o,
|
|
3508
|
-
|
|
3509
|
-
), nt = [...
|
|
3515
|
+
xe
|
|
3516
|
+
), nt = [...je];
|
|
3510
3517
|
V && V.trim() && nt.push({ type: "text", text: V.trim() });
|
|
3511
3518
|
const it = {
|
|
3512
3519
|
id: ((Te = crypto.randomUUID) == null ? void 0 : Te.call(crypto)) || `user-${Date.now()}`,
|
|
3513
3520
|
role: "user",
|
|
3514
3521
|
content: nt,
|
|
3515
3522
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3516
|
-
checkpointId: (
|
|
3517
|
-
checkpointNs: (
|
|
3523
|
+
checkpointId: (X == null ? void 0 : X.checkpointId) ?? f.lastCheckpointId ?? void 0,
|
|
3524
|
+
checkpointNs: (X == null ? void 0 : X.checkpointNs) ?? f.lastCheckpointNs ?? void 0
|
|
3518
3525
|
};
|
|
3519
3526
|
v(it);
|
|
3520
|
-
const oe = { ...it, content: nt }, se = { ...(
|
|
3527
|
+
const oe = { ...it, content: nt }, se = { ...(X == null ? void 0 : X.payloadExtras) ?? {} }, he = xe && xe.length > 0, pe = {
|
|
3521
3528
|
...a ? { threadId: a } : {},
|
|
3522
3529
|
payload: {
|
|
3523
3530
|
messages: [oe],
|
|
@@ -3525,15 +3532,15 @@ function fx({
|
|
|
3525
3532
|
...t && he && n ? { active_agent: n } : {},
|
|
3526
3533
|
...se
|
|
3527
3534
|
},
|
|
3528
|
-
checkpointId: (
|
|
3529
|
-
checkpointNs: (
|
|
3530
|
-
nodeFilter:
|
|
3531
|
-
config:
|
|
3535
|
+
checkpointId: (X == null ? void 0 : X.checkpointId) ?? f.lastCheckpointId ?? void 0,
|
|
3536
|
+
checkpointNs: (X == null ? void 0 : X.checkpointNs) ?? f.lastCheckpointNs ?? void 0,
|
|
3537
|
+
nodeFilter: X == null ? void 0 : X.nodeFilter,
|
|
3538
|
+
config: X == null ? void 0 : X.config
|
|
3532
3539
|
};
|
|
3533
3540
|
Ee(), z(), I(
|
|
3534
3541
|
pe,
|
|
3535
3542
|
(Ne) => {
|
|
3536
|
-
|
|
3543
|
+
we(Ne);
|
|
3537
3544
|
},
|
|
3538
3545
|
{
|
|
3539
3546
|
onError: (Ne) => console.warn("[MessagesProvider] Stream error:", Ne),
|
|
@@ -3551,7 +3558,7 @@ function fx({
|
|
|
3551
3558
|
a,
|
|
3552
3559
|
v,
|
|
3553
3560
|
I,
|
|
3554
|
-
|
|
3561
|
+
we,
|
|
3555
3562
|
Ee,
|
|
3556
3563
|
ce,
|
|
3557
3564
|
f.lastCheckpointId,
|
|
@@ -3563,16 +3570,16 @@ function fx({
|
|
|
3563
3570
|
t,
|
|
3564
3571
|
n
|
|
3565
3572
|
]
|
|
3566
|
-
), Fe =
|
|
3567
|
-
async (V,
|
|
3568
|
-
const
|
|
3569
|
-
if (!
|
|
3573
|
+
), Fe = Pe(
|
|
3574
|
+
async (V, X, xe) => {
|
|
3575
|
+
const je = $.current;
|
|
3576
|
+
if (!je)
|
|
3570
3577
|
throw new Error("No active thread to handle interrupt");
|
|
3571
3578
|
try {
|
|
3572
|
-
console.log(`[MessagesProvider] Handling interrupt ${V}: ${
|
|
3573
|
-
const Ie =
|
|
3579
|
+
console.log(`[MessagesProvider] Handling interrupt ${V}: ${X ? "approved" : "rejected"}`);
|
|
3580
|
+
const Ie = X ? xe ?? !0 : !1;
|
|
3574
3581
|
await o.resume({
|
|
3575
|
-
threadId:
|
|
3582
|
+
threadId: je,
|
|
3576
3583
|
value: Ie
|
|
3577
3584
|
}), console.log(`[MessagesProvider] Interrupt ${V} handled successfully`);
|
|
3578
3585
|
} catch (Ie) {
|
|
@@ -3619,14 +3626,14 @@ function Vs({
|
|
|
3619
3626
|
},
|
|
3620
3627
|
onThreadCleared: () => {
|
|
3621
3628
|
}
|
|
3622
|
-
}), d =
|
|
3629
|
+
}), d = Pe(
|
|
3623
3630
|
(m) => {
|
|
3624
3631
|
u.current = m;
|
|
3625
3632
|
},
|
|
3626
3633
|
[]
|
|
3627
|
-
), f =
|
|
3634
|
+
), f = Pe((m, w) => {
|
|
3628
3635
|
u.current.onThreadLoaded(m, w);
|
|
3629
|
-
}, []), h =
|
|
3636
|
+
}, []), h = Pe(() => {
|
|
3630
3637
|
u.current.onThreadCleared();
|
|
3631
3638
|
}, []);
|
|
3632
3639
|
return /* @__PURE__ */ l.jsx($g, { apiConfig: t, children: /* @__PURE__ */ l.jsx(Bg, { children: /* @__PURE__ */ l.jsx(
|
|
@@ -3720,18 +3727,18 @@ function mx({
|
|
|
3720
3727
|
textareaClassName: d = "",
|
|
3721
3728
|
allowEmptySend: f = !1
|
|
3722
3729
|
}) {
|
|
3723
|
-
const [h, m] =
|
|
3724
|
-
|
|
3730
|
+
const [h, m] = H.useState(e), [w, v] = H.useTransition(), g = H.useRef(null);
|
|
3731
|
+
H.useEffect(() => {
|
|
3725
3732
|
m(e ?? ""), g.current && (g.current.style.height = "auto", g.current.style.height = `${g.current.scrollHeight}px`);
|
|
3726
3733
|
}, [e, t]);
|
|
3727
|
-
const x =
|
|
3734
|
+
const x = H.useCallback(() => {
|
|
3728
3735
|
const k = g.current;
|
|
3729
3736
|
k && (k.style.height = "auto", k.style.height = `${k.scrollHeight}px`);
|
|
3730
3737
|
}, []);
|
|
3731
|
-
|
|
3738
|
+
H.useEffect(() => {
|
|
3732
3739
|
x();
|
|
3733
3740
|
}, [x]);
|
|
3734
|
-
const b =
|
|
3741
|
+
const b = H.useCallback(
|
|
3735
3742
|
async (k) => {
|
|
3736
3743
|
k && k.preventDefault();
|
|
3737
3744
|
const N = (h ?? "").trim();
|
|
@@ -3747,9 +3754,9 @@ function mx({
|
|
|
3747
3754
|
});
|
|
3748
3755
|
},
|
|
3749
3756
|
[h, i, f]
|
|
3750
|
-
), y =
|
|
3757
|
+
), y = H.useCallback((k) => {
|
|
3751
3758
|
m(k.target.value), g.current && (g.current.style.height = "auto", g.current.style.height = `${g.current.scrollHeight}px`);
|
|
3752
|
-
}, []), R =
|
|
3759
|
+
}, []), R = H.useCallback(
|
|
3753
3760
|
(k) => {
|
|
3754
3761
|
k.key === "Enter" && !k.shiftKey ? (k.preventDefault(), b()) : k.key === "Escape" && t && (k.preventDefault(), a == null || a());
|
|
3755
3762
|
},
|
|
@@ -3799,7 +3806,7 @@ function mx({
|
|
|
3799
3806
|
) })
|
|
3800
3807
|
] }) });
|
|
3801
3808
|
}
|
|
3802
|
-
const gx =
|
|
3809
|
+
const gx = H.memo(mx), os = 0, bn = 1, ur = 2, su = 4;
|
|
3803
3810
|
function ml(e) {
|
|
3804
3811
|
return () => e;
|
|
3805
3812
|
}
|
|
@@ -4077,10 +4084,10 @@ function zn(e, t, n) {
|
|
|
4077
4084
|
return Ji(e, t, n).callbackRef;
|
|
4078
4085
|
}
|
|
4079
4086
|
function Ji(e, t, n) {
|
|
4080
|
-
const r =
|
|
4087
|
+
const r = H.useRef(null);
|
|
4081
4088
|
let o = (i) => {
|
|
4082
4089
|
};
|
|
4083
|
-
const s =
|
|
4090
|
+
const s = H.useMemo(() => typeof ResizeObserver < "u" ? new ResizeObserver((i) => {
|
|
4084
4091
|
const a = () => {
|
|
4085
4092
|
const c = i[0].target;
|
|
4086
4093
|
c.offsetParent !== null && e(c);
|
|
@@ -4092,7 +4099,7 @@ function Ji(e, t, n) {
|
|
|
4092
4099
|
}, { callbackRef: o, ref: r };
|
|
4093
4100
|
}
|
|
4094
4101
|
function kx(e, t, n, r, o, s, i, a, c) {
|
|
4095
|
-
const u =
|
|
4102
|
+
const u = H.useCallback(
|
|
4096
4103
|
(d) => {
|
|
4097
4104
|
const f = Ix(d.children, t, a ? "offsetWidth" : "offsetHeight", o);
|
|
4098
4105
|
let h = d.parentElement;
|
|
@@ -4135,7 +4142,7 @@ function vl(e, t, n) {
|
|
|
4135
4142
|
return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t, Tt.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
|
|
4136
4143
|
}
|
|
4137
4144
|
function lu(e, t, n) {
|
|
4138
|
-
const r =
|
|
4145
|
+
const r = H.useRef(null), o = H.useCallback(
|
|
4139
4146
|
(c) => {
|
|
4140
4147
|
if (!(c != null && c.offsetParent))
|
|
4141
4148
|
return;
|
|
@@ -4156,10 +4163,10 @@ function lu(e, t, n) {
|
|
|
4156
4163
|
},
|
|
4157
4164
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4158
4165
|
[e, t]
|
|
4159
|
-
), { callbackRef: s, ref: i } = Ji(o, !0, n), a =
|
|
4166
|
+
), { callbackRef: s, ref: i } = Ji(o, !0, n), a = H.useCallback(() => {
|
|
4160
4167
|
o(i.current);
|
|
4161
4168
|
}, [o, i]);
|
|
4162
|
-
return
|
|
4169
|
+
return H.useEffect(() => {
|
|
4163
4170
|
var c;
|
|
4164
4171
|
if (t) {
|
|
4165
4172
|
t.addEventListener("scroll", a);
|
|
@@ -4850,9 +4857,9 @@ const Kr = Be(
|
|
|
4850
4857
|
P
|
|
4851
4858
|
]) => {
|
|
4852
4859
|
const W = wu(R), { align: z, behavior: q, offset: D } = W, I = E - 1, M = xu(W, S, I);
|
|
4853
|
-
let
|
|
4854
|
-
z === "end" ? (
|
|
4855
|
-
const
|
|
4860
|
+
let B = Mr(M, S.offsetTree, L) + N;
|
|
4861
|
+
z === "end" ? (B += $ + Ut(S.sizeTree, M)[1] - C + P, M === I && (B += A)) : z === "center" ? B += ($ + Ut(S.sizeTree, M)[1] - C + P) / 2 : B -= k, D && (B += D);
|
|
4862
|
+
const J = (Q) => {
|
|
4856
4863
|
y(), Q ? (_("retrying to scroll to", { location: R }, Tt.DEBUG), Ae(m, R)) : (Ae(w, !0), _("list did not change, scroll successful", {}, Tt.DEBUG));
|
|
4857
4864
|
};
|
|
4858
4865
|
if (y(), q === "smooth") {
|
|
@@ -4860,13 +4867,13 @@ const Kr = Be(
|
|
|
4860
4867
|
b = Ue(t, (ce) => {
|
|
4861
4868
|
Q = Q || ce;
|
|
4862
4869
|
}), g = Ht(d, () => {
|
|
4863
|
-
|
|
4870
|
+
J(Q);
|
|
4864
4871
|
});
|
|
4865
4872
|
} else
|
|
4866
|
-
g = Ht(F(t, Ux(150)),
|
|
4873
|
+
g = Ht(F(t, Ux(150)), J);
|
|
4867
4874
|
return x = setTimeout(() => {
|
|
4868
4875
|
y();
|
|
4869
|
-
}, 1200), Ae(c, !0), _("scrolling from index to", { behavior: q, index: M, top:
|
|
4876
|
+
}, 1200), Ae(c, !0), _("scrolling from index to", { behavior: q, index: M, top: B }, Tt.DEBUG), { behavior: q, top: B };
|
|
4870
4877
|
}
|
|
4871
4878
|
)
|
|
4872
4879
|
),
|
|
@@ -5295,21 +5302,21 @@ const Bn = Be(
|
|
|
5295
5302
|
);
|
|
5296
5303
|
const M = [];
|
|
5297
5304
|
if (L.length > 0) {
|
|
5298
|
-
const
|
|
5305
|
+
const we = L[0], Ee = L[L.length - 1];
|
|
5299
5306
|
let K = 0;
|
|
5300
|
-
for (const O of is(D,
|
|
5301
|
-
const Y = O.value, ee = Math.max(O.start,
|
|
5307
|
+
for (const O of is(D, we, Ee)) {
|
|
5308
|
+
const Y = O.value, ee = Math.max(O.start, we), ue = Math.min(O.end, Ee);
|
|
5302
5309
|
for (let le = ee; le <= ue; le++)
|
|
5303
5310
|
M.push({ data: W == null ? void 0 : W[le], index: le, offset: K, size: Y }), K += Y;
|
|
5304
5311
|
}
|
|
5305
5312
|
}
|
|
5306
5313
|
if (!_)
|
|
5307
5314
|
return yo([], M, k, P, z, $);
|
|
5308
|
-
const
|
|
5309
|
-
if (
|
|
5315
|
+
const B = L.length > 0 ? L[L.length - 1] + 1 : 0, J = Mx(q, C, E, B);
|
|
5316
|
+
if (J.length === 0)
|
|
5310
5317
|
return null;
|
|
5311
|
-
const Q = k - 1, ce = ss([], (
|
|
5312
|
-
for (const Ee of
|
|
5318
|
+
const Q = k - 1, ce = ss([], (we) => {
|
|
5319
|
+
for (const Ee of J) {
|
|
5313
5320
|
const K = Ee.value;
|
|
5314
5321
|
let O = K.offset, Y = Ee.start;
|
|
5315
5322
|
const ee = K.size;
|
|
@@ -5318,10 +5325,10 @@ const Bn = Be(
|
|
|
5318
5325
|
const le = Y - Ee.start;
|
|
5319
5326
|
O += le * ee + le * P;
|
|
5320
5327
|
}
|
|
5321
|
-
Y <
|
|
5328
|
+
Y < B && (O += (B - Y) * ee, Y = B);
|
|
5322
5329
|
const ue = Math.min(Ee.end, Q);
|
|
5323
5330
|
for (let le = Y; le <= ue && !(O >= E); le++)
|
|
5324
|
-
|
|
5331
|
+
we.push({ data: W == null ? void 0 : W[le], index: le, offset: O, size: ee }), O += ee + P;
|
|
5325
5332
|
}
|
|
5326
5333
|
});
|
|
5327
5334
|
return yo(ce, M, k, P, z, $);
|
|
@@ -5955,9 +5962,9 @@ function iv(e, t) {
|
|
|
5955
5962
|
Object.hasOwn(r, i) || (n[i] = t[i]);
|
|
5956
5963
|
return n;
|
|
5957
5964
|
}
|
|
5958
|
-
const io = typeof document < "u" ?
|
|
5965
|
+
const io = typeof document < "u" ? H.useLayoutEffect : H.useEffect;
|
|
5959
5966
|
function Iu(e, t, n) {
|
|
5960
|
-
const r = Object.keys(t.required || {}), o = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), a =
|
|
5967
|
+
const r = Object.keys(t.required || {}), o = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), a = H.createContext({});
|
|
5961
5968
|
function c(g, x) {
|
|
5962
5969
|
g.propsReady && Ae(g.propsReady, !1);
|
|
5963
5970
|
for (const b of r) {
|
|
@@ -5980,10 +5987,10 @@ function Iu(e, t, n) {
|
|
|
5980
5987
|
function d(g) {
|
|
5981
5988
|
return i.reduce((x, b) => (x[b] = Sx(g[t.events[b]]), x), {});
|
|
5982
5989
|
}
|
|
5983
|
-
const f =
|
|
5984
|
-
const { children: b, ...y } = g, [R] =
|
|
5990
|
+
const f = H.forwardRef((g, x) => {
|
|
5991
|
+
const { children: b, ...y } = g, [R] = H.useState(() => ss(Tx(e), (E) => {
|
|
5985
5992
|
c(E, y);
|
|
5986
|
-
})), [S] =
|
|
5993
|
+
})), [S] = H.useState(gl(d, R));
|
|
5987
5994
|
io(() => {
|
|
5988
5995
|
for (const E of i)
|
|
5989
5996
|
E in y && Ue(S[E], y[E]);
|
|
@@ -5992,47 +5999,47 @@ function Iu(e, t, n) {
|
|
|
5992
5999
|
};
|
|
5993
6000
|
}, [y, S, R]), io(() => {
|
|
5994
6001
|
c(R, y);
|
|
5995
|
-
}),
|
|
6002
|
+
}), H.useImperativeHandle(x, ml(u(R)));
|
|
5996
6003
|
const C = n;
|
|
5997
6004
|
return /* @__PURE__ */ l.jsx(a.Provider, { value: R, children: n ? /* @__PURE__ */ l.jsx(C, { ...iv([...r, ...o, ...i], y), children: b }) : b });
|
|
5998
6005
|
}), h = (g) => {
|
|
5999
|
-
const x =
|
|
6000
|
-
return
|
|
6006
|
+
const x = H.useContext(a);
|
|
6007
|
+
return H.useCallback(
|
|
6001
6008
|
(b) => {
|
|
6002
6009
|
Ae(x[g], b);
|
|
6003
6010
|
},
|
|
6004
6011
|
[x, g]
|
|
6005
6012
|
);
|
|
6006
6013
|
}, m = (g) => {
|
|
6007
|
-
const x =
|
|
6014
|
+
const x = H.useContext(a)[g], b = H.useCallback(
|
|
6008
6015
|
(y) => Ue(x, y),
|
|
6009
6016
|
[x]
|
|
6010
6017
|
);
|
|
6011
|
-
return
|
|
6018
|
+
return H.useSyncExternalStore(
|
|
6012
6019
|
b,
|
|
6013
6020
|
() => ot(x),
|
|
6014
6021
|
() => ot(x)
|
|
6015
6022
|
);
|
|
6016
6023
|
}, w = (g) => {
|
|
6017
|
-
const x =
|
|
6024
|
+
const x = H.useContext(a)[g], [b, y] = H.useState(gl(ot, x));
|
|
6018
6025
|
return io(
|
|
6019
6026
|
() => Ue(x, (R) => {
|
|
6020
6027
|
R !== b && y(ml(R));
|
|
6021
6028
|
}),
|
|
6022
6029
|
[x, b]
|
|
6023
6030
|
), b;
|
|
6024
|
-
}, v =
|
|
6031
|
+
}, v = H.version.startsWith("18") ? m : w;
|
|
6025
6032
|
return {
|
|
6026
6033
|
Component: f,
|
|
6027
6034
|
useEmitter: (g, x) => {
|
|
6028
|
-
const b =
|
|
6035
|
+
const b = H.useContext(a)[g];
|
|
6029
6036
|
io(() => Ue(b, x), [x, b]);
|
|
6030
6037
|
},
|
|
6031
6038
|
useEmitterValue: v,
|
|
6032
6039
|
usePublisher: h
|
|
6033
6040
|
};
|
|
6034
6041
|
}
|
|
6035
|
-
const Nu =
|
|
6042
|
+
const Nu = H.createContext(void 0), Au = H.createContext(void 0), _u = typeof document < "u" ? H.useLayoutEffect : H.useEffect;
|
|
6036
6043
|
function Gs(e) {
|
|
6037
6044
|
return "self" in e;
|
|
6038
6045
|
}
|
|
@@ -6040,7 +6047,7 @@ function av(e) {
|
|
|
6040
6047
|
return "body" in e;
|
|
6041
6048
|
}
|
|
6042
6049
|
function ju(e, t, n, r = dr, o, s) {
|
|
6043
|
-
const i =
|
|
6050
|
+
const i = H.useRef(null), a = H.useRef(null), c = H.useRef(null), u = H.useCallback(
|
|
6044
6051
|
(h) => {
|
|
6045
6052
|
let m, w, v;
|
|
6046
6053
|
const g = h.target;
|
|
@@ -6060,7 +6067,7 @@ function ju(e, t, n, r = dr, o, s) {
|
|
|
6060
6067
|
},
|
|
6061
6068
|
[e, t, s]
|
|
6062
6069
|
);
|
|
6063
|
-
|
|
6070
|
+
H.useEffect(() => {
|
|
6064
6071
|
const h = o || i.current;
|
|
6065
6072
|
return r(o || i.current), u({ suppressFlushSync: !0, target: h }), h.addEventListener("scroll", u, { passive: !0 }), () => {
|
|
6066
6073
|
r(null), h.removeEventListener("scroll", u);
|
|
@@ -6128,7 +6135,7 @@ const lv = /* @__PURE__ */ Be(() => {
|
|
|
6128
6135
|
}), cv = /* @__PURE__ */ Be(
|
|
6129
6136
|
([e, t]) => ({ ...e, ...t }),
|
|
6130
6137
|
Ze(ku, lv)
|
|
6131
|
-
), uv = ({ height: e }) => /* @__PURE__ */ l.jsx("div", { style: { height: e } }), dv = { overflowAnchor: "none", position: oa(), zIndex: 1 }, Pu = { overflowAnchor: "none" }, fv = { ...Pu, display: "inline-block", height: "100%" }, kl = /* @__PURE__ */
|
|
6138
|
+
), uv = ({ height: e }) => /* @__PURE__ */ l.jsx("div", { style: { height: e } }), dv = { overflowAnchor: "none", position: oa(), zIndex: 1 }, Pu = { overflowAnchor: "none" }, fv = { ...Pu, display: "inline-block", height: "100%" }, kl = /* @__PURE__ */ H.memo(function({ showTopList: e = !1 }) {
|
|
6132
6139
|
const t = Re("listState"), n = Dt("sizeRanges"), r = Re("useWindowScroll"), o = Re("customScrollParent"), s = Dt("windowScrollContainerState"), i = Dt("scrollContainerState"), a = o || r ? s : i, c = Re("itemContent"), u = Re("context"), d = Re("groupContent"), f = Re("trackItemSizes"), h = Re("itemSize"), m = Re("log"), w = Dt("gap"), v = Re("horizontalDirection"), { callbackRef: g } = kx(
|
|
6133
6140
|
n,
|
|
6134
6141
|
h,
|
|
@@ -6139,7 +6146,7 @@ const lv = /* @__PURE__ */ Be(() => {
|
|
|
6139
6146
|
o,
|
|
6140
6147
|
v,
|
|
6141
6148
|
Re("skipAnimationFrameInResizeObserver")
|
|
6142
|
-
), [x, b] =
|
|
6149
|
+
), [x, b] = H.useState(0);
|
|
6143
6150
|
ia("deviation", (P) => {
|
|
6144
6151
|
x !== P && b(P);
|
|
6145
6152
|
});
|
|
@@ -6235,9 +6242,9 @@ function mt(e, t) {
|
|
|
6235
6242
|
function gv(e, t) {
|
|
6236
6243
|
return { item: typeof e == "string" ? void 0 : t };
|
|
6237
6244
|
}
|
|
6238
|
-
const xv = /* @__PURE__ */
|
|
6245
|
+
const xv = /* @__PURE__ */ H.memo(function() {
|
|
6239
6246
|
const e = Re("HeaderComponent"), t = Dt("headerHeight"), n = Re("HeaderFooterTag"), r = zn(
|
|
6240
|
-
|
|
6247
|
+
H.useMemo(
|
|
6241
6248
|
() => (s) => {
|
|
6242
6249
|
t(mn(s, "height"));
|
|
6243
6250
|
},
|
|
@@ -6247,9 +6254,9 @@ const xv = /* @__PURE__ */ B.memo(function() {
|
|
|
6247
6254
|
Re("skipAnimationFrameInResizeObserver")
|
|
6248
6255
|
), o = Re("context");
|
|
6249
6256
|
return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...mt(e, o) }) }) : null;
|
|
6250
|
-
}), vv = /* @__PURE__ */
|
|
6257
|
+
}), vv = /* @__PURE__ */ H.memo(function() {
|
|
6251
6258
|
const e = Re("FooterComponent"), t = Dt("footerHeight"), n = Re("HeaderFooterTag"), r = zn(
|
|
6252
|
-
|
|
6259
|
+
H.useMemo(
|
|
6253
6260
|
() => (s) => {
|
|
6254
6261
|
t(mn(s, "height"));
|
|
6255
6262
|
},
|
|
@@ -6261,7 +6268,7 @@ const xv = /* @__PURE__ */ B.memo(function() {
|
|
|
6261
6268
|
return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...mt(e, o) }) }) : null;
|
|
6262
6269
|
});
|
|
6263
6270
|
function Ou({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
|
|
6264
|
-
return
|
|
6271
|
+
return H.memo(function({ children: r, style: o, context: s, ...i }) {
|
|
6265
6272
|
const a = n("scrollContainerState"), c = t("ScrollerComponent"), u = n("smoothScrollTargetReached"), d = t("scrollerRef"), f = t("horizontalDirection") || !1, { scrollByCallback: h, scrollerRef: m, scrollToCallback: w } = ju(
|
|
6266
6273
|
a,
|
|
6267
6274
|
u,
|
|
@@ -6286,8 +6293,8 @@ function Ou({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
|
|
|
6286
6293
|
});
|
|
6287
6294
|
}
|
|
6288
6295
|
function Mu({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
|
|
6289
|
-
return
|
|
6290
|
-
const a = n("windowScrollContainerState"), c = t("ScrollerComponent"), u = n("smoothScrollTargetReached"), d = t("totalListHeight"), f = t("deviation"), h = t("customScrollParent"), m =
|
|
6296
|
+
return H.memo(function({ children: r, style: o, context: s, ...i }) {
|
|
6297
|
+
const a = n("windowScrollContainerState"), c = t("ScrollerComponent"), u = n("smoothScrollTargetReached"), d = t("totalListHeight"), f = t("deviation"), h = t("customScrollParent"), m = H.useRef(null), w = t("scrollerRef"), { scrollByCallback: v, scrollerRef: g, scrollToCallback: x } = ju(
|
|
6291
6298
|
a,
|
|
6292
6299
|
u,
|
|
6293
6300
|
c,
|
|
@@ -6313,26 +6320,26 @@ function Mu({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
|
|
|
6313
6320
|
});
|
|
6314
6321
|
}
|
|
6315
6322
|
const wv = ({ children: e }) => {
|
|
6316
|
-
const t =
|
|
6323
|
+
const t = H.useContext(Nu), n = Dt("viewportHeight"), r = Dt("fixedItemHeight"), o = Re("alignToBottom"), s = Re("horizontalDirection"), i = H.useMemo(
|
|
6317
6324
|
() => iu(n, (c) => mn(c, s ? "width" : "height")),
|
|
6318
6325
|
[n, s]
|
|
6319
6326
|
), a = zn(i, !0, Re("skipAnimationFrameInResizeObserver"));
|
|
6320
|
-
return
|
|
6327
|
+
return H.useEffect(() => {
|
|
6321
6328
|
t && (n(t.viewportHeight), r(t.itemHeight));
|
|
6322
6329
|
}, [t, n, r]), /* @__PURE__ */ l.jsx("div", { "data-viewport-type": "element", ref: a, style: ls(o), children: e });
|
|
6323
6330
|
}, bv = ({ children: e }) => {
|
|
6324
|
-
const t =
|
|
6331
|
+
const t = H.useContext(Nu), n = Dt("windowViewportRect"), r = Dt("fixedItemHeight"), o = Re("customScrollParent"), s = lu(
|
|
6325
6332
|
n,
|
|
6326
6333
|
o,
|
|
6327
6334
|
Re("skipAnimationFrameInResizeObserver")
|
|
6328
6335
|
), i = Re("alignToBottom");
|
|
6329
|
-
return
|
|
6336
|
+
return H.useEffect(() => {
|
|
6330
6337
|
t && (r(t.itemHeight), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: 100 }));
|
|
6331
6338
|
}, [t, n, r]), /* @__PURE__ */ l.jsx("div", { "data-viewport-type": "window", ref: s, style: ls(i), children: e });
|
|
6332
6339
|
}, yv = ({ children: e }) => {
|
|
6333
6340
|
const t = Re("TopItemListComponent") || "div", n = Re("headerHeight"), r = { ...mv, marginTop: `${n}px` }, o = Re("context");
|
|
6334
6341
|
return /* @__PURE__ */ l.jsx(t, { style: r, ...mt(t, o), children: e });
|
|
6335
|
-
}, Sv = /* @__PURE__ */
|
|
6342
|
+
}, Sv = /* @__PURE__ */ H.memo(function(e) {
|
|
6336
6343
|
const t = Re("useWindowScroll"), n = Re("topItemsIndexes").length > 0, r = Re("customScrollParent"), o = Re("context");
|
|
6337
6344
|
return /* @__PURE__ */ l.jsxs(r || t ? Rv : Tv, { ...e, context: o, children: [
|
|
6338
6345
|
n && /* @__PURE__ */ l.jsx(yv, { children: /* @__PURE__ */ l.jsx(kl, { showTopList: !0 }) }),
|
|
@@ -6486,7 +6493,7 @@ const _v = /* @__PURE__ */ Be(
|
|
|
6486
6493
|
{ customScrollParent: g, useWindowScroll: x, windowScrollContainerState: b, windowScrollTo: y, windowViewportRect: R },
|
|
6487
6494
|
S
|
|
6488
6495
|
]) => {
|
|
6489
|
-
const C = G(0), E = G(0), k = G(Il), N = G({ height: 0, width: 0 }), A = G({ height: 0, width: 0 }), _ = Le(), L = Le(), $ = G(0), P = G(null), W = G({ column: 0, row: 0 }), z = Le(), q = Le(), D = G(!1), I = G(0), M = G(!0),
|
|
6496
|
+
const C = G(0), E = G(0), k = G(Il), N = G({ height: 0, width: 0 }), A = G({ height: 0, width: 0 }), _ = Le(), L = Le(), $ = G(0), P = G(null), W = G({ column: 0, row: 0 }), z = Le(), q = Le(), D = G(!1), I = G(0), M = G(!0), B = G(!1), J = G(!1);
|
|
6490
6497
|
Ue(
|
|
6491
6498
|
F(
|
|
6492
6499
|
w,
|
|
@@ -6498,11 +6505,11 @@ const _v = /* @__PURE__ */ Be(
|
|
|
6498
6505
|
}
|
|
6499
6506
|
), Ue(
|
|
6500
6507
|
F(
|
|
6501
|
-
lt(w, M, A, N, I,
|
|
6508
|
+
lt(w, M, A, N, I, B),
|
|
6502
6509
|
ye(([O, Y, ee, ue, , le]) => O && !Y && ee.height !== 0 && ue.height !== 0 && !le)
|
|
6503
6510
|
),
|
|
6504
6511
|
([, , , , O]) => {
|
|
6505
|
-
Ae(
|
|
6512
|
+
Ae(B, !0), ea(1, () => {
|
|
6506
6513
|
Ae(_, O);
|
|
6507
6514
|
}), Ht(F(u), () => {
|
|
6508
6515
|
Ae(t, [0, 0]), Ae(M, !0);
|
|
@@ -6573,19 +6580,19 @@ const _v = /* @__PURE__ */ Be(
|
|
|
6573
6580
|
Ye,
|
|
6574
6581
|
V,
|
|
6575
6582
|
,
|
|
6576
|
-
|
|
6577
|
-
|
|
6583
|
+
X,
|
|
6584
|
+
xe
|
|
6578
6585
|
]) => {
|
|
6579
|
-
const { column:
|
|
6586
|
+
const { column: je, row: Ie } = ue, { height: nt, width: it } = le, { width: oe } = Fe;
|
|
6580
6587
|
if (V === 0 && (O === 0 || oe === 0))
|
|
6581
6588
|
return Il;
|
|
6582
6589
|
if (it === 0) {
|
|
6583
|
-
const jt = ta(
|
|
6590
|
+
const jt = ta(xe, O), Vn = jt + Math.max(V - 1, 0);
|
|
6584
6591
|
return Nv(_l(jt, Vn, Ye));
|
|
6585
6592
|
}
|
|
6586
|
-
const se = Du(oe, it,
|
|
6593
|
+
const se = Du(oe, it, je);
|
|
6587
6594
|
let he, pe;
|
|
6588
|
-
|
|
6595
|
+
X ? Y === 0 && ee === 0 && V > 0 ? (he = 0, pe = V - 1) : (he = se * Do((Y + Ie) / (nt + Ie)), pe = se * Nl((ee + Ie) / (nt + Ie)) - 1, pe = Xs(O - 1, kr(pe, se - 1)), he = Xs(pe, kr(0, he))) : (he = 0, pe = -1);
|
|
6589
6596
|
const Te = _l(he, pe, Ye), { bottom: Ne, top: We } = jl(Fe, ue, le, Te), Ve = Nl(O / se), ct = Ve * nt + (Ve - 1) * Ie - Ne;
|
|
6590
6597
|
return { bottom: Ne, itemHeight: nt, items: Te, itemWidth: it, offsetBottom: ct, offsetTop: We, top: We };
|
|
6591
6598
|
}
|
|
@@ -6632,7 +6639,7 @@ const _v = /* @__PURE__ */ Be(
|
|
|
6632
6639
|
ne(([[, O]]) => O - 1),
|
|
6633
6640
|
Je()
|
|
6634
6641
|
)
|
|
6635
|
-
),
|
|
6642
|
+
), we = Nt(
|
|
6636
6643
|
F(
|
|
6637
6644
|
be(k),
|
|
6638
6645
|
ye(({ items: O }) => O.length > 0 && O[0].index === 0),
|
|
@@ -6657,11 +6664,11 @@ const _v = /* @__PURE__ */ Be(
|
|
|
6657
6664
|
_,
|
|
6658
6665
|
_e(N, A, C, W),
|
|
6659
6666
|
ne(([O, Y, ee, ue, le]) => {
|
|
6660
|
-
const Fe = wu(O), { align: Ye, behavior: V, offset:
|
|
6661
|
-
let
|
|
6662
|
-
|
|
6663
|
-
let
|
|
6664
|
-
return Ye === "end" ?
|
|
6667
|
+
const Fe = wu(O), { align: Ye, behavior: V, offset: X } = Fe;
|
|
6668
|
+
let xe = Fe.index;
|
|
6669
|
+
xe === "LAST" && (xe = ue - 1), xe = kr(0, xe, Xs(ue - 1, xe));
|
|
6670
|
+
let je = Ri(Y, le, ee, xe);
|
|
6671
|
+
return Ye === "end" ? je = Al(je - Y.height + ee.height) : Ye === "center" && (je = Al(je - Y.height / 2 + ee.height / 2)), X && (je += X), { behavior: V, top: je };
|
|
6665
6672
|
})
|
|
6666
6673
|
),
|
|
6667
6674
|
c
|
|
@@ -6708,14 +6715,14 @@ const _v = /* @__PURE__ */ Be(
|
|
|
6708
6715
|
...m,
|
|
6709
6716
|
// output
|
|
6710
6717
|
gridState: k,
|
|
6711
|
-
horizontalDirection:
|
|
6718
|
+
horizontalDirection: J,
|
|
6712
6719
|
initialTopMostItemIndex: I,
|
|
6713
6720
|
totalListHeight: K,
|
|
6714
6721
|
...h,
|
|
6715
6722
|
endReached: ce,
|
|
6716
6723
|
propsReady: v,
|
|
6717
6724
|
rangeChanged: Ee,
|
|
6718
|
-
startReached:
|
|
6725
|
+
startReached: we,
|
|
6719
6726
|
stateChanged: z,
|
|
6720
6727
|
stateRestoreInProgress: D,
|
|
6721
6728
|
...S
|
|
@@ -6767,9 +6774,9 @@ const jv = /* @__PURE__ */ Be(() => {
|
|
|
6767
6774
|
}), Pv = /* @__PURE__ */ Be(
|
|
6768
6775
|
([e, t]) => ({ ...e, ...t }),
|
|
6769
6776
|
Ze(_v, jv)
|
|
6770
|
-
), Ov = /* @__PURE__ */
|
|
6777
|
+
), Ov = /* @__PURE__ */ H.memo(function() {
|
|
6771
6778
|
const e = et("gridState"), t = et("listClassName"), n = et("itemClassName"), r = et("itemContent"), o = et("computeItemKey"), s = et("isSeeking"), i = Lt("scrollHeight"), a = et("ItemComponent"), c = et("ListComponent"), u = et("ScrollSeekPlaceholder"), d = et("context"), f = Lt("itemDimensions"), h = Lt("gap"), m = et("log"), w = et("stateRestoreInProgress"), v = Lt("reportReadyState"), g = zn(
|
|
6772
|
-
|
|
6779
|
+
H.useMemo(
|
|
6773
6780
|
() => (x) => {
|
|
6774
6781
|
const b = x.parentElement.parentElement.scrollHeight;
|
|
6775
6782
|
i(b);
|
|
@@ -6822,9 +6829,9 @@ const jv = /* @__PURE__ */ Be(() => {
|
|
|
6822
6829
|
})
|
|
6823
6830
|
}
|
|
6824
6831
|
);
|
|
6825
|
-
}), Mv =
|
|
6832
|
+
}), Mv = H.memo(function() {
|
|
6826
6833
|
const e = et("HeaderComponent"), t = Lt("headerHeight"), n = et("headerFooterTag"), r = zn(
|
|
6827
|
-
|
|
6834
|
+
H.useMemo(
|
|
6828
6835
|
() => (s) => {
|
|
6829
6836
|
t(mn(s, "height"));
|
|
6830
6837
|
},
|
|
@@ -6834,9 +6841,9 @@ const jv = /* @__PURE__ */ Be(() => {
|
|
|
6834
6841
|
!1
|
|
6835
6842
|
), o = et("context");
|
|
6836
6843
|
return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...mt(e, o) }) }) : null;
|
|
6837
|
-
}), Dv =
|
|
6844
|
+
}), Dv = H.memo(function() {
|
|
6838
6845
|
const e = et("FooterComponent"), t = Lt("footerHeight"), n = et("headerFooterTag"), r = zn(
|
|
6839
|
-
|
|
6846
|
+
H.useMemo(
|
|
6840
6847
|
() => (s) => {
|
|
6841
6848
|
t(mn(s, "height"));
|
|
6842
6849
|
},
|
|
@@ -6847,8 +6854,8 @@ const jv = /* @__PURE__ */ Be(() => {
|
|
|
6847
6854
|
), o = et("context");
|
|
6848
6855
|
return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...mt(e, o) }) }) : null;
|
|
6849
6856
|
}), Lv = ({ children: e }) => {
|
|
6850
|
-
const t =
|
|
6851
|
-
|
|
6857
|
+
const t = H.useContext(Au), n = Lt("itemDimensions"), r = Lt("viewportDimensions"), o = zn(
|
|
6858
|
+
H.useMemo(
|
|
6852
6859
|
() => (s) => {
|
|
6853
6860
|
r(s.getBoundingClientRect());
|
|
6854
6861
|
},
|
|
@@ -6857,15 +6864,15 @@ const jv = /* @__PURE__ */ Be(() => {
|
|
|
6857
6864
|
!0,
|
|
6858
6865
|
!1
|
|
6859
6866
|
);
|
|
6860
|
-
return
|
|
6867
|
+
return H.useEffect(() => {
|
|
6861
6868
|
t && (r({ height: t.viewportHeight, width: t.viewportWidth }), n({ height: t.itemHeight, width: t.itemWidth }));
|
|
6862
6869
|
}, [t, r, n]), /* @__PURE__ */ l.jsx("div", { ref: o, style: ls(!1), children: e });
|
|
6863
6870
|
}, $v = ({ children: e }) => {
|
|
6864
|
-
const t =
|
|
6865
|
-
return
|
|
6871
|
+
const t = H.useContext(Au), n = Lt("windowViewportRect"), r = Lt("itemDimensions"), o = et("customScrollParent"), s = lu(n, o, !1);
|
|
6872
|
+
return H.useEffect(() => {
|
|
6866
6873
|
t && (r({ height: t.itemHeight, width: t.itemWidth }), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
|
|
6867
6874
|
}, [t, n, r]), /* @__PURE__ */ l.jsx("div", { ref: s, style: ls(!1), children: e });
|
|
6868
|
-
}, Fv = /* @__PURE__ */
|
|
6875
|
+
}, Fv = /* @__PURE__ */ H.memo(function({ ...e }) {
|
|
6869
6876
|
const t = et("useWindowScroll"), n = et("customScrollParent"), r = n || t ? Bv : zv, o = n || t ? $v : Lv, s = et("context");
|
|
6870
6877
|
return /* @__PURE__ */ l.jsx(r, { ...e, ...mt(r, s), children: /* @__PURE__ */ l.jsxs(o, { children: [
|
|
6871
6878
|
/* @__PURE__ */ l.jsx(Mv, {}),
|
|
@@ -10152,7 +10159,7 @@ const Hb = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
|
|
|
10152
10159
|
));
|
|
10153
10160
|
Hb.displayName = vs.displayName;
|
|
10154
10161
|
function Ub({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
|
|
10155
|
-
const [s, i] = fe(!1), [a, c] = fe(null), [u, d] = fe(null), { toast: f } = ha(), h =
|
|
10162
|
+
const [s, i] = fe(!1), [a, c] = fe(null), [u, d] = fe(null), { toast: f } = ha(), h = H.useCallback(async () => {
|
|
10156
10163
|
if (n) {
|
|
10157
10164
|
i(!0), d(null), c(null);
|
|
10158
10165
|
try {
|
|
@@ -10429,7 +10436,7 @@ function Xb({ className: e }) {
|
|
|
10429
10436
|
}
|
|
10430
10437
|
);
|
|
10431
10438
|
}
|
|
10432
|
-
const Jb =
|
|
10439
|
+
const Jb = H.memo(function({
|
|
10433
10440
|
message: t,
|
|
10434
10441
|
messageIndex: n,
|
|
10435
10442
|
isStreamingMessage: r = !1,
|
|
@@ -10448,7 +10455,7 @@ const Jb = B.memo(function({
|
|
|
10448
10455
|
onCancelEdit: g,
|
|
10449
10456
|
onCopy: x
|
|
10450
10457
|
}) {
|
|
10451
|
-
const [b, y] = fe(!1), [R, S] = fe("collapsed"), [C, E] = fe(!1), { currentThreadId: k } = rs(), { handleInterrupt: N } = ru(), { toast: A } = ha(), [_, L] = fe({}), [$, P] = fe(!1), [W, z] = fe(null), q = c === "phone" || c === "half-screen", D = t.role, I = D === "tool", M = !(r && D !== "user"),
|
|
10458
|
+
const [b, y] = fe(!1), [R, S] = fe("collapsed"), [C, E] = fe(!1), { currentThreadId: k } = rs(), { handleInterrupt: N } = ru(), { toast: A } = ha(), [_, L] = fe({}), [$, P] = fe(!1), [W, z] = fe(null), q = c === "phone" || c === "half-screen", D = t.role, I = D === "tool", M = !(r && D !== "user"), B = H.useMemo(() => {
|
|
10452
10459
|
switch (D) {
|
|
10453
10460
|
case "user":
|
|
10454
10461
|
return "text-[hsl(var(--chat-bubble-user-text))]";
|
|
@@ -10461,10 +10468,10 @@ const Jb = B.memo(function({
|
|
|
10461
10468
|
default:
|
|
10462
10469
|
return "text-[hsl(var(--chat-bubble-ai-text))]";
|
|
10463
10470
|
}
|
|
10464
|
-
}, [D]),
|
|
10471
|
+
}, [D]), J = vt(() => Wb(t.content), [t.content]), Q = vt(() => Vb(t.content), [t.content]), ce = vt(
|
|
10465
10472
|
() => t.content.filter((oe) => oe.type === "image_url"),
|
|
10466
10473
|
[t.content]
|
|
10467
|
-
),
|
|
10474
|
+
), we = vt(
|
|
10468
10475
|
() => t.content.filter((oe) => oe.type === "file"),
|
|
10469
10476
|
[t.content]
|
|
10470
10477
|
), Ee = vt(
|
|
@@ -10473,8 +10480,8 @@ const Jb = B.memo(function({
|
|
|
10473
10480
|
), K = vt(() => qb(t.content), [t.content]);
|
|
10474
10481
|
vt(() => Gb(t.content), [t.content]);
|
|
10475
10482
|
const O = vt(() => K.length <= En ? K : `${K.slice(0, En)}
|
|
10476
|
-
… [truncated ${K.length - En} chars]`, [K]), Y =
|
|
10477
|
-
const he = oe === "visible" && I ? O : I ? K :
|
|
10483
|
+
… [truncated ${K.length - En} chars]`, [K]), Y = H.useCallback(async (oe = "all") => {
|
|
10484
|
+
const he = oe === "visible" && I ? O : I ? K : J;
|
|
10478
10485
|
async function pe(Te) {
|
|
10479
10486
|
try {
|
|
10480
10487
|
await navigator.clipboard.writeText(Te);
|
|
@@ -10492,13 +10499,13 @@ const Jb = B.memo(function({
|
|
|
10492
10499
|
} catch (Te) {
|
|
10493
10500
|
console.error("Failed to copy:", Te);
|
|
10494
10501
|
}
|
|
10495
|
-
}, [I, K,
|
|
10502
|
+
}, [I, K, J, O, x]), ee = H.useCallback(() => {
|
|
10496
10503
|
if (!w) return;
|
|
10497
|
-
const oe = I ? K :
|
|
10504
|
+
const oe = I ? K : J;
|
|
10498
10505
|
w(t.id, oe);
|
|
10499
|
-
}, [w, t.id, I, K,
|
|
10506
|
+
}, [w, t.id, I, K, J]), ue = H.useCallback(() => {
|
|
10500
10507
|
v == null || v(n);
|
|
10501
|
-
}, [v, n]), le =
|
|
10508
|
+
}, [v, n]), le = H.useCallback(async (oe, se, he) => {
|
|
10502
10509
|
if (!M) {
|
|
10503
10510
|
oe.preventDefault();
|
|
10504
10511
|
return;
|
|
@@ -10547,8 +10554,8 @@ const Jb = B.memo(function({
|
|
|
10547
10554
|
} catch (pe) {
|
|
10548
10555
|
console.error("File click error:", pe), L((Te) => ({ ...Te, [he]: !1 }));
|
|
10549
10556
|
}
|
|
10550
|
-
}, [M, _, A, k]), Fe =
|
|
10551
|
-
const se = Z(q ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0",
|
|
10557
|
+
}, [M, _, A, k]), Fe = H.useCallback(() => {
|
|
10558
|
+
const se = Z(q ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", B);
|
|
10552
10559
|
switch (D) {
|
|
10553
10560
|
case "user":
|
|
10554
10561
|
return /* @__PURE__ */ l.jsx($p, { className: se });
|
|
@@ -10559,7 +10566,7 @@ const Jb = B.memo(function({
|
|
|
10559
10566
|
default:
|
|
10560
10567
|
return /* @__PURE__ */ l.jsx(Ua, { className: se });
|
|
10561
10568
|
}
|
|
10562
|
-
}, [q,
|
|
10569
|
+
}, [q, B, D]), Ye = H.useCallback(() => {
|
|
10563
10570
|
const oe = "group relative mb-4 flex w-full";
|
|
10564
10571
|
switch (D) {
|
|
10565
10572
|
case "user":
|
|
@@ -10571,7 +10578,7 @@ const Jb = B.memo(function({
|
|
|
10571
10578
|
default:
|
|
10572
10579
|
return oe;
|
|
10573
10580
|
}
|
|
10574
|
-
}, [D]), V =
|
|
10581
|
+
}, [D]), V = H.useCallback(() => {
|
|
10575
10582
|
const oe = Z(
|
|
10576
10583
|
"rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
|
|
10577
10584
|
q && "px-3 py-2 text-sm"
|
|
@@ -10603,21 +10610,21 @@ const Jb = B.memo(function({
|
|
|
10603
10610
|
"border border-border/60 dark:border-border/40"
|
|
10604
10611
|
);
|
|
10605
10612
|
}
|
|
10606
|
-
}, [q, D]),
|
|
10613
|
+
}, [q, D]), X = H.useCallback(async (oe) => {
|
|
10607
10614
|
try {
|
|
10608
10615
|
const se = oe.id || `interrupt-${Date.now()}`;
|
|
10609
10616
|
await N(se, !0);
|
|
10610
10617
|
} catch (se) {
|
|
10611
10618
|
console.error("Failed to approve interrupt:", se);
|
|
10612
10619
|
}
|
|
10613
|
-
}, [N]),
|
|
10620
|
+
}, [N]), xe = H.useCallback(async (oe) => {
|
|
10614
10621
|
try {
|
|
10615
10622
|
const se = oe.id || `interrupt-${Date.now()}`;
|
|
10616
10623
|
await N(se, !1);
|
|
10617
10624
|
} catch (se) {
|
|
10618
10625
|
console.error("Failed to reject interrupt:", se);
|
|
10619
10626
|
}
|
|
10620
|
-
}, [N]),
|
|
10627
|
+
}, [N]), je = H.useCallback(({ part: oe, i: se }) => {
|
|
10621
10628
|
if (oe.type === "text") {
|
|
10622
10629
|
const he = oe.text ?? "", pe = he.trim(), Te = oc(pe);
|
|
10623
10630
|
return Te && D !== "tool" ? /* @__PURE__ */ l.jsx(Zb, { data: Te }, se) : D === "user" && f && pe.length > h ? /* @__PURE__ */ l.jsxs(Ml, { open: C, onOpenChange: E, children: [
|
|
@@ -10680,29 +10687,29 @@ const Jb = B.memo(function({
|
|
|
10680
10687
|
ey,
|
|
10681
10688
|
{
|
|
10682
10689
|
interruptPart: oe,
|
|
10683
|
-
onApprove:
|
|
10684
|
-
onReject:
|
|
10690
|
+
onApprove: X,
|
|
10691
|
+
onReject: xe
|
|
10685
10692
|
},
|
|
10686
10693
|
se
|
|
10687
10694
|
) : null;
|
|
10688
10695
|
}, [
|
|
10689
10696
|
le,
|
|
10690
10697
|
_,
|
|
10691
|
-
|
|
10692
|
-
|
|
10698
|
+
X,
|
|
10699
|
+
xe,
|
|
10693
10700
|
D,
|
|
10694
10701
|
f,
|
|
10695
10702
|
h,
|
|
10696
10703
|
C,
|
|
10697
10704
|
q
|
|
10698
|
-
]), Ie =
|
|
10705
|
+
]), Ie = H.useCallback(() => /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
|
|
10699
10706
|
/* @__PURE__ */ l.jsx(ui, { className: "h-4 w-4 text-muted-foreground" }),
|
|
10700
10707
|
/* @__PURE__ */ l.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
|
|
10701
|
-
] }), []), nt =
|
|
10702
|
-
if (!(
|
|
10708
|
+
] }), []), nt = H.useCallback(() => {
|
|
10709
|
+
if (!(J.trim().length > 0 || ce.length > 0 || we.length > 0 || Ee.length > 0) && !r)
|
|
10703
10710
|
return Ie();
|
|
10704
10711
|
if (t.model === "reflection") {
|
|
10705
|
-
const se =
|
|
10712
|
+
const se = J.trim(), he = oc(se);
|
|
10706
10713
|
if (he && typeof he == "object")
|
|
10707
10714
|
return /* @__PURE__ */ l.jsx(ty, { data: he });
|
|
10708
10715
|
}
|
|
@@ -10731,16 +10738,16 @@ const Jb = B.memo(function({
|
|
|
10731
10738
|
}) });
|
|
10732
10739
|
}
|
|
10733
10740
|
if (!I) {
|
|
10734
|
-
const se = /* @__PURE__ */ l.jsx("div", { className: "space-y-2", children: t.content.map((he, pe) => /* @__PURE__ */ l.jsx(
|
|
10741
|
+
const se = /* @__PURE__ */ l.jsx("div", { className: "space-y-2", children: t.content.map((he, pe) => /* @__PURE__ */ l.jsx(je, { part: he, i: pe }, pe)) });
|
|
10735
10742
|
return r ? /* @__PURE__ */ l.jsxs("div", { "aria-busy": "true", role: "status", children: [
|
|
10736
10743
|
se,
|
|
10737
|
-
/* @__PURE__ */ l.jsx(Xb, { className:
|
|
10744
|
+
/* @__PURE__ */ l.jsx(Xb, { className: B })
|
|
10738
10745
|
] }) : se;
|
|
10739
10746
|
}
|
|
10740
10747
|
}, [
|
|
10741
|
-
|
|
10748
|
+
J,
|
|
10742
10749
|
ce.length,
|
|
10743
|
-
|
|
10750
|
+
we.length,
|
|
10744
10751
|
r,
|
|
10745
10752
|
t.model,
|
|
10746
10753
|
I,
|
|
@@ -10749,7 +10756,7 @@ const Jb = B.memo(function({
|
|
|
10749
10756
|
R,
|
|
10750
10757
|
u,
|
|
10751
10758
|
Ie,
|
|
10752
|
-
|
|
10759
|
+
B
|
|
10753
10760
|
]), it = vt(() => Yb(t), [t]);
|
|
10754
10761
|
return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
10755
10762
|
/* @__PURE__ */ l.jsx("div", { className: Z(Ye(), m.container), children: /* @__PURE__ */ l.jsxs("div", { className: Z(V(), m.content), children: [
|
|
@@ -10759,7 +10766,7 @@ const Jb = B.memo(function({
|
|
|
10759
10766
|
className: Z(
|
|
10760
10767
|
"flex items-center justify-between mb-2 pb-2 border-b border-current/10",
|
|
10761
10768
|
q && "mb-1 pb-1",
|
|
10762
|
-
|
|
10769
|
+
B,
|
|
10763
10770
|
m.header
|
|
10764
10771
|
),
|
|
10765
10772
|
children: [
|
|
@@ -10772,7 +10779,7 @@ const Jb = B.memo(function({
|
|
|
10772
10779
|
variant: "outline",
|
|
10773
10780
|
className: Z(
|
|
10774
10781
|
"text-xs flex items-center gap-1 cursor-pointer",
|
|
10775
|
-
|
|
10782
|
+
B,
|
|
10776
10783
|
"border border-current/40",
|
|
10777
10784
|
q && "text-xs h-4"
|
|
10778
10785
|
),
|
|
@@ -10794,7 +10801,7 @@ const Jb = B.memo(function({
|
|
|
10794
10801
|
{
|
|
10795
10802
|
variant: "ghost",
|
|
10796
10803
|
size: "sm",
|
|
10797
|
-
className: Z("h-6 px-1",
|
|
10804
|
+
className: Z("h-6 px-1", B, "hover:bg-foreground/10"),
|
|
10798
10805
|
onClick: () => S((oe) => oe === "collapsed" ? "preview" : "collapsed"),
|
|
10799
10806
|
children: /* @__PURE__ */ l.jsxs("span", { className: "text-xs flex items-center gap-1", children: [
|
|
10800
10807
|
"Tool Output ",
|
|
@@ -10807,7 +10814,7 @@ const Jb = B.memo(function({
|
|
|
10807
10814
|
i && t.createdAt && /* @__PURE__ */ l.jsx(
|
|
10808
10815
|
"time",
|
|
10809
10816
|
{
|
|
10810
|
-
className: Z("text-xs opacity-60",
|
|
10817
|
+
className: Z("text-xs opacity-60", B, q && "text-xs"),
|
|
10811
10818
|
dateTime: new Date(t.createdAt).toISOString(),
|
|
10812
10819
|
title: new Date(t.createdAt).toLocaleString(),
|
|
10813
10820
|
children: new Intl.DateTimeFormat(void 0, { hour: "2-digit", minute: "2-digit" }).format(new Date(t.createdAt))
|
|
@@ -10829,10 +10836,10 @@ const Jb = B.memo(function({
|
|
|
10829
10836
|
variant: "ghost",
|
|
10830
10837
|
size: "sm",
|
|
10831
10838
|
onClick: () => Y(I ? "visible" : "all"),
|
|
10832
|
-
className: Z("h-6 w-6 p-0 hover:bg-foreground/10",
|
|
10839
|
+
className: Z("h-6 w-6 p-0 hover:bg-foreground/10", B, q && "h-5 w-5"),
|
|
10833
10840
|
"aria-label": I ? "Copy visible" : "Copy message",
|
|
10834
10841
|
title: I ? "Copy visible portion" : "Copy message",
|
|
10835
|
-
children: /* @__PURE__ */ l.jsx(Wa, { className: Z(b ? "text-success" :
|
|
10842
|
+
children: /* @__PURE__ */ l.jsx(Wa, { className: Z(b ? "text-success" : B, q ? "h-3 w-3" : "h-4 w-4") })
|
|
10836
10843
|
}
|
|
10837
10844
|
),
|
|
10838
10845
|
I && /* @__PURE__ */ l.jsx(
|
|
@@ -10841,7 +10848,7 @@ const Jb = B.memo(function({
|
|
|
10841
10848
|
variant: "ghost",
|
|
10842
10849
|
size: "sm",
|
|
10843
10850
|
onClick: () => Y("all"),
|
|
10844
|
-
className: Z("h-6 px-1 text-xs hover:bg-foreground/10",
|
|
10851
|
+
className: Z("h-6 px-1 text-xs hover:bg-foreground/10", B),
|
|
10845
10852
|
"aria-label": "Copy all (may be large)",
|
|
10846
10853
|
title: "Copy all (may be large)",
|
|
10847
10854
|
children: "all"
|
|
@@ -10854,9 +10861,9 @@ const Jb = B.memo(function({
|
|
|
10854
10861
|
variant: "ghost",
|
|
10855
10862
|
size: "sm",
|
|
10856
10863
|
onClick: ee,
|
|
10857
|
-
className: Z("h-6 w-6 p-0 hover:bg-foreground/10",
|
|
10864
|
+
className: Z("h-6 w-6 p-0 hover:bg-foreground/10", B, q && "h-5 w-5"),
|
|
10858
10865
|
"aria-label": "Edit message",
|
|
10859
|
-
children: /* @__PURE__ */ l.jsx(Va, { className: Z(
|
|
10866
|
+
children: /* @__PURE__ */ l.jsx(Va, { className: Z(B, q ? "h-3 w-3" : "h-4 w-4") })
|
|
10860
10867
|
}
|
|
10861
10868
|
),
|
|
10862
10869
|
D === "assistant" && v && /* @__PURE__ */ l.jsx(
|
|
@@ -10865,9 +10872,9 @@ const Jb = B.memo(function({
|
|
|
10865
10872
|
variant: "ghost",
|
|
10866
10873
|
size: "sm",
|
|
10867
10874
|
onClick: ue,
|
|
10868
|
-
className: Z("h-6 w-6 p-0 hover:bg-foreground/10",
|
|
10875
|
+
className: Z("h-6 w-6 p-0 hover:bg-foreground/10", B, q && "h-5 w-5"),
|
|
10869
10876
|
"aria-label": "Regenerate response",
|
|
10870
|
-
children: /* @__PURE__ */ l.jsx(di, { className: Z(
|
|
10877
|
+
children: /* @__PURE__ */ l.jsx(di, { className: Z(B, q ? "h-3 w-3" : "h-4 w-4") })
|
|
10871
10878
|
}
|
|
10872
10879
|
)
|
|
10873
10880
|
]
|
|
@@ -11073,7 +11080,7 @@ function ny({ issues: e }) {
|
|
|
11073
11080
|
] }, n.key);
|
|
11074
11081
|
}) });
|
|
11075
11082
|
}
|
|
11076
|
-
const ic = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Od =
|
|
11083
|
+
const ic = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Od = H.forwardRef(({
|
|
11077
11084
|
messages: e,
|
|
11078
11085
|
isStreaming: t,
|
|
11079
11086
|
streamingAssistantId: n,
|
|
@@ -11093,7 +11100,7 @@ const ic = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Od = B.forwa
|
|
|
11093
11100
|
onScrollAway: g,
|
|
11094
11101
|
onAtBottom: x
|
|
11095
11102
|
}, b) => {
|
|
11096
|
-
const y = Xe(null), R = Xe(null), S = Xe(!1), [C, E] = fe(!0), k =
|
|
11103
|
+
const y = Xe(null), R = Xe(null), S = Xe(!1), [C, E] = fe(!0), k = Pe((_) => {
|
|
11097
11104
|
E(_), g && g(!_), x && x(_);
|
|
11098
11105
|
}, [g, x]), N = vt(() => {
|
|
11099
11106
|
if (a)
|
|
@@ -11211,27 +11218,27 @@ function wa(e) {
|
|
|
11211
11218
|
t,
|
|
11212
11219
|
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
11213
11220
|
), i = (v) => {
|
|
11214
|
-
const { scope: g, children: x } = v, b =
|
|
11221
|
+
const { scope: g, children: x } = v, b = H.useRef(null), y = H.useRef(/* @__PURE__ */ new Map()).current;
|
|
11215
11222
|
return /* @__PURE__ */ l.jsx(o, { scope: g, itemMap: y, collectionRef: b, children: x });
|
|
11216
11223
|
};
|
|
11217
11224
|
i.displayName = t;
|
|
11218
|
-
const a = e + "CollectionSlot", c = nr(a), u =
|
|
11225
|
+
const a = e + "CollectionSlot", c = nr(a), u = H.forwardRef(
|
|
11219
11226
|
(v, g) => {
|
|
11220
11227
|
const { scope: x, children: b } = v, y = s(a, x), R = Me(g, y.collectionRef);
|
|
11221
11228
|
return /* @__PURE__ */ l.jsx(c, { ref: R, children: b });
|
|
11222
11229
|
}
|
|
11223
11230
|
);
|
|
11224
11231
|
u.displayName = a;
|
|
11225
|
-
const d = e + "CollectionItemSlot", f = "data-radix-collection-item", h = nr(d), m =
|
|
11232
|
+
const d = e + "CollectionItemSlot", f = "data-radix-collection-item", h = nr(d), m = H.forwardRef(
|
|
11226
11233
|
(v, g) => {
|
|
11227
|
-
const { scope: x, children: b, ...y } = v, R =
|
|
11228
|
-
return
|
|
11234
|
+
const { scope: x, children: b, ...y } = v, R = H.useRef(null), S = Me(g, R), C = s(d, x);
|
|
11235
|
+
return H.useEffect(() => (C.itemMap.set(R, { ref: R, ...y }), () => void C.itemMap.delete(R))), /* @__PURE__ */ l.jsx(h, { [f]: "", ref: S, children: b });
|
|
11229
11236
|
}
|
|
11230
11237
|
);
|
|
11231
11238
|
m.displayName = d;
|
|
11232
11239
|
function w(v) {
|
|
11233
11240
|
const g = s(e + "CollectionConsumer", v);
|
|
11234
|
-
return
|
|
11241
|
+
return H.useCallback(() => {
|
|
11235
11242
|
const b = g.collectionRef.current;
|
|
11236
11243
|
if (!b) return [];
|
|
11237
11244
|
const y = Array.from(b.querySelectorAll(`[${f}]`));
|
|
@@ -12657,20 +12664,20 @@ var Ia = "PopperContent", [b0, y0] = Gd(Ia), Qd = p.forwardRef(
|
|
|
12657
12664
|
c && h0({ ...$ }),
|
|
12658
12665
|
p0({
|
|
12659
12666
|
...$,
|
|
12660
|
-
apply: ({ elements: Fe, rects: Ye, availableWidth: V, availableHeight:
|
|
12661
|
-
const { width:
|
|
12662
|
-
Ie.setProperty("--radix-popper-available-width", `${V}px`), Ie.setProperty("--radix-popper-available-height", `${
|
|
12667
|
+
apply: ({ elements: Fe, rects: Ye, availableWidth: V, availableHeight: X }) => {
|
|
12668
|
+
const { width: xe, height: je } = Ye.reference, Ie = Fe.floating.style;
|
|
12669
|
+
Ie.setProperty("--radix-popper-available-width", `${V}px`), Ie.setProperty("--radix-popper-available-height", `${X}px`), Ie.setProperty("--radix-popper-anchor-width", `${xe}px`), Ie.setProperty("--radix-popper-anchor-height", `${je}px`);
|
|
12663
12670
|
}
|
|
12664
12671
|
}),
|
|
12665
12672
|
R && g0({ element: R, padding: a }),
|
|
12666
12673
|
T0({ arrowWidth: E, arrowHeight: k }),
|
|
12667
12674
|
h && m0({ strategy: "referenceHidden", ...$ })
|
|
12668
12675
|
]
|
|
12669
|
-
}), [I, M] = nf(z),
|
|
12676
|
+
}), [I, M] = nf(z), B = ft(w);
|
|
12670
12677
|
dt(() => {
|
|
12671
|
-
q && (
|
|
12672
|
-
}, [q,
|
|
12673
|
-
const
|
|
12678
|
+
q && (B == null || B());
|
|
12679
|
+
}, [q, B]);
|
|
12680
|
+
const J = (K = D.arrow) == null ? void 0 : K.x, Q = (O = D.arrow) == null ? void 0 : O.y, ce = ((Y = D.arrow) == null ? void 0 : Y.centerOffset) !== 0, [we, Ee] = p.useState();
|
|
12674
12681
|
return dt(() => {
|
|
12675
12682
|
x && Ee(window.getComputedStyle(x).zIndex);
|
|
12676
12683
|
}, [x]), /* @__PURE__ */ l.jsx(
|
|
@@ -12683,7 +12690,7 @@ var Ia = "PopperContent", [b0, y0] = Gd(Ia), Qd = p.forwardRef(
|
|
|
12683
12690
|
transform: q ? W.transform : "translate(0, -200%)",
|
|
12684
12691
|
// keep off the page when measuring
|
|
12685
12692
|
minWidth: "max-content",
|
|
12686
|
-
zIndex:
|
|
12693
|
+
zIndex: we,
|
|
12687
12694
|
"--radix-popper-transform-origin": [
|
|
12688
12695
|
(ee = D.transformOrigin) == null ? void 0 : ee.x,
|
|
12689
12696
|
(ue = D.transformOrigin) == null ? void 0 : ue.y
|
|
@@ -12703,7 +12710,7 @@ var Ia = "PopperContent", [b0, y0] = Gd(Ia), Qd = p.forwardRef(
|
|
|
12703
12710
|
scope: n,
|
|
12704
12711
|
placedSide: I,
|
|
12705
12712
|
onArrowChange: S,
|
|
12706
|
-
arrowX:
|
|
12713
|
+
arrowX: J,
|
|
12707
12714
|
arrowY: Q,
|
|
12708
12715
|
shouldHideArrow: ce,
|
|
12709
12716
|
children: /* @__PURE__ */ l.jsx(
|
|
@@ -13076,15 +13083,15 @@ var $t = "MenuContent", [q0, _a] = Un($t), bf = p.forwardRef(
|
|
|
13076
13083
|
...v
|
|
13077
13084
|
} = e, g = Wn($t, n), x = Zr($t, n), b = Ts(n), y = gf(n), R = B0(n), [S, C] = p.useState(null), E = p.useRef(null), k = Me(t, E, g.onContentChange), N = p.useRef(0), A = p.useRef(""), _ = p.useRef(0), L = p.useRef(null), $ = p.useRef("right"), P = p.useRef(0), W = w ? ps : p.Fragment, z = w ? { as: X0, allowPinchZoom: !0 } : void 0, q = (I) => {
|
|
13078
13085
|
var K, O;
|
|
13079
|
-
const M = A.current + I,
|
|
13086
|
+
const M = A.current + I, B = R().filter((Y) => !Y.disabled), J = document.activeElement, Q = (K = B.find((Y) => Y.ref.current === J)) == null ? void 0 : K.textValue, ce = B.map((Y) => Y.textValue), we = lS(ce, M, Q), Ee = (O = B.find((Y) => Y.textValue === we)) == null ? void 0 : O.ref.current;
|
|
13080
13087
|
(function Y(ee) {
|
|
13081
13088
|
A.current = ee, window.clearTimeout(N.current), ee !== "" && (N.current = window.setTimeout(() => Y(""), 1e3));
|
|
13082
13089
|
})(M), Ee && setTimeout(() => Ee.focus());
|
|
13083
13090
|
};
|
|
13084
13091
|
p.useEffect(() => () => window.clearTimeout(N.current), []), pa();
|
|
13085
13092
|
const D = p.useCallback((I) => {
|
|
13086
|
-
var
|
|
13087
|
-
return $.current === ((
|
|
13093
|
+
var B, J;
|
|
13094
|
+
return $.current === ((B = L.current) == null ? void 0 : B.side) && uS(I, (J = L.current) == null ? void 0 : J.area);
|
|
13088
13095
|
}, []);
|
|
13089
13096
|
return /* @__PURE__ */ l.jsx(
|
|
13090
13097
|
q0,
|
|
@@ -13161,8 +13168,8 @@ var $t = "MenuContent", [q0, _a] = Un($t), bf = p.forwardRef(
|
|
|
13161
13168
|
ref: k,
|
|
13162
13169
|
style: { outline: "none", ...v.style },
|
|
13163
13170
|
onKeyDown: ae(v.onKeyDown, (I) => {
|
|
13164
|
-
const
|
|
13165
|
-
|
|
13171
|
+
const B = I.target.closest("[data-radix-menu-content]") === I.currentTarget, J = I.ctrlKey || I.altKey || I.metaKey, Q = I.key.length === 1;
|
|
13172
|
+
B && (I.key === "Tab" && I.preventDefault(), !J && Q && q(I.key));
|
|
13166
13173
|
const ce = E.current;
|
|
13167
13174
|
if (I.target !== ce || !$0.includes(I.key)) return;
|
|
13168
13175
|
I.preventDefault();
|
|
@@ -13175,10 +13182,10 @@ var $t = "MenuContent", [q0, _a] = Un($t), bf = p.forwardRef(
|
|
|
13175
13182
|
onPointerMove: ae(
|
|
13176
13183
|
e.onPointerMove,
|
|
13177
13184
|
Br((I) => {
|
|
13178
|
-
const M = I.target,
|
|
13179
|
-
if (I.currentTarget.contains(M) &&
|
|
13180
|
-
const
|
|
13181
|
-
$.current =
|
|
13185
|
+
const M = I.target, B = P.current !== I.clientX;
|
|
13186
|
+
if (I.currentTarget.contains(M) && B) {
|
|
13187
|
+
const J = I.clientX > P.current ? "right" : "left";
|
|
13188
|
+
$.current = J, P.current = I.clientX;
|
|
13182
13189
|
}
|
|
13183
13190
|
})
|
|
13184
13191
|
)
|
|
@@ -13853,52 +13860,52 @@ function ci({
|
|
|
13853
13860
|
streamingAssistantId: L,
|
|
13854
13861
|
lastCheckpointId: $,
|
|
13855
13862
|
lastCheckpointNs: P
|
|
13856
|
-
} = Hg(), [W, z] = fe(null), [q, D] = fe(""), [I, M] = fe(null), [
|
|
13863
|
+
} = Hg(), [W, z] = fe(null), [q, D] = fe(""), [I, M] = fe(null), [B, J] = fe([]), [Q, ce] = fe(0), [we, Ee] = fe(0), [K, O] = fe(!1), [Y, ee] = fe(null), [ue, le] = fe(null), [Fe, Ye] = fe(!1), [V, X] = fe(null), [xe, je] = fe([]), [Ie, nt] = fe(null), [it, oe] = fe(null), [se, he] = fe(!1), pe = Xe(null), Te = Xe(null), Ne = Xe(null), We = Pe(() => {
|
|
13857
13864
|
pe.current && (pe.current.value = ""), Te.current && (Te.current.value = ""), ce((ie) => ie + 1), Ee((ie) => ie + 1);
|
|
13858
13865
|
}, []), Ve = Xe(!1);
|
|
13859
13866
|
tt(() => {
|
|
13860
|
-
Ve.current && !A && (
|
|
13867
|
+
Ve.current && !A && (J([]), We()), Ve.current = A;
|
|
13861
13868
|
}, [A, We]);
|
|
13862
13869
|
const [ct, jt] = fe("desktop");
|
|
13863
13870
|
tt(() => {
|
|
13864
13871
|
const ie = () => {
|
|
13865
|
-
const
|
|
13866
|
-
jt(
|
|
13872
|
+
const ve = window.innerWidth;
|
|
13873
|
+
jt(ve < 640 ? "phone" : ve < 1024 ? "tablet" : "desktop");
|
|
13867
13874
|
};
|
|
13868
13875
|
return ie(), window.addEventListener("resize", ie), () => window.removeEventListener("resize", ie);
|
|
13869
13876
|
}, []), tt(() => {
|
|
13870
13877
|
let ie = !1;
|
|
13871
13878
|
if (!v) {
|
|
13872
|
-
|
|
13879
|
+
je([]), nt(null), oe(null), Ne.current = null;
|
|
13873
13880
|
return;
|
|
13874
13881
|
}
|
|
13875
|
-
const
|
|
13882
|
+
const ve = {
|
|
13876
13883
|
threadId: v,
|
|
13877
13884
|
checkpointId: $ ?? null,
|
|
13878
13885
|
checkpointNs: P ?? null
|
|
13879
13886
|
}, De = Ne.current;
|
|
13880
|
-
if (!(De && De.threadId ===
|
|
13887
|
+
if (!(De && De.threadId === ve.threadId && De.checkpointId === ve.checkpointId && De.checkpointNs === ve.checkpointNs))
|
|
13881
13888
|
return x(v).then((Qe) => {
|
|
13882
13889
|
var oo;
|
|
13883
13890
|
if (ie) return;
|
|
13884
13891
|
const Rt = ((Qe == null ? void 0 : Qe.checkpoints) ?? []).slice().sort((ln, T) => new Date(T.createdAt).getTime() - new Date(ln.createdAt).getTime());
|
|
13885
|
-
|
|
13892
|
+
je(Rt);
|
|
13886
13893
|
const Gt = Ie, wr = Gt && Rt.some((ln) => ln.checkpointId === Gt) ? Gt : ((oo = Rt[0]) == null ? void 0 : oo.checkpointId) ?? null;
|
|
13887
13894
|
let ro = null;
|
|
13888
13895
|
if (wr) {
|
|
13889
13896
|
const ln = Rt.find((T) => T.checkpointId === wr);
|
|
13890
13897
|
ro = (ln == null ? void 0 : ln.checkpointNs) ?? null;
|
|
13891
13898
|
}
|
|
13892
|
-
nt(wr), oe(ro), Ne.current =
|
|
13899
|
+
nt(wr), oe(ro), Ne.current = ve;
|
|
13893
13900
|
}).catch((Qe) => {
|
|
13894
|
-
console.error("ChatInterface - listCheckpoints error:", Qe), ie || (
|
|
13901
|
+
console.error("ChatInterface - listCheckpoints error:", Qe), ie || (je([]), Ne.current = null);
|
|
13895
13902
|
}), () => {
|
|
13896
13903
|
ie = !0;
|
|
13897
13904
|
};
|
|
13898
13905
|
}, [v, $, P, Ie, x]), tt(() => {
|
|
13899
13906
|
$ && (nt($), oe(P ?? null));
|
|
13900
13907
|
}, [$, P]);
|
|
13901
|
-
const Vn =
|
|
13908
|
+
const Vn = Pe(async () => {
|
|
13902
13909
|
if (!(!S || C))
|
|
13903
13910
|
try {
|
|
13904
13911
|
await N();
|
|
@@ -13909,14 +13916,14 @@ function ci({
|
|
|
13909
13916
|
tt(() => {
|
|
13910
13917
|
(async () => {
|
|
13911
13918
|
if (!w.baseUrl) {
|
|
13912
|
-
|
|
13919
|
+
X(null);
|
|
13913
13920
|
return;
|
|
13914
13921
|
}
|
|
13915
13922
|
try {
|
|
13916
|
-
const
|
|
13917
|
-
|
|
13918
|
-
} catch (
|
|
13919
|
-
console.warn("Failed to fetch default message:",
|
|
13923
|
+
const ve = await w.getAgent("default");
|
|
13924
|
+
X(ve.uiDefaultMessage || null);
|
|
13925
|
+
} catch (ve) {
|
|
13926
|
+
console.warn("Failed to fetch default message:", ve), X(null);
|
|
13920
13927
|
}
|
|
13921
13928
|
})();
|
|
13922
13929
|
}, [w]), tt(() => {
|
|
@@ -13927,39 +13934,39 @@ function ci({
|
|
|
13927
13934
|
return `Message too long (${ie.length}/${No} characters)`;
|
|
13928
13935
|
try {
|
|
13929
13936
|
return sy(ie), null;
|
|
13930
|
-
} catch (
|
|
13931
|
-
return (
|
|
13937
|
+
} catch (ve) {
|
|
13938
|
+
return (ve == null ? void 0 : ve.message) || "Invalid message";
|
|
13932
13939
|
}
|
|
13933
13940
|
}, Os = async (ie) => {
|
|
13934
|
-
const
|
|
13935
|
-
if (!(!
|
|
13936
|
-
if (
|
|
13937
|
-
const De = Ps(
|
|
13941
|
+
const ve = ie.trim();
|
|
13942
|
+
if (!(!ve && B.length === 0)) {
|
|
13943
|
+
if (ve) {
|
|
13944
|
+
const De = Ps(ve);
|
|
13938
13945
|
if (De) {
|
|
13939
13946
|
M(De);
|
|
13940
13947
|
return;
|
|
13941
13948
|
}
|
|
13942
13949
|
}
|
|
13943
13950
|
try {
|
|
13944
|
-
await E(
|
|
13951
|
+
await E(ve || "", {
|
|
13945
13952
|
checkpointId: Ie ?? $ ?? void 0,
|
|
13946
13953
|
checkpointNs: it ?? P ?? void 0,
|
|
13947
13954
|
payloadExtras: W ? { edit: !0, originalMessageId: W } : void 0,
|
|
13948
|
-
attachments:
|
|
13949
|
-
}), f == null || f(
|
|
13955
|
+
attachments: B
|
|
13956
|
+
}), f == null || f(ve), M(null), J([]), We(), z(null), D("");
|
|
13950
13957
|
} catch (De) {
|
|
13951
13958
|
const Qe = (De == null ? void 0 : De.message) || "Failed to send message";
|
|
13952
13959
|
M(Qe), m == null || m(Qe);
|
|
13953
13960
|
}
|
|
13954
13961
|
}
|
|
13955
|
-
}, Qr =
|
|
13956
|
-
u && (z(ie), D(
|
|
13957
|
-
}, [u]), mr =
|
|
13962
|
+
}, Qr = H.useCallback((ie, ve) => {
|
|
13963
|
+
u && (z(ie), D(ve), M(null));
|
|
13964
|
+
}, [u]), mr = H.useCallback(() => {
|
|
13958
13965
|
z(null), D(""), M(null);
|
|
13959
|
-
}, []), Ms =
|
|
13960
|
-
Qr(ie,
|
|
13961
|
-
}, [Qr]), gr =
|
|
13962
|
-
const
|
|
13966
|
+
}, []), Ms = Pe((ie, ve) => {
|
|
13967
|
+
Qr(ie, ve);
|
|
13968
|
+
}, [Qr]), gr = Pe((ie) => {
|
|
13969
|
+
const ve = (De) => {
|
|
13963
13970
|
const Qe = De.content || [], Rt = Qe.filter((Gt) => Gt.type === "text").map((Gt) => Gt.text).join("");
|
|
13964
13971
|
if (Rt) return Rt;
|
|
13965
13972
|
try {
|
|
@@ -13970,7 +13977,7 @@ function ci({
|
|
|
13970
13977
|
};
|
|
13971
13978
|
for (let De = ie - 1; De >= 0; De--)
|
|
13972
13979
|
if (R[De].role === "user") {
|
|
13973
|
-
const Qe =
|
|
13980
|
+
const Qe = ve(R[De]);
|
|
13974
13981
|
Qe && E(Qe, {
|
|
13975
13982
|
checkpointId: Ie ?? $ ?? void 0,
|
|
13976
13983
|
checkpointNs: it ?? P ?? void 0
|
|
@@ -13978,24 +13985,24 @@ function ci({
|
|
|
13978
13985
|
break;
|
|
13979
13986
|
}
|
|
13980
13987
|
}, [R, E, Ie, it, $, P]), eo = (ie) => {
|
|
13981
|
-
const
|
|
13982
|
-
|
|
13988
|
+
const ve = Array.from(ie.target.files || []);
|
|
13989
|
+
J((De) => [...De, ...ve]), ie.target.value = "";
|
|
13983
13990
|
}, fn = (ie) => {
|
|
13984
|
-
|
|
13985
|
-
const De =
|
|
13991
|
+
J((ve) => {
|
|
13992
|
+
const De = ve.filter((Qe, Rt) => ie !== Rt);
|
|
13986
13993
|
return De.length === 0 && We(), De;
|
|
13987
13994
|
});
|
|
13988
13995
|
}, xr = async (ie) => {
|
|
13989
|
-
const
|
|
13990
|
-
if (
|
|
13996
|
+
const ve = (ie.target.files || [])[0];
|
|
13997
|
+
if (ve) {
|
|
13991
13998
|
ee(null), le(null), O(!0);
|
|
13992
13999
|
try {
|
|
13993
14000
|
await E("", {
|
|
13994
14001
|
checkpointId: Ie ?? $ ?? void 0,
|
|
13995
14002
|
checkpointNs: it ?? P ?? void 0,
|
|
13996
|
-
attachments: [
|
|
14003
|
+
attachments: [ve]
|
|
13997
14004
|
});
|
|
13998
|
-
const De = `Uploaded ${
|
|
14005
|
+
const De = `Uploaded ${ve.name} - processing through chat stream`;
|
|
13999
14006
|
le(De);
|
|
14000
14007
|
} catch (De) {
|
|
14001
14008
|
const Qe = De instanceof Error ? De.message : "Failed to upload Excel file";
|
|
@@ -14006,8 +14013,8 @@ function ci({
|
|
|
14006
14013
|
}
|
|
14007
14014
|
}, vr = (ie) => {
|
|
14008
14015
|
if (!ie) return "Unknown";
|
|
14009
|
-
const
|
|
14010
|
-
return Number.isNaN(
|
|
14016
|
+
const ve = Date.parse(ie);
|
|
14017
|
+
return Number.isNaN(ve) ? ie : new Date(ve).toLocaleString();
|
|
14011
14018
|
}, to = async (ie) => {
|
|
14012
14019
|
if (v) {
|
|
14013
14020
|
he(!0);
|
|
@@ -14016,7 +14023,7 @@ function ci({
|
|
|
14016
14023
|
await y(), nt(null), oe(null);
|
|
14017
14024
|
return;
|
|
14018
14025
|
}
|
|
14019
|
-
const
|
|
14026
|
+
const ve = xe.find((Qe) => Qe.checkpointId === ie), De = (ve == null ? void 0 : ve.checkpointNs) ?? null;
|
|
14020
14027
|
await b(ie, De), nt(ie), oe(De);
|
|
14021
14028
|
} finally {
|
|
14022
14029
|
he(!1);
|
|
@@ -14038,7 +14045,7 @@ function ci({
|
|
|
14038
14045
|
}
|
|
14039
14046
|
)
|
|
14040
14047
|
] }),
|
|
14041
|
-
v &&
|
|
14048
|
+
v && xe.length > 0 && /* @__PURE__ */ l.jsxs("div", { className: "flex-shrink-0 flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/60 text-xs dark:bg-muted/50", children: [
|
|
14042
14049
|
/* @__PURE__ */ l.jsx("span", { className: "opacity-70", children: "Checkpoint:" }),
|
|
14043
14050
|
/* @__PURE__ */ l.jsxs(
|
|
14044
14051
|
"select",
|
|
@@ -14046,12 +14053,12 @@ function ci({
|
|
|
14046
14053
|
className: "border border-border rounded px-2 py-1 text-xs bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring dark:bg-secondary",
|
|
14047
14054
|
value: Ie ?? "",
|
|
14048
14055
|
onChange: (ie) => {
|
|
14049
|
-
const
|
|
14050
|
-
to(
|
|
14056
|
+
const ve = ie.target.value || null;
|
|
14057
|
+
to(ve);
|
|
14051
14058
|
},
|
|
14052
14059
|
children: [
|
|
14053
14060
|
/* @__PURE__ */ l.jsx("option", { value: "", children: "Latest" }),
|
|
14054
|
-
|
|
14061
|
+
xe.map((ie) => /* @__PURE__ */ l.jsxs("option", { value: ie.checkpointId, children: [
|
|
14055
14062
|
vr(ie.createdAt),
|
|
14056
14063
|
ie.preview ? ` — ${ie.preview.slice(0, 40)}` : ""
|
|
14057
14064
|
] }, ie.checkpointId))
|
|
@@ -14125,7 +14132,7 @@ function ci({
|
|
|
14125
14132
|
},
|
|
14126
14133
|
Q
|
|
14127
14134
|
),
|
|
14128
|
-
|
|
14135
|
+
B.length > 0 && /* @__PURE__ */ l.jsx("div", { className: "flex flex-wrap gap-2", children: B.map((ie, ve) => /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
|
|
14129
14136
|
/* @__PURE__ */ l.jsx(ui, { size: 14 }),
|
|
14130
14137
|
/* @__PURE__ */ l.jsx("span", { className: "truncate max-w-[150px]", children: ie.name }),
|
|
14131
14138
|
/* @__PURE__ */ l.jsx(
|
|
@@ -14133,13 +14140,13 @@ function ci({
|
|
|
14133
14140
|
{
|
|
14134
14141
|
variant: "ghost",
|
|
14135
14142
|
size: "sm",
|
|
14136
|
-
onClick: () => fn(
|
|
14143
|
+
onClick: () => fn(ve),
|
|
14137
14144
|
className: "h-4 w-4 p-0 text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400",
|
|
14138
14145
|
"aria-label": `Remove ${ie.name}`,
|
|
14139
14146
|
children: /* @__PURE__ */ l.jsx(Jn, { size: 12 })
|
|
14140
14147
|
}
|
|
14141
14148
|
)
|
|
14142
|
-
] },
|
|
14149
|
+
] }, ve)) })
|
|
14143
14150
|
] }),
|
|
14144
14151
|
c && /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
14145
14152
|
/* @__PURE__ */ l.jsx(
|
|
@@ -14151,7 +14158,7 @@ function ci({
|
|
|
14151
14158
|
onChange: xr,
|
|
14152
14159
|
className: "hidden"
|
|
14153
14160
|
},
|
|
14154
|
-
|
|
14161
|
+
we
|
|
14155
14162
|
),
|
|
14156
14163
|
K && /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
14157
14164
|
/* @__PURE__ */ l.jsx(fi, { className: "h-4 w-4 animate-spin" }),
|
|
@@ -14212,7 +14219,7 @@ function ci({
|
|
|
14212
14219
|
onSend: Os,
|
|
14213
14220
|
onCancelEdit: mr,
|
|
14214
14221
|
onStop: k,
|
|
14215
|
-
allowEmptySend:
|
|
14222
|
+
allowEmptySend: B.length > 0,
|
|
14216
14223
|
textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${W ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${I ? "border-red-400" : ""} ${d.textarea || ""}`
|
|
14217
14224
|
}
|
|
14218
14225
|
) })
|
|
@@ -14824,8 +14831,8 @@ function wc({
|
|
|
14824
14831
|
if (M.stopPropagation(), !!confirm("Delete this thread?"))
|
|
14825
14832
|
try {
|
|
14826
14833
|
await v(I), d == null || d(I);
|
|
14827
|
-
} catch (
|
|
14828
|
-
console.error("Failed to delete thread:",
|
|
14834
|
+
} catch (B) {
|
|
14835
|
+
console.error("Failed to delete thread:", B);
|
|
14829
14836
|
}
|
|
14830
14837
|
}, $ = (I, M) => {
|
|
14831
14838
|
M.stopPropagation(), S(I.threadId), E(I.title || `Thread ${I.threadId.slice(0, 8)}`);
|
|
@@ -14843,7 +14850,7 @@ function wc({
|
|
|
14843
14850
|
}, q = (I) => {
|
|
14844
14851
|
if (!I) return "";
|
|
14845
14852
|
try {
|
|
14846
|
-
const M = new Date(I),
|
|
14853
|
+
const M = new Date(I), J = (/* @__PURE__ */ new Date()).getTime() - M.getTime(), Q = Math.floor(J / (1e3 * 60 * 60 * 24));
|
|
14847
14854
|
return Q === 0 ? M.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : Q === 1 ? "Yesterday" : Q < 7 ? `${Q} days ago` : M.toLocaleDateString();
|
|
14848
14855
|
} catch {
|
|
14849
14856
|
return "";
|
|
@@ -15427,10 +15434,10 @@ var Bt = 10, [Wh, Tn] = pr(Fn), MC = "SelectContentImpl", DC = nr("SelectContent
|
|
|
15427
15434
|
window.removeEventListener("blur", K), window.removeEventListener("resize", K);
|
|
15428
15435
|
};
|
|
15429
15436
|
}, [D]);
|
|
15430
|
-
const [M,
|
|
15437
|
+
const [M, B] = lp((K) => {
|
|
15431
15438
|
const O = L().filter((ue) => !ue.disabled), Y = O.find((ue) => ue.ref.current === document.activeElement), ee = cp(O, K, Y);
|
|
15432
15439
|
ee && setTimeout(() => ee.ref.current.focus());
|
|
15433
|
-
}),
|
|
15440
|
+
}), J = p.useCallback(
|
|
15434
15441
|
(K, O, Y) => {
|
|
15435
15442
|
const ee = !W.current && !Y;
|
|
15436
15443
|
(b.value !== void 0 && b.value === O || ee) && (N(K), ee && (W.current = !0));
|
|
@@ -15442,7 +15449,7 @@ var Bt = 10, [Wh, Tn] = pr(Fn), MC = "SelectContentImpl", DC = nr("SelectContent
|
|
|
15442
15449
|
(b.value !== void 0 && b.value === O || ee) && _(K);
|
|
15443
15450
|
},
|
|
15444
15451
|
[b.value]
|
|
15445
|
-
),
|
|
15452
|
+
), we = r === "popper" ? Li : Kh, Ee = we === Li ? {
|
|
15446
15453
|
side: a,
|
|
15447
15454
|
sideOffset: c,
|
|
15448
15455
|
align: u,
|
|
@@ -15461,7 +15468,7 @@ var Bt = 10, [Wh, Tn] = pr(Fn), MC = "SelectContentImpl", DC = nr("SelectContent
|
|
|
15461
15468
|
content: y,
|
|
15462
15469
|
viewport: S,
|
|
15463
15470
|
onViewportChange: C,
|
|
15464
|
-
itemRefCallback:
|
|
15471
|
+
itemRefCallback: J,
|
|
15465
15472
|
selectedItem: k,
|
|
15466
15473
|
onItemLeave: Q,
|
|
15467
15474
|
itemTextRefCallback: ce,
|
|
@@ -15492,7 +15499,7 @@ var Bt = 10, [Wh, Tn] = pr(Fn), MC = "SelectContentImpl", DC = nr("SelectContent
|
|
|
15492
15499
|
onFocusOutside: (K) => K.preventDefault(),
|
|
15493
15500
|
onDismiss: () => b.onOpenChange(!1),
|
|
15494
15501
|
children: /* @__PURE__ */ l.jsx(
|
|
15495
|
-
|
|
15502
|
+
we,
|
|
15496
15503
|
{
|
|
15497
15504
|
role: "listbox",
|
|
15498
15505
|
id: b.contentId,
|
|
@@ -15513,7 +15520,7 @@ var Bt = 10, [Wh, Tn] = pr(Fn), MC = "SelectContentImpl", DC = nr("SelectContent
|
|
|
15513
15520
|
},
|
|
15514
15521
|
onKeyDown: ae(x.onKeyDown, (K) => {
|
|
15515
15522
|
const O = K.ctrlKey || K.altKey || K.metaKey;
|
|
15516
|
-
if (K.key === "Tab" && K.preventDefault(), !O && K.key.length === 1 &&
|
|
15523
|
+
if (K.key === "Tab" && K.preventDefault(), !O && K.key.length === 1 && B(K.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(K.key)) {
|
|
15517
15524
|
let ee = L().filter((ue) => !ue.disabled).map((ue) => ue.ref.current);
|
|
15518
15525
|
if (["ArrowUp", "End"].includes(K.key) && (ee = ee.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(K.key)) {
|
|
15519
15526
|
const ue = K.target, le = ee.indexOf(ue);
|
|
@@ -15538,29 +15545,29 @@ var LC = "SelectItemAlignedPosition", Kh = p.forwardRef((e, t) => {
|
|
|
15538
15545
|
if (s.trigger && s.valueNode && a && u && v && g && x) {
|
|
15539
15546
|
const E = s.trigger.getBoundingClientRect(), k = u.getBoundingClientRect(), N = s.valueNode.getBoundingClientRect(), A = x.getBoundingClientRect();
|
|
15540
15547
|
if (s.dir !== "rtl") {
|
|
15541
|
-
const ue = A.left - k.left, le = N.left - ue, Fe = E.left - le, Ye = E.width + Fe, V = Math.max(Ye, k.width),
|
|
15548
|
+
const ue = A.left - k.left, le = N.left - ue, Fe = E.left - le, Ye = E.width + Fe, V = Math.max(Ye, k.width), X = window.innerWidth - Bt, xe = Di(le, [
|
|
15542
15549
|
Bt,
|
|
15543
15550
|
// Prevents the content from going off the starting edge of the
|
|
15544
15551
|
// viewport. It may still go off the ending edge, but this can be
|
|
15545
15552
|
// controlled by the user since they may want to manage overflow in a
|
|
15546
15553
|
// specific way.
|
|
15547
15554
|
// https://github.com/radix-ui/primitives/issues/2049
|
|
15548
|
-
Math.max(Bt,
|
|
15555
|
+
Math.max(Bt, X - V)
|
|
15549
15556
|
]);
|
|
15550
|
-
a.style.minWidth = Ye + "px", a.style.left =
|
|
15557
|
+
a.style.minWidth = Ye + "px", a.style.left = xe + "px";
|
|
15551
15558
|
} else {
|
|
15552
|
-
const ue = k.right - A.right, le = window.innerWidth - N.right - ue, Fe = window.innerWidth - E.right - le, Ye = E.width + Fe, V = Math.max(Ye, k.width),
|
|
15559
|
+
const ue = k.right - A.right, le = window.innerWidth - N.right - ue, Fe = window.innerWidth - E.right - le, Ye = E.width + Fe, V = Math.max(Ye, k.width), X = window.innerWidth - Bt, xe = Di(le, [
|
|
15553
15560
|
Bt,
|
|
15554
|
-
Math.max(Bt,
|
|
15561
|
+
Math.max(Bt, X - V)
|
|
15555
15562
|
]);
|
|
15556
|
-
a.style.minWidth = Ye + "px", a.style.right =
|
|
15563
|
+
a.style.minWidth = Ye + "px", a.style.right = xe + "px";
|
|
15557
15564
|
}
|
|
15558
|
-
const _ = h(), L = window.innerHeight - Bt * 2, $ = v.scrollHeight, P = window.getComputedStyle(u), W = parseInt(P.borderTopWidth, 10), z = parseInt(P.paddingTop, 10), q = parseInt(P.borderBottomWidth, 10), D = parseInt(P.paddingBottom, 10), I = W + z + $ + D + q, M = Math.min(g.offsetHeight * 5, I),
|
|
15565
|
+
const _ = h(), L = window.innerHeight - Bt * 2, $ = v.scrollHeight, P = window.getComputedStyle(u), W = parseInt(P.borderTopWidth, 10), z = parseInt(P.paddingTop, 10), q = parseInt(P.borderBottomWidth, 10), D = parseInt(P.paddingBottom, 10), I = W + z + $ + D + q, M = Math.min(g.offsetHeight * 5, I), B = window.getComputedStyle(v), J = parseInt(B.paddingTop, 10), Q = parseInt(B.paddingBottom, 10), ce = E.top + E.height / 2 - Bt, we = L - ce, Ee = g.offsetHeight / 2, K = g.offsetTop + Ee, O = W + z + K, Y = I - O;
|
|
15559
15566
|
if (O <= ce) {
|
|
15560
15567
|
const ue = _.length > 0 && g === _[_.length - 1].ref.current;
|
|
15561
15568
|
a.style.bottom = "0px";
|
|
15562
15569
|
const le = u.clientHeight - v.offsetTop - v.offsetHeight, Fe = Math.max(
|
|
15563
|
-
|
|
15570
|
+
we,
|
|
15564
15571
|
Ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
15565
15572
|
(ue ? Q : 0) + le + q
|
|
15566
15573
|
), Ye = O + Fe;
|
|
@@ -15571,7 +15578,7 @@ var LC = "SelectItemAlignedPosition", Kh = p.forwardRef((e, t) => {
|
|
|
15571
15578
|
const Fe = Math.max(
|
|
15572
15579
|
ce,
|
|
15573
15580
|
W + v.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
15574
|
-
(ue ?
|
|
15581
|
+
(ue ? J : 0) + Ee
|
|
15575
15582
|
) + Y;
|
|
15576
15583
|
a.style.height = Fe + "px", v.scrollTop = O - ce + v.offsetTop;
|
|
15577
15584
|
}
|
|
@@ -16536,7 +16543,7 @@ function GT({
|
|
|
16536
16543
|
"--chat-sidebar-width": u === "phone" ? "100%" : u === "tablet" ? "280px" : u === "half-screen" ? "240px" : "320px",
|
|
16537
16544
|
"--chat-message-max-width": u === "phone" ? "95%" : u === "tablet" ? "90%" : u === "half-screen" ? "85%" : "80%",
|
|
16538
16545
|
"--chat-input-height": u === "phone" ? "120px" : "100px"
|
|
16539
|
-
}), c =
|
|
16546
|
+
}), c = H.useCallback((u) => {
|
|
16540
16547
|
var d;
|
|
16541
16548
|
(d = s.onThreadChange) == null || d.call(s, u);
|
|
16542
16549
|
}, [s]);
|