@flowengage/react-chatbot 8.0.120 → 8.0.121

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.
@@ -9529,7 +9529,7 @@ async function Oh(e) {
9529
9529
  break;
9530
9530
  case "PromptUpdated": break;
9531
9531
  case "AgentPanel":
9532
- m?.({
9532
+ console.log("[FlowEngage] AgentPanel received:", e.panel, (e.items || []).length, "items"), m?.({
9533
9533
  panel: e.panel || null,
9534
9534
  title: e.title || null,
9535
9535
  items: e.items || []
@@ -9549,9 +9549,17 @@ async function Oh(e) {
9549
9549
  M && le.enqueue(new Int16Array(e.data));
9550
9550
  return;
9551
9551
  }
9552
+ let t;
9552
9553
  try {
9553
- ge(JSON.parse(e.data));
9554
- } catch {}
9554
+ t = JSON.parse(e.data);
9555
+ } catch {
9556
+ return;
9557
+ }
9558
+ try {
9559
+ ge(t);
9560
+ } catch (e) {
9561
+ console.error("[FlowEngage] voice event handler failed:", t?.type, e);
9562
+ }
9555
9563
  }, w.onerror = () => l?.(/* @__PURE__ */ Error("Voice connection failed")), w.onclose = () => {
9556
9564
  pe(), o?.();
9557
9565
  }, {
@@ -9872,25 +9880,32 @@ function Uh(e, t) {
9872
9880
  n();
9873
9881
  }
9874
9882
  }
9875
- function Wh(e, { title: t = "Products", side: n = "right", productUrl: r = null } = {}) {
9883
+ function Wh(e, t = {}) {
9884
+ try {
9885
+ Gh(e, t);
9886
+ } catch (e) {
9887
+ console.error("[FlowEngage] product panel render failed:", e), Kh();
9888
+ }
9889
+ }
9890
+ function Gh(e, { title: t = "Products", side: n = "right", productUrl: r = null } = {}) {
9876
9891
  if (typeof document > "u") return;
9877
9892
  let i = Array.isArray(e) ? e.filter(Boolean) : [];
9878
- if (!i.length) return Gh();
9893
+ if (!i.length) return console.log("[FlowEngage] product panel: nothing to show"), Kh();
9879
9894
  Ah();
9880
9895
  let a = Lh();
9881
9896
  Vh = n === "left" ? "left" : "right", Uh(a, Vh), Hh || (Hh = !0, window.addEventListener("resize", () => {
9882
9897
  Ih?.classList.contains(`${Q}-show`) && Uh(Ih, Vh);
9883
- })), a.innerHTML = "";
9884
- let o = document.createElement("div");
9885
- o.id = `${Q}-panel-head`;
9886
- let s = document.createElement("div");
9887
- s.id = `${Q}-panel-title`, s.textContent = t;
9888
- let c = document.createElement("span");
9889
- c.id = `${Q}-panel-count`, c.textContent = String(i.length);
9890
- let l = document.createElement("button");
9891
- l.id = `${Q}-panel-close`, l.type = "button", l.setAttribute("aria-label", "Close product panel"), l.textContent = "×", l.addEventListener("click", () => Gh()), o.append(s, c, l);
9892
- let u = document.createElement("div");
9893
- u.id = `${Q}-panel-list`;
9898
+ }));
9899
+ let o = document.createDocumentFragment(), s = document.createElement("div");
9900
+ s.id = `${Q}-panel-head`;
9901
+ let c = document.createElement("div");
9902
+ c.id = `${Q}-panel-title`, c.textContent = t;
9903
+ let l = document.createElement("span");
9904
+ l.id = `${Q}-panel-count`, l.textContent = String(i.length);
9905
+ let u = document.createElement("button");
9906
+ u.id = `${Q}-panel-close`, u.type = "button", u.setAttribute("aria-label", "Close product panel"), u.textContent = "×", u.addEventListener("click", () => Kh()), s.append(c, l, u);
9907
+ let d = document.createElement("div");
9908
+ d.id = `${Q}-panel-list`;
9894
9909
  for (let e of i) {
9895
9910
  let t = typeof r == "function" ? r(e) : null, n = document.createElement(t ? "a" : "div");
9896
9911
  if (n.className = `${Q}-card`, t && (n.href = t, n.rel = "noopener"), e.image) {
@@ -9923,49 +9938,54 @@ function Wh(e, { title: t = "Products", side: n = "right", productUrl: r = null
9923
9938
  let e = document.createElement("div");
9924
9939
  e.className = `${Q}-card-price`, e.textContent = c, i.appendChild(e);
9925
9940
  }
9926
- n.appendChild(i), u.appendChild(n);
9941
+ n.appendChild(i), d.appendChild(n);
9927
9942
  }
9928
- a.append(o, u), a.classList.remove(`${Q}-show`), a.offsetHeight, a.classList.add(`${Q}-show`);
9943
+ o.append(s, d), a.innerHTML = "", a.append(o), a.classList.remove(`${Q}-show`), a.offsetHeight, a.classList.add(`${Q}-show`), console.log("[FlowEngage] product panel shown:", i.length, "items", {
9944
+ left: a.style.left,
9945
+ right: a.style.right,
9946
+ bottom: a.style.bottom,
9947
+ rect: a.getBoundingClientRect()
9948
+ });
9929
9949
  }
9930
- function Gh() {
9950
+ function Kh() {
9931
9951
  Ih && Ih.classList.remove(`${Q}-show`);
9932
9952
  }
9933
- var Kh = null, qh = [];
9934
- function Jh() {
9935
- return (!Kh || !Kh.isConnected) && (Kh = document.createElement("div"), Kh.id = `${Q}-bar`, document.body.appendChild(Kh)), Kh;
9936
- }
9953
+ var qh = null, Jh = [];
9937
9954
  function Yh() {
9955
+ return (!qh || !qh.isConnected) && (qh = document.createElement("div"), qh.id = `${Q}-bar`, document.body.appendChild(qh)), qh;
9956
+ }
9957
+ function Xh() {
9938
9958
  if (typeof document > "u") return;
9939
- Ah(), qh.forEach(clearTimeout), qh = [];
9940
- let e = Jh();
9959
+ Ah(), Jh.forEach(clearTimeout), Jh = [];
9960
+ let e = Yh();
9941
9961
  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";
9942
9962
  let t = [[80, "width 0.6s ease"], [92, "width 1.2s ease"]], n = 50;
9943
9963
  for (let [e, r] of t) {
9944
9964
  let t = n, i = e, a = r;
9945
- qh.push(setTimeout(() => {
9946
- Kh && (Kh.style.transition = a, Kh.style.width = `${i}%`);
9965
+ Jh.push(setTimeout(() => {
9966
+ qh && (qh.style.transition = a, qh.style.width = `${i}%`);
9947
9967
  }, t)), n += 800;
9948
9968
  }
9949
9969
  }
9950
- function Xh() {
9951
- Kh && (qh.forEach(clearTimeout), qh = [], Kh.style.transition = "width 0.2s ease", Kh.style.width = "100%", qh.push(setTimeout(() => {
9952
- Kh && (Kh.style.transition = "opacity 0.35s ease", Kh.style.opacity = "0", qh.push(setTimeout(() => {
9953
- Kh && (Kh.style.width = "0%", Kh.classList.remove(`${Q}-bar-active`));
9970
+ function Zh() {
9971
+ qh && (Jh.forEach(clearTimeout), Jh = [], qh.style.transition = "width 0.2s ease", qh.style.width = "100%", Jh.push(setTimeout(() => {
9972
+ qh && (qh.style.transition = "opacity 0.35s ease", qh.style.opacity = "0", Jh.push(setTimeout(() => {
9973
+ qh && (qh.style.width = "0%", qh.classList.remove(`${Q}-bar-active`));
9954
9974
  }, 380)));
9955
9975
  }, 220)));
9956
9976
  }
9957
- var Zh = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
9977
+ var Qh = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
9958
9978
  <filter id="${Q}-csh">
9959
9979
  <feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
9960
9980
  </filter>
9961
9981
  <path d="M4 2L19 10.5L11 12.8L8 20L4 2Z"
9962
9982
  fill="white" stroke="#1e1b4b" stroke-width="1.6" stroke-linejoin="round"
9963
9983
  filter="url(#${Q}-csh)"/>
9964
- </svg>`, Qh = null, $h = !1;
9965
- function eg() {
9966
- return (!Qh || !Qh.isConnected) && (Qh = document.createElement("div"), Qh.id = `${Q}-cursor`, Qh.innerHTML = Zh, document.body.appendChild(Qh), $h = !1), Qh;
9984
+ </svg>`, $h = null, eg = !1;
9985
+ function tg() {
9986
+ return (!$h || !$h.isConnected) && ($h = document.createElement("div"), $h.id = `${Q}-cursor`, $h.innerHTML = Qh, document.body.appendChild($h), eg = !1), $h;
9967
9987
  }
9968
- async function tg(e) {
9988
+ async function ng(e) {
9969
9989
  if (typeof document > "u" || !e) return;
9970
9990
  Ah();
9971
9991
  let t;
@@ -9974,18 +9994,18 @@ async function tg(e) {
9974
9994
  } catch {
9975
9995
  return;
9976
9996
  }
9977
- let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = eg();
9978
- $h ||= (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 ag(360);
9997
+ let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = tg();
9998
+ eg ||= (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 og(360);
9979
9999
  }
9980
- function ng(e = !1) {
9981
- Qh && (e ? (Qh.classList.remove(`${Q}-cursor-visible`), $h = !1) : (Qh.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
9982
- $h = !1;
10000
+ function rg(e = !1) {
10001
+ $h && (e ? ($h.classList.remove(`${Q}-cursor-visible`), eg = !1) : ($h.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
10002
+ eg = !1;
9983
10003
  }, 250)));
9984
10004
  }
9985
- async function rg(e) {
9986
- Qh && (Qh.classList.add(`${Q}-cursor-click`), await ag(280), Qh.classList.remove(`${Q}-cursor-click`));
10005
+ async function ig(e) {
10006
+ $h && ($h.classList.add(`${Q}-cursor-click`), await og(280), $h.classList.remove(`${Q}-cursor-click`));
9987
10007
  }
9988
- function ig(e) {
10008
+ function ag(e) {
9989
10009
  if (!e || typeof document > "u") return;
9990
10010
  Ah();
9991
10011
  let t;
@@ -10013,12 +10033,12 @@ function ig(e) {
10013
10033
  a.remove(), e.style.position = n, e.style.overflow = r;
10014
10034
  }, 650);
10015
10035
  }
10016
- function ag(e) {
10036
+ function og(e) {
10017
10037
  return new Promise((t) => setTimeout(t, e));
10018
10038
  }
10019
10039
  //#endregion
10020
10040
  //#region src/lib/svgIcons.jsx
10021
- var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
10041
+ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
10022
10042
  width: e,
10023
10043
  height: e,
10024
10044
  viewBox: "0 0 24 24",
@@ -10034,7 +10054,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10034
10054
  strokeLinecap: "round",
10035
10055
  strokeLinejoin: "round"
10036
10056
  })]
10037
- }), sg = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
10057
+ }), cg = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
10038
10058
  width: e,
10039
10059
  height: e,
10040
10060
  viewBox: "0 0 24 24",
@@ -10049,7 +10069,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10049
10069
  x2: "1",
10050
10070
  y2: "23"
10051
10071
  })]
10052
- }), cg = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
10072
+ }), lg = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
10053
10073
  width: e,
10054
10074
  height: e,
10055
10075
  viewBox: "0 0 24 24",
@@ -10064,7 +10084,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10064
10084
  x2: "12",
10065
10085
  y2: "5"
10066
10086
  }), /* @__PURE__ */ g("polyline", { points: "5 12 12 5 19 12" })]
10067
- }), lg = () => /* @__PURE__ */ _("svg", {
10087
+ }), ug = () => /* @__PURE__ */ _("svg", {
10068
10088
  width: "14",
10069
10089
  height: "14",
10070
10090
  viewBox: "0 0 24 24",
@@ -10074,7 +10094,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10074
10094
  strokeLinecap: "round",
10075
10095
  strokeLinejoin: "round",
10076
10096
  children: [/* @__PURE__ */ g("polyline", { points: "9 17 4 12 9 7" }), /* @__PURE__ */ g("path", { d: "M20 18v-2a4 4 0 00-4-4H4" })]
10077
- }), ug = () => /* @__PURE__ */ g("svg", {
10097
+ }), dg = () => /* @__PURE__ */ g("svg", {
10078
10098
  width: "18",
10079
10099
  height: "18",
10080
10100
  viewBox: "0 0 24 24",
@@ -10084,7 +10104,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10084
10104
  strokeLinecap: "round",
10085
10105
  strokeLinejoin: "round",
10086
10106
  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" })
10087
- }), dg = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
10107
+ }), fg = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
10088
10108
  className: e,
10089
10109
  width: "14",
10090
10110
  height: "14",
@@ -10113,7 +10133,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10113
10133
  y2: "16"
10114
10134
  })
