@flowengage/react-chatbot 5.0.64 → 5.0.65

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.
@@ -214,9 +214,13 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
214
214
  if (!t) return null;
215
215
  let n = window.sessionStorage.getItem(t);
216
216
  if (!n) return null;
217
- window.sessionStorage.removeItem(t);
218
- let r = JSON.parse(n);
219
- return !r || typeof r.previousPage != "string" || Number.isFinite(r.ts) && Date.now() - r.ts > 6e4 || r.targetPath && (window.location.pathname.replace(/\/$/, "") || "/") !== (r.targetPath.replace(/\/$/, "") || "/") ? null : { previousPage: r.previousPage };
217
+ let r;
218
+ try {
219
+ r = JSON.parse(n);
220
+ } catch {
221
+ return window.sessionStorage.removeItem(t), null;
222
+ }
223
+ return !r || typeof r.previousPage != "string" || Number.isFinite(r.ts) && Date.now() - r.ts > 6e4 ? (window.sessionStorage.removeItem(t), null) : r.targetPath && (window.location.pathname.replace(/\/$/, "") || "/") !== (r.targetPath.replace(/\/$/, "") || "/") ? null : (window.sessionStorage.removeItem(t), { previousPage: r.previousPage });
220
224
  } catch {
221
225
  return null;
222
226
  }
