@flowengage/react-chatbot 5.0.41 → 5.0.43

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.
@@ -26268,7 +26268,43 @@ var _D = class extends HE {
26268
26268
  static startSession(e) {
26269
26269
  return e.textOnly ? aD.startSession(e) : uD.startSession(e);
26270
26270
  }
26271
- }, vD = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
26271
+ }, vD = {
26272
+ wordsSoFar: 0,
26273
+ speechStartTime: 0,
26274
+ isSpeaking: !1,
26275
+ items: [],
26276
+ timers: [],
26277
+ lastHighlightId: null,
26278
+ isVoiceMode: !1
26279
+ };
26280
+ function yD() {
26281
+ vD.timers.forEach(clearTimeout), vD.wordsSoFar = 0, vD.speechStartTime = 0, vD.isSpeaking = !1, vD.items = [], vD.timers = [], vD.lastHighlightId = null;
26282
+ }
26283
+ //#endregion
26284
+ //#region src/utils/highlightEngine.js
26285
+ var bD = 80;
26286
+ function xD(e) {
26287
+ requestAnimationFrame(() => {
26288
+ let t = e.getBoundingClientRect(), n = t.top + t.height / 2, r = bD, i = r + (window.innerHeight - r) / 2, a = window.pageYOffset + n - i;
26289
+ window.scrollTo({
26290
+ top: Math.max(0, a),
26291
+ behavior: "smooth"
26292
+ });
26293
+ });
26294
+ }
26295
+ function SD(e) {
26296
+ if (!e || e.hasAttribute("data-fe-highlighted")) return;
26297
+ CD(), e.classList?.remove("fe-highlight-section", "fe-highlight-speaking", "fe-highlight-exiting"), xD(e);
26298
+ let t = e.style.cssText;
26299
+ e.setAttribute("data-fe-highlighted", "true"), e.setAttribute("data-fe-orig-style", t), e.style.outline = "3px solid #2563eb", e.style.outlineOffset = "8px", e.style.background = "rgba(37, 99, 235, 0.08)", e.style.borderRadius = "8px", e.style.padding = "12px 16px", e.style.transition = "all 0.4s ease";
26300
+ }
26301
+ function CD() {
26302
+ let e = document.querySelector("[data-fe-highlighted]");
26303
+ e && (e.style.cssText = e.getAttribute("data-fe-orig-style") || "", e.removeAttribute("data-fe-highlighted"), e.removeAttribute("data-fe-orig-style"));
26304
+ }
26305
+ //#endregion
26306
+ //#region src/lib/svgIcons.jsx
26307
+ var wD = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
26272
26308
  width: e,
26273
26309
  height: e,
26274
26310
  viewBox: "0 0 24 24",
@@ -26284,7 +26320,7 @@ var _D = class extends HE {
26284
26320
  strokeLinecap: "round",
26285
26321
  strokeLinejoin: "round"
26286
26322
  })]
26287
- }), yD = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
26323
+ }), TD = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
26288
26324
  width: e,
26289
26325
  height: e,
26290
26326
  viewBox: "0 0 24 24",
@@ -26299,7 +26335,7 @@ var _D = class extends HE {
26299
26335
  x2: "1",
26300
26336
  y2: "23"
26301
26337
  })]
26302
- }), bD = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
26338
+ }), ED = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
26303
26339
  width: e,
26304
26340
  height: e,
26305
26341
  viewBox: "0 0 24 24",
@@ -26314,7 +26350,7 @@ var _D = class extends HE {
26314
26350
  x2: "12",
26315
26351
  y2: "5"
26316
26352
  }), /* @__PURE__ */ g("polyline", { points: "5 12 12 5 19 12" })]
26317
- }), xD = () => /* @__PURE__ */ _("svg", {
26353
+ }), DD = () => /* @__PURE__ */ _("svg", {
26318
26354
  width: "14",
26319
26355
  height: "14",
26320
26356
  viewBox: "0 0 24 24",
@@ -26324,7 +26360,7 @@ var _D = class extends HE {
26324
26360
  strokeLinecap: "round",
26325
26361
  strokeLinejoin: "round",
26326
26362
  children: [/* @__PURE__ */ g("polyline", { points: "9 17 4 12 9 7" }), /* @__PURE__ */ g("path", { d: "M20 18v-2a4 4 0 00-4-4H4" })]
26327
- }), SD = () => /* @__PURE__ */ g("svg", {
26363
+ }), OD = () => /* @__PURE__ */ g("svg", {
26328
26364
  width: "18",
26329
26365
  height: "18",
26330
26366
  viewBox: "0 0 24 24",
@@ -26334,7 +26370,7 @@ var _D = class extends HE {
26334
26370
  strokeLinecap: "round",
26335
26371
  strokeLinejoin: "round",
26336
26372
  children: /* @__PURE__ */ g("path", { d: "M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.42 19.42 0 01-6.12-6.11A19.79 19.79 0 012 4.11 2 2 0 014.11 2h3a2 2 0 012 1.72c.13.96.37 1.91.71 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.9.34 1.85.58 2.81.71A2 2 0 0122 16.92z" })
26337
- }), CD = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
26373
+ }), kD = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
26338
26374
  className: e,
26339
26375
  width: "14",
26340
26376
  height: "14",
@@ -26363,7 +26399,7 @@ var _D = class extends HE {
26363
26399
  y2: "16"
26364
26400
  })
26365
26401
  ]
26366
- }), wD = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
26402
+ }), AD = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
26367
26403
  width: e,
26368
26404
  height: e,
26369
26405
  viewBox: "0 0 24 24",
@@ -26386,7 +26422,7 @@ var _D = class extends HE {
26386
26422
  /* @__PURE__ */ g("path", { d: "M15 13v2" }),
26387
26423
  /* @__PURE__ */ g("path", { d: "M9 13v2" })
26388
26424
  ]
26389
- }), TD = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
26425
+ }), jD = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
26390
26426
  width: e,
26391
26427
  height: e,
26392
26428
  viewBox: "0 0 24 24",
@@ -26406,7 +26442,7 @@ var _D = class extends HE {
26406
26442
  x2: "19",
26407
26443
  y2: "12"
26408
26444
  })]
26409
- }), ED = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
26445
+ }), MD = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
26410
26446
  width: e,
26411
26447
  height: e,
26412
26448
  viewBox: "0 0 24 24",
@@ -26432,7 +26468,7 @@ var _D = class extends HE {
26432
26468
  fill: t
26433
26469
  })
26434
26470
  ]
26435
- }), DD = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
26471
+ }), ND = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
26436
26472
  width: "24",
26437
26473
  height: "24",
26438
26474
  viewBox: "0 0 24 24",
@@ -26450,7 +26486,7 @@ var _D = class extends HE {
26450
26486
  "stroke-linecap": "round",
26451
26487
  "stroke-linejoin": "round"
26452
26488
  })]
26453
- }), OD = () => /* @__PURE__ */ g("svg", {
26489
+ }), PD = () => /* @__PURE__ */ g("svg", {
26454
26490
  width: "24",
26455
26491
  height: "24",
26456
26492
  viewBox: "0 0 24 24",
@@ -26462,7 +26498,7 @@ var _D = class extends HE {
26462
26498
  "stroke-width": "1.5",
26463
26499
  "stroke-linejoin": "round"
26464
26500
  })
26465
- }), kD = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
26501
+ }), FD = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
26466
26502
  xmlns: "http://www.w3.org/2000/svg",
26467
26503
  width: e,
26468
26504
  height: e,
@@ -26480,7 +26516,7 @@ var _D = class extends HE {
26480
26516
  /* @__PURE__ */ g("path", { d: "m2 2 20 20" }),
26481
26517
  /* @__PURE__ */ g("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12" })
26482
26518
  ]
