@flowengage/react-chatbot 1.5.6 → 1.5.7

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.
@@ -25782,133 +25782,149 @@ var gE = class extends VT {
25782
25782
  }, _E = 375, vE = 6e3, Z = {
25783
25783
  wordsSoFar: 0,
25784
25784
  speechStartTime: 0,
25785
- isSpeaking: !1,
25785
+ isVoice: !1,
25786
25786
  items: [],
25787
25787
  timers: [],
25788
25788
  textDraining: !1,
25789
- lastHighlightId: null,
25790
- isVoiceMode: !1
25789
+ lastHighlightId: null
25791
25790
  };
25792
- function yE(e, t = 5e3) {
25793
- let n = {
25794
- execute: e,
25795
- wordOffset: Z.wordsSoFar,
25796
- holdMs: t
25797
- };
25798
- if (Z.isVoiceMode) if (Z.speechStartTime > 0) bE(n);
25799
- else {
25800
- Z.items.push(n);
25801
- let e = setTimeout(() => {
25802
- let e = Z.items.indexOf(n);
25803
- e !== -1 && (Z.items.splice(e, 1), n.execute());
25804
- }, vE);
25805
- Z.timers.push(e);
25806
- }
25807
- else Z.items.push(n), Z.textDraining || CE();
25808
- }
25809
- function bE(e) {
25810
- let t = e.wordOffset * _E, n = Date.now() - Z.speechStartTime, r = Math.max(0, t - n), i = setTimeout(e.execute, r);
25811
- Z.timers.push(i);
25812
- }
25813
- function xE() {
25814
- Z.speechStartTime = Date.now(), Z.isSpeaking = !0, Z.items.forEach(bE), Z.items = [];
25791
+ function yE(e) {
25792
+ let t = Math.max(0, e.wordOffset * _E - (Date.now() - Z.speechStartTime));
25793
+ Z.timers.push(setTimeout(e.execute, t));
25815
25794
  }
25816
- function SE() {
25817
- Z.isSpeaking = !1, Z.items.forEach((e) => e.execute()), Z.items = [];
25818
- }
25819
- function CE() {
25820
- if (Z.items.length === 0) {
25795
+ function bE() {
25796
+ if (!Z.items.length) {
25821
25797
  Z.textDraining = !1;
25822
25798
  return;
25823
25799
  }
25824
25800
  Z.textDraining = !0;
25825
25801
  let e = Z.items.shift();
25826
- setTimeout(() => e.execute(), 300);
25827
- let t = setTimeout(CE, e.holdMs);
25828
- Z.timers.push(t);
25802
+ setTimeout(e.execute, 300), Z.timers.push(setTimeout(bE, e.holdMs));
25803
+ }
25804
+ function xE(e) {
25805
+ Z.isVoice ? Z.speechStartTime > 0 ? yE(e) : (Z.items.push(e), Z.timers.push(setTimeout(() => {
25806
+ let t = Z.items.indexOf(e);
25807
+ t !== -1 && (Z.items.splice(t, 1), e.execute());
25808
+ }, vE))) : (Z.items.push(e), Z.textDraining || bE());
25809
+ }
25810
+ function SE(e, t = 5e3) {
25811
+ xE({
25812
+ execute: e,
25813
+ wordOffset: Z.wordsSoFar,
25814
+ holdMs: t
25815
+ });
25816
+ }
25817
+ function CE(e, t, n = 5e3) {
25818
+ xE({
25819
+ execute: e,
25820
+ wordOffset: t,
25821
+ holdMs: n
25822
+ });
25823
+ }
25824
+ function wE() {
25825
+ Z.speechStartTime = Date.now(), Z.items.forEach(yE), Z.items = [];
25826
+ }
25827
+ function TE() {
25828
+ Z.items.forEach((e) => e.execute()), Z.items = [];
25829
25829
  }
25830
- function wE(e) {
25830
+ function EE(e) {
25831
25831
  Z.wordsSoFar += e;
25832
25832
  }
25833
- function TE(e) {
25834
- Z.isVoiceMode = e;
25833
+ function DE() {
25834
+ return Z.wordsSoFar;
25835
25835
  }
25836
- function EE() {
25837
- return Z.lastHighlightId;
25836
+ function OE(e) {
25837
+ Z.isVoice = e;
25838
25838
  }
25839
- function DE(e) {
25839
+ function kE(e) {
25840
25840
  Z.lastHighlightId = e;
25841
25841
  }
25842
- function OE() {
25843
- Z.timers.forEach(clearTimeout), Z.wordsSoFar = 0, Z.speechStartTime = 0, Z.isSpeaking = !1, Z.items = [], Z.timers = [], Z.textDraining = !1, Z.lastHighlightId = null;
25842
+ function AE() {
25843
+ Z.timers.forEach(clearTimeout), Object.assign(Z, {
25844
+ wordsSoFar: 0,
25845
+ speechStartTime: 0,
25846
+ items: [],
25847
+ timers: [],
25848
+ textDraining: !1,
25849
+ lastHighlightId: null
25850
+ });
25844
25851
  }
25845
25852
  //#endregion
25846
25853
  //#region src/utils/highlightEngine.js
25847
- var kE = null;
25848
- function AE(e) {
25854
+ var jE = null;
25855
+ function ME(e) {
25849
25856
  try {
25850
25857
  e.scrollIntoView({
25851
25858
  behavior: "smooth",
25852
25859
  block: "center"
25853
25860
  });
25854
- } catch {
25855
- try {
25856
- e.scrollIntoView(!0);
25857
- } catch {}
25858
- }
25861
+ } catch {}
25859
25862
  }
25860
- function jE(e) {
25861
- ME(), kE = document.createElement("div"), kE.id = "fe-spotlight-overlay", kE.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.35);z-index:9998;pointer-events:none;transition:opacity 0.4s ease;opacity:0;", document.body.appendChild(kE), kE.offsetHeight, kE.style.opacity = "1", e.style.position = "relative", e.style.zIndex = "9999";
25863
+ function NE(e) {
25864
+ PE(), jE = Object.assign(document.createElement("div"), { id: "fe-spotlight-overlay" }), jE.style.cssText = "position:fixed;inset:0;background:rgba(0,0,0,0.35);z-index:9998;pointer-events:none;transition:opacity 0.4s ease;opacity:0;", document.body.appendChild(jE), jE.offsetHeight, jE.style.opacity = "1", e.style.position = "relative", e.style.zIndex = "9999";
25862
25865
  }
25863
- function ME() {
25864
- if (kE) {
25865
- kE.style.opacity = "0";
25866
- let e = kE;
25867
- setTimeout(() => {
25868
- e.parentNode && e.parentNode.removeChild(e);
25869
- }, 400), kE = null;
25866
+ function PE() {
25867
+ if (jE) {
25868
+ jE.style.opacity = "0";
25869
+ let e = jE;
25870
+ setTimeout(() => e.parentNode?.removeChild(e), 400), jE = null;
25870
25871
  }
25871
25872
  document.querySelectorAll("[data-fe-highlighted]").forEach((e) => {
25872
25873
  e.style.zIndex = "", e.style.position = "";
25873
25874
  });
25874
25875
  }
25875
- function NE(e) {
25876
- if (!e || e.hasAttribute("data-fe-highlighted")) return;
25877
- PE(), AE(e);
25878
- let t = e.style.cssText;
25879
- e.setAttribute("data-fe-highlighted", "true"), e.setAttribute("data-fe-orig-style", t), e.style.outline = "3px solid #2563eb", e.style.outlineOffset = "8px", e.style.background = "rgba(37, 99, 235, 0.08)", e.style.borderRadius = "8px", e.style.padding = "12px 16px", e.style.transition = "all 0.4s ease", jE(e), setTimeout(() => PE(), 6e4);
25880
- }
25881
- function PE() {
25876
+ function FE(e) {
25877
+ !e || e.hasAttribute("data-fe-highlighted") || (IE(), ME(e), e.setAttribute("data-fe-orig-style", e.style.cssText), e.setAttribute("data-fe-highlighted", "true"), Object.assign(e.style, {
25878
+ outline: "3px solid #2563eb",
25879
+ outlineOffset: "8px",
25880
+ background: "rgba(37,99,235,0.08)",
25881
+ borderRadius: "8px",
25882
+ padding: "12px 16px",
25883
+ transition: "all 0.4s ease"
25884
+ }), NE(e), setTimeout(IE, 6e4));
25885
+ }
25886
+ function IE() {
25882
25887
  let e = document.querySelector("[data-fe-highlighted]");
25883
- e && (e.style.cssText = e.getAttribute("data-fe-orig-style") || "", e.removeAttribute("data-fe-highlighted"), e.removeAttribute("data-fe-orig-style")), ME();
25888
+ e && (e.style.cssText = e.getAttribute("data-fe-orig-style") || "", e.removeAttribute("data-fe-highlighted"), e.removeAttribute("data-fe-orig-style")), PE();
25884
25889
  }
25885
- function FE() {
25886
- let e = document.querySelectorAll("h2, h3"), t = [];
25887
- return e.forEach((e) => {
25888
- let n = e.textContent.trim().replace(/[\u2014\u2013\u2014\u2013:]/g, " ").replace(/\([^)]*\)/g, "").replace(/\s+/g, " ").trim().toLowerCase(), r = [n], i = n.split(" ").filter((e) => e.length > 2);
25889
- for (let e = 0; e <= i.length - 2; e++) r.push(i.slice(e, e + 2).join(" ")), e <= i.length - 3 && r.push(i.slice(e, e + 3).join(" "));
25890
- let a = e.id || n.replace(/\s+/g, "-").slice(0, 60);
25891
- t.push({
25892
- keywords: r,
25890
+ function LE() {
25891
+ return Array.from(document.querySelectorAll("h2, h3")).map((e) => {
25892
+ let t = e.textContent.trim().replace(/[\u2013\u2014:]/g, " ").replace(/\([^)]*\)/g, "").replace(/\s+/g, " ").trim().toLowerCase(), n = t.split(" ").filter((e) => e.length > 2), r = [t];
25893
+ for (let e = 0; e <= n.length - 2; e++) r.push(n.slice(e, e + 2).join(" ")), e <= n.length - 3 && r.push(n.slice(e, e + 3).join(" "));
25894
+ return {
25893
25895
  element: e,
25894
- id: a
25895
- });
25896
- }), t;
25896
+ id: e.id || t.replace(/\s+/g, "-").slice(0, 60),
25897
+ keywords: r
25898
+ };
25899
+ });
25897
25900
  }
25898
- function IE(e, t = !1) {
25899
- let n = FE();
25901
+ function RE(e, t = !1) {
25902
+ let n = LE();
25900
25903
  if (!n.length) return;
25901
- let r = e.toLowerCase(), i = null, a = 0;
25902
- for (let e of n) for (let t of e.keywords) t.length < 10 || r.includes(t) && t.length > a && (a = t.length, i = e);
25903
- if (i && i.id !== EE()) {
25904
- DE(i.id);
25905
- let n = e.trim().split(/\s+/).length;
25906
- yE(() => NE(i.element), Math.max(5e3, Math.min(n * (t ? 400 : 240), 25e3)));
25907
- }
25904
+ let r = e.toLowerCase(), i = DE(), a = t ? 400 : 240, o = e.trim().split(/\s+/).length, s = n.map((t) => {
25905
+ let n = t.keywords.filter((e) => e.length >= 10).reduce((e, t) => {
25906
+ let n = r.indexOf(t);
25907
+ return n !== -1 && n < e ? n : e;
25908
+ }, Infinity);
25909
+ return n === Infinity ? null : {
25910
+ entry: t,
25911
+ wordOffset: e.substring(0, n).trim().split(/\s+/).filter(Boolean).length
25912
+ };
25913
+ }).filter(Boolean).sort((e, t) => e.wordOffset - t.wordOffset);
25914
+ if (!s.length) return;
25915
+ let c = /* @__PURE__ */ new Set();
25916
+ s.forEach(({ entry: e, wordOffset: t }, n) => {
25917
+ if (c.has(e.id)) return;
25918
+ c.add(e.id);
25919
+ let r = s[n + 1]?.wordOffset ?? o, l = Math.max(3e3, Math.min((r - t) * a, 2e4)), { element: u, id: d } = e;
25920
+ CE(() => {
25921
+ kE(d), FE(u);
25922
+ }, i + t, l);
25923
+ });
25908
25924
  }
25909
25925
  //#endregion
25910
25926
  //#region src/lib/svgIcons.jsx
25911
- var LE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25927
+ var zE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25912
25928
  width: e,
25913
25929
  height: e,
25914
25930
  viewBox: "0 0 24 24",
@@ -25923,7 +25939,7 @@ var LE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25923
25939
  x2: "1",
25924
25940
  y2: "23"
25925
25941
  })]
25926
- }), RE = () => /* @__PURE__ */ _("svg", {
25942
+ }), BE = () => /* @__PURE__ */ _("svg", {
25927
25943
  width: "18",
25928
25944
  height: "18",
25929
25945
  viewBox: "0 0 24 24",
@@ -25938,7 +25954,7 @@ var LE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25938
25954
  x2: "12",
25939
25955
  y2: "5"
25940
25956
  }), /* @__PURE__ */ g("polyline", { points: "5 12 12 5 19 12" })]
25941
- }), zE = () => /* @__PURE__ */ _("svg", {
25957
+ }), VE = () => /* @__PURE__ */ _("svg", {
25942
25958
  width: "14",
25943
25959
  height: "14",
25944
25960
  viewBox: "0 0 24 24",
@@ -25948,7 +25964,7 @@ var LE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25948
25964
  strokeLinecap: "round",
25949
25965
  strokeLinejoin: "round",
25950
25966
  children: [/* @__PURE__ */ g("polyline", { points: "9 17 4 12 9 7" }), /* @__PURE__ */ g("path", { d: "M20 18v-2a4 4 0 00-4-4H4" })]
25951
- }), BE = () => /* @__PURE__ */ g("svg", {
25967
+ }), HE = () => /* @__PURE__ */ g("svg", {
25952
25968
  width: "18",
25953
25969
  height: "18",
25954
25970
  viewBox: "0 0 24 24",
@@ -25958,7 +25974,7 @@ var LE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25958
25974
  strokeLinecap: "round",
25959
25975
  strokeLinejoin: "round",
25960
25976
  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" })
25961
- }), VE = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
25977
+ }), UE = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
25962
25978
  className: e,
25963
25979
  width: "14",
25964
25980
  height: "14",
@@ -25987,7 +26003,7 @@ var LE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25987
26003
  y2: "16"
25988
26004
  })
