@flowengage/react-chatbot 1.1.3 → 1.1.4

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.
@@ -1848,27 +1848,52 @@ function rn(e, t) {
1848
1848
  t ||= e.replace(/[-_]+/g, " ").trim();
1849
1849
  }
1850
1850
  if (!t) return null;
1851
- let n = t.toLowerCase().trim(), r = document.querySelectorAll("h1, h2, h3, h4, h5, h6, [data-section]");
1852
- for (let e of r) if (e.textContent.toLowerCase().includes(n)) return e;
1853
- let i = n.split(/\s+/).filter((e) => e.length > 2);
1854
- if (i.length > 1) {
1851
+ let n = t.toLowerCase().trim(), r = Array.from(document.querySelectorAll("h1, h2, h3, h4, h5, h6, [data-section]"));
1852
+ for (let e of r) if (e.textContent.replace(/\s+/g, " ").toLowerCase().trim() === n) return e;
1853
+ for (let e of r) {
1854
+ let t = e.textContent.replace(/\s+/g, " ").toLowerCase().trim();
1855
+ if (t.startsWith(n) || t.endsWith(n)) return e;
1856
+ }
1857
+ let i = [];
1858
+ for (let e of r) {
1859
+ let t = e.textContent.replace(/\s+/g, " ").toLowerCase().trim();
1860
+ t.includes(n) && i.push({
1861
+ el: e,
1862
+ len: t.length
1863
+ });
1864
+ }
1865
+ if (i.length) return i.sort((e, t) => e.len - t.len), i[0].el;
1866
+ for (let e of r) {
1867
+ let t = e.textContent.replace(/\s+/g, " ").toLowerCase().trim();
1868
+ if (t.length > 3 && n.includes(t)) return e;
1869
+ }
1870
+ let a = n.split(/\s+/).filter((e) => e.length > 2);
1871
+ if (a.length > 0) {
1855
1872
  let e = null, t = 0;
1856
1873
  for (let n of r) {
1857
- let r = n.textContent.toLowerCase(), a = 0;
1858
- for (let e of i) r.includes(e) && a++;
1859
- let o = a / i.length;
1874
+ let r = n.textContent.replace(/\s+/g, " ").toLowerCase(), i = 0;
1875
+ for (let e of a) r.includes(e) && i++;
1876
+ let o = i / a.length;
1860
1877
  o > t && o >= .6 && (t = o, e = n);
1861
1878
  }
1862
1879
  if (e) return e;
1863
1880
  }
1864
- let a = document.querySelectorAll("li, strong, blockquote, dt");
1865
- for (let e of a) {
1866
- let t = e.textContent.toLowerCase();
1881
+ let o = document.querySelectorAll("section, article, .card, [class*='feature'], [class*='service']");
1882
+ for (let e of o) {
1883
+ let t = e.querySelector("h1, h2, h3, h4, h5, h6");
1884
+ if (t) {
1885
+ let r = t.textContent.replace(/\s+/g, " ").toLowerCase().trim();
1886
+ if (r.includes(n) || n.includes(r)) return e;
1887
+ }
1888
+ }
1889
+ let s = document.querySelectorAll("li, strong, blockquote, dt, a");
1890
+ for (let e of s) {
1891
+ let t = e.textContent.replace(/\s+/g, " ").toLowerCase().trim();
1867
1892
  if (t.includes(n) && t.length < 500) return e.tagName === "STRONG" && e.parentElement?.tagName === "LI" ? e.parentElement : e;
1868
1893
  }
1869
- let o = document.querySelectorAll("p");
1870
- for (let e of o) {
1871
- let t = e.textContent.toLowerCase();
1894
+ let c = document.querySelectorAll("p");
1895
+ for (let e of c) {
1896
+ let t = e.textContent.replace(/\s+/g, " ").toLowerCase().trim();
1872
1897
  if (t.includes(n) && t.length < 800) return e;
1873
1898
  }
1874
1899
  return null;
@@ -22171,7 +22196,65 @@ function hg(e) {
22171
22196
  return !1;
22172
22197
  }
22173
22198
  }
22174
- function gg(e) {
22199
+ var gg = new Set([
22200
+ "SCRIPT",
22201
+ "STYLE",
22202
+ "NOSCRIPT",
22203
+ "SVG",
22204
+ "CANVAS",
22205
+ "VIDEO",
22206
+ "AUDIO",
22207
+ "IFRAME",
22208
+ "OBJECT",
22209
+ "EMBED",
22210
+ "NAV",
22211
+ "FOOTER"
22212
+ ]);
22213
+ function _g(e, t = 3e3) {
22214
+ if (!e) return "";
22215
+ let n = [], r = 0;
22216
+ function i(e) {
22217
+ if (r >= t) return;
22218
+ if (e.nodeType === Node.TEXT_NODE) {
22219
+ let t = e.textContent.replace(/\s+/g, " ").trim();
22220
+ t && (n.push(t), r += t.length);
22221
+ return;
22222
+ }
22223
+ if (e.nodeType !== Node.ELEMENT_NODE || gg.has(e.tagName) || hg(e)) return;
22224
+ try {
22225
+ let t = xg(e);
22226
+ if (t.display === "none" || t.visibility === "hidden") return;
22227
+ } catch {}
22228
+ let a = /^(P|H[1-6]|DIV|SECTION|ARTICLE|LI|TR|BLOCKQUOTE|PRE|HEADER|DT|DD|FIGCAPTION)$/.test(e.tagName);
22229
+ a && n.length > 0 && n.push("\n");
22230
+ for (let n of e.childNodes) if (i(n), r >= t) break;
22231
+ a && n.push("\n");
22232
+ }
22233
+ i(e);
22234
+ let a = n.join(" ").replace(/[ \t]+/g, " ").replace(/\n /g, "\n").replace(/\n{3,}/g, "\n\n").trim();
22235
+ return a.length > t && (a = a.slice(0, t).replace(/\s\S*$/, "") + "…"), a;
22236
+ }
22237
+ function vg() {
22238
+ if (typeof document > "u") return null;
22239
+ for (let e of [
22240
+ "main",
22241
+ "article",
22242
+ "[role=\"main\"]",
22243
+ "#content",
22244
+ "#main-content",
22245
+ "#main",
22246
+ ".main-content",
22247
+ ".content",
22248
+ ".post-content",
22249
+ ".article-content",
22250
+ ".entry-content"
22251
+ ]) {
22252
+ let t = document.querySelector(e);
22253
+ if (t && !hg(t)) return t;
22254
+ }
22255
+ return document.body;
22256
+ }
22257
+ function yg(e) {
22175
22258
  if (!e) return null;
22176
22259
  try {
22177
22260
  return e.closest("form");
@@ -22184,7 +22267,7 @@ function gg(e) {
22184
22267
  return null;
22185
22268
  }
22186
22269
  }
22187
- function _g(e) {
22270
+ function bg(e) {
22188
22271
  if (!e) return null;
22189
22272
  let t = e.querySelector("h1, h2, h3, h4, h5, legend");
22190
22273
  if (t) return t.textContent.replace(/\s+/g, " ").trim().slice(0, 60);
@@ -22199,14 +22282,14 @@ function _g(e) {
22199
22282
  }
22200
22283
  return null;
22201
22284
  }
22202
- function vg(e) {
22285
+ function xg(e) {
22203
22286
  try {
22204
22287
  let t = e.ownerDocument?.defaultView;
22205
22288
  if (t) return t.getComputedStyle(e);
22206
22289
  } catch {}
22207
22290
  return window.getComputedStyle(e);
22208
22291
  }
22209
- function yg(e) {
22292
+ function Sg(e) {
22210
22293
  let t = /* @__PURE__ */ new Set();
22211
22294
  function n(r) {
22212
22295
  if (!r || t.has(r)) return;
@@ -22219,10 +22302,10 @@ function yg(e) {
22219
22302
  }
22220
22303
  typeof document < "u" && n(document);
22221
22304
  }
22222
- function bg(e) {
22305
+ function Cg(e) {
22223
22306
  return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
22224
22307
  }
22225
- function xg(e) {
22308
+ function wg(e) {
22226
22309
  let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
22227
22310
  if (n) {
22228
22311
  let e = n.trim().split(/\s+/).filter(Boolean), r = [];
@@ -22230,40 +22313,40 @@ function xg(e) {
22230
22313
  let e = t.getElementById(n);
22231
22314
  e?.textContent && r.push(e.textContent.trim());
22232
22315
  } catch {}
22233
- if (r.length) return bg(r.join(" "));
22316
+ if (r.length) return Cg(r.join(" "));
22234
22317
  }
22235
- if (e.labels && e.labels.length) return bg(e.labels[0].textContent);
22318
+ if (e.labels && e.labels.length) return Cg(e.labels[0].textContent);
22236
22319
  let r = e.id;
22237
22320
  if (r) try {
22238
22321
  let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
22239
- if (e) return bg(e.textContent);
22322
+ if (e) return Cg(e.textContent);
22240
22323
  } catch {
22241
22324
  let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
22242
- if (e) return bg(e.textContent);
22325
+ if (e) return Cg(e.textContent);
22243
22326
  }
22244
22327
  let i = e.previousElementSibling;
22245
22328
  for (let e = 0; e < 6 && i; e += 1) {
22246
- if (i.tagName === "LABEL") return bg(i.textContent);
22329
+ if (i.tagName === "LABEL") return Cg(i.textContent);
22247
22330
  let e = (i.className || "").toString().toLowerCase();
22248
22331
  if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
22249
- let e = bg(i.textContent);
22332
+ let e = Cg(i.textContent);
22250
22333
  if (e) return e;
22251
22334
  }
22252
22335
  i = i.previousElementSibling;
22253
22336
  }
22254
22337
  let a = e.parentElement;
22255
22338
  for (let e = 0; e < 5 && a; e += 1) {
22256
- if (a.tagName === "LABEL") return bg(a.textContent);
22339
+ if (a.tagName === "LABEL") return Cg(a.textContent);
22257
22340
  let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
22258
- if (e?.textContent) return bg(e.textContent);
22341
+ if (e?.textContent) return Cg(e.textContent);
22259
22342
  a = a.parentElement;
22260
22343
  }
22261
22344
  let o = e.getAttribute("aria-label");
22262
- return o ? bg(o) : null;
22345
+ return o ? Cg(o) : null;
22263
22346
  }
22264
- function Sg() {
22347
+ function Tg() {
22265
22348
  let e = [];
22266
- return yg((t) => {
22349
+ return Sg((t) => {
22267
22350
  e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
22268
22351
  if (hg(e)) return !1;
22269
22352
  let t = (e.type || "").toLowerCase();
@@ -22274,7 +22357,7 @@ function Sg() {
22274
22357
  "image"
22275
22358
  ].includes(t) || e.disabled || e.readOnly) return !1;
22276
22359
  try {
22277
- let t = vg(e);
22360
+ let t = xg(e);
22278
22361
  if (t.display === "none" || t.visibility === "hidden" || parseFloat(t.opacity) === 0) return !1;
22279
22362
  } catch {}
22280
22363
  try {
@@ -22284,7 +22367,7 @@ function Sg() {
22284
22367
  }));
22285
22368
  }), e;
22286
22369
  }
22287
- function Cg(e) {
22370
+ function Eg(e) {
22288
22371
  if (!e || typeof e.closest != "function") return !1;
22289
22372
  try {
22290
22373
  return !!e.closest("footer, [role=\"contentinfo\"], #footer, .site-footer, [class*=\"footer\"], [id*=\"footer\"]");
@@ -22292,44 +22375,49 @@ function Cg(e) {
22292
22375
  return !1;
22293
22376
  }
22294
22377
  }
22295
- function wg() {
22296
- let e = Sg();
22378
+ function Dg() {
22379
+ let e = Tg();
22297
22380
  for (let t of e) {
22298
- if ((t.type || "").toLowerCase() !== "email" || Cg(t)) continue;
22299
- let e = gg(t);
22381
+ if ((t.type || "").toLowerCase() !== "email" || Eg(t)) continue;
22382
+ let e = yg(t);
22300
22383
  if (e) return e;
22301
22384
  }
22302
22385
  return null;
22303
22386
  }
22304
- function Tg() {
22305
- let e = Sg(), t = /* @__PURE__ */ new Map(), n = 0;
22387
+ function Og() {
22388
+ let e = Tg(), t = /* @__PURE__ */ new Map(), n = 0;
22306
22389
  return e.map((e, r) => {
22307
- let i = gg(e), a = i || "__orphan__";
22390
+ let i = yg(e), a = i || "__orphan__";
22308
22391
  t.has(a) || t.set(a, n++);
22309
22392
  let o = t.get(a);
22310
22393
  return {
22311
22394
  formIndex: o,
22312
- formName: (i ? _g(i) : null) || `Form ${o}`,
22395
+ formName: (i ? bg(i) : null) || `Form ${o}`,
22313
22396
  fieldIndex: r,
22314
22397
  tag: e.tagName,
22315
22398
  type: e.type || "text",
22316
22399
  name: e.name || null,
22317
22400
  id: e.id || null,
22318
- label: xg(e),
22401
+ label: wg(e),
22319
22402
  placeholder: e.placeholder || null
22320
22403
  };
22321
22404
  });
22322
22405
  }
22323
- function Eg() {
22406
+ function kg(e) {
22407
+ if (hg(e) || e.disabled) return !1;
22408
+ try {
22409
+ let t = xg(e);
22410
+ if (t.display === "none" || t.visibility === "hidden" || parseFloat(t.opacity) === 0) return !1;
22411
+ } catch {}
22412
+ return !0;
22413
+ }
22414
+ function Ag() {
22324
22415
  let e = [];
22325
- return yg((t) => {
22326
- e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
22327
- if (hg(e) || e.disabled) return !1;
22328
- try {
22329
- let t = vg(e);
22330
- if (t.display === "none" || t.visibility === "hidden" || parseFloat(t.opacity) === 0) return !1;
22331
- } catch {}
22332
- return !0;
22416
+ return Sg((t) => {
22417
+ e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter(kg)), e.push(...Array.from(t.querySelectorAll("a[href]")).filter((e) => {
22418
+ if (!kg(e)) return !1;
22419
+ let t = (e.textContent || "").replace(/\s+/g, " ").trim();
22420
+ return !(!t || t.length < 2 || t.length > 150);
22333
22421
  }));
22334
22422
  }), e.slice(0, 60).map((e, t) => ({
22335
22423
  index: t,
@@ -22338,15 +22426,15 @@ function Eg() {
22338
22426
  type: e.type || e.tagName
22339
22427
  }));
22340
22428
  }
22341
- function Dg(e) {
22429
+ function jg(e) {
22342
22430
  return String(e || "").toLowerCase().replace(/\u00a0/g, " ").replace(/\*/g, "").replace(/\s+/g, " ").trim();
22343
22431
  }
22344
- function Og(e) {
22345
- let t = Dg(e);
22432
+ function Mg(e) {
22433
+ let t = jg(e);
22346
22434
  return t = t.replace(/\s+field\s*$/i, "").trim(), t;
22347
22435
  }
22348
- function kg(e, t) {
22349
- let n = Og(t);
22436
+ function Ng(e, t) {
22437
+ let n = Mg(t);
22350
22438
  if (!n) return 0;
22351
22439
  let r = (e.name || "").toLowerCase(), i = (e.id || "").toLowerCase();
22352
22440
  if (r === "url" && /url|website|domain|audit|conduct|site(\s|$)|page(\s|$)/.test(n) && !/email|e-mail|mail|name|message|phone/.test(n) || (i === "url-input" || i.endsWith("-url-input")) && /url|website|domain|audit|conduct/.test(n) && !/email|e-mail|mail|name|message|phone/.test(n)) return 100;
@@ -22358,12 +22446,12 @@ function kg(e, t) {
22358
22446
  e.name,
22359
22447
  e.id,
22360
22448
  e.placeholder,
22361
- xg(e),
22449
+ wg(e),
22362
22450
  e.getAttribute("aria-label"),
22363
22451
  e.getAttribute("title"),
22364
22452
  e.getAttribute("data-testid"),
22365
22453
  e.getAttribute("autocomplete")
22366
- ].filter(Boolean).map((e) => Dg(e)), s = 0;
22454
+ ].filter(Boolean).map((e) => jg(e)), s = 0;
22367
22455
  for (let e of o) {
22368
22456
  if (!e) continue;
22369
22457
  if (e === n) {
@@ -22383,16 +22471,16 @@ function kg(e, t) {
22383
22471
  }
22384
22472
  return s;
22385
22473
  }
22386
- var Ag = 22;
22387
- function jg(e, t) {
22474
+ var Pg = 22;
22475
+ function Fg(e, t) {
22388
22476
  let n = null, r = 0;
22389
22477
  for (let i of e) {
22390
- let e = kg(i, t);
22478
+ let e = Ng(i, t);
22391
22479
  e > r && (r = e, n = i);
22392
22480
  }
22393
- return !n || r < Ag ? null : n;
22481
+ return !n || r < Pg ? null : n;
22394
22482
  }
22395
- function Mg(e, t, n) {
22483
+ function Ig(e, t, n) {
22396
22484
  let r = String(t || "").toLowerCase().trim(), i = String(n || "").trim();
22397
22485
  if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i) || !(/^https?:\/\//i.test(i) || /\.\w{2,}(\/|\s|$)/.test(i) || r.includes("url") || r.includes("website") || r.includes("domain") || r.includes("site"))) return null;
22398
22486
  let a = null, o = 0;
@@ -22412,7 +22500,7 @@ function Mg(e, t, n) {
22412
22500
  t.name,
22413
22501
  t.id,
22414
22502
  t.placeholder,
22415
- xg(t),
22503
+ wg(t),
22416
22504
  t.getAttribute("aria-label"),
22417
22505
  t.getAttribute("autocomplete")
22418
22506
  ].filter(Boolean).join(" ").toLowerCase();
@@ -22420,15 +22508,15 @@ function Mg(e, t, n) {
22420
22508
  }
22421
22509
  return !a || o < 42 ? null : a;
22422
22510
  }
22423
- function Ng(e) {
22511
+ function Lg(e) {
22424
22512
  let t = String(e ?? "").trim();
22425
22513
  return !t || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t) ? !1 : /^https?:\/\//i.test(t) ? !0 : /\.\w{2,}(\/|\s|$)/.test(t);
22426
22514
  }
22427
- function Pg(e) {
22515
+ function Rg(e) {
22428
22516
  let t = String(e ?? "").toLowerCase().trim();
22429
22517
  return t ? !!(t === "url" || t === "website" || t === "website url" || t === "website_url" || t === "enter website url" || t.includes("website") || t.includes("domain") || /(enter\s+website|site\s*url|page\s*url)/.test(t)) : !1;
22430
22518
  }
22431
- function Fg(e) {
22519
+ function zg(e) {
22432
22520
  if (!e || e.tagName !== "INPUT" && e.tagName !== "TEXTAREA") return !1;
22433
22521
  let t = (e.type || "").toLowerCase();
22434
22522
  return ![
@@ -22440,22 +22528,22 @@ function Fg(e) {
22440
22528
  "file"
22441
22529
  ].includes(t);
22442
22530
  }
22443
- function Ig(e) {
22444
- if (!Fg(e)) return !1;
22531
+ function Bg(e) {
22532
+ if (!zg(e)) return !1;
22445
22533
  let t = (e.name || "").toLowerCase(), n = (e.id || "").toLowerCase(), r = [
22446
22534
  e.name,
22447
22535
  e.id,
22448
22536
  e.placeholder,
22449
- xg(e),
22537
+ wg(e),
22450
22538
  e.getAttribute("aria-label")
22451
22539
  ].filter(Boolean).join(" ").toLowerCase();
22452
22540
  return t === "url" || n === "url-input" || n.endsWith("-url-input") || /(website\s*url|enter\s+website|site\s*url)/.test(r) || /(website|domain)/.test(r) && /(url|site)/.test(r);
22453
22541
  }
22454
- function Lg(e, t, n) {
22455
- let r = String(t ?? ""), i = String(n ?? ""), a = Bg(e, r) || jg(e, r) || Mg(e, r, i);
22542
+ function Vg(e, t, n) {
22543
+ let r = String(t ?? ""), i = String(n ?? ""), a = Wg(e, r) || Fg(e, r) || Ig(e, r, i);
22456
22544
  if (!a) return [];
22457
22545
  let o = new Set([a]);
22458
- if (Ng(i) && Pg(r)) for (let t of e) t !== a && Ig(t) && o.add(t);
22546
+ if (Lg(i) && Rg(r)) for (let t of e) t !== a && Bg(t) && o.add(t);
22459
22547
  let s = Array.from(o);
22460
22548
  return s.sort((e, t) => {
22461
22549
  if (e === t) return 0;
@@ -22463,7 +22551,7 @@ function Lg(e, t, n) {
22463
22551
  return n & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
22464
22552
  }), s;
22465
22553
  }
22466
- function Rg(e, t) {
22554
+ function Hg(e, t) {
22467
22555
  try {
22468
22556
  if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
22469
22557
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
@@ -22478,17 +22566,17 @@ function Rg(e, t) {
22478
22566
  return Infinity;
22479
22567
  }
22480
22568
  }
22481
- function zg(e) {
22569
+ function Ug(e) {
22482
22570
  if (!e || typeof e != "string") return null;
22483
22571
  let t = null;
22484
- return yg((n) => {
22572
+ return Sg((n) => {
22485
22573
  try {
22486
22574
  let r = n.getElementById(e);
22487
22575
  r && !hg(r) && r.matches?.("input, select, textarea") && (t = r);
22488
22576
  } catch {}
22489
22577
  }), t;
22490
22578
  }
22491
- function Bg(e, t) {
22579
+ function Wg(e, t) {
22492
22580
  let n = String(t ?? "").trim();
22493
22581
  if (!n) return null;
22494
22582
  let r = n.match(/^name:\s*([\w.-]+)$/i);
@@ -22498,12 +22586,12 @@ function Bg(e, t) {
22498
22586
  }
22499
22587
  let i = n.match(/^id:\s*([\w.-]+)$/i);
22500
22588
  if (i) {
22501
- let e = zg(i[1]);
22589
+ let e = Ug(i[1]);
22502
22590
  if (e) return e;
22503
22591
  }
22504
22592
  let a = n.startsWith("#") ? n.slice(1) : n;
22505
22593
  if (/^[\w-]+$/.test(a)) {
22506
- let e = zg(a);
22594
+ let e = Ug(a);
22507
22595
  if (e) return e;
22508
22596
  }
22509
22597
  let o = n.toLowerCase().replace(/\s+/g, " ");
@@ -22513,7 +22601,7 @@ function Bg(e, t) {
22513
22601
  }
22514
22602
  return null;
22515
22603
  }
22516
- function Vg(e, t) {
22604
+ function Gg(e, t) {
22517
22605
  let n = String(t || "").toLowerCase().trim();
22518
22606
  if (!n) return 0;
22519
22607
  let r = [
@@ -22530,21 +22618,18 @@ function Vg(e, t) {
22530
22618
  for (let e of i) r.includes(e) && (a += 1);
22531
22619
  return a / i.length * 92;
22532
22620
  }
22533
- function Hg(e, t) {
22621
+ function Kg(e, t) {
22534
22622
  let n = [];
22535
- yg((e) => {
22536
- n.push(...Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
22537
- if (hg(e) || e.disabled) return !1;
22538
- try {
22539
- let t = vg(e);
22540
- if (t.display === "none" || t.visibility === "hidden" || parseFloat(t.opacity) === 0) return !1;
22541
- } catch {}
22542
- return !0;
22623
+ Sg((e) => {
22624
+ n.push(...Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter(kg)), n.push(...Array.from(e.querySelectorAll("a[href]")).filter((e) => {
22625
+ if (!kg(e)) return !1;
22626
+ let t = (e.textContent || "").replace(/\s+/g, " ").trim();
22627
+ return !(!t || t.length < 2 || t.length > 150);
22543
22628
  }));
22544
22629
  });
22545
22630
  let r = 0, i = n.map((t) => ({
22546
22631
  el: t,
22547
- s: Vg(t, e)
22632
+ s: Gg(t, e)
22548
22633
  }));
22549
22634
  for (let { s: e } of i) e > r && (r = e);
22550
22635
  if (r < 36) return null;
@@ -22554,14 +22639,14 @@ function Hg(e, t) {
22554
22639
  if (o.length) {
22555
22640
  let e = a[0], t = Infinity;
22556
22641
  for (let n of a) for (let r of o) {
22557
- let i = Rg(n, r);
22642
+ let i = Hg(n, r);
22558
22643
  i < t && (t = i, e = n);
22559
22644
  }
22560
22645
  return e;
22561
22646
  }
22562
22647
  return a[0];
22563
22648
  }
22564
- function Ug(e) {
22649
+ function qg(e) {
22565
22650
  if (e == null) return {};
22566
22651
  if (typeof e == "string") {
22567
22652
  let t = e.trim();
@@ -22574,8 +22659,8 @@ function Ug(e) {
22574
22659
  }
22575
22660
  return e;
22576
22661
  }
22577
- function Wg(e) {
22578
- let t = Ug(e);
22662
+ function Jg(e) {
22663
+ let t = qg(e);
22579
22664
  if (Array.isArray(t) && t.length > 0) {
22580
22665
  let e = t[0];
22581
22666
  if (e?.field_key != null || e?.fieldKey != null) return t.map((e) => ({
@@ -22603,12 +22688,12 @@ function Wg(e) {
22603
22688
  value: e?.value ?? e?.Value
22604
22689
  })) : [];
22605
22690
  }
22606
- function Gg(e) {
22691
+ function Yg(e) {
22607
22692
  if (!e || typeof e != "string") return e;
22608
22693
  let t = e.trim();
22609
22694
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t) ? t : (t = t.replace(/\s+at\s+the\s+rate\s*(of)?\s+/gi, "@"), t = t.replace(/\s+at\s+/gi, "@"), t = t.replace(/\s+dot\s+/gi, "."), t = t.replace(/\s+/g, ""), t = t.replace(/\.{2,}/g, ".").replace(/\.$/, ""), t);
22610
22695
  }
22611
- function Kg(e) {
22696
+ function Xg(e) {
22612
22697
  if (!e || typeof e != "string") return e;
22613
22698
  let t = {
22614
22699
  zero: "0",
@@ -22627,7 +22712,7 @@ function Kg(e) {
22627
22712
  for (let [e, r] of Object.entries(t)) n = n.replace(RegExp(`\\b${e}\\b`, "g"), r);
22628
22713
  return n = n.replace(/[^\d+]/g, ""), n;
22629
22714
  }
22630
- function qg(e) {
22715
+ function Zg(e) {
22631
22716
  if (!e || typeof e != "string") return [];
22632
22717
  let t = e.trim();
22633
22718
  if (!t || /\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\b/i.test(t)) return [];
@@ -22646,7 +22731,7 @@ function qg(e) {
22646
22731
  }
22647
22732
  return [];
22648
22733
  }
22649
- function Jg(e) {
22734
+ function Qg(e) {
22650
22735
  if (!e || typeof e != "string") return [];
22651
22736
  let t = e.trim();
22652
22737
  if (!t) return [];
@@ -22658,7 +22743,7 @@ function Jg(e) {
22658
22743
  field_key: e,
22659
22744
  value: i
22660
22745
  }));
22661
- }, o = Gg(t), s = i.test(o), c = o.match(/^\s*([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,})\s*$/i);
22746
+ }, o = Yg(t), s = i.test(o), c = o.match(/^\s*([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,})\s*$/i);
22662
22747
  if (c) return a("Email Address", c[1]), n;
22663
22748
  if (!i.test(t) && s) {
22664
22749
  let e = o.match(i);
@@ -22686,17 +22771,17 @@ function Jg(e) {
22686
22771
  }
22687
22772
  return n;
22688
22773
  }
22689
- function Yg(e) {
22774
+ function $g(e) {
22690
22775
  if (!e || typeof e != "object") return null;
22691
22776
  let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
22692
22777
  return t == null ? null : String(t).trim() || null;
22693
22778
  }
22694
- function Xg(e) {
22779
+ function e_(e) {
22695
22780
  if (!e || typeof e != "object") return null;
22696
22781
  let t = e.query ?? e.q ?? e.search ?? e.text ?? e.keywords ?? e.search_query ?? e.searchQuery ?? e.question ?? e.prompt ?? e.topic ?? e.intent;
22697
22782
  return t == null ? null : String(t).trim() || null;
22698
22783
  }
22699
- function Zg(e) {
22784
+ function t_(e) {
22700
22785
  let t = e.ownerDocument?.defaultView || window, n = e.tagName === "TEXTAREA" ? t.HTMLTextAreaElement.prototype : t.HTMLInputElement.prototype, r = Object.getOwnPropertyDescriptor(n, "value");
22701
22786
  return (e, t) => {
22702
22787
  try {
@@ -22705,7 +22790,7 @@ function Zg(e) {
22705
22790
  r?.set ? r.set.call(e, t) : e.value = t;
22706
22791
  };
22707
22792
  }
22708
- async function Qg(e, t, n) {
22793
+ async function n_(e, t, n) {
22709
22794
  if (!n?.skipScroll) try {
22710
22795
  e.scrollIntoView({
22711
22796
  behavior: "smooth",
@@ -22745,7 +22830,7 @@ async function Qg(e, t, n) {
22745
22830
  ].includes(String(t).toLowerCase().trim()), e.dispatchEvent(new Event("input", a)), e.dispatchEvent(new Event("change", a)), cg(e), !0;
22746
22831
  let o = String(t);
22747
22832
  if (r === "INPUT" || r === "TEXTAREA") {
22748
- let t = Zg(e);
22833
+ let t = t_(e);
22749
22834
  try {
22750
22835
  await eg(e, o, t);
22751
22836
  } catch {
@@ -22775,11 +22860,11 @@ async function Qg(e, t, n) {
22775
22860
  } catch {}
22776
22861
  return cg(e), !0;
22777
22862
  }
22778
- function $g(e) {
22863
+ function r_(e) {
22779
22864
  let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = null, o = {
22780
22865
  navigate_to_page: async (n) => {
22781
22866
  $("navigate_to_page ▶ raw parameters:", n);
22782
- let r = Ug(n), i = Yg(r), a = r.section_text ?? r.sectionText ?? r.section;
22867
+ let r = qg(n), i = $g(r), a = r.section_text ?? r.sectionText ?? r.section;
22783
22868
  if ($("navigate_to_page · coerced:", {
22784
22869
  url: i,
22785
22870
  sectionText: a
@@ -22806,7 +22891,7 @@ function $g(e) {
22806
22891
  }
22807
22892
  let e = "";
22808
22893
  try {
22809
- let t = Tg(), n = Eg();
22894
+ let t = Og(), n = Ag();
22810
22895
  if (t.length > 0) {
22811
22896
  let r = t.map((e) => e.label || e.placeholder || e.name || e.id).filter(Boolean).join(", "), i = n.map((e) => e.text).filter(Boolean).join(", ");
22812
22897
  e = ` This page has a form with fields: [${r}]` + (i ? ` and buttons: [${i}].` : ".") + " Call list_page_forms then start filling.";
@@ -22822,12 +22907,12 @@ function $g(e) {
22822
22907
  },
22823
22908
  highlight_on_page: async (e) => {
22824
22909
  $("highlight_on_page ▶", e);
22825
- let t = Ug(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i = rn(n || null, r || null);
22910
+ let t = qg(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i = rn(n || null, r || null);
22826
22911
  return i ? (an(i, { speaking: !0 }), $("highlight_on_page ✓ (speaking)"), "OK_HIGHLIGHT section is now highlighted and scrolled into view.") : ($("highlight_on_page ✖ no element"), "Could not find that section on the page.");
22827
22912
  },
22828
22913
  search_site_content: async (e) => {
22829
22914
  $("search_site_content ▶", e);
22830
- let r = Xg(Ug(e));
22915
+ let r = e_(qg(e));
22831
22916
  if ($("search_site_content · query:", r, "siteId:", t, "apiBase:", n || "(empty)"), rg("Searching site content…", { spinner: !0 }), !r) return ig(), $("search_site_content ✖ missing query"), "Missing query parameter.";
22832
22917
  if (!t) return ig(), $("search_site_content ✖ no siteId"), "Site is not configured for search.";
22833
22918
  if (!n) return ig(), $("search_site_content ✖ no api base"), "API base URL is missing; cannot search.";
@@ -22855,14 +22940,33 @@ function $g(e) {
22855
22940
  return $("search_site_content ✖", t), t;
22856
22941
  }
22857
22942
  },
22943
+ read_page_content: async (e) => {
22944
+ $("read_page_content ▶", e);
22945
+ let t = qg(e), n = t?.section_text || t?.sectionText, r = 3e3;
22946
+ try {
22947
+ if (n) {
22948
+ let e = rn(null, n);
22949
+ if (!e) return `Could not find a section matching "${n}" on this page.`;
22950
+ an(e, { speaking: !0 });
22951
+ let t = _g(e, r);
22952
+ return t ? ($("read_page_content ✓ section:", t.length, "chars"), `OK_READ: ${t}`) : "Found the section but it appears to be empty.";
22953
+ }
22954
+ let e = vg();
22955
+ if (!e) return "Could not determine the main content area of this page.";
22956
+ let t = _g(e, r);
22957
+ return t ? ($("read_page_content ✓ page:", t.length, "chars"), `OK_READ: ${t}`) : "The page appears to have no readable text content.";
22958
+ } catch (e) {
22959
+ return $("read_page_content ✖", e?.message), `Error reading page content: ${e?.message || "unknown error"}`;
22960
+ }
22961
+ },
22858
22962
  end_voice_session: async () => ($("end_voice_session ▶"), rg("Ending voice session…", {
22859
22963
  icon: "👋",
22860
22964
  spinner: !1,
22861
22965
  duration: 2e3
22862
22966
  }), dg(!0), lg(), typeof e.requestEndSession == "function" && e.requestEndSession(), "Voice session is ending."),
22863
22967
  list_page_forms: async () => {
22864
- let e = Tg(), t = Eg();
22865
- return $("list_page_forms ✓", `${e.length} field(s)`, `${t.length} button(s)`), a = wg(), $("list_page_forms · activeFormAncestor", a ? "contact-preferring" : "none"), JSON.stringify({
22968
+ let e = Og(), t = Ag();
22969
+ return $("list_page_forms ✓", `${e.length} field(s)`, `${t.length} button(s)`), a = Dg(), $("list_page_forms · activeFormAncestor", a ? "contact-preferring" : "none"), JSON.stringify({
22866
22970
  fields: e,
22867
22971
  buttons: t,
22868
22972
  hint: "Fields are grouped by formIndex/formName. Work with ONE form at a time — only fill fields from the same formIndex. Do not jump to fields in a different form. On pages with a contact form AND a footer 'Conduct Audit' / website URL field: only use the contact form unless the visitor explicitly asks to run an audit. Contact forms: fill in order Full Name → Email Address → Message. Message must be a short note the visitor wants to send (one or two sentences), never a recap of the whole chat or assistant replies. field_key: use placeholder, label, name, or id from this list. click_page_button picks the button nearest the filled fields (e.g. Send Message on the same form)."
@@ -22871,10 +22975,10 @@ function $g(e) {
22871
22975
  fill_form_fields: async (e) => {
22872
22976
  try {
22873
22977
  $("fill_form_fields ▶ raw:", e);
22874
- let t = Wg(e);
22978
+ let t = Jg(e);
22875
22979
  if (!t.length && r) {
22876
- let e = r(), n = qg(e);
22877
- n.length ? $("fill_form_fields · inferred URL from last user utterance (model omitted usable fields):", n) : (n = Jg(e), n.length && $("fill_form_fields · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
22980
+ let e = r(), n = Zg(e);
22981
+ n.length ? $("fill_form_fields · inferred URL from last user utterance (model omitted usable fields):", n) : (n = Qg(e), n.length && $("fill_form_fields · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
22878
22982
  }
22879
22983
  if ($("fill_form_fields · normalized fields:", t), !t.length) return "No fields provided. Call list_page_forms for field_key strings, then fill_form_fields with { \"fields\": [ { \"field_key\": \"<label or placeholder from list>\", \"value\": \"<user value>\" } ] }. Never use empty {}. Pass the value the user just said (email, message, name, URL) in fields.";
22880
22984
  t.length > 1 && rg(`Filling ${t.length} fields…`);
@@ -22883,33 +22987,33 @@ function $g(e) {
22883
22987
  let t = e?.field_key ?? e?.fieldKey, r = e?.value;
22884
22988
  if (t == null || r == null) continue;
22885
22989
  let o = String(t).toLowerCase();
22886
- if (/email|e-mail|mail/.test(o)) r = Gg(r);
22887
- else if (/phone|mobile|tel|cell/.test(o)) r = Kg(r);
22888
- else if (Pg(t) || o === "url") {
22990
+ if (/email|e-mail|mail/.test(o)) r = Yg(r);
22991
+ else if (/phone|mobile|tel|cell/.test(o)) r = Xg(r);
22992
+ else if (Rg(t) || o === "url") {
22889
22993
  let e = String(r ?? "").trim();
22890
22994
  if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e) || /\bat\b/i.test(e) && /\bdot\b/i.test(e)) {
22891
- let n = Gg(e);
22995
+ let n = Yg(e);
22892
22996
  /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n.trim()) && ($("fill_form_fields · remapping url/website intent to Email Address (value is an email)"), t = "Email Address", o = "email address", r = n.trim());
22893
22997
  }
22894
22998
  }
22895
22999
  rg(`Filling ${t}…`), $("fill_form_fields · processing field:", t, "=", r);
22896
- let s = Sg(), c = s;
23000
+ let s = Tg(), c = s;
22897
23001
  if (a) {
22898
- let e = s.filter((e) => gg(e) === a);
23002
+ let e = s.filter((e) => yg(e) === a);
22899
23003
  e.length > 0 && (c = e, $("fill_form_fields · scoped to active form, inputs:", e.length));
22900
23004
  }
22901
23005
  $("fill_form_fields · visible inputs count:", s.length, "scoped:", c.length);
22902
23006
  let l = !1;
22903
23007
  for (let e of [c, ...c === s ? [] : [s]]) {
22904
- let o = Lg(e, String(t), r);
23008
+ let o = Vg(e, String(t), r);
22905
23009
  if (o.length) {
22906
- for (let e = 0; e < o.length; e++) await Qg(o[e], r, { skipScroll: e > 0 }), await new Promise((e) => setTimeout(e, 80));
22907
- i = o, a = gg(o[0]) || a, n.push(String(t)), l = !0;
23010
+ for (let e = 0; e < o.length; e++) await n_(o[e], r, { skipScroll: e > 0 }), await new Promise((e) => setTimeout(e, 80));
23011
+ i = o, a = yg(o[0]) || a, n.push(String(t)), l = !0;
22908
23012
  break;
22909
23013
  }
22910
- let s = Bg(e, String(t));
22911
- if (s ||= jg(e, String(t)), s ||= Mg(e, String(t), r), s) {
22912
- await Qg(s, r), i = [s], a = gg(s) || a, n.push(String(t)), l = !0;
23014
+ let s = Wg(e, String(t));
23015
+ if (s ||= Fg(e, String(t)), s ||= Ig(e, String(t), r), s) {
23016
+ await n_(s, r), i = [s], a = yg(s) || a, n.push(String(t)), l = !0;
22913
23017
  break;
22914
23018
  }
22915
23019
  }
@@ -22929,10 +23033,10 @@ function $g(e) {
22929
23033
  }
22930
23034
  },
22931
23035
  click_page_button: async (e) => {
22932
- let t = Ug(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
23036
+ let t = qg(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
22933
23037
  if ($("click_page_button ▶", n), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
22934
23038
  rg(`Clicking "${n}"…`);
22935
- let r = Hg(n, i);
23039
+ let r = Kg(n, i);
22936
23040
  if (!r) return ig(200), $("click_page_button ✖ no match"), `Could not find a button matching "${n}". Call list_page_forms to see button texts.`;
22937
23041
  try {
22938
23042
  try {
@@ -22953,11 +23057,11 @@ function $g(e) {
22953
23057
  try {
22954
23058
  await fg(r);
22955
23059
  } catch {}
22956
- let e = gg(r) || a, t = [];
23060
+ let e = yg(r) || a, t = [];
22957
23061
  if (e) {
22958
23062
  let n = Array.from(e.querySelectorAll("input[required], textarea[required], select[required]")).filter((e) => !hg(e));
22959
23063
  for (let e of n) if (!(e.value || "").trim()) {
22960
- let n = xg(e) || e.placeholder || e.name || e.type;
23064
+ let n = wg(e) || e.placeholder || e.name || e.type;
22961
23065
  t.push(n);
22962
23066
  }
22963
23067
  }
@@ -22998,7 +23102,7 @@ function $g(e) {
22998
23102
  }
22999
23103
  //#endregion
23000
23104
  //#region src/utils/wrapVoiceToolsForLogging.js
23001
- function e_(e) {
23105
+ function i_(e) {
23002
23106
  return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
23003
23107
  let r = Zt();
23004
23108
  r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
@@ -23015,22 +23119,22 @@ function e_(e) {
23015
23119
  }
23016
23120
  //#endregion
23017
23121
  //#region src/components/VoiceInterface.jsx
23018
- var t_ = {
23122
+ var a_ = {
23019
23123
  idle: "rgba(99,102,241,0.18)",
23020
23124
  listening: "rgba(16,185,129,0.25)",
23021
23125
  speaking: "rgba(245,158,11,0.25)",
23022
23126
  error: "rgba(239,68,68,0.2)"
23023
- }, n_ = {
23127
+ }, o_ = {
23024
23128
  idle: "#6366f1",
23025
23129
  listening: "#10b981",
23026
23130
  speaking: "#f59e0b",
23027
23131
  error: "#ef4444"
23028
23132
  };
23029
- function r_(e, t) {
23133
+ function s_(e, t) {
23030
23134
  let n = (t || "").trim();
23031
23135
  return n ? !!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\b(hang\s+up|disconnect)\b/i.test(n) || /\b(that'?s all|we'?re done)\b/i.test(n) || e === "bot" && (/\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n) || /\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n) || /\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n) || /\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n) || /\b(wrapping\s+up|signing\s+off)\b/i.test(n)) || /^(goodbye|bye|that'?s all|we'?re done|hang up|disconnect)\b/i.test(n)) : !1;
23032
23136
  }
23033
- function i_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, historyRef: d, hasSyncedRef: f, onMessageSync: p, onStartSync: m }) {
23137
+ function c_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, historyRef: d, hasSyncedRef: f, onMessageSync: p, onStartSync: m }) {
23034
23138
  let [h, g] = s("idle"), [ee, te] = s(null), [_, ne] = s(!1), re = o(null), ie = o(null), ae = o(""), oe = o(async () => {}), se = o(!1), v = n(async () => {
23035
23139
  try {
23036
23140
  await re.current?.endSession?.();
@@ -23047,7 +23151,7 @@ function i_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23047
23151
  try {
23048
23152
  if (await navigator.mediaDevices.getUserMedia({ audio: !0 }), t) return;
23049
23153
  d.current = [], ae.current = "", se.current = !1;
23050
- let i = e_($g({
23154
+ let i = i_(r_({
23051
23155
  siteId: r || null,
23052
23156
  apiBaseUrl: a || null,
23053
23157
  getLastUserVoiceText: () => ae.current,
@@ -23074,7 +23178,7 @@ function i_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23074
23178
  message: r,
23075
23179
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
23076
23180
  };
23077
- n === "user" && (ae.current = r), d.current = [...d.current, i], r_(n, r) && queueMicrotask(() => {
23181
+ n === "user" && (ae.current = r), d.current = [...d.current, i], s_(n, r) && queueMicrotask(() => {
23078
23182
  se.current || (se.current = !0, oe.current?.());
23079
23183
  });
23080
23184
  },
@@ -23113,7 +23217,7 @@ function i_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23113
23217
  d,
23114
23218
  m
23115
23219
  ]);
23116
- let ce = h === "listening" || h === "speaking", le = n_[h] || n_.idle, ue = t_[h] || t_.idle;
23220
+ let ce = h === "listening" || h === "speaking", le = o_[h] || o_.idle, ue = a_[h] || a_.idle;
23117
23221
  return /* @__PURE__ */ u("div", {
23118
23222
  ref: ie,
23119
23223
  style: {
@@ -23219,7 +23323,7 @@ function i_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23219
23323
  }
23220
23324
  //#endregion
23221
23325
  //#region src/components/FlowEngageWidget.jsx
23222
- var a_ = [
23326
+ var l_ = [
23223
23327
  {
23224
23328
  key: "become_client",
23225
23329
  label: "Become a Client"
@@ -23240,7 +23344,7 @@ var a_ = [
23240
23344
  key: "looking_for_job",
23241
23345
  label: "Looking for a Job"
23242
23346
  }
23243
- ], o_ = () => /* @__PURE__ */ l("div", {
23347
+ ], u_ = () => /* @__PURE__ */ l("div", {
23244
23348
  style: {
23245
23349
  display: "flex",
23246
23350
  marginBottom: "12px",
@@ -23271,7 +23375,7 @@ var a_ = [
23271
23375
  } }, e)), /* @__PURE__ */ l("style", { children: "\n @keyframes fe-dot-bounce {\n 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }\n 40% { transform: translateY(-5px); opacity: 1; }\n }\n " })]
23272
23376
  })
23273
23377
  });
23274
- function s_() {
23378
+ function d_() {
23275
23379
  let { status: e, runtimeConfig: t, resolvedConfig: n, chatId: r, chatHistory: o, isOpen: c, activeScreen: d, isHumanHandled: f, agentName: p, agentHeadshot: m, visitorEmail: h, isAgentTyping: g, isAiTyping: ee, isLoading: te, isVoiceMode: _, isRateLimited: ne, rateLimitMessage: re, isConversationEnded: ie, incomingCall: ae, activeCallId: oe, callConnectionState: se, callConnectedAt: v, isCallMuted: ce, webRTCError: le, language: ue, historyRef: y, onMessageSync: b, endConversation: de, acceptCall: fe, rejectCall: pe, endWebRTCCall: me, toggleCallMute: he, dismissCallError: ge, captureVisitorEmail: _e, openWidget: ve, closeWidget: ye, sendMessage: be, setVoiceMode: xe, startTyping: Se, stopTyping: Ce, updateTypingDraft: we } = Xt(), [Te, Ee] = s(""), [De, Oe] = s(null), [ke, Ae] = s(null), [je, Me] = s(null), [Ne, Pe] = s(0), [x, Fe] = s(h || ""), [Ie, Le] = s("");
23276
23380
  i(() => {
23277
23381
  try {
@@ -23299,7 +23403,7 @@ function s_() {
23299
23403
  outline: "none",
23300
23404
  fontFamily: "ui-sans-serif, system-ui, sans-serif",
23301
23405
  ...c ? {} : Ue
23302
- }, Ge = S.recommendations?.[ue] || Re.recommendations?.[ue] || a_, Ke = S.greetings?.[ue] || Re.greetings?.[ue], qe = ze.chatButtonText || "Chat with us", Je = ze.headerName || t?.websiteName || "OpenSense Labs", C = ze.logoUrl || null, w = ze.hideWatermark || !1, T = Re.elevenLabsAgentId || t?.elevenLabsAgentId || null, Ye = t?.siteId || n?.siteId || null, Xe = t?.apiBaseUrl || "", Ze = ze.fallbackAgentName || "Agent", Qe = ze.botLabel || "AI", $e = m && String(m).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, et = ae?.agentName || p || Ze, tt = o.some((e) => e.sender === "user"), nt = a(() => {
23406
+ }, Ge = S.recommendations?.[ue] || Re.recommendations?.[ue] || l_, Ke = S.greetings?.[ue] || Re.greetings?.[ue], qe = ze.chatButtonText || "Chat with us", Je = ze.headerName || t?.websiteName || "OpenSense Labs", C = ze.logoUrl || null, w = ze.hideWatermark || !1, T = Re.elevenLabsAgentId || t?.elevenLabsAgentId || null, Ye = t?.siteId || n?.siteId || null, Xe = t?.apiBaseUrl || "", Ze = ze.fallbackAgentName || "Agent", Qe = ze.botLabel || "AI", $e = m && String(m).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, et = ae?.agentName || p || Ze, tt = o.some((e) => e.sender === "user"), nt = a(() => {
23303
23407
  let e = o.findIndex((e) => e.sender === "user");
23304
23408
  return e === -1 ? !1 : o.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
23305
23409
  }, [o]), rt = !h && tt && nt;
@@ -23427,7 +23531,7 @@ function s_() {
23427
23531
  flexDirection: "column"
23428
23532
  },
23429
23533
  className: "fe-screen-fade-in",
23430
- children: /* @__PURE__ */ l(i_, {
23534
+ children: /* @__PURE__ */ l(c_, {
23431
23535
  agentId: T,
23432
23536
  chatId: r,
23433
23537
  siteId: Ye,
@@ -23460,7 +23564,7 @@ function s_() {
23460
23564
  isAiTyping: ee,
23461
23565
  isAgentTyping: g,
23462
23566
  setReplyContext: Me,
23463
- TypingDots: o_,
23567
+ TypingDots: u_,
23464
23568
  primaryColor: Ve,
23465
23569
  agentHeadshot: $e,
23466
23570
  agentDisplayName: p || Ze
@@ -23539,4 +23643,4 @@ function s_() {
23539
23643
  }) : null;
23540
23644
  }
23541
23645
  //#endregion
23542
- export { vn as FlowEngageProvider, s_ as FlowEngageWidget, Xt as useFlowEngage };
23646
+ export { vn as FlowEngageProvider, d_ as FlowEngageWidget, Xt as useFlowEngage };