26483
- }), AD = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), jD = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), MD = new Set([
26519
+ }), ID = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), LD = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), RD = new Set([
26484
26520
  "p",
26485
26521
  "br",
26486
26522
  "ul",
@@ -26491,30 +26527,30 @@ var _D = class extends HE {
26491
26527
  "b",
26492
26528
  "i",
26493
26529
  "a"
26494
- ]), ND = /^https?:\/\//i;
26495
- function PD(e) {
26530
+ ]), zD = /^https?:\/\//i;
26531
+ function BD(e) {
26496
26532
  let t = Array.from(e.childNodes);
26497
26533
  for (let n of t) if (n.nodeType === Node.ELEMENT_NODE) {
26498
26534
  let t = n.tagName.toLowerCase();
26499
- if (!MD.has(t)) {
26535
+ if (!RD.has(t)) {
26500
26536
  e.replaceChild(document.createTextNode(n.textContent), n);
26501
26537
  continue;
26502
26538
  }
26503
26539
  let r = {};
26504
26540
  if (t === "a") {
26505
26541
  let e = n.getAttribute("href") || "";
26506
- ND.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
26542
+ zD.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
26507
26543
  }
26508
26544
  for (; n.attributes.length > 0;) n.removeAttribute(n.attributes[0].name);
26509
26545
  for (let [e, t] of Object.entries(r)) n.setAttribute(e, t);
26510
- PD(n);
26546
+ BD(n);
26511
26547
  } else n.nodeType !== Node.TEXT_NODE && e.removeChild(n);
26512
26548
  }
26513
- function FD(e) {
26549
+ function VD(e) {
26514
26550
  let t = document.createElement("div");
26515
- return t.innerHTML = e, PD(t), t.innerHTML;
26551
+ return t.innerHTML = e, BD(t), t.innerHTML;
26516
26552
  }
26517
- function ID(e) {
26553
+ function HD(e) {
26518
26554
  let t = String(e || "").trim();
26519
26555
  if (!t) return t;
26520
26556
  let n = /^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);
@@ -26526,33 +26562,33 @@ function ID(e) {
26526
26562
  }
26527
26563
  return e;
26528
26564
  }
26529
- var LD = (e = "") => {
26565
+ var UD = (e = "") => {
26530
26566
  let t = String(e || "").trim();
26531
26567
  if (!t) return "";
26532
- if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return ID(FD(t));
26533
- let n = t.replace(/\r\n/g, "\n").replace(/\n{3,}/g, "\n\n").split(/\n\s*\n/).map((e) => e.trim()).filter(Boolean), r = (e) => jD(e).replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, "<a href=\"$2\" target=\"_blank\" rel=\"noopener noreferrer\">$1</a>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(/\*([^*\n]+)\*/g, "<em>$1</em>");
26534
- return ID(n.map((e) => {
26568
+ if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return HD(VD(t));
26569
+ let n = t.replace(/\r\n/g, "\n").replace(/\n{3,}/g, "\n\n").split(/\n\s*\n/).map((e) => e.trim()).filter(Boolean), r = (e) => LD(e).replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, "<a href=\"$2\" target=\"_blank\" rel=\"noopener noreferrer\">$1</a>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(/\*([^*\n]+)\*/g, "<em>$1</em>");
26570
+ return HD(n.map((e) => {
26535
26571
  let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = t.filter((e) => /^[-*]\s+/.test(e));
26536
26572
  if (n.length >= 2 && n.length === t.length) return `<ul>${n.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>`;
26537
26573
  let i = e.split(/\s+(?=[-*]\s+\*\*?)/).map((e) => e.trim()).filter(Boolean);
26538
26574
  return i.length >= 2 && i.every((e) => /^[-*]\s+/.test(e)) ? `<ul>${i.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>` : `<p>${r(e).replace(/\n/g, "<br />")}</p>`;
26539
26575
  }).join(""));
26540
- }, RD = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), zD = new Set([
26576
+ }, WD = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), GD = new Set([
26541
26577
  ".pdf",
26542
26578
  ".docx",
26543
26579
  ".png",
26544
26580
  ".jpg",
26545
26581
  ".jpeg"
26546
- ]), BD = "image/png,image/jpeg,.pdf,.docx";
26547
- function VD(e) {
26582
+ ]), KD = "image/png,image/jpeg,.pdf,.docx";
26583
+ function qD(e) {
26548
26584
  if (!e) return !1;
26549
26585
  let t = typeof e.name == "string" ? e.name.toLowerCase() : "", n = t.includes(".") ? `.${t.split(".").pop()}` : "", r = typeof e.type == "string" ? e.type.toLowerCase() : "";
26550
- return r === "image/png" || r === "image/jpeg" || RD.has(r) || zD.has(n);
26586
+ return r === "image/png" || r === "image/jpeg" || WD.has(r) || GD.has(n);
26551
26587
  }
26552
- function HD(e) {
26553
- return e ? VD(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
26588
+ function JD(e) {
26589
+ return e ? qD(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
26554
26590
  }
26555
- function UD(e = 0) {
26591
+ function YD(e = 0) {
26556
26592
  if (!Number.isFinite(e) || e <= 0) return "";
26557
26593
  let t = [
26558
26594
  "B",
@@ -26564,12 +26600,12 @@ function UD(e = 0) {
26564
26600
  let i = n >= 10 || r === 0 ? 0 : 1;
26565
26601
  return `${n.toFixed(i)} ${t[r]}`;
26566
26602
  }
26567
- function WD(e) {
26603
+ function XD(e) {
26568
26604
  return e ? e.name || "Attachment" : "";
26569
26605
  }
26570
26606
  //#endregion
26571
26607
  //#region src/utils/avatarHelpers.js
26572
- function GD(e) {
26608
+ function ZD(e) {
26573
26609
  if (!e || typeof e != "string") return "?";
26574
26610
  let t = e.trim();
26575
26611
  if (!t) return "?";
@@ -26578,7 +26614,7 @@ function GD(e) {
26578
26614
  }
26579
26615
  //#endregion
26580
26616
  //#region src/components/AvatarImageOrInitials.jsx
26581
- function KD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26617
+ function QD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26582
26618
  let [i, a] = m(null), o = typeof e == "string" ? e.trim() : "";
26583
26619
  return c(() => {
26584
26620
  if (!o) {
@@ -26600,12 +26636,12 @@ function KD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26600
26636
  style: n
26601
26637
  }) : /* @__PURE__ */ g("span", {
26602
26638
  style: r,
26603
- children: GD(t)
26639
+ children: ZD(t)
26604
26640
  });
26605
26641
  }
26606
26642
  //#endregion
26607
26643
  //#region src/components/MessageList.jsx
26608
- function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
26644
+ function $D({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
26609
26645
  let { resolvedConfig: d } = Ln(), f = p(null), [v, y] = m(null), [b, x] = m(null), S = p(e.length), C = p(!0), w = p(null), T = o((e) => {
26610
26646
  let t = e.target.closest("a[href]");
26611
26647
  if (!t) return;
@@ -26660,7 +26696,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26660
26696
  children: [
26661
26697
  e.map((e) => {
26662
26698
  if (e.type === "call_recording" || typeof e.message == "string" && e.message.includes("AI chat recording")) return null;
26663
- let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, d = e.type === "file" && e.metadata?.fileUrl, f = e.agent_name || e.agentName || e.metadata?.agentName || l, p = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, m = AD(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
26699
+ let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, d = e.type === "file" && e.metadata?.fileUrl, f = e.agent_name || e.agentName || e.metadata?.agentName || l, p = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, m = ID(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
26664
26700
  return t ? /* @__PURE__ */ g("div", {
26665
26701
  style: {
26666
26702
  display: "flex",
@@ -26705,7 +26741,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26705
26741
  fontWeight: 800,
26706
26742
  marginTop: !c && (r || o) ? "22px" : "0px"
26707
26743
  },
26708
- children: r ? u || /* @__PURE__ */ g(wD, { size: 16 }) : /* @__PURE__ */ g(KD, {
26744
+ children: r ? u || /* @__PURE__ */ g(AD, { size: 16 }) : /* @__PURE__ */ g(QD, {
26709
26745
  src: p || "",
26710
26746
  name: f,
26711
26747
  imgStyle: {
@@ -26747,7 +26783,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26747
26783
  onMouseLeave: (e) => {
26748
26784
  e.currentTarget.style.color = "#9ca3af";
26749
26785
  },
26750
- children: [/* @__PURE__ */ g(xD, {}), "Reply"]
26786
+ children: [/* @__PURE__ */ g(DD, {}), "Reply"]
26751
26787
  }),
26752
26788
  /* @__PURE__ */ _("div", {
26753
26789
  style: {
@@ -26791,7 +26827,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26791
26827
  children: m
26792
26828
  })]
26793
26829
  }), d ? (() => {
26794
- let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = UD(e.metadata.fileSize), a = t.startsWith("image/"), o = t === "application/pdf" ? {
26830
+ let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = YD(e.metadata.fileSize), a = t.startsWith("image/"), o = t === "application/pdf" ? {
26795
26831
  color: "#ef4444",
26796
26832
  label: "PDF"
26797
26833
  } : t.includes("word") || t.includes("docx") ? {
@@ -26963,7 +26999,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26963
26999
  });
26964
27000
  })() : r ? /* @__PURE__ */ g("div", {
26965
27001
  className: "flowengage-message-content fe-bot-message",
26966
- dangerouslySetInnerHTML: { __html: LD(e.message) },
27002
+ dangerouslySetInnerHTML: { __html: UD(e.message) },
26967
27003
  onClick: T
26968
27004
  }) : /* @__PURE__ */ g("div", {
26969
27005
  style: { whiteSpace: n || o ? "normal" : "pre-wrap" },
@@ -27028,7 +27064,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
27028
27064
  boxShadow: u ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
27029
27065
  overflow: "hidden"
27030
27066
  },
27031
- children: u || /* @__PURE__ */ g(wD, { size: 16 })
27067
+ children: u || /* @__PURE__ */ g(AD, { size: 16 })
27032
27068
  }), /* @__PURE__ */ _("div", {
27033
27069
  style: {
27034
27070
  display: "flex",
@@ -27070,7 +27106,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
27070
27106
  borderRadius: "50%",
27071
27107
  overflow: "hidden"
27072
27108
  },
27073
- children: /* @__PURE__ */ g(KD, {
27109
+ children: /* @__PURE__ */ g(QD, {
27074
27110
  src: s || "",
27075
27111
  name: l,
27076
27112
  imgStyle: {
@@ -27164,7 +27200,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
27164
27200
  }
27165
27201
  //#endregion
27166
27202
  //#region src/components/ChatInput.jsx
27167
- function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: c, clearReplyContext: l, requiresEmail: u, emailInput: d, setEmailInput: f, emailError: m, showVoiceToggle: v = !1, voiceEnabled: y = !0, onFileSelect: b, selectedFile: x = null, onRemoveSelectedFile: S, attachmentError: C = "", isUploadingAttachment: w = !1, inputPlaceholder: T = "Type your message" }) {
27203
+ function eO({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: c, clearReplyContext: l, requiresEmail: u, emailInput: d, setEmailInput: f, emailError: m, showVoiceToggle: v = !1, voiceEnabled: y = !0, onFileSelect: b, selectedFile: x = null, onRemoveSelectedFile: S, attachmentError: C = "", isUploadingAttachment: w = !1, inputPlaceholder: T = "Type your message" }) {
27168
27204
  let ee = p(null), te = c?.sender === "user" ? "You" : c?.sender === "agent" ? "Agent" : "AI Assistant", ne = u ? !!d?.trim() : !!e?.trim() || !!x, re = s || w || !ne, E = !u && y && v;
27169
27205
  return /* @__PURE__ */ _("div", {
27170
27206
  style: {
@@ -27259,7 +27295,7 @@ function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
27259
27295
  background: "rgba(59,130,246,0.08)",
27260
27296
  color: "var(--flowengage-primary)"
27261
27297
  },
27262
- children: /* @__PURE__ */ g(wD, { size: 13 })
27298
+ children: /* @__PURE__ */ g(AD, { size: 13 })
27263
27299
  }), /* @__PURE__ */ g("span", { children: "Please provide your email address so we can help you." })]
27264
27300
  })
27265
27301
  }),
@@ -27299,7 +27335,7 @@ function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
27299
27335
  overflow: "hidden",
27300
27336
  textOverflow: "ellipsis"
27301
27337
  },
27302
- children: WD(x)
27338
+ children: XD(x)
27303
27339
  }),
27304
27340
  /* @__PURE__ */ g("div", {
27305
27341
  style: {
@@ -27307,7 +27343,7 @@ function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
27307
27343
  color: "#6b7280",
27308
27344
  marginTop: "2px"
27309
27345
  },
27310
- children: UD(x.size)
27346
+ children: YD(x.size)
27311
27347
  })
27312
27348
  ]
27313
27349
  }), /* @__PURE__ */ g("button", {
@@ -27352,7 +27388,7 @@ function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
27352
27388
  E ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("input", {
27353
27389
  ref: ee,
27354
27390
  type: "file",
27355
- accept: BD,
27391
+ accept: KD,
27356
27392
  style: { display: "none" },
27357
27393
  onChange: (e) => {
27358
27394
  let t = e.target.files?.[0];
@@ -27384,7 +27420,7 @@ function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
27384
27420
  onMouseLeave: (e) => {
27385
27421
  e.currentTarget.style.opacity = "1";
27386
27422
  },
27387
- children: /* @__PURE__ */ g(TD, {
27423
+ children: /* @__PURE__ */ g(jD, {
27388
27424
  size: 16,
27389
27425
  color: "currentColor"
27390
27426
  })
@@ -27441,7 +27477,7 @@ function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
27441
27477
  onMouseLeave: (e) => {
27442
27478
  e.currentTarget.style.opacity = "1";
27443
27479
  },
27444
- children: /* @__PURE__ */ g(bD, { size: 16 })
27480
+ children: /* @__PURE__ */ g(ED, { size: 16 })
27445
27481
  })
27446
27482
  ]
27447
27483
  }),
@@ -27504,7 +27540,7 @@ function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
27504
27540
  }
27505
27541
  //#endregion
27506
27542
  //#region src/components/StatusBanners.jsx
27507
- function YD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
27543
+ function tO({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
27508
27544
  return /* @__PURE__ */ _(h, { children: [(e || t) && /* @__PURE__ */ _("div", {
27509
27545
  style: {
27510
27546
  margin: "0 20px 10px",
@@ -27517,7 +27553,7 @@ function YD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27517
27553
  gap: "10px"
27518
27554
  },
27519
27555
  children: [
27520
- /* @__PURE__ */ g(CD, { className: "" }),
27556
+ /* @__PURE__ */ g(kD, { className: "" }),
27521
27557
  /* @__PURE__ */ g("span", {
27522
27558
  style: {
27523
27559
  fontSize: "12px",
@@ -27563,13 +27599,13 @@ function YD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27563
27599
  }
27564
27600
  //#endregion
27565
27601
  //#region src/components/AnimatedOrb.jsx
27566
- var XD = [
27602
+ var nO = [
27567
27603
  "#135bd8",
27568
27604
  "#ef334b",
27569
27605
  "#ffbd2e"
27570
27606
  ];
27571
- function ZD(e) {
27572
- return !Array.isArray(e) || e.length === 0 ? XD : e.length === 1 ? [
27607
+ function rO(e) {
27608
+ return !Array.isArray(e) || e.length === 0 ? nO : e.length === 1 ? [
27573
27609
  e[0],
27574
27610
  e[0],
27575
27611
  e[0]
@@ -27583,14 +27619,15 @@ function ZD(e) {
27583
27619
  e[2]
27584
27620
  ];
27585
27621
  }
27586
- var QD = {
27622
+ var iO = {
27587
27623
  idle: 3,
27588
27624
  listening: .75,
27625
+ thinking: 1,
27589
27626
  speaking: 1.4,
27590
27627
  muted: .75,
27591
27628
  error: .08
27592
27629
  };
27593
- function $D(e) {
27630
+ function aO(e) {
27594
27631
  if (!e || typeof e != "string") return [
27595
27632
  0,
27596
27633
  0,
@@ -27603,14 +27640,14 @@ function $D(e) {
27603
27640
  parseInt(n.slice(4, 6), 16) / 255
27604
27641
  ];
27605
27642
  }
27606
- function eO(e, t) {
27643
+ function oO(e, t) {
27607
27644
  if (!e || typeof e != "string") return `rgba(0,0,0,${t})`;
27608
27645
  if (e.startsWith("rgb")) return e.replace(/[\d.]+\)$/, `${t})`);
27609
27646
  let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
27610
27647
  return `rgba(${parseInt(r.slice(0, 2), 16)},${parseInt(r.slice(2, 4), 16)},${parseInt(r.slice(4, 6), 16)},${t})`;
27611
27648
  }
27612
- var tO = "\n attribute vec2 a_pos;\n varying vec2 v_uv;\n void main() {\n v_uv = a_pos * 0.5 + 0.5;\n gl_Position = vec4(a_pos, 0.0, 1.0);\n }\n", nO = "\n precision highp float;\n\n varying vec2 v_uv;\n uniform float u_time;\n uniform float u_speed;\n uniform vec3 u_c1;\n uniform vec3 u_c2;\n uniform vec3 u_c3;\n\n // ── Gradient noise ─────────────────────────────────────────────────────────\n vec2 hash2(vec2 p) {\n p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));\n return -1.0 + 2.0 * fract(sin(p) * 43758.5453123);\n }\n float gnoise(vec2 p) {\n vec2 i = floor(p), f = fract(p);\n vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);\n return mix(\n mix(dot(hash2(i), f),\n dot(hash2(i+vec2(1,0)), f-vec2(1,0)), u.x),\n mix(dot(hash2(i+vec2(0,1)), f-vec2(0,1)),\n dot(hash2(i+vec2(1,1)), f-vec2(1,1)), u.x),\n u.y\n ) * 0.5 + 0.5;\n }\n\n // ── 3-octave FBM normalised to [0,1] — fewer octaves → larger, softer blobs\n float fbm(vec2 p) {\n float v = 0.0, a = 0.5;\n for (int i = 0; i < 3; i++) {\n v += a * gnoise(p);\n p = p * 2.1 + vec2(100.0);\n a *= 0.5;\n }\n return v / 0.875;\n }\n\n // ── Scalar hash for grain ──────────────────────────────────────────────────\n float hash1(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n }\n\n void main() {\n vec2 uv = v_uv;\n float t = u_time * u_speed + 47.3;\n\n // ── ① Two-level domain warp — deep organic folding and swirling ───────────\n // First pass: large-scale sweep\n vec2 q = vec2(\n fbm(uv * 1.8 + vec2( t * 0.13, t * 0.11)) * 2.0 - 1.0,\n fbm(uv * 1.8 + vec2( t * 0.11 + 3.7, -t * 0.14 + 1.1)) * 2.0 - 1.0\n );\n // Second pass: warp the warp — creates curling, folding sub-currents\n vec2 r = vec2(\n fbm(uv * 1.8 + q * 0.55 + vec2( t * 0.09, t * 0.07)) * 2.0 - 1.0,\n fbm(uv * 1.8 + q * 0.55 + vec2(-t * 0.07 + 5.1, t * 0.10 + 2.3)) * 2.0 - 1.0\n );\n vec2 wp = uv + r * 0.38;\n\n // ── ② Three independent fields — each drifts inward from its source edge ──\n // Asymmetric velocities: dominant axis matches the inflow direction so the\n // noise texture visually streams inward (left→right, right→left, bottom→top).\n float f1 = fbm(wp * 0.85 + vec2(-t * 0.18, t * 0.04)); // LEFT → right\n float f2 = fbm(wp * 0.85 + vec2( t * 0.18 + 5.3, t * 0.04 + 1.7)); // RIGHT → left\n float f3 = fbm(wp * 0.85 + vec2( t * 0.04 - 3.2, -t * 0.18 + 6.4)); // BOTTOM → up\n\n // ── ③ Breathing blobs — sin pulse makes each field expand and contract ────\n float p1 = 0.88 + 0.12 * sin(t * 0.61);\n float p2 = 0.88 + 0.12 * sin(t * 0.47 + 2.09);\n float p3 = 0.88 + 0.12 * sin(t * 0.53 + 4.19);\n\n // Wide smoothstep (0.26 → 0.70) → soft, diffused blob edges that dissolve\n // gradually into each other, like dye spreading through water.\n float b1 = smoothstep(0.26, 0.70, f1 * p1);\n float b2 = smoothstep(0.26, 0.70, f2 * p2);\n float b3 = smoothstep(0.26, 0.70, f3 * p3);\n\n // ── ④ Directional origin gradients.\n // Each color owns its home edge (value = 1.0) and smoothly fades to zero\n // before reaching the opposite side. The transition windows are offset so\n // they overlap only in the center third — that overlap zone is where the\n // three colors meet and blend, while the edges stay uncontaminated.\n float d1 = 1.0 - smoothstep(0.20, 0.74, uv.x); // c1: LEFT → full at x<0.20, zero by x=0.74\n float d2 = 1.0 - smoothstep(0.20, 0.74, 1.0 - uv.x); // c2: RIGHT → full at x>0.80, zero by x=0.26\n float d3 = 1.0 - smoothstep(0.18, 0.68, uv.y); // c3: BOTTOM → full at y<0.18, zero by y=0.68\n\n float w1 = b1 * d1;\n float w2 = b2 * d2;\n float w3 = b3 * d3;\n\n // ── ⑤ Dye-mixing colour blend ──────────────────────────────────────────────\n // dyeColor is the weighted average of all active colours — exactly how dyes\n // mix in water: overlapping streams blend smoothly, no hard edges.\n float total = w1 + w2 + w3;\n vec3 dyeColor = (u_c1 * w1 + u_c2 * w2 + u_c3 * w3) / max(total, 0.001);\n\n // Boost brightness of the dye to make colors pop and seem less dull\n dyeColor *= 1.65;\n\n // Exponential coverage: cores are rich and opaque; edges dissolve into the\n // near-white base. White only shows through where dye concentration is thin.\n float coverage = 1.0 - exp(-total * 5.0);\n vec3 col = mix(vec3(1.0, 1.0, 1.0), dyeColor, coverage);\n col = clamp(col, 0.0, 1.0);\n\n // ── ⑥ Sphere shading — subtle edge vignette only, no specular ─────────────\n vec2 uvc = v_uv * 2.0 - 1.0;\n\n // ── ⑦ Subtle grain — breaks gradient banding, adds filmic texture ──────────\n float grain = hash1(v_uv * 437.3 + fract(t)) * 2.0 - 1.0;\n col += grain * 0.018;\n\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n";
27613
- function rO(e, t, n) {
27649
+ var sO = "\n attribute vec2 a_pos;\n varying vec2 v_uv;\n void main() {\n v_uv = a_pos * 0.5 + 0.5;\n gl_Position = vec4(a_pos, 0.0, 1.0);\n }\n", cO = "\n precision highp float;\n\n varying vec2 v_uv;\n uniform float u_time;\n uniform float u_speed;\n uniform vec3 u_c1;\n uniform vec3 u_c2;\n uniform vec3 u_c3;\n\n // ── Gradient noise ─────────────────────────────────────────────────────────\n vec2 hash2(vec2 p) {\n p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));\n return -1.0 + 2.0 * fract(sin(p) * 43758.5453123);\n }\n float gnoise(vec2 p) {\n vec2 i = floor(p), f = fract(p);\n vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);\n return mix(\n mix(dot(hash2(i), f),\n dot(hash2(i+vec2(1,0)), f-vec2(1,0)), u.x),\n mix(dot(hash2(i+vec2(0,1)), f-vec2(0,1)),\n dot(hash2(i+vec2(1,1)), f-vec2(1,1)), u.x),\n u.y\n ) * 0.5 + 0.5;\n }\n\n // ── 3-octave FBM normalised to [0,1] — fewer octaves → larger, softer blobs\n float fbm(vec2 p) {\n float v = 0.0, a = 0.5;\n for (int i = 0; i < 3; i++) {\n v += a * gnoise(p);\n p = p * 2.1 + vec2(100.0);\n a *= 0.5;\n }\n return v / 0.875;\n }\n\n // ── Scalar hash for grain ──────────────────────────────────────────────────\n float hash1(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n }\n\n void main() {\n vec2 uv = v_uv;\n float t = u_time * u_speed + 47.3;\n\n // ── ① Two-level domain warp — deep organic folding and swirling ───────────\n // First pass: large-scale sweep\n vec2 q = vec2(\n fbm(uv * 1.8 + vec2( t * 0.13, t * 0.11)) * 2.0 - 1.0,\n fbm(uv * 1.8 + vec2( t * 0.11 + 3.7, -t * 0.14 + 1.1)) * 2.0 - 1.0\n );\n // Second pass: warp the warp — creates curling, folding sub-currents\n vec2 r = vec2(\n fbm(uv * 1.8 + q * 0.55 + vec2( t * 0.09, t * 0.07)) * 2.0 - 1.0,\n fbm(uv * 1.8 + q * 0.55 + vec2(-t * 0.07 + 5.1, t * 0.10 + 2.3)) * 2.0 - 1.0\n );\n vec2 wp = uv + r * 0.38;\n\n // ── ② Three independent fields — each drifts inward from its source edge ──\n // Asymmetric velocities: dominant axis matches the inflow direction so the\n // noise texture visually streams inward (left→right, right→left, bottom→top).\n float f1 = fbm(wp * 0.85 + vec2(-t * 0.18, t * 0.04)); // LEFT → right\n float f2 = fbm(wp * 0.85 + vec2( t * 0.18 + 5.3, t * 0.04 + 1.7)); // RIGHT → left\n float f3 = fbm(wp * 0.85 + vec2( t * 0.04 - 3.2, -t * 0.18 + 6.4)); // BOTTOM → up\n\n // ── ③ Breathing blobs — sin pulse makes each field expand and contract ────\n float p1 = 0.88 + 0.12 * sin(t * 0.61);\n float p2 = 0.88 + 0.12 * sin(t * 0.47 + 2.09);\n float p3 = 0.88 + 0.12 * sin(t * 0.53 + 4.19);\n\n // Wide smoothstep (0.26 → 0.70) → soft, diffused blob edges that dissolve\n // gradually into each other, like dye spreading through water.\n float b1 = smoothstep(0.26, 0.70, f1 * p1);\n float b2 = smoothstep(0.26, 0.70, f2 * p2);\n float b3 = smoothstep(0.26, 0.70, f3 * p3);\n\n // ── ④ Directional origin gradients.\n // Each color owns its home edge (value = 1.0) and smoothly fades to zero\n // before reaching the opposite side. The transition windows are offset so\n // they overlap only in the center third — that overlap zone is where the\n // three colors meet and blend, while the edges stay uncontaminated.\n float d1 = 1.0 - smoothstep(0.20, 0.74, uv.x); // c1: LEFT → full at x<0.20, zero by x=0.74\n float d2 = 1.0 - smoothstep(0.20, 0.74, 1.0 - uv.x); // c2: RIGHT → full at x>0.80, zero by x=0.26\n float d3 = 1.0 - smoothstep(0.18, 0.68, uv.y); // c3: BOTTOM → full at y<0.18, zero by y=0.68\n\n float w1 = b1 * d1;\n float w2 = b2 * d2;\n float w3 = b3 * d3;\n\n // ── ⑤ Dye-mixing colour blend ──────────────────────────────────────────────\n // dyeColor is the weighted average of all active colours — exactly how dyes\n // mix in water: overlapping streams blend smoothly, no hard edges.\n float total = w1 + w2 + w3;\n vec3 dyeColor = (u_c1 * w1 + u_c2 * w2 + u_c3 * w3) / max(total, 0.001);\n\n // Boost brightness of the dye to make colors pop and seem less dull\n dyeColor *= 1.65;\n\n // Exponential coverage: cores are rich and opaque; edges dissolve into the\n // near-white base. White only shows through where dye concentration is thin.\n float coverage = 1.0 - exp(-total * 5.0);\n vec3 col = mix(vec3(1.0, 1.0, 1.0), dyeColor, coverage);\n col = clamp(col, 0.0, 1.0);\n\n // ── ⑥ Sphere shading — subtle edge vignette only, no specular ─────────────\n vec2 uvc = v_uv * 2.0 - 1.0;\n\n // ── ⑦ Subtle grain — breaks gradient banding, adds filmic texture ──────────\n float grain = hash1(v_uv * 437.3 + fract(t)) * 2.0 - 1.0;\n col += grain * 0.018;\n\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n";
27650
+ function lO(e, t, n) {
27614
27651
  let r = (t, n) => {
27615
27652
  let r = e.createShader(t);
27616
27653
  return e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("[AnimatedOrb shader]", e.getShaderInfoLog(r)), null);
@@ -27619,10 +27656,10 @@ function rO(e, t, n) {
27619
27656
  let o = e.createProgram();
27620
27657
  return e.attachShader(o, i), e.attachShader(o, a), e.linkProgram(o), e.getProgramParameter(o, e.LINK_STATUS) ? o : (console.error("[AnimatedOrb link]", e.getProgramInfoLog(o)), null);
27621
27658
  }
27622
- function iO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
27623
- let [s, l, u] = ZD(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(QD[t] ?? .35);
27659
+ function uO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
27660
+ let [s, l, u] = rO(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(iO[t] ?? .35);
27624
27661
  c(() => {
27625
- h.current = QD[t] ?? .35;
27662
+ h.current = iO[t] ?? .35;
27626
27663
  }, [t]), c(() => {
27627
27664
  let t = m.current;
27628
27665
  if (!t) return;
@@ -27639,7 +27676,7 @@ function iO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27639
27676
  console.warn("[AnimatedOrb] WebGL unavailable.");
27640
27677
  return;
27641
27678
  }
27642
- let i = rO(r, tO, nO);
27679
+ let i = lO(r, sO, cO);
27643
27680
  if (!i) {
27644
27681
  console.error("[AnimatedOrb] WebGL program failed to compile/link");
27645
27682
  return;
@@ -27669,7 +27706,7 @@ function iO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27669
27706
  c2: r.getUniformLocation(i, "u_c2"),
27670
27707
  c3: r.getUniformLocation(i, "u_c3")
27671
27708
  };
27672
- r.uniform3fv(c.c1, $D(s)), r.uniform3fv(c.c2, $D(l)), r.uniform3fv(c.c3, $D(u)), r.viewport(0, 0, t.width, t.height);
27709
+ r.uniform3fv(c.c1, aO(s)), r.uniform3fv(c.c2, aO(l)), r.uniform3fv(c.c3, aO(u)), r.viewport(0, 0, t.width, t.height);
27673
27710
  let d = performance.now(), f, p = (e) => {
27674
27711
  r.uniform1f(c.time, (e - d) / 1e3), r.uniform1f(c.speed, h.current), r.drawArrays(r.TRIANGLES, 0, 6), f = requestAnimationFrame(p);
27675
27712
  };
@@ -27700,7 +27737,7 @@ function iO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27700
27737
  position: "absolute",
27701
27738
  inset: -10,
27702
27739
  borderRadius: "50%",
27703
- background: `radial-gradient(circle, ${eO(s, .18)} 0%, transparent 70%)`,
27740
+ background: `radial-gradient(circle, ${oO(s, .18)} 0%, transparent 70%)`,
27704
27741
  pointerEvents: "none"
27705
27742
  },
27706
27743
  animate: { opacity: [.3, .75] },
@@ -27778,17 +27815,17 @@ function iO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27778
27815
  }
27779
27816
  //#endregion
27780
27817
  //#region src/components/CallScreen.jsx
27781
- var aO = "\n @keyframes fe-call-ring-pulse {\n 0% { transform: scale(1); opacity: 0.55; }\n 70% { transform: scale(1.85); opacity: 0; }\n 100% { transform: scale(1.85); opacity: 0; }\n }\n @keyframes fe-call-spin {\n to { transform: rotate(360deg); }\n }\n @keyframes fe-call-slide-up {\n from { opacity: 0; transform: translateY(24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fe-call-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes fe-call-bar-slide-in {\n from { opacity: 0; transform: translateY(10px) scale(0.97); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n @keyframes fe-call-dot-blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.35; }\n }\n @keyframes fe-call-avatar-breathe {\n 0%, 100% { opacity: 0.5; transform: scale(1); }\n 50% { opacity: 0.9; transform: scale(1.12); }\n }\n";
27782
- function oO(e) {
27818
+ var dO = "\n @keyframes fe-call-ring-pulse {\n 0% { transform: scale(1); opacity: 0.55; }\n 70% { transform: scale(1.85); opacity: 0; }\n 100% { transform: scale(1.85); opacity: 0; }\n }\n @keyframes fe-call-spin {\n to { transform: rotate(360deg); }\n }\n @keyframes fe-call-slide-up {\n from { opacity: 0; transform: translateY(24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fe-call-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes fe-call-bar-slide-in {\n from { opacity: 0; transform: translateY(10px) scale(0.97); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n @keyframes fe-call-dot-blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.35; }\n }\n @keyframes fe-call-avatar-breathe {\n 0%, 100% { opacity: 0.5; transform: scale(1); }\n 50% { opacity: 0.9; transform: scale(1.12); }\n }\n";
27819
+ function fO(e) {
27783
27820
  let t = (e || "").replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
27784
27821
  return `${parseInt(n.slice(0, 2), 16)},${parseInt(n.slice(2, 4), 16)},${parseInt(n.slice(4, 6), 16)}`;
27785
27822
  }
27786
- function sO(e) {
27823
+ function pO(e) {
27787
27824
  if (!e || typeof e != "string") return "#1a1a1a";
27788
27825
  let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = parseInt(n.slice(0, 2), 16) / 255, i = parseInt(n.slice(2, 4), 16) / 255, a = parseInt(n.slice(4, 6), 16) / 255, o = (e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
27789
27826
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
27790
27827
  }
27791
- function cO(e, t) {
27828
+ function mO(e, t) {
27792
27829
  let n = Array.isArray(e) && e.length > 0 ? e : [t || "#3B82F6"], [r, i, a] = n;
27793
27830
  return n.length === 1 ? [
27794
27831
  `radial-gradient(ellipse 110% 65% at 50% -5%, ${r}28 0%, transparent 68%)`,
@@ -27805,8 +27842,8 @@ function cO(e, t) {
27805
27842
  "#f7f8fa"
27806
27843
  ].join(", ");
27807
27844
  }
27808
- function lO({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
27809
- let i = (t || "A")[0].toUpperCase(), a = sO(r), o = n > 48 ? {
27845
+ function hO({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
27846
+ let i = (t || "A")[0].toUpperCase(), a = pO(r), o = n > 48 ? {
27810
27847
  boxShadow: `0 0 0 3px ${r}44`,
27811
27848
  border: "3px solid rgba(255,255,255,0.15)"
27812
27849
  } : { border: `1.5px solid ${r}55` };
@@ -27843,7 +27880,7 @@ function lO({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" })
27843
27880
  children: i
27844
27881
  });
27845
27882
  }
27846
- function uO(e) {
27883
+ function gO(e) {
27847
27884
  let t = p(null), n = o(() => {
27848
27885
  if (!t.current) return;
27849
27886
  let { audioContext: e, oscillator: n, interval: r, toneTimeout: i } = t.current;
@@ -27890,8 +27927,8 @@ function uO(e) {
27890
27927
  n
27891
27928
  ]), c(() => () => n(), [n]), n;
27892
27929
  }
27893
- function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDurationSeconds: r, isCallMuted: i, agentName: a, agentHeadshot: o, fallbackAgentName: s, acceptCall: c, rejectCall: l, endWebRTCCall: u, toggleCallMute: d, formatCallDuration: f, onMinimize: p, primaryColor: m = "#3B82F6", orbColors: h, chatHistory: v = [] }) {
27894
- let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = uO(!!e), S = async () => {
27930
+ function _O({ incomingCall: e, activeCallId: t, callConnectionState: n, callDurationSeconds: r, isCallMuted: i, agentName: a, agentHeadshot: o, fallbackAgentName: s, acceptCall: c, rejectCall: l, endWebRTCCall: u, toggleCallMute: d, formatCallDuration: f, onMinimize: p, primaryColor: m = "#3B82F6", orbColors: h, chatHistory: v = [] }) {
27931
+ let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = gO(!!e), S = async () => {
27895
27932
  x(), await c();
27896
27933
  }, C = async () => {
27897
27934
  x(), await l();
@@ -27903,14 +27940,14 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
27903
27940
  flexDirection: "column",
27904
27941
  borderRadius: "inherit",
27905
27942
  overflow: "hidden",
27906
- background: cO(h, m),
27943
+ background: mO(h, m),
27907
27944
  animation: T ? "fe-call-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)" : "fe-call-fade-in 0.32s ease"
27908
27945
  };
27909
27946
  if (b === "incoming") {
27910
27947
  let e = Array.isArray(h) && h.length > 0 ? h : [m];
27911
27948
  return /* @__PURE__ */ _("div", {
27912
27949
  style: ee,
27913
- children: [/* @__PURE__ */ g("style", { children: aO }), /* @__PURE__ */ _("div", {
27950
+ children: [/* @__PURE__ */ g("style", { children: dO }), /* @__PURE__ */ _("div", {
27914
27951
  style: {
27915
27952
  flex: 1,
27916
27953
  display: "flex",
@@ -27941,7 +27978,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
27941
27978
  width: "96px",
27942
27979
  height: "96px",
27943
27980
  borderRadius: "50%",
27944
- background: `radial-gradient(circle, rgba(${oO(e[0])},0.2) 0%, transparent 70%)`,
27981
+ background: `radial-gradient(circle, rgba(${fO(e[0])},0.2) 0%, transparent 70%)`,
27945
27982
  filter: "blur(10px)",
27946
27983
  zIndex: 0
27947
27984
  } }),
@@ -27958,7 +27995,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
27958
27995
  animation: `fe-call-ring-pulse 2.6s cubic-bezier(0.215,0.61,0.355,1) ${t}s infinite`,
27959
27996
  zIndex: 1
27960
27997
  } }, n)),
27961
- /* @__PURE__ */ g(lO, {
27998
+ /* @__PURE__ */ g(hO, {
27962
27999
  headshot: o,
27963
28000
  name: y,
27964
28001
  size: 82,
@@ -28038,7 +28075,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28038
28075
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(239,68,68,0.5)";
28039
28076
  },
28040
28077
  "aria-label": "Decline call",
28041
- children: /* @__PURE__ */ g(yD, { size: 26 })
28078
+ children: /* @__PURE__ */ g(TD, { size: 26 })
28042
28079
  }), /* @__PURE__ */ g("span", {
28043
28080
  style: {
28044
28081
  fontSize: "12px",
@@ -28079,7 +28116,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28079
28116
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(34,197,94,0.5)";
28080
28117
  },
28081
28118
  "aria-label": "Accept call",
28082
- children: /* @__PURE__ */ g(SD, {})
28119
+ children: /* @__PURE__ */ g(OD, {})
28083
28120
  }), /* @__PURE__ */ g("span", {
28084
28121
  style: {
28085
28122
  fontSize: "12px",
@@ -28096,7 +28133,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28096
28133
  }
28097
28134
  return b === "connecting" ? /* @__PURE__ */ _("div", {
28098
28135
  style: ee,
28099
- children: [/* @__PURE__ */ g("style", { children: aO }), /* @__PURE__ */ _("div", {
28136
+ children: [/* @__PURE__ */ g("style", { children: dO }), /* @__PURE__ */ _("div", {
28100
28137
  style: {
28101
28138
  flex: 1,
28102
28139
  display: "flex",
@@ -28106,7 +28143,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28106
28143
  gap: "24px"
28107
28144
  },
28108
28145
  children: [
28109
- /* @__PURE__ */ g(lO, {
28146
+ /* @__PURE__ */ g(hO, {
28110
28147
  headshot: o,
28111
28148
  name: y,
28112
28149
  size: 64,
@@ -28133,7 +28170,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28133
28170
  }) : /* @__PURE__ */ _("div", {
28134
28171
  style: ee,
28135
28172
  children: [
28136
- /* @__PURE__ */ g("style", { children: aO }),
28173
+ /* @__PURE__ */ g("style", { children: dO }),
28137
28174
  /* @__PURE__ */ _("div", {
28138
28175
  style: {
28139
28176
  display: "flex",
@@ -28179,7 +28216,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28179
28216
  children: /* @__PURE__ */ g("polyline", { points: "15 18 9 12 15 6" })
28180
28217
  })
28181
28218
  }),
28182
- /* @__PURE__ */ g(iO, {
28219
+ /* @__PURE__ */ g(uO, {
28183
28220
  colors: h,
28184
28221
  size: 36,
28185
28222
  voiceState: w
@@ -28230,7 +28267,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28230
28267
  gap: "16px",
28231
28268
  padding: "0 24px 16px"
28232
28269
  },
28233
- children: [/* @__PURE__ */ g(lO, {
28270
+ children: [/* @__PURE__ */ g(hO, {
28234
28271
  headshot: o,
28235
28272
  name: y,
28236
28273
  size: 116,
@@ -28285,7 +28322,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28285
28322
  transition: "all 0.2s ease"
28286
28323
  },
28287
28324
  "aria-label": i ? "Unmute" : "Mute",
28288
- children: [g(i ? kD : vD, { size: 18 }), i ? "Unmute" : "Mute"]
28325
+ children: [g(i ? FD : wD, { size: 18 }), i ? "Unmute" : "Mute"]
28289
28326
  }), /* @__PURE__ */ _("button", {
28290
28327
  type: "button",
28291
28328
  onClick: u,
@@ -28313,15 +28350,15 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28313
28350
  e.currentTarget.style.background = "rgba(239,68,68,0.9)", e.currentTarget.style.transform = "scale(1)";
28314
28351
  },
28315
28352
  "aria-label": "End call",
28316
- children: [/* @__PURE__ */ g(yD, { size: 18 }), "End Call"]
28353
+ children: [/* @__PURE__ */ g(TD, { size: 18 }), "End Call"]
28317
28354
  })]
28318
28355
  })
28319
28356
  ]
28320
28357
  });
28321
28358
  }
28322
- function fO({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
28359
+ function vO({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
28323
28360
  let u = e || n || "Agent";
28324
- return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: aO }), /* @__PURE__ */ _("div", {
28361
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: dO }), /* @__PURE__ */ _("div", {
28325
28362
  role: "button",
28326
28363
  tabIndex: 0,
28327
28364
  onClick: c,
@@ -28378,7 +28415,7 @@ function fO({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
28378
28415
  borderRadius: "50%",
28379
28416
  border: `1.5px solid ${l}55`
28380
28417
  } }),
28381
- /* @__PURE__ */ g(lO, {
28418
+ /* @__PURE__ */ g(hO, {
28382
28419
  headshot: t,
28383
28420
  name: u,
28384
28421
  size: 38,
@@ -28462,7 +28499,7 @@ function fO({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
28462
28499
  boxShadow: i ? `0 0 0 3px ${l}12` : "none"
28463
28500
  },
28464
28501
  "aria-label": i ? "Unmute" : "Mute",
28465
- children: g(i ? kD : vD, { size: 15 })
28502
+ children: g(i ? FD : wD, { size: 15 })
28466
28503
  }), /* @__PURE__ */ g("button", {
28467
28504
  type: "button",
28468
28505
  onClick: (e) => {
@@ -28490,7 +28527,7 @@ function fO({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
28490
28527
  transition: "all 0.18s ease"
28491
28528
  },
28492
28529
  "aria-label": "End call",
28493
- children: /* @__PURE__ */ g(yD, { size: 16 })
28530
+ children: /* @__PURE__ */ g(TD, { size: 16 })
28494
28531
  })]
28495
28532
  })
28496
28533
  ]
@@ -28498,7 +28535,7 @@ function fO({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
28498
28535
  }
28499
28536
  //#endregion
28500
28537
  //#region src/utils/voicePriorContext.js
28501
- function pO(e, t = {}) {
28538
+ function yO(e, t = {}) {
28502
28539
  let n = t.maxChars ?? 4500;
28503
28540
  if (!Array.isArray(e) || e.length === 0) return "";
28504
28541
  let r = [];
@@ -28514,42 +28551,6 @@ function pO(e, t = {}) {
28514
28551
  return i.length > n && (i = "…(earlier messages omitted)\n" + i.slice(-n)), i;
28515
28552
  }
28516
28553
  //#endregion
28517
- //#region src/utils/actionQueue.js
28518
- var mO = {
28519
- wordsSoFar: 0,
28520
- speechStartTime: 0,
28521
- isSpeaking: !1,
28522
- items: [],
28523
- timers: [],
28524
- lastHighlightId: null,
28525
- isVoiceMode: !1
28526
- };
28527
- function hO() {
28528
- mO.timers.forEach(clearTimeout), mO.wordsSoFar = 0, mO.speechStartTime = 0, mO.isSpeaking = !1, mO.items = [], mO.timers = [], mO.lastHighlightId = null;
28529
- }
28530
- //#endregion
28531
- //#region src/utils/highlightEngine.js
28532
- var gO = 80;
28533
- function _O(e) {
28534
- requestAnimationFrame(() => {
28535
- let t = e.getBoundingClientRect(), n = t.top + t.height / 2, r = gO, i = r + (window.innerHeight - r) / 2, a = window.pageYOffset + n - i;
28536
- window.scrollTo({
28537
- top: Math.max(0, a),
28538
- behavior: "smooth"
28539
- });
28540
- });
28541
- }
28542
- function vO(e) {
28543
- if (!e || e.hasAttribute("data-fe-highlighted")) return;
28544
- yO(), e.classList?.remove("fe-highlight-section", "fe-highlight-speaking", "fe-highlight-exiting"), _O(e);
28545
- let t = e.style.cssText;
28546
- e.setAttribute("data-fe-highlighted", "true"), e.setAttribute("data-fe-orig-style", t), e.style.outline = "3px solid #2563eb", e.style.outlineOffset = "8px", e.style.background = "rgba(37, 99, 235, 0.08)", e.style.borderRadius = "8px", e.style.padding = "12px 16px", e.style.transition = "all 0.4s ease";
28547
- }
28548
- function yO() {
28549
- let e = document.querySelector("[data-fe-highlighted]");
28550
- e && (e.style.cssText = e.getAttribute("data-fe-orig-style") || "", e.removeAttribute("data-fe-highlighted"), e.removeAttribute("data-fe-orig-style"));
28551
- }
28552
- //#endregion
28553
28554
  //#region src/utils/voiceActionVisuals.js
28554
28555
  var Q = "fe-vv";
28555
28556
  function bO() {
@@ -29365,11 +29366,11 @@ function Ck(e) {
29365
29366
  return $("flowengage_navigate ✖ blocked", e), e;
29366
29367
  }
29367
29368
  try {
29368
- wO(`Navigating to ${a}...`, { spinner: !0 }), kO(), hO(), yO();
29369
+ wO(`Navigating to ${a}...`, { spinner: !0 }), kO(), yD(), CD();
29369
29370
  try {
29370
29371
  let e = r ? r() : "";
29371
29372
  if (e && t) {
29372
- let n = pO([{
29373
+ let n = yO([{
29373
29374
  sender: "user",
29374
29375
  message: e
29375
29376
  }]);
@@ -29408,7 +29409,7 @@ function Ck(e) {
29408
29409
  let t = hk(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
29409
29410
  Sk();
29410
29411
  let i = hr(n || null, r || null);
29411
- return !i && r && (await new Promise((e) => setTimeout(e, 500)), Sk(), i = hr(null, r)), i ? (vO(i), $("flowengage_highlight ✓", r || n), `OK_HIGHLIGHT: "${r || n}". WALKTHROUGH: If you are mid-walkthrough and have more sections to cover, continue immediately to the next section — do NOT pause or wait for the visitor to speak between sections.`) : ($("flowengage_highlight ✖ no element for:", r || n), `Could not find "${r || n}" on the current page. Try a shorter phrase matching a visible heading.`);
29412
+ return !i && r && (await new Promise((e) => setTimeout(e, 500)), Sk(), i = hr(null, r)), i ? (SD(i), $("flowengage_highlight ✓", r || n), `OK_HIGHLIGHT: "${r || n}". WALKTHROUGH: If you are mid-walkthrough and have more sections to cover, continue immediately to the next section — do NOT pause or wait for the visitor to speak between sections.`) : ($("flowengage_highlight ✖ no element for:", r || n), `Could not find "${r || n}" on the current page. Try a shorter phrase matching a visible heading.`);
29412
29413
  },
29413
29414
  flowengage_read_content: async (e) => {
29414
29415
  $("flowengage_read_content ▶", e);
@@ -29686,7 +29687,7 @@ function Ak(e, t) {
29686
29687
  return n ? !!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\b(hang\s+up|disconnect)\b/i.test(n) || /\b(that'?s all|we'?re done)\b/i.test(n) || e === "bot" && (/\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n) || /\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n) || /\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n) || /\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n) || /\b(wrapping\s+up|signing\s+off)\b/i.test(n)) || /^(goodbye|bye|that'?s all|we'?re done|hang up|disconnect)\b/i.test(n)) : !1;
29687
29688
  }
29688
29689
  function jk({ orbColors: e, ...t }) {
29689
- return /* @__PURE__ */ g(iO, {
29690
+ return /* @__PURE__ */ g(uO, {
29690
29691
  colors: e,
29691
29692
  ...t
29692
29693
  });
@@ -29994,7 +29995,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
29994
29995
  }, [u]), me = o(async (e) => {
29995
29996
  re.current = !0;
29996
29997
  try {
29997
- _r();
29998
+ CD();
29998
29999
  } catch {}
29999
30000
  try {
30000
30001
  await C.current?.endSession?.();
@@ -30039,7 +30040,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30039
30040
  if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
30040
30041
  u.current = [], w.current = "", ee.current = !1, ne.current = !1, re.current = !1, E.current = "minimized", Or({ onBeforeNavigate: () => {
30041
30042
  if (a && u.current.length > 0) try {
30042
- let e = pO(u.current);
30043
+ let e = yO(u.current);
30043
30044
  e && Ae(a, e);
30044
30045
  } catch {}
30045
30046
  if (!er()) {
@@ -30098,40 +30099,40 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30098
30099
  },
30099
30100
  onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
30100
30101
  onModeChange: ({ mode: t }) => {
30101
- if (e) return;
30102
- if (t === "speaking") {
30103
- de.current &&= (clearTimeout(de.current), null), v("speaking"), ce.current = "speaking", le.current = !0, fe.current = !1, ue.current &&= (clearTimeout(ue.current), null);
30104
- return;
30105
- }
30106
- let n = ce.current;
30107
- if (ce.current = "listening", se.current) {
30108
- se.current = !1, pe();
30109
- return;
30110
- }
30111
- if (oe && !T) {
30112
- T = !0;
30113
- try {
30114
- C.current?.sendUserMessage?.("continue with the tour");
30115
- } catch {}
30116
- }
30117
- n === "speaking" && le.current && !te.current && (ce.current = "thinking", v("thinking")), de.current && clearTimeout(de.current), de.current = setTimeout(() => {
30118
- e || ce.current !== "speaking" && (fe.current || (de.current = null, ce.current = "listening", v("listening"), le.current && !te.current && (ue.current && clearTimeout(ue.current), ue.current = setTimeout(() => {
30119
- if (!e && ce.current === "listening" && !te.current) try {
30120
- C.current?.sendContextualUpdate?.("The visitor has been silent for a while. Ask one short, natural question to re-engage — for example: 'Is there anything specific you'd like to know more about?' or 'What else can I help you with today?' Keep it to one sentence.");
30102
+ if (!e) {
30103
+ if (t === "speaking") {
30104
+ de.current &&= (clearTimeout(de.current), null), v("speaking"), ce.current = "speaking", le.current = !0, fe.current = !1, ue.current &&= (clearTimeout(ue.current), null);
30105
+ return;
30106
+ }
30107
+ if (ce.current = "listening", se.current) {
30108
+ se.current = !1, pe();
30109
+ return;
30110
+ }
30111
+ if (oe && !T) {
30112
+ T = !0;
30113
+ try {
30114
+ C.current?.sendUserMessage?.("continue with the tour");
30121
30115
  } catch {}
30122
- }, 4e3))));
30123
- }, 1200);
30116
+ }
30117
+ de.current && clearTimeout(de.current), de.current = setTimeout(() => {
30118
+ e || ce.current !== "speaking" && (fe.current || (de.current = null, ce.current = "listening", v("listening"), le.current && !te.current && (ue.current && clearTimeout(ue.current), ue.current = setTimeout(() => {
30119
+ if (!e && ce.current === "listening" && !te.current) try {
30120
+ C.current?.sendContextualUpdate?.("The visitor has been silent for a while. Ask one short, natural question to re-engage — for example: 'Is there anything specific you'd like to know more about?' or 'What else can I help you with today?' Keep it to one sentence.");
30121
+ } catch {}
30122
+ }, 4e3))));
30123
+ }, 1200);
30124
+ }
30124
30125
  },
30125
30126
  onMessage: (t) => {
30126
30127
  if (e) return;
30127
30128
  let n = t.role === "user" ? "user" : "bot", r = t.message || t.text || t.content || "";
30128
30129
  if (r) {
30129
- if (n === "user" && (w.current = r, fe.current = !0, de.current &&= (clearTimeout(de.current), null), ce.current = "thinking", v("thinking"), ue.current &&= (clearTimeout(ue.current), null)), u.current = [...u.current, {
30130
+ if (n === "user" && (w.current = r, fe.current = !0, de.current &&= (clearTimeout(de.current), null), ce.current = "thinking", ue.current &&= (clearTimeout(ue.current), null)), u.current = [...u.current, {
30130
30131
  sender: n,
30131
30132
  message: r,
30132
30133
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
30133
30134
  }], a) try {
30134
- let e = pO(u.current);
30135
+ let e = yO(u.current);
30135
30136
  e && Ae(a, e);
30136
30137
  } catch {}
30137
30138
  if (Ak(n, r)) {
@@ -30377,7 +30378,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30377
30378
  y2: "23"
30378
30379
  })
30379
30380
  ]
30380
- }) : /* @__PURE__ */ g(vD, {
30381
+ }) : /* @__PURE__ */ g(wD, {
30381
30382
  size: 16,
30382
30383
  color: "currentColor"
30383
30384
  })
@@ -30399,7 +30400,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30399
30400
  padding: 0,
30400
30401
  flexShrink: 0
30401
30402
  },
30402
- children: /* @__PURE__ */ g(ED, {
30403
+ children: /* @__PURE__ */ g(MD, {
30403
30404
  size: 16,
30404
30405
  color: "currentColor"
30405
30406
  })
@@ -30448,7 +30449,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30448
30449
  onMouseLeave: (e) => {
30449
30450
  e.currentTarget.style.background = "none";
30450
30451
  },
30451
- children: [/* @__PURE__ */ g(DD, {}), "Enter Chat Mode"]
30452
+ children: [/* @__PURE__ */ g(ND, {}), "Enter Chat Mode"]
30452
30453
  }),
30453
30454
  /* @__PURE__ */ _("button", {
30454
30455
  onClick: () => {
@@ -30477,7 +30478,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30477
30478
  onMouseLeave: (e) => {
30478
30479
  e.currentTarget.style.background = "none";
30479
30480
  },
30480
- children: [/* @__PURE__ */ g(OD, {}), "End Conversation"]
30481
+ children: [/* @__PURE__ */ g(PD, {}), "End Conversation"]
30481
30482
  }),
30482
30483
  /* @__PURE__ */ g("button", {
30483
30484
  onClick: () => S(!1),
@@ -30995,7 +30996,7 @@ function Lk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30995
30996
  })
30996
30997
  ]
30997
30998
  }),
30998
- /* @__PURE__ */ g(YD, {
30999
+ /* @__PURE__ */ g(tO, {
30999
31000
  webRTCError: fe,
31000
31001
  micError: pe,
31001
31002
  setMicError: me,
@@ -31003,7 +31004,7 @@ function Lk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31003
31004
  isRateLimited: ee,
31004
31005
  rateLimitMessage: te
31005
31006
  }),
31006
- Se && /* @__PURE__ */ g(fO, {
31007
+ Se && /* @__PURE__ */ g(vO, {
31007
31008
  agentName: v,
31008
31009
  agentHeadshot: y,
31009
31010
  fallbackAgentName: b,
@@ -31195,7 +31196,7 @@ function Lk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31195
31196
  children: "No previous chats found."
31196
31197
  })
31197
31198
  })]
31198
- }) : null, Ne ? /* @__PURE__ */ g(qD, {
31199
+ }) : null, Ne ? /* @__PURE__ */ g($D, {
31199
31200
  chatHistory: l,
31200
31201
  isAiTyping: u,
31201
31202
  isLoading: T,
@@ -31337,7 +31338,7 @@ function Lk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31337
31338
  zIndex: 1,
31338
31339
  padding: oe ? "6px 0 0" : "12px 0 0"
31339
31340
  },
31340
- children: /* @__PURE__ */ g(JD, {
31341
+ children: /* @__PURE__ */ g(eO, {
31341
31342
  input: x,
31342
31343
  setInput: S,
31343
31344
  onSubmit: C,
@@ -31470,7 +31471,7 @@ function Rk() {
31470
31471
  let Ft = o(() => {
31471
31472
  St(null), wt("");
31472
31473
  }, []), It = o((e) => {
31473
- let t = HD(e);
31474
+ let t = JD(e);
31474
31475
  if (t) {
31475
31476
  St(null), wt(t);
31476
31477
  return;
@@ -31576,7 +31577,7 @@ function Rk() {
31576
31577
  if (xt) {
31577
31578
  try {
31578
31579
  Et(!0), wt("");
31579
- let e = await se(xt), n = e?.data || e, r = ct.trim() || `Shared file: ${WD(xt)}`;
31580
+ let e = await se(xt), n = e?.data || e, r = ct.trim() || `Shared file: ${XD(xt)}`;
31580
31581
  lt(""), dt(null), Ft(), await D(r, "", t, {
31581
31582
  type: "file",
31582
31583
  metadata: {
@@ -31781,7 +31782,7 @@ function Rk() {
31781
31782
  onMessageSync: oe,
31782
31783
  voiceEndCounter: Oe
31783
31784
  }, "voice"),
31784
- A === "call_screen" && /* @__PURE__ */ g(dO, {
31785
+ A === "call_screen" && /* @__PURE__ */ g(_O, {
31785
31786
  incomingCall: w,
31786
31787
  activeCallId: T,
31787
31788
  callConnectionState: ee,
@@ -31880,4 +31881,4 @@ var zk = class extends e.Component {
31880
31881
  }
31881
31882
  };
31882
31883
  //#endregion
31883
- export { iO as AnimatedOrb, zk as ErrorBoundary, Lr as FlowEngageProvider, Rk as FlowEngageWidget, Ln as useFlowEngage };
31884
+ export { uO as AnimatedOrb, zk as ErrorBoundary, Lr as FlowEngageProvider, Rk as FlowEngageWidget, Ln as useFlowEngage };