@flowengage/react-chatbot 8.0.54 → 8.0.63

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.
@@ -34,46 +34,46 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
34
34
  agentName: "flowengage.agentName",
35
35
  agentHeadshot: "flowengage.agentHeadshot",
36
36
  visitorEmail: "flowengage.visitorEmail"
37
- }, ee = 6e4, te = 480 * 60, ne = 3e4, j = typeof window < "u", re = (e) => e ? `flowengage.visitorEmail.${e}` : null, ie = () => {
37
+ }, ee = 6e4, te = 480 * 60, ne = 3e4, j = typeof window < "u", M = (e) => e ? `flowengage.visitorEmail.${e}` : null, re = () => {
38
38
  if (!j) return null;
39
39
  let e = window.localStorage.getItem(A.chatId);
40
40
  return e && String(e).trim() ? String(e).trim() : null;
41
- }, ae = () => {
41
+ }, ie = () => {
42
42
  if (j) try {
43
43
  window.localStorage.removeItem(A.chatId);
44
44
  } catch {}
45
- }, oe = () => j ? typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}` : "server-chat-id", se = (e) => e ? `flowengage.entrySeen.${e}` : null, ce = (e) => {
45
+ }, ae = () => j ? typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}` : "server-chat-id", oe = (e) => e ? `flowengage.entrySeen.${e}` : null, se = (e) => {
46
46
  if (!j || !e) return !1;
47
47
  try {
48
- let t = se(e);
48
+ let t = oe(e);
49
49
  return t ? window.localStorage.getItem(t) === "1" : !1;
50
50
  } catch {
51
51
  return !1;
52
52
  }
53
- }, le = (e) => {
53
+ }, ce = (e) => {
54
54
  if (!(!j || !e)) try {
55
- let t = se(e);
55
+ let t = oe(e);
56
56
  t && window.localStorage.setItem(t, "1");
57
57
  } catch {}
58
- }, ue = (e) => e ? `flowengage.persistedChatId.${e}` : null, de = (e) => {
58
+ }, le = (e) => e ? `flowengage.persistedChatId.${e}` : null, ue = (e) => {
59
59
  if (!j || !e) return null;
60
60
  try {
61
- let t = ue(e), n = t ? window.localStorage.getItem(t) : null;
61
+ let t = le(e), n = t ? window.localStorage.getItem(t) : null;
62
62
  return n && String(n).trim() ? String(n).trim() : null;
63
63
  } catch {
64
64
  return null;
65
65
  }
66
- }, fe = (e) => {
66
+ }, de = (e) => {
67
67
  if (!(!j || !e)) try {
68
- let t = ue(e);
68
+ let t = le(e);
69
69
  t && window.localStorage.removeItem(t);
70
70
  } catch {}
71
- }, pe = (e, t) => {
71
+ }, fe = (e, t) => {
72
72
  if (!(!j || !e || !t)) try {
73
- let n = ue(e);
73
+ let n = le(e);
74
74
  n && window.localStorage.setItem(n, String(t).trim());
75
75
  } catch {}
76
- }, me = () => j ? {
76
+ }, pe = () => j ? {
77
77
  isOpen: !1,
78
78
  activeScreen: window.sessionStorage.getItem(A.activeScreen) || "ai",
79
79
  isHumanHandled: window.sessionStorage.getItem(A.isHumanHandled) === "true",
@@ -87,7 +87,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
87
87
  agentName: null,
88
88
  agentHeadshot: null,
89
89
  visitorEmail: ""
90
- }, he = (e) => {
90
+ }, me = (e) => {
91
91
  j && Object.entries(e).forEach(([e, t]) => {
92
92
  let n = A[e];
93
93
  if (n) {
@@ -98,17 +98,17 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
98
98
  window.sessionStorage.setItem(n, String(t));
99
99
  }
100
100
  });
101
- }, M = (e) => {
101
+ }, he = (e) => {
102
102
  if (!j || !e) return "";
103
- let t = re(e), n = window.localStorage.getItem(t);
103
+ let t = M(e), n = window.localStorage.getItem(t);
104
104
  if (!n) {
105
105
  let e = window.sessionStorage.getItem(A.visitorEmail);
106
106
  e && (window.localStorage.setItem(t, e), window.sessionStorage.removeItem(A.visitorEmail), n = e);
107
107
  }
108
108
  return n || "";
109
- }, ge = (e, t) => {
109
+ }, N = (e, t) => {
110
110
  if (!j) return;
111
- let n = re(t);
111
+ let n = M(t);
112
112
  if (!n) return;
113
113
  let r = typeof e == "string" ? e.trim() : "";
114
114
  if (!r) {
@@ -116,33 +116,33 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
116
116
  return;
117
117
  }
118
118
  window.localStorage.setItem(n, r), window.sessionStorage.removeItem(A.visitorEmail);
119
- }, _e = (e) => e ? `flowengage.visitorId.${e}` : null, ve = () => `v_${Date.now().toString(36)}_${typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 16) : Math.random().toString(36).slice(2, 18)}`, ye = (e) => {
119
+ }, ge = (e) => e ? `flowengage.visitorId.${e}` : null, _e = () => `v_${Date.now().toString(36)}_${typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 16) : Math.random().toString(36).slice(2, 18)}`, ve = (e) => {
120
120
  if (!j || !e) return null;
121
121
  try {
122
- let t = _e(e), n = t ? window.localStorage.getItem(t) : null;
122
+ let t = ge(e), n = t ? window.localStorage.getItem(t) : null;
123
123
  return n && String(n).trim() ? String(n).trim() : null;
124
124
  } catch {
125
125
  return null;
126
126
  }
127
- }, be = (e) => {
127
+ }, ye = (e) => {
128
128
  if (!j || !e) return null;
129
129
  try {
130
- let t = ye(e);
130
+ let t = ve(e);
131
131
  if (t) return t;
132
- let n = ve(), r = _e(e);
132
+ let n = _e(), r = ge(e);
133
133
  return r && window.localStorage.setItem(r, n), n;
134
134
  } catch {
135
- return ve();
135
+ return _e();
136
136
  }
137
- }, xe = "flowengage.tabId", Se = () => {
137
+ }, be = "flowengage.tabId", xe = () => {
138
138
  if (!j) return "default";
139
139
  try {
140
- let e = window.sessionStorage.getItem(xe);
141
- return e || (e = typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 12) : Math.random().toString(36).slice(2, 14), window.sessionStorage.setItem(xe, e)), e;
140
+ let e = window.sessionStorage.getItem(be);
141
+ return e || (e = typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 12) : Math.random().toString(36).slice(2, 14), window.sessionStorage.setItem(be, e)), e;
142
142
  } catch {
143
143
  return "default";
144
144
  }
145
- }, N = (e) => e ? `flowengage.voice.transcript.${e}.${Se()}` : null, Ce = 600 * 1e3, P = (e, t, n = {}) => {
145
+ }, Se = (e) => e ? `flowengage.voice.transcript.${e}.${xe()}` : null, Ce = 600 * 1e3, P = (e, t, n = {}) => {
146
146
  if (!j || !e) return;
147
147
  let r = typeof t == "string" ? t.trim() : "";
148
148
  if (!r) return;
@@ -151,13 +151,13 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
151
151
  expiresAt: Date.now() + i
152
152
  };
153
153
  try {
154
- let t = N(e);
154
+ let t = Se(e);
155
155
  t && window.localStorage.setItem(t, JSON.stringify(a));
156
156
  } catch {}
157
157
  }, we = (e) => {
158
158
  if (!j || !e) return null;
159
159
  try {
160
- let t = N(e), n = t ? window.localStorage.getItem(t) : null;
160
+ let t = Se(e), n = t ? window.localStorage.getItem(t) : null;
161
161
  if (!n) return null;
162
162
  let r = JSON.parse(n);
163
163
  return !r || typeof r.transcript != "string" ? null : Number.isFinite(r.expiresAt) && Date.now() > r.expiresAt ? (window.localStorage.removeItem(t), null) : r;
@@ -166,7 +166,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
166
166
  }
167
167
  }, Te = (e) => {
168
168
  if (!(!j || !e)) try {
169
- let t = N(e);
169
+ let t = Se(e);
170
170
  t && window.localStorage.removeItem(t);
171
171
  } catch {}
172
172
  }, F = "flowengage.voice.pendingResume", Ee = () => {
@@ -198,7 +198,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
198
198
  } catch {
199
199
  return !1;
200
200
  }
