@flowengage/react-chatbot 1.5.9 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25833,13 +25833,16 @@ function DE(e) {
25833
25833
  function OE() {
25834
25834
  return Z.wordsSoFar;
25835
25835
  }
25836
- function kE(e) {
25837
- Z.isVoice = e;
25836
+ function kE() {
25837
+ return Z.speechStartTime > 0 ? Date.now() - Z.speechStartTime : 0;
25838
25838
  }
25839
25839
  function AE(e) {
25840
+ Z.isVoice = e;
25841
+ }
25842
+ function jE(e) {
25840
25843
  Z.lastHighlightId = e;
25841
25844
  }
25842
- function jE() {
25845
+ function ME() {
25843
25846
  Z.timers.forEach(clearTimeout), Object.assign(Z, {
25844
25847
  wordsSoFar: 0,
25845
25848
  speechStartTime: 0,
@@ -25851,8 +25854,8 @@ function jE() {
25851
25854
  }
25852
25855
  //#endregion
25853
25856
  //#region src/utils/highlightEngine.js
25854
- var ME = null;
25855
- function NE(e) {
25857
+ var NE = null;
25858
+ function PE(e) {
25856
25859
  try {
25857
25860
  e.scrollIntoView({
25858
25861
  behavior: "smooth",
@@ -25860,34 +25863,34 @@ function NE(e) {
25860
25863
  });
25861
25864
  } catch {}
25862
25865
  }
25863
- function PE(e) {
25864
- FE(), ME = Object.assign(document.createElement("div"), { id: "fe-spotlight-overlay" }), ME.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(ME), ME.offsetHeight, ME.style.opacity = "1", e.style.position = "relative", e.style.zIndex = "9999";
25866
+ function FE(e) {
25867
+ IE(), NE = Object.assign(document.createElement("div"), { id: "fe-spotlight-overlay" }), NE.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(NE), NE.offsetHeight, NE.style.opacity = "1", e.style.position = "relative", e.style.zIndex = "9999";
25865
25868
  }
25866
- function FE() {
25867
- if (ME) {
25868
- ME.style.opacity = "0";
25869
- let e = ME;
25870
- setTimeout(() => e.parentNode?.removeChild(e), 400), ME = null;
25869
+ function IE() {
25870
+ if (NE) {
25871
+ NE.style.opacity = "0";
25872
+ let e = NE;
25873
+ setTimeout(() => e.parentNode?.removeChild(e), 400), NE = null;
25871
25874
  }
25872
25875
  document.querySelectorAll("[data-fe-highlighted]").forEach((e) => {
25873
25876
  e.style.zIndex = "", e.style.position = "";
25874
25877
  });
25875
25878
  }
25876
- function IE(e) {
25877
- !e || e.hasAttribute("data-fe-highlighted") || (LE(), NE(e), e.setAttribute("data-fe-orig-style", e.style.cssText), e.setAttribute("data-fe-highlighted", "true"), Object.assign(e.style, {
25879
+ function LE(e) {
25880
+ !e || e.hasAttribute("data-fe-highlighted") || (RE(), PE(e), e.setAttribute("data-fe-orig-style", e.style.cssText), e.setAttribute("data-fe-highlighted", "true"), Object.assign(e.style, {
25878
25881
  outline: "3px solid #2563eb",
25879
25882
  outlineOffset: "8px",
25880
25883
  background: "rgba(37,99,235,0.08)",
25881
25884
  borderRadius: "8px",
25882
25885
  padding: "12px 16px",
25883
25886
  transition: "all 0.4s ease"
25884
- }), PE(e), setTimeout(LE, 6e4));
25887
+ }), FE(e), setTimeout(RE, 6e4));
25885
25888
  }
25886
- function LE() {
25889
+ function RE() {
25887
25890
  let e = document.querySelector("[data-fe-highlighted]");
25888
- e && (e.style.cssText = e.getAttribute("data-fe-orig-style") || "", e.removeAttribute("data-fe-highlighted"), e.removeAttribute("data-fe-orig-style")), FE();
25891
+ e && (e.style.cssText = e.getAttribute("data-fe-orig-style") || "", e.removeAttribute("data-fe-highlighted"), e.removeAttribute("data-fe-orig-style")), IE();
25889
25892
  }
25890
- function RE() {
25893
+ function zE() {
25891
25894
  return Array.from(document.querySelectorAll("h2, h3")).map((e) => {
25892
25895
  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
25896
  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(" "));
@@ -25898,8 +25901,8 @@ function RE() {
25898
25901
  };
25899
25902
  });
25900
25903
  }
25901
- function zE(e, t = !1) {
25902
- let n = RE();
25904
+ function BE(e, t = !1) {
25905
+ let n = zE();
25903
25906
  if (!n.length) return;
25904
25907
  let r = e.toLowerCase(), i = OE(), a = t ? 400 : 240, o = e.trim().split(/\s+/).length, s = n.map((t) => {
25905
25908
  let n = t.keywords.filter((e) => e.length >= 10).reduce((e, t) => {
@@ -25912,19 +25915,18 @@ function zE(e, t = !1) {
25912
25915
  };
25913
25916
  }).filter(Boolean).sort((e, t) => e.wordOffset - t.wordOffset);
25914
25917
  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
- wE(() => {
25921
- AE(d), IE(u);
25922
- }, i + t, l);
25918
+ let c = /* @__PURE__ */ new Set(), l = s.filter(({ entry: e }) => c.has(e.id) ? !1 : (c.add(e.id), !0)), u = kE(), d = u > 0 ? Math.floor(u / a) : -1, f = -1;
25919
+ for (let e = 0; e < l.length; e++) l[e].wordOffset <= d && (f = e);
25920
+ l.forEach(({ entry: e, wordOffset: t }, n) => {
25921
+ let r = l[n + 1]?.wordOffset ?? o, s = Math.max(3e3, Math.min((r - t) * a, 2e4)), { element: c, id: u } = e;
25922
+ n === f ? (jE(u), LE(c)) : n > f && wE(() => {
25923
+ jE(u), LE(c);
25924
+ }, i + t, s);
25923
25925
  });
25924
25926
  }
25925
25927
  //#endregion
25926
25928
  //#region src/lib/svgIcons.jsx
25927
- var BE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25929
+ var VE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25928
25930
  width: e,
25929
25931
  height: e,
25930
25932
  viewBox: "0 0 24 24",
@@ -25939,7 +25941,7 @@ var BE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25939
25941
  x2: "1",
25940
25942
  y2: "23"
25941
25943
  })]
25942
- }), VE = () => /* @__PURE__ */ _("svg", {
25944
+ }), HE = () => /* @__PURE__ */ _("svg", {
25943
25945
  width: "18",
25944
25946
  height: "18",
25945
25947
  viewBox: "0 0 24 24",
@@ -25954,7 +25956,7 @@ var BE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25954
25956
  x2: "12",
25955
25957
  y2: "5"
25956
25958
  }), /* @__PURE__ */ g("polyline", { points: "5 12 12 5 19 12" })]
25957
- }), HE = () => /* @__PURE__ */ _("svg", {
25959
+ }), UE = () => /* @__PURE__ */ _("svg", {
25958
25960
  width: "14",
25959
25961
  height: "14",
25960
25962
  viewBox: "0 0 24 24",
@@ -25964,7 +25966,7 @@ var BE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25964
25966
  strokeLinecap: "round",
25965
25967
  strokeLinejoin: "round",
25966
25968
  children: [/* @__PURE__ */ g("polyline", { points: "9 17 4 12 9 7" }), /* @__PURE__ */ g("path", { d: "M20 18v-2a4 4 0 00-4-4H4" })]
25967
- }), UE = () => /* @__PURE__ */ g("svg", {
25969
+ }), WE = () => /* @__PURE__ */ g("svg", {
25968
25970
  width: "18",
25969
25971
  height: "18",
25970
25972
  viewBox: "0 0 24 24",
@@ -25974,7 +25976,7 @@ var BE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
25974
25976
  strokeLinecap: "round",
25975
25977
  strokeLinejoin: "round",
25976
25978
  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" })
25977
- }), WE = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
25979
+ }), GE = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
25978
25980
  className: e,
25979
25981
  width: "14",
25980
25982
  height: "14",
@@ -26003,7 +26005,7 @@ var BE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
26003
26005
  y2: "16"
26004
26006
  })
26005
26007
  ]
26006
- }), GE = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
26008
+ }), KE = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
26007
26009
  width: e,
26008
26010
  height: e,
26009
26011
  viewBox: "0 0 24 24",
@@ -26026,7 +26028,7 @@ var BE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
26026
26028
  /* @__PURE__ */ g("path", { d: "M15 13v2" }),
26027
26029
  /* @__PURE__ */ g("path", { d: "M9 13v2" })
26028
26030
  ]
26029
- }), KE = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
26031
+ }), qE = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
26030
26032
  width: e,
26031
26033
  height: e,
26032
26034
  viewBox: "0 0 24 24",
@@ -26046,8 +26048,8 @@ var BE = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
26046
26048
  x2: "19",
26047
26049
  y2: "12"
26048
26050
  })]
26049
- }), qE = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), JE = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
26050
- function YE(e) {
26051
+ }), JE = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), YE = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
26052
+ function XE(e) {
26051
26053
  let t = String(e || "").trim();
26052
26054
  if (!t) return t;
26053
26055
  let n = /^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);
@@ -26059,33 +26061,33 @@ function YE(e) {
26059
26061
  }
26060
26062
  return e;
26061
26063
  }
