@trailheadai/chat 0.2.1 → 0.2.2
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/bundle-analysis.html +1 -1
- package/dist/widget.es.js +132 -133
- package/dist/widget.umd.js +2 -2
- package/package.json +1 -1
package/dist/widget.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as ce, jsxs as hl, Fragment as u2 } from "react/jsx-runtime";
|
|
2
2
|
import * as Ez from "react";
|
|
3
3
|
import zz, { useRef as i1, useCallback as kb, useSyncExternalStore as jS, useEffect as dl, createContext as Tz, useState as ai, useEffectEvent as ME, useContext as i2, useMemo as cg, StrictMode as q4 } from "react";
|
|
4
4
|
import Az from "react-dom";
|
|
@@ -53,7 +53,7 @@ function L4() {
|
|
|
53
53
|
return _.now() - z;
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
var D = [], O = [], B = 1, Y = null, te = 3, ae = !1,
|
|
56
|
+
var D = [], O = [], B = 1, Y = null, te = 3, ae = !1, oe = !1, re = !1, se = !1, le = typeof setTimeout == "function" ? setTimeout : null, Ee = typeof clearTimeout == "function" ? clearTimeout : null, ye = typeof setImmediate < "u" ? setImmediate : null;
|
|
57
57
|
function F(H) {
|
|
58
58
|
for (var ee = d(O); ee !== null; ) {
|
|
59
59
|
if (ee.callback === null) h(O);
|
|
@@ -64,9 +64,9 @@ function L4() {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
function Qe(H) {
|
|
67
|
-
if (re = !1, F(H), !
|
|
67
|
+
if (re = !1, F(H), !oe)
|
|
68
68
|
if (d(D) !== null)
|
|
69
|
-
|
|
69
|
+
oe = !0, He || (He = !0, De());
|
|
70
70
|
else {
|
|
71
71
|
var ee = d(O);
|
|
72
72
|
ee !== null && en(Qe, ee.startTime - H);
|
|
@@ -83,7 +83,7 @@ function L4() {
|
|
|
83
83
|
var ee = !0;
|
|
84
84
|
try {
|
|
85
85
|
e: {
|
|
86
|
-
|
|
86
|
+
oe = !1, re && (re = !1, Ee(Te), Te = -1), ae = !0;
|
|
87
87
|
var ne = te;
|
|
88
88
|
try {
|
|
89
89
|
t: {
|
|
@@ -211,7 +211,7 @@ function L4() {
|
|
|
211
211
|
startTime: ne,
|
|
212
212
|
expirationTime: Be,
|
|
213
213
|
sortIndex: -1
|
|
214
|
-
}, ne > Me ? (H.sortIndex = ne, c(O, H), d(D) === null && H === d(O) && (re ? (Ee(Te), Te = -1) : re = !0, en(Qe, ne - Me))) : (H.sortIndex = Be, c(D, H),
|
|
214
|
+
}, ne > Me ? (H.sortIndex = ne, c(O, H), d(D) === null && H === d(O) && (re ? (Ee(Te), Te = -1) : re = !0, en(Qe, ne - Me))) : (H.sortIndex = Be, c(D, H), oe || ae || (oe = !0, He || (He = !0, De()))), H;
|
|
215
215
|
}, u.unstable_shouldYield = de, u.unstable_wrapCallback = function(H) {
|
|
216
216
|
var ee = te;
|
|
217
217
|
return function() {
|
|
@@ -259,7 +259,7 @@ function V4() {
|
|
|
259
259
|
}
|
|
260
260
|
if (se !== null) ee = !0;
|
|
261
261
|
else {
|
|
262
|
-
var ya = h(
|
|
262
|
+
var ya = h(oe);
|
|
263
263
|
ya !== null && O(
|
|
264
264
|
z,
|
|
265
265
|
ya.startTime - H
|
|
@@ -311,12 +311,12 @@ function V4() {
|
|
|
311
311
|
return ne !== 0 ? ne : H.id - ee.id;
|
|
312
312
|
}
|
|
313
313
|
function _(H) {
|
|
314
|
-
for (var ee = h(
|
|
315
|
-
if (ee.callback === null) g(
|
|
314
|
+
for (var ee = h(oe); ee !== null; ) {
|
|
315
|
+
if (ee.callback === null) g(oe);
|
|
316
316
|
else if (ee.startTime <= H)
|
|
317
|
-
g(
|
|
317
|
+
g(oe), ee.sortIndex = ee.expirationTime, d(ae, ee);
|
|
318
318
|
else break;
|
|
319
|
-
ee = h(
|
|
319
|
+
ee = h(oe);
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
function z(H) {
|
|
@@ -324,7 +324,7 @@ function V4() {
|
|
|
324
324
|
if (h(ae) !== null)
|
|
325
325
|
ye = !0, je || (je = !0, Ie());
|
|
326
326
|
else {
|
|
327
|
-
var ee = h(
|
|
327
|
+
var ee = h(oe);
|
|
328
328
|
ee !== null && O(
|
|
329
329
|
z,
|
|
330
330
|
ee.startTime - H
|
|
@@ -350,7 +350,7 @@ function V4() {
|
|
|
350
350
|
return Y.now() - te;
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
|
-
var ae = [],
|
|
353
|
+
var ae = [], oe = [], re = 1, se = null, le = 3, Ee = !1, ye = !1, F = !1, Qe = !1, He = typeof setTimeout == "function" ? setTimeout : null, Te = typeof clearTimeout == "function" ? clearTimeout : null, ue = typeof setImmediate < "u" ? setImmediate : null, je = !1, de = -1, Et = 5, De = -1;
|
|
354
354
|
if (typeof ue == "function")
|
|
355
355
|
var Ie = function() {
|
|
356
356
|
ue(c);
|
|
@@ -434,7 +434,7 @@ function V4() {
|
|
|
434
434
|
startTime: ne,
|
|
435
435
|
expirationTime: Be,
|
|
436
436
|
sortIndex: -1
|
|
437
|
-
}, ne > Me ? (H.sortIndex = ne, d(
|
|
437
|
+
}, ne > Me ? (H.sortIndex = ne, d(oe, H), h(ae) === null && H === h(oe) && (F ? (Te(de), de = -1) : F = !0, O(z, ne - Me))) : (H.sortIndex = Be, d(ae, H), ye || Ee || (ye = !0, je || (je = !0, Ie()))), H;
|
|
438
438
|
}, u.unstable_shouldYield = D, u.unstable_wrapCallback = function(H) {
|
|
439
439
|
var ee = le;
|
|
440
440
|
return function() {
|
|
@@ -567,7 +567,7 @@ function G4() {
|
|
|
567
567
|
}
|
|
568
568
|
return null;
|
|
569
569
|
}
|
|
570
|
-
var Y = Object.assign, te = /* @__PURE__ */ Symbol.for("react.element"), ae = /* @__PURE__ */ Symbol.for("react.transitional.element"),
|
|
570
|
+
var Y = Object.assign, te = /* @__PURE__ */ Symbol.for("react.element"), ae = /* @__PURE__ */ Symbol.for("react.transitional.element"), oe = /* @__PURE__ */ Symbol.for("react.portal"), re = /* @__PURE__ */ Symbol.for("react.fragment"), se = /* @__PURE__ */ Symbol.for("react.strict_mode"), le = /* @__PURE__ */ Symbol.for("react.profiler"), Ee = /* @__PURE__ */ Symbol.for("react.consumer"), ye = /* @__PURE__ */ Symbol.for("react.context"), F = /* @__PURE__ */ Symbol.for("react.forward_ref"), Qe = /* @__PURE__ */ Symbol.for("react.suspense"), He = /* @__PURE__ */ Symbol.for("react.suspense_list"), Te = /* @__PURE__ */ Symbol.for("react.memo"), ue = /* @__PURE__ */ Symbol.for("react.lazy"), je = /* @__PURE__ */ Symbol.for("react.activity"), de = /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel"), Et = Symbol.iterator;
|
|
571
571
|
function De(a) {
|
|
572
572
|
return a === null || typeof a != "object" ? null : (a = Et && a[Et] || a["@@iterator"], typeof a == "function" ? a : null);
|
|
573
573
|
}
|
|
@@ -593,7 +593,7 @@ function G4() {
|
|
|
593
593
|
}
|
|
594
594
|
if (typeof a == "object")
|
|
595
595
|
switch (a.$$typeof) {
|
|
596
|
-
case
|
|
596
|
+
case oe:
|
|
597
597
|
return "Portal";
|
|
598
598
|
case ye:
|
|
599
599
|
return a.displayName || "Context";
|
|
@@ -2602,7 +2602,7 @@ Error generating stack: ` + r.message + `
|
|
|
2602
2602
|
j.mode,
|
|
2603
2603
|
q
|
|
2604
2604
|
), fr(q, N), q.return = j, q;
|
|
2605
|
-
case
|
|
2605
|
+
case oe:
|
|
2606
2606
|
return N = Pd(
|
|
2607
2607
|
N,
|
|
2608
2608
|
j.mode,
|
|
@@ -2638,7 +2638,7 @@ Error generating stack: ` + r.message + `
|
|
|
2638
2638
|
switch (q.$$typeof) {
|
|
2639
2639
|
case ae:
|
|
2640
2640
|
return q.key === _e ? U(j, N, q, I) : null;
|
|
2641
|
-
case
|
|
2641
|
+
case oe:
|
|
2642
2642
|
return q.key === _e ? L(j, N, q, I) : null;
|
|
2643
2643
|
case ue:
|
|
2644
2644
|
return q = to(q), V(j, N, q, I);
|
|
@@ -2672,7 +2672,7 @@ Error generating stack: ` + r.message + `
|
|
|
2672
2672
|
return j = j.get(
|
|
2673
2673
|
I.key === null ? q : I.key
|
|
2674
2674
|
) || null, U(N, j, I, _e);
|
|
2675
|
-
case
|
|
2675
|
+
case oe:
|
|
2676
2676
|
return j = j.get(
|
|
2677
2677
|
I.key === null ? q : I.key
|
|
2678
2678
|
) || null, L(N, j, I, _e);
|
|
@@ -2820,7 +2820,7 @@ Error generating stack: ` + r.message + `
|
|
|
2820
2820
|
), fr(I, q), I.return = j, j = I);
|
|
2821
2821
|
}
|
|
2822
2822
|
return S(j);
|
|
2823
|
-
case
|
|
2823
|
+
case oe:
|
|
2824
2824
|
e: {
|
|
2825
2825
|
for (_e = q.key; N !== null; ) {
|
|
2826
2826
|
if (N.key === _e)
|
|
@@ -10298,7 +10298,7 @@ function X4() {
|
|
|
10298
10298
|
function ae(e, t) {
|
|
10299
10299
|
e.context === ts && (Wh(e.current, 2, t, e, null, null), el());
|
|
10300
10300
|
}
|
|
10301
|
-
function
|
|
10301
|
+
function oe(e, t) {
|
|
10302
10302
|
if (Qu !== null) {
|
|
10303
10303
|
var n = t.staleFamilies;
|
|
10304
10304
|
t = t.updatedFamilies, Af(), xg(
|
|
@@ -27212,7 +27212,7 @@ Learn more: https://react.dev/warnings/version-mismatch`)
|
|
|
27212
27212
|
currentDispatcherRef: Q,
|
|
27213
27213
|
reconcilerVersion: "19.2.3"
|
|
27214
27214
|
};
|
|
27215
|
-
return e.overrideHookState = gE, e.overrideHookStateDeletePath = vE, e.overrideHookStateRenamePath = bE, e.overrideProps = SE, e.overridePropsDeletePath = _E, e.overridePropsRenamePath = EE, e.scheduleUpdate = zE, e.scheduleRetry = TE, e.setErrorHandler = AE, e.setSuspenseHandler = OE, e.scheduleRefresh =
|
|
27215
|
+
return e.overrideHookState = gE, e.overrideHookStateDeletePath = vE, e.overrideHookStateRenamePath = bE, e.overrideProps = SE, e.overridePropsDeletePath = _E, e.overridePropsRenamePath = EE, e.scheduleUpdate = zE, e.scheduleRetry = TE, e.setErrorHandler = AE, e.setSuspenseHandler = OE, e.scheduleRefresh = oe, e.scheduleRoot = ae, e.setRefreshHandler = re, e.getCurrentFiber = Mt, np(e);
|
|
27216
27216
|
})() && To && window.top === window.self && (-1 < navigator.userAgent.indexOf("Chrome") && navigator.userAgent.indexOf("Edge") === -1 || -1 < navigator.userAgent.indexOf("Firefox"))) {
|
|
27217
27217
|
var DE = window.location.protocol;
|
|
27218
27218
|
/^(https?|file):$/.test(DE) && console.info(
|
|
@@ -27290,7 +27290,7 @@ function Q4() {
|
|
|
27290
27290
|
}
|
|
27291
27291
|
var J4 = Q4();
|
|
27292
27292
|
function Dz({ className: u, style: c }) {
|
|
27293
|
-
return /* @__PURE__ */
|
|
27293
|
+
return /* @__PURE__ */ ce(
|
|
27294
27294
|
"svg",
|
|
27295
27295
|
{
|
|
27296
27296
|
className: u,
|
|
@@ -27301,12 +27301,12 @@ function Dz({ className: u, style: c }) {
|
|
|
27301
27301
|
strokeLinecap: "round",
|
|
27302
27302
|
strokeLinejoin: "round",
|
|
27303
27303
|
style: c,
|
|
27304
|
-
children: /* @__PURE__ */
|
|
27304
|
+
children: /* @__PURE__ */ ce("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" })
|
|
27305
27305
|
}
|
|
27306
27306
|
);
|
|
27307
27307
|
}
|
|
27308
27308
|
function Mz({ className: u, style: c }) {
|
|
27309
|
-
return /* @__PURE__ */
|
|
27309
|
+
return /* @__PURE__ */ ce(
|
|
27310
27310
|
"svg",
|
|
27311
27311
|
{
|
|
27312
27312
|
className: u,
|
|
@@ -27317,12 +27317,12 @@ function Mz({ className: u, style: c }) {
|
|
|
27317
27317
|
strokeLinecap: "round",
|
|
27318
27318
|
strokeLinejoin: "round",
|
|
27319
27319
|
style: c,
|
|
27320
|
-
children: /* @__PURE__ */
|
|
27320
|
+
children: /* @__PURE__ */ ce("path", { d: "M18 6l-12 12M6 6l12 12" })
|
|
27321
27321
|
}
|
|
27322
27322
|
);
|
|
27323
27323
|
}
|
|
27324
27324
|
function $4({ className: u }) {
|
|
27325
|
-
return /* @__PURE__ */
|
|
27325
|
+
return /* @__PURE__ */ ce(
|
|
27326
27326
|
"svg",
|
|
27327
27327
|
{
|
|
27328
27328
|
className: u,
|
|
@@ -27332,12 +27332,12 @@ function $4({ className: u }) {
|
|
|
27332
27332
|
strokeWidth: "2",
|
|
27333
27333
|
strokeLinecap: "round",
|
|
27334
27334
|
strokeLinejoin: "round",
|
|
27335
|
-
children: /* @__PURE__ */
|
|
27335
|
+
children: /* @__PURE__ */ ce("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3.05h16.94a2 2 0 0 0 1.71-3.05l-8.47-14.14a2 2 0 0 0-3.42 0zM12 9v6M12 21h.01" })
|
|
27336
27336
|
}
|
|
27337
27337
|
);
|
|
27338
27338
|
}
|
|
27339
27339
|
function k4({ className: u }) {
|
|
27340
|
-
return /* @__PURE__ */
|
|
27340
|
+
return /* @__PURE__ */ ce(
|
|
27341
27341
|
"svg",
|
|
27342
27342
|
{
|
|
27343
27343
|
className: u,
|
|
@@ -27347,7 +27347,7 @@ function k4({ className: u }) {
|
|
|
27347
27347
|
strokeWidth: "2",
|
|
27348
27348
|
strokeLinecap: "round",
|
|
27349
27349
|
strokeLinejoin: "round",
|
|
27350
|
-
children: /* @__PURE__ */
|
|
27350
|
+
children: /* @__PURE__ */ ce("polyline", { points: "20 6 9 17 4 12" })
|
|
27351
27351
|
}
|
|
27352
27352
|
);
|
|
27353
27353
|
}
|
|
@@ -27363,8 +27363,8 @@ function K4({ className: u }) {
|
|
|
27363
27363
|
strokeLinecap: "round",
|
|
27364
27364
|
strokeLinejoin: "round",
|
|
27365
27365
|
children: [
|
|
27366
|
-
/* @__PURE__ */
|
|
27367
|
-
/* @__PURE__ */
|
|
27366
|
+
/* @__PURE__ */ ce("line", { x1: "12", y1: "19", x2: "12", y2: "5" }),
|
|
27367
|
+
/* @__PURE__ */ ce("polyline", { points: "5 12 12 5 19 12" })
|
|
27368
27368
|
]
|
|
27369
27369
|
}
|
|
27370
27370
|
);
|
|
@@ -27539,10 +27539,10 @@ function n3(u) {
|
|
|
27539
27539
|
`) ? D.slice(0, -1) : D
|
|
27540
27540
|
}), z = void 0, D = "", O = "";
|
|
27541
27541
|
}
|
|
27542
|
-
function
|
|
27542
|
+
function oe(re = {}) {
|
|
27543
27543
|
b && re.consume && Y(b), _ = !0, z = void 0, D = "", O = "", b = "";
|
|
27544
27544
|
}
|
|
27545
|
-
return { feed: B, reset:
|
|
27545
|
+
return { feed: B, reset: oe };
|
|
27546
27546
|
}
|
|
27547
27547
|
function l3(u) {
|
|
27548
27548
|
const c = [];
|
|
@@ -28759,25 +28759,25 @@ const IO = /* @__PURE__ */ K("$ZodObject", (u, c) => {
|
|
|
28759
28759
|
z.value = {};
|
|
28760
28760
|
const B = [], Y = _.shape;
|
|
28761
28761
|
for (const te of _.keys) {
|
|
28762
|
-
const
|
|
28763
|
-
|
|
28762
|
+
const oe = Y[te]._zod.run({ value: O[te], issues: [] }, D);
|
|
28763
|
+
oe instanceof Promise ? B.push(oe.then((re) => Ib(re, z, te, O))) : Ib(oe, z, te, O);
|
|
28764
28764
|
}
|
|
28765
28765
|
return b ? uT(B, O, z, D, h.value, u) : B.length ? Promise.all(B).then(() => z) : z;
|
|
28766
28766
|
};
|
|
28767
28767
|
}), FO = /* @__PURE__ */ K("$ZodObjectJIT", (u, c) => {
|
|
28768
28768
|
IO.init(u, c);
|
|
28769
28769
|
const d = u._zod.parse, h = o1(() => lT(c)), g = (te) => {
|
|
28770
|
-
const ae = new yO(["shape", "payload", "ctx"]),
|
|
28770
|
+
const ae = new yO(["shape", "payload", "ctx"]), oe = h.value, re = (ye) => {
|
|
28771
28771
|
const F = jE(ye);
|
|
28772
28772
|
return `shape[${F}]._zod.run({ value: input[${F}], issues: [] }, ctx)`;
|
|
28773
28773
|
};
|
|
28774
28774
|
ae.write("const input = payload.value;");
|
|
28775
28775
|
const se = /* @__PURE__ */ Object.create(null);
|
|
28776
28776
|
let le = 0;
|
|
28777
|
-
for (const ye of
|
|
28777
|
+
for (const ye of oe.keys)
|
|
28778
28778
|
se[ye] = `key_${le++}`;
|
|
28779
28779
|
ae.write("const newResult = {};");
|
|
28780
|
-
for (const ye of
|
|
28780
|
+
for (const ye of oe.keys) {
|
|
28781
28781
|
const F = se[ye], Qe = jE(ye);
|
|
28782
28782
|
ae.write(`const ${F} = ${re(ye)};`), ae.write(`
|
|
28783
28783
|
if (${F}.issues.length) {
|
|
@@ -28807,11 +28807,11 @@ const IO = /* @__PURE__ */ K("$ZodObject", (u, c) => {
|
|
|
28807
28807
|
let Y;
|
|
28808
28808
|
u._zod.parse = (te, ae) => {
|
|
28809
28809
|
Y ?? (Y = h.value);
|
|
28810
|
-
const
|
|
28811
|
-
return _(
|
|
28810
|
+
const oe = te.value;
|
|
28811
|
+
return _(oe) ? z && O && ae?.async === !1 && ae.jitless !== !0 ? (b || (b = g(c.shape)), te = b(te, ae), B ? uT([], oe, te, ae, Y, u) : te) : d(te, ae) : (te.issues.push({
|
|
28812
28812
|
expected: "object",
|
|
28813
28813
|
code: "invalid_type",
|
|
28814
|
-
input:
|
|
28814
|
+
input: oe,
|
|
28815
28815
|
inst: u
|
|
28816
28816
|
}), te);
|
|
28817
28817
|
};
|
|
@@ -32548,7 +32548,7 @@ function cC({
|
|
|
32548
32548
|
new TransformStream({
|
|
32549
32549
|
async transform(z, D) {
|
|
32550
32550
|
await h(async ({ state: O, write: B }) => {
|
|
32551
|
-
var Y, te, ae,
|
|
32551
|
+
var Y, te, ae, oe;
|
|
32552
32552
|
function re(F) {
|
|
32553
32553
|
const He = O.message.parts.filter(Qb).find(
|
|
32554
32554
|
(Te) => Te.toolCallId === F
|
|
@@ -32654,7 +32654,7 @@ function cC({
|
|
|
32654
32654
|
}
|
|
32655
32655
|
case "reasoning-end": {
|
|
32656
32656
|
const F = O.activeReasoningParts[z.id];
|
|
32657
|
-
F.providerMetadata = (
|
|
32657
|
+
F.providerMetadata = (oe = z.providerMetadata) != null ? oe : F.providerMetadata, F.state = "done", delete O.activeReasoningParts[z.id], B();
|
|
32658
32658
|
break;
|
|
32659
32659
|
}
|
|
32660
32660
|
case "file": {
|
|
@@ -33040,7 +33040,7 @@ var pC = class {
|
|
|
33040
33040
|
requestMetadata: c.metadata,
|
|
33041
33041
|
trigger: c.trigger,
|
|
33042
33042
|
messageId: c.messageId
|
|
33043
|
-
})), te = (h = Y?.api) != null ? h : this.api, ae = Y?.headers !== void 0 ? vd(Y.headers) : B,
|
|
33043
|
+
})), te = (h = Y?.api) != null ? h : this.api, ae = Y?.headers !== void 0 ? vd(Y.headers) : B, oe = Y?.body !== void 0 ? Y.body : {
|
|
33044
33044
|
...z,
|
|
33045
33045
|
...c.body,
|
|
33046
33046
|
id: c.chatId,
|
|
@@ -33057,7 +33057,7 @@ var pC = class {
|
|
|
33057
33057
|
`ai-sdk/${mz}`,
|
|
33058
33058
|
oz()
|
|
33059
33059
|
),
|
|
33060
|
-
body: JSON.stringify(
|
|
33060
|
+
body: JSON.stringify(oe),
|
|
33061
33061
|
credentials: re,
|
|
33062
33062
|
signal: u
|
|
33063
33063
|
});
|
|
@@ -33133,7 +33133,7 @@ var pC = class {
|
|
|
33133
33133
|
sendAutomaticallyWhen: B
|
|
33134
33134
|
}) {
|
|
33135
33135
|
this.activeResponse = void 0, this.jobExecutor = new sC(), this.sendMessage = async (Y, te) => {
|
|
33136
|
-
var ae,
|
|
33136
|
+
var ae, oe, re, se;
|
|
33137
33137
|
if (Y == null) {
|
|
33138
33138
|
await this.makeRequest({
|
|
33139
33139
|
trigger: "submit-message",
|
|
@@ -33161,7 +33161,7 @@ var pC = class {
|
|
|
33161
33161
|
this.state.messages = this.state.messages.slice(0, Ee + 1), this.state.replaceMessage(Ee, {
|
|
33162
33162
|
...le,
|
|
33163
33163
|
id: Y.messageId,
|
|
33164
|
-
role: (
|
|
33164
|
+
role: (oe = le.role) != null ? oe : "user",
|
|
33165
33165
|
metadata: Y.metadata
|
|
33166
33166
|
});
|
|
33167
33167
|
} else
|
|
@@ -33180,7 +33180,7 @@ var pC = class {
|
|
|
33180
33180
|
messageId: Y,
|
|
33181
33181
|
...te
|
|
33182
33182
|
} = {}) => {
|
|
33183
|
-
const ae = Y == null ? this.state.messages.length - 1 : this.state.messages.findIndex((
|
|
33183
|
+
const ae = Y == null ? this.state.messages.length - 1 : this.state.messages.findIndex((oe) => oe.id === Y);
|
|
33184
33184
|
if (ae === -1)
|
|
33185
33185
|
throw new Error(`message ${Y} not found`);
|
|
33186
33186
|
this.state.messages = this.state.messages.slice(
|
|
@@ -33200,7 +33200,7 @@ var pC = class {
|
|
|
33200
33200
|
state: Y = "output-available",
|
|
33201
33201
|
tool: te,
|
|
33202
33202
|
toolCallId: ae,
|
|
33203
|
-
output:
|
|
33203
|
+
output: oe,
|
|
33204
33204
|
errorText: re
|
|
33205
33205
|
}) => this.jobExecutor.run(async () => {
|
|
33206
33206
|
var se, le;
|
|
@@ -33208,13 +33208,13 @@ var pC = class {
|
|
|
33208
33208
|
this.state.replaceMessage(Ee.length - 1, {
|
|
33209
33209
|
...ye,
|
|
33210
33210
|
parts: ye.parts.map(
|
|
33211
|
-
(F) => pz(F) && F.toolCallId === ae ? { ...F, state: Y, output:
|
|
33211
|
+
(F) => pz(F) && F.toolCallId === ae ? { ...F, state: Y, output: oe, errorText: re } : F
|
|
33212
33212
|
)
|
|
33213
33213
|
}), this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(
|
|
33214
33214
|
(F) => pz(F) && F.toolCallId === ae ? {
|
|
33215
33215
|
...F,
|
|
33216
33216
|
state: Y,
|
|
33217
|
-
output:
|
|
33217
|
+
output: oe,
|
|
33218
33218
|
errorText: re
|
|
33219
33219
|
} : F
|
|
33220
33220
|
)), this.status !== "streaming" && this.status !== "submitted" && ((se = this.sendAutomaticallyWhen) != null && se.call(this, { messages: this.state.messages })) && this.makeRequest({
|
|
@@ -33277,7 +33277,7 @@ var pC = class {
|
|
|
33277
33277
|
ae.abortController.signal.addEventListener("abort", () => {
|
|
33278
33278
|
B = !0;
|
|
33279
33279
|
}), this.activeResponse = ae;
|
|
33280
|
-
let
|
|
33280
|
+
let oe;
|
|
33281
33281
|
if (u === "resume-stream") {
|
|
33282
33282
|
const se = await this.transport.reconnectToStream({
|
|
33283
33283
|
chatId: this.id,
|
|
@@ -33289,9 +33289,9 @@ var pC = class {
|
|
|
33289
33289
|
this.setStatus({ status: "ready" });
|
|
33290
33290
|
return;
|
|
33291
33291
|
}
|
|
33292
|
-
|
|
33292
|
+
oe = se;
|
|
33293
33293
|
} else
|
|
33294
|
-
|
|
33294
|
+
oe = await this.transport.sendMessages({
|
|
33295
33295
|
chatId: this.id,
|
|
33296
33296
|
messages: this.state.messages,
|
|
33297
33297
|
abortSignal: ae.abortController.signal,
|
|
@@ -33318,7 +33318,7 @@ var pC = class {
|
|
|
33318
33318
|
);
|
|
33319
33319
|
await rC({
|
|
33320
33320
|
stream: cC({
|
|
33321
|
-
stream:
|
|
33321
|
+
stream: oe,
|
|
33322
33322
|
onToolCall: this.onToolCall,
|
|
33323
33323
|
onData: this.onData,
|
|
33324
33324
|
messageMetadataSchema: this.messageMetadataSchema,
|
|
@@ -33534,8 +33534,7 @@ function DC(u, c, d) {
|
|
|
33534
33534
|
function MC(u, c, d) {
|
|
33535
33535
|
return bz.randomUUID && !u ? bz.randomUUID() : DC(u);
|
|
33536
33536
|
}
|
|
33537
|
-
|
|
33538
|
-
const l2 = "https://trailhead-production.up.railway.app", RC = Ra({
|
|
33537
|
+
const l2 = "http://localhost:3000", RC = Ra({
|
|
33539
33538
|
role: h2(["user", "assistant"]),
|
|
33540
33539
|
content: be()
|
|
33541
33540
|
}), CC = Ra({
|
|
@@ -33589,7 +33588,7 @@ function xC({ projectId: u, children: c }) {
|
|
|
33589
33588
|
if (!ye)
|
|
33590
33589
|
throw console.error("Invalid session data: ", _), new Error("Invalid session data");
|
|
33591
33590
|
return F;
|
|
33592
|
-
}),
|
|
33591
|
+
}), oe = kb(async () => {
|
|
33593
33592
|
b(!0);
|
|
33594
33593
|
try {
|
|
33595
33594
|
const re = localStorage.getItem(`th__token_${u}`);
|
|
@@ -33611,8 +33610,8 @@ function xC({ projectId: u, children: c }) {
|
|
|
33611
33610
|
}
|
|
33612
33611
|
}, [u]);
|
|
33613
33612
|
return dl(() => {
|
|
33614
|
-
|
|
33615
|
-
}, []), /* @__PURE__ */
|
|
33613
|
+
oe();
|
|
33614
|
+
}, []), /* @__PURE__ */ ce(
|
|
33616
33615
|
g2.Provider,
|
|
33617
33616
|
{
|
|
33618
33617
|
value: {
|
|
@@ -33621,7 +33620,7 @@ function xC({ projectId: u, children: c }) {
|
|
|
33621
33620
|
isLoading: d,
|
|
33622
33621
|
isFetching: g,
|
|
33623
33622
|
error: _,
|
|
33624
|
-
refetch:
|
|
33623
|
+
refetch: oe
|
|
33625
33624
|
},
|
|
33626
33625
|
children: c
|
|
33627
33626
|
}
|
|
@@ -33670,7 +33669,7 @@ function cA({ children: u }) {
|
|
|
33670
33669
|
metadata: { isLoading: !1 }
|
|
33671
33670
|
}))
|
|
33672
33671
|
});
|
|
33673
|
-
return /* @__PURE__ */
|
|
33672
|
+
return /* @__PURE__ */ ce(
|
|
33674
33673
|
oA.Provider,
|
|
33675
33674
|
{
|
|
33676
33675
|
value: {
|
|
@@ -33711,7 +33710,7 @@ function bd(...u) {
|
|
|
33711
33710
|
return HC(u);
|
|
33712
33711
|
}
|
|
33713
33712
|
const sA = Ez.forwardRef(
|
|
33714
|
-
({ className: u, size: c = "default", ...d }, h) => /* @__PURE__ */
|
|
33713
|
+
({ className: u, size: c = "default", ...d }, h) => /* @__PURE__ */ ce(
|
|
33715
33714
|
"button",
|
|
33716
33715
|
{
|
|
33717
33716
|
className: bd(
|
|
@@ -33729,7 +33728,7 @@ const sA = Ez.forwardRef(
|
|
|
33729
33728
|
)
|
|
33730
33729
|
);
|
|
33731
33730
|
sA.displayName = "Button";
|
|
33732
|
-
const fA = Ez.forwardRef(({ className: u, ...c }, d) => /* @__PURE__ */
|
|
33731
|
+
const fA = Ez.forwardRef(({ className: u, ...c }, d) => /* @__PURE__ */ ce(
|
|
33733
33732
|
"textarea",
|
|
33734
33733
|
{
|
|
33735
33734
|
className: bd(
|
|
@@ -33753,7 +33752,7 @@ function dA({ className: u, ...c }) {
|
|
|
33753
33752
|
"aria-label": "Loading",
|
|
33754
33753
|
...c,
|
|
33755
33754
|
children: [
|
|
33756
|
-
/* @__PURE__ */
|
|
33755
|
+
/* @__PURE__ */ ce(
|
|
33757
33756
|
"circle",
|
|
33758
33757
|
{
|
|
33759
33758
|
className: "opacity-25",
|
|
@@ -33764,7 +33763,7 @@ function dA({ className: u, ...c }) {
|
|
|
33764
33763
|
strokeWidth: "4"
|
|
33765
33764
|
}
|
|
33766
33765
|
),
|
|
33767
|
-
/* @__PURE__ */
|
|
33766
|
+
/* @__PURE__ */ ce(
|
|
33768
33767
|
"path",
|
|
33769
33768
|
{
|
|
33770
33769
|
className: "opacity-75",
|
|
@@ -33780,9 +33779,9 @@ function BC({
|
|
|
33780
33779
|
message: u,
|
|
33781
33780
|
className: c = "h-full"
|
|
33782
33781
|
}) {
|
|
33783
|
-
return /* @__PURE__ */
|
|
33784
|
-
/* @__PURE__ */
|
|
33785
|
-
u && /* @__PURE__ */
|
|
33782
|
+
return /* @__PURE__ */ ce("div", { className: `flex items-center justify-center ${c}`, children: /* @__PURE__ */ hl("div", { className: "text-center", children: [
|
|
33783
|
+
/* @__PURE__ */ ce(dA, { className: "size-6 mx-auto mb-3" }),
|
|
33784
|
+
u && /* @__PURE__ */ ce("p", { className: "text-gray-500", children: u })
|
|
33786
33785
|
] }) });
|
|
33787
33786
|
}
|
|
33788
33787
|
function jC({
|
|
@@ -33796,7 +33795,7 @@ function jC({
|
|
|
33796
33795
|
muted: "text-gray-400",
|
|
33797
33796
|
dark: "text-gray-700"
|
|
33798
33797
|
}[h];
|
|
33799
|
-
return /* @__PURE__ */
|
|
33798
|
+
return /* @__PURE__ */ ce(
|
|
33800
33799
|
"svg",
|
|
33801
33800
|
{
|
|
33802
33801
|
width: g,
|
|
@@ -33806,7 +33805,7 @@ function jC({
|
|
|
33806
33805
|
className: bd("inline-block", z, d),
|
|
33807
33806
|
style: { overflow: "hidden" },
|
|
33808
33807
|
"aria-label": "Loading",
|
|
33809
|
-
children: /* @__PURE__ */
|
|
33808
|
+
children: /* @__PURE__ */ ce("g", { children: /* @__PURE__ */ ce(
|
|
33810
33809
|
"path",
|
|
33811
33810
|
{
|
|
33812
33811
|
d: "M-16,12 Q-12,4 -8,12 Q-4,20 0,12 Q4,4 8,12 Q12,20 16,12 Q20,4 24,12 Q28,20 32,12 Q36,4 40,12 Q44,20 48,12 Q52,4 56,12 Q60,20 64,12",
|
|
@@ -33815,7 +33814,7 @@ function jC({
|
|
|
33815
33814
|
strokeWidth: "2",
|
|
33816
33815
|
strokeLinecap: "round",
|
|
33817
33816
|
strokeLinejoin: "round",
|
|
33818
|
-
children: /* @__PURE__ */
|
|
33817
|
+
children: /* @__PURE__ */ ce(
|
|
33819
33818
|
"animateTransform",
|
|
33820
33819
|
{
|
|
33821
33820
|
attributeName: "transform",
|
|
@@ -33870,7 +33869,7 @@ function GC({
|
|
|
33870
33869
|
B.key === "Enter" && !B.shiftKey && (B.preventDefault(), z(B));
|
|
33871
33870
|
}, O = cg(() => hA(h), [h]);
|
|
33872
33871
|
return /* @__PURE__ */ hl(u2, { children: [
|
|
33873
|
-
/* @__PURE__ */
|
|
33872
|
+
/* @__PURE__ */ ce("style", { children: `
|
|
33874
33873
|
@keyframes bounceIn {
|
|
33875
33874
|
0% {
|
|
33876
33875
|
opacity: 0;
|
|
@@ -33928,14 +33927,14 @@ function GC({
|
|
|
33928
33927
|
animation: slideUp 0.4s cubic-bezier(0.34, 1.15, 0.64, 1);
|
|
33929
33928
|
}
|
|
33930
33929
|
` }),
|
|
33931
|
-
/* @__PURE__ */
|
|
33930
|
+
/* @__PURE__ */ ce(
|
|
33932
33931
|
"form",
|
|
33933
33932
|
{
|
|
33934
33933
|
onSubmit: z,
|
|
33935
33934
|
className: "form-slide-up",
|
|
33936
33935
|
style: { touchAction: "manipulation" },
|
|
33937
33936
|
children: /* @__PURE__ */ hl("div", { className: "max-w-xl mx-auto px-4 py-3 flex items-end gap-2 rounded-full", children: [
|
|
33938
|
-
/* @__PURE__ */
|
|
33937
|
+
/* @__PURE__ */ ce(
|
|
33939
33938
|
fA,
|
|
33940
33939
|
{
|
|
33941
33940
|
ref: _,
|
|
@@ -33951,7 +33950,7 @@ function GC({
|
|
|
33951
33950
|
style: { touchAction: "manipulation" }
|
|
33952
33951
|
}
|
|
33953
33952
|
),
|
|
33954
|
-
/* @__PURE__ */
|
|
33953
|
+
/* @__PURE__ */ ce(
|
|
33955
33954
|
sA,
|
|
33956
33955
|
{
|
|
33957
33956
|
type: "submit",
|
|
@@ -33963,7 +33962,7 @@ function GC({
|
|
|
33963
33962
|
color: O
|
|
33964
33963
|
},
|
|
33965
33964
|
"aria-label": "Send message",
|
|
33966
|
-
children: /* @__PURE__ */
|
|
33965
|
+
children: /* @__PURE__ */ ce(K4, { className: "h-5 w-5" })
|
|
33967
33966
|
}
|
|
33968
33967
|
)
|
|
33969
33968
|
] })
|
|
@@ -34050,14 +34049,14 @@ function QC({
|
|
|
34050
34049
|
isFirstInGroup: b,
|
|
34051
34050
|
isMiddle: !b && !_
|
|
34052
34051
|
}), le = cg(() => hA(c), [c]);
|
|
34053
|
-
return /* @__PURE__ */
|
|
34052
|
+
return /* @__PURE__ */ ce(
|
|
34054
34053
|
"div",
|
|
34055
34054
|
{
|
|
34056
34055
|
className: bd(
|
|
34057
34056
|
"flex w-full",
|
|
34058
34057
|
z ? "justify-start" : "justify-end"
|
|
34059
34058
|
),
|
|
34060
|
-
children: /* @__PURE__ */
|
|
34059
|
+
children: /* @__PURE__ */ ce(
|
|
34061
34060
|
"div",
|
|
34062
34061
|
{
|
|
34063
34062
|
className: bd(
|
|
@@ -34070,7 +34069,7 @@ function QC({
|
|
|
34070
34069
|
...se,
|
|
34071
34070
|
...z ? {} : { backgroundColor: c, color: le }
|
|
34072
34071
|
},
|
|
34073
|
-
children: /* @__PURE__ */
|
|
34072
|
+
children: /* @__PURE__ */ ce("div", { className: "text-base whitespace-pre-wrap wrap-break-word", children: D })
|
|
34074
34073
|
}
|
|
34075
34074
|
)
|
|
34076
34075
|
}
|
|
@@ -34088,7 +34087,7 @@ function JC({
|
|
|
34088
34087
|
}, z = h ? "bg-muted" : _[b].bg, D = h ? "text-muted-foreground" : _[b].text;
|
|
34089
34088
|
return dl(() => {
|
|
34090
34089
|
u === "output-success" ? c?.() : u === "output-error" && d?.("Error submitting interest");
|
|
34091
|
-
}, [u, c, d]), /* @__PURE__ */
|
|
34090
|
+
}, [u, c, d]), /* @__PURE__ */ ce("div", { className: "flex justify-center w-full my-2", children: /* @__PURE__ */ hl(
|
|
34092
34091
|
"span",
|
|
34093
34092
|
{
|
|
34094
34093
|
className: bd(
|
|
@@ -34107,7 +34106,7 @@ function JC({
|
|
|
34107
34106
|
className: "relative inline-flex items-center justify-center shrink-0",
|
|
34108
34107
|
style: { width: "12px", height: "12px" },
|
|
34109
34108
|
children: [
|
|
34110
|
-
/* @__PURE__ */
|
|
34109
|
+
/* @__PURE__ */ ce(
|
|
34111
34110
|
"span",
|
|
34112
34111
|
{
|
|
34113
34112
|
style: {
|
|
@@ -34115,10 +34114,10 @@ function JC({
|
|
|
34115
34114
|
opacity: h ? 1 : 0,
|
|
34116
34115
|
transition: "opacity 0.3s ease-out"
|
|
34117
34116
|
},
|
|
34118
|
-
children: /* @__PURE__ */
|
|
34117
|
+
children: /* @__PURE__ */ ce(dA, { className: "h-3 w-3" })
|
|
34119
34118
|
}
|
|
34120
34119
|
),
|
|
34121
|
-
/* @__PURE__ */
|
|
34120
|
+
/* @__PURE__ */ ce(
|
|
34122
34121
|
"span",
|
|
34123
34122
|
{
|
|
34124
34123
|
style: {
|
|
@@ -34126,19 +34125,19 @@ function JC({
|
|
|
34126
34125
|
opacity: h ? 0 : 1,
|
|
34127
34126
|
transition: "opacity 0.3s ease-out 0.1s"
|
|
34128
34127
|
},
|
|
34129
|
-
children: g ? /* @__PURE__ */
|
|
34128
|
+
children: g ? /* @__PURE__ */ ce(Mz, { className: "h-3 w-3" }) : /* @__PURE__ */ ce(k4, { className: "h-3 w-3" })
|
|
34130
34129
|
}
|
|
34131
34130
|
)
|
|
34132
34131
|
]
|
|
34133
34132
|
}
|
|
34134
34133
|
),
|
|
34135
|
-
/* @__PURE__ */
|
|
34134
|
+
/* @__PURE__ */ ce(
|
|
34136
34135
|
"span",
|
|
34137
34136
|
{
|
|
34138
34137
|
style: {
|
|
34139
34138
|
transition: h ? "opacity 0.4s ease-out 0.15s, transform 0.4s ease-out 0.15s" : "none"
|
|
34140
34139
|
},
|
|
34141
|
-
children: h ? "Submitting..." : g ? "Error submitting" : /* @__PURE__ */
|
|
34140
|
+
children: h ? "Submitting..." : g ? "Error submitting" : /* @__PURE__ */ ce("div", { children: "Thank you! we'll be in touch soon." })
|
|
34142
34141
|
}
|
|
34143
34142
|
)
|
|
34144
34143
|
]
|
|
@@ -34159,9 +34158,9 @@ function $C({
|
|
|
34159
34158
|
const Y = D.text.trim();
|
|
34160
34159
|
if (Y === "" || Y.length === 1 && Y.startsWith("<") || Y.length > 1 && Y.startsWith("<C"))
|
|
34161
34160
|
return null;
|
|
34162
|
-
const te = Y.replace(/<C[\w_>]*\W/g, ""), ae = _.id?.startsWith("welcome-") && z < 3,
|
|
34161
|
+
const te = Y.replace(/<C[\w_>]*\W/g, ""), ae = _.id?.startsWith("welcome-") && z < 3, oe = _.role === "system";
|
|
34163
34162
|
let re = !0, se = !0;
|
|
34164
|
-
if (!
|
|
34163
|
+
if (!oe) {
|
|
34165
34164
|
let le = z - 1;
|
|
34166
34165
|
for (; le >= 0; ) {
|
|
34167
34166
|
const Qe = u[le].role, He = u[le].parts.find(
|
|
@@ -34185,7 +34184,7 @@ function $C({
|
|
|
34185
34184
|
const F = ye < u.length ? u[ye] : null;
|
|
34186
34185
|
se = !F || F.role !== _.role;
|
|
34187
34186
|
}
|
|
34188
|
-
return /* @__PURE__ */
|
|
34187
|
+
return /* @__PURE__ */ ce(
|
|
34189
34188
|
QC,
|
|
34190
34189
|
{
|
|
34191
34190
|
role: _.role,
|
|
@@ -34200,15 +34199,15 @@ function $C({
|
|
|
34200
34199
|
B
|
|
34201
34200
|
);
|
|
34202
34201
|
}
|
|
34203
|
-
return D.type === "tool-end_conversation" ? /* @__PURE__ */
|
|
34202
|
+
return D.type === "tool-end_conversation" ? /* @__PURE__ */ ce(JC, { state: D.state }, B) : null;
|
|
34204
34203
|
})
|
|
34205
34204
|
),
|
|
34206
|
-
(c || b) && /* @__PURE__ */
|
|
34205
|
+
(c || b) && /* @__PURE__ */ ce("div", { className: "flex w-full justify-start", children: /* @__PURE__ */ ce(
|
|
34207
34206
|
"div",
|
|
34208
34207
|
{
|
|
34209
34208
|
className: "px-4 py-3 rounded-t-2xl bg-gray-100 text-gray-800 rounded-r-2xl rounded-bl-[8px]",
|
|
34210
34209
|
style: { animation: "slideUp 0.15s ease-out" },
|
|
34211
|
-
children: /* @__PURE__ */
|
|
34210
|
+
children: /* @__PURE__ */ ce("div", { className: "h-[14px] flex items-center", children: /* @__PURE__ */ ce(
|
|
34212
34211
|
jC,
|
|
34213
34212
|
{
|
|
34214
34213
|
variant: "narrow",
|
|
@@ -34243,15 +34242,15 @@ function mA({
|
|
|
34243
34242
|
role: "assistant",
|
|
34244
34243
|
parts: [{ type: "text", text: ue }],
|
|
34245
34244
|
metadata: { isLoading: !1 }
|
|
34246
|
-
})) ?? [], [b]), { messages:
|
|
34247
|
-
const ue =
|
|
34245
|
+
})) ?? [], [b]), { messages: oe, setMessages: re, sendMessage: se, status: le, error: Ee } = NC(), ye = cg(() => {
|
|
34246
|
+
const ue = oe[oe.length - 1]?.parts ?? [], je = ue[ue.length - 1], de = le === "streaming" && je?.type !== "text";
|
|
34248
34247
|
return le === "submitted" || de;
|
|
34249
|
-
}, [
|
|
34248
|
+
}, [oe, le]);
|
|
34250
34249
|
dl(() => {
|
|
34251
34250
|
Ee && c?.(Ee);
|
|
34252
34251
|
}, [Ee]), dl(() => {
|
|
34253
|
-
if (
|
|
34254
|
-
const ue =
|
|
34252
|
+
if (oe.length === 0 || !d) return;
|
|
34253
|
+
const ue = oe[oe.length - 1];
|
|
34255
34254
|
if (ue.role !== "assistant") return;
|
|
34256
34255
|
const je = ue.parts[ue.parts.length - 1];
|
|
34257
34256
|
if (je.type !== "tool-update_data" || je.state !== "output-available")
|
|
@@ -34268,9 +34267,9 @@ function mA({
|
|
|
34268
34267
|
return;
|
|
34269
34268
|
}
|
|
34270
34269
|
d?.(de.data);
|
|
34271
|
-
}, [
|
|
34272
|
-
if (O || !u ||
|
|
34273
|
-
const ue =
|
|
34270
|
+
}, [oe]), dl(() => {
|
|
34271
|
+
if (O || !u || oe.length === 0) return;
|
|
34272
|
+
const ue = oe[oe.length - 1];
|
|
34274
34273
|
if (ue.role !== "assistant") return;
|
|
34275
34274
|
const je = ue.parts[ue.parts.length - 1];
|
|
34276
34275
|
if (je.type !== "tool-end_conversation" || je.state !== "output-available")
|
|
@@ -34287,7 +34286,7 @@ function mA({
|
|
|
34287
34286
|
return;
|
|
34288
34287
|
}
|
|
34289
34288
|
B(!0), te(!1), u?.(de.data);
|
|
34290
|
-
}, [
|
|
34289
|
+
}, [oe]);
|
|
34291
34290
|
const F = kb(
|
|
34292
34291
|
(ue, je = "success", de = !1) => {
|
|
34293
34292
|
const Et = {
|
|
@@ -34327,26 +34326,26 @@ function mA({
|
|
|
34327
34326
|
};
|
|
34328
34327
|
}, [g, ae, _]);
|
|
34329
34328
|
const Qe = async (ue) => {
|
|
34330
|
-
if (
|
|
34329
|
+
if (oe.length >= z) {
|
|
34331
34330
|
F("Max chat length reached.", "warning");
|
|
34332
34331
|
return;
|
|
34333
34332
|
}
|
|
34334
34333
|
await se({ text: ue });
|
|
34335
34334
|
}, He = i1(null), Te = cg(() => {
|
|
34336
34335
|
if (ye) return "Waiting for response...";
|
|
34337
|
-
const ue =
|
|
34336
|
+
const ue = oe.filter((de) => de.role === "assistant").slice(-1)[0];
|
|
34338
34337
|
if (!ue) return;
|
|
34339
34338
|
const je = ue.parts.find((de) => de.type === "text")?.text?.toLowerCase() || "";
|
|
34340
34339
|
return ZC(je) ?? "Type your message...";
|
|
34341
|
-
}, [
|
|
34340
|
+
}, [oe]);
|
|
34342
34341
|
return dl(() => {
|
|
34343
34342
|
He.current && requestAnimationFrame(() => {
|
|
34344
34343
|
requestAnimationFrame(() => {
|
|
34345
34344
|
He.current && (He.current.scrollTop = He.current.scrollHeight);
|
|
34346
34345
|
});
|
|
34347
34346
|
});
|
|
34348
|
-
}, [
|
|
34349
|
-
/* @__PURE__ */
|
|
34347
|
+
}, [oe]), /* @__PURE__ */ hl(u2, { children: [
|
|
34348
|
+
/* @__PURE__ */ ce("style", { children: `
|
|
34350
34349
|
@keyframes slideUp {
|
|
34351
34350
|
from {
|
|
34352
34351
|
opacity: 0;
|
|
@@ -34371,13 +34370,13 @@ function mA({
|
|
|
34371
34370
|
}
|
|
34372
34371
|
` }),
|
|
34373
34372
|
/* @__PURE__ */ hl("div", { className: "h-full flex flex-col pt-4", children: [
|
|
34374
|
-
/* @__PURE__ */
|
|
34373
|
+
/* @__PURE__ */ ce(
|
|
34375
34374
|
"div",
|
|
34376
34375
|
{
|
|
34377
34376
|
ref: He,
|
|
34378
34377
|
className: "flex-1 overflow-y-auto",
|
|
34379
34378
|
children: /* @__PURE__ */ hl("div", { className: "max-w-xl mx-auto px-4 pt-8 pb-4", children: [
|
|
34380
|
-
D && /* @__PURE__ */
|
|
34379
|
+
D && /* @__PURE__ */ ce("div", { className: "flex justify-center py-8", children: /* @__PURE__ */ ce(
|
|
34381
34380
|
"img",
|
|
34382
34381
|
{
|
|
34383
34382
|
src: D,
|
|
@@ -34385,10 +34384,10 @@ function mA({
|
|
|
34385
34384
|
className: "h-8 logo-enter rounded-full"
|
|
34386
34385
|
}
|
|
34387
34386
|
) }),
|
|
34388
|
-
/* @__PURE__ */
|
|
34387
|
+
/* @__PURE__ */ ce(
|
|
34389
34388
|
$C,
|
|
34390
34389
|
{
|
|
34391
|
-
messages:
|
|
34390
|
+
messages: oe,
|
|
34392
34391
|
isLoading: ye,
|
|
34393
34392
|
color: h
|
|
34394
34393
|
}
|
|
@@ -34396,12 +34395,12 @@ function mA({
|
|
|
34396
34395
|
] })
|
|
34397
34396
|
}
|
|
34398
34397
|
),
|
|
34399
|
-
Y && /* @__PURE__ */
|
|
34398
|
+
Y && /* @__PURE__ */ ce("div", { className: "shrink-0 bg-background ", children: /* @__PURE__ */ ce(
|
|
34400
34399
|
GC,
|
|
34401
34400
|
{
|
|
34402
34401
|
onSend: Qe,
|
|
34403
|
-
disabled: ye || !Y || O ||
|
|
34404
|
-
placeholder: O ? "Conversation ended." :
|
|
34402
|
+
disabled: ye || !Y || O || oe.length >= z,
|
|
34403
|
+
placeholder: O ? "Conversation ended." : oe.length >= z ? "Max chat length reached." : Te,
|
|
34405
34404
|
color: h
|
|
34406
34405
|
}
|
|
34407
34406
|
) })
|
|
@@ -34412,11 +34411,11 @@ function pA({
|
|
|
34412
34411
|
error: u,
|
|
34413
34412
|
onRetry: c
|
|
34414
34413
|
}) {
|
|
34415
|
-
return /* @__PURE__ */
|
|
34416
|
-
/* @__PURE__ */
|
|
34417
|
-
/* @__PURE__ */
|
|
34418
|
-
/* @__PURE__ */
|
|
34419
|
-
c && /* @__PURE__ */
|
|
34414
|
+
return /* @__PURE__ */ ce("div", { className: "flex-1 flex items-center justify-center p-6", children: /* @__PURE__ */ hl("div", { className: "text-center", children: [
|
|
34415
|
+
/* @__PURE__ */ ce($4, { className: "w-6 h-6 text-red-600" }),
|
|
34416
|
+
/* @__PURE__ */ ce("p", { className: "text-red-600 font-medium mb-1", children: "Failed to load chat" }),
|
|
34417
|
+
/* @__PURE__ */ ce("p", { className: "text-gray-500 text-sm mb-4", children: u.message }),
|
|
34418
|
+
c && /* @__PURE__ */ ce(
|
|
34420
34419
|
"button",
|
|
34421
34420
|
{
|
|
34422
34421
|
onClick: c,
|
|
@@ -34427,10 +34426,10 @@ function pA({
|
|
|
34427
34426
|
] }) });
|
|
34428
34427
|
}
|
|
34429
34428
|
function yA() {
|
|
34430
|
-
return /* @__PURE__ */
|
|
34431
|
-
/* @__PURE__ */
|
|
34432
|
-
/* @__PURE__ */
|
|
34433
|
-
/* @__PURE__ */
|
|
34429
|
+
return /* @__PURE__ */ ce("div", { className: "flex-1 flex items-center justify-center p-6", children: /* @__PURE__ */ hl("div", { className: "text-center", children: [
|
|
34430
|
+
/* @__PURE__ */ ce("div", { className: "w-12 h-12 rounded-full bg-gray-100 flex items-center justify-center mx-auto mb-4", children: /* @__PURE__ */ ce(Dz, { className: "w-6 h-6 text-gray-400" }) }),
|
|
34431
|
+
/* @__PURE__ */ ce("p", { className: "text-gray-600 font-medium mb-1", children: "Chat unavailable" }),
|
|
34432
|
+
/* @__PURE__ */ ce("p", { className: "text-gray-500 text-sm", children: "Unable to start a session" })
|
|
34434
34433
|
] }) });
|
|
34435
34434
|
}
|
|
34436
34435
|
function kC({
|
|
@@ -34441,7 +34440,7 @@ function kC({
|
|
|
34441
34440
|
onSubmit: g,
|
|
34442
34441
|
onError: b
|
|
34443
34442
|
}) {
|
|
34444
|
-
return /* @__PURE__ */
|
|
34443
|
+
return /* @__PURE__ */ ce(xC, { projectId: u, children: /* @__PURE__ */ ce(
|
|
34445
34444
|
KC,
|
|
34446
34445
|
{
|
|
34447
34446
|
projectId: u,
|
|
@@ -34476,7 +34475,7 @@ function KC({
|
|
|
34476
34475
|
onSubmit: h,
|
|
34477
34476
|
onError: g
|
|
34478
34477
|
};
|
|
34479
|
-
return u === "bubble" ? /* @__PURE__ */
|
|
34478
|
+
return u === "bubble" ? /* @__PURE__ */ ce(
|
|
34480
34479
|
FC,
|
|
34481
34480
|
{
|
|
34482
34481
|
...B,
|
|
@@ -34485,10 +34484,10 @@ function KC({
|
|
|
34485
34484
|
session: b,
|
|
34486
34485
|
onRetry: D
|
|
34487
34486
|
}
|
|
34488
|
-
) : _ ? /* @__PURE__ */
|
|
34487
|
+
) : _ ? /* @__PURE__ */ ce(BC, {}) : z ? /* @__PURE__ */ ce(pA, { error: z, onRetry: D }) : b ? /* @__PURE__ */ ce(IC, { ...B }, "embedded") : /* @__PURE__ */ ce(yA, {});
|
|
34489
34488
|
}
|
|
34490
34489
|
function IC(u) {
|
|
34491
|
-
return /* @__PURE__ */
|
|
34490
|
+
return /* @__PURE__ */ ce(cA, { children: /* @__PURE__ */ ce(mA, { ...u }) });
|
|
34492
34491
|
}
|
|
34493
34492
|
function FC({
|
|
34494
34493
|
isLoading: u,
|
|
@@ -34499,8 +34498,8 @@ function FC({
|
|
|
34499
34498
|
}) {
|
|
34500
34499
|
const [b, _] = ai(!1);
|
|
34501
34500
|
return u ? null : /* @__PURE__ */ hl(u2, { children: [
|
|
34502
|
-
b && /* @__PURE__ */
|
|
34503
|
-
/* @__PURE__ */
|
|
34501
|
+
b && /* @__PURE__ */ ce("div", { className: "absolute bottom-24 right-5 w-[400px] h-[600px] max-w-[calc(100vw-40px)] max-h-[calc(100vh-140px)] shadow-2xl bg-white rounded-xl z-9999 flex flex-col overflow-hidden animate-in fade-in slide-in-from-bottom-4 duration-300", children: c ? /* @__PURE__ */ ce(pA, { error: c, onRetry: h }) : d ? /* @__PURE__ */ ce(cA, { children: /* @__PURE__ */ ce(mA, { ...g }) }) : /* @__PURE__ */ ce(yA, {}) }),
|
|
34502
|
+
/* @__PURE__ */ ce(
|
|
34504
34503
|
"button",
|
|
34505
34504
|
{
|
|
34506
34505
|
onClick: () => _(!b),
|
|
@@ -34508,7 +34507,7 @@ function FC({
|
|
|
34508
34507
|
style: { backgroundColor: d?.color ?? "#252525" },
|
|
34509
34508
|
"aria-label": b ? "Close chat" : "Open chat",
|
|
34510
34509
|
children: /* @__PURE__ */ hl("div", { className: "relative w-7 h-7", children: [
|
|
34511
|
-
/* @__PURE__ */
|
|
34510
|
+
/* @__PURE__ */ ce(
|
|
34512
34511
|
Mz,
|
|
34513
34512
|
{
|
|
34514
34513
|
className: "w-7 h-7 text-white absolute inset-0 transition-all duration-300",
|
|
@@ -34519,7 +34518,7 @@ function FC({
|
|
|
34519
34518
|
}
|
|
34520
34519
|
}
|
|
34521
34520
|
),
|
|
34522
|
-
/* @__PURE__ */
|
|
34521
|
+
/* @__PURE__ */ ce(
|
|
34523
34522
|
Dz,
|
|
34524
34523
|
{
|
|
34525
34524
|
className: "w-7 h-7 text-white absolute inset-0 transition-all duration-300",
|
|
@@ -34541,7 +34540,7 @@ function WC(u, c) {
|
|
|
34541
34540
|
throw new Error(`Element with id "${u}" not found`);
|
|
34542
34541
|
const h = J4.createRoot(d);
|
|
34543
34542
|
return h.render(
|
|
34544
|
-
/* @__PURE__ */
|
|
34543
|
+
/* @__PURE__ */ ce(q4, { children: /* @__PURE__ */ ce(kC, { ...c }) })
|
|
34545
34544
|
), { unmount: () => h.unmount() };
|
|
34546
34545
|
}
|
|
34547
34546
|
if (typeof window < "u") {
|