teodor-new-chat-ui 4.3.65 → 4.3.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js
CHANGED
|
@@ -324,8 +324,8 @@ function lg() {
|
|
|
324
324
|
}
|
|
325
325
|
return "";
|
|
326
326
|
}
|
|
327
|
-
var
|
|
328
|
-
function
|
|
327
|
+
var Ze = Object.prototype.hasOwnProperty, Ye = {}, ft = m.ReactDebugCurrentFrame;
|
|
328
|
+
function Qe(R) {
|
|
329
329
|
if (R) {
|
|
330
330
|
var H = R._owner, ue = Ge(R.type, R._source, H ? H.type : null);
|
|
331
331
|
ft.setExtraStackFrame(ue);
|
|
@@ -334,7 +334,7 @@ function lg() {
|
|
|
334
334
|
}
|
|
335
335
|
function Oe(R, H, ue, Te, Ve) {
|
|
336
336
|
{
|
|
337
|
-
var $e = Function.call.bind(
|
|
337
|
+
var $e = Function.call.bind(Ze);
|
|
338
338
|
for (var Le in R)
|
|
339
339
|
if ($e(R, Le)) {
|
|
340
340
|
var L = void 0;
|
|
@@ -347,7 +347,7 @@ function lg() {
|
|
|
347
347
|
} catch (he) {
|
|
348
348
|
L = he;
|
|
349
349
|
}
|
|
350
|
-
L && !(L instanceof Error) && (
|
|
350
|
+
L && !(L instanceof Error) && (Qe(Ve), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Te || "React class", ue, Le, typeof L), Qe(null)), L instanceof Error && !(L.message in Ye) && (Ye[L.message] = !0, Qe(Ve), w("Failed %s type: %s", ue, L.message), Qe(null));
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
}
|
|
@@ -382,7 +382,7 @@ function lg() {
|
|
|
382
382
|
__source: !0
|
|
383
383
|
}, mt, At;
|
|
384
384
|
function yt(R) {
|
|
385
|
-
if (
|
|
385
|
+
if (Ze.call(R, "ref")) {
|
|
386
386
|
var H = Object.getOwnPropertyDescriptor(R, "ref").get;
|
|
387
387
|
if (H && H.isReactWarning)
|
|
388
388
|
return !1;
|
|
@@ -390,14 +390,14 @@ function lg() {
|
|
|
390
390
|
return R.ref !== void 0;
|
|
391
391
|
}
|
|
392
392
|
function at(R) {
|
|
393
|
-
if (
|
|
393
|
+
if (Ze.call(R, "key")) {
|
|
394
394
|
var H = Object.getOwnPropertyDescriptor(R, "key").get;
|
|
395
395
|
if (H && H.isReactWarning)
|
|
396
396
|
return !1;
|
|
397
397
|
}
|
|
398
398
|
return R.key !== void 0;
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function Je(R, H) {
|
|
401
401
|
typeof R.ref == "string" && qe.current;
|
|
402
402
|
}
|
|
403
403
|
function Mt(R, H) {
|
|
@@ -411,7 +411,7 @@ function lg() {
|
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function vt(R, H) {
|
|
415
415
|
{
|
|
416
416
|
var ue = function() {
|
|
417
417
|
At || (At = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", H));
|
|
@@ -454,9 +454,9 @@ function lg() {
|
|
|
454
454
|
function qn(R, H, ue, Te, Ve) {
|
|
455
455
|
{
|
|
456
456
|
var $e, Le = {}, L = null, fe = null;
|
|
457
|
-
ue !== void 0 && (we(ue), L = "" + ue), at(H) && (we(H.key), L = "" + H.key), yt(H) && (fe = H.ref,
|
|
457
|
+
ue !== void 0 && (we(ue), L = "" + ue), at(H) && (we(H.key), L = "" + H.key), yt(H) && (fe = H.ref, Je(H, Ve));
|
|
458
458
|
for ($e in H)
|
|
459
|
-
|
|
459
|
+
Ze.call(H, $e) && !ht.hasOwnProperty($e) && (Le[$e] = H[$e]);
|
|
460
460
|
if (R && R.defaultProps) {
|
|
461
461
|
var he = R.defaultProps;
|
|
462
462
|
for ($e in he)
|
|
@@ -464,7 +464,7 @@ function lg() {
|
|
|
464
464
|
}
|
|
465
465
|
if (L || fe) {
|
|
466
466
|
var ke = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
|
|
467
|
-
L && Mt(Le, ke), fe &&
|
|
467
|
+
L && Mt(Le, ke), fe && vt(Le, ke);
|
|
468
468
|
}
|
|
469
469
|
return et(R, L, fe, Ve, Te, qe.current, Le);
|
|
470
470
|
}
|
|
@@ -607,7 +607,7 @@ Check the top-level render call using <` + ue + ">.");
|
|
|
607
607
|
else
|
|
608
608
|
Yt(ot, R);
|
|
609
609
|
}
|
|
610
|
-
if (
|
|
610
|
+
if (Ze.call(H, "key")) {
|
|
611
611
|
var nn = O(R), Tt = Object.keys(H).filter(function(I) {
|
|
612
612
|
return I !== "key";
|
|
613
613
|
}), Xr = Tt.length > 0 ? "{key: someKey, " + Tt.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
@@ -2349,26 +2349,26 @@ function Vu(e) {
|
|
|
2349
2349
|
return Vu(mr(e, o));
|
|
2350
2350
|
}, n;
|
|
2351
2351
|
}
|
|
2352
|
-
const
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2352
|
+
const St = Vu(Ao);
|
|
2353
|
+
St.Axios = hr;
|
|
2354
|
+
St.CanceledError = Wr;
|
|
2355
|
+
St.CancelToken = Ox;
|
|
2356
|
+
St.isCancel = Lu;
|
|
2357
|
+
St.VERSION = Uu;
|
|
2358
|
+
St.toFormData = $s;
|
|
2359
|
+
St.AxiosError = je;
|
|
2360
|
+
St.Cancel = St.CanceledError;
|
|
2361
|
+
St.all = function(t) {
|
|
2362
2362
|
return Promise.all(t);
|
|
2363
2363
|
};
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2364
|
+
St.spread = Mx;
|
|
2365
|
+
St.isAxiosError = Dx;
|
|
2366
|
+
St.mergeConfig = mr;
|
|
2367
|
+
St.AxiosHeaders = Kt;
|
|
2368
|
+
St.formToJSON = (e) => Du(P.isHTMLForm(e) ? new FormData(e) : e);
|
|
2369
|
+
St.getAdapter = Hu.getAdapter;
|
|
2370
|
+
St.HttpStatusCode = ea;
|
|
2371
|
+
St.default = St;
|
|
2372
2372
|
const {
|
|
2373
2373
|
Axios: Gk,
|
|
2374
2374
|
AxiosError: Yk,
|
|
@@ -2386,7 +2386,7 @@ const {
|
|
|
2386
2386
|
formToJSON: aR,
|
|
2387
2387
|
getAdapter: lR,
|
|
2388
2388
|
mergeConfig: cR
|
|
2389
|
-
} =
|
|
2389
|
+
} = St, tc = typeof window < "u" ? window.__API_BASE_URL__ : void 0, nc = tc ? Wn(tc) : void 0;
|
|
2390
2390
|
function Wn(e) {
|
|
2391
2391
|
const n = (e != null && e.trim() ? e.trim() : "/api/chat").replace(/\/+$/, "");
|
|
2392
2392
|
return n ? n.endsWith("/chat") ? n : `${n}/chat` : "/api/chat";
|
|
@@ -2402,7 +2402,7 @@ function rc(e) {
|
|
|
2402
2402
|
function Fx(e) {
|
|
2403
2403
|
return ta.add(e), () => ta.delete(e);
|
|
2404
2404
|
}
|
|
2405
|
-
const cn =
|
|
2405
|
+
const cn = St.create({
|
|
2406
2406
|
// Only set baseURL when configured — do NOT fall back to localhost. Falling back causes
|
|
2407
2407
|
// noisy network requests to the frontend Dev server when the backend isn't configured.
|
|
2408
2408
|
...nc ? { baseURL: nc } : {},
|
|
@@ -3404,14 +3404,14 @@ function yy(e = {}) {
|
|
|
3404
3404
|
const ie = ce.body.getReader(), de = new TextDecoder();
|
|
3405
3405
|
let Be = "", Ge = [];
|
|
3406
3406
|
S.current = 0, m(0);
|
|
3407
|
-
let
|
|
3407
|
+
let Ze = 0, Ye = null;
|
|
3408
3408
|
const ft = () => {
|
|
3409
3409
|
if (Ge.length) {
|
|
3410
3410
|
const He = Ge.join("");
|
|
3411
3411
|
Ge = [], C.current && p((Z) => Z + He);
|
|
3412
3412
|
}
|
|
3413
3413
|
Ye = null;
|
|
3414
|
-
},
|
|
3414
|
+
}, Qe = () => {
|
|
3415
3415
|
typeof window < "u" && Ye == null && (Ye = requestAnimationFrame(ft));
|
|
3416
3416
|
};
|
|
3417
3417
|
let Oe = Date.now();
|
|
@@ -3446,29 +3446,39 @@ function yy(e = {}) {
|
|
|
3446
3446
|
console.debug("[use-chat] malformed SSE:", yt.slice(0, 200));
|
|
3447
3447
|
continue;
|
|
3448
3448
|
}
|
|
3449
|
-
const
|
|
3449
|
+
const Je = vy(at) ? at.data : at;
|
|
3450
3450
|
Oe = Date.now();
|
|
3451
|
-
const Mt =
|
|
3451
|
+
const Mt = Je.seq;
|
|
3452
3452
|
if (Mt !== void 0) {
|
|
3453
|
-
if (Mt <=
|
|
3454
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Mt, lastProcessedSeq:
|
|
3453
|
+
if (Mt <= Ze) {
|
|
3454
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Mt, lastProcessedSeq: Ze, type: Je.type });
|
|
3455
3455
|
continue;
|
|
3456
3456
|
}
|
|
3457
|
-
|
|
3457
|
+
Ze > 0 && Mt > Ze + 1 && ((z = j == null ? void 0 : j.onGap) == null || z.call(j, { from: Ze, to: Mt })), Ze = Mt, S.current = Mt, m(Mt);
|
|
3458
3458
|
}
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3459
|
+
console.debug("[use-chat] received event", {
|
|
3460
|
+
seq: Je.seq,
|
|
3461
|
+
type: Je.type,
|
|
3462
|
+
preview: (() => {
|
|
3463
|
+
var vt;
|
|
3464
|
+
try {
|
|
3465
|
+
return Je.type === "message_delta" ? { deltaTypes: (vt = Je.delta) == null ? void 0 : vt.map((et) => et.type), textLen: (Je.delta || []).filter((et) => et.type === "text").map((et) => String(et.text || "").length) } : Je.content || Je.delta ? { hasContent: !0 } : {};
|
|
3466
|
+
} catch (et) {
|
|
3467
|
+
return { err: String(et) };
|
|
3468
|
+
}
|
|
3469
|
+
})()
|
|
3470
|
+
});
|
|
3471
|
+
try {
|
|
3472
|
+
N == null || N(Je);
|
|
3473
|
+
} catch (vt) {
|
|
3474
|
+
console.error("[use-chat] Error in onEvent callback:", vt, "for event:", Je.type);
|
|
3475
|
+
}
|
|
3476
|
+
if (Je.type === "token" && e.autoAppendAssistant !== !1)
|
|
3477
|
+
Ge.push(Je.content), Qe();
|
|
3478
|
+
else if (Je.type === "message_delta") {
|
|
3479
|
+
const vt = Je.delta.filter((et) => et.type === "text").map((et) => et.text).join("");
|
|
3480
|
+
vt && e.autoAppendAssistant !== !1 && (Ge.push(vt), Qe());
|
|
3481
|
+
} else Je.type === "heartbeat" ? console.debug("[use-chat] heartbeat received") : (Ye !== null && cancelAnimationFrame(Ye), ft(), Je.type === "checkpoint" ? y(Je.checkpointId) : Je.type === "error" && f(Je.message));
|
|
3472
3482
|
}
|
|
3473
3483
|
}
|
|
3474
3484
|
ft();
|
|
@@ -3547,14 +3557,27 @@ function by({
|
|
|
3547
3557
|
s.current = x;
|
|
3548
3558
|
}
|
|
3549
3559
|
if (p.type === "thread_info") {
|
|
3550
|
-
console.log("[useChatStreamingService] 🎯 Received thread_info event:", p)
|
|
3560
|
+
console.log("[useChatStreamingService] 🎯 Received thread_info event:", p);
|
|
3561
|
+
try {
|
|
3562
|
+
t(p);
|
|
3563
|
+
} catch (y) {
|
|
3564
|
+
console.error("[useChatStreamingService] Error in onThreadInfo handler:", y);
|
|
3565
|
+
}
|
|
3551
3566
|
return;
|
|
3552
3567
|
}
|
|
3553
3568
|
if (ly(p)) {
|
|
3554
|
-
|
|
3569
|
+
try {
|
|
3570
|
+
n(p);
|
|
3571
|
+
} catch (y) {
|
|
3572
|
+
console.error("[useChatStreamingService] Error in onMessageEvent handler:", y);
|
|
3573
|
+
}
|
|
3555
3574
|
return;
|
|
3556
3575
|
}
|
|
3557
|
-
|
|
3576
|
+
try {
|
|
3577
|
+
r == null || r(p);
|
|
3578
|
+
} catch (y) {
|
|
3579
|
+
console.error("[useChatStreamingService] Error in onUnhandledEvent handler:", y);
|
|
3580
|
+
}
|
|
3558
3581
|
},
|
|
3559
3582
|
[n, o, t, r]
|
|
3560
3583
|
), { stream: a, stop: l, isStreaming: c, error: d, setToken: f } = yy({
|
|
@@ -3889,15 +3912,15 @@ function zy({
|
|
|
3889
3912
|
state: de,
|
|
3890
3913
|
dispatch: Be,
|
|
3891
3914
|
seed: Ge,
|
|
3892
|
-
prepend:
|
|
3915
|
+
prepend: Ze,
|
|
3893
3916
|
pushUser: Ye,
|
|
3894
3917
|
onEvent: ft,
|
|
3895
|
-
reset:
|
|
3918
|
+
reset: Qe
|
|
3896
3919
|
} = dy(), Oe = De(S);
|
|
3897
3920
|
lt(() => {
|
|
3898
3921
|
Oe.current = S;
|
|
3899
3922
|
}, [S]);
|
|
3900
|
-
const It = De(!1), Ot = De([]), He = De(null), Z = De(null), ve = De(/* @__PURE__ */ new Map()), we = De(S), qe = De(!1), ht = De(null), mt = De(/* @__PURE__ */ new Map()), At = De(/* @__PURE__ */ new Map()), yt = De(/* @__PURE__ */ new Map()), at = De(/* @__PURE__ */ new Map()),
|
|
3923
|
+
const It = De(!1), Ot = De([]), He = De(null), Z = De(null), ve = De(/* @__PURE__ */ new Map()), we = De(S), qe = De(!1), ht = De(null), mt = De(/* @__PURE__ */ new Map()), At = De(/* @__PURE__ */ new Map()), yt = De(/* @__PURE__ */ new Map()), at = De(/* @__PURE__ */ new Map()), Je = be(
|
|
3901
3924
|
(E) => {
|
|
3902
3925
|
if (!E) {
|
|
3903
3926
|
$([]);
|
|
@@ -3915,8 +3938,8 @@ function zy({
|
|
|
3915
3938
|
[]
|
|
3916
3939
|
);
|
|
3917
3940
|
lt(() => {
|
|
3918
|
-
|
|
3919
|
-
}, [S,
|
|
3941
|
+
Je(S);
|
|
3942
|
+
}, [S, Je]);
|
|
3920
3943
|
const Mt = be(() => {
|
|
3921
3944
|
var ne;
|
|
3922
3945
|
const E = at.current;
|
|
@@ -3926,7 +3949,7 @@ function zy({
|
|
|
3926
3949
|
const Q = (ne = I[le]) == null ? void 0 : ne[0];
|
|
3927
3950
|
Q && E.delete(Q);
|
|
3928
3951
|
}
|
|
3929
|
-
}, []),
|
|
3952
|
+
}, []), vt = be(
|
|
3930
3953
|
(E, I, Y) => {
|
|
3931
3954
|
if (!E) return;
|
|
3932
3955
|
const ne = Y === "replace" ? [] : mt.current.get(E) ?? [], le = Y === "replace" ? I : [...I, ...ne];
|
|
@@ -3937,21 +3960,21 @@ function zy({
|
|
|
3937
3960
|
const Q = /* @__PURE__ */ new Map();
|
|
3938
3961
|
for (const Ue of le) {
|
|
3939
3962
|
if (!(Ue != null && Ue.checkpointId)) continue;
|
|
3940
|
-
const Me = `${Ue.checkpointId}::${Ue.checkpointNs ?? ""}`, tt = on(Ue, { cloneMessages: !0 }),
|
|
3941
|
-
if (!
|
|
3963
|
+
const Me = `${Ue.checkpointId}::${Ue.checkpointNs ?? ""}`, tt = on(Ue, { cloneMessages: !0 }), wt = Q.get(Me);
|
|
3964
|
+
if (!wt) {
|
|
3942
3965
|
Q.set(Me, tt);
|
|
3943
3966
|
continue;
|
|
3944
3967
|
}
|
|
3945
|
-
const Nt = hc(
|
|
3946
|
-
Q.set(Me, { ...
|
|
3968
|
+
const Nt = hc(wt, tt);
|
|
3969
|
+
Q.set(Me, { ...wt, ...Nt });
|
|
3947
3970
|
}
|
|
3948
3971
|
const ze = Array.from(Q.values()).sort((Ue, Me) => {
|
|
3949
3972
|
const tt = Number.isFinite(Date.parse(Ue.createdAt ?? "")) ? Date.parse(Ue.createdAt ?? "") : 0;
|
|
3950
3973
|
return (Number.isFinite(Date.parse(Me.createdAt ?? "")) ? Date.parse(Me.createdAt ?? "") : 0) - tt;
|
|
3951
3974
|
});
|
|
3952
|
-
mt.current.set(E, ze), E === Oe.current &&
|
|
3975
|
+
mt.current.set(E, ze), E === Oe.current && Je(E);
|
|
3953
3976
|
},
|
|
3954
|
-
[
|
|
3977
|
+
[Je]
|
|
3955
3978
|
), et = be(
|
|
3956
3979
|
(E, I, Y) => {
|
|
3957
3980
|
if (!E) return;
|
|
@@ -4089,7 +4112,7 @@ function zy({
|
|
|
4089
4112
|
}), re(Q.interrupt ?? null), Ie(Q.nextCursor ?? null), ae(!!Q.nextCursor), D(Q.checkpointId ?? void 0), te(Q.checkpointNs ?? void 0), ie(Q.nextCursorNs ?? void 0);
|
|
4090
4113
|
return;
|
|
4091
4114
|
}
|
|
4092
|
-
const Me = ve.current.get(le), tt = (Me == null ? void 0 : Me.snapshot) ?? null,
|
|
4115
|
+
const Me = ve.current.get(le), tt = (Me == null ? void 0 : Me.snapshot) ?? null, wt = Array.isArray(tt == null ? void 0 : tt.messages) ? tt.messages : [], Nt = on(tt), kn = Array.isArray(E == null ? void 0 : E.messages) ? E.messages : [], _t = /* @__PURE__ */ new Set(), jt = [...kn, ...wt].filter((Rt) => {
|
|
4093
4116
|
const yi = Rt == null ? void 0 : Rt.id;
|
|
4094
4117
|
return yi ? _t.has(yi) ? !1 : (_t.add(yi), !0) : !0;
|
|
4095
4118
|
}), Jr = hc(Nt, Q), Zr = {
|
|
@@ -4112,7 +4135,7 @@ function zy({
|
|
|
4112
4135
|
snapshot: on(Zr, { cloneMessages: !0 })
|
|
4113
4136
|
}), !ze)
|
|
4114
4137
|
return;
|
|
4115
|
-
kn.length &&
|
|
4138
|
+
kn.length && Ze(kn);
|
|
4116
4139
|
const Rn = E && Object.prototype.hasOwnProperty.call(E, "checkpointId") ? E.checkpointId : void 0, Qr = E && Object.prototype.hasOwnProperty.call(E, "checkpointNs") ? E.checkpointNs : void 0, En = E && Object.prototype.hasOwnProperty.call(E, "nextCursor") ? E.nextCursor : void 0, xi = E && Object.prototype.hasOwnProperty.call(E, "nextCursorNs") ? E.nextCursorNs : void 0;
|
|
4117
4140
|
Ie(
|
|
4118
4141
|
(Rt) => En !== void 0 ? En ?? Rt ?? null : Rt ?? null
|
|
@@ -4126,7 +4149,7 @@ function zy({
|
|
|
4126
4149
|
(Rt) => xi !== void 0 ? xi ?? void 0 : Rt
|
|
4127
4150
|
);
|
|
4128
4151
|
},
|
|
4129
|
-
[
|
|
4152
|
+
[Ze, Ge, re]
|
|
4130
4153
|
), lr = be(
|
|
4131
4154
|
(E) => {
|
|
4132
4155
|
if (E.threadId != null && E.threadId !== Oe.current)
|
|
@@ -4136,9 +4159,9 @@ function zy({
|
|
|
4136
4159
|
checkpointId: I.checkpointId ?? null,
|
|
4137
4160
|
checkpointNs: I.checkpointNs ?? null,
|
|
4138
4161
|
pendingInterrupt: I.interrupt ?? null
|
|
4139
|
-
}), re(I.interrupt ?? null), Ie(I.nextCursor ?? null), ae(!!I.nextCursor), D(I.checkpointId ?? void 0), te(I.checkpointNs ?? void 0), ie(I.nextCursorNs ?? void 0), we.current = E.threadId,
|
|
4162
|
+
}), re(I.interrupt ?? null), Ie(I.nextCursor ?? null), ae(!!I.nextCursor), D(I.checkpointId ?? void 0), te(I.checkpointNs ?? void 0), ie(I.nextCursorNs ?? void 0), we.current = E.threadId, Je(E.threadId ?? Oe.current ?? null);
|
|
4140
4163
|
},
|
|
4141
|
-
[Ge, re,
|
|
4164
|
+
[Ge, re, Je]
|
|
4142
4165
|
), Tn = be((E) => {
|
|
4143
4166
|
if (!E) return;
|
|
4144
4167
|
ve.current.delete(E), y(E), mt.current.delete(E), At.current.delete(E), E === Oe.current && $([]);
|
|
@@ -4150,8 +4173,8 @@ function zy({
|
|
|
4150
4173
|
we.current === E && (we.current = null);
|
|
4151
4174
|
}, [y]), pn = be(() => {
|
|
4152
4175
|
const E = Oe.current;
|
|
4153
|
-
E && Tn(E),
|
|
4154
|
-
}, [Tn,
|
|
4176
|
+
E && Tn(E), Qe([]), ae(!1), se(!1), Ie(null), D(void 0), te(void 0), ie(void 0);
|
|
4177
|
+
}, [Tn, Qe]), Hn = be(({ from: E, to: I }) => {
|
|
4155
4178
|
const Y = Oe.current;
|
|
4156
4179
|
Y && console.warn(
|
|
4157
4180
|
`[ChatSessionProvider] Stream sequence gap detected (${E} -> ${I}) for thread ${Y}`
|
|
@@ -4266,7 +4289,7 @@ function zy({
|
|
|
4266
4289
|
if (!Ue) return ze;
|
|
4267
4290
|
const Me = { ...ze.byId };
|
|
4268
4291
|
delete Me[I], Me[Q] = { ...Ue, threadId: Q };
|
|
4269
|
-
const tt = ze.order.map((
|
|
4292
|
+
const tt = ze.order.map((wt) => wt === I ? Q : wt);
|
|
4270
4293
|
return { byId: Me, order: tt };
|
|
4271
4294
|
}), k(Q), setTimeout(() => Dt(), 10), O(null), Q;
|
|
4272
4295
|
} catch (le) {
|
|
@@ -4327,31 +4350,31 @@ function zy({
|
|
|
4327
4350
|
I ?? null,
|
|
4328
4351
|
Y ?? null
|
|
4329
4352
|
), Ue = at.current.get(ze), Me = !ne && !I && !Y && Ue && Date.now() - Ue.timestamp < Dy, tt = !ne && !I && !Y;
|
|
4330
|
-
let
|
|
4353
|
+
let wt = !1;
|
|
4331
4354
|
if (tt) {
|
|
4332
4355
|
const _t = ve.current.get(E);
|
|
4333
4356
|
if (_t)
|
|
4334
|
-
lr(_t),
|
|
4357
|
+
lr(_t), wt = !0;
|
|
4335
4358
|
else {
|
|
4336
4359
|
const jt = p(E);
|
|
4337
|
-
jt && (ve.current.set(E, jt), lr(jt),
|
|
4360
|
+
jt && (ve.current.set(E, jt), lr(jt), wt = !0);
|
|
4338
4361
|
}
|
|
4339
4362
|
}
|
|
4340
|
-
const Nt = ne || !
|
|
4363
|
+
const Nt = ne || !wt || !!I || !!Y, kn = async (_t) => {
|
|
4341
4364
|
_t && F(!0), He.current = E;
|
|
4342
4365
|
try {
|
|
4343
4366
|
const jt = await qn(
|
|
4344
4367
|
{ threadId: E, checkpointId: I, checkpointNs: Y },
|
|
4345
4368
|
{ force: ne }
|
|
4346
4369
|
), { latest: Jr, checkpoints: Zr, snapshots: Rn } = na(jt);
|
|
4347
|
-
Yt(Jr, "replace", E),
|
|
4370
|
+
Yt(Jr, "replace", E), vt(E, Zr, "replace"), et(E, Rn, "replace"), j(null);
|
|
4348
4371
|
} catch (jt) {
|
|
4349
|
-
throw (!
|
|
4372
|
+
throw (!wt || ne || _t) && (i == null || i(String(jt))), j(String(jt)), jt;
|
|
4350
4373
|
} finally {
|
|
4351
4374
|
He.current = null, _t && F(!1);
|
|
4352
4375
|
}
|
|
4353
4376
|
};
|
|
4354
|
-
Nt ? await kn(!0) : tt &&
|
|
4377
|
+
Nt ? await kn(!0) : tt && wt && !Me && kn(!1).catch((_t) => {
|
|
4355
4378
|
console.warn("[ChatSessionProvider] Background refresh failed:", _t);
|
|
4356
4379
|
});
|
|
4357
4380
|
}, `loadThread-${E}`);
|
|
@@ -4362,7 +4385,7 @@ function zy({
|
|
|
4362
4385
|
Gt,
|
|
4363
4386
|
qn,
|
|
4364
4387
|
i,
|
|
4365
|
-
|
|
4388
|
+
vt,
|
|
4366
4389
|
et
|
|
4367
4390
|
]
|
|
4368
4391
|
), Le = be(async () => {
|
|
@@ -4416,7 +4439,7 @@ function zy({
|
|
|
4416
4439
|
Ie(null), ie(void 0), ae(!1), j(null);
|
|
4417
4440
|
return;
|
|
4418
4441
|
}
|
|
4419
|
-
Yt(ne, "prepend", I ?? void 0), I && (
|
|
4442
|
+
Yt(ne, "prepend", I ?? void 0), I && (vt(I, le, "prepend"), et(I, Q, "prepend")), j(null);
|
|
4420
4443
|
} catch (I) {
|
|
4421
4444
|
throw j(String(I)), I;
|
|
4422
4445
|
} finally {
|
|
@@ -4433,7 +4456,7 @@ function zy({
|
|
|
4433
4456
|
ce,
|
|
4434
4457
|
Ne,
|
|
4435
4458
|
z,
|
|
4436
|
-
|
|
4459
|
+
vt,
|
|
4437
4460
|
et
|
|
4438
4461
|
]
|
|
4439
4462
|
), ke = be(
|
|
@@ -4470,7 +4493,7 @@ function zy({
|
|
|
4470
4493
|
Q
|
|
4471
4494
|
), tt = [...Ue];
|
|
4472
4495
|
ne && ne.trim() && tt.push({ type: "text", text: ne.trim() });
|
|
4473
|
-
const
|
|
4496
|
+
const wt = !!Y, Nt = wt ? (I == null ? void 0 : I.checkpointId) ?? de.lastCheckpointId ?? void 0 : void 0, kn = wt ? (I == null ? void 0 : I.checkpointNs) ?? de.lastCheckpointNs ?? void 0 : void 0, _t = {
|
|
4474
4497
|
id: ((Qr = crypto.randomUUID) == null ? void 0 : Qr.call(crypto)) || `user-${Date.now()}`,
|
|
4475
4498
|
role: "user",
|
|
4476
4499
|
content: tt,
|
|
@@ -4577,8 +4600,8 @@ function zy({
|
|
|
4577
4600
|
nextCursorNs: ce ?? null,
|
|
4578
4601
|
interrupt: de.pendingInterrupt ?? B ?? null
|
|
4579
4602
|
}), Y = ve.current.get(E), ne = Y == null ? void 0 : Y.snapshot, le = !ne || ne.messages.length !== I.messages.length || ne.messages.some((Me, tt) => {
|
|
4580
|
-
var
|
|
4581
|
-
return (Me == null ? void 0 : Me.id) !== ((
|
|
4603
|
+
var wt;
|
|
4604
|
+
return (Me == null ? void 0 : Me.id) !== ((wt = I.messages[tt]) == null ? void 0 : wt.id);
|
|
4582
4605
|
}), Q = ((ne == null ? void 0 : ne.checkpointId) ?? null) !== I.checkpointId || ((ne == null ? void 0 : ne.checkpointNs) ?? null) !== I.checkpointNs, ze = ((ne == null ? void 0 : ne.nextCursor) ?? null) !== I.nextCursor || ((ne == null ? void 0 : ne.nextCursorNs) ?? null) !== I.nextCursorNs, Ue = !cc(
|
|
4583
4606
|
(ne == null ? void 0 : ne.interrupt) ?? null,
|
|
4584
4607
|
I.interrupt ?? null
|
|
@@ -4952,7 +4975,7 @@ function Pe(e, t) {
|
|
|
4952
4975
|
function Ba(e) {
|
|
4953
4976
|
e(Vr);
|
|
4954
4977
|
}
|
|
4955
|
-
function
|
|
4978
|
+
function bt(e) {
|
|
4956
4979
|
return e(sd);
|
|
4957
4980
|
}
|
|
4958
4981
|
function ye(e, t) {
|
|
@@ -5119,7 +5142,7 @@ function Zy(e) {
|
|
|
5119
5142
|
};
|
|
5120
5143
|
return n(e);
|
|
5121
5144
|
}
|
|
5122
|
-
function
|
|
5145
|
+
function Ct(...e) {
|
|
5123
5146
|
const t = Ke(), n = new Array(e.length);
|
|
5124
5147
|
let r = 0;
|
|
5125
5148
|
const o = Math.pow(2, e.length) - 1;
|
|
@@ -5167,7 +5190,7 @@ const Qy = {
|
|
|
5167
5190
|
return {
|
|
5168
5191
|
log: J((t, n, r = 1) => {
|
|
5169
5192
|
var o;
|
|
5170
|
-
const s = (o = ev().VIRTUOSO_LOG_LEVEL) != null ? o :
|
|
5193
|
+
const s = (o = ev().VIRTUOSO_LOG_LEVEL) != null ? o : bt(e);
|
|
5171
5194
|
r >= s && console[Qy[r]](
|
|
5172
5195
|
"%creact-virtuoso: %c%s %o",
|
|
5173
5196
|
"color: #0253b3; font-weight: bold",
|
|
@@ -5691,7 +5714,7 @@ const pv = {
|
|
|
5691
5714
|
ye(
|
|
5692
5715
|
V(
|
|
5693
5716
|
d,
|
|
5694
|
-
Ee((C) => C !== void 0 && st(
|
|
5717
|
+
Ee((C) => C !== void 0 && st(bt(y).sizeTree)),
|
|
5695
5718
|
pe((C) => [{ endIndex: 0, size: C, startIndex: 0 }])
|
|
5696
5719
|
),
|
|
5697
5720
|
n
|
|
@@ -5720,11 +5743,11 @@ const pv = {
|
|
|
5720
5743
|
pe((C) => C.diff)
|
|
5721
5744
|
),
|
|
5722
5745
|
(C) => {
|
|
5723
|
-
const { groupIndices: S } =
|
|
5746
|
+
const { groupIndices: S } = bt(y);
|
|
5724
5747
|
if (C > 0)
|
|
5725
5748
|
Pe(t, !0), Pe(s, C + vc(C, S));
|
|
5726
5749
|
else if (C < 0) {
|
|
5727
|
-
const k =
|
|
5750
|
+
const k = bt(v);
|
|
5728
5751
|
k.length > 0 && (C -= vc(-C, k)), Pe(i, C);
|
|
5729
5752
|
}
|
|
5730
5753
|
}
|
|
@@ -5816,7 +5839,7 @@ const pv = {
|
|
|
5816
5839
|
if (st(S.sizeTree))
|
|
5817
5840
|
return S;
|
|
5818
5841
|
let A = Mr();
|
|
5819
|
-
const _ =
|
|
5842
|
+
const _ = bt(v);
|
|
5820
5843
|
let M = 0, F = 0, q = 0;
|
|
5821
5844
|
for (; M < -C; ) {
|
|
5822
5845
|
q = _[F];
|
|
@@ -5896,7 +5919,7 @@ const yd = Xe(
|
|
|
5896
5919
|
e
|
|
5897
5920
|
), ye(
|
|
5898
5921
|
V(
|
|
5899
|
-
|
|
5922
|
+
Ct(o, t, r),
|
|
5900
5923
|
Ee(([l, c]) => Ws(c)),
|
|
5901
5924
|
pe(([l, c, d]) => xn(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
|
|
5902
5925
|
ut(),
|
|
@@ -5916,7 +5939,7 @@ const yd = Xe(
|
|
|
5916
5939
|
)
|
|
5917
5940
|
);
|
|
5918
5941
|
return rt(t, (r) => {
|
|
5919
|
-
r &&
|
|
5942
|
+
r && bt(e)("props updated", {}, qt.DEBUG);
|
|
5920
5943
|
}), { didMount: n, propsReady: t };
|
|
5921
5944
|
},
|
|
5922
5945
|
dt(rr),
|
|
@@ -6029,7 +6052,7 @@ const _o = Xe(
|
|
|
6029
6052
|
c
|
|
6030
6053
|
), rt(
|
|
6031
6054
|
V(
|
|
6032
|
-
|
|
6055
|
+
Ct(t, i),
|
|
6033
6056
|
Fe(a, n, e, c),
|
|
6034
6057
|
Ee(([[, d], f, { sizeTree: h }, p, x]) => d && (!st(h) || za(p)) && !f && !x),
|
|
6035
6058
|
Fe(l)
|
|
@@ -6077,7 +6100,7 @@ const vo = "up", ao = "down", yv = "none", vv = {
|
|
|
6077
6100
|
);
|
|
6078
6101
|
ye(
|
|
6079
6102
|
V(
|
|
6080
|
-
|
|
6103
|
+
Ct(Re(o), Re(f)),
|
|
6081
6104
|
pe(([w, b]) => w <= b),
|
|
6082
6105
|
ut()
|
|
6083
6106
|
),
|
|
@@ -6085,7 +6108,7 @@ const vo = "up", ao = "down", yv = "none", vv = {
|
|
|
6085
6108
|
), ye(V(a, Un(50)), c);
|
|
6086
6109
|
const x = Zt(
|
|
6087
6110
|
V(
|
|
6088
|
-
|
|
6111
|
+
Ct(r, Re(s), Re(t), Re(e), Re(d)),
|
|
6089
6112
|
Pn((w, [{ scrollHeight: b, scrollTop: T }, C, S, k, A]) => {
|
|
6090
6113
|
const _ = T + C - b > -A, M = {
|
|
6091
6114
|
scrollHeight: b,
|
|
@@ -6158,7 +6181,7 @@ const vo = "up", ao = "down", yv = "none", vv = {
|
|
|
6158
6181
|
pe(({ scrollTop: w }) => w),
|
|
6159
6182
|
ut(),
|
|
6160
6183
|
Pn(
|
|
6161
|
-
(w, b) =>
|
|
6184
|
+
(w, b) => bt(p) ? { direction: w.direction, prevScrollTop: b } : { direction: b < w.prevScrollTop ? vo : ao, prevScrollTop: b },
|
|
6162
6185
|
{ direction: ao, prevScrollTop: 0 }
|
|
6163
6186
|
),
|
|
6164
6187
|
pe((w) => w.direction)
|
|
@@ -6208,7 +6231,7 @@ const qa = Xe(
|
|
|
6208
6231
|
([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
|
|
6209
6232
|
const s = Ke(), i = J(0), a = J(0), l = J(0), c = Bt(
|
|
6210
6233
|
V(
|
|
6211
|
-
|
|
6234
|
+
Ct(
|
|
6212
6235
|
Re(r),
|
|
6213
6236
|
Re(o),
|
|
6214
6237
|
Re(n),
|
|
@@ -6357,7 +6380,7 @@ const kr = Xe(
|
|
|
6357
6380
|
ye(s.topItemsIndexes, y);
|
|
6358
6381
|
const w = Bt(
|
|
6359
6382
|
V(
|
|
6360
|
-
|
|
6383
|
+
Ct(
|
|
6361
6384
|
p,
|
|
6362
6385
|
x,
|
|
6363
6386
|
Re(l, xo),
|
|
@@ -6388,7 +6411,7 @@ const kr = Xe(
|
|
|
6388
6411
|
N,
|
|
6389
6412
|
j
|
|
6390
6413
|
]) => {
|
|
6391
|
-
const B = _, { offsetTree: re, sizeTree: W } = B, $ =
|
|
6414
|
+
const B = _, { offsetTree: re, sizeTree: W } = B, $ = bt(v);
|
|
6392
6415
|
if (A === 0)
|
|
6393
6416
|
return { ...Ai, totalCount: A };
|
|
6394
6417
|
if (S === 0 && k === 0)
|
|
@@ -6521,7 +6544,7 @@ const kr = Xe(
|
|
|
6521
6544
|
([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
|
|
6522
6545
|
const s = Ke(), i = Bt(
|
|
6523
6546
|
V(
|
|
6524
|
-
|
|
6547
|
+
Ct(n, e, r, t, o),
|
|
6525
6548
|
pe(([a, l, c, d, f]) => a + l + c + d + f.offsetBottom + f.bottom)
|
|
6526
6549
|
),
|
|
6527
6550
|
0
|
|
@@ -6534,7 +6557,7 @@ const kr = Xe(
|
|
|
6534
6557
|
([{ viewportHeight: e }, { totalListHeight: t }]) => {
|
|
6535
6558
|
const n = J(!1), r = Bt(
|
|
6536
6559
|
V(
|
|
6537
|
-
|
|
6560
|
+
Ct(n, e, t),
|
|
6538
6561
|
Ee(([o]) => o),
|
|
6539
6562
|
pe(([, o, s]) => Math.max(0, o - s)),
|
|
6540
6563
|
Un(0),
|
|
@@ -6580,7 +6603,7 @@ const kr = Xe(
|
|
|
6580
6603
|
Ee((j) => !j),
|
|
6581
6604
|
// skips the initial publish of false, and the cleanup call.
|
|
6582
6605
|
// but if scrollingInProgress is true, we skip the initial publish.
|
|
6583
|
-
yr(
|
|
6606
|
+
yr(bt(i) ? 1 : 2)
|
|
6584
6607
|
),
|
|
6585
6608
|
k
|
|
6586
6609
|
) : k && k(), N;
|
|
@@ -6621,7 +6644,7 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6621
6644
|
}
|
|
6622
6645
|
rt(
|
|
6623
6646
|
V(
|
|
6624
|
-
|
|
6647
|
+
Ct(V(Re(t), yr(1)), l),
|
|
6625
6648
|
Fe(Re(x), s, a, f),
|
|
6626
6649
|
pe(([[C, S], k, A, _, M]) => {
|
|
6627
6650
|
let F = S && _, q = "auto";
|
|
@@ -6630,22 +6653,22 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6630
6653
|
Ee(({ shouldFollow: C }) => C)
|
|
6631
6654
|
),
|
|
6632
6655
|
({ followOutputBehavior: C, totalCount: S }) => {
|
|
6633
|
-
v && (v(), v = null),
|
|
6634
|
-
|
|
6656
|
+
v && (v(), v = null), bt(n) ? requestAnimationFrame(() => {
|
|
6657
|
+
bt(d)("following output to ", { totalCount: S }, qt.DEBUG), m(C);
|
|
6635
6658
|
}) : v = gn(e, () => {
|
|
6636
|
-
|
|
6659
|
+
bt(d)("following output to ", { totalCount: S }, qt.DEBUG), m(C), v = null;
|
|
6637
6660
|
});
|
|
6638
6661
|
}
|
|
6639
6662
|
);
|
|
6640
6663
|
function w(C) {
|
|
6641
6664
|
const S = gn(o, (k) => {
|
|
6642
|
-
C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !v && (
|
|
6665
|
+
C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !v && (bt(d)("scrolling to bottom due to increased size", {}, qt.DEBUG), m("auto"));
|
|
6643
6666
|
});
|
|
6644
6667
|
setTimeout(S, 100);
|
|
6645
6668
|
}
|
|
6646
6669
|
rt(
|
|
6647
6670
|
V(
|
|
6648
|
-
|
|
6671
|
+
Ct(Re(x), t, c),
|
|
6649
6672
|
Ee(([C, , S]) => C && S),
|
|
6650
6673
|
Pn(
|
|
6651
6674
|
({ value: C }, [, S]) => ({ refreshed: C === S, value: S }),
|
|
@@ -6655,11 +6678,11 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6655
6678
|
Fe(x, t)
|
|
6656
6679
|
),
|
|
6657
6680
|
([, C]) => {
|
|
6658
|
-
|
|
6681
|
+
bt(a) && w(C !== !1);
|
|
6659
6682
|
}
|
|
6660
6683
|
), rt(y, () => {
|
|
6661
|
-
w(
|
|
6662
|
-
}), rt(
|
|
6684
|
+
w(bt(x) !== !1);
|
|
6685
|
+
}), rt(Ct(Re(x), o), ([C, S]) => {
|
|
6663
6686
|
C && !S.atBottom && S.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && m("auto");
|
|
6664
6687
|
});
|
|
6665
6688
|
const b = J(null), T = Ke();
|
|
@@ -6677,17 +6700,17 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6677
6700
|
T
|
|
6678
6701
|
), rt(
|
|
6679
6702
|
V(
|
|
6680
|
-
|
|
6703
|
+
Ct(V(T, yr(1)), l),
|
|
6681
6704
|
Fe(Re(b), a, f, h),
|
|
6682
6705
|
pe(([[C, S], k, A, _, M]) => S && A && (k == null ? void 0 : k({ context: M, totalCount: C, scrollingInProgress: _ }))),
|
|
6683
6706
|
Ee((C) => !!C),
|
|
6684
6707
|
Un(0)
|
|
6685
6708
|
),
|
|
6686
6709
|
(C) => {
|
|
6687
|
-
v && (v(), v = null),
|
|
6688
|
-
|
|
6710
|
+
v && (v(), v = null), bt(n) ? requestAnimationFrame(() => {
|
|
6711
|
+
bt(d)("scrolling into view", {}), Pe(p, C);
|
|
6689
6712
|
}) : v = gn(e, () => {
|
|
6690
|
-
|
|
6713
|
+
bt(d)("scrolling into view", {}), Pe(p, C), v = null;
|
|
6691
6714
|
});
|
|
6692
6715
|
}
|
|
6693
6716
|
), { autoscrollToBottom: y, followOutput: x, scrollIntoViewOnChange: b };
|
|
@@ -6767,7 +6790,7 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6767
6790
|
),
|
|
6768
6791
|
t
|
|
6769
6792
|
), rt(
|
|
6770
|
-
V(
|
|
6793
|
+
V(Ct(t, e, n), Fe(r)),
|
|
6771
6794
|
([[o, s, i], a]) => {
|
|
6772
6795
|
o && a && a.change && a.change(s, i);
|
|
6773
6796
|
}
|
|
@@ -6779,7 +6802,7 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6779
6802
|
const n = Ke(), r = Ke(), o = Ke(), s = J(!1), i = J(void 0);
|
|
6780
6803
|
return ye(
|
|
6781
6804
|
V(
|
|
6782
|
-
|
|
6805
|
+
Ct(n, r),
|
|
6783
6806
|
pe(([{ scrollHeight: a, scrollTop: l, viewportHeight: c }, { offsetTop: d }]) => ({
|
|
6784
6807
|
scrollHeight: a,
|
|
6785
6808
|
scrollTop: Math.max(0, l - d),
|
|
@@ -6893,7 +6916,7 @@ const _v = Rd(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
6893
6916
|
b && _v() ? Pe(e, w - m) : v(-m);
|
|
6894
6917
|
}), rt(
|
|
6895
6918
|
V(
|
|
6896
|
-
|
|
6919
|
+
Ct(Bt(s, !1), e, x),
|
|
6897
6920
|
Ee(([m, w, b]) => !m && !b && w !== 0),
|
|
6898
6921
|
pe(([m, w]) => w),
|
|
6899
6922
|
Un(1)
|
|
@@ -7119,11 +7142,11 @@ function Id(e, t, n) {
|
|
|
7119
7142
|
);
|
|
7120
7143
|
return U.useSyncExternalStore(
|
|
7121
7144
|
w,
|
|
7122
|
-
() =>
|
|
7123
|
-
() =>
|
|
7145
|
+
() => bt(m),
|
|
7146
|
+
() => bt(m)
|
|
7124
7147
|
);
|
|
7125
7148
|
}, x = (v) => {
|
|
7126
|
-
const m = U.useContext(a)[v], [w, b] = U.useState(mc(
|
|
7149
|
+
const m = U.useContext(a)[v], [w, b] = U.useState(mc(bt, m));
|
|
7127
7150
|
return Bo(
|
|
7128
7151
|
() => rt(m, (T) => {
|
|
7129
7152
|
T !== w && b(pc(T));
|
|
@@ -7607,7 +7630,7 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7607
7630
|
}
|
|
7608
7631
|
), rt(
|
|
7609
7632
|
V(
|
|
7610
|
-
|
|
7633
|
+
Ct(x, G, M, _, $, ee),
|
|
7611
7634
|
Ee(([D, X, te, ce, , ie]) => D && !X && te.height !== 0 && ce.height !== 0 && !ie)
|
|
7612
7635
|
),
|
|
7613
7636
|
([, , , , D]) => {
|
|
@@ -7643,7 +7666,7 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7643
7666
|
f
|
|
7644
7667
|
), ye(
|
|
7645
7668
|
V(
|
|
7646
|
-
|
|
7669
|
+
Ct(
|
|
7647
7670
|
Re(_, Ho),
|
|
7648
7671
|
Re(M, Ho),
|
|
7649
7672
|
Re(j, (D, X) => D && D.column === X.column && D.row === X.row),
|
|
@@ -7659,7 +7682,7 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7659
7682
|
B
|
|
7660
7683
|
), ye(
|
|
7661
7684
|
V(
|
|
7662
|
-
|
|
7685
|
+
Ct(
|
|
7663
7686
|
Re(S),
|
|
7664
7687
|
r,
|
|
7665
7688
|
Re(j, ow),
|
|
@@ -7682,10 +7705,10 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7682
7705
|
Be,
|
|
7683
7706
|
Ge,
|
|
7684
7707
|
,
|
|
7685
|
-
|
|
7708
|
+
Ze,
|
|
7686
7709
|
Ye
|
|
7687
7710
|
]) => {
|
|
7688
|
-
const { column: ft, row:
|
|
7711
|
+
const { column: ft, row: Qe } = ce, { height: Oe, width: It } = ie, { width: Ot } = de;
|
|
7689
7712
|
if (Ge === 0 && (D === 0 || Ot === 0))
|
|
7690
7713
|
return Ec;
|
|
7691
7714
|
if (It === 0) {
|
|
@@ -7694,8 +7717,8 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7694
7717
|
}
|
|
7695
7718
|
const He = Dd(Ot, It, ft);
|
|
7696
7719
|
let Z, ve;
|
|
7697
|
-
|
|
7698
|
-
const we = Nc(Z, ve, Be), { bottom: qe, top: ht } = _c(de, ce, ie, we), mt = Ic(D / He), At = mt * Oe + (mt - 1) *
|
|
7720
|
+
Ze ? X === 0 && te === 0 && Ge > 0 ? (Z = 0, ve = Ge - 1) : (Z = He * xs((X + Qe) / (Oe + Qe)), ve = He * Ic((te + Qe) / (Oe + Qe)) - 1, ve = ji(D - 1, lo(ve, He - 1)), Z = ji(ve, lo(0, Z))) : (Z = 0, ve = -1);
|
|
7721
|
+
const we = Nc(Z, ve, Be), { bottom: qe, top: ht } = _c(de, ce, ie, we), mt = Ic(D / He), At = mt * Oe + (mt - 1) * Qe - qe;
|
|
7699
7722
|
return { bottom: qe, itemHeight: Oe, items: we, itemWidth: It, offsetBottom: At, offsetTop: ht, top: ht };
|
|
7700
7723
|
}
|
|
7701
7724
|
)
|
|
@@ -7710,7 +7733,7 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7710
7733
|
S
|
|
7711
7734
|
), ye(
|
|
7712
7735
|
V(
|
|
7713
|
-
|
|
7736
|
+
Ct(_, M, A, j),
|
|
7714
7737
|
Ee(([D, X, { items: te }]) => te.length > 0 && X.height !== 0 && D.height !== 0),
|
|
7715
7738
|
pe(([D, X, { items: te }, ce]) => {
|
|
7716
7739
|
const { bottom: ie, top: de } = _c(D, ce, X, te);
|
|
@@ -7731,7 +7754,7 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7731
7754
|
);
|
|
7732
7755
|
const se = Zt(
|
|
7733
7756
|
V(
|
|
7734
|
-
|
|
7757
|
+
Ct(A, S),
|
|
7735
7758
|
Ee(([{ items: D }]) => D.length > 0),
|
|
7736
7759
|
Fe(z),
|
|
7737
7760
|
Ee(([[D, X], te]) => {
|
|
@@ -7766,11 +7789,11 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7766
7789
|
F,
|
|
7767
7790
|
Fe(_, M, S, j),
|
|
7768
7791
|
pe(([D, X, te, ce, ie]) => {
|
|
7769
|
-
const de = vd(D), { align: Be, behavior: Ge, offset:
|
|
7792
|
+
const de = vd(D), { align: Be, behavior: Ge, offset: Ze } = de;
|
|
7770
7793
|
let Ye = de.index;
|
|
7771
7794
|
Ye === "LAST" && (Ye = ce - 1), Ye = lo(0, Ye, ji(ce - 1, Ye));
|
|
7772
7795
|
let ft = fa(X, ie, te, Ye);
|
|
7773
|
-
return Be === "end" ? ft = Ac(ft - X.height + te.height) : Be === "center" && (ft = Ac(ft - X.height / 2 + te.height / 2)),
|
|
7796
|
+
return Be === "end" ? ft = Ac(ft - X.height + te.height) : Be === "center" && (ft = Ac(ft - X.height / 2 + te.height / 2)), Ze && (ft += Ze), { behavior: Ge, top: ft };
|
|
7774
7797
|
})
|
|
7775
7798
|
),
|
|
7776
7799
|
l
|
|
@@ -11631,7 +11654,7 @@ const k0 = U.memo(function({
|
|
|
11631
11654
|
default:
|
|
11632
11655
|
return /* @__PURE__ */ u.jsx(Ol, { className: ve });
|
|
11633
11656
|
}
|
|
11634
|
-
}, [O, ae, N]),
|
|
11657
|
+
}, [O, ae, N]), Ze = U.useCallback(() => {
|
|
11635
11658
|
const Z = "group relative mb-4 flex w-full";
|
|
11636
11659
|
switch (N) {
|
|
11637
11660
|
case "user":
|
|
@@ -11692,7 +11715,7 @@ const k0 = U.memo(function({
|
|
|
11692
11715
|
} finally {
|
|
11693
11716
|
T == null || T();
|
|
11694
11717
|
}
|
|
11695
|
-
}, [w, T, b, q]),
|
|
11718
|
+
}, [w, T, b, q]), Qe = U.useCallback(async (Z) => {
|
|
11696
11719
|
if (w)
|
|
11697
11720
|
return;
|
|
11698
11721
|
const ve = Yo(
|
|
@@ -11765,7 +11788,7 @@ const k0 = U.memo(function({
|
|
|
11765
11788
|
{
|
|
11766
11789
|
interruptPart: At,
|
|
11767
11790
|
onApprove: ft,
|
|
11768
|
-
onReject:
|
|
11791
|
+
onReject: Qe,
|
|
11769
11792
|
disabled: w,
|
|
11770
11793
|
isActive: ht,
|
|
11771
11794
|
payload: mt
|
|
@@ -11778,7 +11801,7 @@ const k0 = U.memo(function({
|
|
|
11778
11801
|
W,
|
|
11779
11802
|
re,
|
|
11780
11803
|
ft,
|
|
11781
|
-
|
|
11804
|
+
Qe,
|
|
11782
11805
|
N,
|
|
11783
11806
|
c,
|
|
11784
11807
|
d,
|
|
@@ -11826,7 +11849,7 @@ const k0 = U.memo(function({
|
|
|
11826
11849
|
ae
|
|
11827
11850
|
]), He = ct(() => C0(t), [t]);
|
|
11828
11851
|
return j && !f ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
11829
|
-
/* @__PURE__ */ u.jsx("div", { className: oe(
|
|
11852
|
+
/* @__PURE__ */ u.jsx("div", { className: oe(Ze(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: oe(Ye(), h.content), children: [
|
|
11830
11853
|
(i || a || j) && /* @__PURE__ */ u.jsxs(
|
|
11831
11854
|
"div",
|
|
11832
11855
|
{
|
|
@@ -13825,9 +13848,9 @@ var yl = "PopperContent", [qS, GS] = Qf(yl), oh = g.forwardRef(
|
|
|
13825
13848
|
l && zS({ ...O }),
|
|
13826
13849
|
BS({
|
|
13827
13850
|
...O,
|
|
13828
|
-
apply: ({ elements: de, rects: Be, availableWidth: Ge, availableHeight:
|
|
13829
|
-
const { width: Ye, height: ft } = Be.reference,
|
|
13830
|
-
|
|
13851
|
+
apply: ({ elements: de, rects: Be, availableWidth: Ge, availableHeight: Ze }) => {
|
|
13852
|
+
const { width: Ye, height: ft } = Be.reference, Qe = de.floating.style;
|
|
13853
|
+
Qe.setProperty("--radix-popper-available-width", `${Ge}px`), Qe.setProperty("--radix-popper-available-height", `${Ze}px`), Qe.setProperty("--radix-popper-anchor-width", `${Ye}px`), Qe.setProperty("--radix-popper-anchor-height", `${ft}px`);
|
|
13831
13854
|
}
|
|
13832
13855
|
}),
|
|
13833
13856
|
T && US({ element: T, padding: a }),
|
|
@@ -15027,8 +15050,8 @@ function Vi({
|
|
|
15027
15050
|
z(!0);
|
|
15028
15051
|
}, []), Ne = be(() => {
|
|
15029
15052
|
z(!1);
|
|
15030
|
-
}, []), Ie = !!ee || ae, [K, D] = xe(null), [X, te] = xe(""), [ce, ie] = xe(null), [de, Be] = xe([]), [Ge,
|
|
15031
|
-
pu.value = L,
|
|
15053
|
+
}, []), Ie = !!ee || ae, [K, D] = xe(null), [X, te] = xe(""), [ce, ie] = xe(null), [de, Be] = xe([]), [Ge, Ze] = xe(0), [Ye, ft] = xe(0), [Qe, Oe] = xe(!1), [It, Ot] = xe(null), [He, Z] = xe(null), [ve, we] = xe(!1), [qe, ht] = xe(null), [mt, At] = xe(!1), yt = De(!1), [at, Je] = xe(() => pu.value), Mt = De(at), vt = De(null), et = be((L) => {
|
|
15054
|
+
pu.value = L, Je(L);
|
|
15032
15055
|
}, []), [qn, Gt] = xe(!1), dn = be(
|
|
15033
15056
|
(L, fe) => {
|
|
15034
15057
|
if (!L || typeof L != "object") return null;
|
|
@@ -15053,7 +15076,7 @@ function Vi({
|
|
|
15053
15076
|
return Number.isNaN(nn) || Number.isNaN(Tt) ? 0 : Tt - nn;
|
|
15054
15077
|
}), L;
|
|
15055
15078
|
}, [M, dn]), Sn = De(null), fn = De(null), gt = be(() => {
|
|
15056
|
-
Sn.current && (Sn.current.value = ""), fn.current && (fn.current.value = ""),
|
|
15079
|
+
Sn.current && (Sn.current.value = ""), fn.current && (fn.current.value = ""), Ze((L) => L + 1), ft((L) => L + 1);
|
|
15057
15080
|
}, []), hn = be(
|
|
15058
15081
|
(L) => {
|
|
15059
15082
|
et(L);
|
|
@@ -15076,10 +15099,10 @@ function Vi({
|
|
|
15076
15099
|
Mt.current = at;
|
|
15077
15100
|
}, [at]), lt(() => {
|
|
15078
15101
|
if (!K) {
|
|
15079
|
-
|
|
15102
|
+
vt.current = null;
|
|
15080
15103
|
return;
|
|
15081
15104
|
}
|
|
15082
|
-
|
|
15105
|
+
vt.current === null && (vt.current = Mt.current), et(X ?? "");
|
|
15083
15106
|
}, [X, K, et]);
|
|
15084
15107
|
const lr = be(async () => {
|
|
15085
15108
|
if (!(!b || T || !mt))
|
|
@@ -15142,11 +15165,11 @@ function Vi({
|
|
|
15142
15165
|
}
|
|
15143
15166
|
}, Hn = U.useCallback(
|
|
15144
15167
|
(L, fe) => {
|
|
15145
|
-
c && (
|
|
15168
|
+
c && (vt.current = at, D(L), te(fe), et(fe), ie(null));
|
|
15146
15169
|
},
|
|
15147
15170
|
[at, c, et]
|
|
15148
15171
|
), cr = U.useCallback(() => {
|
|
15149
|
-
D(null), te(""), ie(null), et(
|
|
15172
|
+
D(null), te(""), ie(null), et(vt.current ?? at), vt.current = null;
|
|
15150
15173
|
}, [at, et]), Ar = be((L, fe) => {
|
|
15151
15174
|
Hn(L, fe);
|
|
15152
15175
|
}, [Hn]), Nr = be((L) => {
|
|
@@ -15366,12 +15389,12 @@ function Vi({
|
|
|
15366
15389
|
},
|
|
15367
15390
|
Ye
|
|
15368
15391
|
),
|
|
15369
|
-
|
|
15392
|
+
Qe && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
15370
15393
|
/* @__PURE__ */ u.jsx(Gi, { className: "h-4 w-4 animate-spin" }),
|
|
15371
15394
|
" Uploading Excel file..."
|
|
15372
15395
|
] }),
|
|
15373
|
-
He && !
|
|
15374
|
-
It && !
|
|
15396
|
+
He && !Qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: He }),
|
|
15397
|
+
It && !Qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: It })
|
|
15375
15398
|
] })
|
|
15376
15399
|
] }),
|
|
15377
15400
|
ce && /* @__PURE__ */ u.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: ce }),
|
|
@@ -15402,9 +15425,9 @@ function Vi({
|
|
|
15402
15425
|
{
|
|
15403
15426
|
onClick: () => {
|
|
15404
15427
|
var L;
|
|
15405
|
-
|
|
15428
|
+
Qe || (L = fn.current) == null || L.click();
|
|
15406
15429
|
},
|
|
15407
|
-
className: `cursor-pointer ${
|
|
15430
|
+
className: `cursor-pointer ${Qe ? "opacity-60 pointer-events-none" : ""}`,
|
|
15408
15431
|
children: [
|
|
15409
15432
|
/* @__PURE__ */ u.jsx(Km, { className: "h-4 w-4 mr-2" }),
|
|
15410
15433
|
" Upload Excel file"
|
|
@@ -16794,20 +16817,20 @@ var uk = "SelectItemAlignedPosition", Jp = g.forwardRef((e, t) => {
|
|
|
16794
16817
|
if (s.trigger && s.valueNode && a && c && y && v && m) {
|
|
16795
16818
|
const k = s.trigger.getBoundingClientRect(), A = c.getBoundingClientRect(), _ = s.valueNode.getBoundingClientRect(), M = m.getBoundingClientRect();
|
|
16796
16819
|
if (s.dir !== "rtl") {
|
|
16797
|
-
const ce = M.left - A.left, ie = _.left - ce, de = k.left - ie, Be = k.width + de, Ge = Math.max(Be, A.width),
|
|
16820
|
+
const ce = M.left - A.left, ie = _.left - ce, de = k.left - ie, Be = k.width + de, Ge = Math.max(Be, A.width), Ze = window.innerWidth - mn, Ye = ba(ie, [
|
|
16798
16821
|
mn,
|
|
16799
16822
|
// Prevents the content from going off the starting edge of the
|
|
16800
16823
|
// viewport. It may still go off the ending edge, but this can be
|
|
16801
16824
|
// controlled by the user since they may want to manage overflow in a
|
|
16802
16825
|
// specific way.
|
|
16803
16826
|
// https://github.com/radix-ui/primitives/issues/2049
|
|
16804
|
-
Math.max(mn,
|
|
16827
|
+
Math.max(mn, Ze - Ge)
|
|
16805
16828
|
]);
|
|
16806
16829
|
a.style.minWidth = Be + "px", a.style.left = Ye + "px";
|
|
16807
16830
|
} else {
|
|
16808
|
-
const ce = A.right - M.right, ie = window.innerWidth - _.right - ce, de = window.innerWidth - k.right - ie, Be = k.width + de, Ge = Math.max(Be, A.width),
|
|
16831
|
+
const ce = A.right - M.right, ie = window.innerWidth - _.right - ce, de = window.innerWidth - k.right - ie, Be = k.width + de, Ge = Math.max(Be, A.width), Ze = window.innerWidth - mn, Ye = ba(ie, [
|
|
16809
16832
|
mn,
|
|
16810
|
-
Math.max(mn,
|
|
16833
|
+
Math.max(mn, Ze - Ge)
|
|
16811
16834
|
]);
|
|
16812
16835
|
a.style.minWidth = Be + "px", a.style.right = Ye + "px";
|
|
16813
16836
|
}
|