26062
- var XE = (e = "") => {
26064
+ var ZE = (e = "") => {
26063
26065
  let t = String(e || "").trim();
26064
26066
  if (!t) return "";
26065
- if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return YE(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) => JE(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 YE(n.map((e) => {
26067
+ if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return XE(t);
26068
+ 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) => YE(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>");
26069
+ return XE(n.map((e) => {
26068
26070
  let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = t.filter((e) => /^[-*]\s+/.test(e));
26069
26071
  if (n.length >= 2 && n.length === t.length) return `<ul>${n.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>`;
26070
26072
  let i = e.split(/\s+(?=[-*]\s+\*\*?)/).map((e) => e.trim()).filter(Boolean);
26071
26073
  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>`;
26072
26074
  }).join(""));
26073
- }, ZE = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), QE = new Set([
26075
+ }, QE = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), $E = new Set([
26074
26076
  ".pdf",
26075
26077
  ".docx",
26076
26078
  ".png",
26077
26079
  ".jpg",
26078
26080
  ".jpeg"
26079
- ]), $E = "image/png,image/jpeg,.pdf,.docx";
26080
- function eD(e) {
26081
+ ]), eD = "image/png,image/jpeg,.pdf,.docx";
26082
+ function tD(e) {
26081
26083
  if (!e) return !1;
26082
26084
  let t = typeof e.name == "string" ? e.name.toLowerCase() : "", n = t.includes(".") ? `.${t.split(".").pop()}` : "", r = typeof e.type == "string" ? e.type.toLowerCase() : "";
26083
- return r === "image/png" || r === "image/jpeg" || ZE.has(r) || QE.has(n);
26085
+ return r === "image/png" || r === "image/jpeg" || QE.has(r) || $E.has(n);
26084
26086
  }
26085
- function tD(e) {
26086
- return e ? eD(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
26087
+ function nD(e) {
26088
+ return e ? tD(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
26087
26089
  }
26088
- function nD(e = 0) {
26090
+ function rD(e = 0) {
26089
26091
  if (!Number.isFinite(e) || e <= 0) return "";
26090
26092
  let t = [
26091
26093
  "B",
@@ -26097,12 +26099,12 @@ function nD(e = 0) {
26097
26099
  let i = n >= 10 || r === 0 ? 0 : 1;
26098
26100
  return `${n.toFixed(i)} ${t[r]}`;
26099
26101
  }
26100
- function rD(e) {
26102
+ function iD(e) {
26101
26103
  return e ? e.name || "Attachment" : "";
26102
26104
  }
26103
26105
  //#endregion
26104
26106
  //#region src/utils/avatarHelpers.js
26105
- function iD(e) {
26107
+ function aD(e) {
26106
26108
  if (!e || typeof e != "string") return "?";
26107
26109
  let t = e.trim();
26108
26110
  if (!t) return "?";
@@ -26111,7 +26113,7 @@ function iD(e) {
26111
26113
  }
26112
26114
  //#endregion
26113
26115
  //#region src/components/AvatarImageOrInitials.jsx
26114
- function aD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26116
+ function oD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26115
26117
  let [i, a] = m(!1), o = typeof e == "string" ? e.trim() : "";
26116
26118
  return c(() => {
26117
26119
  a(!1);
@@ -26122,12 +26124,12 @@ function aD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26122
26124
  style: n
26123
26125
  }) : /* @__PURE__ */ g("span", {
26124
26126
  style: r,
26125
- children: iD(t)
26127
+ children: aD(t)
26126
26128
  });
26127
26129
  }
26128
26130
  //#endregion
26129
26131
  //#region src/components/MessageList.jsx
26130
- function oD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext: r, TypingDots: i, primaryColor: a = "#3B82F6", agentHeadshot: o = null, agentDisplayName: s = "Agent", botAvatarNode: l = null }) {
26132
+ function sD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext: r, TypingDots: i, primaryColor: a = "#3B82F6", agentHeadshot: o = null, agentDisplayName: s = "Agent", botAvatarNode: l = null }) {
26131
26133
  let u = p(null), d = (e) => {
26132
26134
  if (!e) return "just now";
26133
26135
  let t = /* @__PURE__ */ new Date(), n = new Date(e), r = Math.max(0, Math.floor((t - n) / 1e3));
@@ -26156,7 +26158,7 @@ function oD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26156
26158
  },
26157
26159
  children: [
26158
26160
  e.map((e) => {
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 = qE(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
26161
+ 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 = JE(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
26160
26162
  return t ? /* @__PURE__ */ g("div", {
26161
26163
  style: {
26162
26164
  display: "flex",
@@ -26201,7 +26203,7 @@ function oD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26201
26203
  fontWeight: 800,
26202
26204
  marginTop: !u && (i || c) ? "22px" : "0px"
26203
26205
  },
26204
- children: i ? l || /* @__PURE__ */ g(GE, { size: 16 }) : /* @__PURE__ */ g(aD, {
26206
+ children: i ? l || /* @__PURE__ */ g(KE, { size: 16 }) : /* @__PURE__ */ g(oD, {
26205
26207
  src: m || "",
26206
26208
  name: p,
26207
26209
  imgStyle: {
@@ -26243,7 +26245,7 @@ function oD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26243
26245
  onMouseLeave: (e) => {
26244
26246
  e.currentTarget.style.color = "#9ca3af";
26245
26247
  },
26246
- children: [/* @__PURE__ */ g(HE, {}), "Reply"]
26248
+ children: [/* @__PURE__ */ g(UE, {}), "Reply"]
26247
26249
  }),
26248
26250
  /* @__PURE__ */ _("div", {
26249
26251
  style: {
@@ -26287,7 +26289,7 @@ function oD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26287
26289
  })]
26288
26290
  }),
26289
26291
  f ? (() => {
26290
- let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = nD(e.metadata.fileSize), a = t.startsWith("image/"), o = t === "application/pdf" ? {
26292
+ let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = rD(e.metadata.fileSize), a = t.startsWith("image/"), o = t === "application/pdf" ? {
26291
26293
  color: "#ef4444",
26292
26294
  label: "PDF"
26293
26295
  } : t.includes("word") || t.includes("docx") ? {
@@ -26445,7 +26447,7 @@ function oD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26445
26447
  });
26446
26448
  })() : i ? /* @__PURE__ */ g("div", {
26447
26449
  className: "flowengage-message-content fe-bot-message",
26448
- dangerouslySetInnerHTML: { __html: XE(e.message) }
26450
+ dangerouslySetInnerHTML: { __html: ZE(e.message) }
26449
26451
  }) : /* @__PURE__ */ g("div", {
26450
26452
  style: { whiteSpace: n || c ? "normal" : "pre-wrap" },
26451
26453
  children: e.message
@@ -26510,7 +26512,7 @@ function oD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26510
26512
  boxShadow: l ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
26511
26513
  overflow: "hidden"
26512
26514
  },
26513
- children: l || /* @__PURE__ */ g(GE, { size: 16 })
26515
+ children: l || /* @__PURE__ */ g(KE, { size: 16 })
26514
26516
  }), /* @__PURE__ */ _("div", {
26515
26517
  style: {
26516
26518
  display: "flex",
@@ -26552,7 +26554,7 @@ function oD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26552
26554
  borderRadius: "50%",
26553
26555
  overflow: "hidden"
26554
26556
  },
26555
- children: /* @__PURE__ */ g(aD, {
26557
+ children: /* @__PURE__ */ g(oD, {
26556
26558
  src: o || "",
26557
26559
  name: s,
26558
26560
  imgStyle: {
@@ -26592,7 +26594,7 @@ function oD({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
26592
26594
  }
26593
26595
  //#endregion
26594
26596
  //#region src/components/ChatInput.jsx
26595
- function sD({ 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" }) {
26597
+ function cD({ 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" }) {
26596
26598
  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;
26597
26599
  return /* @__PURE__ */ _("div", {
26598
26600
  style: {
@@ -26700,7 +26702,7 @@ function sD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26700
26702
  background: "rgba(59,130,246,0.08)",
26701
26703
  color: "var(--flowengage-primary)"
26702
26704
  },
26703
- children: /* @__PURE__ */ g(GE, { size: 13 })
26705
+ children: /* @__PURE__ */ g(KE, { size: 13 })
26704
26706
  }), /* @__PURE__ */ g("span", { children: "Please provide your email address so we can help you." })]
26705
26707
  })
26706
26708
  }),
@@ -26740,7 +26742,7 @@ function sD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26740
26742
  overflow: "hidden",
26741
26743
  textOverflow: "ellipsis"
26742
26744
  },
26743
- children: rD(x)
26745
+ children: iD(x)
26744
26746
  }),
26745
26747
  /* @__PURE__ */ g("div", {
26746
26748
  style: {
@@ -26748,7 +26750,7 @@ function sD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26748
26750
  color: "#6b7280",
26749
26751
  marginTop: "2px"
26750
26752
  },
26751
- children: nD(x.size)
26753
+ children: rD(x.size)
26752
26754
  })
26753
26755
  ]
26754
26756
  }), /* @__PURE__ */ g("button", {
@@ -26792,7 +26794,7 @@ function sD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26792
26794
  E ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("input", {
26793
26795
  ref: ee,
26794
26796
  type: "file",
26795
- accept: $E,
26797
+ accept: eD,
26796
26798
  style: { display: "none" },
26797
26799
  onChange: (e) => {
26798
26800
  let t = e.target.files?.[0];
@@ -26824,7 +26826,7 @@ function sD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26824
26826
  onMouseLeave: (e) => {
26825
26827
  e.currentTarget.style.opacity = "1";
26826
26828
  },
26827
- children: /* @__PURE__ */ g(KE, {
26829
+ children: /* @__PURE__ */ g(qE, {
26828
26830
  size: 18,
26829
26831
  color: "currentColor"
26830
26832
  })
@@ -26879,7 +26881,7 @@ function sD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26879
26881
  onMouseLeave: (e) => {
26880
26882
  e.currentTarget.style.opacity = "1";
26881
26883
  },
26882
- children: /* @__PURE__ */ g(VE, {})
26884
+ children: /* @__PURE__ */ g(HE, {})
26883
26885
  })
26884
26886
  ]
26885
26887
  }),
@@ -26942,7 +26944,7 @@ function sD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
26942
26944
  }
26943
26945
  //#endregion
26944
26946
  //#region src/components/StatusBanners.jsx
26945
- var cD = ({ muted: e = !1 }) => /* @__PURE__ */ _("svg", {
26947
+ var lD = ({ muted: e = !1 }) => /* @__PURE__ */ _("svg", {
26946
26948
  width: "16",
26947
26949
  height: "16",
26948
26950
  viewBox: "0 0 24 24",
@@ -26962,7 +26964,7 @@ var cD = ({ muted: e = !1 }) => /* @__PURE__ */ _("svg", {
26962
26964
  y2: "22"
26963
26965
  })
26964
26966
  ]
26965
- }), lD = ({ variant: e, onClick: t, children: n, icon: r, compact: i = !1, iconOnly: a = !1, active: o = !1, ariaLabel: s }) => /* @__PURE__ */ _("button", {
26967
+ }), uD = ({ variant: e, onClick: t, children: n, icon: r, compact: i = !1, iconOnly: a = !1, active: o = !1, ariaLabel: s }) => /* @__PURE__ */ _("button", {
26966
26968
  type: "button",
26967
26969
  className: [
26968
26970
  "flowengage-call-btn",
@@ -26976,7 +26978,7 @@ var cD = ({ muted: e = !1 }) => /* @__PURE__ */ _("svg", {
26976
26978
  title: s || n,
26977
26979
  children: [r, !a && /* @__PURE__ */ g("span", { children: n })]
26978
26980
  });
26979
- function uD({ 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 }) {
26981
+ function dD({ 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 }) {
26980
26982
  let T = p(null), ee = o(() => {
26981
26983
  if (!T.current) return;
26982
26984
  let { audioContext: e, oscillator: t, interval: n, toneTimeout: r } = T.current;
@@ -27036,7 +27038,7 @@ function uD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27036
27038
  gap: "10px"
27037
27039
  },
27038
27040
  children: [
27039
- /* @__PURE__ */ g(WE, { className: "" }),
27041
+ /* @__PURE__ */ g(GE, { className: "" }),
27040
27042
  /* @__PURE__ */ g("span", {
27041
27043
  style: {
27042
27044
  fontSize: "12px",
@@ -27079,7 +27081,7 @@ function uD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27079
27081
  className: "call-connected-identity",
27080
27082
  children: [/* @__PURE__ */ g("div", {
27081
27083
  className: `call-icon-wrapper ${E}`,
27082
- children: /* @__PURE__ */ g(BE, { size: 20 })
27084
+ children: /* @__PURE__ */ g(VE, { size: 20 })
27083
27085
  }), /* @__PURE__ */ _("div", {
27084
27086
  className: "call-info-group",
27085
27087
  children: [/* @__PURE__ */ g("h3", {
@@ -27096,25 +27098,25 @@ function uD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27096
27098
  })]
27097
27099
  }), /* @__PURE__ */ _("div", {
27098
27100
  className: "call-actions connected",
27099
- children: [/* @__PURE__ */ g(lD, {
27101
+ children: [/* @__PURE__ */ g(uD, {
27100
27102
  variant: "mute",
27101
27103
  onClick: b,
27102
27104
  compact: x,
27103
27105
  active: y,
27104
- icon: /* @__PURE__ */ g(cD, { muted: y }),
27106
+ icon: /* @__PURE__ */ g(lD, { muted: y }),
27105
27107
  children: y ? "Unmute" : "Mute"
27106
- }), /* @__PURE__ */ g(lD, {
27108
+ }), /* @__PURE__ */ g(uD, {
27107
27109
  variant: "end",
27108
27110
  onClick: v,
27109
27111
  compact: x,
27110
- icon: /* @__PURE__ */ g(BE, { size: 14 }),
27112
+ icon: /* @__PURE__ */ g(VE, { size: 14 }),
27111
27113
  children: "End"
27112
27114
  })]
27113
27115
  })] }) : /* @__PURE__ */ _(h, { children: [
27114
27116
  /* @__PURE__ */ _("div", {
27115
27117
  className: `call-icon-wrapper ${E}`,
27116
27118
  children: [
27117
- /* @__PURE__ */ g(UE, {}),
27119
+ /* @__PURE__ */ g(WE, {}),
27118
27120
  E === "incoming" && /* @__PURE__ */ g("div", { className: "call-pulse-animation" }),
27119
27121
  E === "connecting" && /* @__PURE__ */ g("div", { className: "call-connecting-animation" })
27120
27122
  ]
@@ -27131,22 +27133,22 @@ function uD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27131
27133
  }),
27132
27134
  /* @__PURE__ */ g("div", {
27133
27135
  className: "call-actions",
27134
- children: E === "incoming" && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(lD, {
27136
+ children: E === "incoming" && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(uD, {
27135
27137
  variant: "reject",
27136
27138
  onClick: async () => {
27137
27139
  ee(), await a();
27138
27140
  },
27139
27141
  iconOnly: !0,
27140
- icon: /* @__PURE__ */ g(BE, { size: 14 }),
27142
+ icon: /* @__PURE__ */ g(VE, { size: 14 }),
27141
27143
  ariaLabel: "Decline call",
27142
27144
  children: "Decline"
27143
- }), /* @__PURE__ */ g(lD, {
27145
+ }), /* @__PURE__ */ g(uD, {
27144
27146
  variant: "accept",
27145
27147
  onClick: async () => {
27146
27148
  ee(), await s();
27147
27149
  },
27148
27150
  iconOnly: !0,
27149
- icon: /* @__PURE__ */ g(UE, {}),
27151
+ icon: /* @__PURE__ */ g(WE, {}),
27150
27152
  ariaLabel: "Accept call",
27151
27153
  children: "Accept"
27152
27154
  })] })
@@ -27169,13 +27171,13 @@ function uD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27169
27171
  }
27170
27172
  //#endregion
27171
27173
  //#region src/components/AnimatedOrb.jsx
27172
- var dD = [
27174
+ var fD = [
27173
27175
  "#135bd8",
27174
27176
  "#ef334b",
27175
27177
  "#ffbd2e"
27176
27178
  ];
27177
- function fD(e) {
27178
- return !Array.isArray(e) || e.length === 0 ? dD : e.length === 1 ? [
27179
+ function pD(e) {
27180
+ return !Array.isArray(e) || e.length === 0 ? fD : e.length === 1 ? [
27179
27181
  e[0],
27180
27182
  e[0],
27181
27183
  e[0]
@@ -27189,14 +27191,14 @@ function fD(e) {
27189
27191
  e[2]
27190
27192
  ];
27191
27193
  }
27192
- var pD = {
27194
+ var mD = {
27193
27195
  idle: 3,
27194
27196
  listening: .75,
27195
27197
  speaking: 1.4,
27196
27198
  muted: .75,
27197
27199
  error: .08
27198
27200
  };
27199
- function mD(e) {
27201
+ function hD(e) {
27200
27202
  if (!e || typeof e != "string") return [
27201
27203
  0,
27202
27204
  0,
@@ -27209,14 +27211,14 @@ function mD(e) {
27209
27211
  parseInt(n.slice(4, 6), 16) / 255
27210
27212
  ];
27211
27213
  }
27212
- function hD(e, t) {
27214
+ function gD(e, t) {
27213
27215
  if (!e || typeof e != "string") return `rgba(0,0,0,${t})`;
27214
27216
  if (e.startsWith("rgb")) return e.replace(/[\d.]+\)$/, `${t})`);
27215
27217
  let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
27216
27218
  return `rgba(${parseInt(r.slice(0, 2), 16)},${parseInt(r.slice(2, 4), 16)},${parseInt(r.slice(4, 6), 16)},${t})`;
27217
27219
  }
27218
- var gD = "\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", _D = "\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 vD(e, t, n) {
27220
+ var _D = "\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", vD = "\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";
27221
+ function yD(e, t, n) {
27220
27222
  let r = (t, n) => {
27221
27223
  let r = e.createShader(t);
27222
27224
  return e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("[AnimatedOrb shader]", e.getShaderInfoLog(r)), null);
@@ -27225,10 +27227,10 @@ function vD(e, t, n) {
27225
27227
  let o = e.createProgram();
27226
27228
  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);
27227
27229
  }
27228
- function yD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
27229
- let [s, l, u] = fD(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(pD[t] ?? .35);
27230
+ function bD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
27231
+ let [s, l, u] = pD(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(mD[t] ?? .35);
27230
27232
  c(() => {
27231
- h.current = pD[t] ?? .35;
27233
+ h.current = mD[t] ?? .35;
27232
27234
  }, [t]), c(() => {
27233
27235
  let t = m.current;
27234
27236
  if (!t) return;
@@ -27245,7 +27247,7 @@ function yD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27245
27247
  console.warn("[AnimatedOrb] WebGL unavailable.");
27246
27248
  return;
27247
27249
  }
27248
- let i = vD(r, gD, _D);
27250
+ let i = yD(r, _D, vD);
27249
27251
  if (!i) {
27250
27252
  console.error("[AnimatedOrb] WebGL program failed to compile/link");
27251
27253
  return;
@@ -27275,7 +27277,7 @@ function yD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27275
27277
  c2: r.getUniformLocation(i, "u_c2"),
27276
27278
  c3: r.getUniformLocation(i, "u_c3")
27277
27279
  };
27278
- r.uniform3fv(c.c1, mD(s)), r.uniform3fv(c.c2, mD(l)), r.uniform3fv(c.c3, mD(u)), r.viewport(0, 0, t.width, t.height);
27280
+ r.uniform3fv(c.c1, hD(s)), r.uniform3fv(c.c2, hD(l)), r.uniform3fv(c.c3, hD(u)), r.viewport(0, 0, t.width, t.height);
27279
27281
  let d = performance.now(), f, p = (e) => {
27280
27282
  r.uniform1f(c.time, (e - d) / 1e3), r.uniform1f(c.speed, h.current), r.drawArrays(r.TRIANGLES, 0, 6), f = requestAnimationFrame(p);
27281
27283
  };
@@ -27306,7 +27308,7 @@ function yD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27306
27308
  position: "absolute",
27307
27309
  inset: -10,
27308
27310
  borderRadius: "50%",
27309
- background: `radial-gradient(circle, ${hD(s, .18)} 0%, transparent 70%)`,
27311
+ background: `radial-gradient(circle, ${gD(s, .18)} 0%, transparent 70%)`,
27310
27312
  pointerEvents: "none"
27311
27313
  },
27312
27314
  animate: { opacity: [.3, .75] },
@@ -27385,7 +27387,7 @@ function yD({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27385
27387
  //#endregion
27386
27388
  //#region src/utils/voiceActionVisuals.js
27387
27389
  var Q = "fe-vv";
27388
- function bD() {
27390
+ function xD() {
27389
27391
  if (typeof document > "u" || document.getElementById(`${Q}-styles`)) return;
27390
27392
  let e = `
27391
27393
  /* ── Action toast ───────────────────────────────────────────────────────────── */
@@ -27530,14 +27532,14 @@ function bD() {
27530
27532
  `, t = document.createElement("style");
27531
27533
  t.id = `${Q}-styles`, t.textContent = e, (document.head || document.documentElement).appendChild(t);
27532
27534
  }
27533
- var xD = null, SD = null;
27534
- function CD() {
27535
- return (!xD || !xD.isConnected) && (xD = document.createElement("div"), xD.id = `${Q}-toast`, document.body.appendChild(xD)), xD;
27535
+ var SD = null, CD = null;
27536
+ function wD() {
27537
+ return (!SD || !SD.isConnected) && (SD = document.createElement("div"), SD.id = `${Q}-toast`, document.body.appendChild(SD)), SD;
27536
27538
  }
27537
- function wD(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
27539
+ function TD(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
27538
27540
  if (typeof document > "u") return;
27539
- bD(), SD &&= (clearTimeout(SD), null);
27540
- let i = CD();
27541
+ xD(), CD &&= (clearTimeout(CD), null);
27542
+ let i = wD();
27541
27543
  if (i.innerHTML = "", n) {
27542
27544
  let e = document.createElement("span");
27543
27545
  e.className = `${Q}-icon`, e.textContent = n, i.appendChild(e);
@@ -27546,82 +27548,82 @@ function wD(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
27546
27548
  e.className = `${Q}-spin`, i.appendChild(e);
27547
27549
  }
27548
27550
  let a = document.createElement("span");
27549
- a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (SD = setTimeout(() => TD(), r));
27550
- }
27551
- function TD(e = 0) {
27552
- xD && (e > 0 ? SD = setTimeout(() => {
27553
- xD && xD.classList.remove(`${Q}-show`);
27554
- }, e) : xD && xD.classList.remove(`${Q}-show`));
27551
+ a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (CD = setTimeout(() => ED(), r));
27555
27552
  }
27556
- var ED = null, DD = [];
27557
- function OD() {
27558
- return (!ED || !ED.isConnected) && (ED = document.createElement("div"), ED.id = `${Q}-bar`, document.body.appendChild(ED)), ED;
27553
+ function ED(e = 0) {
27554
+ SD && (e > 0 ? CD = setTimeout(() => {
27555
+ SD && SD.classList.remove(`${Q}-show`);
27556
+ }, e) : SD && SD.classList.remove(`${Q}-show`));
27559
27557
  }
27558
+ var DD = null, OD = [];
27560
27559
  function kD() {
27560
+ return (!DD || !DD.isConnected) && (DD = document.createElement("div"), DD.id = `${Q}-bar`, document.body.appendChild(DD)), DD;
27561
+ }
27562
+ function AD() {
27561
27563
  if (typeof document > "u") return;
27562
- bD(), DD.forEach(clearTimeout), DD = [];
27563
- let e = OD();
27564
+ xD(), OD.forEach(clearTimeout), OD = [];
27565
+ let e = kD();
27564
27566
  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";
27565
27567
  let t = [[80, "width 0.6s ease"], [92, "width 1.2s ease"]], n = 50;
27566
27568
  for (let [e, r] of t) {
27567
27569
  let t = n, i = e, a = r;
27568
- DD.push(setTimeout(() => {
27569
- ED && (ED.style.transition = a, ED.style.width = `${i}%`);
27570
+ OD.push(setTimeout(() => {
27571
+ DD && (DD.style.transition = a, DD.style.width = `${i}%`);
27570
27572
  }, t)), n += 800;
27571
27573
  }
27572
27574
  }
27573
- function AD() {
27574
- ED && (DD.forEach(clearTimeout), DD = [], ED.style.transition = "width 0.2s ease", ED.style.width = "100%", DD.push(setTimeout(() => {
27575
- ED && (ED.style.transition = "opacity 0.35s ease", ED.style.opacity = "0", DD.push(setTimeout(() => {
27576
- ED && (ED.style.width = "0%", ED.classList.remove(`${Q}-bar-active`));
27575
+ function jD() {
27576
+ DD && (OD.forEach(clearTimeout), OD = [], DD.style.transition = "width 0.2s ease", DD.style.width = "100%", OD.push(setTimeout(() => {
27577
+ DD && (DD.style.transition = "opacity 0.35s ease", DD.style.opacity = "0", OD.push(setTimeout(() => {
27578
+ DD && (DD.style.width = "0%", DD.classList.remove(`${Q}-bar-active`));
27577
27579
  }, 380)));
27578
27580
  }, 220)));
27579
27581
  }
27580
- function jD() {
27582
+ function MD() {
27581
27583
  typeof document > "u" || document.querySelectorAll(`.${Q}-field-active, .${Q}-field-filled`).forEach((e) => e.classList.remove(`${Q}-field-active`, `${Q}-field-filled`));
27582
27584
  }
27583
- function MD(e) {
27584
- !e || typeof document > "u" || (bD(), jD(), e.classList.add(`${Q}-field-active`));
27585
- }
27586
27585
  function ND(e) {
27586
+ !e || typeof document > "u" || (xD(), MD(), e.classList.add(`${Q}-field-active`));
27587
+ }
27588
+ function PD(e) {
27587
27589
  e && (e.classList.remove(`${Q}-field-active`), e.classList.add(`${Q}-field-filled`), setTimeout(() => {
27588
27590
  e.isConnected && e.classList.remove(`${Q}-field-filled`);
27589
27591
  }, 1400));
27590
27592
  }
27591
- var PD = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
27593
+ var FD = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
27592
27594
  <filter id="${Q}-csh">
27593
27595
  <feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
27594
27596
  </filter>
27595
27597
  <path d="M4 2L19 10.5L11 12.8L8 20L4 2Z"
27596
27598
  fill="white" stroke="#1e1b4b" stroke-width="1.6" stroke-linejoin="round"
27597
27599
  filter="url(#${Q}-csh)"/>
27598
- </svg>`, FD = null, ID = !1;
27599
- function LD() {
27600
- return (!FD || !FD.isConnected) && (FD = document.createElement("div"), FD.id = `${Q}-cursor`, FD.innerHTML = PD, document.body.appendChild(FD), ID = !1), FD;
27600
+ </svg>`, ID = null, LD = !1;
27601
+ function RD() {
27602
+ return (!ID || !ID.isConnected) && (ID = document.createElement("div"), ID.id = `${Q}-cursor`, ID.innerHTML = FD, document.body.appendChild(ID), LD = !1), ID;
27601
27603
  }
27602
- async function RD(e) {
27604
+ async function zD(e) {
27603
27605
  if (typeof document > "u" || !e) return;
27604
- bD();
27606
+ xD();
27605
27607
  let t;
27606
27608
  try {
27607
27609
  t = e.getBoundingClientRect();
27608
27610
  } catch {
27609
27611
  return;
27610
27612
  }
27611
- let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = LD();
27612
- ID ||= (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 HD(360);
27613
+ let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = RD();
27614
+ LD ||= (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 UD(360);
27613
27615
  }
27614
- function zD(e = !1) {
27615
- FD && (e ? (FD.classList.remove(`${Q}-cursor-visible`), ID = !1) : (FD.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
27616
- ID = !1;
27616
+ function BD(e = !1) {
27617
+ ID && (e ? (ID.classList.remove(`${Q}-cursor-visible`), LD = !1) : (ID.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
27618
+ LD = !1;
27617
27619
  }, 250)));
27618
27620
  }
27619
- async function BD(e) {
27620
- FD && (FD.classList.add(`${Q}-cursor-click`), await HD(280), FD.classList.remove(`${Q}-cursor-click`));
27621
+ async function VD(e) {
27622
+ ID && (ID.classList.add(`${Q}-cursor-click`), await UD(280), ID.classList.remove(`${Q}-cursor-click`));
27621
27623
  }
27622
- function VD(e) {
27624
+ function HD(e) {
27623
27625
  if (!e || typeof document > "u") return;
27624
- bD();
27626
+ xD();
27625
27627
  let t;
27626
27628
  try {
27627
27629
  t = e.getBoundingClientRect();
@@ -27647,7 +27649,7 @@ function VD(e) {
27647
27649
  a.remove(), e.style.position = n, e.style.overflow = r;
27648
27650
  }, 650);
27649
27651
  }
27650
- function HD(e) {
27652
+ function UD(e) {
27651
27653
  return new Promise((t) => setTimeout(t, e));
27652
27654
  }
27653
27655
  //#endregion
@@ -27655,42 +27657,42 @@ function HD(e) {
27655
27657
  function $(...e) {
27656
27658
  mn() && console.log("[FlowEngage:voice-tools]", ...e);
27657
27659
  }
27658
- function UD(e) {
27660
+ function WD(e) {
27659
27661
  return new Promise((t) => setTimeout(t, e));
27660
27662
  }
27661
- var WD = "#flowengage-root, .flowengage-shell, .flowengage-widget-root";
27662
- function GD(e) {
27663
+ var GD = "#flowengage-root, .flowengage-shell, .flowengage-widget-root";
27664
+ function KD(e) {
27663
27665
  if (!e || typeof e.closest != "function") return !1;
27664
27666
  try {
27665
- return !!e.closest(WD);
27667
+ return !!e.closest(GD);
27666
27668
  } catch {
27667
27669
  return !1;
27668
27670
  }
27669
27671
  }
27670
- function KD(e) {
27672
+ function qD(e) {
27671
27673
  try {
27672
27674
  let t = e.ownerDocument?.defaultView;
27673
27675
  if (t) return t.getComputedStyle(e);
27674
27676
  } catch {}
27675
27677
  return window.getComputedStyle(e);
27676
27678
  }
27677
- function qD(e) {
27679
+ function JD(e) {
27678
27680
  let t = /* @__PURE__ */ new Set();
27679
27681
  function n(r) {
27680
27682
  if (!r || t.has(r)) return;
27681
27683
  t.add(r), e(r);
27682
27684
  let i = r.querySelectorAll("iframe");
27683
- for (let e of i) if (!GD(e)) try {
27685
+ for (let e of i) if (!KD(e)) try {
27684
27686
  let t = e.contentDocument;
27685
27687
  t && n(t);
27686
27688
  } catch {}
27687
27689
  }
27688
27690
  typeof document < "u" && n(document);
27689
27691
  }
27690
- function JD(e) {
27692
+ function YD(e) {
27691
27693
  return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
27692
27694
  }
27693
- function YD(e) {
27695
+ function XD(e) {
27694
27696
  let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
27695
27697
  if (n) {
27696
27698
  let e = n.trim().split(/\s+/).filter(Boolean), r = [];
@@ -27698,42 +27700,42 @@ function YD(e) {
27698
27700
  let e = t.getElementById(n);
27699
27701
  e?.textContent && r.push(e.textContent.trim());
27700
27702
  } catch {}
27701
- if (r.length) return JD(r.join(" "));
27703
+ if (r.length) return YD(r.join(" "));
27702
27704
  }
27703
- if (e.labels && e.labels.length) return JD(e.labels[0].textContent);
27705
+ if (e.labels && e.labels.length) return YD(e.labels[0].textContent);
27704
27706
  let r = e.id;
27705
27707
  if (r) try {
27706
27708
  let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
27707
- if (e) return JD(e.textContent);
27709
+ if (e) return YD(e.textContent);
27708
27710
  } catch {
27709
27711
  let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
27710
- if (e) return JD(e.textContent);
27712
+ if (e) return YD(e.textContent);
27711
27713
  }
27712
27714
  let i = e.previousElementSibling;
27713
27715
  for (let e = 0; e < 6 && i; e += 1) {
27714
- if (i.tagName === "LABEL") return JD(i.textContent);
27716
+ if (i.tagName === "LABEL") return YD(i.textContent);
27715
27717
  let e = (i.className || "").toString().toLowerCase();
27716
27718
  if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
27717
- let e = JD(i.textContent);
27719
+ let e = YD(i.textContent);
27718
27720
  if (e) return e;
27719
27721
  }
27720
27722
  i = i.previousElementSibling;
27721
27723
  }
27722
27724
  let a = e.parentElement;
27723
27725
  for (let e = 0; e < 5 && a; e += 1) {
27724
- if (a.tagName === "LABEL") return JD(a.textContent);
27726
+ if (a.tagName === "LABEL") return YD(a.textContent);
27725
27727
  let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
27726
- if (e?.textContent) return JD(e.textContent);
27728
+ if (e?.textContent) return YD(e.textContent);
27727
27729
  a = a.parentElement;
27728
27730
  }
27729
27731
  let o = e.getAttribute("aria-label");
27730
- return o ? JD(o) : null;
27732
+ return o ? YD(o) : null;
27731
27733
  }
27732
- function XD() {
27734
+ function ZD() {
27733
27735
  let e = [];
27734
- return qD((t) => {
27736
+ return JD((t) => {
27735
27737
  e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
27736
- if (GD(e)) return !1;
27738
+ if (KD(e)) return !1;
27737
27739
  let t = (e.type || "").toLowerCase();
27738
27740
  if ([
27739
27741
  "hidden",
@@ -27742,32 +27744,32 @@ function XD() {
27742
27744
  "image"
27743
27745
  ].includes(t) || e.disabled || e.readOnly) return !1;
27744
27746
  try {
27745
- let t = KD(e);
27747
+ let t = qD(e);
27746
27748
  if (t.display === "none" || t.visibility === "hidden") return !1;
27747
27749
  } catch {}
27748
27750
  return !0;
27749
27751
  }));
27750
27752
  }), e;
27751
27753
  }
27752
- function ZD() {
27753
- return XD().map((e, t) => ({
27754
+ function QD() {
27755
+ return ZD().map((e, t) => ({
27754
27756
  formIndex: 0,
27755
27757
  fieldIndex: t,
27756
27758
  tag: e.tagName,
27757
27759
  type: e.type || "text",
27758
27760
  name: e.name || null,
27759
27761
  id: e.id || null,
27760
- label: YD(e),
27762
+ label: XD(e),
27761
27763
  placeholder: e.placeholder || null
27762
27764
  }));
27763
27765
  }
27764
- function QD() {
27766
+ function $D() {
27765
27767
  let e = [];
27766
- return qD((t) => {
27768
+ return JD((t) => {
27767
27769
  e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
27768
- if (GD(e) || e.disabled) return !1;
27770
+ if (KD(e) || e.disabled) return !1;
27769
27771
  try {
27770
- let t = KD(e);
27772
+ let t = qD(e);
27771
27773
  if (t.display === "none" || t.visibility === "hidden") return !1;
27772
27774
  } catch {}
27773
27775
  return !0;
@@ -27779,15 +27781,15 @@ function QD() {
27779
27781
  type: e.type || e.tagName
27780
27782
  }));
27781
27783
  }
27782
- function $D(e) {
27784
+ function eO(e) {
27783
27785
  return String(e || "").toLowerCase().replace(/\u00a0/g, " ").replace(/\*/g, "").replace(/\s+/g, " ").trim();
27784
27786
  }
27785
- function eO(e) {
27786
- let t = $D(e);
27787
+ function tO(e) {
27788
+ let t = eO(e);
27787
27789
  return t = t.replace(/\s+field\s*$/i, "").trim(), t;
27788
27790
  }
27789
- function tO(e, t) {
27790
- let n = eO(t);
27791
+ function nO(e, t) {
27792
+ let n = tO(t);
27791
27793
  if (!n) return 0;
27792
27794
  let r = (e.name || "").toLowerCase(), i = (e.id || "").toLowerCase();
27793
27795
  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;
@@ -27795,12 +27797,12 @@ function tO(e, t) {
27795
27797
  e.name,
27796
27798
  e.id,
27797
27799
  e.placeholder,
27798
- YD(e),
27800
+ XD(e),
27799
27801
  e.getAttribute("aria-label"),
27800
27802
  e.getAttribute("title"),
27801
27803
  e.getAttribute("data-testid"),
27802
27804
  e.getAttribute("autocomplete")
27803
- ].filter(Boolean).map((e) => $D(e)), o = 0;
27805
+ ].filter(Boolean).map((e) => eO(e)), o = 0;
27804
27806
  for (let e of a) {
27805
27807
  if (!e) continue;
27806
27808
  if (e.includes(n) || n.includes(e)) {
@@ -27815,16 +27817,16 @@ function tO(e, t) {
27815
27817
  }
27816
27818
  return o;
27817
27819
  }
27818
- var nO = 28;
27819
- function rO(e, t) {
27820
+ var rO = 28;
27821
+ function iO(e, t) {
27820
27822
  let n = null, r = 0;
27821
27823
  for (let i of e) {
27822
- let e = tO(i, t);
27824
+ let e = nO(i, t);
27823
27825
  e > r && (r = e, n = i);
27824
27826
  }
27825
- return !n || r < nO ? null : n;
27827
+ return !n || r < rO ? null : n;
27826
27828
  }
27827
- function iO(e, t, n) {
27829
+ function aO(e, t, n) {
27828
27830
  let r = String(t || "").toLowerCase().trim(), i = String(n || "").trim();
27829
27831
  if (!(/^https?:\/\//i.test(i) || /\.\w{2,}(\/|\s|$)/.test(i) || r.includes("url") || r.includes("website") || r.includes("domain") || r.includes("site"))) return null;
27830
27832
  let a = null, o = 0;
@@ -27844,7 +27846,7 @@ function iO(e, t, n) {
27844
27846
  t.name,
27845
27847
  t.id,
27846
27848
  t.placeholder,
27847
- YD(t),
27849
+ XD(t),
27848
27850
  t.getAttribute("aria-label"),
27849
27851
  t.getAttribute("autocomplete")
27850
27852
  ].filter(Boolean).join(" ").toLowerCase();
@@ -27852,15 +27854,15 @@ function iO(e, t, n) {
27852
27854
  }
27853
27855
  return !a || o < 42 ? null : a;
27854
27856
  }
27855
- function aO(e) {
27857
+ function oO(e) {
27856
27858
  let t = String(e ?? "").trim();
27857
27859
  return t ? /^https?:\/\//i.test(t) ? !0 : /\.\w{2,}(\/|\s|$)/.test(t) : !1;
27858
27860
  }
27859
- function oO(e) {
27861
+ function sO(e) {
27860
27862
  let t = String(e ?? "").toLowerCase().trim();
27861
27863
  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;
27862
27864
  }
27863
- function sO(e) {
27865
+ function cO(e) {
27864
27866
  if (!e || e.tagName !== "INPUT" && e.tagName !== "TEXTAREA") return !1;
27865
27867
  let t = (e.type || "").toLowerCase();
27866
27868
  return ![
@@ -27872,22 +27874,22 @@ function sO(e) {
27872
27874
  "file"
27873
27875
  ].includes(t);
27874
27876
  }
27875
- function cO(e) {
27876
- if (!sO(e)) return !1;
27877
+ function lO(e) {
27878
+ if (!cO(e)) return !1;
27877
27879
  let t = (e.name || "").toLowerCase(), n = (e.id || "").toLowerCase(), r = [
27878
27880
  e.name,
27879
27881
  e.id,
27880
27882
  e.placeholder,
27881
- YD(e),
27883
+ XD(e),
27882
27884
  e.getAttribute("aria-label")
27883
27885
  ].filter(Boolean).join(" ").toLowerCase();
27884
27886
  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);
27885
27887
  }
27886
- function lO(e, t, n) {
27887
- let r = String(t ?? ""), i = String(n ?? ""), a = fO(e, r) || rO(e, r) || iO(e, r, i);
27888
+ function uO(e, t, n) {
27889
+ let r = String(t ?? ""), i = String(n ?? ""), a = pO(e, r) || iO(e, r) || aO(e, r, i);
27888
27890
  if (!a) return [];
27889
27891
  let o = new Set([a]);
27890
- if (aO(i) && oO(r)) for (let t of e) t !== a && cO(t) && o.add(t);
27892
+ if (oO(i) && sO(r)) for (let t of e) t !== a && lO(t) && o.add(t);
27891
27893
  let s = Array.from(o);
27892
27894
  return s.sort((e, t) => {
27893
27895
  if (e === t) return 0;
@@ -27895,7 +27897,7 @@ function lO(e, t, n) {
27895
27897
  return n & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
27896
27898
  }), s;
27897
27899
  }
27898
- function uO(e, t) {
27900
+ function dO(e, t) {
27899
27901
  try {
27900
27902
  if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
27901
27903
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
@@ -27910,17 +27912,17 @@ function uO(e, t) {
27910
27912
  return Infinity;
27911
27913
  }
27912
27914
  }
27913
- function dO(e) {
27915
+ function fO(e) {
27914
27916
  if (!e || typeof e != "string") return null;
27915
27917
  let t = null;
27916
- return qD((n) => {
27918
+ return JD((n) => {
27917
27919
  try {
27918
27920
  let r = n.getElementById(e);
27919
- r && !GD(r) && r.matches?.("input, select, textarea") && (t = r);
27921
+ r && !KD(r) && r.matches?.("input, select, textarea") && (t = r);
27920
27922
  } catch {}
27921
27923
  }), t;
27922
27924
  }
27923
- function fO(e, t) {
27925
+ function pO(e, t) {
27924
27926
  let n = String(t ?? "").trim();
27925
27927
  if (!n) return null;
27926
27928
  let r = n.match(/^name:\s*([\w.-]+)$/i);
@@ -27930,12 +27932,12 @@ function fO(e, t) {
27930
27932
  }
27931
27933
  let i = n.match(/^id:\s*([\w.-]+)$/i);
27932
27934
  if (i) {
27933
- let e = dO(i[1]);
27935
+ let e = fO(i[1]);
27934
27936
  if (e) return e;
27935
27937
  }
27936
27938
  let a = n.startsWith("#") ? n.slice(1) : n;
27937
27939
  if (/^[\w-]+$/.test(a)) {
27938
- let e = dO(a);
27940
+ let e = fO(a);
27939
27941
  if (e) return e;
27940
27942
  }
27941
27943
  let o = n.toLowerCase().replace(/\s+/g, " ");
@@ -27945,7 +27947,7 @@ function fO(e, t) {
27945
27947
  }
27946
27948
  return null;
27947
27949
  }
27948
- function pO(e, t) {
27950
+ function mO(e, t) {
27949
27951
  let n = String(t || "").toLowerCase().trim();
27950
27952
  if (!n) return 0;
27951
27953
  let r = [
@@ -27961,13 +27963,13 @@ function pO(e, t) {
27961
27963
  for (let e of i) r.includes(e) && (a += 1);
27962
27964
  return a / i.length * 92;
27963
27965
  }
27964
- function mO(e, t) {
27966
+ function hO(e, t) {
27965
27967
  let n = [];
27966
- qD((e) => {
27968
+ JD((e) => {
27967
27969
  n.push(...Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
27968
- if (GD(e) || e.disabled) return !1;
27970
+ if (KD(e) || e.disabled) return !1;
27969
27971
  try {
27970
- let t = KD(e);
27972
+ let t = qD(e);
27971
27973
  if (t.display === "none" || t.visibility === "hidden") return !1;
27972
27974
  } catch {}
27973
27975
  return !0;
@@ -27975,7 +27977,7 @@ function mO(e, t) {
27975
27977
  });
27976
27978
  let r = 0, i = n.map((t) => ({
27977
27979
  el: t,
27978
- s: pO(t, e)
27980
+ s: mO(t, e)
27979
27981
  }));
27980
27982
  for (let { s: e } of i) e > r && (r = e);
27981
27983
  if (r < 36) return null;
@@ -27985,14 +27987,14 @@ function mO(e, t) {
27985
27987
  if (o.length) {
27986
27988
  let e = a[0], t = Infinity;
27987
27989
  for (let n of a) for (let r of o) {
27988
- let i = uO(n, r);
27990
+ let i = dO(n, r);
27989
27991
  i < t && (t = i, e = n);
27990
27992
  }
27991
27993
  return e;
27992
27994
  }
27993
27995
  return a[0];
27994
27996
  }
27995
- function hO(e) {
27997
+ function gO(e) {
27996
27998
  if (e == null) return {};
27997
27999
  if (typeof e == "string") {
27998
28000
  let t = e.trim();
@@ -28005,8 +28007,8 @@ function hO(e) {
28005
28007
  }
28006
28008
  return e;
28007
28009
  }
28008
- function gO(e) {
28009
- let t = hO(e);
28010
+ function _O(e) {
28011
+ let t = gO(e);
28010
28012
  if (Array.isArray(t) && t.length > 0) {
28011
28013
  let e = t[0];
28012
28014
  if (e?.field_key != null || e?.fieldKey != null) return t.map((e) => ({
@@ -28034,7 +28036,7 @@ function gO(e) {
28034
28036
  value: e?.value ?? e?.Value
28035
28037
  })) : [];
28036
28038
  }
28037
- function _O(e) {
28039
+ function vO(e) {
28038
28040
  if (!e || typeof e != "string") return [];
28039
28041
  let t = e.trim();
28040
28042
  if (!t || /\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\b/i.test(t)) return [];
@@ -28053,7 +28055,7 @@ function _O(e) {
28053
28055
  }
28054
28056
  return [];
28055
28057
  }
28056
- function vO(e) {
28058
+ function yO(e) {
28057
28059
  if (!e || typeof e != "string") return [];
28058
28060
  let t = e.trim();
28059
28061
  if (!t) return [];
@@ -28089,17 +28091,17 @@ function vO(e) {
28089
28091
  }
28090
28092
  return n;
28091
28093
  }
28092
- function yO(e) {
28094
+ function bO(e) {
28093
28095
  if (!e || typeof e != "object") return null;
28094
28096
  let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
28095
28097
  return t == null ? null : String(t).trim() || null;
28096
28098
  }
28097
- function bO(e) {
28099
+ function xO(e) {
28098
28100
  if (!e || typeof e != "object") return null;
28099
28101
  let t = e.query ?? e.q ?? e.search ?? e.text ?? e.keywords;
28100
28102
  return t == null ? null : String(t).trim() || null;
28101
28103
  }
28102
- function xO(e, t, n) {
28104
+ function SO(e, t, n) {
28103
28105
  if (!n?.skipScroll) try {
28104
28106
  e.scrollIntoView({
28105
28107
  block: "center",
@@ -28154,7 +28156,7 @@ function xO(e, t, n) {
28154
28156
  } catch {}
28155
28157
  return !0;
28156
28158
  }
28157
- function SO() {
28159
+ function CO() {
28158
28160
  let e = {};
28159
28161
  document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
28160
28162
  if (t.id) return;
@@ -28169,11 +28171,11 @@ function SO() {
28169
28171
  e[r] = !0, t.id = r;
28170
28172
  });
28171
28173
  }
28172
- function CO(e) {
28174
+ function wO(e) {
28173
28175
  let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
28174
28176
  flowengage_navigate: async (n) => {
28175
28177
  $("flowengage_navigate ▶ raw parameters:", n);
28176
- let r = hO(n), i = yO(r), a = r.section_text ?? r.sectionText ?? r.section;
28178
+ let r = gO(n), i = bO(r), a = r.section_text ?? r.sectionText ?? r.section;
28177
28179
  if ($("flowengage_navigate · coerced:", {
28178
28180
  url: i,
28179
28181
  sectionText: a
@@ -28189,38 +28191,38 @@ function CO(e) {
28189
28191
  return $("flowengage_navigate ✖ blocked", e), e;
28190
28192
  }
28191
28193
  try {
28192
- if (wD(`Navigating to ${i}...`, { spinner: !0 }), kD(), jE(), LE(), $("flowengage_navigate → shadowNavigate", i), await On(i), await UD(400), SO(), a && typeof a == "string") {
28194
+ if (TD(`Navigating to ${i}...`, { spinner: !0 }), AD(), ME(), RE(), $("flowengage_navigate → shadowNavigate", i), await On(i), await WD(400), CO(), a && typeof a == "string") {
28193
28195
  let e = xn(null, a);
28194
- e && CE(() => IE(e)), $("flowengage_navigate · highlight", {
28196
+ e && CE(() => LE(e)), $("flowengage_navigate · highlight", {
28195
28197
  sectionText: a,
28196
28198
  found: !!e
28197
28199
  });
28198
28200
  }
28199
28201
  let e = `OK_NAVIGATION ${i}`;
28200
- return $("flowengage_navigate ✓", e), wD("Navigation complete", {
28202
+ return $("flowengage_navigate ✓", e), TD("Navigation complete", {
28201
28203
  spinner: !1,
28202
28204
  icon: "✅",
28203
28205
  duration: 1200
28204
28206
  }), e;
28205
28207
  } catch (e) {
28206
28208
  let t = `Navigation error: ${e?.message || String(e)}`;
28207
- return $("flowengage_navigate ✖", t), wD("Navigation failed", {
28209
+ return $("flowengage_navigate ✖", t), TD("Navigation failed", {
28208
28210
  spinner: !1,
28209
28211
  icon: "⚠️",
28210
28212
  duration: 1800
28211
28213
  }), t;
28212
28214
  } finally {
28213
- AD(), TD(900);
28215
+ jD(), ED(900);
28214
28216
  }
28215
28217
  },
28216
28218
  flowengage_highlight: async (e) => {
28217
28219
  $("flowengage_highlight ▶", e);
28218
- let t = hO(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i = xn(n || null, r || null);
28219
- return i ? (IE(i), $("flowengage_highlight ✓"), "Highlighted the section.") : ($("flowengage_highlight ✖ no element"), "Could not find that section on the page.");
28220
+ let t = gO(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i = xn(n || null, r || null);
28221
+ return i ? (LE(i), $("flowengage_highlight ✓"), "Highlighted the section.") : ($("flowengage_highlight ✖ no element"), "Could not find that section on the page.");
28220
28222
  },
28221
28223
  flowengage_read_content: async (e) => {
28222
28224
  $("flowengage_read_content ▶", e);
28223
- let t = hO(e), n = t?.section_text || t?.sectionText || "";
28225
+ let t = gO(e), n = t?.section_text || t?.sectionText || "";
28224
28226
  try {
28225
28227
  let e = "";
28226
28228
  if (n) {
@@ -28243,7 +28245,7 @@ function CO(e) {
28243
28245
  },
28244
28246
  flowengage_search: async (e) => {
28245
28247
  $("flowengage_search ▶", e);
28246
- let r = bO(hO(e));
28248
+ let r = xO(gO(e));
28247
28249
  if ($("flowengage_search · query:", r, "siteId:", t, "apiBase:", n || "(empty)"), !r) return $("flowengage_search ✖ missing query"), "Missing query parameter.";
28248
28250
  if (!t) return $("flowengage_search ✖ no siteId"), "Site is not configured for search.";
28249
28251
  if (!n) return $("flowengage_search ✖ no api base"), "API base URL is missing; cannot search.";
@@ -28272,7 +28274,7 @@ function CO(e) {
28272
28274
  },
28273
28275
  flowengage_page_content: async (e) => {
28274
28276
  $("flowengage_page_content ▶", e);
28275
- let r = hO(e), i = r?.url || r?.page_url || "";
28277
+ let r = gO(e), i = r?.url || r?.page_url || "";
28276
28278
  if ($("flowengage_page_content · url:", i, "siteId:", t, "apiBase:", n || "(empty)"), !i) return $("flowengage_page_content ✖ missing url"), "Missing url parameter.";
28277
28279
  if (!t) return $("flowengage_page_content ✖ no siteId"), "Site is not configured.";
28278
28280
  if (!n) return $("flowengage_page_content ✖ no api base"), "API base URL is missing; cannot fetch page content.";
@@ -28304,7 +28306,7 @@ function CO(e) {
28304
28306
  },
28305
28307
  flowengage_end_session: async () => ($("flowengage_end_session ▶"), typeof e.requestEndSession == "function" && e.requestEndSession(), "Voice session is ending."),
28306
28308
  flowengage_list_forms: async () => {
28307
- let e = ZD(), t = QD();
28309
+ let e = QD(), t = $D();
28308
28310
  return $("flowengage_list_forms ✓", `${e.length} field(s)`, `${t.length} button(s)`), JSON.stringify({
28309
28311
  fields: e,
28310
28312
  buttons: t,
@@ -28313,52 +28315,52 @@ function CO(e) {
28313
28315
  },
28314
28316
  flowengage_fill_form: async (e) => {
28315
28317
  try {
28316
- $("flowengage_fill_form ▶ raw:", e), jD();
28317
- let t = gO(e);
28318
+ $("flowengage_fill_form ▶ raw:", e), MD();
28319
+ let t = _O(e);
28318
28320
  if (!t.length && r) {
28319
- let e = r(), n = _O(e);
28320
- n.length ? $("flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):", n) : (n = vO(e), n.length && $("flowengage_fill_form · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
28321
+ let e = r(), n = vO(e);
28322
+ n.length ? $("flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):", n) : (n = yO(e), n.length && $("flowengage_fill_form · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
28321
28323
  }
28322
28324
  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.";
28323
28325
  let n = [];
28324
28326
  for (let e of t) {
28325
28327
  let t = e?.field_key ?? e?.fieldKey, r = e?.value;
28326
28328
  if (t == null || r == null) continue;
28327
- wD(`Filling ${String(t)}...`, { spinner: !0 });
28328
- let a = XD(), o = lO(a, String(t), r);
28329
+ TD(`Filling ${String(t)}...`, { spinner: !0 });
28330
+ let a = ZD(), o = uO(a, String(t), r);
28329
28331
  if (o.length) {
28330
- for (let [e, t] of o.entries()) MD(t), await RD(t), xO(t, r, { skipScroll: e > 0 }), ND(t), await UD(120);
28332
+ for (let [e, t] of o.entries()) ND(t), await zD(t), SO(t, r, { skipScroll: e > 0 }), PD(t), await WD(120);
28331
28333
  i = o, n.push(String(t));
28332
28334
  continue;
28333
28335
  }
28334
- let s = fO(a, String(t));
28335
- s ||= rO(a, String(t)), s ||= iO(a, String(t), r), s && (MD(s), await RD(s), xO(s, r), ND(s), await UD(120), i = [s], n.push(String(t)));
28336
+ let s = pO(a, String(t));
28337
+ s ||= iO(a, String(t)), s ||= aO(a, String(t), r), s && (ND(s), await zD(s), SO(s, r), PD(s), await WD(120), i = [s], n.push(String(t)));
28336
28338
  }
28337
28339
  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.";
28338
28340
  let a = `OK_FILLED: ${n.join(", ")}`;
28339
- return $("flowengage_fill_form ✓", a), wD("Form filled", {
28341
+ return $("flowengage_fill_form ✓", a), TD("Form filled", {
28340
28342
  spinner: !1,
28341
28343
  icon: "✅",
28342
28344
  duration: 1100
28343
28345
  }), a;
28344
28346
  } catch (e) {
28345
28347
  let t = `flowengage_fill_form error: ${e?.message || String(e)}`;
28346
- return $("flowengage_fill_form ✖", t), wD("Failed to fill form", {
28348
+ return $("flowengage_fill_form ✖", t), TD("Failed to fill form", {
28347
28349
  spinner: !1,
28348
28350
  icon: "⚠️",
28349
28351
  duration: 1800
28350
28352
  }), t;
28351
28353
  } finally {
28352
- zD(), jD(), TD(700);
28354
+ BD(), MD(), ED(700);
28353
28355
  }
28354
28356
  },
28355
28357
  flowengage_click_button: async (e) => {
28356
- let t = hO(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
28358
+ let t = gO(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
28357
28359
  if ($("flowengage_click_button ▶", n), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
28358
- let r = mO(n, i);
28360
+ let r = hO(n, i);
28359
28361
  if (!r) return $("flowengage_click_button ✖ no match"), `Could not find a button matching "${n}". Call flowengage_list_forms to see button texts.`;
28360
28362
  try {
28361
- wD(`Clicking ${n}...`, { spinner: !0 });
28363
+ TD(`Clicking ${n}...`, { spinner: !0 });
28362
28364
  try {
28363
28365
  r.scrollIntoView({
28364
28366
  block: "center",
@@ -28367,22 +28369,22 @@ function CO(e) {
28367
28369
  } catch {
28368
28370
  r.scrollIntoView(!0);
28369
28371
  }
28370
- await RD(r), r.focus?.(), await BD(r), VD(r), r.click();
28372
+ await zD(r), r.focus?.(), await VD(r), HD(r), r.click();
28371
28373
  let e = (r.textContent || r.value || r.getAttribute("aria-label") || "").trim().slice(0, 80) || "button", t = `OK_CLICK ${e}`;
28372
- return $("flowengage_click_button ✓", t), wD(`Clicked ${e}`, {
28374
+ return $("flowengage_click_button ✓", t), TD(`Clicked ${e}`, {
28373
28375
  spinner: !1,
28374
28376
  icon: "✅",
28375
28377
  duration: 1200
28376
28378
  }), t;
28377
28379
  } catch (e) {
28378
28380
  let t = `Click failed: ${e?.message || String(e)}`;
28379
- return $("flowengage_click_button ✖", t), wD("Click failed", {
28381
+ return $("flowengage_click_button ✖", t), TD("Click failed", {
28380
28382
  spinner: !1,
28381
28383
  icon: "⚠️",
28382
28384
  duration: 1800
28383
28385
  }), t;
28384
28386
  } finally {
28385
- zD(), TD(700);
28387
+ BD(), ED(700);
28386
28388
  }
28387
28389
  }
28388
28390
  };
@@ -28400,7 +28402,7 @@ function CO(e) {
28400
28402
  }
28401
28403
  //#endregion
28402
28404
  //#region src/utils/wrapVoiceToolsForLogging.js
28403
- function wO(e) {
28405
+ function TO(e) {
28404
28406
  return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
28405
28407
  let r = mn();
28406
28408
  r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
@@ -28417,7 +28419,7 @@ function wO(e) {
28417
28419
  }
28418
28420
  //#endregion
28419
28421
  //#region src/components/FlowEngageWidget.jsx
28420
- var TO = {
28422
+ var EO = {
28421
28423
  blue: "#135bd8",
28422
28424
  red: "#ef334b",
28423
28425
  yellow: "#ffbd2e",
@@ -28425,7 +28427,7 @@ var TO = {
28425
28427
  highlight: "rgba(255,255,255,0.9)",
28426
28428
  green: "#10b981"
28427
28429
  };
28428
- function EO(e) {
28430
+ function DO(e) {
28429
28431
  if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
28430
28432
  let [t, n, r] = e;
28431
28433
  return e.length >= 3 && r ? [
@@ -28439,12 +28441,12 @@ function EO(e) {
28439
28441
  "#f7f8fa"
28440
28442
  ].join(", ");
28441
28443
  }
28442
- function DO(e) {
28444
+ function OO(e) {
28443
28445
  if (!e || typeof e != "string") return "#1a1a1a";
28444
28446
  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;
28445
28447
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
28446
28448
  }
28447
- function OO({ logo: t, style: n }) {
28449
+ function kO({ logo: t, style: n }) {
28448
28450
  if (!t) return null;
28449
28451
  if (typeof t == "string") return /* @__PURE__ */ g("img", {
28450
28452
  src: t,
@@ -28469,7 +28471,7 @@ function OO({ logo: t, style: n }) {
28469
28471
  children: r
28470
28472
  }) : null;
28471
28473
  }
28472
- function kO({ title: e }) {
28474
+ function AO({ title: e }) {
28473
28475
  return /* @__PURE__ */ g("div", {
28474
28476
  style: {
28475
28477
  width: "100%",
@@ -28487,18 +28489,18 @@ function kO({ title: e }) {
28487
28489
  children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
28488
28490
  });
28489
28491
  }
28490
- function AO(e, t) {
28492
+ function jO(e, t) {
28491
28493
  let n = (t || "").trim();
28492
28494
  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;
28493
28495
  }
28494
- function jO({ orbColors: e, ...t }) {
28495
- return /* @__PURE__ */ g(yD, {
28496
+ function MO({ orbColors: e, ...t }) {
28497
+ return /* @__PURE__ */ g(bD, {
28496
28498
  colors: e,
28497
28499
  ...t
28498
28500
  });
28499
28501
  }
28500
- function MO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a }) {
28501
- let o = n || TO.green, s = DO(o), c = a ? 72 : 94, l = /* @__PURE__ */ _("div", {
28502
+ function NO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a }) {
28503
+ let o = n || EO.green, s = OO(o), c = a ? 72 : 94, l = /* @__PURE__ */ _("div", {
28502
28504
  style: {
28503
28505
  display: "flex",
28504
28506
  alignItems: "center",
@@ -28615,7 +28617,7 @@ function MO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
28615
28617
  delay: 0
28616
28618
  },
28617
28619
  style: { flexShrink: 0 },
28618
- children: /* @__PURE__ */ g(jO, {
28620
+ children: /* @__PURE__ */ g(MO, {
28619
28621
  size: c,
28620
28622
  orbColors: t
28621
28623
  })
@@ -28643,8 +28645,8 @@ function MO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
28643
28645
  children: l
28644
28646
  }) : l] });
28645
28647
  }
28646
- function NO({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a }) {
28647
- let o = n || TO.green, s = DO(o);
28648
+ function PO({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a }) {
28649
+ let o = n || EO.green, s = OO(o);
28648
28650
  return /* @__PURE__ */ _(Tp.div, {
28649
28651
  initial: {
28650
28652
  scale: 50 / 300,
@@ -28708,7 +28710,7 @@ function NO({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
28708
28710
  children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
28709
28711
  })
28710
28712
  }),
28711
- /* @__PURE__ */ g(jO, {
28713
+ /* @__PURE__ */ g(MO, {
28712
28714
  size: 82,
28713
28715
  orbColors: t
28714
28716
  }),
@@ -28777,7 +28779,7 @@ function NO({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
28777
28779
  ]
28778
28780
  });
28779
28781
  }
28780
- function PO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, historyRef: s, onMessageSync: l }) {
28782
+ function FO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, historyRef: s, onMessageSync: l }) {
28781
28783
  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") => {
28782
28784
  ne.current = e, te.current = !0, queueMicrotask(() => {
28783
28785
  w.current || (w.current = !0, C.current?.());
@@ -28800,8 +28802,8 @@ function PO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
28800
28802
  }
28801
28803
  try {
28802
28804
  if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
28803
- s.current = [], S.current = "", w.current = !1, ee.current = !1, te.current = !1, ne.current = "minimized", kE(!0), jE();
28804
- let t = wO(CO({
28805
+ s.current = [], S.current = "", w.current = !1, ee.current = !1, te.current = !1, ne.current = "minimized", AE(!0), ME();
28806
+ let t = TO(wO({
28805
28807
  siteId: i || null,
28806
28808
  apiBaseUrl: a || null,
28807
28809
  getLastUserVoiceText: () => S.current,
@@ -28818,11 +28820,11 @@ function PO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
28818
28820
  onMessage: (t) => {
28819
28821
  if (e) return;
28820
28822
  let n = t.role === "user" ? "user" : "bot", r = t.message || t.text || t.content || "";
28821
- r && (n === "user" && (S.current = r, jE(), LE()), n === "bot" && (zE(r, !0), DE(r.trim().split(/\s+/).length)), s.current = [...s.current, {
28823
+ r && (n === "user" && (S.current = r, ME(), RE()), n === "bot" && (BE(r, !0), DE(r.trim().split(/\s+/).length)), s.current = [...s.current, {
28822
28824
  sender: n,
28823
28825
  message: r,
28824
28826
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
28825
- }], AO(n, r) && E("minimized"));
28827
+ }], jO(n, r) && E("minimized"));
28826
28828
  },
28827
28829
  onError: (t) => {
28828
28830
  if (!e && !te.current && !ee.current) {
@@ -28847,7 +28849,7 @@ function PO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
28847
28849
  try {
28848
28850
  x.current?.setMicMuted?.(!0);
28849
28851
  } catch {}
28850
- v(!0), jE(), LE(), kE(!1), E("chat");
28852
+ v(!0), ME(), RE(), AE(!1), E("chat");
28851
28853
  }
28852
28854
  }
28853
28855
  });
@@ -28909,7 +28911,7 @@ function PO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
28909
28911
  whiteSpace: "nowrap"
28910
28912
  },
28911
28913
  children: "Listening..."
28912
- }), /* @__PURE__ */ g(jO, {
28914
+ }), /* @__PURE__ */ g(MO, {
28913
28915
  size: 94,
28914
28916
  voiceState: u,
28915
28917
  isMuted: f,
@@ -29151,7 +29153,7 @@ function PO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
29151
29153
  ]
29152
29154
  }) });
29153
29155
  }
29154
- function FO({ orbColors: e }) {
29156
+ function IO({ orbColors: e }) {
29155
29157
  return /* @__PURE__ */ g("div", {
29156
29158
  style: {
29157
29159
  flexShrink: 0,
@@ -29161,13 +29163,13 @@ function FO({ orbColors: e }) {
29161
29163
  alignItems: "center",
29162
29164
  justifyContent: "center"
29163
29165
  },
29164
- children: /* @__PURE__ */ g(jO, {
29166
+ children: /* @__PURE__ */ g(MO, {
29165
29167
  size: 36,
29166
29168
  orbColors: e
29167
29169
  })
29168
29170
  });
29169
29171
  }
29170
- var IO = () => /* @__PURE__ */ g("div", {
29172
+ var LO = () => /* @__PURE__ */ g("div", {
29171
29173
  style: {
29172
29174
  display: "flex",
29173
29175
  marginBottom: "12px",
@@ -29197,7 +29199,7 @@ var IO = () => /* @__PURE__ */ g("div", {
29197
29199
  } }, e))
29198
29200
  })
29199
29201
  });
29200
- function LO({ 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 }) {
29202
+ function RO({ 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 }) {
29201
29203
  let Oe = l.length > 0, ke = w || T || C, Ae = !!(he || ve), [je, Me] = m(!1), Ne = p(null);
29202
29204
  return c(() => {
29203
29205
  if (!je) return;
@@ -29299,7 +29301,7 @@ function LO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29299
29301
  justifyContent: "center",
29300
29302
  height: "40px"
29301
29303
  },
29302
- children: i ? /* @__PURE__ */ g(OO, {
29304
+ children: i ? /* @__PURE__ */ g(kO, {
29303
29305
  logo: i,
29304
29306
  style: {
29305
29307
  height: "34px",
@@ -29312,7 +29314,7 @@ function LO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29312
29314
  height: "40px",
29313
29315
  flexShrink: 0
29314
29316
  },
29315
- children: /* @__PURE__ */ g(kO, { title: e.chatTitle })
29317
+ children: /* @__PURE__ */ g(AO, { title: e.chatTitle })
29316
29318
  })
29317
29319
  }), /* @__PURE__ */ g("div", {
29318
29320
  style: {
@@ -29498,7 +29500,7 @@ function LO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29498
29500
  })
29499
29501
  ]
29500
29502
  }),
29501
- /* @__PURE__ */ g(uD, {
29503
+ /* @__PURE__ */ g(dD, {
29502
29504
  webRTCError: de,
29503
29505
  micError: fe,
29504
29506
  setMicError: pe,
@@ -29526,16 +29528,16 @@ function LO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29526
29528
  minHeight: 0,
29527
29529
  background: "transparent"
29528
29530
  },
29529
- children: Oe ? /* @__PURE__ */ g(oD, {
29531
+ children: Oe ? /* @__PURE__ */ g(sD, {
29530
29532
  chatHistory: l,
29531
29533
  isAiTyping: u,
29532
29534
  isAgentTyping: d,
29533
29535
  setReplyContext: ue,
29534
- TypingDots: IO,
29536
+ TypingDots: LO,
29535
29537
  primaryColor: n,
29536
29538
  agentHeadshot: v,
29537
29539
  agentDisplayName: h || y,
29538
- botAvatarNode: /* @__PURE__ */ g(FO, { orbColors: t })
29540
+ botAvatarNode: /* @__PURE__ */ g(IO, { orbColors: t })
29539
29541
  }) : /* @__PURE__ */ _("div", {
29540
29542
  style: {
29541
29543
  flex: 1,
@@ -29548,7 +29550,7 @@ function LO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29548
29550
  padding: "28px 24px"
29549
29551
  },
29550
29552
  children: [
29551
- /* @__PURE__ */ g(jO, {
29553
+ /* @__PURE__ */ g(MO, {
29552
29554
  size: 94,
29553
29555
  orbColors: t
29554
29556
  }),
@@ -29606,7 +29608,7 @@ function LO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29606
29608
  zIndex: 1,
29607
29609
  padding: ae ? "6px 0 0" : "12px 0 0"
29608
29610
  },
29609
- children: /* @__PURE__ */ g(sD, {
29611
+ children: /* @__PURE__ */ g(cD, {
29610
29612
  input: b,
29611
29613
  setInput: x,
29612
29614
  onSubmit: S,
@@ -29656,7 +29658,7 @@ function LO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29656
29658
  ]
29657
29659
  });
29658
29660
  }
29659
- function RO() {
29661
+ function zO() {
29660
29662
  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();
29661
29663
  c(() => {
29662
29664
  try {
@@ -29669,7 +29671,7 @@ function RO() {
29669
29671
  }, Ce = {
29670
29672
  ...be.theme || {},
29671
29673
  ...xe.theme || {}
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 = EO(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) => ({
29674
+ }, 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 = DO(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) => ({
29673
29675
  id: e.key || `qr-${t}`,
29674
29676
  label: e.label,
29675
29677
  message: e.label,
@@ -29706,7 +29708,7 @@ function RO() {
29706
29708
  let pt = o(() => {
29707
29709
  it(null), ot("");
29708
29710
  }, []), mt = o((e) => {
29709
- let t = tD(e);
29711
+ let t = nD(e);
29710
29712
  if (t) {
29711
29713
  it(null), ot(t);
29712
29714
  return;
@@ -29790,7 +29792,7 @@ function RO() {
29790
29792
  if (rt) {
29791
29793
  try {
29792
29794
  ct(!0), ot("");
29793
- let e = await se(rt), n = e?.data || e, r = Je.trim() || `Shared file: ${rD(rt)}`;
29795
+ let e = await se(rt), n = e?.data || e, r = Je.trim() || `Shared file: ${iD(rt)}`;
29794
29796
  O(""), A(null), pt(), await oe(r, "", t, {
29795
29797
  type: "file",
29796
29798
  metadata: {
@@ -29841,7 +29843,7 @@ function RO() {
29841
29843
  ...yt
29842
29844
  },
29843
29845
  children: [
29844
- Ke === "entry_prompt" && /* @__PURE__ */ g(MO, {
29846
+ Ke === "entry_prompt" && /* @__PURE__ */ g(NO, {
29845
29847
  copy: Le,
29846
29848
  orbColors: we,
29847
29849
  primaryColor: Te,
@@ -29862,13 +29864,13 @@ function RO() {
29862
29864
  transformOrigin: "bottom right",
29863
29865
  display: "inline-block"
29864
29866
  },
29865
- children: /* @__PURE__ */ g(jO, {
29867
+ children: /* @__PURE__ */ g(MO, {
29866
29868
  size: 50,
29867
29869
  orbColors: we,
29868
29870
  onClick: xt
29869
29871
  })
29870
29872
  }),
29871
- Ke === "connection_modal" && /* @__PURE__ */ g(NO, {
29873
+ Ke === "connection_modal" && /* @__PURE__ */ g(PO, {
29872
29874
  copy: Le,
29873
29875
  orbColors: we,
29874
29876
  primaryColor: Te,
@@ -29876,7 +29878,7 @@ function RO() {
29876
29878
  onText: Ct,
29877
29879
  onClose: bt
29878
29880
  }),
29879
- Ke === "voice_mode" && /* @__PURE__ */ g(PO, {
29881
+ Ke === "voice_mode" && /* @__PURE__ */ g(FO, {
29880
29882
  orbColors: we,
29881
29883
  onEnterChat: Ct,
29882
29884
  onEndChat: wt,
@@ -29886,7 +29888,7 @@ function RO() {
29886
29888
  historyRef: ie,
29887
29889
  onMessageSync: ae
29888
29890
  }, "voice"),
29889
- Ke === "text_chat" && /* @__PURE__ */ g(LO, {
29891
+ Ke === "text_chat" && /* @__PURE__ */ g(RO, {
29890
29892
  copy: Le,
29891
29893
  orbColors: we,
29892
29894
  primaryColor: Te,
@@ -29944,4 +29946,4 @@ function RO() {
29944
29946
  });
29945
29947
  }
29946
29948
  //#endregion
29947
- export { yD as AnimatedOrb, In as FlowEngageProvider, RO as FlowEngageWidget, pn as useFlowEngage };
29949
+ export { bD as AnimatedOrb, In as FlowEngageProvider, zO as FlowEngageWidget, pn as useFlowEngage };