10115
10135
  ]
10116
- }), fg = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
10136
+ }), pg = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
10117
10137
  width: e,
10118
10138
  height: e,
10119
10139
  viewBox: "0 0 24 24",
@@ -10136,7 +10156,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10136
10156
  /* @__PURE__ */ g("path", { d: "M15 13v2" }),
10137
10157
  /* @__PURE__ */ g("path", { d: "M9 13v2" })
10138
10158
  ]
10139
- }), pg = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
10159
+ }), mg = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
10140
10160
  width: e,
10141
10161
  height: e,
10142
10162
  viewBox: "0 0 24 24",
@@ -10156,7 +10176,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10156
10176
  x2: "19",
10157
10177
  y2: "12"
10158
10178
  })]
10159
- }), mg = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
10179
+ }), hg = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
10160
10180
  width: e,
10161
10181
  height: e,
10162
10182
  viewBox: "0 0 24 24",
@@ -10182,7 +10202,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10182
10202
  fill: t
10183
10203
  })
10184
10204
  ]
10185
- }), hg = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
10205
+ }), gg = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
10186
10206
  width: "24",
10187
10207
  height: "24",
10188
10208
  viewBox: "0 0 24 24",
@@ -10200,7 +10220,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10200
10220
  "stroke-linecap": "round",
10201
10221
  "stroke-linejoin": "round"
10202
10222
  })]
10203
- }), gg = () => /* @__PURE__ */ g("svg", {
10223
+ }), _g = () => /* @__PURE__ */ g("svg", {
10204
10224
  width: "24",
10205
10225
  height: "24",
10206
10226
  viewBox: "0 0 24 24",
@@ -10212,7 +10232,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10212
10232
  "stroke-width": "1.5",
10213
10233
  "stroke-linejoin": "round"
10214
10234
  })
10215
- }), _g = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
10235
+ }), vg = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
10216
10236
  xmlns: "http://www.w3.org/2000/svg",
10217
10237
  width: e,
10218
10238
  height: e,
@@ -10230,7 +10250,7 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10230
10250
  /* @__PURE__ */ g("path", { d: "m2 2 20 20" }),
10231
10251
  /* @__PURE__ */ g("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12" })
10232
10252
  ]
10233
- }), vg = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), yg = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), bg = new Set([
10253
+ }), yg = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), bg = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), xg = new Set([
10234
10254
  "p",
10235
10255
  "br",
10236
10256
  "ul",
@@ -10241,30 +10261,30 @@ var og = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
10241
10261
  "b",
10242
10262
  "i",
10243
10263
  "a"
10244
- ]), xg = /^https?:\/\//i;
10245
- function Sg(e) {
10264
+ ]), Sg = /^https?:\/\//i;
10265
+ function Cg(e) {
10246
10266
  let t = Array.from(e.childNodes);
10247
10267
  for (let n of t) if (n.nodeType === Node.ELEMENT_NODE) {
10248
10268
  let t = n.tagName.toLowerCase();
10249
- if (!bg.has(t)) {
10269
+ if (!xg.has(t)) {
10250
10270
  e.replaceChild(document.createTextNode(n.textContent), n);
10251
10271
  continue;
10252
10272
  }
10253
10273
  let r = {};
10254
10274
  if (t === "a") {
10255
10275
  let e = n.getAttribute("href") || "";
10256
- xg.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
10276
+ Sg.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
10257
10277
  }
10258
10278
  for (; n.attributes.length > 0;) n.removeAttribute(n.attributes[0].name);
10259
10279
  for (let [e, t] of Object.entries(r)) n.setAttribute(e, t);
10260
- Sg(n);
10280
+ Cg(n);
10261
10281
  } else n.nodeType !== Node.TEXT_NODE && e.removeChild(n);
10262
10282
  }
10263
- function Cg(e) {
10283
+ function wg(e) {
10264
10284
  let t = document.createElement("div");
10265
- return t.innerHTML = e, Sg(t), t.innerHTML;
10285
+ return t.innerHTML = e, Cg(t), t.innerHTML;
10266
10286
  }
10267
- function wg(e) {
10287
+ function Tg(e) {
10268
10288
  let t = String(e || "").trim();
10269
10289
  if (!t) return t;
10270
10290
  let n = /^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);
@@ -10276,33 +10296,33 @@ function wg(e) {
10276
10296
  }
10277
10297
  return e;
10278
10298
  }
10279
- var Tg = (e = "") => {
10299
+ var Eg = (e = "") => {
10280
10300
  let t = String(e || "").trim();
10281
10301
  if (!t) return "";
10282
- if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return wg(Cg(t));
10283
- 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) => yg(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>");
10284
- return wg(n.map((e) => {
10302
+ if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return Tg(wg(t));
10303
+ 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) => bg(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>");
10304
+ return Tg(n.map((e) => {
10285
10305
  let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = t.filter((e) => /^[-*]\s+/.test(e));
10286
10306
  if (n.length >= 2 && n.length === t.length) return `<ul>${n.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>`;
10287
10307
  let i = e.split(/\s+(?=[-*]\s+\*\*?)/).map((e) => e.trim()).filter(Boolean);
10288
10308
  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>`;
10289
10309
  }).join(""));
10290
- }, Eg = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), Dg = new Set([
10310
+ }, Dg = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), Og = new Set([
10291
10311
  ".pdf",
10292
10312
  ".docx",
10293
10313
  ".png",
10294
10314
  ".jpg",
10295
10315
  ".jpeg"
10296
- ]), Og = "image/png,image/jpeg,.pdf,.docx";
10297
- function kg(e) {
10316
+ ]), kg = "image/png,image/jpeg,.pdf,.docx";
10317
+ function Ag(e) {
10298
10318
  if (!e) return !1;
10299
10319
  let t = typeof e.name == "string" ? e.name.toLowerCase() : "", n = t.includes(".") ? `.${t.split(".").pop()}` : "", r = typeof e.type == "string" ? e.type.toLowerCase() : "";
10300
- return r === "image/png" || r === "image/jpeg" || Eg.has(r) || Dg.has(n);
10320
+ return r === "image/png" || r === "image/jpeg" || Dg.has(r) || Og.has(n);
10301
10321
  }
10302
- function Ag(e) {
10303
- return e ? kg(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
10322
+ function jg(e) {
10323
+ return e ? Ag(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
10304
10324
  }
10305
- function jg(e = 0) {
10325
+ function Mg(e = 0) {
10306
10326
  if (!Number.isFinite(e) || e <= 0) return "";
10307
10327
  let t = [
10308
10328
  "B",
@@ -10314,12 +10334,12 @@ function jg(e = 0) {
10314
10334
  let i = n >= 10 || r === 0 ? 0 : 1;
10315
10335
  return `${n.toFixed(i)} ${t[r]}`;
10316
10336
  }
10317
- function Mg(e) {
10337
+ function Ng(e) {
10318
10338
  return e ? e.name || "Attachment" : "";
10319
10339
  }
10320
10340
  //#endregion
10321
10341
  //#region src/utils/avatarHelpers.js
10322
- function Ng(e) {
10342
+ function Pg(e) {
10323
10343
  if (!e || typeof e != "string") return "?";
10324
10344
  let t = e.trim();
10325
10345
  if (!t) return "?";
@@ -10328,7 +10348,7 @@ function Ng(e) {
10328
10348
  }
10329
10349
  //#endregion
10330
10350
  //#region src/components/AvatarImageOrInitials.jsx
10331
- function Pg({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
10351
+ function Fg({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
10332
10352
  let [i, a] = m(null), o = typeof e == "string" ? e.trim() : "";
10333
10353
  return c(() => {
10334
10354
  if (!o) {
@@ -10351,12 +10371,12 @@ function Pg({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
10351
10371
  onError: () => a(null)
10352
10372
  }) : /* @__PURE__ */ g("span", {
10353
10373
  style: r,
10354
- children: Ng(t)
10374
+ children: Pg(t)
10355
10375
  });
10356
10376
  }
10357
10377
  //#endregion
10358
10378
  //#region src/components/MessageList.jsx
10359
- function Fg({ siteId: e, onChoose: t }) {
10379
+ function Ig({ siteId: e, onChoose: t }) {
10360
10380
  let [n, r] = m(null), i = (n) => {
10361
10381
  le(e, n), r(n), t?.(n);
10362
10382
  };
@@ -10429,7 +10449,7 @@ function Fg({ siteId: e, onChoose: t }) {
10429
10449
  })
10430
10450
  });
10431
10451
  }
10432
- function Ig({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
10452
+ function Lg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
10433
10453
  let { resolvedConfig: d } = kn(), f = p(null), [v, y] = m(null), [b, x] = m(null), S = p(e.length), C = p(!0), w = p(null), T = o((e) => {
10434
10454
  let t = e.target.closest("a[href]");
10435
10455
  if (!t) return;
@@ -10484,8 +10504,8 @@ function Ig({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10484
10504
  children: [
10485
10505
  e.map((e) => {
10486
10506
  if (e.type === "call_recording" || typeof e.message == "string" && e.message.includes("AI chat recording")) return null;
10487
- if (e.type === "nav_pref_choice") return /* @__PURE__ */ g(Fg, { siteId: d?.siteId }, e.id || e.messageId);
10488
- let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, f = e.type === "file" && e.metadata?.fileUrl, p = e.agent_name || e.agentName || e.metadata?.agentName || l, m = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, v = vg(e.replyToContent || e.replyContext?.message || ""), S = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
10507
+ if (e.type === "nav_pref_choice") return /* @__PURE__ */ g(Ig, { siteId: d?.siteId }, e.id || e.messageId);
10508
+ let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, f = e.type === "file" && e.metadata?.fileUrl, p = e.agent_name || e.agentName || e.metadata?.agentName || l, m = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, v = yg(e.replyToContent || e.replyContext?.message || ""), S = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
10489
10509
  return t ? /* @__PURE__ */ g("div", {
10490
10510
  style: {
10491
10511
  display: "flex",
@@ -10530,7 +10550,7 @@ function Ig({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10530
10550
  fontWeight: 800,
10531
10551
  marginTop: !c && (r || o) ? "22px" : "0px"
10532
10552
  },
10533
- children: r ? u || /* @__PURE__ */ g(fg, { size: 16 }) : /* @__PURE__ */ g(Pg, {
10553
+ children: r ? u || /* @__PURE__ */ g(pg, { size: 16 }) : /* @__PURE__ */ g(Fg, {
10534
10554
  src: m || "",
10535
10555
  name: p,
10536
10556
  imgStyle: {
@@ -10572,7 +10592,7 @@ function Ig({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10572
10592
  onMouseLeave: (e) => {
10573
10593
  e.currentTarget.style.color = "#9ca3af";
10574
10594
  },
10575
- children: [/* @__PURE__ */ g(lg, {}), "Reply"]
10595
+ children: [/* @__PURE__ */ g(ug, {}), "Reply"]
10576
10596
  }),
10577
10597
  /* @__PURE__ */ _("div", {
10578
10598
  style: {
@@ -10616,7 +10636,7 @@ function Ig({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10616
10636
  children: v
10617
10637
  })]
10618
10638
  }), f ? (() => {
10619
- let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = jg(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" ? {
10639
+ let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = Mg(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" ? {
10620
10640
  color: "#ef4444",
10621
10641
  label: "PDF"
10622
10642
  } : t.includes("word") || t.includes("docx") ? {
@@ -10797,7 +10817,7 @@ function Ig({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10797
10817
  });
10798
10818
  })() : r ? /* @__PURE__ */ g("div", {
10799
10819
  className: "flowengage-message-content fe-bot-message",
10800
- dangerouslySetInnerHTML: { __html: Tg(e.message) },
10820
+ dangerouslySetInnerHTML: { __html: Eg(e.message) },
10801
10821
  onClick: T
10802
10822
  }) : /* @__PURE__ */ g("div", {
10803
10823
  style: { whiteSpace: "pre-wrap" },
@@ -10862,7 +10882,7 @@ function Ig({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10862
10882
  boxShadow: u ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
10863
10883
  overflow: "hidden"
10864
10884
  },
10865
- children: u || /* @__PURE__ */ g(fg, { size: 16 })
10885
+ children: u || /* @__PURE__ */ g(pg, { size: 16 })
10866
10886
  }), /* @__PURE__ */ _("div", {
10867
10887
  style: {
10868
10888
  display: "flex",
@@ -10904,7 +10924,7 @@ function Ig({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10904
10924
  borderRadius: "50%",
10905
10925
  overflow: "hidden"
10906
10926
  },
10907
- children: /* @__PURE__ */ g(Pg, {
10927
+ children: /* @__PURE__ */ g(Fg, {
10908
10928
  src: s || "",
10909
10929
  name: l,
10910
10930
  imgStyle: {
@@ -10998,22 +11018,22 @@ function Ig({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10998
11018
  }
10999
11019
  //#endregion
11000
11020
  //#region src/components/ChatInput.jsx
11001
- var Lg = typeof window < "u" && (window.matchMedia?.("(pointer: coarse)").matches || navigator.maxTouchPoints > 0);
11002
- function Rg({ 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" }) {
11021
+ var Rg = typeof window < "u" && (window.matchMedia?.("(pointer: coarse)").matches || navigator.maxTouchPoints > 0);
11022
+ function zg({ 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" }) {
11003
11023
  let D = p(null), O = p(null), k = (e) => {
11004
11024
  e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 120)}px`);
11005
11025
  };
11006
11026
  c(() => {
11007
11027
  d || k(O.current);
11008
11028
  }, [e, d]), c(() => {
11009
- d || Lg || e || s || O.current?.focus();
11029
+ d || Rg || e || s || O.current?.focus();
11010
11030
  }, [
11011
11031
  e,
11012
11032
  d,
11013
11033
  s
11014
11034
  ]);
11015
11035
  let A = (e) => {
11016
- e.key === "Enter" && (Lg || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), e.currentTarget.form?.requestSubmit()));
11036
+ e.key === "Enter" && (Rg || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), e.currentTarget.form?.requestSubmit()));
11017
11037
  }, 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;
11018
11038
  return /* @__PURE__ */ _("div", {
11019
11039
  style: {
@@ -11108,7 +11128,7 @@ function Rg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
11108
11128
  background: "rgba(59,130,246,0.08)",
11109
11129
  color: "var(--flowengage-primary)"
11110
11130
  },
11111
- children: /* @__PURE__ */ g(fg, { size: 13 })
11131
+ children: /* @__PURE__ */ g(pg, { size: 13 })
11112
11132
  }), /* @__PURE__ */ g("span", { children: "Please provide your email address so we can help you." })]
11113
11133
  })
11114
11134
  }),