201
- }, je = (e) => e ? `flowengage.voice.navState.${e}.${Se()}` : null, Me = (e, t, n, r) => {
201
+ }, je = (e) => e ? `flowengage.voice.navState.${e}.${xe()}` : null, Me = (e, t, n, r) => {
202
202
  if (!(!j || !e || !t)) try {
203
203
  let i = je(e);
204
204
  i && window.sessionStorage.setItem(i, JSON.stringify({
@@ -224,14 +224,14 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
224
224
  } catch {
225
225
  return null;
226
226
  }
227
- }, L = async (e) => {
227
+ }, Pe = async (e) => {
228
228
  let t = await e.json().catch(() => ({}));
229
229
  if (!e.ok) {
230
230
  let n = Error(t.message || t.error || `Request failed with status ${e.status}`);
231
231
  throw n.status = e.status, n;
232
232
  }
233
233
  return t;
234
- }, Pe = async (e, t = {}) => {
234
+ }, L = async (e, t = {}) => {
235
235
  try {
236
236
  return await fetch(e, {
237
237
  mode: "cors",
@@ -243,7 +243,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
243
243
  }
244
244
  }, Fe = async ({ apiBaseUrl: e, userId: t, siteId: n, priorChatId: r = null, forceNew: i = !1, resumeChatId: a = null, visitorId: o = null }) => {
245
245
  let s = `${e}/api/visitors/resolve-session`, c = { siteId: n };
246
- return r && String(r).trim() && (c.priorChatId = String(r).trim()), i && (c.forceNew = !0), a && (c.resumeChatId = a), o && (c.visitorId = o), L(await Pe(s, {
246
+ return r && String(r).trim() && (c.priorChatId = String(r).trim()), i && (c.forceNew = !0), a && (c.resumeChatId = a), o && (c.visitorId = o), Pe(await L(s, {
247
247
  method: "POST",
248
248
  mode: "cors",
249
249
  headers: {
@@ -256,7 +256,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
256
256
  }));
257
257
  }, Ie = async ({ apiBaseUrl: e, siteId: t }) => {
258
258
  let n = typeof window < "u" ? window.location.origin : "http://localhost";
259
- return (await L(await Pe(`${e}/api/widget/chatbot-loader?${new URLSearchParams({
259
+ return (await Pe(await L(`${e}/api/widget/chatbot-loader?${new URLSearchParams({
260
260
  siteId: t,
261
261
  origin: n
262
262
  }).toString()}`, { method: "GET" }))).data;
@@ -274,7 +274,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
274
274
  headers: { "Content-Type": "application/json" },
275
275
  body: i
276
276
  }).catch(() => {}), !0) : !1;
277
- }, a = async (i, a = {}) => L(await Pe(`${e}${i}`, {
277
+ }, a = async (i, a = {}) => Pe(await L(`${e}${i}`, {
278
278
  ...a,
279
279
  headers: {
280
280
  "Content-Type": "application/json",
@@ -289,7 +289,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
289
289
  ...n ? { "x-site-id": n } : {},
290
290
  ...a.headers || {}
291
291
  };
292
- return L(await Pe(`${e}${r}`, {
292
+ return Pe(await L(`${e}${r}`, {
293
293
  ...a,
294
294
  body: i,
295
295
  headers: o
@@ -415,7 +415,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
415
415
  });
416
416
  },
417
417
  async getIceServersConfig() {
418
- return L(await Pe(`${e}/api/calls/ice-config`, {
418
+ return Pe(await L(`${e}/api/calls/ice-config`, {
419
419
  method: "GET",
420
420
  headers: {
421
421
  "x-user-id": t,
@@ -2919,7 +2919,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
2919
2919
  message: "Looks like you're already on this page!",
2920
2920
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
2921
2921
  }]);
2922
- }, []), [T, D] = m(me().isOpen), [O, k] = m(me().activeScreen), [A, j] = m(me().isHumanHandled), [re, se] = m(me().agentName), [ce, le] = m(me().agentHeadshot), [ue, _e] = m(() => M(i?.siteId)), [ve, ye] = m(!1), [xe, Se] = m(!1), [N, Ce] = m("idle"), [P, we] = m(!1), [Te, F] = m(!1), [De, Oe] = m(""), [I, ke] = m(!1), [Ae, je] = m(0), [Me, Ne] = m(0), [L, Pe] = m(!1), [R, Re] = m(null), [ze, Be] = m(null), [Ve, He] = m("idle"), [Ue, We] = m(null), [Ge, Ke] = m(!1), [qe, Je] = m(""), [Ye, Xe] = m(!1), z = p(null), B = p(null), Ze = p(""), Qe = p(!1), $e = p(null), et = p(null), tt = p(null), V = p(null), H = p(null), nt = p(null), rt = p(null), it = p(!1), U = p({
2922
+ }, []), [T, D] = m(pe().isOpen), [O, k] = m(pe().activeScreen), [A, j] = m(pe().isHumanHandled), [M, oe] = m(pe().agentName), [se, ce] = m(pe().agentHeadshot), [le, ge] = m(() => he(i?.siteId)), [_e, ve] = m(!1), [be, xe] = m(!1), [Se, Ce] = m("idle"), [P, we] = m(!1), [Te, F] = m(!1), [De, Oe] = m(""), [I, ke] = m(!1), [Ae, je] = m(0), [Me, Ne] = m(0), [Pe, L] = m(!1), [R, Re] = m(null), [ze, Be] = m(null), [Ve, He] = m("idle"), [Ue, We] = m(null), [Ge, Ke] = m(!1), [qe, Je] = m(""), [Ye, Xe] = m(!1), z = p(null), B = p(null), Ze = p(""), Qe = p(!1), $e = p(null), et = p(null), tt = p(null), V = p(null), H = p(null), nt = p(null), rt = p(null), it = p(!1), U = p({
2923
2923
  url: null,
2924
2924
  at: 0
2925
2925
  }), at = o((e, t) => {
@@ -2935,12 +2935,12 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
2935
2935
  url: n,
2936
2936
  at: Date.now()
2937
2937
  }, br(e, t));
2938
- }, []), ot = p([]), W = p(null), st = p(null), ct = p(null), lt = p(!1), ut = p(!1), dt = p(""), ft = p(null), pt = p(null), mt = p([]), ht = p(0), gt = p(re), _t = p([]), vt = p(!1), yt = p(!1), bt = p(i), xt = p({
2938
+ }, []), ot = p([]), W = p(null), st = p(null), ct = p(null), lt = p(!1), ut = p(!1), dt = p(""), ft = p(null), pt = p(null), mt = p([]), ht = p(0), gt = p(M), _t = p([]), vt = p(!1), yt = p(!1), bt = p(i), xt = p({
2939
2939
  notifyRouteChange: () => {},
2940
2940
  cleanup: () => {}
2941
2941
  }), St = o((e = {}) => {
2942
2942
  let t = !!e.is_human_handled;
2943
- return j(t), t ? (k("agent"), e.agent_info?.name && se(e.agent_info.name), e.agent_info?.headshot && le(e.agent_info.headshot), t) : (k("ai"), t);
2943
+ return j(t), t ? (k("agent"), e.agent_info?.name && oe(e.agent_info.name), e.agent_info?.headshot && ce(e.agent_info.headshot), t) : (k("ai"), t);
2944
2944
  }, []), Ct = f(() => {
2945
2945
  let e = _?.widgetSettings?.call?.maxDurationSeconds ?? i?.widgetSettings?.call?.maxDurationSeconds ?? i?.callMaxDurationSeconds, t = Number(e);
2946
2946
  return Number.isFinite(t) && t > 0 ? t : te;
@@ -2948,8 +2948,8 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
2948
2948
  c(() => {
2949
2949
  et.current = R;
2950
2950
  }, [R]), c(() => {
2951
- gt.current = re;
2952
- }, [re]), c(() => {
2951
+ gt.current = M;
2952
+ }, [M]), c(() => {
2953
2953
  yt.current = I;
2954
2954
  }, [I]), c(() => {
2955
2955
  bt.current = i;
@@ -2960,17 +2960,17 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
2960
2960
  ct.current &&= (window.clearTimeout(ct.current), null);
2961
2961
  }, []), Et = (e) => {
2962
2962
  let t = typeof e == "string" ? e.trim().toLowerCase() : "";
2963
- return _e(t), ge(t, i?.siteId), t;
2963
+ return ge(t), N(t, i?.siteId), t;
2964
2964
  };
2965
2965
  c(() => {
2966
2966
  let e = i?.siteId;
2967
2967
  if (!e) return;
2968
- let t = M(e);
2968
+ let t = he(e);
2969
2969
  if (t) {
2970
- _e(t);
2970
+ ge(t);
2971
2971
  return;
2972
2972
  }
2973
- _e((t) => (t && ge(t, e), t));
2973
+ ge((t) => (t && N(t, e), t));
2974
2974
  }, [i?.siteId]);
2975
2975
  let G = (e = "unspecified") => {
2976
2976
  let t = W.current || nt.current?.callId, n = ht.current, r = ft.current;
@@ -3100,19 +3100,19 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3100
3100
  });
3101
3101
  };
3102
3102
  c(() => {
3103
- he({
3103
+ me({
3104
3104
  isOpen: T,
3105
3105
  activeScreen: O,
3106
3106
  isHumanHandled: A,
3107
- agentName: re,
3108
- agentHeadshot: ce
3107
+ agentName: M,
3108
+ agentHeadshot: se
3109
3109
  });
3110
3110
  }, [
3111
3111
  T,
3112
3112
  O,
3113
3113
  A,
3114
- re,
3115
- ce
3114
+ M,
3115
+ se
3116
3116
  ]), c(() => {
3117
3117
  let e = !0;
3118
3118
  return (async () => {
@@ -3120,21 +3120,21 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3120
3120
  try {
3121
3121
  let t = E(i), n = await Ie(t);
3122
3122
  if (!e) return;
3123
- let a = t.siteId, o = de(a), s = be(a), c = "";
3123
+ let a = t.siteId, o = ue(a), s = ye(a), c = "";
3124
3124
  try {
3125
3125
  let e = Qe.current, r = $e.current;
3126
3126
  if (Qe.current = !1, $e.current = null, c = (await Fe({
3127
3127
  apiBaseUrl: t.apiBaseUrl,
3128
3128
  userId: n.userId,
3129
3129
  siteId: a,
3130
- priorChatId: e || r ? null : o || ie(),
3130
+ priorChatId: e || r ? null : o || re(),
3131
3131
  forceNew: e,
3132
3132
  resumeChatId: r,
3133
3133
  visitorId: s
3134
3134
  }))?.data?.chatId, !c) throw Error("resolve-session returned no chatId");
3135
- ae(), pe(a, c);
3135
+ ie(), fe(a, c);
3136
3136
  } catch (e) {
3137
- console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o || oe(), pe(a, c);
3137
+ console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o || ae(), fe(a, c);
3138
3138
  }
3139
3139
  Ze.current = c;
3140
3140
  let l = Le({
@@ -3162,15 +3162,15 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3162
3162
  }), f.on("disconnect", () => {
3163
3163
  Ce("disconnected");
3164
3164
  }), f.on("aiTyping", () => {
3165
- Se(!0);
3165
+ xe(!0);
3166
3166
  }), f.on("ai:typing", () => {
3167
- Se(!0);
3167
+ xe(!0);
3168
3168
  }), f.on("messageReceived", (e) => {
3169
3169
  let t = e.message || e, n = {
3170
3170
  ...t,
3171
3171
  message: Tr(t.message)
3172
3172
  };
3173
- Se(!1), ye(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && S((e) => [...e.filter((e) => !e.isPending), {
3173
+ xe(!1), ve(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && S((e) => [...e.filter((e) => !e.isPending), {
3174
3174
  ...n,
3175
3175
  isPending: !1,
3176
3176
  id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
@@ -3188,7 +3188,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3188
3188
  ...t,
3189
3189
  message: Tr(t.message)
3190
3190
  };
3191
- Se(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && ((n.sender === "agent" || n.agent_name || n.sender === "ai" || n.sender === "bot") && ye(!1), S((e) => n.sender === "bot" || n.sender === "ai" ? [...e, {
3191
+ xe(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && ((n.sender === "agent" || n.agent_name || n.sender === "ai" || n.sender === "bot") && ve(!1), S((e) => n.sender === "bot" || n.sender === "ai" ? [...e, {
3192
3192
  ...n,
3193
3193
  isPending: !1,
3194
3194
  id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
@@ -3200,11 +3200,11 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3200
3200
  ...n,
3201
3201
  isPending: !1,
3202
3202
  id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
3203
- }]), (n.sender === "agent" || n.agent_name) && (j(!0), k("agent"), se(Ar([
3203
+ }]), (n.sender === "agent" || n.agent_name) && (j(!0), k("agent"), oe(Ar([
3204
3204
  n.agent_name,
3205
3205
  n.agentName,
3206
3206
  n.metadata?.agentName
3207
- ], d)), n.sender_headshot && le(n.sender_headshot), D(!0), je((e) => e + 1)));
3207
+ ], d)), n.sender_headshot && ce(n.sender_headshot), D(!0), je((e) => e + 1)));
3208
3208
  });
3209
3209
  let p = (e = {}) => {
3210
3210
  let t = Ar([
@@ -3213,7 +3213,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3213
3213
  e.agent_name,
3214
3214
  gt.current
3215
3215
  ], d);
3216
- j(!0), k("agent"), se(t), le(e.agent?.headshot || null), D(!0), je((e) => e + 1), S((e) => jr(e, {
3216
+ j(!0), k("agent"), oe(t), ce(e.agent?.headshot || null), D(!0), je((e) => e + 1), S((e) => jr(e, {
3217
3217
  id: `agent-joined-${Date.now()}`,
3218
3218
  sender: "system",
3219
3219
  message: `${t} has joined the chat.`,
@@ -3236,7 +3236,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3236
3236
  }));
3237
3237
  };
3238
3238
  f.on("agent:joined", p), f.on("agentJoined", p), f.on("agent:left", m), f.on("agentLeft", m), f.on("conversationEnded", (e) => {
3239
- Pe(!0);
3239
+ L(!0);
3240
3240
  let t = e?.message || "This conversation has ended. Thank you for reaching out!";
3241
3241
  S((e) => [...e, {
3242
3242
  id: `conversation-ended-${Date.now()}`,
@@ -3247,15 +3247,15 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3247
3247
  }]);
3248
3248
  }), f.on("chat:history_update", (e) => {
3249
3249
  let t = Er(e.chat_history || []);
3250
- S(t), t.length === 0 && (Pe(!1), j(!1), k("ai"), Se(!1), ye(!1));
3250
+ S(t), t.length === 0 && (L(!1), j(!1), k("ai"), xe(!1), ve(!1));
3251
3251
  }), f.on("conversation:reset", () => {
3252
- S([]), Pe(!1), j(!1), k("ai"), Se(!1), ye(!1);
3252
+ S([]), L(!1), j(!1), k("ai"), xe(!1), ve(!1);
3253
3253
  }), f.on("voice:end_session", (e = {}) => {
3254
3254
  console.log("[FlowEngageProvider] voice:end_session received — ending voice session"), Ne((e) => e + 1), D(!0), je((e) => e + 1);
3255
3255
  }), f.on("typing:start", (e) => {
3256
- e.sender === "agent" && ye(!0);
3256
+ e.sender === "agent" && ve(!0);
3257
3257
  }), f.on("typing:stop", (e) => {
3258
- e.sender === "agent" && ye(!1);
3258
+ e.sender === "agent" && ve(!1);
3259
3259
  }), f.on("call:incoming", (e = {}) => {
3260
3260
  let t = Ar([
3261
3261
  e.agentName,
@@ -3268,7 +3268,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3268
3268
  from: e.from || "owner",
3269
3269
  agentId: e.agentId || null,
3270
3270
  agentName: t
3271
- }), se((e) => Ar([t, e], "Agent")), He("incoming"), We(null), D(!0);
3271
+ }), oe((e) => Ar([t, e], "Agent")), He("incoming"), We(null), D(!0);
3272
3272
  }), f.on("call:offer", async (e = {}) => {
3273
3273
  nt.current = e;
3274
3274
  try {
@@ -3584,7 +3584,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3584
3584
  }
3585
3585
  let Ut = async (e, t = "", n = null, i = {}) => {
3586
3586
  let a = typeof e == "string" ? e.trim() : "";
3587
- if (!a || !B.current || !y || l !== "ready" || L) return;
3587
+ if (!a || !B.current || !y || l !== "ready" || Pe) return;
3588
3588
  Bt(), it.current = !1;
3589
3589
  let o = /^\s*(yes|yeah|sure|ok|okay|go ahead|take me(?: there)?(?!\s+\w)|navigate(?!\s+(?:me\s+)?to\s+\w)|yep|absolutely|please do|do it|let'?s go|go there|show me(?!\s+(?:the|a|an)\s+\w)|go to it|bring me there|navigate me there)\b/i, s = /^\s*(?:yes|yeah|sure|ok|okay|yep|absolutely)\s+(?!(?:please|do\s+it|let'?s|that|this|there|it|thanks|go|cool|great|perfect|sounds|alright|proceed)\b)\w/i, c = /\b(take me|navigate|go to|show me|bring me|open|go there|navigate to|take me to|let'?s go to)\b/i;
3590
3590
  if (rt.current && o.test(a) && !s.test(a)) {
@@ -3620,7 +3620,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3620
3620
  chatId: y,
3621
3621
  content: e,
3622
3622
  sender: "user",
3623
- email: ue || void 0,
3623
+ email: le || void 0,
3624
3624
  type: i?.type || "text",
3625
3625
  metadata: i?.metadata || {},
3626
3626
  ...n || {}
@@ -3631,7 +3631,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3631
3631
  try {
3632
3632
  let o = await B.current.sendAiMessage(y, e, r, t, {
3633
3633
  ...n || {},
3634
- ...ue ? { email: ue } : {}
3634
+ ...le ? { email: le } : {}
3635
3635
  }, {
3636
3636
  ...i,
3637
3637
  currentPageUrl: typeof window < "u" ? window.location.href : void 0,
@@ -3700,9 +3700,9 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3700
3700
  });
3701
3701
  }
3702
3702
  }
3703
- S(Er(s)), j(!!o.is_human_handled), k(o.is_human_handled ? "agent" : "ai"), Se(!1), we(!1), await B.current.updateChatStatus(y, "messageSent");
3703
+ S(Er(s)), j(!!o.is_human_handled), k(o.is_human_handled ? "agent" : "ai"), xe(!1), we(!1), await B.current.updateChatStatus(y, "messageSent");
3704
3704
  } catch (e) {
3705
- S((e) => e.filter((e) => e.id !== u)), Se(!1), we(!1), e.status === 429 ? (F(!0), Oe(e.message), window.setTimeout(() => {
3705
+ S((e) => e.filter((e) => e.id !== u)), xe(!1), we(!1), e.status === 429 ? (F(!0), Oe(e.message), window.setTimeout(() => {
3706
3706
  F(!1), Oe("");
3707
3707
  }, ee)) : h(e);
3708
3708
  }
@@ -3756,7 +3756,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3756
3756
  await B.current.updateChatStatus(y, "ended");
3757
3757
  } catch {}
3758
3758
  }
3759
- Pe(!0), S((e) => [...e, {
3759
+ L(!0), S((e) => [...e, {
3760
3760
  id: `conversation-ended-${Date.now()}`,
3761
3761
  sender: "system",
3762
3762
  message: "This conversation has ended. Thank you for reaching out!",
@@ -3795,9 +3795,9 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3795
3795
  }, []);
3796
3796
  let Jt = o(() => {
3797
3797
  let e = i?.siteId;
3798
- fe(e), Qe.current = !0, $e.current = null, z.current?.disconnect(), S([]), b(""), Ze.current = "", Pe(!1), j(!1), se(null), le(null), Xe(!0), s((e) => e + 1);
3798
+ de(e), Qe.current = !0, $e.current = null, z.current?.disconnect(), S([]), b(""), Ze.current = "", L(!1), j(!1), oe(null), ce(null), Xe(!0), s((e) => e + 1);
3799
3799
  }, [i?.siteId]), Yt = o((e) => {
3800
- i?.siteId, Qe.current = !1, $e.current = e, z.current?.disconnect(), S([]), b(""), Ze.current = "", Pe(!1), j(!1), se(null), le(null), Xe(!0), s((e) => e + 1);
3800
+ i?.siteId, Qe.current = !1, $e.current = e, z.current?.disconnect(), S([]), b(""), Ze.current = "", L(!1), j(!1), oe(null), ce(null), Xe(!0), s((e) => e + 1);
3801
3801
  }, [i?.siteId]), Xt = f(() => ({
3802
3802
  status: l,
3803
3803
  error: d,
@@ -3808,17 +3808,17 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3808
3808
  isOpen: T,
3809
3809
  activeScreen: O,
3810
3810
  isHumanHandled: A,
3811
- agentName: re,
3812
- agentHeadshot: ce,
3813
- visitorEmail: ue,
3814
- isAgentTyping: ve,
3815
- isAiTyping: xe,
3816
- connectionStatus: N,
3811
+ agentName: M,
3812
+ agentHeadshot: se,
3813
+ visitorEmail: le,
3814
+ isAgentTyping: _e,
3815
+ isAiTyping: be,
3816
+ connectionStatus: Se,
3817
3817
  isLoading: P,
3818
3818
  isVoiceMode: I,
3819
3819
  isRateLimited: Te,
3820
3820
  rateLimitMessage: De,
3821
- isConversationEnded: L,
3821
+ isConversationEnded: Pe,
3822
3822
  isSessionRestoring: Ye,
3823
3823
  openToChatCounter: Ae,
3824
3824
  voiceEndCounter: Me,
@@ -3869,17 +3869,17 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3869
3869
  T,
3870
3870
  O,
3871
3871
  A,
3872
- re,
3873
- ce,
3874
- ue,
3875
- ve,
3876
- xe,
3877
- N,
3872
+ M,
3873
+ se,
3874
+ le,
3875
+ _e,
3876
+ be,
3877
+ Se,
3878
3878
  P,
3879
3879
  I,
3880
3880
  Te,
3881
3881
  De,
3882
- L,
3882
+ Pe,
3883
3883
  Ye,
3884
3884
  Ae,
3885
3885
  Me,
@@ -8826,8 +8826,13 @@ var _m = {
8826
8826
  ..._m,
8827
8827
  ...nm,
8828
8828
  ...vm
8829
- }, hp), bm = 24e3, xm = 2048, Sm = 1200;
8830
- function Cm(e) {
8829
+ }, hp), bm = 24e3, xm = 2048, Sm = 1200, Cm = .05, wm = 3;
8830
+ function Tm(e) {
8831
+ let t = 0;
8832
+ for (let n = 0; n < e.length; n++) t += e[n] * e[n];
8833
+ return Math.sqrt(t / e.length);
8834
+ }
8835
+ function Em(e) {
8831
8836
  let t = new Int16Array(e.length);
8832
8837
  for (let n = 0; n < e.length; n++) {
8833
8838
  let r = Math.max(-1, Math.min(1, e[n]));
@@ -8835,35 +8840,36 @@ function Cm(e) {
8835
8840
  }
8836
8841
  return t;
8837
8842
  }
8838
- function wm(e) {
8843
+ function Dm(e) {
8839
8844
  let t = new Float32Array(e.length);
8840
8845
  for (let n = 0; n < e.length; n++) t[n] = e[n] / 32768;
8841
8846
  return t;
8842
8847
  }
8843
- function Tm(e, t) {
8844
- let n = 0, r = [];
8848
+ var Om = .18;
8849
+ function km(e, t) {
8850
+ let n = 0, r = [], i = () => {
8851
+ r.forEach((e) => {
8852
+ try {
8853
+ e.stop();
8854
+ } catch {}
8855
+ }), r = [], n = 0;
8856
+ }, a = () => n > e.currentTime;
8845
8857
  return {
8846
8858
  enqueue: (i) => {
8847
- let a = wm(i), o = e.createBuffer(1, a.length, bm);
8848
- o.copyToChannel(a, 0);
8849
- let s = e.createBufferSource();
8850
- s.buffer = o, s.connect(e.destination);
8851
- let c = Math.max(e.currentTime, n);
8852
- s.start(c), n = c + o.duration, r.push(s), s.onended = () => {
8853
- r = r.filter((e) => e !== s), r.length || t?.();
8859
+ let o = Dm(i), s = e.createBuffer(1, o.length, bm);
8860
+ s.copyToChannel(o, 0);
8861
+ let c = e.createBufferSource();
8862
+ c.buffer = s, c.connect(e.destination);
8863
+ let l = a() ? n : e.currentTime + Om;
8864
+ c.start(l), n = l + s.duration, r.push(c), c.onended = () => {
8865
+ r = r.filter((e) => e !== c), !r.length && !a() && t?.();
8854
8866
  };
8855
8867
  },
8856
- stop: () => {
8857
- r.forEach((e) => {
8858
- try {
8859
- e.stop();
8860
- } catch {}
8861
- }), r = [], n = 0;
8862
- },
8863
- isPlaying: () => r.length > 0
8868
+ stop: i,
8869
+ isPlaying: a
8864
8870
  };
8865
8871
  }
8866
- async function Em(e, t, n) {
8872
+ async function Am(e, t, n) {
8867
8873
  let r = new URLSearchParams({ siteId: t || "" });
8868
8874
  n && r.set("chatId", n);
8869
8875
  let i = await fetch(`${e}/api/voice/session?${r.toString()}`, {
@@ -8879,75 +8885,90 @@ async function Em(e, t, n) {
8879
8885
  if (!a?.success || !a.wsUrl) throw Error(a?.error || "Voice session was refused.");
8880
8886
  return a;
8881
8887
  }
8882
- async function Dm(e) {
8883
- let { apiBaseUrl: t, siteId: n, chatId: r, clientTools: i = {}, onConnect: a, onDisconnect: o, onMessage: s, onModeChange: c, onError: l, onUnhandledClientToolCall: u, onAgentTurnEnd: d, onSessionInfo: f } = e, p = await Em(t, n, r);
8884
- f?.({ emailOnFile: !!p.emailOnFile });
8885
- let m = { type: "Start" };
8886
- e.greeting !== void 0 && (m.greeting = e.greeting || null);
8887
- let h = await navigator.mediaDevices.getUserMedia({ audio: {
8888
+ async function jm(e) {
8889
+ let { apiBaseUrl: t, siteId: n, chatId: r, clientTools: i = {}, onConnect: a, onDisconnect: o, onMessage: s, onModeChange: c, onError: l, onUnhandledClientToolCall: u, onAgentTurnEnd: d, onSessionInfo: f, onSessionEnding: p } = e, m = await Am(t, n, r);
8890
+ f?.({ emailOnFile: !!m.emailOnFile });
8891
+ let h = { type: "Start" };
8892
+ e.greeting !== void 0 && (h.greeting = e.greeting || null);
8893
+ let g = await navigator.mediaDevices.getUserMedia({ audio: {
8888
8894
  channelCount: 1,
8889
8895
  echoCancellation: !0,
8890
8896
  noiseSuppression: !0,
8891
8897
  autoGainControl: !0
8892
- } }), g = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: bm });
8893
- g.state === "suspended" && await g.resume();
8894
- let _ = new WebSocket(p.wsUrl);
8895
- _.binaryType = "arraybuffer";
8896
- let v = /* @__PURE__ */ new Set(), y = {
8898
+ } }), _ = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: bm });
8899
+ _.state === "suspended" && await _.resume();
8900
+ let v = new WebSocket(m.wsUrl);
8901
+ v.binaryType = "arraybuffer";
8902
+ let y = /* @__PURE__ */ new Set(), b = {
8897
8903
  role: null,
8898
8904
  text: "",
8899
8905
  timer: null
8900
- }, b = "", x = () => {
8901
- y.timer &&= (clearTimeout(y.timer), null);
8902
- let e = y.text.trim(), t = y.role;
8903
- if (y.text = "", y.role = null, !(!e || !t)) {
8906
+ }, x = "", S = () => {
8907
+ b.timer &&= (clearTimeout(b.timer), null);
8908
+ let e = b.text.trim(), t = b.role;
8909
+ if (b.text = "", b.role = null, !(!e || !t)) {
8904
8910
  if (t === "agent") {
8905
- if (e === b) {
8911
+ if (e === x) {
8906
8912
  console.debug("[FlowEngage] duplicate agent turn suppressed");
8907
8913
  return;
8908
8914
  }
8909
- b = e;
8915
+ x = e;
8910
8916
  }
8911
8917
  s?.({
8912
8918
  role: t,
8913
8919
  message: e
8914
8920
  });
8915
8921
  }
8916
- }, S = (e, t) => {
8917
- t && (y.role && y.role !== e && x(), y.role = e, y.text = y.text ? `${y.text} ${t}`.replace(/\s+/g, " ") : t, y.timer && clearTimeout(y.timer), y.timer = setTimeout(x, Sm));
8918
- }, C = !1, w = !1, T = !1, E = !1, D = !0, O = null, k = () => {
8919
- O && clearTimeout(O);
8922
+ }, C = (e, t) => {
8923
+ t && (b.role && b.role !== e && S(), b.role = e, b.text = b.text ? `${b.text} ${t}`.replace(/\s+/g, " ") : t, b.timer && clearTimeout(b.timer), b.timer = setTimeout(S, Sm));
8924
+ }, w = !1, T = !1, E = !1, D = !1, O = !0, k = 0, A = !1, ee = !1, te = null, ne = !1, j = () => {
8925
+ te && clearTimeout(te);
8920
8926
  let e = () => {
8921
- if (!C) {
8922
- if (A.isPlaying()) {
8923
- O = setTimeout(e, 150);
8927
+ if (!w) {
8928
+ if (M.isPlaying()) {
8929
+ te = setTimeout(e, 150);
8924
8930
  return;
8925
8931
  }
8926
- O = null, d?.();
8932
+ if (te = null, ne) {
8933
+ p?.();
8934
+ return;
8935
+ }
8936
+ !w && v.readyState === WebSocket.OPEN && v.send(JSON.stringify({ type: "PlaybackDrained" })), d?.();
8927
8937
  }
8928
8938
  };
8929
- O = setTimeout(e, 150);
8930
- }, A = Tm(g, () => {
8931
- E && (E = !1, c?.({ mode: "listening" }));
8932
- }), ee = g.createMediaStreamSource(h), te = g.createScriptProcessor(xm, 1, 1);
8933
- te.onaudioprocess = (e) => {
8934
- if (C || _.readyState !== WebSocket.OPEN) return;
8935
- let t = e.inputBuffer.getChannelData(0);
8936
- if (w) {
8937
- T || (T = !0, console.debug("[FlowEngage] mic held — streaming silence to keep socket alive")), _.send(new Int16Array(t.length).buffer);
8939
+ te = setTimeout(e, 150);
8940
+ }, M = km(_, () => {
8941
+ D && (D = !1, c?.({ mode: "listening" }));
8942
+ }), re = _.createMediaStreamSource(g), ie = _.createScriptProcessor(xm, 1, 1);
8943
+ ie.onaudioprocess = (e) => {
8944
+ if (w || v.readyState !== WebSocket.OPEN) return;
8945
+ let t = e.inputBuffer.getChannelData(0), n = () => v.send(new Int16Array(t.length).buffer);
8946
+ if (T) {
8947
+ E || (E = !0, console.debug("[FlowEngage] mic held — streaming silence to keep socket alive")), n();
8938
8948
  return;
8939
8949
  }
8940
- _.send(Cm(t).buffer);
8941
- }, ee.connect(te), te.connect(g.destination);
8942
- let ne = () => {
8943
- if (!C) {
8944
- C = !0, O &&= (clearTimeout(O), null), x(), A.stop();
8950
+ if ((M.isPlaying() || ee) && !A) {
8951
+ if (Tm(t) < Cm) {
8952
+ k = 0, n();
8953
+ return;
8954
+ }
8955
+ if (k += 1, k < wm) {
8956
+ n();
8957
+ return;
8958
+ }
8959
+ A = !0, k = 0, M.stop(), O = !1, console.debug("[FlowEngage] barge-in — visitor spoke over the agent");
8960
+ }
8961
+ v.send(Em(t).buffer);
8962
+ }, re.connect(ie), ie.connect(_.destination);
8963
+ let ae = () => {
8964
+ if (!w) {
8965
+ w = !0, te &&= (clearTimeout(te), null), S(), M.stop();
8945
8966
  try {
8946
- te.disconnect(), ee.disconnect();
8967
+ ie.disconnect(), re.disconnect();
8947
8968
  } catch {}
8948
- h.getTracks().forEach((e) => e.stop()), g.close().catch(() => {}), (_.readyState === WebSocket.OPEN || _.readyState === WebSocket.CONNECTING) && _.close();
8969
+ g.getTracks().forEach((e) => e.stop()), _.close().catch(() => {}), (v.readyState === WebSocket.OPEN || v.readyState === WebSocket.CONNECTING) && v.close();
8949
8970
  }
8950
- }, j = async (e) => {
8971
+ }, oe = async (e) => {
8951
8972
  let t = i[e.name];
8952
8973
  if (!t) return u?.({ tool_name: e.name }), { error: `Unknown tool ${e.name}` };
8953
8974
  let n = {};
@@ -8959,19 +8980,19 @@ async function Dm(e) {
8959
8980
  } catch (e) {
8960
8981
  return { error: e?.message || "Tool execution failed" };
8961
8982
  }
8962
- }, re = async (e) => {
8983
+ }, se = async (e) => {
8963
8984
  for (let t of e.functions || []) {
8964
8985
  if (!t.client_side) continue;
8965
- let e = await j(t);
8966
- if (C || _.readyState !== WebSocket.OPEN) return;
8967
- _.send(JSON.stringify({
8986
+ let e = await oe(t);
8987
+ if (w || v.readyState !== WebSocket.OPEN) return;
8988
+ v.send(JSON.stringify({
8968
8989
  type: "FunctionCallResponse",
8969
8990
  id: t.id,
8970
8991
  name: t.name,
8971
8992
  content: typeof e == "string" ? e : JSON.stringify(e ?? {})
8972
8993
  }));
8973
8994
  }
8974
- }, ie = (e) => {
8995
+ }, ce = (e) => {
8975
8996
  switch (e.type) {
8976
8997
  case "Welcome":
8977
8998
  a?.({ conversationId: e.session_id || r || n });
@@ -8980,8 +9001,8 @@ async function Dm(e) {
8980
9001
  let t = String(e.content || "");
8981
9002
  if (e.role === "user") {
8982
9003
  let e = t.trim();
8983
- if (v.has(e)) {
8984
- v.delete(e);
9004
+ if (y.has(e)) {
9005
+ y.delete(e);
8985
9006
  break;
8986
9007
  }
8987
9008
  if (/^\[SYSTEM:/i.test(e) || /^Continue (now )?to the next section/i.test(e) || /^That was the last section/i.test(e)) {
@@ -8989,20 +9010,26 @@ async function Dm(e) {
8989
9010
  break;
8990
9011
  }
8991
9012
  }
8992
- S(e.role === "user" ? "user" : "agent", t);
9013
+ C(e.role === "user" ? "user" : "agent", t);
8993
9014
  break;
8994
9015
  }
8995
9016
  case "UserStartedSpeaking":
8996
- x(), A.stop(), D = !1, E = !1, c?.({ mode: "listening" });
9017
+ S(), M.stop(), ee = !1, O = !1, D = !1, c?.({ mode: "listening" });
8997
9018
  break;
8998
9019
  case "AgentStartedSpeaking":
8999
- D = !0, E = !0, c?.({ mode: "speaking" });
9020
+ O = !0, D = !0, A = !1, k = 0, c?.({ mode: "speaking" });
9000
9021
  break;
9001
9022
  case "AgentAudioDone":
9002
- x(), k(), A.isPlaying() || (E = !1, c?.({ mode: "listening" }));
9023
+ ee = !1, S(), j(), M.isPlaying() || (D = !1, c?.({ mode: "listening" }));
9003
9024
  break;
9004
9025
  case "FunctionCallRequest":
9005
- re(e);
9026
+ se(e);
9027
+ break;
9028
+ case "AgentPreparing":
9029
+ ee = !0;
9030
+ break;
9031
+ case "SessionEnding":
9032
+ console.debug("[FlowEngage] server is ending the session:", e.reason || "unspecified"), ne = !0;
9006
9033
  break;
9007
9034
  case "PromptUpdated":
9008
9035
  case "AgentThinking": break;
@@ -9015,46 +9042,56 @@ async function Dm(e) {
9015
9042
  default: break;
9016
9043
  }
9017
9044
  };
9018
- return _.onopen = () => _.send(JSON.stringify(m)), _.onmessage = (e) => {
9045
+ return v.onopen = () => v.send(JSON.stringify(h)), v.onmessage = (e) => {
9019
9046
  if (e.data instanceof ArrayBuffer) {
9020
- D && A.enqueue(new Int16Array(e.data));
9047
+ O && M.enqueue(new Int16Array(e.data));
9021
9048
  return;
9022
9049
  }
9023
9050
  try {
9024
- ie(JSON.parse(e.data));
9051
+ ce(JSON.parse(e.data));
9025
9052
  } catch {}
9026
- }, _.onerror = () => l?.(/* @__PURE__ */ Error("Voice connection failed")), _.onclose = () => {
9027
- ne(), o?.();
9053
+ }, v.onerror = () => l?.(/* @__PURE__ */ Error("Voice connection failed")), v.onclose = () => {
9054
+ ae(), o?.();
9028
9055
  }, {
9029
- endSession: async () => ne(),
9056
+ endSession: async () => ae(),
9030
9057
  sendContextualUpdate: (e) => {
9031
- C || _.readyState !== WebSocket.OPEN || !e || _.send(JSON.stringify({
9058
+ w || v.readyState !== WebSocket.OPEN || !e || v.send(JSON.stringify({
9032
9059
  type: "UpdatePrompt",
9033
9060
  prompt: e
9034
9061
  }));
9035
9062
  },
9036
- sendUserMessage: (e, { silent: t = !0 } = {}) => {
9037
- C || _.readyState !== WebSocket.OPEN || !e || (t && v.add(e.trim()), _.send(JSON.stringify({
9063
+ sendUserMessage: (e, { silent: t = !0, suppressQuestion: n = !1 } = {}) => {
9064
+ w || v.readyState !== WebSocket.OPEN || !e || (t && y.add(e.trim()), v.send(JSON.stringify({
9038
9065
  type: "InjectUserMessage",
9039
- content: e
9066
+ content: e,
9067
+ suppress_question: n
9040
9068
  })));
9041
9069
  },
9042
9070
  injectAgentSpeech: (e, t = "interrupt") => {
9043
- C || _.readyState !== WebSocket.OPEN || !e || _.send(JSON.stringify({
9071
+ w || v.readyState !== WebSocket.OPEN || !e || v.send(JSON.stringify({
9044
9072
  type: "InjectAgentMessage",
9045
9073
  message: e,
9046
9074
  behavior: t
9047
9075
  }));
9048
9076
  },
9077
+ setWalkthroughActive: (e) => {
9078
+ w || v.readyState !== WebSocket.OPEN || v.send(JSON.stringify({
9079
+ type: "WalkthroughActive",
9080
+ active: !!e
9081
+ }));
9082
+ },
9049
9083
  setMicMuted: (e) => {
9050
- w = !!e;
9084
+ T = !!e, !w && v.readyState === WebSocket.OPEN && v.send(JSON.stringify({
9085
+ type: "MicHeld",
9086
+ held: T
9087
+ }));
9051
9088
  },
9052
9089
  get status() {
9053
- return C ? "disconnected" : "connected";
9090
+ return w ? "disconnected" : "connected";
9054
9091
  }
9055
9092
  };
9056
9093
  }
9057
- var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9094
+ var Mm = { startSession: jm }, Nm = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9058
9095
  width: e,
9059
9096
  height: e,
9060
9097
  viewBox: "0 0 24 24",
@@ -9070,7 +9107,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9070
9107
  strokeLinecap: "round",
9071
9108
  strokeLinejoin: "round"
9072
9109
  })]
9073
- }), Am = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
9110
+ }), Pm = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
9074
9111
  width: e,
9075
9112
  height: e,
9076
9113
  viewBox: "0 0 24 24",
@@ -9085,7 +9122,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9085
9122
  x2: "1",
9086
9123
  y2: "23"
9087
9124
  })]
9088
- }), jm = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
9125
+ }), Fm = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
9089
9126
  width: e,
9090
9127
  height: e,
9091
9128
  viewBox: "0 0 24 24",
@@ -9100,7 +9137,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9100
9137
  x2: "12",
9101
9138
  y2: "5"
9102
9139
  }), /* @__PURE__ */ g("polyline", { points: "5 12 12 5 19 12" })]
9103
- }), Mm = () => /* @__PURE__ */ _("svg", {
9140
+ }), Im = () => /* @__PURE__ */ _("svg", {
9104
9141
  width: "14",
9105
9142
  height: "14",
9106
9143
  viewBox: "0 0 24 24",
@@ -9110,7 +9147,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9110
9147
  strokeLinecap: "round",
9111
9148
  strokeLinejoin: "round",
9112
9149
  children: [/* @__PURE__ */ g("polyline", { points: "9 17 4 12 9 7" }), /* @__PURE__ */ g("path", { d: "M20 18v-2a4 4 0 00-4-4H4" })]
9113
- }), Nm = () => /* @__PURE__ */ g("svg", {
9150
+ }), Lm = () => /* @__PURE__ */ g("svg", {
9114
9151
  width: "18",
9115
9152
  height: "18",
9116
9153
  viewBox: "0 0 24 24",
@@ -9120,7 +9157,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9120
9157
  strokeLinecap: "round",
9121
9158
  strokeLinejoin: "round",
9122
9159
  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" })
9123
- }), Pm = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
9160
+ }), Rm = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
9124
9161
  className: e,
9125
9162
  width: "14",
9126
9163
  height: "14",
@@ -9149,7 +9186,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9149
9186
  y2: "16"
9150
9187
  })
9151
9188
  ]
9152
- }), Fm = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
9189
+ }), zm = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
9153
9190
  width: e,
9154
9191
  height: e,
9155
9192
  viewBox: "0 0 24 24",
@@ -9172,7 +9209,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9172
9209
  /* @__PURE__ */ g("path", { d: "M15 13v2" }),
9173
9210
  /* @__PURE__ */ g("path", { d: "M9 13v2" })
9174
9211
  ]
9175
- }), Im = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
9212
+ }), Bm = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
9176
9213
  width: e,
9177
9214
  height: e,
9178
9215
  viewBox: "0 0 24 24",
@@ -9192,7 +9229,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9192
9229
  x2: "19",
9193
9230
  y2: "12"
9194
9231
  })]
9195
- }), Lm = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9232
+ }), Vm = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9196
9233
  width: e,
9197
9234
  height: e,
9198
9235
  viewBox: "0 0 24 24",
@@ -9218,7 +9255,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9218
9255
  fill: t
9219
9256
  })
9220
9257
  ]
9221
- }), Rm = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9258
+ }), Hm = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9222
9259
  width: "24",
9223
9260
  height: "24",
9224
9261
  viewBox: "0 0 24 24",
@@ -9236,7 +9273,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9236
9273
  "stroke-linecap": "round",
9237
9274
  "stroke-linejoin": "round"
9238
9275
  })]
9239
- }), zm = () => /* @__PURE__ */ g("svg", {
9276
+ }), Um = () => /* @__PURE__ */ g("svg", {
9240
9277
  width: "24",
9241
9278
  height: "24",
9242
9279
  viewBox: "0 0 24 24",
@@ -9248,7 +9285,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9248
9285
  "stroke-width": "1.5",
9249
9286
  "stroke-linejoin": "round"
9250
9287
  })
9251
- }), Bm = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
9288
+ }), Wm = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
9252
9289
  xmlns: "http://www.w3.org/2000/svg",
9253
9290
  width: e,
9254
9291
  height: e,
@@ -9266,7 +9303,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9266
9303
  /* @__PURE__ */ g("path", { d: "m2 2 20 20" }),
9267
9304
  /* @__PURE__ */ g("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12" })
9268
9305
  ]
9269
- }), Vm = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), Hm = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), Um = new Set([
9306
+ }), Gm = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), Km = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), qm = new Set([
9270
9307
  "p",
9271
9308
  "br",
9272
9309
  "ul",
@@ -9277,30 +9314,30 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9277
9314
  "b",
9278
9315
  "i",
9279
9316
  "a"
9280
- ]), Wm = /^https?:\/\//i;
9281
- function Gm(e) {
9317
+ ]), Jm = /^https?:\/\//i;
9318
+ function Ym(e) {
9282
9319
  let t = Array.from(e.childNodes);
9283
9320
  for (let n of t) if (n.nodeType === Node.ELEMENT_NODE) {
9284
9321
  let t = n.tagName.toLowerCase();
9285
- if (!Um.has(t)) {
9322
+ if (!qm.has(t)) {
9286
9323
  e.replaceChild(document.createTextNode(n.textContent), n);
9287
9324
  continue;
9288
9325
  }
9289
9326
  let r = {};
9290
9327
  if (t === "a") {
9291
9328
  let e = n.getAttribute("href") || "";
9292
- Wm.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
9329
+ Jm.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
9293
9330
  }
9294
9331
  for (; n.attributes.length > 0;) n.removeAttribute(n.attributes[0].name);
9295
9332
  for (let [e, t] of Object.entries(r)) n.setAttribute(e, t);
9296
- Gm(n);
9333
+ Ym(n);
9297
9334
  } else n.nodeType !== Node.TEXT_NODE && e.removeChild(n);
9298
9335
  }
9299
- function Km(e) {
9336
+ function Xm(e) {
9300
9337
  let t = document.createElement("div");
9301
- return t.innerHTML = e, Gm(t), t.innerHTML;
9338
+ return t.innerHTML = e, Ym(t), t.innerHTML;
9302
9339
  }
9303
- function qm(e) {
9340
+ function Zm(e) {
9304
9341
  let t = String(e || "").trim();
9305
9342
  if (!t) return t;
9306
9343
  let n = /^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);
@@ -9312,33 +9349,33 @@ function qm(e) {
9312
9349
  }
9313
9350
  return e;
9314
9351
  }
9315
- var Jm = (e = "") => {
9352
+ var Qm = (e = "") => {
9316
9353
  let t = String(e || "").trim();
9317
9354
  if (!t) return "";
9318
- if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return qm(Km(t));
9319
- 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) => Hm(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>");
9320
- return qm(n.map((e) => {
9355
+ if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return Zm(Xm(t));
9356
+ 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) => Km(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>");
9357
+ return Zm(n.map((e) => {
9321
9358
  let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = t.filter((e) => /^[-*]\s+/.test(e));
9322
9359
  if (n.length >= 2 && n.length === t.length) return `<ul>${n.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>`;
9323
9360
  let i = e.split(/\s+(?=[-*]\s+\*\*?)/).map((e) => e.trim()).filter(Boolean);
9324
9361
  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>`;
9325
9362
  }).join(""));
9326
- }, Ym = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), Xm = new Set([
9363
+ }, $m = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), eh = new Set([
9327
9364
  ".pdf",
9328
9365
  ".docx",
9329
9366
  ".png",
9330
9367
  ".jpg",
9331
9368
  ".jpeg"
9332
- ]), Zm = "image/png,image/jpeg,.pdf,.docx";
9333
- function Qm(e) {
9369
+ ]), th = "image/png,image/jpeg,.pdf,.docx";
9370
+ function nh(e) {
9334
9371
  if (!e) return !1;
9335
9372
  let t = typeof e.name == "string" ? e.name.toLowerCase() : "", n = t.includes(".") ? `.${t.split(".").pop()}` : "", r = typeof e.type == "string" ? e.type.toLowerCase() : "";
9336
- return r === "image/png" || r === "image/jpeg" || Ym.has(r) || Xm.has(n);
9373
+ return r === "image/png" || r === "image/jpeg" || $m.has(r) || eh.has(n);
9337
9374
  }
9338
- function $m(e) {
9339
- return e ? Qm(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
9375
+ function rh(e) {
9376
+ return e ? nh(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
9340
9377
  }
9341
- function eh(e = 0) {
9378
+ function ih(e = 0) {
9342
9379
  if (!Number.isFinite(e) || e <= 0) return "";
9343
9380
  let t = [
9344
9381
  "B",
@@ -9350,12 +9387,12 @@ function eh(e = 0) {
9350
9387
  let i = n >= 10 || r === 0 ? 0 : 1;
9351
9388
  return `${n.toFixed(i)} ${t[r]}`;
9352
9389
  }
9353
- function th(e) {
9390
+ function ah(e) {
9354
9391
  return e ? e.name || "Attachment" : "";
9355
9392
  }
9356
9393
  //#endregion
9357
9394
  //#region src/utils/avatarHelpers.js
9358
- function nh(e) {
9395
+ function oh(e) {
9359
9396
  if (!e || typeof e != "string") return "?";
9360
9397
  let t = e.trim();
9361
9398
  if (!t) return "?";
@@ -9364,7 +9401,7 @@ function nh(e) {
9364
9401
  }
9365
9402
  //#endregion
9366
9403
  //#region src/components/AvatarImageOrInitials.jsx
9367
- function rh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9404
+ function sh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9368
9405
  let [i, a] = m(null), o = typeof e == "string" ? e.trim() : "";
9369
9406
  return c(() => {
9370
9407
  if (!o) {
@@ -9387,12 +9424,12 @@ function rh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9387
9424
  onError: () => a(null)
9388
9425
  }) : /* @__PURE__ */ g("span", {
9389
9426
  style: r,
9390
- children: nh(t)
9427
+ children: oh(t)
9391
9428
  });
9392
9429
  }
9393
9430
  //#endregion
9394
9431
  //#region src/components/MessageList.jsx
9395
- function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
9432
+ function ch({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
9396
9433
  let { resolvedConfig: d } = Cn(), f = p(null), [v, y] = m(null), [b, x] = m(null), S = p(e.length), C = p(!0), w = p(null), T = o((e) => {
9397
9434
  let t = e.target.closest("a[href]");
9398
9435
  if (!t) return;
@@ -9447,7 +9484,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9447
9484
  children: [
9448
9485
  e.map((e) => {
9449
9486
  if (e.type === "call_recording" || typeof e.message == "string" && e.message.includes("AI chat recording")) return null;
9450
- let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, d = e.type === "file" && e.metadata?.fileUrl, f = e.agent_name || e.agentName || e.metadata?.agentName || l, p = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, m = Vm(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
9487
+ let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, d = e.type === "file" && e.metadata?.fileUrl, f = e.agent_name || e.agentName || e.metadata?.agentName || l, p = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, m = Gm(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
9451
9488
  return t ? /* @__PURE__ */ g("div", {
9452
9489
  style: {
9453
9490
  display: "flex",
@@ -9492,7 +9529,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9492
9529
  fontWeight: 800,
9493
9530
  marginTop: !c && (r || o) ? "22px" : "0px"
9494
9531
  },
9495
- children: r ? u || /* @__PURE__ */ g(Fm, { size: 16 }) : /* @__PURE__ */ g(rh, {
9532
+ children: r ? u || /* @__PURE__ */ g(zm, { size: 16 }) : /* @__PURE__ */ g(sh, {
9496
9533
  src: p || "",
9497
9534
  name: f,
9498
9535
  imgStyle: {
@@ -9534,7 +9571,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9534
9571
  onMouseLeave: (e) => {
9535
9572
  e.currentTarget.style.color = "#9ca3af";
9536
9573
  },
9537
- children: [/* @__PURE__ */ g(Mm, {}), "Reply"]
9574
+ children: [/* @__PURE__ */ g(Im, {}), "Reply"]
9538
9575
  }),
9539
9576
  /* @__PURE__ */ _("div", {
9540
9577
  style: {
@@ -9578,7 +9615,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9578
9615
  children: m
9579
9616
  })]
9580
9617
  }), d ? (() => {
9581
- let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = eh(e.metadata.fileSize), a = t.startsWith("image/"), o = `shared file: ${r}`.toLowerCase(), s = (e.message || "").trim(), c = s && s.toLowerCase() !== o && !s.toLowerCase().startsWith("shared file:"), l = t === "application/pdf" ? {
9618
+ let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = ih(e.metadata.fileSize), a = t.startsWith("image/"), o = `shared file: ${r}`.toLowerCase(), s = (e.message || "").trim(), c = s && s.toLowerCase() !== o && !s.toLowerCase().startsWith("shared file:"), l = t === "application/pdf" ? {
9582
9619
  color: "#ef4444",
9583
9620
  label: "PDF"
9584
9621
  } : t.includes("word") || t.includes("docx") ? {
@@ -9759,7 +9796,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9759
9796
  });
9760
9797
  })() : r ? /* @__PURE__ */ g("div", {
9761
9798
  className: "flowengage-message-content fe-bot-message",
9762
- dangerouslySetInnerHTML: { __html: Jm(e.message) },
9799
+ dangerouslySetInnerHTML: { __html: Qm(e.message) },
9763
9800
  onClick: T
9764
9801
  }) : /* @__PURE__ */ g("div", {
9765
9802
  style: { whiteSpace: "pre-wrap" },
@@ -9824,7 +9861,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9824
9861
  boxShadow: u ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
9825
9862
  overflow: "hidden"
9826
9863
  },
9827
- children: u || /* @__PURE__ */ g(Fm, { size: 16 })
9864
+ children: u || /* @__PURE__ */ g(zm, { size: 16 })
9828
9865
  }), /* @__PURE__ */ _("div", {
9829
9866
  style: {
9830
9867
  display: "flex",
@@ -9866,7 +9903,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9866
9903
  borderRadius: "50%",
9867
9904
  overflow: "hidden"
9868
9905
  },
9869
- children: /* @__PURE__ */ g(rh, {
9906
+ children: /* @__PURE__ */ g(sh, {
9870
9907
  src: s || "",
9871
9908
  name: l,
9872
9909
  imgStyle: {
@@ -9960,8 +9997,8 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9960
9997
  }
9961
9998
  //#endregion
9962
9999
  //#region src/components/ChatInput.jsx
9963
- var ah = typeof window < "u" && (window.matchMedia?.("(pointer: coarse)").matches || navigator.maxTouchPoints > 0);
9964
- function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: l, clearReplyContext: u, requiresEmail: d, emailInput: f, setEmailInput: m, emailError: v, showVoiceToggle: y = !1, voiceEnabled: b = !0, onFileSelect: x, selectedFile: S = null, onRemoveSelectedFile: C, attachmentError: w = "", isUploadingAttachment: T = !1, inputPlaceholder: E = "Type your message" }) {
10000
+ var lh = typeof window < "u" && (window.matchMedia?.("(pointer: coarse)").matches || navigator.maxTouchPoints > 0);
10001
+ function uh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: l, clearReplyContext: u, requiresEmail: d, emailInput: f, setEmailInput: m, emailError: v, showVoiceToggle: y = !1, voiceEnabled: b = !0, onFileSelect: x, selectedFile: S = null, onRemoveSelectedFile: C, attachmentError: w = "", isUploadingAttachment: T = !1, inputPlaceholder: E = "Type your message" }) {
9965
10002
  let D = p(null), O = p(null), k = (e) => {
9966
10003
  e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 120)}px`);
9967
10004
  };
@@ -9969,7 +10006,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
9969
10006
  d || k(O.current);
9970
10007
  }, [e, d]);
9971
10008
  let A = (e) => {
9972
- e.key === "Enter" && (ah || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), e.currentTarget.form?.requestSubmit()));
10009
+ e.key === "Enter" && (lh || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), e.currentTarget.form?.requestSubmit()));
9973
10010
  }, ee = l?.sender === "user" ? "You" : l?.sender === "agent" ? "Agent" : "AI Assistant", te = d ? !!f?.trim() : !!e?.trim() || !!S, ne = s || T || !te, j = !d && b && y;
9974
10011
  return /* @__PURE__ */ _("div", {
9975
10012
  style: {
@@ -10064,7 +10101,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10064
10101
  background: "rgba(59,130,246,0.08)",
10065
10102
  color: "var(--flowengage-primary)"
10066
10103
  },
10067
- children: /* @__PURE__ */ g(Fm, { size: 13 })
10104
+ children: /* @__PURE__ */ g(zm, { size: 13 })
10068
10105
  }), /* @__PURE__ */ g("span", { children: "Please provide your email address so we can help you." })]
10069
10106
  })
10070
10107
  }),
@@ -10104,7 +10141,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10104
10141
  overflow: "hidden",
10105
10142
  textOverflow: "ellipsis"
10106
10143
  },
10107
- children: th(S)
10144
+ children: ah(S)
10108
10145
  }),
10109
10146
  /* @__PURE__ */ g("div", {
10110
10147
  style: {
@@ -10112,7 +10149,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10112
10149
  color: "#6b7280",
10113
10150
  marginTop: "2px"
10114
10151
  },
10115
- children: eh(S.size)
10152
+ children: ih(S.size)
10116
10153
  })
10117
10154
  ]
10118
10155
  }), /* @__PURE__ */ g("button", {
@@ -10157,7 +10194,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10157
10194
  j ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("input", {
10158
10195
  ref: D,
10159
10196
  type: "file",
10160
- accept: Zm,
10197
+ accept: th,
10161
10198
  style: { display: "none" },
10162
10199
  onChange: (e) => {
10163
10200
  let t = e.target.files?.[0];
@@ -10189,7 +10226,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10189
10226
  onMouseLeave: (e) => {
10190
10227
  e.currentTarget.style.opacity = "1";
10191
10228
  },
10192
- children: /* @__PURE__ */ g(Im, {
10229
+ children: /* @__PURE__ */ g(Bm, {
10193
10230
  size: 16,
10194
10231
  color: "currentColor"
10195
10232
  })
@@ -10270,7 +10307,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10270
10307
  onMouseLeave: (e) => {
10271
10308
  e.currentTarget.style.opacity = "1";
10272
10309
  },
10273
- children: /* @__PURE__ */ g(jm, { size: 16 })
10310
+ children: /* @__PURE__ */ g(Fm, { size: 16 })
10274
10311
  })
10275
10312
  ]
10276
10313
  }),
@@ -10333,7 +10370,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10333
10370
  }
10334
10371
  //#endregion
10335
10372
  //#region src/components/StatusBanners.jsx
10336
- function sh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
10373
+ function dh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
10337
10374
  return /* @__PURE__ */ _(h, { children: [(e || t) && /* @__PURE__ */ _("div", {
10338
10375
  style: {
10339
10376
  margin: "0 20px 10px",
@@ -10346,7 +10383,7 @@ function sh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
10346
10383
  gap: "10px"
10347
10384
  },
10348
10385
  children: [
10349
- /* @__PURE__ */ g(Pm, { className: "" }),
10386
+ /* @__PURE__ */ g(Rm, { className: "" }),
10350
10387
  /* @__PURE__ */ g("span", {
10351
10388
  style: {
10352
10389
  fontSize: "12px",
@@ -10392,13 +10429,13 @@ function sh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
10392
10429
  }
10393
10430
  //#endregion
10394
10431
  //#region src/components/AnimatedOrb.jsx
10395
- var ch = [
10432
+ var fh = [
10396
10433
  "#135bd8",
10397
10434
  "#ef334b",
10398
10435
  "#ffbd2e"
10399
10436
  ];
10400
- function lh(e) {
10401
- return !Array.isArray(e) || e.length === 0 ? ch : e.length === 1 ? [
10437
+ function ph(e) {
10438
+ return !Array.isArray(e) || e.length === 0 ? fh : e.length === 1 ? [
10402
10439
  e[0],
10403
10440
  e[0],
10404
10441
  e[0]
@@ -10412,7 +10449,7 @@ function lh(e) {
10412
10449
  e[2]
10413
10450
  ];
10414
10451
  }
10415
- var uh = {
10452
+ var mh = {
10416
10453
  idle: 3,
10417
10454
  listening: .75,
10418
10455
  thinking: 1,
@@ -10420,7 +10457,7 @@ var uh = {
10420
10457
  muted: .75,
10421
10458
  error: .08
10422
10459
  };
10423
- function dh(e) {
10460
+ function hh(e) {
10424
10461
  if (!e || typeof e != "string") return [
10425
10462
  0,
10426
10463
  0,
@@ -10433,14 +10470,14 @@ function dh(e) {
10433
10470
  parseInt(n.slice(4, 6), 16) / 255
10434
10471
  ];
10435
10472
  }
10436
- function fh(e, t) {
10473
+ function gh(e, t) {
10437
10474
  if (!e || typeof e != "string") return `rgba(0,0,0,${t})`;
10438
10475
  if (e.startsWith("rgb")) return e.replace(/[\d.]+\)$/, `${t})`);
10439
10476
  let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
10440
10477
  return `rgba(${parseInt(r.slice(0, 2), 16)},${parseInt(r.slice(2, 4), 16)},${parseInt(r.slice(4, 6), 16)},${t})`;
10441
10478
  }
10442
- var ph = "\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", mh = "\n precision highp float;\n\n varying vec2 v_uv;\n uniform float u_time;\n uniform float u_speed;\n uniform vec3 u_c1;\n uniform vec3 u_c2;\n uniform vec3 u_c3;\n\n // ── Gradient noise ─────────────────────────────────────────────────────────\n vec2 hash2(vec2 p) {\n p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));\n return -1.0 + 2.0 * fract(sin(p) * 43758.5453123);\n }\n float gnoise(vec2 p) {\n vec2 i = floor(p), f = fract(p);\n vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);\n return mix(\n mix(dot(hash2(i), f),\n dot(hash2(i+vec2(1,0)), f-vec2(1,0)), u.x),\n mix(dot(hash2(i+vec2(0,1)), f-vec2(0,1)),\n dot(hash2(i+vec2(1,1)), f-vec2(1,1)), u.x),\n u.y\n ) * 0.5 + 0.5;\n }\n\n // ── 3-octave FBM normalised to [0,1] — fewer octaves → larger, softer blobs\n float fbm(vec2 p) {\n float v = 0.0, a = 0.5;\n for (int i = 0; i < 3; i++) {\n v += a * gnoise(p);\n p = p * 2.1 + vec2(100.0);\n a *= 0.5;\n }\n return v / 0.875;\n }\n\n // ── Scalar hash for grain ──────────────────────────────────────────────────\n float hash1(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n }\n\n void main() {\n vec2 uv = v_uv;\n float t = u_time * u_speed + 47.3;\n\n // ── ① Two-level domain warp — deep organic folding and swirling ───────────\n // First pass: large-scale sweep\n vec2 q = vec2(\n fbm(uv * 1.8 + vec2( t * 0.13, t * 0.11)) * 2.0 - 1.0,\n fbm(uv * 1.8 + vec2( t * 0.11 + 3.7, -t * 0.14 + 1.1)) * 2.0 - 1.0\n );\n // Second pass: warp the warp — creates curling, folding sub-currents\n vec2 r = vec2(\n fbm(uv * 1.8 + q * 0.55 + vec2( t * 0.09, t * 0.07)) * 2.0 - 1.0,\n fbm(uv * 1.8 + q * 0.55 + vec2(-t * 0.07 + 5.1, t * 0.10 + 2.3)) * 2.0 - 1.0\n );\n vec2 wp = uv + r * 0.38;\n\n // ── ② Three independent fields — each drifts inward from its source edge ──\n // Asymmetric velocities: dominant axis matches the inflow direction so the\n // noise texture visually streams inward (left→right, right→left, bottom→top).\n float f1 = fbm(wp * 0.85 + vec2(-t * 0.18, t * 0.04)); // LEFT → right\n float f2 = fbm(wp * 0.85 + vec2( t * 0.18 + 5.3, t * 0.04 + 1.7)); // RIGHT → left\n float f3 = fbm(wp * 0.85 + vec2( t * 0.04 - 3.2, -t * 0.18 + 6.4)); // BOTTOM → up\n\n // ── ③ Breathing blobs — sin pulse makes each field expand and contract ────\n float p1 = 0.88 + 0.12 * sin(t * 0.61);\n float p2 = 0.88 + 0.12 * sin(t * 0.47 + 2.09);\n float p3 = 0.88 + 0.12 * sin(t * 0.53 + 4.19);\n\n // Wide smoothstep (0.26 → 0.70) → soft, diffused blob edges that dissolve\n // gradually into each other, like dye spreading through water.\n float b1 = smoothstep(0.26, 0.70, f1 * p1);\n float b2 = smoothstep(0.26, 0.70, f2 * p2);\n float b3 = smoothstep(0.26, 0.70, f3 * p3);\n\n // ── ④ Directional origin gradients.\n // Each color owns its home edge (value = 1.0) and smoothly fades to zero\n // before reaching the opposite side. The transition windows are offset so\n // they overlap only in the center third — that overlap zone is where the\n // three colors meet and blend, while the edges stay uncontaminated.\n float d1 = 1.0 - smoothstep(0.20, 0.74, uv.x); // c1: LEFT → full at x<0.20, zero by x=0.74\n float d2 = 1.0 - smoothstep(0.20, 0.74, 1.0 - uv.x); // c2: RIGHT → full at x>0.80, zero by x=0.26\n float d3 = 1.0 - smoothstep(0.18, 0.68, uv.y); // c3: BOTTOM → full at y<0.18, zero by y=0.68\n\n float w1 = b1 * d1;\n float w2 = b2 * d2;\n float w3 = b3 * d3;\n\n // ── ⑤ Dye-mixing colour blend ──────────────────────────────────────────────\n // dyeColor is the weighted average of all active colours — exactly how dyes\n // mix in water: overlapping streams blend smoothly, no hard edges.\n float total = w1 + w2 + w3;\n vec3 dyeColor = (u_c1 * w1 + u_c2 * w2 + u_c3 * w3) / max(total, 0.001);\n\n // Boost brightness of the dye to make colors pop and seem less dull\n dyeColor *= 1.65;\n\n // Exponential coverage: cores are rich and opaque; edges dissolve into the\n // near-white base. White only shows through where dye concentration is thin.\n float coverage = 1.0 - exp(-total * 5.0);\n vec3 col = mix(vec3(1.0, 1.0, 1.0), dyeColor, coverage);\n col = clamp(col, 0.0, 1.0);\n\n // ── ⑥ Sphere shading — subtle edge vignette only, no specular ─────────────\n vec2 uvc = v_uv * 2.0 - 1.0;\n\n // ── ⑦ Subtle grain — breaks gradient banding, adds filmic texture ──────────\n float grain = hash1(v_uv * 437.3 + fract(t)) * 2.0 - 1.0;\n col += grain * 0.018;\n\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n";
10443
- function hh(e, t, n) {
10479
+ var _h = "\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", vh = "\n precision highp float;\n\n varying vec2 v_uv;\n uniform float u_time;\n uniform float u_speed;\n uniform vec3 u_c1;\n uniform vec3 u_c2;\n uniform vec3 u_c3;\n\n // ── Gradient noise ─────────────────────────────────────────────────────────\n vec2 hash2(vec2 p) {\n p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));\n return -1.0 + 2.0 * fract(sin(p) * 43758.5453123);\n }\n float gnoise(vec2 p) {\n vec2 i = floor(p), f = fract(p);\n vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);\n return mix(\n mix(dot(hash2(i), f),\n dot(hash2(i+vec2(1,0)), f-vec2(1,0)), u.x),\n mix(dot(hash2(i+vec2(0,1)), f-vec2(0,1)),\n dot(hash2(i+vec2(1,1)), f-vec2(1,1)), u.x),\n u.y\n ) * 0.5 + 0.5;\n }\n\n // ── 3-octave FBM normalised to [0,1] — fewer octaves → larger, softer blobs\n float fbm(vec2 p) {\n float v = 0.0, a = 0.5;\n for (int i = 0; i < 3; i++) {\n v += a * gnoise(p);\n p = p * 2.1 + vec2(100.0);\n a *= 0.5;\n }\n return v / 0.875;\n }\n\n // ── Scalar hash for grain ──────────────────────────────────────────────────\n float hash1(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n }\n\n void main() {\n vec2 uv = v_uv;\n float t = u_time * u_speed + 47.3;\n\n // ── ① Two-level domain warp — deep organic folding and swirling ───────────\n // First pass: large-scale sweep\n vec2 q = vec2(\n fbm(uv * 1.8 + vec2( t * 0.13, t * 0.11)) * 2.0 - 1.0,\n fbm(uv * 1.8 + vec2( t * 0.11 + 3.7, -t * 0.14 + 1.1)) * 2.0 - 1.0\n );\n // Second pass: warp the warp — creates curling, folding sub-currents\n vec2 r = vec2(\n fbm(uv * 1.8 + q * 0.55 + vec2( t * 0.09, t * 0.07)) * 2.0 - 1.0,\n fbm(uv * 1.8 + q * 0.55 + vec2(-t * 0.07 + 5.1, t * 0.10 + 2.3)) * 2.0 - 1.0\n );\n vec2 wp = uv + r * 0.38;\n\n // ── ② Three independent fields — each drifts inward from its source edge ──\n // Asymmetric velocities: dominant axis matches the inflow direction so the\n // noise texture visually streams inward (left→right, right→left, bottom→top).\n float f1 = fbm(wp * 0.85 + vec2(-t * 0.18, t * 0.04)); // LEFT → right\n float f2 = fbm(wp * 0.85 + vec2( t * 0.18 + 5.3, t * 0.04 + 1.7)); // RIGHT → left\n float f3 = fbm(wp * 0.85 + vec2( t * 0.04 - 3.2, -t * 0.18 + 6.4)); // BOTTOM → up\n\n // ── ③ Breathing blobs — sin pulse makes each field expand and contract ────\n float p1 = 0.88 + 0.12 * sin(t * 0.61);\n float p2 = 0.88 + 0.12 * sin(t * 0.47 + 2.09);\n float p3 = 0.88 + 0.12 * sin(t * 0.53 + 4.19);\n\n // Wide smoothstep (0.26 → 0.70) → soft, diffused blob edges that dissolve\n // gradually into each other, like dye spreading through water.\n float b1 = smoothstep(0.26, 0.70, f1 * p1);\n float b2 = smoothstep(0.26, 0.70, f2 * p2);\n float b3 = smoothstep(0.26, 0.70, f3 * p3);\n\n // ── ④ Directional origin gradients.\n // Each color owns its home edge (value = 1.0) and smoothly fades to zero\n // before reaching the opposite side. The transition windows are offset so\n // they overlap only in the center third — that overlap zone is where the\n // three colors meet and blend, while the edges stay uncontaminated.\n float d1 = 1.0 - smoothstep(0.20, 0.74, uv.x); // c1: LEFT → full at x<0.20, zero by x=0.74\n float d2 = 1.0 - smoothstep(0.20, 0.74, 1.0 - uv.x); // c2: RIGHT → full at x>0.80, zero by x=0.26\n float d3 = 1.0 - smoothstep(0.18, 0.68, uv.y); // c3: BOTTOM → full at y<0.18, zero by y=0.68\n\n float w1 = b1 * d1;\n float w2 = b2 * d2;\n float w3 = b3 * d3;\n\n // ── ⑤ Dye-mixing colour blend ──────────────────────────────────────────────\n // dyeColor is the weighted average of all active colours — exactly how dyes\n // mix in water: overlapping streams blend smoothly, no hard edges.\n float total = w1 + w2 + w3;\n vec3 dyeColor = (u_c1 * w1 + u_c2 * w2 + u_c3 * w3) / max(total, 0.001);\n\n // Boost brightness of the dye to make colors pop and seem less dull\n dyeColor *= 1.65;\n\n // Exponential coverage: cores are rich and opaque; edges dissolve into the\n // near-white base. White only shows through where dye concentration is thin.\n float coverage = 1.0 - exp(-total * 5.0);\n vec3 col = mix(vec3(1.0, 1.0, 1.0), dyeColor, coverage);\n col = clamp(col, 0.0, 1.0);\n\n // ── ⑥ Sphere shading — subtle edge vignette only, no specular ─────────────\n vec2 uvc = v_uv * 2.0 - 1.0;\n\n // ── ⑦ Subtle grain — breaks gradient banding, adds filmic texture ──────────\n float grain = hash1(v_uv * 437.3 + fract(t)) * 2.0 - 1.0;\n col += grain * 0.018;\n\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n";
10480
+ function yh(e, t, n) {
10444
10481
  let r = (t, n) => {
10445
10482
  let r = e.createShader(t);
10446
10483
  return e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("[AnimatedOrb shader]", e.getShaderInfoLog(r)), null);
@@ -10449,10 +10486,10 @@ function hh(e, t, n) {
10449
10486
  let o = e.createProgram();
10450
10487
  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);
10451
10488
  }
10452
- function gh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
10453
- let [s, l, u] = lh(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(uh[t] ?? .35);
10489
+ function bh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
10490
+ let [s, l, u] = ph(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(mh[t] ?? .35);
10454
10491
  c(() => {
10455
- h.current = uh[t] ?? .35;
10492
+ h.current = mh[t] ?? .35;
10456
10493
  }, [t]), c(() => {
10457
10494
  let t = m.current;
10458
10495
  if (!t) return;
@@ -10469,7 +10506,7 @@ function gh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10469
10506
  console.warn("[AnimatedOrb] WebGL unavailable.");
10470
10507
  return;
10471
10508
  }
10472
- let i = hh(r, ph, mh);
10509
+ let i = yh(r, _h, vh);
10473
10510
  if (!i) {
10474
10511
  console.error("[AnimatedOrb] WebGL program failed to compile/link");
10475
10512
  return;
@@ -10499,7 +10536,7 @@ function gh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10499
10536
  c2: r.getUniformLocation(i, "u_c2"),
10500
10537
  c3: r.getUniformLocation(i, "u_c3")
10501
10538
  };
10502
- r.uniform3fv(c.c1, dh(s)), r.uniform3fv(c.c2, dh(l)), r.uniform3fv(c.c3, dh(u)), r.viewport(0, 0, t.width, t.height);
10539
+ r.uniform3fv(c.c1, hh(s)), r.uniform3fv(c.c2, hh(l)), r.uniform3fv(c.c3, hh(u)), r.viewport(0, 0, t.width, t.height);
10503
10540
  let d = performance.now(), f, p = (e) => {
10504
10541
  r.uniform1f(c.time, (e - d) / 1e3), r.uniform1f(c.speed, h.current), r.drawArrays(r.TRIANGLES, 0, 6), f = requestAnimationFrame(p);
10505
10542
  };
@@ -10530,7 +10567,7 @@ function gh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10530
10567
  position: "absolute",
10531
10568
  inset: -10,
10532
10569
  borderRadius: "50%",
10533
- background: `radial-gradient(circle, ${fh(s, .18)} 0%, transparent 70%)`,
10570
+ background: `radial-gradient(circle, ${gh(s, .18)} 0%, transparent 70%)`,
10534
10571
  pointerEvents: "none"
10535
10572
  },
10536
10573
  animate: { opacity: [.3, .75] },
@@ -10608,17 +10645,17 @@ function gh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10608
10645
  }
10609
10646
  //#endregion
10610
10647
  //#region src/components/CallScreen.jsx
10611
- var _h = "\n @keyframes fe-call-ring-pulse {\n 0% { transform: scale(1); opacity: 0.55; }\n 70% { transform: scale(1.85); opacity: 0; }\n 100% { transform: scale(1.85); opacity: 0; }\n }\n @keyframes fe-call-spin {\n to { transform: rotate(360deg); }\n }\n @keyframes fe-call-slide-up {\n from { opacity: 0; transform: translateY(24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fe-call-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes fe-call-bar-slide-in {\n from { opacity: 0; transform: translateY(10px) scale(0.97); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n @keyframes fe-call-dot-blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.35; }\n }\n @keyframes fe-call-avatar-breathe {\n 0%, 100% { opacity: 0.5; transform: scale(1); }\n 50% { opacity: 0.9; transform: scale(1.12); }\n }\n";
10612
- function vh(e) {
10648
+ var xh = "\n @keyframes fe-call-ring-pulse {\n 0% { transform: scale(1); opacity: 0.55; }\n 70% { transform: scale(1.85); opacity: 0; }\n 100% { transform: scale(1.85); opacity: 0; }\n }\n @keyframes fe-call-spin {\n to { transform: rotate(360deg); }\n }\n @keyframes fe-call-slide-up {\n from { opacity: 0; transform: translateY(24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fe-call-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes fe-call-bar-slide-in {\n from { opacity: 0; transform: translateY(10px) scale(0.97); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n @keyframes fe-call-dot-blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.35; }\n }\n @keyframes fe-call-avatar-breathe {\n 0%, 100% { opacity: 0.5; transform: scale(1); }\n 50% { opacity: 0.9; transform: scale(1.12); }\n }\n";
10649
+ function Sh(e) {
10613
10650
  let t = (e || "").replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
10614
10651
  return `${parseInt(n.slice(0, 2), 16)},${parseInt(n.slice(2, 4), 16)},${parseInt(n.slice(4, 6), 16)}`;
10615
10652
  }
10616
- function yh(e) {
10653
+ function Ch(e) {
10617
10654
  if (!e || typeof e != "string") return "#1a1a1a";
10618
10655
  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;
10619
10656
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
10620
10657
  }
10621
- function bh(e, t) {
10658
+ function wh(e, t) {
10622
10659
  let n = Array.isArray(e) && e.length > 0 ? e : [t || "#3B82F6"], [r, i, a] = n;
10623
10660
  return n.length === 1 ? [
10624
10661
  `radial-gradient(ellipse 110% 65% at 50% -5%, ${r}28 0%, transparent 68%)`,
@@ -10635,8 +10672,8 @@ function bh(e, t) {
10635
10672
  "#f7f8fa"
10636
10673
  ].join(", ");
10637
10674
  }
10638
- function xh({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
10639
- let i = (t || "A")[0].toUpperCase(), a = yh(r), o = n > 48 ? {
10675
+ function Th({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
10676
+ let i = (t || "A")[0].toUpperCase(), a = Ch(r), o = n > 48 ? {
10640
10677
  boxShadow: `0 0 0 3px ${r}44`,
10641
10678
  border: "3px solid rgba(255,255,255,0.15)"
10642
10679
  } : { border: `1.5px solid ${r}55` };
@@ -10673,7 +10710,7 @@ function xh({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" })
10673
10710
  children: i
10674
10711
  });
10675
10712
  }
10676
- function Sh(e) {
10713
+ function Eh(e) {
10677
10714
  let t = p(null), n = o(() => {
10678
10715
  if (!t.current) return;
10679
10716
  let { audioContext: e, oscillator: n, interval: r, toneTimeout: i } = t.current;
@@ -10720,8 +10757,8 @@ function Sh(e) {
10720
10757
  n
10721
10758
  ]), c(() => () => n(), [n]), n;
10722
10759
  }
10723
- function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDurationSeconds: r, isCallMuted: i, agentName: a, agentHeadshot: o, fallbackAgentName: s, acceptCall: c, rejectCall: l, endWebRTCCall: u, toggleCallMute: d, formatCallDuration: f, onMinimize: p, primaryColor: m = "#3B82F6", orbColors: h, chatHistory: v = [] }) {
10724
- let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = Sh(!!e), S = async () => {
10760
+ function Dh({ incomingCall: e, activeCallId: t, callConnectionState: n, callDurationSeconds: r, isCallMuted: i, agentName: a, agentHeadshot: o, fallbackAgentName: s, acceptCall: c, rejectCall: l, endWebRTCCall: u, toggleCallMute: d, formatCallDuration: f, onMinimize: p, primaryColor: m = "#3B82F6", orbColors: h, chatHistory: v = [] }) {
10761
+ let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = Eh(!!e), S = async () => {
10725
10762
  x(), await c();
10726
10763
  }, C = async () => {
10727
10764
  x(), await l();
@@ -10733,14 +10770,14 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10733
10770
  flexDirection: "column",
10734
10771
  borderRadius: "inherit",
10735
10772
  overflow: "hidden",
10736
- background: bh(h, m),
10773
+ background: wh(h, m),
10737
10774
  animation: T ? "fe-call-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)" : "fe-call-fade-in 0.32s ease"
10738
10775
  };
10739
10776
  if (b === "incoming") {
10740
10777
  let e = Array.isArray(h) && h.length > 0 ? h : [m];
10741
10778
  return /* @__PURE__ */ _("div", {
10742
10779
  style: E,
10743
- children: [/* @__PURE__ */ g("style", { children: _h }), /* @__PURE__ */ _("div", {
10780
+ children: [/* @__PURE__ */ g("style", { children: xh }), /* @__PURE__ */ _("div", {
10744
10781
  style: {
10745
10782
  flex: 1,
10746
10783
  display: "flex",
@@ -10771,7 +10808,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10771
10808
  width: "96px",
10772
10809
  height: "96px",
10773
10810
  borderRadius: "50%",
10774
- background: `radial-gradient(circle, rgba(${vh(e[0])},0.2) 0%, transparent 70%)`,
10811
+ background: `radial-gradient(circle, rgba(${Sh(e[0])},0.2) 0%, transparent 70%)`,
10775
10812
  filter: "blur(10px)",
10776
10813
  zIndex: 0
10777
10814
  } }),
@@ -10788,7 +10825,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10788
10825
  animation: `fe-call-ring-pulse 2.6s cubic-bezier(0.215,0.61,0.355,1) ${t}s infinite`,
10789
10826
  zIndex: 1
10790
10827
  } }, n)),
10791
- /* @__PURE__ */ g(xh, {
10828
+ /* @__PURE__ */ g(Th, {
10792
10829
  headshot: o,
10793
10830
  name: y,
10794
10831
  size: 82,
@@ -10868,7 +10905,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10868
10905
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(239,68,68,0.5)";
10869
10906
  },
10870
10907
  "aria-label": "Decline call",
10871
- children: /* @__PURE__ */ g(Am, { size: 26 })
10908
+ children: /* @__PURE__ */ g(Pm, { size: 26 })
10872
10909
  }), /* @__PURE__ */ g("span", {
10873
10910
  style: {
10874
10911
  fontSize: "12px",
@@ -10909,7 +10946,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10909
10946
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(34,197,94,0.5)";
10910
10947
  },
10911
10948
  "aria-label": "Accept call",
10912
- children: /* @__PURE__ */ g(Nm, {})
10949
+ children: /* @__PURE__ */ g(Lm, {})
10913
10950
  }), /* @__PURE__ */ g("span", {
10914
10951
  style: {
10915
10952
  fontSize: "12px",
@@ -10926,7 +10963,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10926
10963
  }
10927
10964
  return b === "connecting" ? /* @__PURE__ */ _("div", {
10928
10965
  style: E,
10929
- children: [/* @__PURE__ */ g("style", { children: _h }), /* @__PURE__ */ _("div", {
10966
+ children: [/* @__PURE__ */ g("style", { children: xh }), /* @__PURE__ */ _("div", {
10930
10967
  style: {
10931
10968
  flex: 1,
10932
10969
  display: "flex",
@@ -10936,7 +10973,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10936
10973
  gap: "24px"
10937
10974
  },
10938
10975
  children: [
10939
- /* @__PURE__ */ g(xh, {
10976
+ /* @__PURE__ */ g(Th, {
10940
10977
  headshot: o,
10941
10978
  name: y,
10942
10979
  size: 64,
@@ -10963,7 +11000,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10963
11000
  }) : /* @__PURE__ */ _("div", {
10964
11001
  style: E,
10965
11002
  children: [
10966
- /* @__PURE__ */ g("style", { children: _h }),
11003
+ /* @__PURE__ */ g("style", { children: xh }),
10967
11004
  /* @__PURE__ */ _("div", {
10968
11005
  style: {
10969
11006
  display: "flex",
@@ -11009,7 +11046,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11009
11046
  children: /* @__PURE__ */ g("polyline", { points: "15 18 9 12 15 6" })
11010
11047
  })
11011
11048
  }),
11012
- /* @__PURE__ */ g(gh, {
11049
+ /* @__PURE__ */ g(bh, {
11013
11050
  colors: h,
11014
11051
  size: 36,
11015
11052
  voiceState: w
@@ -11060,7 +11097,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11060
11097
  gap: "16px",
11061
11098
  padding: "0 24px 16px"
11062
11099
  },
11063
- children: [/* @__PURE__ */ g(xh, {
11100
+ children: [/* @__PURE__ */ g(Th, {
11064
11101
  headshot: o,
11065
11102
  name: y,
11066
11103
  size: 116,
@@ -11115,7 +11152,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11115
11152
  transition: "all 0.2s ease"
11116
11153
  },
11117
11154
  "aria-label": i ? "Unmute" : "Mute",
11118
- children: [g(i ? Bm : km, { size: 18 }), i ? "Unmute" : "Mute"]
11155
+ children: [g(i ? Wm : Nm, { size: 18 }), i ? "Unmute" : "Mute"]
11119
11156
  }), /* @__PURE__ */ _("button", {
11120
11157
  type: "button",
11121
11158
  onClick: u,
@@ -11143,15 +11180,15 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11143
11180
  e.currentTarget.style.background = "rgba(239,68,68,0.9)", e.currentTarget.style.transform = "scale(1)";
11144
11181
  },
11145
11182
  "aria-label": "End call",
11146
- children: [/* @__PURE__ */ g(Am, { size: 18 }), "End Call"]
11183
+ children: [/* @__PURE__ */ g(Pm, { size: 18 }), "End Call"]
11147
11184
  })]
11148
11185
  })
11149
11186
  ]
11150
11187
  });
11151
11188
  }
11152
- function wh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
11189
+ function Oh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
11153
11190
  let u = e || n || "Agent";
11154
- return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: _h }), /* @__PURE__ */ _("div", {
11191
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: xh }), /* @__PURE__ */ _("div", {
11155
11192
  role: "button",
11156
11193
  tabIndex: 0,
11157
11194
  onClick: c,
@@ -11208,7 +11245,7 @@ function wh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11208
11245
  borderRadius: "50%",
11209
11246
  border: `1.5px solid ${l}55`
11210
11247
  } }),
11211
- /* @__PURE__ */ g(xh, {
11248
+ /* @__PURE__ */ g(Th, {
11212
11249
  headshot: t,
11213
11250
  name: u,
11214
11251
  size: 38,
@@ -11292,7 +11329,7 @@ function wh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11292
11329
  boxShadow: i ? `0 0 0 3px ${l}12` : "none"
11293
11330
  },
11294
11331
  "aria-label": i ? "Unmute" : "Mute",
11295
- children: g(i ? Bm : km, { size: 15 })
11332
+ children: g(i ? Wm : Nm, { size: 15 })
11296
11333
  }), /* @__PURE__ */ g("button", {
11297
11334
  type: "button",
11298
11335
  onClick: (e) => {
@@ -11320,7 +11357,7 @@ function wh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11320
11357
  transition: "all 0.18s ease"
11321
11358
  },
11322
11359
  "aria-label": "End call",
11323
- children: /* @__PURE__ */ g(Am, { size: 16 })
11360
+ children: /* @__PURE__ */ g(Pm, { size: 16 })
11324
11361
  })]
11325
11362
  })
11326
11363
  ]
@@ -11328,7 +11365,7 @@ function wh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11328
11365
  }
11329
11366
  //#endregion
11330
11367
  //#region src/utils/voicePriorContext.js
11331
- function Th(e, t = {}) {
11368
+ function kh(e, t = {}) {
11332
11369
  let n = t.maxChars ?? 4500;
11333
11370
  if (!Array.isArray(e) || e.length === 0) return "";
11334
11371
  let r = [];
@@ -11346,7 +11383,7 @@ function Th(e, t = {}) {
11346
11383
  //#endregion
11347
11384
  //#region src/utils/voiceActionVisuals.js
11348
11385
  var Q = "fe-vv";
11349
- function Eh() {
11386
+ function Ah() {
11350
11387
  if (typeof document > "u" || document.getElementById(`${Q}-styles`)) return;
11351
11388
  let e = `
11352
11389
  /* ── Action toast ───────────────────────────────────────────────────────────── */
@@ -11491,14 +11528,14 @@ function Eh() {
11491
11528
  `, t = document.createElement("style");
11492
11529
  t.id = `${Q}-styles`, t.textContent = e, (document.head || document.documentElement).appendChild(t);
11493
11530
  }
11494
- var Dh = null, Oh = null;
11495
- function kh() {
11496
- return (!Dh || !Dh.isConnected) && (Dh = document.createElement("div"), Dh.id = `${Q}-toast`, document.body.appendChild(Dh)), Dh;
11531
+ var jh = null, Mh = null;
11532
+ function Nh() {
11533
+ return (!jh || !jh.isConnected) && (jh = document.createElement("div"), jh.id = `${Q}-toast`, document.body.appendChild(jh)), jh;
11497
11534
  }
11498
- function Ah(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
11535
+ function Ph(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
11499
11536
  if (typeof document > "u") return;
11500
- Eh(), Oh &&= (clearTimeout(Oh), null);
11501
- let i = kh();
11537
+ Ah(), Mh &&= (clearTimeout(Mh), null);
11538
+ let i = Nh();
11502
11539
  if (i.innerHTML = "", n) {
11503
11540
  let e = document.createElement("span");
11504
11541
  e.className = `${Q}-icon`, e.textContent = n, i.appendChild(e);
@@ -11507,71 +11544,71 @@ function Ah(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
11507
11544
  e.className = `${Q}-spin`, i.appendChild(e);
11508
11545
  }
11509
11546
  let a = document.createElement("span");
11510
- a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (Oh = setTimeout(() => jh(), r));
11547
+ a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (Mh = setTimeout(() => Fh(), r));
11511
11548
  }
11512
- function jh(e = 0) {
11513
- Dh && (e > 0 ? Oh = setTimeout(() => {
11514
- Dh && Dh.classList.remove(`${Q}-show`);
11515
- }, e) : Dh && Dh.classList.remove(`${Q}-show`));
11549
+ function Fh(e = 0) {
11550
+ jh && (e > 0 ? Mh = setTimeout(() => {
11551
+ jh && jh.classList.remove(`${Q}-show`);
11552
+ }, e) : jh && jh.classList.remove(`${Q}-show`));
11516
11553
  }
11517
- var Mh = null, Nh = [];
11518
- function Ph() {
11519
- return (!Mh || !Mh.isConnected) && (Mh = document.createElement("div"), Mh.id = `${Q}-bar`, document.body.appendChild(Mh)), Mh;
11554
+ var Ih = null, Lh = [];
11555
+ function Rh() {
11556
+ return (!Ih || !Ih.isConnected) && (Ih = document.createElement("div"), Ih.id = `${Q}-bar`, document.body.appendChild(Ih)), Ih;
11520
11557
  }
11521
- function Fh() {
11558
+ function zh() {
11522
11559
  if (typeof document > "u") return;
11523
- Eh(), Nh.forEach(clearTimeout), Nh = [];
11524
- let e = Ph();
11560
+ Ah(), Lh.forEach(clearTimeout), Lh = [];
11561
+ let e = Rh();
11525
11562
  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";
11526
11563
  let t = [[80, "width 0.6s ease"], [92, "width 1.2s ease"]], n = 50;
11527
11564
  for (let [e, r] of t) {
11528
11565
  let t = n, i = e, a = r;
11529
- Nh.push(setTimeout(() => {
11530
- Mh && (Mh.style.transition = a, Mh.style.width = `${i}%`);
11566
+ Lh.push(setTimeout(() => {
11567
+ Ih && (Ih.style.transition = a, Ih.style.width = `${i}%`);
11531
11568
  }, t)), n += 800;
11532
11569
  }
11533
11570
  }
11534
- function Ih() {
11535
- Mh && (Nh.forEach(clearTimeout), Nh = [], Mh.style.transition = "width 0.2s ease", Mh.style.width = "100%", Nh.push(setTimeout(() => {
11536
- Mh && (Mh.style.transition = "opacity 0.35s ease", Mh.style.opacity = "0", Nh.push(setTimeout(() => {
11537
- Mh && (Mh.style.width = "0%", Mh.classList.remove(`${Q}-bar-active`));
11571
+ function Bh() {
11572
+ Ih && (Lh.forEach(clearTimeout), Lh = [], Ih.style.transition = "width 0.2s ease", Ih.style.width = "100%", Lh.push(setTimeout(() => {
11573
+ Ih && (Ih.style.transition = "opacity 0.35s ease", Ih.style.opacity = "0", Lh.push(setTimeout(() => {
11574
+ Ih && (Ih.style.width = "0%", Ih.classList.remove(`${Q}-bar-active`));
11538
11575
  }, 380)));
11539
11576
  }, 220)));
11540
11577
  }
11541
- var Lh = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
11578
+ var Vh = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
11542
11579
  <filter id="${Q}-csh">
11543
11580
  <feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
11544
11581
  </filter>
11545
11582
  <path d="M4 2L19 10.5L11 12.8L8 20L4 2Z"
11546
11583
  fill="white" stroke="#1e1b4b" stroke-width="1.6" stroke-linejoin="round"
11547
11584
  filter="url(#${Q}-csh)"/>
11548
- </svg>`, Rh = null, zh = !1;
11549
- function Bh() {
11550
- return (!Rh || !Rh.isConnected) && (Rh = document.createElement("div"), Rh.id = `${Q}-cursor`, Rh.innerHTML = Lh, document.body.appendChild(Rh), zh = !1), Rh;
11585
+ </svg>`, Hh = null, Uh = !1;
11586
+ function Wh() {
11587
+ return (!Hh || !Hh.isConnected) && (Hh = document.createElement("div"), Hh.id = `${Q}-cursor`, Hh.innerHTML = Vh, document.body.appendChild(Hh), Uh = !1), Hh;
11551
11588
  }
11552
- async function Vh(e) {
11589
+ async function Gh(e) {
11553
11590
  if (typeof document > "u" || !e) return;
11554
- Eh();
11591
+ Ah();
11555
11592
  let t;
11556
11593
  try {
11557
11594
  t = e.getBoundingClientRect();
11558
11595
  } catch {
11559
11596
  return;
11560
11597
  }
11561
- let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = Bh();
11562
- zh ||= (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 Gh(360);
11598
+ let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = Wh();
11599
+ Uh ||= (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 Yh(360);
11563
11600
  }
11564
- function Hh(e = !1) {
11565
- Rh && (e ? (Rh.classList.remove(`${Q}-cursor-visible`), zh = !1) : (Rh.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
11566
- zh = !1;
11601
+ function Kh(e = !1) {
11602
+ Hh && (e ? (Hh.classList.remove(`${Q}-cursor-visible`), Uh = !1) : (Hh.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
11603
+ Uh = !1;
11567
11604
  }, 250)));
11568
11605
  }
11569
- async function Uh(e) {
11570
- Rh && (Rh.classList.add(`${Q}-cursor-click`), await Gh(280), Rh.classList.remove(`${Q}-cursor-click`));
11606
+ async function qh(e) {
11607
+ Hh && (Hh.classList.add(`${Q}-cursor-click`), await Yh(280), Hh.classList.remove(`${Q}-cursor-click`));
11571
11608
  }
11572
- function Wh(e) {
11609
+ function Jh(e) {
11573
11610
  if (!e || typeof document > "u") return;
11574
- Eh();
11611
+ Ah();
11575
11612
  let t;
11576
11613
  try {
11577
11614
  t = e.getBoundingClientRect();
@@ -11597,29 +11634,29 @@ function Wh(e) {
11597
11634
  a.remove(), e.style.position = n, e.style.overflow = r;
11598
11635
  }, 650);
11599
11636
  }
11600
- function Gh(e) {
11637
+ function Yh(e) {
11601
11638
  return new Promise((t) => setTimeout(t, e));
11602
11639
  }
11603
11640
  //#endregion
11604
11641
  //#region src/utils/voiceClientTools.js
11605
- var Kh = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
11606
- function qh(e) {
11607
- return String(e || "").replace(Kh, "").replace(/\/+$/, "").toLowerCase() || "/";
11642
+ var Xh = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
11643
+ function Zh(e) {
11644
+ return String(e || "").replace(Xh, "").replace(/\/+$/, "").toLowerCase() || "/";
11608
11645
  }
11609
- function Jh(e, t) {
11610
- return qh(e) === qh(t);
11646
+ function Qh(e, t) {
11647
+ return Zh(e) === Zh(t);
11611
11648
  }
11612
11649
  function $(...e) {
11613
11650
  wn() && console.log("[FlowEngage:voice-tools]", ...e);
11614
11651
  }
11615
- function Yh(e) {
11652
+ function $h(e) {
11616
11653
  try {
11617
11654
  let t = e.ownerDocument?.defaultView;
11618
11655
  if (t) return t.getComputedStyle(e);
11619
11656
  } catch {}
11620
11657
  return window.getComputedStyle(e);
11621
11658
  }
11622
- function Xh(e) {
11659
+ function eg(e) {
11623
11660
  let t = /* @__PURE__ */ new Set();
11624
11661
  function n(r) {
11625
11662
  if (!r || t.has(r)) return;
@@ -11632,10 +11669,10 @@ function Xh(e) {
11632
11669
  }
11633
11670
  typeof document < "u" && n(document);
11634
11671
  }
11635
- function Zh(e) {
11672
+ function tg(e) {
11636
11673
  return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
11637
11674
  }
11638
- function Qh(e) {
11675
+ function ng(e) {
11639
11676
  let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
11640
11677
  if (n) {
11641
11678
  let e = n.trim().split(/\s+/).filter(Boolean), r = [];
@@ -11643,40 +11680,40 @@ function Qh(e) {
11643
11680
  let e = t.getElementById(n);
11644
11681
  e?.textContent && r.push(e.textContent.trim());
11645
11682
  } catch {}
11646
- if (r.length) return Zh(r.join(" "));
11683
+ if (r.length) return tg(r.join(" "));
11647
11684
  }
11648
- if (e.labels && e.labels.length) return Zh(e.labels[0].textContent);
11685
+ if (e.labels && e.labels.length) return tg(e.labels[0].textContent);
11649
11686
  let r = e.id;
11650
11687
  if (r) try {
11651
11688
  let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
11652
- if (e) return Zh(e.textContent);
11689
+ if (e) return tg(e.textContent);
11653
11690
  } catch {
11654
11691
  let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
11655
- if (e) return Zh(e.textContent);
11692
+ if (e) return tg(e.textContent);
11656
11693
  }
11657
11694
  let i = e.previousElementSibling;
11658
11695
  for (let e = 0; e < 6 && i; e += 1) {
11659
- if (i.tagName === "LABEL") return Zh(i.textContent);
11696
+ if (i.tagName === "LABEL") return tg(i.textContent);
11660
11697
  let e = (i.className || "").toString().toLowerCase();
11661
11698
  if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
11662
- let e = Zh(i.textContent);
11699
+ let e = tg(i.textContent);
11663
11700
  if (e) return e;
11664
11701
  }
11665
11702
  i = i.previousElementSibling;
11666
11703
  }
11667
11704
  let a = e.parentElement;
11668
11705
  for (let e = 0; e < 5 && a; e += 1) {
11669
- if (a.tagName === "LABEL") return Zh(a.textContent);
11706
+ if (a.tagName === "LABEL") return tg(a.textContent);
11670
11707
  let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
11671
- if (e?.textContent) return Zh(e.textContent);
11708
+ if (e?.textContent) return tg(e.textContent);
11672
11709
  a = a.parentElement;
11673
11710
  }
11674
11711
  let o = e.getAttribute("aria-label");
11675
- return o ? Zh(o) : null;
11712
+ return o ? tg(o) : null;
11676
11713
  }
11677
- function $h() {
11714
+ function rg() {
11678
11715
  let e = [];
11679
- return Xh((t) => {
11716
+ return eg((t) => {
11680
11717
  e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
11681
11718
  if (An(e)) return !1;
11682
11719
  let t = (e.type || "").toLowerCase();
@@ -11687,15 +11724,15 @@ function $h() {
11687
11724
  "image"
11688
11725
  ].includes(t) || e.disabled || e.readOnly) return !1;
11689
11726
  try {
11690
- let t = Yh(e);
11727
+ let t = $h(e);
11691
11728
  if (t.display === "none" || t.visibility === "hidden") return !1;
11692
11729
  } catch {}
11693
11730
  return !0;
11694
11731
  }));
11695
11732
  }), e;
11696
11733
  }
11697
- function eg() {
11698
- return $h().map((e, t) => {
11734
+ function ig() {
11735
+ return rg().map((e, t) => {
11699
11736
  let n = {
11700
11737
  formIndex: 0,
11701
11738
  fieldIndex: t,
@@ -11703,7 +11740,7 @@ function eg() {
11703
11740
  type: e.type || "text",
11704
11741
  name: e.name || null,
11705
11742
  id: e.id || null,
11706
- label: Qh(e),
11743
+ label: ng(e),
11707
11744
  placeholder: e.placeholder || null
11708
11745
  };
11709
11746
  return e.tagName === "SELECT" && (n.options = Array.from(e.options).filter((e) => e.value !== "" && !e.disabled).map((e) => ({
@@ -11712,13 +11749,13 @@ function eg() {
11712
11749
  })), n.currentValue = e.value || null), n;
11713
11750
  });
11714
11751
  }
11715
- function tg() {
11752
+ function ag() {
11716
11753
  let e = [];
11717
- return Xh((t) => {
11754
+ return eg((t) => {
11718
11755
  e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
11719
11756
  if (An(e) || e.disabled) return !1;
11720
11757
  try {
11721
- let t = Yh(e);
11758
+ let t = $h(e);
11722
11759
  if (t.display === "none" || t.visibility === "hidden") return !1;
11723
11760
  } catch {}
11724
11761
  return !0;
@@ -11730,7 +11767,7 @@ function tg() {
11730
11767
  type: e.type || e.tagName
11731
11768
  }));
11732
11769
  }
11733
- function ng(e, t) {
11770
+ function og(e, t) {
11734
11771
  try {
11735
11772
  if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
11736
11773
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
@@ -11745,7 +11782,7 @@ function ng(e, t) {
11745
11782
  return Infinity;
11746
11783
  }
11747
11784
  }
11748
- function rg(e, t) {
11785
+ function sg(e, t) {
11749
11786
  let n = String(t || "").toLowerCase().trim();
11750
11787
  if (!n) return 0;
11751
11788
  let r = (e.innerText || e.textContent || "").replace(/\s+/g, " ").trim(), i = [
@@ -11763,21 +11800,21 @@ function rg(e, t) {
11763
11800
  for (let e of a) i.includes(e) && (o += 1);
11764
11801
  return o / a.length * 92;
11765
11802
  }
11766
- function ig(e, t, n = 6) {
11803
+ function cg(e, t, n = 6) {
11767
11804
  let r = String(t || "").toLowerCase().trim();
11768
11805
  if (!r) return !1;
11769
11806
  let i = e;
11770
11807
  for (let e = 0; e < n && i && (i = i.parentElement, i); e++) if ((i.innerText || i.textContent || "").toLowerCase().includes(r)) return !0;
11771
11808
  return !1;
11772
11809
  }
11773
- function ag(e, t, n) {
11810
+ function lg(e, t, n) {
11774
11811
  let r = [];
11775
- Xh((e) => {
11812
+ eg((e) => {
11776
11813
  let t = Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"], a[href]"));
11777
11814
  r.push(...t.filter((e) => {
11778
11815
  if (An(e) || e.disabled) return !1;
11779
11816
  try {
11780
- let t = Yh(e);
11817
+ let t = $h(e);
11781
11818
  if (t.display === "none" || t.visibility === "hidden" || t.opacity === "0") return !1;
11782
11819
  } catch {}
11783
11820
  return !0;
@@ -11785,14 +11822,14 @@ function ag(e, t, n) {
11785
11822
  });
11786
11823
  let i = 0, a = r.map((t) => ({
11787
11824
  el: t,
11788
- s: rg(t, e)
11825
+ s: sg(t, e)
11789
11826
  }));
11790
11827
  for (let { s: e } of a) e > i && (i = e);
11791
11828
  if (i < 28) return null;
11792
11829
  let o = a.filter(({ s: e }) => e === i).map(({ el: e }) => e);
11793
11830
  if (o.length === 1) return o[0];
11794
11831
  if (n) {
11795
- let e = o.filter((e) => ig(e, n));
11832
+ let e = o.filter((e) => cg(e, n));
11796
11833
  if (e.length === 1) return e[0];
11797
11834
  e.length > 1 && (o = e);
11798
11835
  }
@@ -11800,14 +11837,14 @@ function ag(e, t, n) {
11800
11837
  if (s.length) {
11801
11838
  let e = o[0], t = Infinity;
11802
11839
  for (let n of o) for (let r of s) {
11803
- let i = ng(n, r);
11840
+ let i = og(n, r);
11804
11841
  i < t && (t = i, e = n);
11805
11842
  }
11806
11843
  return e;
11807
11844
  }
11808
11845
  return o[0];
11809
11846
  }
11810
- function og(e) {
11847
+ function ug(e) {
11811
11848
  if (e == null) return {};
11812
11849
  if (typeof e == "string") {
11813
11850
  let t = e.trim();
@@ -11820,12 +11857,12 @@ function og(e) {
11820
11857
  }
11821
11858
  return e;
11822
11859
  }
11823
- function sg(e) {
11860
+ function dg(e) {
11824
11861
  if (!e || typeof e != "object") return null;
11825
11862
  let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
11826
11863
  return t == null ? null : String(t).trim() || null;
11827
11864
  }
11828
- function cg() {
11865
+ function fg() {
11829
11866
  let e = {};
11830
11867
  document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
11831
11868
  if (t.id) return;
@@ -11840,7 +11877,7 @@ function cg() {
11840
11877
  e[r] = !0, t.id = r;
11841
11878
  });
11842
11879
  }
11843
- function lg() {
11880
+ function pg() {
11844
11881
  let e = (e) => {
11845
11882
  let t = Array.from(e).filter((e) => !e.closest("#flowengage-root, .flowengage-shell, .flowengage-widget-root") && !e.closest("nav, footer, header, aside, .nav, .footer, .header, .sidebar")), n = [], r = 0;
11846
11883
  for (; r < t.length;) {
@@ -11883,7 +11920,7 @@ function lg() {
11883
11920
  introText: o
11884
11921
  };
11885
11922
  }
11886
- function ug(e) {
11923
+ function mg(e) {
11887
11924
  if (!e || typeof document > "u") return "";
11888
11925
  let t = new Set([
11889
11926
  "script",
@@ -11969,11 +12006,11 @@ function ug(e) {
11969
12006
  return d.has(t) ? !1 : (d.add(t), !0);
11970
12007
  }).join("\n").replace(/\n{3,}/g, "\n\n").trim();
11971
12008
  }
11972
- function dg(e) {
12009
+ function hg(e) {
11973
12010
  let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
11974
12011
  "fwh-navigate-mvp": async (n) => {
11975
12012
  $("fwh-navigate-mvp ▶ raw parameters:", n);
11976
- let i = og(n), a = sg(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
12013
+ let i = ug(n), a = dg(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
11977
12014
  if ($("fwh-navigate-mvp · coerced:", {
11978
12015
  url: a,
11979
12016
  sectionText: o,
@@ -12012,11 +12049,11 @@ function dg(e) {
12012
12049
  correctedUrl: l
12013
12050
  }), a = l);
12014
12051
  try {
12015
- Ah(`Navigating to ${a}...`, { spinner: !0 }), Fh(), On();
12052
+ Ph(`Navigating to ${a}...`, { spinner: !0 }), zh(), On();
12016
12053
  try {
12017
12054
  let e = r ? r() : "";
12018
12055
  if (e && t) {
12019
- let n = Th([{
12056
+ let n = kh([{
12020
12057
  sender: "user",
12021
12058
  message: e
12022
12059
  }]);
@@ -12044,8 +12081,8 @@ function dg(e) {
12044
12081
  typeof window < "u" && window.scrollTo(0, 0);
12045
12082
  } catch {}
12046
12083
  let o = [], s = null, c = "", l = Date.now() + 12e3;
12047
- for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: o, pageTitleHeading: s, introText: c} = lg(), !(o.length >= 1)););
12048
- cg(), $("fwh-navigate-mvp → page headings collected:", o, "titleHeading:", s);
12084
+ for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: o, pageTitleHeading: s, introText: c} = pg(), !(o.length >= 1)););
12085
+ fg(), $("fwh-navigate-mvp → page headings collected:", o, "titleHeading:", s);
12049
12086
  let u = o.length ? o.join(" | ") : "none", d = o.length ? "Use ONLY these exact heading strings for fwh-highlight-mvp — never invent or abbreviate." : "No headings collected yet — call fwh-get-current-page-mvp immediately (no speech) to get the live headings before speaking or highlighting.", f = s ? ` "${s}" is the PAGE TITLE, not a content section — do not fwh-highlight-mvp it separately; if doing a walkthrough, just fold this intro into your opening line: "${c || "(no intro text found)"}"` : c ? ` No separate page-title heading detected, but this intro text precedes the first section — mention it briefly before covering sections: "${c}"` : "", p = "";
12050
12087
  try {
12051
12088
  if (o.length > 0) {
@@ -12053,7 +12090,7 @@ function dg(e) {
12053
12090
  for (let n of e) {
12054
12091
  let e = cr(null, n);
12055
12092
  if (e) {
12056
- let r = ug(e).substring(0, 800);
12093
+ let r = mg(e).substring(0, 800);
12057
12094
  r && t.push(`[Section: ${n}] ${r}`);
12058
12095
  }
12059
12096
  }
@@ -12062,13 +12099,13 @@ function dg(e) {
12062
12099
  } catch {}
12063
12100
  if (yr()) return _r(), $("fwh-navigate-mvp ✖ landed on a not-found/404 page:", i), `NAVIGATION_PAGE_NOT_FOUND. The page at ${i} does not exist — it shows a "not found"/404 error, not real content. Do NOT offer a page overview, do NOT describe or highlight any sections, do NOT claim the navigation succeeded. Tell the visitor EXACTLY: "It looks like that page doesn't exist — I couldn't find it. Would you like me to take you somewhere else?" Then STOP and wait for their reply.`;
12064
12101
  let m = Date.now() + 4e3, h = typeof window < "u" ? window.location.pathname : r;
12065
- for (; Date.now() < m && !Jh(h, e) && Jh(h, t);) await new Promise((e) => setTimeout(e, 120)), h = window.location.pathname;
12102
+ for (; Date.now() < m && !Qh(h, e) && Qh(h, t);) await new Promise((e) => setTimeout(e, 120)), h = window.location.pathname;
12066
12103
  $("fwh-navigate-mvp route settle:", {
12067
12104
  startPath: t,
12068
12105
  targetPath: e,
12069
12106
  settledPath: h
12070
12107
  });
12071
- let g = typeof window < "u" ? window.location.href : i, _ = (h.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home", v = Jh(h, e), y = !Jh(h, t), b = v || y;
12108
+ let g = typeof window < "u" ? window.location.href : i, _ = (h.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home", v = Qh(h, e), y = !Qh(h, t), b = v || y;
12072
12109
  return $("fwh-navigate-mvp settled:", h, "target:", e, "match:", b), b ? (_r(), `OK_NAVIGATE_SPA. Visitor is now on: ${g} (page: "${_}") | Section headings: ${u}.${f} ${d}${p} Now confirm the arrival in ONE short sentence phrased for what the visitor actually asked for — mention the page by name and what it lets them do (e.g. for a contact request: "I've taken you to the Contact Us page — filling in this form sends your query straight to our team."). Do NOT use a fixed template. Then, in the same breath, offer either a specific section or a full overview. Then STOP — wait for their reply.`) : (_r(), `NAVIGATION_DID_NOT_HAPPEN. The visitor is STILL on ${g} (page: "${_}") — the navigation did not go through. Do NOT say "I have navigated you". Do NOT claim success. Tell the visitor EXACTLY: "Sorry, I couldn't open that page just now. Would you like me to try again, or is there something else I can help with?" Then STOP and wait for their reply.`);
12073
12110
  } catch {}
12074
12111
  let o = "this";
@@ -12079,45 +12116,45 @@ function dg(e) {
12079
12116
  return `OK_NAVIGATE_RELOADING. Navigating to the page now; the voice session will resume automatically on the new page. When the session resumes, say EXACTLY: "I have navigated you on ${o} page. Do you want to know about any specific section or want a complete overview?" Then STOP — wait for the visitor's reply.`;
12080
12117
  } catch (e) {
12081
12118
  let t = `Navigation error: ${e?.message || String(e)}`;
12082
- return $("fwh-navigate-mvp ✖", t), Ah("Navigation failed", {
12119
+ return $("fwh-navigate-mvp ✖", t), Ph("Navigation failed", {
12083
12120
  spinner: !1,
12084
12121
  icon: "⚠️",
12085
12122
  duration: 1800
12086
12123
  }), t;
12087
12124
  } finally {
12088
- Ih(), jh(900);
12125
+ Bh(), Fh(900);
12089
12126
  }
12090
12127
  },
12091
12128
  "fwh-highlight-mvp": async (e) => {
12092
12129
  $("fwh-highlight-mvp ▶", e);
12093
- let t = og(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
12130
+ let t = ug(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
12094
12131
  if (typeof window < "u" && window.__fe_user_nav_during_speech) {
12095
12132
  let e = window.__fe_user_nav_during_speech, t = window.location.pathname;
12096
12133
  if (Date.now() - e.ts >= 3e4) window.__fe_user_nav_during_speech = null;
12097
12134
  else return $("flowengage_highlight ✖ blocked — user navigated during speech", e), `NAV_CHANGED: The visitor navigated from "${e.fromPageName}" to "${e.toPageName}" (current path: ${t}) while you were speaking. STOP the current walkthrough immediately. DO NOT call flowengage_highlight again. Say out loud: "I see you've navigated to the ${e.toPageName} page — do you want me to continue what I was explaining, or shall I guide you through this page?" Wait for the visitor's answer before doing anything else.`;
12098
12135
  }
12099
- cg();
12136
+ fg();
12100
12137
  let i = ((e) => e && e.replace(/^\d+\.\s*/, "").replace(/^["']|["']$/g, "").trim())(r), a = cr(n || null, i || null);
12101
12138
  if (!a && i) {
12102
12139
  let e = Date.now() + 600;
12103
- for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), cg(), a = cr(null, i);
12140
+ for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), fg(), a = cr(null, i);
12104
12141
  }
12105
12142
  if (!a) {
12106
12143
  $("fwh-highlight-mvp ✖ no element for:", i || n);
12107
- let { headings: e } = lg(), t = e.length ? `Page headings: ${e.map((e) => `"${e}"`).join(" | ")}. Use one of these EXACT strings for section_text — no numbers, no quotes around them.` : "No headings found — skip highlight and continue speaking.";
12144
+ let { headings: e } = pg(), t = e.length ? `Page headings: ${e.map((e) => `"${e}"`).join(" | ")}. Use one of these EXACT strings for section_text — no numbers, no quotes around them.` : "No headings found — skip highlight and continue speaking.";
12108
12145
  return `HIGHLIGHT_NOT_FOUND: "${i || n}" on the current page. ${t}`;
12109
12146
  }
12110
12147
  return Dn(a), $("fwh-highlight-mvp ✓", i || n), `OK_HIGHLIGHT: "${i || n}". Your NEXT response must be speech only (no tool call) describing THIS section — "${i || n}" — using its own content, then end with the continue question.`;
12111
12148
  },
12112
12149
  "fwh-read-content-mvp": async (e) => {
12113
12150
  $("fwh-read-content-mvp ▶", e);
12114
- let t = og(e), n = t?.section_text || t?.sectionText || "";
12151
+ let t = ug(e), n = t?.section_text || t?.sectionText || "";
12115
12152
  try {
12116
12153
  let e = "";
12117
12154
  if (n) {
12118
12155
  let t = cr(null, n);
12119
12156
  if (!t) return `Could not find section "${n}" on the page.`;
12120
- e = ug(t);
12157
+ e = mg(t);
12121
12158
  } else {
12122
12159
  let t = (document.querySelector("main") || document.querySelector("article") || document.querySelector("[role=\"main\"]") || document.querySelector("#content") || document.querySelector(".content") || document.body).cloneNode(!0);
12123
12160
  t.querySelectorAll("nav, footer, header, aside, script, style, noscript, .nav, .footer, .header, .sidebar, #flowengage-root, .flowengage-shell, .flowengage-widget-root").forEach((e) => e.remove()), e = t.textContent.replace(/\s+/g, " ").trim();
@@ -12129,7 +12166,7 @@ function dg(e) {
12129
12166
  },
12130
12167
  "fwh-page-content-mvp": async (e) => {
12131
12168
  $("fwh-page-content-mvp ▶", e);
12132
- let r = og(e), i = r?.url || r?.page_url || "";
12169
+ let r = ug(e), i = r?.url || r?.page_url || "";
12133
12170
  if ($("fwh-page-content-mvp · url:", i, "siteId:", t, "apiBase:", n || "(empty)"), !i) return $("fwh-page-content-mvp ✖ missing url"), "Missing url parameter.";
12134
12171
  if (!t) return $("fwh-page-content-mvp ✖ no siteId"), "Site is not configured.";
12135
12172
  if (!n) return $("fwh-page-content-mvp ✖ no api base"), "API base URL is missing; cannot fetch page content.";
@@ -12161,7 +12198,7 @@ function dg(e) {
12161
12198
  },
12162
12199
  "fwh-search-mvp": async (e) => {
12163
12200
  $("fwh-search-mvp ▶", e);
12164
- let r = og(e).query;
12201
+ let r = ug(e).query;
12165
12202
  if (!r) return $("fwh-search-mvp ✖ missing query"), "Missing query parameter.";
12166
12203
  if (!t) return $("fwh-search-mvp ✖ no siteId"), "Search unavailable (no siteId configured).";
12167
12204
  if (!n) return $("fwh-search-mvp ✖ no api base"), "Search unavailable (no API base URL).";
@@ -12199,7 +12236,7 @@ function dg(e) {
12199
12236
  "[class*='menu'] a",
12200
12237
  "[class*='header'] a"
12201
12238
  ];
12202
- if (Xh((t) => {
12239
+ if (eg((t) => {
12203
12240
  for (let r of n) try {
12204
12241
  t.querySelectorAll(r).forEach((t) => {
12205
12242
  if (An(t)) return;
@@ -12207,7 +12244,7 @@ function dg(e) {
12207
12244
  if (!r || !n || n === "#" || n.startsWith("javascript:")) return;
12208
12245
  try {
12209
12246
  let e = t.parentElement;
12210
- if (e && Yh(e).display === "none" && !e.closest("nav, [role='navigation'], header, [class*='nav'], [class*='menu']")) return;
12247
+ if (e && $h(e).display === "none" && !e.closest("nav, [role='navigation'], header, [class*='nav'], [class*='menu']")) return;
12211
12248
  } catch {}
12212
12249
  let i = r.toLowerCase() + "|" + n;
12213
12250
  e.has(i) || e.set(i, {
@@ -12218,7 +12255,7 @@ function dg(e) {
12218
12255
  } catch {}
12219
12256
  t.querySelectorAll("select").forEach((t) => {
12220
12257
  if (An(t)) return;
12221
- let n = Qh(t);
12258
+ let n = ng(t);
12222
12259
  /nav|menu|page|section|go to/i.test(n || t.name || t.id || "") && Array.from(t.options).forEach((r) => {
12223
12260
  if (!r.value || r.disabled) return;
12224
12261
  let i = r.text.trim();
@@ -12240,7 +12277,7 @@ function dg(e) {
12240
12277
  "fwh-request-email-mvp": async () => ($("fwh-request-email-mvp ▶"), typeof e.requestEmailCollection == "function" && e.requestEmailCollection(), "EMAIL_BOX_SHOWN. An email input text box is now visible to the visitor. Say EXACTLY: \"Please enter your email in the text box to continue.\" Then stop and wait silently — do NOT ask them to say it aloud, do NOT repeat, and do NOT answer any other question until you receive the EMAIL_SAVED message."),
12241
12278
  "fwh-get-current-page-mvp": async () => {
12242
12279
  if ($("fwh-get-current-page-mvp ▶"), typeof window > "u") return "Cannot determine current page (no browser context).";
12243
- let e = window.location.href, t = window.location.pathname, n = document.title || "", { headings: r, pageTitleHeading: i, introText: a } = lg();
12280
+ let e = window.location.href, t = window.location.pathname, n = document.title || "", { headings: r, pageTitleHeading: i, introText: a } = pg();
12244
12281
  $("fwh-get-current-page-mvp ✓", {
12245
12282
  url: e,
12246
12283
  path: t,
@@ -12252,7 +12289,7 @@ function dg(e) {
12252
12289
  return `CURRENT_PAGE. URL: ${e} | Title: ${n} | Page sections (${r.length} total): ${s}.${o} *** WALKTHROUGH: do NOT drive it yourself. Do not call fwh-highlight-mvp and do not decide the order — highlighting and section order are handled for you. You will be told which section to describe, one at a time. When told, describe ONLY that section in 3-4 sentences and then stop; never announce another section, never ask whether to continue. ***`;
12253
12290
  },
12254
12291
  "fwh-list-forms-mvp": async () => {
12255
- let e = eg(), t = tg();
12292
+ let e = ig(), t = ag();
12256
12293
  $("fwh-list-forms-mvp ✓", `${e.length} field(s)`, `${t.length} button(s)`);
12257
12294
  let n = e.map((e) => ({
12258
12295
  ...e,
@@ -12266,12 +12303,12 @@ function dg(e) {
12266
12303
  },
12267
12304
  "fwh-fill-form-mvp": async () => "FORM_FILLING_DISABLED: Form filling is not available at this time. Tell the visitor what fields are present (use fwh-list-forms-mvp) and ask them to fill the form themselves.",
12268
12305
  "fwh-click-button-mvp": async (e) => {
12269
- let t = og(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim(), r = (t.card_context ?? t.cardContext ?? "").trim();
12306
+ let t = ug(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim(), r = (t.card_context ?? t.cardContext ?? "").trim();
12270
12307
  if ($("fwh-click-button-mvp ▶", n, r ? `(card_context: ${r})` : ""), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
12271
- let a = ag(n, i, r);
12308
+ let a = lg(n, i, r);
12272
12309
  if (!a) return $("fwh-click-button-mvp ✖ no match"), `Could not find a button matching "${n}". Call fwh-list-forms-mvp to see button texts.`;
12273
12310
  try {
12274
- Ah(`Clicking ${n}...`, { spinner: !0 });
12311
+ Ph(`Clicking ${n}...`, { spinner: !0 });
12275
12312
  try {
12276
12313
  a.scrollIntoView({
12277
12314
  block: "center",
@@ -12280,22 +12317,22 @@ function dg(e) {
12280
12317
  } catch {
12281
12318
  a.scrollIntoView(!0);
12282
12319
  }
12283
- await Vh(a), a.focus?.(), await Uh(a), Wh(a), a.click();
12320
+ await Gh(a), a.focus?.(), await qh(a), Jh(a), a.click();
12284
12321
  let e = (a.textContent || a.value || a.getAttribute("aria-label") || "").trim().slice(0, 80) || "button", t = `OK_CLICK ${e}`;
12285
- return $("fwh-click-button-mvp ✓", t), Ah(`Clicked ${e}`, {
12322
+ return $("fwh-click-button-mvp ✓", t), Ph(`Clicked ${e}`, {
12286
12323
  spinner: !1,
12287
12324
  icon: "✅",
12288
12325
  duration: 1200
12289
12326
  }), t;
12290
12327
  } catch (e) {
12291
12328
  let t = `Click failed: ${e?.message || String(e)}`;
12292
- return $("fwh-click-button-mvp ✖", t), Ah("Click failed", {
12329
+ return $("fwh-click-button-mvp ✖", t), Ph("Click failed", {
12293
12330
  spinner: !1,
12294
12331
  icon: "⚠️",
12295
12332
  duration: 1800
12296
12333
  }), t;
12297
12334
  } finally {
12298
- Hh(), jh(700);
12335
+ Kh(), Fh(700);
12299
12336
  }
12300
12337
  }
12301
12338
  };
@@ -12309,18 +12346,18 @@ function dg(e) {
12309
12346
  clickPageButton: a["fwh-click-button-mvp"]
12310
12347
  };
12311
12348
  }
12312
- var fg = /^(get in touch|contact us|let'?s (talk|connect)|subscribe|newsletter|follow us|quick links|company|solutions|what we do|resources|legal|sitemap|share this)/i;
12313
- function pg() {
12349
+ var gg = /^(get in touch|contact us|let'?s (talk|connect)|subscribe|newsletter|follow us|quick links|company|solutions|what we do|resources|legal|sitemap|share this)/i;
12350
+ function _g() {
12314
12351
  try {
12315
- let { headings: e } = lg();
12316
- return (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !fg.test(e.trim()));
12352
+ let { headings: e } = pg();
12353
+ return (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !gg.test(e.trim()));
12317
12354
  } catch {
12318
12355
  return [];
12319
12356
  }
12320
12357
  }
12321
12358
  //#endregion
12322
12359
  //#region src/utils/wrapVoiceToolsForLogging.js
12323
- function mg(e) {
12360
+ function vg(e) {
12324
12361
  return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
12325
12362
  let r = wn();
12326
12363
  r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
@@ -12337,7 +12374,7 @@ function mg(e) {
12337
12374
  }
12338
12375
  //#endregion
12339
12376
  //#region src/components/FlowEngageWidget.jsx
12340
- var hg = {
12377
+ var yg = {
12341
12378
  blue: "#135bd8",
12342
12379
  red: "#ef334b",
12343
12380
  yellow: "#ffbd2e",
@@ -12345,7 +12382,7 @@ var hg = {
12345
12382
  highlight: "rgba(255,255,255,0.9)",
12346
12383
  green: "#10b981"
12347
12384
  };
12348
- function gg(e) {
12385
+ function bg(e) {
12349
12386
  if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
12350
12387
  let [t, n, r] = e;
12351
12388
  return e.length >= 3 && r ? [
@@ -12359,12 +12396,12 @@ function gg(e) {
12359
12396
  "#f7f8fa"
12360
12397
  ].join(", ");
12361
12398
  }
12362
- function _g(e) {
12399
+ function xg(e) {
12363
12400
  if (!e || typeof e != "string") return "#1a1a1a";
12364
12401
  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;
12365
12402
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
12366
12403
  }
12367
- function vg(t) {
12404
+ function Sg(t) {
12368
12405
  let [n, r] = e.useState(null), i = typeof t == "string" ? t.trim() : "";
12369
12406
  return e.useEffect(() => {
12370
12407
  if (!i) {
@@ -12382,8 +12419,8 @@ function vg(t) {
12382
12419
  };
12383
12420
  }, [i]), n;
12384
12421
  }
12385
- function yg({ logo: t, style: n }) {
12386
- let r = vg(typeof t == "string" ? t : null);
12422
+ function Cg({ logo: t, style: n }) {
12423
+ let r = Sg(typeof t == "string" ? t : null);
12387
12424
  if (!t) return null;
12388
12425
  if (typeof t == "string") return r ? /* @__PURE__ */ g("img", {
12389
12426
  src: r,
@@ -12408,7 +12445,7 @@ function yg({ logo: t, style: n }) {
12408
12445
  children: i
12409
12446
  }) : null;
12410
12447
  }
12411
- function bg({ title: e }) {
12448
+ function wg({ title: e }) {
12412
12449
  return /* @__PURE__ */ g("div", {
12413
12450
  style: {
12414
12451
  width: "100%",
@@ -12426,18 +12463,18 @@ function bg({ title: e }) {
12426
12463
  children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
12427
12464
  });
12428
12465
  }
12429
- function xg(e, t) {
12466
+ function Tg(e, t) {
12430
12467
  let n = (t || "").trim();
12431
12468
  return n ? !!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\b(hang\s+up|disconnect)\b/i.test(n) || e === "bot" && (/\b(that'?s all|we'?re done)\b/i.test(n) || /\b(goodbye|bye)\b/i.test(n) || /\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n) || /\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n) || /\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n) || /\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n) || /\b(wrapping\s+up|signing\s+off)\b/i.test(n))) : !1;
12432
12469
  }
12433
- function Sg({ orbColors: e, ...t }) {
12434
- return /* @__PURE__ */ g(gh, {
12470
+ function Eg({ orbColors: e, ...t }) {
12471
+ return /* @__PURE__ */ g(bh, {
12435
12472
  colors: e,
12436
12473
  ...t
12437
12474
  });
12438
12475
  }
12439
- function Cg({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
12440
- let s = n || hg.green, c = _g(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
12476
+ function Dg({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
12477
+ let s = n || yg.green, c = xg(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
12441
12478
  style: {
12442
12479
  display: "flex",
12443
12480
  alignItems: a ? "flex-end" : "center",
@@ -12563,7 +12600,7 @@ function Cg({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
12563
12600
  delay: 0
12564
12601
  },
12565
12602
  style: { flexShrink: 0 },
12566
- children: /* @__PURE__ */ g(Sg, {
12603
+ children: /* @__PURE__ */ g(Eg, {
12567
12604
  size: l,
12568
12605
  orbColors: t
12569
12606
  })
@@ -12595,8 +12632,8 @@ function Cg({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
12595
12632
  children: u
12596
12633
  })] });
12597
12634
  }
12598
- function wg({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
12599
- let c = n || hg.green, l = _g(c);
12635
+ function Og({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
12636
+ let c = n || yg.green, l = xg(c);
12600
12637
  return /* @__PURE__ */ _(ym.div, {
12601
12638
  initial: {
12602
12639
  scale: 50 / 350,
@@ -12667,7 +12704,7 @@ function wg({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
12667
12704
  children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
12668
12705
  })
12669
12706
  }),
12670
- /* @__PURE__ */ g(Sg, {
12707
+ /* @__PURE__ */ g(Eg, {
12671
12708
  size: 72,
12672
12709
  orbColors: t
12673
12710
  }),
@@ -12747,60 +12784,62 @@ function wg({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
12747
12784
  ]
12748
12785
  });
12749
12786
  }
12750
- function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, voiceEndCounter: d, websiteName: f, voiceFirstMessage: h, captureVisitorEmail: v, emailRequired: y, emailCaptureEnabled: b = !0, listeningLabel: x = "Listening...", enterChatModeLabel: S = "Enter Chat Mode", endConversationLabel: C = "End Conversation" }) {
12787
+ function kg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, voiceEndCounter: d, websiteName: f, voiceFirstMessage: h, captureVisitorEmail: v, emailRequired: y, emailCaptureEnabled: b = !0, listeningLabel: x = "Listening...", enterChatModeLabel: S = "Enter Chat Mode", endConversationLabel: C = "End Conversation" }) {
12751
12788
  c(() => (console.log("[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED"), () => console.log("[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED")), []);
12752
- let [w, T] = m("idle"), [E, D] = m(!1), [O, k] = m(!1), [A, ee] = m(!1), [te, ne] = m(""), [j, re] = m(""), ie = p(!1), ae = p(!1), oe = p(null), se = p(0), ce = p(""), le = p(!1), ue = p(0), de = p(!1), fe = p(!1), pe = p([]), me = p(null);
12753
- me.current = async () => {
12754
- let e = pe.current;
12789
+ let [w, T] = m("idle"), [E, D] = m(!1), [O, k] = m(!1), [A, ee] = m(!1), [te, ne] = m(""), [j, M] = m(""), re = p(!1), ie = p(!1), ae = p(null), oe = p(0), se = p(""), ce = p(!1), le = p(0), ue = p(!1), de = p(!1), fe = p([]), pe = p(null), me = (e) => {
12790
+ ue.current = e, N.current?.setWalkthroughActive?.(e);
12791
+ };
12792
+ pe.current = async () => {
12793
+ let e = fe.current;
12755
12794
  he.current += 1;
12756
12795
  let t = he.current, n = e[t];
12757
12796
  if (!n) {
12758
- de.current = !1, e.length && M.current?.sendUserMessage?.("That was the last section. Say so in one short sentence and ask if they want to explore any section further.");
12797
+ me(!1), e.length && N.current?.sendUserMessage?.("That was the last section. Say so in one short sentence and ask if they want to explore any section further.");
12759
12798
  return;
12760
12799
  }
12761
12800
  try {
12762
12801
  await toolsRef.current?.highlightOnPage?.({ section_text: n });
12763
12802
  } catch {}
12764
- console.debug(`[FlowEngage] walkthrough step ${t + 1}/${e.length}: ${n}`), M.current?.sendUserMessage?.(`Describe the section titled "${n}" in 3-4 sentences, starting with ${t === 0 ? "Starting with" : "Next —"} ${n}. Describe ONLY this section. Do not mention any other section, do not ask whether to continue, then stop.`);
12803
+ console.debug(`[FlowEngage] walkthrough step ${t + 1}/${e.length}: ${n}`), N.current?.sendUserMessage?.(`Describe the section titled "${n}" in 3-4 sentences, starting with ${t === 0 ? "Starting with" : "Next —"} ${n}. Describe ONLY this section. Do not mention any other section, do not ask whether to continue, then stop.`, { suppressQuestion: !0 });
12765
12804
  };
12766
- let he = p(0), M = p(null), ge = p(""), _e = p(async () => {}), ve = p(!1), ye = p(!1), be = p(!1), xe = p(!1), Se = p("minimized"), N = p(null), Ce = p(null), F = p(null), De = p(0), Oe = p(!1), I = p("idle"), ke = p(!1), je = p(!1), Me = p(null), L = p(null), Pe = p(!1), Fe = o((e = "minimized") => {
12805
+ let he = p(0), N = p(null), ge = p(""), _e = p(async () => {}), ve = p(!1), ye = p(!1), be = p(!1), xe = p(!1), Se = p("minimized"), Ce = p(null), F = p(null), De = p(null), Oe = p(0), I = p(!1), ke = p("idle"), je = p(null), Me = p(!1), Pe = o((e = "minimized") => {
12767
12806
  console.warn("[FlowEngage:VoiceDebug] 🛑 requestSessionShutdown called", {
12768
12807
  destination: e,
12769
12808
  stack: (/* @__PURE__ */ Error()).stack?.split("\n").slice(1, 4).join(" | ")
12770
12809
  }), Se.current = e, xe.current = !0, queueMicrotask(() => {
12771
12810
  ve.current || (ve.current = !0, _e.current?.());
12772
12811
  });
12773
- }, [l]), Ie = o(() => {
12774
- oe.current &&= (clearTimeout(oe.current), null);
12812
+ }, [l]), L = o(() => {
12813
+ ae.current &&= (clearTimeout(ae.current), null);
12775
12814
  }, []);
12776
12815
  c(() => {
12777
12816
  if (y) {
12778
- ie.current = !1;
12817
+ re.current = !1;
12779
12818
  return;
12780
12819
  }
12781
- if (ie.current = !0, ae.current = !1, ee(!1), Ie(), le.current) {
12782
- le.current = !1, M.current?.setMicMuted?.(!1);
12783
- let e = ce.current;
12784
- ce.current = "", M.current?.injectAgentSpeech?.("Thanks — I already have your email on file.", "interrupt"), e && M.current?.sendUserMessage?.(`The visitor's email is already on file — do not ask for it. Answer their question now: "${e}"`);
12785
- }
12786
- M.current?.sendContextualUpdate?.("EMAIL REQUIREMENT SATISFIED — the visitor's email is already on file. All earlier instructions about requiring or asking for an email are VOID. Never ask for it again.");
12787
- }, [y, Ie]);
12788
- let Le = /(walk me through|complete overview|full overview|tell me about (each|all)|go through (it|them|each)|overview of|one by one|tell me everything)/i, R = /(that covers everything|that was all|covered everything|anything else)/i, Re = o(() => {
12789
- Ie(), oe.current = setTimeout(() => {
12790
- if (!(!ae.current || ie.current)) if (se.current < 3) {
12791
- se.current += 1;
12820
+ if (re.current = !0, ie.current = !1, ee(!1), L(), ce.current) {
12821
+ ce.current = !1, N.current?.setMicMuted?.(!1);
12822
+ let e = se.current;
12823
+ se.current = "", N.current?.injectAgentSpeech?.("Thanks — I already have your email on file.", "interrupt"), e && N.current?.sendUserMessage?.(`The visitor's email is already on file — do not ask for it. Answer their question now: "${e}"`);
12824
+ }
12825
+ N.current?.sendContextualUpdate?.("EMAIL REQUIREMENT SATISFIED — the visitor's email is already on file. All earlier instructions about requiring or asking for an email are VOID. Never ask for it again.");
12826
+ }, [y, L]);
12827
+ let Fe = /(walk\s*(me\s*)?through|walkthrough|take me through|complete overview|full overview|give me (a|an|the) (overview|tour|walk)|tell me about (each|all)|go through (it|them|each|all)|overview of|one by one|tell me everything|show me (each|all|around))/i, Ie = /(that covers everything|that was all|covered everything|anything else)/i, Le = o(() => {
12828
+ L(), ae.current = setTimeout(() => {
12829
+ if (!(!ie.current || re.current)) if (oe.current < 3) {
12830
+ oe.current += 1;
12792
12831
  try {
12793
- M.current?.injectAgentSpeech?.("I still need your email in the box below to continue — could you enter it, please?", "queue");
12832
+ N.current?.injectAgentSpeech?.("I still need your email in the box below to continue — could you enter it, please?", "queue");
12794
12833
  } catch {}
12795
- Re();
12834
+ Le();
12796
12835
  } else {
12797
12836
  try {
12798
- M.current?.injectAgentSpeech?.("Since I haven't received your email, I'll close this session for now. Feel free to come back anytime — take care!", "queue");
12837
+ N.current?.injectAgentSpeech?.("Since I haven't received your email, I'll close this session for now. Feel free to come back anytime — take care!", "queue");
12799
12838
  } catch {}
12800
- ae.current = !1, ee(!1), Ie(), Oe.current = !0;
12839
+ ie.current = !1, ee(!1), L(), I.current = !0;
12801
12840
  }
12802
12841
  }, 1e4);
12803
- }, [Ie]), ze = o(async (e) => {
12842
+ }, [L]), R = o(async (e) => {
12804
12843
  xe.current = !0;
12805
12844
  try {
12806
12845
  On();
@@ -12809,9 +12848,9 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12809
12848
  Ne(i);
12810
12849
  } catch {}
12811
12850
  try {
12812
- await M.current?.endSession?.();
12851
+ await N.current?.endSession?.();
12813
12852
  } catch {}
12814
- let t = N.current, n = Ce.current;
12853
+ let t = Ce.current, n = F.current;
12815
12854
  if (t && s && a) {
12816
12855
  let e = n ? Math.round((Date.now() - n) / 1e3) : 0;
12817
12856
  fetch(`${a}/api/voice/save-chat-recording`, {
@@ -12825,7 +12864,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12825
12864
  })
12826
12865
  }).catch((e) => console.warn("[FlowEngage] save-chat-recording failed:", e.message));
12827
12866
  }
12828
- if (N.current = null, Ce.current = null, M.current = null, T("idle"), D(!1), ve.current = !1, wr(), i) try {
12867
+ if (Ce.current = null, F.current = null, N.current = null, T("idle"), D(!1), ve.current = !1, wr(), i) try {
12829
12868
  Te(i);
12830
12869
  } catch {}
12831
12870
  typeof u == "function" && await u(l.current), e?.();
@@ -12836,10 +12875,10 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12836
12875
  s,
12837
12876
  a
12838
12877
  ]);
12839
- _e.current = () => ze(Se.current === "chat" ? t : n), c(() => {
12878
+ _e.current = () => R(Se.current === "chat" ? t : n), c(() => {
12840
12879
  ye.current = E;
12841
12880
  }, [E]), c(() => {
12842
- d && Fe("chat");
12881
+ d && Pe("chat");
12843
12882
  }, [d]), c(() => {
12844
12883
  let e = !1, o = null, c = null, d = null;
12845
12884
  return (async () => {
@@ -12851,11 +12890,11 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12851
12890
  if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
12852
12891
  l.current = [], ge.current = "", ve.current = !1, be.current = !1, xe.current = !1, Se.current = "minimized", Cr({ onBeforeNavigate: () => {
12853
12892
  if (i && l.current.length > 0) try {
12854
- let e = Th(l.current);
12893
+ let e = kh(l.current);
12855
12894
  e && P(i, e);
12856
12895
  } catch {}
12857
12896
  if (!qn()) {
12858
- let e = N.current, t = Ce.current;
12897
+ let e = Ce.current, t = F.current;
12859
12898
  if (e && s && a) try {
12860
12899
  let n = t ? Math.round((Date.now() - t) / 1e3) : 0, r = JSON.stringify({
12861
12900
  chatId: s,
@@ -12868,21 +12907,21 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12868
12907
  headers: { "Content-Type": "application/json" },
12869
12908
  body: r,
12870
12909
  keepalive: !0
12871
- }).catch(() => {}), N.current = null, Ce.current = null;
12910
+ }).catch(() => {}), Ce.current = null, F.current = null;
12872
12911
  } catch {}
12873
12912
  }
12874
12913
  Ee();
12875
12914
  } });
12876
- let t = mg(dg({
12915
+ let t = vg(hg({
12877
12916
  siteId: i || null,
12878
12917
  apiBaseUrl: a || null,
12879
12918
  chatId: s || null,
12880
12919
  getLastUserVoiceText: () => ge.current,
12881
12920
  requestEndSession: () => {
12882
- Oe.current = !0;
12921
+ I.current = !0;
12883
12922
  },
12884
12923
  requestEmailCollection: () => {
12885
- b && (ie.current || ae.current || (ae.current = !0, se.current = 0, ee(!0), Re()));
12924
+ b && (re.current || ie.current || (ie.current = !0, oe.current = 0, ee(!0), Le()));
12886
12925
  }
12887
12926
  })), n = i ? we(i) : null, r = !!n?.transcript, u = i ? Ne(i) : null, p = !!u, m = typeof window < "u" ? window.location.pathname : "/", g = typeof document < "u" ? document.title : "", _ = m.replace(/^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i, "") || "/", v = _ === "/" || _ === "", x = {
12888
12927
  apiBaseUrl: a,
@@ -12908,89 +12947,88 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12908
12947
  let e = f || "";
12909
12948
  x.greeting = h || (v ? e ? `Hi, welcome to ${e}! How may I help you?` : "Hi, welcome! How may I help you?" : `Welcome to the ${w} page!`), v || console.log(`[FlowEngage] 🏠 Page-context greeting: "${w}" for ${m}`);
12910
12949
  }
12911
- let O = !1, k = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you on [page] page. Do you want to know about any specific section or want a complete overview?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until the visitor responds. When they reply: if they name a specific section → call fwh-get-current-page-mvp then answer immediately; if they say "overview" or anything non-specific → call fwh-get-current-page-mvp (zero speech) then do a full highlighted walkthrough.` : null, A = !1, te = !p && !r ? "Your greeting has been spoken. Wait for the visitor to ask a question or tell you what they need. Do NOT auto-start a walkthrough or highlight any sections — let the visitor lead." : null, ne = r && !p, j = !1, re = ne ? `The question "Would you like me to continue what I was explaining before, or would you like to know about this page instead?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript, or the visitor navigated before saying much)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until they respond. When they reply: if they want you to CONTINUE the previous topic → resume verbally from the prior transcript above, do NOT call fwh-get-current-page-mvp or describe the new page unless they ask. If they want to know about THIS page → call fwh-get-current-page-mvp (zero speech) then proceed as a normal fresh-page walkthrough/description. If their reply is ambiguous, ask them to clarify which they'd prefer rather than guessing.` : null, oe = !1, _e = !1, Te = b && !!y && !fe.current, F = await Om.startSession({
12950
+ let O = !1, k = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you on [page] page. Do you want to know about any specific section or want a complete overview?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until the visitor responds. When they reply: if they name a specific section → call fwh-get-current-page-mvp then answer immediately; if they say "overview" or anything non-specific → call fwh-get-current-page-mvp (zero speech) then do a full highlighted walkthrough.` : null, A = !1, te = !p && !r ? "Your greeting has been spoken. Wait for the visitor to ask a question or tell you what they need. Do NOT auto-start a walkthrough or highlight any sections — let the visitor lead." : null, ne = r && !p, j = !1, M = ne ? `The question "Would you like me to continue what I was explaining before, or would you like to know about this page instead?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript, or the visitor navigated before saying much)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until they respond. When they reply: if they want you to CONTINUE the previous topic → resume verbally from the prior transcript above, do NOT call fwh-get-current-page-mvp or describe the new page unless they ask. If they want to know about THIS page → call fwh-get-current-page-mvp (zero speech) then proceed as a normal fresh-page walkthrough/description. If their reply is ambiguous, ask them to clarify which they'd prefer rather than guessing.` : null, ae = !1, _e = !1, Te = b && !!y && !de.current, De = await Mm.startSession({
12912
12951
  ...x,
12913
12952
  onConnect: ({ conversationId: e }) => {
12914
- N.current = e, Ce.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
12953
+ Ce.current = e, F.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
12915
12954
  },
12916
12955
  onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
12917
12956
  onSessionInfo: ({ emailOnFile: e }) => {
12918
- fe.current = !!e, e && (ie.current = !0, ae.current = !1, ee(!1), Ie(), console.log("[FlowEngage] email already on file per server — gate disabled"));
12957
+ de.current = !!e, e && (re.current = !0, ie.current = !1, ee(!1), L(), console.log("[FlowEngage] email already on file per server — gate disabled"));
12919
12958
  },
12920
12959
  onAgentTurnEnd: () => {
12921
- e || de.current && (le.current || setTimeout(() => me.current?.(), 250));
12960
+ e || ue.current && (ce.current || setTimeout(() => pe.current?.(), 250));
12961
+ },
12962
+ onSessionEnding: () => {
12963
+ e || Pe("minimized");
12922
12964
  },
12923
12965
  onModeChange: ({ mode: t }) => {
12924
12966
  if (!e) {
12925
12967
  if (t === "speaking") {
12926
- L.current &&= (clearTimeout(L.current), null), T("speaking"), I.current = "speaking", ke.current = !0, Pe.current = !1, Me.current &&= (clearTimeout(Me.current), null);
12968
+ je.current &&= (clearTimeout(je.current), null), T("speaking"), ke.current = "speaking", Me.current = !1;
12927
12969
  return;
12928
12970
  }
12929
- if (I.current = "listening", Oe.current) {
12930
- Oe.current = !1, Fe();
12971
+ if (ke.current = "listening", I.current) {
12972
+ I.current = !1, Pe();
12931
12973
  return;
12932
12974
  }
12933
- if (Te && !_e && !ie.current && !fe.current) {
12975
+ if (Te && !_e && !re.current && !de.current) {
12934
12976
  _e = !0, O = !0, A = !0;
12935
12977
  try {
12936
- M.current?.sendContextualUpdate?.("CRITICAL — EMAIL REQUIRED BEFORE ANYTHING ELSE. The visitor has not provided their email. Do NOT speak right now. Wait silently for the visitor to speak first. The MOMENT the visitor says ANYTHING — a question, a request, or just a greeting — your ENTIRE next response must be EXACTLY this one sentence: \"Before I answer that, could you please enter your email in the text box below?\" Do NOT answer their question. Do NOT say anything about the topic. Do NOT begin an answer and then switch — your first word must be \"Before\". After you say that sentence, stay completely silent until you receive an EMAIL_SAVED message, then thank them briefly and answer their question in full.");
12978
+ N.current?.sendContextualUpdate?.("CRITICAL — EMAIL REQUIRED BEFORE ANYTHING ELSE. The visitor has not provided their email. Do NOT speak right now. Wait silently for the visitor to speak first. The MOMENT the visitor says ANYTHING — a question, a request, or just a greeting — your ENTIRE next response must be EXACTLY this one sentence: \"Before I answer that, could you please enter your email in the text box below?\" Do NOT answer their question. Do NOT say anything about the topic. Do NOT begin an answer and then switch — your first word must be \"Before\". After you say that sentence, stay completely silent until you receive an EMAIL_SAVED message, then thank them briefly and answer their question in full.");
12937
12979
  } catch {}
12938
12980
  }
12939
12981
  if (k && !O) {
12940
12982
  O = !0;
12941
12983
  try {
12942
- M.current?.sendContextualUpdate?.(k);
12984
+ N.current?.sendContextualUpdate?.(k);
12943
12985
  } catch {}
12944
12986
  }
12945
- if (re && !j) {
12987
+ if (M && !j) {
12946
12988
  j = !0;
12947
12989
  try {
12948
- M.current?.sendContextualUpdate?.(re);
12990
+ N.current?.sendContextualUpdate?.(M);
12949
12991
  } catch {}
12950
12992
  }
12951
12993
  if (te && !A) {
12952
12994
  A = !0;
12953
12995
  try {
12954
- M.current?.sendContextualUpdate?.(te);
12996
+ N.current?.sendContextualUpdate?.(te);
12955
12997
  } catch {}
12956
12998
  }
12957
- L.current && clearTimeout(L.current), L.current = setTimeout(() => {
12958
- e || I.current !== "speaking" && (Pe.current || (L.current = null, I.current = "listening", T("listening"), ke.current && je.current && !ye.current && !ae.current && (Me.current && clearTimeout(Me.current), Me.current = setTimeout(() => {
12959
- if (!e && I.current === "listening" && !ye.current && !ae.current) try {
12960
- M.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.");
12961
- } catch {}
12962
- }, 15e3))));
12999
+ je.current && clearTimeout(je.current), je.current = setTimeout(() => {
13000
+ e || ke.current !== "speaking" && (Me.current || (je.current = null, ke.current = "listening", T("listening")));
12963
13001
  }, 1200);
12964
13002
  }
12965
13003
  },
12966
13004
  onMessage: (t) => {
12967
- if (e || le.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
12968
- t.role === "user" && Le.test(String(t.message || "")) && (de.current = !0, ue.current = 0, he.current = -1, pe.current = pg(), setTimeout(() => me.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${pe.current.length} sections on this page`)), t.role !== "user" && R.test(String(t.message || "")) && (de.current = !1);
13005
+ if (e || ce.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
13006
+ t.role === "user" && Fe.test(String(t.message || "")) && (me(!0), le.current = 0, he.current = -1, fe.current = _g(), setTimeout(() => pe.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${fe.current.length} sections on this page`)), t.role !== "user" && Ie.test(String(t.message || "")) && me(!1);
12969
13007
  let n = t.role === "user" ? "user" : "bot", r = t.message || t.text || t.content || "";
12970
13008
  if (r) {
12971
13009
  if (n === "user") {
12972
- ge.current = r, Pe.current = !0, je.current = !0, L.current &&= (clearTimeout(L.current), null), Me.current &&= (clearTimeout(Me.current), null);
13010
+ ge.current = r, Me.current = !0, je.current &&= (clearTimeout(je.current), null);
12973
13011
  try {
12974
13012
  On();
12975
13013
  } catch {}
12976
- Te && !oe && !ie.current && !fe.current && (oe = !0, ce.current = r, le.current = !0, M.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), M.current?.setMicMuted?.(!0), ae.current || (ae.current = !0, se.current = 0, ee(!0), Re()));
13014
+ Te && !ae && !re.current && !de.current && (ae = !0, se.current = r, ce.current = !0, N.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), N.current?.setMicMuted?.(!0), ie.current || (ie.current = !0, oe.current = 0, ee(!0), Le()));
12977
13015
  }
12978
13016
  if (l.current = [...l.current, {
12979
13017
  sender: n,
12980
13018
  message: r,
12981
13019
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
12982
13020
  }], i) try {
12983
- let e = Th(l.current);
13021
+ let e = kh(l.current);
12984
13022
  e && P(i, e);
12985
13023
  } catch {}
12986
- if (xg(n, r)) {
12987
- Oe.current = !0;
13024
+ if (Tg(n, r)) {
13025
+ I.current = !0;
12988
13026
  return;
12989
13027
  }
12990
- if (ye.current && n === "bot" && /are you still there|still there\??|hello\?|anyone there|checking in|you there|are you available|is anyone|did you step away/i.test(r)) if (De.current += 1, De.current === 2) try {
12991
- M.current?.sendContextualUpdate?.("IMPORTANT: The visitor is muted and has not responded to your last 2 checks. Make exactly ONE more check. If there is still no response, say: 'I feel like you are not active, so I'm ending this session. You can connect with me anytime.' then immediately call the fwh-end-session-mvp tool to end the voice session. Do NOT ask again after that.");
13028
+ if (ye.current && n === "bot" && /are you still there|still there\??|hello\?|anyone there|checking in|you there|are you available|is anyone|did you step away/i.test(r)) if (Oe.current += 1, Oe.current === 2) try {
13029
+ N.current?.sendContextualUpdate?.("IMPORTANT: The visitor is muted and has not responded to your last 2 checks. Make exactly ONE more check. If there is still no response, say: 'I feel like you are not active, so I'm ending this session. You can connect with me anytime.' then immediately call the fwh-end-session-mvp tool to end the voice session. Do NOT ask again after that.");
12992
13030
  } catch {}
12993
- else De.current >= 5 && Fe("minimized");
13031
+ else Oe.current >= 5 && Pe("minimized");
12994
13032
  }
12995
13033
  },
12996
13034
  onError: (t) => {
@@ -13001,9 +13039,9 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13001
13039
  raw: t
13002
13040
  });
13003
13041
  try {
13004
- M.current?.setMicMuted?.(!0);
13042
+ N.current?.setMicMuted?.(!0);
13005
13043
  } catch {}
13006
- D(!0), T("error"), Fe("chat");
13044
+ D(!0), T("error"), Pe("chat");
13007
13045
  }
13008
13046
  },
13009
13047
  onDisconnect: (t) => {
@@ -13018,16 +13056,16 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13018
13056
  wasMuted: ye.current
13019
13057
  }), be.current = !0;
13020
13058
  try {
13021
- M.current?.setMicMuted?.(!0);
13059
+ N.current?.setMicMuted?.(!0);
13022
13060
  } catch {}
13023
- D(!0), Fe("chat");
13061
+ D(!0), Pe("chat");
13024
13062
  }
13025
13063
  });
13026
13064
  if (e) {
13027
- console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), F.endSession().catch(() => {});
13065
+ console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), De.endSession().catch(() => {});
13028
13066
  return;
13029
13067
  }
13030
- o = F, M.current = F, T("listening");
13068
+ o = De, N.current = De, T("listening");
13031
13069
  try {
13032
13070
  let e = typeof window < "u" ? window.location.href : "", a = "[]";
13033
13071
  try {
@@ -13039,7 +13077,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13039
13077
  n.length || (n = Array.from(document.body.querySelectorAll("h1, h2, h3")).filter((t) => !t.closest(e)).map((e) => e.textContent.replace(/\s+/g, " ").trim()).filter((e) => e.length > 2 && e.length < 200)), n.length && (o = [...new Set(n)].slice(0, 15).join(" | "));
13040
13078
  } catch {}
13041
13079
  let s = r && !p ? `RESUMING PRIOR SESSION — DO NOT GREET. The visitor is continuing the same conversation after a page reload. Do not introduce yourself or re-state your capabilities. Wait silently until the visitor speaks; if you must speak first, briefly acknowledge where you left off in one short sentence.\nPrior transcript:\n${n?.transcript || ""}\n\n` : "";
13042
- F.sendContextualUpdate(`${s}SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${o}. SiteId: ${i || "unknown"}. Forms: ${a}. ${y ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}The visitor is ALREADY on this page — do NOT offer to navigate there. WALKTHROUGH RULE: When the visitor asks for a walkthrough or overview of this page, you MUST IMMEDIATELY call fwh-get-current-page-mvp (zero speech — call it silently with NO words before it) to get the exact highlightable headings. The approximate headings above are for routing awareness ONLY — they are NOT precise enough for fwh-highlight-mvp. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`);
13080
+ De.sendContextualUpdate(`${s}SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${o}. SiteId: ${i || "unknown"}. Forms: ${a}. ${y ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}The visitor is ALREADY on this page — do NOT offer to navigate there. WALKTHROUGH RULE: When the visitor asks for a walkthrough or overview of this page, you MUST IMMEDIATELY call fwh-get-current-page-mvp (zero speech — call it silently with NO words before it) to get the exact highlightable headings. The approximate headings above are for routing awareness ONLY — they are NOT precise enough for fwh-highlight-mvp. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`);
13043
13081
  } catch {}
13044
13082
  if (typeof window < "u") {
13045
13083
  let t = window.location.pathname, n = () => {
@@ -13068,7 +13106,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13068
13106
  ts: Date.now()
13069
13107
  });
13070
13108
  try {
13071
- M.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${l}" page (${i}). Page title: "${a}". Sections: ${JSON.stringify(o)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${l} page — would you like me to continue what I was explaining, or shall I walk you through this page?" Then wait for my answer. IF I say continue/yes/carry on: resume speaking verbally from where you left off — do NOT call flowengage_navigate, do NOT call flowengage_highlight, the visitor will navigate themselves if needed. IF I want to hear about this page: call flowengage_highlight for sections of "${l}" only.]`);
13109
+ N.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${l}" page (${i}). Page title: "${a}". Sections: ${JSON.stringify(o)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${l} page — would you like me to continue what I was explaining, or shall I walk you through this page?" Then wait for my answer. IF I say continue/yes/carry on: resume speaking verbally from where you left off — do NOT call flowengage_navigate, do NOT call flowengage_highlight, the visitor will navigate themselves if needed. IF I want to hear about this page: call flowengage_highlight for sections of "${l}" only.]`);
13072
13110
  } catch {}
13073
13111
  };
13074
13112
  c = window.history.pushState.bind(window.history), window.history.pushState = (...e) => {
@@ -13092,8 +13130,8 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13092
13130
  if (i) try {
13093
13131
  Ne(i);
13094
13132
  } catch {}
13095
- typeof window < "u" && (window.__fe_user_nav_during_speech = null), wr(), Me.current &&= (clearTimeout(Me.current), null), L.current &&= (clearTimeout(L.current), null), oe.current &&= (clearTimeout(oe.current), null), ke.current = !1, Pe.current = !1, I.current = "idle", c && typeof window < "u" && (window.history.pushState = c), d && typeof window < "u" && window.removeEventListener("popstate", d);
13096
- let t = o || M.current, n = N.current, f = Ce.current;
13133
+ typeof window < "u" && (window.__fe_user_nav_during_speech = null), wr(), je.current &&= (clearTimeout(je.current), null), ae.current &&= (clearTimeout(ae.current), null), Me.current = !1, ke.current = "idle", c && typeof window < "u" && (window.history.pushState = c), d && typeof window < "u" && window.removeEventListener("popstate", d);
13134
+ let t = o || N.current, n = Ce.current, f = F.current;
13097
13135
  if (t?.endSession?.().catch(() => {}), n && s && a) {
13098
13136
  let e = f ? Math.round((Date.now() - f) / 1e3) : 0, t = JSON.stringify({
13099
13137
  chatId: s,
@@ -13106,7 +13144,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13106
13144
  headers: { "Content-Type": "application/json" },
13107
13145
  body: t,
13108
13146
  keepalive: !0
13109
- }).catch(() => {}), N.current = null, Ce.current = null;
13147
+ }).catch(() => {}), Ce.current = null, F.current = null;
13110
13148
  }
13111
13149
  typeof u == "function" && l.current.length > 0 && u(l.current).catch?.(() => {});
13112
13150
  };
@@ -13114,53 +13152,53 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13114
13152
  r,
13115
13153
  i,
13116
13154
  a,
13117
- Fe
13155
+ Pe
13118
13156
  ]), c(() => {
13119
13157
  if (!O) return;
13120
13158
  let e = (e) => {
13121
13159
  let t = e.composedPath?.()?.[0] || e.target;
13122
- F.current && !F.current.contains(t) && k(!1);
13160
+ De.current && !De.current.contains(t) && k(!1);
13123
13161
  };
13124
13162
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
13125
13163
  }, [O]);
13126
- let Be = async () => {
13127
- if (M.current) try {
13164
+ let Re = async () => {
13165
+ if (N.current) try {
13128
13166
  if (E) {
13129
- De.current = 0, await M.current.setMicMuted?.(!1), D(!1);
13167
+ Oe.current = 0, await N.current.setMicMuted?.(!1), D(!1);
13130
13168
  try {
13131
- M.current.sendContextualUpdate?.("The visitor has unmuted. Resume normal interaction and wait for them to speak.");
13169
+ N.current.sendContextualUpdate?.("The visitor has unmuted. Resume normal interaction and wait for them to speak.");
13132
13170
  } catch {}
13133
13171
  } else {
13134
- De.current = 0, await M.current.setMicMuted?.(!0), D(!0);
13172
+ Oe.current = 0, await N.current.setMicMuted?.(!0), D(!0);
13135
13173
  try {
13136
- M.current.sendContextualUpdate?.("The visitor has muted their microphone. Do NOT speak, ask if they are there, or prompt them in any way. Stay completely silent until they unmute.");
13174
+ N.current.sendContextualUpdate?.("The visitor has muted their microphone. Do NOT speak, ask if they are there, or prompt them in any way. Stay completely silent until they unmute.");
13137
13175
  } catch {}
13138
13176
  }
13139
13177
  } catch {}
13140
- }, Ve = o(async (e) => {
13178
+ }, ze = o(async (e) => {
13141
13179
  e?.preventDefault?.();
13142
13180
  let t = te.trim().toLowerCase();
13143
13181
  if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)) {
13144
- re("Please enter a valid email address.");
13182
+ M("Please enter a valid email address.");
13145
13183
  return;
13146
13184
  }
13147
- re("");
13185
+ M("");
13148
13186
  try {
13149
13187
  typeof v == "function" && await v(t);
13150
13188
  } catch {}
13151
- ie.current = !0, ae.current = !1, Ie(), ee(!1), ne(""), le.current = !1, M.current?.setMicMuted?.(!1);
13152
- let n = ce.current;
13153
- ce.current = "";
13189
+ re.current = !0, ie.current = !1, L(), ee(!1), ne(""), ce.current = !1, N.current?.setMicMuted?.(!1);
13190
+ let n = se.current;
13191
+ se.current = "";
13154
13192
  try {
13155
- M.current?.sendUserMessage?.("[SYSTEM: EMAIL_SAVED — the visitor typed and submitted their email address. Say a brief 'Thank you!' and then " + (n ? `immediately answer their original question fully: "${n}".` : "continue helping them.") + " Do NOT ask for their email again.]");
13193
+ N.current?.sendUserMessage?.("[SYSTEM: EMAIL_SAVED — the visitor typed and submitted their email address. Say a brief 'Thank you!' and then " + (n ? `immediately answer their original question fully: "${n}".` : "continue helping them.") + " Do NOT ask for their email again.]");
13156
13194
  } catch {}
13157
13195
  }, [
13158
13196
  te,
13159
13197
  v,
13160
- Ie
13161
- ]), He = Array.isArray(e) && e[0] || "#3B82F6";
13198
+ L
13199
+ ]), Be = Array.isArray(e) && e[0] || "#3B82F6";
13162
13200
  return /* @__PURE__ */ _("div", {
13163
- ref: F,
13201
+ ref: De,
13164
13202
  style: {
13165
13203
  position: "relative",
13166
13204
  display: "flex",
@@ -13171,7 +13209,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13171
13209
  },
13172
13210
  children: [
13173
13211
  A && /* @__PURE__ */ _("form", {
13174
- onSubmit: Ve,
13212
+ onSubmit: ze,
13175
13213
  style: {
13176
13214
  width: "270px",
13177
13215
  maxWidth: "calc(100vw - 40px)",
@@ -13204,7 +13242,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13204
13242
  autoFocus: !0,
13205
13243
  value: te,
13206
13244
  onChange: (e) => {
13207
- ne(e.target.value), j && re("");
13245
+ ne(e.target.value), j && M("");
13208
13246
  },
13209
13247
  placeholder: "you@example.com",
13210
13248
  style: {
@@ -13234,7 +13272,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13234
13272
  padding: "10px 12px",
13235
13273
  borderRadius: "10px",
13236
13274
  border: "none",
13237
- background: te.trim() ? He : "#374151",
13275
+ background: te.trim() ? Be : "#374151",
13238
13276
  color: "white",
13239
13277
  fontSize: "14px",
13240
13278
  fontWeight: 600,
@@ -13280,7 +13318,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13280
13318
  },
13281
13319
  children: "Muted"
13282
13320
  }),
13283
- /* @__PURE__ */ g(Sg, {
13321
+ /* @__PURE__ */ g(Eg, {
13284
13322
  size: 72,
13285
13323
  voiceState: w,
13286
13324
  isMuted: E,
@@ -13303,7 +13341,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13303
13341
  alignItems: "center"
13304
13342
  },
13305
13343
  children: [/* @__PURE__ */ g("button", {
13306
- onClick: Be,
13344
+ onClick: Re,
13307
13345
  title: E ? "Unmute" : "Mute",
13308
13346
  style: {
13309
13347
  width: "24px",
@@ -13352,7 +13390,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13352
13390
  y2: "23"
13353
13391
  })
13354
13392
  ]
13355
- }) : /* @__PURE__ */ g(km, {
13393
+ }) : /* @__PURE__ */ g(Nm, {
13356
13394
  size: 16,
13357
13395
  color: "currentColor"
13358
13396
  })
@@ -13374,7 +13412,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13374
13412
  padding: 0,
13375
13413
  flexShrink: 0
13376
13414
  },
13377
- children: /* @__PURE__ */ g(Lm, {
13415
+ children: /* @__PURE__ */ g(Vm, {
13378
13416
  size: 16,
13379
13417
  color: "currentColor"
13380
13418
  })
@@ -13398,7 +13436,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13398
13436
  children: [
13399
13437
  /* @__PURE__ */ _("button", {
13400
13438
  onClick: () => {
13401
- k(!1), Se.current = "chat", ze(t);
13439
+ k(!1), Se.current = "chat", R(t);
13402
13440
  },
13403
13441
  style: {
13404
13442
  display: "flex",
@@ -13423,11 +13461,11 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13423
13461
  onMouseLeave: (e) => {
13424
13462
  e.currentTarget.style.background = "none";
13425
13463
  },
13426
- children: [/* @__PURE__ */ g(Rm, {}), S]
13464
+ children: [/* @__PURE__ */ g(Hm, {}), S]
13427
13465
  }),
13428
13466
  /* @__PURE__ */ _("button", {
13429
13467
  onClick: () => {
13430
- k(!1), Se.current = "minimized", ze(n);
13468
+ k(!1), Se.current = "minimized", R(n);
13431
13469
  },
13432
13470
  style: {
13433
13471
  display: "flex",
@@ -13452,7 +13490,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13452
13490
  onMouseLeave: (e) => {
13453
13491
  e.currentTarget.style.background = "none";
13454
13492
  },
13455
- children: [/* @__PURE__ */ g(zm, {}), C]
13493
+ children: [/* @__PURE__ */ g(Um, {}), C]
13456
13494
  }),
13457
13495
  /* @__PURE__ */ g("button", {
13458
13496
  onClick: () => k(!1),
@@ -13504,7 +13542,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13504
13542
  ]
13505
13543
  });
13506
13544
  }
13507
- function Eg({ orbColors: e }) {
13545
+ function Ag({ orbColors: e }) {
13508
13546
  let t = Array.isArray(e) && e.length > 0 ? e : [
13509
13547
  "#135bd8",
13510
13548
  "#ef334b",
@@ -13523,7 +13561,7 @@ function Eg({ orbColors: e }) {
13523
13561
  `.replace(/\s+/g, " ").trim()
13524
13562
  } });
13525
13563
  }
13526
- var Dg = () => /* @__PURE__ */ g("div", {
13564
+ var jg = () => /* @__PURE__ */ g("div", {
13527
13565
  style: {
13528
13566
  display: "flex",
13529
13567
  marginBottom: "12px",
@@ -13553,8 +13591,8 @@ var Dg = () => /* @__PURE__ */ g("div", {
13553
13591
  } }, e))
13554
13592
  })
13555
13593
  });
13556
- function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: E, rateLimitMessage: D, selectedFile: O, onFileSelect: k, onRemoveSelectedFile: A, attachmentError: ee, isUploadingAttachment: te, requiresEmail: ne, emailInput: j, setEmailInput: re, emailError: ie, emailCaptureSuccess: ae, replyContext: oe, setReplyContext: se, webRTCError: ce, micError: le, setMicError: ue, dismissCallError: de, activeCallId: fe, isCallMuted: pe, toggleCallMute: me, endWebRTCCall: he, formatCallDuration: M, callDurationSeconds: ge, isCallMinimized: _e, onExpand: ve, onCollapse: ye, onStartVoice: be, voiceEnabled: xe, headerBgColor: Se, onNewChat: N, showPoweredBy: Ce, privacyPolicyUrl: P, getVisitorChatHistory: we, resumeChat: Te, isSessionRestoring: F, isClosing: Ee }) {
13557
- let De = l.length > 0, Oe = T || E || w, I = !!fe, [ke, Ae] = m(!1), [je, Me] = m(!1), [Ne, L] = m([]), [Pe, Fe] = m(!1), Ie = p(null), [Le, R] = m(() => typeof window < "u" ? window.visualViewport?.height ?? window.innerHeight : 600), [Re, ze] = m(0);
13594
+ function Mg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: E, rateLimitMessage: D, selectedFile: O, onFileSelect: k, onRemoveSelectedFile: A, attachmentError: ee, isUploadingAttachment: te, requiresEmail: ne, emailInput: j, setEmailInput: M, emailError: re, emailCaptureSuccess: ie, replyContext: ae, setReplyContext: oe, webRTCError: se, micError: ce, setMicError: le, dismissCallError: ue, activeCallId: de, isCallMuted: fe, toggleCallMute: pe, endWebRTCCall: me, formatCallDuration: he, callDurationSeconds: N, isCallMinimized: ge, onExpand: _e, onCollapse: ve, onStartVoice: ye, voiceEnabled: be, headerBgColor: xe, onNewChat: Se, showPoweredBy: Ce, privacyPolicyUrl: P, getVisitorChatHistory: we, resumeChat: Te, isSessionRestoring: F, isClosing: Ee }) {
13595
+ let De = l.length > 0, Oe = T || E || w, I = !!de, [ke, Ae] = m(!1), [je, Me] = m(!1), [Ne, Pe] = m([]), [L, Fe] = m(!1), Ie = p(null), [Le, R] = m(() => typeof window < "u" ? window.visualViewport?.height ?? window.innerHeight : 600), [Re, ze] = m(0);
13558
13596
  c(() => {
13559
13597
  if (!s) return;
13560
13598
  let e = window.visualViewport;
@@ -13570,7 +13608,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13570
13608
  Ae(!1), Me(!0), Fe(!0);
13571
13609
  try {
13572
13610
  let e = await we();
13573
- e?.data && L(e.data);
13611
+ e?.data && Pe(e.data);
13574
13612
  } catch (e) {
13575
13613
  console.error(e);
13576
13614
  } finally {
@@ -13623,7 +13661,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13623
13661
  alignItems: "center",
13624
13662
  columnGap: "14px",
13625
13663
  padding: "16px 10px 14px",
13626
- background: Se || "transparent",
13664
+ background: xe || "transparent",
13627
13665
  flexShrink: 0,
13628
13666
  position: "relative",
13629
13667
  zIndex: 30
@@ -13636,7 +13674,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13636
13674
  alignItems: "center"
13637
13675
  },
13638
13676
  children: /* @__PURE__ */ g("button", {
13639
- onClick: ye,
13677
+ onClick: ve,
13640
13678
  style: {
13641
13679
  width: "40px",
13642
13680
  height: "40px",
@@ -13693,7 +13731,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13693
13731
  justifyContent: "center",
13694
13732
  height: "40px"
13695
13733
  },
13696
- children: i ? /* @__PURE__ */ g(yg, {
13734
+ children: i ? /* @__PURE__ */ g(Cg, {
13697
13735
  logo: i,
13698
13736
  style: {
13699
13737
  height: "34px",
@@ -13706,7 +13744,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13706
13744
  height: "40px",
13707
13745
  flexShrink: 0
13708
13746
  },
13709
- children: /* @__PURE__ */ g(bg, { title: e.chatTitle })
13747
+ children: /* @__PURE__ */ g(wg, { title: e.chatTitle })
13710
13748
  })
13711
13749
  }), o && /* @__PURE__ */ g("div", {
13712
13750
  style: {
@@ -13803,10 +13841,10 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13803
13841
  animation: "fe-orb-fade-in 0.18s ease"
13804
13842
  },
13805
13843
  children: [
13806
- xe && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("button", {
13844
+ be && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("button", {
13807
13845
  type: "button",
13808
13846
  onClick: () => {
13809
- Ae(!1), be?.();
13847
+ Ae(!1), ye?.();
13810
13848
  },
13811
13849
  style: {
13812
13850
  display: "flex",
@@ -13848,7 +13886,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13848
13886
  /* @__PURE__ */ _("button", {
13849
13887
  type: "button",
13850
13888
  onClick: () => {
13851
- Ae(!1), N?.();
13889
+ Ae(!1), Se?.();
13852
13890
  },
13853
13891
  style: {
13854
13892
  display: "flex",
@@ -13931,7 +13969,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13931
13969
  /* @__PURE__ */ _("button", {
13932
13970
  type: "button",
13933
13971
  onClick: () => {
13934
- Ae(!1), ye?.();
13972
+ Ae(!1), ve?.();
13935
13973
  },
13936
13974
  style: {
13937
13975
  display: "flex",
@@ -13989,24 +14027,24 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13989
14027
  })
13990
14028
  ]
13991
14029
  }),
13992
- /* @__PURE__ */ g(sh, {
13993
- webRTCError: ce,
13994
- micError: le,
13995
- setMicError: ue,
13996
- dismissCallError: de,
14030
+ /* @__PURE__ */ g(dh, {
14031
+ webRTCError: se,
14032
+ micError: ce,
14033
+ setMicError: le,
14034
+ dismissCallError: ue,
13997
14035
  isRateLimited: E,
13998
14036
  rateLimitMessage: D
13999
14037
  }),
14000
- _e && /* @__PURE__ */ g(wh, {
14038
+ ge && /* @__PURE__ */ g(Oh, {
14001
14039
  agentName: v,
14002
14040
  agentHeadshot: y,
14003
14041
  fallbackAgentName: b,
14004
- callDurationSeconds: ge,
14005
- isCallMuted: pe,
14006
- formatCallDuration: M,
14007
- toggleCallMute: me,
14008
- endWebRTCCall: he,
14009
- onExpand: ve,
14042
+ callDurationSeconds: N,
14043
+ isCallMuted: fe,
14044
+ formatCallDuration: he,
14045
+ toggleCallMute: pe,
14046
+ endWebRTCCall: me,
14047
+ onExpand: _e,
14010
14048
  primaryColor: n
14011
14049
  }),
14012
14050
  /* @__PURE__ */ _("div", {
@@ -14071,7 +14109,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14071
14109
  overflowY: "auto",
14072
14110
  position: "relative"
14073
14111
  },
14074
- children: Pe ? /* @__PURE__ */ g("div", {
14112
+ children: L ? /* @__PURE__ */ g("div", {
14075
14113
  style: {
14076
14114
  padding: "40px 20px",
14077
14115
  textAlign: "center",
@@ -14131,17 +14169,17 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14131
14169
  children: "No previous chats found."
14132
14170
  })
14133
14171
  })]
14134
- }) : null, De ? /* @__PURE__ */ g(ih, {
14172
+ }) : null, De ? /* @__PURE__ */ g(ch, {
14135
14173
  chatHistory: l,
14136
14174
  isAiTyping: u,
14137
14175
  isLoading: T,
14138
14176
  isAgentTyping: d,
14139
- setReplyContext: se,
14140
- TypingDots: Dg,
14177
+ setReplyContext: oe,
14178
+ TypingDots: jg,
14141
14179
  primaryColor: n,
14142
14180
  agentHeadshot: y,
14143
14181
  agentDisplayName: v || b,
14144
- botAvatarNode: /* @__PURE__ */ g(Eg, { orbColors: t })
14182
+ botAvatarNode: /* @__PURE__ */ g(Ag, { orbColors: t })
14145
14183
  }) : F ? /* @__PURE__ */ _("div", {
14146
14184
  style: {
14147
14185
  flex: 1,
@@ -14182,7 +14220,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14182
14220
  padding: "28px 24px"
14183
14221
  },
14184
14222
  children: [
14185
- /* @__PURE__ */ g(Sg, {
14223
+ /* @__PURE__ */ g(Eg, {
14186
14224
  size: 94,
14187
14225
  orbColors: t
14188
14226
  }),
@@ -14232,7 +14270,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14232
14270
  ]
14233
14271
  })]
14234
14272
  }),
14235
- ae && /* @__PURE__ */ _("div", {
14273
+ ie && /* @__PURE__ */ _("div", {
14236
14274
  style: {
14237
14275
  margin: "0 16px 8px",
14238
14276
  padding: "9px 14px",
@@ -14273,18 +14311,18 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14273
14311
  zIndex: 1,
14274
14312
  padding: ne ? "6px 0 0" : "12px 0 0"
14275
14313
  },
14276
- children: /* @__PURE__ */ g(oh, {
14314
+ children: /* @__PURE__ */ g(uh, {
14277
14315
  input: x,
14278
14316
  setInput: S,
14279
14317
  onSubmit: C,
14280
14318
  isConversationEnded: w,
14281
14319
  callUiActive: I,
14282
- handleToggleVoice: be,
14320
+ handleToggleVoice: ye,
14283
14321
  showVoiceToggle: f === "agent",
14284
14322
  activeScreen: f,
14285
14323
  inputDisabled: Oe,
14286
- replyContext: oe,
14287
- clearReplyContext: () => se(null),
14324
+ replyContext: ae,
14325
+ clearReplyContext: () => oe(null),
14288
14326
  onFileSelect: k,
14289
14327
  selectedFile: O,
14290
14328
  onRemoveSelectedFile: A,
@@ -14292,8 +14330,8 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14292
14330
  isUploadingAttachment: te,
14293
14331
  requiresEmail: ne,
14294
14332
  emailInput: j,
14295
- setEmailInput: re,
14296
- emailError: ie,
14333
+ setEmailInput: M,
14334
+ emailError: re,
14297
14335
  inputPlaceholder: e.inputPlaceholder
14298
14336
  })
14299
14337
  }),
@@ -14347,29 +14385,29 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14347
14385
  ]
14348
14386
  });
14349
14387
  }
14350
- function kg() {
14351
- let { status: e, runtimeConfig: t, resolvedConfig: n, chatHistory: r, isOpen: i, activeScreen: a, isHumanHandled: s, agentName: l, agentHeadshot: u, visitorEmail: h, isAgentTyping: v, isAiTyping: y, isLoading: b, isRateLimited: x, rateLimitMessage: S, isConversationEnded: C, incomingCall: w, activeCallId: T, callConnectionState: E, callConnectedAt: D, isCallMuted: O, webRTCError: k, language: A, chatId: ee, historyRef: te, onMessageSync: ne, sendMessage: j, uploadChatFile: re, openWidget: ie, captureVisitorEmail: ae, setVoiceMode: oe, endConversation: se, startNewChat: ue, acceptCall: de, rejectCall: fe, endWebRTCCall: pe, toggleCallMute: me, dismissCallError: he, startTyping: M, stopTyping: ge, updateTypingDraft: _e, getVisitorChatHistory: ve, resumeChat: ye, isSessionRestoring: be, openToChatCounter: xe, voiceEndCounter: Se } = Cn();
14388
+ function Ng() {
14389
+ let { status: e, runtimeConfig: t, resolvedConfig: n, chatHistory: r, isOpen: i, activeScreen: a, isHumanHandled: s, agentName: l, agentHeadshot: u, visitorEmail: h, isAgentTyping: v, isAiTyping: y, isLoading: b, isRateLimited: x, rateLimitMessage: S, isConversationEnded: C, incomingCall: w, activeCallId: T, callConnectionState: E, callConnectedAt: D, isCallMuted: O, webRTCError: k, language: A, chatId: ee, historyRef: te, onMessageSync: ne, sendMessage: j, uploadChatFile: M, openWidget: re, captureVisitorEmail: ie, setVoiceMode: ae, endConversation: oe, startNewChat: le, acceptCall: ue, rejectCall: de, endWebRTCCall: fe, toggleCallMute: pe, dismissCallError: me, startTyping: he, stopTyping: N, updateTypingDraft: ge, getVisitorChatHistory: _e, resumeChat: ve, isSessionRestoring: ye, openToChatCounter: be, voiceEndCounter: xe } = Cn();
14352
14390
  c(() => {
14353
14391
  try {
14354
14392
  or();
14355
14393
  } catch {}
14356
14394
  }, []), c(() => {
14357
- xe && V !== "voice_mode" && V !== "text_chat" && V !== "call_screen" && (oe?.(!1), H("text_chat"));
14358
- }, [xe]);
14359
- let N = t?.widgetSettings || {}, Ce = n?.widgetSettings || {}, P = {
14360
- ...N.branding || {},
14395
+ be && V !== "voice_mode" && V !== "text_chat" && V !== "call_screen" && (ae?.(!1), H("text_chat"));
14396
+ }, [be]);
14397
+ let Se = t?.widgetSettings || {}, Ce = n?.widgetSettings || {}, P = {
14398
+ ...Se.branding || {},
14361
14399
  ...Ce.branding || {}
14362
14400
  }, F = {
14363
- ...N.theme || {},
14401
+ ...Se.theme || {},
14364
14402
  ...Ce.theme || {}
14365
14403
  }, Ee = {
14366
- ...N.features || {},
14404
+ ...Se.features || {},
14367
14405
  ...Ce.features || {}
14368
14406
  }, Oe = Ee.voice !== !1, I = Array.isArray(F.orbColors) && F.orbColors.length > 0 ? F.orbColors : null, Ae = F.buttonColor || F.primaryColor || I?.[0] || "#3B82F6", je = {
14369
14407
  small: 50,
14370
14408
  medium: 64,
14371
14409
  large: 80
14372
- }, Me = je[F.orbSize] || je.small, Ne = F.position || "bottom-right", L = P.fallbackAgentName || "Agent", Pe = gg(I ?? F.chatBgColors), Fe = P.logo || P.logoUrl || null, Ie = A || "en", Le = N.recommendations?.[Ie] || [], R = (Ce.recommendations?.[Ie] ?? Le).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
14410
+ }, Me = je[F.orbSize] || je.small, Ne = F.position || "bottom-right", Pe = P.fallbackAgentName || "Agent", L = bg(I ?? F.chatBgColors), Fe = P.logo || P.logoUrl || null, Ie = A || "en", Le = Se.recommendations?.[Ie] || [], R = (Ce.recommendations?.[Ie] ?? Le).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
14373
14411
  id: e.key || `qr-${t}`,
14374
14412
  label: e.label,
14375
14413
  message: e.label,
@@ -14386,11 +14424,11 @@ function kg() {
14386
14424
  }, []);
14387
14425
  let Ke = (() => {
14388
14426
  let e = {
14389
- ...N.pageVisibility || {},
14427
+ ...Se.pageVisibility || {},
14390
14428
  ...Ce.pageVisibility || {}
14391
14429
  };
14392
14430
  return Array.isArray(e.allowedPaths) ? e.allowedPaths.filter(Boolean) : [];
14393
- })(), qe = Ke.length === 0 || Ke.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? We.startsWith(e.slice(0, -1)) : We.replace(/\/$/, "") === e.replace(/\/$/, "")), Je = N.greetings?.[A] || Ce.greetings?.[A] || P.introGreeting || "Hello, I'm here to help you know more about OpenSense Labs.", Ye = {
14431
+ })(), qe = Ke.length === 0 || Ke.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? We.startsWith(e.slice(0, -1)) : We.replace(/\/$/, "") === e.replace(/\/$/, "")), Je = Se.greetings?.[A] || Ce.greetings?.[A] || P.introGreeting || "Hello, I'm here to help you know more about OpenSense Labs.", Ye = {
14394
14432
  entryPrompt: P.entryPrompt || "Do you want to explore in a new way?",
14395
14433
  yesLabel: P.yesLabel || "Yes",
14396
14434
  laterLabel: P.laterLabel || "Later",
@@ -14414,7 +14452,7 @@ function kg() {
14414
14452
  ]), Qe = u && String(u).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, $e = r.some((e) => e.sender === "user"), et = f(() => {
14415
14453
  let e = r.findIndex((e) => e.sender === "user");
14416
14454
  return e === -1 ? !1 : r.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
14417
- }, [r]), tt = !!(Ce._dashboardLivePreview || N._dashboardLivePreview), [V, H] = m(() => tt ? "text_chat" : "entry_prompt"), [nt, rt] = m(""), [it, U] = m(null), [at, ot] = m(h || ""), [W, st] = m(""), [ct, lt] = m(!1), [ut, dt] = m(0), [ft, pt] = m(null), [mt, ht] = m(null), [gt, _t] = m(""), [vt, yt] = m(!1), [bt, xt] = m(!1), [St, Ct] = m(!1), wt = p(null), Tt = p(!1), Et = !h && $e && et && V !== "voice_mode";
14455
+ }, [r]), tt = !!(Ce._dashboardLivePreview || Se._dashboardLivePreview), [V, H] = m(() => tt ? "text_chat" : "entry_prompt"), [nt, rt] = m(""), [it, U] = m(null), [at, ot] = m(h || ""), [W, st] = m(""), [ct, lt] = m(!1), [ut, dt] = m(0), [ft, pt] = m(null), [mt, ht] = m(null), [gt, _t] = m(""), [vt, yt] = m(!1), [bt, xt] = m(!1), [St, Ct] = m(!1), wt = p(null), Tt = p(!1), Et = !h && $e && et && V !== "voice_mode";
14418
14456
  d(() => {
14419
14457
  if (e !== "ready" || Tt.current) return;
14420
14458
  if (Tt.current = !0, !Oe) {
@@ -14427,11 +14465,11 @@ function kg() {
14427
14465
  } catch {}
14428
14466
  let n = De(), r = z ? we(z) : null, i = n || !!r?.transcript;
14429
14467
  if (t) {
14430
- ie?.({ notifyChatInitiated: !0 }), oe?.(!0), H("voice_mode");
14468
+ re?.({ notifyChatInitiated: !0 }), ae?.(!0), H("voice_mode");
14431
14469
  return;
14432
14470
  }
14433
14471
  if (ke()) {
14434
- ie?.({ notifyChatInitiated: !1 }), H("text_chat");
14472
+ re?.({ notifyChatInitiated: !1 }), H("text_chat");
14435
14473
  return;
14436
14474
  }
14437
14475
  if (i) {
@@ -14439,13 +14477,13 @@ function kg() {
14439
14477
  H("minimized_orb");
14440
14478
  return;
14441
14479
  }
14442
- ie?.({ notifyChatInitiated: !0 }), oe?.(!0), H("voice_mode");
14480
+ re?.({ notifyChatInitiated: !0 }), ae?.(!0), H("voice_mode");
14443
14481
  return;
14444
14482
  }
14445
14483
  if (z) try {
14446
14484
  Te(z);
14447
14485
  } catch {}
14448
- if (ce(z)) {
14486
+ if (se(z)) {
14449
14487
  H("minimized_orb");
14450
14488
  return;
14451
14489
  }
@@ -14460,7 +14498,7 @@ function kg() {
14460
14498
  let Ot = o(() => {
14461
14499
  ht(null), _t("");
14462
14500
  }, []), kt = o((e) => {
14463
- let t = $m(e);
14501
+ let t = rh(e);
14464
14502
  if (t) {
14465
14503
  ht(null), _t(t);
14466
14504
  return;
@@ -14503,7 +14541,7 @@ function kg() {
14503
14541
  hasIncomingCall: !!w?.callId,
14504
14542
  activeCallId: T,
14505
14543
  callConnectionState: E
14506
- }), wt.current = e, V === "voice_mode" && oe?.(!1), ie?.(), At());
14544
+ }), wt.current = e, V === "voice_mode" && ae?.(!1), re?.(), At());
14507
14545
  }
14508
14546
  }, [
14509
14547
  T,
@@ -14511,8 +14549,8 @@ function kg() {
14511
14549
  At,
14512
14550
  w?.callId,
14513
14551
  i,
14514
- ie,
14515
- oe,
14552
+ re,
14553
+ ae,
14516
14554
  V
14517
14555
  ]), c(() => {
14518
14556
  !w && !T && V === "call_screen" && H("text_chat");
@@ -14524,16 +14562,16 @@ function kg() {
14524
14562
  !T && bt && xt(!1);
14525
14563
  }, [T, bt]), c(() => {
14526
14564
  if (!s || C) {
14527
- _e?.(""), ge?.();
14565
+ ge?.(""), N?.();
14528
14566
  return;
14529
14567
  }
14530
14568
  if (!nt.trim() || mt) {
14531
- _e?.("");
14532
- let e = window.setTimeout(() => ge?.(), 100);
14569
+ ge?.("");
14570
+ let e = window.setTimeout(() => N?.(), 100);
14533
14571
  return () => window.clearTimeout(e);
14534
14572
  }
14535
- M?.();
14536
- let e = window.setTimeout(() => _e?.(nt), 120), t = window.setTimeout(() => ge?.(), 1200);
14573
+ he?.();
14574
+ let e = window.setTimeout(() => ge?.(nt), 120), t = window.setTimeout(() => N?.(), 1200);
14537
14575
  return () => {
14538
14576
  window.clearTimeout(e), window.clearTimeout(t);
14539
14577
  };
@@ -14542,9 +14580,9 @@ function kg() {
14542
14580
  mt,
14543
14581
  s,
14544
14582
  C,
14545
- M,
14546
- ge,
14547
- _e
14583
+ he,
14584
+ N,
14585
+ ge
14548
14586
  ]);
14549
14587
  let Mt = (e) => e ? {
14550
14588
  replyTo: e.messageId || e.id || null,
@@ -14558,7 +14596,7 @@ function kg() {
14558
14596
  st("Please enter a valid email so we can continue helping you.");
14559
14597
  return;
14560
14598
  }
14561
- await ae(e), st(""), lt(!0), setTimeout(() => lt(!1), 3e3);
14599
+ await ie(e), st(""), lt(!0), setTimeout(() => lt(!1), 3e3);
14562
14600
  return;
14563
14601
  }
14564
14602
  let t = Mt(it);
@@ -14566,7 +14604,7 @@ function kg() {
14566
14604
  if (mt) {
14567
14605
  try {
14568
14606
  yt(!0), _t("");
14569
- let e = await re(mt), n = e?.data || e, r = nt.trim() || `Shared file: ${th(mt)}`;
14607
+ let e = await M(mt), n = e?.data || e, r = nt.trim() || `Shared file: ${ah(mt)}`;
14570
14608
  rt(""), U(null), Ot(), await j(r, "", t, {
14571
14609
  type: "file",
14572
14610
  metadata: {
@@ -14586,8 +14624,8 @@ function kg() {
14586
14624
  let n = nt.trim();
14587
14625
  rt(""), U(null), await j(n, "", t);
14588
14626
  }, Pt = o(() => {
14589
- r.length !== 0 && ue?.();
14590
- }, [r.length, ue]), Ft = (e) => {
14627
+ r.length !== 0 && le?.();
14628
+ }, [r.length, le]), Ft = (e) => {
14591
14629
  let t = Math.floor(e / 60);
14592
14630
  return `${String(t).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`;
14593
14631
  }, It = o(async (e) => {
@@ -14643,11 +14681,11 @@ function kg() {
14643
14681
  t.resume().catch(() => {}), setTimeout(() => t.close().catch(() => {}), 3e3);
14644
14682
  }
14645
14683
  } catch {}
14646
- ie({ notifyChatInitiated: !0 }), oe?.(!0), H("voice_mode");
14684
+ re({ notifyChatInitiated: !0 }), ae?.(!0), H("voice_mode");
14647
14685
  }, Vt = () => {
14648
- ie({ notifyChatInitiated: !0 }), oe?.(!1), H("text_chat");
14686
+ re({ notifyChatInitiated: !0 }), ae?.(!1), H("text_chat");
14649
14687
  }, Ht = () => {
14650
- oe?.(!1), Rt();
14688
+ ae?.(!1), Rt();
14651
14689
  };
14652
14690
  return e !== "ready" || !Ue || Ee.chat === !1 || !qe ? null : /* @__PURE__ */ _("div", {
14653
14691
  className: "flowengage-widget-root",
@@ -14659,15 +14697,15 @@ function kg() {
14659
14697
  onWheel: (e) => e.stopPropagation(),
14660
14698
  onTouchMove: (e) => e.stopPropagation(),
14661
14699
  children: [
14662
- V === "entry_prompt" && /* @__PURE__ */ g(Cg, {
14700
+ V === "entry_prompt" && /* @__PURE__ */ g(Dg, {
14663
14701
  copy: Ye,
14664
14702
  orbColors: I,
14665
14703
  primaryColor: Ae,
14666
14704
  onYes: () => {
14667
- le(z), Bt();
14705
+ ce(z), Bt();
14668
14706
  },
14669
14707
  onLater: () => {
14670
- le(z), Rt();
14708
+ ce(z), Rt();
14671
14709
  },
14672
14710
  isMobile: G,
14673
14711
  isClosing: St
@@ -14742,13 +14780,13 @@ function kg() {
14742
14780
  children: E === "connected" ? `${Ft(ut)} with ${Ze}` : `Tap to return to ${Ze}`
14743
14781
  })]
14744
14782
  })]
14745
- }), /* @__PURE__ */ g(Sg, {
14783
+ }), /* @__PURE__ */ g(Eg, {
14746
14784
  size: Me,
14747
14785
  orbColors: I,
14748
14786
  onClick: T ? At : Oe ? zt : Vt
14749
14787
  })]
14750
14788
  }),
14751
- V === "connection_modal" && /* @__PURE__ */ g(wg, {
14789
+ V === "connection_modal" && /* @__PURE__ */ g(Og, {
14752
14790
  copy: Ye,
14753
14791
  orbColors: I,
14754
14792
  primaryColor: Ae,
@@ -14758,7 +14796,7 @@ function kg() {
14758
14796
  isMobile: G,
14759
14797
  isClosing: St
14760
14798
  }),
14761
- V === "voice_mode" && /* @__PURE__ */ g(Tg, {
14799
+ V === "voice_mode" && /* @__PURE__ */ g(kg, {
14762
14800
  orbColors: I,
14763
14801
  onEnterChat: Vt,
14764
14802
  onEndChat: Ht,
@@ -14768,17 +14806,17 @@ function kg() {
14768
14806
  chatId: ee,
14769
14807
  historyRef: te,
14770
14808
  onMessageSync: ne,
14771
- voiceEndCounter: Se,
14809
+ voiceEndCounter: xe,
14772
14810
  websiteName: t?.websiteName,
14773
- voiceFirstMessage: N.voiceFirstMessage || null,
14774
- captureVisitorEmail: ae,
14811
+ voiceFirstMessage: Se.voiceFirstMessage || null,
14812
+ captureVisitorEmail: ie,
14775
14813
  emailRequired: !h,
14776
14814
  emailCaptureEnabled: P.disableEmailCapture !== !0,
14777
14815
  listeningLabel: P.voiceListeningLabel || "Listening...",
14778
14816
  enterChatModeLabel: P.voiceEnterChatLabel || "Enter Chat Mode",
14779
14817
  endConversationLabel: P.voiceEndConversationLabel || "End Conversation"
14780
14818
  }, "voice"),
14781
- V === "call_screen" && /* @__PURE__ */ g(Ch, {
14819
+ V === "call_screen" && /* @__PURE__ */ g(Dh, {
14782
14820
  incomingCall: w,
14783
14821
  activeCallId: T,
14784
14822
  callConnectionState: E,
@@ -14786,23 +14824,23 @@ function kg() {
14786
14824
  isCallMuted: O,
14787
14825
  agentName: Ze,
14788
14826
  agentHeadshot: Qe,
14789
- fallbackAgentName: L,
14790
- acceptCall: de,
14791
- rejectCall: fe,
14792
- endWebRTCCall: pe,
14793
- toggleCallMute: me,
14827
+ fallbackAgentName: Pe,
14828
+ acceptCall: ue,
14829
+ rejectCall: de,
14830
+ endWebRTCCall: fe,
14831
+ toggleCallMute: pe,
14794
14832
  formatCallDuration: Ft,
14795
14833
  onMinimize: jt,
14796
14834
  primaryColor: Ae,
14797
14835
  orbColors: I,
14798
14836
  chatHistory: r
14799
14837
  }),
14800
- V === "text_chat" && /* @__PURE__ */ g(Og, {
14838
+ V === "text_chat" && /* @__PURE__ */ g(Mg, {
14801
14839
  isClosing: St,
14802
14840
  copy: Ye,
14803
14841
  orbColors: I,
14804
14842
  primaryColor: Ae,
14805
- chatBgGradient: Pe,
14843
+ chatBgGradient: L,
14806
14844
  logo: Fe,
14807
14845
  quickChatOptions: Re,
14808
14846
  onQuickChatSelect: It,
@@ -14813,7 +14851,7 @@ function kg() {
14813
14851
  activeScreen: a,
14814
14852
  agentName: Ze,
14815
14853
  agentHeadshot: Qe,
14816
- fallbackAgentName: L,
14854
+ fallbackAgentName: Pe,
14817
14855
  input: nt,
14818
14856
  setInput: rt,
14819
14857
  onSubmit: Nt,
@@ -14836,11 +14874,11 @@ function kg() {
14836
14874
  webRTCError: k,
14837
14875
  micError: ft,
14838
14876
  setMicError: pt,
14839
- dismissCallError: he,
14877
+ dismissCallError: me,
14840
14878
  activeCallId: T,
14841
14879
  isCallMuted: O,
14842
- toggleCallMute: me,
14843
- endWebRTCCall: pe,
14880
+ toggleCallMute: pe,
14881
+ endWebRTCCall: fe,
14844
14882
  formatCallDuration: Ft,
14845
14883
  callDurationSeconds: ut,
14846
14884
  onCollapse: Rt,
@@ -14853,9 +14891,9 @@ function kg() {
14853
14891
  showPoweredBy: ze,
14854
14892
  privacyPolicyUrl: He,
14855
14893
  headerBgColor: Be,
14856
- getVisitorChatHistory: ve,
14857
- resumeChat: ye,
14858
- isSessionRestoring: be
14894
+ getVisitorChatHistory: _e,
14895
+ resumeChat: ve,
14896
+ isSessionRestoring: ye
14859
14897
  }),
14860
14898
  /* @__PURE__ */ g("style", { children: "\n /* Force any SVG (or img) inside LogoSlot to fill the container height\n regardless of whether the component forwards its style prop. */\n .fe-logo-slot svg,\n .fe-logo-slot img { height: 100%; width: auto; display: block; }\n\n @keyframes fe-orb-breathe { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }\n @keyframes fe-orb-breathe-subtle { 0%,100%{transform:scale(1)} 50%{transform:scale(1.025)} }\n @keyframes fe-orb-pulse { 0%{transform:scale(1);opacity:.65} 50%{transform:scale(1.28);opacity:.1} 100%{transform:scale(1);opacity:.65} }\n @keyframes fe-orb-glow { from{opacity:.35} to{opacity:.75} }\n @keyframes fe-orb-fade-in { from{opacity:0} to{opacity:1} }\n @keyframes fe-orb-slide-up { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }\n @keyframes fe-orb-slide-down { from{opacity:1;transform:translateY(0)} to{opacity:0;transform:translateY(24px)} }\n @keyframes fe-orb-bar-0 { from{height:6px} to{height:18px} }\n @keyframes fe-orb-bar-1 { from{height:10px} to{height:22px} }\n @keyframes fe-orb-bar-2 { from{height:14px} to{height:26px} }\n @keyframes fe-orb-bar-3 { from{height:8px} to{height:20px} }\n @keyframes fe-orb-bar-4 { from{height:6px} to{height:16px} }\n @keyframes fe-dot-bounce { 0%,80%,100%{transform:translateY(0);opacity:.5} 40%{transform:translateY(-5px);opacity:1} }\n " })
14861
14899
  ]
@@ -14863,7 +14901,7 @@ function kg() {
14863
14901
  }
14864
14902
  //#endregion
14865
14903
  //#region src/components/ErrorBoundary.jsx
14866
- var Ag = class extends e.Component {
14904
+ var Pg = class extends e.Component {
14867
14905
  constructor(e) {
14868
14906
  super(e), this.state = { hasError: !1 };
14869
14907
  }
@@ -14878,4 +14916,4 @@ var Ag = class extends e.Component {
14878
14916
  }
14879
14917
  };
14880
14918
  //#endregion
14881
- export { gh as AnimatedOrb, Ag as ErrorBoundary, Mr as FlowEngageProvider, kg as FlowEngageWidget, Cn as useFlowEngage };
14919
+ export { bh as AnimatedOrb, Pg as ErrorBoundary, Mr as FlowEngageProvider, Ng as FlowEngageWidget, Cn as useFlowEngage };