@flowengage/react-chatbot 8.0.104 → 8.0.106

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.
@@ -9247,7 +9247,7 @@ function dh(e) {
9247
9247
  for (let n = 0; n < e.length; n++) t[n] = e[n] / 32768;
9248
9248
  return t;
9249
9249
  }
9250
- var fh = .09, ph = ["audio/webm", "audio/mp4"];
9250
+ var fh = .13, ph = ["audio/webm", "audio/mp4"];
9251
9251
  function mh() {
9252
9252
  return typeof window > "u" || window.MediaRecorder === void 0 ? null : ph.find((e) => window.MediaRecorder.isTypeSupported(e)) || null;
9253
9253
  }
@@ -9261,11 +9261,13 @@ function hh(e, t, n, r, i) {
9261
9261
  if (!e.ok) throw Error(`HTTP ${e.status}`);
9262
9262
  }).catch((e) => console.warn("[FlowEngage] voice recording upload failed:", e.message));
9263
9263
  }
9264
- function gh(e, t, n) {
9264
+ var gh = .02;
9265
+ function _h(e, t, n) {
9265
9266
  let r = 0, i = 0, a = [], o = () => {
9266
- a.forEach((e) => {
9267
+ let t = e.currentTime;
9268
+ a.forEach(({ source: e, gain: n }) => {
9267
9269
  try {
9268
- e.stop();
9270
+ n.gain.cancelScheduledValues(t), n.gain.setValueAtTime(n.gain.value, t), n.gain.linearRampToValueAtTime(0, t + gh), e.stop(t + gh);
9269
9271
  } catch {}
9270
9272
  }), a = [], r = 0;
9271
9273
  }, s = () => r > e.currentTime;
@@ -9274,10 +9276,17 @@ function gh(e, t, n) {
9274
9276
  let c = dh(o), l = e.createBuffer(1, c.length, th);
9275
9277
  l.copyToChannel(c, 0);
9276
9278
  let u = e.createBufferSource();
9277
- u.buffer = l, u.connect(e.destination), n && u.connect(n);
9278
- let d = !s(), f = d ? e.currentTime + fh : r;
9279
- d && (i = f), u.start(f), r = f + l.duration, a.push(u), u.onended = () => {
9280
- a = a.filter((e) => e !== u), !a.length && !s() && t?.();
9279
+ u.buffer = l;
9280
+ let d = e.createGain();
9281
+ u.connect(d), d.connect(e.destination), n && d.connect(n);
9282
+ let f = !s(), p = f ? e.currentTime + fh : r;
9283
+ f && (i = p), u.start(p), r = p + l.duration;
9284
+ let m = {
9285
+ source: u,
9286
+ gain: d
9287
+ };
9288
+ a.push(m), u.onended = () => {
9289
+ a = a.filter((e) => e !== m), !a.length && !s() && t?.();
9281
9290
  };
9282
9291
  },
9283
9292
  stop: o,
@@ -9285,7 +9294,7 @@ function gh(e, t, n) {
9285
9294
  playedMs: () => Math.max(0, (e.currentTime - i) * 1e3)
9286
9295
  };
9287
9296
  }
9288
- async function _h(e, t, n) {
9297
+ async function vh(e, t, n) {
9289
9298
  let r = new URLSearchParams({ siteId: t || "" });
9290
9299
  n && r.set("chatId", n);
9291
9300
  let i = Fr();
@@ -9303,8 +9312,8 @@ async function _h(e, t, n) {
9303
9312
  if (!o?.success || !o.wsUrl) throw Error(o?.error || "Voice session was refused.");
9304
9313
  return o;
9305
9314
  }
9306
- async function vh(e) {
9307
- let { apiBaseUrl: t, siteId: n, chatId: r, clientTools: i = {}, onConnect: a, onDisconnect: o, onMessage: s, onModeChange: c, onError: l, onUnhandledClientToolCall: u, onAgentTurnEnd: d, onSessionInfo: f, onSessionEnding: p } = e, m = await _h(t, n, r);
9315
+ async function yh(e) {
9316
+ let { apiBaseUrl: t, siteId: n, chatId: r, clientTools: i = {}, onConnect: a, onDisconnect: o, onMessage: s, onModeChange: c, onError: l, onUnhandledClientToolCall: u, onAgentTurnEnd: d, onSessionInfo: f, onSessionEnding: p } = e, m = await vh(t, n, r);
9308
9317
  f?.({ emailOnFile: !!m.emailOnFile });
9309
9318
  let h = { type: "Start" };
9310
9319
  e.greeting !== void 0 && (h.greeting = e.greeting || null);
@@ -9361,7 +9370,7 @@ async function vh(e) {
9361
9370
  }
9362
9371
  };
9363
9372
  N = setTimeout(e, 150);
9364
- }, le = gh(_, () => {
9373
+ }, le = _h(_, () => {
9365
9374
  te && (te = !1, c?.({ mode: "listening" }));
9366
9375
  }, v);
9367
9376
  typeof window < "u" && (window.__fe_agentAudioPlaying = () => le.isPlaying());
@@ -9536,7 +9545,7 @@ async function vh(e) {
9536
9545
  }
9537
9546
  };
9538
9547
  }
9539
- var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9548
+ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9540
9549
  width: e,
9541
9550
  height: e,
9542
9551
  viewBox: "0 0 24 24",
@@ -9552,7 +9561,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9552
9561
  strokeLinecap: "round",
9553
9562
  strokeLinejoin: "round"
9554
9563
  })]
9555
- }), xh = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
9564
+ }), Sh = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
9556
9565
  width: e,
9557
9566
  height: e,
9558
9567
  viewBox: "0 0 24 24",
@@ -9567,7 +9576,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9567
9576
  x2: "1",
9568
9577
  y2: "23"
9569
9578
  })]
9570
- }), Sh = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
9579
+ }), Ch = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
9571
9580
  width: e,
9572
9581
  height: e,
9573
9582
  viewBox: "0 0 24 24",
@@ -9582,7 +9591,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9582
9591
  x2: "12",
9583
9592
  y2: "5"
9584
9593
  }), /* @__PURE__ */ g("polyline", { points: "5 12 12 5 19 12" })]
9585
- }), Ch = () => /* @__PURE__ */ _("svg", {
9594
+ }), wh = () => /* @__PURE__ */ _("svg", {
9586
9595
  width: "14",
9587
9596
  height: "14",
9588
9597
  viewBox: "0 0 24 24",
@@ -9592,7 +9601,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9592
9601
  strokeLinecap: "round",
9593
9602
  strokeLinejoin: "round",
9594
9603
  children: [/* @__PURE__ */ g("polyline", { points: "9 17 4 12 9 7" }), /* @__PURE__ */ g("path", { d: "M20 18v-2a4 4 0 00-4-4H4" })]
9595
- }), wh = () => /* @__PURE__ */ g("svg", {
9604
+ }), Th = () => /* @__PURE__ */ g("svg", {
9596
9605
  width: "18",
9597
9606
  height: "18",
9598
9607
  viewBox: "0 0 24 24",
@@ -9602,7 +9611,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9602
9611
  strokeLinecap: "round",
9603
9612
  strokeLinejoin: "round",
9604
9613
  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" })
9605
- }), Th = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
9614
+ }), Eh = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
9606
9615
  className: e,
9607
9616
  width: "14",
9608
9617
  height: "14",
@@ -9631,7 +9640,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9631
9640
  y2: "16"
9632
9641
  })
9633
9642
  ]
9634
- }), Eh = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
9643
+ }), Dh = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
9635
9644
  width: e,
9636
9645
  height: e,
9637
9646
  viewBox: "0 0 24 24",
@@ -9654,7 +9663,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9654
9663
  /* @__PURE__ */ g("path", { d: "M15 13v2" }),
9655
9664
  /* @__PURE__ */ g("path", { d: "M9 13v2" })
9656
9665
  ]
9657
- }), Dh = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
9666
+ }), Oh = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
9658
9667
  width: e,
9659
9668
  height: e,
9660
9669
  viewBox: "0 0 24 24",
@@ -9674,7 +9683,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9674
9683
  x2: "19",
9675
9684
  y2: "12"
9676
9685
  })]
9677
- }), Oh = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9686
+ }), kh = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9678
9687
  width: e,
9679
9688
  height: e,
9680
9689
  viewBox: "0 0 24 24",
@@ -9700,7 +9709,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9700
9709
  fill: t
9701
9710
  })
9702
9711
  ]
9703
- }), kh = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9712
+ }), Ah = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9704
9713
  width: "24",
9705
9714
  height: "24",
9706
9715
  viewBox: "0 0 24 24",
@@ -9718,7 +9727,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9718
9727
  "stroke-linecap": "round",
9719
9728
  "stroke-linejoin": "round"
9720
9729
  })]
9721
- }), Ah = () => /* @__PURE__ */ g("svg", {
9730
+ }), jh = () => /* @__PURE__ */ g("svg", {
9722
9731
  width: "24",
9723
9732
  height: "24",
9724
9733
  viewBox: "0 0 24 24",
@@ -9730,7 +9739,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9730
9739
  "stroke-width": "1.5",
9731
9740
  "stroke-linejoin": "round"
9732
9741
  })
9733
- }), jh = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
9742
+ }), Mh = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
9734
9743
  xmlns: "http://www.w3.org/2000/svg",
9735
9744
  width: e,
9736
9745
  height: e,
@@ -9748,7 +9757,7 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9748
9757
  /* @__PURE__ */ g("path", { d: "m2 2 20 20" }),
9749
9758
  /* @__PURE__ */ g("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12" })
9750
9759
  ]