@@ -11148,7 +11168,7 @@ function Rg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
11148
11168
  overflow: "hidden",
11149
11169
  textOverflow: "ellipsis"
11150
11170
  },
11151
- children: Mg(S)
11171
+ children: Ng(S)
11152
11172
  }),
11153
11173
  /* @__PURE__ */ g("div", {
11154
11174
  style: {
@@ -11156,7 +11176,7 @@ function Rg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
11156
11176
  color: "#6b7280",
11157
11177
  marginTop: "2px"
11158
11178
  },
11159
- children: jg(S.size)
11179
+ children: Mg(S.size)
11160
11180
  })
11161
11181
  ]
11162
11182
  }), /* @__PURE__ */ g("button", {
@@ -11201,7 +11221,7 @@ function Rg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
11201
11221
  j ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("input", {
11202
11222
  ref: D,
11203
11223
  type: "file",
11204
- accept: Og,
11224
+ accept: kg,
11205
11225
  style: { display: "none" },
11206
11226
  onChange: (e) => {
11207
11227
  let t = e.target.files?.[0];
@@ -11233,7 +11253,7 @@ function Rg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
11233
11253
  onMouseLeave: (e) => {
11234
11254
  e.currentTarget.style.opacity = "1";
11235
11255
  },
11236
- children: /* @__PURE__ */ g(pg, {
11256
+ children: /* @__PURE__ */ g(mg, {
11237
11257
  size: 16,
11238
11258
  color: "currentColor"
11239
11259
  })
@@ -11314,7 +11334,7 @@ function Rg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
11314
11334
  onMouseLeave: (e) => {
11315
11335
  e.currentTarget.style.opacity = "1";
11316
11336
  },
11317
- children: /* @__PURE__ */ g(cg, { size: 16 })
11337
+ children: /* @__PURE__ */ g(lg, { size: 16 })
11318
11338
  })
11319
11339
  ]
11320
11340
  }),
@@ -11377,7 +11397,7 @@ function Rg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
11377
11397
  }
11378
11398
  //#endregion
11379
11399
  //#region src/components/StatusBanners.jsx
11380
- function zg({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
11400
+ function Bg({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
11381
11401
  return /* @__PURE__ */ _(h, { children: [(e || t) && /* @__PURE__ */ _("div", {
11382
11402
  style: {
11383
11403
  margin: "0 20px 10px",
@@ -11390,7 +11410,7 @@ function zg({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
11390
11410
  gap: "10px"
11391
11411
  },
11392
11412
  children: [
11393
- /* @__PURE__ */ g(dg, { className: "" }),
11413
+ /* @__PURE__ */ g(fg, { className: "" }),
11394
11414
  /* @__PURE__ */ g("span", {
11395
11415
  style: {
11396
11416
  fontSize: "12px",
@@ -11436,13 +11456,13 @@ function zg({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
11436
11456
  }
11437
11457
  //#endregion
11438
11458
  //#region src/components/AnimatedOrb.jsx
11439
- var Bg = [
11459
+ var Vg = [
11440
11460
  "#135bd8",
11441
11461
  "#ef334b",
11442
11462
  "#ffbd2e"
11443
11463
  ];
11444
- function Vg(e) {
11445
- return !Array.isArray(e) || e.length === 0 ? Bg : e.length === 1 ? [
11464
+ function Hg(e) {
11465
+ return !Array.isArray(e) || e.length === 0 ? Vg : e.length === 1 ? [
11446
11466
  e[0],
11447
11467
  e[0],
11448
11468
  e[0]
@@ -11456,7 +11476,7 @@ function Vg(e) {
11456
11476
  e[2]
11457
11477
  ];
11458
11478
  }
11459
- var Hg = {
11479
+ var Ug = {
11460
11480
  idle: 3,
11461
11481
  listening: .75,
11462
11482
  thinking: 1,
@@ -11464,7 +11484,7 @@ var Hg = {
11464
11484
  muted: .75,
11465
11485
  error: .08
11466
11486
  };
11467
- function Ug(e) {
11487
+ function Wg(e) {
11468
11488
  if (!e || typeof e != "string") return [
11469
11489
  0,
11470
11490
  0,
@@ -11477,14 +11497,14 @@ function Ug(e) {
11477
11497
  parseInt(n.slice(4, 6), 16) / 255
11478
11498
  ];
11479
11499
  }
11480
- function Wg(e, t) {
11500
+ function Gg(e, t) {
11481
11501
  if (!e || typeof e != "string") return `rgba(0,0,0,${t})`;
11482
11502
  if (e.startsWith("rgb")) return e.replace(/[\d.]+\)$/, `${t})`);
11483
11503
  let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
11484
11504
  return `rgba(${parseInt(r.slice(0, 2), 16)},${parseInt(r.slice(2, 4), 16)},${parseInt(r.slice(4, 6), 16)},${t})`;
11485
11505
  }
11486
- var Gg = "\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", Kg = "\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";
11487
- function qg(e, t, n) {
11506
+ var Kg = "\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", qg = "\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";
11507
+ function Jg(e, t, n) {
11488
11508
  let r = (t, n) => {
11489
11509
  let r = e.createShader(t);
11490
11510
  return e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("[AnimatedOrb shader]", e.getShaderInfoLog(r)), null);
@@ -11493,10 +11513,10 @@ function qg(e, t, n) {
11493
11513
  let o = e.createProgram();
11494
11514
  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);
11495
11515
  }
11496
- function Jg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
11497
- let [s, l, u] = Vg(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(Hg[t] ?? .35);
11516
+ function Yg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
11517
+ let [s, l, u] = Hg(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(Ug[t] ?? .35);
11498
11518
  c(() => {
11499
- h.current = Hg[t] ?? .35;
11519
+ h.current = Ug[t] ?? .35;
11500
11520
  }, [t]), c(() => {
11501
11521
  let t = m.current;
11502
11522
  if (!t) return;
@@ -11513,7 +11533,7 @@ function Jg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
11513
11533
  console.warn("[AnimatedOrb] WebGL unavailable.");
11514
11534
  return;
11515
11535
  }
11516
- let i = qg(r, Gg, Kg);
11536
+ let i = Jg(r, Kg, qg);
11517
11537
  if (!i) {
11518
11538
  console.error("[AnimatedOrb] WebGL program failed to compile/link");
11519
11539
  return;
@@ -11543,7 +11563,7 @@ function Jg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
11543
11563
  c2: r.getUniformLocation(i, "u_c2"),
11544
11564
  c3: r.getUniformLocation(i, "u_c3")
11545
11565
  };
11546
- r.uniform3fv(c.c1, Ug(s)), r.uniform3fv(c.c2, Ug(l)), r.uniform3fv(c.c3, Ug(u)), r.viewport(0, 0, t.width, t.height);
11566
+ r.uniform3fv(c.c1, Wg(s)), r.uniform3fv(c.c2, Wg(l)), r.uniform3fv(c.c3, Wg(u)), r.viewport(0, 0, t.width, t.height);
11547
11567
  let d = performance.now(), f, p = (e) => {
11548
11568
  r.uniform1f(c.time, (e - d) / 1e3), r.uniform1f(c.speed, h.current), r.drawArrays(r.TRIANGLES, 0, 6), f = requestAnimationFrame(p);
11549
11569
  };
@@ -11574,7 +11594,7 @@ function Jg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
11574
11594
  position: "absolute",
11575
11595
  inset: -10,
11576
11596
  borderRadius: "50%",
11577
- background: `radial-gradient(circle, ${Wg(s, .18)} 0%, transparent 70%)`,
11597
+ background: `radial-gradient(circle, ${Gg(s, .18)} 0%, transparent 70%)`,
11578
11598
  pointerEvents: "none"
11579
11599
  },
11580
11600
  animate: { opacity: [.3, .75] },
@@ -11652,17 +11672,17 @@ function Jg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
11652
11672
  }
11653
11673
  //#endregion
11654
11674
  //#region src/components/CallScreen.jsx
11655
- var Yg = "\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";
11656
- function Xg(e) {
11675
+ var Xg = "\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";
11676
+ function Zg(e) {
11657
11677
  let t = (e || "").replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
11658
11678
  return `${parseInt(n.slice(0, 2), 16)},${parseInt(n.slice(2, 4), 16)},${parseInt(n.slice(4, 6), 16)}`;
11659
11679
  }
11660
- function Zg(e) {
11680
+ function Qg(e) {
11661
11681
  if (!e || typeof e != "string") return "#1a1a1a";
11662
11682
  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;
11663
11683
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
11664
11684
  }
11665
- function Qg(e, t) {
11685
+ function $g(e, t) {
11666
11686
  let n = Array.isArray(e) && e.length > 0 ? e : [t || "#3B82F6"], [r, i, a] = n;
11667
11687
  return n.length === 1 ? [
11668
11688
  `radial-gradient(ellipse 110% 65% at 50% -5%, ${r}28 0%, transparent 68%)`,
@@ -11679,8 +11699,8 @@ function Qg(e, t) {
11679
11699
  "#f7f8fa"
11680
11700
  ].join(", ");
11681
11701
  }
11682
- function $g({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
11683
- let i = (t || "A")[0].toUpperCase(), a = Zg(r), o = n > 48 ? {
11702
+ function e_({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
11703
+ let i = (t || "A")[0].toUpperCase(), a = Qg(r), o = n > 48 ? {
11684
11704
  boxShadow: `0 0 0 3px ${r}44`,
11685
11705
  border: "3px solid rgba(255,255,255,0.15)"
11686
11706
  } : { border: `1.5px solid ${r}55` };
@@ -11717,7 +11737,7 @@ function $g({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" })
11717
11737
  children: i
11718
11738
  });
11719
11739
  }
11720
- function e_(e) {
11740
+ function t_(e) {
11721
11741
  let t = p(null), n = o(() => {
11722
11742
  if (!t.current) return;
11723
11743
  let { audioContext: e, oscillator: n, interval: r, toneTimeout: i } = t.current;
@@ -11764,8 +11784,8 @@ function e_(e) {
11764
11784
  n
11765
11785
  ]), c(() => () => n(), [n]), n;
11766
11786
  }
11767
- function t_({ 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 = [] }) {
11768
- let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = e_(!!e), S = async () => {
11787
+ function n_({ 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 = [] }) {
11788
+ let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = t_(!!e), S = async () => {
11769
11789
  x(), await c();
11770
11790
  }, C = async () => {
11771
11791
  x(), await l();
@@ -11777,14 +11797,14 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11777
11797
  flexDirection: "column",
11778
11798
  borderRadius: "inherit",
11779
11799
  overflow: "hidden",
11780
- background: Qg(h, m),
11800
+ background: $g(h, m),
11781
11801
  animation: T ? "fe-call-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)" : "fe-call-fade-in 0.32s ease"
11782
11802
  };
11783
11803
  if (b === "incoming") {
11784
11804
  let e = Array.isArray(h) && h.length > 0 ? h : [m];
11785
11805
  return /* @__PURE__ */ _("div", {
11786
11806
  style: E,
11787
- children: [/* @__PURE__ */ g("style", { children: Yg }), /* @__PURE__ */ _("div", {
11807
+ children: [/* @__PURE__ */ g("style", { children: Xg }), /* @__PURE__ */ _("div", {
11788
11808
  style: {
11789
11809
  flex: 1,
11790
11810
  display: "flex",
@@ -11815,7 +11835,7 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11815
11835
  width: "96px",
11816
11836
  height: "96px",
11817
11837
  borderRadius: "50%",
11818
- background: `radial-gradient(circle, rgba(${Xg(e[0])},0.2) 0%, transparent 70%)`,
11838
+ background: `radial-gradient(circle, rgba(${Zg(e[0])},0.2) 0%, transparent 70%)`,
11819
11839
  filter: "blur(10px)",
11820
11840
  zIndex: 0
11821
11841
  } }),
@@ -11832,7 +11852,7 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11832
11852
  animation: `fe-call-ring-pulse 2.6s cubic-bezier(0.215,0.61,0.355,1) ${t}s infinite`,
11833
11853
  zIndex: 1
11834
11854
  } }, n)),
11835
- /* @__PURE__ */ g($g, {
11855
+ /* @__PURE__ */ g(e_, {
11836
11856
  headshot: o,
11837
11857
  name: y,
11838
11858
  size: 82,
@@ -11912,7 +11932,7 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11912
11932
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(239,68,68,0.5)";
11913
11933
  },
11914
11934
  "aria-label": "Decline call",
11915
- children: /* @__PURE__ */ g(sg, { size: 26 })
11935
+ children: /* @__PURE__ */ g(cg, { size: 26 })
11916
11936
  }), /* @__PURE__ */ g("span", {
11917
11937
  style: {
11918
11938
  fontSize: "12px",
@@ -11953,7 +11973,7 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11953
11973
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(34,197,94,0.5)";
11954
11974
  },
11955
11975
  "aria-label": "Accept call",
11956
- children: /* @__PURE__ */ g(ug, {})
11976
+ children: /* @__PURE__ */ g(dg, {})
11957
11977
  }), /* @__PURE__ */ g("span", {
11958
11978
  style: {
11959
11979
  fontSize: "12px",
@@ -11970,7 +11990,7 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11970
11990
  }
11971
11991
  return b === "connecting" ? /* @__PURE__ */ _("div", {
11972
11992
  style: E,
11973
- children: [/* @__PURE__ */ g("style", { children: Yg }), /* @__PURE__ */ _("div", {
11993
+ children: [/* @__PURE__ */ g("style", { children: Xg }), /* @__PURE__ */ _("div", {
11974
11994
  style: {
11975
11995
  flex: 1,
11976
11996
  display: "flex",
@@ -11980,7 +12000,7 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11980
12000
  gap: "24px"
11981
12001
  },
11982
12002
  children: [
11983
- /* @__PURE__ */ g($g, {
12003
+ /* @__PURE__ */ g(e_, {
11984
12004
  headshot: o,
11985
12005
  name: y,
11986
12006
  size: 64,
@@ -12007,7 +12027,7 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
12007
12027
  }) : /* @__PURE__ */ _("div", {
12008
12028
  style: E,
12009
12029
  children: [
12010
- /* @__PURE__ */ g("style", { children: Yg }),
12030
+ /* @__PURE__ */ g("style", { children: Xg }),
12011
12031
  /* @__PURE__ */ _("div", {
12012
12032
  style: {
12013
12033
  display: "flex",
@@ -12053,7 +12073,7 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
12053
12073
  children: /* @__PURE__ */ g("polyline", { points: "15 18 9 12 15 6" })
12054
12074
  })
12055
12075
  }),
12056
- /* @__PURE__ */ g(Jg, {
12076
+ /* @__PURE__ */ g(Yg, {
12057
12077
  colors: h,
12058
12078
  size: 36,
12059
12079
  voiceState: w
@@ -12104,7 +12124,7 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
12104
12124
  gap: "16px",
12105
12125
  padding: "0 24px 16px"
12106
12126
  },
12107
- children: [/* @__PURE__ */ g($g, {
12127
+ children: [/* @__PURE__ */ g(e_, {
12108
12128
  headshot: o,
12109
12129
  name: y,
12110
12130
  size: 116,
@@ -12159,7 +12179,7 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
12159
12179
  transition: "all 0.2s ease"
12160
12180
  },
12161
12181
  "aria-label": i ? "Unmute" : "Mute",
12162
- children: [g(i ? _g : og, { size: 18 }), i ? "Unmute" : "Mute"]
12182
+ children: [g(i ? vg : sg, { size: 18 }), i ? "Unmute" : "Mute"]
12163
12183
  }), /* @__PURE__ */ _("button", {
12164
12184
  type: "button",
12165
12185
  onClick: u,
@@ -12187,15 +12207,15 @@ function t_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
12187
12207
  e.currentTarget.style.background = "rgba(239,68,68,0.9)", e.currentTarget.style.transform = "scale(1)";
12188
12208
  },
12189
12209
  "aria-label": "End call",
12190
- children: [/* @__PURE__ */ g(sg, { size: 18 }), "End Call"]
12210
+ children: [/* @__PURE__ */ g(cg, { size: 18 }), "End Call"]
12191
12211
  })]
12192
12212
  })
12193
12213
  ]
12194
12214
  });
12195
12215
  }
12196
- function n_({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
12216
+ function r_({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
12197
12217
  let u = e || n || "Agent";
12198
- return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: Yg }), /* @__PURE__ */ _("div", {
12218
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: Xg }), /* @__PURE__ */ _("div", {
12199
12219
  role: "button",
12200
12220
  tabIndex: 0,
12201
12221
  onClick: c,
@@ -12252,7 +12272,7 @@ function n_({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
12252
12272
  borderRadius: "50%",
12253
12273
  border: `1.5px solid ${l}55`
12254
12274
  } }),
12255
- /* @__PURE__ */ g($g, {
12275
+ /* @__PURE__ */ g(e_, {
12256
12276
  headshot: t,
12257
12277
  name: u,
12258
12278
  size: 38,
@@ -12336,7 +12356,7 @@ function n_({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
12336
12356
  boxShadow: i ? `0 0 0 3px ${l}12` : "none"
12337
12357
  },
12338
12358
  "aria-label": i ? "Unmute" : "Mute",
12339
- children: g(i ? _g : og, { size: 15 })
12359
+ children: g(i ? vg : sg, { size: 15 })
12340
12360
  }), /* @__PURE__ */ g("button", {
12341
12361
  type: "button",
12342
12362
  onClick: (e) => {
@@ -12364,7 +12384,7 @@ function n_({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
12364
12384
  transition: "all 0.18s ease"
12365
12385
  },
12366
12386
  "aria-label": "End call",
12367
- children: /* @__PURE__ */ g(sg, { size: 16 })
12387
+ children: /* @__PURE__ */ g(cg, { size: 16 })
12368
12388
  })]
12369
12389
  })
12370
12390
  ]
@@ -12372,7 +12392,7 @@ function n_({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
12372
12392
  }
12373
12393
  //#endregion
12374
12394
  //#region src/utils/voicePriorContext.js
12375
- function r_(e, t = {}) {
12395
+ function i_(e, t = {}) {
12376
12396
  let n = t.maxChars ?? 4500;
12377
12397
  if (!Array.isArray(e) || e.length === 0) return "";
12378
12398
  let r = [];
@@ -12389,24 +12409,24 @@ function r_(e, t = {}) {
12389
12409
  }
12390
12410
  //#endregion
12391
12411
  //#region src/utils/voiceClientTools.js
12392
- var i_ = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
12393
- function a_(e) {
12394
- return String(e || "").replace(i_, "").replace(/\/+$/, "").toLowerCase() || "/";
12412
+ var a_ = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
12413
+ function o_(e) {
12414
+ return String(e || "").replace(a_, "").replace(/\/+$/, "").toLowerCase() || "/";
12395
12415
  }
12396
- function o_(e, t) {
12397
- return a_(e) === a_(t);
12416
+ function s_(e, t) {
12417
+ return o_(e) === o_(t);
12398
12418
  }
12399
12419
  function $(...e) {
12400
12420
  An() && console.log("[FlowEngage:voice-tools]", ...e);
12401
12421
  }
12402
- function s_(e) {
12422
+ function c_(e) {
12403
12423
  try {
12404
12424
  let t = e.ownerDocument?.defaultView;
12405
12425
  if (t) return t.getComputedStyle(e);
12406
12426
  } catch {}
12407
12427
  return window.getComputedStyle(e);
12408
12428
  }
12409
- function c_(e) {
12429
+ function l_(e) {
12410
12430
  let t = /* @__PURE__ */ new Set();
12411
12431
  function n(r) {
12412
12432
  if (!r || t.has(r)) return;
@@ -12419,10 +12439,10 @@ function c_(e) {
12419
12439
  }
12420
12440
  typeof document < "u" && n(document);
12421
12441
  }
12422
- function l_(e) {
12442
+ function u_(e) {
12423
12443
  return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
12424
12444
  }
12425
- function u_(e) {
12445
+ function d_(e) {
12426
12446
  let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
12427
12447
  if (n) {
12428
12448
  let e = n.trim().split(/\s+/).filter(Boolean), r = [];
@@ -12430,40 +12450,40 @@ function u_(e) {
12430
12450
  let e = t.getElementById(n);
12431
12451
  e?.textContent && r.push(e.textContent.trim());
12432
12452
  } catch {}
12433
- if (r.length) return l_(r.join(" "));
12453
+ if (r.length) return u_(r.join(" "));
12434
12454
  }
12435
- if (e.labels && e.labels.length) return l_(e.labels[0].textContent);
12455
+ if (e.labels && e.labels.length) return u_(e.labels[0].textContent);
12436
12456
  let r = e.id;
12437
12457
  if (r) try {
12438
12458
  let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
12439
- if (e) return l_(e.textContent);
12459
+ if (e) return u_(e.textContent);
12440
12460
  } catch {
12441
12461
  let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
12442
- if (e) return l_(e.textContent);
12462
+ if (e) return u_(e.textContent);
12443
12463
  }
12444
12464
  let i = e.previousElementSibling;
12445
12465
  for (let e = 0; e < 6 && i; e += 1) {
12446
- if (i.tagName === "LABEL") return l_(i.textContent);
12466
+ if (i.tagName === "LABEL") return u_(i.textContent);
12447
12467
  let e = (i.className || "").toString().toLowerCase();
12448
12468
  if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
12449
- let e = l_(i.textContent);
12469
+ let e = u_(i.textContent);
12450
12470
  if (e) return e;
12451
12471
  }
12452
12472
  i = i.previousElementSibling;
12453
12473
  }
12454
12474
  let a = e.parentElement;
12455
12475
  for (let e = 0; e < 5 && a; e += 1) {
12456
- if (a.tagName === "LABEL") return l_(a.textContent);
12476
+ if (a.tagName === "LABEL") return u_(a.textContent);
12457
12477
  let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
12458
- if (e?.textContent) return l_(e.textContent);
12478
+ if (e?.textContent) return u_(e.textContent);
12459
12479
  a = a.parentElement;
12460
12480
  }
12461
12481
  let o = e.getAttribute("aria-label");
12462
- return o ? l_(o) : null;
12482
+ return o ? u_(o) : null;
12463
12483
  }
12464
- function d_() {
12484
+ function f_() {
12465
12485
  let e = [];
12466
- return c_((t) => {
12486
+ return l_((t) => {
12467
12487
  e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
12468
12488
  if (In(e)) return !1;
12469
12489
  let t = (e.type || "").toLowerCase();
@@ -12474,15 +12494,15 @@ function d_() {
12474
12494
  "image"
12475
12495
  ].includes(t) || e.disabled || e.readOnly) return !1;
12476
12496
  try {
12477
- let t = s_(e);
12497
+ let t = c_(e);
12478
12498
  if (t.display === "none" || t.visibility === "hidden") return !1;
12479
12499
  } catch {}
12480
12500
  return !0;
12481
12501
  }));
12482
12502
  }), e;
12483
12503
  }
12484
- function f_() {
12485
- return d_().map((e, t) => {
12504
+ function p_() {
12505
+ return f_().map((e, t) => {
12486
12506
  let n = {
12487
12507
  formIndex: 0,
12488
12508
  fieldIndex: t,
@@ -12490,7 +12510,7 @@ function f_() {
12490
12510
  type: e.type || "text",
12491
12511
  name: e.name || null,
12492
12512
  id: e.id || null,
12493
- label: u_(e),
12513
+ label: d_(e),
12494
12514
  placeholder: e.placeholder || null
12495
12515
  };
12496
12516
  return e.tagName === "SELECT" && (n.options = Array.from(e.options).filter((e) => e.value !== "" && !e.disabled).map((e) => ({
@@ -12499,13 +12519,13 @@ function f_() {
12499
12519
  })), n.currentValue = e.value || null), n;
12500
12520
  });
12501
12521
  }
12502
- function p_() {
12522
+ function m_() {
12503
12523
  let e = [];
12504
- return c_((t) => {
12524
+ return l_((t) => {
12505
12525
  e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
12506
12526
  if (In(e) || e.disabled) return !1;
12507
12527
  try {
12508
- let t = s_(e);
12528
+ let t = c_(e);
12509
12529
  if (t.display === "none" || t.visibility === "hidden") return !1;
12510
12530
  } catch {}
12511
12531
  return !0;
@@ -12517,7 +12537,7 @@ function p_() {
12517
12537
  type: e.type || e.tagName
12518
12538
  }));
12519
12539
  }
12520
- function m_(e, t) {
12540
+ function h_(e, t) {
12521
12541
  try {
12522
12542
  if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
12523
12543
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
@@ -12532,7 +12552,7 @@ function m_(e, t) {
12532
12552
  return Infinity;
12533
12553
  }
12534
12554
  }
12535
- function h_(e, t) {
12555
+ function g_(e, t) {
12536
12556
  let n = String(t || "").toLowerCase().trim();
12537
12557
  if (!n) return 0;
12538
12558
  let r = (e.innerText || e.textContent || "").replace(/\s+/g, " ").trim(), i = [
@@ -12550,21 +12570,21 @@ function h_(e, t) {
12550
12570
  for (let e of a) i.includes(e) && (o += 1);
12551
12571
  return o / a.length * 92;
12552
12572
  }
12553
- function g_(e, t, n = 6) {
12573
+ function __(e, t, n = 6) {
12554
12574
  let r = String(t || "").toLowerCase().trim();
12555
12575
  if (!r) return !1;
12556
12576
  let i = e;
12557
12577
  for (let e = 0; e < n && i && (i = i.parentElement, i); e++) if ((i.innerText || i.textContent || "").toLowerCase().includes(r)) return !0;
12558
12578
  return !1;
12559
12579
  }
12560
- function __(e, t, n) {
12580
+ function v_(e, t, n) {
12561
12581
  let r = [];
12562
- c_((e) => {
12582
+ l_((e) => {
12563
12583
  let t = Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"], a[href]"));
12564
12584
  r.push(...t.filter((e) => {
12565
12585
  if (In(e) || e.disabled) return !1;
12566
12586
  try {
12567
- let t = s_(e);
12587
+ let t = c_(e);
12568
12588
  if (t.display === "none" || t.visibility === "hidden" || t.opacity === "0") return !1;
12569
12589
  } catch {}
12570
12590
  return !0;
@@ -12572,14 +12592,14 @@ function __(e, t, n) {
12572
12592
  });
12573
12593
  let i = 0, a = r.map((t) => ({
12574
12594
  el: t,
12575
- s: h_(t, e)
12595
+ s: g_(t, e)
12576
12596
  }));
12577
12597
  for (let { s: e } of a) e > i && (i = e);
12578
12598
  if (i < 28) return null;
12579
12599
  let o = a.filter(({ s: e }) => e === i).map(({ el: e }) => e);
12580
12600
  if (o.length === 1) return o[0];
12581
12601
  if (n) {
12582
- let e = o.filter((e) => g_(e, n));
12602
+ let e = o.filter((e) => __(e, n));
12583
12603
  if (e.length === 1) return e[0];
12584
12604
  e.length > 1 && (o = e);
12585
12605
  }
@@ -12587,14 +12607,14 @@ function __(e, t, n) {
12587
12607
  if (s.length) {
12588
12608
  let e = o[0], t = Infinity;
12589
12609
  for (let n of o) for (let r of s) {
12590
- let i = m_(n, r);
12610
+ let i = h_(n, r);
12591
12611
  i < t && (t = i, e = n);
12592
12612
  }
12593
12613
  return e;
12594
12614
  }
12595
12615
  return o[0];
12596
12616
  }
12597
- function v_(e) {
12617
+ function y_(e) {
12598
12618
  if (e == null) return {};
12599
12619
  if (typeof e == "string") {
12600
12620
  let t = e.trim();
@@ -12607,12 +12627,12 @@ function v_(e) {
12607
12627
  }
12608
12628
  return e;
12609
12629
  }
12610
- function y_(e) {
12630
+ function b_(e) {
12611
12631
  if (!e || typeof e != "object") return null;
12612
12632
  let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
12613
12633
  return t == null ? null : String(t).trim() || null;
12614
12634
  }
12615
- function b_() {
12635
+ function x_() {
12616
12636
  let e = {};
12617
12637
  document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
12618
12638
  if (t.id) return;
@@ -12627,7 +12647,7 @@ function b_() {
12627
12647
  e[r] = !0, t.id = r;
12628
12648
  });
12629
12649
  }
12630
- function x_() {
12650
+ function S_() {
12631
12651
  let e = (e) => {
12632
12652
  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;
12633
12653
  for (; r < t.length;) {
@@ -12682,7 +12702,7 @@ function x_() {
12682
12702
  containerHeadings: o
12683
12703
  };
12684
12704
  }
12685
- function S_(e) {
12705
+ function C_(e) {
12686
12706
  if (!e || typeof document > "u") return "";
12687
12707
  let t = new Set([
12688
12708
  "script",
@@ -12768,11 +12788,11 @@ function S_(e) {
12768
12788
  return d.has(t) ? !1 : (d.add(t), !0);
12769
12789
  }).join("\n").replace(/\n{3,}/g, "\n\n").trim();
12770
12790
  }
12771
- function C_(e) {
12791
+ function w_(e) {
12772
12792
  let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = typeof e.beaconSyncFullVoiceHistory == "function" ? e.beaconSyncFullVoiceHistory : null, a = [], o = {
12773
12793
  "fwh-navigate-mvp": async (n) => {
12774
12794
  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.";
12775
- let a = v_(n), o = y_(a), s = a.section_text ?? a.sectionText ?? a.section, c = Array.isArray(a.expected_landmarks) ? a.expected_landmarks : Array.isArray(a.expectedLandmarks) ? a.expectedLandmarks : [];
12795
+ let a = y_(n), o = b_(a), s = a.section_text ?? a.sectionText ?? a.section, c = Array.isArray(a.expected_landmarks) ? a.expected_landmarks : Array.isArray(a.expectedLandmarks) ? a.expectedLandmarks : [];
12776
12796
  if ($("fwh-navigate-mvp · coerced:", {
12777
12797
  url: o,
12778
12798
  sectionText: s,
@@ -12812,14 +12832,14 @@ function C_(e) {
12812
12832
  correctedUrl: u
12813
12833
  }), o = u);
12814
12834
  try {
12815
- Ph(`Navigating to ${o}...`, { spinner: !0 }), Yh(), Pn();
12835
+ Ph(`Navigating to ${o}...`, { spinner: !0 }), Xh(), Pn();
12816
12836
  try {
12817
12837
  i?.();
12818
12838
  } catch {}
12819
12839
  try {
12820
12840
  let e = r ? r() : "";
12821
12841
  if (e && t) {
12822
- let n = r_([{
12842
+ let n = i_([{
12823
12843
  sender: "user",
12824
12844
  message: e
12825
12845
  }]);
@@ -12854,8 +12874,8 @@ function C_(e) {
12854
12874
  typeof window < "u" && window.scrollTo(0, 0);
12855
12875
  } catch {}
12856
12876
  let a = [], s = null, c = "", l = Date.now() + 12e3;
12857
- for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: a, pageTitleHeading: s, introText: c} = x_(), !(a.length >= 1)););
12858
- b_(), $("fwh-navigate-mvp → page headings collected:", a, "titleHeading:", s);
12877
+ for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: a, pageTitleHeading: s, introText: c} = S_(), !(a.length >= 1)););
12878
+ x_(), $("fwh-navigate-mvp → page headings collected:", a, "titleHeading:", s);
12859
12879
  let u = a.length ? a.join(" | ") : "none", d = a.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 = "";
12860
12880
  try {
12861
12881
  if (a.length > 0) {
@@ -12863,7 +12883,7 @@ function C_(e) {
12863
12883
  for (let n of e) {
12864
12884
  let e = mr(null, n);
12865
12885
  if (e) {
12866
- let r = S_(e).substring(0, 800);
12886
+ let r = C_(e).substring(0, 800);
12867
12887
  r && t.push(`[Section: ${n}] ${r}`);
12868
12888
  }
12869
12889
  }
@@ -12872,13 +12892,13 @@ function C_(e) {
12872
12892
  } catch {}
12873
12893
  if (Tr()) return Cr(), $("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.`;
12874
12894
  let m = Date.now() + 4e3, h = typeof window < "u" ? window.location.pathname : r;
12875
- for (; Date.now() < m && !o_(h, e) && o_(h, t);) await new Promise((e) => setTimeout(e, 120)), h = window.location.pathname;
12895
+ for (; Date.now() < m && !s_(h, e) && s_(h, t);) await new Promise((e) => setTimeout(e, 120)), h = window.location.pathname;
12876
12896
  $("fwh-navigate-mvp route settle:", {
12877
12897
  startPath: t,
12878
12898
  targetPath: e,
12879
12899
  settledPath: h
12880
12900
  });
12881
- 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 = o_(h, e), y = !o_(h, t), b = v || y;
12901
+ 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 = s_(h, e), y = !s_(h, t), b = v || y;
12882
12902
  return $("fwh-navigate-mvp settled:", h, "target:", e, "match:", b), b ? (Cr(), `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.`) : (Cr(), `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.`);
12883
12903
  } catch {}
12884
12904
  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.";
@@ -12890,39 +12910,39 @@ function C_(e) {
12890
12910
  duration: 1800
12891
12911
  }), t;
12892
12912
  } finally {
12893
- Xh(), Fh(900);
12913
+ Zh(), Fh(900);
12894
12914
  }
12895
12915
  },
12896
12916
  "fwh-highlight-mvp": async (e) => {
12897
12917
  $("fwh-highlight-mvp ▶", e);
12898
- let t = v_(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
12918
+ let t = y_(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
12899
12919
  if (Wn(3e3), typeof window < "u" && window.__fe_user_nav_during_speech) {
12900
12920
  let e = window.__fe_user_nav_during_speech, t = window.location.pathname;
12901
12921
  if (Date.now() - e.ts >= 3e4) window.__fe_user_nav_during_speech = null;
12902
12922
  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.`;
12903
12923
  }
12904
- b_();
12924
+ x_();
12905
12925
  let i = ((e) => e && e.replace(/^\d+\.\s*/, "").replace(/^["']|["']$/g, "").trim())(r), a = mr(n || null, i || null);
12906
12926
  if (!a && i) {
12907
12927
  let e = Date.now() + 600;
12908
- for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), b_(), a = mr(null, i);
12928
+ for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), x_(), a = mr(null, i);
12909
12929
  }
12910
12930
  if (!a) {
12911
12931
  $("fwh-highlight-mvp ✖ no element for:", i || n);
12912
- let { headings: e } = x_(), 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.";
12932
+ let { headings: e } = S_(), 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.";
12913
12933
  return `HIGHLIGHT_NOT_FOUND: "${i || n}" on the current page. ${t}`;
12914
12934
  }
12915
12935
  return Nn(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.`;
12916
12936
  },
12917
12937
  "fwh-read-content-mvp": async (e) => {
12918
12938
  $("fwh-read-content-mvp ▶", e);
12919
- let t = v_(e), n = t?.section_text || t?.sectionText || "";
12939
+ let t = y_(e), n = t?.section_text || t?.sectionText || "";
12920
12940
  try {
12921
12941
  let e = "";
12922
12942
  if (n) {
12923
12943
  let t = mr(null, n);
12924
12944
  if (!t) return `Could not find section "${n}" on the page.`;
12925
- e = S_(t);
12945
+ e = C_(t);
12926
12946
  } else {
12927
12947
  let t = (document.querySelector("main") || document.querySelector("article") || document.querySelector("[role=\"main\"]") || document.querySelector("#content") || document.querySelector(".content") || document.body).cloneNode(!0);
12928
12948
  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();
@@ -12934,7 +12954,7 @@ function C_(e) {
12934
12954
  },
12935
12955
  "fwh-page-content-mvp": async (e) => {
12936
12956
  $("fwh-page-content-mvp ▶", e);
12937
- let r = v_(e), i = r?.url || r?.page_url || "";
12957
+ let r = y_(e), i = r?.url || r?.page_url || "";
12938
12958
  if ($("fwh-page-content-mvp · url:", i, "siteId:", t, "apiBase:", n || "(empty)"), !i) return $("fwh-page-content-mvp ✖ missing url"), "Missing url parameter.";
12939
12959
  if (!t) return $("fwh-page-content-mvp ✖ no siteId"), "Site is not configured.";
12940
12960
  if (!n) return $("fwh-page-content-mvp ✖ no api base"), "API base URL is missing; cannot fetch page content.";
@@ -12966,7 +12986,7 @@ function C_(e) {
12966
12986
  },
12967
12987
  "fwh-search-mvp": async (e) => {
12968
12988
  $("fwh-search-mvp ▶", e);
12969
- let r = v_(e).query;
12989
+ let r = y_(e).query;
12970
12990
  if (!r) return $("fwh-search-mvp ✖ missing query"), "Missing query parameter.";
12971
12991
  if (!t) return $("fwh-search-mvp ✖ no siteId"), "Search unavailable (no siteId configured).";
12972
12992
  if (!n) return $("fwh-search-mvp ✖ no api base"), "Search unavailable (no API base URL).";
@@ -13004,7 +13024,7 @@ function C_(e) {
13004
13024
  "[class*='menu'] a",
13005
13025
  "[class*='header'] a"
13006
13026
  ];
13007
- if (c_((t) => {
13027
+ if (l_((t) => {
13008
13028
  for (let r of n) try {
13009
13029
  t.querySelectorAll(r).forEach((t) => {
13010
13030
  if (In(t)) return;
@@ -13012,7 +13032,7 @@ function C_(e) {
13012
13032
  if (!r || !n || n === "#" || n.startsWith("javascript:")) return;
13013
13033
  try {
13014
13034
  let e = t.parentElement;
13015
- if (e && s_(e).display === "none" && !e.closest("nav, [role='navigation'], header, [class*='nav'], [class*='menu']")) return;
13035
+ if (e && c_(e).display === "none" && !e.closest("nav, [role='navigation'], header, [class*='nav'], [class*='menu']")) return;
13016
13036
  } catch {}
13017
13037
  let i = r.toLowerCase() + "|" + n;
13018
13038
  e.has(i) || e.set(i, {
@@ -13023,7 +13043,7 @@ function C_(e) {
13023
13043
  } catch {}
13024
13044
  t.querySelectorAll("select").forEach((t) => {
13025
13045
  if (In(t)) return;
13026
- let n = u_(t);
13046
+ let n = d_(t);
13027
13047
  /nav|menu|page|section|go to/i.test(n || t.name || t.id || "") && Array.from(t.options).forEach((r) => {
13028
13048
  if (!r.value || r.disabled) return;
13029
13049
  let i = r.text.trim();
@@ -13047,7 +13067,7 @@ function C_(e) {
13047
13067
  if ($("fwh-get-current-page-mvp ▶"), typeof window > "u") return "Cannot determine current page (no browser context).";
13048
13068
  let e = window.location.href, t = window.location.pathname, n = document.title || "";
13049
13069
  if (Tr()) 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.`;
13050
- let { headings: r, pageTitleHeading: i, introText: a } = x_();
13070
+ let { headings: r, pageTitleHeading: i, introText: a } = S_();
13051
13071
  $("fwh-get-current-page-mvp ✓", {
13052
13072
  url: e,
13053
13073
  path: t,
@@ -13059,7 +13079,7 @@ function C_(e) {
13059
13079
  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. ***`;
13060
13080
  },
13061
13081
  "fwh-list-forms-mvp": async () => {
13062
- let e = f_(), t = p_();
13082
+ let e = p_(), t = m_();
13063
13083
  $("fwh-list-forms-mvp ✓", `${e.length} field(s)`, `${t.length} button(s)`);
13064
13084
  let n = e.map((e) => ({
13065
13085
  ...e,
@@ -13073,9 +13093,9 @@ function C_(e) {
13073
13093
  },
13074
13094
  "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.",
13075
13095
  "fwh-click-button-mvp": async (e) => {
13076
- let t = v_(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim(), r = (t.card_context ?? t.cardContext ?? "").trim();
13096
+ let t = y_(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim(), r = (t.card_context ?? t.cardContext ?? "").trim();
13077
13097
  if ($("fwh-click-button-mvp ▶", n, r ? `(card_context: ${r})` : ""), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
13078
- let i = __(n, a, r);
13098
+ let i = v_(n, a, r);
13079
13099
  if (!i) return $("fwh-click-button-mvp ✖ no match"), `Could not find a button matching "${n}". Call fwh-list-forms-mvp to see button texts.`;
13080
13100
  try {
13081
13101
  Ph(`Clicking ${n}...`, { spinner: !0 });
@@ -13087,7 +13107,7 @@ function C_(e) {
13087
13107
  } catch {
13088
13108
  i.scrollIntoView(!0);
13089
13109
  }
13090
- await tg(i), i.focus?.(), await rg(i), ig(i), i.click();
13110
+ await ng(i), i.focus?.(), await ig(i), ag(i), i.click();
13091
13111
  let e = (i.textContent || i.value || i.getAttribute("aria-label") || "").trim().slice(0, 80) || "button", t = `OK_CLICK ${e}`;
13092
13112
  return $("fwh-click-button-mvp ✓", t), Ph(`Clicked ${e}`, {
13093
13113
  spinner: !1,
@@ -13102,7 +13122,7 @@ function C_(e) {
13102
13122
  duration: 1800
13103
13123
  }), t;
13104
13124
  } finally {
13105
- ng(), Fh(700);
13125
+ rg(), Fh(700);
13106
13126
  }
13107
13127
  },
13108
13128
  "fwh-cart-get-mvp": async () => {
@@ -13215,10 +13235,10 @@ function C_(e) {
13215
13235
  clickPageButton: o["fwh-click-button-mvp"]
13216
13236
  };
13217
13237
  }
13218
- var w_ = /^(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;
13219
- function T_() {
13238
+ var T_ = /^(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;
13239
+ function E_() {
13220
13240
  try {
13221
- let { headings: e, pageTitleHeading: t, containerHeadings: n } = x_(), r = new Set((n || []).map((e) => e.trim())), i = (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !t || e.trim() !== t.trim()).filter((e) => !w_.test(e.trim())), a = i.filter((e) => !r.has(e.trim()));
13241
+ let { headings: e, pageTitleHeading: t, containerHeadings: n } = S_(), r = new Set((n || []).map((e) => e.trim())), i = (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !t || e.trim() !== t.trim()).filter((e) => !T_.test(e.trim())), a = i.filter((e) => !r.has(e.trim()));
13222
13242
  return a.length ? a : i;
13223
13243
  } catch {
13224
13244
  return [];
@@ -13226,7 +13246,7 @@ function T_() {
13226
13246
  }
13227
13247
  //#endregion
13228
13248
  //#region src/utils/wrapVoiceToolsForLogging.js
13229
- function E_(e) {
13249
+ function D_(e) {
13230
13250
  return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
13231
13251
  let r = An();
13232
13252
  r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
@@ -13243,11 +13263,11 @@ function E_(e) {
13243
13263
  }
13244
13264
  //#endregion
13245
13265
  //#region src/components/FlowEngageWidget.jsx
13246
- var D_ = "[PAGE_CONTEXT]";
13247
- function O_(e, t, n) {
13248
- return `${D_} 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.`;
13266
+ var O_ = "[PAGE_CONTEXT]";
13267
+ function k_(e, t, n) {
13268
+ return `${O_} 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.`;
13249
13269
  }
13250
- var k_ = {
13270
+ var A_ = {
13251
13271
  blue: "#135bd8",
13252
13272
  red: "#ef334b",
13253
13273
  yellow: "#ffbd2e",
@@ -13255,7 +13275,7 @@ var k_ = {
13255
13275
  highlight: "rgba(255,255,255,0.9)",
13256
13276
  green: "#10b981"
13257
13277
  };
13258
- function A_(e) {
13278
+ function j_(e) {
13259
13279
  if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
13260
13280
  let [t, n, r] = e;
13261
13281
  return e.length >= 3 && r ? [
@@ -13269,12 +13289,12 @@ function A_(e) {
13269
13289
  "#f7f8fa"
13270
13290
  ].join(", ");
13271
13291
  }
13272
- function j_(e) {
13292
+ function M_(e) {
13273
13293
  if (!e || typeof e != "string") return "#1a1a1a";
13274
13294
  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;
13275
13295
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
13276
13296
  }
13277
- function M_(t) {
13297
+ function N_(t) {
13278
13298
  let [n, r] = e.useState(null), i = typeof t == "string" ? t.trim() : "";
13279
13299
  return e.useEffect(() => {
13280
13300
  if (!i) {
@@ -13292,8 +13312,8 @@ function M_(t) {
13292
13312
  };
13293
13313
  }, [i]), n;
13294
13314
  }
13295
- function N_({ logo: t, style: n }) {
13296
- let r = M_(typeof t == "string" ? t : null);
13315
+ function P_({ logo: t, style: n }) {
13316
+ let r = N_(typeof t == "string" ? t : null);
13297
13317
  if (!t) return null;
13298
13318
  if (typeof t == "string") return r ? /* @__PURE__ */ g("img", {
13299
13319
  src: r,
@@ -13318,7 +13338,7 @@ function N_({ logo: t, style: n }) {
13318
13338
  children: i
13319
13339
  }) : null;
13320
13340
  }
13321
- function P_({ title: e }) {
13341
+ function F_({ title: e }) {
13322
13342
  return /* @__PURE__ */ g("div", {
13323
13343
  style: {
13324
13344
  width: "100%",
@@ -13336,18 +13356,18 @@ function P_({ title: e }) {
13336
13356
  children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
13337
13357
  });
13338
13358
  }
13339
- function F_(e, t) {
13359
+ function I_(e, t) {
13340
13360
  let n = (t || "").trim();
13341
13361
  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;
13342
13362
  }
13343
- function I_({ orbColors: e, ...t }) {
13344
- return /* @__PURE__ */ g(Jg, {
13363
+ function L_({ orbColors: e, ...t }) {
13364
+ return /* @__PURE__ */ g(Yg, {
13345
13365
  colors: e,
13346
13366
  ...t
13347
13367
  });
13348
13368
  }
13349
- function L_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
13350
- let s = n || k_.green, c = j_(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
13369
+ function R_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
13370
+ let s = n || A_.green, c = M_(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
13351
13371
  style: {
13352
13372
  display: "flex",
13353
13373
  alignItems: a ? "flex-end" : "center",
@@ -13473,7 +13493,7 @@ function L_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
13473
13493
  delay: 0
13474
13494
  },
13475
13495
  style: { flexShrink: 0 },
13476
- children: /* @__PURE__ */ g(I_, {
13496
+ children: /* @__PURE__ */ g(L_, {
13477
13497
  size: l,
13478
13498
  orbColors: t
13479
13499
  })
@@ -13505,8 +13525,8 @@ function L_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
13505
13525
  children: u
13506
13526
  })] });
13507
13527
  }
13508
- function R_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
13509
- let c = n || k_.green, l = j_(c);
13528
+ function z_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
13529
+ let c = n || A_.green, l = M_(c);
13510
13530
  return /* @__PURE__ */ _(oh.div, {
13511
13531
  initial: {
13512
13532
  scale: 50 / 350,
@@ -13577,7 +13597,7 @@ function R_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
13577
13597
  children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
13578
13598
  })
13579
13599
  }),
13580
- /* @__PURE__ */ g(I_, {
13600
+ /* @__PURE__ */ g(L_, {
13581
13601
  size: 72,
13582
13602
  orbColors: t
13583
13603
  }),
@@ -13657,7 +13677,7 @@ function R_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
13657
13677
  ]
13658
13678
  });
13659
13679
  }
13660
- function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, beaconSyncVoiceTranscript: d, widgetPosition: f = "bottom-right", voiceEndCounter: h, websiteName: v, voiceFirstMessage: y, captureVisitorEmail: b, emailRequired: x, emailCaptureEnabled: S = !0, listeningLabel: C = "Listening...", thinkingLabel: w = "Thinking...", enterChatModeLabel: T = "Enter Chat Mode", endConversationLabel: E = "End Conversation" }) {
13680
+ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, beaconSyncVoiceTranscript: d, widgetPosition: f = "bottom-right", voiceEndCounter: h, websiteName: v, voiceFirstMessage: y, captureVisitorEmail: b, emailRequired: x, emailCaptureEnabled: S = !0, listeningLabel: C = "Listening...", thinkingLabel: w = "Thinking...", enterChatModeLabel: T = "Enter Chat Mode", endConversationLabel: E = "End Conversation" }) {
13661
13681
  c(() => (console.log("[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED"), () => console.log("[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED")), []);
13662
13682
  let [D, O] = m("idle"), [k, A] = m(!1), [ee, te] = m(!1), [ne, j] = m(() => ce(i) === "auto"), M = () => {
13663
13683
  let e = ne ? "ask" : "auto";
@@ -13744,7 +13764,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13744
13764
  Pn();
13745
13765
  } catch {}
13746
13766
  try {
13747
- Gh();
13767
+ Kh();
13748
13768
  } catch {}
13749
13769
  if (i) try {
13750
13770
  Le(i);
@@ -13792,7 +13812,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13792
13812
  if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
13793
13813
  l.current = [], Ce.current = "", Oe.current = !1, je.current = !1, Me.current = !1, Ne.current = "minimized", Nr({ onBeforeNavigate: () => {
13794
13814
  if (i && l.current.length > 0) try {
13795
- let e = r_(l.current);
13815
+ let e = i_(l.current);
13796
13816
  e && Te(i, e);
13797
13817
  } catch {}
13798
13818
  if (!$n()) {
@@ -13814,7 +13834,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13814
13834
  }
13815
13835
  ke();
13816
13836
  } });
13817
- let t = E_(C_({
13837
+ let t = D_(w_({
13818
13838
  siteId: i || null,
13819
13839
  apiBaseUrl: a || null,
13820
13840
  chatId: s || null,
@@ -13939,7 +13959,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13939
13959
  onMessage: (t) => {
13940
13960
  if (e || pe.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
13941
13961
  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 || ""));
13942
- if (!n && !r && t.role === "user" && We.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null), I(!0), ge.current = !1, me.current = 0, L.current = -1, ve.current = T_(), ye.current = typeof window < "u" ? window.location.pathname : null, setTimeout(() => xe.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${ve.current.length} sections on this page`);
13962
+ if (!n && !r && t.role === "user" && We.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null), I(!0), ge.current = !1, me.current = 0, L.current = -1, ve.current = E_(), ye.current = typeof window < "u" ? window.location.pathname : null, setTimeout(() => xe.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${ve.current.length} sections on this page`);
13943
13963
  else if (!n && t.role === "user" && he.current) {
13944
13964
  let e = String(t.message || "").trim(), n = Ye(e), r = (e) => !!e && (Ke.test(e) || Je.test(e));
13945
13965
  qe.test(be.current || "") ? (console.log("[FlowEngage] walkthrough ended — visitor accepted a navigation offer"), ye.current = null, ve.current = [], I(!1)) : !n || r(e) || r(n) ? ge.current && (ge.current = !1, console.debug("[FlowEngage] walkthrough resumed by visitor"), setTimeout(() => xe.current?.(), 300)) : (console.log("[FlowEngage] walkthrough ended — visitor moved to a new topic"), ye.current = null, ve.current = [], I(!1));
@@ -13956,10 +13976,10 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13956
13976
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
13957
13977
  debug: t.debug
13958
13978
  }], i) try {
13959
- let e = r_(l.current);
13979
+ let e = i_(l.current);
13960
13980
  e && Te(i, e);
13961
13981
  } catch {}
13962
- if (F_(a, o)) {
13982
+ if (I_(a, o)) {
13963
13983
  ze.current = !0;
13964
13984
  return;
13965
13985
  }
@@ -14019,7 +14039,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14019
14039
  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(" | "));
14020
14040
  } catch {}
14021
14041
  let s = r && !m ? `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` : "";
14022
- ue.sendContextualUpdate(`${s}SiteId: ${i || "unknown"}. ${x ? "" : "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.`), ue.sendContextualUpdate(O_(e, o, a));
14042
+ ue.sendContextualUpdate(`${s}SiteId: ${i || "unknown"}. ${x ? "" : "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.`), ue.sendContextualUpdate(k_(e, o, a));
14023
14043
  } catch {}
14024
14044
  if (typeof window < "u") {
14025
14045
  let t = window.location.pathname, n = Date.now(), r = (e) => {
@@ -14055,7 +14075,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14055
14075
  } catch {}
14056
14076
  else console.log("[FlowEngage] auto-nav — skipping the arrival acknowledgment turn");
14057
14077
  try {
14058
- R.current?.sendContextualUpdate?.(O_(l, f));
14078
+ R.current?.sendContextualUpdate?.(k_(l, f));
14059
14079
  } catch {}
14060
14080
  return;
14061
14081
  }
@@ -14070,7 +14090,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14070
14090
  R.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${h}" page (${l}). Page title: "${u}". Sections: ${JSON.stringify(d)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${h} 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 "${h}" only.]`);
14071
14091
  } catch {}
14072
14092
  try {
14073
- R.current?.sendContextualUpdate?.(O_(l, f));
14093
+ R.current?.sendContextualUpdate?.(k_(l, f));
14074
14094
  } catch {}
14075
14095
  };
14076
14096
  c = window.history.pushState.bind(window.history), window.history.pushState = (...e) => {
@@ -14282,7 +14302,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14282
14302
  },
14283
14303
  children: "Muted"
14284
14304
  }),
14285
- /* @__PURE__ */ g(I_, {
14305
+ /* @__PURE__ */ g(L_, {
14286
14306
  size: 72,
14287
14307
  voiceState: D,
14288
14308
  isMuted: k,
@@ -14354,7 +14374,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14354
14374
  y2: "23"
14355
14375
  })
14356
14376
  ]
14357
- }) : /* @__PURE__ */ g(og, {
14377
+ }) : /* @__PURE__ */ g(sg, {
14358
14378
  size: 16,
14359
14379
  color: "currentColor"
14360
14380
  })
@@ -14376,7 +14396,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14376
14396
  padding: 0,
14377
14397
  flexShrink: 0
14378
14398
  },
14379
- children: /* @__PURE__ */ g(mg, {
14399
+ children: /* @__PURE__ */ g(hg, {
14380
14400
  size: 16,
14381
14401
  color: "currentColor"
14382
14402
  })
@@ -14425,7 +14445,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14425
14445
  onMouseLeave: (e) => {
14426
14446
  e.currentTarget.style.background = "none";
14427
14447
  },
14428
- children: [/* @__PURE__ */ g(hg, {}), T]
14448
+ children: [/* @__PURE__ */ g(gg, {}), T]
14429
14449
  }),
14430
14450
  i && /* @__PURE__ */ _("button", {
14431
14451
  onClick: () => M(),
@@ -14529,7 +14549,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14529
14549
  onMouseLeave: (e) => {
14530
14550
  e.currentTarget.style.background = "none";
14531
14551
  },
14532
- children: [/* @__PURE__ */ g(gg, {}), E]
14552
+ children: [/* @__PURE__ */ g(_g, {}), E]
14533
14553
  }),
14534
14554
  /* @__PURE__ */ g("button", {
14535
14555
  onClick: () => te(!1),
@@ -14581,7 +14601,7 @@ function z_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14581
14601
  ]
14582
14602
  });
14583
14603
  }
14584
- function B_({ orbColors: e }) {
14604
+ function V_({ orbColors: e }) {
14585
14605
  let t = Array.isArray(e) && e.length > 0 ? e : [
14586
14606
  "#135bd8",
14587
14607
  "#ef334b",
@@ -14600,7 +14620,7 @@ function B_({ orbColors: e }) {
14600
14620
  `.replace(/\s+/g, " ").trim()
14601
14621
  } });
14602
14622
  }
14603
- var V_ = () => /* @__PURE__ */ g("div", {
14623
+ var H_ = () => /* @__PURE__ */ g("div", {
14604
14624
  style: {
14605
14625
  display: "flex",
14606
14626
  marginBottom: "12px",
@@ -14630,7 +14650,7 @@ var V_ = () => /* @__PURE__ */ g("div", {
14630
14650
  } }, e))
14631
14651
  })
14632
14652
  });
14633
- function H_({ 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: P, setMicError: se, dismissCallError: F, activeCallId: ue, isCallMuted: de, toggleCallMute: fe, endWebRTCCall: pe, formatCallDuration: me, callDurationSeconds: he, isCallMinimized: ge, onExpand: _e, onCollapse: ve, onStartVoice: ye, voiceEnabled: be, headerBgColor: xe, onNewChat: I, showPoweredBy: L, privacyPolicyUrl: R, getVisitorChatHistory: Se, resumeChat: Ce, isSessionRestoring: we, isClosing: Te }) {
14653
+ function U_({ 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: P, setMicError: se, dismissCallError: F, activeCallId: ue, isCallMuted: de, toggleCallMute: fe, endWebRTCCall: pe, formatCallDuration: me, callDurationSeconds: he, isCallMinimized: ge, onExpand: _e, onCollapse: ve, onStartVoice: ye, voiceEnabled: be, headerBgColor: xe, onNewChat: I, showPoweredBy: L, privacyPolicyUrl: R, getVisitorChatHistory: Se, resumeChat: Ce, isSessionRestoring: we, isClosing: Te }) {
14634
14654
  let Ee = l.length > 0, De = T || E || w, Oe = !!ue, [ke, Ae] = m(!1), { resolvedConfig: je } = kn(), Me = je?.siteId || null, [Ne, Pe] = m(() => ce(Me) === "auto"), Fe = () => {
14635
14655
  let e = Ne ? "ask" : "auto";
14636
14656
  le(Me, e), Pe(e === "auto");
@@ -14773,7 +14793,7 @@ function H_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14773
14793
  justifyContent: "center",
14774
14794
  height: "40px"
14775
14795
  },
14776
- children: i ? /* @__PURE__ */ g(N_, {
14796
+ children: i ? /* @__PURE__ */ g(P_, {
14777
14797
  logo: i,
14778
14798
  style: {
14779
14799
  height: "34px",
@@ -14786,7 +14806,7 @@ function H_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14786
14806
  height: "40px",
14787
14807
  flexShrink: 0
14788
14808
  },
14789
- children: /* @__PURE__ */ g(P_, { title: e.chatTitle })
14809
+ children: /* @__PURE__ */ g(F_, { title: e.chatTitle })
14790
14810
  })
14791
14811
  }), o && /* @__PURE__ */ g("div", {
14792
14812
  style: {
@@ -15150,7 +15170,7 @@ function H_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
15150
15170
  })
15151
15171
  ]
15152
15172
  }),
15153
- /* @__PURE__ */ g(zg, {
15173
+ /* @__PURE__ */ g(Bg, {
15154
15174
  webRTCError: oe,
15155
15175
  micError: P,
15156
15176
  setMicError: se,
@@ -15158,7 +15178,7 @@ function H_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
15158
15178
  isRateLimited: E,
15159
15179
  rateLimitMessage: D
15160
15180
  }),
15161
- ge && /* @__PURE__ */ g(n_, {
15181
+ ge && /* @__PURE__ */ g(r_, {
15162
15182
  agentName: v,
15163
15183
  agentHeadshot: y,
15164
15184
  fallbackAgentName: b,
@@ -15292,17 +15312,17 @@ function H_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
15292
15312
  children: "No previous chats found."
15293
15313
  })
15294
15314
  })]
15295
- }) : null, Ee ? /* @__PURE__ */ g(Ig, {
15315
+ }) : null, Ee ? /* @__PURE__ */ g(Lg, {
15296
15316
  chatHistory: l,
15297
15317
  isAiTyping: u,
15298
15318
  isLoading: T,
15299
15319
  isAgentTyping: d,
15300
15320
  setReplyContext: N,
15301
- TypingDots: V_,
15321
+ TypingDots: H_,
15302
15322
  primaryColor: n,
15303
15323
  agentHeadshot: y,
15304
15324
  agentDisplayName: v || b,
15305
- botAvatarNode: /* @__PURE__ */ g(B_, { orbColors: t })
15325
+ botAvatarNode: /* @__PURE__ */ g(V_, { orbColors: t })
15306
15326
  }) : we ? /* @__PURE__ */ _("div", {
15307
15327
  style: {
15308
15328
  flex: 1,
@@ -15343,7 +15363,7 @@ function H_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
15343
15363
  padding: "28px 24px"
15344
15364
  },
15345
15365
  children: [
15346
- /* @__PURE__ */ g(I_, {
15366
+ /* @__PURE__ */ g(L_, {
15347
15367
  size: 94,
15348
15368
  orbColors: t
15349
15369
  }),
@@ -15434,7 +15454,7 @@ function H_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
15434
15454
  zIndex: 1,
15435
15455
  padding: ne ? "6px 0 0" : "12px 0 0"
15436
15456
  },
15437
- children: /* @__PURE__ */ g(Rg, {
15457
+ children: /* @__PURE__ */ g(zg, {
15438
15458
  input: x,
15439
15459
  setInput: S,
15440
15460
  onSubmit: C,
@@ -15508,7 +15528,7 @@ function H_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
15508
15528
  ]
15509
15529
  });
15510
15530
  }
15511
- function U_() {
15531
+ function W_() {
15512
15532
  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, beaconSyncVoiceTranscript: j, sendMessage: M, uploadChatFile: re, openWidget: ie, captureVisitorEmail: ae, setVoiceMode: N, endConversation: se, startNewChat: F, acceptCall: ce, rejectCall: le, endWebRTCCall: ue, toggleCallMute: de, dismissCallError: fe, startTyping: pe, stopTyping: me, updateTypingDraft: he, getVisitorChatHistory: ge, resumeChat: _e, isSessionRestoring: ve, openToChatCounter: ye, voiceEndCounter: be } = kn();
15513
15533
  c(() => {
15514
15534
  try {
@@ -15530,7 +15550,7 @@ function U_() {
15530
15550
  small: 50,
15531
15551
  medium: 64,
15532
15552
  large: 80
15533
- }, ke = Oe[R.orbSize] || Oe.small, je = R.position || "bottom-right", Me = L.fallbackAgentName || "Agent", Pe = A_(we ?? R.chatBgColors), Fe = L.logo || L.logoUrl || null, Ie = A || "en", Le = xe.recommendations?.[Ie] || [], z = (I.recommendations?.[Ie] ?? Le).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
15553
+ }, ke = Oe[R.orbSize] || Oe.small, je = R.position || "bottom-right", Me = L.fallbackAgentName || "Agent", Pe = j_(we ?? R.chatBgColors), Fe = L.logo || L.logoUrl || null, Ie = A || "en", Le = xe.recommendations?.[Ie] || [], z = (I.recommendations?.[Ie] ?? Le).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
15534
15554
  id: e.key || `qr-${t}`,
15535
15555
  label: e.label,
15536
15556
  message: e.label,
@@ -15621,7 +15641,7 @@ function U_() {
15621
15641
  let kt = o(() => {
15622
15642
  ht(null), _t("");
15623
15643
  }, []), At = o((e) => {
15624
- let t = Ag(e);
15644
+ let t = jg(e);
15625
15645
  if (t) {
15626
15646
  ht(null), _t(t);
15627
15647
  return;
@@ -15727,7 +15747,7 @@ function U_() {
15727
15747
  if (mt) {
15728
15748
  try {
15729
15749
  yt(!0), _t("");
15730
- let e = await re(mt), n = e?.data || e, r = tt.trim() || `Shared file: ${Mg(mt)}`;
15750
+ let e = await re(mt), n = e?.data || e, r = tt.trim() || `Shared file: ${Ng(mt)}`;
15731
15751
  nt(""), it(null), kt(), await M(r, "", t, {
15732
15752
  type: "file",
15733
15753
  metadata: {
@@ -15820,7 +15840,7 @@ function U_() {
15820
15840
  onWheel: (e) => e.stopPropagation(),
15821
15841
  onTouchMove: (e) => e.stopPropagation(),
15822
15842
  children: [
15823
- W === "entry_prompt" && /* @__PURE__ */ g(L_, {
15843
+ W === "entry_prompt" && /* @__PURE__ */ g(R_, {
15824
15844
  copy: qe,
15825
15845
  orbColors: we,
15826
15846
  primaryColor: Te,
@@ -15903,13 +15923,13 @@ function U_() {
15903
15923
  children: E === "connected" ? `${It(ut)} with ${Ze}` : `Tap to return to ${Ze}`
15904
15924
  })]
15905
15925
  })]
15906
- }), /* @__PURE__ */ g(I_, {
15926
+ }), /* @__PURE__ */ g(L_, {
15907
15927
  size: ke,
15908
15928
  orbColors: we,
15909
15929
  onClick: T ? jt : Ce ? Bt : Ht
15910
15930
  })]
15911
15931
  }),
15912
- W === "connection_modal" && /* @__PURE__ */ g(R_, {
15932
+ W === "connection_modal" && /* @__PURE__ */ g(z_, {
15913
15933
  copy: qe,
15914
15934
  orbColors: we,
15915
15935
  primaryColor: Te,
@@ -15919,7 +15939,7 @@ function U_() {
15919
15939
  isMobile: Dt,
15920
15940
  isClosing: St
15921
15941
  }),
15922
- W === "voice_mode" && /* @__PURE__ */ g(z_, {
15942
+ W === "voice_mode" && /* @__PURE__ */ g(B_, {
15923
15943
  orbColors: we,
15924
15944
  onEnterChat: Ht,
15925
15945
  onEndChat: Ut,
@@ -15942,7 +15962,7 @@ function U_() {
15942
15962
  enterChatModeLabel: L.voiceEnterChatLabel || "Enter Chat Mode",
15943
15963
  endConversationLabel: L.voiceEndConversationLabel || "End Conversation"
15944
15964
  }, "voice"),
15945
- W === "call_screen" && /* @__PURE__ */ g(t_, {
15965
+ W === "call_screen" && /* @__PURE__ */ g(n_, {
15946
15966
  incomingCall: w,
15947
15967
  activeCallId: T,
15948
15968
  callConnectionState: E,
@@ -15961,7 +15981,7 @@ function U_() {
15961
15981
  orbColors: we,
15962
15982
  chatHistory: r
15963
15983
  }),
15964
- W === "text_chat" && /* @__PURE__ */ g(H_, {
15984
+ W === "text_chat" && /* @__PURE__ */ g(U_, {
15965
15985
  isClosing: St,
15966
15986
  copy: qe,
15967
15987
  orbColors: we,
@@ -16027,7 +16047,7 @@ function U_() {
16027
16047
  }
16028
16048
  //#endregion
16029
16049
  //#region src/components/ErrorBoundary.jsx
16030
- var W_ = class extends e.Component {
16050
+ var G_ = class extends e.Component {
16031
16051
  constructor(e) {
16032
16052
  super(e), this.state = { hasError: !1 };
16033
16053
  }
@@ -16042,4 +16062,4 @@ var W_ = class extends e.Component {
16042
16062
  }
16043
16063
  };
16044
16064
  //#endregion
16045
- export { Jg as AnimatedOrb, W_ as ErrorBoundary, yi as FlowEngageProvider, U_ as FlowEngageWidget, kn as useFlowEngage };
16065
+ export { Yg as AnimatedOrb, G_ as ErrorBoundary, yi as FlowEngageProvider, W_ as FlowEngageWidget, kn as useFlowEngage };