@superwise.ai/superwise-chatbot-package 1.0.8 → 1.0.9
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/react-chatbot.es.js +180 -180
- package/dist/react-chatbot.umd.js +9 -9
- package/package.json +1 -1
package/dist/react-chatbot.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Ne, { memo as Pe, useState as
|
|
1
|
+
import Ne, { memo as Pe, useState as H, useRef as V, useEffect as $, useMemo as Ie, useCallback as Z } from "react";
|
|
2
2
|
var xe = { exports: {} }, se = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -13,7 +13,7 @@ var Re;
|
|
|
13
13
|
function Ue() {
|
|
14
14
|
if (Re) return se;
|
|
15
15
|
Re = 1;
|
|
16
|
-
var
|
|
16
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
17
17
|
function i(a, o, f) {
|
|
18
18
|
var c = null;
|
|
19
19
|
if (f !== void 0 && (c = "" + f), o.key !== void 0 && (c = "" + o.key), "key" in o) {
|
|
@@ -22,7 +22,7 @@ function Ue() {
|
|
|
22
22
|
d !== "key" && (f[d] = o[d]);
|
|
23
23
|
} else f = o;
|
|
24
24
|
return o = f.ref, {
|
|
25
|
-
$$typeof:
|
|
25
|
+
$$typeof: t,
|
|
26
26
|
type: a,
|
|
27
27
|
key: c,
|
|
28
28
|
ref: o !== void 0 ? o : null,
|
|
@@ -44,12 +44,12 @@ var ae = {};
|
|
|
44
44
|
var _e;
|
|
45
45
|
function Be() {
|
|
46
46
|
return _e || (_e = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
|
-
function r
|
|
48
|
-
if (
|
|
49
|
-
if (typeof
|
|
50
|
-
return
|
|
51
|
-
if (typeof
|
|
52
|
-
switch (
|
|
47
|
+
function t(r) {
|
|
48
|
+
if (r == null) return null;
|
|
49
|
+
if (typeof r == "function")
|
|
50
|
+
return r.$$typeof === T ? null : r.displayName || r.name || null;
|
|
51
|
+
if (typeof r == "string") return r;
|
|
52
|
+
switch (r) {
|
|
53
53
|
case x:
|
|
54
54
|
return "Fragment";
|
|
55
55
|
case _:
|
|
@@ -63,127 +63,127 @@ function Be() {
|
|
|
63
63
|
case ue:
|
|
64
64
|
return "Activity";
|
|
65
65
|
}
|
|
66
|
-
if (typeof
|
|
67
|
-
switch (typeof
|
|
66
|
+
if (typeof r == "object")
|
|
67
|
+
switch (typeof r.tag == "number" && console.error(
|
|
68
68
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
|
-
),
|
|
69
|
+
), r.$$typeof) {
|
|
70
70
|
case g:
|
|
71
71
|
return "Portal";
|
|
72
72
|
case le:
|
|
73
|
-
return
|
|
73
|
+
return r.displayName || "Context";
|
|
74
74
|
case Y:
|
|
75
|
-
return (
|
|
76
|
-
case
|
|
77
|
-
var u =
|
|
78
|
-
return
|
|
75
|
+
return (r._context.displayName || "Context") + ".Consumer";
|
|
76
|
+
case W:
|
|
77
|
+
var u = r.render;
|
|
78
|
+
return r = r.displayName, r || (r = u.displayName || u.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
|
|
79
79
|
case pe:
|
|
80
|
-
return u =
|
|
80
|
+
return u = r.displayName || null, u !== null ? u : t(r.type) || "Memo";
|
|
81
81
|
case q:
|
|
82
|
-
u =
|
|
82
|
+
u = r._payload, r = r._init;
|
|
83
83
|
try {
|
|
84
|
-
return r(
|
|
84
|
+
return t(r(u));
|
|
85
85
|
} catch {
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
|
-
function n(
|
|
91
|
-
return "" +
|
|
90
|
+
function n(r) {
|
|
91
|
+
return "" + r;
|
|
92
92
|
}
|
|
93
|
-
function i(
|
|
93
|
+
function i(r) {
|
|
94
94
|
try {
|
|
95
|
-
n(
|
|
95
|
+
n(r);
|
|
96
96
|
var u = !1;
|
|
97
97
|
} catch {
|
|
98
98
|
u = !0;
|
|
99
99
|
}
|
|
100
100
|
if (u) {
|
|
101
101
|
u = console;
|
|
102
|
-
var S = u.error, E = typeof Symbol == "function" && Symbol.toStringTag &&
|
|
102
|
+
var S = u.error, E = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
|
|
103
103
|
return S.call(
|
|
104
104
|
u,
|
|
105
105
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
106
|
E
|
|
107
|
-
), n(
|
|
107
|
+
), n(r);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
function a(
|
|
111
|
-
if (
|
|
112
|
-
if (typeof
|
|
110
|
+
function a(r) {
|
|
111
|
+
if (r === x) return "<>";
|
|
112
|
+
if (typeof r == "object" && r !== null && r.$$typeof === q)
|
|
113
113
|
return "<...>";
|
|
114
114
|
try {
|
|
115
|
-
var u = r
|
|
115
|
+
var u = t(r);
|
|
116
116
|
return u ? "<" + u + ">" : "<...>";
|
|
117
117
|
} catch {
|
|
118
118
|
return "<...>";
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
function o() {
|
|
122
|
-
var
|
|
123
|
-
return
|
|
122
|
+
var r = P.A;
|
|
123
|
+
return r === null ? null : r.getOwner();
|
|
124
124
|
}
|
|
125
125
|
function f() {
|
|
126
126
|
return Error("react-stack-top-frame");
|
|
127
127
|
}
|
|
128
|
-
function c(
|
|
129
|
-
if (te.call(
|
|
130
|
-
var u = Object.getOwnPropertyDescriptor(
|
|
128
|
+
function c(r) {
|
|
129
|
+
if (te.call(r, "key")) {
|
|
130
|
+
var u = Object.getOwnPropertyDescriptor(r, "key").get;
|
|
131
131
|
if (u && u.isReactWarning) return !1;
|
|
132
132
|
}
|
|
133
|
-
return
|
|
133
|
+
return r.key !== void 0;
|
|
134
134
|
}
|
|
135
|
-
function d(
|
|
135
|
+
function d(r, u) {
|
|
136
136
|
function S() {
|
|
137
137
|
U || (U = !0, console.error(
|
|
138
138
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
139
|
u
|
|
140
140
|
));
|
|
141
141
|
}
|
|
142
|
-
S.isReactWarning = !0, Object.defineProperty(
|
|
142
|
+
S.isReactWarning = !0, Object.defineProperty(r, "key", {
|
|
143
143
|
get: S,
|
|
144
144
|
configurable: !0
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
function l() {
|
|
148
|
-
var
|
|
149
|
-
return O[
|
|
148
|
+
var r = t(this.type);
|
|
149
|
+
return O[r] || (O[r] = !0, console.error(
|
|
150
150
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
|
-
)),
|
|
151
|
+
)), r = this.props.ref, r !== void 0 ? r : null;
|
|
152
152
|
}
|
|
153
|
-
function b(
|
|
153
|
+
function b(r, u, S, E, J, X) {
|
|
154
154
|
var j = S.ref;
|
|
155
|
-
return
|
|
155
|
+
return r = {
|
|
156
156
|
$$typeof: w,
|
|
157
|
-
type:
|
|
157
|
+
type: r,
|
|
158
158
|
key: u,
|
|
159
159
|
props: S,
|
|
160
160
|
_owner: E
|
|
161
|
-
}, (j !== void 0 ? j : null) !== null ? Object.defineProperty(
|
|
161
|
+
}, (j !== void 0 ? j : null) !== null ? Object.defineProperty(r, "ref", {
|
|
162
162
|
enumerable: !1,
|
|
163
163
|
get: l
|
|
164
|
-
}) : Object.defineProperty(
|
|
164
|
+
}) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
|
|
165
165
|
configurable: !1,
|
|
166
166
|
enumerable: !1,
|
|
167
167
|
writable: !0,
|
|
168
168
|
value: 0
|
|
169
|
-
}), Object.defineProperty(
|
|
169
|
+
}), Object.defineProperty(r, "_debugInfo", {
|
|
170
170
|
configurable: !1,
|
|
171
171
|
enumerable: !1,
|
|
172
172
|
writable: !0,
|
|
173
173
|
value: null
|
|
174
|
-
}), Object.defineProperty(
|
|
174
|
+
}), Object.defineProperty(r, "_debugStack", {
|
|
175
175
|
configurable: !1,
|
|
176
176
|
enumerable: !1,
|
|
177
177
|
writable: !0,
|
|
178
178
|
value: J
|
|
179
|
-
}), Object.defineProperty(
|
|
179
|
+
}), Object.defineProperty(r, "_debugTask", {
|
|
180
180
|
configurable: !1,
|
|
181
181
|
enumerable: !1,
|
|
182
182
|
writable: !0,
|
|
183
183
|
value: X
|
|
184
|
-
}), Object.freeze && (Object.freeze(
|
|
184
|
+
}), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
|
|
185
185
|
}
|
|
186
|
-
function m(
|
|
186
|
+
function m(r, u, S, E, J, X) {
|
|
187
187
|
var j = u.children;
|
|
188
188
|
if (j !== void 0)
|
|
189
189
|
if (E)
|
|
@@ -197,7 +197,7 @@ function Be() {
|
|
|
197
197
|
);
|
|
198
198
|
else L(j);
|
|
199
199
|
if (te.call(u, "key")) {
|
|
200
|
-
j = r
|
|
200
|
+
j = t(r);
|
|
201
201
|
var R = Object.keys(u).filter(function(K) {
|
|
202
202
|
return K !== "key";
|
|
203
203
|
});
|
|
@@ -221,9 +221,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
221
221
|
} else S = u;
|
|
222
222
|
return j && d(
|
|
223
223
|
S,
|
|
224
|
-
typeof
|
|
224
|
+
typeof r == "function" ? r.displayName || r.name || "Unknown" : r
|
|
225
225
|
), b(
|
|
226
|
-
|
|
226
|
+
r,
|
|
227
227
|
j,
|
|
228
228
|
S,
|
|
229
229
|
o(),
|
|
@@ -231,43 +231,43 @@ React keys must be passed directly to JSX without using spread:
|
|
|
231
231
|
X
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
|
-
function L(
|
|
235
|
-
p(
|
|
234
|
+
function L(r) {
|
|
235
|
+
p(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === q && (r._payload.status === "fulfilled" ? p(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
|
|
236
236
|
}
|
|
237
|
-
function p(
|
|
238
|
-
return typeof
|
|
237
|
+
function p(r) {
|
|
238
|
+
return typeof r == "object" && r !== null && r.$$typeof === w;
|
|
239
239
|
}
|
|
240
|
-
var h = Ne, w = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), M = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), Y = Symbol.for("react.consumer"), le = Symbol.for("react.context"),
|
|
240
|
+
var h = Ne, w = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), M = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), Y = Symbol.for("react.consumer"), le = Symbol.for("react.context"), W = Symbol.for("react.forward_ref"), ce = Symbol.for("react.suspense"), de = Symbol.for("react.suspense_list"), pe = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), ue = Symbol.for("react.activity"), T = Symbol.for("react.client.reference"), P = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, te = Object.prototype.hasOwnProperty, be = Array.isArray, G = console.createTask ? console.createTask : function() {
|
|
241
241
|
return null;
|
|
242
242
|
};
|
|
243
243
|
h = {
|
|
244
|
-
react_stack_bottom_frame: function(
|
|
245
|
-
return
|
|
244
|
+
react_stack_bottom_frame: function(r) {
|
|
245
|
+
return r();
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
248
|
var U, O = {}, re = h.react_stack_bottom_frame.bind(
|
|
249
249
|
h,
|
|
250
250
|
f
|
|
251
251
|
)(), me = G(a(f)), ne = {};
|
|
252
|
-
ae.Fragment = x, ae.jsx = function(
|
|
252
|
+
ae.Fragment = x, ae.jsx = function(r, u, S) {
|
|
253
253
|
var E = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
254
254
|
return m(
|
|
255
|
-
|
|
255
|
+
r,
|
|
256
256
|
u,
|
|
257
257
|
S,
|
|
258
258
|
!1,
|
|
259
259
|
E ? Error("react-stack-top-frame") : re,
|
|
260
|
-
E ? G(a(
|
|
260
|
+
E ? G(a(r)) : me
|
|
261
261
|
);
|
|
262
|
-
}, ae.jsxs = function(
|
|
262
|
+
}, ae.jsxs = function(r, u, S) {
|
|
263
263
|
var E = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
264
264
|
return m(
|
|
265
|
-
|
|
265
|
+
r,
|
|
266
266
|
u,
|
|
267
267
|
S,
|
|
268
268
|
!0,
|
|
269
269
|
E ? Error("react-stack-top-frame") : re,
|
|
270
|
-
E ? G(a(
|
|
270
|
+
E ? G(a(r)) : me
|
|
271
271
|
);
|
|
272
272
|
};
|
|
273
273
|
}()), ae;
|
|
@@ -281,9 +281,9 @@ const Ze = [
|
|
|
281
281
|
"additional_parameter_user_role:",
|
|
282
282
|
"additional_parameter_use_case:"
|
|
283
283
|
], ie = "Apologize, I’m unable to respond at the moment. Please try asking your question again or click Contact Sales to get in touch with our team.";
|
|
284
|
-
function Ye(
|
|
285
|
-
if (typeof
|
|
286
|
-
let n =
|
|
284
|
+
function Ye(t) {
|
|
285
|
+
if (typeof t != "string" || t.length === 0) return t;
|
|
286
|
+
let n = t;
|
|
287
287
|
for (const i of Ze)
|
|
288
288
|
for (; ; ) {
|
|
289
289
|
const a = n.indexOf(i);
|
|
@@ -306,18 +306,18 @@ function Ye(r) {
|
|
|
306
306
|
}
|
|
307
307
|
return n.includes("Parameters:") && (n = n.split("Parameters:")[0].trim()), n;
|
|
308
308
|
}
|
|
309
|
-
function qe(
|
|
310
|
-
if (typeof
|
|
311
|
-
const n =
|
|
312
|
-
return n.startsWith("Message: ") ? n.slice(9).trim() : n.startsWith("Message : ") ? n.slice(11).trim() :
|
|
309
|
+
function qe(t) {
|
|
310
|
+
if (typeof t != "string" || t.length === 0) return t;
|
|
311
|
+
const n = t.trim();
|
|
312
|
+
return n.startsWith("Message: ") ? n.slice(9).trim() : n.startsWith("Message : ") ? n.slice(11).trim() : t;
|
|
313
313
|
}
|
|
314
|
-
async function Ge(
|
|
314
|
+
async function Ge(t, n = [], i = [], a = "", o = "", f = "", c = null) {
|
|
315
315
|
var L, p, h;
|
|
316
316
|
const d = typeof f == "string" && f.trim().length > 0 ? f.trim() : "https://sage-api-ttyw-stage.superwise.ai/api/v1/", l = d.replace(/\/+$/, "").endsWith("/chat") ? d : d.replace(/\/+$/, "") + "/chat", b = Array.isArray(n) ? n.map((w) => ({
|
|
317
317
|
role: w.role,
|
|
318
318
|
message: w.content != null ? w.content : ""
|
|
319
319
|
})) : [], m = {
|
|
320
|
-
user_input:
|
|
320
|
+
user_input: t,
|
|
321
321
|
chat_history: b,
|
|
322
322
|
mql_df: Array.isArray(i) ? i : [],
|
|
323
323
|
agent_id: a,
|
|
@@ -350,8 +350,8 @@ async function Ge(r, n = [], i = [], a = "", o = "", f = "", c = null) {
|
|
|
350
350
|
return w.name === "TypeError" && w.message.includes("fetch") ? { reply: ie, mqlDf: [], isError: !0 } : { reply: ie, mqlDf: [], isError: !0 };
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
async function Je(
|
|
354
|
-
const c = (typeof a == "string" && a.trim().length > 0 ? a.trim() : "https://sage-api-ttyw-stage.superwise.ai/api/v1/").replace(/\/+$/, "").replace(/\/chat\/?$/, "").replace(/\/+$/, "") + "/pdf", d = Array.isArray(
|
|
353
|
+
async function Je(t, n = null, i = [], a = "") {
|
|
354
|
+
const c = (typeof a == "string" && a.trim().length > 0 ? a.trim() : "https://sage-api-ttyw-stage.superwise.ai/api/v1/").replace(/\/+$/, "").replace(/\/chat\/?$/, "").replace(/\/+$/, "") + "/pdf", d = Array.isArray(t) && t.length > 0 ? t[0] : n || {
|
|
355
355
|
name: "User",
|
|
356
356
|
email: "user@example.com",
|
|
357
357
|
summary: "Chat conversation summary"
|
|
@@ -1109,11 +1109,11 @@ const y = {
|
|
|
1109
1109
|
opacity: 0.9;\r
|
|
1110
1110
|
}`, Ke = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='190'%20height='42'%20viewBox='0%200%20190%2042'%20fill='none'%3e%3cpath%20d='M17.2253%2014.2603C17.155%2014.0259%2016.9441%2013.8618%2016.7097%2013.8618H14.6472C14.3894%2013.8618%2014.1785%2014.0259%2014.1316%2014.2603L10.7801%2027.5053C10.7332%2027.6694%2010.7801%2027.8335%2010.8739%2027.9741C10.9676%2028.1148%2011.1317%2028.1851%2011.2957%2028.1851H12.9363C13.1941%2028.1851%2013.4051%2027.9976%2013.4754%2027.7631L14.0613%2025.0673H17.3191L17.905%2027.7631C17.9519%2028.021%2018.1862%2028.1851%2018.444%2028.1851H20.0846C20.2487%2028.1851%2020.4128%2028.1148%2020.5065%2027.9741C20.6003%2027.8335%2020.6471%2027.6694%2020.6003%2027.5053L17.2488%2014.2603H17.2253ZM14.5769%2022.5824L15.655%2017.636L16.7566%2022.5824H14.5769Z'%20fill='%23FF0000'%3e%3c/path%3e%3cpath%20d='M23.8359%2013.8618H22.2656C21.9609%2013.8618%2021.7266%2014.0962%2021.7266%2014.401V27.6459C21.7266%2027.9507%2021.9609%2028.1851%2022.2656%2028.1851H23.8359C24.1406%2028.1851%2024.375%2027.9507%2024.375%2027.6459V14.401C24.375%2014.0962%2024.1406%2013.8618%2023.8359%2013.8618ZM22.2891%2014.0493C22.2422%2014.0493%2022.1953%2014.0493%2022.1484%2014.0728C22.1953%2014.0728%2022.2422%2014.0493%2022.2891%2014.0493Z'%20fill='%23FF0000'%3e%3c/path%3e%3cpath%20d='M36.1401%2029.4041L36.0932%2012.5256C36.0932%2011.3066%2035.4369%2010.1579%2034.3588%209.5484L19.7341%201.15601C18.6794%200.546507%2017.3669%200.546507%2016.2888%201.15601L1.71091%209.61872C0.65624%2010.2282%200%2011.3769%200%2012.5959L0.046874%2029.4744C0.046874%2030.6934%200.703114%2031.8421%201.78122%2032.4516L16.406%2040.844C17.4607%2041.4535%2018.7731%2041.4535%2019.8513%2040.844L34.4291%2032.3813C35.4838%2031.7718%2036.1401%2030.6231%2036.1401%2029.4041ZM11.9998%2031.5608C6.16397%2028.1851%204.17181%2020.7539%207.54676%2014.9167C10.8983%209.07955%2018.3513%207.08694%2024.1871%2010.4626C30.023%2013.8149%2032.0151%2021.2696%2028.6402%2027.1068C25.2887%2032.9439%2017.8357%2034.9365%2011.9998%2031.5608Z'%20fill='%23FF0000'%3e%3c/path%3e%3cpath%20d='M46.3593%2014.19C46.6171%2013.9087%2046.9218%2013.6977%2047.2734%2013.557C47.6249%2013.4164%2048.0468%2013.3461%2048.5155%2013.3461C48.9843%2013.3461%2049.6171%2013.4398%2050.0858%2013.6508C50.5546%2013.8618%2050.9295%2014.1665%2051.2342%2014.5416C51.3983%2014.7526%2051.5623%2014.987%2051.6795%2015.2683C51.8202%2015.5496%2051.9139%2015.8309%2051.9608%2016.1357L55.4295%2015.0574C55.1717%2014.1431%2054.8201%2013.3695%2054.3748%2012.7131C53.9295%2012.0567%2053.3904%2011.4941%2052.7576%2011.0487C52.1952%2010.6502%2051.5623%2010.3689%2050.8358%2010.1813C50.1327%209.99379%2049.3593%209.90002%2048.5624%209.90002C47.7655%209.90002%2046.5937%2010.0407%2045.7734%2010.3454C44.9765%2010.6502%2044.2734%2011.0956%2043.7109%2011.6816C43.125%2012.2443%2042.7031%2012.9241%2042.4219%2013.7211C42.1406%2014.5182%2042%2015.4324%2042%2016.4405C42%2017.4485%2042.1641%2018.5034%2042.5156%2019.277C42.8672%2020.0506%2043.3828%2020.707%2044.0859%2021.2461C44.789%2021.7853%2045.7031%2022.2776%2046.8515%2022.6761L48.8436%2023.4028C49.5702%2023.6842%2050.1561%2023.9655%2050.5546%2024.2702C50.953%2024.5515%2051.2342%2024.8797%2051.3983%2025.2314C51.5623%2025.583%2051.6327%2026.0284%2051.6327%2026.5676C51.6327%2027.1067%2051.5858%2027.4818%2051.4686%2027.8335C51.3749%2028.1851%2051.1874%2028.4899%2050.9764%2028.7712C50.742%2029.0759%2050.4374%2029.2869%2050.0624%2029.4275C49.7108%2029.5682%2049.2889%2029.6385%2048.8202%2029.6385C48.3515%2029.6385%2047.7187%2029.5448%2047.2734%2029.3338C46.8046%2029.1228%2046.4296%2028.818%2046.1249%2028.443C45.9374%2028.232%2045.7734%2027.9976%2045.6562%2027.6928C45.5156%2027.4115%2045.4453%2027.1067%2045.3749%2026.802L41.8594%2027.7866C42.0937%2028.7008%2042.4453%2029.4979%2042.8906%2030.2011C43.3594%2030.9044%2043.8984%2031.467%2044.5546%2031.9359C45.1406%2032.311%2045.7734%2032.5923%2046.4765%2032.8032C47.1796%2033.0142%2047.953%2033.108%2048.7499%2033.108C49.5468%2033.108%2050.742%2032.9439%2051.5389%2032.6626C52.3592%2032.3578%2053.0623%2031.9124%2053.6483%2031.3029C54.1873%2030.7169%2054.6092%2030.0136%2054.9139%2029.1931C55.2185%2028.3726%2055.3592%2027.4349%2055.3592%2026.3566C55.3592%2025.2782%2055.1951%2024.2702%2054.8435%2023.4966C54.492%2022.723%2053.9764%2022.0666%2053.2498%2021.5275C52.5233%2020.9883%2051.5858%2020.496%2050.3905%2020.0506L48.4218%2019.3239C47.6952%2019.0426%2047.1327%2018.7612%2046.7577%2018.4799C46.3593%2018.1752%2046.1015%2017.8704%2045.9609%2017.5188C45.8203%2017.1672%2045.7499%2016.7686%2045.7499%2016.2998C45.7499%2015.8309%2045.7968%2015.4324%2045.914%2015.0808C46.0077%2014.7292%2046.1718%2014.4478%2046.3593%2014.19Z'%20fill='black'%3e%3c/path%3e%3cpath%20d='M67.5233%2026.4504C67.5233%2027.1536%2067.4295%2027.7631%2067.242%2028.232C67.0545%2028.7008%2066.7499%2029.0525%2066.3046%2029.3103C65.8593%2029.5682%2065.2733%2029.6854%2064.5468%2029.6854C63.8202%2029.6854%2063.2109%2029.5682%2062.7656%2029.3103C62.3202%2029.0525%2062.0156%2028.7008%2061.8281%2028.232C61.6406%2027.7631%2061.5468%2027.1771%2061.5468%2026.4504V10.1579H57.8672V26.3332C57.8672%2027.6694%2058.1016%2028.8415%2058.5703%2029.8495C59.039%2030.8575%2059.7656%2031.6546%2060.75%2032.2406C61.7343%2032.8267%2063.0234%2033.108%2064.5702%2033.108C66.1171%2033.108%2067.3592%2032.8267%2068.367%2032.2406C69.3748%2031.6546%2070.1014%2030.8575%2070.5467%2029.8261C70.992%2028.7946%2071.2264%2027.6459%2071.2264%2026.3332V10.1579H67.5467V26.4504H67.5233Z'%20fill='black'%3e%3c/path%3e%3cpath%20d='M83.7186%2010.9549C82.7811%2010.4158%2081.5858%2010.1579%2080.1562%2010.1579H74.0859V32.8033H77.7656V24.9032H80.1093C81.5624%2024.9032%2082.7577%2024.6453%2083.6952%2024.1296C84.6327%2023.6138%2085.3358%2022.8168%2085.8045%2021.7385C86.2732%2020.6601%2086.5076%2019.2536%2086.5076%2017.5423C86.5076%2015.831%2086.2732%2014.4479%2085.8045%2013.3695C85.3358%2012.2912%2084.6327%2011.4941%2083.6952%2010.9549H83.7186ZM82.4999%2019.9099C82.2889%2020.4726%2081.9843%2020.8711%2081.5858%2021.1289C81.1874%2021.3868%2080.6718%2021.504%2080.0155%2021.504H77.7421V13.6274H80.0155C80.6718%2013.6274%2081.1874%2013.7446%2081.5858%2014.0025C81.9843%2014.2603%2082.2889%2014.6588%2082.4999%2015.2215C82.7108%2015.7841%2082.8046%2016.5577%2082.8046%2017.5423C82.8046%2018.5268%2082.7108%2019.3473%2082.4999%2019.9099Z'%20fill='black'%3e%3c/path%3e%3cpath%20d='M88.5938%2032.8267H99.7029V29.3807H92.2734V23.0043H98.4608V19.5817H92.2734V13.6274H99.7029V10.1813H88.5938V32.8267Z'%20fill='black'%3e%3c/path%3e%3cpath%20d='M111.797%2023.356C112.711%2022.8402%20113.437%2022.0666%20113.953%2021.0352C114.469%2020.0037%20114.726%2018.7144%20114.726%2017.1672C114.726%2015.62%20114.492%2014.2134%20114.023%2013.2054C113.555%2012.1739%20112.851%2011.4238%20111.961%2010.9315C111.047%2010.4392%20109.922%2010.2048%20108.586%2010.2048H102.023V32.8501H105.703V24.153H108.258L111.094%2032.8501H115.078L111.75%2023.4028C111.75%2023.4028%20111.797%2023.4028%20111.82%2023.3794L111.797%2023.356ZM105.68%2013.6274H108.422C108.961%2013.6274%20109.406%2013.7211%20109.805%2013.9321C110.18%2014.1431%20110.484%2014.4947%20110.695%2015.0105C110.906%2015.5028%20111%2016.2295%20111%2017.1437C111%2018.058%20110.906%2018.8081%20110.695%2019.3239C110.484%2019.8396%20110.203%2020.1912%20109.828%2020.4022C109.453%2020.6132%20109.008%2020.707%20108.469%2020.707H105.703V13.6508L105.68%2013.6274Z'%20fill='black'%3e%3c/path%3e%3cpath%20d='M132.234%2027.3412L129.047%2010.1813H125.508L122.344%2027.2474L119.086%2010.1813H115.148L120.328%2032.8267H124.148L127.289%2017.6595L130.406%2032.8267H134.226L139.382%2010.1813H135.492L132.234%2027.3412Z'%20fill='black'%3e%3c/path%3e%3cpath%20d='M144.773%2010.1813H141.094V32.8267H144.773V10.1813Z'%20fill='black'%3e%3c/path%3e%3cpath%20d='M151.851%2014.19C152.109%2013.9087%20152.414%2013.6977%20152.766%2013.557C153.117%2013.4164%20153.539%2013.3461%20154.008%2013.3461C154.476%2013.3461%20155.109%2013.4398%20155.578%2013.6508C156.047%2013.8618%20156.422%2014.1665%20156.726%2014.5416C156.89%2014.7526%20157.055%2014.987%20157.172%2015.2683C157.312%2015.5496%20157.406%2015.8309%20157.453%2016.1357L160.922%2015.0574C160.664%2014.1431%20160.312%2013.3695%20159.867%2012.7131C159.422%2012.0567%20158.883%2011.4941%20158.25%2011.0487C157.687%2010.6502%20157.055%2010.3689%20156.328%2010.1813C155.625%209.99379%20154.851%209.90002%20154.055%209.90002C153.258%209.90002%20152.086%2010.0407%20151.266%2010.3454C150.469%2010.6502%20149.766%2011.0956%20149.203%2011.6816C148.617%2012.2443%20148.195%2012.9241%20147.914%2013.7211C147.633%2014.5182%20147.492%2015.4324%20147.492%2016.4405C147.492%2017.4485%20147.656%2018.5034%20148.008%2019.277C148.359%2020.0506%20148.875%2020.707%20149.578%2021.2461C150.281%2021.7853%20151.195%2022.2776%20152.344%2022.6761L154.336%2023.4028C155.062%2023.6842%20155.648%2023.9655%20156.047%2024.2702C156.445%2024.5515%20156.726%2024.8797%20156.89%2025.2314C157.055%2025.583%20157.125%2026.0284%20157.125%2026.5676C157.125%2027.1067%20157.078%2027.4818%20156.961%2027.8335C156.867%2028.1851%20156.68%2028.4899%20156.469%2028.7712C156.234%2029.0759%20155.93%2029.2869%20155.555%2029.4275C155.203%2029.5682%20154.781%2029.6385%20154.312%2029.6385C153.844%2029.6385%20153.211%2029.5448%20152.766%2029.3338C152.297%2029.1228%20151.922%2028.818%20151.617%2028.443C151.43%2028.232%20151.266%2027.9976%20151.148%2027.6928C151.008%2027.4115%20150.914%2027.1067%20150.867%2026.802L147.352%2027.7866C147.586%2028.7008%20147.937%2029.4979%20148.383%2030.2011C148.852%2030.9044%20149.391%2031.467%20150.047%2031.9359C150.633%2032.311%20151.266%2032.5923%20151.969%2032.8032C152.672%2033.0142%20153.445%2033.108%20154.242%2033.108C155.039%2033.108%20156.234%2032.9439%20157.031%2032.6626C157.851%2032.3578%20158.555%2031.9124%20159.14%2031.3029C159.68%2030.7169%20160.101%2030.0136%20160.406%2029.1931C160.711%2028.3726%20160.851%2027.4349%20160.851%2026.3566C160.851%2025.2782%20160.687%2024.2702%20160.336%2023.4966C159.984%2022.723%20159.469%2022.0666%20158.742%2021.5275C158.015%2020.9883%20157.078%2020.496%20155.883%2020.0506L153.914%2019.3239C153.187%2019.0426%20152.625%2018.7612%20152.25%2018.4799C151.852%2018.1752%20151.594%2017.8704%20151.453%2017.5188C151.312%2017.1672%20151.242%2016.7686%20151.242%2016.2998C151.242%2015.8309%20151.289%2015.4324%20151.406%2015.0808C151.5%2014.7292%20151.664%2014.4478%20151.851%2014.19Z'%20fill='black'%3e%3c/path%3e%3cpath%20d='M174.633%2013.6274V10.1813H163.5V32.8267H174.633V29.3807H167.18V23.0043H173.367V19.5817H167.18V13.6274H174.633Z'%20fill='black'%3e%3c/path%3e%3cpath%20d='M179.316%2011.0956V10.1345H183.512V11.0956H181.918V15.8075H180.91V11.0956H179.316Z'%20fill='black'%3e%3c/path%3e%3cpath%20d='M184.168%2010.1345H185.41L186.676%2013.9321L187.941%2010.1345H189.184V15.8075H188.269V11.8223L187.098%2015.1511H186.254L185.082%2011.9161V15.831H184.168V10.1579V10.1345Z'%20fill='black'%3e%3c/path%3e%3c/svg%3e";
|
|
1111
1111
|
let Qe = 0;
|
|
1112
|
-
function Ae({ width:
|
|
1112
|
+
function Ae({ width: t = 20, height: n = 20, style: i }) {
|
|
1113
1113
|
const a = V(null);
|
|
1114
1114
|
a.current || (a.current = `clip0_avatar_${++Qe}`);
|
|
1115
1115
|
const o = a.current;
|
|
1116
|
-
return /* @__PURE__ */ e.jsxs("svg", { width:
|
|
1116
|
+
return /* @__PURE__ */ e.jsxs("svg", { width: t, height: n, viewBox: "0 0 155 174", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: i, "aria-hidden": !0, children: [
|
|
1117
1117
|
/* @__PURE__ */ e.jsxs("g", { clipPath: `url(#${o})`, children: [
|
|
1118
1118
|
/* @__PURE__ */ e.jsx("path", { d: "M73.41 57.8388C73.15 56.8088 72.23 56.0988 71.17 56.0988H62.35C61.29 56.0988 60.37 56.8188 60.11 57.8488L45.8 114.299C45.62 114.999 45.78 115.719 46.22 116.289C46.66 116.859 47.33 117.179 48.05 117.179H55.05C56.13 117.179 57.08 116.419 57.31 115.359L59.83 103.889H73.76L76.29 115.359C76.52 116.409 77.47 117.179 78.55 117.179H85.54C86.26 117.179 86.92 116.849 87.37 116.289C87.81 115.719 87.96 114.999 87.79 114.299L73.44 57.8488L73.41 57.8388ZM62.12 93.3688L66.76 72.2188L71.42 93.3688H62.12Z", fill: "#FF0000" }),
|
|
1119
1119
|
/* @__PURE__ */ e.jsx("path", { d: "M101.69 56.0988H95.01C93.73 56.0988 92.7 57.1388 92.7 58.4088V114.859C92.7 116.139 93.74 117.169 95.01 117.169H101.69C102.97 117.169 104 116.129 104 114.859V58.4088C104 57.1288 102.96 56.0988 101.69 56.0988Z", fill: "#FF0000" }),
|
|
@@ -1122,8 +1122,8 @@ function Ae({ width: r = 20, height: n = 20, style: i }) {
|
|
|
1122
1122
|
/* @__PURE__ */ e.jsx("defs", { children: /* @__PURE__ */ e.jsx("clipPath", { id: o, children: /* @__PURE__ */ e.jsx("rect", { width: "154.17", height: "173.268", fill: "white" }) }) })
|
|
1123
1123
|
] });
|
|
1124
1124
|
}
|
|
1125
|
-
function et({ width:
|
|
1126
|
-
const a =
|
|
1125
|
+
function et({ width: t, height: n = 20, style: i }) {
|
|
1126
|
+
const a = t ?? 4.6875 * n;
|
|
1127
1127
|
return /* @__PURE__ */ e.jsxs("svg", { width: a, height: n, viewBox: "0 0 75 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: i, "aria-hidden": !0, children: [
|
|
1128
1128
|
/* @__PURE__ */ e.jsx("path", { d: "M6.82917 5.34411C6.8013 5.25174 6.71768 5.18707 6.62476 5.18707H5.80712C5.70492 5.18707 5.62129 5.25174 5.60271 5.34411L4.27404 10.5635C4.25546 10.6282 4.27404 10.6928 4.31121 10.7483C4.34838 10.8037 4.41341 10.8314 4.47845 10.8314H5.12885C5.23106 10.8314 5.31468 10.7575 5.34255 10.6651L5.57484 9.60278H6.86634L7.09862 10.6651C7.11721 10.7667 7.21012 10.8314 7.31232 10.8314H7.96272C8.02776 10.8314 8.0928 10.8037 8.12997 10.7483C8.16713 10.6928 8.18571 10.6282 8.16713 10.5635L6.83846 5.34411H6.82917ZM5.77925 8.62356L6.20665 6.67437L6.64335 8.62356H5.77925Z", fill: "white" }),
|
|
1129
1129
|
/* @__PURE__ */ e.jsx("path", { d: "M9.44935 5.18707H8.82683C8.70604 5.18707 8.61313 5.27945 8.61313 5.39954V10.6189C8.61313 10.739 8.70604 10.8314 8.82683 10.8314H9.44935C9.57014 10.8314 9.66305 10.739 9.66305 10.6189V5.39954C9.66305 5.27945 9.57014 5.18707 9.44935 5.18707ZM8.83612 5.26097C8.81754 5.26097 8.79896 5.26098 8.78037 5.27021C8.79896 5.27021 8.81754 5.26097 8.83612 5.26097Z", fill: "white" }),
|
|
@@ -1144,21 +1144,21 @@ function et({ width: r, height: n = 20, style: i }) {
|
|
|
1144
1144
|
const Me = "superwise-chatbot-package-css";
|
|
1145
1145
|
function tt() {
|
|
1146
1146
|
if (typeof document > "u" || document.getElementById(Me)) return;
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1147
|
+
const t = document.createElement("style");
|
|
1148
|
+
t.id = Me, t.textContent = Xe, document.head.appendChild(t);
|
|
1149
1149
|
}
|
|
1150
1150
|
tt();
|
|
1151
|
-
function rt(
|
|
1152
|
-
return
|
|
1151
|
+
function rt(t) {
|
|
1152
|
+
return t === "human" ? { ...y.message, ...y.messageSelf } : { ...y.message, ...y.messageOther };
|
|
1153
1153
|
}
|
|
1154
|
-
function Ce(
|
|
1155
|
-
return String(
|
|
1154
|
+
function Ce(t) {
|
|
1155
|
+
return String(t).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1156
1156
|
}
|
|
1157
|
-
function ye(
|
|
1158
|
-
return !
|
|
1157
|
+
function ye(t) {
|
|
1158
|
+
return !t.trim() || /^\s*([*\-]|\d+\.)\s+/.test(t) ? !1 : /^\s{2,}/.test(t) && /[=(){}\[\],:]/.test(t) || /["'][^"']*["']\s*[:=]/.test(t) && t.length > 10 ? !0 : /\[text\]|\[\/text\]|\]\[text\]/i.test(t) || /\?|!/.test(t) || t.includes("—") || t.includes("–") || /^\s*(Would|Can|May|Could|Should|I |You |We |Let's|Please|Sure|Yes|No)\b/i.test(t) || /\b(your|you|we|me)\b/i.test(t) || /^\s*[A-Z][^.(]*[.?]\s*$/.test(t) || /^\s*#/.test(t) || /^\s*[-*]\s+[A-Z]/.test(t) && !/\.\w+\s*\(|=/.test(t) || /^\s*\d+\.\s+[A-Z][^.(]*$/.test(t) ? !1 : !!(/^\s*[)\]}]\s*$/.test(t) || /^\s*\.{3}\s*$/.test(t) || /^\s*(GET|POST|PUT|PATCH|DELETE|HEAD)\s+\S+/i.test(t) || /^\s*(Authorization|Content-Type|Accept)\s*:/i.test(t) || /^\s*\{\s*$/.test(t) || /^\s*[\w.]+\s*=/.test(t) || /\.\w+\s*\(|\b(print|range|open|str|int|list|dict)\s*\(/.test(t) || /^\s*(def|class|import|from|return|if|else|elif|for|while|try|except|with|async)\b/.test(t) || /^\s{2,}/.test(t) && /[=(){}\[\],:]/.test(t) || /[,(]\s*$|:\s*$/.test(t) || /["'][^"']*["']\s*[:=]/.test(t) && t.length > 10 || /\b\w+\s*\([^)]*\)\s*$/.test(t) && /[=.]\w+\s*\(|import|from\s+\w+/.test(t));
|
|
1159
1159
|
}
|
|
1160
|
-
function nt(
|
|
1161
|
-
const n = [], i =
|
|
1160
|
+
function nt(t) {
|
|
1161
|
+
const n = [], i = t.split(`
|
|
1162
1162
|
`), a = [];
|
|
1163
1163
|
let o = 0;
|
|
1164
1164
|
for (; o < i.length; ) {
|
|
@@ -1183,14 +1183,14 @@ function nt(r) {
|
|
|
1183
1183
|
return { html: a.join(`
|
|
1184
1184
|
`), codeBlocks: n };
|
|
1185
1185
|
}
|
|
1186
|
-
function Ve(
|
|
1187
|
-
return !
|
|
1186
|
+
function Ve(t) {
|
|
1187
|
+
return !t || !String(t).trim() ? "" : String(t).replace(/^### (.*$)/gim, "<h3>$1</h3>").replace(/^## (.*$)/gim, "<h2>$1</h2>").replace(/^# (.*$)/gim, "<h1>$1</h1>").replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>").replace(/\*(.*?)\*/g, "<em>$1</em>").replace(/`([^`]+)`/g, "<code>$1</code>").replace(/\n/g, "<br>");
|
|
1188
1188
|
}
|
|
1189
|
-
const
|
|
1190
|
-
function ot(
|
|
1189
|
+
const $e = /^\s*([*\-]|\d+\.)\s+(.*)$/;
|
|
1190
|
+
function ot(t) {
|
|
1191
1191
|
const n = [];
|
|
1192
|
-
for (const l of
|
|
1193
|
-
const b = l.match(
|
|
1192
|
+
for (const l of t) {
|
|
1193
|
+
const b = l.match($e);
|
|
1194
1194
|
if (!b) continue;
|
|
1195
1195
|
const m = l.match(/^(\s*)/)[1].length, L = b[1], p = b[2], h = /^\d+\.$/.test(L);
|
|
1196
1196
|
n.push({ indent: m, content: p, ordered: h });
|
|
@@ -1222,9 +1222,9 @@ function ot(r) {
|
|
|
1222
1222
|
o.pop().type === "ul" ? (a.push("</ul>"), o.length > 0 && o[o.length - 1].type === "ol" && a.push("</li>")) : a.push("</ol>");
|
|
1223
1223
|
return a.join("");
|
|
1224
1224
|
}
|
|
1225
|
-
function
|
|
1226
|
-
if (!
|
|
1227
|
-
let n = String(
|
|
1225
|
+
function We(t) {
|
|
1226
|
+
if (!t) return "";
|
|
1227
|
+
let n = String(t);
|
|
1228
1228
|
const i = [];
|
|
1229
1229
|
n = n.replace(/```\s*(\w*)\s*\n?([\s\S]*?)```/g, (p, h, w) => {
|
|
1230
1230
|
const g = i.length, x = Ce(w.trim());
|
|
@@ -1234,7 +1234,7 @@ function Te(r) {
|
|
|
1234
1234
|
return i.push(`<pre class="sw-ttyw-code-block"><code>${g}</code></pre>`), `\0CODE_FENCED_${w}\0`;
|
|
1235
1235
|
});
|
|
1236
1236
|
const { html: a, codeBlocks: o } = nt(n);
|
|
1237
|
-
n = a, n = n.replace(/\[text\]([\s\S]*?)(?:\[\/text\]|\]\[text\])/gi, '<span class="sw-ttyw-text-block">$1</span>').replace(/\[bold\]([\s\S]*?)
|
|
1237
|
+
n = a, n = n.replace(/\[text\]([\s\S]*?)(?:\[\/text\]|\]\[text\]|\[text\]|\](?=\s*(\n|$)))/gi, '<span class="sw-ttyw-text-block">$1</span>').replace(/\[bold\]([\s\S]*?)(?:\[\/bold\]|\]\[bold\]|\[bold\]|\](?=\s*(\n|$)))/gi, "<strong>$1</strong>").replace(/\[italic\]([\s\S]*?)(?:\[\/italic\]|\]\[italic\]|\[italic\]|\](?=\s*(\n|$)))/gi, "<em>$1</em>").replace(/bold([\s\S]*?)\/bold/gi, "<strong>$1</strong>").replace(/italic([\s\S]*?)\/italic/gi, "<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>').replace(/(https?:\/\/[^\s<]+)/g, '<a href="$1" target="_blank" rel="noopener noreferrer">$1</a>').replace(/\[([^[\]]+)\]/g, '<span class="sw-ttyw-bracket-label">$1</span>');
|
|
1238
1238
|
const f = n.split(`
|
|
1239
1239
|
`), c = [];
|
|
1240
1240
|
let d = [], l = [];
|
|
@@ -1246,7 +1246,7 @@ function Te(r) {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
for (let p = 0; p < f.length; p++) {
|
|
1248
1248
|
const h = f[p];
|
|
1249
|
-
|
|
1249
|
+
$e.test(h) ? (m(), d.push(h)) : (b(), l.push(h));
|
|
1250
1250
|
}
|
|
1251
1251
|
return b(), m(), n = c.map((p) => p.type === "list" ? ot(p.lines) : Ve(p.lines.join(`
|
|
1252
1252
|
`))).join(""), i.forEach((p, h) => {
|
|
@@ -1256,10 +1256,10 @@ function Te(r) {
|
|
|
1256
1256
|
}), n = n.replace(/(<br\s*\/?>)\s*$/i, ""), n;
|
|
1257
1257
|
}
|
|
1258
1258
|
const st = 30, at = 300, it = Pe(function({ text: n, speed: i = 20, onComplete: a }) {
|
|
1259
|
-
const [o, f] =
|
|
1260
|
-
|
|
1259
|
+
const [o, f] = H(""), [c, d] = H(!1), l = V(a);
|
|
1260
|
+
$(() => {
|
|
1261
1261
|
l.current = a;
|
|
1262
|
-
}, [a]),
|
|
1262
|
+
}, [a]), $(() => {
|
|
1263
1263
|
if (!n) return;
|
|
1264
1264
|
f(""), d(!1);
|
|
1265
1265
|
const m = n.trim().split(/\s+/), L = Math.min(st, m.length), p = m.slice(0, L).join(" "), h = Math.min(p.length, at, n.length);
|
|
@@ -1275,7 +1275,7 @@ const st = 30, at = 300, it = Pe(function({ text: n, speed: i = 20, onComplete:
|
|
|
1275
1275
|
g && clearInterval(g), typeof document < "u" && document.removeEventListener("visibilitychange", _);
|
|
1276
1276
|
};
|
|
1277
1277
|
}, [n, i]);
|
|
1278
|
-
const b = (m) => m.replace(/(https?:\/\/[^\s<]+)/g, '<a href="$1" target="_blank" rel="noopener noreferrer">$1</a>').replace(/\[bold\]([\s\S]*?)
|
|
1278
|
+
const b = (m) => m.replace(/(https?:\/\/[^\s<]+)/g, '<a href="$1" target="_blank" rel="noopener noreferrer">$1</a>').replace(/\[bold\]([\s\S]*?)(?:\[\/bold\]|\]\[bold\]|\[bold\]|\](?=\s*(\n|$)))/gi, "<strong>$1</strong>").replace(/\[italic\]([\s\S]*?)(?:\[\/italic\]|\]\[italic\]|\[italic\]|\](?=\s*(\n|$)))/gi, "<em>$1</em>").replace(/\[text\]([\s\S]*?)(?:\[\/text\]|\]\[text\]|\[text\]|\](?=\s*(\n|$)))/gi, '<span class="sw-ttyw-text-block">$1</span>').replace(/bold([\s\S]*?)\/bold/gi, "<strong>$1</strong>").replace(/italic([\s\S]*?)\/italic/gi, "<em>$1</em>").replace(/\[([^[\]]+)\]/g, '<span class="sw-ttyw-bracket-label">$1</span>').replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>").replace(/\*(.*?)\*/g, "<em>$1</em>").replace(/(?:^|\n)-\s+/g, `
|
|
1279
1279
|
• `).replace(/\n/g, "<br/>").replace(/(\d+\.\s)/g, "<br/>$1").replace(/(\*\s)/g, "<br/>$1");
|
|
1280
1280
|
return /* @__PURE__ */ e.jsx(
|
|
1281
1281
|
"div",
|
|
@@ -1286,7 +1286,7 @@ const st = 30, at = 300, it = Pe(function({ text: n, speed: i = 20, onComplete:
|
|
|
1286
1286
|
wordBreak: "break-word"
|
|
1287
1287
|
},
|
|
1288
1288
|
dangerouslySetInnerHTML: {
|
|
1289
|
-
__html: c ?
|
|
1289
|
+
__html: c ? We(o) : b(o) + '<span class="typing-cursor">|</span>'
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
1292
|
);
|
|
@@ -1305,7 +1305,7 @@ const st = 30, at = 300, it = Pe(function({ text: n, speed: i = 20, onComplete:
|
|
|
1305
1305
|
lineHeight: "1.5",
|
|
1306
1306
|
wordBreak: "break-word"
|
|
1307
1307
|
},
|
|
1308
|
-
dangerouslySetInnerHTML: { __html:
|
|
1308
|
+
dangerouslySetInnerHTML: { __html: We(n.text) }
|
|
1309
1309
|
}
|
|
1310
1310
|
) : /* @__PURE__ */ e.jsx(
|
|
1311
1311
|
"div",
|
|
@@ -1316,57 +1316,57 @@ const st = 30, at = 300, it = Pe(function({ text: n, speed: i = 20, onComplete:
|
|
|
1316
1316
|
wordBreak: "break-word"
|
|
1317
1317
|
},
|
|
1318
1318
|
dangerouslySetInnerHTML: {
|
|
1319
|
-
__html: n.text.replace(/\[bold\]([\s\S]*?)
|
|
1319
|
+
__html: n.text.replace(/\[bold\]([\s\S]*?)(?:\[\/bold\]|\]\[bold\]|\[bold\]|\](?=\s*(\n|$)))/gi, "<strong>$1</strong>").replace(/\[italic\]([\s\S]*?)(?:\[\/italic\]|\]\[italic\]|\[italic\]|\](?=\s*(\n|$)))/gi, "<em>$1</em>").replace(/\[text\]([\s\S]*?)(?:\[\/text\]|\]\[text\]|\[text\]|\](?=\s*(\n|$)))/gi, '<span class="sw-ttyw-text-block">$1</span>').replace(/bold([\s\S]*?)\/bold/gi, "<strong>$1</strong>").replace(/italic([\s\S]*?)\/italic/gi, "<em>$1</em>").replace(/\[([^[\]]+)\]/g, "<strong>$1</strong>").replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>").replace(/\*(.*?)\*/g, "<em>$1</em>").replace(/(?:^|\n)-\s+/g, `
|
|
1320
1320
|
• `).replace(/\n/g, "<br/>").replace(/(\d+\.\s)/g, "<br/>$1").replace(/(\*\s)/g, "<br/>$1")
|
|
1321
1321
|
}
|
|
1322
1322
|
}
|
|
1323
1323
|
) })
|
|
1324
1324
|
] });
|
|
1325
|
-
}), ct = (
|
|
1325
|
+
}), ct = (t = "") => {
|
|
1326
1326
|
const n = (/* @__PURE__ */ new Date()).getHours();
|
|
1327
1327
|
let i = [];
|
|
1328
|
-
return n >= 5 && n < 12 ?
|
|
1329
|
-
`🌅 Good morning ${
|
|
1330
|
-
`☀️ Morning ${
|
|
1331
|
-
`🌞 Good morning ${
|
|
1332
|
-
`👋 Rise and shine ${
|
|
1333
|
-
`👋 Morning ${
|
|
1328
|
+
return n >= 5 && n < 12 ? t ? i = [
|
|
1329
|
+
`🌅 Good morning ${t}! I'm an expert on SUPERWISE. Ready to explore the platform together and uncover what's possible?`,
|
|
1330
|
+
`☀️ Morning ${t}! I'm an expert on SUPERWISE. What would you like to discover or optimize today?`,
|
|
1331
|
+
`🌞 Good morning ${t}! I'm an expert on SUPERWISE. Curious about a feature or looking to dive deeper into the platform?`,
|
|
1332
|
+
`👋 Rise and shine ${t}! I'm an expert on SUPERWISE. Let's jump into anything you want to explore.`,
|
|
1333
|
+
`👋 Morning ${t}! I'm an expert on SUPERWISE. How can I guide you through the platform today?`
|
|
1334
1334
|
] : i = [
|
|
1335
1335
|
"🌅 Good morning! I'm an expert on SUPERWISE. Ready to explore the platform together and uncover what's possible?",
|
|
1336
1336
|
"☀️ Morning! I'm an expert on SUPERWISE. What would you like to discover or optimize today?",
|
|
1337
1337
|
"🌞 Good morning! I'm an expert on SUPERWISE. Curious about a feature or looking to dive deeper into the platform?",
|
|
1338
1338
|
"👋 Rise and shine! I'm an expert on SUPERWISE. Let's jump into anything you want to explore.",
|
|
1339
1339
|
"👋 Morning! I'm an expert on SUPERWISE. How can I guide you through the platform today?"
|
|
1340
|
-
] : n >= 12 && n < 17 ?
|
|
1341
|
-
`🌞 Good afternoon ${
|
|
1342
|
-
`☀️ Afternoon ${
|
|
1343
|
-
`👋 Good afternoon ${
|
|
1344
|
-
`🌅 Hey there ${
|
|
1345
|
-
`🌅 Afternoon ${
|
|
1340
|
+
] : n >= 12 && n < 17 ? t ? i = [
|
|
1341
|
+
`🌞 Good afternoon ${t}! I'm an expert on SUPERWISE. Ready to explore insights, features, or workflows together?`,
|
|
1342
|
+
`☀️ Afternoon ${t}! I'm an expert on SUPERWISE. How may I help you today?`,
|
|
1343
|
+
`👋 Good afternoon ${t}! I'm an expert on SUPERWISE. Looking to learn, optimize, or explore something specific?`,
|
|
1344
|
+
`🌅 Hey there ${t}! SUPERWISE expert here. Ready to help you unlock the capabilities you're curious about.`,
|
|
1345
|
+
`🌅 Afternoon ${t}! I'm an expert on SUPERWISE. How can I support your exploration today?`
|
|
1346
1346
|
] : i = [
|
|
1347
1347
|
"🌞 Good afternoon! I'm an expert on SUPERWISE. Ready to explore insights, features, or workflows together?",
|
|
1348
1348
|
"☀️ Afternoon! I'm an expert on SUPERWISE. How may I help you today?",
|
|
1349
1349
|
"👋 Good afternoon! I'm an expert on SUPERWISE. Looking to learn, optimize, or explore something specific?",
|
|
1350
1350
|
"🌅 Hey there! SUPERWISE expert here. Ready to help you unlock the capabilities you're curious about.",
|
|
1351
1351
|
"🌅 Afternoon! I'm an expert on SUPERWISE. How can I support your exploration today?"
|
|
1352
|
-
] : n >= 17 && n < 21 ?
|
|
1353
|
-
`🌆 Good evening ${
|
|
1354
|
-
`🌅 Evening ${
|
|
1355
|
-
`👋 Good evening ${
|
|
1356
|
-
`🌇 Hey there ${
|
|
1357
|
-
`🌇 Evening ${
|
|
1352
|
+
] : n >= 17 && n < 21 ? t ? i = [
|
|
1353
|
+
`🌆 Good evening ${t}! I'm a SUPERWISE expert. Ready to explore features or clarify anything you're evaluating?`,
|
|
1354
|
+
`🌅 Evening ${t}! I'm your SUPERWISE expert. What can I help you discover or fine-tune tonight?`,
|
|
1355
|
+
`👋 Good evening ${t}! I'm an expert on SUPERWISE. Interested in exploring capabilities or reviewing how something works?`,
|
|
1356
|
+
`🌇 Hey there ${t}! SUPERWISE expert here. Want to dive into the platform together?`,
|
|
1357
|
+
`🌇 Evening ${t}! I'm an expert on SUPERWISE. How can I assist your learning or discovery today?`
|
|
1358
1358
|
] : i = [
|
|
1359
1359
|
"🌆 Good evening! I'm a SUPERWISE expert. Ready to explore features or clarify anything you're evaluating?",
|
|
1360
1360
|
"🌅 Evening! I'm your SUPERWISE expert. What can I help you discover or fine-tune tonight?",
|
|
1361
1361
|
"👋 Good evening! I'm an expert on SUPERWISE. Interested in exploring capabilities or reviewing how something works?",
|
|
1362
1362
|
"🌇 Hey there! SUPERWISE expert here. Want to dive into the platform together?",
|
|
1363
1363
|
"🌇 Evening! I'm an expert on SUPERWISE. How can I assist your learning or discovery today?"
|
|
1364
|
-
] :
|
|
1365
|
-
`🌙 Good evening ${
|
|
1366
|
-
`⭐ Evening ${
|
|
1367
|
-
`👋 Good evening ${
|
|
1368
|
-
`🌃 Hey there ${
|
|
1369
|
-
`🌃 Evening ${
|
|
1364
|
+
] : t ? i = [
|
|
1365
|
+
`🌙 Good evening ${t}! I'm a SUPERWISE expert. Ready to guide you through the platform anytime.`,
|
|
1366
|
+
`⭐ Evening ${t}! I'm your SUPERWISE expert. What brings you to Superwise tonight - exploration, questions, or clarity?`,
|
|
1367
|
+
`👋 Good evening ${t}! I'm a SUPERWISE expert. Looking to discover features or understand how something works?`,
|
|
1368
|
+
`🌃 Hey there ${t}! I'm a SUPERWISE expert. Want to explore what the platform offers?`,
|
|
1369
|
+
`🌃 Evening ${t}! SUPERWISE expert here. How can I help simplify or explain things for you today?`
|
|
1370
1370
|
] : i = [
|
|
1371
1371
|
"🌙 Good evening! I'm a SUPERWISE expert. Ready to guide you through the platform anytime.",
|
|
1372
1372
|
"⭐ Evening! I'm your SUPERWISE expert. What brings you to Superwise tonight - exploration, questions, or clarity?",
|
|
@@ -1375,8 +1375,8 @@ const st = 30, at = 300, it = Pe(function({ text: n, speed: i = 20, onComplete:
|
|
|
1375
1375
|
"🌃 Evening! SUPERWISE expert here. How can I help simplify or explain things for you today?"
|
|
1376
1376
|
], i[Math.floor(Math.random() * i.length)];
|
|
1377
1377
|
};
|
|
1378
|
-
function pt({ title:
|
|
1379
|
-
const [c, d] =
|
|
1378
|
+
function pt({ title: t = "", agentId: n = "", discoveryAgentId: i = "", primaryColor: a = "", minimizedButtonColor: o = "", apiUrl: f = "" }) {
|
|
1379
|
+
const [c, d] = H(() => {
|
|
1380
1380
|
try {
|
|
1381
1381
|
if (typeof window < "u" && window.localStorage) {
|
|
1382
1382
|
const s = window.localStorage.getItem("chatbot-messages");
|
|
@@ -1385,7 +1385,7 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1385
1385
|
} catch {
|
|
1386
1386
|
}
|
|
1387
1387
|
return [];
|
|
1388
|
-
}), [l, b] =
|
|
1388
|
+
}), [l, b] = H(() => {
|
|
1389
1389
|
try {
|
|
1390
1390
|
if (typeof window < "u" && window.localStorage) {
|
|
1391
1391
|
const s = window.localStorage.getItem("chatbot-mql_df");
|
|
@@ -1394,7 +1394,7 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1394
1394
|
} catch {
|
|
1395
1395
|
}
|
|
1396
1396
|
return [];
|
|
1397
|
-
}), [m, L] =
|
|
1397
|
+
}), [m, L] = H(""), [p, h] = H(!1), [w, g] = H(!1), [x, M] = H(!0), [_, Y] = H(!1), [le, W] = H(/* @__PURE__ */ new Set()), [ce, de] = H(!1), [pe, q] = H(!1), [ue, T] = H(!1), [P, te] = H(!1), [be, G] = H(""), [U, O] = H(""), re = 12e4, me = "https://superwise.ai/contact/", ne = (s) => typeof s == "string" && s.includes("unable to respond at the moment") && s.includes("Contact Sales"), r = V(null), u = V(null), E = (() => {
|
|
1398
1398
|
if (a) return a;
|
|
1399
1399
|
if (typeof document < "u" && typeof window < "u") {
|
|
1400
1400
|
const s = document.querySelector("[data-chatbot-color]");
|
|
@@ -1404,19 +1404,19 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1404
1404
|
if (v) return v;
|
|
1405
1405
|
}
|
|
1406
1406
|
return "#000";
|
|
1407
|
-
})(), J = o || "#000000", X =
|
|
1407
|
+
})(), J = o || "#000000", X = Ie(() => {
|
|
1408
1408
|
if (!l || l.length === 0) return "";
|
|
1409
1409
|
const s = l.find((C) => C.name && C.email);
|
|
1410
1410
|
return s ? `${s.name} (${s.email})` : "";
|
|
1411
|
-
}, [l]), j = V(null), R = V(null), [oe, K] =
|
|
1412
|
-
|
|
1411
|
+
}, [l]), j = V(null), R = V(null), [oe, K] = H(!0), Q = V(!0), ke = V(c), A = Z(() => {
|
|
1412
|
+
r.current && (clearTimeout(r.current), r.current = null);
|
|
1413
1413
|
}, []), ve = Z((s) => {
|
|
1414
|
-
A(),
|
|
1415
|
-
}, [re, A]), we =
|
|
1414
|
+
A(), r.current = setTimeout(s, re);
|
|
1415
|
+
}, [re, A]), we = Ie(() => c.map((s) => ({ role: s.from, content: s.text })), [c]), he = (s) => {
|
|
1416
1416
|
O(s), setTimeout(() => {
|
|
1417
1417
|
O("");
|
|
1418
1418
|
}, 4e3);
|
|
1419
|
-
},
|
|
1419
|
+
}, Te = (s) => {
|
|
1420
1420
|
const C = s.length, v = s.trim();
|
|
1421
1421
|
return G(""), O(""), !v || C === 0 ? (he("Please enter a message before sending."), !1) : new RegExp(/(<([^>]+)>)/gi).test(v) ? (he("Please avoid using HTML tags or scripts in your message."), !1) : v.length < 2 ? (he("Please enter a meaningful question (at least 2 characters)."), !1) : v.length > 1e3 ? (he("Message is too long. Please keep it under 1000 characters."), !1) : (G(""), O(""), !0);
|
|
1422
1422
|
}, D = Z((s = "auto") => {
|
|
@@ -1424,9 +1424,9 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1424
1424
|
const C = R.current;
|
|
1425
1425
|
C && (C.scrollTop = C.scrollHeight), (v = j.current) == null || v.scrollIntoView({ behavior: s }), Q.current = !0, K(!0);
|
|
1426
1426
|
}, []);
|
|
1427
|
-
|
|
1427
|
+
$(() => {
|
|
1428
1428
|
Q.current && requestAnimationFrame(() => D("auto"));
|
|
1429
|
-
}, [c, U, ue, P, le, p, D]),
|
|
1429
|
+
}, [c, U, ue, P, le, p, D]), $(() => {
|
|
1430
1430
|
const s = R.current;
|
|
1431
1431
|
if (!s || typeof ResizeObserver > "u") return;
|
|
1432
1432
|
const C = new ResizeObserver(() => {
|
|
@@ -1435,15 +1435,15 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1435
1435
|
return C.observe(s), () => C.disconnect();
|
|
1436
1436
|
}, [D]);
|
|
1437
1437
|
const ge = V(null), Se = V(x);
|
|
1438
|
-
|
|
1438
|
+
$(() => {
|
|
1439
1439
|
const s = Se.current;
|
|
1440
1440
|
if (Se.current = x, s && !x) {
|
|
1441
1441
|
const C = ge.current;
|
|
1442
1442
|
C != null ? (ge.current = null, requestAnimationFrame(() => {
|
|
1443
1443
|
const v = R.current;
|
|
1444
1444
|
if (v) {
|
|
1445
|
-
const
|
|
1446
|
-
v.scrollTop = Math.min(C, Math.max(0,
|
|
1445
|
+
const I = v.scrollHeight - v.clientHeight;
|
|
1446
|
+
v.scrollTop = Math.min(C, Math.max(0, I));
|
|
1447
1447
|
const fe = v.scrollHeight - v.scrollTop - v.clientHeight <= 40;
|
|
1448
1448
|
Q.current = fe, K(fe);
|
|
1449
1449
|
}
|
|
@@ -1453,37 +1453,37 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1453
1453
|
const Fe = Z(() => {
|
|
1454
1454
|
const s = R.current;
|
|
1455
1455
|
if (!s) return;
|
|
1456
|
-
const
|
|
1457
|
-
Q.current !==
|
|
1456
|
+
const I = s.scrollHeight - s.scrollTop - s.clientHeight <= 40;
|
|
1457
|
+
Q.current !== I && (Q.current = I, K(I));
|
|
1458
1458
|
}, []);
|
|
1459
|
-
|
|
1459
|
+
$(() => {
|
|
1460
1460
|
try {
|
|
1461
1461
|
typeof window < "u" && window.localStorage && window.localStorage.setItem("chatbot-messages", JSON.stringify(c));
|
|
1462
1462
|
} catch {
|
|
1463
1463
|
}
|
|
1464
|
-
}, [c]),
|
|
1464
|
+
}, [c]), $(() => {
|
|
1465
1465
|
try {
|
|
1466
1466
|
typeof window < "u" && window.localStorage && window.localStorage.setItem("chatbot-mql_df", JSON.stringify(l));
|
|
1467
1467
|
} catch {
|
|
1468
1468
|
}
|
|
1469
|
-
}, [l]),
|
|
1469
|
+
}, [l]), $(() => {
|
|
1470
1470
|
ke.current = c;
|
|
1471
|
-
}, [c]),
|
|
1471
|
+
}, [c]), $(() => {
|
|
1472
1472
|
if (c.length === 0 && !ce) {
|
|
1473
1473
|
const C = { from: "ai", text: ct(X) };
|
|
1474
|
-
d([C]), de(!0),
|
|
1474
|
+
d([C]), de(!0), W(/* @__PURE__ */ new Set([0]));
|
|
1475
1475
|
}
|
|
1476
|
-
}, [c.length, ce, X]),
|
|
1476
|
+
}, [c.length, ce, X]), $(() => () => A(), [A]);
|
|
1477
1477
|
const Ee = Z(async () => {
|
|
1478
|
-
var
|
|
1478
|
+
var He;
|
|
1479
1479
|
if (p || P) return;
|
|
1480
1480
|
const s = m.trim();
|
|
1481
|
-
if (!s ||
|
|
1481
|
+
if (!s || !Te(m))
|
|
1482
1482
|
return;
|
|
1483
|
-
|
|
1483
|
+
T(!1), A(), (He = u.current) == null || He.abort();
|
|
1484
1484
|
const C = new AbortController();
|
|
1485
1485
|
u.current = C;
|
|
1486
|
-
const v = C.signal,
|
|
1486
|
+
const v = C.signal, I = { from: "human", text: s }, F = ke.current, fe = [...F, I];
|
|
1487
1487
|
d(fe), L(""), h(!0);
|
|
1488
1488
|
let Le = s;
|
|
1489
1489
|
if (l && l.length > 0 && !pe) {
|
|
@@ -1493,7 +1493,7 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1493
1493
|
const Oe = [...we, { role: "human", content: s }];
|
|
1494
1494
|
ve(() => {
|
|
1495
1495
|
var k;
|
|
1496
|
-
|
|
1496
|
+
T(!0), (k = u.current) == null || k.abort(), h(!1);
|
|
1497
1497
|
});
|
|
1498
1498
|
try {
|
|
1499
1499
|
const k = await Ge(Le, Oe, l, n, i, f, v);
|
|
@@ -1501,28 +1501,28 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1501
1501
|
const B = { from: "ai", text: k };
|
|
1502
1502
|
d((N) => {
|
|
1503
1503
|
const z = [...N, B];
|
|
1504
|
-
return
|
|
1505
|
-
}), (k.startsWith("⚠️") || k.startsWith("❌") || k
|
|
1504
|
+
return W((ee) => /* @__PURE__ */ new Set([...ee, z.length - 1])), z;
|
|
1505
|
+
}), (k.startsWith("⚠️") || k.startsWith("❌") || ne(k)) && T(!0);
|
|
1506
1506
|
} else {
|
|
1507
1507
|
if (k != null && k.isError) {
|
|
1508
|
-
|
|
1508
|
+
T(!0);
|
|
1509
1509
|
const N = k.reply || ie;
|
|
1510
1510
|
d((z) => {
|
|
1511
1511
|
const ee = [...z, { from: "ai", text: N }];
|
|
1512
|
-
return
|
|
1512
|
+
return W((De) => /* @__PURE__ */ new Set([...De, ee.length - 1])), ee;
|
|
1513
1513
|
});
|
|
1514
1514
|
return;
|
|
1515
1515
|
}
|
|
1516
1516
|
const B = { from: "ai", text: k.reply };
|
|
1517
1517
|
d((N) => {
|
|
1518
1518
|
const z = [...N, B];
|
|
1519
|
-
return
|
|
1520
|
-
}), k.mqlDf && Array.isArray(k.mqlDf) && b(k.mqlDf), k.reply && (k.reply.startsWith("⚠️") || k.reply.startsWith("❌") || k.reply
|
|
1519
|
+
return W((ee) => /* @__PURE__ */ new Set([...ee, z.length - 1])), z;
|
|
1520
|
+
}), k.mqlDf && Array.isArray(k.mqlDf) && b(k.mqlDf), k.reply && (k.reply.startsWith("⚠️") || k.reply.startsWith("❌") || ne(k.reply)) && T(!0), k.chatHistoryLimitExceeded && te(!0);
|
|
1521
1521
|
}
|
|
1522
1522
|
} catch (k) {
|
|
1523
1523
|
if (A(), k.name === "AbortError")
|
|
1524
1524
|
return;
|
|
1525
|
-
|
|
1525
|
+
T(!0), d((B) => {
|
|
1526
1526
|
const N = [
|
|
1527
1527
|
...B,
|
|
1528
1528
|
{
|
|
@@ -1530,14 +1530,14 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1530
1530
|
text: ie
|
|
1531
1531
|
}
|
|
1532
1532
|
];
|
|
1533
|
-
return
|
|
1533
|
+
return W((z) => /* @__PURE__ */ new Set([...z, N.length - 1])), N;
|
|
1534
1534
|
});
|
|
1535
1535
|
} finally {
|
|
1536
1536
|
h(!1);
|
|
1537
1537
|
}
|
|
1538
1538
|
}, [m, n, i, l, pe, we, P, A, ve]), ze = Z(() => {
|
|
1539
1539
|
var s;
|
|
1540
|
-
A(), (s = u.current) == null || s.abort(),
|
|
1540
|
+
A(), (s = u.current) == null || s.abort(), T(!1), te(!1), d([]), W(/* @__PURE__ */ new Set()), de(!1), q(!1);
|
|
1541
1541
|
try {
|
|
1542
1542
|
typeof window < "u" && window.localStorage && window.localStorage.removeItem("chatbot-messages");
|
|
1543
1543
|
} catch {
|
|
@@ -1551,14 +1551,14 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1551
1551
|
}
|
|
1552
1552
|
try {
|
|
1553
1553
|
h(!0), console.log("mql_df data for lead extraction:", l);
|
|
1554
|
-
const
|
|
1554
|
+
const I = {
|
|
1555
1555
|
name: ((s = l.find((F) => F.name)) == null ? void 0 : s.name) || "Chat User",
|
|
1556
1556
|
email: ((C = l.find((F) => F.email)) == null ? void 0 : C.email) || "user@example.com",
|
|
1557
1557
|
summary: `Chat conversation with ${c.length} messages. User asked: "${((v = c.find((F) => F.from === "human")) == null ? void 0 : v.text) || "No user messages"}"`
|
|
1558
1558
|
};
|
|
1559
|
-
console.log("Extracted lead row:",
|
|
1560
|
-
} catch (
|
|
1561
|
-
console.error("Failed to download PDF:",
|
|
1559
|
+
console.log("Extracted lead row:", I), await Je(l, I, we, f), console.log("PDF downloaded successfully");
|
|
1560
|
+
} catch (I) {
|
|
1561
|
+
console.error("Failed to download PDF:", I);
|
|
1562
1562
|
} finally {
|
|
1563
1563
|
h(!1);
|
|
1564
1564
|
}
|
|
@@ -1591,7 +1591,7 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1591
1591
|
) : (
|
|
1592
1592
|
/* Full State - Header with Controls */
|
|
1593
1593
|
/* @__PURE__ */ e.jsxs("div", { className: "sw-ttyw-chat-header", style: y.header, children: [
|
|
1594
|
-
/* @__PURE__ */ e.jsx("div", { className: "sw-ttyw-name", style: y.name, children:
|
|
1594
|
+
/* @__PURE__ */ e.jsx("div", { className: "sw-ttyw-name", style: y.name, children: t }),
|
|
1595
1595
|
/* @__PURE__ */ e.jsxs("div", { style: y.headerActions, children: [
|
|
1596
1596
|
/* @__PURE__ */ e.jsx(
|
|
1597
1597
|
"button",
|
|
@@ -1696,9 +1696,9 @@ function pt({ title: r = "", agentId: n = "", discoveryAgentId: i = "", primaryC
|
|
|
1696
1696
|
msg: s,
|
|
1697
1697
|
isTyping: le.has(C),
|
|
1698
1698
|
onTypingComplete: () => {
|
|
1699
|
-
|
|
1700
|
-
const
|
|
1701
|
-
return
|
|
1699
|
+
W((v) => {
|
|
1700
|
+
const I = new Set(v);
|
|
1701
|
+
return I.delete(C), I;
|
|
1702
1702
|
}), requestAnimationFrame(() => D("auto"));
|
|
1703
1703
|
}
|
|
1704
1704
|
},
|