9751
- }), Mh = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), Nh = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), Ph = new Set([
9760
+ }), Nh = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), Ph = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), Fh = new Set([
9752
9761
  "p",
9753
9762
  "br",
9754
9763
  "ul",
@@ -9759,30 +9768,30 @@ var yh = { startSession: vh }, bh = ({ size: e = 18, color: t = "currentColor" }
9759
9768
  "b",
9760
9769
  "i",
9761
9770
  "a"
9762
- ]), Fh = /^https?:\/\//i;
9763
- function Ih(e) {
9771
+ ]), Ih = /^https?:\/\//i;
9772
+ function Lh(e) {
9764
9773
  let t = Array.from(e.childNodes);
9765
9774
  for (let n of t) if (n.nodeType === Node.ELEMENT_NODE) {
9766
9775
  let t = n.tagName.toLowerCase();
9767
- if (!Ph.has(t)) {
9776
+ if (!Fh.has(t)) {
9768
9777
  e.replaceChild(document.createTextNode(n.textContent), n);
9769
9778
  continue;
9770
9779
  }
9771
9780
  let r = {};
9772
9781
  if (t === "a") {
9773
9782
  let e = n.getAttribute("href") || "";
9774
- Fh.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
9783
+ Ih.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
9775
9784
  }
9776
9785
  for (; n.attributes.length > 0;) n.removeAttribute(n.attributes[0].name);
9777
9786
  for (let [e, t] of Object.entries(r)) n.setAttribute(e, t);
9778
- Ih(n);
9787
+ Lh(n);
9779
9788
  } else n.nodeType !== Node.TEXT_NODE && e.removeChild(n);
9780
9789
  }
9781
- function Lh(e) {
9790
+ function Rh(e) {
9782
9791
  let t = document.createElement("div");
9783
- return t.innerHTML = e, Ih(t), t.innerHTML;
9792
+ return t.innerHTML = e, Lh(t), t.innerHTML;
9784
9793
  }
9785
- function Rh(e) {
9794
+ function zh(e) {
9786
9795
  let t = String(e || "").trim();
9787
9796
  if (!t) return t;
9788
9797
  let n = /^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);
@@ -9794,33 +9803,33 @@ function Rh(e) {
9794
9803
  }
9795
9804
  return e;
9796
9805
  }
9797
- var zh = (e = "") => {
9806
+ var Bh = (e = "") => {
9798
9807
  let t = String(e || "").trim();
9799
9808
  if (!t) return "";
9800
- if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return Rh(Lh(t));
9801
- 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) => Nh(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>");
9802
- return Rh(n.map((e) => {
9809
+ if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return zh(Rh(t));
9810
+ 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) => Ph(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>");
9811
+ return zh(n.map((e) => {
9803
9812
  let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = t.filter((e) => /^[-*]\s+/.test(e));
9804
9813
  if (n.length >= 2 && n.length === t.length) return `<ul>${n.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>`;
9805
9814
  let i = e.split(/\s+(?=[-*]\s+\*\*?)/).map((e) => e.trim()).filter(Boolean);
9806
9815
  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>`;
9807
9816
  }).join(""));
9808
- }, Bh = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), Vh = new Set([
9817
+ }, Vh = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), Hh = new Set([
9809
9818
  ".pdf",
9810
9819
  ".docx",
9811
9820
  ".png",
9812
9821
  ".jpg",
9813
9822
  ".jpeg"
9814
- ]), Hh = "image/png,image/jpeg,.pdf,.docx";
9815
- function Uh(e) {
9823
+ ]), Uh = "image/png,image/jpeg,.pdf,.docx";
9824
+ function Wh(e) {
9816
9825
  if (!e) return !1;
9817
9826
  let t = typeof e.name == "string" ? e.name.toLowerCase() : "", n = t.includes(".") ? `.${t.split(".").pop()}` : "", r = typeof e.type == "string" ? e.type.toLowerCase() : "";
9818
- return r === "image/png" || r === "image/jpeg" || Bh.has(r) || Vh.has(n);
9827
+ return r === "image/png" || r === "image/jpeg" || Vh.has(r) || Hh.has(n);
9819
9828
  }
9820
- function Wh(e) {
9821
- return e ? Uh(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
9829
+ function Gh(e) {
9830
+ return e ? Wh(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
9822
9831
  }
9823
- function Gh(e = 0) {
9832
+ function Kh(e = 0) {
9824
9833
  if (!Number.isFinite(e) || e <= 0) return "";
9825
9834
  let t = [
9826
9835
  "B",
@@ -9832,12 +9841,12 @@ function Gh(e = 0) {
9832
9841
  let i = n >= 10 || r === 0 ? 0 : 1;
9833
9842
  return `${n.toFixed(i)} ${t[r]}`;
9834
9843
  }
9835
- function Kh(e) {
9844
+ function qh(e) {
9836
9845
  return e ? e.name || "Attachment" : "";
9837
9846
  }
9838
9847
  //#endregion
9839
9848
  //#region src/utils/avatarHelpers.js
9840
- function qh(e) {
9849
+ function Jh(e) {
9841
9850
  if (!e || typeof e != "string") return "?";
9842
9851
  let t = e.trim();
9843
9852
  if (!t) return "?";
@@ -9846,7 +9855,7 @@ function qh(e) {
9846
9855
  }
9847
9856
  //#endregion
9848
9857
  //#region src/components/AvatarImageOrInitials.jsx
9849
- function Jh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9858
+ function Yh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9850
9859
  let [i, a] = m(null), o = typeof e == "string" ? e.trim() : "";
9851
9860
  return c(() => {
9852
9861
  if (!o) {
@@ -9869,12 +9878,12 @@ function Jh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9869
9878
  onError: () => a(null)
9870
9879
  }) : /* @__PURE__ */ g("span", {
9871
9880
  style: r,
9872
- children: qh(t)
9881
+ children: Jh(t)
9873
9882
  });
9874
9883
  }
9875
9884
  //#endregion
9876
9885
  //#region src/components/MessageList.jsx
9877
- function Yh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
9886
+ function Xh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
9878
9887
  let { resolvedConfig: d } = Cn(), f = p(null), [v, y] = m(null), [b, x] = m(null), S = p(e.length), C = p(!0), w = p(null), T = o((e) => {
9879
9888
  let t = e.target.closest("a[href]");
9880
9889
  if (!t) return;
@@ -9929,7 +9938,7 @@ function Yh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9929
9938
  children: [
9930
9939
  e.map((e) => {
9931
9940
  if (e.type === "call_recording" || typeof e.message == "string" && e.message.includes("AI chat recording")) return null;
9932
- 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 = Mh(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
9941
+ 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 = Nh(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
9933
9942
  return t ? /* @__PURE__ */ g("div", {
9934
9943
  style: {
9935
9944
  display: "flex",
@@ -9974,7 +9983,7 @@ function Yh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9974
9983
  fontWeight: 800,
9975
9984
  marginTop: !c && (r || o) ? "22px" : "0px"
9976
9985
  },
9977
- children: r ? u || /* @__PURE__ */ g(Eh, { size: 16 }) : /* @__PURE__ */ g(Jh, {
9986
+ children: r ? u || /* @__PURE__ */ g(Dh, { size: 16 }) : /* @__PURE__ */ g(Yh, {
9978
9987
  src: p || "",
9979
9988
  name: f,
9980
9989
  imgStyle: {
@@ -10016,7 +10025,7 @@ function Yh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10016
10025
  onMouseLeave: (e) => {
10017
10026
  e.currentTarget.style.color = "#9ca3af";
10018
10027
  },
10019
- children: [/* @__PURE__ */ g(Ch, {}), "Reply"]
10028
+ children: [/* @__PURE__ */ g(wh, {}), "Reply"]
10020
10029
  }),
10021
10030
  /* @__PURE__ */ _("div", {
10022
10031
  style: {
@@ -10060,7 +10069,7 @@ function Yh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10060
10069
  children: m
10061
10070
  })]
10062
10071
  }), d ? (() => {
10063
- let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = Gh(e.metadata.fileSize), a = t.startsWith("image/"), o = `shared file: ${r}`.toLowerCase(), s = (e.message || "").trim(), c = s && s.toLowerCase() !== o && !s.toLowerCase().startsWith("shared file:"), l = t === "application/pdf" ? {
10072
+ let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = Kh(e.metadata.fileSize), a = t.startsWith("image/"), o = `shared file: ${r}`.toLowerCase(), s = (e.message || "").trim(), c = s && s.toLowerCase() !== o && !s.toLowerCase().startsWith("shared file:"), l = t === "application/pdf" ? {
10064
10073
  color: "#ef4444",
10065
10074
  label: "PDF"
10066
10075
  } : t.includes("word") || t.includes("docx") ? {
@@ -10241,7 +10250,7 @@ function Yh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10241
10250
  });
10242
10251
  })() : r ? /* @__PURE__ */ g("div", {
10243
10252
  className: "flowengage-message-content fe-bot-message",
10244
- dangerouslySetInnerHTML: { __html: zh(e.message) },
10253
+ dangerouslySetInnerHTML: { __html: Bh(e.message) },
10245
10254
  onClick: T
10246
10255
  }) : /* @__PURE__ */ g("div", {
10247
10256
  style: { whiteSpace: "pre-wrap" },
@@ -10306,7 +10315,7 @@ function Yh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10306
10315
  boxShadow: u ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
10307
10316
  overflow: "hidden"
10308
10317
  },
10309
- children: u || /* @__PURE__ */ g(Eh, { size: 16 })
10318
+ children: u || /* @__PURE__ */ g(Dh, { size: 16 })
10310
10319
  }), /* @__PURE__ */ _("div", {
10311
10320
  style: {
10312
10321
  display: "flex",
@@ -10348,7 +10357,7 @@ function Yh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10348
10357
  borderRadius: "50%",
10349
10358
  overflow: "hidden"
10350
10359
  },
10351
- children: /* @__PURE__ */ g(Jh, {
10360
+ children: /* @__PURE__ */ g(Yh, {
10352
10361
  src: s || "",
10353
10362
  name: l,
10354
10363
  imgStyle: {
@@ -10442,22 +10451,22 @@ function Yh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10442
10451
  }
10443
10452
  //#endregion
10444
10453
  //#region src/components/ChatInput.jsx
10445
- var Xh = typeof window < "u" && (window.matchMedia?.("(pointer: coarse)").matches || navigator.maxTouchPoints > 0);
10446
- function Zh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: l, clearReplyContext: u, requiresEmail: d, emailInput: f, setEmailInput: m, emailError: v, showVoiceToggle: y = !1, voiceEnabled: b = !0, onFileSelect: x, selectedFile: S = null, onRemoveSelectedFile: C, attachmentError: w = "", isUploadingAttachment: T = !1, inputPlaceholder: E = "Type your message" }) {
10454
+ var Zh = typeof window < "u" && (window.matchMedia?.("(pointer: coarse)").matches || navigator.maxTouchPoints > 0);
10455
+ function Qh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: l, clearReplyContext: u, requiresEmail: d, emailInput: f, setEmailInput: m, emailError: v, showVoiceToggle: y = !1, voiceEnabled: b = !0, onFileSelect: x, selectedFile: S = null, onRemoveSelectedFile: C, attachmentError: w = "", isUploadingAttachment: T = !1, inputPlaceholder: E = "Type your message" }) {
10447
10456
  let D = p(null), O = p(null), k = (e) => {
10448
10457
  e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 120)}px`);
10449
10458
  };
10450
10459
  c(() => {
10451
10460
  d || k(O.current);
10452
10461
  }, [e, d]), c(() => {
10453
- d || Xh || e || s || O.current?.focus();
10462
+ d || Zh || e || s || O.current?.focus();
10454
10463
  }, [
10455
10464
  e,
10456
10465
  d,
10457
10466
  s
10458
10467
  ]);
10459
10468
  let A = (e) => {
10460
- e.key === "Enter" && (Xh || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), e.currentTarget.form?.requestSubmit()));
10469
+ e.key === "Enter" && (Zh || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), e.currentTarget.form?.requestSubmit()));
10461
10470
  }, ee = l?.sender === "user" ? "You" : l?.sender === "agent" ? "Agent" : "AI Assistant", te = d ? !!f?.trim() : !!e?.trim() || !!S, ne = s || T || !te, j = !d && b && y;
10462
10471
  return /* @__PURE__ */ _("div", {
10463
10472
  style: {
@@ -10552,7 +10561,7 @@ function Zh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10552
10561
  background: "rgba(59,130,246,0.08)",
10553
10562
  color: "var(--flowengage-primary)"
10554
10563
  },
10555
- children: /* @__PURE__ */ g(Eh, { size: 13 })
10564
+ children: /* @__PURE__ */ g(Dh, { size: 13 })
10556
10565
  }), /* @__PURE__ */ g("span", { children: "Please provide your email address so we can help you." })]
10557
10566
  })
10558
10567
  }),
@@ -10592,7 +10601,7 @@ function Zh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10592
10601
  overflow: "hidden",
10593
10602
  textOverflow: "ellipsis"
10594
10603
  },
10595
- children: Kh(S)
10604
+ children: qh(S)
10596
10605
  }),
10597
10606
  /* @__PURE__ */ g("div", {
10598
10607
  style: {
@@ -10600,7 +10609,7 @@ function Zh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10600
10609
  color: "#6b7280",
10601
10610
  marginTop: "2px"
10602
10611
  },
10603
- children: Gh(S.size)
10612
+ children: Kh(S.size)
10604
10613
  })
10605
10614
  ]