25989
26005
  ]
25990
- }), HE = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
26006
+ }), WE = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
25991
26007
  width: e,
25992
26008
  height: e,
25993
26009
  viewBox: "0 0 24 24",
@@ -26010,7 +26026,7 @@ var LE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
26010
26026
  /* @__PURE__ */ g("path", { d: "M15 13v2" }),
26011
26027
  /* @__PURE__ */ g("path", { d: "M9 13v2" })
26012
26028
  ]
26013
- }), UE = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
26029
+ }), GE = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
26014
26030
  width: e,
26015
26031
  height: e,
26016
26032
  viewBox: "0 0 24 24",
@@ -26030,8 +26046,8 @@ var LE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
26030
26046
  x2: "19",
26031
26047
  y2: "12"
26032
26048
  })]
26033
- }), WE = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), GE = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
26034
- function KE(e) {
26049
+ }), KE = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), qE = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
26050
+ function JE(e) {
26035
26051
  let t = String(e || "").trim();
26036
26052
  if (!t) return t;
26037
26053
  let n = /^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);
@@ -26043,33 +26059,33 @@ function KE(e) {
26043
26059
  }
26044
26060
  return e;
26045
26061
  }
26046
- var qE = (e = "") => {
26062
+ var YE = (e = "") => {
26047
26063
  let t = String(e || "").trim();
26048
26064
  if (!t) return "";
26049
- if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return KE(t);
26050
- 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) => GE(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>");
26051
- return KE(n.map((e) => {
26065
+ if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return JE(t);
26066
+ 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) => qE(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>");
26067
+ return JE(n.map((e) => {
26052
26068
  let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = t.filter((e) => /^[-*]\s+/.test(e));
26053
26069
  if (n.length >= 2 && n.length === t.length) return `<ul>${n.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>`;
26054
26070
  let i = e.split(/\s+(?=[-*]\s+\*\*?)/).map((e) => e.trim()).filter(Boolean);
26055
26071
  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>`;
26056
26072
  }).join(""));
26057
- }, JE = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), YE = new Set([
26073
+ }, XE = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), ZE = new Set([
26058
26074
  ".pdf",
26059
26075
  ".docx",
26060
26076
  ".png",
26061
26077
  ".jpg",
26062
26078
  ".jpeg"
26063
- ]), XE = "image/png,image/jpeg,.pdf,.docx";
26064
- function ZE(e) {
26079
+ ]), QE = "image/png,image/jpeg,.pdf,.docx";
26080
+ function $E(e) {
26065
26081
  if (!e) return !1;
26066
26082
  let t = typeof e.name == "string" ? e.name.toLowerCase() : "", n = t.includes(".") ? `.${t.split(".").pop()}` : "", r = typeof e.type == "string" ? e.type.toLowerCase() : "";
26067
- return r === "image/png" || r === "image/jpeg" || JE.has(r) || YE.has(n);
26083
+ return r === "image/png" || r === "image/jpeg" || XE.has(r) || ZE.has(n);
26068
26084
  }
26069
- function QE(e) {
26070
- return e ? ZE(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
26085
+ function eD(e) {
26086
+ return e ? $E(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
26071
26087
  }
26072
- function $E(e = 0) {
26088
+ function tD(e = 0) {
26073
26089
  if (!Number.isFinite(e) || e <= 0) return "";
26074
26090
  let t = [
26075
26091
  "B",
@@ -26081,12 +26097,12 @@ function $E(e = 0) {
26081
26097
  let i = n >= 10 || r === 0 ? 0 : 1;
26082
26098
  return `${n.toFixed(i)} ${t[r]}`;
26083
26099
  }
26084
- function eD(e) {
26100
+ function nD(e) {
26085
26101
  return e ? e.name || "Attachment" : "";
26086
26102
  }
26087
26103
  //#endregion
26088
26104
  //#region src/utils/avatarHelpers.js
26089
- function tD(e) {
26105
+ function rD(e) {
26090
26106
  if (!e || typeof e != "string") return "?";
26091
26107
  let t = e.trim();
26092
26108
  if (!t) return "?";
@@ -26095,7 +26111,7 @@ function tD(e) {
26095
26111
  }
26096
26112
  //#endregion
26097
26113
  //#region src/components/AvatarImageOrInitials.jsx
26098
- function nD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26114
+ function iD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26099
26115
  let [i, a] = m(!1), o = typeof e == "string" ? e.trim() : "";
26100
26116
  return c(() => {
26101
26117
  a(!1);
@@ -26106,12 +26122,12 @@ function nD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26106
26122
  style: n
26107
26123
  }) : /* @__PURE__ */ g("span", {
26108
26124
  style: r,
26109
- children: tD(t)
26125
+ children: rD(t)
26110
26126
  });
26111
26127
  }
26112
26128
  //#endregion
26113
26129
  //#region src/components/MessageList.jsx
26114
- function rD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext: r, TypingDots: i, primaryColor: a = "#3B82F6", agentHeadshot: o = null, agentDisplayName: s = "Agent", botAvatarNode: l = null }) {
26130
+ function aD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext: r, TypingDots: i, primaryColor: a = "#3B82F6", agentHeadshot: o = null, agentDisplayName: s = "Agent", botAvatarNode: l = null }) {
26115
26131
  let u = p(null), d = (e) => {
26116
26132
  if (!e) return "just now";
26117
26133
  let t = /* @__PURE__ */ new Date(), n = new Date(e), r = Math.max(0, Math.floor((t - n) / 1e3));
@@ -26140,7 +26156,7 @@ function rD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26140
26156
  },
26141
26157
  children: [
26142
26158
  e.map((e) => {
26143
- let t = e.sender === "system", n = e.sender === "user", i = e.sender === "ai" || e.sender === "bot", c = e.sender === "agent", u = e.isPending, f = e.type === "file" && e.metadata?.fileUrl, p = e.agent_name || e.agentName || e.metadata?.agentName || s, m = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof o == "string" && o.trim() || null, h = WE(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
26159
+ let t = e.sender === "system", n = e.sender === "user", i = e.sender === "ai" || e.sender === "bot", c = e.sender === "agent", u = e.isPending, f = e.type === "file" && e.metadata?.fileUrl, p = e.agent_name || e.agentName || e.metadata?.agentName || s, m = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof o == "string" && o.trim() || null, h = KE(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
26144
26160
  return t ? /* @__PURE__ */ g("div", {
26145
26161
  style: {
26146
26162
  display: "flex",
@@ -26185,7 +26201,7 @@ function rD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26185
26201
  fontWeight: 800,
26186
26202
  marginTop: !u && (i || c) ? "22px" : "0px"
26187
26203
  },
26188
- children: i ? l || /* @__PURE__ */ g(HE, { size: 16 }) : /* @__PURE__ */ g(nD, {
26204
+ children: i ? l || /* @__PURE__ */ g(WE, { size: 16 }) : /* @__PURE__ */ g(iD, {
26189
26205
  src: m || "",
26190
26206
  name: p,
26191
26207
  imgStyle: {
@@ -26227,7 +26243,7 @@ function rD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26227
26243
  onMouseLeave: (e) => {
26228
26244
  e.currentTarget.style.color = "#9ca3af";
26229
26245
  },
26230
- children: [/* @__PURE__ */ g(zE, {}), "Reply"]
26246
+ children: [/* @__PURE__ */ g(VE, {}), "Reply"]
26231
26247
  }),
26232
26248
  /* @__PURE__ */ _("div", {
26233
26249
  style: {
@@ -26271,7 +26287,7 @@ function rD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26271
26287
  })]
26272
26288
  }),
26273
26289
  f ? (() => {
26274
- let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = $E(e.metadata.fileSize), a = t.startsWith("image/"), o = t === "application/pdf" ? {
26290
+ let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = tD(e.metadata.fileSize), a = t.startsWith("image/"), o = t === "application/pdf" ? {
26275
26291
  color: "#ef4444",
26276
26292
  label: "PDF"
26277
26293
  } : t.includes("word") || t.includes("docx") ? {
@@ -26429,7 +26445,7 @@ function rD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26429
26445
  });
26430
26446
  })() : i ? /* @__PURE__ */ g("div", {
26431
26447
  className: "flowengage-message-content fe-bot-message",
26432
- dangerouslySetInnerHTML: { __html: qE(e.message) }
26448
+ dangerouslySetInnerHTML: { __html: YE(e.message) }
26433
26449
  }) : /* @__PURE__ */ g("div", {
26434
26450
  style: { whiteSpace: n || c ? "normal" : "pre-wrap" },
26435
26451
  children: e.message
@@ -26494,7 +26510,7 @@ function rD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26494
26510
  boxShadow: l ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
26495
26511
  overflow: "hidden"
26496
26512
  },
26497
- children: l || /* @__PURE__ */ g(HE, { size: 16 })
26513
+ children: l || /* @__PURE__ */ g(WE, { size: 16 })
26498
26514
  }), /* @__PURE__ */ _("div", {
26499
26515
  style: {
26500
26516
  display: "flex",
@@ -26536,7 +26552,7 @@ function rD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26536
26552
  borderRadius: "50%",
26537
26553
  overflow: "hidden"
26538
26554
  },
26539
- children: /* @__PURE__ */ g(nD, {
26555
+ children: /* @__PURE__ */ g(iD, {
26540
26556
  src: o || "",
26541
26557
  name: s,
26542
26558
  imgStyle: {
@@ -26576,7 +26592,7 @@ function rD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26576
26592
  }
26577
26593
  //#endregion
26578
26594
  //#region src/components/ChatInput.jsx
26579
- function iD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: c, clearReplyContext: l, requiresEmail: u, emailInput: d, setEmailInput: f, emailError: m, showVoiceToggle: v = !1, voiceEnabled: y = !0, onFileSelect: b, selectedFile: x = null, onRemoveSelectedFile: S, attachmentError: C = "", isUploadingAttachment: w = !1, inputPlaceholder: T = "Type your message" }) {
26595
+ function oD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: c, clearReplyContext: l, requiresEmail: u, emailInput: d, setEmailInput: f, emailError: m, showVoiceToggle: v = !1, voiceEnabled: y = !0, onFileSelect: b, selectedFile: x = null, onRemoveSelectedFile: S, attachmentError: C = "", isUploadingAttachment: w = !1, inputPlaceholder: T = "Type your message" }) {
26580
26596
  let ee = p(null), te = c?.sender === "user" ? "You" : c?.sender === "agent" ? "Agent" : "AI Assistant", ne = u ? !!d?.trim() : !!e?.trim() || !!x, re = s || w || !ne, E = !u && y && v;
26581
26597
  return /* @__PURE__ */ _("div", {
26582
26598
  style: {
@@ -26684,7 +26700,7 @@ function iD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26684
26700
  background: "rgba(59,130,246,0.08)",
26685
26701
  color: "var(--flowengage-primary)"
26686
26702
  },
26687
- children: /* @__PURE__ */ g(HE, { size: 13 })
26703
+ children: /* @__PURE__ */ g(WE, { size: 13 })
26688
26704
  }), /* @__PURE__ */ g("span", { children: "Please provide your email address so we can help you." })]
26689
26705
  })
26690
26706
  }),
@@ -26724,7 +26740,7 @@ function iD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26724
26740
  overflow: "hidden",
26725
26741
  textOverflow: "ellipsis"
26726
26742
  },
26727
- children: eD(x)
26743
+ children: nD(x)
26728
26744
  }),
26729
26745
  /* @__PURE__ */ g("div", {
26730
26746
  style: {
@@ -26732,7 +26748,7 @@ function iD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26732
26748
  color: "#6b7280",
26733
26749
  marginTop: "2px"
26734
26750
  },
26735
- children: $E(x.size)
26751
+ children: tD(x.size)
26736
26752
  })
26737
26753
  ]
26738
26754
  }), /* @__PURE__ */ g("button", {
@@ -26776,7 +26792,7 @@ function iD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26776
26792
  E ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("input", {
26777
26793
  ref: ee,
26778
26794
  type: "file",
26779
- accept: XE,
26795
+ accept: QE,
26780
26796
  style: { display: "none" },
26781
26797
  onChange: (e) => {
26782
26798
  let t = e.target.files?.[0];
@@ -26808,7 +26824,7 @@ function iD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26808
26824
  onMouseLeave: (e) => {
26809
26825
  e.currentTarget.style.opacity = "1";
26810
26826
  },
26811
- children: /* @__PURE__ */ g(UE, {
26827
+ children: /* @__PURE__ */ g(GE, {
26812
26828
  size: 18,
26813
26829
  color: "currentColor"
26814
26830
  })
@@ -26863,7 +26879,7 @@ function iD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26863
26879
  onMouseLeave: (e) => {
26864
26880
  e.currentTarget.style.opacity = "1";
26865
26881
  },
26866
- children: /* @__PURE__ */ g(RE, {})
26882
+ children: /* @__PURE__ */ g(BE, {})
26867
26883
  })
26868
26884
  ]
26869
26885
  }),
@@ -26926,7 +26942,7 @@ function iD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26926
26942
  }
26927
26943
  //#endregion
26928
26944
  //#region src/components/StatusBanners.jsx
26929
- var aD = ({ muted: e = !1 }) => /* @__PURE__ */ _("svg", {
26945
+ var sD = ({ muted: e = !1 }) => /* @__PURE__ */ _("svg", {
26930
26946
  width: "16",
26931
26947
  height: "16",
26932
26948
  viewBox: "0 0 24 24",
@@ -26946,7 +26962,7 @@ var aD = ({ muted: e = !1 }) => /* @__PURE__ */ _("svg", {
26946
26962
  y2: "22"
26947
26963
  })
26948
26964
  ]
26949
- }), oD = ({ variant: e, onClick: t, children: n, icon: r, compact: i = !1, iconOnly: a = !1, active: o = !1, ariaLabel: s }) => /* @__PURE__ */ _("button", {
26965
+ }), cD = ({ variant: e, onClick: t, children: n, icon: r, compact: i = !1, iconOnly: a = !1, active: o = !1, ariaLabel: s }) => /* @__PURE__ */ _("button", {
26950
26966
  type: "button",
26951
26967
  className: [
26952
26968
  "flowengage-call-btn",
@@ -26960,7 +26976,7 @@ var aD = ({ muted: e = !1 }) => /* @__PURE__ */ _("svg", {
26960
26976
  title: s || n,
26961
26977
  children: [r, !a && /* @__PURE__ */ g("span", { children: n })]
26962
26978
  });
26963
- function sD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, incomingCall: i, rejectCall: a, acceptCall: s, activeCallId: l, callConnectionState: u, formatCallDuration: d, callDurationSeconds: m, endWebRTCCall: v, isCallMuted: y, toggleCallMute: b, isAIVoiceActive: x, currentCallAgentName: S, isRateLimited: C, rateLimitMessage: w }) {
26979
+ function lD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, incomingCall: i, rejectCall: a, acceptCall: s, activeCallId: l, callConnectionState: u, formatCallDuration: d, callDurationSeconds: m, endWebRTCCall: v, isCallMuted: y, toggleCallMute: b, isAIVoiceActive: x, currentCallAgentName: S, isRateLimited: C, rateLimitMessage: w }) {
26964
26980
  let T = p(null), ee = o(() => {
26965
26981
  if (!T.current) return;
26966
26982
  let { audioContext: e, oscillator: t, interval: n, toneTimeout: r } = T.current;
@@ -27020,7 +27036,7 @@ function sD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27020
27036
  gap: "10px"
27021
27037
  },
27022
27038
  children: [
27023
- /* @__PURE__ */ g(VE, { className: "" }),
27039
+ /* @__PURE__ */ g(UE, { className: "" }),
27024
27040
  /* @__PURE__ */ g("span", {
27025
27041
  style: {
27026
27042
  fontSize: "12px",
@@ -27063,7 +27079,7 @@ function sD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27063
27079
  className: "call-connected-identity",
27064
27080
  children: [/* @__PURE__ */ g("div", {
27065
27081
  className: `call-icon-wrapper ${E}`,
27066
- children: /* @__PURE__ */ g(LE, { size: 20 })
27082
+ children: /* @__PURE__ */ g(zE, { size: 20 })
27067
27083
  }), /* @__PURE__ */ _("div", {
27068
27084
  className: "call-info-group",
27069
27085
  children: [/* @__PURE__ */ g("h3", {
@@ -27080,25 +27096,25 @@ function sD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27080
27096
  })]
27081
27097
  }), /* @__PURE__ */ _("div", {
27082
27098
  className: "call-actions connected",
27083
- children: [/* @__PURE__ */ g(oD, {
27099
+ children: [/* @__PURE__ */ g(cD, {
27084
27100
  variant: "mute",
27085
27101
  onClick: b,
27086
27102
  compact: x,
27087
27103
  active: y,
27088
- icon: /* @__PURE__ */ g(aD, { muted: y }),
27104
+ icon: /* @__PURE__ */ g(sD, { muted: y }),
27089
27105
  children: y ? "Unmute" : "Mute"
27090
- }), /* @__PURE__ */ g(oD, {
27106
+ }), /* @__PURE__ */ g(cD, {
27091
27107
  variant: "end",
27092
27108
  onClick: v,
27093
27109
  compact: x,
27094
- icon: /* @__PURE__ */ g(LE, { size: 14 }),
27110
+ icon: /* @__PURE__ */ g(zE, { size: 14 }),
27095
27111
  children: "End"
27096
27112
  })]
27097
27113
  })] }) : /* @__PURE__ */ _(h, { children: [
27098
27114
  /* @__PURE__ */ _("div", {
27099
27115
  className: `call-icon-wrapper ${E}`,
27100
27116
  children: [
27101
- /* @__PURE__ */ g(BE, {}),
27117
+ /* @__PURE__ */ g(HE, {}),
27102
27118
  E === "incoming" && /* @__PURE__ */ g("div", { className: "call-pulse-animation" }),
27103
27119
  E === "connecting" && /* @__PURE__ */ g("div", { className: "call-connecting-animation" })
27104
27120
  ]
@@ -27115,22 +27131,22 @@ function sD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27115
27131
  }),
27116
27132
  /* @__PURE__ */ g("div", {
27117
27133
  className: "call-actions",
27118
- children: E === "incoming" && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(oD, {
27134
+ children: E === "incoming" && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(cD, {
27119
27135
  variant: "reject",
27120
27136
  onClick: async () => {
27121
27137
  ee(), await a();
27122
27138
  },
27123
27139
  iconOnly: !0,
27124
- icon: /* @__PURE__ */ g(LE, { size: 14 }),
27140
+ icon: /* @__PURE__ */ g(zE, { size: 14 }),
27125
27141
  ariaLabel: "Decline call",
27126
27142
  children: "Decline"
27127
- }), /* @__PURE__ */ g(oD, {
27143
+ }), /* @__PURE__ */ g(cD, {
27128
27144
  variant: "accept",
27129
27145
  onClick: async () => {
27130
27146
  ee(), await s();
27131
27147
  },
27132
27148
  iconOnly: !0,
27133
- icon: /* @__PURE__ */ g(BE, {}),
27149
+ icon: /* @__PURE__ */ g(HE, {}),
27134
27150
  ariaLabel: "Accept call",
27135
27151
  children: "Accept"
27136
27152
  })] })
@@ -27153,13 +27169,13 @@ function sD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27153
27169
  }
27154
27170
  //#endregion
27155
27171
  //#region src/components/AnimatedOrb.jsx
27156
- var cD = [
27172
+ var uD = [
27157
27173
  "#135bd8",
27158
27174
  "#ef334b",
27159
27175
  "#ffbd2e"
27160
27176
  ];
27161
- function lD(e) {
27162
- return !Array.isArray(e) || e.length === 0 ? cD : e.length === 1 ? [
27177
+ function dD(e) {
27178
+ return !Array.isArray(e) || e.length === 0 ? uD : e.length === 1 ? [
27163
27179
  e[0],
27164
27180
  e[0],
27165
27181
  e[0]
@@ -27173,14 +27189,14 @@ function lD(e) {
27173
27189
  e[2]
27174
27190
  ];
27175
27191
  }
27176
- var uD = {
27192
+ var fD = {
27177
27193
  idle: 3,
27178
27194
  listening: .75,
27179
27195
  speaking: 1.4,
27180
27196
  muted: .75,
27181
27197
  error: .08
27182
27198
  };
27183
- function dD(e) {
27199
+ function pD(e) {
27184
27200
  if (!e || typeof e != "string") return [
27185
27201
  0,
27186
27202
  0,
@@ -27193,14 +27209,14 @@ function dD(e) {
27193
27209
  parseInt(n.slice(4, 6), 16) / 255
27194
27210
  ];
27195
27211
  }
27196
- function fD(e, t) {
27212
+ function mD(e, t) {
27197
27213
  if (!e || typeof e != "string") return `rgba(0,0,0,${t})`;
27198
27214
  if (e.startsWith("rgb")) return e.replace(/[\d.]+\)$/, `${t})`);
27199
27215
  let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
27200
27216
  return `rgba(${parseInt(r.slice(0, 2), 16)},${parseInt(r.slice(2, 4), 16)},${parseInt(r.slice(4, 6), 16)},${t})`;
27201
27217
  }
27202
- var pD = "\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", mD = "\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 masks.\n // Left/right use exponent 1.4 (they span the full axis so they need some\n // tightening). Bottom uses 0.8 — a lower exponent spreads the third colour\n // further toward the centre, compensating for the circular clip making the\n // bottom band visually narrower than left/right. All three end up with\n // roughly equal visual weight in the finished orb.\n float d1 = pow(1.0 - uv.x, 1.4); // Color 1: from LEFT (uv.x = 0)\n float d2 = pow(uv.x, 1.4); // Color 2: from RIGHT (uv.x = 1)\n float d3 = pow(1.0 - uv.y, 0.8); // Color 3: from BOTTOM — wider spread for balance\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";
27203
- function hD(e, t, n) {
27218
+ var hD = "\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", gD = "\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 masks.\n // Left/right use exponent 1.4 (they span the full axis so they need some\n // tightening). Bottom uses 0.8 — a lower exponent spreads the third colour\n // further toward the centre, compensating for the circular clip making the\n // bottom band visually narrower than left/right. All three end up with\n // roughly equal visual weight in the finished orb.\n float d1 = pow(1.0 - uv.x, 1.4); // Color 1: from LEFT (uv.x = 0)\n float d2 = pow(uv.x, 1.4); // Color 2: from RIGHT (uv.x = 1)\n float d3 = pow(1.0 - uv.y, 0.8); // Color 3: from BOTTOM — wider spread for balance\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";
27219
+ function _D(e, t, n) {
27204
27220
  let r = (t, n) => {
27205
27221
  let r = e.createShader(t);
27206
27222
  return e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("[AnimatedOrb shader]", e.getShaderInfoLog(r)), null);
@@ -27209,10 +27225,10 @@ function hD(e, t, n) {
27209
27225
  let o = e.createProgram();
27210
27226
  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);
27211
27227
  }
27212
- function gD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
27213
- let [s, l, u] = lD(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(uD[t] ?? .35);
27228
+ function vD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
27229
+ let [s, l, u] = dD(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(fD[t] ?? .35);
27214
27230
  c(() => {
27215
- h.current = uD[t] ?? .35;
27231
+ h.current = fD[t] ?? .35;
27216
27232
  }, [t]), c(() => {
27217
27233
  let t = m.current;
27218
27234
  if (!t) return;
@@ -27229,7 +27245,7 @@ function gD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27229
27245
  console.warn("[AnimatedOrb] WebGL unavailable.");
27230
27246
  return;
27231
27247
  }
27232
- let i = hD(r, pD, mD);
27248
+ let i = _D(r, hD, gD);
27233
27249
  if (!i) {
27234
27250
  console.error("[AnimatedOrb] WebGL program failed to compile/link");
27235
27251
  return;
@@ -27259,7 +27275,7 @@ function gD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27259
27275
  c2: r.getUniformLocation(i, "u_c2"),
27260
27276
  c3: r.getUniformLocation(i, "u_c3")
27261
27277
  };
27262
- r.uniform3fv(c.c1, dD(s)), r.uniform3fv(c.c2, dD(l)), r.uniform3fv(c.c3, dD(u)), r.viewport(0, 0, t.width, t.height);
27278
+ r.uniform3fv(c.c1, pD(s)), r.uniform3fv(c.c2, pD(l)), r.uniform3fv(c.c3, pD(u)), r.viewport(0, 0, t.width, t.height);
27263
27279
  let d = performance.now(), f, p = (e) => {
27264
27280
  r.uniform1f(c.time, (e - d) / 1e3), r.uniform1f(c.speed, h.current), r.drawArrays(r.TRIANGLES, 0, 6), f = requestAnimationFrame(p);
27265
27281
  };
@@ -27290,7 +27306,7 @@ function gD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27290
27306
  position: "absolute",
27291
27307
  inset: -10,
27292
27308
  borderRadius: "50%",
27293
- background: `radial-gradient(circle, ${fD(s, .18)} 0%, transparent 70%)`,
27309
+ background: `radial-gradient(circle, ${mD(s, .18)} 0%, transparent 70%)`,
27294
27310
  pointerEvents: "none"
27295
27311
  },
27296
27312
  animate: { opacity: [.3, .75] },
@@ -27369,7 +27385,7 @@ function gD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27369
27385
  //#endregion
27370
27386
  //#region src/utils/voiceActionVisuals.js
27371
27387
  var Q = "fe-vv";
27372
- function _D() {
27388
+ function yD() {
27373
27389
  if (typeof document > "u" || document.getElementById(`${Q}-styles`)) return;
27374
27390
  let e = `
27375
27391
  /* ── Action toast ───────────────────────────────────────────────────────────── */
@@ -27514,14 +27530,14 @@ function _D() {
27514
27530
  `, t = document.createElement("style");
27515
27531
  t.id = `${Q}-styles`, t.textContent = e, (document.head || document.documentElement).appendChild(t);
27516
27532
  }
27517
- var vD = null, yD = null;
27518
- function bD() {
27519
- return (!vD || !vD.isConnected) && (vD = document.createElement("div"), vD.id = `${Q}-toast`, document.body.appendChild(vD)), vD;
27533
+ var bD = null, xD = null;
27534
+ function SD() {
27535
+ return (!bD || !bD.isConnected) && (bD = document.createElement("div"), bD.id = `${Q}-toast`, document.body.appendChild(bD)), bD;
27520
27536
  }
27521
- function xD(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
27537
+ function CD(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
27522
27538
  if (typeof document > "u") return;
27523
- _D(), yD &&= (clearTimeout(yD), null);
27524
- let i = bD();
27539
+ yD(), xD &&= (clearTimeout(xD), null);
27540
+ let i = SD();
27525
27541
  if (i.innerHTML = "", n) {
27526
27542
  let e = document.createElement("span");
27527
27543
  e.className = `${Q}-icon`, e.textContent = n, i.appendChild(e);
@@ -27530,82 +27546,82 @@ function xD(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
27530
27546
  e.className = `${Q}-spin`, i.appendChild(e);
27531
27547
  }
27532
27548
  let a = document.createElement("span");
27533
- a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (yD = setTimeout(() => SD(), r));
27549
+ a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (xD = setTimeout(() => wD(), r));
27534
27550
  }
27535
- function SD(e = 0) {
27536
- vD && (e > 0 ? yD = setTimeout(() => {
27537
- vD && vD.classList.remove(`${Q}-show`);
27538
- }, e) : vD && vD.classList.remove(`${Q}-show`));
27551
+ function wD(e = 0) {
27552
+ bD && (e > 0 ? xD = setTimeout(() => {
27553
+ bD && bD.classList.remove(`${Q}-show`);
27554
+ }, e) : bD && bD.classList.remove(`${Q}-show`));
27539
27555
  }
27540
- var CD = null, wD = [];
27541
- function TD() {
27542
- return (!CD || !CD.isConnected) && (CD = document.createElement("div"), CD.id = `${Q}-bar`, document.body.appendChild(CD)), CD;
27556
+ var TD = null, ED = [];
27557
+ function DD() {
27558
+ return (!TD || !TD.isConnected) && (TD = document.createElement("div"), TD.id = `${Q}-bar`, document.body.appendChild(TD)), TD;
27543
27559
  }
27544
- function ED() {
27560
+ function OD() {
27545
27561
  if (typeof document > "u") return;
27546
- _D(), wD.forEach(clearTimeout), wD = [];
27547
- let e = TD();
27562
+ yD(), ED.forEach(clearTimeout), ED = [];
27563
+ let e = DD();
27548
27564
  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";
27549
27565
  let t = [[80, "width 0.6s ease"], [92, "width 1.2s ease"]], n = 50;
27550
27566
  for (let [e, r] of t) {
27551
27567
  let t = n, i = e, a = r;
27552
- wD.push(setTimeout(() => {
27553
- CD && (CD.style.transition = a, CD.style.width = `${i}%`);
27568
+ ED.push(setTimeout(() => {
27569
+ TD && (TD.style.transition = a, TD.style.width = `${i}%`);
27554
27570
  }, t)), n += 800;
27555
27571
  }
27556
27572
  }
27557
- function DD() {
27558
- CD && (wD.forEach(clearTimeout), wD = [], CD.style.transition = "width 0.2s ease", CD.style.width = "100%", wD.push(setTimeout(() => {
27559
- CD && (CD.style.transition = "opacity 0.35s ease", CD.style.opacity = "0", wD.push(setTimeout(() => {
27560
- CD && (CD.style.width = "0%", CD.classList.remove(`${Q}-bar-active`));
27573
+ function kD() {
27574
+ TD && (ED.forEach(clearTimeout), ED = [], TD.style.transition = "width 0.2s ease", TD.style.width = "100%", ED.push(setTimeout(() => {
27575
+ TD && (TD.style.transition = "opacity 0.35s ease", TD.style.opacity = "0", ED.push(setTimeout(() => {
27576
+ TD && (TD.style.width = "0%", TD.classList.remove(`${Q}-bar-active`));
27561
27577
  }, 380)));
27562
27578
  }, 220)));
27563
27579
  }
27564
- function OD() {
27580
+ function AD() {
27565
27581
  typeof document > "u" || document.querySelectorAll(`.${Q}-field-active, .${Q}-field-filled`).forEach((e) => e.classList.remove(`${Q}-field-active`, `${Q}-field-filled`));
27566
27582
  }
27567
- function kD(e) {
27568
- !e || typeof document > "u" || (_D(), OD(), e.classList.add(`${Q}-field-active`));
27583
+ function jD(e) {
27584
+ !e || typeof document > "u" || (yD(), AD(), e.classList.add(`${Q}-field-active`));
27569
27585
  }
27570
- function AD(e) {
27586
+ function MD(e) {
27571
27587
  e && (e.classList.remove(`${Q}-field-active`), e.classList.add(`${Q}-field-filled`), setTimeout(() => {
27572
27588
  e.isConnected && e.classList.remove(`${Q}-field-filled`);
27573
27589
  }, 1400));
27574
27590
  }
27575
- var jD = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
27591
+ var ND = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
27576
27592
  <filter id="${Q}-csh">
27577
27593
  <feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
27578
27594
  </filter>
27579
27595
  <path d="M4 2L19 10.5L11 12.8L8 20L4 2Z"
27580
27596
  fill="white" stroke="#1e1b4b" stroke-width="1.6" stroke-linejoin="round"
27581
27597
  filter="url(#${Q}-csh)"/>
27582
- </svg>`, MD = null, ND = !1;
27583
- function PD() {
27584
- return (!MD || !MD.isConnected) && (MD = document.createElement("div"), MD.id = `${Q}-cursor`, MD.innerHTML = jD, document.body.appendChild(MD), ND = !1), MD;
27598
+ </svg>`, PD = null, FD = !1;
27599
+ function ID() {
27600
+ return (!PD || !PD.isConnected) && (PD = document.createElement("div"), PD.id = `${Q}-cursor`, PD.innerHTML = ND, document.body.appendChild(PD), FD = !1), PD;
27585
27601
  }
27586
- async function FD(e) {
27602
+ async function LD(e) {
27587
27603
  if (typeof document > "u" || !e) return;
27588
- _D();
27604
+ yD();
27589
27605
  let t;
27590
27606
  try {
27591
27607
  t = e.getBoundingClientRect();
27592
27608
  } catch {
27593
27609
  return;
27594
27610
  }
27595
- let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = PD();
27596
- ND ||= (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 zD(360);
27611
+ let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = ID();
27612
+ FD ||= (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 VD(360);
27597
27613
  }
27598
- function ID(e = !1) {
27599
- MD && (e ? (MD.classList.remove(`${Q}-cursor-visible`), ND = !1) : (MD.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
27600
- ND = !1;
27614
+ function RD(e = !1) {
27615
+ PD && (e ? (PD.classList.remove(`${Q}-cursor-visible`), FD = !1) : (PD.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
27616
+ FD = !1;
27601
27617
  }, 250)));
27602
27618
  }
27603
- async function LD(e) {
27604
- MD && (MD.classList.add(`${Q}-cursor-click`), await zD(280), MD.classList.remove(`${Q}-cursor-click`));
27619
+ async function zD(e) {
27620
+ PD && (PD.classList.add(`${Q}-cursor-click`), await VD(280), PD.classList.remove(`${Q}-cursor-click`));
27605
27621
  }
27606
- function RD(e) {
27622
+ function BD(e) {
27607
27623
  if (!e || typeof document > "u") return;
27608
- _D();
27624
+ yD();
27609
27625
  let t;
27610
27626
  try {
27611
27627
  t = e.getBoundingClientRect();
@@ -27631,7 +27647,7 @@ function RD(e) {
27631
27647
  a.remove(), e.style.position = n, e.style.overflow = r;
27632
27648
  }, 650);
27633
27649
  }
27634
- function zD(e) {
27650
+ function VD(e) {
27635
27651
  return new Promise((t) => setTimeout(t, e));
27636
27652
  }
27637
27653
  //#endregion
@@ -27639,42 +27655,42 @@ function zD(e) {
27639
27655
  function $(...e) {
27640
27656
  mn() && console.log("[FlowEngage:voice-tools]", ...e);
27641
27657
  }
27642
- function BD(e) {
27658
+ function HD(e) {
27643
27659
  return new Promise((t) => setTimeout(t, e));
27644
27660
  }
27645
- var VD = "#flowengage-root, .flowengage-shell, .flowengage-widget-root";
27646
- function HD(e) {
27661
+ var UD = "#flowengage-root, .flowengage-shell, .flowengage-widget-root";
27662
+ function WD(e) {
27647
27663
  if (!e || typeof e.closest != "function") return !1;
27648
27664
  try {
27649
- return !!e.closest(VD);
27665
+ return !!e.closest(UD);
27650
27666
  } catch {
27651
27667
  return !1;
27652
27668
  }
27653
27669
  }
27654
- function UD(e) {
27670
+ function GD(e) {
27655
27671
  try {
27656
27672
  let t = e.ownerDocument?.defaultView;
27657
27673
  if (t) return t.getComputedStyle(e);
27658
27674
  } catch {}
27659
27675
  return window.getComputedStyle(e);
27660
27676
  }
27661
- function WD(e) {
27677
+ function KD(e) {
27662
27678
  let t = /* @__PURE__ */ new Set();
27663
27679
  function n(r) {
27664
27680
  if (!r || t.has(r)) return;
27665
27681
  t.add(r), e(r);
27666
27682
  let i = r.querySelectorAll("iframe");
27667
- for (let e of i) if (!HD(e)) try {
27683
+ for (let e of i) if (!WD(e)) try {
27668
27684
  let t = e.contentDocument;
27669
27685
  t && n(t);
27670
27686
  } catch {}
27671
27687
  }
27672
27688
  typeof document < "u" && n(document);
27673
27689
  }
27674
- function GD(e) {
27690
+ function qD(e) {
27675
27691
  return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
27676
27692
  }
27677
- function KD(e) {
27693
+ function JD(e) {
27678
27694
  let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
27679
27695
  if (n) {
27680
27696
  let e = n.trim().split(/\s+/).filter(Boolean), r = [];
@@ -27682,42 +27698,42 @@ function KD(e) {
27682
27698
  let e = t.getElementById(n);
27683
27699
  e?.textContent && r.push(e.textContent.trim());
27684
27700
  } catch {}
27685
- if (r.length) return GD(r.join(" "));
27701
+ if (r.length) return qD(r.join(" "));
27686
27702
  }
27687
- if (e.labels && e.labels.length) return GD(e.labels[0].textContent);
27703
+ if (e.labels && e.labels.length) return qD(e.labels[0].textContent);
27688
27704
  let r = e.id;
27689
27705
  if (r) try {
27690
27706
  let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
27691
- if (e) return GD(e.textContent);
27707
+ if (e) return qD(e.textContent);
27692
27708
  } catch {
27693
27709
  let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
27694
- if (e) return GD(e.textContent);
27710
+ if (e) return qD(e.textContent);
27695
27711
  }
27696
27712
  let i = e.previousElementSibling;
27697
27713
  for (let e = 0; e < 6 && i; e += 1) {
27698
- if (i.tagName === "LABEL") return GD(i.textContent);
27714
+ if (i.tagName === "LABEL") return qD(i.textContent);
27699
27715
  let e = (i.className || "").toString().toLowerCase();
27700
27716
  if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
27701
- let e = GD(i.textContent);
27717
+ let e = qD(i.textContent);
27702
27718
  if (e) return e;
27703
27719
  }
27704
27720
  i = i.previousElementSibling;
27705
27721
  }
27706
27722
  let a = e.parentElement;
27707
27723
  for (let e = 0; e < 5 && a; e += 1) {
27708
- if (a.tagName === "LABEL") return GD(a.textContent);
27724
+ if (a.tagName === "LABEL") return qD(a.textContent);
27709
27725
  let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
27710
- if (e?.textContent) return GD(e.textContent);
27726
+ if (e?.textContent) return qD(e.textContent);
27711
27727
  a = a.parentElement;
27712
27728
  }
27713
27729
  let o = e.getAttribute("aria-label");
27714
- return o ? GD(o) : null;
27730
+ return o ? qD(o) : null;
27715
27731
  }
27716
- function qD() {
27732
+ function YD() {
27717
27733
  let e = [];
27718
- return WD((t) => {
27734
+ return KD((t) => {
27719
27735
  e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
27720
- if (HD(e)) return !1;
27736
+ if (WD(e)) return !1;
27721
27737
  let t = (e.type || "").toLowerCase();
27722
27738
  if ([
27723
27739
  "hidden",
@@ -27726,32 +27742,32 @@ function qD() {
27726
27742
  "image"
27727
27743
  ].includes(t) || e.disabled || e.readOnly) return !1;
27728
27744
  try {
27729
- let t = UD(e);
27745
+ let t = GD(e);
27730
27746
  if (t.display === "none" || t.visibility === "hidden") return !1;
27731
27747
  } catch {}
27732
27748
  return !0;
27733
27749
  }));
27734
27750
  }), e;
27735
27751
  }
27736
- function JD() {
27737
- return qD().map((e, t) => ({
27752
+ function XD() {
27753
+ return YD().map((e, t) => ({
27738
27754
  formIndex: 0,
27739
27755
  fieldIndex: t,
27740
27756
  tag: e.tagName,
27741
27757
  type: e.type || "text",
27742
27758
  name: e.name || null,
27743
27759
  id: e.id || null,
27744
- label: KD(e),
27760
+ label: JD(e),
27745
27761
  placeholder: e.placeholder || null
27746
27762
  }));
27747
27763
  }
27748
- function YD() {
27764
+ function ZD() {
27749
27765
  let e = [];
27750
- return WD((t) => {
27766
+ return KD((t) => {
27751
27767
  e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
27752
- if (HD(e) || e.disabled) return !1;
27768
+ if (WD(e) || e.disabled) return !1;
27753
27769
  try {
27754
- let t = UD(e);
27770
+ let t = GD(e);
27755
27771
  if (t.display === "none" || t.visibility === "hidden") return !1;
27756
27772
  } catch {}
27757
27773
  return !0;
@@ -27763,15 +27779,15 @@ function YD() {
27763
27779
  type: e.type || e.tagName
27764
27780
  }));
27765
27781
  }
27766
- function XD(e) {
27782
+ function QD(e) {
27767
27783
  return String(e || "").toLowerCase().replace(/\u00a0/g, " ").replace(/\*/g, "").replace(/\s+/g, " ").trim();
27768
27784
  }
27769
- function ZD(e) {
27770
- let t = XD(e);
27785
+ function $D(e) {
27786
+ let t = QD(e);
27771
27787
  return t = t.replace(/\s+field\s*$/i, "").trim(), t;
27772
27788
  }
27773
- function QD(e, t) {
27774
- let n = ZD(t);
27789
+ function eO(e, t) {
27790
+ let n = $D(t);
27775
27791
  if (!n) return 0;
27776
27792
  let r = (e.name || "").toLowerCase(), i = (e.id || "").toLowerCase();
27777
27793
  if (r === "url" && /url|website|domain|site|audit/.test(n) || (i === "url-input" || i.endsWith("-url-input")) && /url|website|domain|site|audit/.test(n)) return 100;
@@ -27779,12 +27795,12 @@ function QD(e, t) {
27779
27795
  e.name,
27780
27796
  e.id,
27781
27797
  e.placeholder,
27782
- KD(e),
27798
+ JD(e),
27783
27799
  e.getAttribute("aria-label"),
27784
27800
  e.getAttribute("title"),
27785
27801
  e.getAttribute("data-testid"),
27786
27802
  e.getAttribute("autocomplete")
27787
- ].filter(Boolean).map((e) => XD(e)), o = 0;
27803
+ ].filter(Boolean).map((e) => QD(e)), o = 0;
27788
27804
  for (let e of a) {
27789
27805
  if (!e) continue;
27790
27806
  if (e.includes(n) || n.includes(e)) {
@@ -27799,16 +27815,16 @@ function QD(e, t) {
27799
27815
  }
27800
27816
  return o;
27801
27817
  }
27802
- var $D = 28;
27803
- function eO(e, t) {
27818
+ var tO = 28;
27819
+ function nO(e, t) {
27804
27820
  let n = null, r = 0;
27805
27821
  for (let i of e) {
27806
- let e = QD(i, t);
27822
+ let e = eO(i, t);
27807
27823
  e > r && (r = e, n = i);
27808
27824
  }
27809
- return !n || r < $D ? null : n;
27825
+ return !n || r < tO ? null : n;
27810
27826
  }
27811
- function tO(e, t, n) {
27827
+ function rO(e, t, n) {
27812
27828
  let r = String(t || "").toLowerCase().trim(), i = String(n || "").trim();
27813
27829
  if (!(/^https?:\/\//i.test(i) || /\.\w{2,}(\/|\s|$)/.test(i) || r.includes("url") || r.includes("website") || r.includes("domain") || r.includes("site"))) return null;
27814
27830
  let a = null, o = 0;
@@ -27828,7 +27844,7 @@ function tO(e, t, n) {
27828
27844
  t.name,
27829
27845
  t.id,
27830
27846
  t.placeholder,
27831
- KD(t),
27847
+ JD(t),
27832
27848
  t.getAttribute("aria-label"),
27833
27849
  t.getAttribute("autocomplete")
27834
27850
  ].filter(Boolean).join(" ").toLowerCase();
@@ -27836,15 +27852,15 @@ function tO(e, t, n) {
27836
27852
  }
27837
27853
  return !a || o < 42 ? null : a;
27838
27854
  }
27839
- function nO(e) {
27855
+ function iO(e) {
27840
27856
  let t = String(e ?? "").trim();
27841
27857
  return t ? /^https?:\/\//i.test(t) ? !0 : /\.\w{2,}(\/|\s|$)/.test(t) : !1;
27842
27858
  }
27843
- function rO(e) {
27859
+ function aO(e) {
27844
27860
  let t = String(e ?? "").toLowerCase().trim();
27845
27861
  return t ? !!(t === "url" || t === "website" || t === "website url" || t === "website_url" || t === "enter website url" || t.includes("website") || t.includes("domain") || /(enter\s+website|site\s*url|page\s*url)/.test(t)) : !1;
27846
27862
  }
27847
- function iO(e) {
27863
+ function oO(e) {
27848
27864
  if (!e || e.tagName !== "INPUT" && e.tagName !== "TEXTAREA") return !1;
27849
27865
  let t = (e.type || "").toLowerCase();
27850
27866
  return ![
@@ -27856,22 +27872,22 @@ function iO(e) {
27856
27872
  "file"
27857
27873
  ].includes(t);
27858
27874
  }
27859
- function aO(e) {
27860
- if (!iO(e)) return !1;
27875
+ function sO(e) {
27876
+ if (!oO(e)) return !1;
27861
27877
  let t = (e.name || "").toLowerCase(), n = (e.id || "").toLowerCase(), r = [
27862
27878
  e.name,
27863
27879
  e.id,
27864
27880
  e.placeholder,
27865
- KD(e),
27881
+ JD(e),
27866
27882
  e.getAttribute("aria-label")
27867
27883
  ].filter(Boolean).join(" ").toLowerCase();
27868
27884
  return t === "url" || n === "url-input" || n.endsWith("-url-input") || /(website\s*url|enter\s+website|site\s*url)/.test(r) || /(website|domain)/.test(r) && /(url|site)/.test(r);
27869
27885
  }
27870
- function oO(e, t, n) {
27871
- let r = String(t ?? ""), i = String(n ?? ""), a = lO(e, r) || eO(e, r) || tO(e, r, i);
27886
+ function cO(e, t, n) {
27887
+ let r = String(t ?? ""), i = String(n ?? ""), a = dO(e, r) || nO(e, r) || rO(e, r, i);
27872
27888
  if (!a) return [];
27873
27889
  let o = new Set([a]);
27874
- if (nO(i) && rO(r)) for (let t of e) t !== a && aO(t) && o.add(t);
27890
+ if (iO(i) && aO(r)) for (let t of e) t !== a && sO(t) && o.add(t);
27875
27891
  let s = Array.from(o);
27876
27892
  return s.sort((e, t) => {
27877
27893
  if (e === t) return 0;
@@ -27879,7 +27895,7 @@ function oO(e, t, n) {
27879
27895
  return n & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
27880
27896
  }), s;
27881
27897
  }
27882
- function sO(e, t) {
27898
+ function lO(e, t) {
27883
27899
  try {
27884
27900
  if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
27885
27901
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
@@ -27894,17 +27910,17 @@ function sO(e, t) {
27894
27910
  return Infinity;
27895
27911
  }
27896
27912
  }
27897
- function cO(e) {
27913
+ function uO(e) {
27898
27914
  if (!e || typeof e != "string") return null;
27899
27915
  let t = null;
27900
- return WD((n) => {
27916
+ return KD((n) => {
27901
27917
  try {
27902
27918
  let r = n.getElementById(e);
27903
- r && !HD(r) && r.matches?.("input, select, textarea") && (t = r);
27919
+ r && !WD(r) && r.matches?.("input, select, textarea") && (t = r);
27904
27920
  } catch {}
27905
27921
  }), t;
27906
27922
  }
27907
- function lO(e, t) {
27923
+ function dO(e, t) {
27908
27924
  let n = String(t ?? "").trim();
27909
27925
  if (!n) return null;
27910
27926
  let r = n.match(/^name:\s*([\w.-]+)$/i);
@@ -27914,12 +27930,12 @@ function lO(e, t) {
27914
27930
  }
27915
27931
  let i = n.match(/^id:\s*([\w.-]+)$/i);
27916
27932
  if (i) {
27917
- let e = cO(i[1]);
27933
+ let e = uO(i[1]);
27918
27934
  if (e) return e;
27919
27935
  }
27920
27936
  let a = n.startsWith("#") ? n.slice(1) : n;
27921
27937
  if (/^[\w-]+$/.test(a)) {
27922
- let e = cO(a);
27938
+ let e = uO(a);
27923
27939
  if (e) return e;
27924
27940
  }
27925
27941
  let o = n.toLowerCase().replace(/\s+/g, " ");
@@ -27929,7 +27945,7 @@ function lO(e, t) {
27929
27945
  }
27930
27946
  return null;
27931
27947
  }
27932
- function uO(e, t) {
27948
+ function fO(e, t) {
27933
27949
  let n = String(t || "").toLowerCase().trim();
27934
27950
  if (!n) return 0;
27935
27951
  let r = [
@@ -27945,13 +27961,13 @@ function uO(e, t) {
27945
27961
  for (let e of i) r.includes(e) && (a += 1);
27946
27962
  return a / i.length * 92;
27947
27963
  }
27948
- function dO(e, t) {
27964
+ function pO(e, t) {
27949
27965
  let n = [];
27950
- WD((e) => {
27966
+ KD((e) => {
27951
27967
  n.push(...Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
27952
- if (HD(e) || e.disabled) return !1;
27968
+ if (WD(e) || e.disabled) return !1;
27953
27969
  try {
27954
- let t = UD(e);
27970
+ let t = GD(e);
27955
27971
  if (t.display === "none" || t.visibility === "hidden") return !1;
27956
27972
  } catch {}
27957
27973
  return !0;
@@ -27959,7 +27975,7 @@ function dO(e, t) {
27959
27975
  });
27960
27976
  let r = 0, i = n.map((t) => ({
27961
27977
  el: t,
27962
- s: uO(t, e)
27978
+ s: fO(t, e)
27963
27979
  }));
27964
27980
  for (let { s: e } of i) e > r && (r = e);
27965
27981
  if (r < 36) return null;
@@ -27969,14 +27985,14 @@ function dO(e, t) {
27969
27985
  if (o.length) {
27970
27986
  let e = a[0], t = Infinity;
27971
27987
  for (let n of a) for (let r of o) {
27972
- let i = sO(n, r);
27988
+ let i = lO(n, r);
27973
27989
  i < t && (t = i, e = n);
27974
27990
  }
27975
27991
  return e;
27976
27992
  }
27977
27993
  return a[0];
27978
27994
  }
27979
- function fO(e) {
27995
+ function mO(e) {
27980
27996
  if (e == null) return {};
27981
27997
  if (typeof e == "string") {
27982
27998
  let t = e.trim();
@@ -27989,8 +28005,8 @@ function fO(e) {
27989
28005
  }
27990
28006
  return e;
27991
28007
  }
27992
- function pO(e) {
27993
- let t = fO(e);
28008
+ function hO(e) {
28009
+ let t = mO(e);
27994
28010
  if (Array.isArray(t) && t.length > 0) {
27995
28011
  let e = t[0];
27996
28012
  if (e?.field_key != null || e?.fieldKey != null) return t.map((e) => ({
@@ -28018,7 +28034,7 @@ function pO(e) {
28018
28034
  value: e?.value ?? e?.Value
28019
28035
  })) : [];
28020
28036
  }
28021
- function mO(e) {
28037
+ function gO(e) {
28022
28038
  if (!e || typeof e != "string") return [];
28023
28039
  let t = e.trim();
28024
28040
  if (!t || /\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\b/i.test(t)) return [];
@@ -28037,7 +28053,7 @@ function mO(e) {
28037
28053
  }
28038
28054
  return [];
28039
28055
  }
28040
- function hO(e) {
28056
+ function _O(e) {
28041
28057
  if (!e || typeof e != "string") return [];
28042
28058
  let t = e.trim();
28043
28059
  if (!t) return [];
@@ -28073,17 +28089,17 @@ function hO(e) {
28073
28089
  }
28074
28090
  return n;
28075
28091
  }
28076
- function gO(e) {
28092
+ function vO(e) {
28077
28093
  if (!e || typeof e != "object") return null;
28078
28094
  let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
28079
28095
  return t == null ? null : String(t).trim() || null;
28080
28096
  }
28081
- function _O(e) {
28097
+ function yO(e) {
28082
28098
  if (!e || typeof e != "object") return null;
28083
28099
  let t = e.query ?? e.q ?? e.search ?? e.text ?? e.keywords;
28084
28100
  return t == null ? null : String(t).trim() || null;
28085
28101
  }
28086
- function vO(e, t, n) {
28102
+ function bO(e, t, n) {
28087
28103
  if (!n?.skipScroll) try {
28088
28104
  e.scrollIntoView({
28089
28105
  block: "center",
@@ -28138,7 +28154,7 @@ function vO(e, t, n) {
28138
28154
  } catch {}
28139
28155
  return !0;
28140
28156
  }
28141
- function yO() {
28157
+ function xO() {
28142
28158
  let e = {};
28143
28159
  document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
28144
28160
  if (t.id) return;
@@ -28153,11 +28169,11 @@ function yO() {
28153
28169
  e[r] = !0, t.id = r;
28154
28170
  });
28155
28171
  }
28156
- function bO(e) {
28172
+ function SO(e) {
28157
28173
  let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
28158
28174
  flowengage_navigate: async (n) => {
28159
28175
  $("flowengage_navigate ▶ raw parameters:", n);
28160
- let r = fO(n), i = gO(r), a = r.section_text ?? r.sectionText ?? r.section;
28176
+ let r = mO(n), i = vO(r), a = r.section_text ?? r.sectionText ?? r.section;
28161
28177
  if ($("flowengage_navigate · coerced:", {
28162
28178
  url: i,
28163
28179
  sectionText: a
@@ -28173,38 +28189,38 @@ function bO(e) {
28173
28189
  return $("flowengage_navigate ✖ blocked", e), e;
28174
28190
  }
28175
28191
  try {
28176
- if (xD(`Navigating to ${i}...`, { spinner: !0 }), ED(), OE(), PE(), $("flowengage_navigate → shadowNavigate", i), await On(i), await BD(400), yO(), a && typeof a == "string") {
28192
+ if (CD(`Navigating to ${i}...`, { spinner: !0 }), OD(), AE(), IE(), $("flowengage_navigate → shadowNavigate", i), await On(i), await HD(400), xO(), a && typeof a == "string") {
28177
28193
  let e = xn(null, a);
28178
- e && yE(() => NE(e)), $("flowengage_navigate · highlight", {
28194
+ e && SE(() => FE(e)), $("flowengage_navigate · highlight", {
28179
28195
  sectionText: a,
28180
28196
  found: !!e
28181
28197
  });
28182
28198
  }
28183
28199
  let e = `OK_NAVIGATION ${i}`;
28184
- return $("flowengage_navigate ✓", e), xD("Navigation complete", {
28200
+ return $("flowengage_navigate ✓", e), CD("Navigation complete", {
28185
28201
  spinner: !1,
28186
28202
  icon: "✅",
28187
28203
  duration: 1200
28188
28204
  }), e;
28189
28205
  } catch (e) {
28190
28206
  let t = `Navigation error: ${e?.message || String(e)}`;
28191
- return $("flowengage_navigate ✖", t), xD("Navigation failed", {
28207
+ return $("flowengage_navigate ✖", t), CD("Navigation failed", {
28192
28208
  spinner: !1,
28193
28209
  icon: "⚠️",
28194
28210
  duration: 1800
28195
28211
  }), t;
28196
28212
  } finally {
28197
- DD(), SD(900);
28213
+ kD(), wD(900);
28198
28214
  }
28199
28215
  },
28200
28216
  flowengage_highlight: async (e) => {
28201
28217
  $("flowengage_highlight ▶", e);
28202
- let t = fO(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i = xn(n || null, r || null);
28203
- return i ? (yE(() => NE(i)), $("flowengage_highlight ✓ (enqueued)"), "Highlighted the section.") : ($("flowengage_highlight ✖ no element"), "Could not find that section on the page.");
28218
+ let t = mO(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i = xn(n || null, r || null);
28219
+ return i ? (SE(() => FE(i)), $("flowengage_highlight ✓ (enqueued)"), "Highlighted the section.") : ($("flowengage_highlight ✖ no element"), "Could not find that section on the page.");
28204
28220
  },
28205
28221
  flowengage_read_content: async (e) => {
28206
28222
  $("flowengage_read_content ▶", e);
28207
- let t = fO(e), n = t?.section_text || t?.sectionText || "";
28223
+ let t = mO(e), n = t?.section_text || t?.sectionText || "";
28208
28224
  try {
28209
28225
  let e = "";
28210
28226
  if (n) {
@@ -28227,7 +28243,7 @@ function bO(e) {
28227
28243
  },
28228
28244
  flowengage_search: async (e) => {
28229
28245
  $("flowengage_search ▶", e);
28230
- let r = _O(fO(e));
28246
+ let r = yO(mO(e));
28231
28247
  if ($("flowengage_search · query:", r, "siteId:", t, "apiBase:", n || "(empty)"), !r) return $("flowengage_search ✖ missing query"), "Missing query parameter.";
28232
28248
  if (!t) return $("flowengage_search ✖ no siteId"), "Site is not configured for search.";
28233
28249
  if (!n) return $("flowengage_search ✖ no api base"), "API base URL is missing; cannot search.";
@@ -28256,7 +28272,7 @@ function bO(e) {
28256
28272
  },
28257
28273
  flowengage_page_content: async (e) => {
28258
28274
  $("flowengage_page_content ▶", e);
28259
- let r = fO(e), i = r?.url || r?.page_url || "";
28275
+ let r = mO(e), i = r?.url || r?.page_url || "";
28260
28276
  if ($("flowengage_page_content · url:", i, "siteId:", t, "apiBase:", n || "(empty)"), !i) return $("flowengage_page_content ✖ missing url"), "Missing url parameter.";
28261
28277
  if (!t) return $("flowengage_page_content ✖ no siteId"), "Site is not configured.";
28262
28278
  if (!n) return $("flowengage_page_content ✖ no api base"), "API base URL is missing; cannot fetch page content.";
@@ -28288,7 +28304,7 @@ function bO(e) {
28288
28304
  },
28289
28305
  flowengage_end_session: async () => ($("flowengage_end_session ▶"), typeof e.requestEndSession == "function" && e.requestEndSession(), "Voice session is ending."),
28290
28306
  flowengage_list_forms: async () => {
28291
- let e = JD(), t = YD();
28307
+ let e = XD(), t = ZD();
28292
28308
  return $("flowengage_list_forms ✓", `${e.length} field(s)`, `${t.length} button(s)`), JSON.stringify({
28293
28309
  fields: e,
28294
28310
  buttons: t,
@@ -28297,52 +28313,52 @@ function bO(e) {
28297
28313
  },
28298
28314
  flowengage_fill_form: async (e) => {
28299
28315
  try {
28300
- $("flowengage_fill_form ▶ raw:", e), OD();
28301
- let t = pO(e);
28316
+ $("flowengage_fill_form ▶ raw:", e), AD();
28317
+ let t = hO(e);
28302
28318
  if (!t.length && r) {
28303
- let e = r(), n = mO(e);
28304
- n.length ? $("flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):", n) : (n = hO(e), n.length && $("flowengage_fill_form · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
28319
+ let e = r(), n = gO(e);
28320
+ n.length ? $("flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):", n) : (n = _O(e), n.length && $("flowengage_fill_form · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
28305
28321
  }
28306
28322
  if ($("flowengage_fill_form · normalized fields:", t), !t.length) return "No fields provided. Call flowengage_list_forms for field_key strings, then flowengage_fill_form with { \"fields\": [ { \"field_key\": \"<label or placeholder from list>\", \"value\": \"<user value>\" } ] }. Never use empty {}. Pass the value the user just said (email, message, name, URL) in fields.";
28307
28323
  let n = [];
28308
28324
  for (let e of t) {
28309
28325
  let t = e?.field_key ?? e?.fieldKey, r = e?.value;
28310
28326
  if (t == null || r == null) continue;
28311
- xD(`Filling ${String(t)}...`, { spinner: !0 });
28312
- let a = qD(), o = oO(a, String(t), r);
28327
+ CD(`Filling ${String(t)}...`, { spinner: !0 });
28328
+ let a = YD(), o = cO(a, String(t), r);
28313
28329
  if (o.length) {
28314
- for (let [e, t] of o.entries()) kD(t), await FD(t), vO(t, r, { skipScroll: e > 0 }), AD(t), await BD(120);
28330
+ for (let [e, t] of o.entries()) jD(t), await LD(t), bO(t, r, { skipScroll: e > 0 }), MD(t), await HD(120);
28315
28331
  i = o, n.push(String(t));
28316
28332
  continue;
28317
28333
  }
28318
- let s = lO(a, String(t));
28319
- s ||= eO(a, String(t)), s ||= tO(a, String(t), r), s && (kD(s), await FD(s), vO(s, r), AD(s), await BD(120), i = [s], n.push(String(t)));
28334
+ let s = dO(a, String(t));
28335
+ s ||= nO(a, String(t)), s ||= rO(a, String(t), r), s && (jD(s), await LD(s), bO(s, r), MD(s), await HD(120), i = [s], n.push(String(t)));
28320
28336
  }
28321
28337
  if (!n.length) return $("flowengage_fill_form ✖ no matches"), "Could not match any fields. Call flowengage_list_forms and use field_key values that match placeholder, label, name, or id (e.g. Enter Website URL). Ensure the form is on the page, not the chat panel.";
28322
28338
  let a = `OK_FILLED: ${n.join(", ")}`;
28323
- return $("flowengage_fill_form ✓", a), xD("Form filled", {
28339
+ return $("flowengage_fill_form ✓", a), CD("Form filled", {
28324
28340
  spinner: !1,
28325
28341
  icon: "✅",
28326
28342
  duration: 1100
28327
28343
  }), a;
28328
28344
  } catch (e) {
28329
28345
  let t = `flowengage_fill_form error: ${e?.message || String(e)}`;
28330
- return $("flowengage_fill_form ✖", t), xD("Failed to fill form", {
28346
+ return $("flowengage_fill_form ✖", t), CD("Failed to fill form", {
28331
28347
  spinner: !1,
28332
28348
  icon: "⚠️",
28333
28349
  duration: 1800
28334
28350
  }), t;
28335
28351
  } finally {
28336
- ID(), OD(), SD(700);
28352
+ RD(), AD(), wD(700);
28337
28353
  }
28338
28354
  },
28339
28355
  flowengage_click_button: async (e) => {
28340
- let t = fO(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
28356
+ let t = mO(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
28341
28357
  if ($("flowengage_click_button ▶", n), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
28342
- let r = dO(n, i);
28358
+ let r = pO(n, i);
28343
28359
  if (!r) return $("flowengage_click_button ✖ no match"), `Could not find a button matching "${n}". Call flowengage_list_forms to see button texts.`;
28344
28360
  try {
28345
- xD(`Clicking ${n}...`, { spinner: !0 });
28361
+ CD(`Clicking ${n}...`, { spinner: !0 });
28346
28362
  try {
28347
28363
  r.scrollIntoView({
28348
28364
  block: "center",
@@ -28351,22 +28367,22 @@ function bO(e) {
28351
28367
  } catch {
28352
28368
  r.scrollIntoView(!0);
28353
28369
  }
28354
- await FD(r), r.focus?.(), await LD(r), RD(r), r.click();
28370
+ await LD(r), r.focus?.(), await zD(r), BD(r), r.click();
28355
28371
  let e = (r.textContent || r.value || r.getAttribute("aria-label") || "").trim().slice(0, 80) || "button", t = `OK_CLICK ${e}`;
28356
- return $("flowengage_click_button ✓", t), xD(`Clicked ${e}`, {
28372
+ return $("flowengage_click_button ✓", t), CD(`Clicked ${e}`, {
28357
28373
  spinner: !1,
28358
28374
  icon: "✅",
28359
28375
  duration: 1200
28360
28376
  }), t;
28361
28377
  } catch (e) {
28362
28378
  let t = `Click failed: ${e?.message || String(e)}`;
28363
- return $("flowengage_click_button ✖", t), xD("Click failed", {
28379
+ return $("flowengage_click_button ✖", t), CD("Click failed", {
28364
28380
  spinner: !1,
28365
28381
  icon: "⚠️",
28366
28382
  duration: 1800
28367
28383
  }), t;
28368
28384
  } finally {
28369
- ID(), SD(700);
28385
+ RD(), wD(700);
28370
28386
  }
28371
28387
  }
28372
28388
  };
@@ -28384,7 +28400,7 @@ function bO(e) {
28384
28400
  }
28385
28401
  //#endregion
28386
28402
  //#region src/utils/wrapVoiceToolsForLogging.js
28387
- function xO(e) {
28403
+ function CO(e) {
28388
28404
  return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
28389
28405
  let r = mn();
28390
28406
  r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
@@ -28401,7 +28417,7 @@ function xO(e) {
28401
28417
  }
28402
28418
  //#endregion
28403
28419
  //#region src/components/FlowEngageWidget.jsx
28404
- var SO = {
28420
+ var wO = {
28405
28421
  blue: "#135bd8",
28406
28422
  red: "#ef334b",
28407
28423
  yellow: "#ffbd2e",
@@ -28409,7 +28425,7 @@ var SO = {
28409
28425
  highlight: "rgba(255,255,255,0.9)",
28410
28426
  green: "#10b981"
28411
28427
  };
28412
- function CO(e) {
28428
+ function TO(e) {
28413
28429
  if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
28414
28430
  let [t, n, r] = e;
28415
28431
  return e.length >= 3 && r ? [
@@ -28423,12 +28439,12 @@ function CO(e) {
28423
28439
  "#f7f8fa"
28424
28440
  ].join(", ");
28425
28441
  }
28426
- function wO(e) {
28442
+ function EO(e) {
28427
28443
  if (!e || typeof e != "string") return "#1a1a1a";
28428
28444
  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;
28429
28445
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
28430
28446
  }
28431
- function TO({ logo: t, style: n }) {
28447
+ function DO({ logo: t, style: n }) {
28432
28448
  if (!t) return null;
28433
28449
  if (typeof t == "string") return /* @__PURE__ */ g("img", {
28434
28450
  src: t,
@@ -28453,7 +28469,7 @@ function TO({ logo: t, style: n }) {
28453
28469
  children: r
28454
28470
  }) : null;
28455
28471
  }
28456
- function EO({ title: e }) {
28472
+ function OO({ title: e }) {
28457
28473
  return /* @__PURE__ */ g("div", {
28458
28474
  style: {
28459
28475
  width: "100%",
@@ -28471,18 +28487,18 @@ function EO({ title: e }) {
28471
28487
  children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
28472
28488
  });
28473
28489
  }
28474
- function DO(e, t) {
28490
+ function kO(e, t) {
28475
28491
  let n = (t || "").trim();
28476
28492
  return n ? !!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\b(hang\s+up|disconnect)\b/i.test(n) || /\b(that'?s all|we'?re done)\b/i.test(n) || e === "bot" && (/\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n) || /\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n) || /\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n) || /\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n) || /\b(wrapping\s+up|signing\s+off)\b/i.test(n)) || /^(goodbye|bye|that'?s all|we'?re done|hang up|disconnect)\b/i.test(n)) : !1;
28477
28493
  }
28478
- function OO({ orbColors: e, ...t }) {
28479
- return /* @__PURE__ */ g(gD, {
28494
+ function AO({ orbColors: e, ...t }) {
28495
+ return /* @__PURE__ */ g(vD, {
28480
28496
  colors: e,
28481
28497
  ...t
28482
28498
  });
28483
28499
  }
28484
- function kO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a }) {
28485
- let o = n || SO.green, s = wO(o), c = a ? 72 : 94, l = /* @__PURE__ */ _("div", {
28500
+ function jO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a }) {
28501
+ let o = n || wO.green, s = EO(o), c = a ? 72 : 94, l = /* @__PURE__ */ _("div", {
28486
28502
  style: {
28487
28503
  display: "flex",
28488
28504
  alignItems: "center",
@@ -28599,7 +28615,7 @@ function kO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
28599
28615
  delay: 0
28600
28616
  },
28601
28617
  style: { flexShrink: 0 },
28602
- children: /* @__PURE__ */ g(OO, {
28618
+ children: /* @__PURE__ */ g(AO, {
28603
28619
  size: c,
28604
28620
  orbColors: t
28605
28621
  })
@@ -28627,8 +28643,8 @@ function kO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
28627
28643
  children: l
28628
28644
  }) : l] });
28629
28645
  }
28630
- function AO({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a }) {
28631
- let o = n || SO.green, s = wO(o);
28646
+ function MO({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a }) {
28647
+ let o = n || wO.green, s = EO(o);
28632
28648
  return /* @__PURE__ */ _(Tp.div, {
28633
28649
  initial: {
28634
28650
  scale: 50 / 300,
@@ -28692,7 +28708,7 @@ function AO({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
28692
28708
  children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
28693
28709
  })
28694
28710
  }),
28695
- /* @__PURE__ */ g(OO, {
28711
+ /* @__PURE__ */ g(AO, {
28696
28712
  size: 82,
28697
28713
  orbColors: t
28698
28714
  }),
@@ -28761,7 +28777,7 @@ function AO({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
28761
28777
  ]
28762
28778
  });
28763
28779
  }
28764
- function jO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, historyRef: s, onMessageSync: l }) {
28780
+ function NO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, historyRef: s, onMessageSync: l }) {
28765
28781
  let [u, d] = m("idle"), [f, v] = m(!1), [y, b] = m(!1), x = p(null), S = p(""), C = p(async () => {}), w = p(!1), T = p(!1), ee = p(!1), te = p(!1), ne = p("minimized"), re = p(null), E = o((e = "minimized") => {
28766
28782
  ne.current = e, te.current = !0, queueMicrotask(() => {
28767
28783
  w.current || (w.current = !0, C.current?.());
@@ -28784,8 +28800,8 @@ function jO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
28784
28800
  }
28785
28801
  try {
28786
28802
  if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
28787
- s.current = [], S.current = "", w.current = !1, ee.current = !1, te.current = !1, ne.current = "minimized", TE(!0), OE();
28788
- let t = xO(bO({
28803
+ s.current = [], S.current = "", w.current = !1, ee.current = !1, te.current = !1, ne.current = "minimized", OE(!0), AE();
28804
+ let t = CO(SO({
28789
28805
  siteId: i || null,
28790
28806
  apiBaseUrl: a || null,
28791
28807
  getLastUserVoiceText: () => S.current,
@@ -28797,16 +28813,16 @@ function jO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
28797
28813
  clientTools: t,
28798
28814
  onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
28799
28815
  onModeChange: ({ mode: t }) => {
28800
- e || (d(t === "speaking" ? "speaking" : "listening"), t === "speaking" ? xE() : SE());
28816
+ e || (d(t === "speaking" ? "speaking" : "listening"), t === "speaking" ? wE() : TE());
28801
28817
  },
28802
28818
  onMessage: (t) => {
28803
28819
  if (e) return;
28804
28820
  let n = t.role === "user" ? "user" : "bot", r = t.message || t.text || t.content || "";
28805
- r && (n === "user" && (S.current = r, OE(), PE()), n === "bot" && (IE(r, !0), wE(r.trim().split(/\s+/).length)), s.current = [...s.current, {
28821
+ r && (n === "user" && (S.current = r, AE(), IE()), n === "bot" && (RE(r, !0), EE(r.trim().split(/\s+/).length)), s.current = [...s.current, {
28806
28822
  sender: n,
28807
28823
  message: r,
28808
28824
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
28809
- }], DO(n, r) && E("minimized"));
28825
+ }], kO(n, r) && E("minimized"));
28810
28826
  },
28811
28827
  onError: (t) => {
28812
28828
  if (!e && !te.current && !ee.current) {
@@ -28831,7 +28847,7 @@ function jO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
28831
28847
  try {
28832
28848
  x.current?.setMicMuted?.(!0);
28833
28849
  } catch {}
28834
- v(!0), OE(), PE(), TE(!1), E("chat");
28850
+ v(!0), AE(), IE(), OE(!1), E("chat");
28835
28851
  }
28836
28852
  }
28837
28853
  });
@@ -28893,7 +28909,7 @@ function jO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
28893
28909
  whiteSpace: "nowrap"
28894
28910
  },
28895
28911
  children: "Listening..."
28896
- }), /* @__PURE__ */ g(OO, {
28912
+ }), /* @__PURE__ */ g(AO, {
28897
28913
  size: 94,
28898
28914
  voiceState: u,
28899
28915
  isMuted: f,
@@ -29135,7 +29151,7 @@ function jO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
29135
29151
  ]
29136
29152
  }) });
29137
29153
  }
29138
- function MO({ orbColors: e }) {
29154
+ function PO({ orbColors: e }) {
29139
29155
  return /* @__PURE__ */ g("div", {
29140
29156
  style: {
29141
29157
  flexShrink: 0,
@@ -29145,13 +29161,13 @@ function MO({ orbColors: e }) {
29145
29161
  alignItems: "center",
29146
29162
  justifyContent: "center"
29147
29163
  },
29148
- children: /* @__PURE__ */ g(OO, {
29164
+ children: /* @__PURE__ */ g(AO, {
29149
29165
  size: 36,
29150
29166
  orbColors: e
29151
29167
  })
29152
29168
  });
29153
29169
  }
29154
- var NO = () => /* @__PURE__ */ g("div", {
29170
+ var FO = () => /* @__PURE__ */ g("div", {
29155
29171
  style: {
29156
29172
  display: "flex",
29157
29173
  marginBottom: "12px",
@@ -29181,7 +29197,7 @@ var NO = () => /* @__PURE__ */ g("div", {
29181
29197
  } }, e))
29182
29198
  })
29183
29199
  });
29184
- function PO({ 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: h, agentHeadshot: v, fallbackAgentName: y, input: b, setInput: x, onSubmit: S, isConversationEnded: C, isLoading: w, isRateLimited: T, rateLimitMessage: ee, selectedFile: te, onFileSelect: ne, onRemoveSelectedFile: re, attachmentError: E, isUploadingAttachment: ie, requiresEmail: ae, emailInput: oe, setEmailInput: se, emailError: ce, replyContext: le, setReplyContext: ue, webRTCError: de, micError: fe, setMicError: pe, dismissCallError: me, incomingCall: he, rejectCall: ge, acceptCall: _e, activeCallId: ve, callConnectionState: ye, isCallMuted: be, toggleCallMute: xe, endWebRTCCall: Se, formatCallDuration: Ce, callDurationSeconds: we, onCollapse: Te, onStartVoice: Ee, showPoweredBy: De }) {
29200
+ function IO({ 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: h, agentHeadshot: v, fallbackAgentName: y, input: b, setInput: x, onSubmit: S, isConversationEnded: C, isLoading: w, isRateLimited: T, rateLimitMessage: ee, selectedFile: te, onFileSelect: ne, onRemoveSelectedFile: re, attachmentError: E, isUploadingAttachment: ie, requiresEmail: ae, emailInput: oe, setEmailInput: se, emailError: ce, replyContext: le, setReplyContext: ue, webRTCError: de, micError: fe, setMicError: pe, dismissCallError: me, incomingCall: he, rejectCall: ge, acceptCall: _e, activeCallId: ve, callConnectionState: ye, isCallMuted: be, toggleCallMute: xe, endWebRTCCall: Se, formatCallDuration: Ce, callDurationSeconds: we, onCollapse: Te, onStartVoice: Ee, showPoweredBy: De }) {
29185
29201
  let Oe = l.length > 0, ke = w || T || C, Ae = !!(he || ve), [je, Me] = m(!1), Ne = p(null);
29186
29202
  return c(() => {
29187
29203
  if (!je) return;
@@ -29283,7 +29299,7 @@ function PO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29283
29299
  justifyContent: "center",
29284
29300
  height: "40px"
29285
29301
  },
29286
- children: i ? /* @__PURE__ */ g(TO, {
29302
+ children: i ? /* @__PURE__ */ g(DO, {
29287
29303
  logo: i,
29288
29304
  style: {
29289
29305
  height: "34px",
@@ -29296,7 +29312,7 @@ function PO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29296
29312
  height: "40px",
29297
29313
  flexShrink: 0
29298
29314
  },
29299
- children: /* @__PURE__ */ g(EO, { title: e.chatTitle })
29315
+ children: /* @__PURE__ */ g(OO, { title: e.chatTitle })
29300
29316
  })
29301
29317
  }), /* @__PURE__ */ g("div", {
29302
29318
  style: {
@@ -29482,7 +29498,7 @@ function PO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29482
29498
  })
29483
29499
  ]
29484
29500
  }),
29485
- /* @__PURE__ */ g(sD, {
29501
+ /* @__PURE__ */ g(lD, {
29486
29502
  webRTCError: de,
29487
29503
  micError: fe,
29488
29504
  setMicError: pe,
@@ -29510,16 +29526,16 @@ function PO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29510
29526
  minHeight: 0,
29511
29527
  background: "transparent"
29512
29528
  },
29513
- children: Oe ? /* @__PURE__ */ g(rD, {
29529
+ children: Oe ? /* @__PURE__ */ g(aD, {
29514
29530
  chatHistory: l,
29515
29531
  isAiTyping: u,
29516
29532
  isAgentTyping: d,
29517
29533
  setReplyContext: ue,
29518
- TypingDots: NO,
29534
+ TypingDots: FO,
29519
29535
  primaryColor: n,
29520
29536
  agentHeadshot: v,
29521
29537
  agentDisplayName: h || y,
29522
- botAvatarNode: /* @__PURE__ */ g(MO, { orbColors: t })
29538
+ botAvatarNode: /* @__PURE__ */ g(PO, { orbColors: t })
29523
29539
  }) : /* @__PURE__ */ _("div", {
29524
29540
  style: {
29525
29541
  flex: 1,
@@ -29532,7 +29548,7 @@ function PO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29532
29548
  padding: "28px 24px"
29533
29549
  },
29534
29550
  children: [
29535
- /* @__PURE__ */ g(OO, {
29551
+ /* @__PURE__ */ g(AO, {
29536
29552
  size: 94,
29537
29553
  orbColors: t
29538
29554
  }),
@@ -29590,7 +29606,7 @@ function PO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29590
29606
  zIndex: 1,
29591
29607
  padding: ae ? "6px 0 0" : "12px 0 0"
29592
29608
  },
29593
- children: /* @__PURE__ */ g(iD, {
29609
+ children: /* @__PURE__ */ g(oD, {
29594
29610
  input: b,
29595
29611
  setInput: x,
29596
29612
  onSubmit: S,
@@ -29640,7 +29656,7 @@ function PO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29640
29656
  ]
29641
29657
  });
29642
29658
  }
29643
- function FO() {
29659
+ function LO() {
29644
29660
  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: ee, callConnectedAt: te, isCallMuted: ne, webRTCError: re, language: E, historyRef: ie, onMessageSync: ae, sendMessage: oe, uploadChatFile: se, openWidget: ce, captureVisitorEmail: le, setVoiceMode: ue, endConversation: de, acceptCall: fe, rejectCall: pe, endWebRTCCall: me, toggleCallMute: he, dismissCallError: ge, startTyping: _e, stopTyping: ve, updateTypingDraft: ye } = pn();
29645
29661
  c(() => {
29646
29662
  try {
@@ -29653,7 +29669,7 @@ function FO() {
29653
29669
  }, Ce = {
29654
29670
  ...be.theme || {},
29655
29671
  ...xe.theme || {}
29656
- }, we = Array.isArray(Ce.orbColors) && Ce.orbColors.length > 0 ? Ce.orbColors : null, Te = we?.[0] || Ce.primaryColor || "#3B82F6", Ee = Ce.position || "bottom-right", De = Se.fallbackAgentName || "Agent", Oe = CO(we ?? Ce.chatBgColors), ke = Se.logo || Se.logoUrl || null, Ae = E || "en", je = be.recommendations?.[Ae] || [], Me = (xe.recommendations?.[Ae] ?? je).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
29672
+ }, we = Array.isArray(Ce.orbColors) && Ce.orbColors.length > 0 ? Ce.orbColors : null, Te = we?.[0] || Ce.primaryColor || "#3B82F6", Ee = Ce.position || "bottom-right", De = Se.fallbackAgentName || "Agent", Oe = TO(we ?? Ce.chatBgColors), ke = Se.logo || Se.logoUrl || null, Ae = E || "en", je = be.recommendations?.[Ae] || [], Me = (xe.recommendations?.[Ae] ?? je).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
29657
29673
  id: e.key || `qr-${t}`,
29658
29674
  label: e.label,
29659
29675
  message: e.label,
@@ -29690,7 +29706,7 @@ function FO() {
29690
29706
  let pt = o(() => {
29691
29707
  it(null), ot("");
29692
29708
  }, []), mt = o((e) => {
29693
- let t = QE(e);
29709
+ let t = eD(e);
29694
29710
  if (t) {
29695
29711
  it(null), ot(t);
29696
29712
  return;
@@ -29774,7 +29790,7 @@ function FO() {
29774
29790
  if (rt) {
29775
29791
  try {
29776
29792
  ct(!0), ot("");
29777
- let e = await se(rt), n = e?.data || e, r = Je.trim() || `Shared file: ${eD(rt)}`;
29793
+ let e = await se(rt), n = e?.data || e, r = Je.trim() || `Shared file: ${nD(rt)}`;
29778
29794
  O(""), A(null), pt(), await oe(r, "", t, {
29779
29795
  type: "file",
29780
29796
  metadata: {
@@ -29825,7 +29841,7 @@ function FO() {
29825
29841
  ...yt
29826
29842
  },
29827
29843
  children: [
29828
- Ke === "entry_prompt" && /* @__PURE__ */ g(kO, {
29844
+ Ke === "entry_prompt" && /* @__PURE__ */ g(jO, {
29829
29845
  copy: Le,
29830
29846
  orbColors: we,
29831
29847
  primaryColor: Te,
@@ -29846,13 +29862,13 @@ function FO() {
29846
29862
  transformOrigin: "bottom right",
29847
29863
  display: "inline-block"
29848
29864
  },
29849
- children: /* @__PURE__ */ g(OO, {
29865
+ children: /* @__PURE__ */ g(AO, {
29850
29866
  size: 50,
29851
29867
  orbColors: we,
29852
29868
  onClick: xt
29853
29869
  })
29854
29870
  }),
29855
- Ke === "connection_modal" && /* @__PURE__ */ g(AO, {
29871
+ Ke === "connection_modal" && /* @__PURE__ */ g(MO, {
29856
29872
  copy: Le,
29857
29873
  orbColors: we,
29858
29874
  primaryColor: Te,
@@ -29860,7 +29876,7 @@ function FO() {
29860
29876
  onText: Ct,
29861
29877
  onClose: bt
29862
29878
  }),
29863
- Ke === "voice_mode" && /* @__PURE__ */ g(jO, {
29879
+ Ke === "voice_mode" && /* @__PURE__ */ g(NO, {
29864
29880
  orbColors: we,
29865
29881
  onEnterChat: Ct,
29866
29882
  onEndChat: wt,
@@ -29870,7 +29886,7 @@ function FO() {
29870
29886
  historyRef: ie,
29871
29887
  onMessageSync: ae
29872
29888
  }, "voice"),
29873
- Ke === "text_chat" && /* @__PURE__ */ g(PO, {
29889
+ Ke === "text_chat" && /* @__PURE__ */ g(IO, {
29874
29890
  copy: Le,
29875
29891
  orbColors: we,
29876
29892
  primaryColor: Te,
@@ -29928,4 +29944,4 @@ function FO() {
29928
29944
  });
29929
29945
  }
29930
29946
  //#endregion
29931
- export { gD as AnimatedOrb, In as FlowEngageProvider, FO as FlowEngageWidget, pn as useFlowEngage };
29947
+ export { vD as AnimatedOrb, In as FlowEngageProvider, LO as FlowEngageWidget, pn as useFlowEngage };