teodor-new-chat-ui 4.3.112 → 4.3.114
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 +144 -144
- package/dist/index.umd.js +9 -9
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -212,13 +212,13 @@ function Ag() {
|
|
|
212
212
|
` + ee + R;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
var
|
|
215
|
+
var Y = !1, ae;
|
|
216
216
|
{
|
|
217
217
|
var fe = typeof WeakMap == "function" ? WeakMap : Map;
|
|
218
218
|
ae = new fe();
|
|
219
219
|
}
|
|
220
220
|
function z(R, q) {
|
|
221
|
-
if (!R ||
|
|
221
|
+
if (!R || Y)
|
|
222
222
|
return "";
|
|
223
223
|
{
|
|
224
224
|
var ue = ae.get(R);
|
|
@@ -226,7 +226,7 @@ function Ag() {
|
|
|
226
226
|
return ue;
|
|
227
227
|
}
|
|
228
228
|
var ke;
|
|
229
|
-
|
|
229
|
+
Y = !0;
|
|
230
230
|
var Xe = Error.prepareStackTrace;
|
|
231
231
|
Error.prepareStackTrace = void 0;
|
|
232
232
|
var ct;
|
|
@@ -283,7 +283,7 @@ function Ag() {
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
} finally {
|
|
286
|
-
|
|
286
|
+
Y = !1, Re.current = ct, se(), Error.prepareStackTrace = Xe;
|
|
287
287
|
}
|
|
288
288
|
var Yt = R ? R.displayName || R.name : "", J = Yt ? M(Yt) : "";
|
|
289
289
|
return typeof R == "function" && ae.set(R, J), J;
|
|
@@ -470,7 +470,7 @@ function Ag() {
|
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
var Pt = m.ReactCurrentOwner, bt = m.ReactDebugCurrentFrame;
|
|
473
|
-
function
|
|
473
|
+
function G(R) {
|
|
474
474
|
if (R) {
|
|
475
475
|
var q = R._owner, ue = _e(R.type, R._source, q ? q.type : null);
|
|
476
476
|
bt.setExtraStackFrame(ue);
|
|
@@ -520,7 +520,7 @@ Check the top-level render call using <` + ue + ">.");
|
|
|
520
520
|
return;
|
|
521
521
|
mt[ue] = !0;
|
|
522
522
|
var ke = "";
|
|
523
|
-
R && R._owner && R._owner !== Pt.current && (ke = " It was passed a child from " + W(R._owner.type) + "."),
|
|
523
|
+
R && R._owner && R._owner !== Pt.current && (ke = " It was passed a child from " + W(R._owner.type) + "."), G(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ue, ke), G(null);
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
526
|
function Me(R, q) {
|
|
@@ -572,11 +572,11 @@ Check the top-level render call using <` + ue + ">.");
|
|
|
572
572
|
for (var q = Object.keys(R.props), ue = 0; ue < q.length; ue++) {
|
|
573
573
|
var ke = q[ue];
|
|
574
574
|
if (ke !== "children" && ke !== "key") {
|
|
575
|
-
|
|
575
|
+
G(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", ke), G(null);
|
|
576
576
|
break;
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
R.ref !== null && (
|
|
579
|
+
R.ref !== null && (G(R), w("Invalid attribute `ref` supplied to `React.Fragment`."), G(null));
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
var mr = {};
|
|
@@ -3352,7 +3352,7 @@ function Dy(e = {}) {
|
|
|
3352
3352
|
threadId: P.threadId ?? null,
|
|
3353
3353
|
headers: {}
|
|
3354
3354
|
}, (async () => {
|
|
3355
|
-
var be, Ae, Z, se, Re, ee, M,
|
|
3355
|
+
var be, Ae, Z, se, Re, ee, M, Y, ae, fe, z, le, Q, _e, ve, Oe, Ve, Ze;
|
|
3356
3356
|
const oe = (Qe) => {
|
|
3357
3357
|
var Ce;
|
|
3358
3358
|
try {
|
|
@@ -3378,8 +3378,8 @@ function Dy(e = {}) {
|
|
|
3378
3378
|
Te && (bt = ((Z = JSON.parse(Te)) == null ? void 0 : Z.apiKey) || null);
|
|
3379
3379
|
} catch {
|
|
3380
3380
|
}
|
|
3381
|
-
const
|
|
3382
|
-
|
|
3381
|
+
const G = Le || Pt || bt || null;
|
|
3382
|
+
G && (Qe = { Authorization: `Bearer ${G}` });
|
|
3383
3383
|
}
|
|
3384
3384
|
} catch {
|
|
3385
3385
|
}
|
|
@@ -3448,9 +3448,9 @@ function Dy(e = {}) {
|
|
|
3448
3448
|
...S.current,
|
|
3449
3449
|
threadId: Pt
|
|
3450
3450
|
}), (ee = j == null ? void 0 : j.onOpen) == null || ee.call(j, { threadId: Pt, created: bt }); ; ) {
|
|
3451
|
-
const { value:
|
|
3451
|
+
const { value: G, done: Te } = await Je.read();
|
|
3452
3452
|
if (Te) break;
|
|
3453
|
-
ht += Nt.decode(
|
|
3453
|
+
ht += Nt.decode(G, { stream: !0 }), ht.length > qt && (ht = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3454
3454
|
let pe;
|
|
3455
3455
|
for (; (pe = ht.indexOf(`
|
|
3456
3456
|
|
|
@@ -3511,7 +3511,7 @@ function Dy(e = {}) {
|
|
|
3511
3511
|
} else if (Be.type === "heartbeat") {
|
|
3512
3512
|
console.debug("[use-chat] heartbeat received");
|
|
3513
3513
|
try {
|
|
3514
|
-
(
|
|
3514
|
+
(Y = j == null ? void 0 : j.onHeartbeat) == null || Y.call(j, Be);
|
|
3515
3515
|
} catch (Me) {
|
|
3516
3516
|
console.warn("[use-chat] heartbeat callback failed", Me);
|
|
3517
3517
|
}
|
|
@@ -4097,7 +4097,7 @@ function av({
|
|
|
4097
4097
|
qo(() => {
|
|
4098
4098
|
C(Jo(E));
|
|
4099
4099
|
});
|
|
4100
|
-
}, [w]), [be, Ae] = we(!1), [Z, se] = we(!1), [Re, ee] = we(null), [M,
|
|
4100
|
+
}, [w]), [be, Ae] = we(!1), [Z, se] = we(!1), [Re, ee] = we(null), [M, Y] = we(void 0), [ae, fe] = we(void 0), [z, le] = we(void 0), {
|
|
4101
4101
|
state: Q,
|
|
4102
4102
|
dispatch: _e,
|
|
4103
4103
|
seed: ve,
|
|
@@ -4219,15 +4219,15 @@ function av({
|
|
|
4219
4219
|
rt.current ? ut.current.push(ce) : ce().catch((re) => {
|
|
4220
4220
|
K(re);
|
|
4221
4221
|
});
|
|
4222
|
-
}), []),
|
|
4222
|
+
}), []), G = Ee(S.length), Te = Ee(!1);
|
|
4223
4223
|
yt(() => {
|
|
4224
|
-
|
|
4224
|
+
G.current = S.length;
|
|
4225
4225
|
}, [S.length]), yt(() => {
|
|
4226
4226
|
const E = Q.pendingInterrupt ?? Uy(Q.messages);
|
|
4227
4227
|
jc(U, E) || $(E ?? null);
|
|
4228
4228
|
}, [U, Q.messages, Q.pendingInterrupt]);
|
|
4229
4229
|
const pe = me(async () => {
|
|
4230
|
-
const E =
|
|
4230
|
+
const E = G.current > 0;
|
|
4231
4231
|
E || A(!0);
|
|
4232
4232
|
try {
|
|
4233
4233
|
const I = await c.listThreads();
|
|
@@ -4305,7 +4305,7 @@ function av({
|
|
|
4305
4305
|
checkpointId: re.checkpointId ?? null,
|
|
4306
4306
|
checkpointNs: re.checkpointNs ?? null,
|
|
4307
4307
|
pendingInterrupt: re.interrupt ?? null
|
|
4308
|
-
}), $(re.interrupt ?? null), ee(re.nextCursor ?? null), Ae(!!re.nextCursor),
|
|
4308
|
+
}), $(re.interrupt ?? null), ee(re.nextCursor ?? null), Ae(!!re.nextCursor), Y(re.checkpointId ?? void 0), fe(re.checkpointNs ?? void 0), le(re.nextCursorNs ?? void 0);
|
|
4309
4309
|
return;
|
|
4310
4310
|
}
|
|
4311
4311
|
const We = Nt.current.get(ce), Tt = (We == null ? void 0 : We.snapshot) ?? null, _t = Array.isArray(Tt == null ? void 0 : Tt.messages) ? Tt.messages : [], Zt = gn(Tt), _n = Array.isArray(E == null ? void 0 : E.messages) ? E.messages : [], Wt = /* @__PURE__ */ new Set(), $t = [..._n, ..._t].filter((Vt) => {
|
|
@@ -4337,7 +4337,7 @@ function av({
|
|
|
4337
4337
|
(Vt) => yr !== void 0 ? yr ?? Vt ?? null : Vt ?? null
|
|
4338
4338
|
), Ae(
|
|
4339
4339
|
(Vt) => yr !== void 0 ? !!yr : Vt
|
|
4340
|
-
),
|
|
4340
|
+
), Y(
|
|
4341
4341
|
(Vt) => $r !== void 0 ? $r ?? Vt ?? void 0 : Vt ?? void 0
|
|
4342
4342
|
), fe(
|
|
4343
4343
|
(Vt) => tr !== void 0 ? tr ?? Vt ?? void 0 : Vt ?? void 0
|
|
@@ -4355,7 +4355,7 @@ function av({
|
|
|
4355
4355
|
checkpointId: I.checkpointId ?? null,
|
|
4356
4356
|
checkpointNs: I.checkpointNs ?? null,
|
|
4357
4357
|
pendingInterrupt: I.interrupt ?? null
|
|
4358
|
-
}), $(I.interrupt ?? null), ee(I.nextCursor ?? null), Ae(!!I.nextCursor),
|
|
4358
|
+
}), $(I.interrupt ?? null), ee(I.nextCursor ?? null), Ae(!!I.nextCursor), Y(I.checkpointId ?? void 0), fe(I.checkpointNs ?? void 0), le(I.nextCursorNs ?? void 0), ht.current = E.threadId, Ut(E.threadId ?? Ce.current ?? null);
|
|
4359
4359
|
},
|
|
4360
4360
|
[ve, $, Ut]
|
|
4361
4361
|
), ue = me((E) => {
|
|
@@ -4369,7 +4369,7 @@ function av({
|
|
|
4369
4369
|
ht.current === E && (ht.current = null);
|
|
4370
4370
|
}, [y]), ke = me(() => {
|
|
4371
4371
|
const E = Ce.current;
|
|
4372
|
-
E && ue(E), Qe([]), Ae(!1), se(!1), ee(null),
|
|
4372
|
+
E && ue(E), Qe([]), Ae(!1), se(!1), ee(null), Y(void 0), fe(void 0), le(void 0);
|
|
4373
4373
|
}, [ue, Qe]), Xe = me(({ from: E, to: I }) => {
|
|
4374
4374
|
const H = Ce.current;
|
|
4375
4375
|
H && console.warn(
|
|
@@ -4694,7 +4694,7 @@ function av({
|
|
|
4694
4694
|
), Kl = me(async () => {
|
|
4695
4695
|
await bt(async () => {
|
|
4696
4696
|
const E = Ce.current;
|
|
4697
|
-
E && ue(E), Je.current = null, _(null), Ce.current = null, ht.current = null, ke(),
|
|
4697
|
+
E && ue(E), Je.current = null, _(null), Ce.current = null, ht.current = null, ke(), Y(void 0), fe(void 0), le(void 0), ne([]);
|
|
4698
4698
|
try {
|
|
4699
4699
|
localStorage.removeItem("lastThreadId");
|
|
4700
4700
|
} catch (I) {
|
|
@@ -6739,9 +6739,9 @@ const Pr = at(
|
|
|
6739
6739
|
const se = F[0], Re = F[F.length - 1];
|
|
6740
6740
|
let ee = 0;
|
|
6741
6741
|
for (const M of oi($, se, Re)) {
|
|
6742
|
-
const
|
|
6742
|
+
const Y = M.value, ae = Math.max(M.start, se), fe = Math.min(M.end, Re);
|
|
6743
6743
|
for (let z = ae; z <= fe; z++)
|
|
6744
|
-
ne.push({ data: B == null ? void 0 : B[z], index: z, offset: ee, size:
|
|
6744
|
+
ne.push({ data: B == null ? void 0 : B[z], index: z, offset: ee, size: Y }), ee += Y;
|
|
6745
6745
|
}
|
|
6746
6746
|
}
|
|
6747
6747
|
if (!D)
|
|
@@ -6752,16 +6752,16 @@ const Pr = at(
|
|
|
6752
6752
|
const Ae = _ - 1, Z = ri([], (se) => {
|
|
6753
6753
|
for (const Re of be) {
|
|
6754
6754
|
const ee = Re.value;
|
|
6755
|
-
let M = ee.offset,
|
|
6755
|
+
let M = ee.offset, Y = Re.start;
|
|
6756
6756
|
const ae = ee.size;
|
|
6757
6757
|
if (ee.offset < S) {
|
|
6758
|
-
|
|
6759
|
-
const z =
|
|
6758
|
+
Y += Math.floor((S - ee.offset + P) / (ae + P));
|
|
6759
|
+
const z = Y - Re.start;
|
|
6760
6760
|
M += z * ae + z * P;
|
|
6761
6761
|
}
|
|
6762
|
-
|
|
6762
|
+
Y < oe && (M += (oe - Y) * ae, Y = oe);
|
|
6763
6763
|
const fe = Math.min(Re.end, Ae);
|
|
6764
|
-
for (let z =
|
|
6764
|
+
for (let z = Y; z <= fe && !(M >= k); z++)
|
|
6765
6765
|
se.push({ data: B == null ? void 0 : B[z], index: z, offset: M, size: ae }), M += ae + P;
|
|
6766
6766
|
}
|
|
6767
6767
|
});
|
|
@@ -7932,7 +7932,7 @@ const Rw = /* @__PURE__ */ at(
|
|
|
7932
7932
|
X(
|
|
7933
7933
|
g,
|
|
7934
7934
|
Ye(L),
|
|
7935
|
-
Pe(([M,
|
|
7935
|
+
Pe(([M, Y]) => !!Y)
|
|
7936
7936
|
),
|
|
7937
7937
|
() => {
|
|
7938
7938
|
He(ne, !1);
|
|
@@ -7940,7 +7940,7 @@ const Rw = /* @__PURE__ */ at(
|
|
|
7940
7940
|
), ft(
|
|
7941
7941
|
X(
|
|
7942
7942
|
zt(g, ne, A, N, L, oe),
|
|
7943
|
-
Pe(([M,
|
|
7943
|
+
Pe(([M, Y, ae, fe, , z]) => M && !Y && ae.height !== 0 && fe.height !== 0 && !z)
|
|
7944
7944
|
),
|
|
7945
7945
|
([, , , , M]) => {
|
|
7946
7946
|
He(oe, !0), al(1, () => {
|
|
@@ -7963,7 +7963,7 @@ const Rw = /* @__PURE__ */ at(
|
|
|
7963
7963
|
Pe(([, M]) => M != null)
|
|
7964
7964
|
),
|
|
7965
7965
|
([, M]) => {
|
|
7966
|
-
M && (He(N, M.viewport), He(A, M.item), He(B, M.gap), M.scrollTop > 0 && (He($, !0), kn(X(c, Er(1)), (
|
|
7966
|
+
M && (He(N, M.viewport), He(A, M.item), He(B, M.gap), M.scrollTop > 0 && (He($, !0), kn(X(c, Er(1)), (Y) => {
|
|
7967
7967
|
He($, !1);
|
|
7968
7968
|
}), He(l, { top: M.scrollTop })));
|
|
7969
7969
|
}
|
|
@@ -7978,12 +7978,12 @@ const Rw = /* @__PURE__ */ at(
|
|
|
7978
7978
|
zt(
|
|
7979
7979
|
je(N, Qo),
|
|
7980
7980
|
je(A, Qo),
|
|
7981
|
-
je(B, (M,
|
|
7981
|
+
je(B, (M, Y) => M && M.column === Y.column && M.row === Y.row),
|
|
7982
7982
|
je(c)
|
|
7983
7983
|
),
|
|
7984
|
-
ge(([M,
|
|
7984
|
+
ge(([M, Y, ae, fe]) => ({
|
|
7985
7985
|
gap: ae,
|
|
7986
|
-
item:
|
|
7986
|
+
item: Y,
|
|
7987
7987
|
scrollTop: fe,
|
|
7988
7988
|
viewport: M
|
|
7989
7989
|
}))
|
|
@@ -8007,7 +8007,7 @@ const Rw = /* @__PURE__ */ at(
|
|
|
8007
8007
|
ge(
|
|
8008
8008
|
([
|
|
8009
8009
|
M,
|
|
8010
|
-
[
|
|
8010
|
+
[Y, ae],
|
|
8011
8011
|
fe,
|
|
8012
8012
|
z,
|
|
8013
8013
|
le,
|
|
@@ -8026,7 +8026,7 @@ const Rw = /* @__PURE__ */ at(
|
|
|
8026
8026
|
}
|
|
8027
8027
|
const ut = af(rt, Ce, Ve);
|
|
8028
8028
|
let ot, Je;
|
|
8029
|
-
ve ?
|
|
8029
|
+
ve ? Y === 0 && ae === 0 && _e > 0 ? (ot = 0, Je = _e - 1) : (ot = ut * _s((Y + Ze) / (Qe + Ze)), Je = ut * Jc((ae + Ze) / (Qe + Ze)) - 1, Je = Yi(M - 1, yo(Je, ut - 1)), ot = Yi(Je, yo(0, ot))) : (ot = 0, Je = -1);
|
|
8030
8030
|
const Nt = Qc(ot, Je, Q), { bottom: ht, top: kt } = eu(le, fe, z, Nt), At = Jc(M / ut), et = At * Qe + (At - 1) * Ze - ht;
|
|
8031
8031
|
return { bottom: ht, itemHeight: Qe, items: Nt, itemWidth: Ce, offsetBottom: et, offsetTop: kt, top: kt };
|
|
8032
8032
|
}
|
|
@@ -8043,9 +8043,9 @@ const Rw = /* @__PURE__ */ at(
|
|
|
8043
8043
|
), Se(
|
|
8044
8044
|
X(
|
|
8045
8045
|
zt(N, A, _, B),
|
|
8046
|
-
Pe(([M,
|
|
8047
|
-
ge(([M,
|
|
8048
|
-
const { bottom: z, top: le } = eu(M, fe,
|
|
8046
|
+
Pe(([M, Y, { items: ae }]) => ae.length > 0 && Y.height !== 0 && M.height !== 0),
|
|
8047
|
+
ge(([M, Y, { items: ae }, fe]) => {
|
|
8048
|
+
const { bottom: z, top: le } = eu(M, fe, Y, ae);
|
|
8049
8049
|
return [le, z];
|
|
8050
8050
|
}),
|
|
8051
8051
|
Et(Ro)
|
|
@@ -8057,7 +8057,7 @@ const Rw = /* @__PURE__ */ at(
|
|
|
8057
8057
|
X(
|
|
8058
8058
|
c,
|
|
8059
8059
|
Ye(Ae),
|
|
8060
|
-
ge(([M,
|
|
8060
|
+
ge(([M, Y]) => Y || M !== 0)
|
|
8061
8061
|
),
|
|
8062
8062
|
Ae
|
|
8063
8063
|
);
|
|
@@ -8066,9 +8066,9 @@ const Rw = /* @__PURE__ */ at(
|
|
|
8066
8066
|
zt(_, S),
|
|
8067
8067
|
Pe(([{ items: M }]) => M.length > 0),
|
|
8068
8068
|
Ye(Ae),
|
|
8069
|
-
Pe(([[M,
|
|
8070
|
-
const fe = M.items[M.items.length - 1].index ===
|
|
8071
|
-
return (ae || M.bottom > 0 && M.itemHeight > 0 && M.offsetBottom === 0 && M.items.length ===
|
|
8069
|
+
Pe(([[M, Y], ae]) => {
|
|
8070
|
+
const fe = M.items[M.items.length - 1].index === Y - 1;
|
|
8071
|
+
return (ae || M.bottom > 0 && M.itemHeight > 0 && M.offsetBottom === 0 && M.items.length === Y) && fe;
|
|
8072
8072
|
}),
|
|
8073
8073
|
ge(([[, M]]) => M - 1),
|
|
8074
8074
|
Et()
|
|
@@ -8084,7 +8084,7 @@ const Rw = /* @__PURE__ */ at(
|
|
|
8084
8084
|
X(
|
|
8085
8085
|
je(_),
|
|
8086
8086
|
Ye($),
|
|
8087
|
-
Pe(([{ items: M },
|
|
8087
|
+
Pe(([{ items: M }, Y]) => M.length > 0 && !Y),
|
|
8088
8088
|
ge(([{ items: M }]) => ({
|
|
8089
8089
|
endIndex: M[M.length - 1].index,
|
|
8090
8090
|
startIndex: M[0].index
|
|
@@ -8097,12 +8097,12 @@ const Rw = /* @__PURE__ */ at(
|
|
|
8097
8097
|
X(
|
|
8098
8098
|
D,
|
|
8099
8099
|
Ye(N, A, S, B),
|
|
8100
|
-
ge(([M,
|
|
8100
|
+
ge(([M, Y, ae, fe, z]) => {
|
|
8101
8101
|
const le = Ud(M), { align: Q, behavior: _e, offset: ve } = le;
|
|
8102
8102
|
let Oe = le.index;
|
|
8103
8103
|
Oe === "LAST" && (Oe = fe - 1), Oe = yo(0, Oe, Yi(fe - 1, Oe));
|
|
8104
|
-
let Ve = Ea(
|
|
8105
|
-
return Q === "end" ? Ve = Zc(Ve -
|
|
8104
|
+
let Ve = Ea(Y, z, ae, Oe);
|
|
8105
|
+
return Q === "end" ? Ve = Zc(Ve - Y.height + ae.height) : Q === "center" && (Ve = Zc(Ve - Y.height / 2 + ae.height / 2)), ve && (Ve += ve), { behavior: _e, top: Ve };
|
|
8106
8106
|
})
|
|
8107
8107
|
),
|
|
8108
8108
|
l
|
|
@@ -11828,7 +11828,7 @@ const Tu = V.memo(function({
|
|
|
11828
11828
|
fileViewerOpen: Re,
|
|
11829
11829
|
currentFileInfo: ee,
|
|
11830
11830
|
closeFileViewer: M
|
|
11831
|
-
} = H0({ allowFileOpen: Ae, currentThreadId: j }),
|
|
11831
|
+
} = H0({ allowFileOpen: Ae, currentThreadId: j }), Y = V.useMemo(() => {
|
|
11832
11832
|
switch (L) {
|
|
11833
11833
|
case "user":
|
|
11834
11834
|
return "text-[hsl(var(--chat-bubble-user-text))]";
|
|
@@ -11842,16 +11842,16 @@ const Tu = V.memo(function({
|
|
|
11842
11842
|
return "text-[hsl(var(--chat-bubble-ai-text))]";
|
|
11843
11843
|
}
|
|
11844
11844
|
}, [L]), ae = st(() => oe ? "" : L0(t.content), [oe, t]), fe = st(() => oe ? {} : nh(t), [oe, t]), z = st(
|
|
11845
|
-
() => oe ? [] : t.content.filter((
|
|
11845
|
+
() => oe ? [] : t.content.filter((G) => G.type === "image_url"),
|
|
11846
11846
|
[oe, t]
|
|
11847
11847
|
), le = st(
|
|
11848
|
-
() => oe ? [] : t.content.filter((
|
|
11848
|
+
() => oe ? [] : t.content.filter((G) => G.type === "file"),
|
|
11849
11849
|
[oe, t]
|
|
11850
11850
|
), Q = st(
|
|
11851
|
-
() => oe ? [] : t.content.filter((
|
|
11851
|
+
() => oe ? [] : t.content.filter((G) => G.type === "interrupt"),
|
|
11852
11852
|
[oe, t]
|
|
11853
11853
|
), _e = (m == null ? void 0 : m.id) ?? (m == null ? void 0 : m.interrupt_id), ve = is(_e), Oe = m == null ? void 0 : m.value, Ve = st(() => oe ? "" : $0(t.content), [oe, t]), Ze = V.useCallback(async () => {
|
|
11854
|
-
const
|
|
11854
|
+
const G = ne ? Ve : ae;
|
|
11855
11855
|
async function Te(pe) {
|
|
11856
11856
|
if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
|
|
11857
11857
|
await navigator.clipboard.writeText(pe);
|
|
@@ -11869,21 +11869,21 @@ const Tu = V.memo(function({
|
|
|
11869
11869
|
throw new Error("Clipboard API not supported in this context.");
|
|
11870
11870
|
}
|
|
11871
11871
|
try {
|
|
11872
|
-
await Te(
|
|
11872
|
+
await Te(G), D(!0), setTimeout(() => D(!1), 2e3), y == null || y(G);
|
|
11873
11873
|
} catch (pe) {
|
|
11874
11874
|
console.error("Failed to copy:", pe);
|
|
11875
11875
|
}
|
|
11876
11876
|
}, [ne, Ve, ae, y]), Qe = V.useCallback(() => {
|
|
11877
11877
|
if (!p) return;
|
|
11878
|
-
const
|
|
11878
|
+
const G = ne ? Ve : ae, Te = "type" in t && t.type === "default_message" ? void 0 : {
|
|
11879
11879
|
checkpointId: t.checkpointId ?? null,
|
|
11880
11880
|
checkpointNs: t.checkpointNs ?? null
|
|
11881
11881
|
};
|
|
11882
|
-
p(t.id,
|
|
11882
|
+
p(t.id, G, Te);
|
|
11883
11883
|
}, [p, t.id, ne, Ve, ae, t]), Ce = V.useCallback(() => {
|
|
11884
11884
|
g == null || g(n);
|
|
11885
11885
|
}, [g, n]), rt = V.useCallback(() => {
|
|
11886
|
-
const Te = ie($ ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0",
|
|
11886
|
+
const Te = ie($ ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", Y);
|
|
11887
11887
|
switch (L) {
|
|
11888
11888
|
case "user":
|
|
11889
11889
|
return /* @__PURE__ */ u.jsx(ug, { className: Te });
|
|
@@ -11894,26 +11894,26 @@ const Tu = V.memo(function({
|
|
|
11894
11894
|
default:
|
|
11895
11895
|
return /* @__PURE__ */ u.jsx(Pi, { className: Te });
|
|
11896
11896
|
}
|
|
11897
|
-
}, [$,
|
|
11898
|
-
const
|
|
11897
|
+
}, [$, Y, L]), ut = V.useCallback(() => {
|
|
11898
|
+
const G = "group relative mb-4 flex w-full";
|
|
11899
11899
|
switch (L) {
|
|
11900
11900
|
case "user":
|
|
11901
|
-
return ie(
|
|
11901
|
+
return ie(G, "justify-end");
|
|
11902
11902
|
case "assistant":
|
|
11903
11903
|
case "tool":
|
|
11904
11904
|
case "system":
|
|
11905
|
-
return ie(
|
|
11905
|
+
return ie(G, "justify-start");
|
|
11906
11906
|
default:
|
|
11907
|
-
return
|
|
11907
|
+
return G;
|
|
11908
11908
|
}
|
|
11909
11909
|
}, [L]), ot = V.useCallback(() => {
|
|
11910
|
-
const
|
|
11910
|
+
const G = ie(
|
|
11911
11911
|
"rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
|
|
11912
11912
|
$ && "px-3 py-2 text-sm"
|
|
11913
11913
|
);
|
|
11914
11914
|
if (be)
|
|
11915
11915
|
return ie(
|
|
11916
|
-
|
|
11916
|
+
G,
|
|
11917
11917
|
"w-full",
|
|
11918
11918
|
"bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
|
|
11919
11919
|
"border border-border/60 dark:border-border/40 shadow-sm"
|
|
@@ -11921,25 +11921,25 @@ const Tu = V.memo(function({
|
|
|
11921
11921
|
switch (L) {
|
|
11922
11922
|
case "user":
|
|
11923
11923
|
return ie(
|
|
11924
|
-
|
|
11924
|
+
G,
|
|
11925
11925
|
"w-full md:max-w-[95%]",
|
|
11926
11926
|
"bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
|
|
11927
11927
|
"border border-transparent"
|
|
11928
11928
|
);
|
|
11929
11929
|
case "assistant":
|
|
11930
11930
|
return ie(
|
|
11931
|
-
|
|
11931
|
+
G,
|
|
11932
11932
|
"w-full md:max-w-[95%]",
|
|
11933
11933
|
"bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
|
|
11934
11934
|
"border border-border/60 dark:border-border/40"
|
|
11935
11935
|
);
|
|
11936
11936
|
case "tool":
|
|
11937
|
-
return ie(
|
|
11937
|
+
return ie(G, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
|
|
11938
11938
|
case "system":
|
|
11939
|
-
return ie(
|
|
11939
|
+
return ie(G, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
|
|
11940
11940
|
default:
|
|
11941
11941
|
return ie(
|
|
11942
|
-
|
|
11942
|
+
G,
|
|
11943
11943
|
"w-full md:max-w-[95%]",
|
|
11944
11944
|
"bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
|
|
11945
11945
|
"border border-border/60 dark:border-border/40"
|
|
@@ -11949,7 +11949,7 @@ const Tu = V.memo(function({
|
|
|
11949
11949
|
if (be && oe)
|
|
11950
11950
|
return /* @__PURE__ */ u.jsx("div", { className: ie(ut(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: ie(ot(), h.content), children: [
|
|
11951
11951
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 mb-2 pb-2 border-b border-current/10", children: [
|
|
11952
|
-
/* @__PURE__ */ u.jsx(Pi, { className: ie("h-4 w-4",
|
|
11952
|
+
/* @__PURE__ */ u.jsx(Pi, { className: ie("h-4 w-4", Y) }),
|
|
11953
11953
|
a && /* @__PURE__ */ u.jsx("span", { className: "font-medium text-sm", children: "Assistant" })
|
|
11954
11954
|
] }),
|
|
11955
11955
|
/* @__PURE__ */ u.jsx(
|
|
@@ -11960,14 +11960,14 @@ const Tu = V.memo(function({
|
|
|
11960
11960
|
}
|
|
11961
11961
|
)
|
|
11962
11962
|
] }) });
|
|
11963
|
-
const Je = V.useCallback(async (
|
|
11963
|
+
const Je = V.useCallback(async (G) => {
|
|
11964
11964
|
if (w)
|
|
11965
11965
|
return;
|
|
11966
11966
|
const Te = is(
|
|
11967
|
-
(
|
|
11967
|
+
(G == null ? void 0 : G.id) ?? (G == null ? void 0 : G.interrupt_id)
|
|
11968
11968
|
);
|
|
11969
11969
|
if (!Te) {
|
|
11970
|
-
console.warn("Interrupt part missing id",
|
|
11970
|
+
console.warn("Interrupt part missing id", G);
|
|
11971
11971
|
return;
|
|
11972
11972
|
}
|
|
11973
11973
|
try {
|
|
@@ -11977,14 +11977,14 @@ const Tu = V.memo(function({
|
|
|
11977
11977
|
} finally {
|
|
11978
11978
|
T == null || T();
|
|
11979
11979
|
}
|
|
11980
|
-
}, [w, T, b, U]), Nt = V.useCallback(async (
|
|
11980
|
+
}, [w, T, b, U]), Nt = V.useCallback(async (G) => {
|
|
11981
11981
|
if (w)
|
|
11982
11982
|
return;
|
|
11983
11983
|
const Te = is(
|
|
11984
|
-
(
|
|
11984
|
+
(G == null ? void 0 : G.id) ?? (G == null ? void 0 : G.interrupt_id)
|
|
11985
11985
|
);
|
|
11986
11986
|
if (!Te) {
|
|
11987
|
-
console.warn("Interrupt part missing id",
|
|
11987
|
+
console.warn("Interrupt part missing id", G);
|
|
11988
11988
|
return;
|
|
11989
11989
|
}
|
|
11990
11990
|
try {
|
|
@@ -11994,9 +11994,9 @@ const Tu = V.memo(function({
|
|
|
11994
11994
|
} finally {
|
|
11995
11995
|
T == null || T();
|
|
11996
11996
|
}
|
|
11997
|
-
}, [w, T, b, U]), ht = V.useCallback(({ part:
|
|
11998
|
-
if (
|
|
11999
|
-
const pe =
|
|
11997
|
+
}, [w, T, b, U]), ht = V.useCallback(({ part: G, i: Te }) => {
|
|
11998
|
+
if (G.type === "text") {
|
|
11999
|
+
const pe = G.text ?? "", xt = pe.trim(), pt = ml(xt);
|
|
12000
12000
|
return pt && L !== "tool" ? /* @__PURE__ */ u.jsx(rh, { data: pt }, Te) : L === "user" && c && xt.length > d ? /* @__PURE__ */ u.jsx(
|
|
12001
12001
|
U0,
|
|
12002
12002
|
{
|
|
@@ -12009,8 +12009,8 @@ const Tu = V.memo(function({
|
|
|
12009
12009
|
Te
|
|
12010
12010
|
) : /* @__PURE__ */ u.jsx(Ds, { content: pe, allowHtml: !1 }, Te);
|
|
12011
12011
|
}
|
|
12012
|
-
if (
|
|
12013
|
-
const pe =
|
|
12012
|
+
if (G.type === "image_url") {
|
|
12013
|
+
const pe = G;
|
|
12014
12014
|
return /* @__PURE__ */ u.jsx("div", { className: "my-2", children: /* @__PURE__ */ u.jsx(
|
|
12015
12015
|
"img",
|
|
12016
12016
|
{
|
|
@@ -12021,8 +12021,8 @@ const Tu = V.memo(function({
|
|
|
12021
12021
|
}
|
|
12022
12022
|
) }, Te);
|
|
12023
12023
|
}
|
|
12024
|
-
if (
|
|
12025
|
-
const pe =
|
|
12024
|
+
if (G.type === "file") {
|
|
12025
|
+
const pe = G, xt = pe.name || "file";
|
|
12026
12026
|
return /* @__PURE__ */ u.jsxs(
|
|
12027
12027
|
"a",
|
|
12028
12028
|
{
|
|
@@ -12041,8 +12041,8 @@ const Tu = V.memo(function({
|
|
|
12041
12041
|
Te
|
|
12042
12042
|
);
|
|
12043
12043
|
}
|
|
12044
|
-
if (
|
|
12045
|
-
const pe =
|
|
12044
|
+
if (G.type === "interrupt") {
|
|
12045
|
+
const pe = G, xt = is(
|
|
12046
12046
|
(pe == null ? void 0 : pe.id) ?? (pe == null ? void 0 : pe.interrupt_id)
|
|
12047
12047
|
), pt = !!(ve && xt && xt === ve), mt = pt ? Oe ?? (pe == null ? void 0 : pe.value) : pe == null ? void 0 : pe.value, Be = xt ? { ...pe, id: xt, interrupt_id: xt } : pe;
|
|
12048
12048
|
return /* @__PURE__ */ u.jsx(
|
|
@@ -12078,10 +12078,10 @@ const Tu = V.memo(function({
|
|
|
12078
12078
|
/* @__PURE__ */ u.jsx(ca, { className: "h-4 w-4 text-muted-foreground" }),
|
|
12079
12079
|
/* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
|
|
12080
12080
|
] }), []), At = V.useCallback(() => {
|
|
12081
|
-
const
|
|
12081
|
+
const G = ae.trim().length > 0 || z.length > 0 || le.length > 0 || Q.length > 0;
|
|
12082
12082
|
if (!ne && le.length > 0 && !r)
|
|
12083
12083
|
return kt();
|
|
12084
|
-
if (!ne && !
|
|
12084
|
+
if (!ne && !G && !r)
|
|
12085
12085
|
return null;
|
|
12086
12086
|
if (ne)
|
|
12087
12087
|
return /* @__PURE__ */ u.jsx(
|
|
@@ -12096,7 +12096,7 @@ const Tu = V.memo(function({
|
|
|
12096
12096
|
const Te = t, pe = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: Te.content.map((xt, pt) => /* @__PURE__ */ u.jsx(ht, { part: xt, i: pt }, pt)) });
|
|
12097
12097
|
return r ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
|
|
12098
12098
|
pe,
|
|
12099
|
-
/* @__PURE__ */ u.jsx(z0, { className:
|
|
12099
|
+
/* @__PURE__ */ u.jsx(z0, { className: Y })
|
|
12100
12100
|
] }) : pe;
|
|
12101
12101
|
}
|
|
12102
12102
|
}, [
|
|
@@ -12108,24 +12108,24 @@ const Tu = V.memo(function({
|
|
|
12108
12108
|
ne,
|
|
12109
12109
|
F,
|
|
12110
12110
|
kt,
|
|
12111
|
-
|
|
12111
|
+
Y
|
|
12112
12112
|
]), et = st(() => oe ? "Assistant" : F0(t), [oe, t]), Ue = V.useMemo(() => oe ? [] : Array.isArray(C) ? C : [], [C, oe]), Rt = V.useMemo(() => {
|
|
12113
|
-
var
|
|
12114
|
-
return Ue.length ? _ && Ue.some((Te) => Te.id === _) ? _ : ((
|
|
12115
|
-
}, [_, Ue]), Ut = V.useMemo(() => !Ue.length || !S ? null : Ue.some((
|
|
12116
|
-
(
|
|
12113
|
+
var G;
|
|
12114
|
+
return Ue.length ? _ && Ue.some((Te) => Te.id === _) ? _ : ((G = Ue[0]) == null ? void 0 : G.id) ?? null : null;
|
|
12115
|
+
}, [_, Ue]), Ut = V.useMemo(() => !Ue.length || !S ? null : Ue.some((G) => G.id === S) ? S : null, [S, Ue]) ?? Rt, qt = L === "user" && Ue.length > 0 && typeof k == "function", it = V.useCallback(
|
|
12116
|
+
(G) => {
|
|
12117
12117
|
if (!k) return;
|
|
12118
|
-
const Te = (
|
|
12118
|
+
const Te = (G == null ? void 0 : G.id) ?? null, pe = (G == null ? void 0 : G.parentId) ?? N ?? null;
|
|
12119
12119
|
k(Te, pe);
|
|
12120
12120
|
},
|
|
12121
12121
|
[N, k]
|
|
12122
|
-
), Le = V.useMemo(() => Ut ? Ue.findIndex((
|
|
12122
|
+
), Le = V.useMemo(() => Ut ? Ue.findIndex((G) => G.id === Ut) : -1, [Ut, Ue]), Pt = V.useMemo(() => Le < 0 ? null : Ue[Le] ?? null, [Le, Ue]), bt = V.useCallback((G) => {
|
|
12123
12123
|
const Te = [];
|
|
12124
|
-
if (
|
|
12125
|
-
return Te.length ? Te.join(" • ") :
|
|
12124
|
+
if (G.step !== null && Te.push(`Step ${G.step}`), G.source && Te.push(G.source), !G.createdAt)
|
|
12125
|
+
return Te.length ? Te.join(" • ") : G.id.slice(0, 8);
|
|
12126
12126
|
let pe = "";
|
|
12127
12127
|
try {
|
|
12128
|
-
const pt = new Date(
|
|
12128
|
+
const pt = new Date(G.createdAt);
|
|
12129
12129
|
Number.isNaN(pt.getTime()) || (pe = new Intl.DateTimeFormat(void 0, {
|
|
12130
12130
|
hour: "2-digit",
|
|
12131
12131
|
minute: "2-digit"
|
|
@@ -12134,7 +12134,7 @@ const Tu = V.memo(function({
|
|
|
12134
12134
|
pe = "";
|
|
12135
12135
|
}
|
|
12136
12136
|
const xt = Te.length ? ` • ${Te.join(" • ")}` : "";
|
|
12137
|
-
return `${pe ||
|
|
12137
|
+
return `${pe || G.id.slice(0, 8)}${xt}`;
|
|
12138
12138
|
}, []);
|
|
12139
12139
|
return ne && !f ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
12140
12140
|
/* @__PURE__ */ u.jsx("div", { className: ie(ut(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: ie(ot(), h.content), children: [
|
|
@@ -12144,7 +12144,7 @@ const Tu = V.memo(function({
|
|
|
12144
12144
|
className: ie(
|
|
12145
12145
|
"flex items-center justify-between mb-2 pb-2 border-b border-current/10",
|
|
12146
12146
|
$ && "mb-1 pb-1",
|
|
12147
|
-
|
|
12147
|
+
Y,
|
|
12148
12148
|
h.header
|
|
12149
12149
|
),
|
|
12150
12150
|
children: [
|
|
@@ -12157,16 +12157,16 @@ const Tu = V.memo(function({
|
|
|
12157
12157
|
variant: "outline",
|
|
12158
12158
|
className: ie(
|
|
12159
12159
|
"text-xs flex items-center gap-1 cursor-pointer select-none",
|
|
12160
|
-
|
|
12160
|
+
Y,
|
|
12161
12161
|
"border border-current/40",
|
|
12162
12162
|
$ && "text-xs h-4"
|
|
12163
12163
|
),
|
|
12164
12164
|
role: "button",
|
|
12165
12165
|
tabIndex: 0,
|
|
12166
12166
|
"aria-expanded": F === "expanded",
|
|
12167
|
-
onClick: () => W((
|
|
12168
|
-
onKeyDown: (
|
|
12169
|
-
(
|
|
12167
|
+
onClick: () => W((G) => G === "expanded" ? "preview" : "expanded"),
|
|
12168
|
+
onKeyDown: (G) => {
|
|
12169
|
+
(G.key === "Enter" || G.key === " ") && (G.preventDefault(), W((Te) => Te === "expanded" ? "preview" : "expanded"));
|
|
12170
12170
|
},
|
|
12171
12171
|
children: [
|
|
12172
12172
|
/* @__PURE__ */ u.jsx("span", { children: fe.name ?? "Tool Output" }),
|
|
@@ -12188,8 +12188,8 @@ const Tu = V.memo(function({
|
|
|
12188
12188
|
),
|
|
12189
12189
|
onClick: () => {
|
|
12190
12190
|
if (Le <= 0) return;
|
|
12191
|
-
const
|
|
12192
|
-
|
|
12191
|
+
const G = Ue[Le - 1];
|
|
12192
|
+
G && it(G);
|
|
12193
12193
|
},
|
|
12194
12194
|
"aria-label": "Previous checkpoint",
|
|
12195
12195
|
disabled: Le <= 0,
|
|
@@ -12214,8 +12214,8 @@ const Tu = V.memo(function({
|
|
|
12214
12214
|
),
|
|
12215
12215
|
onClick: () => {
|
|
12216
12216
|
if (Le >= Ue.length - 1) return;
|
|
12217
|
-
const
|
|
12218
|
-
|
|
12217
|
+
const G = Ue[Le + 1];
|
|
12218
|
+
G && it(G);
|
|
12219
12219
|
},
|
|
12220
12220
|
"aria-label": "Next checkpoint",
|
|
12221
12221
|
disabled: Le >= Ue.length - 1,
|
|
@@ -12226,7 +12226,7 @@ const Tu = V.memo(function({
|
|
|
12226
12226
|
i && t.createdAt && /* @__PURE__ */ u.jsx(
|
|
12227
12227
|
"time",
|
|
12228
12228
|
{
|
|
12229
|
-
className: ie("text-xs opacity-60",
|
|
12229
|
+
className: ie("text-xs opacity-60", Y, $ && "text-xs"),
|
|
12230
12230
|
dateTime: new Date(t.createdAt).toISOString(),
|
|
12231
12231
|
title: new Date(t.createdAt).toLocaleString(),
|
|
12232
12232
|
children: new Intl.DateTimeFormat(void 0, { hour: "2-digit", minute: "2-digit" }).format(new Date(t.createdAt))
|
|
@@ -12247,10 +12247,10 @@ const Tu = V.memo(function({
|
|
|
12247
12247
|
variant: "ghost",
|
|
12248
12248
|
size: "sm",
|
|
12249
12249
|
onClick: () => Ze(),
|
|
12250
|
-
className: ie("h-6 w-6 p-0 hover:bg-foreground/10",
|
|
12250
|
+
className: ie("h-6 w-6 p-0 hover:bg-foreground/10", Y, $ && "h-5 w-5"),
|
|
12251
12251
|
"aria-label": "Copy message",
|
|
12252
12252
|
title: "Copy message",
|
|
12253
|
-
children: /* @__PURE__ */ u.jsx(ec, { className: ie(A ? "text-success" :
|
|
12253
|
+
children: /* @__PURE__ */ u.jsx(ec, { className: ie(A ? "text-success" : Y, $ ? "h-3 w-3" : "h-4 w-4") })
|
|
12254
12254
|
}
|
|
12255
12255
|
) }),
|
|
12256
12256
|
L === "user" && p && /* @__PURE__ */ u.jsx(
|
|
@@ -12259,9 +12259,9 @@ const Tu = V.memo(function({
|
|
|
12259
12259
|
variant: "ghost",
|
|
12260
12260
|
size: "sm",
|
|
12261
12261
|
onClick: Qe,
|
|
12262
|
-
className: ie("h-6 w-6 p-0 hover:bg-foreground/10",
|
|
12262
|
+
className: ie("h-6 w-6 p-0 hover:bg-foreground/10", Y, $ && "h-5 w-5"),
|
|
12263
12263
|
"aria-label": "Edit message",
|
|
12264
|
-
children: /* @__PURE__ */ u.jsx(tc, { className: ie(
|
|
12264
|
+
children: /* @__PURE__ */ u.jsx(tc, { className: ie(Y, $ ? "h-3 w-3" : "h-4 w-4") })
|
|
12265
12265
|
}
|
|
12266
12266
|
),
|
|
12267
12267
|
L === "assistant" && g && /* @__PURE__ */ u.jsx(
|
|
@@ -12270,9 +12270,9 @@ const Tu = V.memo(function({
|
|
|
12270
12270
|
variant: "ghost",
|
|
12271
12271
|
size: "sm",
|
|
12272
12272
|
onClick: Ce,
|
|
12273
|
-
className: ie("h-6 w-6 p-0 hover:bg-foreground/10",
|
|
12273
|
+
className: ie("h-6 w-6 p-0 hover:bg-foreground/10", Y, $ && "h-5 w-5"),
|
|
12274
12274
|
"aria-label": "Regenerate response",
|
|
12275
|
-
children: /* @__PURE__ */ u.jsx(ua, { className: ie(
|
|
12275
|
+
children: /* @__PURE__ */ u.jsx(ua, { className: ie(Y, $ ? "h-3 w-3" : "h-4 w-4") })
|
|
12276
12276
|
}
|
|
12277
12277
|
)
|
|
12278
12278
|
]
|
|
@@ -12689,7 +12689,7 @@ const ku = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, V0 = (e) =>
|
|
|
12689
12689
|
const z = se[0], le = se[se.length - 1], Q = [z == null ? void 0 : z.createdAt, le == null ? void 0 : le.createdAt].map((ve) => ve ? ee(ve) : null).filter(Boolean).join(" → "), _e = (ve) => {
|
|
12690
12690
|
A && A(ve);
|
|
12691
12691
|
};
|
|
12692
|
-
return /* @__PURE__ */ u.jsx("div", { className: "absolute inset-y-0 left-0 hidden w-[15rem] border-r border-border/50 bg-gradient-to-b from-background/95 to-background/70 md:flex", children: /* @__PURE__ */ u.jsxs("div", { className: "flex h-full w-full flex-col px-4 py-4", children: [
|
|
12692
|
+
return /* @__PURE__ */ u.jsx("div", { className: "absolute inset-y-0 left-0 z-10 hidden w-[15rem] border-r border-border/50 bg-gradient-to-b from-background/95 to-background/70 md:flex", children: /* @__PURE__ */ u.jsxs("div", { className: "flex h-full w-full flex-col px-4 py-4", children: [
|
|
12693
12693
|
/* @__PURE__ */ u.jsxs("div", { children: [
|
|
12694
12694
|
/* @__PURE__ */ u.jsx("div", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Timeline" }),
|
|
12695
12695
|
/* @__PURE__ */ u.jsxs("div", { className: "mt-1 text-[11px] text-muted-foreground", children: [
|
|
@@ -12733,7 +12733,7 @@ const ku = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, V0 = (e) =>
|
|
|
12733
12733
|
}
|
|
12734
12734
|
)
|
|
12735
12735
|
] }) });
|
|
12736
|
-
}, [Re, ee, A, se]),
|
|
12736
|
+
}, [Re, ee, A, se]), Y = se.length > 0, ae = st(() => {
|
|
12737
12737
|
if (typeof p != "string") return null;
|
|
12738
12738
|
const z = p.trim();
|
|
12739
12739
|
return z ? {
|
|
@@ -12765,7 +12765,7 @@ const ku = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, V0 = (e) =>
|
|
|
12765
12765
|
) }) }) }) : /* @__PURE__ */ u.jsx("div", { className: f, style: h, children: /* @__PURE__ */ u.jsx("div", { className: "flex items-center justify-center py-8 text-muted-foreground text-center max-w-2xl mx-auto", children: p || "No messages yet. Start a conversation!" }) });
|
|
12766
12766
|
const fe = [
|
|
12767
12767
|
"flex h-full flex-col",
|
|
12768
|
-
|
|
12768
|
+
Y ? "md:pl-[15rem]" : "",
|
|
12769
12769
|
f
|
|
12770
12770
|
].filter(Boolean).join(" ");
|
|
12771
12771
|
return /* @__PURE__ */ u.jsx("div", { className: fe, style: h, children: /* @__PURE__ */ u.jsxs("div", { className: "relative flex-1 min-h-0", children: [
|
|
@@ -12811,18 +12811,18 @@ const ku = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, V0 = (e) =>
|
|
|
12811
12811
|
return Ve.parentCheckpointId;
|
|
12812
12812
|
if (typeof Ze.parentCheckpointId == "string")
|
|
12813
12813
|
return Ze.parentCheckpointId;
|
|
12814
|
-
})(), ot = Ce || (typeof Qe == "number" ? `Step ${Qe}` : null) || rt || null, Je = Oe, Nt =
|
|
12814
|
+
})(), ot = Ce || (typeof Qe == "number" ? `Step ${Qe}` : null) || rt || null, Je = Oe, Nt = Y && Je && Re === Je;
|
|
12815
12815
|
return /* @__PURE__ */ u.jsxs(
|
|
12816
12816
|
"div",
|
|
12817
12817
|
{
|
|
12818
|
-
className:
|
|
12818
|
+
className: "relative mb-4 last:mb-0",
|
|
12819
12819
|
"data-message-id": Q,
|
|
12820
12820
|
style: {
|
|
12821
12821
|
minHeight: "60px",
|
|
12822
12822
|
containIntrinsicSize: "auto 120px"
|
|
12823
12823
|
},
|
|
12824
12824
|
children: [
|
|
12825
|
-
|
|
12825
|
+
Y && /* @__PURE__ */ u.jsx("div", { className: "pointer-events-none absolute left-0 top-1 hidden h-full w-[15rem] items-start md:flex", children: /* @__PURE__ */ u.jsxs("div", { className: "flex items-start gap-3 pt-3", children: [
|
|
12826
12826
|
/* @__PURE__ */ u.jsx("span", { className: "mt-2 h-px w-10 bg-border/50" }),
|
|
12827
12827
|
/* @__PURE__ */ u.jsxs("div", { className: "pointer-events-auto flex flex-col gap-1", children: [
|
|
12828
12828
|
/* @__PURE__ */ u.jsx(
|
|
@@ -14324,7 +14324,7 @@ var bh = "PopperAnchor", Sh = v.forwardRef(
|
|
|
14324
14324
|
Sh.displayName = bh;
|
|
14325
14325
|
var jl = "PopperContent", [cC, uC] = yh(jl), Ch = v.forwardRef(
|
|
14326
14326
|
(e, t) => {
|
|
14327
|
-
var ee, M,
|
|
14327
|
+
var ee, M, Y, ae, fe, z;
|
|
14328
14328
|
const {
|
|
14329
14329
|
__scopePopper: n,
|
|
14330
14330
|
side: r = "bottom",
|
|
@@ -14379,7 +14379,7 @@ var jl = "PopperContent", [cC, uC] = yh(jl), Ch = v.forwardRef(
|
|
|
14379
14379
|
Jt(() => {
|
|
14380
14380
|
U && (oe == null || oe());
|
|
14381
14381
|
}, [U, oe]);
|
|
14382
|
-
const be = (ee = $.arrow) == null ? void 0 : ee.x, Ae = (M = $.arrow) == null ? void 0 : M.y, Z = ((
|
|
14382
|
+
const be = (ee = $.arrow) == null ? void 0 : ee.x, Ae = (M = $.arrow) == null ? void 0 : M.y, Z = ((Y = $.arrow) == null ? void 0 : Y.centerOffset) !== 0, [se, Re] = v.useState();
|
|
14383
14383
|
return Jt(() => {
|
|
14384
14384
|
m && Re(window.getComputedStyle(m).zIndex);
|
|
14385
14385
|
}, [m]), /* @__PURE__ */ u.jsx(
|
|
@@ -14785,9 +14785,9 @@ var vn = "MenuContent", [DC, Ml] = Mr(vn), Uh = v.forwardRef(
|
|
|
14785
14785
|
...x
|
|
14786
14786
|
} = e, y = Dr(vn, n), m = Ko(vn, n), w = Si(n), b = Fh(n), T = AC(n), [C, S] = v.useState(null), k = v.useRef(null), _ = nt(t, k, y.onContentChange), N = v.useRef(0), A = v.useRef(""), D = v.useRef(0), F = v.useRef(null), W = v.useRef("right"), P = v.useRef(0), B = g ? di : v.Fragment, j = g ? { as: FC, allowPinchZoom: !0 } : void 0, U = (L) => {
|
|
14787
14787
|
var ee, M;
|
|
14788
|
-
const ne = A.current + L, oe = T().filter((
|
|
14789
|
-
(function
|
|
14790
|
-
A.current = ae, window.clearTimeout(N.current), ae !== "" && (N.current = window.setTimeout(() =>
|
|
14788
|
+
const ne = A.current + L, oe = T().filter((Y) => !Y.disabled), be = document.activeElement, Ae = (ee = oe.find((Y) => Y.ref.current === be)) == null ? void 0 : ee.textValue, Z = oe.map((Y) => Y.textValue), se = JC(Z, ne, Ae), Re = (M = oe.find((Y) => Y.textValue === se)) == null ? void 0 : M.ref.current;
|
|
14789
|
+
(function Y(ae) {
|
|
14790
|
+
A.current = ae, window.clearTimeout(N.current), ae !== "" && (N.current = window.setTimeout(() => Y(""), 1e3));
|
|
14791
14791
|
})(ne), Re && setTimeout(() => Re.focus());
|
|
14792
14792
|
};
|
|
14793
14793
|
v.useEffect(() => () => window.clearTimeout(N.current), []), xl();
|
|
@@ -15568,9 +15568,9 @@ function la({
|
|
|
15568
15568
|
Z(!0);
|
|
15569
15569
|
}, []), Re = me(() => {
|
|
15570
15570
|
Z(!1);
|
|
15571
|
-
}, []), ee = !!be || Ae, [M,
|
|
15571
|
+
}, []), ee = !!be || Ae, [M, Y] = we(null), [ae, fe] = we(""), [z, le] = we(null), [Q, _e] = we(null), [ve, Oe] = we([]), [Ve, Ze] = we(0), [Qe, Ce] = we(0), [rt, ut] = we(!1), [ot, Je] = we(null), [Nt, ht] = we(null), [kt, At] = we(!1), [et, Ue] = we(null), [Rt, Kt] = we(!1), Ut = Ee(!1), [qt, it] = we(() => $u.value), Le = Ee(qt), Pt = Ee(null), bt = me((J) => {
|
|
15572
15572
|
$u.value = J, it(J);
|
|
15573
|
-
}, []), [
|
|
15573
|
+
}, []), [G, Te] = we(!1), pe = me(
|
|
15574
15574
|
(J, de) => {
|
|
15575
15575
|
if (!J || typeof J != "object") return null;
|
|
15576
15576
|
const he = J[de];
|
|
@@ -15705,7 +15705,7 @@ function la({
|
|
|
15705
15705
|
checkpointId: he,
|
|
15706
15706
|
checkpointNs: Ct
|
|
15707
15707
|
}
|
|
15708
|
-
), h == null || h(de), bt(""), _e(null), Oe([]), lt(),
|
|
15708
|
+
), h == null || h(de), bt(""), _e(null), Oe([]), lt(), Y(null), fe(""), le(null);
|
|
15709
15709
|
} catch (he) {
|
|
15710
15710
|
const Ct = (he == null ? void 0 : he.message) || "Failed to send message";
|
|
15711
15711
|
_e(Ct), g == null || g(Ct);
|
|
@@ -15713,14 +15713,14 @@ function la({
|
|
|
15713
15713
|
}
|
|
15714
15714
|
}, R = V.useCallback(
|
|
15715
15715
|
(J, de, he) => {
|
|
15716
|
-
c && (Pt.current = qt,
|
|
15716
|
+
c && (Pt.current = qt, Y(J), fe(de), bt(de), _e(null), le({
|
|
15717
15717
|
checkpointId: (he == null ? void 0 : he.checkpointId) ?? null,
|
|
15718
15718
|
checkpointNs: (he == null ? void 0 : he.checkpointNs) ?? null
|
|
15719
15719
|
}));
|
|
15720
15720
|
},
|
|
15721
15721
|
[qt, c, bt]
|
|
15722
15722
|
), q = V.useCallback(() => {
|
|
15723
|
-
|
|
15723
|
+
Y(null), fe(""), le(null), _e(null), bt(Pt.current ?? qt), Pt.current = null;
|
|
15724
15724
|
}, [qt, bt]), ue = me(
|
|
15725
15725
|
(J, de, he) => {
|
|
15726
15726
|
R(J, de, he);
|
|
@@ -15873,7 +15873,7 @@ function la({
|
|
|
15873
15873
|
onRegenerate: ke,
|
|
15874
15874
|
onCancelEdit: q,
|
|
15875
15875
|
emptyMessage: et ?? void 0,
|
|
15876
|
-
isNavigatingCheckpoint:
|
|
15876
|
+
isNavigatingCheckpoint: G,
|
|
15877
15877
|
activeInterrupt: be,
|
|
15878
15878
|
disableInterruptActions: Ae,
|
|
15879
15879
|
onInterruptActionStart: se,
|
|
@@ -17241,7 +17241,7 @@ var Tn = 10, [pm, pr] = oo(_r), Tk = "SelectContentImpl", kk = qr("SelectContent
|
|
|
17241
17241
|
}, [b]), xl();
|
|
17242
17242
|
const j = v.useCallback(
|
|
17243
17243
|
(ee) => {
|
|
17244
|
-
const [M, ...
|
|
17244
|
+
const [M, ...Y] = F().map((z) => z.ref.current), [ae] = Y.slice(-1), fe = document.activeElement;
|
|
17245
17245
|
for (const z of ee)
|
|
17246
17246
|
if (z === fe || (z == null || z.scrollIntoView({ block: "nearest" }), z === M && C && (C.scrollTop = 0), z === ae && C && (C.scrollTop = C.scrollHeight), z == null || z.focus(), document.activeElement !== fe)) return;
|
|
17247
17247
|
},
|
|
@@ -17263,11 +17263,11 @@ var Tn = 10, [pm, pr] = oo(_r), Tk = "SelectContentImpl", kk = qr("SelectContent
|
|
|
17263
17263
|
x: Math.abs(Math.round(ae.pageX) - (((fe = L.current) == null ? void 0 : fe.x) ?? 0)),
|
|
17264
17264
|
y: Math.abs(Math.round(ae.pageY) - (((z = L.current) == null ? void 0 : z.y) ?? 0))
|
|
17265
17265
|
};
|
|
17266
|
-
},
|
|
17266
|
+
}, Y = (ae) => {
|
|
17267
17267
|
ee.x <= 10 && ee.y <= 10 ? ae.preventDefault() : b.contains(ae.target) || $(!1), document.removeEventListener("pointermove", M), L.current = null;
|
|
17268
17268
|
};
|
|
17269
|
-
return L.current !== null && (document.addEventListener("pointermove", M), document.addEventListener("pointerup",
|
|
17270
|
-
document.removeEventListener("pointermove", M), document.removeEventListener("pointerup",
|
|
17269
|
+
return L.current !== null && (document.addEventListener("pointermove", M), document.addEventListener("pointerup", Y, { capture: !0, once: !0 })), () => {
|
|
17270
|
+
document.removeEventListener("pointermove", M), document.removeEventListener("pointerup", Y, { capture: !0 });
|
|
17271
17271
|
};
|
|
17272
17272
|
}
|
|
17273
17273
|
}, [b, $, L]), v.useEffect(() => {
|
|
@@ -17277,17 +17277,17 @@ var Tn = 10, [pm, pr] = oo(_r), Tk = "SelectContentImpl", kk = qr("SelectContent
|
|
|
17277
17277
|
};
|
|
17278
17278
|
}, [$]);
|
|
17279
17279
|
const [ne, oe] = jm((ee) => {
|
|
17280
|
-
const M = F().filter((fe) => !fe.disabled),
|
|
17280
|
+
const M = F().filter((fe) => !fe.disabled), Y = M.find((fe) => fe.ref.current === document.activeElement), ae = Pm(M, ee, Y);
|
|
17281
17281
|
ae && setTimeout(() => ae.ref.current.focus());
|
|
17282
17282
|
}), be = v.useCallback(
|
|
17283
|
-
(ee, M,
|
|
17284
|
-
const ae = !B.current && !
|
|
17283
|
+
(ee, M, Y) => {
|
|
17284
|
+
const ae = !B.current && !Y;
|
|
17285
17285
|
(w.value !== void 0 && w.value === M || ae) && (N(ee), ae && (B.current = !0));
|
|
17286
17286
|
},
|
|
17287
17287
|
[w.value]
|
|
17288
17288
|
), Ae = v.useCallback(() => b == null ? void 0 : b.focus(), [b]), Z = v.useCallback(
|
|
17289
|
-
(ee, M,
|
|
17290
|
-
const ae = !B.current && !
|
|
17289
|
+
(ee, M, Y) => {
|
|
17290
|
+
const ae = !B.current && !Y;
|
|
17291
17291
|
(w.value !== void 0 && w.value === M || ae) && D(ee);
|
|
17292
17292
|
},
|
|
17293
17293
|
[w.value]
|
|
@@ -17404,7 +17404,7 @@ var Rk = "SelectItemAlignedPosition", gm = v.forwardRef((e, t) => {
|
|
|
17404
17404
|
]);
|
|
17405
17405
|
a.style.minWidth = Q + "px", a.style.right = Oe + "px";
|
|
17406
17406
|
}
|
|
17407
|
-
const D = h(), F = window.innerHeight - Tn * 2, W = x.scrollHeight, P = window.getComputedStyle(c), B = parseInt(P.borderTopWidth, 10), j = parseInt(P.paddingTop, 10), U = parseInt(P.borderBottomWidth, 10), $ = parseInt(P.paddingBottom, 10), L = B + j + W + $ + U, ne = Math.min(y.offsetHeight * 5, L), oe = window.getComputedStyle(x), be = parseInt(oe.paddingTop, 10), Ae = parseInt(oe.paddingBottom, 10), Z = k.top + k.height / 2 - Tn, se = F - Z, Re = y.offsetHeight / 2, ee = y.offsetTop + Re, M = B + j + ee,
|
|
17407
|
+
const D = h(), F = window.innerHeight - Tn * 2, W = x.scrollHeight, P = window.getComputedStyle(c), B = parseInt(P.borderTopWidth, 10), j = parseInt(P.paddingTop, 10), U = parseInt(P.borderBottomWidth, 10), $ = parseInt(P.paddingBottom, 10), L = B + j + W + $ + U, ne = Math.min(y.offsetHeight * 5, L), oe = window.getComputedStyle(x), be = parseInt(oe.paddingTop, 10), Ae = parseInt(oe.paddingBottom, 10), Z = k.top + k.height / 2 - Tn, se = F - Z, Re = y.offsetHeight / 2, ee = y.offsetTop + Re, M = B + j + ee, Y = L - M;
|
|
17408
17408
|
if (M <= Z) {
|
|
17409
17409
|
const fe = D.length > 0 && y === D[D.length - 1].ref.current;
|
|
17410
17410
|
a.style.bottom = "0px";
|
|
@@ -17421,7 +17421,7 @@ var Rk = "SelectItemAlignedPosition", gm = v.forwardRef((e, t) => {
|
|
|
17421
17421
|
Z,
|
|
17422
17422
|
B + x.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
17423
17423
|
(fe ? be : 0) + Re
|
|
17424
|
-
) +
|
|
17424
|
+
) + Y;
|
|
17425
17425
|
a.style.height = le + "px", x.scrollTop = M - Z + x.offsetTop;
|
|
17426
17426
|
}
|
|
17427
17427
|
a.style.margin = `${Tn}px 0`, a.style.minHeight = ne + "px", a.style.maxHeight = F + "px", r == null || r(), requestAnimationFrame(() => p.current = !0);
|