teodor-new-chat-ui 4.1.73 → 4.1.74
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 +725 -714
- package/dist/index.umd.js +20 -20
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -72,10 +72,10 @@ function qm() {
|
|
|
72
72
|
se.unshift("Warning: " + T), Function.prototype.apply.call(console[g], console, se);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
var I = !1, C = !1, k = !1, R = !1,
|
|
75
|
+
var I = !1, C = !1, k = !1, R = !1, N = !1, A;
|
|
76
76
|
A = Symbol.for("react.module.reference");
|
|
77
77
|
function O(g) {
|
|
78
|
-
return !!(typeof g == "string" || typeof g == "function" || g === r || g === s ||
|
|
78
|
+
return !!(typeof g == "string" || typeof g == "function" || g === r || g === s || N || g === o || g === u || g === d || R || g === p || I || C || k || typeof g == "object" && g !== null && (g.$$typeof === h || g.$$typeof === f || g.$$typeof === i || g.$$typeof === a || g.$$typeof === l || // This needs to include all possible module reference object
|
|
79
79
|
// types supported by any Flight configuration anywhere since
|
|
80
80
|
// we don't know which Flight build this will end up being used
|
|
81
81
|
// with.
|
|
@@ -136,18 +136,18 @@ function qm() {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
var
|
|
140
|
-
function
|
|
139
|
+
var E = Object.assign, z = 0, B, H, M, D, G, _, X;
|
|
140
|
+
function ie() {
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
ie.__reactDisabledLog = !0;
|
|
143
143
|
function we() {
|
|
144
144
|
{
|
|
145
|
-
if (
|
|
146
|
-
|
|
145
|
+
if (z === 0) {
|
|
146
|
+
B = console.log, H = console.info, M = console.warn, D = console.error, G = console.group, _ = console.groupCollapsed, X = console.groupEnd;
|
|
147
147
|
var g = {
|
|
148
148
|
configurable: !0,
|
|
149
149
|
enumerable: !0,
|
|
150
|
-
value:
|
|
150
|
+
value: ie,
|
|
151
151
|
writable: !0
|
|
152
152
|
};
|
|
153
153
|
Object.defineProperties(console, {
|
|
@@ -160,42 +160,42 @@ function qm() {
|
|
|
160
160
|
groupEnd: g
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
z++;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
function Ce() {
|
|
167
167
|
{
|
|
168
|
-
if (
|
|
168
|
+
if (z--, z === 0) {
|
|
169
169
|
var g = {
|
|
170
170
|
configurable: !0,
|
|
171
171
|
enumerable: !0,
|
|
172
172
|
writable: !0
|
|
173
173
|
};
|
|
174
174
|
Object.defineProperties(console, {
|
|
175
|
-
log:
|
|
176
|
-
value:
|
|
175
|
+
log: E({}, g, {
|
|
176
|
+
value: B
|
|
177
177
|
}),
|
|
178
|
-
info:
|
|
178
|
+
info: E({}, g, {
|
|
179
179
|
value: H
|
|
180
180
|
}),
|
|
181
|
-
warn:
|
|
181
|
+
warn: E({}, g, {
|
|
182
182
|
value: M
|
|
183
183
|
}),
|
|
184
|
-
error:
|
|
184
|
+
error: E({}, g, {
|
|
185
185
|
value: D
|
|
186
186
|
}),
|
|
187
|
-
group:
|
|
188
|
-
value:
|
|
187
|
+
group: E({}, g, {
|
|
188
|
+
value: G
|
|
189
189
|
}),
|
|
190
|
-
groupCollapsed:
|
|
190
|
+
groupCollapsed: E({}, g, {
|
|
191
191
|
value: _
|
|
192
192
|
}),
|
|
193
|
-
groupEnd:
|
|
194
|
-
value:
|
|
193
|
+
groupEnd: E({}, g, {
|
|
194
|
+
value: X
|
|
195
195
|
})
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
z < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
var de = v.ReactCurrentDispatcher, K;
|
|
@@ -355,7 +355,7 @@ function qm() {
|
|
|
355
355
|
function ne(g) {
|
|
356
356
|
return pt(g);
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function le(g) {
|
|
359
359
|
{
|
|
360
360
|
var T = typeof Symbol == "function" && Symbol.toStringTag, j = T && g[Symbol.toStringTag] || g.constructor.name || "Object";
|
|
361
361
|
return j;
|
|
@@ -373,7 +373,7 @@ function qm() {
|
|
|
373
373
|
}
|
|
374
374
|
function pe(g) {
|
|
375
375
|
if (he(g))
|
|
376
|
-
return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
376
|
+
return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", le(g)), be(g);
|
|
377
377
|
}
|
|
378
378
|
var Ie = v.ReactCurrentOwner, Ze = {
|
|
379
379
|
key: !0,
|
|
@@ -579,7 +579,7 @@ Check the top-level render call using <` + j + ">.");
|
|
|
579
579
|
g.ref !== null && (Pt(g), b("Invalid attribute `ref` supplied to `React.Fragment`."), Pt(null));
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
var
|
|
582
|
+
var ae = {};
|
|
583
583
|
function xe(g, T, j, U, ee, se) {
|
|
584
584
|
{
|
|
585
585
|
var Q = O(g);
|
|
@@ -611,14 +611,14 @@ Check the top-level render call using <` + j + ">.");
|
|
|
611
611
|
var lt = V(g), Ge = Object.keys(T).filter(function(En) {
|
|
612
612
|
return En !== "key";
|
|
613
613
|
}), wt = Ge.length > 0 ? "{key: someKey, " + Ge.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
614
|
-
if (!
|
|
614
|
+
if (!ae[lt + wt]) {
|
|
615
615
|
var Nt = Ge.length > 0 ? "{" + Ge.join(": ..., ") + ": ...}" : "{}";
|
|
616
616
|
b(`A props object containing a "key" prop is being spread into JSX:
|
|
617
617
|
let props = %s;
|
|
618
618
|
<%s {...props} />
|
|
619
619
|
React keys must be passed directly to JSX without using spread:
|
|
620
620
|
let props = %s;
|
|
621
|
-
<%s key={someKey} {...props} />`, wt, lt, Nt, lt),
|
|
621
|
+
<%s key={someKey} {...props} />`, wt, lt, Nt, lt), ae[lt + wt] = !0;
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
624
|
return g === r ? xr(Ke) : gr(Ke), Ke;
|
|
@@ -1864,65 +1864,65 @@ const Tu = (e) => {
|
|
|
1864
1864
|
onDownloadProgress: C,
|
|
1865
1865
|
onUploadProgress: k,
|
|
1866
1866
|
responseType: R,
|
|
1867
|
-
headers:
|
|
1867
|
+
headers: N,
|
|
1868
1868
|
withCredentials: A = "same-origin",
|
|
1869
1869
|
fetchOptions: O
|
|
1870
1870
|
} = Tu(y), L = t || fetch;
|
|
1871
1871
|
R = R ? (R + "").toLowerCase() : "text";
|
|
1872
1872
|
let F = ux([b, S && S.toAbortSignal()], I), V = null;
|
|
1873
|
-
const
|
|
1873
|
+
const E = F && F.unsubscribe && (() => {
|
|
1874
1874
|
F.unsubscribe();
|
|
1875
1875
|
});
|
|
1876
|
-
let
|
|
1876
|
+
let z;
|
|
1877
1877
|
try {
|
|
1878
|
-
if (k && u && x !== "get" && x !== "head" && (
|
|
1878
|
+
if (k && u && x !== "get" && x !== "head" && (z = await p(N, v)) !== 0) {
|
|
1879
1879
|
let _ = new n(w, {
|
|
1880
1880
|
method: "POST",
|
|
1881
1881
|
body: v,
|
|
1882
1882
|
duplex: "half"
|
|
1883
|
-
}),
|
|
1884
|
-
if (P.isFormData(v) && (
|
|
1885
|
-
const [
|
|
1886
|
-
|
|
1883
|
+
}), X;
|
|
1884
|
+
if (P.isFormData(v) && (X = _.headers.get("content-type")) && N.setContentType(X), _.body) {
|
|
1885
|
+
const [ie, we] = Rl(
|
|
1886
|
+
z,
|
|
1887
1887
|
Zo(El(k))
|
|
1888
1888
|
);
|
|
1889
|
-
v = Al(_.body, _l,
|
|
1889
|
+
v = Al(_.body, _l, ie, we);
|
|
1890
1890
|
}
|
|
1891
1891
|
}
|
|
1892
1892
|
P.isString(A) || (A = A ? "include" : "omit");
|
|
1893
|
-
const
|
|
1893
|
+
const B = s && "credentials" in n.prototype, H = {
|
|
1894
1894
|
...O,
|
|
1895
1895
|
signal: F,
|
|
1896
1896
|
method: x.toUpperCase(),
|
|
1897
|
-
headers:
|
|
1897
|
+
headers: N.normalize().toJSON(),
|
|
1898
1898
|
body: v,
|
|
1899
1899
|
duplex: "half",
|
|
1900
|
-
credentials:
|
|
1900
|
+
credentials: B ? A : void 0
|
|
1901
1901
|
};
|
|
1902
1902
|
V = s && new n(w, H);
|
|
1903
1903
|
let M = await (s ? L(V, O) : L(w, H));
|
|
1904
1904
|
const D = d && (R === "stream" || R === "response");
|
|
1905
|
-
if (d && (C || D &&
|
|
1905
|
+
if (d && (C || D && E)) {
|
|
1906
1906
|
const _ = {};
|
|
1907
1907
|
["status", "statusText", "headers"].forEach((Ce) => {
|
|
1908
1908
|
_[Ce] = M[Ce];
|
|
1909
1909
|
});
|
|
1910
|
-
const
|
|
1911
|
-
|
|
1910
|
+
const X = P.toFiniteNumber(M.headers.get("content-length")), [ie, we] = C && Rl(
|
|
1911
|
+
X,
|
|
1912
1912
|
Zo(El(C), !0)
|
|
1913
1913
|
) || [];
|
|
1914
1914
|
M = new r(
|
|
1915
|
-
Al(M.body, _l,
|
|
1916
|
-
we && we(),
|
|
1915
|
+
Al(M.body, _l, ie, () => {
|
|
1916
|
+
we && we(), E && E();
|
|
1917
1917
|
}),
|
|
1918
1918
|
_
|
|
1919
1919
|
);
|
|
1920
1920
|
}
|
|
1921
1921
|
R = R || "text";
|
|
1922
|
-
let
|
|
1923
|
-
return !D &&
|
|
1924
|
-
Cu(_,
|
|
1925
|
-
data:
|
|
1922
|
+
let G = await f[P.findKey(f, R) || "text"](M, y);
|
|
1923
|
+
return !D && E && E(), await new Promise((_, X) => {
|
|
1924
|
+
Cu(_, X, {
|
|
1925
|
+
data: G,
|
|
1926
1926
|
headers: _t.from(M.headers),
|
|
1927
1927
|
status: M.status,
|
|
1928
1928
|
statusText: M.statusText,
|
|
@@ -1930,13 +1930,13 @@ const Tu = (e) => {
|
|
|
1930
1930
|
request: V
|
|
1931
1931
|
});
|
|
1932
1932
|
});
|
|
1933
|
-
} catch (
|
|
1934
|
-
throw
|
|
1933
|
+
} catch (B) {
|
|
1934
|
+
throw E && E(), B && B.name === "TypeError" && /Load failed|fetch/i.test(B.message) ? Object.assign(
|
|
1935
1935
|
new De("Network Error", De.ERR_NETWORK, y, V),
|
|
1936
1936
|
{
|
|
1937
|
-
cause:
|
|
1937
|
+
cause: B.cause || B
|
|
1938
1938
|
}
|
|
1939
|
-
) : De.from(
|
|
1939
|
+
) : De.from(B, B && B.code, y, V);
|
|
1940
1940
|
}
|
|
1941
1941
|
};
|
|
1942
1942
|
}, gx = /* @__PURE__ */ new Map(), Iu = (e) => {
|
|
@@ -3035,55 +3035,55 @@ function Fx(e = {}) {
|
|
|
3035
3035
|
}, []), R = Ne(() => {
|
|
3036
3036
|
var O;
|
|
3037
3037
|
(O = S.current) == null || O.abort(), S.current = null, l(!1), b(!1), C.current = 0, x(0);
|
|
3038
|
-
}, []),
|
|
3038
|
+
}, []), N = Ne(() => {
|
|
3039
3039
|
h(""), y(null), d(null);
|
|
3040
3040
|
}, []), A = Ne(
|
|
3041
3041
|
(O, L, F) => {
|
|
3042
3042
|
S.current && (S.current.abort(), S.current = null), l(!0), d(null), e.autoAppendAssistant !== !1 && h("");
|
|
3043
3043
|
const V = new AbortController();
|
|
3044
3044
|
return S.current = V, (async () => {
|
|
3045
|
-
var
|
|
3046
|
-
const
|
|
3045
|
+
var z, B, H, M, D, G, _, X;
|
|
3046
|
+
const E = (ie) => {
|
|
3047
3047
|
var we;
|
|
3048
3048
|
try {
|
|
3049
|
-
const Ce = JSON.parse(JSON.stringify(
|
|
3049
|
+
const Ce = JSON.parse(JSON.stringify(ie));
|
|
3050
3050
|
return (we = Ce == null ? void 0 : Ce.payload) != null && we.files_info && Array.isArray(Ce.payload.files_info) && (Ce.payload.files_info = Ce.payload.files_info.map((de) => ({
|
|
3051
3051
|
...de,
|
|
3052
3052
|
data: de != null && de.data ? `<base64 ${String(de.data).length} chars>` : de == null ? void 0 : de.data
|
|
3053
3053
|
}))), Ce;
|
|
3054
3054
|
} catch {
|
|
3055
|
-
return
|
|
3055
|
+
return ie;
|
|
3056
3056
|
}
|
|
3057
3057
|
};
|
|
3058
3058
|
try {
|
|
3059
|
-
let
|
|
3059
|
+
let ie = {};
|
|
3060
3060
|
try {
|
|
3061
3061
|
if (r)
|
|
3062
|
-
|
|
3062
|
+
ie = { Authorization: `Bearer ${r}` };
|
|
3063
3063
|
else if (typeof window < "u") {
|
|
3064
|
-
const $e = window.__AUTH_TOKEN__, ot = ((
|
|
3064
|
+
const $e = window.__AUTH_TOKEN__, ot = ((z = window.localStorage) == null ? void 0 : z.getItem("authToken")) || null;
|
|
3065
3065
|
let Je = null;
|
|
3066
3066
|
try {
|
|
3067
|
-
const pt = (
|
|
3067
|
+
const pt = (B = window.localStorage) == null ? void 0 : B.getItem("chat-settings");
|
|
3068
3068
|
pt && (Je = ((H = JSON.parse(pt)) == null ? void 0 : H.apiKey) || null);
|
|
3069
3069
|
} catch {
|
|
3070
3070
|
}
|
|
3071
3071
|
const _e = $e || ot || Je || null;
|
|
3072
|
-
_e && (
|
|
3072
|
+
_e && (ie = { Authorization: `Bearer ${_e}` });
|
|
3073
3073
|
}
|
|
3074
3074
|
} catch {
|
|
3075
3075
|
}
|
|
3076
3076
|
console.debug(
|
|
3077
3077
|
"[use-chat] POST",
|
|
3078
3078
|
t + n,
|
|
3079
|
-
|
|
3079
|
+
E(O)
|
|
3080
3080
|
);
|
|
3081
3081
|
const we = await fetch(t + n, {
|
|
3082
3082
|
method: "POST",
|
|
3083
3083
|
headers: {
|
|
3084
3084
|
"Content-Type": "application/json",
|
|
3085
3085
|
Accept: "text/event-stream",
|
|
3086
|
-
...
|
|
3086
|
+
...ie,
|
|
3087
3087
|
...s.current
|
|
3088
3088
|
},
|
|
3089
3089
|
body: JSON.stringify(O),
|
|
@@ -3132,9 +3132,9 @@ function Fx(e = {}) {
|
|
|
3132
3132
|
for (; (ne = K.indexOf(`
|
|
3133
3133
|
|
|
3134
3134
|
`)) >= 0; ) {
|
|
3135
|
-
const
|
|
3135
|
+
const le = K.slice(0, ne);
|
|
3136
3136
|
K = K.slice(ne + 2);
|
|
3137
|
-
const he = zx(
|
|
3137
|
+
const he = zx(le);
|
|
3138
3138
|
if (!he) continue;
|
|
3139
3139
|
let be;
|
|
3140
3140
|
try {
|
|
@@ -3172,7 +3172,7 @@ function Fx(e = {}) {
|
|
|
3172
3172
|
} catch (Oe) {
|
|
3173
3173
|
if (Oe.name !== "AbortError") {
|
|
3174
3174
|
const $e = Oe.message || String(Oe);
|
|
3175
|
-
d($e), (
|
|
3175
|
+
d($e), (G = F == null ? void 0 : F.onError) == null || G.call(F, $e);
|
|
3176
3176
|
}
|
|
3177
3177
|
} finally {
|
|
3178
3178
|
try {
|
|
@@ -3183,10 +3183,10 @@ function Fx(e = {}) {
|
|
|
3183
3183
|
}
|
|
3184
3184
|
J !== null && typeof window < "u" && window.cancelAnimationFrame(J), clearInterval(Xe), l(!1), b(!1), S.current = null, C.current = 0, x(0);
|
|
3185
3185
|
}
|
|
3186
|
-
} catch (
|
|
3187
|
-
if (
|
|
3188
|
-
const we =
|
|
3189
|
-
d(we), (
|
|
3186
|
+
} catch (ie) {
|
|
3187
|
+
if (ie.name !== "AbortError") {
|
|
3188
|
+
const we = ie.message || String(ie);
|
|
3189
|
+
d(we), (X = F == null ? void 0 : F.onError) == null || X.call(F, we);
|
|
3190
3190
|
}
|
|
3191
3191
|
} finally {
|
|
3192
3192
|
l(!1), b(!1), S.current = null, C.current = 0, x(0);
|
|
@@ -3207,7 +3207,7 @@ function Fx(e = {}) {
|
|
|
3207
3207
|
connected: v,
|
|
3208
3208
|
stream: A,
|
|
3209
3209
|
stop: R,
|
|
3210
|
-
clear:
|
|
3210
|
+
clear: N,
|
|
3211
3211
|
setToken: k
|
|
3212
3212
|
};
|
|
3213
3213
|
}
|
|
@@ -3631,28 +3631,31 @@ function Zx(e) {
|
|
|
3631
3631
|
function Qx(e) {
|
|
3632
3632
|
const { api: t, baseHost: n, onError: r, initialThreadId: o = null } = e, [s, i] = ye(
|
|
3633
3633
|
() => {
|
|
3634
|
-
var
|
|
3635
|
-
return ui(n, (
|
|
3634
|
+
var E;
|
|
3635
|
+
return ui(n, (E = t.getAuthToken) == null ? void 0 : E.call(t));
|
|
3636
3636
|
}
|
|
3637
3637
|
), [a, l] = ye(() => {
|
|
3638
|
-
var
|
|
3639
|
-
const
|
|
3640
|
-
ui(n, (
|
|
3638
|
+
var z;
|
|
3639
|
+
const E = di(
|
|
3640
|
+
ui(n, (z = t.getAuthToken) == null ? void 0 : z.call(t))
|
|
3641
3641
|
);
|
|
3642
|
-
return To(
|
|
3643
|
-
}), u = dt(() =>
|
|
3642
|
+
return To(E);
|
|
3643
|
+
}), u = dt(() => {
|
|
3644
|
+
const E = fi(a);
|
|
3645
|
+
return console.log("[useThreadList] threads memo updated, result.length:", E.length), E;
|
|
3646
|
+
}, [a]), [d, f] = ye(o), [h, p] = ye(!1), [y, w] = ye(null), x = We(u.length), v = We(!1), b = We(null), S = We(""), I = We(!1), C = We(null);
|
|
3644
3647
|
st(() => {
|
|
3645
3648
|
x.current = u.length;
|
|
3646
3649
|
}, [u.length]);
|
|
3647
3650
|
const k = Ne(() => {
|
|
3648
|
-
const
|
|
3649
|
-
l(To(
|
|
3651
|
+
const E = di(s);
|
|
3652
|
+
l(To(E));
|
|
3650
3653
|
}, [s]), R = Ne(
|
|
3651
|
-
(
|
|
3654
|
+
(E, z) => {
|
|
3652
3655
|
if (!Ar()) return;
|
|
3653
3656
|
b.current !== null && (window.clearTimeout(b.current), b.current = null);
|
|
3654
|
-
const
|
|
3655
|
-
if (
|
|
3657
|
+
const B = E.map((M) => `${M.threadId}:${M.updatedAt ?? ""}:${M.messageCount ?? ""}`).join("|");
|
|
3658
|
+
if (E.length === 0) {
|
|
3656
3659
|
try {
|
|
3657
3660
|
Hu(s);
|
|
3658
3661
|
} catch {
|
|
@@ -3660,18 +3663,18 @@ function Qx(e) {
|
|
|
3660
3663
|
S.current = "";
|
|
3661
3664
|
return;
|
|
3662
3665
|
}
|
|
3663
|
-
if (
|
|
3666
|
+
if (B === S.current)
|
|
3664
3667
|
return;
|
|
3665
3668
|
const H = () => {
|
|
3666
3669
|
try {
|
|
3667
|
-
const M =
|
|
3668
|
-
Uu(s, M), S.current =
|
|
3670
|
+
const M = E.slice(0, zu);
|
|
3671
|
+
Uu(s, M), S.current = B;
|
|
3669
3672
|
} catch {
|
|
3670
3673
|
} finally {
|
|
3671
3674
|
b.current = null;
|
|
3672
3675
|
}
|
|
3673
3676
|
};
|
|
3674
|
-
if (
|
|
3677
|
+
if (z != null && z.immediate) {
|
|
3675
3678
|
H();
|
|
3676
3679
|
return;
|
|
3677
3680
|
}
|
|
@@ -3680,89 +3683,97 @@ function Qx(e) {
|
|
|
3680
3683
|
}, wa);
|
|
3681
3684
|
},
|
|
3682
3685
|
[s]
|
|
3683
|
-
),
|
|
3686
|
+
), N = Ne(() => {
|
|
3684
3687
|
R(u, { immediate: !0 });
|
|
3685
3688
|
}, [R, u]), A = Ne(async () => {
|
|
3686
|
-
const
|
|
3687
|
-
|
|
3689
|
+
const E = x.current > 0;
|
|
3690
|
+
E || p(!0);
|
|
3688
3691
|
try {
|
|
3689
|
-
const
|
|
3692
|
+
const z = await t.listThreads();
|
|
3693
|
+
console.log("[useThreadList.refreshThreads] fetched items:", z.length, "background:", E);
|
|
3694
|
+
const B = () => {
|
|
3690
3695
|
l((H) => {
|
|
3691
|
-
const M = (
|
|
3692
|
-
|
|
3696
|
+
const M = (X) => X.map((ie) => `${ie.threadId}:${ie.updatedAt ?? ""}:${ie.messageCount ?? ""}`).join("|"), D = fi(H), G = M(D) === M(z);
|
|
3697
|
+
if (console.log("[useThreadList.refreshThreads.updateStore] prevList.length:", D.length, "items.length:", z.length, "same:", G, "threadsInitialized:", v.current), G)
|
|
3698
|
+
return H;
|
|
3699
|
+
if (z.length === 0 && D.length > 0 && !v.current)
|
|
3700
|
+
return console.log("[useThreadList.refreshThreads.updateStore] ignoring empty result during init"), H;
|
|
3701
|
+
console.log("[useThreadList.refreshThreads.updateStore] building store from", z.length, "items");
|
|
3702
|
+
const _ = To(z);
|
|
3703
|
+
return console.log("[useThreadList.refreshThreads.updateStore] new store has", _.order.length, "threads"), _;
|
|
3693
3704
|
});
|
|
3694
3705
|
};
|
|
3695
|
-
|
|
3696
|
-
} catch (
|
|
3697
|
-
r == null || r(String(
|
|
3706
|
+
E ? (console.log("[useThreadList.refreshThreads] using startTransition (background mode)"), ru(B)) : (console.log("[useThreadList.refreshThreads] direct update (initial load mode)"), B()), w(null), v.current || (v.current = !0);
|
|
3707
|
+
} catch (z) {
|
|
3708
|
+
r == null || r(String(z)), console.error("[useThreadList] Failed to refresh threads:", z), w(String(z));
|
|
3698
3709
|
} finally {
|
|
3699
|
-
|
|
3710
|
+
E || p(!1);
|
|
3700
3711
|
}
|
|
3701
3712
|
}, [t, r]), O = Ne(
|
|
3702
|
-
async (
|
|
3713
|
+
async (E) => {
|
|
3703
3714
|
var H;
|
|
3704
|
-
const
|
|
3705
|
-
threadId:
|
|
3706
|
-
title:
|
|
3715
|
+
const z = `thread-${((H = crypto.randomUUID) == null ? void 0 : H.call(crypto)) ?? Date.now().toString(36)}`, B = {
|
|
3716
|
+
threadId: z,
|
|
3717
|
+
title: E || "New Chat",
|
|
3707
3718
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3708
3719
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3709
3720
|
messageCount: 0
|
|
3710
3721
|
};
|
|
3711
3722
|
l((M) => ({
|
|
3712
|
-
byId: { ...M.byId, [
|
|
3713
|
-
order: [
|
|
3714
|
-
})), f(
|
|
3723
|
+
byId: { ...M.byId, [z]: B },
|
|
3724
|
+
order: [z, ...M.order]
|
|
3725
|
+
})), f(z);
|
|
3715
3726
|
try {
|
|
3716
|
-
const M = await t.createThread(
|
|
3727
|
+
const M = await t.createThread(E);
|
|
3717
3728
|
return l((D) => {
|
|
3718
|
-
const
|
|
3719
|
-
delete
|
|
3720
|
-
const _ = D.order.map((
|
|
3721
|
-
return { byId:
|
|
3729
|
+
const G = { ...D.byId };
|
|
3730
|
+
delete G[z], G[M.threadId] = M;
|
|
3731
|
+
const _ = D.order.map((X) => X === z ? M.threadId : X);
|
|
3732
|
+
return { byId: G, order: _ };
|
|
3722
3733
|
}), f(M.threadId), w(null), M;
|
|
3723
3734
|
} catch (M) {
|
|
3724
3735
|
throw l((D) => {
|
|
3725
|
-
const
|
|
3726
|
-
return delete
|
|
3727
|
-
byId:
|
|
3728
|
-
order: D.order.filter((_) => _ !==
|
|
3736
|
+
const G = { ...D.byId };
|
|
3737
|
+
return delete G[z], {
|
|
3738
|
+
byId: G,
|
|
3739
|
+
order: D.order.filter((_) => _ !== z)
|
|
3729
3740
|
};
|
|
3730
3741
|
}), w(String(M)), r == null || r(String(M)), M;
|
|
3731
3742
|
}
|
|
3732
3743
|
},
|
|
3733
3744
|
[t, r]
|
|
3734
3745
|
), L = Ne(
|
|
3735
|
-
async (
|
|
3736
|
-
var
|
|
3746
|
+
async (E) => {
|
|
3747
|
+
var z;
|
|
3737
3748
|
try {
|
|
3738
|
-
await t.deleteThread(
|
|
3739
|
-
let
|
|
3749
|
+
await t.deleteThread(E);
|
|
3750
|
+
let B = null;
|
|
3740
3751
|
l((M) => {
|
|
3741
|
-
if (!M.byId[
|
|
3752
|
+
if (!M.byId[E]) return M;
|
|
3742
3753
|
const D = { ...M.byId };
|
|
3743
|
-
delete D[
|
|
3744
|
-
const
|
|
3745
|
-
return
|
|
3746
|
-
}),
|
|
3747
|
-
const H = d ===
|
|
3748
|
-
H && f(null), (
|
|
3749
|
-
} catch (
|
|
3750
|
-
throw w(String(
|
|
3754
|
+
delete D[E];
|
|
3755
|
+
const G = M.order.filter((X) => X !== E), _ = { byId: D, order: G };
|
|
3756
|
+
return B = fi(_), _;
|
|
3757
|
+
}), B && R(B, { immediate: !0 });
|
|
3758
|
+
const H = d === E;
|
|
3759
|
+
H && f(null), (z = e.onThreadRemoved) == null || z.call(e, E, { wasCurrent: H }), await A(), w(null);
|
|
3760
|
+
} catch (B) {
|
|
3761
|
+
throw w(String(B)), B;
|
|
3751
3762
|
}
|
|
3752
3763
|
},
|
|
3753
3764
|
[t, d, e, A, R]
|
|
3754
3765
|
), F = Ne(
|
|
3755
|
-
async (
|
|
3766
|
+
async (E, z) => {
|
|
3756
3767
|
try {
|
|
3757
|
-
await t.updateThread(
|
|
3758
|
-
const H =
|
|
3768
|
+
await t.updateThread(E, z), l((B) => {
|
|
3769
|
+
const H = B.byId[E];
|
|
3759
3770
|
return H ? {
|
|
3760
|
-
byId: { ...
|
|
3761
|
-
order:
|
|
3762
|
-
} :
|
|
3771
|
+
byId: { ...B.byId, [E]: { ...H, title: z } },
|
|
3772
|
+
order: B.order
|
|
3773
|
+
} : B;
|
|
3763
3774
|
}), w(null);
|
|
3764
|
-
} catch (
|
|
3765
|
-
throw await A(), w(String(
|
|
3775
|
+
} catch (B) {
|
|
3776
|
+
throw await A(), w(String(B)), B;
|
|
3766
3777
|
}
|
|
3767
3778
|
},
|
|
3768
3779
|
[t, A]
|
|
@@ -3774,19 +3785,19 @@ function Qx(e) {
|
|
|
3774
3785
|
};
|
|
3775
3786
|
}, [u, R]), st(() => {
|
|
3776
3787
|
var H, M, D;
|
|
3777
|
-
const
|
|
3778
|
-
const _ = ui(n,
|
|
3788
|
+
const E = (G) => {
|
|
3789
|
+
const _ = ui(n, G ?? null);
|
|
3779
3790
|
C.current !== _ && (C.current = _, I.current = !1), i(_);
|
|
3780
|
-
const
|
|
3781
|
-
l(To(
|
|
3791
|
+
const X = di(_);
|
|
3792
|
+
l(To(X)), I.current || (I.current = !0, A().catch(() => {
|
|
3782
3793
|
}));
|
|
3783
|
-
},
|
|
3784
|
-
(M = e.onAuthTokenChange) == null || M.call(e,
|
|
3785
|
-
const
|
|
3786
|
-
var _,
|
|
3787
|
-
(_ = e.onAuthTokenChange) == null || _.call(e,
|
|
3794
|
+
}, z = ((H = t.getAuthToken) == null ? void 0 : H.call(t)) ?? null;
|
|
3795
|
+
(M = e.onAuthTokenChange) == null || M.call(e, z), E(z);
|
|
3796
|
+
const B = (D = t.onTokenChange) == null ? void 0 : D.call(t, (G) => {
|
|
3797
|
+
var _, X;
|
|
3798
|
+
(_ = e.onAuthTokenChange) == null || _.call(e, G), (X = e.clearAllMessageCaches) == null || X.call(e), E(G);
|
|
3788
3799
|
});
|
|
3789
|
-
return () =>
|
|
3800
|
+
return () => B == null ? void 0 : B();
|
|
3790
3801
|
}, [
|
|
3791
3802
|
t,
|
|
3792
3803
|
n,
|
|
@@ -3794,15 +3805,15 @@ function Qx(e) {
|
|
|
3794
3805
|
e.clearAllMessageCaches,
|
|
3795
3806
|
e.onAuthTokenChange
|
|
3796
3807
|
]);
|
|
3797
|
-
const V = Ne((
|
|
3798
|
-
l((
|
|
3799
|
-
const
|
|
3800
|
-
return
|
|
3801
|
-
byId: { ...
|
|
3802
|
-
order:
|
|
3808
|
+
const V = Ne((E) => {
|
|
3809
|
+
l((z) => {
|
|
3810
|
+
const B = z.byId[E.threadId];
|
|
3811
|
+
return B ? B.title === E.title && B.updatedAt === E.updatedAt && B.messageCount === E.messageCount ? z : {
|
|
3812
|
+
byId: { ...z.byId, [E.threadId]: E },
|
|
3813
|
+
order: z.order
|
|
3803
3814
|
} : {
|
|
3804
|
-
byId: { ...
|
|
3805
|
-
order: [
|
|
3815
|
+
byId: { ...z.byId, [E.threadId]: E },
|
|
3816
|
+
order: [E.threadId, ...z.order]
|
|
3806
3817
|
};
|
|
3807
3818
|
});
|
|
3808
3819
|
}, []);
|
|
@@ -3816,7 +3827,7 @@ function Qx(e) {
|
|
|
3816
3827
|
createThread: O,
|
|
3817
3828
|
deleteThread: L,
|
|
3818
3829
|
renameThread: F,
|
|
3819
|
-
persistThreadsCache:
|
|
3830
|
+
persistThreadsCache: N,
|
|
3820
3831
|
hydrateThreadsFromCache: k,
|
|
3821
3832
|
upsertThreadSummary: V
|
|
3822
3833
|
};
|
|
@@ -3892,14 +3903,14 @@ function tv({
|
|
|
3892
3903
|
currentThreadId: C,
|
|
3893
3904
|
setCurrentThreadId: k,
|
|
3894
3905
|
isLoadingThreads: R,
|
|
3895
|
-
threadsError:
|
|
3906
|
+
threadsError: N,
|
|
3896
3907
|
refreshThreads: A,
|
|
3897
3908
|
createThread: O,
|
|
3898
3909
|
deleteThread: L,
|
|
3899
3910
|
renameThread: F,
|
|
3900
3911
|
persistThreadsCache: V,
|
|
3901
|
-
hydrateThreadsFromCache:
|
|
3902
|
-
upsertThreadSummary:
|
|
3912
|
+
hydrateThreadsFromCache: E,
|
|
3913
|
+
upsertThreadSummary: z
|
|
3903
3914
|
} = Qx({
|
|
3904
3915
|
api: l,
|
|
3905
3916
|
baseHost: f,
|
|
@@ -3907,7 +3918,7 @@ function tv({
|
|
|
3907
3918
|
initialThreadId: t,
|
|
3908
3919
|
clearAllMessageCaches: b,
|
|
3909
3920
|
onAuthTokenChange: (g) => S.current(g ?? null)
|
|
3910
|
-
}), [
|
|
3921
|
+
}), [B, H] = ye(!1), [M, D] = ye(null), [G, _] = ye(null), [X, ie] = ye(!1), [we, Ce] = ye(!1), [de, K] = ye([]), [$, Y] = ye([]), J = We([]), [me, oe] = ye(null), {
|
|
3911
3922
|
state: te,
|
|
3912
3923
|
dispatch: Xe,
|
|
3913
3924
|
seed: Ue,
|
|
@@ -3919,7 +3930,7 @@ function tv({
|
|
|
3919
3930
|
st(() => {
|
|
3920
3931
|
_e.current = C;
|
|
3921
3932
|
}, [C]);
|
|
3922
|
-
const pt = We(!1), ne = We([]),
|
|
3933
|
+
const pt = We(!1), ne = We([]), le = We(null), he = We(null), be = We(/* @__PURE__ */ new Map()), pe = We(C), Ie = We({ threadId: null, checkpointId: null, checkpointNs: null }), Ze = Ne((g, T) => new Promise((j, U) => {
|
|
3923
3934
|
const ee = async () => {
|
|
3924
3935
|
pt.current = !0;
|
|
3925
3936
|
try {
|
|
@@ -3941,7 +3952,7 @@ function tv({
|
|
|
3941
3952
|
var ee;
|
|
3942
3953
|
const g = _e.current;
|
|
3943
3954
|
if (!g) {
|
|
3944
|
-
|
|
3955
|
+
G !== null && _(null), Ie.current = {
|
|
3945
3956
|
threadId: null,
|
|
3946
3957
|
checkpointId: null,
|
|
3947
3958
|
checkpointNs: null
|
|
@@ -3950,7 +3961,7 @@ function tv({
|
|
|
3950
3961
|
}
|
|
3951
3962
|
const T = te.pendingInterrupt ?? Hx(te.messages);
|
|
3952
3963
|
if (T) {
|
|
3953
|
-
li(
|
|
3964
|
+
li(G, T) || _(T), Ie.current = {
|
|
3954
3965
|
threadId: g,
|
|
3955
3966
|
checkpointId: te.lastCheckpointId ?? null,
|
|
3956
3967
|
checkpointNs: te.lastCheckpointNs ?? null
|
|
@@ -3965,16 +3976,16 @@ function tv({
|
|
|
3965
3976
|
if (me) {
|
|
3966
3977
|
const se = (ee = me.values) == null ? void 0 : ee.state, Q = Vl(se);
|
|
3967
3978
|
if (Q !== null) {
|
|
3968
|
-
li(
|
|
3979
|
+
li(G, Q) || _(Q), Ie.current = j;
|
|
3969
3980
|
return;
|
|
3970
3981
|
}
|
|
3971
|
-
if (Ie.current.threadId === j.threadId && Ie.current.checkpointId === j.checkpointId && Ie.current.checkpointNs === j.checkpointNs &&
|
|
3982
|
+
if (Ie.current.threadId === j.threadId && Ie.current.checkpointId === j.checkpointId && Ie.current.checkpointNs === j.checkpointNs && G === null) {
|
|
3972
3983
|
Ie.current = j;
|
|
3973
3984
|
return;
|
|
3974
3985
|
}
|
|
3975
3986
|
}
|
|
3976
3987
|
if (!(l != null && l.getState)) {
|
|
3977
|
-
|
|
3988
|
+
G !== null && _(null), Ie.current = j;
|
|
3978
3989
|
return;
|
|
3979
3990
|
}
|
|
3980
3991
|
let U = !1;
|
|
@@ -3985,16 +3996,16 @@ function tv({
|
|
|
3985
3996
|
}).then((se) => {
|
|
3986
3997
|
if (U) return;
|
|
3987
3998
|
const Q = Vl(se == null ? void 0 : se.state);
|
|
3988
|
-
li(
|
|
3999
|
+
li(G, Q ?? null) || _(Q ?? null);
|
|
3989
4000
|
}).catch((se) => {
|
|
3990
|
-
U || (console.warn("[ChatSessionProvider] Failed to inspect thread state for interrupts:", se),
|
|
4001
|
+
U || (console.warn("[ChatSessionProvider] Failed to inspect thread state for interrupts:", se), G !== null && _(null));
|
|
3991
4002
|
}), () => {
|
|
3992
4003
|
U = !0;
|
|
3993
4004
|
};
|
|
3994
4005
|
}, [
|
|
3995
4006
|
me,
|
|
3996
4007
|
l,
|
|
3997
|
-
|
|
4008
|
+
G,
|
|
3998
4009
|
te.lastCheckpointId,
|
|
3999
4010
|
te.lastCheckpointNs,
|
|
4000
4011
|
te.messages,
|
|
@@ -4020,7 +4031,7 @@ function tv({
|
|
|
4020
4031
|
};
|
|
4021
4032
|
if (be.current.set(Q, En), pe.current = Q, !ge)
|
|
4022
4033
|
return;
|
|
4023
|
-
J.current = Nt, Y(Nt),
|
|
4034
|
+
J.current = Nt, Y(Nt), ie(Nt.length > 0), K(wt);
|
|
4024
4035
|
const Ot = ko(wt, Ge) ?? wt[wt.length - 1] ?? null;
|
|
4025
4036
|
if (oe(Ot), T === "replace") {
|
|
4026
4037
|
const vr = Nn(Ot ?? rt);
|
|
@@ -4041,7 +4052,7 @@ function tv({
|
|
|
4041
4052
|
Oe,
|
|
4042
4053
|
Ue,
|
|
4043
4054
|
K,
|
|
4044
|
-
|
|
4055
|
+
ie,
|
|
4045
4056
|
Y,
|
|
4046
4057
|
oe
|
|
4047
4058
|
]
|
|
@@ -4052,7 +4063,7 @@ function tv({
|
|
|
4052
4063
|
const T = Array.isArray(g.checkpoints) ? g.checkpoints : [];
|
|
4053
4064
|
K(T);
|
|
4054
4065
|
const j = Array.isArray(g.pendingCheckpoints) ? g.pendingCheckpoints : [];
|
|
4055
|
-
J.current = j, Y(j),
|
|
4066
|
+
J.current = j, Y(j), ie(j.length > 0);
|
|
4056
4067
|
const U = {
|
|
4057
4068
|
checkpointId: g.activeCheckpointId ?? null,
|
|
4058
4069
|
checkpointNs: g.activeCheckpointNs ?? null
|
|
@@ -4068,7 +4079,7 @@ function tv({
|
|
|
4068
4079
|
Ue,
|
|
4069
4080
|
K,
|
|
4070
4081
|
Y,
|
|
4071
|
-
|
|
4082
|
+
ie,
|
|
4072
4083
|
oe,
|
|
4073
4084
|
J
|
|
4074
4085
|
]
|
|
@@ -4105,7 +4116,7 @@ function tv({
|
|
|
4105
4116
|
g && (be.current.delete(g), v(g), pe.current === g && (pe.current = null));
|
|
4106
4117
|
}, [v]), rn = Ne(() => {
|
|
4107
4118
|
const g = _e.current;
|
|
4108
|
-
g && Gt(g), Je([]),
|
|
4119
|
+
g && Gt(g), Je([]), ie(!1), Ce(!1), K([]), Y([]), J.current = [], oe(null);
|
|
4109
4120
|
}, [Gt, Je]), Hn = Ne(({ from: g, to: T }) => {
|
|
4110
4121
|
const j = _e.current;
|
|
4111
4122
|
j && console.warn(
|
|
@@ -4140,10 +4151,10 @@ function tv({
|
|
|
4140
4151
|
messageCount: ge
|
|
4141
4152
|
};
|
|
4142
4153
|
_e.current !== j && (!_e.current && te.messages.length <= 1 && (he.current = j), k(j)), ru(() => {
|
|
4143
|
-
|
|
4154
|
+
z(Se);
|
|
4144
4155
|
});
|
|
4145
4156
|
},
|
|
4146
|
-
[te.messages.length, I.length,
|
|
4157
|
+
[te.messages.length, I.length, z]
|
|
4147
4158
|
), { startStream: hr, stop: In, isStreaming: on, error: Pt, setAuthToken: sn } = Bx({
|
|
4148
4159
|
baseUrl: d,
|
|
4149
4160
|
onThreadInfo: zr,
|
|
@@ -4183,7 +4194,7 @@ function tv({
|
|
|
4183
4194
|
he.current = null;
|
|
4184
4195
|
return;
|
|
4185
4196
|
}
|
|
4186
|
-
if (
|
|
4197
|
+
if (le.current === g && !U)
|
|
4187
4198
|
return;
|
|
4188
4199
|
k((Se) => Se === g ? Se : g), _e.current = g;
|
|
4189
4200
|
const ee = !U && !T && !j;
|
|
@@ -4198,7 +4209,7 @@ function tv({
|
|
|
4198
4209
|
}
|
|
4199
4210
|
}
|
|
4200
4211
|
const Q = U || !se || !!T || !!j, ge = async (Se) => {
|
|
4201
|
-
Se && H(!0),
|
|
4212
|
+
Se && H(!0), le.current = g;
|
|
4202
4213
|
try {
|
|
4203
4214
|
const Re = await l.getStateHistory({
|
|
4204
4215
|
threadId: g,
|
|
@@ -4209,7 +4220,7 @@ function tv({
|
|
|
4209
4220
|
} catch (Re) {
|
|
4210
4221
|
throw (!se || U || Se) && (i == null || i(String(Re))), D(String(Re)), Re;
|
|
4211
4222
|
} finally {
|
|
4212
|
-
|
|
4223
|
+
le.current = null, Se && H(!1);
|
|
4213
4224
|
}
|
|
4214
4225
|
};
|
|
4215
4226
|
Q ? await ge(!0) : ee && se && ge(!1).catch((Se) => {
|
|
@@ -4296,7 +4307,7 @@ function tv({
|
|
|
4296
4307
|
if (we) return;
|
|
4297
4308
|
const g = J.current;
|
|
4298
4309
|
if (!g.length) {
|
|
4299
|
-
|
|
4310
|
+
ie(!1);
|
|
4300
4311
|
return;
|
|
4301
4312
|
}
|
|
4302
4313
|
const [T, ...j] = g;
|
|
@@ -4317,7 +4328,7 @@ function tv({
|
|
|
4317
4328
|
}
|
|
4318
4329
|
), D(null);
|
|
4319
4330
|
} catch (U) {
|
|
4320
|
-
throw J.current = [T, ...J.current], Y(J.current),
|
|
4331
|
+
throw J.current = [T, ...J.current], Y(J.current), ie(!0), D(String(U)), U;
|
|
4321
4332
|
} finally {
|
|
4322
4333
|
Ce(!1);
|
|
4323
4334
|
}
|
|
@@ -4362,7 +4373,7 @@ function tv({
|
|
|
4362
4373
|
});
|
|
4363
4374
|
},
|
|
4364
4375
|
[ft]
|
|
4365
|
-
),
|
|
4376
|
+
), ae = Ne(
|
|
4366
4377
|
async (g, T) => {
|
|
4367
4378
|
var En;
|
|
4368
4379
|
const j = _e.current, U = (g == null ? void 0 : g.text) ?? "", ee = (g == null ? void 0 : g.attachments) ?? [], se = ee.length ? ee : (T == null ? void 0 : T.attachments) ?? [], Q = {
|
|
@@ -4532,7 +4543,7 @@ function tv({
|
|
|
4532
4543
|
currentThreadId: C,
|
|
4533
4544
|
setCurrentThreadId: k,
|
|
4534
4545
|
isLoading: R,
|
|
4535
|
-
error:
|
|
4546
|
+
error: N,
|
|
4536
4547
|
actions: {
|
|
4537
4548
|
createThread: Rn,
|
|
4538
4549
|
deleteThread: Un,
|
|
@@ -4540,19 +4551,19 @@ function tv({
|
|
|
4540
4551
|
refreshThreads: () => A()
|
|
4541
4552
|
},
|
|
4542
4553
|
persistThreadsCache: V,
|
|
4543
|
-
hydrateFromCache:
|
|
4554
|
+
hydrateFromCache: E
|
|
4544
4555
|
}),
|
|
4545
4556
|
[
|
|
4546
4557
|
I,
|
|
4547
4558
|
C,
|
|
4548
4559
|
R,
|
|
4549
|
-
|
|
4560
|
+
N,
|
|
4550
4561
|
Rn,
|
|
4551
4562
|
Un,
|
|
4552
4563
|
pr,
|
|
4553
4564
|
A,
|
|
4554
4565
|
V,
|
|
4555
|
-
|
|
4566
|
+
E,
|
|
4556
4567
|
k
|
|
4557
4568
|
]
|
|
4558
4569
|
), an = dt(() => {
|
|
@@ -4564,17 +4575,17 @@ function tv({
|
|
|
4564
4575
|
return {
|
|
4565
4576
|
threadId: C,
|
|
4566
4577
|
messages: te.messages,
|
|
4567
|
-
interrupt:
|
|
4578
|
+
interrupt: G,
|
|
4568
4579
|
checkpoint: {
|
|
4569
4580
|
id: te.lastCheckpointId ?? null,
|
|
4570
4581
|
namespace: te.lastCheckpointNs ?? null
|
|
4571
4582
|
},
|
|
4572
4583
|
checkpoints: de,
|
|
4573
4584
|
metadata: j,
|
|
4574
|
-
isLoading:
|
|
4585
|
+
isLoading: B,
|
|
4575
4586
|
isHistoryLoading: we,
|
|
4576
4587
|
error: M,
|
|
4577
|
-
hasMore:
|
|
4588
|
+
hasMore: X,
|
|
4578
4589
|
loadOlder: gr,
|
|
4579
4590
|
seedFromSnapshot: xr,
|
|
4580
4591
|
clearState: rn,
|
|
@@ -4588,10 +4599,10 @@ function tv({
|
|
|
4588
4599
|
mr,
|
|
4589
4600
|
rn,
|
|
4590
4601
|
C,
|
|
4591
|
-
X,
|
|
4592
4602
|
G,
|
|
4603
|
+
X,
|
|
4593
4604
|
we,
|
|
4594
|
-
|
|
4605
|
+
B,
|
|
4595
4606
|
gr,
|
|
4596
4607
|
Yt,
|
|
4597
4608
|
te.assemblingId,
|
|
@@ -4608,12 +4619,12 @@ function tv({
|
|
|
4608
4619
|
() => ({
|
|
4609
4620
|
isStreaming: on,
|
|
4610
4621
|
error: Pt,
|
|
4611
|
-
submit:
|
|
4622
|
+
submit: ae,
|
|
4612
4623
|
stop: In,
|
|
4613
4624
|
resume: Me,
|
|
4614
4625
|
setAuthToken: sn
|
|
4615
4626
|
}),
|
|
4616
|
-
[on, Pt,
|
|
4627
|
+
[on, Pt, ae, In, Me, sn]
|
|
4617
4628
|
);
|
|
4618
4629
|
return /* @__PURE__ */ c.jsx(ev.Provider, { value: !0, children: /* @__PURE__ */ c.jsx(Ku.Provider, { value: Kn, children: /* @__PURE__ */ c.jsx(Wu.Provider, { value: ut, children: /* @__PURE__ */ c.jsx(Vu.Provider, { value: an, children: e }) }) }) });
|
|
4619
4630
|
}
|
|
@@ -4734,15 +4745,15 @@ function ov({
|
|
|
4734
4745
|
p(e ?? ""), x.current && (x.current.style.height = "auto", x.current.style.height = `${x.current.scrollHeight}px`);
|
|
4735
4746
|
}, [e, t]);
|
|
4736
4747
|
const v = q.useCallback(() => {
|
|
4737
|
-
const
|
|
4738
|
-
|
|
4748
|
+
const N = x.current;
|
|
4749
|
+
N && (N.style.height = "auto", N.style.height = `${N.scrollHeight}px`);
|
|
4739
4750
|
}, []);
|
|
4740
4751
|
q.useEffect(() => {
|
|
4741
4752
|
v();
|
|
4742
4753
|
}, [v]);
|
|
4743
4754
|
const b = q.useCallback(
|
|
4744
|
-
async (
|
|
4745
|
-
|
|
4755
|
+
async (N) => {
|
|
4756
|
+
N && N.preventDefault();
|
|
4746
4757
|
const A = (h ?? "").trim();
|
|
4747
4758
|
!A && !f || w(() => {
|
|
4748
4759
|
try {
|
|
@@ -4756,15 +4767,15 @@ function ov({
|
|
|
4756
4767
|
});
|
|
4757
4768
|
},
|
|
4758
4769
|
[h, i, f]
|
|
4759
|
-
), S = q.useCallback((
|
|
4760
|
-
p(
|
|
4770
|
+
), S = q.useCallback((N) => {
|
|
4771
|
+
p(N.target.value), x.current && (x.current.style.height = "auto", x.current.style.height = `${x.current.scrollHeight}px`);
|
|
4761
4772
|
}, []), I = q.useCallback(
|
|
4762
|
-
(
|
|
4763
|
-
|
|
4773
|
+
(N) => {
|
|
4774
|
+
N.key === "Enter" && !N.shiftKey ? (N.preventDefault(), b()) : N.key === "Escape" && t && (N.preventDefault(), a == null || a());
|
|
4764
4775
|
},
|
|
4765
4776
|
[b, t, a]
|
|
4766
4777
|
), R = `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${t ? "border-[hsl(var(--ring))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))] dark:bg-[hsl(var(--card))] dark:text-[hsl(var(--card-foreground))]" : ""} ${d}`;
|
|
4767
|
-
return /* @__PURE__ */ c.jsx("form", { onSubmit: (
|
|
4778
|
+
return /* @__PURE__ */ c.jsx("form", { onSubmit: (N) => void b(N), className: `w-full ${u}`, children: /* @__PURE__ */ c.jsxs("div", { className: "flex items-end gap-2", children: [
|
|
4768
4779
|
/* @__PURE__ */ c.jsx("div", { className: "flex-1", children: /* @__PURE__ */ c.jsx(
|
|
4769
4780
|
qu,
|
|
4770
4781
|
{
|
|
@@ -4886,7 +4897,7 @@ function Ae(e) {
|
|
|
4886
4897
|
e(n) && t(n);
|
|
4887
4898
|
};
|
|
4888
4899
|
}
|
|
4889
|
-
function
|
|
4900
|
+
function ce(e) {
|
|
4890
4901
|
return (t) => Yu(t, e);
|
|
4891
4902
|
}
|
|
4892
4903
|
function cn(e) {
|
|
@@ -5192,13 +5203,13 @@ const It = qe(
|
|
|
5192
5203
|
return ve(
|
|
5193
5204
|
W(
|
|
5194
5205
|
e,
|
|
5195
|
-
|
|
5206
|
+
ce(({ scrollTop: x }) => x)
|
|
5196
5207
|
),
|
|
5197
5208
|
t
|
|
5198
5209
|
), ve(
|
|
5199
5210
|
W(
|
|
5200
5211
|
e,
|
|
5201
|
-
|
|
5212
|
+
ce(({ scrollHeight: x }) => x)
|
|
5202
5213
|
),
|
|
5203
5214
|
i
|
|
5204
5215
|
), ve(t, o), {
|
|
@@ -5547,7 +5558,7 @@ const Nv = {
|
|
|
5547
5558
|
current: [],
|
|
5548
5559
|
prev: []
|
|
5549
5560
|
}),
|
|
5550
|
-
|
|
5561
|
+
ce(({ prev: C }) => C)
|
|
5551
5562
|
),
|
|
5552
5563
|
[]
|
|
5553
5564
|
);
|
|
@@ -5556,12 +5567,12 @@ const Nv = {
|
|
|
5556
5567
|
l,
|
|
5557
5568
|
Ae((C) => C.length > 0),
|
|
5558
5569
|
Fe(w, p),
|
|
5559
|
-
|
|
5560
|
-
const
|
|
5570
|
+
ce(([C, k, R]) => {
|
|
5571
|
+
const N = C.reduce((A, O, L) => Lt(A, O, no(O, k.offsetTree, R) || L), kr());
|
|
5561
5572
|
return {
|
|
5562
5573
|
...k,
|
|
5563
5574
|
groupIndices: C,
|
|
5564
|
-
groupOffsetTree:
|
|
5575
|
+
groupOffsetTree: N
|
|
5565
5576
|
};
|
|
5566
5577
|
})
|
|
5567
5578
|
),
|
|
@@ -5571,7 +5582,7 @@ const Nv = {
|
|
|
5571
5582
|
r,
|
|
5572
5583
|
Fe(w),
|
|
5573
5584
|
Ae(([C, { lastIndex: k }]) => C < k),
|
|
5574
|
-
|
|
5585
|
+
ce(([C, { lastIndex: k, lastSize: R }]) => [
|
|
5575
5586
|
{
|
|
5576
5587
|
endIndex: k,
|
|
5577
5588
|
size: R,
|
|
@@ -5584,7 +5595,7 @@ const Nv = {
|
|
|
5584
5595
|
const v = Tt(
|
|
5585
5596
|
W(
|
|
5586
5597
|
u,
|
|
5587
|
-
|
|
5598
|
+
ce((C) => C === void 0)
|
|
5588
5599
|
),
|
|
5589
5600
|
!0
|
|
5590
5601
|
);
|
|
@@ -5592,7 +5603,7 @@ const Nv = {
|
|
|
5592
5603
|
W(
|
|
5593
5604
|
d,
|
|
5594
5605
|
Ae((C) => C !== void 0 && et(mt(w).sizeTree)),
|
|
5595
|
-
|
|
5606
|
+
ce((C) => [{ endIndex: 0, size: C, startIndex: 0 }])
|
|
5596
5607
|
),
|
|
5597
5608
|
n
|
|
5598
5609
|
);
|
|
@@ -5607,7 +5618,7 @@ const Nv = {
|
|
|
5607
5618
|
}),
|
|
5608
5619
|
{ changed: !1, sizes: y }
|
|
5609
5620
|
),
|
|
5610
|
-
|
|
5621
|
+
ce((C) => C.changed)
|
|
5611
5622
|
)
|
|
5612
5623
|
);
|
|
5613
5624
|
Ye(
|
|
@@ -5617,7 +5628,7 @@ const Nv = {
|
|
|
5617
5628
|
(C, k) => ({ diff: C.prev - k, prev: k }),
|
|
5618
5629
|
{ diff: 0, prev: 0 }
|
|
5619
5630
|
),
|
|
5620
|
-
|
|
5631
|
+
ce((C) => C.diff)
|
|
5621
5632
|
),
|
|
5622
5633
|
(C) => {
|
|
5623
5634
|
const { groupIndices: k } = mt(w);
|
|
@@ -5640,44 +5651,44 @@ const Nv = {
|
|
|
5640
5651
|
W(
|
|
5641
5652
|
s,
|
|
5642
5653
|
Fe(w),
|
|
5643
|
-
|
|
5644
|
-
const R = k.groupIndices.length > 0,
|
|
5654
|
+
ce(([C, k]) => {
|
|
5655
|
+
const R = k.groupIndices.length > 0, N = [], A = k.lastSize;
|
|
5645
5656
|
if (R) {
|
|
5646
5657
|
const O = eo(k.sizeTree, 0);
|
|
5647
5658
|
let L = 0, F = 0;
|
|
5648
5659
|
for (; L < C; ) {
|
|
5649
|
-
const
|
|
5650
|
-
|
|
5651
|
-
endIndex:
|
|
5660
|
+
const E = k.groupIndices[F], z = k.groupIndices.length === F + 1 ? 1 / 0 : k.groupIndices[F + 1] - E - 1;
|
|
5661
|
+
N.push({
|
|
5662
|
+
endIndex: E,
|
|
5652
5663
|
size: O,
|
|
5653
|
-
startIndex:
|
|
5654
|
-
}),
|
|
5655
|
-
endIndex:
|
|
5664
|
+
startIndex: E
|
|
5665
|
+
}), N.push({
|
|
5666
|
+
endIndex: E + 1 + z - 1,
|
|
5656
5667
|
size: A,
|
|
5657
|
-
startIndex:
|
|
5658
|
-
}), F++, L +=
|
|
5668
|
+
startIndex: E + 1
|
|
5669
|
+
}), F++, L += z + 1;
|
|
5659
5670
|
}
|
|
5660
5671
|
const V = Jn(k.sizeTree);
|
|
5661
5672
|
return L !== C && V.shift(), V.reduce(
|
|
5662
|
-
(
|
|
5663
|
-
let H =
|
|
5664
|
-
return
|
|
5665
|
-
...
|
|
5673
|
+
(E, { k: z, v: B }) => {
|
|
5674
|
+
let H = E.ranges;
|
|
5675
|
+
return E.prevSize !== 0 && (H = [
|
|
5676
|
+
...E.ranges,
|
|
5666
5677
|
{
|
|
5667
|
-
endIndex:
|
|
5668
|
-
size:
|
|
5669
|
-
startIndex:
|
|
5678
|
+
endIndex: z + C - 1,
|
|
5679
|
+
size: E.prevSize,
|
|
5680
|
+
startIndex: E.prevIndex
|
|
5670
5681
|
}
|
|
5671
5682
|
]), {
|
|
5672
|
-
prevIndex:
|
|
5673
|
-
prevSize:
|
|
5683
|
+
prevIndex: z + C,
|
|
5684
|
+
prevSize: B,
|
|
5674
5685
|
ranges: H
|
|
5675
5686
|
};
|
|
5676
5687
|
},
|
|
5677
5688
|
{
|
|
5678
5689
|
prevIndex: C,
|
|
5679
5690
|
prevSize: 0,
|
|
5680
|
-
ranges:
|
|
5691
|
+
ranges: N
|
|
5681
5692
|
}
|
|
5682
5693
|
).ranges;
|
|
5683
5694
|
}
|
|
@@ -5701,9 +5712,9 @@ const Nv = {
|
|
|
5701
5712
|
W(
|
|
5702
5713
|
i,
|
|
5703
5714
|
Fe(w, p),
|
|
5704
|
-
|
|
5705
|
-
const
|
|
5706
|
-
return no(
|
|
5715
|
+
ce(([C, { offsetTree: k }, R]) => {
|
|
5716
|
+
const N = -C;
|
|
5717
|
+
return no(N, k, R);
|
|
5707
5718
|
})
|
|
5708
5719
|
)
|
|
5709
5720
|
);
|
|
@@ -5711,11 +5722,11 @@ const Nv = {
|
|
|
5711
5722
|
W(
|
|
5712
5723
|
i,
|
|
5713
5724
|
Fe(w, p),
|
|
5714
|
-
|
|
5725
|
+
ce(([C, k, R]) => {
|
|
5715
5726
|
if (k.groupIndices.length > 0) {
|
|
5716
5727
|
if (et(k.sizeTree))
|
|
5717
5728
|
return k;
|
|
5718
|
-
let
|
|
5729
|
+
let N = kr();
|
|
5719
5730
|
const A = mt(x);
|
|
5720
5731
|
let O = 0, L = 0, F = 0;
|
|
5721
5732
|
for (; O < -C; ) {
|
|
@@ -5723,23 +5734,23 @@ const Nv = {
|
|
|
5723
5734
|
const V = A[L + 1] - F - 1;
|
|
5724
5735
|
L++, O += V + 1;
|
|
5725
5736
|
}
|
|
5726
|
-
if (
|
|
5737
|
+
if (N = Jn(k.sizeTree).reduce((V, { k: E, v: z }) => Lt(V, Math.max(0, E + C), z), N), O !== -C) {
|
|
5727
5738
|
const V = eo(k.sizeTree, F);
|
|
5728
|
-
|
|
5729
|
-
const
|
|
5730
|
-
|
|
5739
|
+
N = Lt(N, 0, V);
|
|
5740
|
+
const E = Zt(k.sizeTree, -C + 1)[1];
|
|
5741
|
+
N = Lt(N, 1, E);
|
|
5731
5742
|
}
|
|
5732
5743
|
return {
|
|
5733
5744
|
...k,
|
|
5734
|
-
sizeTree:
|
|
5735
|
-
...qi(k.offsetTree, 0,
|
|
5745
|
+
sizeTree: N,
|
|
5746
|
+
...qi(k.offsetTree, 0, N, R)
|
|
5736
5747
|
};
|
|
5737
5748
|
} else {
|
|
5738
|
-
const
|
|
5749
|
+
const N = Jn(k.sizeTree).reduce((A, { k: O, v: L }) => Lt(A, Math.max(0, O + C), L), kr());
|
|
5739
5750
|
return {
|
|
5740
5751
|
...k,
|
|
5741
|
-
sizeTree:
|
|
5742
|
-
...qi(k.offsetTree, 0,
|
|
5752
|
+
sizeTree: N,
|
|
5753
|
+
...qi(k.offsetTree, 0, N, R)
|
|
5743
5754
|
};
|
|
5744
5755
|
}
|
|
5745
5756
|
})
|
|
@@ -5781,26 +5792,26 @@ function Av(e) {
|
|
|
5781
5792
|
}
|
|
5782
5793
|
const ad = qe(
|
|
5783
5794
|
([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
|
|
5784
|
-
const s = He(), i = He(), a = Ft(W(s,
|
|
5795
|
+
const s = He(), i = He(), a = Ft(W(s, ce(Av)));
|
|
5785
5796
|
return ve(
|
|
5786
5797
|
W(
|
|
5787
5798
|
a,
|
|
5788
|
-
|
|
5799
|
+
ce((l) => l.totalCount)
|
|
5789
5800
|
),
|
|
5790
5801
|
n
|
|
5791
5802
|
), ve(
|
|
5792
5803
|
W(
|
|
5793
5804
|
a,
|
|
5794
|
-
|
|
5805
|
+
ce((l) => l.groupIndices)
|
|
5795
5806
|
),
|
|
5796
5807
|
e
|
|
5797
5808
|
), ve(
|
|
5798
5809
|
W(
|
|
5799
5810
|
xt(o, t, r),
|
|
5800
5811
|
Ae(([l, u]) => Ns(u)),
|
|
5801
|
-
|
|
5812
|
+
ce(([l, u, d]) => Zt(u.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
|
|
5802
5813
|
it(),
|
|
5803
|
-
|
|
5814
|
+
ce((l) => [l])
|
|
5804
5815
|
),
|
|
5805
5816
|
i
|
|
5806
5817
|
), { groupCounts: s, topItemsIndexes: i };
|
|
@@ -5851,31 +5862,31 @@ const go = qe(
|
|
|
5851
5862
|
p,
|
|
5852
5863
|
Fe(n, f, r, w, a, i, h),
|
|
5853
5864
|
Fe(e, s, o),
|
|
5854
|
-
|
|
5865
|
+
ce(
|
|
5855
5866
|
([
|
|
5856
|
-
[I, C, k, R,
|
|
5867
|
+
[I, C, k, R, N, A, O, L],
|
|
5857
5868
|
F,
|
|
5858
5869
|
V,
|
|
5859
|
-
|
|
5870
|
+
E
|
|
5860
5871
|
]) => {
|
|
5861
|
-
const
|
|
5862
|
-
let _ = no(
|
|
5863
|
-
|
|
5864
|
-
const
|
|
5865
|
-
S(),
|
|
5872
|
+
const z = ld(I), { align: B, behavior: H, offset: M } = z, D = R - 1, G = id(z, C, D);
|
|
5873
|
+
let _ = no(G, C.offsetTree, F) + A;
|
|
5874
|
+
B === "end" ? (_ += V + Zt(C.sizeTree, G)[1] - k + E, G === D && (_ += O)) : B === "center" ? _ += (V + Zt(C.sizeTree, G)[1] - k + E) / 2 : _ -= N, M && (_ += M);
|
|
5875
|
+
const X = (ie) => {
|
|
5876
|
+
S(), ie ? (L("retrying to scroll to", { location: I }, jt.DEBUG), Le(p, I)) : (Le(y, !0), L("list did not change, scroll successful", {}, jt.DEBUG));
|
|
5866
5877
|
};
|
|
5867
5878
|
if (S(), H === "smooth") {
|
|
5868
|
-
let
|
|
5879
|
+
let ie = !1;
|
|
5869
5880
|
b = Ye(t, (we) => {
|
|
5870
|
-
|
|
5881
|
+
ie = ie || we;
|
|
5871
5882
|
}), x = Jt(d, () => {
|
|
5872
|
-
|
|
5883
|
+
X(ie);
|
|
5873
5884
|
});
|
|
5874
5885
|
} else
|
|
5875
|
-
x = Jt(W(t, jv(150)),
|
|
5886
|
+
x = Jt(W(t, jv(150)), X);
|
|
5876
5887
|
return v = setTimeout(() => {
|
|
5877
5888
|
S();
|
|
5878
|
-
}, 1200), Le(l, !0), L("scrolling from index to", { behavior: H, index:
|
|
5889
|
+
}, 1200), Le(l, !0), L("scrolling from index to", { behavior: H, index: G, top: _ }, jt.DEBUG), { behavior: H, top: _ };
|
|
5879
5890
|
}
|
|
5880
5891
|
)
|
|
5881
5892
|
),
|
|
@@ -5978,7 +5989,7 @@ const ro = "up", qr = "down", Pv = "none", Ov = {
|
|
|
5978
5989
|
ve(
|
|
5979
5990
|
W(
|
|
5980
5991
|
xt(Ee(o), Ee(f)),
|
|
5981
|
-
|
|
5992
|
+
ce(([b, S]) => b <= S),
|
|
5982
5993
|
it()
|
|
5983
5994
|
),
|
|
5984
5995
|
a
|
|
@@ -5986,8 +5997,8 @@ const ro = "up", qr = "down", Pv = "none", Ov = {
|
|
|
5986
5997
|
const y = Ft(
|
|
5987
5998
|
W(
|
|
5988
5999
|
xt(r, Ee(s), Ee(t), Ee(e), Ee(d)),
|
|
5989
|
-
dn((b, [{ scrollHeight: S, scrollTop: I }, C, k, R,
|
|
5990
|
-
const A = I + C - S > -
|
|
6000
|
+
dn((b, [{ scrollHeight: S, scrollTop: I }, C, k, R, N]) => {
|
|
6001
|
+
const A = I + C - S > -N, O = {
|
|
5991
6002
|
scrollHeight: S,
|
|
5992
6003
|
scrollTop: I,
|
|
5993
6004
|
viewportHeight: C
|
|
@@ -6040,14 +6051,14 @@ const ro = "up", qr = "down", Pv = "none", Ov = {
|
|
|
6040
6051
|
{ changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 }
|
|
6041
6052
|
),
|
|
6042
6053
|
Ae((b) => b.changed),
|
|
6043
|
-
|
|
6054
|
+
ce((b) => b.jump)
|
|
6044
6055
|
),
|
|
6045
6056
|
0
|
|
6046
6057
|
);
|
|
6047
6058
|
ve(
|
|
6048
6059
|
W(
|
|
6049
6060
|
y,
|
|
6050
|
-
|
|
6061
|
+
ce((b) => b.atBottom)
|
|
6051
6062
|
),
|
|
6052
6063
|
i
|
|
6053
6064
|
), ve(W(i, Sn(50)), l);
|
|
@@ -6055,13 +6066,13 @@ const ro = "up", qr = "down", Pv = "none", Ov = {
|
|
|
6055
6066
|
ve(
|
|
6056
6067
|
W(
|
|
6057
6068
|
r,
|
|
6058
|
-
|
|
6069
|
+
ce(({ scrollTop: b }) => b),
|
|
6059
6070
|
it(),
|
|
6060
6071
|
dn(
|
|
6061
6072
|
(b, S) => mt(p) ? { direction: b.direction, prevScrollTop: S } : { direction: S < b.prevScrollTop ? ro : qr, prevScrollTop: S },
|
|
6062
6073
|
{ direction: qr, prevScrollTop: 0 }
|
|
6063
6074
|
),
|
|
6064
|
-
|
|
6075
|
+
ce((b) => b.direction)
|
|
6065
6076
|
),
|
|
6066
6077
|
x
|
|
6067
6078
|
), ve(W(r, Sn(50), cn(Pv)), x);
|
|
@@ -6080,7 +6091,7 @@ const ro = "up", qr = "down", Pv = "none", Ov = {
|
|
|
6080
6091
|
Fe(h),
|
|
6081
6092
|
Ae(([b, S]) => !!S),
|
|
6082
6093
|
dn(([b, S], [I]) => [S, I], [0, 0]),
|
|
6083
|
-
|
|
6094
|
+
ce(([b, S]) => S - b)
|
|
6084
6095
|
),
|
|
6085
6096
|
v
|
|
6086
6097
|
), {
|
|
@@ -6119,7 +6130,7 @@ const Aa = qe(
|
|
|
6119
6130
|
Ee(e),
|
|
6120
6131
|
Ee(a)
|
|
6121
6132
|
),
|
|
6122
|
-
|
|
6133
|
+
ce(
|
|
6123
6134
|
([
|
|
6124
6135
|
d,
|
|
6125
6136
|
f,
|
|
@@ -6133,9 +6144,9 @@ const Aa = qe(
|
|
|
6133
6144
|
]) => {
|
|
6134
6145
|
const I = d - b, C = x + v, k = Math.max(h - I, 0);
|
|
6135
6146
|
let R = ec;
|
|
6136
|
-
const
|
|
6137
|
-
return p -= b, p += h + v, y += h + v, y -= b, p > d + C -
|
|
6138
|
-
Math.max(I - h - tc(w, ns, R) -
|
|
6147
|
+
const N = nc(S, ns), A = nc(S, rs);
|
|
6148
|
+
return p -= b, p += h + v, y += h + v, y -= b, p > d + C - N && (R = ro), y < d - k + f + A && (R = qr), R !== ec ? [
|
|
6149
|
+
Math.max(I - h - tc(w, ns, R) - N, 0),
|
|
6139
6150
|
I - k - v + f + tc(w, rs, R) + A
|
|
6140
6151
|
] : null;
|
|
6141
6152
|
}
|
|
@@ -6270,70 +6281,70 @@ const cr = qe(
|
|
|
6270
6281
|
Ee(n),
|
|
6271
6282
|
e
|
|
6272
6283
|
),
|
|
6273
|
-
Ae(([k, R, ,
|
|
6274
|
-
const O = A && A.length !==
|
|
6284
|
+
Ae(([k, R, , N, , , , , , , A]) => {
|
|
6285
|
+
const O = A && A.length !== N;
|
|
6275
6286
|
return k && !R && !O;
|
|
6276
6287
|
}),
|
|
6277
|
-
|
|
6288
|
+
ce(
|
|
6278
6289
|
([
|
|
6279
6290
|
,
|
|
6280
6291
|
,
|
|
6281
6292
|
[k, R],
|
|
6282
|
-
|
|
6293
|
+
N,
|
|
6283
6294
|
A,
|
|
6284
6295
|
O,
|
|
6285
6296
|
L,
|
|
6286
6297
|
F,
|
|
6287
6298
|
V,
|
|
6288
|
-
|
|
6289
|
-
|
|
6299
|
+
E,
|
|
6300
|
+
z
|
|
6290
6301
|
]) => {
|
|
6291
|
-
const
|
|
6292
|
-
if (
|
|
6293
|
-
return { ...mi, totalCount:
|
|
6302
|
+
const B = A, { offsetTree: H, sizeTree: M } = B, D = mt(x);
|
|
6303
|
+
if (N === 0)
|
|
6304
|
+
return { ...mi, totalCount: N };
|
|
6294
6305
|
if (k === 0 && R === 0)
|
|
6295
|
-
return D === 0 ? { ...mi, totalCount:
|
|
6306
|
+
return D === 0 ? { ...mi, totalCount: N } : ud(D, O, A, V, E, z || []);
|
|
6296
6307
|
if (et(M))
|
|
6297
6308
|
return D > 0 ? null : Ho(
|
|
6298
|
-
Dv(Na(O,
|
|
6309
|
+
Dv(Na(O, N), B, z),
|
|
6299
6310
|
[],
|
|
6300
|
-
E,
|
|
6301
6311
|
N,
|
|
6302
|
-
|
|
6312
|
+
E,
|
|
6313
|
+
B,
|
|
6303
6314
|
V
|
|
6304
6315
|
);
|
|
6305
|
-
const
|
|
6316
|
+
const G = [];
|
|
6306
6317
|
if (F.length > 0) {
|
|
6307
6318
|
const Ce = F[0], de = F[F.length - 1];
|
|
6308
6319
|
let K = 0;
|
|
6309
6320
|
for (const $ of Es(M, Ce, de)) {
|
|
6310
6321
|
const Y = $.value, J = Math.max($.start, Ce), me = Math.min($.end, de);
|
|
6311
6322
|
for (let oe = J; oe <= me; oe++)
|
|
6312
|
-
|
|
6323
|
+
G.push({ data: z == null ? void 0 : z[oe], index: oe, offset: K, size: Y }), K += Y;
|
|
6313
6324
|
}
|
|
6314
6325
|
}
|
|
6315
6326
|
if (!L)
|
|
6316
|
-
return Ho([],
|
|
6317
|
-
const _ = F.length > 0 ? F[F.length - 1] + 1 : 0,
|
|
6318
|
-
if (
|
|
6327
|
+
return Ho([], G, N, E, B, V);
|
|
6328
|
+
const _ = F.length > 0 ? F[F.length - 1] + 1 : 0, X = kv(H, k, R, _);
|
|
6329
|
+
if (X.length === 0)
|
|
6319
6330
|
return null;
|
|
6320
|
-
const
|
|
6321
|
-
for (const de of
|
|
6331
|
+
const ie = N - 1, we = Rs([], (Ce) => {
|
|
6332
|
+
for (const de of X) {
|
|
6322
6333
|
const K = de.value;
|
|
6323
6334
|
let $ = K.offset, Y = de.start;
|
|
6324
6335
|
const J = K.size;
|
|
6325
6336
|
if (K.offset < k) {
|
|
6326
|
-
Y += Math.floor((k - K.offset +
|
|
6337
|
+
Y += Math.floor((k - K.offset + E) / (J + E));
|
|
6327
6338
|
const oe = Y - de.start;
|
|
6328
|
-
$ += oe * J + oe *
|
|
6339
|
+
$ += oe * J + oe * E;
|
|
6329
6340
|
}
|
|
6330
6341
|
Y < _ && ($ += (_ - Y) * J, Y = _);
|
|
6331
|
-
const me = Math.min(de.end,
|
|
6342
|
+
const me = Math.min(de.end, ie);
|
|
6332
6343
|
for (let oe = Y; oe <= me && !($ >= R); oe++)
|
|
6333
|
-
Ce.push({ data:
|
|
6344
|
+
Ce.push({ data: z == null ? void 0 : z[oe], index: oe, offset: $, size: J }), $ += J + E;
|
|
6334
6345
|
}
|
|
6335
6346
|
});
|
|
6336
|
-
return Ho(we,
|
|
6347
|
+
return Ho(we, G, N, E, B, V);
|
|
6337
6348
|
}
|
|
6338
6349
|
),
|
|
6339
6350
|
//@ts-expect-error filter needs to be fixed
|
|
@@ -6346,25 +6357,25 @@ const cr = qe(
|
|
|
6346
6357
|
W(
|
|
6347
6358
|
e,
|
|
6348
6359
|
Ae(Ca),
|
|
6349
|
-
|
|
6360
|
+
ce((k) => k == null ? void 0 : k.length)
|
|
6350
6361
|
),
|
|
6351
6362
|
o
|
|
6352
6363
|
), ve(
|
|
6353
6364
|
W(
|
|
6354
6365
|
b,
|
|
6355
|
-
|
|
6366
|
+
ce((k) => k.topListHeight)
|
|
6356
6367
|
),
|
|
6357
6368
|
f
|
|
6358
6369
|
), ve(f, a), ve(
|
|
6359
6370
|
W(
|
|
6360
6371
|
b,
|
|
6361
|
-
|
|
6372
|
+
ce((k) => [k.top, k.bottom])
|
|
6362
6373
|
),
|
|
6363
6374
|
i
|
|
6364
6375
|
), ve(
|
|
6365
6376
|
W(
|
|
6366
6377
|
b,
|
|
6367
|
-
|
|
6378
|
+
ce((k) => k.items)
|
|
6368
6379
|
),
|
|
6369
6380
|
v
|
|
6370
6381
|
);
|
|
@@ -6374,30 +6385,30 @@ const cr = qe(
|
|
|
6374
6385
|
Ae(({ items: k }) => k.length > 0),
|
|
6375
6386
|
Fe(o, e),
|
|
6376
6387
|
Ae(([{ items: k }, R]) => k[k.length - 1].originalIndex === R - 1),
|
|
6377
|
-
|
|
6388
|
+
ce(([, k, R]) => [k - 1, R]),
|
|
6378
6389
|
it(to),
|
|
6379
|
-
|
|
6390
|
+
ce(([k]) => k)
|
|
6380
6391
|
)
|
|
6381
6392
|
), I = Ft(
|
|
6382
6393
|
W(
|
|
6383
6394
|
b,
|
|
6384
6395
|
Sn(200),
|
|
6385
6396
|
Ae(({ items: k, topItems: R }) => k.length > 0 && k[0].originalIndex === R.length),
|
|
6386
|
-
|
|
6397
|
+
ce(({ items: k }) => k[0].index),
|
|
6387
6398
|
it()
|
|
6388
6399
|
)
|
|
6389
6400
|
), C = Ft(
|
|
6390
6401
|
W(
|
|
6391
6402
|
b,
|
|
6392
6403
|
Ae(({ items: k }) => k.length > 0),
|
|
6393
|
-
|
|
6394
|
-
let R = 0,
|
|
6395
|
-
for (; k[R].type === "group" && R <
|
|
6404
|
+
ce(({ items: k }) => {
|
|
6405
|
+
let R = 0, N = k.length - 1;
|
|
6406
|
+
for (; k[R].type === "group" && R < N; )
|
|
6396
6407
|
R++;
|
|
6397
|
-
for (; k[
|
|
6398
|
-
|
|
6408
|
+
for (; k[N].type === "group" && N > R; )
|
|
6409
|
+
N--;
|
|
6399
6410
|
return {
|
|
6400
|
-
endIndex: k[
|
|
6411
|
+
endIndex: k[N].index,
|
|
6401
6412
|
startIndex: k[R].index
|
|
6402
6413
|
};
|
|
6403
6414
|
}),
|
|
@@ -6422,7 +6433,7 @@ const cr = qe(
|
|
|
6422
6433
|
const s = He(), i = Tt(
|
|
6423
6434
|
W(
|
|
6424
6435
|
xt(n, e, r, t, o),
|
|
6425
|
-
|
|
6436
|
+
ce(([a, l, u, d, f]) => a + l + u + d + f.offsetBottom + f.bottom)
|
|
6426
6437
|
),
|
|
6427
6438
|
0
|
|
6428
6439
|
);
|
|
@@ -6436,7 +6447,7 @@ const cr = qe(
|
|
|
6436
6447
|
W(
|
|
6437
6448
|
xt(n, e, t),
|
|
6438
6449
|
Ae(([o]) => o),
|
|
6439
|
-
|
|
6450
|
+
ce(([, o, s]) => Math.max(0, o - s)),
|
|
6440
6451
|
Sn(0),
|
|
6441
6452
|
it()
|
|
6442
6453
|
),
|
|
@@ -6466,24 +6477,24 @@ const cr = qe(
|
|
|
6466
6477
|
d,
|
|
6467
6478
|
Fe(t, l, n, s, o, r, a),
|
|
6468
6479
|
Fe(e),
|
|
6469
|
-
|
|
6470
|
-
const { align: I, behavior: C, calculateViewLocation: k = Fv, done: R, ...
|
|
6480
|
+
ce(([[f, h, p, y, w, x, v, b], S]) => {
|
|
6481
|
+
const { align: I, behavior: C, calculateViewLocation: k = Fv, done: R, ...N } = f, A = id(f, h, y - 1), O = no(A, h.offsetTree, S) + w + x, L = O + Zt(h.sizeTree, A)[1], F = b + x, V = b + p - v, E = k({
|
|
6471
6482
|
itemBottom: L,
|
|
6472
6483
|
itemTop: O,
|
|
6473
|
-
locationParams: { align: I, behavior: C, ...
|
|
6484
|
+
locationParams: { align: I, behavior: C, ...N },
|
|
6474
6485
|
viewportBottom: V,
|
|
6475
6486
|
viewportTop: F
|
|
6476
6487
|
});
|
|
6477
|
-
return
|
|
6488
|
+
return E ? R && Jt(
|
|
6478
6489
|
W(
|
|
6479
6490
|
i,
|
|
6480
|
-
Ae((
|
|
6491
|
+
Ae((z) => !z),
|
|
6481
6492
|
// skips the initial publish of false, and the cleanup call.
|
|
6482
6493
|
// but if scrollingInProgress is true, we skip the initial publish.
|
|
6483
6494
|
nr(mt(i) ? 1 : 2)
|
|
6484
6495
|
),
|
|
6485
6496
|
R
|
|
6486
|
-
) : R && R(),
|
|
6497
|
+
) : R && R(), E;
|
|
6487
6498
|
}),
|
|
6488
6499
|
Ae((f) => f !== null)
|
|
6489
6500
|
),
|
|
@@ -6523,9 +6534,9 @@ const $v = (e, t) => typeof e == "function" ? oc(e(t)) : t && oc(e), zv = qe(
|
|
|
6523
6534
|
W(
|
|
6524
6535
|
xt(W(Ee(t), nr(1)), l),
|
|
6525
6536
|
Fe(Ee(y), s, a, f),
|
|
6526
|
-
|
|
6537
|
+
ce(([[C, k], R, N, A, O]) => {
|
|
6527
6538
|
let L = k && A, F = "auto";
|
|
6528
|
-
return L && (F = $v(R,
|
|
6539
|
+
return L && (F = $v(R, N || O), L = L && !!F), { followOutputBehavior: F, shouldFollow: L, totalCount: C };
|
|
6529
6540
|
}),
|
|
6530
6541
|
Ae(({ shouldFollow: C }) => C)
|
|
6531
6542
|
),
|
|
@@ -6567,7 +6578,7 @@ const $v = (e, t) => typeof e == "function" ? oc(e(t)) : t && oc(e), zv = qe(
|
|
|
6567
6578
|
Ui(
|
|
6568
6579
|
W(
|
|
6569
6580
|
Ee(r),
|
|
6570
|
-
|
|
6581
|
+
ce((C) => {
|
|
6571
6582
|
var k;
|
|
6572
6583
|
return (k = C == null ? void 0 : C.length) != null ? k : 0;
|
|
6573
6584
|
})
|
|
@@ -6579,7 +6590,7 @@ const $v = (e, t) => typeof e == "function" ? oc(e(t)) : t && oc(e), zv = qe(
|
|
|
6579
6590
|
W(
|
|
6580
6591
|
xt(W(I, nr(1)), l),
|
|
6581
6592
|
Fe(Ee(S), a, f, h),
|
|
6582
|
-
|
|
6593
|
+
ce(([[C, k], R, N, A, O]) => k && N && (R == null ? void 0 : R({ context: O, totalCount: C, scrollingInProgress: A }))),
|
|
6583
6594
|
Ae((C) => !!C),
|
|
6584
6595
|
Sn(0)
|
|
6585
6596
|
),
|
|
@@ -6610,7 +6621,7 @@ const $v = (e, t) => typeof e == "function" ? oc(e(t)) : t && oc(e), zv = qe(
|
|
|
6610
6621
|
Fe(s),
|
|
6611
6622
|
Ae(([, l]) => l !== 0),
|
|
6612
6623
|
Fe(o, r, t, n, e),
|
|
6613
|
-
|
|
6624
|
+
ce(([[, l], u, d, f, h, p = []]) => ud(l, u, d, f, h, p))
|
|
6614
6625
|
),
|
|
6615
6626
|
i
|
|
6616
6627
|
), {}),
|
|
@@ -6624,7 +6635,7 @@ const $v = (e, t) => typeof e == "function" ? oc(e(t)) : t && oc(e), zv = qe(
|
|
|
6624
6635
|
e,
|
|
6625
6636
|
Fe(r),
|
|
6626
6637
|
Ae(([, o]) => o !== 0),
|
|
6627
|
-
|
|
6638
|
+
ce(([, o]) => ({ top: o }))
|
|
6628
6639
|
),
|
|
6629
6640
|
(o) => {
|
|
6630
6641
|
Jt(
|
|
@@ -6654,7 +6665,7 @@ const $v = (e, t) => typeof e == "function" ? oc(e(t)) : t && oc(e), zv = qe(
|
|
|
6654
6665
|
e,
|
|
6655
6666
|
Fe(r, t, n),
|
|
6656
6667
|
Ae(([o, s]) => !!s),
|
|
6657
|
-
|
|
6668
|
+
ce(([o, s, i, a]) => {
|
|
6658
6669
|
const { enter: l, exit: u } = s;
|
|
6659
6670
|
if (i) {
|
|
6660
6671
|
if (u(o, a))
|
|
@@ -6680,7 +6691,7 @@ const $v = (e, t) => typeof e == "function" ? oc(e(t)) : t && oc(e), zv = qe(
|
|
|
6680
6691
|
return ve(
|
|
6681
6692
|
W(
|
|
6682
6693
|
xt(n, r),
|
|
6683
|
-
|
|
6694
|
+
ce(([{ scrollHeight: a, scrollTop: l, viewportHeight: u }, { offsetTop: d }]) => ({
|
|
6684
6695
|
scrollHeight: a,
|
|
6685
6696
|
scrollTop: Math.max(0, l - d),
|
|
6686
6697
|
viewportHeight: u
|
|
@@ -6691,7 +6702,7 @@ const $v = (e, t) => typeof e == "function" ? oc(e(t)) : t && oc(e), zv = qe(
|
|
|
6691
6702
|
W(
|
|
6692
6703
|
t,
|
|
6693
6704
|
Fe(r),
|
|
6694
|
-
|
|
6705
|
+
ce(([a, { offsetTop: l }]) => ({
|
|
6695
6706
|
...a,
|
|
6696
6707
|
top: a.top + l
|
|
6697
6708
|
}))
|
|
@@ -6725,13 +6736,13 @@ const $v = (e, t) => typeof e == "function" ? oc(e(t)) : t && oc(e), zv = qe(
|
|
|
6725
6736
|
const I = Iv(y.sizeTree);
|
|
6726
6737
|
x && v !== null && b !== null && (w = v.scrollTop - b.offsetTop), w -= S, p({ ranges: I, scrollTop: w });
|
|
6727
6738
|
}
|
|
6728
|
-
), ve(W(d, Ae(Ca),
|
|
6739
|
+
), ve(W(d, Ae(Ca), ce(Wv)), o), ve(
|
|
6729
6740
|
W(
|
|
6730
6741
|
s,
|
|
6731
6742
|
Fe(d),
|
|
6732
6743
|
Ae(([, p]) => p !== void 0),
|
|
6733
6744
|
it(),
|
|
6734
|
-
|
|
6745
|
+
ce(([, p]) => p.ranges)
|
|
6735
6746
|
),
|
|
6736
6747
|
e
|
|
6737
6748
|
), {
|
|
@@ -6750,7 +6761,7 @@ const Vv = qe(([{ topItemsIndexes: e }]) => {
|
|
|
6750
6761
|
W(
|
|
6751
6762
|
t,
|
|
6752
6763
|
Ae((n) => n >= 0),
|
|
6753
|
-
|
|
6764
|
+
ce((n) => Array.from({ length: n }).map((r, o) => o))
|
|
6754
6765
|
),
|
|
6755
6766
|
e
|
|
6756
6767
|
), { topItemCount: t };
|
|
@@ -6773,17 +6784,17 @@ const Kv = md(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
6773
6784
|
l,
|
|
6774
6785
|
Fe(i),
|
|
6775
6786
|
dn(
|
|
6776
|
-
([, v, b, S], [{ bottom: I, items: C, offsetBottom: k, totalCount: R },
|
|
6787
|
+
([, v, b, S], [{ bottom: I, items: C, offsetBottom: k, totalCount: R }, N]) => {
|
|
6777
6788
|
const A = I + k;
|
|
6778
6789
|
let O = 0;
|
|
6779
|
-
return b === R && v.length > 0 && C.length > 0 && (C[0].originalIndex === 0 && v[0].originalIndex === 0 || (O = A - S, O !== 0 && (O +=
|
|
6790
|
+
return b === R && v.length > 0 && C.length > 0 && (C[0].originalIndex === 0 && v[0].originalIndex === 0 || (O = A - S, O !== 0 && (O += N))), [O, C, R, A];
|
|
6780
6791
|
},
|
|
6781
6792
|
[0, [], 0, 0]
|
|
6782
6793
|
),
|
|
6783
6794
|
Ae(([v]) => v !== 0),
|
|
6784
6795
|
Fe(r, a, n, o, p, y),
|
|
6785
6796
|
Ae(([, v, b, S, , , I]) => !I && !S && v !== 0 && b === ro),
|
|
6786
|
-
|
|
6797
|
+
ce(([[v], , , , , b]) => (b("Upward scrolling compensation", { amount: v }, jt.DEBUG), v))
|
|
6787
6798
|
)
|
|
6788
6799
|
);
|
|
6789
6800
|
function x(v) {
|
|
@@ -6795,21 +6806,21 @@ const Kv = md(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
6795
6806
|
W(
|
|
6796
6807
|
xt(Tt(s, !1), e, y),
|
|
6797
6808
|
Ae(([v, b, S]) => !v && !S && b !== 0),
|
|
6798
|
-
|
|
6809
|
+
ce(([v, b]) => b),
|
|
6799
6810
|
Sn(1)
|
|
6800
6811
|
),
|
|
6801
6812
|
x
|
|
6802
6813
|
), ve(
|
|
6803
6814
|
W(
|
|
6804
6815
|
f,
|
|
6805
|
-
|
|
6816
|
+
ce((v) => ({ top: -v }))
|
|
6806
6817
|
),
|
|
6807
6818
|
t
|
|
6808
6819
|
), Ye(
|
|
6809
6820
|
W(
|
|
6810
6821
|
u,
|
|
6811
6822
|
Fe(h, d),
|
|
6812
|
-
|
|
6823
|
+
ce(([v, { groupIndices: b, lastSize: S, sizeTree: I }, C]) => {
|
|
6813
6824
|
function k(R) {
|
|
6814
6825
|
return R * (S + C);
|
|
6815
6826
|
}
|
|
@@ -6817,12 +6828,12 @@ const Kv = md(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
6817
6828
|
return k(v);
|
|
6818
6829
|
{
|
|
6819
6830
|
let R = 0;
|
|
6820
|
-
const
|
|
6831
|
+
const N = eo(I, 0);
|
|
6821
6832
|
let A = 0, O = 0;
|
|
6822
6833
|
for (; A < v; ) {
|
|
6823
|
-
A++, R +=
|
|
6834
|
+
A++, R += N;
|
|
6824
6835
|
let L = b.length === O + 1 ? 1 / 0 : b[O + 1] - b[O] - 1;
|
|
6825
|
-
A + L > v && (R -=
|
|
6836
|
+
A + L > v && (R -= N, L = v - A + 1), A += L, R += k(L), O++;
|
|
6826
6837
|
}
|
|
6827
6838
|
return R;
|
|
6828
6839
|
}
|
|
@@ -6901,12 +6912,12 @@ const Kv = md(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
6901
6912
|
{ scrollToIndex: C },
|
|
6902
6913
|
k,
|
|
6903
6914
|
{ topItemCount: R },
|
|
6904
|
-
{ groupCounts:
|
|
6915
|
+
{ groupCounts: N },
|
|
6905
6916
|
A
|
|
6906
6917
|
]) => (ve(I.rangeChanged, A.scrollSeekRangeChanged), ve(
|
|
6907
6918
|
W(
|
|
6908
6919
|
A.windowViewportRect,
|
|
6909
|
-
|
|
6920
|
+
ce((O) => O.visibleHeight)
|
|
6910
6921
|
),
|
|
6911
6922
|
w.viewportHeight
|
|
6912
6923
|
), {
|
|
@@ -6915,7 +6926,7 @@ const Kv = md(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
6915
6926
|
firstItemIndex: n,
|
|
6916
6927
|
fixedItemHeight: r,
|
|
6917
6928
|
gap: o,
|
|
6918
|
-
groupCounts:
|
|
6929
|
+
groupCounts: N,
|
|
6919
6930
|
initialItemFinalLocationReached: h,
|
|
6920
6931
|
initialTopMostItemIndex: p,
|
|
6921
6932
|
scrolledToInitialItem: y,
|
|
@@ -7112,7 +7123,7 @@ const Jv = /* @__PURE__ */ qe(() => {
|
|
|
7112
7123
|
const e = Z((a) => `Item ${a}`), t = Z((a) => `Group ${a}`), n = Z({}), r = Z(Pa), o = Z("div"), s = Z(Dr), i = (a, l = null) => Tt(
|
|
7113
7124
|
W(
|
|
7114
7125
|
n,
|
|
7115
|
-
|
|
7126
|
+
ce((u) => u[a]),
|
|
7116
7127
|
it()
|
|
7117
7128
|
),
|
|
7118
7129
|
l
|
|
@@ -7149,10 +7160,10 @@ const Jv = /* @__PURE__ */ qe(() => {
|
|
|
7149
7160
|
w,
|
|
7150
7161
|
Pe("skipAnimationFrameInResizeObserver")
|
|
7151
7162
|
), [v, b] = q.useState(0);
|
|
7152
|
-
Oa("deviation", (
|
|
7153
|
-
v !==
|
|
7163
|
+
Oa("deviation", (E) => {
|
|
7164
|
+
v !== E && b(E);
|
|
7154
7165
|
});
|
|
7155
|
-
const S = Pe("EmptyPlaceholder"), I = Pe("ScrollSeekPlaceholder") || Qv, C = Pe("ListComponent"), k = Pe("ItemComponent"), R = Pe("GroupComponent"),
|
|
7166
|
+
const S = Pe("EmptyPlaceholder"), I = Pe("ScrollSeekPlaceholder") || Qv, C = Pe("ListComponent"), k = Pe("ItemComponent"), R = Pe("GroupComponent"), N = Pe("computeItemKey"), A = Pe("isSeeking"), O = Pe("groupIndices").length > 0, L = Pe("alignToBottom"), F = Pe("initialItemFinalLocationReached"), V = e ? {} : {
|
|
7156
7167
|
boxSizing: "border-box",
|
|
7157
7168
|
...w ? {
|
|
7158
7169
|
display: "inline-block",
|
|
@@ -7175,42 +7186,42 @@ const Jv = /* @__PURE__ */ qe(() => {
|
|
|
7175
7186
|
"data-testid": e ? "virtuoso-top-item-list" : "virtuoso-item-list",
|
|
7176
7187
|
ref: x,
|
|
7177
7188
|
style: V,
|
|
7178
|
-
children: (e ? t.topItems : t.items).map((
|
|
7179
|
-
const
|
|
7189
|
+
children: (e ? t.topItems : t.items).map((E) => {
|
|
7190
|
+
const z = E.originalIndex, B = N(z + t.firstItemIndex, E.data, u);
|
|
7180
7191
|
return A ? /* @__PURE__ */ Mo(
|
|
7181
7192
|
I,
|
|
7182
7193
|
{
|
|
7183
7194
|
...kt(I, u),
|
|
7184
|
-
height:
|
|
7185
|
-
index:
|
|
7186
|
-
key:
|
|
7187
|
-
type:
|
|
7188
|
-
...
|
|
7195
|
+
height: E.size,
|
|
7196
|
+
index: E.index,
|
|
7197
|
+
key: B,
|
|
7198
|
+
type: E.type || "item",
|
|
7199
|
+
...E.type === "group" ? {} : { groupIndex: E.groupIndex }
|
|
7189
7200
|
}
|
|
7190
|
-
) :
|
|
7201
|
+
) : E.type === "group" ? /* @__PURE__ */ Mo(
|
|
7191
7202
|
R,
|
|
7192
7203
|
{
|
|
7193
7204
|
...kt(R, u),
|
|
7194
|
-
"data-index":
|
|
7195
|
-
"data-item-index":
|
|
7196
|
-
"data-known-size":
|
|
7197
|
-
key:
|
|
7205
|
+
"data-index": z,
|
|
7206
|
+
"data-item-index": E.index,
|
|
7207
|
+
"data-known-size": E.size,
|
|
7208
|
+
key: B,
|
|
7198
7209
|
style: ew
|
|
7199
7210
|
},
|
|
7200
|
-
d(
|
|
7211
|
+
d(E.index, u)
|
|
7201
7212
|
) : /* @__PURE__ */ Mo(
|
|
7202
7213
|
k,
|
|
7203
7214
|
{
|
|
7204
7215
|
...kt(k, u),
|
|
7205
|
-
...sw(k,
|
|
7206
|
-
"data-index":
|
|
7207
|
-
"data-item-group-index":
|
|
7208
|
-
"data-item-index":
|
|
7209
|
-
"data-known-size":
|
|
7210
|
-
key:
|
|
7216
|
+
...sw(k, E.data),
|
|
7217
|
+
"data-index": z,
|
|
7218
|
+
"data-item-group-index": E.groupIndex,
|
|
7219
|
+
"data-item-index": E.index,
|
|
7220
|
+
"data-known-size": E.size,
|
|
7221
|
+
key: B,
|
|
7211
7222
|
style: w ? tw : Sd
|
|
7212
7223
|
},
|
|
7213
|
-
O ? l(
|
|
7224
|
+
O ? l(E.index, E.groupIndex, E.data, u) : l(E.index, E.data, u)
|
|
7214
7225
|
);
|
|
7215
7226
|
})
|
|
7216
7227
|
}
|
|
@@ -7425,7 +7436,7 @@ const lw = ({ children: e }) => {
|
|
|
7425
7436
|
] })), r = Z(null), o = Z(null), s = Z({}), i = Z(Pa), a = Z(Dr), l = (u, d = null) => Tt(
|
|
7426
7437
|
W(
|
|
7427
7438
|
s,
|
|
7428
|
-
|
|
7439
|
+
ce((f) => f[u]),
|
|
7429
7440
|
it()
|
|
7430
7441
|
),
|
|
7431
7442
|
d
|
|
@@ -7495,7 +7506,7 @@ const yw = /* @__PURE__ */ qe(
|
|
|
7495
7506
|
{ customScrollParent: x, useWindowScroll: v, windowScrollContainerState: b, windowScrollTo: S, windowViewportRect: I },
|
|
7496
7507
|
C
|
|
7497
7508
|
]) => {
|
|
7498
|
-
const k = Z(0), R = Z(0),
|
|
7509
|
+
const k = Z(0), R = Z(0), N = Z(ac), A = Z({ height: 0, width: 0 }), O = Z({ height: 0, width: 0 }), L = He(), F = He(), V = Z(0), E = Z(null), z = Z({ column: 0, row: 0 }), B = He(), H = He(), M = Z(!1), D = Z(0), G = Z(!0), _ = Z(!1), X = Z(!1);
|
|
7499
7510
|
Ye(
|
|
7500
7511
|
W(
|
|
7501
7512
|
y,
|
|
@@ -7503,18 +7514,18 @@ const yw = /* @__PURE__ */ qe(
|
|
|
7503
7514
|
Ae(([$, Y]) => !!Y)
|
|
7504
7515
|
),
|
|
7505
7516
|
() => {
|
|
7506
|
-
Le(
|
|
7517
|
+
Le(G, !1);
|
|
7507
7518
|
}
|
|
7508
7519
|
), Ye(
|
|
7509
7520
|
W(
|
|
7510
|
-
xt(y,
|
|
7521
|
+
xt(y, G, O, A, D, _),
|
|
7511
7522
|
Ae(([$, Y, J, me, , oe]) => $ && !Y && J.height !== 0 && me.height !== 0 && !oe)
|
|
7512
7523
|
),
|
|
7513
7524
|
([, , , , $]) => {
|
|
7514
7525
|
Le(_, !0), Ea(1, () => {
|
|
7515
7526
|
Le(L, $);
|
|
7516
7527
|
}), Jt(W(u), () => {
|
|
7517
|
-
Le(t, [0, 0]), Le(
|
|
7528
|
+
Le(t, [0, 0]), Le(G, !0);
|
|
7518
7529
|
});
|
|
7519
7530
|
}
|
|
7520
7531
|
), ve(
|
|
@@ -7531,14 +7542,14 @@ const yw = /* @__PURE__ */ qe(
|
|
|
7531
7542
|
Ae(([, $]) => $ != null)
|
|
7532
7543
|
),
|
|
7533
7544
|
([, $]) => {
|
|
7534
|
-
$ && (Le(A, $.viewport), Le(O, $.item), Le(
|
|
7545
|
+
$ && (Le(A, $.viewport), Le(O, $.item), Le(z, $.gap), $.scrollTop > 0 && (Le(M, !0), Jt(W(u, nr(1)), (Y) => {
|
|
7535
7546
|
Le(M, !1);
|
|
7536
7547
|
}), Le(l, { top: $.scrollTop })));
|
|
7537
7548
|
}
|
|
7538
7549
|
), ve(
|
|
7539
7550
|
W(
|
|
7540
7551
|
A,
|
|
7541
|
-
|
|
7552
|
+
ce(({ height: $ }) => $)
|
|
7542
7553
|
),
|
|
7543
7554
|
f
|
|
7544
7555
|
), ve(
|
|
@@ -7546,33 +7557,33 @@ const yw = /* @__PURE__ */ qe(
|
|
|
7546
7557
|
xt(
|
|
7547
7558
|
Ee(A, Ro),
|
|
7548
7559
|
Ee(O, Ro),
|
|
7549
|
-
Ee(
|
|
7560
|
+
Ee(z, ($, Y) => $ && $.column === Y.column && $.row === Y.row),
|
|
7550
7561
|
Ee(u)
|
|
7551
7562
|
),
|
|
7552
|
-
|
|
7563
|
+
ce(([$, Y, J, me]) => ({
|
|
7553
7564
|
gap: J,
|
|
7554
7565
|
item: Y,
|
|
7555
7566
|
scrollTop: me,
|
|
7556
7567
|
viewport: $
|
|
7557
7568
|
}))
|
|
7558
7569
|
),
|
|
7559
|
-
|
|
7570
|
+
B
|
|
7560
7571
|
), ve(
|
|
7561
7572
|
W(
|
|
7562
7573
|
xt(
|
|
7563
7574
|
Ee(k),
|
|
7564
7575
|
r,
|
|
7565
|
-
Ee(
|
|
7576
|
+
Ee(z, ww),
|
|
7566
7577
|
Ee(O, Ro),
|
|
7567
7578
|
Ee(A, Ro),
|
|
7568
|
-
Ee(
|
|
7579
|
+
Ee(E),
|
|
7569
7580
|
Ee(R),
|
|
7570
7581
|
Ee(M),
|
|
7571
|
-
Ee(
|
|
7582
|
+
Ee(G),
|
|
7572
7583
|
Ee(D)
|
|
7573
7584
|
),
|
|
7574
7585
|
Ae(([, , , , , , , $]) => !$),
|
|
7575
|
-
|
|
7586
|
+
ce(
|
|
7576
7587
|
([
|
|
7577
7588
|
$,
|
|
7578
7589
|
[Y, J],
|
|
@@ -7592,27 +7603,27 @@ const yw = /* @__PURE__ */ qe(
|
|
|
7592
7603
|
const ft = Na($e, $), Et = ft + Math.max(Ue - 1, 0);
|
|
7593
7604
|
return vw(uc(ft, Et, Xe));
|
|
7594
7605
|
}
|
|
7595
|
-
const
|
|
7606
|
+
const le = Td(ne, pt, ot);
|
|
7596
7607
|
let he, be;
|
|
7597
|
-
Oe ? Y === 0 && J === 0 && Ue > 0 ? (he = 0, be = Ue - 1) : (he =
|
|
7598
|
-
const pe = uc(he, be, Xe), { bottom: Ie, top: Ze } = dc(te, me, oe, pe), ze = lc($ /
|
|
7608
|
+
Oe ? Y === 0 && J === 0 && Ue > 0 ? (he = 0, be = Ue - 1) : (he = le * os((Y + Je) / (_e + Je)), be = le * lc((J + Je) / (_e + Je)) - 1, be = vi($ - 1, Gr(be, le - 1)), he = vi(be, Gr(0, he))) : (he = 0, be = -1);
|
|
7609
|
+
const pe = uc(he, be, Xe), { bottom: Ie, top: Ze } = dc(te, me, oe, pe), ze = lc($ / le), nt = ze * _e + (ze - 1) * Je - Ie;
|
|
7599
7610
|
return { bottom: Ie, itemHeight: _e, items: pe, itemWidth: pt, offsetBottom: nt, offsetTop: Ze, top: Ze };
|
|
7600
7611
|
}
|
|
7601
7612
|
)
|
|
7602
7613
|
),
|
|
7603
|
-
|
|
7614
|
+
N
|
|
7604
7615
|
), ve(
|
|
7605
7616
|
W(
|
|
7606
|
-
|
|
7617
|
+
E,
|
|
7607
7618
|
Ae(($) => $ !== null),
|
|
7608
|
-
|
|
7619
|
+
ce(($) => $.length)
|
|
7609
7620
|
),
|
|
7610
7621
|
k
|
|
7611
7622
|
), ve(
|
|
7612
7623
|
W(
|
|
7613
|
-
xt(A, O,
|
|
7624
|
+
xt(A, O, N, z),
|
|
7614
7625
|
Ae(([$, Y, { items: J }]) => J.length > 0 && Y.height !== 0 && $.height !== 0),
|
|
7615
|
-
|
|
7626
|
+
ce(([$, Y, { items: J }, me]) => {
|
|
7616
7627
|
const { bottom: oe, top: te } = dc($, me, Y, J);
|
|
7617
7628
|
return [te, oe];
|
|
7618
7629
|
}),
|
|
@@ -7620,40 +7631,40 @@ const yw = /* @__PURE__ */ qe(
|
|
|
7620
7631
|
),
|
|
7621
7632
|
t
|
|
7622
7633
|
);
|
|
7623
|
-
const
|
|
7634
|
+
const ie = Z(!1);
|
|
7624
7635
|
ve(
|
|
7625
7636
|
W(
|
|
7626
7637
|
u,
|
|
7627
|
-
Fe(
|
|
7628
|
-
|
|
7638
|
+
Fe(ie),
|
|
7639
|
+
ce(([$, Y]) => Y || $ !== 0)
|
|
7629
7640
|
),
|
|
7630
|
-
|
|
7641
|
+
ie
|
|
7631
7642
|
);
|
|
7632
7643
|
const we = Ft(
|
|
7633
7644
|
W(
|
|
7634
|
-
xt(
|
|
7645
|
+
xt(N, k),
|
|
7635
7646
|
Ae(([{ items: $ }]) => $.length > 0),
|
|
7636
|
-
Fe(
|
|
7647
|
+
Fe(ie),
|
|
7637
7648
|
Ae(([[$, Y], J]) => {
|
|
7638
7649
|
const me = $.items[$.items.length - 1].index === Y - 1;
|
|
7639
7650
|
return (J || $.bottom > 0 && $.itemHeight > 0 && $.offsetBottom === 0 && $.items.length === Y) && me;
|
|
7640
7651
|
}),
|
|
7641
|
-
|
|
7652
|
+
ce(([[, $]]) => $ - 1),
|
|
7642
7653
|
it()
|
|
7643
7654
|
)
|
|
7644
7655
|
), Ce = Ft(
|
|
7645
7656
|
W(
|
|
7646
|
-
Ee(
|
|
7657
|
+
Ee(N),
|
|
7647
7658
|
Ae(({ items: $ }) => $.length > 0 && $[0].index === 0),
|
|
7648
7659
|
cn(0),
|
|
7649
7660
|
it()
|
|
7650
7661
|
)
|
|
7651
7662
|
), de = Ft(
|
|
7652
7663
|
W(
|
|
7653
|
-
Ee(
|
|
7664
|
+
Ee(N),
|
|
7654
7665
|
Fe(M),
|
|
7655
7666
|
Ae(([{ items: $ }, Y]) => $.length > 0 && !Y),
|
|
7656
|
-
|
|
7667
|
+
ce(([{ items: $ }]) => ({
|
|
7657
7668
|
endIndex: $[$.length - 1].index,
|
|
7658
7669
|
startIndex: $[0].index
|
|
7659
7670
|
})),
|
|
@@ -7664,8 +7675,8 @@ const yw = /* @__PURE__ */ qe(
|
|
|
7664
7675
|
ve(de, p.scrollSeekRangeChanged), ve(
|
|
7665
7676
|
W(
|
|
7666
7677
|
L,
|
|
7667
|
-
Fe(A, O, k,
|
|
7668
|
-
|
|
7678
|
+
Fe(A, O, k, z),
|
|
7679
|
+
ce(([$, Y, J, me, oe]) => {
|
|
7669
7680
|
const te = ld($), { align: Xe, behavior: Ue, offset: Oe } = te;
|
|
7670
7681
|
let $e = te.index;
|
|
7671
7682
|
$e === "LAST" && ($e = me - 1), $e = Gr(0, $e, vi(me - 1, $e));
|
|
@@ -7677,24 +7688,24 @@ const yw = /* @__PURE__ */ qe(
|
|
|
7677
7688
|
);
|
|
7678
7689
|
const K = Tt(
|
|
7679
7690
|
W(
|
|
7680
|
-
|
|
7681
|
-
|
|
7691
|
+
N,
|
|
7692
|
+
ce(($) => $.offsetBottom + $.bottom)
|
|
7682
7693
|
),
|
|
7683
7694
|
0
|
|
7684
7695
|
);
|
|
7685
7696
|
return ve(
|
|
7686
7697
|
W(
|
|
7687
7698
|
I,
|
|
7688
|
-
|
|
7699
|
+
ce(($) => ({ height: $.visibleHeight, width: $.visibleWidth }))
|
|
7689
7700
|
),
|
|
7690
7701
|
A
|
|
7691
7702
|
), {
|
|
7692
7703
|
customScrollParent: x,
|
|
7693
7704
|
// input
|
|
7694
|
-
data:
|
|
7705
|
+
data: E,
|
|
7695
7706
|
deviation: V,
|
|
7696
7707
|
footerHeight: o,
|
|
7697
|
-
gap:
|
|
7708
|
+
gap: z,
|
|
7698
7709
|
headerHeight: s,
|
|
7699
7710
|
increaseViewportBy: e,
|
|
7700
7711
|
initialItemCount: R,
|
|
@@ -7716,8 +7727,8 @@ const yw = /* @__PURE__ */ qe(
|
|
|
7716
7727
|
windowViewportRect: I,
|
|
7717
7728
|
...p,
|
|
7718
7729
|
// output
|
|
7719
|
-
gridState:
|
|
7720
|
-
horizontalDirection:
|
|
7730
|
+
gridState: N,
|
|
7731
|
+
horizontalDirection: X,
|
|
7721
7732
|
initialTopMostItemIndex: D,
|
|
7722
7733
|
totalListHeight: K,
|
|
7723
7734
|
...h,
|
|
@@ -7725,7 +7736,7 @@ const yw = /* @__PURE__ */ qe(
|
|
|
7725
7736
|
propsReady: w,
|
|
7726
7737
|
rangeChanged: de,
|
|
7727
7738
|
startReached: Ce,
|
|
7728
|
-
stateChanged:
|
|
7739
|
+
stateChanged: B,
|
|
7729
7740
|
stateRestoreInProgress: M,
|
|
7730
7741
|
...C
|
|
7731
7742
|
};
|
|
@@ -7750,7 +7761,7 @@ const bw = /* @__PURE__ */ qe(() => {
|
|
|
7750
7761
|
const e = Z((f) => `Item ${f}`), t = Z({}), n = Z(null), r = Z("virtuoso-grid-item"), o = Z("virtuoso-grid-list"), s = Z(Pa), i = Z("div"), a = Z(Dr), l = (f, h = null) => Tt(
|
|
7751
7762
|
W(
|
|
7752
7763
|
t,
|
|
7753
|
-
|
|
7764
|
+
ce((p) => p[f]),
|
|
7754
7765
|
it()
|
|
7755
7766
|
),
|
|
7756
7767
|
h
|
|
@@ -9606,12 +9617,12 @@ class On {
|
|
|
9606
9617
|
continue;
|
|
9607
9618
|
}
|
|
9608
9619
|
default: {
|
|
9609
|
-
const
|
|
9620
|
+
const N = 'Token with "' + p.type + '" type was not found.';
|
|
9610
9621
|
if (this.options.silent) {
|
|
9611
|
-
console.error(
|
|
9622
|
+
console.error(N);
|
|
9612
9623
|
return;
|
|
9613
9624
|
} else
|
|
9614
|
-
throw new Error(
|
|
9625
|
+
throw new Error(N);
|
|
9615
9626
|
}
|
|
9616
9627
|
}
|
|
9617
9628
|
}
|
|
@@ -10101,11 +10112,11 @@ var wy = "DismissableLayer", Xi = "dismissableLayer.update", yy = "dismissableLa
|
|
|
10101
10112
|
onDismiss: a,
|
|
10102
10113
|
...l
|
|
10103
10114
|
} = e, u = m.useContext(Bd), [d, f] = m.useState(null), h = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, p] = m.useState({}), y = Be(t, (R) => f(R)), w = Array.from(u.layers), [x] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), v = w.indexOf(x), b = d ? w.indexOf(d) : -1, S = u.layersWithOutsidePointerEventsDisabled.size > 0, I = b >= v, C = ky((R) => {
|
|
10104
|
-
const
|
|
10115
|
+
const N = R.target, A = [...u.branches].some((O) => O.contains(N));
|
|
10105
10116
|
!I || A || (o == null || o(R), i == null || i(R), R.defaultPrevented || a == null || a());
|
|
10106
10117
|
}, h), k = Ty((R) => {
|
|
10107
|
-
const
|
|
10108
|
-
[...u.branches].some((O) => O.contains(
|
|
10118
|
+
const N = R.target;
|
|
10119
|
+
[...u.branches].some((O) => O.contains(N)) || (s == null || s(R), i == null || i(R), R.defaultPrevented || a == null || a());
|
|
10109
10120
|
}, h);
|
|
10110
10121
|
return vy((R) => {
|
|
10111
10122
|
b === u.layers.size - 1 && (r == null || r(R), !R.defaultPrevented && a && (R.preventDefault(), a()));
|
|
@@ -10755,10 +10766,10 @@ function hb(e) {
|
|
|
10755
10766
|
var v = _o(w), b = n.current, S = "deltaX" in w ? w.deltaX : b[0] - v[0], I = "deltaY" in w ? w.deltaY : b[1] - v[1], C, k = w.target, R = Math.abs(S) > Math.abs(I) ? "h" : "v";
|
|
10756
10767
|
if ("touches" in w && R === "h" && k.type === "range")
|
|
10757
10768
|
return !1;
|
|
10758
|
-
var
|
|
10759
|
-
if (!
|
|
10769
|
+
var N = Oc(R, k);
|
|
10770
|
+
if (!N)
|
|
10760
10771
|
return !0;
|
|
10761
|
-
if (
|
|
10772
|
+
if (N ? C = R : (C = R === "v" ? "h" : "v", N = Oc(R, k)), !N)
|
|
10762
10773
|
return !1;
|
|
10763
10774
|
if (!r.current && "changedTouches" in w && (S || I) && (r.current = C), !C)
|
|
10764
10775
|
return !0;
|
|
@@ -11503,7 +11514,7 @@ const zb = q.memo(function({
|
|
|
11503
11514
|
onCancelEdit: x,
|
|
11504
11515
|
onCopy: v
|
|
11505
11516
|
}) {
|
|
11506
|
-
const [b, S] = ye(!1), [I, C] = ye("collapsed"), [k, R] = ye(!1), { currentThreadId:
|
|
11517
|
+
const [b, S] = ye(!1), [I, C] = ye("collapsed"), [k, R] = ye(!1), { currentThreadId: N } = ba(), { respondToInterrupt: A } = Sa(), { toast: O } = Ba(), [L, F] = ye({}), [V, E] = ye(!1), [z, B] = ye(null), H = l === "phone" || l === "half-screen", M = t.role, D = M === "tool", G = !(r && M !== "user"), _ = q.useMemo(() => {
|
|
11507
11518
|
switch (M) {
|
|
11508
11519
|
case "user":
|
|
11509
11520
|
return "text-[hsl(var(--chat-bubble-user-text))]";
|
|
@@ -11516,7 +11527,7 @@ const zb = q.memo(function({
|
|
|
11516
11527
|
default:
|
|
11517
11528
|
return "text-[hsl(var(--chat-bubble-ai-text))]";
|
|
11518
11529
|
}
|
|
11519
|
-
}, [M]),
|
|
11530
|
+
}, [M]), X = dt(() => Pb(t.content), [t.content]), ie = dt(() => Ob(t.content), [t.content]), we = dt(
|
|
11520
11531
|
() => t.content.filter((ne) => ne.type === "image_url"),
|
|
11521
11532
|
[t.content]
|
|
11522
11533
|
), Ce = dt(
|
|
@@ -11529,7 +11540,7 @@ const zb = q.memo(function({
|
|
|
11529
11540
|
dt(() => Lb(t.content), [t.content]);
|
|
11530
11541
|
const $ = dt(() => K.length <= qn ? K : `${K.slice(0, qn)}
|
|
11531
11542
|
… [truncated ${K.length - qn} chars]`, [K]), Y = q.useCallback(async (ne = "all") => {
|
|
11532
|
-
const he = ne === "visible" && D ? $ : D ? K :
|
|
11543
|
+
const he = ne === "visible" && D ? $ : D ? K : X;
|
|
11533
11544
|
async function be(pe) {
|
|
11534
11545
|
try {
|
|
11535
11546
|
await navigator.clipboard.writeText(pe);
|
|
@@ -11547,14 +11558,14 @@ const zb = q.memo(function({
|
|
|
11547
11558
|
} catch (pe) {
|
|
11548
11559
|
console.error("Failed to copy:", pe);
|
|
11549
11560
|
}
|
|
11550
|
-
}, [D, K,
|
|
11561
|
+
}, [D, K, X, $, v]), J = q.useCallback(() => {
|
|
11551
11562
|
if (!y) return;
|
|
11552
|
-
const ne = D ? K :
|
|
11563
|
+
const ne = D ? K : X;
|
|
11553
11564
|
y(t.id, ne);
|
|
11554
|
-
}, [y, t.id, D, K,
|
|
11565
|
+
}, [y, t.id, D, K, X]), me = q.useCallback(() => {
|
|
11555
11566
|
w == null || w(n);
|
|
11556
|
-
}, [w, n]), oe = q.useCallback(async (ne,
|
|
11557
|
-
if (!
|
|
11567
|
+
}, [w, n]), oe = q.useCallback(async (ne, le, he) => {
|
|
11568
|
+
if (!G) {
|
|
11558
11569
|
ne.preventDefault();
|
|
11559
11570
|
return;
|
|
11560
11571
|
}
|
|
@@ -11563,30 +11574,30 @@ const zb = q.memo(function({
|
|
|
11563
11574
|
return;
|
|
11564
11575
|
}
|
|
11565
11576
|
try {
|
|
11566
|
-
const be = String(
|
|
11577
|
+
const be = String(le.url ?? ""), pe = be.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
11567
11578
|
if (pe) {
|
|
11568
11579
|
ne.preventDefault();
|
|
11569
|
-
const Ie = pe[1], Ze =
|
|
11570
|
-
|
|
11580
|
+
const Ie = pe[1], Ze = le.name || `file_${Ie}`, ze = le.mimeType || "application/octet-stream";
|
|
11581
|
+
B({ id: Ie, name: Ze, mimeType: ze }), E(!0);
|
|
11571
11582
|
return;
|
|
11572
11583
|
}
|
|
11573
11584
|
if (be.startsWith("data:")) {
|
|
11574
11585
|
ne.preventDefault(), F((ze) => ({ ...ze, [he]: !0 }));
|
|
11575
|
-
const Ie = `${
|
|
11586
|
+
const Ie = `${le.name}_${le.size}_${Date.now()}`, Ze = O({ title: "Fetching file...", description: "", open: !0 });
|
|
11576
11587
|
try {
|
|
11577
|
-
const ze = await fy(
|
|
11588
|
+
const ze = await fy(N ?? void 0);
|
|
11578
11589
|
if (!ze || !Array.isArray(ze))
|
|
11579
11590
|
throw new Error("Invalid file list response");
|
|
11580
|
-
const nt = ze.find((ft) => !ft || typeof ft != "object" || !((ft.filename ?? "") === (
|
|
11591
|
+
const nt = ze.find((ft) => !ft || typeof ft != "object" || !((ft.filename ?? "") === (le.name ?? "")) ? !1 : typeof le.size == "number" && typeof ft.size == "number" ? ft.size === le.size : !0);
|
|
11581
11592
|
if (!(nt != null && nt.id))
|
|
11582
|
-
throw new Error(`File "${
|
|
11593
|
+
throw new Error(`File "${le.name}" is not yet available on the server`);
|
|
11583
11594
|
if (!nt.id || !nt.filename)
|
|
11584
11595
|
throw new Error("Invalid file data received from server");
|
|
11585
|
-
|
|
11596
|
+
B({
|
|
11586
11597
|
id: nt.id,
|
|
11587
|
-
name:
|
|
11588
|
-
mimeType:
|
|
11589
|
-
}),
|
|
11598
|
+
name: le.name || nt.filename || `file_${nt.id}`,
|
|
11599
|
+
mimeType: le.mimeType || nt.mime_type || "application/octet-stream"
|
|
11600
|
+
}), E(!0), Ze.update({ id: Ze.id, title: "Success", description: `Opened ${le.name}`, open: !0 });
|
|
11590
11601
|
} catch (ze) {
|
|
11591
11602
|
console.error("Failed to fetch server file:", ze);
|
|
11592
11603
|
const nt = ze instanceof Error ? ze.message : "Unknown error occurred";
|
|
@@ -11602,17 +11613,17 @@ const zb = q.memo(function({
|
|
|
11602
11613
|
} catch (be) {
|
|
11603
11614
|
console.error("File click error:", be), F((pe) => ({ ...pe, [he]: !1 }));
|
|
11604
11615
|
}
|
|
11605
|
-
}, [
|
|
11606
|
-
const
|
|
11616
|
+
}, [G, L, O, N]), te = q.useCallback(() => {
|
|
11617
|
+
const le = re(H ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", _);
|
|
11607
11618
|
switch (M) {
|
|
11608
11619
|
case "user":
|
|
11609
|
-
return /* @__PURE__ */ c.jsx(Rm, { className:
|
|
11620
|
+
return /* @__PURE__ */ c.jsx(Rm, { className: le });
|
|
11610
11621
|
case "assistant":
|
|
11611
|
-
return /* @__PURE__ */ c.jsx(xl, { className:
|
|
11622
|
+
return /* @__PURE__ */ c.jsx(xl, { className: le });
|
|
11612
11623
|
case "tool":
|
|
11613
|
-
return /* @__PURE__ */ c.jsx(Im, { className:
|
|
11624
|
+
return /* @__PURE__ */ c.jsx(Im, { className: le });
|
|
11614
11625
|
default:
|
|
11615
|
-
return /* @__PURE__ */ c.jsx(xl, { className:
|
|
11626
|
+
return /* @__PURE__ */ c.jsx(xl, { className: le });
|
|
11616
11627
|
}
|
|
11617
11628
|
}, [H, _, M]), Xe = q.useCallback(() => {
|
|
11618
11629
|
const ne = "group relative mb-4 flex w-full";
|
|
@@ -11660,30 +11671,30 @@ const zb = q.memo(function({
|
|
|
11660
11671
|
}
|
|
11661
11672
|
}, [H, M]), Oe = q.useCallback(async (ne) => {
|
|
11662
11673
|
try {
|
|
11663
|
-
const
|
|
11664
|
-
if (!
|
|
11674
|
+
const le = (ne == null ? void 0 : ne.id) || (ne == null ? void 0 : ne.interrupt_id);
|
|
11675
|
+
if (!le) {
|
|
11665
11676
|
console.warn("Interrupt part missing id", ne);
|
|
11666
11677
|
return;
|
|
11667
11678
|
}
|
|
11668
|
-
await A(
|
|
11669
|
-
} catch (
|
|
11670
|
-
console.error("Failed to approve interrupt:",
|
|
11679
|
+
await A(le, !0);
|
|
11680
|
+
} catch (le) {
|
|
11681
|
+
console.error("Failed to approve interrupt:", le);
|
|
11671
11682
|
}
|
|
11672
11683
|
}, [A]), $e = q.useCallback(async (ne) => {
|
|
11673
11684
|
try {
|
|
11674
|
-
const
|
|
11675
|
-
if (!
|
|
11685
|
+
const le = (ne == null ? void 0 : ne.id) || (ne == null ? void 0 : ne.interrupt_id);
|
|
11686
|
+
if (!le) {
|
|
11676
11687
|
console.warn("Interrupt part missing id", ne);
|
|
11677
11688
|
return;
|
|
11678
11689
|
}
|
|
11679
|
-
await A(
|
|
11680
|
-
} catch (
|
|
11681
|
-
console.error("Failed to reject interrupt:",
|
|
11690
|
+
await A(le, !1);
|
|
11691
|
+
} catch (le) {
|
|
11692
|
+
console.error("Failed to reject interrupt:", le);
|
|
11682
11693
|
}
|
|
11683
|
-
}, [A]), ot = q.useCallback(({ part: ne, i:
|
|
11694
|
+
}, [A]), ot = q.useCallback(({ part: ne, i: le }) => {
|
|
11684
11695
|
if (ne.type === "text") {
|
|
11685
11696
|
const he = ne.text ?? "", be = he.trim(), pe = Lc(be);
|
|
11686
|
-
return pe && M !== "tool" ? /* @__PURE__ */ c.jsx(Bb, { data: pe },
|
|
11697
|
+
return pe && M !== "tool" ? /* @__PURE__ */ c.jsx(Bb, { data: pe }, le) : M === "user" && f && be.length > h ? /* @__PURE__ */ c.jsxs(pc, { open: k, onOpenChange: R, children: [
|
|
11687
11698
|
/* @__PURE__ */ c.jsx("div", { className: re("text-sm text-[hsl(var(--chat-bubble-user-text))]", H && "text-xs"), children: k ? /* @__PURE__ */ c.jsx(Sc, { content: be, allowHtml: !1 }) : /* @__PURE__ */ c.jsxs("pre", { className: re("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]", H && "text-xs"), children: [
|
|
11688
11699
|
be.substring(0, h),
|
|
11689
11700
|
"..."
|
|
@@ -11705,7 +11716,7 @@ const zb = q.memo(function({
|
|
|
11705
11716
|
] })
|
|
11706
11717
|
}
|
|
11707
11718
|
) })
|
|
11708
|
-
] },
|
|
11719
|
+
] }, le) : /* @__PURE__ */ c.jsx(Sc, { content: he, allowHtml: !1 }, le);
|
|
11709
11720
|
}
|
|
11710
11721
|
if (ne.type === "image_url") {
|
|
11711
11722
|
const he = ne;
|
|
@@ -11717,7 +11728,7 @@ const zb = q.memo(function({
|
|
|
11717
11728
|
loading: "lazy",
|
|
11718
11729
|
className: "border rounded max-h-[420px] w-auto object-contain"
|
|
11719
11730
|
}
|
|
11720
|
-
) },
|
|
11731
|
+
) }, le);
|
|
11721
11732
|
}
|
|
11722
11733
|
if (ne.type === "file") {
|
|
11723
11734
|
const he = ne, be = he.name || "file";
|
|
@@ -11725,18 +11736,18 @@ const zb = q.memo(function({
|
|
|
11725
11736
|
"a",
|
|
11726
11737
|
{
|
|
11727
11738
|
href: he.url,
|
|
11728
|
-
onClick: (pe) => oe(pe, he,
|
|
11739
|
+
onClick: (pe) => oe(pe, he, le),
|
|
11729
11740
|
className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
|
|
11730
11741
|
dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
|
|
11731
11742
|
children: [
|
|
11732
|
-
L[
|
|
11743
|
+
L[le] ? /* @__PURE__ */ c.jsx(ou, { className: "h-4 w-4 animate-spin" }) : null,
|
|
11733
11744
|
/* @__PURE__ */ c.jsxs("span", { className: "truncate max-w-[180px]", children: [
|
|
11734
11745
|
be,
|
|
11735
|
-
L[
|
|
11746
|
+
L[le] ? " (processing)" : ""
|
|
11736
11747
|
] })
|
|
11737
11748
|
]
|
|
11738
11749
|
},
|
|
11739
|
-
|
|
11750
|
+
le
|
|
11740
11751
|
);
|
|
11741
11752
|
}
|
|
11742
11753
|
return ne.type === "interrupt" ? /* @__PURE__ */ c.jsx(
|
|
@@ -11746,7 +11757,7 @@ const zb = q.memo(function({
|
|
|
11746
11757
|
onApprove: Oe,
|
|
11747
11758
|
onReject: $e
|
|
11748
11759
|
},
|
|
11749
|
-
|
|
11760
|
+
le
|
|
11750
11761
|
) : null;
|
|
11751
11762
|
}, [
|
|
11752
11763
|
oe,
|
|
@@ -11762,22 +11773,22 @@ const zb = q.memo(function({
|
|
|
11762
11773
|
/* @__PURE__ */ c.jsx(ji, { className: "h-4 w-4 text-muted-foreground" }),
|
|
11763
11774
|
/* @__PURE__ */ c.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
|
|
11764
11775
|
] }), []), _e = q.useCallback(() => {
|
|
11765
|
-
const ne =
|
|
11776
|
+
const ne = X.trim().length > 0 || we.length > 0 || Ce.length > 0 || de.length > 0;
|
|
11766
11777
|
if (!D && !ne && !r)
|
|
11767
11778
|
return Je();
|
|
11768
11779
|
if (t.model === "reflection") {
|
|
11769
|
-
const
|
|
11780
|
+
const le = X.trim(), he = Lc(le);
|
|
11770
11781
|
if (he && typeof he == "object")
|
|
11771
11782
|
return /* @__PURE__ */ c.jsx(Wb, { data: he });
|
|
11772
11783
|
}
|
|
11773
|
-
if (D &&
|
|
11774
|
-
const
|
|
11784
|
+
if (D && ie.name === "get_issues") {
|
|
11785
|
+
const le = t.content.find((pe) => pe.type === "tool_end"), he = (le == null ? void 0 : le.output) ?? K, be = Cf(he);
|
|
11775
11786
|
if (be) return /* @__PURE__ */ c.jsx(Vb, { issues: be });
|
|
11776
11787
|
}
|
|
11777
11788
|
if (D) {
|
|
11778
|
-
const
|
|
11779
|
-
if (
|
|
11780
|
-
return /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children:
|
|
11789
|
+
const le = Mb(t.content);
|
|
11790
|
+
if (le.length > 0)
|
|
11791
|
+
return /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: le.map((he, be) => {
|
|
11781
11792
|
const pe = typeof he.output == "string" ? he.output : Zi(he.output), Ie = pe.length > qn ? `${pe.slice(0, qn)}
|
|
11782
11793
|
… [truncated ${pe.length - qn} chars]` : pe, Ze = I === "expanded";
|
|
11783
11794
|
return /* @__PURE__ */ c.jsxs(pc, { open: Ze, onOpenChange: (ze) => C(ze ? "expanded" : "preview"), children: [
|
|
@@ -11795,21 +11806,21 @@ const zb = q.memo(function({
|
|
|
11795
11806
|
}) });
|
|
11796
11807
|
}
|
|
11797
11808
|
if (!D) {
|
|
11798
|
-
const
|
|
11809
|
+
const le = /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: t.content.map((he, be) => /* @__PURE__ */ c.jsx(ot, { part: he, i: be }, be)) });
|
|
11799
11810
|
return r ? /* @__PURE__ */ c.jsxs("div", { "aria-busy": "true", role: "status", children: [
|
|
11800
|
-
|
|
11811
|
+
le,
|
|
11801
11812
|
/* @__PURE__ */ c.jsx($b, { className: _ })
|
|
11802
|
-
] }) :
|
|
11813
|
+
] }) : le;
|
|
11803
11814
|
}
|
|
11804
11815
|
}, [
|
|
11805
|
-
|
|
11816
|
+
X,
|
|
11806
11817
|
we.length,
|
|
11807
11818
|
Ce.length,
|
|
11808
11819
|
de.length,
|
|
11809
11820
|
r,
|
|
11810
11821
|
t.model,
|
|
11811
11822
|
D,
|
|
11812
|
-
|
|
11823
|
+
ie.name,
|
|
11813
11824
|
K,
|
|
11814
11825
|
I,
|
|
11815
11826
|
u,
|
|
@@ -11831,7 +11842,7 @@ const zb = q.memo(function({
|
|
|
11831
11842
|
/* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11832
11843
|
te(),
|
|
11833
11844
|
a && pt && /* @__PURE__ */ c.jsx("span", { className: re("font-medium", H ? "text-xs" : "text-sm"), children: pt }),
|
|
11834
|
-
D &&
|
|
11845
|
+
D && ie.name && /* @__PURE__ */ c.jsxs(
|
|
11835
11846
|
Yi,
|
|
11836
11847
|
{
|
|
11837
11848
|
variant: "outline",
|
|
@@ -11845,16 +11856,16 @@ const zb = q.memo(function({
|
|
|
11845
11856
|
tabIndex: 0,
|
|
11846
11857
|
"aria-expanded": I !== "collapsed",
|
|
11847
11858
|
onKeyDown: (ne) => {
|
|
11848
|
-
(ne.key === "Enter" || ne.key === " ") && (ne.preventDefault(), C((
|
|
11859
|
+
(ne.key === "Enter" || ne.key === " ") && (ne.preventDefault(), C((le) => le === "collapsed" ? "preview" : "collapsed"));
|
|
11849
11860
|
},
|
|
11850
11861
|
onClick: () => C((ne) => ne === "collapsed" ? "preview" : "collapsed"),
|
|
11851
11862
|
children: [
|
|
11852
|
-
/* @__PURE__ */ c.jsx("span", { children:
|
|
11863
|
+
/* @__PURE__ */ c.jsx("span", { children: ie.name }),
|
|
11853
11864
|
/* @__PURE__ */ c.jsx("span", { className: "inline-flex items-center", children: I !== "collapsed" ? /* @__PURE__ */ c.jsx(Wr, { className: "h-3 w-3" }) : /* @__PURE__ */ c.jsx(Sr, { className: "h-3 w-3" }) })
|
|
11854
11865
|
]
|
|
11855
11866
|
}
|
|
11856
11867
|
),
|
|
11857
|
-
D && !
|
|
11868
|
+
D && !ie.name && /* @__PURE__ */ c.jsx(
|
|
11858
11869
|
Ve,
|
|
11859
11870
|
{
|
|
11860
11871
|
variant: "ghost",
|
|
@@ -11943,14 +11954,14 @@ const zb = q.memo(function({
|
|
|
11943
11954
|
}
|
|
11944
11955
|
),
|
|
11945
11956
|
/* @__PURE__ */ c.jsx("div", { className: "relative", children: _e() }),
|
|
11946
|
-
D && I === "expanded" && (
|
|
11947
|
-
|
|
11957
|
+
D && I === "expanded" && (ie.toolCallId || ie.name) && /* @__PURE__ */ c.jsxs("div", { className: re("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", H && "text-xs"), children: [
|
|
11958
|
+
ie.name && /* @__PURE__ */ c.jsxs("div", { children: [
|
|
11948
11959
|
"Function: ",
|
|
11949
|
-
|
|
11960
|
+
ie.name
|
|
11950
11961
|
] }),
|
|
11951
|
-
|
|
11962
|
+
ie.toolCallId && /* @__PURE__ */ c.jsxs("div", { children: [
|
|
11952
11963
|
"Call ID: ",
|
|
11953
|
-
|
|
11964
|
+
ie.toolCallId
|
|
11954
11965
|
] })
|
|
11955
11966
|
] }),
|
|
11956
11967
|
!(i || a || D) && s && !o && /* @__PURE__ */ c.jsxs(
|
|
@@ -11996,16 +12007,16 @@ const zb = q.memo(function({
|
|
|
11996
12007
|
}
|
|
11997
12008
|
)
|
|
11998
12009
|
] }) }),
|
|
11999
|
-
|
|
12010
|
+
z && /* @__PURE__ */ c.jsx(
|
|
12000
12011
|
jb,
|
|
12001
12012
|
{
|
|
12002
12013
|
isOpen: V,
|
|
12003
12014
|
onClose: () => {
|
|
12004
|
-
|
|
12015
|
+
E(!1), B(null);
|
|
12005
12016
|
},
|
|
12006
|
-
fileId:
|
|
12007
|
-
fileName:
|
|
12008
|
-
mimeType:
|
|
12017
|
+
fileId: z.id,
|
|
12018
|
+
fileName: z.name,
|
|
12019
|
+
mimeType: z.mimeType
|
|
12009
12020
|
}
|
|
12010
12021
|
)
|
|
12011
12022
|
] });
|
|
@@ -12158,7 +12169,7 @@ const $c = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, kf = q.forwa
|
|
|
12158
12169
|
onScrollAway: x,
|
|
12159
12170
|
onAtBottom: v
|
|
12160
12171
|
}, b) => {
|
|
12161
|
-
const S = We(null), I = We(null), C = We(!1), [k, R] = ye(!0),
|
|
12172
|
+
const S = We(null), I = We(null), C = We(!1), [k, R] = ye(!0), N = Ne((L) => {
|
|
12162
12173
|
R(L), x && x(!L), v && v(L);
|
|
12163
12174
|
}, [x, v]), A = dt(() => {
|
|
12164
12175
|
if (a)
|
|
@@ -12192,7 +12203,7 @@ const $c = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, kf = q.forwa
|
|
|
12192
12203
|
startReached: () => {
|
|
12193
12204
|
A && A();
|
|
12194
12205
|
},
|
|
12195
|
-
atBottomStateChange:
|
|
12206
|
+
atBottomStateChange: N,
|
|
12196
12207
|
style: { height: "100%", overscrollBehavior: "contain" },
|
|
12197
12208
|
computeItemKey: (L, F) => $c(F, L),
|
|
12198
12209
|
itemContent: (L, F) => {
|
|
@@ -12600,17 +12611,17 @@ const l0 = (e) => ({
|
|
|
12600
12611
|
}, p = Xa(o), y = Ya(p), w = await i.getDimensions(u), x = p === "y", v = x ? "top" : "left", b = x ? "bottom" : "right", S = x ? "clientHeight" : "clientWidth", I = s.reference[y] + s.reference[p] - h[p] - s.floating[y], C = h[p] - s.reference[p], k = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
|
|
12601
12612
|
let R = k ? k[S] : 0;
|
|
12602
12613
|
(!R || !await (i.isElement == null ? void 0 : i.isElement(k))) && (R = a.floating[S] || s.floating[y]);
|
|
12603
|
-
const
|
|
12614
|
+
const N = I / 2 - C / 2, A = R / 2 - w[y] / 2 - 1, O = Mn(f[v], A), L = Mn(f[b], A), F = O, V = R - w[y] - L, E = R / 2 - w[y] / 2 + N, z = Qi(F, E, V), B = !l.arrow && Lr(o) != null && E !== z && s.reference[y] / 2 - (E < F ? O : L) - w[y] / 2 < 0, H = B ? E < F ? E - F : E - V : 0;
|
|
12604
12615
|
return {
|
|
12605
12616
|
[p]: h[p] + H,
|
|
12606
12617
|
data: {
|
|
12607
|
-
[p]:
|
|
12608
|
-
centerOffset:
|
|
12609
|
-
...
|
|
12618
|
+
[p]: z,
|
|
12619
|
+
centerOffset: E - z - H,
|
|
12620
|
+
...B && {
|
|
12610
12621
|
alignmentOffset: H
|
|
12611
12622
|
}
|
|
12612
12623
|
},
|
|
12613
|
-
reset:
|
|
12624
|
+
reset: B
|
|
12614
12625
|
};
|
|
12615
12626
|
}
|
|
12616
12627
|
}), c0 = function(e) {
|
|
@@ -12639,32 +12650,32 @@ const l0 = (e) => ({
|
|
|
12639
12650
|
return {};
|
|
12640
12651
|
const v = Tn(o), b = fn(a), S = Tn(a) === a, I = await (l.isRTL == null ? void 0 : l.isRTL(u.floating)), C = h || (S || !w ? [cs(a)] : t0(a)), k = y !== "none";
|
|
12641
12652
|
!h && k && C.push(...s0(a, w, y, I));
|
|
12642
|
-
const R = [a, ...C],
|
|
12653
|
+
const R = [a, ...C], N = await so(t, x), A = [];
|
|
12643
12654
|
let O = ((r = s.flip) == null ? void 0 : r.overflows) || [];
|
|
12644
|
-
if (d && A.push(
|
|
12645
|
-
const
|
|
12646
|
-
A.push(E[
|
|
12655
|
+
if (d && A.push(N[v]), f) {
|
|
12656
|
+
const E = e0(o, i, I);
|
|
12657
|
+
A.push(N[E[0]], N[E[1]]);
|
|
12647
12658
|
}
|
|
12648
12659
|
if (O = [...O, {
|
|
12649
12660
|
placement: o,
|
|
12650
12661
|
overflows: A
|
|
12651
|
-
}], !A.every((
|
|
12662
|
+
}], !A.every((E) => E <= 0)) {
|
|
12652
12663
|
var L, F;
|
|
12653
|
-
const
|
|
12654
|
-
if (
|
|
12664
|
+
const E = (((L = s.flip) == null ? void 0 : L.index) || 0) + 1, z = R[E];
|
|
12665
|
+
if (z && (!(f === "alignment" ? b !== fn(z) : !1) || // We leave the current main axis only if every placement on that axis
|
|
12655
12666
|
// overflows the main axis.
|
|
12656
12667
|
O.every((M) => fn(M.placement) === b ? M.overflows[0] > 0 : !0)))
|
|
12657
12668
|
return {
|
|
12658
12669
|
data: {
|
|
12659
|
-
index:
|
|
12670
|
+
index: E,
|
|
12660
12671
|
overflows: O
|
|
12661
12672
|
},
|
|
12662
12673
|
reset: {
|
|
12663
|
-
placement:
|
|
12674
|
+
placement: z
|
|
12664
12675
|
}
|
|
12665
12676
|
};
|
|
12666
|
-
let
|
|
12667
|
-
if (!
|
|
12677
|
+
let B = (F = O.filter((H) => H.overflows[0] <= 0).sort((H, M) => H.overflows[1] - M.overflows[1])[0]) == null ? void 0 : F.placement;
|
|
12678
|
+
if (!B)
|
|
12668
12679
|
switch (p) {
|
|
12669
12680
|
case "bestFit": {
|
|
12670
12681
|
var V;
|
|
@@ -12676,18 +12687,18 @@ const l0 = (e) => ({
|
|
|
12676
12687
|
D === "y";
|
|
12677
12688
|
}
|
|
12678
12689
|
return !0;
|
|
12679
|
-
}).map((M) => [M.placement, M.overflows.filter((D) => D > 0).reduce((D,
|
|
12680
|
-
H && (
|
|
12690
|
+
}).map((M) => [M.placement, M.overflows.filter((D) => D > 0).reduce((D, G) => D + G, 0)]).sort((M, D) => M[1] - D[1])[0]) == null ? void 0 : V[0];
|
|
12691
|
+
H && (B = H);
|
|
12681
12692
|
break;
|
|
12682
12693
|
}
|
|
12683
12694
|
case "initialPlacement":
|
|
12684
|
-
|
|
12695
|
+
B = a;
|
|
12685
12696
|
break;
|
|
12686
12697
|
}
|
|
12687
|
-
if (o !==
|
|
12698
|
+
if (o !== B)
|
|
12688
12699
|
return {
|
|
12689
12700
|
reset: {
|
|
12690
|
-
placement:
|
|
12701
|
+
placement: B
|
|
12691
12702
|
}
|
|
12692
12703
|
};
|
|
12693
12704
|
}
|
|
@@ -12917,14 +12928,14 @@ const f0 = function(e) {
|
|
|
12917
12928
|
let x, v;
|
|
12918
12929
|
f === "top" || f === "bottom" ? (x = f, v = h === (await (i.isRTL == null ? void 0 : i.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (v = f, x = h === "end" ? "top" : "bottom");
|
|
12919
12930
|
const b = w - d.top - d.bottom, S = y - d.left - d.right, I = Mn(w - d[x], b), C = Mn(y - d[v], S), k = !t.middlewareData.shift;
|
|
12920
|
-
let R = I,
|
|
12921
|
-
if ((n = t.middlewareData.shift) != null && n.enabled.x && (
|
|
12931
|
+
let R = I, N = C;
|
|
12932
|
+
if ((n = t.middlewareData.shift) != null && n.enabled.x && (N = S), (r = t.middlewareData.shift) != null && r.enabled.y && (R = b), k && !h) {
|
|
12922
12933
|
const O = Dt(d.left, 0), L = Dt(d.right, 0), F = Dt(d.top, 0), V = Dt(d.bottom, 0);
|
|
12923
|
-
p ?
|
|
12934
|
+
p ? N = y - 2 * (O !== 0 || L !== 0 ? O + L : Dt(d.left, d.right)) : R = w - 2 * (F !== 0 || V !== 0 ? F + V : Dt(d.top, d.bottom));
|
|
12924
12935
|
}
|
|
12925
12936
|
await l({
|
|
12926
12937
|
...t,
|
|
12927
|
-
availableWidth:
|
|
12938
|
+
availableWidth: N,
|
|
12928
12939
|
availableHeight: R
|
|
12929
12940
|
});
|
|
12930
12941
|
const A = await i.getDimensions(a.floating);
|
|
@@ -13508,7 +13519,7 @@ function J0(e) {
|
|
|
13508
13519
|
M !== k.current && (k.current = M, w(M));
|
|
13509
13520
|
}, []), S = m.useCallback((M) => {
|
|
13510
13521
|
M !== R.current && (R.current = M, v(M));
|
|
13511
|
-
}, []), I = s || y, C = i || x, k = m.useRef(null), R = m.useRef(null),
|
|
13522
|
+
}, []), I = s || y, C = i || x, k = m.useRef(null), R = m.useRef(null), N = m.useRef(d), A = l != null, O = Ni(l), L = Ni(o), F = Ni(u), V = m.useCallback(() => {
|
|
13512
13523
|
if (!k.current || !R.current)
|
|
13513
13524
|
return;
|
|
13514
13525
|
const M = {
|
|
@@ -13517,7 +13528,7 @@ function J0(e) {
|
|
|
13517
13528
|
middleware: h
|
|
13518
13529
|
};
|
|
13519
13530
|
L.current && (M.platform = L.current), G0(k.current, R.current, M).then((D) => {
|
|
13520
|
-
const
|
|
13531
|
+
const G = {
|
|
13521
13532
|
...D,
|
|
13522
13533
|
// The floating element's position may be recomputed while it's closed
|
|
13523
13534
|
// but still mounted (such as when transitioning out). To ensure
|
|
@@ -13525,20 +13536,20 @@ function J0(e) {
|
|
|
13525
13536
|
// setting it to `true` when `open === false` (must be specified).
|
|
13526
13537
|
isPositioned: F.current !== !1
|
|
13527
13538
|
};
|
|
13528
|
-
|
|
13529
|
-
f(
|
|
13539
|
+
E.current && !ds(N.current, G) && (N.current = G, ys.flushSync(() => {
|
|
13540
|
+
f(G);
|
|
13530
13541
|
}));
|
|
13531
13542
|
});
|
|
13532
13543
|
}, [h, t, n, L, F]);
|
|
13533
13544
|
Jo(() => {
|
|
13534
|
-
u === !1 &&
|
|
13545
|
+
u === !1 && N.current.isPositioned && (N.current.isPositioned = !1, f((M) => ({
|
|
13535
13546
|
...M,
|
|
13536
13547
|
isPositioned: !1
|
|
13537
13548
|
})));
|
|
13538
13549
|
}, [u]);
|
|
13539
|
-
const
|
|
13540
|
-
Jo(() => (
|
|
13541
|
-
|
|
13550
|
+
const E = m.useRef(!1);
|
|
13551
|
+
Jo(() => (E.current = !0, () => {
|
|
13552
|
+
E.current = !1;
|
|
13542
13553
|
}), []), Jo(() => {
|
|
13543
13554
|
if (I && (k.current = I), C && (R.current = C), I && C) {
|
|
13544
13555
|
if (O.current)
|
|
@@ -13546,12 +13557,12 @@ function J0(e) {
|
|
|
13546
13557
|
V();
|
|
13547
13558
|
}
|
|
13548
13559
|
}, [I, C, V, O, A]);
|
|
13549
|
-
const
|
|
13560
|
+
const z = m.useMemo(() => ({
|
|
13550
13561
|
reference: k,
|
|
13551
13562
|
floating: R,
|
|
13552
13563
|
setReference: b,
|
|
13553
13564
|
setFloating: S
|
|
13554
|
-
}), [b, S]),
|
|
13565
|
+
}), [b, S]), B = m.useMemo(() => ({
|
|
13555
13566
|
reference: I,
|
|
13556
13567
|
floating: C
|
|
13557
13568
|
}), [I, C]), H = m.useMemo(() => {
|
|
@@ -13560,28 +13571,28 @@ function J0(e) {
|
|
|
13560
13571
|
left: 0,
|
|
13561
13572
|
top: 0
|
|
13562
13573
|
};
|
|
13563
|
-
if (!
|
|
13574
|
+
if (!B.floating)
|
|
13564
13575
|
return M;
|
|
13565
|
-
const D = Xc(
|
|
13576
|
+
const D = Xc(B.floating, d.x), G = Xc(B.floating, d.y);
|
|
13566
13577
|
return a ? {
|
|
13567
13578
|
...M,
|
|
13568
|
-
transform: "translate(" + D + "px, " +
|
|
13569
|
-
...Mf(
|
|
13579
|
+
transform: "translate(" + D + "px, " + G + "px)",
|
|
13580
|
+
...Mf(B.floating) >= 1.5 && {
|
|
13570
13581
|
willChange: "transform"
|
|
13571
13582
|
}
|
|
13572
13583
|
} : {
|
|
13573
13584
|
position: n,
|
|
13574
13585
|
left: D,
|
|
13575
|
-
top:
|
|
13586
|
+
top: G
|
|
13576
13587
|
};
|
|
13577
|
-
}, [n, a,
|
|
13588
|
+
}, [n, a, B.floating, d.x, d.y]);
|
|
13578
13589
|
return m.useMemo(() => ({
|
|
13579
13590
|
...d,
|
|
13580
13591
|
update: V,
|
|
13581
|
-
refs:
|
|
13582
|
-
elements:
|
|
13592
|
+
refs: z,
|
|
13593
|
+
elements: B,
|
|
13583
13594
|
floatingStyles: H
|
|
13584
|
-
}), [d, V,
|
|
13595
|
+
}), [d, V, z, B, H]);
|
|
13585
13596
|
}
|
|
13586
13597
|
const Z0 = (e) => {
|
|
13587
13598
|
function t(n) {
|
|
@@ -13698,12 +13709,12 @@ var tl = "PopperContent", [cS, uS] = Ff(tl), Uf = m.forwardRef(
|
|
|
13698
13709
|
updatePositionStrategy: p = "optimized",
|
|
13699
13710
|
onPlaced: y,
|
|
13700
13711
|
...w
|
|
13701
|
-
} = e, x = $f(tl, n), [v, b] = m.useState(null), S = Be(t, (te) => b(te)), [I, C] = m.useState(null), k = Lf(I), R = (k == null ? void 0 : k.width) ?? 0,
|
|
13712
|
+
} = e, x = $f(tl, n), [v, b] = m.useState(null), S = Be(t, (te) => b(te)), [I, C] = m.useState(null), k = Lf(I), R = (k == null ? void 0 : k.width) ?? 0, N = (k == null ? void 0 : k.height) ?? 0, A = r + (s !== "center" ? "-" + s : ""), O = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, L = Array.isArray(u) ? u : [u], F = L.length > 0, V = {
|
|
13702
13713
|
padding: O,
|
|
13703
13714
|
boundary: L.filter(fS),
|
|
13704
13715
|
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
13705
13716
|
altBoundary: F
|
|
13706
|
-
}, { refs:
|
|
13717
|
+
}, { refs: E, floatingStyles: z, placement: B, isPositioned: H, middlewareData: M } = J0({
|
|
13707
13718
|
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
13708
13719
|
strategy: "fixed",
|
|
13709
13720
|
placement: A,
|
|
@@ -13714,7 +13725,7 @@ var tl = "PopperContent", [cS, uS] = Ff(tl), Uf = m.forwardRef(
|
|
|
13714
13725
|
reference: x.anchor
|
|
13715
13726
|
},
|
|
13716
13727
|
middleware: [
|
|
13717
|
-
Q0({ mainAxis: o +
|
|
13728
|
+
Q0({ mainAxis: o + N, alignmentAxis: i }),
|
|
13718
13729
|
l && eS({
|
|
13719
13730
|
mainAxis: !0,
|
|
13720
13731
|
crossAxis: !1,
|
|
@@ -13730,24 +13741,24 @@ var tl = "PopperContent", [cS, uS] = Ff(tl), Uf = m.forwardRef(
|
|
|
13730
13741
|
}
|
|
13731
13742
|
}),
|
|
13732
13743
|
I && sS({ element: I, padding: a }),
|
|
13733
|
-
hS({ arrowWidth: R, arrowHeight:
|
|
13744
|
+
hS({ arrowWidth: R, arrowHeight: N }),
|
|
13734
13745
|
h && oS({ strategy: "referenceHidden", ...V })
|
|
13735
13746
|
]
|
|
13736
|
-
}), [D,
|
|
13747
|
+
}), [D, G] = Kf(B), _ = bt(y);
|
|
13737
13748
|
yt(() => {
|
|
13738
13749
|
H && (_ == null || _());
|
|
13739
13750
|
}, [H, _]);
|
|
13740
|
-
const
|
|
13751
|
+
const X = (K = M.arrow) == null ? void 0 : K.x, ie = ($ = M.arrow) == null ? void 0 : $.y, we = ((Y = M.arrow) == null ? void 0 : Y.centerOffset) !== 0, [Ce, de] = m.useState();
|
|
13741
13752
|
return yt(() => {
|
|
13742
13753
|
v && de(window.getComputedStyle(v).zIndex);
|
|
13743
13754
|
}, [v]), /* @__PURE__ */ c.jsx(
|
|
13744
13755
|
"div",
|
|
13745
13756
|
{
|
|
13746
|
-
ref:
|
|
13757
|
+
ref: E.setFloating,
|
|
13747
13758
|
"data-radix-popper-content-wrapper": "",
|
|
13748
13759
|
style: {
|
|
13749
|
-
...
|
|
13750
|
-
transform: H ?
|
|
13760
|
+
...z,
|
|
13761
|
+
transform: H ? z.transform : "translate(0, -200%)",
|
|
13751
13762
|
// keep off the page when measuring
|
|
13752
13763
|
minWidth: "max-content",
|
|
13753
13764
|
zIndex: Ce,
|
|
@@ -13770,14 +13781,14 @@ var tl = "PopperContent", [cS, uS] = Ff(tl), Uf = m.forwardRef(
|
|
|
13770
13781
|
scope: n,
|
|
13771
13782
|
placedSide: D,
|
|
13772
13783
|
onArrowChange: C,
|
|
13773
|
-
arrowX:
|
|
13774
|
-
arrowY:
|
|
13784
|
+
arrowX: X,
|
|
13785
|
+
arrowY: ie,
|
|
13775
13786
|
shouldHideArrow: we,
|
|
13776
13787
|
children: /* @__PURE__ */ c.jsx(
|
|
13777
13788
|
je.div,
|
|
13778
13789
|
{
|
|
13779
13790
|
"data-side": D,
|
|
13780
|
-
"data-align":
|
|
13791
|
+
"data-align": G,
|
|
13781
13792
|
...w,
|
|
13782
13793
|
ref: S,
|
|
13783
13794
|
style: {
|
|
@@ -13889,9 +13900,9 @@ var wS = m.forwardRef((e, t) => {
|
|
|
13889
13900
|
caller: yo
|
|
13890
13901
|
}), [v, b] = m.useState(!1), S = bt(u), I = Jf(n), C = m.useRef(!1), [k, R] = m.useState(0);
|
|
13891
13902
|
return m.useEffect(() => {
|
|
13892
|
-
const
|
|
13893
|
-
if (
|
|
13894
|
-
return
|
|
13903
|
+
const N = h.current;
|
|
13904
|
+
if (N)
|
|
13905
|
+
return N.addEventListener(Ai, S), () => N.removeEventListener(Ai, S);
|
|
13895
13906
|
}, [S]), /* @__PURE__ */ c.jsx(
|
|
13896
13907
|
xS,
|
|
13897
13908
|
{
|
|
@@ -13901,16 +13912,16 @@ var wS = m.forwardRef((e, t) => {
|
|
|
13901
13912
|
loop: o,
|
|
13902
13913
|
currentTabStopId: w,
|
|
13903
13914
|
onItemFocus: m.useCallback(
|
|
13904
|
-
(
|
|
13915
|
+
(N) => x(N),
|
|
13905
13916
|
[x]
|
|
13906
13917
|
),
|
|
13907
13918
|
onItemShiftTab: m.useCallback(() => b(!0), []),
|
|
13908
13919
|
onFocusableItemAdd: m.useCallback(
|
|
13909
|
-
() => R((
|
|
13920
|
+
() => R((N) => N + 1),
|
|
13910
13921
|
[]
|
|
13911
13922
|
),
|
|
13912
13923
|
onFocusableItemRemove: m.useCallback(
|
|
13913
|
-
() => R((
|
|
13924
|
+
() => R((N) => N - 1),
|
|
13914
13925
|
[]
|
|
13915
13926
|
),
|
|
13916
13927
|
children: /* @__PURE__ */ c.jsx(
|
|
@@ -13924,15 +13935,15 @@ var wS = m.forwardRef((e, t) => {
|
|
|
13924
13935
|
onMouseDown: fe(e.onMouseDown, () => {
|
|
13925
13936
|
C.current = !0;
|
|
13926
13937
|
}),
|
|
13927
|
-
onFocus: fe(e.onFocus, (
|
|
13938
|
+
onFocus: fe(e.onFocus, (N) => {
|
|
13928
13939
|
const A = !C.current;
|
|
13929
|
-
if (
|
|
13940
|
+
if (N.target === N.currentTarget && A && !v) {
|
|
13930
13941
|
const O = new CustomEvent(Ai, pS);
|
|
13931
|
-
if (
|
|
13932
|
-
const L = I().filter((
|
|
13942
|
+
if (N.currentTarget.dispatchEvent(O), !O.defaultPrevented) {
|
|
13943
|
+
const L = I().filter((B) => B.focusable), F = L.find((B) => B.active), V = L.find((B) => B.id === w), z = [F, V, ...L].filter(
|
|
13933
13944
|
Boolean
|
|
13934
|
-
).map((
|
|
13935
|
-
nh(
|
|
13945
|
+
).map((B) => B.ref.current);
|
|
13946
|
+
nh(z, d);
|
|
13936
13947
|
}
|
|
13937
13948
|
}
|
|
13938
13949
|
C.current = !1;
|
|
@@ -14141,17 +14152,17 @@ var Vt = "MenuContent", [DS, ol] = dr(Vt), ch = m.forwardRef(
|
|
|
14141
14152
|
onDismiss: p,
|
|
14142
14153
|
disableOutsideScroll: y,
|
|
14143
14154
|
...w
|
|
14144
|
-
} = e, x = fr(Vt, n), v = So(Vt, n), b = qs(n), S = sh(n), I = AS(n), [C, k] = m.useState(null), R = m.useRef(null),
|
|
14155
|
+
} = e, x = fr(Vt, n), v = So(Vt, n), b = qs(n), S = sh(n), I = AS(n), [C, k] = m.useState(null), R = m.useRef(null), N = Be(t, R, x.onContentChange), A = m.useRef(0), O = m.useRef(""), L = m.useRef(0), F = m.useRef(null), V = m.useRef("right"), E = m.useRef(0), z = y ? Ds : m.Fragment, B = y ? { as: $S, allowPinchZoom: !0 } : void 0, H = (D) => {
|
|
14145
14156
|
var K, $;
|
|
14146
|
-
const
|
|
14157
|
+
const G = O.current + D, _ = I().filter((Y) => !Y.disabled), X = document.activeElement, ie = (K = _.find((Y) => Y.ref.current === X)) == null ? void 0 : K.textValue, we = _.map((Y) => Y.textValue), Ce = JS(we, G, ie), de = ($ = _.find((Y) => Y.textValue === Ce)) == null ? void 0 : $.ref.current;
|
|
14147
14158
|
(function Y(J) {
|
|
14148
14159
|
O.current = J, window.clearTimeout(A.current), J !== "" && (A.current = window.setTimeout(() => Y(""), 1e3));
|
|
14149
|
-
})(
|
|
14160
|
+
})(G), de && setTimeout(() => de.focus());
|
|
14150
14161
|
};
|
|
14151
14162
|
m.useEffect(() => () => window.clearTimeout(A.current), []), Ha();
|
|
14152
14163
|
const M = m.useCallback((D) => {
|
|
14153
|
-
var _,
|
|
14154
|
-
return V.current === ((_ = F.current) == null ? void 0 : _.side) && QS(D, (
|
|
14164
|
+
var _, X;
|
|
14165
|
+
return V.current === ((_ = F.current) == null ? void 0 : _.side) && QS(D, (X = F.current) == null ? void 0 : X.area);
|
|
14155
14166
|
}, []);
|
|
14156
14167
|
return /* @__PURE__ */ c.jsx(
|
|
14157
14168
|
DS,
|
|
@@ -14166,8 +14177,8 @@ var Vt = "MenuContent", [DS, ol] = dr(Vt), ch = m.forwardRef(
|
|
|
14166
14177
|
),
|
|
14167
14178
|
onItemLeave: m.useCallback(
|
|
14168
14179
|
(D) => {
|
|
14169
|
-
var
|
|
14170
|
-
M(D) || ((
|
|
14180
|
+
var G;
|
|
14181
|
+
M(D) || ((G = R.current) == null || G.focus(), k(null));
|
|
14171
14182
|
},
|
|
14172
14183
|
[M]
|
|
14173
14184
|
),
|
|
@@ -14181,14 +14192,14 @@ var Vt = "MenuContent", [DS, ol] = dr(Vt), ch = m.forwardRef(
|
|
|
14181
14192
|
onPointerGraceIntentChange: m.useCallback((D) => {
|
|
14182
14193
|
F.current = D;
|
|
14183
14194
|
}, []),
|
|
14184
|
-
children: /* @__PURE__ */ c.jsx(
|
|
14195
|
+
children: /* @__PURE__ */ c.jsx(z, { ...B, children: /* @__PURE__ */ c.jsx(
|
|
14185
14196
|
Ps,
|
|
14186
14197
|
{
|
|
14187
14198
|
asChild: !0,
|
|
14188
14199
|
trapped: o,
|
|
14189
14200
|
onMountAutoFocus: fe(s, (D) => {
|
|
14190
|
-
var
|
|
14191
|
-
D.preventDefault(), (
|
|
14201
|
+
var G;
|
|
14202
|
+
D.preventDefault(), (G = R.current) == null || G.focus({ preventScroll: !0 });
|
|
14192
14203
|
}),
|
|
14193
14204
|
onUnmountAutoFocus: i,
|
|
14194
14205
|
children: /* @__PURE__ */ c.jsx(
|
|
@@ -14225,11 +14236,11 @@ var Vt = "MenuContent", [DS, ol] = dr(Vt), ch = m.forwardRef(
|
|
|
14225
14236
|
dir: v.dir,
|
|
14226
14237
|
...b,
|
|
14227
14238
|
...w,
|
|
14228
|
-
ref:
|
|
14239
|
+
ref: N,
|
|
14229
14240
|
style: { outline: "none", ...w.style },
|
|
14230
14241
|
onKeyDown: fe(w.onKeyDown, (D) => {
|
|
14231
|
-
const _ = D.target.closest("[data-radix-menu-content]") === D.currentTarget,
|
|
14232
|
-
_ && (D.key === "Tab" && D.preventDefault(), !
|
|
14242
|
+
const _ = D.target.closest("[data-radix-menu-content]") === D.currentTarget, X = D.ctrlKey || D.altKey || D.metaKey, ie = D.key.length === 1;
|
|
14243
|
+
_ && (D.key === "Tab" && D.preventDefault(), !X && ie && H(D.key));
|
|
14233
14244
|
const we = R.current;
|
|
14234
14245
|
if (D.target !== we || !RS.includes(D.key)) return;
|
|
14235
14246
|
D.preventDefault();
|
|
@@ -14242,10 +14253,10 @@ var Vt = "MenuContent", [DS, ol] = dr(Vt), ch = m.forwardRef(
|
|
|
14242
14253
|
onPointerMove: fe(
|
|
14243
14254
|
e.onPointerMove,
|
|
14244
14255
|
lo((D) => {
|
|
14245
|
-
const
|
|
14246
|
-
if (D.currentTarget.contains(
|
|
14247
|
-
const
|
|
14248
|
-
V.current =
|
|
14256
|
+
const G = D.target, _ = E.current !== D.clientX;
|
|
14257
|
+
if (D.currentTarget.contains(G) && _) {
|
|
14258
|
+
const X = D.clientX > E.current ? "right" : "left";
|
|
14259
|
+
V.current = X, E.current = D.clientX;
|
|
14249
14260
|
}
|
|
14250
14261
|
})
|
|
14251
14262
|
)
|
|
@@ -14910,46 +14921,46 @@ function _i({
|
|
|
14910
14921
|
loadOlder: C,
|
|
14911
14922
|
checkpoints: k,
|
|
14912
14923
|
navigateToCheckpoint: R,
|
|
14913
|
-
returnToLatest:
|
|
14924
|
+
returnToLatest: N,
|
|
14914
14925
|
checkpoint: A,
|
|
14915
14926
|
respondToInterrupt: O,
|
|
14916
14927
|
metadata: L
|
|
14917
|
-
} = Sa(), { isStreaming: F, error: V, submit:
|
|
14918
|
-
nt.current && (nt.current.value = ""), ft.current && (ft.current.value = ""), Y((
|
|
14928
|
+
} = Sa(), { isStreaming: F, error: V, submit: E, stop: z } = nv(), B = x ?? w ?? null, H = (A == null ? void 0 : A.id) ?? null, M = (A == null ? void 0 : A.namespace) ?? null, D = (L == null ? void 0 : L.assemblingMessageId) ?? null, [G, _] = ye(null), [X, ie] = ye(""), [we, Ce] = ye(null), [de, K] = ye([]), [$, Y] = ye(0), [J, me] = ye(0), [oe, te] = ye(!1), [Xe, Ue] = ye(null), [Oe, $e] = ye(null), [ot, Je] = ye(!1), [_e, pt] = ye(null), [ne, le] = ye([]), [he, be] = ye(null), [pe, Ie] = ye(null), [Ze, ze] = ye(!1), nt = We(null), ft = We(null), Et = Ne(() => {
|
|
14929
|
+
nt.current && (nt.current.value = ""), ft.current && (ft.current.value = ""), Y((ae) => ae + 1), me((ae) => ae + 1);
|
|
14919
14930
|
}, []), Gt = We(!1);
|
|
14920
14931
|
st(() => {
|
|
14921
14932
|
Gt.current && !F && (K([]), Et()), Gt.current = F;
|
|
14922
14933
|
}, [F, Et]);
|
|
14923
14934
|
const [rn, Hn] = ye("desktop");
|
|
14924
14935
|
st(() => {
|
|
14925
|
-
const
|
|
14936
|
+
const ae = () => {
|
|
14926
14937
|
const xe = window.innerWidth;
|
|
14927
14938
|
Hn(xe < 640 ? "phone" : xe < 1024 ? "tablet" : "desktop");
|
|
14928
14939
|
};
|
|
14929
|
-
return
|
|
14940
|
+
return ae(), window.addEventListener("resize", ae), () => window.removeEventListener("resize", ae);
|
|
14930
14941
|
}, []), st(() => {
|
|
14931
|
-
if (!
|
|
14932
|
-
|
|
14942
|
+
if (!B) {
|
|
14943
|
+
le([]), be(null), Ie(null);
|
|
14933
14944
|
return;
|
|
14934
14945
|
}
|
|
14935
|
-
const
|
|
14936
|
-
if (ae
|
|
14946
|
+
const ae = (k ?? []).slice().sort((xe, Me) => new Date(Me.createdAt).getTime() - new Date(xe.createdAt).getTime());
|
|
14947
|
+
if (le(ae), !ae.length) {
|
|
14937
14948
|
be(null), Ie(null);
|
|
14938
14949
|
return;
|
|
14939
14950
|
}
|
|
14940
|
-
if (!he || !
|
|
14941
|
-
const xe =
|
|
14951
|
+
if (!he || !ae.some((xe) => Yn(xe).checkpointId === he)) {
|
|
14952
|
+
const xe = ae[0], Me = xe ? Yn(xe) : { checkpointId: null, checkpointNs: null };
|
|
14942
14953
|
be(Me.checkpointId), Ie(Me.checkpointNs);
|
|
14943
14954
|
}
|
|
14944
|
-
}, [he,
|
|
14955
|
+
}, [he, B, k]), st(() => {
|
|
14945
14956
|
H && (be(H), Ie(M ?? null));
|
|
14946
14957
|
}, [H, M]);
|
|
14947
14958
|
const zr = Ne(async () => {
|
|
14948
14959
|
if (!(!b || S))
|
|
14949
14960
|
try {
|
|
14950
14961
|
await C();
|
|
14951
|
-
} catch (
|
|
14952
|
-
console.warn("loadOlder failed",
|
|
14962
|
+
} catch (ae) {
|
|
14963
|
+
console.warn("loadOlder failed", ae);
|
|
14953
14964
|
}
|
|
14954
14965
|
}, [b, S, C]);
|
|
14955
14966
|
st(() => {
|
|
@@ -14968,16 +14979,16 @@ function _i({
|
|
|
14968
14979
|
}, [y]), st(() => {
|
|
14969
14980
|
V && !ot && (p == null || p(V));
|
|
14970
14981
|
}, [V, ot, p]);
|
|
14971
|
-
const hr = (
|
|
14972
|
-
if (
|
|
14973
|
-
return `Message too long (${
|
|
14982
|
+
const hr = (ae) => {
|
|
14983
|
+
if (ae.length > Xo)
|
|
14984
|
+
return `Message too long (${ae.length}/${Xo} characters)`;
|
|
14974
14985
|
try {
|
|
14975
|
-
return Gb(
|
|
14986
|
+
return Gb(ae), null;
|
|
14976
14987
|
} catch (xe) {
|
|
14977
14988
|
return (xe == null ? void 0 : xe.message) || "Invalid message";
|
|
14978
14989
|
}
|
|
14979
|
-
}, In = async (
|
|
14980
|
-
const xe =
|
|
14990
|
+
}, In = async (ae) => {
|
|
14991
|
+
const xe = ae.trim();
|
|
14981
14992
|
if (!(!xe && de.length === 0)) {
|
|
14982
14993
|
if (xe) {
|
|
14983
14994
|
const Me = hr(xe);
|
|
@@ -14987,29 +14998,29 @@ function _i({
|
|
|
14987
14998
|
}
|
|
14988
14999
|
}
|
|
14989
15000
|
try {
|
|
14990
|
-
await
|
|
15001
|
+
await E(
|
|
14991
15002
|
{
|
|
14992
15003
|
text: xe || "",
|
|
14993
15004
|
attachments: de,
|
|
14994
|
-
payload:
|
|
15005
|
+
payload: G ? { edit: !0, originalMessageId: G } : void 0
|
|
14995
15006
|
},
|
|
14996
15007
|
{
|
|
14997
15008
|
checkpointId: he ?? H ?? void 0,
|
|
14998
15009
|
checkpointNs: pe ?? M ?? void 0
|
|
14999
15010
|
}
|
|
15000
|
-
), f == null || f(xe), Ce(null), K([]), Et(), _(null),
|
|
15011
|
+
), f == null || f(xe), Ce(null), K([]), Et(), _(null), ie("");
|
|
15001
15012
|
} catch (Me) {
|
|
15002
15013
|
const ut = (Me == null ? void 0 : Me.message) || "Failed to send message";
|
|
15003
15014
|
Ce(ut), p == null || p(ut);
|
|
15004
15015
|
}
|
|
15005
15016
|
}
|
|
15006
|
-
}, on = q.useCallback((
|
|
15007
|
-
u && (_(
|
|
15017
|
+
}, on = q.useCallback((ae, xe) => {
|
|
15018
|
+
u && (_(ae), ie(xe), Ce(null));
|
|
15008
15019
|
}, [u]), Pt = q.useCallback(() => {
|
|
15009
|
-
_(null),
|
|
15010
|
-
}, []), sn = Ne((
|
|
15011
|
-
on(
|
|
15012
|
-
}, [on]), Rn = Ne((
|
|
15020
|
+
_(null), ie(""), Ce(null);
|
|
15021
|
+
}, []), sn = Ne((ae, xe) => {
|
|
15022
|
+
on(ae, xe);
|
|
15023
|
+
}, [on]), Rn = Ne((ae) => {
|
|
15013
15024
|
const xe = (Me) => {
|
|
15014
15025
|
const ut = Me.content || [], an = ut.filter((Kn) => Kn.type === "text").map((Kn) => Kn.text).join("");
|
|
15015
15026
|
if (an) return an;
|
|
@@ -15019,10 +15030,10 @@ function _i({
|
|
|
15019
15030
|
return String(ut);
|
|
15020
15031
|
}
|
|
15021
15032
|
};
|
|
15022
|
-
for (let Me =
|
|
15033
|
+
for (let Me = ae - 1; Me >= 0; Me--)
|
|
15023
15034
|
if (v[Me].role === "user") {
|
|
15024
15035
|
const ut = xe(v[Me]);
|
|
15025
|
-
ut &&
|
|
15036
|
+
ut && E(
|
|
15026
15037
|
{ text: ut },
|
|
15027
15038
|
{
|
|
15028
15039
|
checkpointId: he ?? H ?? void 0,
|
|
@@ -15031,20 +15042,20 @@ function _i({
|
|
|
15031
15042
|
);
|
|
15032
15043
|
break;
|
|
15033
15044
|
}
|
|
15034
|
-
}, [v,
|
|
15035
|
-
const xe = Array.from(
|
|
15036
|
-
K((Me) => [...Me, ...xe]),
|
|
15037
|
-
}, pr = (
|
|
15045
|
+
}, [v, E, he, pe, H, M]), Un = (ae) => {
|
|
15046
|
+
const xe = Array.from(ae.target.files || []);
|
|
15047
|
+
K((Me) => [...Me, ...xe]), ae.target.value = "";
|
|
15048
|
+
}, pr = (ae) => {
|
|
15038
15049
|
K((xe) => {
|
|
15039
|
-
const Me = xe.filter((ut, an) =>
|
|
15050
|
+
const Me = xe.filter((ut, an) => ae !== an);
|
|
15040
15051
|
return Me.length === 0 && Et(), Me;
|
|
15041
15052
|
});
|
|
15042
|
-
}, Yt = async (
|
|
15043
|
-
const xe = (
|
|
15053
|
+
}, Yt = async (ae) => {
|
|
15054
|
+
const xe = (ae.target.files || [])[0];
|
|
15044
15055
|
if (xe) {
|
|
15045
15056
|
Ue(null), $e(null), te(!0);
|
|
15046
15057
|
try {
|
|
15047
|
-
await
|
|
15058
|
+
await E(
|
|
15048
15059
|
{ attachments: [xe] },
|
|
15049
15060
|
{
|
|
15050
15061
|
checkpointId: he ?? H ?? void 0,
|
|
@@ -15057,23 +15068,23 @@ function _i({
|
|
|
15057
15068
|
const ut = Me instanceof Error ? Me.message : "Failed to upload Excel file";
|
|
15058
15069
|
console.error("Excel upload failed", Me), Ue(ut), p == null || p(ut);
|
|
15059
15070
|
} finally {
|
|
15060
|
-
te(!1),
|
|
15071
|
+
te(!1), ae.target.value = "", Et();
|
|
15061
15072
|
}
|
|
15062
15073
|
}
|
|
15063
|
-
}, mr = (
|
|
15064
|
-
if (!
|
|
15065
|
-
const xe = Date.parse(
|
|
15066
|
-
return Number.isNaN(xe) ?
|
|
15067
|
-
}, Wn = async (
|
|
15074
|
+
}, mr = (ae) => {
|
|
15075
|
+
if (!ae) return "Unknown";
|
|
15076
|
+
const xe = Date.parse(ae);
|
|
15077
|
+
return Number.isNaN(xe) ? ae : new Date(xe).toLocaleString();
|
|
15078
|
+
}, Wn = async (ae) => {
|
|
15068
15079
|
if (w) {
|
|
15069
15080
|
ze(!0);
|
|
15070
15081
|
try {
|
|
15071
|
-
if (!
|
|
15072
|
-
await
|
|
15082
|
+
if (!ae) {
|
|
15083
|
+
await N(), be(null), Ie(null);
|
|
15073
15084
|
return;
|
|
15074
15085
|
}
|
|
15075
|
-
const xe = ne.find((ut) => Yn(ut).checkpointId ===
|
|
15076
|
-
await R(
|
|
15086
|
+
const xe = ne.find((ut) => Yn(ut).checkpointId === ae), Me = xe ? Yn(xe) : { checkpointId: null, checkpointNs: null };
|
|
15087
|
+
await R(ae, Me.checkpointNs), be(ae), Ie(Me.checkpointNs);
|
|
15077
15088
|
} finally {
|
|
15078
15089
|
ze(!1);
|
|
15079
15090
|
}
|
|
@@ -15101,16 +15112,16 @@ function _i({
|
|
|
15101
15112
|
{
|
|
15102
15113
|
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",
|
|
15103
15114
|
value: he ?? "",
|
|
15104
|
-
onChange: (
|
|
15105
|
-
const xe =
|
|
15115
|
+
onChange: (ae) => {
|
|
15116
|
+
const xe = ae.target.value || null;
|
|
15106
15117
|
Wn(xe);
|
|
15107
15118
|
},
|
|
15108
|
-
children: ne.map((
|
|
15119
|
+
children: ne.map((ae) => {
|
|
15109
15120
|
var ut;
|
|
15110
|
-
const xe = Yn(
|
|
15121
|
+
const xe = Yn(ae), Me = (ut = ae.metadata) == null ? void 0 : ut.step;
|
|
15111
15122
|
return /* @__PURE__ */ c.jsxs("option", { value: xe.checkpointId, children: [
|
|
15112
|
-
mr(
|
|
15113
|
-
|
|
15123
|
+
mr(ae.createdAt),
|
|
15124
|
+
ae.next ? ` — ${ae.next}` : "__end__",
|
|
15114
15125
|
Me ? ` (Step ${Me})` : ""
|
|
15115
15126
|
] }, xe.checkpointId);
|
|
15116
15127
|
})
|
|
@@ -15135,7 +15146,7 @@ function _i({
|
|
|
15135
15146
|
followNewMessages: i,
|
|
15136
15147
|
layoutSize: rn,
|
|
15137
15148
|
enableMessageEditing: u,
|
|
15138
|
-
editingMessageId:
|
|
15149
|
+
editingMessageId: G,
|
|
15139
15150
|
onStartReached: () => {
|
|
15140
15151
|
zr();
|
|
15141
15152
|
},
|
|
@@ -15154,7 +15165,7 @@ function _i({
|
|
|
15154
15165
|
}
|
|
15155
15166
|
),
|
|
15156
15167
|
/* @__PURE__ */ c.jsxs("div", { className: xr, children: [
|
|
15157
|
-
|
|
15168
|
+
G && /* @__PURE__ */ c.jsx("div", { className: "mb-3 p-3 bg-blue-50 border border-blue-200 rounded-lg", children: /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
15158
15169
|
/* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
15159
15170
|
/* @__PURE__ */ c.jsx(su, { size: 16, className: "text-blue-600" }),
|
|
15160
15171
|
/* @__PURE__ */ c.jsx("span", { className: "text-sm font-medium text-blue-800", children: "Editing message" })
|
|
@@ -15178,14 +15189,14 @@ function _i({
|
|
|
15178
15189
|
ref: nt,
|
|
15179
15190
|
type: "file",
|
|
15180
15191
|
multiple: !0,
|
|
15181
|
-
onChange: (
|
|
15192
|
+
onChange: (ae) => Un(ae),
|
|
15182
15193
|
className: "hidden"
|
|
15183
15194
|
},
|
|
15184
15195
|
$
|
|
15185
15196
|
),
|
|
15186
|
-
de.length > 0 && /* @__PURE__ */ c.jsx("div", { className: "flex flex-wrap gap-2", children: de.map((
|
|
15197
|
+
de.length > 0 && /* @__PURE__ */ c.jsx("div", { className: "flex flex-wrap gap-2", children: de.map((ae, xe) => /* @__PURE__ */ c.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: [
|
|
15187
15198
|
/* @__PURE__ */ c.jsx(ji, { size: 14 }),
|
|
15188
|
-
/* @__PURE__ */ c.jsx("span", { className: "truncate max-w-[150px]", children:
|
|
15199
|
+
/* @__PURE__ */ c.jsx("span", { className: "truncate max-w-[150px]", children: ae.name }),
|
|
15189
15200
|
/* @__PURE__ */ c.jsx(
|
|
15190
15201
|
Ve,
|
|
15191
15202
|
{
|
|
@@ -15193,7 +15204,7 @@ function _i({
|
|
|
15193
15204
|
size: "sm",
|
|
15194
15205
|
onClick: () => pr(xe),
|
|
15195
15206
|
className: "h-4 w-4 p-0 text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400",
|
|
15196
|
-
"aria-label": `Remove ${
|
|
15207
|
+
"aria-label": `Remove ${ae.name}`,
|
|
15197
15208
|
children: /* @__PURE__ */ c.jsx(Cr, { size: 12 })
|
|
15198
15209
|
}
|
|
15199
15210
|
)
|
|
@@ -15236,8 +15247,8 @@ function _i({
|
|
|
15236
15247
|
) }),
|
|
15237
15248
|
/* @__PURE__ */ c.jsxs(Xh, { align: "start", sideOffset: 6, className: "w-52", children: [
|
|
15238
15249
|
a && /* @__PURE__ */ c.jsxs(oa, { onClick: () => {
|
|
15239
|
-
var
|
|
15240
|
-
return (
|
|
15250
|
+
var ae;
|
|
15251
|
+
return (ae = nt.current) == null ? void 0 : ae.click();
|
|
15241
15252
|
}, className: "cursor-pointer", children: [
|
|
15242
15253
|
/* @__PURE__ */ c.jsx(ji, { className: "h-4 w-4 mr-2" }),
|
|
15243
15254
|
" Attach files or images"
|
|
@@ -15246,8 +15257,8 @@ function _i({
|
|
|
15246
15257
|
oa,
|
|
15247
15258
|
{
|
|
15248
15259
|
onClick: () => {
|
|
15249
|
-
var
|
|
15250
|
-
oe || (
|
|
15260
|
+
var ae;
|
|
15261
|
+
oe || (ae = ft.current) == null || ae.click();
|
|
15251
15262
|
},
|
|
15252
15263
|
className: `cursor-pointer ${oe ? "opacity-60 pointer-events-none" : ""}`,
|
|
15253
15264
|
children: [
|
|
@@ -15261,17 +15272,17 @@ function _i({
|
|
|
15261
15272
|
/* @__PURE__ */ c.jsx("div", { className: "flex-1", children: /* @__PURE__ */ c.jsx(
|
|
15262
15273
|
sv,
|
|
15263
15274
|
{
|
|
15264
|
-
initialValue:
|
|
15265
|
-
editingMessageId:
|
|
15266
|
-
placeholder:
|
|
15275
|
+
initialValue: X,
|
|
15276
|
+
editingMessageId: G,
|
|
15277
|
+
placeholder: G ? "Edit your message..." : t,
|
|
15267
15278
|
isStreaming: F,
|
|
15268
15279
|
disabled: !1,
|
|
15269
15280
|
maxLength: Xo,
|
|
15270
15281
|
onSend: In,
|
|
15271
15282
|
onCancelEdit: Pt,
|
|
15272
|
-
onStop:
|
|
15283
|
+
onStop: z,
|
|
15273
15284
|
allowEmptySend: de.length > 0,
|
|
15274
|
-
textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${
|
|
15285
|
+
textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${G ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${we ? "border-red-400" : ""} ${d.textarea || ""}`
|
|
15275
15286
|
}
|
|
15276
15287
|
) })
|
|
15277
15288
|
] })
|
|
@@ -15307,7 +15318,7 @@ var cl = "ScrollArea", [Jh, _T] = xn(cl), [WC, qt] = Jh(cl), Zh = m.forwardRef(
|
|
|
15307
15318
|
dir: o,
|
|
15308
15319
|
scrollHideDelay: s = 600,
|
|
15309
15320
|
...i
|
|
15310
|
-
} = e, [a, l] = m.useState(null), [u, d] = m.useState(null), [f, h] = m.useState(null), [p, y] = m.useState(null), [w, x] = m.useState(null), [v, b] = m.useState(0), [S, I] = m.useState(0), [C, k] = m.useState(!1), [R,
|
|
15321
|
+
} = e, [a, l] = m.useState(null), [u, d] = m.useState(null), [f, h] = m.useState(null), [p, y] = m.useState(null), [w, x] = m.useState(null), [v, b] = m.useState(0), [S, I] = m.useState(0), [C, k] = m.useState(!1), [R, N] = m.useState(!1), A = Be(t, (L) => l(L)), O = Bs(o);
|
|
15311
15322
|
return /* @__PURE__ */ c.jsx(
|
|
15312
15323
|
WC,
|
|
15313
15324
|
{
|
|
@@ -15327,7 +15338,7 @@ var cl = "ScrollArea", [Jh, _T] = xn(cl), [WC, qt] = Jh(cl), Zh = m.forwardRef(
|
|
|
15327
15338
|
scrollbarY: w,
|
|
15328
15339
|
onScrollbarYChange: x,
|
|
15329
15340
|
scrollbarYEnabled: R,
|
|
15330
|
-
onScrollbarYEnabledChange:
|
|
15341
|
+
onScrollbarYEnabledChange: N,
|
|
15331
15342
|
onCornerWidthChange: b,
|
|
15332
15343
|
onCornerHeightChange: I,
|
|
15333
15344
|
children: /* @__PURE__ */ c.jsx(
|
|
@@ -15630,7 +15641,7 @@ var VC = m.forwardRef((e, t) => {
|
|
|
15630
15641
|
onResize: f,
|
|
15631
15642
|
...h
|
|
15632
15643
|
} = e, p = qt(wn, n), [y, w] = m.useState(null), x = Be(t, (A) => w(A)), v = m.useRef(null), b = m.useRef(""), S = p.viewport, I = r.content - r.viewport, C = bt(d), k = bt(l), R = Js(f, 10);
|
|
15633
|
-
function
|
|
15644
|
+
function N(A) {
|
|
15634
15645
|
if (v.current) {
|
|
15635
15646
|
const O = A.clientX - v.current.left, L = A.clientY - v.current.top;
|
|
15636
15647
|
u({ x: O, y: L });
|
|
@@ -15659,9 +15670,9 @@ var VC = m.forwardRef((e, t) => {
|
|
|
15659
15670
|
ref: x,
|
|
15660
15671
|
style: { position: "absolute", ...h.style },
|
|
15661
15672
|
onPointerDown: fe(e.onPointerDown, (A) => {
|
|
15662
|
-
A.button === 0 && (A.target.setPointerCapture(A.pointerId), v.current = y.getBoundingClientRect(), b.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", p.viewport && (p.viewport.style.scrollBehavior = "auto"),
|
|
15673
|
+
A.button === 0 && (A.target.setPointerCapture(A.pointerId), v.current = y.getBoundingClientRect(), b.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", p.viewport && (p.viewport.style.scrollBehavior = "auto"), N(A));
|
|
15663
15674
|
}),
|
|
15664
|
-
onPointerMove: fe(e.onPointerMove,
|
|
15675
|
+
onPointerMove: fe(e.onPointerMove, N),
|
|
15665
15676
|
onPointerUp: fe(e.onPointerUp, (A) => {
|
|
15666
15677
|
const O = A.target;
|
|
15667
15678
|
O.hasPointerCapture(A.pointerId) && O.releasePointerCapture(A.pointerId), document.body.style.webkitUserSelect = b.current, p.viewport && (p.viewport.style.scrollBehavior = ""), v.current = null;
|
|
@@ -15855,7 +15866,7 @@ function Qc({
|
|
|
15855
15866
|
currentThreadId: h,
|
|
15856
15867
|
isLoading: p,
|
|
15857
15868
|
actions: y
|
|
15858
|
-
} = ba(), { loadThread: w } = Sa(), { createThread: x, deleteThread: v, renameThread: b } = y, [S, I] = ye(Array.isArray(f) ? f : []), C = We(S.length > 0), [k, R] = ye(null), [
|
|
15869
|
+
} = ba(), { loadThread: w } = Sa(), { createThread: x, deleteThread: v, renameThread: b } = y, [S, I] = ye(Array.isArray(f) ? f : []), C = We(S.length > 0), [k, R] = ye(null), [N, A] = ye(""), [O, L] = ye(!1);
|
|
15859
15870
|
st(() => {
|
|
15860
15871
|
const _ = Array.isArray(f) ? f : [];
|
|
15861
15872
|
if (_.length > 0) {
|
|
@@ -15867,8 +15878,8 @@ function Qc({
|
|
|
15867
15878
|
const F = async (_) => {
|
|
15868
15879
|
try {
|
|
15869
15880
|
await w(_), a == null || a(_), l == null || l(_);
|
|
15870
|
-
} catch (
|
|
15871
|
-
console.error("Failed to select thread:",
|
|
15881
|
+
} catch (X) {
|
|
15882
|
+
console.error("Failed to select thread:", X);
|
|
15872
15883
|
}
|
|
15873
15884
|
}, V = async () => {
|
|
15874
15885
|
try {
|
|
@@ -15880,35 +15891,35 @@ function Qc({
|
|
|
15880
15891
|
} finally {
|
|
15881
15892
|
L(!1);
|
|
15882
15893
|
}
|
|
15883
|
-
},
|
|
15884
|
-
if (
|
|
15894
|
+
}, E = async (_, X) => {
|
|
15895
|
+
if (X.stopPropagation(), !!confirm("Delete this thread?"))
|
|
15885
15896
|
try {
|
|
15886
15897
|
await v(_), d == null || d(_);
|
|
15887
|
-
} catch (
|
|
15888
|
-
console.error("Failed to delete thread:",
|
|
15898
|
+
} catch (ie) {
|
|
15899
|
+
console.error("Failed to delete thread:", ie);
|
|
15889
15900
|
}
|
|
15890
|
-
},
|
|
15891
|
-
|
|
15892
|
-
},
|
|
15893
|
-
if (
|
|
15901
|
+
}, z = (_, X) => {
|
|
15902
|
+
X.stopPropagation(), R(_.threadId), A(_.title || `Thread ${_.threadId.slice(0, 8)}`);
|
|
15903
|
+
}, B = async (_) => {
|
|
15904
|
+
if (N.trim())
|
|
15894
15905
|
try {
|
|
15895
|
-
await b(_,
|
|
15896
|
-
} catch (
|
|
15897
|
-
console.error("Failed to update title:",
|
|
15906
|
+
await b(_, N.trim()), R(null), A("");
|
|
15907
|
+
} catch (X) {
|
|
15908
|
+
console.error("Failed to update title:", X);
|
|
15898
15909
|
}
|
|
15899
15910
|
}, H = () => {
|
|
15900
15911
|
R(null), A("");
|
|
15901
|
-
}, M = (_,
|
|
15902
|
-
_.key === "Enter" ?
|
|
15912
|
+
}, M = (_, X) => {
|
|
15913
|
+
_.key === "Enter" ? B(X) : _.key === "Escape" && H();
|
|
15903
15914
|
}, D = (_) => {
|
|
15904
15915
|
if (!_) return "";
|
|
15905
15916
|
try {
|
|
15906
|
-
const
|
|
15907
|
-
return Ce === 0 ?
|
|
15917
|
+
const X = new Date(_), we = (/* @__PURE__ */ new Date()).getTime() - X.getTime(), Ce = Math.floor(we / (1e3 * 60 * 60 * 24));
|
|
15918
|
+
return Ce === 0 ? X.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : Ce === 1 ? "Yesterday" : Ce < 7 ? `${Ce} days ago` : X.toLocaleDateString();
|
|
15908
15919
|
} catch {
|
|
15909
15920
|
return "";
|
|
15910
15921
|
}
|
|
15911
|
-
},
|
|
15922
|
+
}, G = (_) => _.title || `Thread ${_.threadId.slice(0, 8)}`;
|
|
15912
15923
|
return /* @__PURE__ */ c.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
|
|
15913
15924
|
t && /* @__PURE__ */ c.jsx("div", { className: s.header || "flex-shrink-0 p-2 border-b bg-slate-800 border-slate-700 text-slate-100 flex justify-end", children: /* @__PURE__ */ c.jsx(
|
|
15914
15925
|
Ve,
|
|
@@ -15933,32 +15944,32 @@ function Qc({
|
|
|
15933
15944
|
] }) : S.length === 0 ? /* @__PURE__ */ c.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
|
|
15934
15945
|
/* @__PURE__ */ c.jsx(Pm, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
|
|
15935
15946
|
/* @__PURE__ */ c.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
|
|
15936
|
-
] }) : S.slice().sort((_,
|
|
15947
|
+
] }) : S.slice().sort((_, X) => new Date(X.updatedAt || X.createdAt || "").getTime() - new Date(_.updatedAt || _.createdAt || "").getTime()).map((_) => /* @__PURE__ */ c.jsxs(
|
|
15937
15948
|
"div",
|
|
15938
15949
|
{
|
|
15939
15950
|
onClick: () => F(_.threadId),
|
|
15940
15951
|
className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? h) === _.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
|
|
15941
15952
|
children: [
|
|
15942
15953
|
/* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
15943
|
-
/* @__PURE__ */ c.jsx("div", { className: "flex-1 min-w-0", children: k === _.threadId ? /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", onClick: (
|
|
15944
|
-
/* @__PURE__ */ c.jsx(ps, { value:
|
|
15945
|
-
/* @__PURE__ */ c.jsx(Ve, { variant: "ghost", size: "sm", onClick: () =>
|
|
15954
|
+
/* @__PURE__ */ c.jsx("div", { className: "flex-1 min-w-0", children: k === _.threadId ? /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", onClick: (X) => X.stopPropagation(), children: [
|
|
15955
|
+
/* @__PURE__ */ c.jsx(ps, { value: N, onChange: (X) => A(X.target.value), onKeyDown: (X) => M(X, _.threadId), className: "h-6 text-sm", autoFocus: !0 }),
|
|
15956
|
+
/* @__PURE__ */ c.jsx(Ve, { variant: "ghost", size: "sm", onClick: () => B(_.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(ha, { size: 12 }) }),
|
|
15946
15957
|
/* @__PURE__ */ c.jsx(Ve, { variant: "ghost", size: "sm", onClick: H, className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(Cr, { size: 12 }) })
|
|
15947
15958
|
] }) : /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
|
|
15948
|
-
/* @__PURE__ */ c.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children:
|
|
15959
|
+
/* @__PURE__ */ c.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: G(_) }),
|
|
15949
15960
|
/* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
|
|
15950
15961
|
/* @__PURE__ */ c.jsx(Om, { size: 10 }),
|
|
15951
15962
|
/* @__PURE__ */ c.jsx("span", { children: D(_.updatedAt || _.createdAt) })
|
|
15952
15963
|
] })
|
|
15953
15964
|
] }) }),
|
|
15954
15965
|
/* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
|
|
15955
|
-
r && k !== _.threadId && /* @__PURE__ */ c.jsx(Ve, { variant: "ghost", size: "sm", onClick: (
|
|
15966
|
+
r && k !== _.threadId && /* @__PURE__ */ c.jsx(Ve, { variant: "ghost", size: "sm", onClick: (X) => z(_, X), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ c.jsx(su, { size: 12 }) }),
|
|
15956
15967
|
n && /* @__PURE__ */ c.jsx(
|
|
15957
15968
|
Ve,
|
|
15958
15969
|
{
|
|
15959
15970
|
variant: "ghost",
|
|
15960
15971
|
size: "sm",
|
|
15961
|
-
onClick: (
|
|
15972
|
+
onClick: (X) => E(_.threadId, X),
|
|
15962
15973
|
className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
|
|
15963
15974
|
title: "Delete thread",
|
|
15964
15975
|
children: /* @__PURE__ */ c.jsx(Mm, { size: 12 })
|
|
@@ -16286,7 +16297,7 @@ var gk = [" ", "Enter", "ArrowUp", "ArrowDown"], xk = [" ", "Enter"], ir = "Sele
|
|
|
16286
16297
|
disabled: h,
|
|
16287
16298
|
required: p,
|
|
16288
16299
|
form: y
|
|
16289
|
-
} = e, w = ti(t), [x, v] = m.useState(null), [b, S] = m.useState(null), [I, C] = m.useState(!1), k = Bs(u), [R,
|
|
16300
|
+
} = e, w = ti(t), [x, v] = m.useState(null), [b, S] = m.useState(null), [I, C] = m.useState(!1), k = Bs(u), [R, N] = rr({
|
|
16290
16301
|
prop: r,
|
|
16291
16302
|
defaultProp: o ?? !1,
|
|
16292
16303
|
onChange: s,
|
|
@@ -16296,7 +16307,7 @@ var gk = [" ", "Enter", "ArrowUp", "ArrowDown"], xk = [" ", "Enter"], ir = "Sele
|
|
|
16296
16307
|
defaultProp: a,
|
|
16297
16308
|
onChange: l,
|
|
16298
16309
|
caller: ir
|
|
16299
|
-
}), L = m.useRef(null), F = x ? y || !!x.closest("form") : !0, [V,
|
|
16310
|
+
}), L = m.useRef(null), F = x ? y || !!x.closest("form") : !0, [V, E] = m.useState(/* @__PURE__ */ new Set()), z = Array.from(V).map((B) => B.props.value).join(";");
|
|
16300
16311
|
return /* @__PURE__ */ c.jsx(qf, { ...w, children: /* @__PURE__ */ c.jsxs(
|
|
16301
16312
|
wk,
|
|
16302
16313
|
{
|
|
@@ -16312,7 +16323,7 @@ var gk = [" ", "Enter", "ArrowUp", "ArrowDown"], xk = [" ", "Enter"], ir = "Sele
|
|
|
16312
16323
|
value: A,
|
|
16313
16324
|
onValueChange: O,
|
|
16314
16325
|
open: R,
|
|
16315
|
-
onOpenChange:
|
|
16326
|
+
onOpenChange: N,
|
|
16316
16327
|
dir: k,
|
|
16317
16328
|
triggerPointerDownPosRef: L,
|
|
16318
16329
|
disabled: h,
|
|
@@ -16321,13 +16332,13 @@ var gk = [" ", "Enter", "ArrowUp", "ArrowDown"], xk = [" ", "Enter"], ir = "Sele
|
|
|
16321
16332
|
yk,
|
|
16322
16333
|
{
|
|
16323
16334
|
scope: e.__scopeSelect,
|
|
16324
|
-
onNativeOptionAdd: m.useCallback((
|
|
16325
|
-
|
|
16335
|
+
onNativeOptionAdd: m.useCallback((B) => {
|
|
16336
|
+
E((H) => new Set(H).add(B));
|
|
16326
16337
|
}, []),
|
|
16327
|
-
onNativeOptionRemove: m.useCallback((
|
|
16328
|
-
|
|
16338
|
+
onNativeOptionRemove: m.useCallback((B) => {
|
|
16339
|
+
E((H) => {
|
|
16329
16340
|
const M = new Set(H);
|
|
16330
|
-
return M.delete(
|
|
16341
|
+
return M.delete(B), M;
|
|
16331
16342
|
});
|
|
16332
16343
|
}, []),
|
|
16333
16344
|
children: n
|
|
@@ -16342,7 +16353,7 @@ var gk = [" ", "Enter", "ArrowUp", "ArrowDown"], xk = [" ", "Enter"], ir = "Sele
|
|
|
16342
16353
|
name: d,
|
|
16343
16354
|
autoComplete: f,
|
|
16344
16355
|
value: A,
|
|
16345
|
-
onChange: (
|
|
16356
|
+
onChange: (B) => O(B.target.value),
|
|
16346
16357
|
disabled: h,
|
|
16347
16358
|
form: y,
|
|
16348
16359
|
children: [
|
|
@@ -16350,7 +16361,7 @@ var gk = [" ", "Enter", "ArrowUp", "ArrowDown"], xk = [" ", "Enter"], ir = "Sele
|
|
|
16350
16361
|
Array.from(V)
|
|
16351
16362
|
]
|
|
16352
16363
|
},
|
|
16353
|
-
|
|
16364
|
+
z
|
|
16354
16365
|
) : null
|
|
16355
16366
|
]
|
|
16356
16367
|
}
|
|
@@ -16465,13 +16476,13 @@ var Xt = 10, [Op, Bn] = $r(ar), kk = "SelectContentImpl", Tk = Er("SelectContent
|
|
|
16465
16476
|
avoidCollisions: x,
|
|
16466
16477
|
//
|
|
16467
16478
|
...v
|
|
16468
|
-
} = e, b = zn(ar, n), [S, I] = m.useState(null), [C, k] = m.useState(null), R = Be(t, (K) => I(K)), [
|
|
16479
|
+
} = e, b = zn(ar, n), [S, I] = m.useState(null), [C, k] = m.useState(null), R = Be(t, (K) => I(K)), [N, A] = m.useState(null), [O, L] = m.useState(
|
|
16469
16480
|
null
|
|
16470
|
-
), F = ei(n), [V,
|
|
16481
|
+
), F = ei(n), [V, E] = m.useState(!1), z = m.useRef(!1);
|
|
16471
16482
|
m.useEffect(() => {
|
|
16472
16483
|
if (S) return Ua(S);
|
|
16473
16484
|
}, [S]), Ha();
|
|
16474
|
-
const
|
|
16485
|
+
const B = m.useCallback(
|
|
16475
16486
|
(K) => {
|
|
16476
16487
|
const [$, ...Y] = F().map((oe) => oe.ref.current), [J] = Y.slice(-1), me = document.activeElement;
|
|
16477
16488
|
for (const oe of K)
|
|
@@ -16479,8 +16490,8 @@ var Xt = 10, [Op, Bn] = $r(ar), kk = "SelectContentImpl", Tk = Er("SelectContent
|
|
|
16479
16490
|
},
|
|
16480
16491
|
[F, C]
|
|
16481
16492
|
), H = m.useCallback(
|
|
16482
|
-
() =>
|
|
16483
|
-
[
|
|
16493
|
+
() => B([N, S]),
|
|
16494
|
+
[B, N, S]
|
|
16484
16495
|
);
|
|
16485
16496
|
m.useEffect(() => {
|
|
16486
16497
|
V && H();
|
|
@@ -16508,18 +16519,18 @@ var Xt = 10, [Op, Bn] = $r(ar), kk = "SelectContentImpl", Tk = Er("SelectContent
|
|
|
16508
16519
|
window.removeEventListener("blur", K), window.removeEventListener("resize", K);
|
|
16509
16520
|
};
|
|
16510
16521
|
}, [M]);
|
|
16511
|
-
const [
|
|
16522
|
+
const [G, _] = Zp((K) => {
|
|
16512
16523
|
const $ = F().filter((me) => !me.disabled), Y = $.find((me) => me.ref.current === document.activeElement), J = Qp($, K, Y);
|
|
16513
16524
|
J && setTimeout(() => J.ref.current.focus());
|
|
16514
|
-
}),
|
|
16525
|
+
}), X = m.useCallback(
|
|
16515
16526
|
(K, $, Y) => {
|
|
16516
|
-
const J = !
|
|
16517
|
-
(b.value !== void 0 && b.value === $ || J) && (A(K), J && (
|
|
16527
|
+
const J = !z.current && !Y;
|
|
16528
|
+
(b.value !== void 0 && b.value === $ || J) && (A(K), J && (z.current = !0));
|
|
16518
16529
|
},
|
|
16519
16530
|
[b.value]
|
|
16520
|
-
),
|
|
16531
|
+
), ie = m.useCallback(() => S == null ? void 0 : S.focus(), [S]), we = m.useCallback(
|
|
16521
16532
|
(K, $, Y) => {
|
|
16522
|
-
const J = !
|
|
16533
|
+
const J = !z.current && !Y;
|
|
16523
16534
|
(b.value !== void 0 && b.value === $ || J) && L(K);
|
|
16524
16535
|
},
|
|
16525
16536
|
[b.value]
|
|
@@ -16542,15 +16553,15 @@ var Xt = 10, [Op, Bn] = $r(ar), kk = "SelectContentImpl", Tk = Er("SelectContent
|
|
|
16542
16553
|
content: S,
|
|
16543
16554
|
viewport: C,
|
|
16544
16555
|
onViewportChange: k,
|
|
16545
|
-
itemRefCallback:
|
|
16546
|
-
selectedItem:
|
|
16547
|
-
onItemLeave:
|
|
16556
|
+
itemRefCallback: X,
|
|
16557
|
+
selectedItem: N,
|
|
16558
|
+
onItemLeave: ie,
|
|
16548
16559
|
itemTextRefCallback: we,
|
|
16549
16560
|
focusSelectedItem: H,
|
|
16550
16561
|
selectedItemText: O,
|
|
16551
16562
|
position: r,
|
|
16552
16563
|
isPositioned: V,
|
|
16553
|
-
searchRef:
|
|
16564
|
+
searchRef: G,
|
|
16554
16565
|
children: /* @__PURE__ */ c.jsx(Ds, { as: Tk, allowPinchZoom: !0, children: /* @__PURE__ */ c.jsx(
|
|
16555
16566
|
Ps,
|
|
16556
16567
|
{
|
|
@@ -16582,7 +16593,7 @@ var Xt = 10, [Op, Bn] = $r(ar), kk = "SelectContentImpl", Tk = Er("SelectContent
|
|
|
16582
16593
|
onContextMenu: (K) => K.preventDefault(),
|
|
16583
16594
|
...v,
|
|
16584
16595
|
...de,
|
|
16585
|
-
onPlaced: () =>
|
|
16596
|
+
onPlaced: () => E(!0),
|
|
16586
16597
|
ref: R,
|
|
16587
16598
|
style: {
|
|
16588
16599
|
// flex layout so we can place the scroll buttons properly
|
|
@@ -16600,7 +16611,7 @@ var Xt = 10, [Op, Bn] = $r(ar), kk = "SelectContentImpl", Tk = Er("SelectContent
|
|
|
16600
16611
|
const me = K.target, oe = J.indexOf(me);
|
|
16601
16612
|
J = J.slice(oe + 1);
|
|
16602
16613
|
}
|
|
16603
|
-
setTimeout(() =>
|
|
16614
|
+
setTimeout(() => B(J)), K.preventDefault();
|
|
16604
16615
|
}
|
|
16605
16616
|
})
|
|
16606
16617
|
}
|
|
@@ -16617,9 +16628,9 @@ Mp.displayName = kk;
|
|
|
16617
16628
|
var Ik = "SelectItemAlignedPosition", Dp = m.forwardRef((e, t) => {
|
|
16618
16629
|
const { __scopeSelect: n, onPlaced: r, ...o } = e, s = zn(ar, n), i = Bn(ar, n), [a, l] = m.useState(null), [u, d] = m.useState(null), f = Be(t, (R) => d(R)), h = ei(n), p = m.useRef(!1), y = m.useRef(!0), { viewport: w, selectedItem: x, selectedItemText: v, focusSelectedItem: b } = i, S = m.useCallback(() => {
|
|
16619
16630
|
if (s.trigger && s.valueNode && a && u && w && x && v) {
|
|
16620
|
-
const R = s.trigger.getBoundingClientRect(),
|
|
16631
|
+
const R = s.trigger.getBoundingClientRect(), N = u.getBoundingClientRect(), A = s.valueNode.getBoundingClientRect(), O = v.getBoundingClientRect();
|
|
16621
16632
|
if (s.dir !== "rtl") {
|
|
16622
|
-
const me = O.left -
|
|
16633
|
+
const me = O.left - N.left, oe = A.left - me, te = R.left - oe, Xe = R.width + te, Ue = Math.max(Xe, N.width), Oe = window.innerWidth - Xt, $e = sa(oe, [
|
|
16623
16634
|
Xt,
|
|
16624
16635
|
// Prevents the content from going off the starting edge of the
|
|
16625
16636
|
// viewport. It may still go off the ending edge, but this can be
|
|
@@ -16630,20 +16641,20 @@ var Ik = "SelectItemAlignedPosition", Dp = m.forwardRef((e, t) => {
|
|
|
16630
16641
|
]);
|
|
16631
16642
|
a.style.minWidth = Xe + "px", a.style.left = $e + "px";
|
|
16632
16643
|
} else {
|
|
16633
|
-
const me =
|
|
16644
|
+
const me = N.right - O.right, oe = window.innerWidth - A.right - me, te = window.innerWidth - R.right - oe, Xe = R.width + te, Ue = Math.max(Xe, N.width), Oe = window.innerWidth - Xt, $e = sa(oe, [
|
|
16634
16645
|
Xt,
|
|
16635
16646
|
Math.max(Xt, Oe - Ue)
|
|
16636
16647
|
]);
|
|
16637
16648
|
a.style.minWidth = Xe + "px", a.style.right = $e + "px";
|
|
16638
16649
|
}
|
|
16639
|
-
const L = h(), F = window.innerHeight - Xt * 2, V = w.scrollHeight,
|
|
16650
|
+
const L = h(), F = window.innerHeight - Xt * 2, V = w.scrollHeight, E = window.getComputedStyle(u), z = parseInt(E.borderTopWidth, 10), B = parseInt(E.paddingTop, 10), H = parseInt(E.borderBottomWidth, 10), M = parseInt(E.paddingBottom, 10), D = z + B + V + M + H, G = Math.min(x.offsetHeight * 5, D), _ = window.getComputedStyle(w), X = parseInt(_.paddingTop, 10), ie = parseInt(_.paddingBottom, 10), we = R.top + R.height / 2 - Xt, Ce = F - we, de = x.offsetHeight / 2, K = x.offsetTop + de, $ = z + B + K, Y = D - $;
|
|
16640
16651
|
if ($ <= we) {
|
|
16641
16652
|
const me = L.length > 0 && x === L[L.length - 1].ref.current;
|
|
16642
16653
|
a.style.bottom = "0px";
|
|
16643
16654
|
const oe = u.clientHeight - w.offsetTop - w.offsetHeight, te = Math.max(
|
|
16644
16655
|
Ce,
|
|
16645
16656
|
de + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
16646
|
-
(me ?
|
|
16657
|
+
(me ? ie : 0) + oe + H
|
|
16647
16658
|
), Xe = $ + te;
|
|
16648
16659
|
a.style.height = Xe + "px";
|
|
16649
16660
|
} else {
|
|
@@ -16651,12 +16662,12 @@ var Ik = "SelectItemAlignedPosition", Dp = m.forwardRef((e, t) => {
|
|
|
16651
16662
|
a.style.top = "0px";
|
|
16652
16663
|
const te = Math.max(
|
|
16653
16664
|
we,
|
|
16654
|
-
|
|
16655
|
-
(me ?
|
|
16665
|
+
z + w.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
16666
|
+
(me ? X : 0) + de
|
|
16656
16667
|
) + Y;
|
|
16657
16668
|
a.style.height = te + "px", w.scrollTop = $ - we + w.offsetTop;
|
|
16658
16669
|
}
|
|
16659
|
-
a.style.margin = `${Xt}px 0`, a.style.minHeight =
|
|
16670
|
+
a.style.margin = `${Xt}px 0`, a.style.minHeight = G + "px", a.style.maxHeight = F + "px", r == null || r(), requestAnimationFrame(() => p.current = !0);
|
|
16660
16671
|
}
|
|
16661
16672
|
}, [
|
|
16662
16673
|
h,
|