@ronak27/superwise-chatbot-package 1.0.0

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.
@@ -0,0 +1,1161 @@
1
+ import ae, { memo as se, useState as b, useEffect as I, useRef as ee, useMemo as ie, useCallback as Z } from "react";
2
+ var G = { exports: {} }, L = {};
3
+ var te;
4
+ function le() {
5
+ if (te) return L;
6
+ te = 1;
7
+ var n = /* @__PURE__ */ Symbol.for("react.transitional.element"), i = /* @__PURE__ */ Symbol.for("react.fragment");
8
+ function w(y, s, f) {
9
+ var p = null;
10
+ if (f !== void 0 && (p = "" + f), s.key !== void 0 && (p = "" + s.key), "key" in s) {
11
+ f = {};
12
+ for (var l in s)
13
+ l !== "key" && (f[l] = s[l]);
14
+ } else f = s;
15
+ return s = f.ref, {
16
+ $$typeof: n,
17
+ type: y,
18
+ key: p,
19
+ ref: s !== void 0 ? s : null,
20
+ props: f
21
+ };
22
+ }
23
+ return L.Fragment = i, L.jsx = w, L.jsxs = w, L;
24
+ }
25
+ var z = {};
26
+ var re;
27
+ function ce() {
28
+ return re || (re = 1, process.env.NODE_ENV !== "production" && (function() {
29
+ function n(e) {
30
+ if (e == null) return null;
31
+ if (typeof e == "function")
32
+ return e.$$typeof === X ? null : e.displayName || e.name || null;
33
+ if (typeof e == "string") return e;
34
+ switch (e) {
35
+ case N:
36
+ return "Fragment";
37
+ case W:
38
+ return "Profiler";
39
+ case C:
40
+ return "StrictMode";
41
+ case M:
42
+ return "Suspense";
43
+ case R:
44
+ return "SuspenseList";
45
+ case K:
46
+ return "Activity";
47
+ }
48
+ if (typeof e == "object")
49
+ switch (typeof e.tag == "number" && console.error(
50
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
51
+ ), e.$$typeof) {
52
+ case $:
53
+ return "Portal";
54
+ case Q:
55
+ return e.displayName || "Context";
56
+ case q:
57
+ return (e._context.displayName || "Context") + ".Consumer";
58
+ case H:
59
+ var r = e.render;
60
+ return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
61
+ case J:
62
+ return r = e.displayName || null, r !== null ? r : n(e.type) || "Memo";
63
+ case O:
64
+ r = e._payload, e = e._init;
65
+ try {
66
+ return n(e(r));
67
+ } catch {
68
+ }
69
+ }
70
+ return null;
71
+ }
72
+ function i(e) {
73
+ return "" + e;
74
+ }
75
+ function w(e) {
76
+ try {
77
+ i(e);
78
+ var r = !1;
79
+ } catch {
80
+ r = !0;
81
+ }
82
+ if (r) {
83
+ r = console;
84
+ var d = r.error, h = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
85
+ return d.call(
86
+ r,
87
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
+ h
89
+ ), i(e);
90
+ }
91
+ }
92
+ function y(e) {
93
+ if (e === N) return "<>";
94
+ if (typeof e == "object" && e !== null && e.$$typeof === O)
95
+ return "<...>";
96
+ try {
97
+ var r = n(e);
98
+ return r ? "<" + r + ">" : "<...>";
99
+ } catch {
100
+ return "<...>";
101
+ }
102
+ }
103
+ function s() {
104
+ var e = P.A;
105
+ return e === null ? null : e.getOwner();
106
+ }
107
+ function f() {
108
+ return Error("react-stack-top-frame");
109
+ }
110
+ function p(e) {
111
+ if (F.call(e, "key")) {
112
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
113
+ if (r && r.isReactWarning) return !1;
114
+ }
115
+ return e.key !== void 0;
116
+ }
117
+ function l(e, r) {
118
+ function d() {
119
+ B || (B = !0, console.error(
120
+ "%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)",
121
+ r
122
+ ));
123
+ }
124
+ d.isReactWarning = !0, Object.defineProperty(e, "key", {
125
+ get: d,
126
+ configurable: !0
127
+ });
128
+ }
129
+ function c() {
130
+ var e = n(this.type);
131
+ return D[e] || (D[e] = !0, console.error(
132
+ "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."
133
+ )), e = this.props.ref, e !== void 0 ? e : null;
134
+ }
135
+ function m(e, r, d, h, k, A) {
136
+ var g = d.ref;
137
+ return e = {
138
+ $$typeof: j,
139
+ type: e,
140
+ key: r,
141
+ props: d,
142
+ _owner: h
143
+ }, (g !== void 0 ? g : null) !== null ? Object.defineProperty(e, "ref", {
144
+ enumerable: !1,
145
+ get: c
146
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
147
+ configurable: !1,
148
+ enumerable: !1,
149
+ writable: !0,
150
+ value: 0
151
+ }), Object.defineProperty(e, "_debugInfo", {
152
+ configurable: !1,
153
+ enumerable: !1,
154
+ writable: !0,
155
+ value: null
156
+ }), Object.defineProperty(e, "_debugStack", {
157
+ configurable: !1,
158
+ enumerable: !1,
159
+ writable: !0,
160
+ value: k
161
+ }), Object.defineProperty(e, "_debugTask", {
162
+ configurable: !1,
163
+ enumerable: !1,
164
+ writable: !0,
165
+ value: A
166
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
167
+ }
168
+ function u(e, r, d, h, k, A) {
169
+ var g = r.children;
170
+ if (g !== void 0)
171
+ if (h)
172
+ if (Y(g)) {
173
+ for (h = 0; h < g.length; h++)
174
+ x(g[h]);
175
+ Object.freeze && Object.freeze(g);
176
+ } else
177
+ console.error(
178
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
179
+ );
180
+ else x(g);
181
+ if (F.call(r, "key")) {
182
+ g = n(e);
183
+ var v = Object.keys(r).filter(function(ne) {
184
+ return ne !== "key";
185
+ });
186
+ h = 0 < v.length ? "{key: someKey, " + v.join(": ..., ") + ": ...}" : "{key: someKey}", o[g + h] || (v = 0 < v.length ? "{" + v.join(": ..., ") + ": ...}" : "{}", console.error(
187
+ `A props object containing a "key" prop is being spread into JSX:
188
+ let props = %s;
189
+ <%s {...props} />
190
+ React keys must be passed directly to JSX without using spread:
191
+ let props = %s;
192
+ <%s key={someKey} {...props} />`,
193
+ h,
194
+ g,
195
+ v,
196
+ g
197
+ ), o[g + h] = !0);
198
+ }
199
+ if (g = null, d !== void 0 && (w(d), g = "" + d), p(r) && (w(r.key), g = "" + r.key), "key" in r) {
200
+ d = {};
201
+ for (var T in r)
202
+ T !== "key" && (d[T] = r[T]);
203
+ } else d = r;
204
+ return g && l(
205
+ d,
206
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
207
+ ), m(
208
+ e,
209
+ g,
210
+ d,
211
+ s(),
212
+ k,
213
+ A
214
+ );
215
+ }
216
+ function x(e) {
217
+ E(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === O && (e._payload.status === "fulfilled" ? E(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
218
+ }
219
+ function E(e) {
220
+ return typeof e == "object" && e !== null && e.$$typeof === j;
221
+ }
222
+ var S = ae, j = /* @__PURE__ */ Symbol.for("react.transitional.element"), $ = /* @__PURE__ */ Symbol.for("react.portal"), N = /* @__PURE__ */ Symbol.for("react.fragment"), C = /* @__PURE__ */ Symbol.for("react.strict_mode"), W = /* @__PURE__ */ Symbol.for("react.profiler"), q = /* @__PURE__ */ Symbol.for("react.consumer"), Q = /* @__PURE__ */ Symbol.for("react.context"), H = /* @__PURE__ */ Symbol.for("react.forward_ref"), M = /* @__PURE__ */ Symbol.for("react.suspense"), R = /* @__PURE__ */ Symbol.for("react.suspense_list"), J = /* @__PURE__ */ Symbol.for("react.memo"), O = /* @__PURE__ */ Symbol.for("react.lazy"), K = /* @__PURE__ */ Symbol.for("react.activity"), X = /* @__PURE__ */ Symbol.for("react.client.reference"), P = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, F = Object.prototype.hasOwnProperty, Y = Array.isArray, _ = console.createTask ? console.createTask : function() {
223
+ return null;
224
+ };
225
+ S = {
226
+ react_stack_bottom_frame: function(e) {
227
+ return e();
228
+ }
229
+ };
230
+ var B, D = {}, V = S.react_stack_bottom_frame.bind(
231
+ S,
232
+ f
233
+ )(), U = _(y(f)), o = {};
234
+ z.Fragment = N, z.jsx = function(e, r, d) {
235
+ var h = 1e4 > P.recentlyCreatedOwnerStacks++;
236
+ return u(
237
+ e,
238
+ r,
239
+ d,
240
+ !1,
241
+ h ? Error("react-stack-top-frame") : V,
242
+ h ? _(y(e)) : U
243
+ );
244
+ }, z.jsxs = function(e, r, d) {
245
+ var h = 1e4 > P.recentlyCreatedOwnerStacks++;
246
+ return u(
247
+ e,
248
+ r,
249
+ d,
250
+ !0,
251
+ h ? Error("react-stack-top-frame") : V,
252
+ h ? _(y(e)) : U
253
+ );
254
+ };
255
+ })()), z;
256
+ }
257
+ var oe;
258
+ function de() {
259
+ return oe || (oe = 1, process.env.NODE_ENV === "production" ? G.exports = le() : G.exports = ce()), G.exports;
260
+ }
261
+ var t = de();
262
+ async function pe(n, i = [], w = [], y = "", s = "") {
263
+ const f = "https://sage-api-ttyw-stage.superwise.ai/api/v1/chat";
264
+ console.log("src/api.js: sendMessageToAI called with discoveryAgentId:", s), console.log("src/api.js: agentId:", y);
265
+ const p = Array.isArray(i) ? i.map((c) => ({
266
+ role: c.role,
267
+ message: c.content != null ? c.content : ""
268
+ })) : [], l = {
269
+ user_input: n,
270
+ chat_history: p,
271
+ mql_df: Array.isArray(w) ? w : [],
272
+ agent_id: y,
273
+ discovery_agent_id: s
274
+ };
275
+ console.log("Sending payload:", l);
276
+ try {
277
+ const c = await fetch(f, {
278
+ method: "POST",
279
+ headers: {
280
+ "Content-Type": "application/json",
281
+ Accept: "application/json"
282
+ },
283
+ body: JSON.stringify(l)
284
+ });
285
+ if (console.log("Response status:", c.status), console.log("Response headers:", c.headers), !c.ok) {
286
+ const E = await c.text();
287
+ return console.error("API Error Response:", E), { reply: `❌ API Error ${c.status}: ${E}`, mqlDf: [] };
288
+ }
289
+ const m = await c.json();
290
+ console.log("API Response Data:", m);
291
+ let u = "⚠️ No reply from server.", x = [];
292
+ return m.chat_response ? u = m.chat_response : m.success && m.data?.chat_response ? u = m.data.chat_response : m.message && (u = m.message), m.mql_df ? x = m.mql_df : m.data?.mql_df && (x = m.data.mql_df), u.includes("Parameters:") && (u = u.split("Parameters:")[0].trim()), { reply: u, mqlDf: x };
293
+ } catch (c) {
294
+ return console.error("API call failed:", c), c.name === "TypeError" && c.message.includes("fetch") ? { reply: "⚠️ Network error. Please check your connection.", mqlDf: [] } : { reply: `⚠️ API request failed: ${c.message}`, mqlDf: [] };
295
+ }
296
+ }
297
+ async function me(n, i = null, w = []) {
298
+ const y = "https://sage-api-ttyw-stage.superwise.ai/pdf", s = Array.isArray(n) && n.length > 0 ? n[0] : i || {
299
+ name: "User",
300
+ email: "user@example.com",
301
+ summary: "Chat conversation summary"
302
+ }, f = Array.isArray(w) ? w.map((l) => ({
303
+ role: l.role,
304
+ message: l.content != null ? l.content : ""
305
+ })) : [], p = {
306
+ lead_row: s,
307
+ chat_history: f
308
+ };
309
+ console.log("Downloading PDF with payload:", p);
310
+ try {
311
+ const l = await fetch(y, {
312
+ method: "POST",
313
+ headers: {
314
+ "Content-Type": "application/json",
315
+ Accept: "application/pdf"
316
+ },
317
+ body: JSON.stringify(p)
318
+ });
319
+ if (console.log("PDF Response status:", l.status), !l.ok) {
320
+ const x = await l.text();
321
+ throw console.error("PDF API Error Response:", x), new Error(`PDF API Error ${l.status}: ${x}`);
322
+ }
323
+ const c = await l.blob(), m = window.URL.createObjectURL(c), u = document.createElement("a");
324
+ return u.href = m, u.download = `chatbot-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.pdf`, document.body.appendChild(u), u.click(), document.body.removeChild(u), window.URL.revokeObjectURL(m), !0;
325
+ } catch (l) {
326
+ throw console.error("PDF download failed:", l), l;
327
+ }
328
+ }
329
+ const a = {
330
+ container: {
331
+ position: "fixed",
332
+ bottom: "0px",
333
+ right: "20px",
334
+ zIndex: 999999,
335
+ fontFamily: "'Inter', sans-serif",
336
+ maxWidth: "400px",
337
+ width: "80vw",
338
+ maxHeight: "75vh",
339
+ height: "75vh",
340
+ display: "flex",
341
+ flexDirection: "column",
342
+ borderRadius: "1rem",
343
+ background: "white",
344
+ boxShadow: "0 0 8rem 0 rgba(0, 0, 0, 0.1), 0rem 2rem 4rem -3rem rgba(0, 0, 0, 0.5)",
345
+ boxSizing: "border-box"
346
+ },
347
+ containerMinimized: {
348
+ position: "fixed",
349
+ bottom: "20px",
350
+ right: "20px",
351
+ zIndex: 999999,
352
+ fontFamily: "'Inter', sans-serif",
353
+ width: "auto",
354
+ minWidth: "250px",
355
+ maxWidth: "350px",
356
+ height: "auto",
357
+ display: "flex",
358
+ flexDirection: "row",
359
+ borderRadius: "25px",
360
+ background: "#000000",
361
+ boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
362
+ boxSizing: "border-box",
363
+ padding: "12px 16px",
364
+ alignItems: "center",
365
+ cursor: "pointer"
366
+ },
367
+ header: {
368
+ position: "relative",
369
+ display: "flex",
370
+ alignItems: "center",
371
+ justifyContent: "space-between",
372
+ padding: "10px",
373
+ background: "var(--swttyw-primary-color)",
374
+ color: "#fff",
375
+ borderRadius: "10px 10px 0 0",
376
+ fontFamily: "'Inter', sans-serif",
377
+ flexShrink: 0,
378
+ boxSizing: "border-box"
379
+ },
380
+ name: {
381
+ fontWeight: 500,
382
+ fontSize: "var(--swttyw-header-font-size)",
383
+ color: "#fff",
384
+ flexGrow: 1,
385
+ marginBottom: "0.125rem",
386
+ wordBreak: "break-all"
387
+ },
388
+ headerActions: {
389
+ display: "flex",
390
+ alignItems: "center",
391
+ gap: "8px"
392
+ },
393
+ headerButton: {
394
+ background: "transparent",
395
+ border: "none",
396
+ color: "#fff",
397
+ cursor: "pointer",
398
+ padding: "4px",
399
+ borderRadius: "4px",
400
+ display: "flex",
401
+ alignItems: "center",
402
+ justifyContent: "center",
403
+ width: "24px",
404
+ height: "24px",
405
+ textDecoration: "none",
406
+ transition: "opacity 0.3s ease"
407
+ },
408
+ chatSection: {
409
+ padding: "1rem",
410
+ backgroundColor: "var(--swttyw-background-color)",
411
+ flexGrow: 1,
412
+ overflowY: "auto",
413
+ display: "flex",
414
+ flexDirection: "column",
415
+ boxShadow: "inset 0 2rem 2rem -2rem rgba(0, 0, 0, 0.05), inset 0 -2rem 2rem -2rem rgba(0, 0, 0, 0.05)",
416
+ height: "calc(50vh - 200px)"
417
+ },
418
+ inputSection: {
419
+ boxSizing: "border-box",
420
+ flexBasis: "4rem",
421
+ flexShrink: 0,
422
+ display: "flex",
423
+ alignItems: "center",
424
+ boxShadow: "0 0 1rem rgba(0, 0, 0, 0.1), 0rem 1rem 1rem -1rem rgba(0, 0, 0, 0.2)",
425
+ margin: "0.50rem"
426
+ },
427
+ textarea: {
428
+ border: "none",
429
+ backgroundImage: "none",
430
+ backgroundColor: "white",
431
+ padding: "0.5rem 1rem",
432
+ marginRight: "1rem",
433
+ borderRadius: "10px",
434
+ flexGrow: 2,
435
+ fontFamily: "'Inter', sans-serif",
436
+ fontWeight: 400,
437
+ letterSpacing: "0.025em",
438
+ resize: "none",
439
+ fontSize: "16px",
440
+ outline: "none"
441
+ },
442
+ inputFooter: {
443
+ display: "flex",
444
+ flexDirection: "column",
445
+ justifyContent: "space-between",
446
+ padding: "5px"
447
+ },
448
+ sendButton: {
449
+ background: "transparent",
450
+ border: "0px",
451
+ cursor: "pointer",
452
+ display: "flex",
453
+ alignItems: "center",
454
+ justifyContent: "center",
455
+ color: "#000000"
456
+ },
457
+ characterCount: {
458
+ fontSize: "12px",
459
+ color: "var(--swttyw-primary-color)",
460
+ textAlign: "center"
461
+ },
462
+ modalOverlay: {
463
+ position: "absolute",
464
+ background: "#ffffffe8",
465
+ height: "calc(100% - 85px)",
466
+ width: "100%",
467
+ top: "48px",
468
+ display: "flex",
469
+ justifyContent: "center",
470
+ alignItems: "center"
471
+ },
472
+ modalBody: {
473
+ textAlign: "center"
474
+ },
475
+ modalActions: {
476
+ display: "flex",
477
+ justifyContent: "center"
478
+ },
479
+ footer: {
480
+ flexShrink: 0,
481
+ display: "flex",
482
+ alignItems: "center",
483
+ justifyContent: "center",
484
+ background: "var(--swttyw-primary-color)",
485
+ borderRadius: "0 0 10px 10px",
486
+ paddingBottom: "6px",
487
+ paddingTop: "6px",
488
+ marginTop: "0px",
489
+ color: "#f8f9fa",
490
+ fontSize: "var(--swttyw-footer-font-size)",
491
+ borderTop: "3px solid var(--swttyw-primary-color)",
492
+ padding: "15px 0px",
493
+ fontFamily: "'Inter', sans-serif"
494
+ },
495
+ message: {
496
+ boxSizing: "border-box",
497
+ padding: "0.5rem 1rem",
498
+ margin: "1rem",
499
+ background: "#FFF",
500
+ borderRadius: "1.125rem 1.125rem 1.125rem 0",
501
+ minHeight: "2.25rem",
502
+ width: "fit-content",
503
+ boxShadow: "0 0 2rem rgba(0, 0, 0, 0.075), 0rem 1rem 1rem -1rem rgba(0, 0, 0, 0.1)",
504
+ fontSize: "15px",
505
+ wordBreak: "break-word",
506
+ fontFamily: "'Inter', sans-serif",
507
+ display: "table",
508
+ alignItems: "flex-start",
509
+ gap: "8px",
510
+ position: "relative"
511
+ },
512
+ messageSelf: {
513
+ margin: "1rem 1rem 1rem auto",
514
+ borderRadius: "1.125rem 1.125rem 0 1.125rem",
515
+ background: "#000000",
516
+ color: "white",
517
+ position: "relative",
518
+ maxWidth: "80%",
519
+ fontSize: "var(--swttyw-body-font-size)",
520
+ flexDirection: "row-reverse"
521
+ },
522
+ messageOther: {
523
+ position: "relative",
524
+ fontSize: "var(--swttyw-body-font-size)"
525
+ },
526
+ messageAvatar: {
527
+ width: "24px",
528
+ height: "24px",
529
+ borderRadius: "50%",
530
+ flexShrink: 0,
531
+ display: "flex",
532
+ alignItems: "center",
533
+ justifyContent: "center",
534
+ fontSize: "12px",
535
+ fontWeight: "bold",
536
+ position: "absolute",
537
+ top: "5px"
538
+ },
539
+ messageContent: {
540
+ flex: 1,
541
+ marginLeft: "32px",
542
+ marginRight: "8px"
543
+ },
544
+ minimizedContent: {
545
+ display: "flex",
546
+ alignItems: "center",
547
+ gap: "12px",
548
+ color: "white",
549
+ flex: 1
550
+ },
551
+ chatIcon: {
552
+ width: "20px",
553
+ height: "20px",
554
+ flexShrink: 0
555
+ },
556
+ minimizedTitle: {
557
+ color: "white",
558
+ fontSize: "16px",
559
+ fontWeight: "500",
560
+ margin: 0
561
+ }
562
+ };
563
+ function ue(n) {
564
+ return n === "human" ? { ...a.message, ...a.messageSelf } : { ...a.message, ...a.messageOther };
565
+ }
566
+ const fe = se(function({ text: i, speed: w = 10, onComplete: y }) {
567
+ const [s, f] = b(""), [p, l] = b(!1);
568
+ I(() => {
569
+ if (!i) return;
570
+ f(""), l(!1);
571
+ let m = 0;
572
+ const u = setInterval(() => {
573
+ m < i.length ? (f(i.slice(0, m + 1)), m++) : (l(!0), clearInterval(u), y && y());
574
+ }, w);
575
+ return () => clearInterval(u);
576
+ }, [i, w, y]);
577
+ const c = (m) => m.replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>").replace(/\*(.*?)\*/g, "<em>$1</em>").replace(/\n/g, "<br/>").replace(/(\d+\.\s)/g, "<br/>$1").replace(/(\*\s)/g, "<br/>$1");
578
+ return /* @__PURE__ */ t.jsx(
579
+ "div",
580
+ {
581
+ style: {
582
+ whiteSpace: "pre-wrap",
583
+ lineHeight: "1.5",
584
+ wordBreak: "break-word"
585
+ },
586
+ dangerouslySetInnerHTML: {
587
+ __html: c(s) + (p ? "" : '<span class="typing-cursor">|</span>')
588
+ }
589
+ }
590
+ );
591
+ }), ge = se(function({ msg: i, isTyping: w = !1, onTypingComplete: y }) {
592
+ const s = i.from === "human" ? "sw-ttyw-message self" : "sw-ttyw-message other";
593
+ return /* @__PURE__ */ t.jsxs("div", { className: s, style: ue(i.from), children: [
594
+ /* @__PURE__ */ t.jsx("div", { className: "message-avatar", style: a.messageAvatar, children: i.from === "human" ? /* @__PURE__ */ t.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "black", xmlns: "http://www.w3.org/2000/svg", children: [
595
+ /* @__PURE__ */ t.jsx("path", { d: "M20 21V19C20 17.9391 19.5786 16.9217 18.8284 16.1716C18.0783 15.4214 17.0609 15 16 15H8C6.93913 15 5.92172 15.4214 5.17157 16.1716C4.42143 16.9217 4 17.9391 4 19V21", fill: "black" }),
596
+ /* @__PURE__ */ t.jsx("circle", { cx: "12", cy: "7", r: "4", fill: "black" })
597
+ ] }) : /* @__PURE__ */ t.jsx(
598
+ "img",
599
+ {
600
+ src: "https://superwise.ai/wp-content/uploads/2025/07/cropped-Superwise-icon-1-32x32.png",
601
+ alt: "AI Avatar",
602
+ style: {
603
+ width: "20px",
604
+ height: "20px",
605
+ borderRadius: "50%",
606
+ objectFit: "cover"
607
+ }
608
+ }
609
+ ) }),
610
+ /* @__PURE__ */ t.jsx("div", { className: "message-content", style: a.messageContent, children: i.from === "ai" && w ? /* @__PURE__ */ t.jsx(fe, { text: i.text, speed: 20, onComplete: y }) : /* @__PURE__ */ t.jsx(
611
+ "div",
612
+ {
613
+ style: {
614
+ whiteSpace: "pre-wrap",
615
+ lineHeight: "1.5",
616
+ wordBreak: "break-word"
617
+ },
618
+ dangerouslySetInnerHTML: {
619
+ __html: i.text.replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>").replace(/\*(.*?)\*/g, "<em>$1</em>").replace(/\n/g, "<br/>").replace(/(\d+\.\s)/g, "<br/>$1").replace(/(\*\s)/g, "<br/>$1")
620
+ // Bullet points
621
+ }
622
+ }
623
+ ) })
624
+ ] });
625
+ }), we = () => {
626
+ const n = (/* @__PURE__ */ new Date()).getHours();
627
+ return n >= 5 && n < 12 ? "Good morning" : n >= 12 && n < 17 ? "Good afternoon" : (n >= 17 && n < 21, "Good evening");
628
+ }, he = () => {
629
+ const n = we(), i = [
630
+ `👋 ${n}! Looking to explore Superwise?`,
631
+ `👋 ${n}! Ready to discover what Superwise can do for you?`,
632
+ `👋 ${n}! How can I help you with Superwise today?`,
633
+ `👋 ${n}! What brings you to Superwise?`,
634
+ `👋 ${n}! Let's explore Superwise together!`
635
+ ];
636
+ return i[Math.floor(Math.random() * i.length)];
637
+ };
638
+ function xe({ title: n = "Superwise Expert Agent", agentId: i = "", discoveryAgentId: w = "", primaryColor: y = "" }) {
639
+ console.log("chatbot.jsx: Chatbot component mounted with props:", { agentId: i, discoveryAgentId: w, title: n });
640
+ const [s, f] = b(() => {
641
+ try {
642
+ if (typeof window < "u" && window.localStorage) {
643
+ const o = window.localStorage.getItem("chatbot-messages");
644
+ return o ? JSON.parse(o) : [];
645
+ }
646
+ } catch {
647
+ }
648
+ return [];
649
+ }), [p, l] = b(() => {
650
+ try {
651
+ if (typeof window < "u" && window.localStorage) {
652
+ const o = window.localStorage.getItem("chatbot-mql_df");
653
+ return o ? JSON.parse(o) : [];
654
+ }
655
+ } catch {
656
+ }
657
+ return [];
658
+ }), [c, m] = b(""), [u, x] = b(!1), [E, S] = b(!1), [j, $] = b(!1), [N, C] = b(/* @__PURE__ */ new Set()), [W, q] = b(!1), [Q, H] = b(""), [M, R] = b(""), [J, O] = b(!1), X = (() => {
659
+ if (y) return y;
660
+ if (typeof document < "u" && typeof window < "u") {
661
+ const o = document.querySelector("[data-chatbot-color]");
662
+ if (o)
663
+ return o.getAttribute("data-chatbot-color") || "#000";
664
+ const r = getComputedStyle(document.documentElement).getPropertyValue("--swttyw-primary-color").trim();
665
+ if (r) return r;
666
+ }
667
+ return "#000";
668
+ })(), P = ee(null), F = ee(s), Y = ie(() => s.map((o) => ({ role: o.from, content: o.text })), [s]), _ = (o) => {
669
+ R(o), setTimeout(() => {
670
+ R("");
671
+ }, 4e3);
672
+ }, B = (o) => {
673
+ const e = o.length, r = o.trim();
674
+ return H(""), R(""), !r || e === 0 ? (_("Please enter a message before sending."), !1) : new RegExp(/(<([^>]+)>)/gi).test(r) ? (_("Please avoid using HTML tags or scripts in your message."), !1) : r.length < 2 ? (_("Please enter a meaningful question (at least 2 characters)."), !1) : r.length > 1e3 ? (_("Message is too long. Please keep it under 1000 characters."), !1) : (H(""), R(""), !0);
675
+ };
676
+ I(() => {
677
+ P.current?.scrollIntoView({ behavior: "smooth" });
678
+ }, [s, u]), I(() => {
679
+ try {
680
+ typeof window < "u" && window.localStorage && window.localStorage.setItem("chatbot-messages", JSON.stringify(s));
681
+ } catch {
682
+ }
683
+ }, [s]), I(() => {
684
+ try {
685
+ typeof window < "u" && window.localStorage && window.localStorage.setItem("chatbot-mql_df", JSON.stringify(p));
686
+ } catch {
687
+ }
688
+ }, [p]), I(() => {
689
+ O(!0);
690
+ }, []), I(() => {
691
+ F.current = s;
692
+ }, [s]), I(() => {
693
+ if (s.length === 0 && !W) {
694
+ const e = { from: "ai", text: he() };
695
+ f([e]), q(!0), C(/* @__PURE__ */ new Set([0]));
696
+ }
697
+ }, [s.length, W]);
698
+ const D = Z(async () => {
699
+ const o = c.trim();
700
+ if (!o || !B(c))
701
+ return;
702
+ const e = { from: "human", text: o }, d = [...F.current, e];
703
+ f(d), m(""), x(!0);
704
+ const h = [...Y, { role: "human", content: o }];
705
+ console.log("chatbot.jsx: discoveryAgentId:", w), console.log("chatbot.jsx: agentId:", i);
706
+ const k = await pe(o, h, p, i, w);
707
+ if (typeof k == "string") {
708
+ const A = { from: "ai", text: k };
709
+ f((g) => {
710
+ const v = [...g, A];
711
+ return C((T) => /* @__PURE__ */ new Set([...T, v.length - 1])), v;
712
+ });
713
+ } else {
714
+ const A = { from: "ai", text: k.reply };
715
+ f((g) => {
716
+ const v = [...g, A];
717
+ return C((T) => /* @__PURE__ */ new Set([...T, v.length - 1])), v;
718
+ }), k.mqlDf && Array.isArray(k.mqlDf) && l(k.mqlDf);
719
+ }
720
+ x(!1);
721
+ }, [c, i, w, p]), V = Z(() => {
722
+ f([]), l([]), C(/* @__PURE__ */ new Set()), q(!1);
723
+ try {
724
+ typeof window < "u" && window.localStorage && (window.localStorage.removeItem("chatbot-messages"), window.localStorage.removeItem("chatbot-mql_df"));
725
+ } catch {
726
+ }
727
+ S(!1);
728
+ }, []), U = Z(async () => {
729
+ if (!p || p.length === 0) {
730
+ console.warn("No mql_df data available for PDF download");
731
+ return;
732
+ }
733
+ try {
734
+ x(!0), console.log("mql_df data for lead extraction:", p);
735
+ const o = {
736
+ name: p.find((e) => e.name)?.name || "Chat User",
737
+ email: p.find((e) => e.email)?.email || "user@example.com",
738
+ summary: `Chat conversation with ${s.length} messages. User asked: "${s.find((e) => e.from === "human")?.text || "No user messages"}"`
739
+ };
740
+ console.log("Extracted lead row:", o), await me(p, o, Y), console.log("PDF downloaded successfully");
741
+ } catch (o) {
742
+ console.error("Failed to download PDF:", o);
743
+ } finally {
744
+ x(!1);
745
+ }
746
+ }, [p, s]);
747
+ return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
748
+ J && /* @__PURE__ */ t.jsx("style", { children: `
749
+ :root {
750
+ --swttyw-primary-color: ${X};
751
+ --swttyw-avatar-image: url('');
752
+ --swttyw-user-avatar-image: url('');
753
+ --swttyw-background-color: #F7F7F7;
754
+ --swttyw-header-font-size: 16px;
755
+ --swttyw-body-font-size: 15px;
756
+ --swttyw-footer-font-size: 16px;
757
+ --swttyw-user-background-image: url('');
758
+ }
759
+
760
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');
761
+
762
+ .sw-ttyw-chatbot ::-webkit-scrollbar {
763
+ width: 3px;
764
+ }
765
+
766
+ .sw-ttyw-chatbot ::-webkit-scrollbar-track {
767
+ background: transparent;
768
+ }
769
+
770
+ .sw-ttyw-chatbot ::-webkit-scrollbar-thumb {
771
+ background: var(--swttyw-primary-color);
772
+ }
773
+
774
+ .sw-ttyw-chatbot ::-webkit-scrollbar-thumb:hover {
775
+ background: var(--swttyw-primary-color);
776
+ }
777
+
778
+ .typing {
779
+ display: inline-block !important;
780
+ width: 0.8rem !important;
781
+ height: 0.8rem !important;
782
+ min-width: 0.8rem !important;
783
+ min-height: 0.8rem !important;
784
+ max-width: 0.8rem !important;
785
+ max-height: 0.8rem !important;
786
+ margin-right: 0.5rem !important;
787
+ box-sizing: border-box !important;
788
+ background: #ccc !important;
789
+ border-radius: 50% !important;
790
+ }
791
+
792
+ .typing.typing-1 {
793
+ -webkit-animation: typingAlt 1.4s infinite !important;
794
+ animation: typingAlt 1.4s infinite !important;
795
+ }
796
+
797
+ .typing.typing-2 {
798
+ -webkit-animation: typingAlt 1.4s 0.2s infinite !important;
799
+ animation: typingAlt 1.4s 0.2s infinite !important;
800
+ }
801
+
802
+ .typing.typing-3 {
803
+ -webkit-animation: typingAlt 1.4s 0.4s infinite !important;
804
+ animation: typingAlt 1.4s 0.4s infinite !important;
805
+ }
806
+
807
+ .typing-cursor {
808
+ animation: blink 1s infinite;
809
+ color: var(--swttyw-primary-color);
810
+ font-weight: bold;
811
+ }
812
+
813
+ @keyframes blink {
814
+ 0%, 50% { opacity: 1; }
815
+ 51%, 100% { opacity: 0; }
816
+ }
817
+
818
+ /* Error message styling */
819
+ .swttyw-input-error {
820
+ background-color: #FEE8E8;
821
+ border: 1px solid #FDC2C2;
822
+ border-radius: 8px;
823
+ padding: 12px 16px;
824
+ margin: 8px 0;
825
+ display: flex;
826
+ align-items: center;
827
+ gap: 8px;
828
+ color: #E04F4F;
829
+ font-size: 14px;
830
+ line-height: 1.4;
831
+ }
832
+
833
+ .swttyw-input-error .error-icon {
834
+ color: #F59E0B;
835
+ font-size: 16px;
836
+ flex-shrink: 0;
837
+ }
838
+
839
+ /* Validation message in messages area */
840
+ .sw-ttyw-validation-message {
841
+ background-color: #FEE8E8;
842
+ border: 1px solid #FDC2C2;
843
+ border-radius: 8px;
844
+ padding: 12px 16px;
845
+ margin: 8px 16px;
846
+ display: flex;
847
+ align-items: center;
848
+ gap: 8px;
849
+ color: #E04F4F;
850
+ font-size: 14px;
851
+ line-height: 1.4;
852
+ animation: slideIn 0.3s ease-out;
853
+ }
854
+
855
+ .sw-ttyw-validation-message .error-icon {
856
+ color: #F59E0B;
857
+ font-size: 16px;
858
+ flex-shrink: 0;
859
+ }
860
+
861
+ @keyframes slideIn {
862
+ from {
863
+ opacity: 0;
864
+ transform: translateY(-10px);
865
+ }
866
+ to {
867
+ opacity: 1;
868
+ transform: translateY(0);
869
+ }
870
+ }
871
+
872
+ @-webkit-keyframes typingAlt {
873
+ 0%, 60%, 100% {
874
+ transform: translateY(0) scale(1);
875
+ opacity: 0.4;
876
+ }
877
+ 30% {
878
+ transform: translateY(-10px) scale(1.2);
879
+ opacity: 1;
880
+ }
881
+ }
882
+
883
+ @keyframes typingAlt {
884
+ 0%, 60%, 100% {
885
+ transform: translateY(0) scale(1);
886
+ opacity: 0.4;
887
+ }
888
+ 30% {
889
+ transform: translateY(-10px) scale(1.2);
890
+ opacity: 1;
891
+ }
892
+ }
893
+
894
+ /* Ensure user messages have black background */
895
+ .sw-ttyw-message.self {
896
+ background: #000000 !important;
897
+ color: white !important;
898
+ margin: 1rem 1rem 1rem auto !important;
899
+ border-radius: 1.125rem 1.125rem 0 1.125rem !important;
900
+ max-width: 80% !important;
901
+ display: table;
902
+ }
903
+
904
+ /* Avatar positioning for user messages */
905
+ .sw-ttyw-message.self .message-avatar {
906
+ right: -28px !important;
907
+ left: auto !important;
908
+ }
909
+
910
+ /* Avatar positioning for AI messages */
911
+ .sw-ttyw-message.other .message-avatar {
912
+ left: -28px !important;
913
+ right: auto !important;
914
+ display: table;
915
+ }
916
+
917
+ /* Ensure proper spacing for message content */
918
+ .sw-ttyw-message .message-content {
919
+ margin-left: 0 !important;
920
+ margin-right: 0 !important;
921
+ padding-left: 0 !important;
922
+ padding-right: 0 !important;
923
+ }
924
+
925
+ /* Empty state styling */
926
+ .sw-ttyw-empty-state {
927
+ background-color: var(--swttyw-background-color) !important;
928
+ transition: opacity 0.3s ease-in-out !important;
929
+ }
930
+
931
+ .sw-ttyw-empty-state:hover {
932
+ opacity: 0.5 !important;
933
+ }
934
+
935
+ /* Ensure empty state doesn't interfere with scrolling */
936
+ .sw-ttyw-messages:has(.sw-ttyw-empty-state) {
937
+ overflow: hidden !important;
938
+ }
939
+ ` }),
940
+ /* @__PURE__ */ t.jsxs(
941
+ "div",
942
+ {
943
+ className: "sw-ttyw-chatbot",
944
+ style: j ? a.containerMinimized : a.container,
945
+ onClick: j ? () => $(!1) : void 0,
946
+ children: [
947
+ j ? (
948
+ /* Minimized State - Horizontal Button */
949
+ /* @__PURE__ */ t.jsxs("div", { style: a.minimizedContent, children: [
950
+ /* @__PURE__ */ t.jsxs("svg", { style: a.chatIcon, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
951
+ /* @__PURE__ */ t.jsx("path", { d: "M21 15C21 15.5304 20.7893 16.0391 20.4142 16.4142C20.0391 16.7893 19.5304 17 19 17H7L3 21V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H19C19.5304 3 20.0391 3.21071 20.4142 3.58579C20.7893 3.96086 21 4.46957 21 5V15Z", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
952
+ /* @__PURE__ */ t.jsx("path", { d: "M8 9H16", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
953
+ /* @__PURE__ */ t.jsx("path", { d: "M8 13H12", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
954
+ ] }),
955
+ /* @__PURE__ */ t.jsx("div", { style: a.minimizedTitle, children: n })
956
+ ] })
957
+ ) : (
958
+ /* Full State - Header with Controls */
959
+ /* @__PURE__ */ t.jsxs("div", { className: "sw-ttyw-chat-header", style: a.header, children: [
960
+ /* @__PURE__ */ t.jsx("div", { className: "sw-ttyw-name", style: a.name, children: n }),
961
+ /* @__PURE__ */ t.jsxs("div", { style: a.headerActions, children: [
962
+ /* @__PURE__ */ t.jsx(
963
+ "button",
964
+ {
965
+ onClick: () => $(!j),
966
+ style: a.headerButton,
967
+ title: j ? "Maximize chat" : "Minimize chat",
968
+ children: /* @__PURE__ */ t.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t.jsx("path", { d: "M6 9H18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) })
969
+ }
970
+ ),
971
+ p && p.length > 0 && /* @__PURE__ */ t.jsx(
972
+ "button",
973
+ {
974
+ onClick: U,
975
+ style: a.headerButton,
976
+ title: "Download PDF Report",
977
+ disabled: u,
978
+ children: /* @__PURE__ */ t.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
979
+ /* @__PURE__ */ t.jsx("path", { d: "M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
980
+ /* @__PURE__ */ t.jsx("path", { d: "M7 10L12 15L17 10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
981
+ /* @__PURE__ */ t.jsx("path", { d: "M12 15V3", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
982
+ ] })
983
+ }
984
+ ),
985
+ /* @__PURE__ */ t.jsx(
986
+ "button",
987
+ {
988
+ onClick: () => S(!0),
989
+ style: a.headerButton,
990
+ title: "Clear chat",
991
+ children: /* @__PURE__ */ t.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
992
+ /* @__PURE__ */ t.jsx("path", { d: "M3 6H5H21", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
993
+ /* @__PURE__ */ t.jsx("path", { d: "M8 6V4C8 3.46957 8.21071 2.96086 8.58579 2.58579C8.96086 2.21071 9.46957 2 10 2H14C14.5304 2 15.0391 2.21071 15.4142 2.58579C15.7893 2.96086 16 3.46957 16 4V6M19 6V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20V6H19Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
994
+ /* @__PURE__ */ t.jsx("path", { d: "M10 11V17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
995
+ /* @__PURE__ */ t.jsx("path", { d: "M14 11V17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
996
+ ] })
997
+ }
998
+ )
999
+ ] })
1000
+ ] })
1001
+ ),
1002
+ !j && /* @__PURE__ */ t.jsxs("div", { className: "sw-ttyw-chat-section", style: { flexGrow: 1, display: "flex", flexDirection: "column" }, children: [
1003
+ /* @__PURE__ */ t.jsxs("div", { className: "sw-ttyw-messages", style: a.chatSection, children: [
1004
+ s.length === 0 && !u && /* @__PURE__ */ t.jsx("div", { className: "sw-ttyw-empty-state", style: {
1005
+ display: "flex",
1006
+ flexDirection: "column",
1007
+ alignItems: "center",
1008
+ justifyContent: "center",
1009
+ height: "100%",
1010
+ position: "relative"
1011
+ }, children: /* @__PURE__ */ t.jsx(
1012
+ "img",
1013
+ {
1014
+ src: "https://superwise.ai/wp-content/uploads/2024/05/Superwise-logo.svg",
1015
+ alt: "Superwise Logo",
1016
+ style: {
1017
+ width: "350px",
1018
+ height: "200px",
1019
+ opacity: 0.8,
1020
+ objectFit: "contain"
1021
+ },
1022
+ onError: (o) => {
1023
+ console.log("Logo failed to load, using fallback"), o.target.style.display = "none";
1024
+ }
1025
+ }
1026
+ ) }),
1027
+ s.map((o, e) => /* @__PURE__ */ t.jsx(
1028
+ ge,
1029
+ {
1030
+ msg: o,
1031
+ isTyping: N.has(e),
1032
+ onTypingComplete: () => {
1033
+ C((r) => {
1034
+ const d = new Set(r);
1035
+ return d.delete(e), d;
1036
+ });
1037
+ }
1038
+ },
1039
+ e
1040
+ )),
1041
+ M && /* @__PURE__ */ t.jsxs("div", { className: "sw-ttyw-validation-message", children: [
1042
+ /* @__PURE__ */ t.jsx("span", { className: "error-icon", children: "⚠️" }),
1043
+ /* @__PURE__ */ t.jsx("span", { children: M })
1044
+ ] }),
1045
+ u && /* @__PURE__ */ t.jsxs("div", { className: "sw-ttyw-message other message-loading", style: { ...a.message, ...a.messageOther }, children: [
1046
+ /* @__PURE__ */ t.jsx("div", { className: "message-avatar", style: a.messageAvatar, children: /* @__PURE__ */ t.jsx(
1047
+ "img",
1048
+ {
1049
+ src: "https://superwise.ai/wp-content/uploads/2025/07/cropped-Superwise-icon-1-32x32.png",
1050
+ alt: "AI Avatar",
1051
+ style: {
1052
+ width: "20px",
1053
+ height: "20px",
1054
+ borderRadius: "50%",
1055
+ objectFit: "cover"
1056
+ }
1057
+ }
1058
+ ) }),
1059
+ /* @__PURE__ */ t.jsxs("div", { className: "message-content", style: a.messageContent, children: [
1060
+ /* @__PURE__ */ t.jsx("div", { className: "typing typing-1" }),
1061
+ /* @__PURE__ */ t.jsx("div", { className: "typing typing-2" }),
1062
+ /* @__PURE__ */ t.jsx("div", { className: "typing typing-3" })
1063
+ ] })
1064
+ ] }),
1065
+ /* @__PURE__ */ t.jsx("div", { ref: P })
1066
+ ] }),
1067
+ /* @__PURE__ */ t.jsxs("div", { className: "sw-ttyw-chat-input-section", style: a.inputSection, children: [
1068
+ /* @__PURE__ */ t.jsx(
1069
+ "textarea",
1070
+ {
1071
+ className: "sw-ttyw-input",
1072
+ placeholder: "Please ask question here",
1073
+ value: c,
1074
+ onChange: (o) => {
1075
+ m(o.target.value), M && R("");
1076
+ },
1077
+ maxLength: 1e3,
1078
+ style: a.textarea,
1079
+ onKeyDown: (o) => o.key === "Enter" && !o.shiftKey && (o.preventDefault(), D())
1080
+ }
1081
+ ),
1082
+ /* @__PURE__ */ t.jsxs("div", { className: "sw-ttyw-chat-input-content", style: a.inputFooter, children: [
1083
+ /* @__PURE__ */ t.jsxs("small", { id: "sw-ttyw-chat-textbox-status", style: a.characterCount, children: [
1084
+ /* @__PURE__ */ t.jsx("span", { children: c.length }),
1085
+ "/1000"
1086
+ ] }),
1087
+ /* @__PURE__ */ t.jsx(
1088
+ "button",
1089
+ {
1090
+ id: "sw-ttyw-chat-send-message",
1091
+ onClick: D,
1092
+ "aria-label": "Send message",
1093
+ style: a.sendButton,
1094
+ children: /* @__PURE__ */ t.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000", className: "cwv replaced-svg", children: [
1095
+ /* @__PURE__ */ t.jsx("path", { d: "M0 0h24v24H0z", fill: "none" }),
1096
+ /* @__PURE__ */ t.jsx("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" })
1097
+ ] })
1098
+ }
1099
+ )
1100
+ ] })
1101
+ ] })
1102
+ ] }),
1103
+ E && /* @__PURE__ */ t.jsxs("div", { className: "swttyw-modal swttyw-modal-clear-history", style: a.modalOverlay, children: [
1104
+ /* @__PURE__ */ t.jsx("div", { className: "swtty-modal-header" }),
1105
+ /* @__PURE__ */ t.jsxs("div", { className: "swtty-modal-body", style: a.modalBody, children: [
1106
+ /* @__PURE__ */ t.jsx("div", { className: "swtty-content", children: "Are you sure you want to delete the chat history?" }),
1107
+ /* @__PURE__ */ t.jsxs("div", { className: "swtty-action", style: a.modalActions, children: [
1108
+ /* @__PURE__ */ t.jsx(
1109
+ "input",
1110
+ {
1111
+ type: "button",
1112
+ className: "swttyw-btn swttyw-btn-primary",
1113
+ id: "swttyw-btn-clear-history-yes",
1114
+ onClick: V,
1115
+ value: "Yes",
1116
+ style: {
1117
+ background: "var(--swttyw-primary-color)",
1118
+ color: "white",
1119
+ border: "none",
1120
+ padding: "10px 20px",
1121
+ cursor: "pointer",
1122
+ borderRadius: "8px",
1123
+ margin: "10px 5px"
1124
+ }
1125
+ }
1126
+ ),
1127
+ /* @__PURE__ */ t.jsx(
1128
+ "input",
1129
+ {
1130
+ type: "button",
1131
+ className: "swttyw-btn swttyw-btn-primary-inverse",
1132
+ id: "swttyw-btn-clear-history-no",
1133
+ onClick: () => S(!1),
1134
+ value: "No",
1135
+ style: {
1136
+ background: "transparent",
1137
+ color: "var(--swttyw-primary-color)",
1138
+ border: "1px solid var(--swttyw-primary-color)",
1139
+ padding: "10px 20px",
1140
+ cursor: "pointer",
1141
+ borderRadius: "8px",
1142
+ margin: "10px 5px"
1143
+ }
1144
+ }
1145
+ )
1146
+ ] })
1147
+ ] }),
1148
+ /* @__PURE__ */ t.jsx("div", { className: "swtty-modal-footer" })
1149
+ ] }),
1150
+ !j && /* @__PURE__ */ t.jsxs("div", { className: "sw-ttyw-chat-footer", style: a.footer, children: [
1151
+ "Powered by ",
1152
+ /* @__PURE__ */ t.jsx("a", { href: "https://superwise.ai/", className: "ml-1", target: "_new", style: { marginLeft: "0.25rem", lineHeight: 0 }, children: /* @__PURE__ */ t.jsx("img", { src: "https://rebrandstg.superwise.ai/wp-content/plugins/superwise-ttyw/front/images/sw_ttyw_white_logo.svg", alt: "SUPERWISE®", height: "20" }) })
1153
+ ] })
1154
+ ]
1155
+ }
1156
+ )
1157
+ ] });
1158
+ }
1159
+ export {
1160
+ xe as Chatbot
1161
+ };