10606
10615
  }), /* @__PURE__ */ g("button", {
@@ -10645,7 +10654,7 @@ function Zh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10645
10654
  j ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("input", {
10646
10655
  ref: D,
10647
10656
  type: "file",
10648
- accept: Hh,
10657
+ accept: Uh,
10649
10658
  style: { display: "none" },
10650
10659
  onChange: (e) => {
10651
10660
  let t = e.target.files?.[0];
@@ -10677,7 +10686,7 @@ function Zh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10677
10686
  onMouseLeave: (e) => {
10678
10687
  e.currentTarget.style.opacity = "1";
10679
10688
  },
10680
- children: /* @__PURE__ */ g(Dh, {
10689
+ children: /* @__PURE__ */ g(Oh, {
10681
10690
  size: 16,
10682
10691
  color: "currentColor"
10683
10692
  })
@@ -10758,7 +10767,7 @@ function Zh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10758
10767
  onMouseLeave: (e) => {
10759
10768
  e.currentTarget.style.opacity = "1";
10760
10769
  },
10761
- children: /* @__PURE__ */ g(Sh, { size: 16 })
10770
+ children: /* @__PURE__ */ g(Ch, { size: 16 })
10762
10771
  })
10763
10772
  ]
10764
10773
  }),
@@ -10821,7 +10830,7 @@ function Zh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10821
10830
  }
10822
10831
  //#endregion
10823
10832
  //#region src/components/StatusBanners.jsx
10824
- function Qh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
10833
+ function $h({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
10825
10834
  return /* @__PURE__ */ _(h, { children: [(e || t) && /* @__PURE__ */ _("div", {
10826
10835
  style: {
10827
10836
  margin: "0 20px 10px",
@@ -10834,7 +10843,7 @@ function Qh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
10834
10843
  gap: "10px"
10835
10844
  },
10836
10845
  children: [
10837
- /* @__PURE__ */ g(Th, { className: "" }),
10846
+ /* @__PURE__ */ g(Eh, { className: "" }),
10838
10847
  /* @__PURE__ */ g("span", {
10839
10848
  style: {
10840
10849
  fontSize: "12px",
@@ -10880,13 +10889,13 @@ function Qh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
10880
10889
  }
10881
10890
  //#endregion
10882
10891
  //#region src/components/AnimatedOrb.jsx
10883
- var $h = [
10892
+ var eg = [
10884
10893
  "#135bd8",
10885
10894
  "#ef334b",
10886
10895
  "#ffbd2e"
10887
10896
  ];
10888
- function eg(e) {
10889
- return !Array.isArray(e) || e.length === 0 ? $h : e.length === 1 ? [
10897
+ function tg(e) {
10898
+ return !Array.isArray(e) || e.length === 0 ? eg : e.length === 1 ? [
10890
10899
  e[0],
10891
10900
  e[0],
10892
10901
  e[0]
@@ -10900,7 +10909,7 @@ function eg(e) {
10900
10909
  e[2]
10901
10910
  ];
10902
10911
  }
10903
- var tg = {
10912
+ var ng = {
10904
10913
  idle: 3,
10905
10914
  listening: .75,
10906
10915
  thinking: 1,
@@ -10908,7 +10917,7 @@ var tg = {
10908
10917
  muted: .75,
10909
10918
  error: .08
10910
10919
  };
10911
- function ng(e) {
10920
+ function rg(e) {
10912
10921
  if (!e || typeof e != "string") return [
10913
10922
  0,
10914
10923
  0,
@@ -10921,14 +10930,14 @@ function ng(e) {
10921
10930
  parseInt(n.slice(4, 6), 16) / 255
10922
10931
  ];
10923
10932
  }
10924
- function rg(e, t) {
10933
+ function ig(e, t) {
10925
10934
  if (!e || typeof e != "string") return `rgba(0,0,0,${t})`;
10926
10935
  if (e.startsWith("rgb")) return e.replace(/[\d.]+\)$/, `${t})`);
10927
10936
  let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
10928
10937
  return `rgba(${parseInt(r.slice(0, 2), 16)},${parseInt(r.slice(2, 4), 16)},${parseInt(r.slice(4, 6), 16)},${t})`;
10929
10938
  }
10930
- var ig = "\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", ag = "\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";
10931
- function og(e, t, n) {
10939
+ var ag = "\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", og = "\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";
10940
+ function sg(e, t, n) {
10932
10941
  let r = (t, n) => {
10933
10942
  let r = e.createShader(t);
10934
10943
  return e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("[AnimatedOrb shader]", e.getShaderInfoLog(r)), null);
@@ -10937,10 +10946,10 @@ function og(e, t, n) {
10937
10946
  let o = e.createProgram();
10938
10947
  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);
10939
10948
  }
10940
- function sg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
10941
- let [s, l, u] = eg(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(tg[t] ?? .35);
10949
+ function cg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
10950
+ let [s, l, u] = tg(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(ng[t] ?? .35);
10942
10951
  c(() => {
10943
- h.current = tg[t] ?? .35;
10952
+ h.current = ng[t] ?? .35;
10944
10953
  }, [t]), c(() => {
10945
10954
  let t = m.current;
10946
10955
  if (!t) return;
@@ -10957,7 +10966,7 @@ function sg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10957
10966
  console.warn("[AnimatedOrb] WebGL unavailable.");
10958
10967
  return;
10959
10968
  }
10960
- let i = og(r, ig, ag);
10969
+ let i = sg(r, ag, og);
10961
10970
  if (!i) {
10962
10971
  console.error("[AnimatedOrb] WebGL program failed to compile/link");
10963
10972
  return;
@@ -10987,7 +10996,7 @@ function sg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10987
10996
  c2: r.getUniformLocation(i, "u_c2"),
10988
10997
  c3: r.getUniformLocation(i, "u_c3")
10989
10998
  };
10990
- r.uniform3fv(c.c1, ng(s)), r.uniform3fv(c.c2, ng(l)), r.uniform3fv(c.c3, ng(u)), r.viewport(0, 0, t.width, t.height);
10999
+ r.uniform3fv(c.c1, rg(s)), r.uniform3fv(c.c2, rg(l)), r.uniform3fv(c.c3, rg(u)), r.viewport(0, 0, t.width, t.height);
10991
11000
  let d = performance.now(), f, p = (e) => {
10992
11001
  r.uniform1f(c.time, (e - d) / 1e3), r.uniform1f(c.speed, h.current), r.drawArrays(r.TRIANGLES, 0, 6), f = requestAnimationFrame(p);
10993
11002
  };
@@ -11018,7 +11027,7 @@ function sg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
11018
11027
  position: "absolute",
11019
11028
  inset: -10,
11020
11029
  borderRadius: "50%",
11021
- background: `radial-gradient(circle, ${rg(s, .18)} 0%, transparent 70%)`,
11030
+ background: `radial-gradient(circle, ${ig(s, .18)} 0%, transparent 70%)`,
11022
11031
  pointerEvents: "none"
11023
11032
  },
11024
11033
  animate: { opacity: [.3, .75] },
@@ -11096,17 +11105,17 @@ function sg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
11096
11105
  }
11097
11106
  //#endregion
11098
11107
  //#region src/components/CallScreen.jsx
11099
- var cg = "\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";
11100
- function lg(e) {
11108
+ var lg = "\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";
11109
+ function ug(e) {
11101
11110
  let t = (e || "").replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
11102
11111
  return `${parseInt(n.slice(0, 2), 16)},${parseInt(n.slice(2, 4), 16)},${parseInt(n.slice(4, 6), 16)}`;
11103
11112
  }
11104
- function ug(e) {
11113
+ function dg(e) {
11105
11114
  if (!e || typeof e != "string") return "#1a1a1a";
11106
11115
  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;
11107
11116
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
11108
11117
  }
11109
- function dg(e, t) {
11118
+ function fg(e, t) {
11110
11119
  let n = Array.isArray(e) && e.length > 0 ? e : [t || "#3B82F6"], [r, i, a] = n;
11111
11120
  return n.length === 1 ? [
11112
11121
  `radial-gradient(ellipse 110% 65% at 50% -5%, ${r}28 0%, transparent 68%)`,
@@ -11123,8 +11132,8 @@ function dg(e, t) {
11123
11132
  "#f7f8fa"
11124
11133
  ].join(", ");
11125
11134
  }
11126
- function fg({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
11127
- let i = (t || "A")[0].toUpperCase(), a = ug(r), o = n > 48 ? {
11135
+ function pg({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
11136
+ let i = (t || "A")[0].toUpperCase(), a = dg(r), o = n > 48 ? {
11128
11137
  boxShadow: `0 0 0 3px ${r}44`,
11129
11138
  border: "3px solid rgba(255,255,255,0.15)"
11130
11139
  } : { border: `1.5px solid ${r}55` };
@@ -11161,7 +11170,7 @@ function fg({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" })
11161
11170
  children: i
11162
11171
  });
11163
11172
  }
11164
- function pg(e) {
11173
+ function mg(e) {
11165
11174
  let t = p(null), n = o(() => {
11166
11175
  if (!t.current) return;
11167
11176
  let { audioContext: e, oscillator: n, interval: r, toneTimeout: i } = t.current;
@@ -11208,8 +11217,8 @@ function pg(e) {
11208
11217
  n
11209
11218
  ]), c(() => () => n(), [n]), n;
11210
11219
  }
11211
- function mg({ 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 = [] }) {
11212
- let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = pg(!!e), S = async () => {
11220
+ function hg({ 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 = [] }) {
11221
+ let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = mg(!!e), S = async () => {
11213
11222
  x(), await c();
11214
11223
  }, C = async () => {
11215
11224
  x(), await l();
@@ -11221,14 +11230,14 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11221
11230
  flexDirection: "column",
11222
11231
  borderRadius: "inherit",
11223
11232
  overflow: "hidden",
11224
- background: dg(h, m),
11233
+ background: fg(h, m),
11225
11234
  animation: T ? "fe-call-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)" : "fe-call-fade-in 0.32s ease"
11226
11235
  };
11227
11236
  if (b === "incoming") {
11228
11237
  let e = Array.isArray(h) && h.length > 0 ? h : [m];
11229
11238
  return /* @__PURE__ */ _("div", {
11230
11239
  style: E,
11231
- children: [/* @__PURE__ */ g("style", { children: cg }), /* @__PURE__ */ _("div", {
11240
+ children: [/* @__PURE__ */ g("style", { children: lg }), /* @__PURE__ */ _("div", {
11232
11241
  style: {
11233
11242
  flex: 1,
11234
11243
  display: "flex",
@@ -11259,7 +11268,7 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11259
11268
  width: "96px",
11260
11269
  height: "96px",
11261
11270
  borderRadius: "50%",
11262
- background: `radial-gradient(circle, rgba(${lg(e[0])},0.2) 0%, transparent 70%)`,
11271
+ background: `radial-gradient(circle, rgba(${ug(e[0])},0.2) 0%, transparent 70%)`,
11263
11272
  filter: "blur(10px)",
11264
11273
  zIndex: 0
11265
11274
  } }),
@@ -11276,7 +11285,7 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11276
11285
  animation: `fe-call-ring-pulse 2.6s cubic-bezier(0.215,0.61,0.355,1) ${t}s infinite`,
11277
11286
  zIndex: 1
11278
11287
  } }, n)),
11279
- /* @__PURE__ */ g(fg, {
11288
+ /* @__PURE__ */ g(pg, {
11280
11289
  headshot: o,
11281
11290
  name: y,
11282
11291
  size: 82,
@@ -11356,7 +11365,7 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11356
11365
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(239,68,68,0.5)";
11357
11366
  },
11358
11367
  "aria-label": "Decline call",
11359
- children: /* @__PURE__ */ g(xh, { size: 26 })
11368
+ children: /* @__PURE__ */ g(Sh, { size: 26 })
11360
11369
  }), /* @__PURE__ */ g("span", {
11361
11370
  style: {
11362
11371
  fontSize: "12px",
@@ -11397,7 +11406,7 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11397
11406
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(34,197,94,0.5)";
11398
11407
  },
11399
11408
  "aria-label": "Accept call",
11400
- children: /* @__PURE__ */ g(wh, {})
11409
+ children: /* @__PURE__ */ g(Th, {})
11401
11410
  }), /* @__PURE__ */ g("span", {
11402
11411
  style: {
11403
11412
  fontSize: "12px",
@@ -11414,7 +11423,7 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11414
11423
  }
11415
11424
  return b === "connecting" ? /* @__PURE__ */ _("div", {
11416
11425
  style: E,
11417
- children: [/* @__PURE__ */ g("style", { children: cg }), /* @__PURE__ */ _("div", {
11426
+ children: [/* @__PURE__ */ g("style", { children: lg }), /* @__PURE__ */ _("div", {
11418
11427
  style: {
11419
11428
  flex: 1,
11420
11429
  display: "flex",
@@ -11424,7 +11433,7 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11424
11433
  gap: "24px"
11425
11434
  },
11426
11435
  children: [
11427
- /* @__PURE__ */ g(fg, {
11436
+ /* @__PURE__ */ g(pg, {
11428
11437
  headshot: o,
11429
11438
  name: y,
11430
11439
  size: 64,
@@ -11451,7 +11460,7 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11451
11460
  }) : /* @__PURE__ */ _("div", {
11452
11461
  style: E,
11453
11462
  children: [
11454
- /* @__PURE__ */ g("style", { children: cg }),
11463
+ /* @__PURE__ */ g("style", { children: lg }),
11455
11464
  /* @__PURE__ */ _("div", {
11456
11465
  style: {
11457
11466
  display: "flex",
@@ -11497,7 +11506,7 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11497
11506
  children: /* @__PURE__ */ g("polyline", { points: "15 18 9 12 15 6" })
11498
11507
  })
11499
11508
  }),
11500
- /* @__PURE__ */ g(sg, {
11509
+ /* @__PURE__ */ g(cg, {
11501
11510
  colors: h,
11502
11511
  size: 36,
11503
11512
  voiceState: w
@@ -11548,7 +11557,7 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11548
11557
  gap: "16px",
11549
11558
  padding: "0 24px 16px"
11550
11559
  },
11551
- children: [/* @__PURE__ */ g(fg, {
11560
+ children: [/* @__PURE__ */ g(pg, {
11552
11561
  headshot: o,
11553
11562
  name: y,
11554
11563
  size: 116,
@@ -11603,7 +11612,7 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11603
11612
  transition: "all 0.2s ease"
11604
11613
  },
11605
11614
  "aria-label": i ? "Unmute" : "Mute",
11606
- children: [g(i ? jh : bh, { size: 18 }), i ? "Unmute" : "Mute"]
11615
+ children: [g(i ? Mh : xh, { size: 18 }), i ? "Unmute" : "Mute"]
11607
11616
  }), /* @__PURE__ */ _("button", {
11608
11617
  type: "button",
11609
11618
  onClick: u,
@@ -11631,15 +11640,15 @@ function mg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11631
11640
  e.currentTarget.style.background = "rgba(239,68,68,0.9)", e.currentTarget.style.transform = "scale(1)";
11632
11641
  },
11633
11642
  "aria-label": "End call",
11634
- children: [/* @__PURE__ */ g(xh, { size: 18 }), "End Call"]
11643
+ children: [/* @__PURE__ */ g(Sh, { size: 18 }), "End Call"]
11635
11644
  })]
11636
11645
  })
11637
11646
  ]
11638
11647
  });
11639
11648
  }
11640
- function hg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
11649
+ function gg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
11641
11650
  let u = e || n || "Agent";
11642
- return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: cg }), /* @__PURE__ */ _("div", {
11651
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: lg }), /* @__PURE__ */ _("div", {
11643
11652
  role: "button",
11644
11653
  tabIndex: 0,
11645
11654
  onClick: c,
@@ -11696,7 +11705,7 @@ function hg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11696
11705
  borderRadius: "50%",
11697
11706
  border: `1.5px solid ${l}55`
11698
11707
  } }),
11699
- /* @__PURE__ */ g(fg, {
11708
+ /* @__PURE__ */ g(pg, {
11700
11709
  headshot: t,
11701
11710
  name: u,
11702
11711
  size: 38,
@@ -11780,7 +11789,7 @@ function hg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11780
11789
  boxShadow: i ? `0 0 0 3px ${l}12` : "none"
11781
11790
  },
11782
11791
  "aria-label": i ? "Unmute" : "Mute",
11783
- children: g(i ? jh : bh, { size: 15 })
11792
+ children: g(i ? Mh : xh, { size: 15 })
11784
11793
  }), /* @__PURE__ */ g("button", {
11785
11794
  type: "button",
11786
11795
  onClick: (e) => {
@@ -11808,7 +11817,7 @@ function hg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11808
11817
  transition: "all 0.18s ease"
11809
11818
  },
11810
11819
  "aria-label": "End call",
11811
- children: /* @__PURE__ */ g(xh, { size: 16 })
11820
+ children: /* @__PURE__ */ g(Sh, { size: 16 })
11812
11821
  })]
11813
11822
  })
11814
11823
  ]
@@ -11816,7 +11825,7 @@ function hg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11816
11825
  }
11817
11826
  //#endregion
11818
11827
  //#region src/utils/voicePriorContext.js
11819
- function gg(e, t = {}) {
11828
+ function _g(e, t = {}) {
11820
11829
  let n = t.maxChars ?? 4500;
11821
11830
  if (!Array.isArray(e) || e.length === 0) return "";
11822
11831
  let r = [];
@@ -11834,7 +11843,7 @@ function gg(e, t = {}) {
11834
11843
  //#endregion
11835
11844
  //#region src/utils/voiceActionVisuals.js
11836
11845
  var Q = "fe-vv";
11837
- function _g() {
11846
+ function vg() {
11838
11847
  if (typeof document > "u" || document.getElementById(`${Q}-styles`)) return;
11839
11848
  let e = `
11840
11849
  /* ── Action toast ───────────────────────────────────────────────────────────── */
@@ -11979,14 +11988,14 @@ function _g() {
11979
11988
  `, t = document.createElement("style");
11980
11989
  t.id = `${Q}-styles`, t.textContent = e, (document.head || document.documentElement).appendChild(t);
11981
11990
  }
11982
- var vg = null, yg = null;
11983
- function bg() {
11984
- return (!vg || !vg.isConnected) && (vg = document.createElement("div"), vg.id = `${Q}-toast`, document.body.appendChild(vg)), vg;
11991
+ var yg = null, bg = null;
11992
+ function xg() {
11993
+ return (!yg || !yg.isConnected) && (yg = document.createElement("div"), yg.id = `${Q}-toast`, document.body.appendChild(yg)), yg;
11985
11994
  }
11986
- function xg(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
11995
+ function Sg(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
11987
11996
  if (typeof document > "u") return;
11988
- _g(), yg &&= (clearTimeout(yg), null);
11989
- let i = bg();
11997
+ vg(), bg &&= (clearTimeout(bg), null);
11998
+ let i = xg();
11990
11999
  if (i.innerHTML = "", n) {
11991
12000
  let e = document.createElement("span");
11992
12001
  e.className = `${Q}-icon`, e.textContent = n, i.appendChild(e);
@@ -11995,71 +12004,71 @@ function xg(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
11995
12004
  e.className = `${Q}-spin`, i.appendChild(e);
11996
12005
  }
11997
12006
  let a = document.createElement("span");
11998
- a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (yg = setTimeout(() => Sg(), r));
11999
- }
12000
- function Sg(e = 0) {
12001
- vg && (e > 0 ? yg = setTimeout(() => {
12002
- vg && vg.classList.remove(`${Q}-show`);
12003
- }, e) : vg && vg.classList.remove(`${Q}-show`));
12007
+ a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (bg = setTimeout(() => Cg(), r));
12004
12008
  }
12005
- var Cg = null, wg = [];
12006
- function Tg() {
12007
- return (!Cg || !Cg.isConnected) && (Cg = document.createElement("div"), Cg.id = `${Q}-bar`, document.body.appendChild(Cg)), Cg;
12009
+ function Cg(e = 0) {
12010
+ yg && (e > 0 ? bg = setTimeout(() => {
12011
+ yg && yg.classList.remove(`${Q}-show`);
12012
+ }, e) : yg && yg.classList.remove(`${Q}-show`));
12008
12013
  }
12014
+ var wg = null, Tg = [];
12009
12015
  function Eg() {
12016
+ return (!wg || !wg.isConnected) && (wg = document.createElement("div"), wg.id = `${Q}-bar`, document.body.appendChild(wg)), wg;
12017
+ }
12018
+ function Dg() {
12010
12019
  if (typeof document > "u") return;
12011
- _g(), wg.forEach(clearTimeout), wg = [];
12012
- let e = Tg();
12020
+ vg(), Tg.forEach(clearTimeout), Tg = [];
12021
+ let e = Eg();
12013
12022
  e.style.transition = "none", e.style.width = "0%", e.classList.add(`${Q}-bar-active`), e.offsetHeight, e.style.transition = "width 0.35s ease, opacity 0.25s ease";
12014
12023
  let t = [[80, "width 0.6s ease"], [92, "width 1.2s ease"]], n = 50;
12015
12024
  for (let [e, r] of t) {
12016
12025
  let t = n, i = e, a = r;
12017
- wg.push(setTimeout(() => {
12018
- Cg && (Cg.style.transition = a, Cg.style.width = `${i}%`);
12026
+ Tg.push(setTimeout(() => {
12027
+ wg && (wg.style.transition = a, wg.style.width = `${i}%`);
12019
12028
  }, t)), n += 800;
12020
12029
  }
12021
12030
  }
12022
- function Dg() {
12023
- Cg && (wg.forEach(clearTimeout), wg = [], Cg.style.transition = "width 0.2s ease", Cg.style.width = "100%", wg.push(setTimeout(() => {
12024
- Cg && (Cg.style.transition = "opacity 0.35s ease", Cg.style.opacity = "0", wg.push(setTimeout(() => {
12025
- Cg && (Cg.style.width = "0%", Cg.classList.remove(`${Q}-bar-active`));
12031
+ function Og() {
12032
+ wg && (Tg.forEach(clearTimeout), Tg = [], wg.style.transition = "width 0.2s ease", wg.style.width = "100%", Tg.push(setTimeout(() => {
12033
+ wg && (wg.style.transition = "opacity 0.35s ease", wg.style.opacity = "0", Tg.push(setTimeout(() => {
12034
+ wg && (wg.style.width = "0%", wg.classList.remove(`${Q}-bar-active`));
12026
12035
  }, 380)));
12027
12036
  }, 220)));
12028
12037
  }
12029
- var Og = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
12038
+ var kg = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
12030
12039
  <filter id="${Q}-csh">
12031
12040
  <feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
12032
12041
  </filter>
12033
12042
  <path d="M4 2L19 10.5L11 12.8L8 20L4 2Z"
12034
12043
  fill="white" stroke="#1e1b4b" stroke-width="1.6" stroke-linejoin="round"
12035
12044
  filter="url(#${Q}-csh)"/>
12036
- </svg>`, kg = null, Ag = !1;
12037
- function jg() {
12038
- return (!kg || !kg.isConnected) && (kg = document.createElement("div"), kg.id = `${Q}-cursor`, kg.innerHTML = Og, document.body.appendChild(kg), Ag = !1), kg;
12045
+ </svg>`, Ag = null, jg = !1;
12046
+ function Mg() {
12047
+ return (!Ag || !Ag.isConnected) && (Ag = document.createElement("div"), Ag.id = `${Q}-cursor`, Ag.innerHTML = kg, document.body.appendChild(Ag), jg = !1), Ag;
12039
12048
  }
12040
- async function Mg(e) {
12049
+ async function Ng(e) {
12041
12050
  if (typeof document > "u" || !e) return;
12042
- _g();
12051
+ vg();
12043
12052
  let t;
12044
12053
  try {
12045
12054
  t = e.getBoundingClientRect();
12046
12055
  } catch {
12047
12056
  return;
12048
12057
  }
12049
- let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = jg();
12050
- Ag ||= (i.style.transition = "none", i.style.left = `${window.innerWidth / 2}px`, i.style.top = `${window.innerHeight * .4}px`, i.classList.add(`${Q}-cursor-visible`), i.offsetHeight, i.style.transition = "left 0.32s cubic-bezier(0.25,0.46,0.45,0.94), top 0.32s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.2s ease", !0), i.style.left = `${n}px`, i.style.top = `${r}px`, await Ig(360);
12058
+ let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = Mg();
12059
+ jg ||= (i.style.transition = "none", i.style.left = `${window.innerWidth / 2}px`, i.style.top = `${window.innerHeight * .4}px`, i.classList.add(`${Q}-cursor-visible`), i.offsetHeight, i.style.transition = "left 0.32s cubic-bezier(0.25,0.46,0.45,0.94), top 0.32s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.2s ease", !0), i.style.left = `${n}px`, i.style.top = `${r}px`, await Lg(360);
12051
12060
  }
12052
- function Ng(e = !1) {
12053
- kg && (e ? (kg.classList.remove(`${Q}-cursor-visible`), Ag = !1) : (kg.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
12054
- Ag = !1;
12061
+ function Pg(e = !1) {
12062
+ Ag && (e ? (Ag.classList.remove(`${Q}-cursor-visible`), jg = !1) : (Ag.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
12063
+ jg = !1;
12055
12064
  }, 250)));
12056
12065
  }
12057
- async function Pg(e) {
12058
- kg && (kg.classList.add(`${Q}-cursor-click`), await Ig(280), kg.classList.remove(`${Q}-cursor-click`));
12066
+ async function Fg(e) {
12067
+ Ag && (Ag.classList.add(`${Q}-cursor-click`), await Lg(280), Ag.classList.remove(`${Q}-cursor-click`));
12059
12068
  }
12060
- function Fg(e) {
12069
+ function Ig(e) {
12061
12070
  if (!e || typeof document > "u") return;
12062
- _g();
12071
+ vg();
12063
12072
  let t;
12064
12073
  try {
12065
12074
  t = e.getBoundingClientRect();
@@ -12085,29 +12094,29 @@ function Fg(e) {
12085
12094
  a.remove(), e.style.position = n, e.style.overflow = r;
12086
12095
  }, 650);
12087
12096
  }
12088
- function Ig(e) {
12097
+ function Lg(e) {
12089
12098
  return new Promise((t) => setTimeout(t, e));
12090
12099
  }
12091
12100
  //#endregion
12092
12101
  //#region src/utils/voiceClientTools.js
12093
- var Lg = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
12094
- function Rg(e) {
12095
- return String(e || "").replace(Lg, "").replace(/\/+$/, "").toLowerCase() || "/";
12102
+ var Rg = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
12103
+ function zg(e) {
12104
+ return String(e || "").replace(Rg, "").replace(/\/+$/, "").toLowerCase() || "/";
12096
12105
  }
12097
- function zg(e, t) {
12098
- return Rg(e) === Rg(t);
12106
+ function Bg(e, t) {
12107
+ return zg(e) === zg(t);
12099
12108
  }
12100
12109
  function $(...e) {
12101
12110
  wn() && console.log("[FlowEngage:voice-tools]", ...e);
12102
12111
  }
12103
- function Bg(e) {
12112
+ function Vg(e) {
12104
12113
  try {
12105
12114
  let t = e.ownerDocument?.defaultView;
12106
12115
  if (t) return t.getComputedStyle(e);
12107
12116
  } catch {}
12108
12117
  return window.getComputedStyle(e);
12109
12118
  }
12110
- function Vg(e) {
12119
+ function Hg(e) {
12111
12120
  let t = /* @__PURE__ */ new Set();
12112
12121
  function n(r) {
12113
12122
  if (!r || t.has(r)) return;
@@ -12120,10 +12129,10 @@ function Vg(e) {
12120
12129
  }
12121
12130
  typeof document < "u" && n(document);
12122
12131
  }
12123
- function Hg(e) {
12132
+ function Ug(e) {
12124
12133
  return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
12125
12134
  }
12126
- function Ug(e) {
12135
+ function Wg(e) {
12127
12136
  let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
12128
12137
  if (n) {
12129
12138
  let e = n.trim().split(/\s+/).filter(Boolean), r = [];
@@ -12131,40 +12140,40 @@ function Ug(e) {
12131
12140
  let e = t.getElementById(n);
12132
12141
  e?.textContent && r.push(e.textContent.trim());
12133
12142
  } catch {}
12134
- if (r.length) return Hg(r.join(" "));
12143
+ if (r.length) return Ug(r.join(" "));
12135
12144
  }
12136
- if (e.labels && e.labels.length) return Hg(e.labels[0].textContent);
12145
+ if (e.labels && e.labels.length) return Ug(e.labels[0].textContent);
12137
12146
  let r = e.id;
12138
12147
  if (r) try {
12139
12148
  let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
12140
- if (e) return Hg(e.textContent);
12149
+ if (e) return Ug(e.textContent);
12141
12150
  } catch {
12142
12151
  let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
12143
- if (e) return Hg(e.textContent);
12152
+ if (e) return Ug(e.textContent);
12144
12153
  }
12145
12154
  let i = e.previousElementSibling;
12146
12155
  for (let e = 0; e < 6 && i; e += 1) {
12147
- if (i.tagName === "LABEL") return Hg(i.textContent);
12156
+ if (i.tagName === "LABEL") return Ug(i.textContent);
12148
12157
  let e = (i.className || "").toString().toLowerCase();
12149
12158
  if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
12150
- let e = Hg(i.textContent);
12159
+ let e = Ug(i.textContent);
12151
12160
  if (e) return e;
12152
12161
  }
12153
12162
  i = i.previousElementSibling;
12154
12163
  }
12155
12164
  let a = e.parentElement;
12156
12165
  for (let e = 0; e < 5 && a; e += 1) {
12157
- if (a.tagName === "LABEL") return Hg(a.textContent);
12166
+ if (a.tagName === "LABEL") return Ug(a.textContent);
12158
12167
  let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
12159
- if (e?.textContent) return Hg(e.textContent);
12168
+ if (e?.textContent) return Ug(e.textContent);
12160
12169
  a = a.parentElement;
12161
12170
  }
12162
12171
  let o = e.getAttribute("aria-label");
12163
- return o ? Hg(o) : null;
12172
+ return o ? Ug(o) : null;
12164
12173
  }
12165
- function Wg() {
12174
+ function Gg() {
12166
12175
  let e = [];
12167
- return Vg((t) => {
12176
+ return Hg((t) => {
12168
12177
  e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
12169
12178
  if (An(e)) return !1;
12170
12179
  let t = (e.type || "").toLowerCase();
@@ -12175,15 +12184,15 @@ function Wg() {
12175
12184
  "image"
12176
12185
  ].includes(t) || e.disabled || e.readOnly) return !1;
12177
12186
  try {
12178
- let t = Bg(e);
12187
+ let t = Vg(e);
12179
12188
  if (t.display === "none" || t.visibility === "hidden") return !1;
12180
12189
  } catch {}
12181
12190
  return !0;
12182
12191
  }));
12183
12192
  }), e;
12184
12193
  }
12185
- function Gg() {
12186
- return Wg().map((e, t) => {
12194
+ function Kg() {
12195
+ return Gg().map((e, t) => {
12187
12196
  let n = {
12188
12197
  formIndex: 0,
12189
12198
  fieldIndex: t,
@@ -12191,7 +12200,7 @@ function Gg() {
12191
12200
  type: e.type || "text",
12192
12201
  name: e.name || null,
12193
12202
  id: e.id || null,
12194
- label: Ug(e),
12203
+ label: Wg(e),
12195
12204
  placeholder: e.placeholder || null
12196
12205
  };
12197
12206
  return e.tagName === "SELECT" && (n.options = Array.from(e.options).filter((e) => e.value !== "" && !e.disabled).map((e) => ({
@@ -12200,13 +12209,13 @@ function Gg() {
12200
12209
  })), n.currentValue = e.value || null), n;
12201
12210
  });
12202
12211
  }
12203
- function Kg() {
12212
+ function qg() {
12204
12213
  let e = [];
12205
- return Vg((t) => {
12214
+ return Hg((t) => {
12206
12215
  e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
12207
12216
  if (An(e) || e.disabled) return !1;
12208
12217
  try {
12209
- let t = Bg(e);
12218
+ let t = Vg(e);
12210
12219
  if (t.display === "none" || t.visibility === "hidden") return !1;
12211
12220
  } catch {}
12212
12221
  return !0;
@@ -12218,7 +12227,7 @@ function Kg() {
12218
12227
  type: e.type || e.tagName
12219
12228
  }));
12220
12229
  }
12221
- function qg(e, t) {
12230
+ function Jg(e, t) {
12222
12231
  try {
12223
12232
  if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
12224
12233
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
@@ -12233,7 +12242,7 @@ function qg(e, t) {
12233
12242
  return Infinity;
12234
12243
  }
12235
12244
  }
12236
- function Jg(e, t) {
12245
+ function Yg(e, t) {
12237
12246
  let n = String(t || "").toLowerCase().trim();
12238
12247
  if (!n) return 0;
12239
12248
  let r = (e.innerText || e.textContent || "").replace(/\s+/g, " ").trim(), i = [
@@ -12251,21 +12260,21 @@ function Jg(e, t) {
12251
12260
  for (let e of a) i.includes(e) && (o += 1);
12252
12261
  return o / a.length * 92;
12253
12262
  }
12254
- function Yg(e, t, n = 6) {
12263
+ function Xg(e, t, n = 6) {
12255
12264
  let r = String(t || "").toLowerCase().trim();
12256
12265
  if (!r) return !1;
12257
12266
  let i = e;
12258
12267
  for (let e = 0; e < n && i && (i = i.parentElement, i); e++) if ((i.innerText || i.textContent || "").toLowerCase().includes(r)) return !0;
12259
12268
  return !1;
12260
12269
  }
12261
- function Xg(e, t, n) {
12270
+ function Zg(e, t, n) {
12262
12271
  let r = [];
12263
- Vg((e) => {
12272
+ Hg((e) => {
12264
12273
  let t = Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"], a[href]"));
12265
12274
  r.push(...t.filter((e) => {
12266
12275
  if (An(e) || e.disabled) return !1;
12267
12276
  try {
12268
- let t = Bg(e);
12277
+ let t = Vg(e);
12269
12278
  if (t.display === "none" || t.visibility === "hidden" || t.opacity === "0") return !1;
12270
12279
  } catch {}
12271
12280
  return !0;
@@ -12273,14 +12282,14 @@ function Xg(e, t, n) {
12273
12282
  });
12274
12283
  let i = 0, a = r.map((t) => ({
12275
12284
  el: t,
12276
- s: Jg(t, e)
12285
+ s: Yg(t, e)
12277
12286
  }));
12278
12287
  for (let { s: e } of a) e > i && (i = e);
12279
12288
  if (i < 28) return null;
12280
12289
  let o = a.filter(({ s: e }) => e === i).map(({ el: e }) => e);
12281
12290
  if (o.length === 1) return o[0];
12282
12291
  if (n) {
12283
- let e = o.filter((e) => Yg(e, n));
12292
+ let e = o.filter((e) => Xg(e, n));
12284
12293
  if (e.length === 1) return e[0];
12285
12294
  e.length > 1 && (o = e);
12286
12295
  }
@@ -12288,14 +12297,14 @@ function Xg(e, t, n) {
12288
12297
  if (s.length) {
12289
12298
  let e = o[0], t = Infinity;
12290
12299
  for (let n of o) for (let r of s) {
12291
- let i = qg(n, r);
12300
+ let i = Jg(n, r);
12292
12301
  i < t && (t = i, e = n);
12293
12302
  }
12294
12303
  return e;
12295
12304
  }
12296
12305
  return o[0];
12297
12306
  }
12298
- function Zg(e) {
12307
+ function Qg(e) {
12299
12308
  if (e == null) return {};
12300
12309
  if (typeof e == "string") {
12301
12310
  let t = e.trim();
@@ -12308,12 +12317,12 @@ function Zg(e) {
12308
12317
  }
12309
12318
  return e;
12310
12319
  }
12311
- function Qg(e) {
12320
+ function $g(e) {
12312
12321
  if (!e || typeof e != "object") return null;
12313
12322
  let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
12314
12323
  return t == null ? null : String(t).trim() || null;
12315
12324
  }
12316
- function $g() {
12325
+ function e_() {
12317
12326
  let e = {};
12318
12327
  document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
12319
12328
  if (t.id) return;
@@ -12328,7 +12337,7 @@ function $g() {
12328
12337
  e[r] = !0, t.id = r;
12329
12338
  });
12330
12339
  }
12331
- function e_() {
12340
+ function t_() {
12332
12341
  let e = (e) => {
12333
12342
  let t = Array.from(e).filter((e) => !e.closest("#flowengage-root, .flowengage-shell, .flowengage-widget-root") && !e.closest("nav, footer, header, aside, .nav, .footer, .header, .sidebar")), n = [], r = 0;
12334
12343
  for (; r < t.length;) {
@@ -12371,7 +12380,7 @@ function e_() {
12371
12380
  introText: o
12372
12381
  };
12373
12382
  }
12374
- function t_(e) {
12383
+ function n_(e) {
12375
12384
  if (!e || typeof document > "u") return "";
12376
12385
  let t = new Set([
12377
12386
  "script",
@@ -12457,11 +12466,11 @@ function t_(e) {
12457
12466
  return d.has(t) ? !1 : (d.add(t), !0);
12458
12467
  }).join("\n").replace(/\n{3,}/g, "\n\n").trim();
12459
12468
  }
12460
- function n_(e) {
12469
+ function r_(e) {
12461
12470
  let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
12462
12471
  "fwh-navigate-mvp": async (n) => {
12463
12472
  if ($("fwh-navigate-mvp ▶ raw parameters:", n), e?.isWalkthroughActive?.()) return $("fwh-navigate-mvp ✖ blocked — walkthrough in progress"), "NAVIGATION_BLOCKED_DURING_WALKTHROUGH. A walkthrough of the current page is in progress, so navigation is not allowed. Do NOT tell the visitor you navigated or offer to. Describe the requested section using the CURRENT page's own content (fwh-read-content-mvp), then stop.";
12464
- let i = Zg(n), a = Qg(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
12473
+ let i = Qg(n), a = $g(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
12465
12474
  if ($("fwh-navigate-mvp · coerced:", {
12466
12475
  url: a,
12467
12476
  sectionText: o,
@@ -12501,11 +12510,11 @@ function n_(e) {
12501
12510
  correctedUrl: l
12502
12511
  }), a = l);
12503
12512
  try {
12504
- xg(`Navigating to ${a}...`, { spinner: !0 }), Eg(), On();
12513
+ Sg(`Navigating to ${a}...`, { spinner: !0 }), Dg(), On();
12505
12514
  try {
12506
12515
  let e = r ? r() : "";
12507
12516
  if (e && t) {
12508
- let n = gg([{
12517
+ let n = _g([{
12509
12518
  sender: "user",
12510
12519
  message: e
12511
12520
  }]);
@@ -12540,8 +12549,8 @@ function n_(e) {
12540
12549
  typeof window < "u" && window.scrollTo(0, 0);
12541
12550
  } catch {}
12542
12551
  let o = [], s = null, c = "", l = Date.now() + 12e3;
12543
- for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: o, pageTitleHeading: s, introText: c} = e_(), !(o.length >= 1)););
12544
- $g(), $("fwh-navigate-mvp → page headings collected:", o, "titleHeading:", s);
12552
+ for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: o, pageTitleHeading: s, introText: c} = t_(), !(o.length >= 1)););
12553
+ e_(), $("fwh-navigate-mvp → page headings collected:", o, "titleHeading:", s);
12545
12554
  let u = o.length ? o.join(" | ") : "none", d = o.length ? "Use ONLY these exact heading strings for fwh-highlight-mvp — never invent or abbreviate." : "No headings collected yet — call fwh-get-current-page-mvp immediately (no speech) to get the live headings before speaking or highlighting.", f = s ? ` "${s}" is the PAGE TITLE, not a content section — do not fwh-highlight-mvp it separately; if doing a walkthrough, just fold this intro into your opening line: "${c || "(no intro text found)"}"` : c ? ` No separate page-title heading detected, but this intro text precedes the first section — mention it briefly before covering sections: "${c}"` : "", p = "";
12546
12555
  try {
12547
12556
  if (o.length > 0) {
@@ -12549,7 +12558,7 @@ function n_(e) {
12549
12558
  for (let n of e) {
12550
12559
  let e = cr(null, n);
12551
12560
  if (e) {
12552
- let r = t_(e).substring(0, 800);
12561
+ let r = n_(e).substring(0, 800);
12553
12562
  r && t.push(`[Section: ${n}] ${r}`);
12554
12563
  }
12555
12564
  }
@@ -12558,57 +12567,57 @@ function n_(e) {
12558
12567
  } catch {}
12559
12568
  if (yr()) return _r(), $("fwh-navigate-mvp ✖ landed on a not-found/404 page:", i), `NAVIGATION_PAGE_NOT_FOUND. The page at ${i} does not exist — it shows a "not found"/404 error, not real content. Do NOT offer a page overview, do NOT describe or highlight any sections, do NOT claim the navigation succeeded. Tell the visitor EXACTLY: "It looks like that page doesn't exist — I couldn't find it. Would you like me to take you somewhere else?" Then STOP and wait for their reply.`;
12560
12569
  let m = Date.now() + 4e3, h = typeof window < "u" ? window.location.pathname : r;
12561
- for (; Date.now() < m && !zg(h, e) && zg(h, t);) await new Promise((e) => setTimeout(e, 120)), h = window.location.pathname;
12570
+ for (; Date.now() < m && !Bg(h, e) && Bg(h, t);) await new Promise((e) => setTimeout(e, 120)), h = window.location.pathname;
12562
12571
  $("fwh-navigate-mvp route settle:", {
12563
12572
  startPath: t,
12564
12573
  targetPath: e,
12565
12574
  settledPath: h
12566
12575
  });
12567
- let g = typeof window < "u" ? window.location.href : i, _ = (h.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home", v = zg(h, e), y = !zg(h, t), b = v || y;
12576
+ let g = typeof window < "u" ? window.location.href : i, _ = (h.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home", v = Bg(h, e), y = !Bg(h, t), b = v || y;
12568
12577
  return $("fwh-navigate-mvp settled:", h, "target:", e, "match:", b), b ? (_r(), `OK_NAVIGATE_SPA. Visitor is now on: ${g} (page: "${_}") | Section headings: ${u}.${f} ${d}${p} Now confirm the arrival in ONE short sentence phrased for what the visitor actually asked for — mention the page by name and what it lets them do (e.g. for a contact request: "I've taken you to the Contact Us page — filling in this form sends your query straight to our team."). Do NOT use a fixed template. Then, in the same breath, offer either a specific section or a full overview. Then STOP — wait for their reply.`) : (_r(), `NAVIGATION_DID_NOT_HAPPEN. The visitor is STILL on ${g} (page: "${_}") — the navigation did not go through. Do NOT say "I have navigated you". Do NOT claim success. Tell the visitor EXACTLY: "Sorry, I couldn't open that page just now. Would you like me to try again, or is there something else I can help with?" Then STOP and wait for their reply.`);
12569
12578
  } catch {}
12570
12579
  return "OK_NAVIGATE_RELOADING. The page is reloading now and this session is ending. Say NOTHING further — do not confirm the navigation, do not describe the page. The arrival greeting is spoken automatically on the new page; you resume from the visitor's next reply.";
12571
12580
  } catch (e) {
12572
12581
  let t = `Navigation error: ${e?.message || String(e)}`;
12573
- return $("fwh-navigate-mvp ✖", t), xg("Navigation failed", {
12582
+ return $("fwh-navigate-mvp ✖", t), Sg("Navigation failed", {
12574
12583
  spinner: !1,
12575
12584
  icon: "⚠️",
12576
12585
  duration: 1800
12577
12586
  }), t;
12578
12587
  } finally {
12579
- Dg(), Sg(900);
12588
+ Og(), Cg(900);
12580
12589
  }
12581
12590
  },
12582
12591
  "fwh-highlight-mvp": async (e) => {
12583
12592
  $("fwh-highlight-mvp ▶", e);
12584
- let t = Zg(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
12593
+ let t = Qg(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
12585
12594
  if (Rn(3e3), typeof window < "u" && window.__fe_user_nav_during_speech) {
12586
12595
  let e = window.__fe_user_nav_during_speech, t = window.location.pathname;
12587
12596
  if (Date.now() - e.ts >= 3e4) window.__fe_user_nav_during_speech = null;
12588
12597
  else return $("flowengage_highlight ✖ blocked — user navigated during speech", e), `NAV_CHANGED: The visitor navigated from "${e.fromPageName}" to "${e.toPageName}" (current path: ${t}) while you were speaking. STOP the current walkthrough immediately. DO NOT call fwh-highlight-mvp again. Say out loud: "I see you've navigated to the ${e.toPageName} page — do you want me to continue what I was explaining, or shall I guide you through this page?" Wait for the visitor's answer before doing anything else.`;
12589
12598
  }
12590
- $g();
12599
+ e_();
12591
12600
  let i = ((e) => e && e.replace(/^\d+\.\s*/, "").replace(/^["']|["']$/g, "").trim())(r), a = cr(n || null, i || null);
12592
12601
  if (!a && i) {
12593
12602
  let e = Date.now() + 600;
12594
- for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), $g(), a = cr(null, i);
12603
+ for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), e_(), a = cr(null, i);
12595
12604
  }
12596
12605
  if (!a) {
12597
12606
  $("fwh-highlight-mvp ✖ no element for:", i || n);
12598
- let { headings: e } = e_(), t = e.length ? `Page headings: ${e.map((e) => `"${e}"`).join(" | ")}. Use one of these EXACT strings for section_text — no numbers, no quotes around them.` : "No headings found — skip highlight and continue speaking.";
12607
+ let { headings: e } = t_(), t = e.length ? `Page headings: ${e.map((e) => `"${e}"`).join(" | ")}. Use one of these EXACT strings for section_text — no numbers, no quotes around them.` : "No headings found — skip highlight and continue speaking.";
12599
12608
  return `HIGHLIGHT_NOT_FOUND: "${i || n}" on the current page. ${t}`;
12600
12609
  }
12601
12610
  return Dn(a), $("fwh-highlight-mvp ✓", i || n), `OK_HIGHLIGHT: "${i || n}". Your NEXT response must be speech only (no tool call) describing THIS section — "${i || n}" — using its own content. Do not ask whether to continue.`;
12602
12611
  },
12603
12612
  "fwh-read-content-mvp": async (e) => {
12604
12613
  $("fwh-read-content-mvp ▶", e);
12605
- let t = Zg(e), n = t?.section_text || t?.sectionText || "";
12614
+ let t = Qg(e), n = t?.section_text || t?.sectionText || "";
12606
12615
  try {
12607
12616
  let e = "";
12608
12617
  if (n) {
12609
12618
  let t = cr(null, n);
12610
12619
  if (!t) return `Could not find section "${n}" on the page.`;
12611
- e = t_(t);
12620
+ e = n_(t);
12612
12621
  } else {
12613
12622
  let t = (document.querySelector("main") || document.querySelector("article") || document.querySelector("[role=\"main\"]") || document.querySelector("#content") || document.querySelector(".content") || document.body).cloneNode(!0);
12614
12623
  t.querySelectorAll("nav, footer, header, aside, script, style, noscript, .nav, .footer, .header, .sidebar, #flowengage-root, .flowengage-shell, .flowengage-widget-root").forEach((e) => e.remove()), e = t.textContent.replace(/\s+/g, " ").trim();
@@ -12620,7 +12629,7 @@ function n_(e) {
12620
12629
  },
12621
12630
  "fwh-page-content-mvp": async (e) => {
12622
12631
  $("fwh-page-content-mvp ▶", e);
12623
- let r = Zg(e), i = r?.url || r?.page_url || "";
12632
+ let r = Qg(e), i = r?.url || r?.page_url || "";
12624
12633
  if ($("fwh-page-content-mvp · url:", i, "siteId:", t, "apiBase:", n || "(empty)"), !i) return $("fwh-page-content-mvp ✖ missing url"), "Missing url parameter.";
12625
12634
  if (!t) return $("fwh-page-content-mvp ✖ no siteId"), "Site is not configured.";
12626
12635
  if (!n) return $("fwh-page-content-mvp ✖ no api base"), "API base URL is missing; cannot fetch page content.";
@@ -12652,7 +12661,7 @@ function n_(e) {
12652
12661
  },
12653
12662
  "fwh-search-mvp": async (e) => {
12654
12663
  $("fwh-search-mvp ▶", e);
12655
- let r = Zg(e).query;
12664
+ let r = Qg(e).query;
12656
12665
  if (!r) return $("fwh-search-mvp ✖ missing query"), "Missing query parameter.";
12657
12666
  if (!t) return $("fwh-search-mvp ✖ no siteId"), "Search unavailable (no siteId configured).";
12658
12667
  if (!n) return $("fwh-search-mvp ✖ no api base"), "Search unavailable (no API base URL).";
@@ -12690,7 +12699,7 @@ function n_(e) {
12690
12699
  "[class*='menu'] a",
12691
12700
  "[class*='header'] a"
12692
12701
  ];
12693
- if (Vg((t) => {
12702
+ if (Hg((t) => {
12694
12703
  for (let r of n) try {
12695
12704
  t.querySelectorAll(r).forEach((t) => {
12696
12705
  if (An(t)) return;
@@ -12698,7 +12707,7 @@ function n_(e) {
12698
12707
  if (!r || !n || n === "#" || n.startsWith("javascript:")) return;
12699
12708
  try {
12700
12709
  let e = t.parentElement;
12701
- if (e && Bg(e).display === "none" && !e.closest("nav, [role='navigation'], header, [class*='nav'], [class*='menu']")) return;
12710
+ if (e && Vg(e).display === "none" && !e.closest("nav, [role='navigation'], header, [class*='nav'], [class*='menu']")) return;
12702
12711
  } catch {}
12703
12712
  let i = r.toLowerCase() + "|" + n;
12704
12713
  e.has(i) || e.set(i, {
@@ -12709,7 +12718,7 @@ function n_(e) {
12709
12718
  } catch {}
12710
12719
  t.querySelectorAll("select").forEach((t) => {
12711
12720
  if (An(t)) return;
12712
- let n = Ug(t);
12721
+ let n = Wg(t);
12713
12722
  /nav|menu|page|section|go to/i.test(n || t.name || t.id || "") && Array.from(t.options).forEach((r) => {
12714
12723
  if (!r.value || r.disabled) return;
12715
12724
  let i = r.text.trim();
@@ -12733,7 +12742,7 @@ function n_(e) {
12733
12742
  if ($("fwh-get-current-page-mvp ▶"), typeof window > "u") return "Cannot determine current page (no browser context).";
12734
12743
  let e = window.location.href, t = window.location.pathname, n = document.title || "";
12735
12744
  if (yr()) return $("fwh-get-current-page-mvp ✓ 404 detected", { url: e }), `CURRENT_PAGE_NOT_FOUND. The visitor is currently on a 404 / page-not-found error page (${e}). There is no real content here. Do NOT describe this page, do NOT list sections, do NOT offer a walkthrough, and do NOT describe it from your own knowledge. Tell the visitor plainly that the page they are on doesn't exist, and offer to take them somewhere that does.`;
12736
- let { headings: r, pageTitleHeading: i, introText: a } = e_();
12745
+ let { headings: r, pageTitleHeading: i, introText: a } = t_();
12737
12746
  $("fwh-get-current-page-mvp ✓", {
12738
12747
  url: e,
12739
12748
  path: t,
@@ -12745,7 +12754,7 @@ function n_(e) {
12745
12754
  return `CURRENT_PAGE. URL: ${e} | Title: ${n} | Page sections (${r.length} total): ${s}.${o} *** WALKTHROUGH: do NOT drive it yourself. Do not call fwh-highlight-mvp and do not decide the order — highlighting and section order are handled for you. You will be told which section to describe, one at a time. When told, describe ONLY that section in 3-4 sentences and then stop; never announce another section, never ask whether to continue. ***`;
12746
12755
  },
12747
12756
  "fwh-list-forms-mvp": async () => {
12748
- let e = Gg(), t = Kg();
12757
+ let e = Kg(), t = qg();
12749
12758
  $("fwh-list-forms-mvp ✓", `${e.length} field(s)`, `${t.length} button(s)`);
12750
12759
  let n = e.map((e) => ({
12751
12760
  ...e,
@@ -12759,12 +12768,12 @@ function n_(e) {
12759
12768
  },
12760
12769
  "fwh-fill-form-mvp": async () => "FORM_FILLING_DISABLED: Form filling is not available at this time. Tell the visitor what fields are present (use fwh-list-forms-mvp) and ask them to fill the form themselves.",
12761
12770
  "fwh-click-button-mvp": async (e) => {
12762
- let t = Zg(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim(), r = (t.card_context ?? t.cardContext ?? "").trim();
12771
+ let t = Qg(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim(), r = (t.card_context ?? t.cardContext ?? "").trim();
12763
12772
  if ($("fwh-click-button-mvp ▶", n, r ? `(card_context: ${r})` : ""), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
12764
- let a = Xg(n, i, r);
12773
+ let a = Zg(n, i, r);
12765
12774
  if (!a) return $("fwh-click-button-mvp ✖ no match"), `Could not find a button matching "${n}". Call fwh-list-forms-mvp to see button texts.`;
12766
12775
  try {
12767
- xg(`Clicking ${n}...`, { spinner: !0 });
12776
+ Sg(`Clicking ${n}...`, { spinner: !0 });
12768
12777
  try {
12769
12778
  a.scrollIntoView({
12770
12779
  block: "center",
@@ -12773,22 +12782,22 @@ function n_(e) {
12773
12782
  } catch {
12774
12783
  a.scrollIntoView(!0);
12775
12784
  }
12776
- await Mg(a), a.focus?.(), await Pg(a), Fg(a), a.click();
12785
+ await Ng(a), a.focus?.(), await Fg(a), Ig(a), a.click();
12777
12786
  let e = (a.textContent || a.value || a.getAttribute("aria-label") || "").trim().slice(0, 80) || "button", t = `OK_CLICK ${e}`;
12778
- return $("fwh-click-button-mvp ✓", t), xg(`Clicked ${e}`, {
12787
+ return $("fwh-click-button-mvp ✓", t), Sg(`Clicked ${e}`, {
12779
12788
  spinner: !1,
12780
12789
  icon: "✅",
12781
12790
  duration: 1200
12782
12791
  }), t;
12783
12792
  } catch (e) {
12784
12793
  let t = `Click failed: ${e?.message || String(e)}`;
12785
- return $("fwh-click-button-mvp ✖", t), xg("Click failed", {
12794
+ return $("fwh-click-button-mvp ✖", t), Sg("Click failed", {
12786
12795
  spinner: !1,
12787
12796
  icon: "⚠️",
12788
12797
  duration: 1800
12789
12798
  }), t;
12790
12799
  } finally {
12791
- Ng(), Sg(700);
12800
+ Pg(), Cg(700);
12792
12801
  }
12793
12802
  },
12794
12803
  "fwh-cart-get-mvp": async () => {
@@ -12901,18 +12910,18 @@ function n_(e) {
12901
12910
  clickPageButton: a["fwh-click-button-mvp"]
12902
12911
  };
12903
12912
  }
12904
- var r_ = /^(get in touch|contact us|let'?s (talk|connect)|subscribe|newsletter|follow us|quick links|company|solutions|what we do|resources|legal|sitemap|share this)/i;
12905
- function i_() {
12913
+ var i_ = /^(get in touch|contact us|let'?s (talk|connect)|subscribe|newsletter|follow us|quick links|company|solutions|what we do|resources|legal|sitemap|share this)/i;
12914
+ function a_() {
12906
12915
  try {
12907
- let { headings: e, pageTitleHeading: t } = e_();
12908
- return (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !t || e.trim() !== t.trim()).filter((e) => !r_.test(e.trim()));
12916
+ let { headings: e, pageTitleHeading: t } = t_();
12917
+ return (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !t || e.trim() !== t.trim()).filter((e) => !i_.test(e.trim()));
12909
12918
  } catch {
12910
12919
  return [];
12911
12920
  }
12912
12921
  }
12913
12922
  //#endregion
12914
12923
  //#region src/utils/wrapVoiceToolsForLogging.js
12915
- function a_(e) {
12924
+ function o_(e) {
12916
12925
  return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
12917
12926
  let r = wn();
12918
12927
  r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
@@ -12929,7 +12938,11 @@ function a_(e) {
12929
12938
  }
12930
12939
  //#endregion
12931
12940
  //#region src/components/FlowEngageWidget.jsx
12932
- var o_ = {
12941
+ var s_ = "[PAGE_CONTEXT]";
12942
+ function c_(e, t, n) {
12943
+ return `${s_} SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${t || ""}. ${n ? `Forms: ${n}. ` : ""}The visitor is ALREADY on this page — do NOT offer to navigate there.`;
12944
+ }
12945
+ var l_ = {
12933
12946
  blue: "#135bd8",
12934
12947
  red: "#ef334b",
12935
12948
  yellow: "#ffbd2e",
@@ -12937,7 +12950,7 @@ var o_ = {
12937
12950
  highlight: "rgba(255,255,255,0.9)",
12938
12951
  green: "#10b981"
12939
12952
  };
12940
- function s_(e) {
12953
+ function u_(e) {
12941
12954
  if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
12942
12955
  let [t, n, r] = e;
12943
12956
  return e.length >= 3 && r ? [
@@ -12951,12 +12964,12 @@ function s_(e) {
12951
12964
  "#f7f8fa"
12952
12965
  ].join(", ");
12953
12966
  }
12954
- function c_(e) {
12967
+ function d_(e) {
12955
12968
  if (!e || typeof e != "string") return "#1a1a1a";
12956
12969
  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;
12957
12970
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
12958
12971
  }
12959
- function l_(t) {
12972
+ function f_(t) {
12960
12973
  let [n, r] = e.useState(null), i = typeof t == "string" ? t.trim() : "";
12961
12974
  return e.useEffect(() => {
12962
12975
  if (!i) {
@@ -12974,8 +12987,8 @@ function l_(t) {
12974
12987
  };
12975
12988
  }, [i]), n;
12976
12989
  }
12977
- function u_({ logo: t, style: n }) {
12978
- let r = l_(typeof t == "string" ? t : null);
12990
+ function p_({ logo: t, style: n }) {
12991
+ let r = f_(typeof t == "string" ? t : null);
12979
12992
  if (!t) return null;
12980
12993
  if (typeof t == "string") return r ? /* @__PURE__ */ g("img", {
12981
12994
  src: r,
@@ -13000,7 +13013,7 @@ function u_({ logo: t, style: n }) {
13000
13013
  children: i
13001
13014
  }) : null;
13002
13015
  }
13003
- function d_({ title: e }) {
13016
+ function m_({ title: e }) {
13004
13017
  return /* @__PURE__ */ g("div", {
13005
13018
  style: {
13006
13019
  width: "100%",
@@ -13018,18 +13031,18 @@ function d_({ title: e }) {
13018
13031
  children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
13019
13032
  });
13020
13033
  }
13021
- function f_(e, t) {
13034
+ function h_(e, t) {
13022
13035
  let n = (t || "").trim();
13023
13036
  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) || e === "bot" && (/\b(that'?s all|we'?re done)\b/i.test(n) || /\b(goodbye|bye)\b/i.test(n) || /\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))) : !1;
13024
13037
  }
13025
- function p_({ orbColors: e, ...t }) {
13026
- return /* @__PURE__ */ g(sg, {
13038
+ function g_({ orbColors: e, ...t }) {
13039
+ return /* @__PURE__ */ g(cg, {
13027
13040
  colors: e,
13028
13041
  ...t
13029
13042
  });
13030
13043
  }
13031
- function m_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
13032
- let s = n || o_.green, c = c_(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
13044
+ function __({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
13045
+ let s = n || l_.green, c = d_(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
13033
13046
  style: {
13034
13047
  display: "flex",
13035
13048
  alignItems: a ? "flex-end" : "center",
@@ -13155,7 +13168,7 @@ function m_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
13155
13168
  delay: 0
13156
13169
  },
13157
13170
  style: { flexShrink: 0 },
13158
- children: /* @__PURE__ */ g(p_, {
13171
+ children: /* @__PURE__ */ g(g_, {
13159
13172
  size: l,
13160
13173
  orbColors: t
13161
13174
  })
@@ -13187,8 +13200,8 @@ function m_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
13187
13200
  children: u
13188
13201
  })] });
13189
13202
  }
13190
- function h_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
13191
- let c = n || o_.green, l = c_(c);
13203
+ function v_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
13204
+ let c = n || l_.green, l = d_(c);
13192
13205
  return /* @__PURE__ */ _(eh.div, {
13193
13206
  initial: {
13194
13207
  scale: 50 / 350,
@@ -13259,7 +13272,7 @@ function h_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
13259
13272
  children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
13260
13273
  })
13261
13274
  }),
13262
- /* @__PURE__ */ g(p_, {
13275
+ /* @__PURE__ */ g(g_, {
13263
13276
  size: 72,
13264
13277
  orbColors: t
13265
13278
  }),
@@ -13339,7 +13352,7 @@ function h_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
13339
13352
  ]
13340
13353
  });
13341
13354
  }
13342
- function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, voiceEndCounter: d, websiteName: f, voiceFirstMessage: h, captureVisitorEmail: v, emailRequired: y, emailCaptureEnabled: b = !0, listeningLabel: x = "Listening...", thinkingLabel: S = "Thinking...", enterChatModeLabel: C = "Enter Chat Mode", endConversationLabel: w = "End Conversation" }) {
13355
+ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, voiceEndCounter: d, websiteName: f, voiceFirstMessage: h, captureVisitorEmail: v, emailRequired: y, emailCaptureEnabled: b = !0, listeningLabel: x = "Listening...", thinkingLabel: S = "Thinking...", enterChatModeLabel: C = "Enter Chat Mode", endConversationLabel: w = "End Conversation" }) {
13343
13356
  c(() => (console.log("[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED"), () => console.log("[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED")), []);
13344
13357
  let [T, E] = m("idle"), [D, O] = m(!1), [k, A] = m(!1), [ee, te] = m(!1), [ne, j] = m(""), [M, re] = m(""), ie = p(!1), ae = p(!1), N = p(null), oe = p(0), se = p(""), ce = p(!1), le = p(0), ue = p(!1), de = p(!1), fe = p(!1), pe = p([]), me = p(null), he = (e) => {
13345
13358
  ue.current = e, e || (de.current = !1), P.current?.setWalkthroughActive?.(e);
@@ -13463,7 +13476,7 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13463
13476
  if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
13464
13477
  l.current = [], ve.current = "", be.current = !1, xe.current = !1, L.current = !1, Te.current = "minimized", Dr({ onBeforeNavigate: () => {
13465
13478
  if (i && l.current.length > 0) try {
13466
- let e = gg(l.current);
13479
+ let e = _g(l.current);
13467
13480
  e && I(i, e);
13468
13481
  } catch {}
13469
13482
  if (!qn()) {
@@ -13485,7 +13498,7 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13485
13498
  }
13486
13499
  we();
13487
13500
  } });
13488
- let t = a_(n_({
13501
+ let t = o_(r_({
13489
13502
  siteId: i || null,
13490
13503
  apiBaseUrl: a || null,
13491
13504
  chatId: s || null,
@@ -13530,7 +13543,7 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13530
13543
  let e = f || "";
13531
13544
  x.greeting = h || (v ? e ? `Hi, welcome to ${e}! How may I help you?` : "Hi, welcome! How may I help you?" : `Welcome to ${T}! How may I help you?`), v || console.log(`[FlowEngage] 🏠 Page-context greeting: "${w}" for ${m}`);
13532
13545
  }
13533
- let A = !1, ee = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you to the [page] page. Do you want to know about any specific section or want a complete overview?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until the visitor responds. When they reply: if they name a specific section → call fwh-get-current-page-mvp then answer immediately; if they say "overview" or anything non-specific → call fwh-get-current-page-mvp (zero speech) then do a full highlighted walkthrough.` : null, ne = !1, j = !p && !r ? "Your greeting has been spoken. Wait for the visitor to ask a question or tell you what they need. Do NOT auto-start a walkthrough or highlight any sections — let the visitor lead." : null, M = r && !p, re = !1, N = M ? `The question "Would you like me to continue what I was explaining before, or would you like to know about this page instead?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript, or the visitor navigated before saying much)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until they respond. When they reply: if they want you to CONTINUE the previous topic → resume verbally from the prior transcript above, do NOT call fwh-get-current-page-mvp or describe the new page unless they ask. If they want to know about THIS page → call fwh-get-current-page-mvp (zero speech) then proceed as a normal fresh-page walkthrough/description. If their reply is ambiguous, ask them to clarify which they'd prefer rather than guessing.` : null, ye = !1, Ce = !1, Oe = b && !!y && !fe.current, ze = await yh.startSession({
13546
+ let A = !1, ee = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you to the [page] page. Do you want to know about any specific section or want a complete overview?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until the visitor responds. When they reply: if they name a specific section → call fwh-get-current-page-mvp then answer immediately; if they say "overview" or anything non-specific → call fwh-get-current-page-mvp (zero speech) then do a full highlighted walkthrough.` : null, ne = !1, j = !p && !r ? "Your greeting has been spoken. Wait for the visitor to ask a question or tell you what they need. Do NOT auto-start a walkthrough or highlight any sections — let the visitor lead." : null, M = r && !p, re = !1, N = M ? `The question "Would you like me to continue what I was explaining before, or would you like to know about this page instead?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript, or the visitor navigated before saying much)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until they respond. When they reply: if they want you to CONTINUE the previous topic → resume verbally from the prior transcript above, do NOT call fwh-get-current-page-mvp or describe the new page unless they ask. If they want to know about THIS page → call fwh-get-current-page-mvp (zero speech) then proceed as a normal fresh-page walkthrough/description. If their reply is ambiguous, ask them to clarify which they'd prefer rather than guessing.` : null, ye = !1, Ce = !1, Oe = b && !!y && !fe.current, ze = await bh.startSession({
13534
13547
  ...x,
13535
13548
  onConnect: ({ conversationId: e }) => {
13536
13549
  Ee.current = e, De.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
@@ -13602,7 +13615,7 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13602
13615
  onMessage: (t) => {
13603
13616
  if (e || ce.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
13604
13617
  let n = t.role === "user" && /^(Describe the section titled "|\[SYSTEM:|Give the visitor a complete spoken overview|That was the last section)/.test(String(t.message || "").trim()), r = /\b(?:this|that|the)\s+(?:case\s*stud(?:y|ies)|product|article|blog|post|item|service)\b/i.test(String(t.message || ""));
13605
- if (!n && !r && t.role === "user" && V.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null), he(!0), de.current = !1, le.current = 0, ge.current = -1, pe.current = i_(), setTimeout(() => me.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${pe.current.length} sections on this page`);
13618
+ if (!n && !r && t.role === "user" && V.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null), he(!0), de.current = !1, le.current = 0, ge.current = -1, pe.current = a_(), setTimeout(() => me.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${pe.current.length} sections on this page`);
13606
13619
  else if (!n && t.role === "user" && ue.current) {
13607
13620
  let e = String(t.message || "").trim();
13608
13621
  Le.test(e) ? de.current && (de.current = !1, console.debug("[FlowEngage] walkthrough resumed by visitor"), setTimeout(() => me.current?.(), 300)) : (de.current = !0, console.debug("[FlowEngage] walkthrough paused — visitor interjected"));
@@ -13619,10 +13632,10 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13619
13632
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
13620
13633
  debug: t.debug
13621
13634
  }], i) try {
13622
- let e = gg(l.current);
13635
+ let e = _g(l.current);
13623
13636
  e && I(i, e);
13624
13637
  } catch {}
13625
- if (f_(a, o)) {
13638
+ if (h_(a, o)) {
13626
13639
  je.current = !0;
13627
13640
  return;
13628
13641
  }
@@ -13682,7 +13695,7 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13682
13695
  n.length || (n = Array.from(document.body.querySelectorAll("h1, h2, h3")).filter((t) => !t.closest(e)).map((e) => e.textContent.replace(/\s+/g, " ").trim()).filter((e) => e.length > 2 && e.length < 200)), n.length && (o = [...new Set(n)].slice(0, 15).join(" | "));
13683
13696
  } catch {}
13684
13697
  let s = r && !p ? `RESUMING PRIOR SESSION — DO NOT GREET. The visitor is continuing the same conversation after a page reload. Do not introduce yourself or re-state your capabilities. Wait silently until the visitor speaks; if you must speak first, briefly acknowledge where you left off in one short sentence.\nPrior transcript:\n${n?.transcript || ""}\n\n` : "";
13685
- ze.sendContextualUpdate(`${s}SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${o}. SiteId: ${i || "unknown"}. Forms: ${a}. ${y ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}The visitor is ALREADY on this page — do NOT offer to navigate there. WALKTHROUGH RULE: When the visitor asks for a walkthrough or overview of this page, you MUST IMMEDIATELY call fwh-get-current-page-mvp (zero speech — call it silently with NO words before it) to get the exact highlightable headings. The approximate headings above are for routing awareness ONLY — they are NOT precise enough for fwh-highlight-mvp. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`);
13698
+ ze.sendContextualUpdate(`${s}SiteId: ${i || "unknown"}. ${y ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}WALKTHROUGH RULE: When the visitor asks for a walkthrough or overview of this page, you MUST IMMEDIATELY call fwh-get-current-page-mvp (zero speech — call it silently with NO words before it) to get the exact highlightable headings. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`), ze.sendContextualUpdate(c_(e, o, a));
13686
13699
  } catch {}
13687
13700
  if (typeof window < "u") {
13688
13701
  let t = window.location.pathname, n = Date.now(), r = (e) => {
@@ -13711,23 +13724,29 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13711
13724
  try {
13712
13725
  On();
13713
13726
  } catch {}
13714
- let d = (e) => (e.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home", f = d(s), p = d(i);
13727
+ let d = u.map((e) => e.text).join(" | "), f = (e) => (e.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home", p = f(s), m = f(i);
13715
13728
  if (o) {
13716
13729
  typeof window < "u" && (window.__fe_agent_nav = null), console.log(`[FlowEngage] agent-driven navigation settled: "${s}" → "${i}"`);
13717
13730
  try {
13718
- P.current?.sendUserMessage?.(`[SYSTEM: YOU just navigated the visitor to the "${p}" page (${c}) at their request — this was YOUR action, not theirs. Page title: "${l}". Sections: ${JSON.stringify(u)}. Say: "Here we are on the ${p} page." Then introduce this page in 2-3 sentences, and finish by asking: "Would you like me to walk you through it section by section?" NEVER say "I see you've navigated" — the visitor did not navigate, you did. Do NOT call fwh-navigate-mvp again. Wait for their answer before describing sections.]`, { suppressQuestion: !0 });
13731
+ P.current?.sendUserMessage?.(`[SYSTEM: YOU just navigated the visitor to the "${m}" page (${c}) at their request — this was YOUR action, not theirs. Page title: "${l}". Sections: ${JSON.stringify(u)}. Say: "Here we are on the ${m} page." Then introduce this page in 2-3 sentences, and finish by asking: "Would you like me to walk you through it section by section?" NEVER say "I see you've navigated" — the visitor did not navigate, you did. Do NOT call fwh-navigate-mvp again. Wait for their answer before describing sections.]`, { suppressQuestion: !0 });
13732
+ } catch {}
13733
+ try {
13734
+ P.current?.sendContextualUpdate?.(c_(c, d));
13719
13735
  } catch {}
13720
13736
  return;
13721
13737
  }
13722
13738
  typeof window < "u" && (window.__fe_user_nav_during_speech = {
13723
13739
  fromPath: s,
13724
13740
  toPath: i,
13725
- fromPageName: f,
13726
- toPageName: p,
13741
+ fromPageName: p,
13742
+ toPageName: m,
13727
13743
  ts: Date.now()
13728
13744
  }), console.log(`[FlowEngage] visitor navigation detected: "${s}" → "${i}" (agent target: ${k || "none"})`);
13729
13745
  try {
13730
- P.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${p}" page (${c}). Page title: "${l}". Sections: ${JSON.stringify(u)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${p} page — would you like me to continue what I was explaining, or shall I walk you through this page?" Then wait for my answer. IF I say continue/yes/carry on: resume speaking verbally from where you left off — do NOT call fwh-navigate-mvp, do NOT call fwh-highlight-mvp, the visitor will navigate themselves if needed. IF I want to hear about this page: call fwh-highlight-mvp for sections of "${p}" only.]`);
13746
+ P.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${m}" page (${c}). Page title: "${l}". Sections: ${JSON.stringify(u)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${m} page — would you like me to continue what I was explaining, or shall I walk you through this page?" Then wait for my answer. IF I say continue/yes/carry on: resume speaking verbally from where you left off — do NOT call fwh-navigate-mvp, do NOT call fwh-highlight-mvp, the visitor will navigate themselves if needed. IF I want to hear about this page: call fwh-highlight-mvp for sections of "${m}" only.]`);
13747
+ } catch {}
13748
+ try {
13749
+ P.current?.sendContextualUpdate?.(c_(c, d));
13731
13750
  } catch {}
13732
13751
  };
13733
13752
  c = window.history.pushState.bind(window.history), window.history.pushState = (...e) => {
@@ -13939,7 +13958,7 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13939
13958
  },
13940
13959
  children: "Muted"
13941
13960
  }),
13942
- /* @__PURE__ */ g(p_, {
13961
+ /* @__PURE__ */ g(g_, {
13943
13962
  size: 72,
13944
13963
  voiceState: T,
13945
13964
  isMuted: D,
@@ -14011,7 +14030,7 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14011
14030
  y2: "23"
14012
14031
  })
14013
14032
  ]
14014
- }) : /* @__PURE__ */ g(bh, {
14033
+ }) : /* @__PURE__ */ g(xh, {
14015
14034
  size: 16,
14016
14035
  color: "currentColor"
14017
14036
  })
@@ -14033,7 +14052,7 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14033
14052
  padding: 0,
14034
14053
  flexShrink: 0
14035
14054
  },
14036
- children: /* @__PURE__ */ g(Oh, {
14055
+ children: /* @__PURE__ */ g(kh, {
14037
14056
  size: 16,
14038
14057
  color: "currentColor"
14039
14058
  })
@@ -14082,7 +14101,7 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14082
14101
  onMouseLeave: (e) => {
14083
14102
  e.currentTarget.style.background = "none";
14084
14103
  },
14085
- children: [/* @__PURE__ */ g(kh, {}), C]
14104
+ children: [/* @__PURE__ */ g(Ah, {}), C]
14086
14105
  }),
14087
14106
  /* @__PURE__ */ _("button", {
14088
14107
  onClick: () => {
@@ -14111,7 +14130,7 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14111
14130
  onMouseLeave: (e) => {
14112
14131
  e.currentTarget.style.background = "none";
14113
14132
  },
14114
- children: [/* @__PURE__ */ g(Ah, {}), w]
14133
+ children: [/* @__PURE__ */ g(jh, {}), w]
14115
14134
  }),
14116
14135
  /* @__PURE__ */ g("button", {
14117
14136
  onClick: () => A(!1),
@@ -14163,7 +14182,7 @@ function g_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14163
14182
  ]
14164
14183
  });
14165
14184
  }
14166
- function __({ orbColors: e }) {
14185
+ function b_({ orbColors: e }) {
14167
14186
  let t = Array.isArray(e) && e.length > 0 ? e : [
14168
14187
  "#135bd8",
14169
14188
  "#ef334b",
@@ -14182,7 +14201,7 @@ function __({ orbColors: e }) {
14182
14201
  `.replace(/\s+/g, " ").trim()
14183
14202
  } });
14184
14203
  }
14185
- var v_ = () => /* @__PURE__ */ g("div", {
14204
+ var x_ = () => /* @__PURE__ */ g("div", {
14186
14205
  style: {
14187
14206
  display: "flex",
14188
14207
  marginBottom: "12px",
@@ -14212,7 +14231,7 @@ var v_ = () => /* @__PURE__ */ g("div", {
14212
14231
  } }, e))
14213
14232
  })
14214
14233
  });
14215
- function y_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: E, rateLimitMessage: D, selectedFile: O, onFileSelect: k, onRemoveSelectedFile: A, attachmentError: ee, isUploadingAttachment: te, requiresEmail: ne, emailInput: j, setEmailInput: M, emailError: re, emailCaptureSuccess: ie, replyContext: ae, setReplyContext: N, webRTCError: oe, micError: se, setMicError: ce, dismissCallError: le, activeCallId: ue, isCallMuted: de, toggleCallMute: fe, endWebRTCCall: pe, formatCallDuration: me, callDurationSeconds: he, isCallMinimized: ge, onExpand: P, onCollapse: _e, onStartVoice: ve, voiceEnabled: ye, headerBgColor: be, onNewChat: F, showPoweredBy: xe, privacyPolicyUrl: I, getVisitorChatHistory: Se, resumeChat: Ce, isSessionRestoring: L, isClosing: we }) {
14234
+ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: E, rateLimitMessage: D, selectedFile: O, onFileSelect: k, onRemoveSelectedFile: A, attachmentError: ee, isUploadingAttachment: te, requiresEmail: ne, emailInput: j, setEmailInput: M, emailError: re, emailCaptureSuccess: ie, replyContext: ae, setReplyContext: N, webRTCError: oe, micError: se, setMicError: ce, dismissCallError: le, activeCallId: ue, isCallMuted: de, toggleCallMute: fe, endWebRTCCall: pe, formatCallDuration: me, callDurationSeconds: he, isCallMinimized: ge, onExpand: P, onCollapse: _e, onStartVoice: ve, voiceEnabled: ye, headerBgColor: be, onNewChat: F, showPoweredBy: xe, privacyPolicyUrl: I, getVisitorChatHistory: Se, resumeChat: Ce, isSessionRestoring: L, isClosing: we }) {
14216
14235
  let Te = l.length > 0, Ee = T || E || w, De = !!ue, [Oe, ke] = m(!1), [Ae, je] = m(!1), [Me, R] = m([]), [z, Ne] = m(!1), Pe = p(null), [Fe, B] = m(() => typeof window < "u" ? window.visualViewport?.height ?? window.innerHeight : 600), [V, Ie] = m(0);
14217
14236
  c(() => {
14218
14237
  if (!s) return;
@@ -14352,7 +14371,7 @@ function y_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14352
14371
  justifyContent: "center",
14353
14372
  height: "40px"
14354
14373
  },
14355
- children: i ? /* @__PURE__ */ g(u_, {
14374
+ children: i ? /* @__PURE__ */ g(p_, {
14356
14375
  logo: i,
14357
14376
  style: {
14358
14377
  height: "34px",
@@ -14365,7 +14384,7 @@ function y_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14365
14384
  height: "40px",
14366
14385
  flexShrink: 0
14367
14386
  },
14368
- children: /* @__PURE__ */ g(d_, { title: e.chatTitle })
14387
+ children: /* @__PURE__ */ g(m_, { title: e.chatTitle })
14369
14388
  })
14370
14389
  }), o && /* @__PURE__ */ g("div", {
14371
14390
  style: {
@@ -14648,7 +14667,7 @@ function y_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14648
14667
  })
14649
14668
  ]
14650
14669
  }),
14651
- /* @__PURE__ */ g(Qh, {
14670
+ /* @__PURE__ */ g($h, {
14652
14671
  webRTCError: oe,
14653
14672
  micError: se,
14654
14673
  setMicError: ce,
@@ -14656,7 +14675,7 @@ function y_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14656
14675
  isRateLimited: E,
14657
14676
  rateLimitMessage: D
14658
14677
  }),
14659
- ge && /* @__PURE__ */ g(hg, {
14678
+ ge && /* @__PURE__ */ g(gg, {
14660
14679
  agentName: v,
14661
14680
  agentHeadshot: y,
14662
14681
  fallbackAgentName: b,
@@ -14790,17 +14809,17 @@ function y_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14790
14809
  children: "No previous chats found."
14791
14810
  })
14792
14811
  })]
14793
- }) : null, Te ? /* @__PURE__ */ g(Yh, {
14812
+ }) : null, Te ? /* @__PURE__ */ g(Xh, {
14794
14813
  chatHistory: l,
14795
14814
  isAiTyping: u,
14796
14815
  isLoading: T,
14797
14816
  isAgentTyping: d,
14798
14817
  setReplyContext: N,
14799
- TypingDots: v_,
14818
+ TypingDots: x_,
14800
14819
  primaryColor: n,
14801
14820
  agentHeadshot: y,
14802
14821
  agentDisplayName: v || b,
14803
- botAvatarNode: /* @__PURE__ */ g(__, { orbColors: t })
14822
+ botAvatarNode: /* @__PURE__ */ g(b_, { orbColors: t })
14804
14823
  }) : L ? /* @__PURE__ */ _("div", {
14805
14824
  style: {
14806
14825
  flex: 1,
@@ -14841,7 +14860,7 @@ function y_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14841
14860
  padding: "28px 24px"
14842
14861
  },
14843
14862
  children: [
14844
- /* @__PURE__ */ g(p_, {
14863
+ /* @__PURE__ */ g(g_, {
14845
14864
  size: 94,
14846
14865
  orbColors: t
14847
14866
  }),
@@ -14932,7 +14951,7 @@ function y_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14932
14951
  zIndex: 1,
14933
14952
  padding: ne ? "6px 0 0" : "12px 0 0"
14934
14953
  },
14935
- children: /* @__PURE__ */ g(Zh, {
14954
+ children: /* @__PURE__ */ g(Qh, {
14936
14955
  input: x,
14937
14956
  setInput: S,
14938
14957
  onSubmit: C,
@@ -15006,7 +15025,7 @@ function y_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
15006
15025
  ]
15007
15026
  });
15008
15027
  }
15009
- function b_() {
15028
+ function C_() {
15010
15029
  let { status: e, runtimeConfig: t, resolvedConfig: n, chatHistory: r, isOpen: i, activeScreen: a, isHumanHandled: s, agentName: l, agentHeadshot: u, visitorEmail: h, isAgentTyping: v, isAiTyping: y, isLoading: b, isRateLimited: x, rateLimitMessage: S, isConversationEnded: C, incomingCall: w, activeCallId: T, callConnectionState: E, callConnectedAt: D, isCallMuted: O, webRTCError: k, language: A, chatId: ee, historyRef: te, onMessageSync: ne, sendMessage: j, uploadChatFile: M, openWidget: re, captureVisitorEmail: ie, setVoiceMode: ae, endConversation: N, startNewChat: ce, acceptCall: le, rejectCall: ue, endWebRTCCall: de, toggleCallMute: fe, dismissCallError: pe, startTyping: me, stopTyping: he, updateTypingDraft: ge, getVisitorChatHistory: P, resumeChat: _e, isSessionRestoring: ve, openToChatCounter: ye, voiceEndCounter: be } = Cn();
15011
15030
  c(() => {
15012
15031
  try {
@@ -15028,7 +15047,7 @@ function b_() {
15028
15047
  small: 50,
15029
15048
  medium: 64,
15030
15049
  large: 80
15031
- }, je = Ae[L.orbSize] || Ae.small, Me = L.position || "bottom-right", R = I.fallbackAgentName || "Agent", z = s_(De ?? L.chatBgColors), Ne = I.logo || I.logoUrl || null, Pe = A || "en", Fe = F.recommendations?.[Pe] || [], B = (xe.recommendations?.[Pe] ?? Fe).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
15050
+ }, je = Ae[L.orbSize] || Ae.small, Me = L.position || "bottom-right", R = I.fallbackAgentName || "Agent", z = u_(De ?? L.chatBgColors), Ne = I.logo || I.logoUrl || null, Pe = A || "en", Fe = F.recommendations?.[Pe] || [], B = (xe.recommendations?.[Pe] ?? Fe).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
15032
15051
  id: e.key || `qr-${t}`,
15033
15052
  label: e.label,
15034
15053
  message: e.label,
@@ -15119,7 +15138,7 @@ function b_() {
15119
15138
  let Ot = o(() => {
15120
15139
  mt(null), gt("");
15121
15140
  }, []), kt = o((e) => {
15122
- let t = Wh(e);
15141
+ let t = Gh(e);
15123
15142
  if (t) {
15124
15143
  mt(null), gt(t);
15125
15144
  return;
@@ -15225,7 +15244,7 @@ function b_() {
15225
15244
  if (pt) {
15226
15245
  try {
15227
15246
  vt(!0), gt("");
15228
- let e = await M(pt), n = e?.data || e, r = et.trim() || `Shared file: ${Kh(pt)}`;
15247
+ let e = await M(pt), n = e?.data || e, r = et.trim() || `Shared file: ${qh(pt)}`;
15229
15248
  tt(""), G(null), Ot(), await j(r, "", t, {
15230
15249
  type: "file",
15231
15250
  metadata: {
@@ -15318,7 +15337,7 @@ function b_() {
15318
15337
  onWheel: (e) => e.stopPropagation(),
15319
15338
  onTouchMove: (e) => e.stopPropagation(),
15320
15339
  children: [
15321
- W === "entry_prompt" && /* @__PURE__ */ g(m_, {
15340
+ W === "entry_prompt" && /* @__PURE__ */ g(__, {
15322
15341
  copy: Ke,
15323
15342
  orbColors: De,
15324
15343
  primaryColor: ke,
@@ -15401,13 +15420,13 @@ function b_() {
15401
15420
  children: E === "connected" ? `${Ft(lt)} with ${U}` : `Tap to return to ${U}`
15402
15421
  })]
15403
15422
  })]
15404
- }), /* @__PURE__ */ g(p_, {
15423
+ }), /* @__PURE__ */ g(g_, {
15405
15424
  size: je,
15406
15425
  orbColors: De,
15407
15426
  onClick: T ? At : Ee ? zt : Vt
15408
15427
  })]
15409
15428
  }),
15410
- W === "connection_modal" && /* @__PURE__ */ g(h_, {
15429
+ W === "connection_modal" && /* @__PURE__ */ g(v_, {
15411
15430
  copy: Ke,
15412
15431
  orbColors: De,
15413
15432
  primaryColor: ke,
@@ -15417,7 +15436,7 @@ function b_() {
15417
15436
  isMobile: Et,
15418
15437
  isClosing: xt
15419
15438
  }),
15420
- W === "voice_mode" && /* @__PURE__ */ g(g_, {
15439
+ W === "voice_mode" && /* @__PURE__ */ g(y_, {
15421
15440
  orbColors: De,
15422
15441
  onEnterChat: Vt,
15423
15442
  onEndChat: Ht,
@@ -15438,7 +15457,7 @@ function b_() {
15438
15457
  enterChatModeLabel: I.voiceEnterChatLabel || "Enter Chat Mode",
15439
15458
  endConversationLabel: I.voiceEndConversationLabel || "End Conversation"
15440
15459
  }, "voice"),
15441
- W === "call_screen" && /* @__PURE__ */ g(mg, {
15460
+ W === "call_screen" && /* @__PURE__ */ g(hg, {
15442
15461
  incomingCall: w,
15443
15462
  activeCallId: T,
15444
15463
  callConnectionState: E,
@@ -15457,7 +15476,7 @@ function b_() {
15457
15476
  orbColors: De,
15458
15477
  chatHistory: r
15459
15478
  }),
15460
- W === "text_chat" && /* @__PURE__ */ g(y_, {
15479
+ W === "text_chat" && /* @__PURE__ */ g(S_, {
15461
15480
  isClosing: xt,
15462
15481
  copy: Ke,
15463
15482
  orbColors: De,
@@ -15523,7 +15542,7 @@ function b_() {
15523
15542
  }
15524
15543
  //#endregion
15525
15544
  //#region src/components/ErrorBoundary.jsx
15526
- var x_ = class extends e.Component {
15545
+ var w_ = class extends e.Component {
15527
15546
  constructor(e) {
15528
15547
  super(e), this.state = { hasError: !1 };
15529
15548
  }
@@ -15538,4 +15557,4 @@ var x_ = class extends e.Component {
15538
15557
  }
15539
15558
  };
15540
15559
  //#endregion
15541
- export { sg as AnimatedOrb, x_ as ErrorBoundary, pi as FlowEngageProvider, b_ as FlowEngageWidget, Cn as useFlowEngage };
15560
+ export { cg as AnimatedOrb, w_ as ErrorBoundary, pi as FlowEngageProvider, C_ as FlowEngageWidget, Cn as useFlowEngage };