@@ -28832,53 +28836,39 @@ function $(...e) {
28832
28836
  function WO(e) {
28833
28837
  return new Promise((t) => setTimeout(t, e));
28834
28838
  }
28835
- function GO(e = 10) {
28836
- if (typeof document > "u") return [];
28837
- try {
28838
- let t = /* @__PURE__ */ new Set(), n = [], r = document.querySelectorAll("h1, h2, h3");
28839
- for (let i of r) {
28840
- if (qO(i)) continue;
28841
- let r = (i.textContent || "").trim().replace(/\s+/g, " ");
28842
- if (!(!r || r.length < 3 || r.length > 120) && !t.has(r.toLowerCase()) && (t.add(r.toLowerCase()), n.push(r), n.length >= e)) break;
28843
- }
28844
- return n;
28845
- } catch {
28846
- return [];
28847
- }
28848
- }
28849
- var KO = "#flowengage-root, .flowengage-shell, .flowengage-widget-root";
28850
- function qO(e) {
28839
+ var GO = "#flowengage-root, .flowengage-shell, .flowengage-widget-root";
28840
+ function KO(e) {
28851
28841
  if (!e || typeof e.closest != "function") return !1;
28852
28842
  try {
28853
- return !!e.closest(KO);
28843
+ return !!e.closest(GO);
28854
28844
  } catch {
28855
28845
  return !1;
28856
28846
  }
28857
28847
  }
28858
- function JO(e) {
28848
+ function qO(e) {
28859
28849
  try {
28860
28850
  let t = e.ownerDocument?.defaultView;
28861
28851
  if (t) return t.getComputedStyle(e);
28862
28852
  } catch {}
28863
28853
  return window.getComputedStyle(e);
28864
28854
  }
28865
- function YO(e) {
28855
+ function JO(e) {
28866
28856
  let t = /* @__PURE__ */ new Set();
28867
28857
  function n(r) {
28868
28858
  if (!r || t.has(r)) return;
28869
28859
  t.add(r), e(r);
28870
28860
  let i = r.querySelectorAll("iframe");
28871
- for (let e of i) if (!qO(e)) try {
28861
+ for (let e of i) if (!KO(e)) try {
28872
28862
  let t = e.contentDocument;
28873
28863
  t && n(t);
28874
28864
  } catch {}
28875
28865
  }
28876
28866
  typeof document < "u" && n(document);
28877
28867
  }
28878
- function XO(e) {
28868
+ function YO(e) {
28879
28869
  return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
28880
28870
  }
28881
- function ZO(e) {
28871
+ function XO(e) {
28882
28872
  let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
28883
28873
  if (n) {
28884
28874
  let e = n.trim().split(/\s+/).filter(Boolean), r = [];
@@ -28886,42 +28876,42 @@ function ZO(e) {
28886
28876
  let e = t.getElementById(n);
28887
28877
  e?.textContent && r.push(e.textContent.trim());
28888
28878
  } catch {}
28889
- if (r.length) return XO(r.join(" "));
28879
+ if (r.length) return YO(r.join(" "));
28890
28880
  }
28891
- if (e.labels && e.labels.length) return XO(e.labels[0].textContent);
28881
+ if (e.labels && e.labels.length) return YO(e.labels[0].textContent);
28892
28882
  let r = e.id;
28893
28883
  if (r) try {
28894
28884
  let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
28895
- if (e) return XO(e.textContent);
28885
+ if (e) return YO(e.textContent);
28896
28886
  } catch {
28897
28887
  let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
28898
- if (e) return XO(e.textContent);
28888
+ if (e) return YO(e.textContent);
28899
28889
  }
28900
28890
  let i = e.previousElementSibling;
28901
28891
  for (let e = 0; e < 6 && i; e += 1) {
28902
- if (i.tagName === "LABEL") return XO(i.textContent);
28892
+ if (i.tagName === "LABEL") return YO(i.textContent);
28903
28893
  let e = (i.className || "").toString().toLowerCase();
28904
28894
  if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
28905
- let e = XO(i.textContent);
28895
+ let e = YO(i.textContent);
28906
28896
  if (e) return e;
28907
28897
  }
28908
28898
  i = i.previousElementSibling;
28909
28899
  }
28910
28900
  let a = e.parentElement;
28911
28901
  for (let e = 0; e < 5 && a; e += 1) {
28912
- if (a.tagName === "LABEL") return XO(a.textContent);
28902
+ if (a.tagName === "LABEL") return YO(a.textContent);
28913
28903
  let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
28914
- if (e?.textContent) return XO(e.textContent);
28904
+ if (e?.textContent) return YO(e.textContent);
28915
28905
  a = a.parentElement;
28916
28906
  }
28917
28907
  let o = e.getAttribute("aria-label");
28918
- return o ? XO(o) : null;
28908
+ return o ? YO(o) : null;
28919
28909
  }
28920
- function QO() {
28910
+ function ZO() {
28921
28911
  let e = [];
28922
- return YO((t) => {
28912
+ return JO((t) => {
28923
28913
  e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
28924
- if (qO(e)) return !1;
28914
+ if (KO(e)) return !1;
28925
28915
  let t = (e.type || "").toLowerCase();
28926
28916
  if ([
28927
28917
  "hidden",
@@ -28930,32 +28920,32 @@ function QO() {
28930
28920
  "image"
28931
28921
  ].includes(t) || e.disabled || e.readOnly) return !1;
28932
28922
  try {
28933
- let t = JO(e);
28923
+ let t = qO(e);
28934
28924
  if (t.display === "none" || t.visibility === "hidden") return !1;
28935
28925
  } catch {}
28936
28926
  return !0;
28937
28927
  }));
28938
28928
  }), e;
28939
28929
  }
28940
- function $O() {
28941
- return QO().map((e, t) => ({
28930
+ function QO() {
28931
+ return ZO().map((e, t) => ({
28942
28932
  formIndex: 0,
28943
28933
  fieldIndex: t,
28944
28934
  tag: e.tagName,
28945
28935
  type: e.type || "text",
28946
28936
  name: e.name || null,
28947
28937
  id: e.id || null,
28948
- label: ZO(e),
28938
+ label: XO(e),
28949
28939
  placeholder: e.placeholder || null
28950
28940
  }));
28951
28941
  }
28952
- function ek() {
28942
+ function $O() {
28953
28943
  let e = [];
28954
- return YO((t) => {
28944
+ return JO((t) => {
28955
28945
  e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
28956
- if (qO(e) || e.disabled) return !1;
28946
+ if (KO(e) || e.disabled) return !1;
28957
28947
  try {
28958
- let t = JO(e);
28948
+ let t = qO(e);
28959
28949
  if (t.display === "none" || t.visibility === "hidden") return !1;
28960
28950
  } catch {}
28961
28951
  return !0;
@@ -28967,15 +28957,15 @@ function ek() {
28967
28957
  type: e.type || e.tagName
28968
28958
  }));
28969
28959
  }
28970
- function tk(e) {
28960
+ function ek(e) {
28971
28961
  return String(e || "").toLowerCase().replace(/\u00a0/g, " ").replace(/\*/g, "").replace(/\s+/g, " ").trim();
28972
28962
  }
28973
- function nk(e) {
28974
- let t = tk(e);
28963
+ function tk(e) {
28964
+ let t = ek(e);
28975
28965
  return t = t.replace(/\s+field\s*$/i, "").trim(), t;
28976
28966
  }
28977
- function rk(e, t) {
28978
- let n = nk(t);
28967
+ function nk(e, t) {
28968
+ let n = tk(t);
28979
28969
  if (!n) return 0;
28980
28970
  let r = (e.name || "").toLowerCase(), i = (e.id || "").toLowerCase();
28981
28971
  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;
@@ -28983,12 +28973,12 @@ function rk(e, t) {
28983
28973
  e.name,
28984
28974
  e.id,
28985
28975
  e.placeholder,
28986
- ZO(e),
28976
+ XO(e),
28987
28977
  e.getAttribute("aria-label"),
28988
28978
  e.getAttribute("title"),
28989
28979
  e.getAttribute("data-testid"),
28990
28980
  e.getAttribute("autocomplete")
28991
- ].filter(Boolean).map((e) => tk(e)), o = 0;
28981
+ ].filter(Boolean).map((e) => ek(e)), o = 0;
28992
28982
  for (let e of a) {
28993
28983
  if (!e) continue;
28994
28984
  if (e.includes(n) || n.includes(e)) {
@@ -29003,16 +28993,16 @@ function rk(e, t) {
29003
28993
  }
29004
28994
  return o;
29005
28995
  }
29006
- var ik = 28;
29007
- function ak(e, t) {
28996
+ var rk = 28;
28997
+ function ik(e, t) {
29008
28998
  let n = null, r = 0;
29009
28999
  for (let i of e) {
29010
- let e = rk(i, t);
29000
+ let e = nk(i, t);
29011
29001
  e > r && (r = e, n = i);
29012
29002
  }
29013
- return !n || r < ik ? null : n;
29003
+ return !n || r < rk ? null : n;
29014
29004
  }
29015
- function ok(e, t, n) {
29005
+ function ak(e, t, n) {
29016
29006
  let r = String(t || "").toLowerCase().trim(), i = String(n || "").trim();
29017
29007
  if (!(/^https?:\/\//i.test(i) || /\.\w{2,}(\/|\s|$)/.test(i) || r.includes("url") || r.includes("website") || r.includes("domain") || r.includes("site"))) return null;
29018
29008
  let a = null, o = 0;
@@ -29032,7 +29022,7 @@ function ok(e, t, n) {
29032
29022
  t.name,
29033
29023
  t.id,
29034
29024
  t.placeholder,
29035
- ZO(t),
29025
+ XO(t),
29036
29026
  t.getAttribute("aria-label"),
29037
29027
  t.getAttribute("autocomplete")
29038
29028
  ].filter(Boolean).join(" ").toLowerCase();
@@ -29040,15 +29030,15 @@ function ok(e, t, n) {
29040
29030
  }
29041
29031
  return !a || o < 42 ? null : a;
29042
29032
  }
29043
- function sk(e) {
29033
+ function ok(e) {
29044
29034
  let t = String(e ?? "").trim();
29045
29035
  return t ? /^https?:\/\//i.test(t) ? !0 : /\.\w{2,}(\/|\s|$)/.test(t) : !1;
29046
29036
  }
29047
- function ck(e) {
29037
+ function sk(e) {
29048
29038
  let t = String(e ?? "").toLowerCase().trim();
29049
29039
  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;
29050
29040
  }
29051
- function lk(e) {
29041
+ function ck(e) {
29052
29042
  if (!e || e.tagName !== "INPUT" && e.tagName !== "TEXTAREA") return !1;
29053
29043
  let t = (e.type || "").toLowerCase();
29054
29044
  return ![
@@ -29060,22 +29050,22 @@ function lk(e) {
29060
29050
  "file"
29061
29051
  ].includes(t);
29062
29052
  }
29063
- function uk(e) {
29064
- if (!lk(e)) return !1;
29053
+ function lk(e) {
29054
+ if (!ck(e)) return !1;
29065
29055
  let t = (e.name || "").toLowerCase(), n = (e.id || "").toLowerCase(), r = [
29066
29056
  e.name,
29067
29057
  e.id,
29068
29058
  e.placeholder,
29069
- ZO(e),
29059
+ XO(e),
29070
29060
  e.getAttribute("aria-label")
29071
29061
  ].filter(Boolean).join(" ").toLowerCase();
29072
29062
  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);
29073
29063
  }
29074
- function dk(e, t, n) {
29075
- let r = String(t ?? ""), i = String(n ?? ""), a = mk(e, r) || ak(e, r) || ok(e, r, i);
29064
+ function uk(e, t, n) {
29065
+ let r = String(t ?? ""), i = String(n ?? ""), a = pk(e, r) || ik(e, r) || ak(e, r, i);
29076
29066
  if (!a) return [];
29077
29067
  let o = new Set([a]);
29078
- if (sk(i) && ck(r)) for (let t of e) t !== a && uk(t) && o.add(t);
29068
+ if (ok(i) && sk(r)) for (let t of e) t !== a && lk(t) && o.add(t);
29079
29069
  let s = Array.from(o);
29080
29070
  return s.sort((e, t) => {
29081
29071
  if (e === t) return 0;
@@ -29083,7 +29073,7 @@ function dk(e, t, n) {
29083
29073
  return n & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
29084
29074
  }), s;
29085
29075
  }
29086
- function fk(e, t) {
29076
+ function dk(e, t) {
29087
29077
  try {
29088
29078
  if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
29089
29079
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
@@ -29098,17 +29088,17 @@ function fk(e, t) {
29098
29088
  return Infinity;
29099
29089
  }
29100
29090
  }
29101
- function pk(e) {
29091
+ function fk(e) {
29102
29092
  if (!e || typeof e != "string") return null;
29103
29093
  let t = null;
29104
- return YO((n) => {
29094
+ return JO((n) => {
29105
29095
  try {
29106
29096
  let r = n.getElementById(e);
29107
- r && !qO(r) && r.matches?.("input, select, textarea") && (t = r);
29097
+ r && !KO(r) && r.matches?.("input, select, textarea") && (t = r);
29108
29098
  } catch {}
29109
29099
  }), t;
29110
29100
  }
29111
- function mk(e, t) {
29101
+ function pk(e, t) {
29112
29102
  let n = String(t ?? "").trim();
29113
29103
  if (!n) return null;
29114
29104
  let r = n.match(/^name:\s*([\w.-]+)$/i);
@@ -29118,12 +29108,12 @@ function mk(e, t) {
29118
29108
  }
29119
29109
  let i = n.match(/^id:\s*([\w.-]+)$/i);
29120
29110
  if (i) {
29121
- let e = pk(i[1]);
29111
+ let e = fk(i[1]);
29122
29112
  if (e) return e;
29123
29113
  }
29124
29114
  let a = n.startsWith("#") ? n.slice(1) : n;
29125
29115
  if (/^[\w-]+$/.test(a)) {
29126
- let e = pk(a);
29116
+ let e = fk(a);
29127
29117
  if (e) return e;
29128
29118
  }
29129
29119
  let o = n.toLowerCase().replace(/\s+/g, " ");
@@ -29133,7 +29123,7 @@ function mk(e, t) {
29133
29123
  }
29134
29124
  return null;
29135
29125
  }
29136
- function hk(e, t) {
29126
+ function mk(e, t) {
29137
29127
  let n = String(t || "").toLowerCase().trim();
29138
29128
  if (!n) return 0;
29139
29129
  let r = [
@@ -29149,13 +29139,13 @@ function hk(e, t) {
29149
29139
  for (let e of i) r.includes(e) && (a += 1);
29150
29140
  return a / i.length * 92;
29151
29141
  }
29152
- function gk(e, t) {
29142
+ function hk(e, t) {
29153
29143
  let n = [];
29154
- YO((e) => {
29144
+ JO((e) => {
29155
29145
  n.push(...Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
29156
- if (qO(e) || e.disabled) return !1;
29146
+ if (KO(e) || e.disabled) return !1;
29157
29147
  try {
29158
- let t = JO(e);
29148
+ let t = qO(e);
29159
29149
  if (t.display === "none" || t.visibility === "hidden") return !1;
29160
29150
  } catch {}
29161
29151
  return !0;
@@ -29163,7 +29153,7 @@ function gk(e, t) {
29163
29153
  });
29164
29154
  let r = 0, i = n.map((t) => ({
29165
29155
  el: t,
29166
- s: hk(t, e)
29156
+ s: mk(t, e)
29167
29157
  }));
29168
29158
  for (let { s: e } of i) e > r && (r = e);
29169
29159
  if (r < 36) return null;
@@ -29173,14 +29163,14 @@ function gk(e, t) {
29173
29163
  if (o.length) {
29174
29164
  let e = a[0], t = Infinity;
29175
29165
  for (let n of a) for (let r of o) {
29176
- let i = fk(n, r);
29166
+ let i = dk(n, r);
29177
29167
  i < t && (t = i, e = n);
29178
29168
  }
29179
29169
  return e;
29180
29170
  }
29181
29171
  return a[0];
29182
29172
  }
29183
- function _k(e) {
29173
+ function gk(e) {
29184
29174
  if (e == null) return {};
29185
29175
  if (typeof e == "string") {
29186
29176
  let t = e.trim();
@@ -29193,8 +29183,8 @@ function _k(e) {
29193
29183
  }
29194
29184
  return e;
29195
29185
  }
29196
- function vk(e) {
29197
- let t = _k(e);
29186
+ function _k(e) {
29187
+ let t = gk(e);
29198
29188
  if (Array.isArray(t) && t.length > 0) {
29199
29189
  let e = t[0];
29200
29190
  if (e?.field_key != null || e?.fieldKey != null) return t.map((e) => ({
@@ -29222,7 +29212,7 @@ function vk(e) {
29222
29212
  value: e?.value ?? e?.Value
29223
29213
  })) : [];
29224
29214
  }
29225
- function yk(e) {
29215
+ function vk(e) {
29226
29216
  if (!e || typeof e != "string") return [];
29227
29217
  let t = e.trim();
29228
29218
  if (!t || /\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\b/i.test(t)) return [];
@@ -29241,7 +29231,7 @@ function yk(e) {
29241
29231
  }
29242
29232
  return [];
29243
29233
  }
29244
- function bk(e) {
29234
+ function yk(e) {
29245
29235
  if (!e || typeof e != "string") return [];
29246
29236
  let t = e.trim();
29247
29237
  if (!t) return [];
@@ -29277,17 +29267,17 @@ function bk(e) {
29277
29267
  }
29278
29268
  return n;
29279
29269
  }
29280
- function xk(e) {
29270
+ function bk(e) {
29281
29271
  if (!e || typeof e != "object") return null;
29282
29272
  let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
29283
29273
  return t == null ? null : String(t).trim() || null;
29284
29274
  }
29285
- function Sk(e) {
29275
+ function xk(e) {
29286
29276
  if (!e || typeof e != "object") return null;
29287
29277
  let t = e.query ?? e.q ?? e.search ?? e.text ?? e.keywords;
29288
29278
  return t == null ? null : String(t).trim() || null;
29289
29279
  }
29290
- function Ck(e, t, n) {
29280
+ function Sk(e, t, n) {
29291
29281
  if (!n?.skipScroll) try {
29292
29282
  e.scrollIntoView({
29293
29283
  block: "center",
@@ -29342,7 +29332,7 @@ function Ck(e, t, n) {
29342
29332
  } catch {}
29343
29333
  return !0;
29344
29334
  }
29345
- function wk() {
29335
+ function Ck() {
29346
29336
  let e = {};
29347
29337
  document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
29348
29338
  if (t.id) return;
@@ -29357,27 +29347,11 @@ function wk() {
29357
29347
  e[r] = !0, t.id = r;
29358
29348
  });
29359
29349
  }
29360
- var Tk = [], Ek = 5e3, Dk = null;
29361
- function Ok() {
29362
- if (Dk !== null && (clearInterval(Dk), Dk = null), Tk.length === 0) return;
29363
- let e = Tk.shift();
29364
- CD(e.el), $("highlight ✓ seq[0] at TTS start", e.label), Tk.length !== 0 && (Dk = setInterval(() => {
29365
- if (Tk.length === 0) {
29366
- clearInterval(Dk), Dk = null;
29367
- return;
29368
- }
29369
- let e = Tk.shift();
29370
- CD(e.el), $("highlight ✓ seq interval", e.label);
29371
- }, Ek));
29372
- }
29373
- function kk() {
29374
- Dk !== null && (clearInterval(Dk), Dk = null), Tk.length = 0;
29375
- }
29376
- function Ak(e) {
29350
+ function wk(e) {
29377
29351
  let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
29378
29352
  flowengage_navigate: async (n) => {
29379
29353
  $("flowengage_navigate ▶ raw parameters:", n);
29380
- let i = _k(n), a = xk(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
29354
+ let i = gk(n), a = bk(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
29381
29355
  if ($("flowengage_navigate · coerced:", {
29382
29356
  url: a,
29383
29357
  sectionText: o,
@@ -29424,15 +29398,7 @@ function Ak(e) {
29424
29398
  let e = new URL(a, window.location.origin).pathname, t = Date.now() + 2e3;
29425
29399
  for (; Date.now() < t && !(typeof window < "u" && window.location.pathname === e);) await new Promise((e) => setTimeout(e, 80));
29426
29400
  let n = typeof window < "u" ? window.location.pathname : e, r = typeof window < "u" ? window.location.href : a, i = n === e, o = (n.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home";
29427
- if ($("flowengage_navigate → SPA nav complete. target:", e, "actual:", n), i) {
29428
- wr();
29429
- let e = GO();
29430
- return `OK_NAVIGATE_SPA. Visitor is now on: ${r} (page: "${o}").${e.length > 0 ? ` Section headings on this page (use these EXACTLY for flowengage_highlight — do not guess): ${e.map((e) => `"${e}"`).join(", ")}.` : ""} Do NOT say "I have navigated you" or "I've taken you to" — the page is already loaded visually. Speak about this page immediately and highlight the first relevant section.`;
29431
- } else {
29432
- wr();
29433
- let e = GO();
29434
- return `OK_NAVIGATE_SPA. CURRENT PAGE IS: ${r} (page: "${o}").${e.length > 0 ? ` Section headings on this page: ${e.map((e) => `"${e}"`).join(", ")}.` : ""} The visitor manually navigated here. Describe THIS page only — do not mention the page you tried to navigate to.`;
29435
- }
29401
+ return $("flowengage_navigate → SPA nav complete. target:", e, "actual:", n), i ? (wr(), `OK_NAVIGATE_SPA. Visitor is now on: ${r} (page: "${o}"). Do NOT say "I have navigated you" or "I've taken you to" — the page is already loaded visually. Start immediately with highlights and content about THIS page.`) : (wr(), `OK_NAVIGATE_SPA. CURRENT PAGE IS: ${r} (page: "${o}"). The visitor manually navigated here. Describe THIS page only — do not mention the page you tried to navigate to.`);
29436
29402
  } catch {}
29437
29403
  return "OK_NAVIGATE_RELOADING. Navigating to the page now; the voice session will resume automatically on the new page. When the session resumes, immediately introduce the new page and continue guiding the visitor — do not wait for the user to speak first.";
29438
29404
  } catch (e) {
@@ -29448,17 +29414,14 @@ function Ak(e) {
29448
29414
  },
29449
29415
  flowengage_highlight: async (e) => {
29450
29416
  $("flowengage_highlight ▶", e);
29451
- let t = _k(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i = r || n || "";
29452
- wk();
29453
- let a = hr(n || null, r || null);
29454
- return !a && r && (await new Promise((e) => setTimeout(e, 500)), wk(), a = hr(null, r)), a ? (Tk.push({
29455
- el: a,
29456
- label: i
29457
- }), $("flowengage_highlight ◷ queued for word-sync", i), `OK_HIGHLIGHT: "${i}" queued. Continue speaking — highlights are timed automatically.`) : ($("flowengage_highlight ✖ no element for:", i), `HIGHLIGHT_NOT_FOUND: "${i}" — section not found. Do NOT apologize or mention this. Continue speaking naturally. Try a shorter phrase (first 2-3 words) next time.`);
29417
+ let t = gk(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
29418
+ Ck();
29419
+ let i = hr(n || null, r || null);
29420
+ return !i && r && (await new Promise((e) => setTimeout(e, 500)), Ck(), i = hr(null, r)), i ? (CD(i), $("flowengage_highlight ✓", r || n), `OK_HIGHLIGHT: "${r || n}". WALKTHROUGH: If you are mid-walkthrough and have more sections to cover, continue immediately to the next section — do NOT pause or wait for the visitor to speak between sections.`) : ($("flowengage_highlight ✖ no element for:", r || n), `Could not find "${r || n}" on the current page. Try a shorter phrase matching a visible heading.`);
29458
29421
  },
29459
29422
  flowengage_read_content: async (e) => {
29460
29423
  $("flowengage_read_content ▶", e);
29461
- let t = _k(e), n = t?.section_text || t?.sectionText || "";
29424
+ let t = gk(e), n = t?.section_text || t?.sectionText || "";
29462
29425
  try {
29463
29426
  let e = "";
29464
29427
  if (n) {
@@ -29481,7 +29444,7 @@ function Ak(e) {
29481
29444
  },
29482
29445
  flowengage_search: async (e) => {
29483
29446
  $("flowengage_search ▶", e);
29484
- let r = Sk(_k(e));
29447
+ let r = xk(gk(e));
29485
29448
  if ($("flowengage_search · query:", r, "siteId:", t, "apiBase:", n || "(empty)"), !r) return $("flowengage_search ✖ missing query"), "Missing query parameter.";
29486
29449
  if (!t) return $("flowengage_search ✖ no siteId"), "Site is not configured for search.";
29487
29450
  if (!n) return $("flowengage_search ✖ no api base"), "API base URL is missing; cannot search.";
@@ -29513,7 +29476,7 @@ function Ak(e) {
29513
29476
  },
29514
29477
  flowengage_page_content: async (e) => {
29515
29478
  $("flowengage_page_content ▶", e);
29516
- let r = _k(e), i = r?.url || r?.page_url || "";
29479
+ let r = gk(e), i = r?.url || r?.page_url || "";
29517
29480
  if ($("flowengage_page_content · url:", i, "siteId:", t, "apiBase:", n || "(empty)"), !i) return $("flowengage_page_content ✖ missing url"), "Missing url parameter.";
29518
29481
  if (!t) return $("flowengage_page_content ✖ no siteId"), "Site is not configured.";
29519
29482
  if (!n) return $("flowengage_page_content ✖ no api base"), "API base URL is missing; cannot fetch page content.";
@@ -29554,7 +29517,7 @@ function Ak(e) {
29554
29517
  }), `CURRENT_PAGE. URL: ${e} | Path: ${t} | Title: ${n}. Use THIS as the definitive current page — not any previously navigated URL.`;
29555
29518
  },
29556
29519
  flowengage_list_forms: async () => {
29557
- let e = $O(), t = ek();
29520
+ let e = QO(), t = $O();
29558
29521
  return $("flowengage_list_forms ✓", `${e.length} field(s)`, `${t.length} button(s)`), JSON.stringify({
29559
29522
  fields: e,
29560
29523
  buttons: t,
@@ -29564,10 +29527,10 @@ function Ak(e) {
29564
29527
  flowengage_fill_form: async (e) => {
29565
29528
  try {
29566
29529
  $("flowengage_fill_form ▶ raw:", e), MO();
29567
- let t = vk(e);
29530
+ let t = _k(e);
29568
29531
  if (!t.length && r) {
29569
- let e = r(), n = yk(e);
29570
- n.length ? $("flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):", n) : (n = bk(e), n.length && $("flowengage_fill_form · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
29532
+ let e = r(), n = vk(e);
29533
+ n.length ? $("flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):", n) : (n = yk(e), n.length && $("flowengage_fill_form · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
29571
29534
  }
29572
29535
  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.";
29573
29536
  let n = [];
@@ -29575,14 +29538,14 @@ function Ak(e) {
29575
29538
  let t = e?.field_key ?? e?.fieldKey, r = e?.value;
29576
29539
  if (t == null || r == null) continue;
29577
29540
  TO(`Filling ${String(t)}...`, { spinner: !0 });
29578
- let a = QO(), o = dk(a, String(t), r);
29541
+ let a = ZO(), o = uk(a, String(t), r);
29579
29542
  if (o.length) {
29580
- for (let [e, t] of o.entries()) NO(t), await zO(t), Ck(t, r, { skipScroll: e > 0 }), PO(t), await WO(120);
29543
+ for (let [e, t] of o.entries()) NO(t), await zO(t), Sk(t, r, { skipScroll: e > 0 }), PO(t), await WO(120);
29581
29544
  i = o, n.push(String(t));
29582
29545
  continue;
29583
29546
  }
29584
- let s = mk(a, String(t));
29585
- s ||= ak(a, String(t)), s ||= ok(a, String(t), r), s && (NO(s), await zO(s), Ck(s, r), PO(s), await WO(120), i = [s], n.push(String(t)));
29547
+ let s = pk(a, String(t));
29548
+ s ||= ik(a, String(t)), s ||= ak(a, String(t), r), s && (NO(s), await zO(s), Sk(s, r), PO(s), await WO(120), i = [s], n.push(String(t)));
29586
29549
  }
29587
29550
  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.";
29588
29551
  let a = `OK_FILLED: ${n.join(", ")}`;
@@ -29603,9 +29566,9 @@ function Ak(e) {
29603
29566
  }
29604
29567
  },
29605
29568
  flowengage_click_button: async (e) => {
29606
- let t = _k(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
29569
+ let t = gk(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
29607
29570
  if ($("flowengage_click_button ▶", n), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
29608
- let r = gk(n, i);
29571
+ let r = hk(n, i);
29609
29572
  if (!r) return $("flowengage_click_button ✖ no match"), `Could not find a button matching "${n}". Call flowengage_list_forms to see button texts.`;
29610
29573
  try {
29611
29574
  TO(`Clicking ${n}...`, { spinner: !0 });
@@ -29649,7 +29612,7 @@ function Ak(e) {
29649
29612
  }
29650
29613
  //#endregion
29651
29614
  //#region src/utils/wrapVoiceToolsForLogging.js
29652
- function jk(e) {
29615
+ function Tk(e) {
29653
29616
  return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
29654
29617
  let r = Rn();
29655
29618
  r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
@@ -29666,7 +29629,7 @@ function jk(e) {
29666
29629
  }
29667
29630
  //#endregion
29668
29631
  //#region src/components/FlowEngageWidget.jsx
29669
- var Mk = {
29632
+ var Ek = {
29670
29633
  blue: "#135bd8",
29671
29634
  red: "#ef334b",
29672
29635
  yellow: "#ffbd2e",
@@ -29674,7 +29637,7 @@ var Mk = {
29674
29637
  highlight: "rgba(255,255,255,0.9)",
29675
29638
  green: "#10b981"
29676
29639
  };
29677
- function Nk(e) {
29640
+ function Dk(e) {
29678
29641
  if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
29679
29642
  let [t, n, r] = e;
29680
29643
  return e.length >= 3 && r ? [
@@ -29688,12 +29651,12 @@ function Nk(e) {
29688
29651
  "#f7f8fa"
29689
29652
  ].join(", ");
29690
29653
  }
29691
- function Pk(e) {
29654
+ function Ok(e) {
29692
29655
  if (!e || typeof e != "string") return "#1a1a1a";
29693
29656
  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;
29694
29657
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
29695
29658
  }
29696
- function Fk({ logo: t, style: n }) {
29659
+ function kk({ logo: t, style: n }) {
29697
29660
  if (!t) return null;
29698
29661
  if (typeof t == "string") return /* @__PURE__ */ g("img", {
29699
29662
  src: t,
@@ -29718,7 +29681,7 @@ function Fk({ logo: t, style: n }) {
29718
29681
  children: r
29719
29682
  }) : null;
29720
29683
  }
29721
- function Ik({ title: e }) {
29684
+ function Ak({ title: e }) {
29722
29685
  return /* @__PURE__ */ g("div", {
29723
29686
  style: {
29724
29687
  width: "100%",
@@ -29736,18 +29699,18 @@ function Ik({ title: e }) {
29736
29699
  children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
29737
29700
  });
29738
29701
  }
29739
- function Lk(e, t) {
29702
+ function jk(e, t) {
29740
29703
  let n = (t || "").trim();
29741
29704
  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;
29742
29705
  }
29743
- function Rk({ orbColors: e, ...t }) {
29706
+ function Mk({ orbColors: e, ...t }) {
29744
29707
  return /* @__PURE__ */ g(dO, {
29745
29708
  colors: e,
29746
29709
  ...t
29747
29710
  });
29748
29711
  }
29749
- function zk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
29750
- let s = n || Mk.green, c = Pk(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
29712
+ function Nk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
29713
+ let s = n || Ek.green, c = Ok(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
29751
29714
  style: {
29752
29715
  display: "flex",
29753
29716
  alignItems: a ? "flex-end" : "center",
@@ -29868,7 +29831,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
29868
29831
  delay: 0
29869
29832
  },
29870
29833
  style: { flexShrink: 0 },
29871
- children: /* @__PURE__ */ g(Rk, {
29834
+ children: /* @__PURE__ */ g(Mk, {
29872
29835
  size: l,
29873
29836
  orbColors: t
29874
29837
  })
@@ -29900,8 +29863,8 @@ function zk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
29900
29863
  children: u
29901
29864
  })] });
29902
29865
  }
29903
- function Bk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
29904
- let c = n || Mk.green, l = Pk(c);
29866
+ function Pk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
29867
+ let c = n || Ek.green, l = Ok(c);
29905
29868
  return /* @__PURE__ */ _(Dm.div, {
29906
29869
  initial: {
29907
29870
  scale: 50 / 350,
@@ -29972,7 +29935,7 @@ function Bk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
29972
29935
  children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
29973
29936
  })
29974
29937
  }),
29975
- /* @__PURE__ */ g(Rk, {
29938
+ /* @__PURE__ */ g(Mk, {
29976
29939
  size: 72,
29977
29940
  orbColors: t
29978
29941
  }),
@@ -30041,7 +30004,7 @@ function Bk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
30041
30004
  ]
30042
30005
  });
30043
30006
  }
30044
- function Vk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i, siteId: a, apiBaseUrl: s, chatId: l, historyRef: u, onMessageSync: d, voiceEndCounter: f }) {
30007
+ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i, siteId: a, apiBaseUrl: s, chatId: l, historyRef: u, onMessageSync: d, voiceEndCounter: f }) {
30045
30008
  let [h, v] = m("idle"), [y, b] = m(!1), [x, S] = m(!1), C = p(null), w = p(""), T = p(async () => {}), ee = p(!1), te = p(!1), ne = p(!1), re = p(!1), E = p("minimized"), ie = p(null), ae = p(null), oe = p(null), D = p(0), se = p(!1), ce = p("idle"), le = p(!1), ue = p(null), de = p(null), fe = p(!1), pe = o((e = "minimized") => {
30046
30009
  E.current = e, re.current = !0, queueMicrotask(() => {
30047
30010
  ee.current || (ee.current = !0, T.current?.());
@@ -30051,9 +30014,6 @@ function Vk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30051
30014
  try {
30052
30015
  wD();
30053
30016
  } catch {}
30054
- try {
30055
- kk();
30056
- } catch {}
30057
30017
  if (a) try {
30058
30018
  Ve(a);
30059
30019
  } catch {}
@@ -30097,11 +30057,7 @@ function Vk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30097
30057
  return;
30098
30058
  }
30099
30059
  try {
30100
- if ((await navigator.mediaDevices.getUserMedia({ audio: {
30101
- noiseSuppression: !0,
30102
- echoCancellation: !0,
30103
- autoGainControl: !0
30104
- } })).getTracks().forEach((e) => e.stop()), e) return;
30060
+ if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
30105
30061
  u.current = [], w.current = "", ee.current = !1, ne.current = !1, re.current = !1, E.current = "minimized", kr({ onBeforeNavigate: () => {
30106
30062
  if (a && u.current.length > 0) try {
30107
30063
  let e = bO(u.current);
@@ -30126,7 +30082,7 @@ function Vk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30126
30082
  }
30127
30083
  Ne();
30128
30084
  } });
30129
- let t = jk(Ak({
30085
+ let t = Tk(wk({
30130
30086
  siteId: a || null,
30131
30087
  apiBaseUrl: s || null,
30132
30088
  getLastUserVoiceText: () => w.current,
@@ -30165,7 +30121,7 @@ function Vk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30165
30121
  onModeChange: ({ mode: t }) => {
30166
30122
  if (!e) {
30167
30123
  if (t === "speaking") {
30168
- de.current &&= (clearTimeout(de.current), null), v("speaking"), ce.current = "speaking", le.current = !0, fe.current = !1, ue.current &&= (clearTimeout(ue.current), null), Ok();
30124
+ de.current &&= (clearTimeout(de.current), null), v("speaking"), ce.current = "speaking", le.current = !0, fe.current = !1, ue.current &&= (clearTimeout(ue.current), null);
30169
30125
  return;
30170
30126
  }
30171
30127
  if (ce.current = "listening", se.current) {
@@ -30184,7 +30140,7 @@ function Vk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30184
30140
  C.current?.sendContextualUpdate?.("The visitor has been silent for a while. Ask one short, natural question to re-engage — for example: 'Is there anything specific you'd like to know more about?' or 'What else can I help you with today?' Keep it to one sentence.");
30185
30141
  } catch {}
30186
30142
  }, 4e3))));
30187
- }, 2500);
30143
+ }, 1200);
30188
30144
  }
30189
30145
  },
30190
30146
  onMessage: (t) => {
@@ -30199,7 +30155,7 @@ function Vk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30199
30155
  let e = bO(u.current);
30200
30156
  e && Ae(a, e);
30201
30157
  } catch {}
30202
- if (Lk(n, r)) {
30158
+ if (jk(n, r)) {
30203
30159
  pe("minimized");
30204
30160
  return;
30205
30161
  }
@@ -30363,7 +30319,7 @@ function Vk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30363
30319
  },
30364
30320
  children: "Muted"
30365
30321
  }),
30366
- /* @__PURE__ */ g(Rk, {
30322
+ /* @__PURE__ */ g(Mk, {
30367
30323
  size: 72,
30368
30324
  voiceState: h,
30369
30325
  isMuted: y,
@@ -30601,7 +30557,7 @@ function Vk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30601
30557
  ]
30602
30558
  });
30603
30559
  }
30604
- function Hk({ orbColors: e }) {
30560
+ function Ik({ orbColors: e }) {
30605
30561
  return /* @__PURE__ */ g("div", {
30606
30562
  style: {
30607
30563
  flexShrink: 0,
@@ -30611,13 +30567,13 @@ function Hk({ orbColors: e }) {
30611
30567
  alignItems: "center",
30612
30568
  justifyContent: "center"
30613
30569
  },
30614
- children: /* @__PURE__ */ g(Rk, {
30570
+ children: /* @__PURE__ */ g(Mk, {
30615
30571
  size: 36,
30616
30572
  orbColors: e
30617
30573
  })
30618
30574
  });
30619
30575
  }
30620
- var Uk = () => /* @__PURE__ */ g("div", {
30576
+ var Lk = () => /* @__PURE__ */ g("div", {
30621
30577
  style: {
30622
30578
  display: "flex",
30623
30579
  marginBottom: "12px",
@@ -30647,7 +30603,7 @@ var Uk = () => /* @__PURE__ */ g("div", {
30647
30603
  } }, e))
30648
30604
  })
30649
30605
  });
30650
- function Wk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: ee, rateLimitMessage: te, selectedFile: ne, onFileSelect: re, onRemoveSelectedFile: E, attachmentError: ie, isUploadingAttachment: ae, requiresEmail: oe, emailInput: D, setEmailInput: se, emailError: ce, emailCaptureSuccess: le, replyContext: ue, setReplyContext: de, webRTCError: fe, micError: pe, setMicError: me, dismissCallError: he, activeCallId: ge, isCallMuted: _e, toggleCallMute: ve, endWebRTCCall: ye, formatCallDuration: be, callDurationSeconds: xe, isCallMinimized: Se, onExpand: Ce, onCollapse: we, onStartVoice: Te, onNewChat: Ee, onEndConversation: De, showPoweredBy: Oe, getVisitorChatHistory: ke, getVisitorChatThread: Ae, resumeChat: je, isSessionRestoring: Me, isClosing: O }) {
30606
+ function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: ee, rateLimitMessage: te, selectedFile: ne, onFileSelect: re, onRemoveSelectedFile: E, attachmentError: ie, isUploadingAttachment: ae, requiresEmail: oe, emailInput: D, setEmailInput: se, emailError: ce, emailCaptureSuccess: le, replyContext: ue, setReplyContext: de, webRTCError: fe, micError: pe, setMicError: me, dismissCallError: he, activeCallId: ge, isCallMuted: _e, toggleCallMute: ve, endWebRTCCall: ye, formatCallDuration: be, callDurationSeconds: xe, isCallMinimized: Se, onExpand: Ce, onCollapse: we, onStartVoice: Te, onNewChat: Ee, onEndConversation: De, showPoweredBy: Oe, getVisitorChatHistory: ke, getVisitorChatThread: Ae, resumeChat: je, isSessionRestoring: Me, isClosing: O }) {
30651
30607
  let Ne = l.length > 0, Pe = T || ee || w, Fe = !!ge, [Ie, Le] = m(!1), [Re, ze] = m(!1), [Be, Ve] = m([]), [He, Ue] = m(!1), [We, Ge] = m(null), [Ke, qe] = m([]), Je = p(null), Ye = async () => {
30652
30608
  Le(!1), ze(!0), Ue(!0), Ge(null);
30653
30609
  try {
@@ -30772,7 +30728,7 @@ function Wk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30772
30728
  justifyContent: "center",
30773
30729
  height: "40px"
30774
30730
  },
30775
- children: i ? /* @__PURE__ */ g(Fk, {
30731
+ children: i ? /* @__PURE__ */ g(kk, {
30776
30732
  logo: i,
30777
30733
  style: {
30778
30734
  height: "34px",
@@ -30785,7 +30741,7 @@ function Wk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30785
30741
  height: "40px",
30786
30742
  flexShrink: 0
30787
30743
  },
30788
- children: /* @__PURE__ */ g(Ik, { title: e.chatTitle })
30744
+ children: /* @__PURE__ */ g(Ak, { title: e.chatTitle })
30789
30745
  })
30790
30746
  }), /* @__PURE__ */ g("div", {
30791
30747
  style: {
@@ -31273,11 +31229,11 @@ function Wk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31273
31229
  isLoading: T,
31274
31230
  isAgentTyping: d,
31275
31231
  setReplyContext: de,
31276
- TypingDots: Uk,
31232
+ TypingDots: Lk,
31277
31233
  primaryColor: n,
31278
31234
  agentHeadshot: y,
31279
31235
  agentDisplayName: v || b,
31280
- botAvatarNode: /* @__PURE__ */ g(Hk, { orbColors: t })
31236
+ botAvatarNode: /* @__PURE__ */ g(Ik, { orbColors: t })
31281
31237
  }) : Me ? /* @__PURE__ */ _("div", {
31282
31238
  style: {
31283
31239
  flex: 1,
@@ -31318,7 +31274,7 @@ function Wk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31318
31274
  padding: "28px 24px"
31319
31275
  },
31320
31276
  children: [
31321
- /* @__PURE__ */ g(Rk, {
31277
+ /* @__PURE__ */ g(Mk, {
31322
31278
  size: 94,
31323
31279
  orbColors: t
31324
31280
  }),
@@ -31459,7 +31415,7 @@ function Wk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31459
31415
  ]
31460
31416
  });
31461
31417
  }
31462
- function Gk() {
31418
+ function zk() {
31463
31419
  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, chatId: ie, historyRef: ae, onMessageSync: oe, sendMessage: D, uploadChatFile: se, openWidget: ce, captureVisitorEmail: le, setVoiceMode: ue, endConversation: de, startNewChat: me, acceptCall: he, rejectCall: ge, endWebRTCCall: _e, toggleCallMute: ve, dismissCallError: ye, startTyping: be, stopTyping: xe, updateTypingDraft: Se, getVisitorChatHistory: Ce, getVisitorChatThread: we, resumeChat: Te, isSessionRestoring: Ee, openToChatCounter: De, voiceEndCounter: Oe } = Ln();
31464
31420
  c(() => {
31465
31421
  try {
@@ -31477,7 +31433,7 @@ function Gk() {
31477
31433
  }, Fe = {
31478
31434
  ...ke.features || {},
31479
31435
  ...Ae.features || {}
31480
- }, Ie = Fe.voice !== !1, Re = Array.isArray(Ne.orbColors) && Ne.orbColors.length > 0 ? Ne.orbColors : null, ze = Ne.buttonColor || Ne.primaryColor || Re?.[0] || "#3B82F6", Be = Ne.position || "bottom-right", Ve = O.fallbackAgentName || "Agent", He = Nk(Re ?? Ne.chatBgColors), Ue = O.logo || O.logoUrl || null, We = E || "en", Ge = ke.recommendations?.[We] || [], Ke = (Ae.recommendations?.[We] ?? Ge).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
31436
+ }, Ie = Fe.voice !== !1, Re = Array.isArray(Ne.orbColors) && Ne.orbColors.length > 0 ? Ne.orbColors : null, ze = Ne.buttonColor || Ne.primaryColor || Re?.[0] || "#3B82F6", Be = Ne.position || "bottom-right", Ve = O.fallbackAgentName || "Agent", He = Dk(Re ?? Ne.chatBgColors), Ue = O.logo || O.logoUrl || null, We = E || "en", Ge = ke.recommendations?.[We] || [], Ke = (Ae.recommendations?.[We] ?? Ge).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
31481
31437
  id: e.key || `qr-${t}`,
31482
31438
  label: e.label,
31483
31439
  message: e.label,
@@ -31741,7 +31697,7 @@ function Gk() {
31741
31697
  onWheel: (e) => e.stopPropagation(),
31742
31698
  onTouchMove: (e) => e.stopPropagation(),
31743
31699
  children: [
31744
- A === "entry_prompt" && /* @__PURE__ */ g(zk, {
31700
+ A === "entry_prompt" && /* @__PURE__ */ g(Nk, {
31745
31701
  copy: Ze,
31746
31702
  orbColors: Re,
31747
31703
  primaryColor: ze,
@@ -31824,13 +31780,13 @@ function Gk() {
31824
31780
  children: ee === "connected" ? `${Ht(_t)} with ${nt}` : `Tap to return to ${nt}`
31825
31781
  })]
31826
31782
  })]
31827
- }), /* @__PURE__ */ g(Rk, {
31783
+ }), /* @__PURE__ */ g(Mk, {
31828
31784
  size: 50,
31829
31785
  orbColors: Re,
31830
31786
  onClick: T && Dt ? Lt : Ie ? Kt : Jt
31831
31787
  })]
31832
31788
  }),
31833
- A === "connection_modal" && /* @__PURE__ */ g(Bk, {
31789
+ A === "connection_modal" && /* @__PURE__ */ g(Pk, {
31834
31790
  copy: Ze,
31835
31791
  orbColors: Re,
31836
31792
  primaryColor: ze,
@@ -31840,7 +31796,7 @@ function Gk() {
31840
31796
  isMobile: Nt,
31841
31797
  isClosing: kt
31842
31798
  }),
31843
- A === "voice_mode" && /* @__PURE__ */ g(Vk, {
31799
+ A === "voice_mode" && /* @__PURE__ */ g(Fk, {
31844
31800
  orbColors: Re,
31845
31801
  onEnterChat: Jt,
31846
31802
  onEndChat: Yt,
@@ -31872,7 +31828,7 @@ function Gk() {
31872
31828
  orbColors: Re,
31873
31829
  chatHistory: r
31874
31830
  }),
31875
- A === "text_chat" && /* @__PURE__ */ g(Wk, {
31831
+ A === "text_chat" && /* @__PURE__ */ g(Rk, {
31876
31832
  isClosing: kt,
31877
31833
  copy: Ze,
31878
31834
  orbColors: Re,
@@ -31937,7 +31893,7 @@ function Gk() {
31937
31893
  }
31938
31894
  //#endregion
31939
31895
  //#region src/components/ErrorBoundary.jsx
31940
- var Kk = class extends e.Component {
31896
+ var Bk = class extends e.Component {
31941
31897
  constructor(e) {
31942
31898
  super(e), this.state = { hasError: !1 };
31943
31899
  }
@@ -31952,4 +31908,4 @@ var Kk = class extends e.Component {
31952
31908
  }
31953
31909
  };
31954
31910
  //#endregion
31955
- export { dO as AnimatedOrb, Kk as ErrorBoundary, Rr as FlowEngageProvider, Gk as FlowEngageWidget, Ln as useFlowEngage };
31911
+ export { dO as AnimatedOrb, Bk as ErrorBoundary, Rr as FlowEngageProvider, zk as FlowEngageWidget, Ln as useFlowEngage };