@eloquentai/chat-sdk 0.36.1-dev.1 → 0.36.2-dev.1
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.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { L as
|
|
3
|
-
import { jsx as
|
|
2
|
+
import { L as Mt, c as nt, u as At, g as ct, X as Pt, i as Ot, A as Ut, d as H, e as Ze, f as jt, h as Dt, r as $t, t as Bt, j as Lt, N as at, k as $e, l as Nt, H as Zt, w as ut, m as Kt, s as Vt, n as Wt, o as Ht, E as Ft, p as Jt, S as Gt, C as Yt, T as Xt } from "./skeleton-B1g6gW9j.js";
|
|
3
|
+
import { jsx as C, jsxs as Be, Fragment as Qt } from "react/jsx-runtime";
|
|
4
4
|
import { useState as S, useEffect as F, useMemo as et, useCallback as w, useRef as N } from "react";
|
|
5
5
|
import { createPortal as tt } from "react-dom";
|
|
6
6
|
import eo from "react-dom/client";
|
|
7
7
|
try {
|
|
8
8
|
let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, t = new e.Error().stack;
|
|
9
|
-
t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "
|
|
9
|
+
t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "cf9fcab7-6583-4e6b-8b7d-e0ff62e9131e", e._sentryDebugIdIdentifier = "sentry-dbid-cf9fcab7-6583-4e6b-8b7d-e0ff62e9131e");
|
|
10
10
|
} catch {
|
|
11
11
|
}
|
|
12
12
|
if (typeof window < "u") {
|
|
@@ -39,7 +39,7 @@ function oo({
|
|
|
39
39
|
isDarkMode: t = !1
|
|
40
40
|
}) {
|
|
41
41
|
const o = t ? "#fff" : "#000", r = t ? "#000000" : "#ffffff";
|
|
42
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ C("div", { className: "eloq:absolute eloq:inset-0 eloq:m-auto eloq:flex eloq:items-center eloq:justify-center eloq:overflow-hidden", children: /* @__PURE__ */ C(
|
|
43
43
|
"div",
|
|
44
44
|
{
|
|
45
45
|
className: nt(
|
|
@@ -48,13 +48,13 @@ function oo({
|
|
|
48
48
|
t ? "eloq:bg-[#fff] eloq:text-[#000]" : "eloq:bg-[#000] eloq:text-[#fff]"
|
|
49
49
|
),
|
|
50
50
|
onClick: e,
|
|
51
|
-
children: /* @__PURE__ */
|
|
51
|
+
children: /* @__PURE__ */ C("div", { className: "eloq:absolute eloq:inset-0 eloq:flex eloq:justify-center eloq:items-center eloq:m-auto", children: /* @__PURE__ */ C(Mt, { bgColor: o, fgColor: r }) })
|
|
52
52
|
}
|
|
53
53
|
) });
|
|
54
54
|
}
|
|
55
55
|
function Je({ children: e, head: t, ...o }) {
|
|
56
56
|
const [r, n] = S(null), a = r?.contentWindow?.document?.head, c = r?.contentWindow?.document?.body;
|
|
57
|
-
return /* @__PURE__ */
|
|
57
|
+
return /* @__PURE__ */ Be("iframe", { ...o, ref: n, children: [
|
|
58
58
|
a && tt(t, a),
|
|
59
59
|
c && tt(e, c)
|
|
60
60
|
] });
|
|
@@ -69,7 +69,7 @@ function no({
|
|
|
69
69
|
onMessageClick: r,
|
|
70
70
|
autoHideDelay: n
|
|
71
71
|
}) {
|
|
72
|
-
const [a, c] = S(!1), [s, u] = S("entering"), i =
|
|
72
|
+
const [a, c] = S(!1), [s, u] = S("entering"), i = At();
|
|
73
73
|
return F(() => {
|
|
74
74
|
if (t) {
|
|
75
75
|
c(!0), u("entering");
|
|
@@ -92,7 +92,7 @@ function no({
|
|
|
92
92
|
}, 300);
|
|
93
93
|
return () => clearTimeout(l);
|
|
94
94
|
}
|
|
95
|
-
}, [t, o, n]), a ? /* @__PURE__ */
|
|
95
|
+
}, [t, o, n]), a ? /* @__PURE__ */ C(
|
|
96
96
|
"div",
|
|
97
97
|
{
|
|
98
98
|
className: nt(
|
|
@@ -103,7 +103,7 @@ function no({
|
|
|
103
103
|
s === "visible" && "eloq:translate-x-0 eloq:opacity-100 eloq:scale-100",
|
|
104
104
|
s === "exiting" && "eloq:translate-x-8 eloq:opacity-0 eloq:scale-95"
|
|
105
105
|
),
|
|
106
|
-
children: /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ C("div", { className: "eloq:relative eloq:drop-shadow-lg eloq:hover:drop-shadow-xl eloq:transition-all eloq:duration-300", children: /* @__PURE__ */ Be(
|
|
107
107
|
"div",
|
|
108
108
|
{
|
|
109
109
|
className: "eloq:relative eloq:rounded-lg eloq:border eloq:p-3 eloq:cursor-pointer",
|
|
@@ -112,14 +112,14 @@ function no({
|
|
|
112
112
|
},
|
|
113
113
|
onClick: r,
|
|
114
114
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ Be(
|
|
116
116
|
"svg",
|
|
117
117
|
{
|
|
118
118
|
"aria-hidden": !0,
|
|
119
119
|
className: "eloq:absolute eloq:bottom-1 eloq:-right-[9px] eloq:h-4 eloq:w-4 eloq:-scale-x-100",
|
|
120
120
|
viewBox: "0 0 10.54 11.14",
|
|
121
121
|
children: [
|
|
122
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ C(
|
|
123
123
|
"path",
|
|
124
124
|
{
|
|
125
125
|
d: "M5.75,0s0,.36,0,.51c-.09,4.52-5.74,10.64-5.74,10.64,8.19.02,10.54-2.26,10.54-2.26h0c-1.6-2.96-3.19-5.92-4.79-8.88Z",
|
|
@@ -129,7 +129,7 @@ function no({
|
|
|
129
129
|
style: { stroke: "hsl(var(--border))" }
|
|
130
130
|
}
|
|
131
131
|
),
|
|
132
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ C(
|
|
133
133
|
"rect",
|
|
134
134
|
{
|
|
135
135
|
x: "6.2",
|
|
@@ -142,7 +142,7 @@ function no({
|
|
|
142
142
|
]
|
|
143
143
|
}
|
|
144
144
|
),
|
|
145
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ C(
|
|
146
146
|
"p",
|
|
147
147
|
{
|
|
148
148
|
className: "eloq:text-sm eloq:leading-relaxed eloq:pr-4",
|
|
@@ -152,7 +152,7 @@ function no({
|
|
|
152
152
|
children: e
|
|
153
153
|
}
|
|
154
154
|
),
|
|
155
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ C(
|
|
156
156
|
"button",
|
|
157
157
|
{
|
|
158
158
|
"aria-label": "Dismiss message",
|
|
@@ -165,7 +165,7 @@ function no({
|
|
|
165
165
|
// with the message on any bubble background (and dark mode).
|
|
166
166
|
color: i.botBubbleTextColor || ct(i.botBubbleColor)
|
|
167
167
|
},
|
|
168
|
-
children: /* @__PURE__ */
|
|
168
|
+
children: /* @__PURE__ */ C(Pt, { className: "eloq:w-2.5 eloq:h-2.5", strokeWidth: 1.75 })
|
|
169
169
|
}
|
|
170
170
|
)
|
|
171
171
|
]
|
|
@@ -174,7 +174,7 @@ function no({
|
|
|
174
174
|
}
|
|
175
175
|
) : null;
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function dt(e) {
|
|
178
178
|
if (typeof document > "u") return null;
|
|
179
179
|
const t = document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));
|
|
180
180
|
return t ? decodeURIComponent(t[1]) : null;
|
|
@@ -329,7 +329,7 @@ function it({ appId: e }) {
|
|
|
329
329
|
function po(e) {
|
|
330
330
|
return e.flatMap((t) => {
|
|
331
331
|
if (!t.attachments) return [t];
|
|
332
|
-
const o = t.attachments.filter((r) =>
|
|
332
|
+
const o = t.attachments.filter((r) => Ot(r.url)).map(({ url: r, mimeType: n, name: a }) => ({ url: r, mimeType: n, name: a }));
|
|
333
333
|
return o.length > 0 ? [{ ...t, attachments: o }] : t.content ? [{ ...t, attachments: void 0 }] : [];
|
|
334
334
|
});
|
|
335
335
|
}
|
|
@@ -439,17 +439,17 @@ function yo(e) {
|
|
|
439
439
|
case "data": {
|
|
440
440
|
if (q.id !== i) return;
|
|
441
441
|
R = Date.now();
|
|
442
|
-
let
|
|
443
|
-
if (typeof
|
|
442
|
+
let _ = q.event;
|
|
443
|
+
if (typeof _ == "string")
|
|
444
444
|
try {
|
|
445
|
-
|
|
445
|
+
_ = JSON.parse(_);
|
|
446
446
|
} catch {
|
|
447
447
|
console.warn(
|
|
448
448
|
"[EloquentChatSDK] Unparseable realtime event ignored"
|
|
449
449
|
);
|
|
450
450
|
return;
|
|
451
451
|
}
|
|
452
|
-
n(
|
|
452
|
+
n(_);
|
|
453
453
|
return;
|
|
454
454
|
}
|
|
455
455
|
case "broadcast_error": {
|
|
@@ -484,7 +484,7 @@ class ko {
|
|
|
484
484
|
function _o(e) {
|
|
485
485
|
return new ko(e);
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function St(e) {
|
|
488
488
|
const t = e.startsWith("^") ? 1 : 0, o = e.endsWith("$") ? e.length - 1 : e.length;
|
|
489
489
|
return e.slice(t, o);
|
|
490
490
|
}
|
|
@@ -496,7 +496,7 @@ function Co(e, t, o) {
|
|
|
496
496
|
configurable: !0
|
|
497
497
|
});
|
|
498
498
|
}
|
|
499
|
-
const
|
|
499
|
+
const It = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
500
500
|
};
|
|
501
501
|
function ot(e) {
|
|
502
502
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
@@ -510,7 +510,7 @@ function So(e) {
|
|
|
510
510
|
const o = t.prototype;
|
|
511
511
|
return !(ot(o) === !1 || Object.prototype.hasOwnProperty.call(o, "isPrototypeOf") === !1);
|
|
512
512
|
}
|
|
513
|
-
function
|
|
513
|
+
function pt(e) {
|
|
514
514
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
515
515
|
}
|
|
516
516
|
function Io(e, t, o) {
|
|
@@ -558,7 +558,7 @@ function Ae(e, t) {
|
|
|
558
558
|
function Me(e) {
|
|
559
559
|
return typeof e == "string" ? e : e?.message;
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function ht(e, t, o) {
|
|
562
562
|
var r;
|
|
563
563
|
for (let n = t; n < e.length; n++)
|
|
564
564
|
(r = e[n]).schema ?? (r.schema = o);
|
|
@@ -578,20 +578,20 @@ function zo(e, t) {
|
|
|
578
578
|
r.get ? Object.defineProperty(e, o, { ...r, enumerable: !1 }) : Mo(e, o, r.value);
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function Oe(e, t, o, r = !0) {
|
|
582
582
|
return Object.defineProperty(e, t, { configurable: !0, writable: !0, enumerable: r, value: o }), o;
|
|
583
583
|
}
|
|
584
584
|
function To(e, t, o) {
|
|
585
|
-
return
|
|
585
|
+
return Oe(e, t, o, !1);
|
|
586
586
|
}
|
|
587
587
|
function Mo(e, t, o) {
|
|
588
588
|
Object.defineProperty(e, t, {
|
|
589
589
|
configurable: !0,
|
|
590
590
|
get() {
|
|
591
|
-
return this == null ? o :
|
|
591
|
+
return this == null ? o : Oe(this, t, o.bind(this));
|
|
592
592
|
},
|
|
593
593
|
set(r) {
|
|
594
|
-
|
|
594
|
+
Oe(this, t, r);
|
|
595
595
|
}
|
|
596
596
|
});
|
|
597
597
|
}
|
|
@@ -643,18 +643,18 @@ function Oo(e, t, o, r) {
|
|
|
643
643
|
}
|
|
644
644
|
});
|
|
645
645
|
}
|
|
646
|
-
var
|
|
646
|
+
var ft;
|
|
647
647
|
const Xe = { value: void 0, enumerable: !1 };
|
|
648
|
-
let
|
|
648
|
+
let gt = "captureStackTrace" in Error ? Error : null;
|
|
649
649
|
function Uo(e) {
|
|
650
|
-
const t =
|
|
650
|
+
const t = gt;
|
|
651
651
|
if (t) {
|
|
652
652
|
const o = t.stackTraceLimit;
|
|
653
653
|
if (typeof o == "number") {
|
|
654
654
|
try {
|
|
655
655
|
t.stackTraceLimit = 0;
|
|
656
656
|
} catch {
|
|
657
|
-
return
|
|
657
|
+
return gt = null, new e();
|
|
658
658
|
}
|
|
659
659
|
try {
|
|
660
660
|
return new e();
|
|
@@ -721,7 +721,7 @@ class Pe extends Error {
|
|
|
721
721
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
-
(
|
|
724
|
+
(ft = globalThis).__zod_globalConfig ?? (ft.__zod_globalConfig = {});
|
|
725
725
|
const Le = globalThis.__zod_globalConfig;
|
|
726
726
|
function ye(e) {
|
|
727
727
|
return e && Object.assign(Le, e), Le;
|
|
@@ -738,10 +738,10 @@ const $o = {
|
|
|
738
738
|
set: Do,
|
|
739
739
|
enumerable: !0,
|
|
740
740
|
configurable: !0
|
|
741
|
-
}, Qe = { value: void 0, enumerable: !1 },
|
|
741
|
+
}, Qe = { value: void 0, enumerable: !1 }, mt = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]), Bo = (e, t) => {
|
|
742
742
|
e.name = "$ZodError", Qe.value = t, Object.defineProperty(e, "issues", Qe), Qe.value = void 0, Object.defineProperty(e, "message", $o);
|
|
743
743
|
const o = Object.getPrototypeOf(e);
|
|
744
|
-
|
|
744
|
+
mt.has(o) || (mt.add(o), Object.defineProperty(o, "toString", {
|
|
745
745
|
configurable: !0,
|
|
746
746
|
enumerable: !1,
|
|
747
747
|
get() {
|
|
@@ -761,7 +761,7 @@ const $o = {
|
|
|
761
761
|
throw new Pe();
|
|
762
762
|
if (s.issues.length) {
|
|
763
763
|
const u = new (a?.Err ?? e)(s.issues.map((i) => Se(i, c, ye())));
|
|
764
|
-
throw
|
|
764
|
+
throw It(u, a?.callee ?? t), u;
|
|
765
765
|
}
|
|
766
766
|
return s.value;
|
|
767
767
|
};
|
|
@@ -772,7 +772,7 @@ const $o = {
|
|
|
772
772
|
let s = o._zod.run({ value: r, issues: [] }, c);
|
|
773
773
|
if (s instanceof Promise && (s = await s), s.issues.length) {
|
|
774
774
|
const u = new (a?.Err ?? e)(s.issues.map((i) => Se(i, c, ye())));
|
|
775
|
-
throw
|
|
775
|
+
throw It(u, a?.callee ?? t), u;
|
|
776
776
|
}
|
|
777
777
|
return s.value;
|
|
778
778
|
};
|
|
@@ -781,9 +781,9 @@ const $o = {
|
|
|
781
781
|
const n = r ? { ...r, async: !1 } : { async: !1 }, a = t._zod.run({ value: o, issues: [] }, n);
|
|
782
782
|
if (a instanceof Promise)
|
|
783
783
|
throw new Pe();
|
|
784
|
-
return a.issues.length ?
|
|
784
|
+
return a.issues.length ? Rt(e, a.issues, n) : { success: !0, data: a.value };
|
|
785
785
|
}, Wo = /* @__PURE__ */ Vo(Ke);
|
|
786
|
-
function
|
|
786
|
+
function Rt(e, t, o) {
|
|
787
787
|
let r;
|
|
788
788
|
return {
|
|
789
789
|
success: !1,
|
|
@@ -798,7 +798,7 @@ function Et(e, t, o) {
|
|
|
798
798
|
const Ho = (e) => async (t, o, r) => {
|
|
799
799
|
const n = r ? { ...r, async: !0 } : { async: !0 };
|
|
800
800
|
let a = t._zod.run({ value: o, issues: [] }, n);
|
|
801
|
-
return a instanceof Promise && (a = await a), a.issues.length ?
|
|
801
|
+
return a instanceof Promise && (a = await a), a.issues.length ? Rt(e, a.issues, n) : { success: !0, data: a.value };
|
|
802
802
|
}, Fo = /* @__PURE__ */ Ho(Ke), Jo = /^[\s\S]{0,}$/, Go = /^-?\d+(?:\.\d+)?$/, Yo = /^null$/i, Xo = {
|
|
803
803
|
major: 4,
|
|
804
804
|
minor: 6,
|
|
@@ -830,12 +830,12 @@ const Ho = (e) => async (t, o, r) => {
|
|
|
830
830
|
throw new Pe();
|
|
831
831
|
if (d || f instanceof Promise)
|
|
832
832
|
d = (d ?? Promise.resolve()).then(async () => {
|
|
833
|
-
await f, s.issues.length !== h && (
|
|
833
|
+
await f, s.issues.length !== h && (ht(s.issues, h, e), l || (l = _e(s, h)));
|
|
834
834
|
});
|
|
835
835
|
else {
|
|
836
836
|
if (s.issues.length === h)
|
|
837
837
|
continue;
|
|
838
|
-
|
|
838
|
+
ht(s.issues, h, e), l || (l = _e(s, h));
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
841
|
return d ? d.then(() => s) : s;
|
|
@@ -872,12 +872,12 @@ const Ho = (e) => async (t, o, r) => {
|
|
|
872
872
|
return To(this, "~standard", er(this));
|
|
873
873
|
},
|
|
874
874
|
set "~standard"(e) {
|
|
875
|
-
|
|
875
|
+
Oe(this, "~standard", e);
|
|
876
876
|
}
|
|
877
|
-
}),
|
|
877
|
+
}), Et = (e, t) => e.issues.length ? { issues: e.issues.map((o) => Se(o, t, ye())) } : { value: e.value };
|
|
878
878
|
async function Qo(e, t) {
|
|
879
879
|
const o = { async: !0 };
|
|
880
|
-
return
|
|
880
|
+
return Et(await e._zod.run({ value: t, issues: [] }, o), o);
|
|
881
881
|
}
|
|
882
882
|
function er(e) {
|
|
883
883
|
return {
|
|
@@ -886,7 +886,7 @@ function er(e) {
|
|
|
886
886
|
try {
|
|
887
887
|
const r = e._zod.run({ value: t, issues: [] }, o);
|
|
888
888
|
if (!(r instanceof Promise))
|
|
889
|
-
return
|
|
889
|
+
return Et(r, o);
|
|
890
890
|
} catch {
|
|
891
891
|
}
|
|
892
892
|
return Qo(e, t);
|
|
@@ -1042,7 +1042,7 @@ const ir = /* @__PURE__ */ X("$ZodObject", (e, t) => {
|
|
|
1042
1042
|
return c ? ar(p, d, i, l, n.value, e, f === !0) : p.length ? Promise.all(p).then(() => i) : i;
|
|
1043
1043
|
};
|
|
1044
1044
|
});
|
|
1045
|
-
function
|
|
1045
|
+
function bt(e, t, o, r) {
|
|
1046
1046
|
for (const a of e)
|
|
1047
1047
|
if (a.issues.length === 0)
|
|
1048
1048
|
return t.value = a.value, t;
|
|
@@ -1061,7 +1061,7 @@ const sr = /* @__PURE__ */ X("$ZodUnion", (e, t) => {
|
|
|
1061
1061
|
}), me(e, "pattern", (r) => {
|
|
1062
1062
|
if (r.def.options.every((n) => n._zod.pattern)) {
|
|
1063
1063
|
const n = r.def.options.map((a) => a._zod.pattern);
|
|
1064
|
-
return new RegExp(`^(${n.map((a) =>
|
|
1064
|
+
return new RegExp(`^(${n.map((a) => St(a.source)).join("|")})$`);
|
|
1065
1065
|
}
|
|
1066
1066
|
});
|
|
1067
1067
|
const o = t.options.length === 1 ? t.options[0]._zod.run : null;
|
|
@@ -1083,7 +1083,7 @@ const sr = /* @__PURE__ */ X("$ZodUnion", (e, t) => {
|
|
|
1083
1083
|
c.push(u);
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
|
-
return a ? Promise.all(c).then((s) =>
|
|
1086
|
+
return a ? Promise.all(c).then((s) => bt(s, r, e, n)) : bt(c, r, e, n);
|
|
1087
1087
|
};
|
|
1088
1088
|
}), lr = /* @__PURE__ */ X("$ZodRecord", (e, t) => {
|
|
1089
1089
|
xe.init(e, t);
|
|
@@ -1192,7 +1192,7 @@ const sr = /* @__PURE__ */ X("$ZodUnion", (e, t) => {
|
|
|
1192
1192
|
const o = new Set(t.values);
|
|
1193
1193
|
e._zod.values = o, me(e, "pattern", (r) => {
|
|
1194
1194
|
const n = r.def.values;
|
|
1195
|
-
return new RegExp(n.length ? `^(${n.map((a) => typeof a == "string" ?
|
|
1195
|
+
return new RegExp(n.length ? `^(${n.map((a) => typeof a == "string" ? pt(a) : a ? pt(a.toString()) : String(a)).join("|")})$` : "^[^\\s\\S]$");
|
|
1196
1196
|
}), e._zod.parse = (r, n) => {
|
|
1197
1197
|
const a = r.value;
|
|
1198
1198
|
return o.has(a) || r.issues.push({
|
|
@@ -1205,7 +1205,7 @@ const sr = /* @__PURE__ */ X("$ZodUnion", (e, t) => {
|
|
|
1205
1205
|
}), ur = /* @__PURE__ */ X("$ZodNullable", (e, t) => {
|
|
1206
1206
|
xe.init(e, t), me(e, "optin", (o) => o.def.innerType._zod.optin), me(e, "optout", (o) => o.def.innerType._zod.optout), me(e, "pattern", (o) => {
|
|
1207
1207
|
const r = o.def.innerType._zod.pattern;
|
|
1208
|
-
return r ? new RegExp(`^(${
|
|
1208
|
+
return r ? new RegExp(`^(${St(r.source)}|null)$`) : void 0;
|
|
1209
1209
|
}), me(e, "values", (o) => o.def.innerType._zod.values ? /* @__PURE__ */ new Set([...o.def.innerType._zod.values, null]) : void 0), e._zod.parse = (o, r) => o.value === null ? o : t.innerType._zod.run(o, r);
|
|
1210
1210
|
});
|
|
1211
1211
|
function dr(e) {
|
|
@@ -1232,7 +1232,7 @@ const Ie = /* @__PURE__ */ X("ZodMiniType", (e, t) => {
|
|
|
1232
1232
|
return this.check;
|
|
1233
1233
|
},
|
|
1234
1234
|
set with(e) {
|
|
1235
|
-
|
|
1235
|
+
Oe(this, "with", e);
|
|
1236
1236
|
},
|
|
1237
1237
|
parse(e, t) {
|
|
1238
1238
|
return No(this, e, t, { callee: this.parse });
|
|
@@ -1305,17 +1305,17 @@ function vr(e, t) {
|
|
|
1305
1305
|
...Ce(t)
|
|
1306
1306
|
});
|
|
1307
1307
|
}
|
|
1308
|
-
const
|
|
1308
|
+
const wt = /* @__PURE__ */ X("ZodMiniRecord", (e, t) => {
|
|
1309
1309
|
lr.init(e, t), Ie.init(e, t);
|
|
1310
1310
|
});
|
|
1311
1311
|
// @__NO_SIDE_EFFECTS__
|
|
1312
1312
|
function qr(e, t, o) {
|
|
1313
|
-
return !t || !t._zod ? new
|
|
1313
|
+
return !t || !t._zod ? new wt({
|
|
1314
1314
|
type: "record",
|
|
1315
1315
|
keyType: /* @__PURE__ */ T(),
|
|
1316
1316
|
valueType: e,
|
|
1317
1317
|
...Ce(t)
|
|
1318
|
-
}) : new
|
|
1318
|
+
}) : new wt({
|
|
1319
1319
|
type: "record",
|
|
1320
1320
|
keyType: e,
|
|
1321
1321
|
valueType: t,
|
|
@@ -1421,7 +1421,7 @@ const kr = /* @__PURE__ */ $({
|
|
|
1421
1421
|
Nr
|
|
1422
1422
|
]), Kr = /* @__PURE__ */ $({
|
|
1423
1423
|
url: /* @__PURE__ */ T(),
|
|
1424
|
-
mimeType: /* @__PURE__ */ fe(
|
|
1424
|
+
mimeType: /* @__PURE__ */ fe(Ut),
|
|
1425
1425
|
name: /* @__PURE__ */ T()
|
|
1426
1426
|
}), Vr = /* @__PURE__ */ $({
|
|
1427
1427
|
data: Kr
|
|
@@ -1452,14 +1452,14 @@ function Xr({
|
|
|
1452
1452
|
for (const M of o)
|
|
1453
1453
|
M.id && v.current.add(M.id);
|
|
1454
1454
|
}, [o]);
|
|
1455
|
-
const z = N(null), A = N(null), E = N(0), j = N(null), P = N(null), b = N(null), q = N(null),
|
|
1455
|
+
const z = N(null), A = N(null), E = N(0), j = N(null), P = N(null), b = N(null), q = N(null), _ = N(0), te = N(!1), Q = N(!1), ne = H(r), ae = H(n), D = H(a), J = H(c), Z = H(s), V = H(u), oe = H(i), ce = H(l), G = H(d), ie = H(p), Y = H(h), ue = H(f), be = H(g), { publishError: pe } = Ze(), re = e?.app_sync_url, he = e?.app_sync_api_key, m = !!(re && he), x = H(re), O = H(he), U = w(() => {
|
|
1456
1456
|
z.current && (z.current.close(), z.current = null);
|
|
1457
1457
|
}, []), k = w(() => {
|
|
1458
1458
|
P.current && (clearInterval(P.current), P.current = null);
|
|
1459
1459
|
}, []), y = w(() => {
|
|
1460
|
-
|
|
1460
|
+
_.current = 0, b.current && (clearInterval(b.current), b.current = null), q.current && (clearTimeout(q.current), q.current = null);
|
|
1461
1461
|
}, []), B = w(() => {
|
|
1462
|
-
|
|
1462
|
+
_.current = Math.max(0, _.current - 1), _.current === 0 && y();
|
|
1463
1463
|
}, [y]), I = w(() => {
|
|
1464
1464
|
j.current && (clearTimeout(j.current), j.current = null);
|
|
1465
1465
|
}, []), K = N(() => {
|
|
@@ -1503,7 +1503,7 @@ function Xr({
|
|
|
1503
1503
|
}
|
|
1504
1504
|
case "error": {
|
|
1505
1505
|
const de = parseInt(ge.data.code);
|
|
1506
|
-
pe({ code: de, message:
|
|
1506
|
+
pe({ code: de, message: jt(de) }), Z.current?.();
|
|
1507
1507
|
return;
|
|
1508
1508
|
}
|
|
1509
1509
|
case "agent_cognition": {
|
|
@@ -1602,7 +1602,7 @@ function Xr({
|
|
|
1602
1602
|
});
|
|
1603
1603
|
},
|
|
1604
1604
|
[ue, ne, ae, B]
|
|
1605
|
-
),
|
|
1605
|
+
), Ue = w(
|
|
1606
1606
|
(M) => {
|
|
1607
1607
|
k(), P.current = setInterval(
|
|
1608
1608
|
() => ee(M),
|
|
@@ -1640,16 +1640,16 @@ function Xr({
|
|
|
1640
1640
|
throw new Error(
|
|
1641
1641
|
"Cannot connect: AppSync settings not ready or missing chatId"
|
|
1642
1642
|
);
|
|
1643
|
-
I(), te.current = !0, A.current = M, E.current = 0,
|
|
1643
|
+
I(), te.current = !0, A.current = M, E.current = 0, Ue(M), await se(M);
|
|
1644
1644
|
},
|
|
1645
|
-
[m, I, se,
|
|
1645
|
+
[m, I, se, Ue]
|
|
1646
1646
|
), Ee = w(() => {
|
|
1647
1647
|
te.current = !1, A.current = null, E.current = 0, I(), k(), y(), U();
|
|
1648
1648
|
}, [I, k, y, U]), We = w(() => {
|
|
1649
1649
|
const M = A.current;
|
|
1650
1650
|
if (!M) return;
|
|
1651
|
-
const le =
|
|
1652
|
-
y(),
|
|
1651
|
+
const le = _.current + 1;
|
|
1652
|
+
y(), _.current = le, b.current = setInterval(
|
|
1653
1653
|
() => ee(M),
|
|
1654
1654
|
Gr
|
|
1655
1655
|
), q.current = setTimeout(
|
|
@@ -1683,7 +1683,7 @@ function en(e, t) {
|
|
|
1683
1683
|
timestamp: t
|
|
1684
1684
|
};
|
|
1685
1685
|
}
|
|
1686
|
-
function
|
|
1686
|
+
function vt(e, t, o) {
|
|
1687
1687
|
const r = (a) => [
|
|
1688
1688
|
...e.slice(0, a),
|
|
1689
1689
|
t,
|
|
@@ -1741,7 +1741,7 @@ function nn(e, t) {
|
|
|
1741
1741
|
} : {}
|
|
1742
1742
|
};
|
|
1743
1743
|
}
|
|
1744
|
-
function
|
|
1744
|
+
function qt(e, t, o) {
|
|
1745
1745
|
return e.map(
|
|
1746
1746
|
(r) => r.id === t ? o(r) : r
|
|
1747
1747
|
);
|
|
@@ -1776,7 +1776,7 @@ function ln({
|
|
|
1776
1776
|
}) {
|
|
1777
1777
|
const { saveChatData: g, clearChatData: R, updateLastActivity: v, markChatClosed: z } = it({
|
|
1778
1778
|
appId: e
|
|
1779
|
-
}), { publishApiError: A, publishNetworkError: E } = Ze(), { showCognition: j, hideCognition: P } =
|
|
1779
|
+
}), { publishApiError: A, publishNetworkError: E } = Ze(), { showCognition: j, hideCognition: P } = Dt(), b = H(c), q = H(u), _ = N(0), te = w(
|
|
1780
1780
|
(m, x, O) => {
|
|
1781
1781
|
if (!m.response.content) return;
|
|
1782
1782
|
const U = !!s?.welcome_message && m.response.content === s.welcome_message, k = q.current.some(
|
|
@@ -1785,11 +1785,11 @@ function ln({
|
|
|
1785
1785
|
(I) => I.id === m.message_id
|
|
1786
1786
|
);
|
|
1787
1787
|
!U && !k && !y && f?.();
|
|
1788
|
-
const B =
|
|
1788
|
+
const B = _.current;
|
|
1789
1789
|
i((I) => {
|
|
1790
|
-
if (
|
|
1790
|
+
if (_.current !== B || I.some((ee) => ee.isRatingRequest) || I.some((ee) => ee.id === m.message_id) || s?.welcome_message && m.response.content === s.welcome_message)
|
|
1791
1791
|
return I;
|
|
1792
|
-
const K = I.filter((ee) => !ee.isThinking), se =
|
|
1792
|
+
const K = I.filter((ee) => !ee.isThinking), se = vt(
|
|
1793
1793
|
K,
|
|
1794
1794
|
Qr(m),
|
|
1795
1795
|
O
|
|
@@ -1816,13 +1816,13 @@ function ln({
|
|
|
1816
1816
|
), Q = w(
|
|
1817
1817
|
(m, x, O, U) => {
|
|
1818
1818
|
if (!m.response.content) return;
|
|
1819
|
-
const k =
|
|
1819
|
+
const k = _.current;
|
|
1820
1820
|
i((y) => {
|
|
1821
|
-
if (
|
|
1821
|
+
if (_.current !== k || y.some(
|
|
1822
1822
|
(K) => K.id === m.message_id || // A send whose reply POST hasn't resolved still has its local id.
|
|
1823
1823
|
K.sender === "user" && K.isNew && K.content === m.response.content
|
|
1824
1824
|
)) return y;
|
|
1825
|
-
const I =
|
|
1825
|
+
const I = vt(
|
|
1826
1826
|
y,
|
|
1827
1827
|
en(m, U),
|
|
1828
1828
|
O
|
|
@@ -1864,7 +1864,7 @@ function ln({
|
|
|
1864
1864
|
fetchHistory: D,
|
|
1865
1865
|
getChatToken: J
|
|
1866
1866
|
}), ie = w(() => {
|
|
1867
|
-
|
|
1867
|
+
_.current += 1, P(), oe(), ce(), $t(u), i(
|
|
1868
1868
|
(m) => m.filter((x) => Array.isArray(x) ? !1 : x.isWelcomeMessage)
|
|
1869
1869
|
), R(), d(null);
|
|
1870
1870
|
}, [
|
|
@@ -1876,7 +1876,7 @@ function ln({
|
|
|
1876
1876
|
i,
|
|
1877
1877
|
d
|
|
1878
1878
|
]), Y = w(
|
|
1879
|
-
(m, x) => i((O) =>
|
|
1879
|
+
(m, x) => i((O) => qt(O, m, x)),
|
|
1880
1880
|
[i]
|
|
1881
1881
|
), ue = w(
|
|
1882
1882
|
async (m) => {
|
|
@@ -1912,7 +1912,7 @@ function ln({
|
|
|
1912
1912
|
(I) => an(I, y, B)
|
|
1913
1913
|
)
|
|
1914
1914
|
}).catch((B) => {
|
|
1915
|
-
throw
|
|
1915
|
+
throw Bt(B, k.name);
|
|
1916
1916
|
})
|
|
1917
1917
|
)
|
|
1918
1918
|
),
|
|
@@ -1921,15 +1921,15 @@ function ln({
|
|
|
1921
1921
|
(m, x, O, U) => {
|
|
1922
1922
|
P(), U && i((y) => sn(y, O)), i((y) => y.filter((B) => !B.isThinking));
|
|
1923
1923
|
const k = () => Y(O, (y) => ({ ...y, isFailed: !0 }));
|
|
1924
|
-
if (m instanceof
|
|
1924
|
+
if (m instanceof Lt) {
|
|
1925
1925
|
k();
|
|
1926
1926
|
return;
|
|
1927
1927
|
}
|
|
1928
|
-
if (m instanceof at || m instanceof
|
|
1928
|
+
if (m instanceof at || m instanceof $e && m.status === 403) {
|
|
1929
1929
|
E();
|
|
1930
1930
|
return;
|
|
1931
1931
|
}
|
|
1932
|
-
A(m), m instanceof
|
|
1932
|
+
A(m), m instanceof $e && // A 401 means an expired or closed chat token: drop the session so
|
|
1933
1933
|
// the next send starts a fresh one, as for a client-side expiry.
|
|
1934
1934
|
(m.status >= 500 || m.status === 401) ? (d(null), R(), i((y) => y.filter((B) => B.id !== O)), x.reset()) : k();
|
|
1935
1935
|
},
|
|
@@ -1949,7 +1949,7 @@ function ln({
|
|
|
1949
1949
|
i((k) => [...k, rn()]);
|
|
1950
1950
|
return;
|
|
1951
1951
|
}
|
|
1952
|
-
const O =
|
|
1952
|
+
const O = _.current, U = nn(m, x);
|
|
1953
1953
|
i((k) => [...k, U]), v();
|
|
1954
1954
|
try {
|
|
1955
1955
|
const k = l?.id || await ue(c), y = await be(
|
|
@@ -1960,7 +1960,7 @@ function ln({
|
|
|
1960
1960
|
);
|
|
1961
1961
|
y.length > 0 && Y(U.id, (I) => ({
|
|
1962
1962
|
...I,
|
|
1963
|
-
attachments:
|
|
1963
|
+
attachments: Nt(y, x)
|
|
1964
1964
|
}));
|
|
1965
1965
|
const B = await c.replyToConversation({
|
|
1966
1966
|
text: m.content,
|
|
@@ -1972,8 +1972,8 @@ function ln({
|
|
|
1972
1972
|
userData: r
|
|
1973
1973
|
});
|
|
1974
1974
|
i((I) => {
|
|
1975
|
-
if (
|
|
1976
|
-
const K =
|
|
1975
|
+
if (_.current !== O) return I;
|
|
1976
|
+
const K = qt(
|
|
1977
1977
|
I,
|
|
1978
1978
|
U.id,
|
|
1979
1979
|
(se) => ({ ...se, id: B.message_id, isNew: !1 })
|
|
@@ -2028,10 +2028,10 @@ function ln({
|
|
|
2028
2028
|
};
|
|
2029
2029
|
}
|
|
2030
2030
|
const cn = { BASE_URL: "/", DEV: !1, MODE: "dev", PROD: !0, SSR: !1, VITE_API_URL: "https://chat.eloquentai.dev", VITE_CDN_URL: "https://cdn.eloquentai.dev", VITE_ENVIRONMENT: "dev", VITE_REGION_API_URL: "https://region.eloquentai.dev" };
|
|
2031
|
-
function
|
|
2031
|
+
function zt(e) {
|
|
2032
2032
|
return typeof window > "u" || typeof import.meta > "u" ? "" : cn[e] || "";
|
|
2033
2033
|
}
|
|
2034
|
-
const un =
|
|
2034
|
+
const un = zt("VITE_API_URL"), dn = zt("VITE_REGION_API_URL");
|
|
2035
2035
|
function pn() {
|
|
2036
2036
|
return un || "";
|
|
2037
2037
|
}
|
|
@@ -2043,7 +2043,7 @@ class fn {
|
|
|
2043
2043
|
userId = null;
|
|
2044
2044
|
conversationId = null;
|
|
2045
2045
|
constructor(t) {
|
|
2046
|
-
this.userId = t.userId || null, this.httpClient = new
|
|
2046
|
+
this.userId = t.userId || null, this.httpClient = new Zt(t);
|
|
2047
2047
|
}
|
|
2048
2048
|
getUserData() {
|
|
2049
2049
|
return {
|
|
@@ -2149,13 +2149,13 @@ const gn = {
|
|
|
2149
2149
|
factor: 2
|
|
2150
2150
|
};
|
|
2151
2151
|
function mn(e) {
|
|
2152
|
-
return e instanceof at ? !0 : e instanceof
|
|
2152
|
+
return e instanceof at ? !0 : e instanceof $e ? e.status === 429 || e.status >= 500 : !1;
|
|
2153
2153
|
}
|
|
2154
2154
|
function bn(e, t) {
|
|
2155
2155
|
const o = t.minDelayMs * t.factor ** e, r = Math.min(o, t.maxDelayMs);
|
|
2156
2156
|
return Math.random() * r;
|
|
2157
2157
|
}
|
|
2158
|
-
async function
|
|
2158
|
+
async function yt(e, t = {}) {
|
|
2159
2159
|
const o = { ...gn, ...t };
|
|
2160
2160
|
for (let r = 0; ; r++)
|
|
2161
2161
|
try {
|
|
@@ -2168,36 +2168,36 @@ async function xt(e, t = {}) {
|
|
|
2168
2168
|
);
|
|
2169
2169
|
}
|
|
2170
2170
|
}
|
|
2171
|
-
const
|
|
2171
|
+
const je = /* @__PURE__ */ new Map(), De = /* @__PURE__ */ new Map();
|
|
2172
2172
|
function wn(e, t, o) {
|
|
2173
2173
|
const r = o?.dedupe !== !1, [n, a] = S(
|
|
2174
|
-
() =>
|
|
2174
|
+
() => je.get(e)
|
|
2175
2175
|
), { publishApiError: c, publishNetworkError: s } = Ze(), [u, i] = S(void 0), [l, d] = S(!1), p = N(!0);
|
|
2176
2176
|
N(() => (p.current = !0, () => {
|
|
2177
2177
|
p.current = !1;
|
|
2178
2178
|
}));
|
|
2179
2179
|
const h = w(async () => {
|
|
2180
|
-
if (
|
|
2181
|
-
const f =
|
|
2180
|
+
if (je.has(e)) {
|
|
2181
|
+
const f = je.get(e);
|
|
2182
2182
|
return a(f), f;
|
|
2183
2183
|
}
|
|
2184
2184
|
d(!0), i(void 0);
|
|
2185
2185
|
try {
|
|
2186
|
-
if (r &&
|
|
2187
|
-
return await
|
|
2186
|
+
if (r && De.has(e))
|
|
2187
|
+
return await De.get(e);
|
|
2188
2188
|
const f = t();
|
|
2189
|
-
r &&
|
|
2189
|
+
r && De.set(e, f);
|
|
2190
2190
|
const g = await f;
|
|
2191
|
-
return
|
|
2191
|
+
return je.set(e, g), p.current && a(g), g;
|
|
2192
2192
|
} catch (f) {
|
|
2193
|
-
throw f instanceof at || f instanceof
|
|
2193
|
+
throw f instanceof at || f instanceof $e && f.status === 403 ? s() : c(f), p.current && i(f), f;
|
|
2194
2194
|
} finally {
|
|
2195
|
-
|
|
2195
|
+
De.delete(e), p.current && d(!1);
|
|
2196
2196
|
}
|
|
2197
2197
|
}, [e, r, t, c, s]);
|
|
2198
2198
|
return { data: n, error: u, isLoading: l, fetch: h };
|
|
2199
2199
|
}
|
|
2200
|
-
function
|
|
2200
|
+
function xt(e, t) {
|
|
2201
2201
|
const o = e?.deviceId || crypto.randomUUID();
|
|
2202
2202
|
return e?.userId ? e.externalId !== t ? { userId: e.userId, externalId: t, deviceId: o } : {
|
|
2203
2203
|
userId: e.userId,
|
|
@@ -2207,9 +2207,9 @@ function kt(e, t) {
|
|
|
2207
2207
|
}
|
|
2208
2208
|
function vn(e) {
|
|
2209
2209
|
const { appId: t, initialUserId: o } = e, { getSavedChatData: r } = it({ appId: t }), [n, a] = S(
|
|
2210
|
-
() =>
|
|
2210
|
+
() => xt(r(), o)
|
|
2211
2211
|
), [c, s] = S(o);
|
|
2212
|
-
return c !== o && (s(o), a(
|
|
2212
|
+
return c !== o && (s(o), a(xt(r(), o))), {
|
|
2213
2213
|
// Identity is available synchronously; kept in the contract because
|
|
2214
2214
|
// consumers (SDK boot) still key off it.
|
|
2215
2215
|
isReady: !0,
|
|
@@ -2237,7 +2237,7 @@ function qn({
|
|
|
2237
2237
|
baseURL: p,
|
|
2238
2238
|
appId: t
|
|
2239
2239
|
})
|
|
2240
|
-
), [f, g] = S(null), [R, v] = S(null), [z, A] = S([]), [E, j] = S(!1), [P, b] = S(!1), [q,
|
|
2240
|
+
), [f, g] = S(null), [R, v] = S(null), [z, A] = S([]), [E, j] = S(!1), [P, b] = S(!1), [q, _] = S(!0), Q = wn(`sdk-boot-${t}`, () => h.boot()).fetch;
|
|
2241
2241
|
F(() => {
|
|
2242
2242
|
if (i())
|
|
2243
2243
|
l();
|
|
@@ -2259,16 +2259,16 @@ function qn({
|
|
|
2259
2259
|
if (ne.current) return;
|
|
2260
2260
|
ne.current = !0, (async () => {
|
|
2261
2261
|
const [D, J] = await ut(
|
|
2262
|
-
|
|
2262
|
+
yt(() => h.getOrganizationByAppId(t))
|
|
2263
2263
|
);
|
|
2264
2264
|
if (J) {
|
|
2265
|
-
console.error("Failed to fetch organization data:", J),
|
|
2265
|
+
console.error("Failed to fetch organization data:", J), _(!1), j(!0);
|
|
2266
2266
|
return;
|
|
2267
2267
|
}
|
|
2268
2268
|
h.setRegion(D.region);
|
|
2269
|
-
const [Z, V] = await ut(
|
|
2269
|
+
const [Z, V] = await ut(yt(Q));
|
|
2270
2270
|
if (V) {
|
|
2271
|
-
|
|
2271
|
+
_(!1), j(!0);
|
|
2272
2272
|
return;
|
|
2273
2273
|
}
|
|
2274
2274
|
const {
|
|
@@ -2276,11 +2276,11 @@ function qn({
|
|
|
2276
2276
|
userId: ce,
|
|
2277
2277
|
messages: G
|
|
2278
2278
|
} = d();
|
|
2279
|
-
oe && ce && G.some(
|
|
2280
|
-
await
|
|
2279
|
+
oe && ce && G.some(Kt) && A(
|
|
2280
|
+
await Vt(h, oe, G)
|
|
2281
2281
|
);
|
|
2282
2282
|
const ie = Z.chat_settings.welcome_message;
|
|
2283
|
-
g(Z.chat_settings),
|
|
2283
|
+
g(Z.chat_settings), _(Z.chat_settings.is_active ?? !0), ie && A((Y) => Y.length > 0 || Y.some((ue) => ue.isWelcomeMessage) ? Y : [tn(ie)]), j(!0);
|
|
2284
2284
|
})();
|
|
2285
2285
|
}, [u, h, t, Q, d]), {
|
|
2286
2286
|
userId: a,
|
|
@@ -2297,9 +2297,9 @@ function qn({
|
|
|
2297
2297
|
isChatActive: q
|
|
2298
2298
|
};
|
|
2299
2299
|
}
|
|
2300
|
-
const
|
|
2300
|
+
const Tt = "(max-width: 640px)";
|
|
2301
2301
|
function yn() {
|
|
2302
|
-
return typeof window > "u" ? !1 : window.matchMedia(
|
|
2302
|
+
return typeof window > "u" ? !1 : window.matchMedia(Tt).matches;
|
|
2303
2303
|
}
|
|
2304
2304
|
function xn(e) {
|
|
2305
2305
|
const [t, o] = S(yn), [r, n] = S(
|
|
@@ -2307,7 +2307,7 @@ function xn(e) {
|
|
|
2307
2307
|
), a = e ?? t, c = typeof window > "u";
|
|
2308
2308
|
return F(() => {
|
|
2309
2309
|
if (c) return;
|
|
2310
|
-
const s = window.matchMedia(
|
|
2310
|
+
const s = window.matchMedia(Tt), u = (i) => {
|
|
2311
2311
|
o(i.matches);
|
|
2312
2312
|
};
|
|
2313
2313
|
return u(s), s.addEventListener("change", u), () => s.removeEventListener("change", u);
|
|
@@ -2323,16 +2323,16 @@ function xn(e) {
|
|
|
2323
2323
|
portalContainer: r
|
|
2324
2324
|
};
|
|
2325
2325
|
}
|
|
2326
|
-
const
|
|
2326
|
+
const kt = 1245, kn = [
|
|
2327
2327
|
[2.32, 0.4],
|
|
2328
2328
|
[4.25, 0.18]
|
|
2329
2329
|
], _n = [
|
|
2330
2330
|
{ start: 0, duration: 0.22, level: 0.45 },
|
|
2331
2331
|
{ start: 0.16, duration: 0.2, level: 0.25 }
|
|
2332
|
-
], Cn = 0.3, Sn = 3e-3,
|
|
2333
|
-
function
|
|
2332
|
+
], Cn = 0.3, Sn = 3e-3, _t = 1e-4;
|
|
2333
|
+
function Ct(e, t, o, r, n, a) {
|
|
2334
2334
|
const c = e.createOscillator(), s = e.createGain();
|
|
2335
|
-
c.type = "sine", c.frequency.setValueAtTime(o, n), s.gain.setValueAtTime(
|
|
2335
|
+
c.type = "sine", c.frequency.setValueAtTime(o, n), s.gain.setValueAtTime(_t, n), s.gain.exponentialRampToValueAtTime(r, n + Sn), s.gain.exponentialRampToValueAtTime(_t, n + a), c.connect(s).connect(t), c.start(n), c.stop(n + a + 0.05);
|
|
2336
2336
|
}
|
|
2337
2337
|
function In(e) {
|
|
2338
2338
|
const t = e.createGain();
|
|
@@ -2341,18 +2341,18 @@ function In(e) {
|
|
|
2341
2341
|
o.type = "lowpass", o.frequency.value = 6e3, t.connect(o).connect(e.destination);
|
|
2342
2342
|
const r = e.currentTime + 0.02;
|
|
2343
2343
|
_n.forEach((n) => {
|
|
2344
|
-
|
|
2344
|
+
Ct(
|
|
2345
2345
|
e,
|
|
2346
2346
|
t,
|
|
2347
|
-
|
|
2347
|
+
kt,
|
|
2348
2348
|
n.level,
|
|
2349
2349
|
r + n.start,
|
|
2350
2350
|
n.duration
|
|
2351
2351
|
), kn.forEach(([a, c]) => {
|
|
2352
|
-
|
|
2352
|
+
Ct(
|
|
2353
2353
|
e,
|
|
2354
2354
|
t,
|
|
2355
|
-
|
|
2355
|
+
kt * a,
|
|
2356
2356
|
n.level * c,
|
|
2357
2357
|
r + n.start,
|
|
2358
2358
|
n.duration * 0.35
|
|
@@ -2446,7 +2446,7 @@ function Un({
|
|
|
2446
2446
|
apiClient: P,
|
|
2447
2447
|
chatSettings: b,
|
|
2448
2448
|
currentChat: q,
|
|
2449
|
-
messages:
|
|
2449
|
+
messages: _,
|
|
2450
2450
|
isReady: te,
|
|
2451
2451
|
isChatClosed: Q,
|
|
2452
2452
|
isChatActive: ne
|
|
@@ -2456,11 +2456,11 @@ function Un({
|
|
|
2456
2456
|
initialUserId: r,
|
|
2457
2457
|
userName: n,
|
|
2458
2458
|
userData: a
|
|
2459
|
-
}), ae = so({ chatProps: c, chatSettings: b }), D = u ?? d ?? !1, J = i ?? p ?? !0, Z = l ?? h ?? !0, V = On(o), [oe, ce] = S(() => g ? !0 :
|
|
2459
|
+
}), ae = so({ chatProps: c, chatSettings: b }), D = u ?? d ?? !1, J = i ?? p ?? !0, Z = l ?? h ?? !0, V = On(o), [oe, ce] = S(() => g ? !0 : dt(V) === "true" || v ? !1 : D ?? v), [G, ie] = S(!1);
|
|
2460
2460
|
F(() => {
|
|
2461
2461
|
if (!te || G || (ie(!0), g)) return;
|
|
2462
2462
|
const L = b?.initial_open;
|
|
2463
|
-
L != null && (v || L &&
|
|
2463
|
+
L != null && (v || L && dt(V) === "true" || ce(L));
|
|
2464
2464
|
}, [
|
|
2465
2465
|
te,
|
|
2466
2466
|
G,
|
|
@@ -2480,12 +2480,12 @@ function Un({
|
|
|
2480
2480
|
}));
|
|
2481
2481
|
},
|
|
2482
2482
|
[V, g, he]
|
|
2483
|
-
), x =
|
|
2483
|
+
), x = Wt(oe, 400), [O, U] = S(
|
|
2484
2484
|
c?.messages ?? []
|
|
2485
|
-
), [k, y] = S(q), [B, I] = S(!1), [K, se] = S(
|
|
2486
|
-
K !==
|
|
2487
|
-
const [ee,
|
|
2488
|
-
ee !== q && (
|
|
2485
|
+
), [k, y] = S(q), [B, I] = S(!1), [K, se] = S(_);
|
|
2486
|
+
K !== _ && (se(_), _.length > 0 && U(_));
|
|
2487
|
+
const [ee, Ue] = S(q);
|
|
2488
|
+
ee !== q && (Ue(q), q && y(q));
|
|
2489
2489
|
const [Ve, Re] = S(Q);
|
|
2490
2490
|
Ve !== Q && (Re(Q), Q && I(!0));
|
|
2491
2491
|
const Ee = w(() => {
|
|
@@ -2512,8 +2512,8 @@ function Un({
|
|
|
2512
2512
|
onAgentMessage: re.notify
|
|
2513
2513
|
});
|
|
2514
2514
|
F(() => {
|
|
2515
|
-
|
|
2516
|
-
}, [
|
|
2515
|
+
_.length > 0 && U(_);
|
|
2516
|
+
}, [_]), F(() => {
|
|
2517
2517
|
q && y(q);
|
|
2518
2518
|
}, [q]);
|
|
2519
2519
|
const ke = N(null);
|
|
@@ -2624,10 +2624,10 @@ function Bn({
|
|
|
2624
2624
|
children: e
|
|
2625
2625
|
}) {
|
|
2626
2626
|
const t = $n();
|
|
2627
|
-
return /* @__PURE__ */
|
|
2627
|
+
return /* @__PURE__ */ C(Ht.Provider, { value: t, children: e });
|
|
2628
2628
|
}
|
|
2629
2629
|
const Ln = ({ children: e }) => {
|
|
2630
|
-
const [t, o] = S(null), [r, n] = S(!1), a =
|
|
2630
|
+
const [t, o] = S(null), [r, n] = S(!1), a = Jt(o), i = {
|
|
2631
2631
|
error: t,
|
|
2632
2632
|
hideSdk: r,
|
|
2633
2633
|
publishApiError: a,
|
|
@@ -2635,7 +2635,7 @@ const Ln = ({ children: e }) => {
|
|
|
2635
2635
|
publishNetworkError: () => n(!0),
|
|
2636
2636
|
clearError: () => o(null)
|
|
2637
2637
|
};
|
|
2638
|
-
return /* @__PURE__ */
|
|
2638
|
+
return /* @__PURE__ */ C(Ft.Provider, { value: i, children: e });
|
|
2639
2639
|
}, Nn = 100;
|
|
2640
2640
|
function Zn({
|
|
2641
2641
|
appId: e,
|
|
@@ -2665,7 +2665,7 @@ function Zn({
|
|
|
2665
2665
|
INTERNAL_ONLY_API_URL: b
|
|
2666
2666
|
}) {
|
|
2667
2667
|
const { hideSdk: q } = Ze(), {
|
|
2668
|
-
isReady:
|
|
2668
|
+
isReady: _,
|
|
2669
2669
|
isChatActive: te,
|
|
2670
2670
|
isInitiallyOpen: Q,
|
|
2671
2671
|
hasCloseButton: ne,
|
|
@@ -2713,9 +2713,9 @@ function Zn({
|
|
|
2713
2713
|
}, [J, z]);
|
|
2714
2714
|
const k = jn(D && Z);
|
|
2715
2715
|
Dn(D && Z);
|
|
2716
|
-
const y = !
|
|
2716
|
+
const y = !_;
|
|
2717
2717
|
if (q || y && !h || !y && !te) return null;
|
|
2718
|
-
const B = () => /* @__PURE__ */
|
|
2718
|
+
const B = () => /* @__PURE__ */ Be(
|
|
2719
2719
|
"div",
|
|
2720
2720
|
{
|
|
2721
2721
|
style: {
|
|
@@ -2731,23 +2731,12 @@ function Zn({
|
|
|
2731
2731
|
...g ? { position: "relative", inset: 0, width: "100%", height: "100%" } : {}
|
|
2732
2732
|
},
|
|
2733
2733
|
children: [
|
|
2734
|
-
/* @__PURE__ */
|
|
2735
|
-
/* @__PURE__ */
|
|
2734
|
+
/* @__PURE__ */ C("style", { children: to }),
|
|
2735
|
+
/* @__PURE__ */ C(
|
|
2736
2736
|
Je,
|
|
2737
2737
|
{
|
|
2738
2738
|
className: "eloquentai-chat-messaging",
|
|
2739
|
-
head: /* @__PURE__ */
|
|
2740
|
-
/* @__PURE__ */ _("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }),
|
|
2741
|
-
/* @__PURE__ */ _("link", { rel: "preconnect", href: "https://fonts.gstatic.com" }),
|
|
2742
|
-
/* @__PURE__ */ _(
|
|
2743
|
-
"link",
|
|
2744
|
-
{
|
|
2745
|
-
href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap",
|
|
2746
|
-
rel: "stylesheet"
|
|
2747
|
-
}
|
|
2748
|
-
),
|
|
2749
|
-
/* @__PURE__ */ _("style", { children: Fe })
|
|
2750
|
-
] }),
|
|
2739
|
+
head: /* @__PURE__ */ C("style", { children: Fe }),
|
|
2751
2740
|
style: {
|
|
2752
2741
|
display: Z || ie ? "block" : "none",
|
|
2753
2742
|
width: D ? "100vw" : "400px",
|
|
@@ -2779,9 +2768,9 @@ function Zn({
|
|
|
2779
2768
|
// booting): hold the widget's frame with a skeleton so a remount —
|
|
2780
2769
|
// project/environment switch in the host app — doesn't flash an
|
|
2781
2770
|
// empty hole where the chat was.
|
|
2782
|
-
/* @__PURE__ */
|
|
2783
|
-
) : /* @__PURE__ */
|
|
2784
|
-
|
|
2771
|
+
/* @__PURE__ */ C(Gt, { isOpen: !0, isMobile: D, skipAnimation: !0 })
|
|
2772
|
+
) : /* @__PURE__ */ C(
|
|
2773
|
+
Yt,
|
|
2785
2774
|
{
|
|
2786
2775
|
...G,
|
|
2787
2776
|
hasIntroAnimation: !h,
|
|
@@ -2809,11 +2798,11 @@ function Zn({
|
|
|
2809
2798
|
)
|
|
2810
2799
|
}
|
|
2811
2800
|
),
|
|
2812
|
-
!h && /* @__PURE__ */
|
|
2801
|
+
!h && /* @__PURE__ */ C(
|
|
2813
2802
|
Je,
|
|
2814
2803
|
{
|
|
2815
2804
|
className: "eloquentai-chat-launcher",
|
|
2816
|
-
head: /* @__PURE__ */
|
|
2805
|
+
head: /* @__PURE__ */ C("style", { children: Fe }),
|
|
2817
2806
|
style: {
|
|
2818
2807
|
position: "fixed",
|
|
2819
2808
|
bottom: 17,
|
|
@@ -2827,7 +2816,7 @@ function Zn({
|
|
|
2827
2816
|
pointerEvents: Z ? "none" : "auto",
|
|
2828
2817
|
transition: Z ? "opacity 100ms ease-in" : "opacity 200ms ease-out 320ms"
|
|
2829
2818
|
},
|
|
2830
|
-
children: /* @__PURE__ */
|
|
2819
|
+
children: /* @__PURE__ */ C(
|
|
2831
2820
|
oo,
|
|
2832
2821
|
{
|
|
2833
2822
|
isOpen: Z,
|
|
@@ -2837,11 +2826,11 @@ function Zn({
|
|
|
2837
2826
|
)
|
|
2838
2827
|
}
|
|
2839
2828
|
),
|
|
2840
|
-
G?.displayWelcomeMessages ? /* @__PURE__ */
|
|
2829
|
+
G?.displayWelcomeMessages ? /* @__PURE__ */ C(
|
|
2841
2830
|
Je,
|
|
2842
2831
|
{
|
|
2843
2832
|
className: "eloquentai-chat-proactive-message",
|
|
2844
|
-
head: /* @__PURE__ */
|
|
2833
|
+
head: /* @__PURE__ */ C("style", { children: Fe }),
|
|
2845
2834
|
style: {
|
|
2846
2835
|
position: "fixed",
|
|
2847
2836
|
// Aligns the bubble's tail with the launcher's center: the
|
|
@@ -2850,13 +2839,13 @@ function Zn({
|
|
|
2850
2839
|
bottom: 24,
|
|
2851
2840
|
right: 17
|
|
2852
2841
|
},
|
|
2853
|
-
children: /* @__PURE__ */
|
|
2842
|
+
children: /* @__PURE__ */ C(Xt, { ...G?.theme ?? {}, children: /* @__PURE__ */ C(
|
|
2854
2843
|
"div",
|
|
2855
2844
|
{
|
|
2856
2845
|
className: nt("eloq:w-full eloq:h-full", {
|
|
2857
2846
|
dark: G?.theme?.mode === "dark"
|
|
2858
2847
|
}),
|
|
2859
|
-
children: re && !Q && /* @__PURE__ */
|
|
2848
|
+
children: re && !Q && /* @__PURE__ */ C(
|
|
2860
2849
|
no,
|
|
2861
2850
|
{
|
|
2862
2851
|
message: re.text,
|
|
@@ -2875,20 +2864,20 @@ function Zn({
|
|
|
2875
2864
|
]
|
|
2876
2865
|
}
|
|
2877
2866
|
);
|
|
2878
|
-
return /* @__PURE__ */
|
|
2867
|
+
return /* @__PURE__ */ C(Qt, { children: g ? B() : ue ? /* @__PURE__ */ C(ro, { container: ue, children: B() }) : null });
|
|
2879
2868
|
}
|
|
2880
2869
|
function Kn(e) {
|
|
2881
|
-
return /* @__PURE__ */
|
|
2870
|
+
return /* @__PURE__ */ C(Ln, { children: /* @__PURE__ */ C(Bn, { children: /* @__PURE__ */ C(Zn, { ...e }) }) });
|
|
2882
2871
|
}
|
|
2883
2872
|
function Gn(e, t) {
|
|
2884
2873
|
return ((r, n, a) => {
|
|
2885
2874
|
const c = eo.createRoot(n);
|
|
2886
|
-
return c.render(/* @__PURE__ */
|
|
2875
|
+
return c.render(/* @__PURE__ */ C(r, { ...a })), c.unmount;
|
|
2887
2876
|
})(Kn, e, t);
|
|
2888
2877
|
}
|
|
2889
2878
|
export {
|
|
2890
2879
|
Kn as Chat,
|
|
2891
|
-
|
|
2880
|
+
Yt as ChatInterface,
|
|
2892
2881
|
Gn as renderChat,
|
|
2893
2882
|
Xr as useRealtimeSocket
|
|
2894
2883
|
};
|