teodor-new-chat-ui 4.1.61 → 4.1.62
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 +634 -633
- package/dist/index.umd.js +20 -20
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ var ym = Object.defineProperty;
|
|
|
2
2
|
var bm = (e, t, n) => t in e ? ym(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var wl = (e, t, n) => bm(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import * as m from "react";
|
|
5
|
-
import q, { createContext as po, useContext as Ss, useReducer as Sm, useRef as qe, useCallback as
|
|
5
|
+
import q, { createContext as po, useContext as Ss, useReducer as Sm, useRef as qe, useCallback as Ae, useEffect as ct, useMemo as ht, useState as me, startTransition as $o, createElement as zo, useLayoutEffect as Cm } from "react";
|
|
6
6
|
import { Square as km, Send as Tm, X as Rr, ExternalLink as Im, Download as Rm, Image as Em, FileText as yl, Loader as au, Bot as bl, Wrench as Nm, User as Am, ChevronUp as Gr, ChevronDown as Ir, Paperclip as Mi, Copy as Sl, Edit as Cl, RotateCcw as Di, ChevronRight as _m, Check as ga, Circle as jm, Loader2 as Li, Edit3 as lu, Plus as Pm, FileSpreadsheet as Om, MessageSquarePlus as Mm, MessageSquare as Dm, Calendar as Lm, Trash2 as Fm, Settings as $m, Server as zm, EyeOff as Bm, Eye as Hm, Layout as Um, MessageCircle as Wm, Save as Vm } from "lucide-react";
|
|
7
7
|
import { Slot as Km, createSlot as jr } from "@radix-ui/react-slot";
|
|
8
8
|
import { cva as Cs } from "class-variance-authority";
|
|
@@ -163,7 +163,7 @@ function Xm() {
|
|
|
163
163
|
B++;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function be() {
|
|
167
167
|
{
|
|
168
168
|
if (B--, B === 0) {
|
|
169
169
|
var k = {
|
|
@@ -267,31 +267,31 @@ function Xm() {
|
|
|
267
267
|
if (Ie && Ee && typeof Ie.stack == "string") {
|
|
268
268
|
for (var A = Ie.stack.split(`
|
|
269
269
|
`), ee = Ee.stack.split(`
|
|
270
|
-
`),
|
|
270
|
+
`), te = A.length - 1, le = ee.length - 1; te >= 1 && le >= 0 && A[te] !== ee[le]; )
|
|
271
271
|
le--;
|
|
272
|
-
for (;
|
|
273
|
-
if (A[
|
|
274
|
-
if (
|
|
272
|
+
for (; te >= 1 && le >= 0; te--, le--)
|
|
273
|
+
if (A[te] !== ee[le]) {
|
|
274
|
+
if (te !== 1 || le !== 1)
|
|
275
275
|
do
|
|
276
|
-
if (
|
|
277
|
-
var
|
|
278
|
-
` + A[
|
|
279
|
-
return k.displayName &&
|
|
276
|
+
if (te--, le--, le < 0 || A[te] !== ee[le]) {
|
|
277
|
+
var ye = `
|
|
278
|
+
` + A[te].replace(" at new ", " at ");
|
|
279
|
+
return k.displayName && ye.includes("<anonymous>") && (ye = ye.replace("<anonymous>", k.displayName)), typeof k == "function" && se.set(k, ye), ye;
|
|
280
280
|
}
|
|
281
|
-
while (
|
|
281
|
+
while (te >= 1 && le >= 0);
|
|
282
282
|
break;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
} finally {
|
|
286
|
-
G = !1, Te.current = et,
|
|
286
|
+
G = !1, Te.current = et, be(), Error.prepareStackTrace = Ye;
|
|
287
287
|
}
|
|
288
|
-
var
|
|
289
|
-
return typeof k == "function" && se.set(k,
|
|
288
|
+
var je = k ? k.displayName || k.name : "", it = je ? z(je) : "";
|
|
289
|
+
return typeof k == "function" && se.set(k, it), it;
|
|
290
290
|
}
|
|
291
291
|
function Be(k, W, ae) {
|
|
292
292
|
return Z(k, !1);
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function tt(k) {
|
|
295
295
|
var W = k.prototype;
|
|
296
296
|
return !!(W && W.isReactComponent);
|
|
297
297
|
}
|
|
@@ -299,7 +299,7 @@ function Xm() {
|
|
|
299
299
|
if (k == null)
|
|
300
300
|
return "";
|
|
301
301
|
if (typeof k == "function")
|
|
302
|
-
return Z(k,
|
|
302
|
+
return Z(k, tt(k));
|
|
303
303
|
if (typeof k == "string")
|
|
304
304
|
return z(k);
|
|
305
305
|
switch (k) {
|
|
@@ -344,16 +344,16 @@ function Xm() {
|
|
|
344
344
|
throw ee.name = "Invariant Violation", ee;
|
|
345
345
|
}
|
|
346
346
|
A = k[R](W, R, Ee, ae, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
347
|
-
} catch (
|
|
348
|
-
A =
|
|
347
|
+
} catch (te) {
|
|
348
|
+
A = te;
|
|
349
349
|
}
|
|
350
350
|
A && !(A instanceof Error) && (ie(Ye), y("%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).", Ee || "React class", ae, R, typeof A), ie(null)), A instanceof Error && !(A.message in $e) && ($e[A.message] = !0, ie(Ye), y("Failed %s type: %s", ae, A.message), ie(null));
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
var
|
|
355
|
-
function
|
|
356
|
-
return
|
|
354
|
+
var ot = Array.isArray;
|
|
355
|
+
function ne(k) {
|
|
356
|
+
return ot(k);
|
|
357
357
|
}
|
|
358
358
|
function ue(k) {
|
|
359
359
|
{
|
|
@@ -375,7 +375,7 @@ function Xm() {
|
|
|
375
375
|
if (ge(k))
|
|
376
376
|
return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ue(k)), Re(k);
|
|
377
377
|
}
|
|
378
|
-
var Oe = x.ReactCurrentOwner,
|
|
378
|
+
var Oe = x.ReactCurrentOwner, st = {
|
|
379
379
|
key: !0,
|
|
380
380
|
ref: !0,
|
|
381
381
|
__self: !0,
|
|
@@ -397,7 +397,7 @@ function Xm() {
|
|
|
397
397
|
}
|
|
398
398
|
return k.key !== void 0;
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function At(k, W) {
|
|
401
401
|
typeof k.ref == "string" && Oe.current;
|
|
402
402
|
}
|
|
403
403
|
function Pn(k, W) {
|
|
@@ -454,13 +454,13 @@ function Xm() {
|
|
|
454
454
|
function cn(k, W, ae, Ee, Ye) {
|
|
455
455
|
{
|
|
456
456
|
var et, R = {}, A = null, ee = null;
|
|
457
|
-
ae !== void 0 && (Q(ae), A = "" + ae), gt(W) && (Q(W.key), A = "" + W.key), lt(W) && (ee = W.ref,
|
|
457
|
+
ae !== void 0 && (Q(ae), A = "" + ae), gt(W) && (Q(W.key), A = "" + W.key), lt(W) && (ee = W.ref, At(W, Ye));
|
|
458
458
|
for (et in W)
|
|
459
|
-
we.call(W, et) && !
|
|
459
|
+
we.call(W, et) && !st.hasOwnProperty(et) && (R[et] = W[et]);
|
|
460
460
|
if (k && k.defaultProps) {
|
|
461
|
-
var
|
|
462
|
-
for (et in
|
|
463
|
-
R[et] === void 0 && (R[et] =
|
|
461
|
+
var te = k.defaultProps;
|
|
462
|
+
for (et in te)
|
|
463
|
+
R[et] === void 0 && (R[et] = te[et]);
|
|
464
464
|
}
|
|
465
465
|
if (A || ee) {
|
|
466
466
|
var le = typeof k == "function" ? k.displayName || k.name || "Unknown" : k;
|
|
@@ -527,7 +527,7 @@ Check the top-level render call using <` + ae + ">.");
|
|
|
527
527
|
{
|
|
528
528
|
if (typeof k != "object")
|
|
529
529
|
return;
|
|
530
|
-
if (
|
|
530
|
+
if (ne(k))
|
|
531
531
|
for (var ae = 0; ae < k.length; ae++) {
|
|
532
532
|
var Ee = k[ae];
|
|
533
533
|
Gn(Ee) && Rn(Ee, W);
|
|
@@ -580,7 +580,7 @@ Check the top-level render call using <` + ae + ">.");
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
var oe = {};
|
|
583
|
-
function
|
|
583
|
+
function ke(k, W, ae, Ee, Ye, et) {
|
|
584
584
|
{
|
|
585
585
|
var R = O(k);
|
|
586
586
|
if (!R) {
|
|
@@ -588,50 +588,50 @@ Check the top-level render call using <` + ae + ">.");
|
|
|
588
588
|
(k === void 0 || typeof k == "object" && k !== null && Object.keys(k).length === 0) && (A += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
589
589
|
var ee = xr();
|
|
590
590
|
ee ? A += ee : A += Yn();
|
|
591
|
-
var
|
|
592
|
-
k === null ?
|
|
591
|
+
var te;
|
|
592
|
+
k === null ? te = "null" : ne(k) ? te = "array" : k !== void 0 && k.$$typeof === t ? (te = "<" + (K(k.type) || "Unknown") + " />", A = " Did you accidentally export a JSX literal instead of a component?") : te = typeof k, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", te, A);
|
|
593
593
|
}
|
|
594
594
|
var le = cn(k, W, ae, Ye, et);
|
|
595
595
|
if (le == null)
|
|
596
596
|
return le;
|
|
597
597
|
if (R) {
|
|
598
|
-
var
|
|
599
|
-
if (
|
|
598
|
+
var ye = W.children;
|
|
599
|
+
if (ye !== void 0)
|
|
600
600
|
if (Ee)
|
|
601
|
-
if (
|
|
602
|
-
for (var
|
|
603
|
-
Xn(
|
|
604
|
-
Object.freeze && Object.freeze(
|
|
601
|
+
if (ne(ye)) {
|
|
602
|
+
for (var je = 0; je < ye.length; je++)
|
|
603
|
+
Xn(ye[je], k);
|
|
604
|
+
Object.freeze && Object.freeze(ye);
|
|
605
605
|
} else
|
|
606
606
|
y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
607
607
|
else
|
|
608
|
-
Xn(
|
|
608
|
+
Xn(ye, k);
|
|
609
609
|
}
|
|
610
610
|
if (we.call(W, "key")) {
|
|
611
|
-
var
|
|
611
|
+
var it = K(k), Ie = Object.keys(W).filter(function(Dt) {
|
|
612
612
|
return Dt !== "key";
|
|
613
613
|
}), at = Ie.length > 0 ? "{key: someKey, " + Ie.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
614
|
-
if (!oe[
|
|
614
|
+
if (!oe[it + at]) {
|
|
615
615
|
var dn = Ie.length > 0 ? "{" + Ie.join(": ..., ") + ": ...}" : "{}";
|
|
616
616
|
y(`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} />`, at,
|
|
621
|
+
<%s key={someKey} {...props} />`, at, it, dn, it), oe[it + at] = !0;
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
624
|
return k === r ? yr(le) : wr(le), le;
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
function He(k, W, ae) {
|
|
628
|
-
return
|
|
628
|
+
return ke(k, W, ae, !0);
|
|
629
629
|
}
|
|
630
630
|
function Qe(k, W, ae) {
|
|
631
|
-
return
|
|
631
|
+
return ke(k, W, ae, !1);
|
|
632
632
|
}
|
|
633
|
-
var
|
|
634
|
-
Kr.Fragment = r, Kr.jsx =
|
|
633
|
+
var _t = Qe, un = He;
|
|
634
|
+
Kr.Fragment = r, Kr.jsx = _t, Kr.jsxs = un;
|
|
635
635
|
}()), Kr;
|
|
636
636
|
}
|
|
637
637
|
process.env.NODE_ENV === "production" ? Fi.exports = Ym() : Fi.exports = Xm();
|
|
@@ -646,14 +646,14 @@ const { toString: Jm } = Object.prototype, { getPrototypeOf: xa } = Object, { it
|
|
|
646
646
|
return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
|
|
647
647
|
})(/* @__PURE__ */ Object.create(null)), an = (e) => (e = e.toLowerCase(), (t) => Is(t) === e), Rs = (e) => (t) => typeof t === e, { isArray: Lr } = Array, Pr = Rs("undefined");
|
|
648
648
|
function mo(e) {
|
|
649
|
-
return e !== null && !Pr(e) && e.constructor !== null && !Pr(e.constructor) &&
|
|
649
|
+
return e !== null && !Pr(e) && e.constructor !== null && !Pr(e.constructor) && Pt(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
650
650
|
}
|
|
651
651
|
const fu = an("ArrayBuffer");
|
|
652
652
|
function Zm(e) {
|
|
653
653
|
let t;
|
|
654
654
|
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && fu(e.buffer), t;
|
|
655
655
|
}
|
|
656
|
-
const Qm = Rs("string"),
|
|
656
|
+
const Qm = Rs("string"), Pt = Rs("function"), hu = Rs("number"), go = (e) => e !== null && typeof e == "object", eg = (e) => e === !0 || e === !1, Bo = (e) => {
|
|
657
657
|
if (Is(e) !== "object")
|
|
658
658
|
return !1;
|
|
659
659
|
const t = xa(e);
|
|
@@ -666,10 +666,10 @@ const Qm = Rs("string"), jt = Rs("function"), hu = Rs("number"), go = (e) => e !
|
|
|
666
666
|
} catch {
|
|
667
667
|
return !1;
|
|
668
668
|
}
|
|
669
|
-
}, ng = an("Date"), rg = an("File"), og = an("Blob"), sg = an("FileList"), ig = (e) => go(e) &&
|
|
669
|
+
}, ng = an("Date"), rg = an("File"), og = an("Blob"), sg = an("FileList"), ig = (e) => go(e) && Pt(e.pipe), ag = (e) => {
|
|
670
670
|
let t;
|
|
671
|
-
return e && (typeof FormData == "function" && e instanceof FormData ||
|
|
672
|
-
t === "object" &&
|
|
671
|
+
return e && (typeof FormData == "function" && e instanceof FormData || Pt(e.append) && ((t = Is(e)) === "formdata" || // detect form-data instance
|
|
672
|
+
t === "object" && Pt(e.toString) && e.toString() === "[object FormData]"));
|
|
673
673
|
}, lg = an("URLSearchParams"), [cg, ug, dg, fg] = ["ReadableStream", "Request", "Response", "Headers"].map(an), hg = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
674
674
|
function xo(e, t, { allOwnKeys: n = !1 } = {}) {
|
|
675
675
|
if (e === null || typeof e > "u")
|
|
@@ -709,7 +709,7 @@ function $i() {
|
|
|
709
709
|
return n;
|
|
710
710
|
}
|
|
711
711
|
const pg = (e, t, n, { allOwnKeys: r } = {}) => (xo(t, (o, s) => {
|
|
712
|
-
n &&
|
|
712
|
+
n && Pt(o) ? e[s] = uu(o, n) : e[s] = o;
|
|
713
713
|
}, { allOwnKeys: r }), e), mg = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), gg = (e, t, n, r) => {
|
|
714
714
|
e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
715
715
|
value: t.prototype
|
|
@@ -763,10 +763,10 @@ const pg = (e, t, n, { allOwnKeys: r } = {}) => (xo(t, (o, s) => {
|
|
|
763
763
|
}), Object.defineProperties(e, r);
|
|
764
764
|
}, Ig = (e) => {
|
|
765
765
|
gu(e, (t, n) => {
|
|
766
|
-
if (
|
|
766
|
+
if (Pt(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
|
|
767
767
|
return !1;
|
|
768
768
|
const r = e[n];
|
|
769
|
-
if (
|
|
769
|
+
if (Pt(r)) {
|
|
770
770
|
if (t.enumerable = !1, "writable" in t) {
|
|
771
771
|
t.writable = !1;
|
|
772
772
|
return;
|
|
@@ -786,7 +786,7 @@ const pg = (e, t, n, { allOwnKeys: r } = {}) => (xo(t, (o, s) => {
|
|
|
786
786
|
}, Eg = () => {
|
|
787
787
|
}, Ng = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
|
|
788
788
|
function Ag(e) {
|
|
789
|
-
return !!(e &&
|
|
789
|
+
return !!(e && Pt(e.append) && e[du] === "FormData" && e[Ts]);
|
|
790
790
|
}
|
|
791
791
|
const _g = (e) => {
|
|
792
792
|
const t = new Array(10), n = (r, o) => {
|
|
@@ -807,14 +807,14 @@ const _g = (e) => {
|
|
|
807
807
|
return r;
|
|
808
808
|
};
|
|
809
809
|
return n(e, 0);
|
|
810
|
-
}, jg = an("AsyncFunction"), Pg = (e) => e && (go(e) ||
|
|
810
|
+
}, jg = an("AsyncFunction"), Pg = (e) => e && (go(e) || Pt(e)) && Pt(e.then) && Pt(e.catch), xu = ((e, t) => e ? setImmediate : t ? ((n, r) => (er.addEventListener("message", ({ source: o, data: s }) => {
|
|
811
811
|
o === er && s === n && r.length && r.shift()();
|
|
812
812
|
}, !1), (o) => {
|
|
813
813
|
r.push(o), er.postMessage(n, "*");
|
|
814
814
|
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
|
|
815
815
|
typeof setImmediate == "function",
|
|
816
|
-
|
|
817
|
-
), Og = typeof queueMicrotask < "u" ? queueMicrotask.bind(er) : typeof process < "u" && process.nextTick || xu, Mg = (e) => e != null &&
|
|
816
|
+
Pt(er.postMessage)
|
|
817
|
+
), Og = typeof queueMicrotask < "u" ? queueMicrotask.bind(er) : typeof process < "u" && process.nextTick || xu, Mg = (e) => e != null && Pt(e[Ts]), P = {
|
|
818
818
|
isArray: Lr,
|
|
819
819
|
isArrayBuffer: fu,
|
|
820
820
|
isBuffer: mo,
|
|
@@ -835,7 +835,7 @@ const _g = (e) => {
|
|
|
835
835
|
isFile: rg,
|
|
836
836
|
isBlob: og,
|
|
837
837
|
isRegExp: Tg,
|
|
838
|
-
isFunction:
|
|
838
|
+
isFunction: Pt,
|
|
839
839
|
isStream: ig,
|
|
840
840
|
isURLSearchParams: lg,
|
|
841
841
|
isTypedArray: yg,
|
|
@@ -1310,7 +1310,7 @@ function rx(e, t) {
|
|
|
1310
1310
|
});
|
|
1311
1311
|
});
|
|
1312
1312
|
}
|
|
1313
|
-
let
|
|
1313
|
+
let Ot = class {
|
|
1314
1314
|
constructor(t) {
|
|
1315
1315
|
t && this.set(t);
|
|
1316
1316
|
}
|
|
@@ -1436,8 +1436,8 @@ let Pt = class {
|
|
|
1436
1436
|
return P.isArray(t) ? t.forEach(s) : s(t), this;
|
|
1437
1437
|
}
|
|
1438
1438
|
};
|
|
1439
|
-
|
|
1440
|
-
P.reduceDescriptors(
|
|
1439
|
+
Ot.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
1440
|
+
P.reduceDescriptors(Ot.prototype, ({ value: e }, t) => {
|
|
1441
1441
|
let n = t[0].toUpperCase() + t.slice(1);
|
|
1442
1442
|
return {
|
|
1443
1443
|
get: () => e,
|
|
@@ -1446,9 +1446,9 @@ P.reduceDescriptors(Pt.prototype, ({ value: e }, t) => {
|
|
|
1446
1446
|
}
|
|
1447
1447
|
};
|
|
1448
1448
|
});
|
|
1449
|
-
P.freezeMethods(
|
|
1449
|
+
P.freezeMethods(Ot);
|
|
1450
1450
|
function ai(e, t) {
|
|
1451
|
-
const n = this || vo, r = t || n, o =
|
|
1451
|
+
const n = this || vo, r = t || n, o = Ot.from(r.headers);
|
|
1452
1452
|
let s = r.data;
|
|
1453
1453
|
return P.forEach(e, function(a) {
|
|
1454
1454
|
s = a.call(n, s, o.normalize(), t ? t.status : void 0);
|
|
@@ -1571,7 +1571,7 @@ function Ru(e, t, n) {
|
|
|
1571
1571
|
let r = !cx(t);
|
|
1572
1572
|
return e && (r || n == !1) ? ux(e, t) : t;
|
|
1573
1573
|
}
|
|
1574
|
-
const Pl = (e) => e instanceof
|
|
1574
|
+
const Pl = (e) => e instanceof Ot ? { ...e } : e;
|
|
1575
1575
|
function or(e, t) {
|
|
1576
1576
|
t = t || {};
|
|
1577
1577
|
const n = {};
|
|
@@ -1639,7 +1639,7 @@ function or(e, t) {
|
|
|
1639
1639
|
const Eu = (e) => {
|
|
1640
1640
|
const t = or({}, e);
|
|
1641
1641
|
let { data: n, withXSRFToken: r, xsrfHeaderName: o, xsrfCookieName: s, headers: i, auth: a } = t;
|
|
1642
|
-
if (t.headers = i =
|
|
1642
|
+
if (t.headers = i = Ot.from(i), t.url = Su(Ru(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), a && i.set(
|
|
1643
1643
|
"Authorization",
|
|
1644
1644
|
"Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : ""))
|
|
1645
1645
|
), P.isFormData(n)) {
|
|
@@ -1661,7 +1661,7 @@ const Eu = (e) => {
|
|
|
1661
1661
|
return new Promise(function(n, r) {
|
|
1662
1662
|
const o = Eu(e);
|
|
1663
1663
|
let s = o.data;
|
|
1664
|
-
const i =
|
|
1664
|
+
const i = Ot.from(o.headers).normalize();
|
|
1665
1665
|
let { responseType: a, onUploadProgress: l, onDownloadProgress: u } = o, d, f, h, p, w;
|
|
1666
1666
|
function v() {
|
|
1667
1667
|
p && p(), w && w(), o.cancelToken && o.cancelToken.unsubscribe(d), o.signal && o.signal.removeEventListener("abort", d);
|
|
@@ -1671,7 +1671,7 @@ const Eu = (e) => {
|
|
|
1671
1671
|
function x() {
|
|
1672
1672
|
if (!g)
|
|
1673
1673
|
return;
|
|
1674
|
-
const b =
|
|
1674
|
+
const b = Ot.from(
|
|
1675
1675
|
"getAllResponseHeaders" in g && g.getAllResponseHeaders()
|
|
1676
1676
|
), S = {
|
|
1677
1677
|
data: !a || a === "text" || a === "json" ? g.responseText : g.response,
|
|
@@ -1904,8 +1904,8 @@ const Eu = (e) => {
|
|
|
1904
1904
|
const D = d && (I === "stream" || I === "response");
|
|
1905
1905
|
if (d && (S || D && N)) {
|
|
1906
1906
|
const j = {};
|
|
1907
|
-
["status", "statusText", "headers"].forEach((
|
|
1908
|
-
j[
|
|
1907
|
+
["status", "statusText", "headers"].forEach((be) => {
|
|
1908
|
+
j[be] = M[be];
|
|
1909
1909
|
});
|
|
1910
1910
|
const J = P.toFiniteNumber(M.headers.get("content-length")), [fe, ve] = S && _l(
|
|
1911
1911
|
J,
|
|
@@ -1923,7 +1923,7 @@ const Eu = (e) => {
|
|
|
1923
1923
|
return !D && N && N(), await new Promise((j, J) => {
|
|
1924
1924
|
Iu(j, J, {
|
|
1925
1925
|
data: Y,
|
|
1926
|
-
headers:
|
|
1926
|
+
headers: Ot.from(M.headers),
|
|
1927
1927
|
status: M.status,
|
|
1928
1928
|
statusText: M.statusText,
|
|
1929
1929
|
config: w,
|
|
@@ -2004,7 +2004,7 @@ function li(e) {
|
|
|
2004
2004
|
throw new Fr(null, e);
|
|
2005
2005
|
}
|
|
2006
2006
|
function zl(e) {
|
|
2007
|
-
return li(e), e.headers =
|
|
2007
|
+
return li(e), e.headers = Ot.from(e.headers), e.data = ai.call(
|
|
2008
2008
|
e,
|
|
2009
2009
|
e.transformRequest
|
|
2010
2010
|
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Au.getAdapter(e.adapter || vo.adapter, e)(e).then(function(r) {
|
|
@@ -2012,13 +2012,13 @@ function zl(e) {
|
|
|
2012
2012
|
e,
|
|
2013
2013
|
e.transformResponse,
|
|
2014
2014
|
r
|
|
2015
|
-
), r.headers =
|
|
2015
|
+
), r.headers = Ot.from(r.headers), r;
|
|
2016
2016
|
}, function(r) {
|
|
2017
2017
|
return Tu(r) || (li(e), r && r.response && (r.response.data = ai.call(
|
|
2018
2018
|
e,
|
|
2019
2019
|
e.transformResponse,
|
|
2020
2020
|
r.response
|
|
2021
|
-
), r.response.headers =
|
|
2021
|
+
), r.response.headers = Ot.from(r.response.headers))), Promise.reject(r);
|
|
2022
2022
|
});
|
|
2023
2023
|
}
|
|
2024
2024
|
const _u = "1.12.2", Ns = {};
|
|
@@ -2127,7 +2127,7 @@ let nr = class {
|
|
|
2127
2127
|
(w) => {
|
|
2128
2128
|
delete s[w];
|
|
2129
2129
|
}
|
|
2130
|
-
), n.headers =
|
|
2130
|
+
), n.headers = Ot.concat(i, s);
|
|
2131
2131
|
const a = [];
|
|
2132
2132
|
let l = !0;
|
|
2133
2133
|
this.interceptors.request.forEach(function(v) {
|
|
@@ -2364,7 +2364,7 @@ mt.all = function(t) {
|
|
|
2364
2364
|
mt.spread = Cx;
|
|
2365
2365
|
mt.isAxiosError = kx;
|
|
2366
2366
|
mt.mergeConfig = or;
|
|
2367
|
-
mt.AxiosHeaders =
|
|
2367
|
+
mt.AxiosHeaders = Ot;
|
|
2368
2368
|
mt.formToJSON = (e) => ku(P.isHTMLForm(e) ? new FormData(e) : e);
|
|
2369
2369
|
mt.getAdapter = Au.getAdapter;
|
|
2370
2370
|
mt.HttpStatusCode = Ui;
|
|
@@ -2665,13 +2665,13 @@ function Mx(e, t) {
|
|
|
2665
2665
|
}
|
|
2666
2666
|
}
|
|
2667
2667
|
function Dx(e = []) {
|
|
2668
|
-
const [t, n] = Sm(Mx, { ...Ox, messages: e }), r = qe([]), o = qe(null), s = qe(null), i =
|
|
2668
|
+
const [t, n] = Sm(Mx, { ...Ox, messages: e }), r = qe([]), o = qe(null), s = qe(null), i = Ae(() => {
|
|
2669
2669
|
o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), o.current = null, s.current = null;
|
|
2670
2670
|
const d = r.current;
|
|
2671
2671
|
d.length && (r.current = [], n({ type: "batch", payload: { events: d } }));
|
|
2672
|
-
}, []), a =
|
|
2672
|
+
}, []), a = Ae(() => {
|
|
2673
2673
|
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => i())) : s.current === null && (s.current = setTimeout(i, 8));
|
|
2674
|
-
}, [i]), l =
|
|
2674
|
+
}, [i]), l = Ae((d) => {
|
|
2675
2675
|
r.current.push(d), a();
|
|
2676
2676
|
}, [a]);
|
|
2677
2677
|
ct(() => () => {
|
|
@@ -2963,14 +2963,14 @@ function $x(e) {
|
|
|
2963
2963
|
return t[t.length - 1] || null;
|
|
2964
2964
|
}
|
|
2965
2965
|
function zx(e = {}) {
|
|
2966
|
-
const t = ht(() => An(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = me(e.token ?? null), s = qe(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = me(!1), [u, d] = me(null), [f, h] = me(""), [p, w] = me(null), [v, g] = me(0), [x, y] = me(!1), b = qe(null), T = qe(!0), S = qe(0), C =
|
|
2966
|
+
const t = ht(() => An(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = me(e.token ?? null), s = qe(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = me(!1), [u, d] = me(null), [f, h] = me(""), [p, w] = me(null), [v, g] = me(0), [x, y] = me(!1), b = qe(null), T = qe(!0), S = qe(0), C = Ae((O) => {
|
|
2967
2967
|
o(O);
|
|
2968
|
-
}, []), I =
|
|
2968
|
+
}, []), I = Ae(() => {
|
|
2969
2969
|
var O;
|
|
2970
2970
|
(O = b.current) == null || O.abort(), b.current = null, l(!1), y(!1), S.current = 0, g(0);
|
|
2971
|
-
}, []), E =
|
|
2971
|
+
}, []), E = Ae(() => {
|
|
2972
2972
|
h(""), w(null), d(null);
|
|
2973
|
-
}, []), _ =
|
|
2973
|
+
}, []), _ = Ae(
|
|
2974
2974
|
(O, L, F) => {
|
|
2975
2975
|
b.current && (b.current.abort(), b.current = null), l(!0), d(null), e.autoAppendAssistant !== !1 && h("");
|
|
2976
2976
|
const K = new AbortController();
|
|
@@ -2979,11 +2979,11 @@ function zx(e = {}) {
|
|
|
2979
2979
|
const N = (fe) => {
|
|
2980
2980
|
var ve;
|
|
2981
2981
|
try {
|
|
2982
|
-
const
|
|
2983
|
-
return (ve =
|
|
2982
|
+
const be = JSON.parse(JSON.stringify(fe));
|
|
2983
|
+
return (ve = be == null ? void 0 : be.payload) != null && ve.files_info && Array.isArray(be.payload.files_info) && (be.payload.files_info = be.payload.files_info.map((Te) => ({
|
|
2984
2984
|
...Te,
|
|
2985
2985
|
data: Te != null && Te.data ? `<base64 ${String(Te.data).length} chars>` : Te == null ? void 0 : Te.data
|
|
2986
|
-
}))),
|
|
2986
|
+
}))), be;
|
|
2987
2987
|
} catch {
|
|
2988
2988
|
return fe;
|
|
2989
2989
|
}
|
|
@@ -2997,8 +2997,8 @@ function zx(e = {}) {
|
|
|
2997
2997
|
const $e = window.__AUTH_TOKEN__, Ke = ((B = window.localStorage) == null ? void 0 : B.getItem("authToken")) || null;
|
|
2998
2998
|
let ie = null;
|
|
2999
2999
|
try {
|
|
3000
|
-
const
|
|
3001
|
-
|
|
3000
|
+
const ot = ($ = window.localStorage) == null ? void 0 : $.getItem("chat-settings");
|
|
3001
|
+
ot && (ie = ((H = JSON.parse(ot)) == null ? void 0 : H.apiKey) || null);
|
|
3002
3002
|
} catch {
|
|
3003
3003
|
}
|
|
3004
3004
|
const vt = $e || Ke || ie || null;
|
|
@@ -3034,7 +3034,7 @@ function zx(e = {}) {
|
|
|
3034
3034
|
);
|
|
3035
3035
|
}
|
|
3036
3036
|
y(!0);
|
|
3037
|
-
const
|
|
3037
|
+
const be = ve.body.getReader(), Te = new TextDecoder();
|
|
3038
3038
|
let U = "", z = [];
|
|
3039
3039
|
S.current = 0, g(0);
|
|
3040
3040
|
let G = 0, se = null;
|
|
@@ -3048,7 +3048,7 @@ function zx(e = {}) {
|
|
|
3048
3048
|
typeof window < "u" && se == null && (se = requestAnimationFrame(ce));
|
|
3049
3049
|
};
|
|
3050
3050
|
let Be = Date.now();
|
|
3051
|
-
const
|
|
3051
|
+
const tt = setInterval(() => {
|
|
3052
3052
|
var we;
|
|
3053
3053
|
if (Date.now() - Be > 6e4) {
|
|
3054
3054
|
const $e = "Stream idle timeout";
|
|
@@ -3058,15 +3058,15 @@ function zx(e = {}) {
|
|
|
3058
3058
|
try {
|
|
3059
3059
|
const we = ve.headers.get("X-Thread-Id") || ve.headers.get("x-thread-id"), $e = ve.headers.get("X-Thread-Created") || ve.headers.get("x-thread-created"), Ke = we ?? null, ie = String($e ?? "").toLowerCase() === "true";
|
|
3060
3060
|
for ((M = F == null ? void 0 : F.onOpen) == null || M.call(F, { threadId: Ke, created: ie }); ; ) {
|
|
3061
|
-
const { value: vt, done:
|
|
3062
|
-
if (
|
|
3061
|
+
const { value: vt, done: ot } = await be.read();
|
|
3062
|
+
if (ot) break;
|
|
3063
3063
|
U += Te.decode(vt, { stream: !0 }), U.length > Ve && (U = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3064
|
-
let
|
|
3065
|
-
for (; (
|
|
3064
|
+
let ne;
|
|
3065
|
+
for (; (ne = U.indexOf(`
|
|
3066
3066
|
|
|
3067
3067
|
`)) >= 0; ) {
|
|
3068
|
-
const ue = U.slice(0,
|
|
3069
|
-
U = U.slice(
|
|
3068
|
+
const ue = U.slice(0, ne);
|
|
3069
|
+
U = U.slice(ne + 2);
|
|
3070
3070
|
const ge = Hx(ue);
|
|
3071
3071
|
if (!ge) continue;
|
|
3072
3072
|
let Re;
|
|
@@ -3087,17 +3087,17 @@ function zx(e = {}) {
|
|
|
3087
3087
|
G > 0 && Oe > G + 1 && ((D = F == null ? void 0 : F.onGap) == null || D.call(F, { from: G, to: Oe })), G = Oe, S.current = Oe, g(Oe);
|
|
3088
3088
|
}
|
|
3089
3089
|
if (console.debug("[use-chat] received event", { seq: Q.seq, type: Q.type, preview: (() => {
|
|
3090
|
-
var
|
|
3090
|
+
var st;
|
|
3091
3091
|
try {
|
|
3092
|
-
return Q.type === "message_delta" ? { deltaTypes: (
|
|
3092
|
+
return Q.type === "message_delta" ? { deltaTypes: (st = Q.delta) == null ? void 0 : st.map((Fe) => Fe.type), textLen: (Q.delta || []).filter((Fe) => Fe.type === "text").map((Fe) => String(Fe.text || "").length) } : Q.content || Q.delta ? { hasContent: !0 } : {};
|
|
3093
3093
|
} catch (Fe) {
|
|
3094
3094
|
return { err: String(Fe) };
|
|
3095
3095
|
}
|
|
3096
3096
|
})() }), L == null || L(Q), Q.type === "token" && e.autoAppendAssistant !== !1)
|
|
3097
3097
|
z.push(Q.content), Z();
|
|
3098
3098
|
else if (Q.type === "message_delta") {
|
|
3099
|
-
const
|
|
3100
|
-
|
|
3099
|
+
const st = Q.delta.filter((Fe) => Fe.type === "text").map((Fe) => Fe.text).join("");
|
|
3100
|
+
st && e.autoAppendAssistant !== !1 && (z.push(st), Z());
|
|
3101
3101
|
} else Q.type === "heartbeat" ? console.debug("[use-chat] heartbeat received") : (se !== null && cancelAnimationFrame(se), ce(), Q.type === "checkpoint" ? w(Q.checkpointId) : Q.type === "error" && d(Q.message));
|
|
3102
3102
|
}
|
|
3103
3103
|
}
|
|
@@ -3109,12 +3109,12 @@ function zx(e = {}) {
|
|
|
3109
3109
|
}
|
|
3110
3110
|
} finally {
|
|
3111
3111
|
try {
|
|
3112
|
-
await
|
|
3112
|
+
await be.cancel();
|
|
3113
3113
|
} catch {
|
|
3114
3114
|
} finally {
|
|
3115
|
-
(j =
|
|
3115
|
+
(j = be.releaseLock) == null || j.call(be);
|
|
3116
3116
|
}
|
|
3117
|
-
se !== null && typeof window < "u" && window.cancelAnimationFrame(se), clearInterval(
|
|
3117
|
+
se !== null && typeof window < "u" && window.cancelAnimationFrame(se), clearInterval(tt), l(!1), y(!1), b.current = null, S.current = 0, g(0);
|
|
3118
3118
|
}
|
|
3119
3119
|
} catch (fe) {
|
|
3120
3120
|
if (fe.name !== "AbortError") {
|
|
@@ -3164,7 +3164,7 @@ function Ux({
|
|
|
3164
3164
|
onUnhandledEvent: r,
|
|
3165
3165
|
onSequenceGap: o
|
|
3166
3166
|
}) {
|
|
3167
|
-
const s = qe(null), i =
|
|
3167
|
+
const s = qe(null), i = Ae(
|
|
3168
3168
|
(p) => {
|
|
3169
3169
|
const w = p.seq ?? null;
|
|
3170
3170
|
if (w !== null) {
|
|
@@ -3190,7 +3190,7 @@ function Ux({
|
|
|
3190
3190
|
), { stream: a, stop: l, isStreaming: u, error: d, setToken: f } = zx({
|
|
3191
3191
|
baseUrl: e,
|
|
3192
3192
|
token: null
|
|
3193
|
-
}), h =
|
|
3193
|
+
}), h = Ae(
|
|
3194
3194
|
(p, w) => {
|
|
3195
3195
|
s.current = null, a(
|
|
3196
3196
|
p,
|
|
@@ -3574,12 +3574,12 @@ function ev(e) {
|
|
|
3574
3574
|
ct(() => {
|
|
3575
3575
|
g.current = u.length;
|
|
3576
3576
|
}, [u.length]);
|
|
3577
|
-
const C =
|
|
3577
|
+
const C = Ae(() => {
|
|
3578
3578
|
const N = pi(s);
|
|
3579
3579
|
$o(() => {
|
|
3580
3580
|
l(No(N));
|
|
3581
3581
|
});
|
|
3582
|
-
}, [s]), I =
|
|
3582
|
+
}, [s]), I = Ae(
|
|
3583
3583
|
(N, B) => {
|
|
3584
3584
|
if (!Or()) return;
|
|
3585
3585
|
y.current !== null && (window.clearTimeout(y.current), y.current = null);
|
|
@@ -3612,9 +3612,9 @@ function ev(e) {
|
|
|
3612
3612
|
}, Ca);
|
|
3613
3613
|
},
|
|
3614
3614
|
[s]
|
|
3615
|
-
), E =
|
|
3615
|
+
), E = Ae(() => {
|
|
3616
3616
|
I(u, { immediate: !0 });
|
|
3617
|
-
}, [I, u]), _ =
|
|
3617
|
+
}, [I, u]), _ = Ae(async () => {
|
|
3618
3618
|
const N = g.current > 0;
|
|
3619
3619
|
N || p(!0);
|
|
3620
3620
|
try {
|
|
@@ -3630,7 +3630,7 @@ function ev(e) {
|
|
|
3630
3630
|
} finally {
|
|
3631
3631
|
N || p(!1);
|
|
3632
3632
|
}
|
|
3633
|
-
}, [t, r]), O =
|
|
3633
|
+
}, [t, r]), O = Ae(
|
|
3634
3634
|
async (N) => {
|
|
3635
3635
|
var H;
|
|
3636
3636
|
const B = `thread-${((H = crypto.randomUUID) == null ? void 0 : H.call(crypto)) ?? Date.now().toString(36)}`, $ = {
|
|
@@ -3663,7 +3663,7 @@ function ev(e) {
|
|
|
3663
3663
|
}
|
|
3664
3664
|
},
|
|
3665
3665
|
[t, r]
|
|
3666
|
-
), L =
|
|
3666
|
+
), L = Ae(
|
|
3667
3667
|
async (N) => {
|
|
3668
3668
|
var B;
|
|
3669
3669
|
try {
|
|
@@ -3683,7 +3683,7 @@ function ev(e) {
|
|
|
3683
3683
|
}
|
|
3684
3684
|
},
|
|
3685
3685
|
[t, d, e, _, I]
|
|
3686
|
-
), F =
|
|
3686
|
+
), F = Ae(
|
|
3687
3687
|
async (N, B) => {
|
|
3688
3688
|
try {
|
|
3689
3689
|
await t.updateThread(N, B), l(($) => {
|
|
@@ -3728,7 +3728,7 @@ function ev(e) {
|
|
|
3728
3728
|
e.clearAllMessageCaches,
|
|
3729
3729
|
e.onAuthTokenChange
|
|
3730
3730
|
]);
|
|
3731
|
-
const K =
|
|
3731
|
+
const K = Ae((N) => {
|
|
3732
3732
|
l((B) => {
|
|
3733
3733
|
const $ = B.byId[N.threadId];
|
|
3734
3734
|
return $ ? $.title === N.title && $.updatedAt === N.updatedAt && $.messageCount === N.messageCount ? B : {
|
|
@@ -3772,19 +3772,19 @@ function nv({
|
|
|
3772
3772
|
} catch {
|
|
3773
3773
|
return "unknown";
|
|
3774
3774
|
}
|
|
3775
|
-
}, [u]), h = ht(() => `threadPayload:${Xx}:${f}:`, [f]), p =
|
|
3775
|
+
}, [u]), h = ht(() => `threadPayload:${Xx}:${f}:`, [f]), p = Ae((R) => `${h}${R}`, [h]), w = Ae((R) => {
|
|
3776
3776
|
if (!R || typeof R != "object") return null;
|
|
3777
3777
|
const A = R;
|
|
3778
3778
|
if (typeof A.threadId != "string") return null;
|
|
3779
|
-
const ee = Array.isArray(A.checkpoints) ? A.checkpoints.filter((
|
|
3779
|
+
const ee = Array.isArray(A.checkpoints) ? A.checkpoints.filter((je) => je && typeof je == "object") : [], te = Array.isArray(A.pendingCheckpoints) ? A.pendingCheckpoints.map((je) => Bu(je)).filter((je) => !!je) : [], le = A.activeCheckpointId === null || A.activeCheckpointId === void 0 ? null : Yt(A.activeCheckpointId) ?? null, ye = A.activeCheckpointNs === null || A.activeCheckpointNs === void 0 ? null : Yt(A.activeCheckpointNs) ?? null;
|
|
3780
3780
|
return {
|
|
3781
3781
|
threadId: A.threadId,
|
|
3782
3782
|
checkpoints: ee,
|
|
3783
|
-
pendingCheckpoints:
|
|
3783
|
+
pendingCheckpoints: te,
|
|
3784
3784
|
activeCheckpointId: le,
|
|
3785
|
-
activeCheckpointNs:
|
|
3785
|
+
activeCheckpointNs: ye
|
|
3786
3786
|
};
|
|
3787
|
-
}, []), v =
|
|
3787
|
+
}, []), v = Ae((R) => {
|
|
3788
3788
|
const A = ka(p(R));
|
|
3789
3789
|
if (!A) return null;
|
|
3790
3790
|
try {
|
|
@@ -3793,7 +3793,7 @@ function nv({
|
|
|
3793
3793
|
} catch {
|
|
3794
3794
|
return null;
|
|
3795
3795
|
}
|
|
3796
|
-
}, [p, w]), g =
|
|
3796
|
+
}, [p, w]), g = Ae((R) => {
|
|
3797
3797
|
const A = {
|
|
3798
3798
|
threadId: R.threadId,
|
|
3799
3799
|
checkpoints: Array.isArray(R.checkpoints) ? R.checkpoints : [],
|
|
@@ -3808,9 +3808,9 @@ function nv({
|
|
|
3808
3808
|
Wu(p(R.threadId), JSON.stringify(A));
|
|
3809
3809
|
} catch {
|
|
3810
3810
|
}
|
|
3811
|
-
}, [p]), x =
|
|
3811
|
+
}, [p]), x = Ae((R) => {
|
|
3812
3812
|
Vu(p(R));
|
|
3813
|
-
}, [p]), y =
|
|
3813
|
+
}, [p]), y = Ae(() => {
|
|
3814
3814
|
if (Or())
|
|
3815
3815
|
try {
|
|
3816
3816
|
const R = h;
|
|
@@ -3841,11 +3841,11 @@ function nv({
|
|
|
3841
3841
|
initialThreadId: t,
|
|
3842
3842
|
clearAllMessageCaches: y,
|
|
3843
3843
|
onAuthTokenChange: (R) => b.current(R ?? null)
|
|
3844
|
-
}), [$, H] = me(!1), [M, D] = me(null), [Y, j] = me(null), [J, fe] = me(!1), [ve,
|
|
3844
|
+
}), [$, H] = me(!1), [M, D] = me(null), [Y, j] = me(null), [J, fe] = me(!1), [ve, be] = me(!1), [Te, U] = me(void 0), [z, G] = me(void 0), [se, ce] = me([]), [Z, Be] = me([]), [tt, Ve] = me([]), we = qe([]), [$e, Ke] = me(null), {
|
|
3845
3845
|
state: ie,
|
|
3846
3846
|
dispatch: vt,
|
|
3847
|
-
seed:
|
|
3848
|
-
prepend:
|
|
3847
|
+
seed: ot,
|
|
3848
|
+
prepend: ne,
|
|
3849
3849
|
pushUser: ue,
|
|
3850
3850
|
onEvent: ge,
|
|
3851
3851
|
reset: Re
|
|
@@ -3853,29 +3853,29 @@ function nv({
|
|
|
3853
3853
|
ct(() => {
|
|
3854
3854
|
Q.current = S;
|
|
3855
3855
|
}, [S]);
|
|
3856
|
-
const Oe = qe(!1),
|
|
3856
|
+
const Oe = qe(!1), st = qe([]), Fe = qe(null), Ze = qe(null), lt = qe(/* @__PURE__ */ new Map()), gt = qe(S), At = qe({ threadId: null, checkpointId: null, checkpointNs: null }), Pn = Ae((R, A) => new Promise((ee, te) => {
|
|
3857
3857
|
const le = async () => {
|
|
3858
3858
|
Oe.current = !0;
|
|
3859
3859
|
try {
|
|
3860
3860
|
await R(), ee();
|
|
3861
|
-
} catch (
|
|
3862
|
-
|
|
3861
|
+
} catch (ye) {
|
|
3862
|
+
te(ye);
|
|
3863
3863
|
} finally {
|
|
3864
3864
|
Oe.current = !1;
|
|
3865
|
-
const
|
|
3866
|
-
|
|
3865
|
+
const ye = st.current.shift();
|
|
3866
|
+
ye && ye().catch(() => {
|
|
3867
3867
|
});
|
|
3868
3868
|
}
|
|
3869
3869
|
};
|
|
3870
|
-
Oe.current ?
|
|
3871
|
-
|
|
3870
|
+
Oe.current ? st.current.push(le) : le().catch((ye) => {
|
|
3871
|
+
te(ye);
|
|
3872
3872
|
});
|
|
3873
3873
|
}), []);
|
|
3874
3874
|
ct(() => {
|
|
3875
|
-
var
|
|
3875
|
+
var le;
|
|
3876
3876
|
const R = Q.current;
|
|
3877
3877
|
if (!R) {
|
|
3878
|
-
Y !== null && j(null),
|
|
3878
|
+
Y !== null && j(null), At.current = {
|
|
3879
3879
|
threadId: null,
|
|
3880
3880
|
checkpointId: null,
|
|
3881
3881
|
checkpointNs: null
|
|
@@ -3884,7 +3884,7 @@ function nv({
|
|
|
3884
3884
|
}
|
|
3885
3885
|
const A = ie.pendingInterrupt ?? Wx(ie.messages);
|
|
3886
3886
|
if (A) {
|
|
3887
|
-
di(Y, A) || j(A),
|
|
3887
|
+
di(Y, A) || j(A), At.current = {
|
|
3888
3888
|
threadId: R,
|
|
3889
3889
|
checkpointId: ie.lastCheckpointId ?? null,
|
|
3890
3890
|
checkpointNs: ie.lastCheckpointNs ?? null
|
|
@@ -3897,32 +3897,33 @@ function nv({
|
|
|
3897
3897
|
checkpointNs: ie.lastCheckpointNs ?? null
|
|
3898
3898
|
};
|
|
3899
3899
|
if ($e) {
|
|
3900
|
-
const
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3900
|
+
const ye = (le = $e.values) == null ? void 0 : le.state, je = Yl(ye);
|
|
3901
|
+
if (je !== null) {
|
|
3902
|
+
di(Y, je) || j(je), At.current = ee;
|
|
3903
|
+
return;
|
|
3904
|
+
}
|
|
3905
|
+
if (At.current.threadId === ee.threadId && At.current.checkpointId === ee.checkpointId && At.current.checkpointNs === ee.checkpointNs && Y === null) {
|
|
3906
|
+
At.current = ee;
|
|
3907
|
+
return;
|
|
3908
|
+
}
|
|
3905
3909
|
}
|
|
3906
|
-
const ne = Mt.current.threadId === ee.threadId && Mt.current.checkpointId === ee.checkpointId && Mt.current.checkpointNs === ee.checkpointNs;
|
|
3907
3910
|
if (!(l != null && l.getState)) {
|
|
3908
|
-
Y !== null && j(null),
|
|
3911
|
+
Y !== null && j(null), At.current = ee;
|
|
3909
3912
|
return;
|
|
3910
3913
|
}
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
let le = !1;
|
|
3914
|
-
return Mt.current = ee, l.getState({
|
|
3914
|
+
let te = !1;
|
|
3915
|
+
return At.current = ee, l.getState({
|
|
3915
3916
|
threadId: R,
|
|
3916
3917
|
checkpointId: ee.checkpointId ?? void 0,
|
|
3917
3918
|
checkpointNs: ee.checkpointNs ?? void 0
|
|
3918
|
-
}).then((
|
|
3919
|
-
if (
|
|
3920
|
-
const
|
|
3921
|
-
di(Y,
|
|
3922
|
-
}).catch((
|
|
3923
|
-
|
|
3919
|
+
}).then((ye) => {
|
|
3920
|
+
if (te) return;
|
|
3921
|
+
const je = Yl(ye == null ? void 0 : ye.state);
|
|
3922
|
+
di(Y, je ?? null) || j(je ?? null);
|
|
3923
|
+
}).catch((ye) => {
|
|
3924
|
+
te || (console.warn("[ChatSessionProvider] Failed to inspect thread state for interrupts:", ye), Y !== null && j(null));
|
|
3924
3925
|
}), () => {
|
|
3925
|
-
|
|
3926
|
+
te = !0;
|
|
3926
3927
|
};
|
|
3927
3928
|
}, [
|
|
3928
3929
|
$e,
|
|
@@ -3933,37 +3934,37 @@ function nv({
|
|
|
3933
3934
|
ie.messages,
|
|
3934
3935
|
ie.pendingInterrupt
|
|
3935
3936
|
]);
|
|
3936
|
-
const Wr = qe(!1), qn = qe(null), cn =
|
|
3937
|
-
(R, A, ee,
|
|
3938
|
-
const le = Array.isArray(R == null ? void 0 : R.checkpoints) ? R.checkpoints.filter((Sr) => Sr && typeof Sr == "object") : [],
|
|
3939
|
-
if (!
|
|
3937
|
+
const Wr = qe(!1), qn = qe(null), cn = Ae(
|
|
3938
|
+
(R, A, ee, te) => {
|
|
3939
|
+
const le = Array.isArray(R == null ? void 0 : R.checkpoints) ? R.checkpoints.filter((Sr) => Sr && typeof Sr == "object") : [], ye = qx(le), je = ee ?? (R == null ? void 0 : R.threadId) ?? Q.current;
|
|
3940
|
+
if (!je)
|
|
3940
3941
|
return;
|
|
3941
|
-
const
|
|
3942
|
+
const it = je === Q.current, Ie = A === "replace" ? null : lt.current.get(je) ?? null, at = A === "replace" ? [] : it ? Z : (Ie == null ? void 0 : Ie.checkpoints) ?? [], dn = A === "replace" ? [] : it ? we.current : (Ie == null ? void 0 : Ie.pendingCheckpoints) ?? [], Dt = {
|
|
3942
3943
|
checkpointId: (R == null ? void 0 : R.checkpointId) ?? null,
|
|
3943
3944
|
checkpointNs: (R == null ? void 0 : R.checkpointNs) ?? null
|
|
3944
|
-
}, Ct =
|
|
3945
|
-
checkpointId: (
|
|
3946
|
-
checkpointNs: (
|
|
3947
|
-
}, Kt = Kx(at,
|
|
3948
|
-
threadId:
|
|
3945
|
+
}, Ct = ye[ye.length - 1] ?? null, Lt = ba(Ct, Dt), jt = {
|
|
3946
|
+
checkpointId: (te == null ? void 0 : te.checkpointId) ?? (A === "replace" ? Lt.checkpointId : (it ? ie.lastCheckpointId ?? null : (Ie == null ? void 0 : Ie.activeCheckpointId) ?? null) ?? Lt.checkpointId),
|
|
3947
|
+
checkpointNs: (te == null ? void 0 : te.checkpointNs) ?? (A === "replace" ? Lt.checkpointNs : (it ? ie.lastCheckpointNs ?? null : (Ie == null ? void 0 : Ie.activeCheckpointNs) ?? null) ?? Lt.checkpointNs)
|
|
3948
|
+
}, Kt = Kx(at, ye, A), En = Gx(Kt, dn), br = {
|
|
3949
|
+
threadId: je,
|
|
3949
3950
|
checkpoints: Kt,
|
|
3950
3951
|
pendingCheckpoints: En,
|
|
3951
|
-
activeCheckpointId:
|
|
3952
|
-
activeCheckpointNs:
|
|
3952
|
+
activeCheckpointId: jt.checkpointId,
|
|
3953
|
+
activeCheckpointNs: jt.checkpointNs
|
|
3953
3954
|
};
|
|
3954
|
-
if (lt.current.set(
|
|
3955
|
+
if (lt.current.set(je, br), gt.current = je, !it)
|
|
3955
3956
|
return;
|
|
3956
|
-
we.current = En, Ve(En), fe(En.length > 0), U(
|
|
3957
|
-
const Ft = Eo(Kt,
|
|
3957
|
+
we.current = En, Ve(En), fe(En.length > 0), U(jt.checkpointId ?? void 0), G(jt.checkpointNs ?? void 0), Be(Kt), ce(Jn(Kt));
|
|
3958
|
+
const Ft = Eo(Kt, jt) ?? Kt[Kt.length - 1] ?? null;
|
|
3958
3959
|
if (Ke(Ft), A === "replace") {
|
|
3959
3960
|
const Sr = On(Ft ?? Ct);
|
|
3960
|
-
|
|
3961
|
-
checkpointId:
|
|
3962
|
-
checkpointNs:
|
|
3961
|
+
ot(Sr, {
|
|
3962
|
+
checkpointId: jt.checkpointId,
|
|
3963
|
+
checkpointNs: jt.checkpointNs
|
|
3963
3964
|
});
|
|
3964
3965
|
} else if (A === "prepend") {
|
|
3965
3966
|
const vl = On(Ct ?? Ft);
|
|
3966
|
-
vl.length &&
|
|
3967
|
+
vl.length && ne(vl);
|
|
3967
3968
|
}
|
|
3968
3969
|
},
|
|
3969
3970
|
[
|
|
@@ -3971,8 +3972,8 @@ function nv({
|
|
|
3971
3972
|
ie.lastCheckpointId,
|
|
3972
3973
|
ie.lastCheckpointNs,
|
|
3973
3974
|
we,
|
|
3974
|
-
|
|
3975
|
-
|
|
3975
|
+
ne,
|
|
3976
|
+
ot,
|
|
3976
3977
|
ce,
|
|
3977
3978
|
Be,
|
|
3978
3979
|
fe,
|
|
@@ -3981,7 +3982,7 @@ function nv({
|
|
|
3981
3982
|
Ve,
|
|
3982
3983
|
Ke
|
|
3983
3984
|
]
|
|
3984
|
-
), kn =
|
|
3985
|
+
), kn = Ae(
|
|
3985
3986
|
(R) => {
|
|
3986
3987
|
if (R.threadId != null && R.threadId !== Q.current)
|
|
3987
3988
|
return;
|
|
@@ -3989,21 +3990,21 @@ function nv({
|
|
|
3989
3990
|
Be(A), ce(Jn(A));
|
|
3990
3991
|
const ee = Array.isArray(R.pendingCheckpoints) ? R.pendingCheckpoints : [];
|
|
3991
3992
|
we.current = ee, Ve(ee), fe(ee.length > 0);
|
|
3992
|
-
const
|
|
3993
|
+
const te = {
|
|
3993
3994
|
checkpointId: R.activeCheckpointId ?? null,
|
|
3994
3995
|
checkpointNs: R.activeCheckpointNs ?? null
|
|
3995
3996
|
};
|
|
3996
|
-
U(
|
|
3997
|
-
const le = Eo(A,
|
|
3997
|
+
U(te.checkpointId ?? void 0), G(te.checkpointNs ?? void 0);
|
|
3998
|
+
const le = Eo(A, te) ?? A[A.length - 1] ?? null;
|
|
3998
3999
|
Ke(le);
|
|
3999
|
-
const
|
|
4000
|
-
|
|
4001
|
-
checkpointId:
|
|
4002
|
-
checkpointNs:
|
|
4000
|
+
const ye = On(le);
|
|
4001
|
+
ot(ye, {
|
|
4002
|
+
checkpointId: te.checkpointId,
|
|
4003
|
+
checkpointNs: te.checkpointNs
|
|
4003
4004
|
}), gt.current = R.threadId;
|
|
4004
4005
|
},
|
|
4005
4006
|
[
|
|
4006
|
-
|
|
4007
|
+
ot,
|
|
4007
4008
|
ce,
|
|
4008
4009
|
Be,
|
|
4009
4010
|
Ve,
|
|
@@ -4021,17 +4022,17 @@ function nv({
|
|
|
4021
4022
|
checkpointNs: ie.lastCheckpointNs ?? null
|
|
4022
4023
|
}, A = R.checkpointId ? Sa(R) : null;
|
|
4023
4024
|
let ee = !1;
|
|
4024
|
-
const
|
|
4025
|
+
const te = Z.map((le, ye) => {
|
|
4025
4026
|
var Dt;
|
|
4026
|
-
const
|
|
4027
|
-
if (!(A ?
|
|
4027
|
+
const je = wo(le);
|
|
4028
|
+
if (!(A ? je === A : ye === Z.length - 1))
|
|
4028
4029
|
return le;
|
|
4029
4030
|
const Ie = Array.isArray(
|
|
4030
4031
|
(Dt = le.values) == null ? void 0 : Dt.messages
|
|
4031
4032
|
) ? le.values.messages : [];
|
|
4032
4033
|
return Ie.length === ie.messages.length && Ie.every((Ct, Lt) => {
|
|
4033
|
-
var
|
|
4034
|
-
return (Ct == null ? void 0 : Ct.id) === ((
|
|
4034
|
+
var jt;
|
|
4035
|
+
return (Ct == null ? void 0 : Ct.id) === ((jt = ie.messages[Lt]) == null ? void 0 : jt.id);
|
|
4035
4036
|
}) ? le : (ee = !0, {
|
|
4036
4037
|
...le,
|
|
4037
4038
|
values: {
|
|
@@ -4040,19 +4041,19 @@ function nv({
|
|
|
4040
4041
|
}
|
|
4041
4042
|
});
|
|
4042
4043
|
});
|
|
4043
|
-
ee && (Be(
|
|
4044
|
+
ee && (Be(te), ce(Jn(te)));
|
|
4044
4045
|
}, [Z, ie.lastCheckpointId, ie.lastCheckpointNs, ie.messages]);
|
|
4045
|
-
const Vt =
|
|
4046
|
+
const Vt = Ae((R) => {
|
|
4046
4047
|
R && (lt.current.delete(R), x(R), gt.current === R && (gt.current = null));
|
|
4047
|
-
}, [x]), bt =
|
|
4048
|
+
}, [x]), bt = Ae(() => {
|
|
4048
4049
|
const R = Q.current;
|
|
4049
|
-
R && Vt(R), Re([]), fe(!1),
|
|
4050
|
-
}, [Vt, Re]), Tn =
|
|
4050
|
+
R && Vt(R), Re([]), fe(!1), be(!1), U(void 0), G(void 0), ce([]), Be([]), Ve([]), we.current = [], Ke(null);
|
|
4051
|
+
}, [Vt, Re]), Tn = Ae(({ from: R, to: A }) => {
|
|
4051
4052
|
const ee = Q.current;
|
|
4052
4053
|
ee && console.warn(
|
|
4053
4054
|
`[ChatSessionProvider] Stream sequence gap detected (${R} -> ${A}) for thread ${ee}`
|
|
4054
4055
|
);
|
|
4055
|
-
}, []), Gn =
|
|
4056
|
+
}, []), Gn = Ae(
|
|
4056
4057
|
(R) => {
|
|
4057
4058
|
const A = R.threadId;
|
|
4058
4059
|
console.log("[ChatSessionProvider] 📥 Handling thread_info event:", {
|
|
@@ -4090,43 +4091,43 @@ function nv({
|
|
|
4090
4091
|
var R;
|
|
4091
4092
|
b.current(((R = l.getAuthToken) == null ? void 0 : R.call(l)) ?? null);
|
|
4092
4093
|
}, [l]);
|
|
4093
|
-
const Xn =
|
|
4094
|
+
const Xn = Ae(
|
|
4094
4095
|
async (R) => {
|
|
4095
4096
|
const A = await O(R);
|
|
4096
4097
|
return (A == null ? void 0 : A.threadId) ?? null;
|
|
4097
4098
|
},
|
|
4098
4099
|
[O]
|
|
4099
|
-
), wr =
|
|
4100
|
+
), wr = Ae(
|
|
4100
4101
|
async (R) => {
|
|
4101
4102
|
const A = Q.current === R;
|
|
4102
4103
|
await L(R), Vt(R), A && (Ze.current = R, C(null), Q.current = null, gt.current = null, bt());
|
|
4103
4104
|
},
|
|
4104
4105
|
[L, bt, Vt, C]
|
|
4105
|
-
), yr =
|
|
4106
|
+
), yr = Ae(
|
|
4106
4107
|
(R, A) => F(R, A),
|
|
4107
4108
|
[F]
|
|
4108
|
-
), oe =
|
|
4109
|
-
async (R, A, ee,
|
|
4109
|
+
), oe = Ae(
|
|
4110
|
+
async (R, A, ee, te = !1) => {
|
|
4110
4111
|
await Pn(async () => {
|
|
4111
|
-
if (Ze.current === R && !
|
|
4112
|
+
if (Ze.current === R && !te) {
|
|
4112
4113
|
Ze.current = null;
|
|
4113
4114
|
return;
|
|
4114
4115
|
}
|
|
4115
|
-
if (Fe.current === R && !
|
|
4116
|
+
if (Fe.current === R && !te)
|
|
4116
4117
|
return;
|
|
4117
4118
|
C((Ie) => Ie === R ? Ie : R), Q.current = R;
|
|
4118
|
-
const le = !
|
|
4119
|
-
let
|
|
4119
|
+
const le = !te && !A && !ee;
|
|
4120
|
+
let ye = !1;
|
|
4120
4121
|
if (le) {
|
|
4121
4122
|
const Ie = lt.current.get(R);
|
|
4122
4123
|
if (Ie)
|
|
4123
|
-
kn(Ie),
|
|
4124
|
+
kn(Ie), ye = !0;
|
|
4124
4125
|
else {
|
|
4125
4126
|
const at = v(R);
|
|
4126
|
-
at && (lt.current.set(R, at), kn(at),
|
|
4127
|
+
at && (lt.current.set(R, at), kn(at), ye = !0);
|
|
4127
4128
|
}
|
|
4128
4129
|
}
|
|
4129
|
-
const
|
|
4130
|
+
const je = te || !ye || !!A || !!ee, it = async (Ie) => {
|
|
4130
4131
|
Ie && H(!0), Fe.current = R;
|
|
4131
4132
|
try {
|
|
4132
4133
|
const at = await l.getStateHistory({
|
|
@@ -4136,18 +4137,18 @@ function nv({
|
|
|
4136
4137
|
});
|
|
4137
4138
|
cn(at, "replace", R), D(null);
|
|
4138
4139
|
} catch (at) {
|
|
4139
|
-
throw (!
|
|
4140
|
+
throw (!ye || te || Ie) && (i == null || i(String(at))), D(String(at)), at;
|
|
4140
4141
|
} finally {
|
|
4141
4142
|
Fe.current = null, Ie && H(!1);
|
|
4142
4143
|
}
|
|
4143
4144
|
};
|
|
4144
|
-
|
|
4145
|
+
je ? await it(!0) : le && ye && it(!1).catch((Ie) => {
|
|
4145
4146
|
console.warn("[ChatSessionProvider] Background refresh failed:", Ie);
|
|
4146
4147
|
});
|
|
4147
4148
|
}, `loadThread-${R}`);
|
|
4148
4149
|
},
|
|
4149
4150
|
[l, kn, cn, Pn, i]
|
|
4150
|
-
),
|
|
4151
|
+
), ke = Ae(async () => {
|
|
4151
4152
|
await Pn(async () => {
|
|
4152
4153
|
const R = Q.current;
|
|
4153
4154
|
R && Vt(R), Ze.current = null, C(null), Q.current = null, gt.current = null, bt(), U(void 0), G(void 0);
|
|
@@ -4157,28 +4158,28 @@ function nv({
|
|
|
4157
4158
|
console.warn("[ChatSessionProvider] Failed to clear lastThreadId:", A);
|
|
4158
4159
|
}
|
|
4159
4160
|
}, "clearCurrentThread");
|
|
4160
|
-
}, [bt, Vt, Pn]), He =
|
|
4161
|
+
}, [bt, Vt, Pn]), He = Ae(
|
|
4161
4162
|
async (R, A) => {
|
|
4162
4163
|
if (!Q.current) throw new Error("No active thread");
|
|
4163
|
-
const
|
|
4164
|
+
const te = Eo(Z, {
|
|
4164
4165
|
checkpointId: R,
|
|
4165
4166
|
checkpointNs: A ?? null
|
|
4166
4167
|
});
|
|
4167
|
-
if (!
|
|
4168
|
+
if (!te)
|
|
4168
4169
|
throw new Error(`Checkpoint ${R} not found in loaded history`);
|
|
4169
4170
|
const le = {
|
|
4170
4171
|
checkpointId: R,
|
|
4171
4172
|
checkpointNs: A ?? null
|
|
4172
|
-
},
|
|
4173
|
+
}, ye = {
|
|
4173
4174
|
threadId: Q.current,
|
|
4174
4175
|
checkpoints: Z,
|
|
4175
4176
|
pendingCheckpoints: we.current,
|
|
4176
4177
|
activeCheckpointId: le.checkpointId,
|
|
4177
4178
|
activeCheckpointNs: le.checkpointNs
|
|
4178
4179
|
};
|
|
4179
|
-
lt.current.set(Q.current,
|
|
4180
|
-
const
|
|
4181
|
-
|
|
4180
|
+
lt.current.set(Q.current, ye), gt.current = Q.current, U(le.checkpointId ?? void 0), G(le.checkpointNs ?? void 0), Ke(te);
|
|
4181
|
+
const je = On(te);
|
|
4182
|
+
ot(je, {
|
|
4182
4183
|
checkpointId: le.checkpointId,
|
|
4183
4184
|
checkpointNs: le.checkpointNs
|
|
4184
4185
|
}), ce(Jn(Z));
|
|
@@ -4187,31 +4188,31 @@ function nv({
|
|
|
4187
4188
|
Z,
|
|
4188
4189
|
Eo,
|
|
4189
4190
|
On,
|
|
4190
|
-
|
|
4191
|
+
ot,
|
|
4191
4192
|
Ke,
|
|
4192
4193
|
ce,
|
|
4193
4194
|
U,
|
|
4194
4195
|
G,
|
|
4195
4196
|
Jn
|
|
4196
4197
|
]
|
|
4197
|
-
), Qe =
|
|
4198
|
+
), Qe = Ae(async () => {
|
|
4198
4199
|
var A, ee;
|
|
4199
4200
|
if (!Q.current) throw new Error("No active thread");
|
|
4200
4201
|
const R = Z[Z.length - 1];
|
|
4201
4202
|
if (R) {
|
|
4202
|
-
const
|
|
4203
|
-
checkpointId: ((A =
|
|
4204
|
-
checkpointNs: ((ee =
|
|
4205
|
-
},
|
|
4203
|
+
const te = R.config, le = {
|
|
4204
|
+
checkpointId: ((A = te == null ? void 0 : te.configurable) == null ? void 0 : A.checkpoint_id) ?? null,
|
|
4205
|
+
checkpointNs: ((ee = te == null ? void 0 : te.configurable) == null ? void 0 : ee.checkpoint_ns) ?? null
|
|
4206
|
+
}, ye = {
|
|
4206
4207
|
threadId: Q.current,
|
|
4207
4208
|
checkpoints: Z,
|
|
4208
4209
|
pendingCheckpoints: we.current,
|
|
4209
4210
|
activeCheckpointId: le.checkpointId,
|
|
4210
4211
|
activeCheckpointNs: le.checkpointNs
|
|
4211
4212
|
};
|
|
4212
|
-
lt.current.set(Q.current,
|
|
4213
|
-
const
|
|
4214
|
-
|
|
4213
|
+
lt.current.set(Q.current, ye), gt.current = Q.current, U(le.checkpointId ?? void 0), G(le.checkpointNs ?? void 0), Ke(R);
|
|
4214
|
+
const je = On(R);
|
|
4215
|
+
ot(je, {
|
|
4215
4216
|
checkpointId: le.checkpointId,
|
|
4216
4217
|
checkpointNs: le.checkpointNs
|
|
4217
4218
|
}), ce(Jn(Z));
|
|
@@ -4220,14 +4221,14 @@ function nv({
|
|
|
4220
4221
|
}, [
|
|
4221
4222
|
Z,
|
|
4222
4223
|
On,
|
|
4223
|
-
|
|
4224
|
+
ot,
|
|
4224
4225
|
Ke,
|
|
4225
4226
|
ce,
|
|
4226
4227
|
U,
|
|
4227
4228
|
G,
|
|
4228
4229
|
Jn,
|
|
4229
4230
|
oe
|
|
4230
|
-
]),
|
|
4231
|
+
]), _t = Ae(
|
|
4231
4232
|
async () => {
|
|
4232
4233
|
if (!Q.current) throw new Error("No active thread");
|
|
4233
4234
|
if (ve) return;
|
|
@@ -4237,26 +4238,26 @@ function nv({
|
|
|
4237
4238
|
return;
|
|
4238
4239
|
}
|
|
4239
4240
|
const [A, ...ee] = R;
|
|
4240
|
-
we.current = ee, Ve(ee),
|
|
4241
|
+
we.current = ee, Ve(ee), be(!0);
|
|
4241
4242
|
try {
|
|
4242
|
-
const
|
|
4243
|
-
threadId:
|
|
4243
|
+
const te = Q.current, le = await l.getStateHistory({
|
|
4244
|
+
threadId: te,
|
|
4244
4245
|
checkpointId: A.checkpointId,
|
|
4245
4246
|
checkpointNs: A.checkpointNs ?? void 0
|
|
4246
4247
|
});
|
|
4247
4248
|
cn(
|
|
4248
4249
|
le,
|
|
4249
4250
|
"prepend",
|
|
4250
|
-
|
|
4251
|
+
te ?? void 0,
|
|
4251
4252
|
{
|
|
4252
4253
|
checkpointId: ie.lastCheckpointId ?? null,
|
|
4253
4254
|
checkpointNs: ie.lastCheckpointNs ?? null
|
|
4254
4255
|
}
|
|
4255
4256
|
), D(null);
|
|
4256
|
-
} catch (
|
|
4257
|
-
throw we.current = [A, ...we.current], Ve(we.current), fe(!0), D(String(
|
|
4257
|
+
} catch (te) {
|
|
4258
|
+
throw we.current = [A, ...we.current], Ve(we.current), fe(!0), D(String(te)), te;
|
|
4258
4259
|
} finally {
|
|
4259
|
-
|
|
4260
|
+
be(!1);
|
|
4260
4261
|
}
|
|
4261
4262
|
},
|
|
4262
4263
|
[
|
|
@@ -4268,7 +4269,7 @@ function nv({
|
|
|
4268
4269
|
we,
|
|
4269
4270
|
Ve
|
|
4270
4271
|
]
|
|
4271
|
-
), un =
|
|
4272
|
+
), un = Ae(
|
|
4272
4273
|
(R) => {
|
|
4273
4274
|
if (!(R != null && R.threadId))
|
|
4274
4275
|
return;
|
|
@@ -4297,23 +4298,23 @@ function nv({
|
|
|
4297
4298
|
});
|
|
4298
4299
|
},
|
|
4299
4300
|
[cn]
|
|
4300
|
-
), k =
|
|
4301
|
+
), k = Ae(
|
|
4301
4302
|
async (R, A) => {
|
|
4302
4303
|
var br;
|
|
4303
|
-
const ee = Q.current,
|
|
4304
|
+
const ee = Q.current, te = (R == null ? void 0 : R.text) ?? "", le = (R == null ? void 0 : R.attachments) ?? [], ye = le.length ? le : (A == null ? void 0 : A.attachments) ?? [], je = {
|
|
4304
4305
|
...(A == null ? void 0 : A.payloadExtras) ?? {},
|
|
4305
4306
|
...(R == null ? void 0 : R.payload) ?? {}
|
|
4306
4307
|
};
|
|
4307
|
-
if (!ee && !Object.keys(
|
|
4308
|
+
if (!ee && !Object.keys(je).length && ye.length === 0 && !te.trim()) {
|
|
4308
4309
|
console.warn("[ChatSessionProvider] Nothing to submit - skipping");
|
|
4309
4310
|
return;
|
|
4310
4311
|
}
|
|
4311
|
-
!ee && !
|
|
4312
|
-
const { contentParts:
|
|
4312
|
+
!ee && !je.messages && console.warn("[ChatSessionProvider] No thread ID - message will create new thread");
|
|
4313
|
+
const { contentParts: it, filesInfo: Ie } = await jx(
|
|
4313
4314
|
l,
|
|
4314
|
-
|
|
4315
|
-
), at = [...
|
|
4316
|
-
|
|
4315
|
+
ye
|
|
4316
|
+
), at = [...it];
|
|
4317
|
+
te && te.trim() && at.push({ type: "text", text: te.trim() });
|
|
4317
4318
|
const dn = !!ee, Dt = dn ? (A == null ? void 0 : A.checkpointId) ?? ie.lastCheckpointId ?? void 0 : void 0, Ct = dn ? (A == null ? void 0 : A.checkpointNs) ?? ie.lastCheckpointNs ?? void 0 : void 0, Lt = {
|
|
4318
4319
|
id: ((br = crypto.randomUUID) == null ? void 0 : br.call(crypto)) || `user-${Date.now()}`,
|
|
4319
4320
|
role: "user",
|
|
@@ -4323,13 +4324,13 @@ function nv({
|
|
|
4323
4324
|
...Ct != null ? { checkpointNs: Ct } : {}
|
|
4324
4325
|
};
|
|
4325
4326
|
at.length > 0 && ue(Lt);
|
|
4326
|
-
const
|
|
4327
|
+
const jt = { ...Lt, content: at }, Kt = ye.length > 0, En = {
|
|
4327
4328
|
...ee ? { threadId: ee } : {},
|
|
4328
4329
|
payload: {
|
|
4329
|
-
messages: at.length > 0 ? [
|
|
4330
|
+
messages: at.length > 0 ? [jt] : [],
|
|
4330
4331
|
files_info: Ie,
|
|
4331
4332
|
...o && Kt && s ? { active_agent: s } : {},
|
|
4332
|
-
...
|
|
4333
|
+
...je
|
|
4333
4334
|
},
|
|
4334
4335
|
...Dt != null ? { checkpointId: Dt } : {},
|
|
4335
4336
|
...Ct != null ? { checkpointNs: Ct } : {},
|
|
@@ -4357,40 +4358,40 @@ function nv({
|
|
|
4357
4358
|
ue,
|
|
4358
4359
|
Yn
|
|
4359
4360
|
]
|
|
4360
|
-
), W =
|
|
4361
|
+
), W = Ae(
|
|
4361
4362
|
async (R, A, ee) => {
|
|
4362
|
-
var le,
|
|
4363
|
-
const
|
|
4364
|
-
if (!
|
|
4363
|
+
var le, ye;
|
|
4364
|
+
const te = Q.current;
|
|
4365
|
+
if (!te)
|
|
4365
4366
|
throw new Error("No active thread to handle interrupt");
|
|
4366
4367
|
try {
|
|
4367
|
-
const
|
|
4368
|
+
const je = A ? ee ?? !0 : !1;
|
|
4368
4369
|
try {
|
|
4369
4370
|
vt({ type: "interrupt_response", payload: { interruptId: R } });
|
|
4370
4371
|
} catch (Lt) {
|
|
4371
4372
|
console.warn("[ChatSessionProvider] optimistic interrupt_response dispatch failed:", Lt);
|
|
4372
4373
|
}
|
|
4373
|
-
const
|
|
4374
|
+
const it = `${d}/runs/resume`, Ie = (le = l.getAuthToken) == null ? void 0 : le.call(l), at = await fetch(it, {
|
|
4374
4375
|
method: "POST",
|
|
4375
4376
|
headers: {
|
|
4376
4377
|
"Content-Type": "application/json",
|
|
4377
4378
|
...Ie ? { Authorization: `Bearer ${Ie}` } : {}
|
|
4378
4379
|
},
|
|
4379
4380
|
body: JSON.stringify({
|
|
4380
|
-
thread_id:
|
|
4381
|
-
value:
|
|
4381
|
+
thread_id: te,
|
|
4382
|
+
value: je
|
|
4382
4383
|
})
|
|
4383
4384
|
});
|
|
4384
4385
|
if (!at.ok)
|
|
4385
4386
|
throw new Error(`Resume failed with status ${at.status}`);
|
|
4386
|
-
const dn = (
|
|
4387
|
+
const dn = (ye = at.body) == null ? void 0 : ye.getReader();
|
|
4387
4388
|
if (!dn) throw new Error("No response body for resume stream");
|
|
4388
4389
|
const Dt = new TextDecoder();
|
|
4389
4390
|
let Ct = "";
|
|
4390
4391
|
for (; ; ) {
|
|
4391
|
-
const { done: Lt, value:
|
|
4392
|
+
const { done: Lt, value: jt } = await dn.read();
|
|
4392
4393
|
if (Lt) break;
|
|
4393
|
-
Ct += Dt.decode(
|
|
4394
|
+
Ct += Dt.decode(jt, { stream: !0 });
|
|
4394
4395
|
const Kt = Ct.split(`
|
|
4395
4396
|
`);
|
|
4396
4397
|
Ct = Kt.pop() || "";
|
|
@@ -4406,12 +4407,12 @@ function nv({
|
|
|
4406
4407
|
}
|
|
4407
4408
|
}
|
|
4408
4409
|
j(null);
|
|
4409
|
-
} catch (
|
|
4410
|
-
throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${R}:`,
|
|
4410
|
+
} catch (je) {
|
|
4411
|
+
throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${R}:`, je), je;
|
|
4411
4412
|
}
|
|
4412
4413
|
},
|
|
4413
4414
|
[l, vt, d]
|
|
4414
|
-
), ae =
|
|
4415
|
+
), ae = Ae(
|
|
4415
4416
|
(R) => W(R.interruptId, R.approved, R.value),
|
|
4416
4417
|
[W]
|
|
4417
4418
|
);
|
|
@@ -4447,19 +4448,19 @@ function nv({
|
|
|
4447
4448
|
pendingCheckpoints: we.current,
|
|
4448
4449
|
activeCheckpointId: ie.lastCheckpointId ?? null,
|
|
4449
4450
|
activeCheckpointNs: ie.lastCheckpointNs ?? null
|
|
4450
|
-
}, ee = lt.current.get(R),
|
|
4451
|
-
(
|
|
4451
|
+
}, ee = lt.current.get(R), te = !ee || Jl(ee.checkpoints ?? []) !== Jl(A.checkpoints), le = (it) => it.map((Ie) => os(Ie)).join("|"), ye = !ee || le(ee.pendingCheckpoints ?? []) !== le(A.pendingCheckpoints), je = !ee || ee.activeCheckpointId !== A.activeCheckpointId || ee.activeCheckpointNs !== A.activeCheckpointNs;
|
|
4452
|
+
(te || ye || je) && (lt.current.set(R, A), qn.current && window.clearTimeout(qn.current), qn.current = window.setTimeout(() => {
|
|
4452
4453
|
try {
|
|
4453
4454
|
g(A);
|
|
4454
|
-
} catch (
|
|
4455
|
-
console.warn("[ChatSessionProvider] Failed to persist thread payload:",
|
|
4455
|
+
} catch (it) {
|
|
4456
|
+
console.warn("[ChatSessionProvider] Failed to persist thread payload:", it);
|
|
4456
4457
|
}
|
|
4457
4458
|
}, Ca));
|
|
4458
4459
|
}, [
|
|
4459
4460
|
Z,
|
|
4460
4461
|
ie.lastCheckpointId,
|
|
4461
4462
|
ie.lastCheckpointNs,
|
|
4462
|
-
|
|
4463
|
+
tt
|
|
4463
4464
|
]);
|
|
4464
4465
|
const Ee = ht(
|
|
4465
4466
|
() => ({
|
|
@@ -4510,17 +4511,17 @@ function nv({
|
|
|
4510
4511
|
isHistoryLoading: ve,
|
|
4511
4512
|
error: M,
|
|
4512
4513
|
hasMore: J,
|
|
4513
|
-
loadOlder:
|
|
4514
|
+
loadOlder: _t,
|
|
4514
4515
|
seedFromSnapshot: un,
|
|
4515
4516
|
clearState: bt,
|
|
4516
4517
|
navigateToCheckpoint: He,
|
|
4517
4518
|
returnToLatest: Qe,
|
|
4518
4519
|
loadThread: oe,
|
|
4519
|
-
clearThread:
|
|
4520
|
+
clearThread: ke,
|
|
4520
4521
|
respondToInterrupt: W
|
|
4521
4522
|
};
|
|
4522
4523
|
}, [
|
|
4523
|
-
|
|
4524
|
+
ke,
|
|
4524
4525
|
bt,
|
|
4525
4526
|
S,
|
|
4526
4527
|
Y,
|
|
@@ -4528,7 +4529,7 @@ function nv({
|
|
|
4528
4529
|
ve,
|
|
4529
4530
|
$,
|
|
4530
4531
|
se,
|
|
4531
|
-
|
|
4532
|
+
_t,
|
|
4532
4533
|
oe,
|
|
4533
4534
|
ie.assemblingId,
|
|
4534
4535
|
ie.lastBranch,
|
|
@@ -4817,7 +4818,7 @@ function ut(e = Qu) {
|
|
|
4817
4818
|
e(t, r) || (t = r, n(r));
|
|
4818
4819
|
};
|
|
4819
4820
|
}
|
|
4820
|
-
function
|
|
4821
|
+
function _e(e) {
|
|
4821
4822
|
return (t) => (n) => {
|
|
4822
4823
|
e(n) && t(n);
|
|
4823
4824
|
};
|
|
@@ -4975,7 +4976,7 @@ function xt(...e) {
|
|
|
4975
4976
|
}
|
|
4976
4977
|
};
|
|
4977
4978
|
}
|
|
4978
|
-
function
|
|
4979
|
+
function Ne(e, t = Qu) {
|
|
4979
4980
|
return V(e, ut(t));
|
|
4980
4981
|
}
|
|
4981
4982
|
function Ki(...e) {
|
|
@@ -4988,7 +4989,7 @@ function Ki(...e) {
|
|
|
4988
4989
|
}
|
|
4989
4990
|
};
|
|
4990
4991
|
}
|
|
4991
|
-
var
|
|
4992
|
+
var Mt = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e))(Mt || {});
|
|
4992
4993
|
const mv = {
|
|
4993
4994
|
0: "debug",
|
|
4994
4995
|
3: "error",
|
|
@@ -5069,7 +5070,7 @@ function vv(e, t, n, r) {
|
|
|
5069
5070
|
if (a.dataset.index === void 0)
|
|
5070
5071
|
continue;
|
|
5071
5072
|
const l = parseInt(a.dataset.index), u = parseFloat(a.dataset.knownSize), d = t(a, n);
|
|
5072
|
-
if (d === 0 && r("Zero-sized element, this should not happen", { child: a },
|
|
5073
|
+
if (d === 0 && r("Zero-sized element, this should not happen", { child: a }, Mt.ERROR), d === u)
|
|
5073
5074
|
continue;
|
|
5074
5075
|
const f = s[s.length - 1];
|
|
5075
5076
|
s.length === 0 || f.size !== d || f.endIndex !== l - 1 ? s.push({ endIndex: l, size: d, startIndex: l }) : s[s.length - 1].endIndex++;
|
|
@@ -5077,7 +5078,7 @@ function vv(e, t, n, r) {
|
|
|
5077
5078
|
return s;
|
|
5078
5079
|
}
|
|
5079
5080
|
function tc(e, t, n) {
|
|
5080
|
-
return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t,
|
|
5081
|
+
return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t, Mt.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
|
|
5081
5082
|
}
|
|
5082
5083
|
function ed(e, t, n) {
|
|
5083
5084
|
const r = q.useRef(null), o = q.useCallback(
|
|
@@ -5174,15 +5175,15 @@ function td(e, t) {
|
|
|
5174
5175
|
}
|
|
5175
5176
|
return s.push({ end: 1 / 0, start: r, value: o }), s;
|
|
5176
5177
|
}
|
|
5177
|
-
function
|
|
5178
|
+
function nt(e) {
|
|
5178
5179
|
return e === ro;
|
|
5179
5180
|
}
|
|
5180
5181
|
function oo(e, t) {
|
|
5181
|
-
if (!
|
|
5182
|
+
if (!nt(e))
|
|
5182
5183
|
return t === e.k ? e.v : t < e.k ? oo(e.l, t) : oo(e.r, t);
|
|
5183
5184
|
}
|
|
5184
5185
|
function rn(e, t, n = "k") {
|
|
5185
|
-
if (
|
|
5186
|
+
if (nt(e))
|
|
5186
5187
|
return [-1 / 0, void 0];
|
|
5187
5188
|
if (Number(e[n]) === t)
|
|
5188
5189
|
return [e.k, e.v];
|
|
@@ -5193,24 +5194,24 @@ function rn(e, t, n = "k") {
|
|
|
5193
5194
|
return rn(e.l, t, n);
|
|
5194
5195
|
}
|
|
5195
5196
|
function Bt(e, t, n) {
|
|
5196
|
-
return
|
|
5197
|
+
return nt(e) ? od(t, n, 1) : t === e.k ? wt(e, { k: t, v: n }) : t < e.k ? nc(wt(e, { l: Bt(e.l, t, n) })) : nc(wt(e, { r: Bt(e.r, t, n) }));
|
|
5197
5198
|
}
|
|
5198
5199
|
function Er() {
|
|
5199
5200
|
return ro;
|
|
5200
5201
|
}
|
|
5201
5202
|
function js(e, t, n) {
|
|
5202
|
-
if (
|
|
5203
|
+
if (nt(e))
|
|
5203
5204
|
return [];
|
|
5204
5205
|
const r = rn(e, t)[0];
|
|
5205
5206
|
return wv(Gi(e, r, n));
|
|
5206
5207
|
}
|
|
5207
5208
|
function qi(e, t) {
|
|
5208
|
-
if (
|
|
5209
|
+
if (nt(e)) return ro;
|
|
5209
5210
|
const { k: n, l: r, r: o } = e;
|
|
5210
5211
|
if (t === n) {
|
|
5211
|
-
if (
|
|
5212
|
+
if (nt(r))
|
|
5212
5213
|
return o;
|
|
5213
|
-
if (
|
|
5214
|
+
if (nt(o))
|
|
5214
5215
|
return r;
|
|
5215
5216
|
{
|
|
5216
5217
|
const [s, i] = rd(r);
|
|
@@ -5219,10 +5220,10 @@ function qi(e, t) {
|
|
|
5219
5220
|
} else return t < n ? Vo(wt(e, { l: qi(r, t) })) : Vo(wt(e, { r: qi(o, t) }));
|
|
5220
5221
|
}
|
|
5221
5222
|
function tr(e) {
|
|
5222
|
-
return
|
|
5223
|
+
return nt(e) ? [] : [...tr(e.l), { k: e.k, v: e.v }, ...tr(e.r)];
|
|
5223
5224
|
}
|
|
5224
5225
|
function Gi(e, t, n) {
|
|
5225
|
-
if (
|
|
5226
|
+
if (nt(e))
|
|
5226
5227
|
return [];
|
|
5227
5228
|
const { k: r, l: o, r: s, v: i } = e;
|
|
5228
5229
|
let a = [];
|
|
@@ -5235,7 +5236,7 @@ function Vo(e) {
|
|
|
5235
5236
|
if (n > r.lvl + 1) {
|
|
5236
5237
|
if (xi(t))
|
|
5237
5238
|
return sd(wt(e, { lvl: n - 1 }));
|
|
5238
|
-
if (!
|
|
5239
|
+
if (!nt(t) && !nt(t.r))
|
|
5239
5240
|
return wt(t.r, {
|
|
5240
5241
|
l: wt(t, { r: t.r.l }),
|
|
5241
5242
|
lvl: n,
|
|
@@ -5248,7 +5249,7 @@ function Vo(e) {
|
|
|
5248
5249
|
} else {
|
|
5249
5250
|
if (xi(e))
|
|
5250
5251
|
return Yi(wt(e, { lvl: n - 1 }));
|
|
5251
|
-
if (!
|
|
5252
|
+
if (!nt(r) && !nt(r.l)) {
|
|
5252
5253
|
const o = r.l, s = xi(o) ? r.lvl - 1 : r.lvl;
|
|
5253
5254
|
return wt(o, {
|
|
5254
5255
|
l: wt(e, {
|
|
@@ -5272,13 +5273,13 @@ function wt(e, t) {
|
|
|
5272
5273
|
);
|
|
5273
5274
|
}
|
|
5274
5275
|
function nd(e) {
|
|
5275
|
-
return
|
|
5276
|
+
return nt(e.r) ? e.l : Vo(wt(e, { r: nd(e.r) }));
|
|
5276
5277
|
}
|
|
5277
5278
|
function xi(e) {
|
|
5278
|
-
return
|
|
5279
|
+
return nt(e) || e.lvl > e.r.lvl;
|
|
5279
5280
|
}
|
|
5280
5281
|
function rd(e) {
|
|
5281
|
-
return
|
|
5282
|
+
return nt(e.r) ? [e.k, e.v] : rd(e.r);
|
|
5282
5283
|
}
|
|
5283
5284
|
function od(e, t, n, r = ro, o = ro) {
|
|
5284
5285
|
return { k: e, l: r, lvl: n, r: o, v: t };
|
|
@@ -5288,11 +5289,11 @@ function nc(e) {
|
|
|
5288
5289
|
}
|
|
5289
5290
|
function sd(e) {
|
|
5290
5291
|
const { l: t } = e;
|
|
5291
|
-
return !
|
|
5292
|
+
return !nt(t) && t.lvl === e.lvl ? wt(t, { r: wt(e, { l: t.r }) }) : e;
|
|
5292
5293
|
}
|
|
5293
5294
|
function Yi(e) {
|
|
5294
5295
|
const { lvl: t, r: n } = e;
|
|
5295
|
-
return !
|
|
5296
|
+
return !nt(n) && !nt(n.r) && n.lvl === t && n.r.lvl === t ? wt(n, { l: wt(e, { r: n.l }), lvl: t + 1 }) : e;
|
|
5296
5297
|
}
|
|
5297
5298
|
function wv(e) {
|
|
5298
5299
|
return td(e, ({ k: t, v: n }) => ({ index: t, value: n }));
|
|
@@ -5337,7 +5338,7 @@ function Ln(e, t) {
|
|
|
5337
5338
|
return Math.round(e.getBoundingClientRect()[t]);
|
|
5338
5339
|
}
|
|
5339
5340
|
function Ps(e) {
|
|
5340
|
-
return !
|
|
5341
|
+
return !nt(e.groupOffsetTree);
|
|
5341
5342
|
}
|
|
5342
5343
|
function _a({ index: e }, t) {
|
|
5343
5344
|
return t === e ? 0 : t < e ? -1 : 1;
|
|
@@ -5354,10 +5355,10 @@ function bv() {
|
|
|
5354
5355
|
};
|
|
5355
5356
|
}
|
|
5356
5357
|
function Sv(e, t) {
|
|
5357
|
-
let n =
|
|
5358
|
+
let n = nt(e) ? 0 : 1 / 0;
|
|
5358
5359
|
for (const r of t) {
|
|
5359
5360
|
const { endIndex: o, size: s, startIndex: i } = r;
|
|
5360
|
-
if (n = Math.min(n, i),
|
|
5361
|
+
if (n = Math.min(n, i), nt(e)) {
|
|
5361
5362
|
e = Bt(e, 0, s);
|
|
5362
5363
|
continue;
|
|
5363
5364
|
}
|
|
@@ -5404,10 +5405,10 @@ function Tv(e, t, n, r = 0) {
|
|
|
5404
5405
|
return r > 0 && (t = Math.max(t, ad(e, r, _a).offset)), td(yv(e, t, n, kv), Ev);
|
|
5405
5406
|
}
|
|
5406
5407
|
function Iv(e, [t, n, r, o]) {
|
|
5407
|
-
t.length > 0 && r("received item sizes", t,
|
|
5408
|
+
t.length > 0 && r("received item sizes", t, Mt.DEBUG);
|
|
5408
5409
|
const s = e.sizeTree;
|
|
5409
5410
|
let i = s, a = 0;
|
|
5410
|
-
if (n.length > 0 &&
|
|
5411
|
+
if (n.length > 0 && nt(s) && t.length === 2) {
|
|
5411
5412
|
const h = t[0].size, p = t[1].size;
|
|
5412
5413
|
i = n.reduce((w, v) => Bt(Bt(w, v, h), v + 1, p), i);
|
|
5413
5414
|
} else
|
|
@@ -5490,7 +5491,7 @@ const Av = {
|
|
|
5490
5491
|
xe(
|
|
5491
5492
|
V(
|
|
5492
5493
|
l,
|
|
5493
|
-
|
|
5494
|
+
_e((S) => S.length > 0),
|
|
5494
5495
|
ze(v, p),
|
|
5495
5496
|
de(([S, C, I]) => {
|
|
5496
5497
|
const E = S.reduce((_, O, L) => Bt(_, O, io(O, C.offsetTree, I) || L), Er());
|
|
@@ -5506,7 +5507,7 @@ const Av = {
|
|
|
5506
5507
|
V(
|
|
5507
5508
|
r,
|
|
5508
5509
|
ze(v),
|
|
5509
|
-
|
|
5510
|
+
_e(([S, { lastIndex: C }]) => S < C),
|
|
5510
5511
|
de(([S, { lastIndex: C, lastSize: I }]) => [
|
|
5511
5512
|
{
|
|
5512
5513
|
endIndex: C,
|
|
@@ -5527,7 +5528,7 @@ const Av = {
|
|
|
5527
5528
|
xe(
|
|
5528
5529
|
V(
|
|
5529
5530
|
d,
|
|
5530
|
-
|
|
5531
|
+
_e((S) => S !== void 0 && nt(pt(v).sizeTree)),
|
|
5531
5532
|
de((S) => [{ endIndex: 0, size: S, startIndex: 0 }])
|
|
5532
5533
|
),
|
|
5533
5534
|
n
|
|
@@ -5568,7 +5569,7 @@ const Av = {
|
|
|
5568
5569
|
S < 0 && C(
|
|
5569
5570
|
"`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
|
|
5570
5571
|
{ firstItemIndex: a },
|
|
5571
|
-
|
|
5572
|
+
Mt.ERROR
|
|
5572
5573
|
);
|
|
5573
5574
|
});
|
|
5574
5575
|
const b = Ht(s);
|
|
@@ -5649,7 +5650,7 @@ const Av = {
|
|
|
5649
5650
|
ze(v, p),
|
|
5650
5651
|
de(([S, C, I]) => {
|
|
5651
5652
|
if (C.groupIndices.length > 0) {
|
|
5652
|
-
if (
|
|
5653
|
+
if (nt(C.sizeTree))
|
|
5653
5654
|
return C;
|
|
5654
5655
|
let E = Er();
|
|
5655
5656
|
const _ = pt(g);
|
|
@@ -5733,7 +5734,7 @@ const ud = Xe(
|
|
|
5733
5734
|
), xe(
|
|
5734
5735
|
V(
|
|
5735
5736
|
xt(o, t, r),
|
|
5736
|
-
|
|
5737
|
+
_e(([l, u]) => Ps(u)),
|
|
5737
5738
|
de(([l, u, d]) => rn(u.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
|
|
5738
5739
|
ut(),
|
|
5739
5740
|
de((l) => [l])
|
|
@@ -5747,12 +5748,12 @@ const ud = Xe(
|
|
|
5747
5748
|
const t = X(!1), n = Ht(
|
|
5748
5749
|
V(
|
|
5749
5750
|
t,
|
|
5750
|
-
|
|
5751
|
+
_e((r) => r),
|
|
5751
5752
|
ut()
|
|
5752
5753
|
)
|
|
5753
5754
|
);
|
|
5754
5755
|
return Je(t, (r) => {
|
|
5755
|
-
r && pt(e)("props updated", {},
|
|
5756
|
+
r && pt(e)("props updated", {}, Mt.DEBUG);
|
|
5756
5757
|
}), { didMount: n, propsReady: t };
|
|
5757
5758
|
},
|
|
5758
5759
|
dt(Un),
|
|
@@ -5798,7 +5799,7 @@ const yo = Xe(
|
|
|
5798
5799
|
let j = io(Y, S.offsetTree, F) + _;
|
|
5799
5800
|
$ === "end" ? (j += K + rn(S.sizeTree, Y)[1] - C + N, Y === D && (j += O)) : $ === "center" ? j += (K + rn(S.sizeTree, Y)[1] - C + N) / 2 : j -= E, M && (j += M);
|
|
5800
5801
|
const J = (fe) => {
|
|
5801
|
-
b(), fe ? (L("retrying to scroll to", { location: T },
|
|
5802
|
+
b(), fe ? (L("retrying to scroll to", { location: T }, Mt.DEBUG), Le(p, T)) : (Le(w, !0), L("list did not change, scroll successful", {}, Mt.DEBUG));
|
|
5802
5803
|
};
|
|
5803
5804
|
if (b(), H === "smooth") {
|
|
5804
5805
|
let fe = !1;
|
|
@@ -5811,7 +5812,7 @@ const yo = Xe(
|
|
|
5811
5812
|
g = nn(V(t, Pv(150)), J);
|
|
5812
5813
|
return x = setTimeout(() => {
|
|
5813
5814
|
b();
|
|
5814
|
-
}, 1200), Le(l, !0), L("scrolling from index to", { behavior: H, index: Y, top: j },
|
|
5815
|
+
}, 1200), Le(l, !0), L("scrolling from index to", { behavior: H, index: Y, top: j }, Mt.DEBUG), { behavior: H, top: j };
|
|
5815
5816
|
}
|
|
5816
5817
|
)
|
|
5817
5818
|
),
|
|
@@ -5851,7 +5852,7 @@ const bo = Xe(
|
|
|
5851
5852
|
V(
|
|
5852
5853
|
i,
|
|
5853
5854
|
ze(l),
|
|
5854
|
-
|
|
5855
|
+
_e(([d, f]) => !!f),
|
|
5855
5856
|
hn(!1)
|
|
5856
5857
|
),
|
|
5857
5858
|
a
|
|
@@ -5859,7 +5860,7 @@ const bo = Xe(
|
|
|
5859
5860
|
V(
|
|
5860
5861
|
i,
|
|
5861
5862
|
ze(l),
|
|
5862
|
-
|
|
5863
|
+
_e(([d, f]) => !!f),
|
|
5863
5864
|
hn(!1)
|
|
5864
5865
|
),
|
|
5865
5866
|
u
|
|
@@ -5867,7 +5868,7 @@ const bo = Xe(
|
|
|
5867
5868
|
V(
|
|
5868
5869
|
xt(t, i),
|
|
5869
5870
|
ze(a, n, e, u),
|
|
5870
|
-
|
|
5871
|
+
_e(([[, d], f, { sizeTree: h }, p, w]) => d && (!nt(h) || Ra(p)) && !f && !w),
|
|
5871
5872
|
ze(l)
|
|
5872
5873
|
),
|
|
5873
5874
|
([, d]) => {
|
|
@@ -5903,7 +5904,7 @@ const ao = "up", Jr = "down", Ov = "none", Mv = {
|
|
|
5903
5904
|
}, Dv = 0, So = Xe(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
|
|
5904
5905
|
const i = X(!1), a = X(!0), l = We(), u = We(), d = X(4), f = X(Dv), h = Rt(
|
|
5905
5906
|
V(
|
|
5906
|
-
Ki(V(
|
|
5907
|
+
Ki(V(Ne(o), ir(1), hn(!0)), V(Ne(o), ir(1), hn(!1), ec(100))),
|
|
5907
5908
|
ut()
|
|
5908
5909
|
),
|
|
5909
5910
|
!1
|
|
@@ -5913,7 +5914,7 @@ const ao = "up", Jr = "down", Ov = "none", Mv = {
|
|
|
5913
5914
|
);
|
|
5914
5915
|
xe(
|
|
5915
5916
|
V(
|
|
5916
|
-
xt(
|
|
5917
|
+
xt(Ne(o), Ne(f)),
|
|
5917
5918
|
de(([y, b]) => y <= b),
|
|
5918
5919
|
ut()
|
|
5919
5920
|
),
|
|
@@ -5921,7 +5922,7 @@ const ao = "up", Jr = "down", Ov = "none", Mv = {
|
|
|
5921
5922
|
), xe(V(a, Nn(50)), u);
|
|
5922
5923
|
const w = Ht(
|
|
5923
5924
|
V(
|
|
5924
|
-
xt(r,
|
|
5925
|
+
xt(r, Ne(s), Ne(t), Ne(e), Ne(d)),
|
|
5925
5926
|
mn((y, [{ scrollHeight: b, scrollTop: T }, S, C, I, E]) => {
|
|
5926
5927
|
const _ = T + S - b > -E, O = {
|
|
5927
5928
|
scrollHeight: b,
|
|
@@ -5975,7 +5976,7 @@ const ao = "up", Jr = "down", Ov = "none", Mv = {
|
|
|
5975
5976
|
},
|
|
5976
5977
|
{ changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 }
|
|
5977
5978
|
),
|
|
5978
|
-
|
|
5979
|
+
_e((y) => y.changed),
|
|
5979
5980
|
de((y) => y.jump)
|
|
5980
5981
|
),
|
|
5981
5982
|
0
|
|
@@ -6005,7 +6006,7 @@ const ao = "up", Jr = "down", Ov = "none", Mv = {
|
|
|
6005
6006
|
return xe(
|
|
6006
6007
|
V(
|
|
6007
6008
|
h,
|
|
6008
|
-
|
|
6009
|
+
_e((y) => !y),
|
|
6009
6010
|
hn(0)
|
|
6010
6011
|
),
|
|
6011
6012
|
x
|
|
@@ -6014,7 +6015,7 @@ const ao = "up", Jr = "down", Ov = "none", Mv = {
|
|
|
6014
6015
|
o,
|
|
6015
6016
|
Nn(100),
|
|
6016
6017
|
ze(h),
|
|
6017
|
-
|
|
6018
|
+
_e(([y, b]) => !!b),
|
|
6018
6019
|
mn(([y, b], [T]) => [b, T], [0, 0]),
|
|
6019
6020
|
de(([y, b]) => b - y)
|
|
6020
6021
|
),
|
|
@@ -6045,15 +6046,15 @@ const Oa = Xe(
|
|
|
6045
6046
|
const s = We(), i = X(0), a = X(0), l = X(0), u = Rt(
|
|
6046
6047
|
V(
|
|
6047
6048
|
xt(
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6049
|
+
Ne(r),
|
|
6050
|
+
Ne(o),
|
|
6051
|
+
Ne(n),
|
|
6052
|
+
Ne(s, so),
|
|
6053
|
+
Ne(l),
|
|
6054
|
+
Ne(i),
|
|
6055
|
+
Ne(t),
|
|
6056
|
+
Ne(e),
|
|
6057
|
+
Ne(a)
|
|
6057
6058
|
),
|
|
6058
6059
|
de(
|
|
6059
6060
|
([
|
|
@@ -6076,7 +6077,7 @@ const Oa = Xe(
|
|
|
6076
6077
|
] : null;
|
|
6077
6078
|
}
|
|
6078
6079
|
),
|
|
6079
|
-
|
|
6080
|
+
_e((d) => d != null),
|
|
6080
6081
|
ut(so)
|
|
6081
6082
|
),
|
|
6082
6083
|
[0, 0]
|
|
@@ -6196,17 +6197,17 @@ const hr = Xe(
|
|
|
6196
6197
|
xt(
|
|
6197
6198
|
p,
|
|
6198
6199
|
w,
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6200
|
+
Ne(l, so),
|
|
6201
|
+
Ne(o),
|
|
6202
|
+
Ne(r),
|
|
6203
|
+
Ne(u),
|
|
6203
6204
|
d,
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6205
|
+
Ne(v),
|
|
6206
|
+
Ne(t),
|
|
6207
|
+
Ne(n),
|
|
6207
6208
|
e
|
|
6208
6209
|
),
|
|
6209
|
-
|
|
6210
|
+
_e(([C, I, , E, , , , , , , _]) => {
|
|
6210
6211
|
const O = _ && _.length !== E;
|
|
6211
6212
|
return C && !I && !O;
|
|
6212
6213
|
}),
|
|
@@ -6229,7 +6230,7 @@ const hr = Xe(
|
|
|
6229
6230
|
return { ...vi, totalCount: E };
|
|
6230
6231
|
if (C === 0 && I === 0)
|
|
6231
6232
|
return D === 0 ? { ...vi, totalCount: E } : hd(D, O, _, K, N, B || []);
|
|
6232
|
-
if (
|
|
6233
|
+
if (nt(M))
|
|
6233
6234
|
return D > 0 ? null : Ko(
|
|
6234
6235
|
Lv(Pa(O, E), $, B),
|
|
6235
6236
|
[],
|
|
@@ -6240,10 +6241,10 @@ const hr = Xe(
|
|
|
6240
6241
|
);
|
|
6241
6242
|
const Y = [];
|
|
6242
6243
|
if (F.length > 0) {
|
|
6243
|
-
const
|
|
6244
|
+
const be = F[0], Te = F[F.length - 1];
|
|
6244
6245
|
let U = 0;
|
|
6245
|
-
for (const z of js(M,
|
|
6246
|
-
const G = z.value, se = Math.max(z.start,
|
|
6246
|
+
for (const z of js(M, be, Te)) {
|
|
6247
|
+
const G = z.value, se = Math.max(z.start, be), ce = Math.min(z.end, Te);
|
|
6247
6248
|
for (let Z = se; Z <= ce; Z++)
|
|
6248
6249
|
Y.push({ data: B == null ? void 0 : B[Z], index: Z, offset: U, size: G }), U += G;
|
|
6249
6250
|
}
|
|
@@ -6253,7 +6254,7 @@ const hr = Xe(
|
|
|
6253
6254
|
const j = F.length > 0 ? F[F.length - 1] + 1 : 0, J = Tv(H, C, I, j);
|
|
6254
6255
|
if (J.length === 0)
|
|
6255
6256
|
return null;
|
|
6256
|
-
const fe = E - 1, ve = _s([], (
|
|
6257
|
+
const fe = E - 1, ve = _s([], (be) => {
|
|
6257
6258
|
for (const Te of J) {
|
|
6258
6259
|
const U = Te.value;
|
|
6259
6260
|
let z = U.offset, G = Te.start;
|
|
@@ -6266,14 +6267,14 @@ const hr = Xe(
|
|
|
6266
6267
|
G < j && (z += (j - G) * se, G = j);
|
|
6267
6268
|
const ce = Math.min(Te.end, fe);
|
|
6268
6269
|
for (let Z = G; Z <= ce && !(z >= I); Z++)
|
|
6269
|
-
|
|
6270
|
+
be.push({ data: B == null ? void 0 : B[Z], index: Z, offset: z, size: se }), z += se + N;
|
|
6270
6271
|
}
|
|
6271
6272
|
});
|
|
6272
6273
|
return Ko(ve, Y, E, N, $, K);
|
|
6273
6274
|
}
|
|
6274
6275
|
),
|
|
6275
6276
|
//@ts-expect-error filter needs to be fixed
|
|
6276
|
-
|
|
6277
|
+
_e((C) => C !== null),
|
|
6277
6278
|
ut()
|
|
6278
6279
|
),
|
|
6279
6280
|
vi
|
|
@@ -6281,7 +6282,7 @@ const hr = Xe(
|
|
|
6281
6282
|
xe(
|
|
6282
6283
|
V(
|
|
6283
6284
|
e,
|
|
6284
|
-
|
|
6285
|
+
_e(Ra),
|
|
6285
6286
|
de((C) => C == null ? void 0 : C.length)
|
|
6286
6287
|
),
|
|
6287
6288
|
o
|
|
@@ -6307,9 +6308,9 @@ const hr = Xe(
|
|
|
6307
6308
|
const b = Ht(
|
|
6308
6309
|
V(
|
|
6309
6310
|
y,
|
|
6310
|
-
|
|
6311
|
+
_e(({ items: C }) => C.length > 0),
|
|
6311
6312
|
ze(o, e),
|
|
6312
|
-
|
|
6313
|
+
_e(([{ items: C }, I]) => C[C.length - 1].originalIndex === I - 1),
|
|
6313
6314
|
de(([, C, I]) => [C - 1, I]),
|
|
6314
6315
|
ut(so),
|
|
6315
6316
|
de(([C]) => C)
|
|
@@ -6318,14 +6319,14 @@ const hr = Xe(
|
|
|
6318
6319
|
V(
|
|
6319
6320
|
y,
|
|
6320
6321
|
Nn(200),
|
|
6321
|
-
|
|
6322
|
+
_e(({ items: C, topItems: I }) => C.length > 0 && C[0].originalIndex === I.length),
|
|
6322
6323
|
de(({ items: C }) => C[0].index),
|
|
6323
6324
|
ut()
|
|
6324
6325
|
)
|
|
6325
6326
|
), S = Ht(
|
|
6326
6327
|
V(
|
|
6327
6328
|
y,
|
|
6328
|
-
|
|
6329
|
+
_e(({ items: C }) => C.length > 0),
|
|
6329
6330
|
de(({ items: C }) => {
|
|
6330
6331
|
let I = 0, E = C.length - 1;
|
|
6331
6332
|
for (; C[I].type === "group" && I < E; )
|
|
@@ -6362,7 +6363,7 @@ const hr = Xe(
|
|
|
6362
6363
|
),
|
|
6363
6364
|
0
|
|
6364
6365
|
);
|
|
6365
|
-
return xe(
|
|
6366
|
+
return xe(Ne(i), s), { totalListHeight: i, totalListHeightChanged: s };
|
|
6366
6367
|
},
|
|
6367
6368
|
dt(Et, hr),
|
|
6368
6369
|
{ singleton: !0 }
|
|
@@ -6371,7 +6372,7 @@ const hr = Xe(
|
|
|
6371
6372
|
const n = X(!1), r = Rt(
|
|
6372
6373
|
V(
|
|
6373
6374
|
xt(n, e, t),
|
|
6374
|
-
|
|
6375
|
+
_e(([o]) => o),
|
|
6375
6376
|
de(([, o, s]) => Math.max(0, o - s)),
|
|
6376
6377
|
Nn(0),
|
|
6377
6378
|
ut()
|
|
@@ -6413,7 +6414,7 @@ const hr = Xe(
|
|
|
6413
6414
|
return N ? I && nn(
|
|
6414
6415
|
V(
|
|
6415
6416
|
i,
|
|
6416
|
-
|
|
6417
|
+
_e((B) => !B),
|
|
6417
6418
|
// skips the initial publish of false, and the cleanup call.
|
|
6418
6419
|
// but if scrollingInProgress is true, we skip the initial publish.
|
|
6419
6420
|
ir(pt(i) ? 1 : 2)
|
|
@@ -6421,7 +6422,7 @@ const hr = Xe(
|
|
|
6421
6422
|
I
|
|
6422
6423
|
) : I && I(), N;
|
|
6423
6424
|
}),
|
|
6424
|
-
|
|
6425
|
+
_e((f) => f !== null)
|
|
6425
6426
|
),
|
|
6426
6427
|
u
|
|
6427
6428
|
), {
|
|
@@ -6457,37 +6458,37 @@ const zv = (e, t) => typeof e == "function" ? lc(e(t)) : t && lc(e), Bv = Xe(
|
|
|
6457
6458
|
}
|
|
6458
6459
|
Je(
|
|
6459
6460
|
V(
|
|
6460
|
-
xt(V(
|
|
6461
|
-
ze(
|
|
6461
|
+
xt(V(Ne(t), ir(1)), l),
|
|
6462
|
+
ze(Ne(w), s, a, f),
|
|
6462
6463
|
de(([[S, C], I, E, _, O]) => {
|
|
6463
6464
|
let L = C && _, F = "auto";
|
|
6464
6465
|
return L && (F = zv(I, E || O), L = L && !!F), { followOutputBehavior: F, shouldFollow: L, totalCount: S };
|
|
6465
6466
|
}),
|
|
6466
|
-
|
|
6467
|
+
_e(({ shouldFollow: S }) => S)
|
|
6467
6468
|
),
|
|
6468
6469
|
({ followOutputBehavior: S, totalCount: C }) => {
|
|
6469
6470
|
g && (g(), g = null), pt(n) ? requestAnimationFrame(() => {
|
|
6470
|
-
pt(d)("following output to ", { totalCount: C },
|
|
6471
|
+
pt(d)("following output to ", { totalCount: C }, Mt.DEBUG), x(S);
|
|
6471
6472
|
}) : g = nn(e, () => {
|
|
6472
|
-
pt(d)("following output to ", { totalCount: C },
|
|
6473
|
+
pt(d)("following output to ", { totalCount: C }, Mt.DEBUG), x(S), g = null;
|
|
6473
6474
|
});
|
|
6474
6475
|
}
|
|
6475
6476
|
);
|
|
6476
6477
|
function y(S) {
|
|
6477
6478
|
const C = nn(o, (I) => {
|
|
6478
|
-
S && !I.atBottom && I.notAtBottomBecause === "SIZE_INCREASED" && !g && (pt(d)("scrolling to bottom due to increased size", {},
|
|
6479
|
+
S && !I.atBottom && I.notAtBottomBecause === "SIZE_INCREASED" && !g && (pt(d)("scrolling to bottom due to increased size", {}, Mt.DEBUG), x("auto"));
|
|
6479
6480
|
});
|
|
6480
6481
|
setTimeout(C, 100);
|
|
6481
6482
|
}
|
|
6482
6483
|
Je(
|
|
6483
6484
|
V(
|
|
6484
|
-
xt(
|
|
6485
|
-
|
|
6485
|
+
xt(Ne(w), t, u),
|
|
6486
|
+
_e(([S, , C]) => S && C),
|
|
6486
6487
|
mn(
|
|
6487
6488
|
({ value: S }, [, C]) => ({ refreshed: S === C, value: C }),
|
|
6488
6489
|
{ refreshed: !1, value: 0 }
|
|
6489
6490
|
),
|
|
6490
|
-
|
|
6491
|
+
_e(({ refreshed: S }) => S),
|
|
6491
6492
|
ze(w, t)
|
|
6492
6493
|
),
|
|
6493
6494
|
([, S]) => {
|
|
@@ -6495,28 +6496,28 @@ const zv = (e, t) => typeof e == "function" ? lc(e(t)) : t && lc(e), Bv = Xe(
|
|
|
6495
6496
|
}
|
|
6496
6497
|
), Je(v, () => {
|
|
6497
6498
|
y(pt(w) !== !1);
|
|
6498
|
-
}), Je(xt(
|
|
6499
|
+
}), Je(xt(Ne(w), o), ([S, C]) => {
|
|
6499
6500
|
S && !C.atBottom && C.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && x("auto");
|
|
6500
6501
|
});
|
|
6501
6502
|
const b = X(null), T = We();
|
|
6502
6503
|
return xe(
|
|
6503
6504
|
Ki(
|
|
6504
6505
|
V(
|
|
6505
|
-
|
|
6506
|
+
Ne(r),
|
|
6506
6507
|
de((S) => {
|
|
6507
6508
|
var C;
|
|
6508
6509
|
return (C = S == null ? void 0 : S.length) != null ? C : 0;
|
|
6509
6510
|
})
|
|
6510
6511
|
),
|
|
6511
|
-
V(
|
|
6512
|
+
V(Ne(t))
|
|
6512
6513
|
),
|
|
6513
6514
|
T
|
|
6514
6515
|
), Je(
|
|
6515
6516
|
V(
|
|
6516
6517
|
xt(V(T, ir(1)), l),
|
|
6517
|
-
ze(
|
|
6518
|
+
ze(Ne(b), a, f, h),
|
|
6518
6519
|
de(([[S, C], I, E, _, O]) => C && E && (I == null ? void 0 : I({ context: O, totalCount: S, scrollingInProgress: _ }))),
|
|
6519
|
-
|
|
6520
|
+
_e((S) => !!S),
|
|
6520
6521
|
Nn(0)
|
|
6521
6522
|
),
|
|
6522
6523
|
(S) => {
|
|
@@ -6544,7 +6545,7 @@ const zv = (e, t) => typeof e == "function" ? lc(e(t)) : t && lc(e), Bv = Xe(
|
|
|
6544
6545
|
V(
|
|
6545
6546
|
a,
|
|
6546
6547
|
ze(s),
|
|
6547
|
-
|
|
6548
|
+
_e(([, l]) => l !== 0),
|
|
6548
6549
|
ze(o, r, t, n, e),
|
|
6549
6550
|
de(([[, l], u, d, f, h, p = []]) => hd(l, u, d, f, h, p))
|
|
6550
6551
|
),
|
|
@@ -6559,7 +6560,7 @@ const zv = (e, t) => typeof e == "function" ? lc(e(t)) : t && lc(e), Bv = Xe(
|
|
|
6559
6560
|
V(
|
|
6560
6561
|
e,
|
|
6561
6562
|
ze(r),
|
|
6562
|
-
|
|
6563
|
+
_e(([, o]) => o !== 0),
|
|
6563
6564
|
de(([, o]) => ({ top: o }))
|
|
6564
6565
|
),
|
|
6565
6566
|
(o) => {
|
|
@@ -6567,7 +6568,7 @@ const zv = (e, t) => typeof e == "function" ? lc(e(t)) : t && lc(e), Bv = Xe(
|
|
|
6567
6568
|
V(
|
|
6568
6569
|
n,
|
|
6569
6570
|
ir(1),
|
|
6570
|
-
|
|
6571
|
+
_e((s) => s.items.length > 1)
|
|
6571
6572
|
),
|
|
6572
6573
|
() => {
|
|
6573
6574
|
requestAnimationFrame(() => {
|
|
@@ -6589,7 +6590,7 @@ const zv = (e, t) => typeof e == "function" ? lc(e(t)) : t && lc(e), Bv = Xe(
|
|
|
6589
6590
|
V(
|
|
6590
6591
|
e,
|
|
6591
6592
|
ze(r, t, n),
|
|
6592
|
-
|
|
6593
|
+
_e(([o, s]) => !!s),
|
|
6593
6594
|
de(([o, s, i, a]) => {
|
|
6594
6595
|
const { enter: l, exit: u } = s;
|
|
6595
6596
|
if (i) {
|
|
@@ -6661,11 +6662,11 @@ const zv = (e, t) => typeof e == "function" ? lc(e(t)) : t && lc(e), Bv = Xe(
|
|
|
6661
6662
|
const T = Rv(w.sizeTree);
|
|
6662
6663
|
g && x !== null && y !== null && (v = x.scrollTop - y.offsetTop), v -= b, p({ ranges: T, scrollTop: v });
|
|
6663
6664
|
}
|
|
6664
|
-
), xe(V(d,
|
|
6665
|
+
), xe(V(d, _e(Ra), de(Vv)), o), xe(
|
|
6665
6666
|
V(
|
|
6666
6667
|
s,
|
|
6667
6668
|
ze(d),
|
|
6668
|
-
|
|
6669
|
+
_e(([, p]) => p !== void 0),
|
|
6669
6670
|
ut(),
|
|
6670
6671
|
de(([, p]) => p.ranges)
|
|
6671
6672
|
),
|
|
@@ -6685,7 +6686,7 @@ const Kv = Xe(([{ topItemsIndexes: e }]) => {
|
|
|
6685
6686
|
return xe(
|
|
6686
6687
|
V(
|
|
6687
6688
|
t,
|
|
6688
|
-
|
|
6689
|
+
_e((n) => n >= 0),
|
|
6689
6690
|
de((n) => Array.from({ length: n }).map((r, o) => o))
|
|
6690
6691
|
),
|
|
6691
6692
|
e
|
|
@@ -6716,10 +6717,10 @@ const qv = vd(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
6716
6717
|
},
|
|
6717
6718
|
[0, [], 0, 0]
|
|
6718
6719
|
),
|
|
6719
|
-
|
|
6720
|
+
_e(([x]) => x !== 0),
|
|
6720
6721
|
ze(r, a, n, o, p, w),
|
|
6721
|
-
|
|
6722
|
-
de(([[x], , , , , y]) => (y("Upward scrolling compensation", { amount: x },
|
|
6722
|
+
_e(([, x, y, b, , , T]) => !T && !b && x !== 0 && y === ao),
|
|
6723
|
+
de(([[x], , , , , y]) => (y("Upward scrolling compensation", { amount: x }, Mt.DEBUG), x))
|
|
6723
6724
|
)
|
|
6724
6725
|
);
|
|
6725
6726
|
function g(x) {
|
|
@@ -6730,7 +6731,7 @@ const qv = vd(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
6730
6731
|
}), Je(
|
|
6731
6732
|
V(
|
|
6732
6733
|
xt(Rt(s, !1), e, w),
|
|
6733
|
-
|
|
6734
|
+
_e(([x, y, b]) => !x && !b && y !== 0),
|
|
6734
6735
|
de(([x, y]) => y),
|
|
6735
6736
|
Nn(1)
|
|
6736
6737
|
),
|
|
@@ -7436,7 +7437,7 @@ const bw = /* @__PURE__ */ Xe(
|
|
|
7436
7437
|
V(
|
|
7437
7438
|
w,
|
|
7438
7439
|
ze(D),
|
|
7439
|
-
|
|
7440
|
+
_e(([z, G]) => !!G)
|
|
7440
7441
|
),
|
|
7441
7442
|
() => {
|
|
7442
7443
|
Le(Y, !1);
|
|
@@ -7444,7 +7445,7 @@ const bw = /* @__PURE__ */ Xe(
|
|
|
7444
7445
|
), Je(
|
|
7445
7446
|
V(
|
|
7446
7447
|
xt(w, Y, O, _, D, j),
|
|
7447
|
-
|
|
7448
|
+
_e(([z, G, se, ce, , Z]) => z && !G && se.height !== 0 && ce.height !== 0 && !Z)
|
|
7448
7449
|
),
|
|
7449
7450
|
([, , , , z]) => {
|
|
7450
7451
|
Le(j, !0), ja(1, () => {
|
|
@@ -7456,7 +7457,7 @@ const bw = /* @__PURE__ */ Xe(
|
|
|
7456
7457
|
), xe(
|
|
7457
7458
|
V(
|
|
7458
7459
|
H,
|
|
7459
|
-
|
|
7460
|
+
_e((z) => z != null && z.scrollTop > 0),
|
|
7460
7461
|
hn(0)
|
|
7461
7462
|
),
|
|
7462
7463
|
I
|
|
@@ -7464,7 +7465,7 @@ const bw = /* @__PURE__ */ Xe(
|
|
|
7464
7465
|
V(
|
|
7465
7466
|
w,
|
|
7466
7467
|
ze(H),
|
|
7467
|
-
|
|
7468
|
+
_e(([, z]) => z != null)
|
|
7468
7469
|
),
|
|
7469
7470
|
([, z]) => {
|
|
7470
7471
|
z && (Le(_, z.viewport), Le(O, z.item), Le(B, z.gap), z.scrollTop > 0 && (Le(M, !0), nn(V(u, ir(1)), (G) => {
|
|
@@ -7480,10 +7481,10 @@ const bw = /* @__PURE__ */ Xe(
|
|
|
7480
7481
|
), xe(
|
|
7481
7482
|
V(
|
|
7482
7483
|
xt(
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7484
|
+
Ne(_, _o),
|
|
7485
|
+
Ne(O, _o),
|
|
7486
|
+
Ne(B, (z, G) => z && z.column === G.column && z.row === G.row),
|
|
7487
|
+
Ne(u)
|
|
7487
7488
|
),
|
|
7488
7489
|
de(([z, G, se, ce]) => ({
|
|
7489
7490
|
gap: se,
|
|
@@ -7496,18 +7497,18 @@ const bw = /* @__PURE__ */ Xe(
|
|
|
7496
7497
|
), xe(
|
|
7497
7498
|
V(
|
|
7498
7499
|
xt(
|
|
7499
|
-
|
|
7500
|
+
Ne(C),
|
|
7500
7501
|
r,
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7502
|
+
Ne(B, yw),
|
|
7503
|
+
Ne(O, _o),
|
|
7504
|
+
Ne(_, _o),
|
|
7505
|
+
Ne(N),
|
|
7506
|
+
Ne(I),
|
|
7507
|
+
Ne(M),
|
|
7508
|
+
Ne(Y),
|
|
7509
|
+
Ne(D)
|
|
7509
7510
|
),
|
|
7510
|
-
|
|
7511
|
+
_e(([, , , , , , , z]) => !z),
|
|
7511
7512
|
de(
|
|
7512
7513
|
([
|
|
7513
7514
|
z,
|
|
@@ -7515,24 +7516,24 @@ const bw = /* @__PURE__ */ Xe(
|
|
|
7515
7516
|
ce,
|
|
7516
7517
|
Z,
|
|
7517
7518
|
Be,
|
|
7518
|
-
|
|
7519
|
+
tt,
|
|
7519
7520
|
Ve,
|
|
7520
7521
|
,
|
|
7521
7522
|
we,
|
|
7522
7523
|
$e
|
|
7523
7524
|
]) => {
|
|
7524
|
-
const { column: Ke, row: ie } = ce, { height: vt, width:
|
|
7525
|
-
if (Ve === 0 && (z === 0 ||
|
|
7525
|
+
const { column: Ke, row: ie } = ce, { height: vt, width: ot } = Z, { width: ne } = Be;
|
|
7526
|
+
if (Ve === 0 && (z === 0 || ne === 0))
|
|
7526
7527
|
return dc;
|
|
7527
|
-
if (
|
|
7528
|
+
if (ot === 0) {
|
|
7528
7529
|
const lt = Pa($e, z), gt = lt + Math.max(Ve - 1, 0);
|
|
7529
|
-
return ww(pc(lt, gt,
|
|
7530
|
+
return ww(pc(lt, gt, tt));
|
|
7530
7531
|
}
|
|
7531
|
-
const ue = Ed(
|
|
7532
|
+
const ue = Ed(ne, ot, Ke);
|
|
7532
7533
|
let ge, Re;
|
|
7533
7534
|
we ? G === 0 && se === 0 && Ve > 0 ? (ge = 0, Re = Ve - 1) : (ge = ue * ls((G + ie) / (vt + ie)), Re = ue * fc((se + ie) / (vt + ie)) - 1, Re = bi(z - 1, Zr(Re, ue - 1)), ge = bi(Re, Zr(0, ge))) : (ge = 0, Re = -1);
|
|
7534
|
-
const Q = pc(ge, Re,
|
|
7535
|
-
return { bottom: Oe, itemHeight: vt, items: Q, itemWidth:
|
|
7535
|
+
const Q = pc(ge, Re, tt), { bottom: Oe, top: st } = mc(Be, ce, Z, Q), Fe = fc(z / ue), Ze = Fe * vt + (Fe - 1) * ie - Oe;
|
|
7536
|
+
return { bottom: Oe, itemHeight: vt, items: Q, itemWidth: ot, offsetBottom: Ze, offsetTop: st, top: st };
|
|
7536
7537
|
}
|
|
7537
7538
|
)
|
|
7538
7539
|
),
|
|
@@ -7540,14 +7541,14 @@ const bw = /* @__PURE__ */ Xe(
|
|
|
7540
7541
|
), xe(
|
|
7541
7542
|
V(
|
|
7542
7543
|
N,
|
|
7543
|
-
|
|
7544
|
+
_e((z) => z !== null),
|
|
7544
7545
|
de((z) => z.length)
|
|
7545
7546
|
),
|
|
7546
7547
|
C
|
|
7547
7548
|
), xe(
|
|
7548
7549
|
V(
|
|
7549
7550
|
xt(_, O, E, B),
|
|
7550
|
-
|
|
7551
|
+
_e(([z, G, { items: se }]) => se.length > 0 && G.height !== 0 && z.height !== 0),
|
|
7551
7552
|
de(([z, G, { items: se }, ce]) => {
|
|
7552
7553
|
const { bottom: Z, top: Be } = mc(z, ce, G, se);
|
|
7553
7554
|
return [Be, Z];
|
|
@@ -7568,27 +7569,27 @@ const bw = /* @__PURE__ */ Xe(
|
|
|
7568
7569
|
const ve = Ht(
|
|
7569
7570
|
V(
|
|
7570
7571
|
xt(E, C),
|
|
7571
|
-
|
|
7572
|
+
_e(([{ items: z }]) => z.length > 0),
|
|
7572
7573
|
ze(fe),
|
|
7573
|
-
|
|
7574
|
+
_e(([[z, G], se]) => {
|
|
7574
7575
|
const ce = z.items[z.items.length - 1].index === G - 1;
|
|
7575
7576
|
return (se || z.bottom > 0 && z.itemHeight > 0 && z.offsetBottom === 0 && z.items.length === G) && ce;
|
|
7576
7577
|
}),
|
|
7577
7578
|
de(([[, z]]) => z - 1),
|
|
7578
7579
|
ut()
|
|
7579
7580
|
)
|
|
7580
|
-
),
|
|
7581
|
+
), be = Ht(
|
|
7581
7582
|
V(
|
|
7582
|
-
|
|
7583
|
-
|
|
7583
|
+
Ne(E),
|
|
7584
|
+
_e(({ items: z }) => z.length > 0 && z[0].index === 0),
|
|
7584
7585
|
hn(0),
|
|
7585
7586
|
ut()
|
|
7586
7587
|
)
|
|
7587
7588
|
), Te = Ht(
|
|
7588
7589
|
V(
|
|
7589
|
-
|
|
7590
|
+
Ne(E),
|
|
7590
7591
|
ze(M),
|
|
7591
|
-
|
|
7592
|
+
_e(([{ items: z }, G]) => z.length > 0 && !G),
|
|
7592
7593
|
de(([{ items: z }]) => ({
|
|
7593
7594
|
endIndex: z[z.length - 1].index,
|
|
7594
7595
|
startIndex: z[0].index
|
|
@@ -7602,11 +7603,11 @@ const bw = /* @__PURE__ */ Xe(
|
|
|
7602
7603
|
L,
|
|
7603
7604
|
ze(_, O, C, B),
|
|
7604
7605
|
de(([z, G, se, ce, Z]) => {
|
|
7605
|
-
const Be = dd(z), { align:
|
|
7606
|
+
const Be = dd(z), { align: tt, behavior: Ve, offset: we } = Be;
|
|
7606
7607
|
let $e = Be.index;
|
|
7607
7608
|
$e === "LAST" && ($e = ce - 1), $e = Zr(0, $e, bi(ce - 1, $e));
|
|
7608
7609
|
let Ke = Ji(G, Z, se, $e);
|
|
7609
|
-
return
|
|
7610
|
+
return tt === "end" ? Ke = hc(Ke - G.height + se.height) : tt === "center" && (Ke = hc(Ke - G.height / 2 + se.height / 2)), we && (Ke += we), { behavior: Ve, top: Ke };
|
|
7610
7611
|
})
|
|
7611
7612
|
),
|
|
7612
7613
|
l
|
|
@@ -7660,7 +7661,7 @@ const bw = /* @__PURE__ */ Xe(
|
|
|
7660
7661
|
endReached: ve,
|
|
7661
7662
|
propsReady: v,
|
|
7662
7663
|
rangeChanged: Te,
|
|
7663
|
-
startReached:
|
|
7664
|
+
startReached: be,
|
|
7664
7665
|
stateChanged: $,
|
|
7665
7666
|
stateRestoreInProgress: M,
|
|
7666
7667
|
...S
|
|
@@ -7691,7 +7692,7 @@ const Sw = /* @__PURE__ */ Xe(() => {
|
|
|
7691
7692
|
),
|
|
7692
7693
|
h
|
|
7693
7694
|
), u = X(!1), d = X(!1);
|
|
7694
|
-
return xe(
|
|
7695
|
+
return xe(Ne(d), u), {
|
|
7695
7696
|
components: t,
|
|
7696
7697
|
computeItemKey: s,
|
|
7697
7698
|
context: n,
|
|
@@ -7864,7 +7865,7 @@ const Sw = /* @__PURE__ */ Xe(() => {
|
|
|
7864
7865
|
Nw
|
|
7865
7866
|
), Aw = /* @__PURE__ */ Id({ useEmitter: Nd, useEmitterValue: ft, usePublisher: Jt }), _w = /* @__PURE__ */ Rd({ useEmitter: Nd, useEmitterValue: ft, usePublisher: Jt });
|
|
7866
7867
|
function gc(e, t, n) {
|
|
7867
|
-
return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t,
|
|
7868
|
+
return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t, Mt.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
|
|
7868
7869
|
}
|
|
7869
7870
|
const jw = Cs(
|
|
7870
7871
|
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
@@ -8332,7 +8333,7 @@ function $d(e) {
|
|
|
8332
8333
|
return e.replace(Qw, (t, n) => (n = n.toLowerCase(), n === "colon" ? ":" : n.charAt(0) === "#" ? n.charAt(1) === "x" ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1)) : ""));
|
|
8333
8334
|
}
|
|
8334
8335
|
const ey = /(^|[^\[])\^/g;
|
|
8335
|
-
function
|
|
8336
|
+
function rt(e, t) {
|
|
8336
8337
|
e = typeof e == "string" ? e : e.source, t = t || "";
|
|
8337
8338
|
const n = {
|
|
8338
8339
|
replace: (r, o) => (o = o.source || o, o = o.replace(ey, "$1"), e = e.replace(r, o), n),
|
|
@@ -8875,7 +8876,7 @@ class Ua {
|
|
|
8875
8876
|
}
|
|
8876
8877
|
}
|
|
8877
8878
|
}
|
|
8878
|
-
const
|
|
8879
|
+
const Ce = {
|
|
8879
8880
|
newline: /^(?: *(?:\n|$))+/,
|
|
8880
8881
|
code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
|
|
8881
8882
|
fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
|
@@ -8892,37 +8893,37 @@ const Se = {
|
|
|
8892
8893
|
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
|
8893
8894
|
text: /^[^\n]+/
|
|
8894
8895
|
};
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
...
|
|
8896
|
+
Ce._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
8897
|
+
Ce._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
|
8898
|
+
Ce.def = rt(Ce.def).replace("label", Ce._label).replace("title", Ce._title).getRegex();
|
|
8899
|
+
Ce.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
8900
|
+
Ce.listItemStart = rt(/^( *)(bull) */).replace("bull", Ce.bullet).getRegex();
|
|
8901
|
+
Ce.list = rt(Ce.list).replace(/bull/g, Ce.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + Ce.def.source + ")").getRegex();
|
|
8902
|
+
Ce._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
8903
|
+
Ce._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
|
8904
|
+
Ce.html = rt(Ce.html, "i").replace("comment", Ce._comment).replace("tag", Ce._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
8905
|
+
Ce.paragraph = rt(Ce._paragraph).replace("hr", Ce.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ce._tag).getRegex();
|
|
8906
|
+
Ce.blockquote = rt(Ce.blockquote).replace("paragraph", Ce.paragraph).getRegex();
|
|
8907
|
+
Ce.normal = { ...Ce };
|
|
8908
|
+
Ce.gfm = {
|
|
8909
|
+
...Ce.normal,
|
|
8909
8910
|
table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
|
|
8910
8911
|
// Cells
|
|
8911
8912
|
};
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
...
|
|
8916
|
-
html:
|
|
8913
|
+
Ce.gfm.table = rt(Ce.gfm.table).replace("hr", Ce.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ce._tag).getRegex();
|
|
8914
|
+
Ce.gfm.paragraph = rt(Ce._paragraph).replace("hr", Ce.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", Ce.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ce._tag).getRegex();
|
|
8915
|
+
Ce.pedantic = {
|
|
8916
|
+
...Ce.normal,
|
|
8917
|
+
html: rt(
|
|
8917
8918
|
`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
|
|
8918
|
-
).replace("comment",
|
|
8919
|
+
).replace("comment", Ce._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
8919
8920
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
8920
8921
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
8921
8922
|
fences: cs,
|
|
8922
8923
|
// fences not supported
|
|
8923
8924
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
8924
|
-
paragraph:
|
|
8925
|
-
]`).replace("lheading",
|
|
8925
|
+
paragraph: rt(Ce.normal._paragraph).replace("hr", Ce.hr).replace("heading", ` *#{1,6} *[^
|
|
8926
|
+
]`).replace("lheading", Ce.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
|
|
8926
8927
|
};
|
|
8927
8928
|
const he = {
|
|
8928
8929
|
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
|
@@ -8949,26 +8950,26 @@ const he = {
|
|
|
8949
8950
|
punctuation: /^([\spunctuation])/
|
|
8950
8951
|
};
|
|
8951
8952
|
he._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
|
|
8952
|
-
he.punctuation =
|
|
8953
|
+
he.punctuation = rt(he.punctuation).replace(/punctuation/g, he._punctuation).getRegex();
|
|
8953
8954
|
he.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
|
|
8954
8955
|
he.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
|
|
8955
|
-
he._comment =
|
|
8956
|
-
he.emStrong.lDelim =
|
|
8957
|
-
he.emStrong.rDelimAst =
|
|
8958
|
-
he.emStrong.rDelimUnd =
|
|
8956
|
+
he._comment = rt(Ce._comment).replace("(?:-->|$)", "-->").getRegex();
|
|
8957
|
+
he.emStrong.lDelim = rt(he.emStrong.lDelim).replace(/punct/g, he._punctuation).getRegex();
|
|
8958
|
+
he.emStrong.rDelimAst = rt(he.emStrong.rDelimAst, "g").replace(/punct/g, he._punctuation).getRegex();
|
|
8959
|
+
he.emStrong.rDelimUnd = rt(he.emStrong.rDelimUnd, "g").replace(/punct/g, he._punctuation).getRegex();
|
|
8959
8960
|
he._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
|
8960
8961
|
he._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
|
8961
8962
|
he._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
|
|
8962
|
-
he.autolink =
|
|
8963
|
+
he.autolink = rt(he.autolink).replace("scheme", he._scheme).replace("email", he._email).getRegex();
|
|
8963
8964
|
he._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
|
8964
|
-
he.tag =
|
|
8965
|
+
he.tag = rt(he.tag).replace("comment", he._comment).replace("attribute", he._attribute).getRegex();
|
|
8965
8966
|
he._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
8966
8967
|
he._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
|
|
8967
8968
|
he._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
|
8968
|
-
he.link =
|
|
8969
|
-
he.reflink =
|
|
8970
|
-
he.nolink =
|
|
8971
|
-
he.reflinkSearch =
|
|
8969
|
+
he.link = rt(he.link).replace("label", he._label).replace("href", he._href).replace("title", he._title).getRegex();
|
|
8970
|
+
he.reflink = rt(he.reflink).replace("label", he._label).replace("ref", Ce._label).getRegex();
|
|
8971
|
+
he.nolink = rt(he.nolink).replace("ref", Ce._label).getRegex();
|
|
8972
|
+
he.reflinkSearch = rt(he.reflinkSearch, "g").replace("reflink", he.reflink).replace("nolink", he.nolink).getRegex();
|
|
8972
8973
|
he.normal = { ...he };
|
|
8973
8974
|
he.pedantic = {
|
|
8974
8975
|
...he.normal,
|
|
@@ -8984,23 +8985,23 @@ he.pedantic = {
|
|
|
8984
8985
|
endAst: /\*(?!\*)/g,
|
|
8985
8986
|
endUnd: /_(?!_)/g
|
|
8986
8987
|
},
|
|
8987
|
-
link:
|
|
8988
|
-
reflink:
|
|
8988
|
+
link: rt(/^!?\[(label)\]\((.*?)\)/).replace("label", he._label).getRegex(),
|
|
8989
|
+
reflink: rt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", he._label).getRegex()
|
|
8989
8990
|
};
|
|
8990
8991
|
he.gfm = {
|
|
8991
8992
|
...he.normal,
|
|
8992
|
-
escape:
|
|
8993
|
+
escape: rt(he.escape).replace("])", "~|])").getRegex(),
|
|
8993
8994
|
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
|
8994
8995
|
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
|
8995
8996
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
8996
8997
|
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
8997
8998
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
8998
8999
|
};
|
|
8999
|
-
he.gfm.url =
|
|
9000
|
+
he.gfm.url = rt(he.gfm.url, "i").replace("email", he.gfm._extended_email).getRegex();
|
|
9000
9001
|
he.breaks = {
|
|
9001
9002
|
...he.gfm,
|
|
9002
|
-
br:
|
|
9003
|
-
text:
|
|
9003
|
+
br: rt(he.br).replace("{2,}", "*").getRegex(),
|
|
9004
|
+
text: rt(he.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
9004
9005
|
};
|
|
9005
9006
|
function uy(e) {
|
|
9006
9007
|
return e.replace(/---/g, "—").replace(/--/g, "–").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1‘").replace(/'/g, "’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1“").replace(/"/g, "”").replace(/\.{3}/g, "…");
|
|
@@ -9020,17 +9021,17 @@ class Fn {
|
|
|
9020
9021
|
top: !0
|
|
9021
9022
|
};
|
|
9022
9023
|
const n = {
|
|
9023
|
-
block:
|
|
9024
|
+
block: Ce.normal,
|
|
9024
9025
|
inline: he.normal
|
|
9025
9026
|
};
|
|
9026
|
-
this.options.pedantic ? (n.block =
|
|
9027
|
+
this.options.pedantic ? (n.block = Ce.pedantic, n.inline = he.pedantic) : this.options.gfm && (n.block = Ce.gfm, this.options.breaks ? n.inline = he.breaks : n.inline = he.gfm), this.tokenizer.rules = n;
|
|
9027
9028
|
}
|
|
9028
9029
|
/**
|
|
9029
9030
|
* Expose Rules
|
|
9030
9031
|
*/
|
|
9031
9032
|
static get rules() {
|
|
9032
9033
|
return {
|
|
9033
|
-
block:
|
|
9034
|
+
block: Ce,
|
|
9034
9035
|
inline: he
|
|
9035
9036
|
};
|
|
9036
9037
|
}
|
|
@@ -9666,7 +9667,7 @@ function Hd(e, t) {
|
|
|
9666
9667
|
return (n, r, o) => {
|
|
9667
9668
|
typeof r == "function" && (o = r, r = null);
|
|
9668
9669
|
const s = { ...r };
|
|
9669
|
-
r = { ...
|
|
9670
|
+
r = { ...Se.defaults, ...s };
|
|
9670
9671
|
const i = dy(r.silent, r.async, o);
|
|
9671
9672
|
if (typeof n > "u" || n === null)
|
|
9672
9673
|
return i(new Error("marked(): input parameter is undefined or null"));
|
|
@@ -9684,7 +9685,7 @@ function Hd(e, t) {
|
|
|
9684
9685
|
let h;
|
|
9685
9686
|
if (!f)
|
|
9686
9687
|
try {
|
|
9687
|
-
r.walkTokens &&
|
|
9688
|
+
r.walkTokens && Se.walkTokens(l, r.walkTokens), h = t(l, r), r.hooks && (h = r.hooks.postprocess(h));
|
|
9688
9689
|
} catch (p) {
|
|
9689
9690
|
f = p;
|
|
9690
9691
|
}
|
|
@@ -9692,7 +9693,7 @@ function Hd(e, t) {
|
|
|
9692
9693
|
};
|
|
9693
9694
|
if (!a || a.length < 3 || (delete r.highlight, !l.length)) return u();
|
|
9694
9695
|
let d = 0;
|
|
9695
|
-
|
|
9696
|
+
Se.walkTokens(l, function(f) {
|
|
9696
9697
|
f.type === "code" && (d++, setTimeout(() => {
|
|
9697
9698
|
a(f.text, f.lang, function(h, p) {
|
|
9698
9699
|
if (h)
|
|
@@ -9704,11 +9705,11 @@ function Hd(e, t) {
|
|
|
9704
9705
|
return;
|
|
9705
9706
|
}
|
|
9706
9707
|
if (r.async)
|
|
9707
|
-
return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((a) => e(a, r)).then((a) => r.walkTokens ? Promise.all(
|
|
9708
|
+
return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((a) => e(a, r)).then((a) => r.walkTokens ? Promise.all(Se.walkTokens(a, r.walkTokens)).then(() => a) : a).then((a) => t(a, r)).then((a) => r.hooks ? r.hooks.postprocess(a) : a).catch(i);
|
|
9708
9709
|
try {
|
|
9709
9710
|
r.hooks && (n = r.hooks.preprocess(n));
|
|
9710
9711
|
const a = e(n, r);
|
|
9711
|
-
r.walkTokens &&
|
|
9712
|
+
r.walkTokens && Se.walkTokens(a, r.walkTokens);
|
|
9712
9713
|
let l = t(a, r);
|
|
9713
9714
|
return r.hooks && (l = r.hooks.postprocess(l)), l;
|
|
9714
9715
|
} catch (a) {
|
|
@@ -9716,19 +9717,19 @@ function Hd(e, t) {
|
|
|
9716
9717
|
}
|
|
9717
9718
|
};
|
|
9718
9719
|
}
|
|
9719
|
-
function
|
|
9720
|
+
function Se(e, t, n) {
|
|
9720
9721
|
return Hd(Fn.lex, $n.parse)(e, t, n);
|
|
9721
9722
|
}
|
|
9722
|
-
|
|
9723
|
-
return
|
|
9723
|
+
Se.options = Se.setOptions = function(e) {
|
|
9724
|
+
return Se.defaults = { ...Se.defaults, ...e }, Yw(Se.defaults), Se;
|
|
9724
9725
|
};
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
const t =
|
|
9726
|
+
Se.getDefaults = Dd;
|
|
9727
|
+
Se.defaults = pr;
|
|
9728
|
+
Se.use = function(...e) {
|
|
9729
|
+
const t = Se.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
9729
9730
|
e.forEach((n) => {
|
|
9730
9731
|
const r = { ...n };
|
|
9731
|
-
if (r.async =
|
|
9732
|
+
if (r.async = Se.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((o) => {
|
|
9732
9733
|
if (!o.name)
|
|
9733
9734
|
throw new Error("extension name required");
|
|
9734
9735
|
if (o.renderer) {
|
|
@@ -9745,7 +9746,7 @@ be.use = function(...e) {
|
|
|
9745
9746
|
}
|
|
9746
9747
|
o.childTokens && (t.childTokens[o.name] = o.childTokens);
|
|
9747
9748
|
}), r.extensions = t), n.renderer) {
|
|
9748
|
-
const o =
|
|
9749
|
+
const o = Se.defaults.renderer || new Wa();
|
|
9749
9750
|
for (const s in n.renderer) {
|
|
9750
9751
|
const i = o[s];
|
|
9751
9752
|
o[s] = (...a) => {
|
|
@@ -9756,7 +9757,7 @@ be.use = function(...e) {
|
|
|
9756
9757
|
r.renderer = o;
|
|
9757
9758
|
}
|
|
9758
9759
|
if (n.tokenizer) {
|
|
9759
|
-
const o =
|
|
9760
|
+
const o = Se.defaults.tokenizer || new Ua();
|
|
9760
9761
|
for (const s in n.tokenizer) {
|
|
9761
9762
|
const i = o[s];
|
|
9762
9763
|
o[s] = (...a) => {
|
|
@@ -9767,11 +9768,11 @@ be.use = function(...e) {
|
|
|
9767
9768
|
r.tokenizer = o;
|
|
9768
9769
|
}
|
|
9769
9770
|
if (n.hooks) {
|
|
9770
|
-
const o =
|
|
9771
|
+
const o = Se.defaults.hooks || new us();
|
|
9771
9772
|
for (const s in n.hooks) {
|
|
9772
9773
|
const i = o[s];
|
|
9773
9774
|
us.passThroughHooks.has(s) ? o[s] = (a) => {
|
|
9774
|
-
if (
|
|
9775
|
+
if (Se.defaults.async)
|
|
9775
9776
|
return Promise.resolve(n.hooks[s].call(o, a)).then((u) => i.call(o, u));
|
|
9776
9777
|
const l = n.hooks[s].call(o, a);
|
|
9777
9778
|
return i.call(o, l);
|
|
@@ -9783,54 +9784,54 @@ be.use = function(...e) {
|
|
|
9783
9784
|
r.hooks = o;
|
|
9784
9785
|
}
|
|
9785
9786
|
if (n.walkTokens) {
|
|
9786
|
-
const o =
|
|
9787
|
+
const o = Se.defaults.walkTokens;
|
|
9787
9788
|
r.walkTokens = function(s) {
|
|
9788
9789
|
let i = [];
|
|
9789
9790
|
return i.push(n.walkTokens.call(this, s)), o && (i = i.concat(o.call(this, s))), i;
|
|
9790
9791
|
};
|
|
9791
9792
|
}
|
|
9792
|
-
|
|
9793
|
+
Se.setOptions(r);
|
|
9793
9794
|
});
|
|
9794
9795
|
};
|
|
9795
|
-
|
|
9796
|
+
Se.walkTokens = function(e, t) {
|
|
9796
9797
|
let n = [];
|
|
9797
9798
|
for (const r of e)
|
|
9798
|
-
switch (n = n.concat(t.call(
|
|
9799
|
+
switch (n = n.concat(t.call(Se, r)), r.type) {
|
|
9799
9800
|
case "table": {
|
|
9800
9801
|
for (const o of r.header)
|
|
9801
|
-
n = n.concat(
|
|
9802
|
+
n = n.concat(Se.walkTokens(o.tokens, t));
|
|
9802
9803
|
for (const o of r.rows)
|
|
9803
9804
|
for (const s of o)
|
|
9804
|
-
n = n.concat(
|
|
9805
|
+
n = n.concat(Se.walkTokens(s.tokens, t));
|
|
9805
9806
|
break;
|
|
9806
9807
|
}
|
|
9807
9808
|
case "list": {
|
|
9808
|
-
n = n.concat(
|
|
9809
|
+
n = n.concat(Se.walkTokens(r.items, t));
|
|
9809
9810
|
break;
|
|
9810
9811
|
}
|
|
9811
9812
|
default:
|
|
9812
|
-
|
|
9813
|
-
n = n.concat(
|
|
9814
|
-
}) : r.tokens && (n = n.concat(
|
|
9813
|
+
Se.defaults.extensions && Se.defaults.extensions.childTokens && Se.defaults.extensions.childTokens[r.type] ? Se.defaults.extensions.childTokens[r.type].forEach(function(o) {
|
|
9814
|
+
n = n.concat(Se.walkTokens(r[o], t));
|
|
9815
|
+
}) : r.tokens && (n = n.concat(Se.walkTokens(r.tokens, t)));
|
|
9815
9816
|
}
|
|
9816
9817
|
return n;
|
|
9817
9818
|
};
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9819
|
+
Se.parseInline = Hd(Fn.lexInline, $n.parseInline);
|
|
9820
|
+
Se.Parser = $n;
|
|
9821
|
+
Se.parser = $n.parse;
|
|
9822
|
+
Se.Renderer = Wa;
|
|
9823
|
+
Se.TextRenderer = zd;
|
|
9824
|
+
Se.Lexer = Fn;
|
|
9825
|
+
Se.lexer = Fn.lex;
|
|
9826
|
+
Se.Tokenizer = Ua;
|
|
9827
|
+
Se.Slugger = Bd;
|
|
9828
|
+
Se.Hooks = us;
|
|
9829
|
+
Se.parse = Se;
|
|
9830
|
+
Se.options;
|
|
9831
|
+
Se.setOptions;
|
|
9832
|
+
Se.use;
|
|
9833
|
+
Se.walkTokens;
|
|
9834
|
+
Se.parseInline;
|
|
9834
9835
|
$n.parse;
|
|
9835
9836
|
Fn.lex;
|
|
9836
9837
|
function Ic({
|
|
@@ -9843,9 +9844,9 @@ function Ic({
|
|
|
9843
9844
|
try {
|
|
9844
9845
|
if (!n) {
|
|
9845
9846
|
const i = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
|
|
9846
|
-
return
|
|
9847
|
+
return Se.parse(i);
|
|
9847
9848
|
}
|
|
9848
|
-
return
|
|
9849
|
+
return Se.parse(e);
|
|
9849
9850
|
} catch (i) {
|
|
9850
9851
|
return console.error("[MarkdownContent] parse error", i), `<pre>Error rendering markdown: ${String(i)}</pre>`;
|
|
9851
9852
|
}
|
|
@@ -11453,19 +11454,19 @@ const Bb = q.memo(function({
|
|
|
11453
11454
|
return "text-[hsl(var(--chat-bubble-ai-text))]";
|
|
11454
11455
|
}
|
|
11455
11456
|
}, [M]), J = ht(() => Ob(t.content), [t.content]), fe = ht(() => Mb(t.content), [t.content]), ve = ht(
|
|
11456
|
-
() => t.content.filter((
|
|
11457
|
+
() => t.content.filter((ne) => ne.type === "image_url"),
|
|
11457
11458
|
[t.content]
|
|
11458
|
-
),
|
|
11459
|
-
() => t.content.filter((
|
|
11459
|
+
), be = ht(
|
|
11460
|
+
() => t.content.filter((ne) => ne.type === "file"),
|
|
11460
11461
|
[t.content]
|
|
11461
11462
|
), Te = ht(
|
|
11462
|
-
() => t.content.filter((
|
|
11463
|
+
() => t.content.filter((ne) => ne.type === "interrupt"),
|
|
11463
11464
|
[t.content]
|
|
11464
11465
|
), U = ht(() => Lb(t.content), [t.content]);
|
|
11465
11466
|
ht(() => Fb(t.content), [t.content]);
|
|
11466
11467
|
const z = ht(() => U.length <= Zn ? U : `${U.slice(0, Zn)}
|
|
11467
|
-
… [truncated ${U.length - Zn} chars]`, [U]), G = q.useCallback(async (
|
|
11468
|
-
const ge =
|
|
11468
|
+
… [truncated ${U.length - Zn} chars]`, [U]), G = q.useCallback(async (ne = "all") => {
|
|
11469
|
+
const ge = ne === "visible" && D ? z : D ? U : J;
|
|
11469
11470
|
async function Re(Q) {
|
|
11470
11471
|
try {
|
|
11471
11472
|
await navigator.clipboard.writeText(Q);
|
|
@@ -11485,30 +11486,30 @@ const Bb = q.memo(function({
|
|
|
11485
11486
|
}
|
|
11486
11487
|
}, [D, U, J, z, x]), se = q.useCallback(() => {
|
|
11487
11488
|
if (!w) return;
|
|
11488
|
-
const
|
|
11489
|
-
w(t.id,
|
|
11489
|
+
const ne = D ? U : J;
|
|
11490
|
+
w(t.id, ne);
|
|
11490
11491
|
}, [w, t.id, D, U, J]), ce = q.useCallback(() => {
|
|
11491
11492
|
v == null || v(n);
|
|
11492
|
-
}, [v, n]), Z = q.useCallback(async (
|
|
11493
|
+
}, [v, n]), Z = q.useCallback(async (ne, ue, ge) => {
|
|
11493
11494
|
if (!Y) {
|
|
11494
|
-
|
|
11495
|
+
ne.preventDefault();
|
|
11495
11496
|
return;
|
|
11496
11497
|
}
|
|
11497
11498
|
if (L[ge]) {
|
|
11498
|
-
|
|
11499
|
+
ne.preventDefault();
|
|
11499
11500
|
return;
|
|
11500
11501
|
}
|
|
11501
11502
|
try {
|
|
11502
11503
|
const Re = String(ue.url ?? ""), Q = Re.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
11503
11504
|
if (Q) {
|
|
11504
|
-
|
|
11505
|
-
const Oe = Q[1],
|
|
11506
|
-
$({ id: Oe, name:
|
|
11505
|
+
ne.preventDefault();
|
|
11506
|
+
const Oe = Q[1], st = ue.name || `file_${Oe}`, Fe = ue.mimeType || "application/octet-stream";
|
|
11507
|
+
$({ id: Oe, name: st, mimeType: Fe }), N(!0);
|
|
11507
11508
|
return;
|
|
11508
11509
|
}
|
|
11509
11510
|
if (Re.startsWith("data:")) {
|
|
11510
|
-
|
|
11511
|
-
const Oe = `${ue.name}_${ue.size}_${Date.now()}`,
|
|
11511
|
+
ne.preventDefault(), F((Fe) => ({ ...Fe, [ge]: !0 }));
|
|
11512
|
+
const Oe = `${ue.name}_${ue.size}_${Date.now()}`, st = O({ title: "Fetching file...", description: "", open: !0 });
|
|
11512
11513
|
try {
|
|
11513
11514
|
const Fe = await hy(E ?? void 0);
|
|
11514
11515
|
if (!Fe || !Array.isArray(Fe))
|
|
@@ -11522,11 +11523,11 @@ const Bb = q.memo(function({
|
|
|
11522
11523
|
id: Ze.id,
|
|
11523
11524
|
name: ue.name || Ze.filename || `file_${Ze.id}`,
|
|
11524
11525
|
mimeType: ue.mimeType || Ze.mime_type || "application/octet-stream"
|
|
11525
|
-
}), N(!0),
|
|
11526
|
+
}), N(!0), st.update({ id: st.id, title: "Success", description: `Opened ${ue.name}`, open: !0 });
|
|
11526
11527
|
} catch (Fe) {
|
|
11527
11528
|
console.error("Failed to fetch server file:", Fe);
|
|
11528
11529
|
const Ze = Fe instanceof Error ? Fe.message : "Unknown error occurred";
|
|
11529
|
-
|
|
11530
|
+
st.update({ id: st.id, title: "Failed", description: Ze }), O({
|
|
11530
11531
|
title: "Failed to fetch file",
|
|
11531
11532
|
description: Ze,
|
|
11532
11533
|
open: !0
|
|
@@ -11550,75 +11551,75 @@ const Bb = q.memo(function({
|
|
|
11550
11551
|
default:
|
|
11551
11552
|
return /* @__PURE__ */ c.jsx(bl, { className: ue });
|
|
11552
11553
|
}
|
|
11553
|
-
}, [H, j, M]),
|
|
11554
|
-
const
|
|
11554
|
+
}, [H, j, M]), tt = q.useCallback(() => {
|
|
11555
|
+
const ne = "group relative mb-4 flex w-full";
|
|
11555
11556
|
switch (M) {
|
|
11556
11557
|
case "user":
|
|
11557
|
-
return re(
|
|
11558
|
+
return re(ne, "justify-end");
|
|
11558
11559
|
case "assistant":
|
|
11559
11560
|
case "tool":
|
|
11560
11561
|
case "system":
|
|
11561
|
-
return re(
|
|
11562
|
+
return re(ne, "justify-start");
|
|
11562
11563
|
default:
|
|
11563
|
-
return
|
|
11564
|
+
return ne;
|
|
11564
11565
|
}
|
|
11565
11566
|
}, [M]), Ve = q.useCallback(() => {
|
|
11566
|
-
const
|
|
11567
|
+
const ne = re(
|
|
11567
11568
|
"rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
|
|
11568
11569
|
H && "px-3 py-2 text-sm"
|
|
11569
11570
|
);
|
|
11570
11571
|
switch (M) {
|
|
11571
11572
|
case "user":
|
|
11572
11573
|
return re(
|
|
11573
|
-
|
|
11574
|
+
ne,
|
|
11574
11575
|
"w-full md:max-w-[95%]",
|
|
11575
11576
|
"bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
|
|
11576
11577
|
"border border-transparent"
|
|
11577
11578
|
);
|
|
11578
11579
|
case "assistant":
|
|
11579
11580
|
return re(
|
|
11580
|
-
|
|
11581
|
+
ne,
|
|
11581
11582
|
"w-full md:max-w-[95%]",
|
|
11582
11583
|
"bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
|
|
11583
11584
|
"border border-border/60 dark:border-border/40"
|
|
11584
11585
|
);
|
|
11585
11586
|
case "tool":
|
|
11586
|
-
return re(
|
|
11587
|
+
return re(ne, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
|
|
11587
11588
|
case "system":
|
|
11588
|
-
return re(
|
|
11589
|
+
return re(ne, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
|
|
11589
11590
|
default:
|
|
11590
11591
|
return re(
|
|
11591
|
-
|
|
11592
|
+
ne,
|
|
11592
11593
|
"w-full md:max-w-[95%]",
|
|
11593
11594
|
"bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
|
|
11594
11595
|
"border border-border/60 dark:border-border/40"
|
|
11595
11596
|
);
|
|
11596
11597
|
}
|
|
11597
|
-
}, [H, M]), we = q.useCallback(async (
|
|
11598
|
+
}, [H, M]), we = q.useCallback(async (ne) => {
|
|
11598
11599
|
try {
|
|
11599
|
-
const ue = (
|
|
11600
|
+
const ue = (ne == null ? void 0 : ne.id) || (ne == null ? void 0 : ne.interrupt_id);
|
|
11600
11601
|
if (!ue) {
|
|
11601
|
-
console.warn("Interrupt part missing id",
|
|
11602
|
+
console.warn("Interrupt part missing id", ne);
|
|
11602
11603
|
return;
|
|
11603
11604
|
}
|
|
11604
11605
|
await _(ue, !0);
|
|
11605
11606
|
} catch (ue) {
|
|
11606
11607
|
console.error("Failed to approve interrupt:", ue);
|
|
11607
11608
|
}
|
|
11608
|
-
}, [_]), $e = q.useCallback(async (
|
|
11609
|
+
}, [_]), $e = q.useCallback(async (ne) => {
|
|
11609
11610
|
try {
|
|
11610
|
-
const ue = (
|
|
11611
|
+
const ue = (ne == null ? void 0 : ne.id) || (ne == null ? void 0 : ne.interrupt_id);
|
|
11611
11612
|
if (!ue) {
|
|
11612
|
-
console.warn("Interrupt part missing id",
|
|
11613
|
+
console.warn("Interrupt part missing id", ne);
|
|
11613
11614
|
return;
|
|
11614
11615
|
}
|
|
11615
11616
|
await _(ue, !1);
|
|
11616
11617
|
} catch (ue) {
|
|
11617
11618
|
console.error("Failed to reject interrupt:", ue);
|
|
11618
11619
|
}
|
|
11619
|
-
}, [_]), Ke = q.useCallback(({ part:
|
|
11620
|
-
if (
|
|
11621
|
-
const ge =
|
|
11620
|
+
}, [_]), Ke = q.useCallback(({ part: ne, i: ue }) => {
|
|
11621
|
+
if (ne.type === "text") {
|
|
11622
|
+
const ge = ne.text ?? "", Re = ge.trim(), Q = Bc(Re);
|
|
11622
11623
|
return Q && M !== "tool" ? /* @__PURE__ */ c.jsx(Hb, { data: Q }, ue) : M === "user" && f && Re.length > h ? /* @__PURE__ */ c.jsxs(vc, { open: C, onOpenChange: I, children: [
|
|
11623
11624
|
/* @__PURE__ */ c.jsx("div", { className: re("text-sm text-[hsl(var(--chat-bubble-user-text))]", H && "text-xs"), children: C ? /* @__PURE__ */ c.jsx(Ic, { content: Re, 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: [
|
|
11624
11625
|
Re.substring(0, h),
|
|
@@ -11643,8 +11644,8 @@ const Bb = q.memo(function({
|
|
|
11643
11644
|
) })
|
|
11644
11645
|
] }, ue) : /* @__PURE__ */ c.jsx(Ic, { content: ge, allowHtml: !1 }, ue);
|
|
11645
11646
|
}
|
|
11646
|
-
if (
|
|
11647
|
-
const ge =
|
|
11647
|
+
if (ne.type === "image_url") {
|
|
11648
|
+
const ge = ne;
|
|
11648
11649
|
return /* @__PURE__ */ c.jsx("div", { className: "my-2", children: /* @__PURE__ */ c.jsx(
|
|
11649
11650
|
"img",
|
|
11650
11651
|
{
|
|
@@ -11655,8 +11656,8 @@ const Bb = q.memo(function({
|
|
|
11655
11656
|
}
|
|
11656
11657
|
) }, ue);
|
|
11657
11658
|
}
|
|
11658
|
-
if (
|
|
11659
|
-
const ge =
|
|
11659
|
+
if (ne.type === "file") {
|
|
11660
|
+
const ge = ne, Re = ge.name || "file";
|
|
11660
11661
|
return /* @__PURE__ */ c.jsxs(
|
|
11661
11662
|
"a",
|
|
11662
11663
|
{
|
|
@@ -11675,10 +11676,10 @@ const Bb = q.memo(function({
|
|
|
11675
11676
|
ue
|
|
11676
11677
|
);
|
|
11677
11678
|
}
|
|
11678
|
-
return
|
|
11679
|
+
return ne.type === "interrupt" ? /* @__PURE__ */ c.jsx(
|
|
11679
11680
|
Wb,
|
|
11680
11681
|
{
|
|
11681
|
-
interruptPart:
|
|
11682
|
+
interruptPart: ne,
|
|
11682
11683
|
onApprove: we,
|
|
11683
11684
|
onReject: $e
|
|
11684
11685
|
},
|
|
@@ -11698,8 +11699,8 @@ const Bb = q.memo(function({
|
|
|
11698
11699
|
/* @__PURE__ */ c.jsx(Mi, { className: "h-4 w-4 text-muted-foreground" }),
|
|
11699
11700
|
/* @__PURE__ */ c.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
|
|
11700
11701
|
] }), []), vt = q.useCallback(() => {
|
|
11701
|
-
const
|
|
11702
|
-
if (!D && !
|
|
11702
|
+
const ne = J.trim().length > 0 || ve.length > 0 || be.length > 0 || Te.length > 0;
|
|
11703
|
+
if (!D && !ne && !r)
|
|
11703
11704
|
return ie();
|
|
11704
11705
|
if (t.model === "reflection") {
|
|
11705
11706
|
const ue = J.trim(), ge = Bc(ue);
|
|
@@ -11715,11 +11716,11 @@ const Bb = q.memo(function({
|
|
|
11715
11716
|
if (ue.length > 0)
|
|
11716
11717
|
return /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: ue.map((ge, Re) => {
|
|
11717
11718
|
const Q = typeof ge.output == "string" ? ge.output : ta(ge.output), Oe = Q.length > Zn ? `${Q.slice(0, Zn)}
|
|
11718
|
-
… [truncated ${Q.length - Zn} chars]` : Q,
|
|
11719
|
-
return /* @__PURE__ */ c.jsxs(vc, { open:
|
|
11719
|
+
… [truncated ${Q.length - Zn} chars]` : Q, st = T === "expanded";
|
|
11720
|
+
return /* @__PURE__ */ c.jsxs(vc, { open: st, onOpenChange: (Fe) => S(Fe ? "expanded" : "preview"), children: [
|
|
11720
11721
|
/* @__PURE__ */ c.jsx("div", { className: "flex items-center gap-2 text-xs", children: /* @__PURE__ */ c.jsx(Zi, { variant: "outline", children: (ge.name ?? "tool") + (ge.toolCallId ? ` • ${ge.toolCallId.slice(0, 8)}` : "") }) }),
|
|
11721
|
-
/* @__PURE__ */ c.jsx("div", { className: "font-mono text-sm mt-1", children: /* @__PURE__ */ c.jsx("pre", { className: "whitespace-pre-wrap break-words", children:
|
|
11722
|
-
/* @__PURE__ */ c.jsx(wc, { asChild: !0, children: /* @__PURE__ */ c.jsx(Ge, { variant: "ghost", size: "sm", className: "h-6 text-xs", children:
|
|
11722
|
+
/* @__PURE__ */ c.jsx("div", { className: "font-mono text-sm mt-1", children: /* @__PURE__ */ c.jsx("pre", { className: "whitespace-pre-wrap break-words", children: st ? Oe : Oe.slice(0, d) + (Oe.length > d ? "..." : "") }) }),
|
|
11723
|
+
/* @__PURE__ */ c.jsx(wc, { asChild: !0, children: /* @__PURE__ */ c.jsx(Ge, { variant: "ghost", size: "sm", className: "h-6 text-xs", children: st ? /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
|
|
11723
11724
|
" ",
|
|
11724
11725
|
/* @__PURE__ */ c.jsx(Gr, { className: "h-3 w-3 mr-1" }),
|
|
11725
11726
|
" Show less"
|
|
@@ -11740,7 +11741,7 @@ const Bb = q.memo(function({
|
|
|
11740
11741
|
}, [
|
|
11741
11742
|
J,
|
|
11742
11743
|
ve.length,
|
|
11743
|
-
|
|
11744
|
+
be.length,
|
|
11744
11745
|
Te.length,
|
|
11745
11746
|
r,
|
|
11746
11747
|
t.model,
|
|
@@ -11751,9 +11752,9 @@ const Bb = q.memo(function({
|
|
|
11751
11752
|
u,
|
|
11752
11753
|
ie,
|
|
11753
11754
|
j
|
|
11754
|
-
]),
|
|
11755
|
+
]), ot = ht(() => $b(t), [t]);
|
|
11755
11756
|
return /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
|
|
11756
|
-
/* @__PURE__ */ c.jsx("div", { className: re(
|
|
11757
|
+
/* @__PURE__ */ c.jsx("div", { className: re(tt(), p.container), children: /* @__PURE__ */ c.jsxs("div", { className: re(Ve(), p.content), children: [
|
|
11757
11758
|
(i || a || D) && /* @__PURE__ */ c.jsxs(
|
|
11758
11759
|
"div",
|
|
11759
11760
|
{
|
|
@@ -11766,7 +11767,7 @@ const Bb = q.memo(function({
|
|
|
11766
11767
|
children: [
|
|
11767
11768
|
/* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11768
11769
|
Be(),
|
|
11769
|
-
a &&
|
|
11770
|
+
a && ot && /* @__PURE__ */ c.jsx("span", { className: re("font-medium", H ? "text-xs" : "text-sm"), children: ot }),
|
|
11770
11771
|
D && fe.name && /* @__PURE__ */ c.jsxs(
|
|
11771
11772
|
Zi,
|
|
11772
11773
|
{
|
|
@@ -11780,10 +11781,10 @@ const Bb = q.memo(function({
|
|
|
11780
11781
|
role: "button",
|
|
11781
11782
|
tabIndex: 0,
|
|
11782
11783
|
"aria-expanded": T !== "collapsed",
|
|
11783
|
-
onKeyDown: (
|
|
11784
|
-
(
|
|
11784
|
+
onKeyDown: (ne) => {
|
|
11785
|
+
(ne.key === "Enter" || ne.key === " ") && (ne.preventDefault(), S((ue) => ue === "collapsed" ? "preview" : "collapsed"));
|
|
11785
11786
|
},
|
|
11786
|
-
onClick: () => S((
|
|
11787
|
+
onClick: () => S((ne) => ne === "collapsed" ? "preview" : "collapsed"),
|
|
11787
11788
|
children: [
|
|
11788
11789
|
/* @__PURE__ */ c.jsx("span", { children: fe.name }),
|
|
11789
11790
|
/* @__PURE__ */ c.jsx("span", { className: "inline-flex items-center", children: T !== "collapsed" ? /* @__PURE__ */ c.jsx(Gr, { className: "h-3 w-3" }) : /* @__PURE__ */ c.jsx(Ir, { className: "h-3 w-3" }) })
|
|
@@ -11796,7 +11797,7 @@ const Bb = q.memo(function({
|
|
|
11796
11797
|
variant: "ghost",
|
|
11797
11798
|
size: "sm",
|
|
11798
11799
|
className: re("h-6 px-1", j, "hover:bg-foreground/10"),
|
|
11799
|
-
onClick: () => S((
|
|
11800
|
+
onClick: () => S((ne) => ne === "collapsed" ? "preview" : "collapsed"),
|
|
11800
11801
|
children: /* @__PURE__ */ c.jsxs("span", { className: "text-xs flex items-center gap-1", children: [
|
|
11801
11802
|
"Tool Output ",
|
|
11802
11803
|
T !== "collapsed" ? /* @__PURE__ */ c.jsx(Gr, { className: "h-3 w-3" }) : /* @__PURE__ */ c.jsx(Ir, { className: "h-3 w-3" })
|
|
@@ -12094,7 +12095,7 @@ const Uc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Rf = q.forwa
|
|
|
12094
12095
|
onScrollAway: g,
|
|
12095
12096
|
onAtBottom: x
|
|
12096
12097
|
}, y) => {
|
|
12097
|
-
const b = qe(null), T = qe(null), S = qe(!1), [C, I] = me(!0), E =
|
|
12098
|
+
const b = qe(null), T = qe(null), S = qe(!1), [C, I] = me(!0), E = Ae((L) => {
|
|
12098
12099
|
I(L), g && g(!L), x && x(L);
|
|
12099
12100
|
}, [g, x]), _ = ht(() => {
|
|
12100
12101
|
if (a)
|
|
@@ -13660,8 +13661,8 @@ var sl = "PopperContent", [uS, dS] = Bf(sl), Kf = m.forwardRef(
|
|
|
13660
13661
|
l && rS({ ...K }),
|
|
13661
13662
|
oS({
|
|
13662
13663
|
...K,
|
|
13663
|
-
apply: ({ elements: Be, rects:
|
|
13664
|
-
const { width: $e, height: Ke } =
|
|
13664
|
+
apply: ({ elements: Be, rects: tt, availableWidth: Ve, availableHeight: we }) => {
|
|
13665
|
+
const { width: $e, height: Ke } = tt.reference, ie = Be.floating.style;
|
|
13665
13666
|
ie.setProperty("--radix-popper-available-width", `${Ve}px`), ie.setProperty("--radix-popper-available-height", `${we}px`), ie.setProperty("--radix-popper-anchor-width", `${$e}px`), ie.setProperty("--radix-popper-anchor-height", `${Ke}px`);
|
|
13666
13667
|
}
|
|
13667
13668
|
}),
|
|
@@ -13673,7 +13674,7 @@ var sl = "PopperContent", [uS, dS] = Bf(sl), Kf = m.forwardRef(
|
|
|
13673
13674
|
yt(() => {
|
|
13674
13675
|
H && (j == null || j());
|
|
13675
13676
|
}, [H, j]);
|
|
13676
|
-
const J = (U = M.arrow) == null ? void 0 : U.x, fe = (z = M.arrow) == null ? void 0 : z.y, ve = ((G = M.arrow) == null ? void 0 : G.centerOffset) !== 0, [
|
|
13677
|
+
const J = (U = M.arrow) == null ? void 0 : U.x, fe = (z = M.arrow) == null ? void 0 : z.y, ve = ((G = M.arrow) == null ? void 0 : G.centerOffset) !== 0, [be, Te] = m.useState();
|
|
13677
13678
|
return yt(() => {
|
|
13678
13679
|
x && Te(window.getComputedStyle(x).zIndex);
|
|
13679
13680
|
}, [x]), /* @__PURE__ */ c.jsx(
|
|
@@ -13686,7 +13687,7 @@ var sl = "PopperContent", [uS, dS] = Bf(sl), Kf = m.forwardRef(
|
|
|
13686
13687
|
transform: H ? B.transform : "translate(0, -200%)",
|
|
13687
13688
|
// keep off the page when measuring
|
|
13688
13689
|
minWidth: "max-content",
|
|
13689
|
-
zIndex:
|
|
13690
|
+
zIndex: be,
|
|
13690
13691
|
"--radix-popper-transform-origin": [
|
|
13691
13692
|
(se = M.transformOrigin) == null ? void 0 : se.x,
|
|
13692
13693
|
(ce = M.transformOrigin) == null ? void 0 : ce.y
|
|
@@ -14079,7 +14080,7 @@ var Zt = "MenuContent", [LS, ll] = mr(Zt), fh = m.forwardRef(
|
|
|
14079
14080
|
...v
|
|
14080
14081
|
} = e, g = gr(Zt, n), x = Io(Zt, n), y = Js(n), b = lh(n), T = _S(n), [S, C] = m.useState(null), I = m.useRef(null), E = Ue(t, I, g.onContentChange), _ = m.useRef(0), O = m.useRef(""), L = m.useRef(0), F = m.useRef(null), K = m.useRef("right"), N = m.useRef(0), B = w ? zs : m.Fragment, $ = w ? { as: zS, allowPinchZoom: !0 } : void 0, H = (D) => {
|
|
14081
14082
|
var U, z;
|
|
14082
|
-
const Y = O.current + D, j = T().filter((G) => !G.disabled), J = document.activeElement, fe = (U = j.find((G) => G.ref.current === J)) == null ? void 0 : U.textValue, ve = j.map((G) => G.textValue),
|
|
14083
|
+
const Y = O.current + D, j = T().filter((G) => !G.disabled), J = document.activeElement, fe = (U = j.find((G) => G.ref.current === J)) == null ? void 0 : U.textValue, ve = j.map((G) => G.textValue), be = ZS(ve, Y, fe), Te = (z = j.find((G) => G.textValue === be)) == null ? void 0 : z.ref.current;
|
|
14083
14084
|
(function G(se) {
|
|
14084
14085
|
O.current = se, window.clearTimeout(_.current), se !== "" && (_.current = window.setTimeout(() => G(""), 1e3));
|
|
14085
14086
|
})(Y), Te && setTimeout(() => Te.focus());
|
|
@@ -14850,38 +14851,38 @@ function Oi({
|
|
|
14850
14851
|
checkpoint: _,
|
|
14851
14852
|
respondToInterrupt: O,
|
|
14852
14853
|
metadata: L
|
|
14853
|
-
} = Ia(), { isStreaming: F, error: K, submit: N, stop: B } = rv(), $ = g ?? v ?? null, H = (_ == null ? void 0 : _.id) ?? null, M = (_ == null ? void 0 : _.namespace) ?? null, D = (L == null ? void 0 : L.assemblingMessageId) ?? null, [Y, j] = me(null), [J, fe] = me(""), [ve,
|
|
14854
|
+
} = Ia(), { isStreaming: F, error: K, submit: N, stop: B } = rv(), $ = g ?? v ?? null, H = (_ == null ? void 0 : _.id) ?? null, M = (_ == null ? void 0 : _.namespace) ?? null, D = (L == null ? void 0 : L.assemblingMessageId) ?? null, [Y, j] = me(null), [J, fe] = me(""), [ve, be] = me(null), [Te, U] = me([]), [z, G] = me(0), [se, ce] = me(0), [Z, Be] = me(!1), [tt, Ve] = me(null), [we, $e] = me(null), [Ke, ie] = me(!1), [vt, ot] = me(null), [ne, ue] = me([]), [ge, Re] = me(null), [Q, Oe] = me(null), [st, Fe] = me(!1), Ze = qe(null), lt = qe(null), gt = Ae(() => {
|
|
14854
14855
|
Ze.current && (Ze.current.value = ""), lt.current && (lt.current.value = ""), G((oe) => oe + 1), ce((oe) => oe + 1);
|
|
14855
|
-
}, []),
|
|
14856
|
+
}, []), At = qe(!1);
|
|
14856
14857
|
ct(() => {
|
|
14857
|
-
|
|
14858
|
+
At.current && !F && (U([]), gt()), At.current = F;
|
|
14858
14859
|
}, [F, gt]);
|
|
14859
14860
|
const [Pn, Wr] = me("desktop");
|
|
14860
14861
|
ct(() => {
|
|
14861
14862
|
const oe = () => {
|
|
14862
|
-
const
|
|
14863
|
-
Wr(
|
|
14863
|
+
const ke = window.innerWidth;
|
|
14864
|
+
Wr(ke < 640 ? "phone" : ke < 1024 ? "tablet" : "desktop");
|
|
14864
14865
|
};
|
|
14865
14866
|
return oe(), window.addEventListener("resize", oe), () => window.removeEventListener("resize", oe);
|
|
14866
14867
|
}, []), ct(() => {
|
|
14867
|
-
var
|
|
14868
|
+
var ke, He;
|
|
14868
14869
|
if (!$) {
|
|
14869
14870
|
ue([]), Re(null), Oe(null);
|
|
14870
14871
|
return;
|
|
14871
14872
|
}
|
|
14872
|
-
const oe = (C ?? []).slice().sort((Qe,
|
|
14873
|
+
const oe = (C ?? []).slice().sort((Qe, _t) => new Date(_t.createdAt).getTime() - new Date(Qe.createdAt).getTime());
|
|
14873
14874
|
if (ue(oe), !oe.length) {
|
|
14874
14875
|
Re(null), Oe(null);
|
|
14875
14876
|
return;
|
|
14876
14877
|
}
|
|
14877
14878
|
if (!ge || !oe.some((Qe) => Qe.checkpointId === ge)) {
|
|
14878
|
-
const Qe = ((
|
|
14879
|
-
Re(Qe), Oe(
|
|
14879
|
+
const Qe = ((ke = oe[0]) == null ? void 0 : ke.checkpointId) ?? null, _t = Qe ? ((He = oe.find((un) => un.checkpointId === Qe)) == null ? void 0 : He.checkpointNs) ?? null : null;
|
|
14880
|
+
Re(Qe), Oe(_t);
|
|
14880
14881
|
}
|
|
14881
14882
|
}, [ge, $, C]), ct(() => {
|
|
14882
14883
|
H && (Re(H), Oe(M ?? null));
|
|
14883
14884
|
}, [H, M]);
|
|
14884
|
-
const qn =
|
|
14885
|
+
const qn = Ae(async () => {
|
|
14885
14886
|
if (!(!y || b))
|
|
14886
14887
|
try {
|
|
14887
14888
|
await S();
|
|
@@ -14892,14 +14893,14 @@ function Oi({
|
|
|
14892
14893
|
ct(() => {
|
|
14893
14894
|
(async () => {
|
|
14894
14895
|
if (!w.baseUrl) {
|
|
14895
|
-
|
|
14896
|
+
ot(null);
|
|
14896
14897
|
return;
|
|
14897
14898
|
}
|
|
14898
14899
|
try {
|
|
14899
|
-
const
|
|
14900
|
-
|
|
14901
|
-
} catch (
|
|
14902
|
-
console.warn("Failed to fetch default message:",
|
|
14900
|
+
const ke = await w.getAgent("default");
|
|
14901
|
+
ot(ke.uiDefaultMessage || null);
|
|
14902
|
+
} catch (ke) {
|
|
14903
|
+
console.warn("Failed to fetch default message:", ke), ot(null);
|
|
14903
14904
|
}
|
|
14904
14905
|
})();
|
|
14905
14906
|
}, [w]), ct(() => {
|
|
@@ -14910,23 +14911,23 @@ function Oi({
|
|
|
14910
14911
|
return `Message too long (${oe.length}/${es} characters)`;
|
|
14911
14912
|
try {
|
|
14912
14913
|
return Yb(oe), null;
|
|
14913
|
-
} catch (
|
|
14914
|
-
return (
|
|
14914
|
+
} catch (ke) {
|
|
14915
|
+
return (ke == null ? void 0 : ke.message) || "Invalid message";
|
|
14915
14916
|
}
|
|
14916
14917
|
}, kn = async (oe) => {
|
|
14917
|
-
const
|
|
14918
|
-
if (!(!
|
|
14919
|
-
if (
|
|
14920
|
-
const He = cn(
|
|
14918
|
+
const ke = oe.trim();
|
|
14919
|
+
if (!(!ke && Te.length === 0)) {
|
|
14920
|
+
if (ke) {
|
|
14921
|
+
const He = cn(ke);
|
|
14921
14922
|
if (He) {
|
|
14922
|
-
|
|
14923
|
+
be(He);
|
|
14923
14924
|
return;
|
|
14924
14925
|
}
|
|
14925
14926
|
}
|
|
14926
14927
|
try {
|
|
14927
14928
|
await N(
|
|
14928
14929
|
{
|
|
14929
|
-
text:
|
|
14930
|
+
text: ke || "",
|
|
14930
14931
|
attachments: Te,
|
|
14931
14932
|
payload: Y ? { edit: !0, originalMessageId: Y } : void 0
|
|
14932
14933
|
},
|
|
@@ -14934,22 +14935,22 @@ function Oi({
|
|
|
14934
14935
|
checkpointId: ge ?? H ?? void 0,
|
|
14935
14936
|
checkpointNs: Q ?? M ?? void 0
|
|
14936
14937
|
}
|
|
14937
|
-
), f == null || f(
|
|
14938
|
+
), f == null || f(ke), be(null), U([]), gt(), j(null), fe("");
|
|
14938
14939
|
} catch (He) {
|
|
14939
14940
|
const Qe = (He == null ? void 0 : He.message) || "Failed to send message";
|
|
14940
|
-
|
|
14941
|
+
be(Qe), p == null || p(Qe);
|
|
14941
14942
|
}
|
|
14942
14943
|
}
|
|
14943
|
-
}, Vt = q.useCallback((oe,
|
|
14944
|
-
u && (j(oe), fe(
|
|
14944
|
+
}, Vt = q.useCallback((oe, ke) => {
|
|
14945
|
+
u && (j(oe), fe(ke), be(null));
|
|
14945
14946
|
}, [u]), bt = q.useCallback(() => {
|
|
14946
|
-
j(null), fe(""),
|
|
14947
|
-
}, []), Tn =
|
|
14948
|
-
Vt(oe,
|
|
14949
|
-
}, [Vt]), Gn =
|
|
14950
|
-
const
|
|
14951
|
-
const Qe = He.content || [],
|
|
14952
|
-
if (
|
|
14947
|
+
j(null), fe(""), be(null);
|
|
14948
|
+
}, []), Tn = Ae((oe, ke) => {
|
|
14949
|
+
Vt(oe, ke);
|
|
14950
|
+
}, [Vt]), Gn = Ae((oe) => {
|
|
14951
|
+
const ke = (He) => {
|
|
14952
|
+
const Qe = He.content || [], _t = Qe.filter((un) => un.type === "text").map((un) => un.text).join("");
|
|
14953
|
+
if (_t) return _t;
|
|
14953
14954
|
try {
|
|
14954
14955
|
return JSON.stringify(Qe, null, 2);
|
|
14955
14956
|
} catch {
|
|
@@ -14958,7 +14959,7 @@ function Oi({
|
|
|
14958
14959
|
};
|
|
14959
14960
|
for (let He = oe - 1; He >= 0; He--)
|
|
14960
14961
|
if (x[He].role === "user") {
|
|
14961
|
-
const Qe =
|
|
14962
|
+
const Qe = ke(x[He]);
|
|
14962
14963
|
Qe && N(
|
|
14963
14964
|
{ text: Qe },
|
|
14964
14965
|
{
|
|
@@ -14969,26 +14970,26 @@ function Oi({
|
|
|
14969
14970
|
break;
|
|
14970
14971
|
}
|
|
14971
14972
|
}, [x, N, ge, Q, H, M]), Yn = (oe) => {
|
|
14972
|
-
const
|
|
14973
|
-
U((He) => [...He, ...
|
|
14973
|
+
const ke = Array.from(oe.target.files || []);
|
|
14974
|
+
U((He) => [...He, ...ke]), oe.target.value = "";
|
|
14974
14975
|
}, xr = (oe) => {
|
|
14975
|
-
U((
|
|
14976
|
-
const He =
|
|
14976
|
+
U((ke) => {
|
|
14977
|
+
const He = ke.filter((Qe, _t) => oe !== _t);
|
|
14977
14978
|
return He.length === 0 && gt(), He;
|
|
14978
14979
|
});
|
|
14979
14980
|
}, In = async (oe) => {
|
|
14980
|
-
const
|
|
14981
|
-
if (
|
|
14981
|
+
const ke = (oe.target.files || [])[0];
|
|
14982
|
+
if (ke) {
|
|
14982
14983
|
Ve(null), $e(null), Be(!0);
|
|
14983
14984
|
try {
|
|
14984
14985
|
await N(
|
|
14985
|
-
{ attachments: [
|
|
14986
|
+
{ attachments: [ke] },
|
|
14986
14987
|
{
|
|
14987
14988
|
checkpointId: ge ?? H ?? void 0,
|
|
14988
14989
|
checkpointNs: Q ?? M ?? void 0
|
|
14989
14990
|
}
|
|
14990
14991
|
);
|
|
14991
|
-
const He = `Uploaded ${
|
|
14992
|
+
const He = `Uploaded ${ke.name} - processing through chat stream`;
|
|
14992
14993
|
$e(He);
|
|
14993
14994
|
} catch (He) {
|
|
14994
14995
|
const Qe = He instanceof Error ? He.message : "Failed to upload Excel file";
|
|
@@ -14999,8 +15000,8 @@ function Oi({
|
|
|
14999
15000
|
}
|
|
15000
15001
|
}, vr = (oe) => {
|
|
15001
15002
|
if (!oe) return "Unknown";
|
|
15002
|
-
const
|
|
15003
|
-
return Number.isNaN(
|
|
15003
|
+
const ke = Date.parse(oe);
|
|
15004
|
+
return Number.isNaN(ke) ? oe : new Date(ke).toLocaleString();
|
|
15004
15005
|
}, Rn = async (oe) => {
|
|
15005
15006
|
if (v) {
|
|
15006
15007
|
Fe(!0);
|
|
@@ -15009,7 +15010,7 @@ function Oi({
|
|
|
15009
15010
|
await E(), Re(null), Oe(null);
|
|
15010
15011
|
return;
|
|
15011
15012
|
}
|
|
15012
|
-
const
|
|
15013
|
+
const ke = ne.find((Qe) => Qe.checkpointId === oe), He = (ke == null ? void 0 : ke.checkpointNs) ?? null;
|
|
15013
15014
|
await I(oe, He), Re(oe), Oe(He);
|
|
15014
15015
|
} finally {
|
|
15015
15016
|
Fe(!1);
|
|
@@ -15031,7 +15032,7 @@ function Oi({
|
|
|
15031
15032
|
}
|
|
15032
15033
|
)
|
|
15033
15034
|
] }),
|
|
15034
|
-
v &&
|
|
15035
|
+
v && ne.length > 0 && /* @__PURE__ */ c.jsxs("div", { className: "flex-shrink-0 flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/60 text-xs dark:bg-muted/50", children: [
|
|
15035
15036
|
/* @__PURE__ */ c.jsx("span", { className: "opacity-70", children: "Checkpoint:" }),
|
|
15036
15037
|
/* @__PURE__ */ c.jsx(
|
|
15037
15038
|
"select",
|
|
@@ -15039,10 +15040,10 @@ function Oi({
|
|
|
15039
15040
|
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",
|
|
15040
15041
|
value: ge ?? "",
|
|
15041
15042
|
onChange: (oe) => {
|
|
15042
|
-
const
|
|
15043
|
-
Rn(
|
|
15043
|
+
const ke = oe.target.value || null;
|
|
15044
|
+
Rn(ke);
|
|
15044
15045
|
},
|
|
15045
|
-
children:
|
|
15046
|
+
children: ne.map((oe) => /* @__PURE__ */ c.jsxs("option", { value: oe.checkpointId, children: [
|
|
15046
15047
|
vr(oe.createdAt),
|
|
15047
15048
|
oe.next ? ` — ${oe.next}` : "__end__",
|
|
15048
15049
|
oe.step ? ` (Step ${oe.step})` : ""
|
|
@@ -15076,7 +15077,7 @@ function Oi({
|
|
|
15076
15077
|
onRegenerate: Gn,
|
|
15077
15078
|
onCancelEdit: bt,
|
|
15078
15079
|
emptyMessage: vt ?? void 0,
|
|
15079
|
-
isNavigatingCheckpoint:
|
|
15080
|
+
isNavigatingCheckpoint: st
|
|
15080
15081
|
}
|
|
15081
15082
|
),
|
|
15082
15083
|
T && /* @__PURE__ */ c.jsxs("div", { className: "absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 bg-background/80 backdrop-blur-sm text-muted-foreground", children: [
|
|
@@ -15116,7 +15117,7 @@ function Oi({
|
|
|
15116
15117
|
},
|
|
15117
15118
|
z
|
|
15118
15119
|
),
|
|
15119
|
-
Te.length > 0 && /* @__PURE__ */ c.jsx("div", { className: "flex flex-wrap gap-2", children: Te.map((oe,
|
|
15120
|
+
Te.length > 0 && /* @__PURE__ */ c.jsx("div", { className: "flex flex-wrap gap-2", children: Te.map((oe, ke) => /* @__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: [
|
|
15120
15121
|
/* @__PURE__ */ c.jsx(Mi, { size: 14 }),
|
|
15121
15122
|
/* @__PURE__ */ c.jsx("span", { className: "truncate max-w-[150px]", children: oe.name }),
|
|
15122
15123
|
/* @__PURE__ */ c.jsx(
|
|
@@ -15124,13 +15125,13 @@ function Oi({
|
|
|
15124
15125
|
{
|
|
15125
15126
|
variant: "ghost",
|
|
15126
15127
|
size: "sm",
|
|
15127
|
-
onClick: () => xr(
|
|
15128
|
+
onClick: () => xr(ke),
|
|
15128
15129
|
className: "h-4 w-4 p-0 text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400",
|
|
15129
15130
|
"aria-label": `Remove ${oe.name}`,
|
|
15130
15131
|
children: /* @__PURE__ */ c.jsx(Rr, { size: 12 })
|
|
15131
15132
|
}
|
|
15132
15133
|
)
|
|
15133
|
-
] },
|
|
15134
|
+
] }, ke)) })
|
|
15134
15135
|
] }),
|
|
15135
15136
|
l && /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
|
|
15136
15137
|
/* @__PURE__ */ c.jsx(
|
|
@@ -15149,7 +15150,7 @@ function Oi({
|
|
|
15149
15150
|
" Uploading Excel file..."
|
|
15150
15151
|
] }),
|
|
15151
15152
|
we && !Z && /* @__PURE__ */ c.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: we }),
|
|
15152
|
-
|
|
15153
|
+
tt && !Z && /* @__PURE__ */ c.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: tt })
|
|
15153
15154
|
] })
|
|
15154
15155
|
] }),
|
|
15155
15156
|
ve && /* @__PURE__ */ c.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: ve }),
|
|
@@ -15836,8 +15837,8 @@ function ru({
|
|
|
15836
15837
|
}, D = (j) => {
|
|
15837
15838
|
if (!j) return "";
|
|
15838
15839
|
try {
|
|
15839
|
-
const J = new Date(j), ve = (/* @__PURE__ */ new Date()).getTime() - J.getTime(),
|
|
15840
|
-
return
|
|
15840
|
+
const J = new Date(j), ve = (/* @__PURE__ */ new Date()).getTime() - J.getTime(), be = Math.floor(ve / (1e3 * 60 * 60 * 24));
|
|
15841
|
+
return be === 0 ? J.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : be === 1 ? "Yesterday" : be < 7 ? `${be} days ago` : J.toLocaleDateString();
|
|
15841
15842
|
} catch {
|
|
15842
15843
|
return "";
|
|
15843
15844
|
}
|
|
@@ -16456,7 +16457,7 @@ var tn = 10, [Lp, Kn] = Ur(dr), Tk = "SelectContentImpl", Ik = jr("SelectContent
|
|
|
16456
16457
|
(y.value !== void 0 && y.value === z || se) && L(U);
|
|
16457
16458
|
},
|
|
16458
16459
|
[y.value]
|
|
16459
|
-
),
|
|
16460
|
+
), be = r === "popper" ? ca : $p, Te = be === ca ? {
|
|
16460
16461
|
side: a,
|
|
16461
16462
|
sideOffset: l,
|
|
16462
16463
|
align: u,
|
|
@@ -16506,7 +16507,7 @@ var tn = 10, [Lp, Kn] = Ur(dr), Tk = "SelectContentImpl", Ik = jr("SelectContent
|
|
|
16506
16507
|
onFocusOutside: (U) => U.preventDefault(),
|
|
16507
16508
|
onDismiss: () => y.onOpenChange(!1),
|
|
16508
16509
|
children: /* @__PURE__ */ c.jsx(
|
|
16509
|
-
|
|
16510
|
+
be,
|
|
16510
16511
|
{
|
|
16511
16512
|
role: "listbox",
|
|
16512
16513
|
id: y.contentId,
|
|
@@ -16552,7 +16553,7 @@ var Rk = "SelectItemAlignedPosition", $p = m.forwardRef((e, t) => {
|
|
|
16552
16553
|
if (s.trigger && s.valueNode && a && u && v && g && x) {
|
|
16553
16554
|
const I = s.trigger.getBoundingClientRect(), E = u.getBoundingClientRect(), _ = s.valueNode.getBoundingClientRect(), O = x.getBoundingClientRect();
|
|
16554
16555
|
if (s.dir !== "rtl") {
|
|
16555
|
-
const ce = O.left - E.left, Z = _.left - ce, Be = I.left - Z,
|
|
16556
|
+
const ce = O.left - E.left, Z = _.left - ce, Be = I.left - Z, tt = I.width + Be, Ve = Math.max(tt, E.width), we = window.innerWidth - tn, $e = la(Z, [
|
|
16556
16557
|
tn,
|
|
16557
16558
|
// Prevents the content from going off the starting edge of the
|
|
16558
16559
|
// viewport. It may still go off the ending edge, but this can be
|
|
@@ -16561,24 +16562,24 @@ var Rk = "SelectItemAlignedPosition", $p = m.forwardRef((e, t) => {
|
|
|
16561
16562
|
// https://github.com/radix-ui/primitives/issues/2049
|
|
16562
16563
|
Math.max(tn, we - Ve)
|
|
16563
16564
|
]);
|
|
16564
|
-
a.style.minWidth =
|
|
16565
|
+
a.style.minWidth = tt + "px", a.style.left = $e + "px";
|
|
16565
16566
|
} else {
|
|
16566
|
-
const ce = E.right - O.right, Z = window.innerWidth - _.right - ce, Be = window.innerWidth - I.right - Z,
|
|
16567
|
+
const ce = E.right - O.right, Z = window.innerWidth - _.right - ce, Be = window.innerWidth - I.right - Z, tt = I.width + Be, Ve = Math.max(tt, E.width), we = window.innerWidth - tn, $e = la(Z, [
|
|
16567
16568
|
tn,
|
|
16568
16569
|
Math.max(tn, we - Ve)
|
|
16569
16570
|
]);
|
|
16570
|
-
a.style.minWidth =
|
|
16571
|
+
a.style.minWidth = tt + "px", a.style.right = $e + "px";
|
|
16571
16572
|
}
|
|
16572
|
-
const L = h(), F = window.innerHeight - tn * 2, K = v.scrollHeight, N = window.getComputedStyle(u), B = parseInt(N.borderTopWidth, 10), $ = parseInt(N.paddingTop, 10), H = parseInt(N.borderBottomWidth, 10), M = parseInt(N.paddingBottom, 10), D = B + $ + K + M + H, Y = Math.min(g.offsetHeight * 5, D), j = window.getComputedStyle(v), J = parseInt(j.paddingTop, 10), fe = parseInt(j.paddingBottom, 10), ve = I.top + I.height / 2 - tn,
|
|
16573
|
+
const L = h(), F = window.innerHeight - tn * 2, K = v.scrollHeight, N = window.getComputedStyle(u), B = parseInt(N.borderTopWidth, 10), $ = parseInt(N.paddingTop, 10), H = parseInt(N.borderBottomWidth, 10), M = parseInt(N.paddingBottom, 10), D = B + $ + K + M + H, Y = Math.min(g.offsetHeight * 5, D), j = window.getComputedStyle(v), J = parseInt(j.paddingTop, 10), fe = parseInt(j.paddingBottom, 10), ve = I.top + I.height / 2 - tn, be = F - ve, Te = g.offsetHeight / 2, U = g.offsetTop + Te, z = B + $ + U, G = D - z;
|
|
16573
16574
|
if (z <= ve) {
|
|
16574
16575
|
const ce = L.length > 0 && g === L[L.length - 1].ref.current;
|
|
16575
16576
|
a.style.bottom = "0px";
|
|
16576
16577
|
const Z = u.clientHeight - v.offsetTop - v.offsetHeight, Be = Math.max(
|
|
16577
|
-
|
|
16578
|
+
be,
|
|
16578
16579
|
Te + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
16579
16580
|
(ce ? fe : 0) + Z + H
|
|
16580
|
-
),
|
|
16581
|
-
a.style.height =
|
|
16581
|
+
), tt = z + Be;
|
|
16582
|
+
a.style.height = tt + "px";
|
|
16582
16583
|
} else {
|
|
16583
16584
|
const ce = L.length > 0 && g === L[0].ref.current;
|
|
16584
16585
|
a.style.top = "0px";
|