@livelayer/react 0.5.22 → 0.5.23

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.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { jsxs as _, jsx as n, Fragment as Lt } from "react/jsx-runtime";
3
- import { Component as mn, useState as S, useRef as A, useEffect as N, useCallback as L, useMemo as dt, forwardRef as St, createElement as gn } from "react";
2
+ import { jsxs as _, jsx as n, Fragment as St } from "react/jsx-runtime";
3
+ import { Component as mn, useState as S, useRef as A, useEffect as N, useCallback as L, useMemo as ut, forwardRef as Ct, createElement as gn } from "react";
4
4
  import { LiveKitSession as yn } from "@livelayer/sdk";
5
5
  import { createLocalAudioTrack as vn, Track as en, createLocalVideoTrack as bn } from "livekit-client";
6
6
  class wn extends mn {
@@ -73,7 +73,7 @@ function _n(e) {
73
73
  e.sessionEndpoint,
74
74
  JSON.stringify(e.sessionBody ?? {})
75
75
  ]);
76
- const I = L(async () => {
76
+ const T = L(async () => {
77
77
  const R = w.current;
78
78
  if (R)
79
79
  try {
@@ -97,7 +97,7 @@ function _n(e) {
97
97
  audioElement: s,
98
98
  canResume: x,
99
99
  error: C,
100
- connect: I,
100
+ connect: T,
101
101
  disconnect: q,
102
102
  getRoom: m,
103
103
  session: w.current
@@ -236,13 +236,13 @@ function Sn() {
236
236
  }, []), s = L(() => {
237
237
  const w = f.current, H = y.current;
238
238
  if (H && w) {
239
- const I = w.localParticipant.getTrackPublication(en.Source.Camera);
240
- if (I != null && I.track) {
239
+ const T = w.localParticipant.getTrackPublication(en.Source.Camera);
240
+ if (T != null && T.track) {
241
241
  try {
242
- w.localParticipant.unpublishTrack(I.track);
242
+ w.localParticipant.unpublishTrack(T.track);
243
243
  } catch {
244
244
  }
245
- I.track.stop();
245
+ T.track.stop();
246
246
  } else
247
247
  H.stop();
248
248
  }
@@ -252,9 +252,9 @@ function Sn() {
252
252
  if (H) {
253
253
  i(null);
254
254
  try {
255
- const I = { ...Ln };
256
- w && (I.deviceId = w);
257
- const q = await bn(I);
255
+ const T = { ...Ln };
256
+ w && (T.deviceId = w);
257
+ const q = await bn(T);
258
258
  await H.localParticipant.publishTrack(q), y.current = q;
259
259
  const m = q.attach();
260
260
  l(m), t(!0), w && u(w);
@@ -265,8 +265,8 @@ function Sn() {
265
265
  );
266
266
  } catch {
267
267
  }
268
- } catch (I) {
269
- const q = I instanceof Error && I.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
268
+ } catch (T) {
269
+ const q = T instanceof Error && T.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
270
270
  i(q);
271
271
  }
272
272
  }
@@ -448,16 +448,16 @@ function $n(e = Pn) {
448
448
  });
449
449
  }, [e]), t;
450
450
  }
451
- const Ot = "__llHistoryPatched", ut = "ll:pathname";
451
+ const Ot = "__llHistoryPatched", ft = "ll:pathname";
452
452
  function zn() {
453
453
  if (typeof window > "u" || window.history[Ot]) return;
454
454
  const e = window.history.pushState, t = window.history.replaceState;
455
455
  window.history.pushState = function(...r) {
456
456
  const i = e.apply(this, r);
457
- return window.dispatchEvent(new Event(ut)), i;
457
+ return window.dispatchEvent(new Event(ft)), i;
458
458
  }, window.history.replaceState = function(...r) {
459
459
  const i = t.apply(this, r);
460
- return window.dispatchEvent(new Event(ut)), i;
460
+ return window.dispatchEvent(new Event(ft)), i;
461
461
  }, window.history[Ot] = !0;
462
462
  }
463
463
  function Ht() {
@@ -471,8 +471,8 @@ function On(e) {
471
471
  if (e !== void 0) return;
472
472
  zn();
473
473
  const i = () => r(Ht());
474
- return i(), window.addEventListener("popstate", i), window.addEventListener(ut, i), () => {
475
- window.removeEventListener("popstate", i), window.removeEventListener(ut, i);
474
+ return i(), window.addEventListener("popstate", i), window.addEventListener(ft, i), () => {
475
+ window.removeEventListener("popstate", i), window.removeEventListener(ft, i);
476
476
  };
477
477
  }, [e]), e ?? t;
478
478
  }
@@ -503,7 +503,7 @@ function Un(e, t, r) {
503
503
  return e === void 0 ? !0 : Bt(r, e) ? !1 : t && t.length > 0 ? Bt(t, e) : !0;
504
504
  }
505
505
  function jn(e, t, r) {
506
- return dt(
506
+ return ut(
507
507
  () => Un(e, t, r),
508
508
  [e, t, r]
509
509
  );
@@ -663,7 +663,7 @@ const Gn = ({
663
663
  }
664
664
  },
665
665
  [s]
666
- ), I = L(
666
+ ), T = L(
667
667
  (M) => {
668
668
  const B = C.current;
669
669
  if (!B) return;
@@ -716,7 +716,7 @@ const Gn = ({
716
716
  type: "button",
717
717
  className: W,
718
718
  onPointerDown: H,
719
- onPointerMove: I,
719
+ onPointerMove: T,
720
720
  onPointerUp: q,
721
721
  onPointerCancel: q,
722
722
  onClick: m,
@@ -729,7 +729,7 @@ const Gn = ({
729
729
  // as the click affordance), then the circular avatar photo
730
730
  // taking the rest of the tab. Reinforces "this is an
731
731
  // avatar-based experience" even when collapsed.
732
- /* @__PURE__ */ _(Lt, { children: [
732
+ /* @__PURE__ */ _(St, { children: [
733
733
  /* @__PURE__ */ n(
734
734
  Ut,
735
735
  {
@@ -764,7 +764,7 @@ const Gn = ({
764
764
  className: o,
765
765
  barClassName: l
766
766
  }) => {
767
- const c = A(null), u = A([]), f = dt(() => {
767
+ const c = A(null), u = A([]), f = ut(() => {
768
768
  const b = (Math.sqrt(5) - 1) / 2;
769
769
  return Array.from({ length: t }, (s, a) => 0.5 + a * b % 1 * 0.5);
770
770
  }, [t]);
@@ -972,7 +972,7 @@ const Gn = ({
972
972
  agentState: v,
973
973
  transcript: w,
974
974
  canResume: H,
975
- needsUserGesture: I,
975
+ needsUserGesture: T,
976
976
  error: q,
977
977
  isMuted: m,
978
978
  micError: R,
@@ -983,29 +983,29 @@ const Gn = ({
983
983
  activeCameraId: F,
984
984
  isScreenShareEnabled: G,
985
985
  screenPreviewEl: ie,
986
- isSpeakerMuted: we,
986
+ isSpeakerMuted: _e,
987
987
  allowCamera: tt,
988
988
  allowScreenShare: nt,
989
989
  allowTyping: rt,
990
990
  avatarVideoContainerRef: it,
991
991
  agentVideoEl: re,
992
992
  micGateOpen: ce,
993
- onConnect: _e,
993
+ onConnect: xe,
994
994
  onDisconnect: Ne,
995
995
  onRetry: Ae,
996
996
  onResumeAudio: Re,
997
997
  onToggleMute: Me,
998
998
  onToggleCamera: Ie,
999
- onSwitchCameraDevice: V,
1000
- onToggleScreenShare: pt,
1001
- onToggleSpeaker: ht,
999
+ onSwitchCameraDevice: J,
1000
+ onToggleScreenShare: ht,
1001
+ onToggleSpeaker: mt,
1002
1002
  onSendMessage: ot,
1003
1003
  onMinimize: de,
1004
1004
  onClose: Te,
1005
1005
  onClearMicError: Fe
1006
1006
  }) => {
1007
1007
  var Oe;
1008
- const xe = ((u == null ? void 0 : u.length) ?? 0) > 1, De = C === "connecting" || C === "connected", X = C === "connected", ee = C === "idle" || C === "disconnected" || C === "error", [Pe, oe] = S(!1);
1008
+ const ke = ((u == null ? void 0 : u.length) ?? 0) > 1, De = C === "connecting" || C === "connected", X = C === "connected", ee = C === "idle" || C === "disconnected" || C === "error", [Pe, oe] = S(!1);
1009
1009
  N(() => {
1010
1010
  if (!re) {
1011
1011
  oe(!1);
@@ -1021,14 +1021,14 @@ const Gn = ({
1021
1021
  re.removeEventListener("playing", p), re.removeEventListener("loadeddata", p);
1022
1022
  };
1023
1023
  }, [re]);
1024
- const [ue, ke] = S(!1);
1024
+ const [ue, Le] = S(!1);
1025
1025
  N(() => {
1026
1026
  if (!X) {
1027
- ke(!1);
1027
+ Le(!1);
1028
1028
  return;
1029
1029
  }
1030
1030
  if (Pe) return;
1031
- const p = setTimeout(() => ke(!0), 8e3);
1031
+ const p = setTimeout(() => Le(!0), 8e3);
1032
1032
  return () => clearTimeout(p);
1033
1033
  }, [X, Pe]);
1034
1034
  const Ue = C === "connecting" || X && !!i && !Pe && !ue, te = A(null), le = A(null);
@@ -1057,15 +1057,15 @@ const Gn = ({
1057
1057
  const [me, je] = S(""), Ve = L(
1058
1058
  (p) => {
1059
1059
  p.preventDefault();
1060
- const Y = me.trim();
1061
- Y && (ot(Y), je(""));
1060
+ const K = me.trim();
1061
+ K && (ot(K), je(""));
1062
1062
  },
1063
1063
  [me, ot]
1064
1064
  ), Ye = c.productName || "Live Layer";
1065
1065
  let ge = null, ye = null;
1066
1066
  for (let p = w.length - 1; p >= 0; p--) {
1067
- const Y = w[p];
1068
- if (!ge && Y.role === "agent" ? ge = Y : !ye && Y.role === "user" && (ye = Y), ge && ye) break;
1067
+ const K = w[p];
1068
+ if (!ge && K.role === "agent" ? ge = K : !ye && K.role === "user" && (ye = K), ge && ye) break;
1069
1069
  }
1070
1070
  const ze = X ? (ge == null ? void 0 : ge.text) || null : l || null, lt = X && (ye == null ? void 0 : ye.text) || null, Je = [
1071
1071
  "ll-expanded",
@@ -1106,7 +1106,7 @@ const Gn = ({
1106
1106
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1107
1107
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: y ? "Switching..." : "Connecting..." })
1108
1108
  ] }),
1109
- I && X && /* @__PURE__ */ _(
1109
+ T && X && /* @__PURE__ */ _(
1110
1110
  "button",
1111
1111
  {
1112
1112
  type: "button",
@@ -1127,17 +1127,17 @@ const Gn = ({
1127
1127
  type: "button",
1128
1128
  className: "ll-hpill",
1129
1129
  onClick: (p) => {
1130
- xe && (p.stopPropagation(), s());
1130
+ ke && (p.stopPropagation(), s());
1131
1131
  },
1132
- "aria-haspopup": xe ? "listbox" : void 0,
1133
- "aria-expanded": xe ? b : void 0,
1132
+ "aria-haspopup": ke ? "listbox" : void 0,
1133
+ "aria-expanded": ke ? b : void 0,
1134
1134
  children: [
1135
1135
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1136
- xe && /* @__PURE__ */ n(st, {})
1136
+ ke && /* @__PURE__ */ n(st, {})
1137
1137
  ]
1138
1138
  }
1139
1139
  ),
1140
- xe && b && /* @__PURE__ */ n(
1140
+ ke && b && /* @__PURE__ */ n(
1141
1141
  "div",
1142
1142
  {
1143
1143
  className: "ll-hmenu",
@@ -1268,14 +1268,14 @@ const Gn = ({
1268
1268
  ] })
1269
1269
  ),
1270
1270
  ee && /* @__PURE__ */ (() => {
1271
- const p = H ? "Restart paused session" : C === "disconnected" ? "Reconnect to agent" : "Start video call", Y = H ? "Pick up where you left off" : null;
1272
- return /* @__PURE__ */ _(Lt, { children: [
1271
+ const p = H ? "Restart paused session" : C === "disconnected" ? "Reconnect to agent" : "Start video call", K = H ? "Pick up where you left off" : null;
1272
+ return /* @__PURE__ */ _(St, { children: [
1273
1273
  C === "idle" && !H && !q && /* @__PURE__ */ _(
1274
1274
  "button",
1275
1275
  {
1276
1276
  type: "button",
1277
1277
  className: "ll-expanded__play",
1278
- onClick: _e,
1278
+ onClick: xe,
1279
1279
  "aria-label": p,
1280
1280
  children: [
1281
1281
  /* @__PURE__ */ n("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ n("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
@@ -1285,13 +1285,13 @@ const Gn = ({
1285
1285
  ),
1286
1286
  /* @__PURE__ */ _("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1287
1287
  l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
1288
- Y && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: Y }),
1288
+ K && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: K }),
1289
1289
  /* @__PURE__ */ n(
1290
1290
  "button",
1291
1291
  {
1292
1292
  type: "button",
1293
1293
  className: "ll-expanded__cta",
1294
- onClick: _e,
1294
+ onClick: xe,
1295
1295
  "aria-label": p,
1296
1296
  children: p
1297
1297
  }
@@ -1344,7 +1344,7 @@ const Gn = ({
1344
1344
  {
1345
1345
  type: "button",
1346
1346
  className: `ll-tool ${G ? "is-on" : ""}`,
1347
- onClick: pt,
1347
+ onClick: ht,
1348
1348
  "aria-label": G ? "Stop sharing screen" : "Share screen",
1349
1349
  title: G ? "Stop sharing" : "Share screen",
1350
1350
  children: /* @__PURE__ */ n(nr, {})
@@ -1368,7 +1368,7 @@ const Gn = ({
1368
1368
  type: "button",
1369
1369
  className: `ll-tool ll-tool--right ${z ? "is-on" : ""}`,
1370
1370
  onClick: (p) => {
1371
- p.stopPropagation(), he((Y) => !Y), pe(!1);
1371
+ p.stopPropagation(), he((K) => !K), pe(!1);
1372
1372
  },
1373
1373
  "aria-label": "Camera devices",
1374
1374
  "aria-haspopup": "listbox",
@@ -1383,7 +1383,7 @@ const Gn = ({
1383
1383
  devices: B,
1384
1384
  activeId: F,
1385
1385
  onPick: (p) => {
1386
- he(!1), V(p);
1386
+ he(!1), J(p);
1387
1387
  }
1388
1388
  }
1389
1389
  )
@@ -1411,7 +1411,7 @@ const Gn = ({
1411
1411
  type: "button",
1412
1412
  className: `ll-tool ll-tool--right ${m ? "is-muted" : ""}`,
1413
1413
  onClick: (p) => {
1414
- p.stopPropagation(), pe((Y) => !Y), he(!1);
1414
+ p.stopPropagation(), pe((K) => !K), he(!1);
1415
1415
  },
1416
1416
  "aria-label": "Microphone devices",
1417
1417
  "aria-haspopup": "listbox",
@@ -1435,11 +1435,11 @@ const Gn = ({
1435
1435
  "button",
1436
1436
  {
1437
1437
  type: "button",
1438
- className: `ll-tool ${we ? "is-muted" : ""}`,
1439
- onClick: ht,
1440
- "aria-label": we ? "Unmute speaker" : "Mute speaker",
1441
- title: we ? "Unmute speaker" : "Mute speaker",
1442
- children: /* @__PURE__ */ n(or, { muted: we })
1438
+ className: `ll-tool ${_e ? "is-muted" : ""}`,
1439
+ onClick: mt,
1440
+ "aria-label": _e ? "Unmute speaker" : "Mute speaker",
1441
+ title: _e ? "Unmute speaker" : "Mute speaker",
1442
+ children: /* @__PURE__ */ n(or, { muted: _e })
1443
1443
  }
1444
1444
  ),
1445
1445
  /* @__PURE__ */ n(
@@ -1493,7 +1493,7 @@ const Gn = ({
1493
1493
  )
1494
1494
  ] });
1495
1495
  if (!q || C !== "error") return null;
1496
- let p = "Failed to connect", Y = "Try again";
1496
+ let p = "Failed to connect", K = "Try again";
1497
1497
  return q === "MIC_PERMISSION_DENIED" ? p = "Microphone blocked. Allow access to talk." : q === "MIC_NOT_FOUND" ? p = "No microphone found. Plug one in + retry." : q === "MIC_UNAVAILABLE" ? p = "Mic unavailable. Check other apps using it." : q === "AGENT_TIMEOUT" ? p = "Agent didn't pick up. Try again." : q === "CONNECT_FAILED" ? p = "Connection failed. Check your network." : q.length < 80 && (p = q), /* @__PURE__ */ _("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1498
1498
  /* @__PURE__ */ n("span", { children: p }),
1499
1499
  /* @__PURE__ */ n(
@@ -1502,7 +1502,7 @@ const Gn = ({
1502
1502
  type: "button",
1503
1503
  className: "ll-expanded__banner-retry",
1504
1504
  onClick: Ae,
1505
- children: Y
1505
+ children: K
1506
1506
  }
1507
1507
  )
1508
1508
  ] });
@@ -1547,7 +1547,7 @@ function ir({ muted: e }) {
1547
1547
  function or({ muted: e }) {
1548
1548
  return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1549
1549
  /* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1550
- e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(Lt, { children: [
1550
+ e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(St, { children: [
1551
1551
  /* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
1552
1552
  /* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
1553
1553
  ] })
@@ -1600,7 +1600,7 @@ const Kt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
1600
1600
  '[data-ll-private="true"]',
1601
1601
  ".ll-widget"
1602
1602
  ];
1603
- function Ct(e) {
1603
+ function Et(e) {
1604
1604
  let t = e;
1605
1605
  for (; t; ) {
1606
1606
  for (const r of sr)
@@ -1609,8 +1609,8 @@ function Ct(e) {
1609
1609
  }
1610
1610
  return !1;
1611
1611
  }
1612
- function ft(e) {
1613
- if (Ct(e)) return !1;
1612
+ function pt(e) {
1613
+ if (Et(e)) return !1;
1614
1614
  if (e instanceof HTMLInputElement) {
1615
1615
  if (e.type === "password") return !1;
1616
1616
  const t = (e.getAttribute("autocomplete") || "").toLowerCase();
@@ -1717,7 +1717,7 @@ function mr(e, t = {}) {
1717
1717
  );
1718
1718
  for (const m of v) {
1719
1719
  if (C.length >= dr) break;
1720
- if (Ze(m) || !ft(m) || !et(m)) continue;
1720
+ if (Ze(m) || !pt(m) || !et(m)) continue;
1721
1721
  const R = Gt(m), W = m instanceof HTMLInputElement ? m.type : m.tagName.toLowerCase();
1722
1722
  R && C.push({ label: Ee(R, 100), type: W });
1723
1723
  }
@@ -1726,7 +1726,7 @@ function mr(e, t = {}) {
1726
1726
  ), H = [];
1727
1727
  for (const m of w) {
1728
1728
  if (H.length >= fr) break;
1729
- if (Ct(m)) continue;
1729
+ if (Et(m)) continue;
1730
1730
  const R = m.getAttribute("data-ll-form") || "";
1731
1731
  if (!R) continue;
1732
1732
  const W = m.getAttribute("data-ll-intent") || void 0, z = Array.from(
@@ -1736,7 +1736,7 @@ function mr(e, t = {}) {
1736
1736
  ), M = [];
1737
1737
  for (const B of z) {
1738
1738
  if (M.length >= pr) break;
1739
- if (!ft(B)) continue;
1739
+ if (!pt(B)) continue;
1740
1740
  const F = B.getAttribute("data-ll-field") || "";
1741
1741
  if (!F) continue;
1742
1742
  const G = Gt(B) || F, ie = B instanceof HTMLInputElement ? B.type : B.tagName.toLowerCase();
@@ -1744,7 +1744,7 @@ function mr(e, t = {}) {
1744
1744
  }
1745
1745
  H.push({ id: R, intent: W, fields: M });
1746
1746
  }
1747
- const I = {
1747
+ const T = {
1748
1748
  url: i,
1749
1749
  title: l,
1750
1750
  pathname: o,
@@ -1755,15 +1755,15 @@ function mr(e, t = {}) {
1755
1755
  forms: H,
1756
1756
  extras: e
1757
1757
  };
1758
- let q = qe(JSON.stringify(I.regions)) + qe(I.visibleText) + qe(JSON.stringify(I.visibleLinks)) + qe(JSON.stringify(I.visibleFields));
1759
- for (; q > ct && I.visibleFields.length > 0; )
1760
- I.visibleFields.pop(), q = qe(JSON.stringify(I.visibleFields));
1761
- for (; q > ct && I.visibleLinks.length > 0; )
1762
- I.visibleLinks.pop(), q -= 80;
1763
- return qe(I.visibleText) > ct && (I.visibleText = Ee(I.visibleText, ct - 100)), I;
1758
+ let q = qe(JSON.stringify(T.regions)) + qe(T.visibleText) + qe(JSON.stringify(T.visibleLinks)) + qe(JSON.stringify(T.visibleFields));
1759
+ for (; q > ct && T.visibleFields.length > 0; )
1760
+ T.visibleFields.pop(), q = qe(JSON.stringify(T.visibleFields));
1761
+ for (; q > ct && T.visibleLinks.length > 0; )
1762
+ T.visibleLinks.pop(), q -= 80;
1763
+ return qe(T.visibleText) > ct && (T.visibleText = Ee(T.visibleText, ct - 100)), T;
1764
1764
  }
1765
1765
  let Be = null;
1766
- function _t(e, t = {}) {
1766
+ function kt(e, t = {}) {
1767
1767
  const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1768
1768
  if (Be && Be.key === o && r - Be.at < 1e3)
1769
1769
  return Be.ctx;
@@ -1793,7 +1793,7 @@ function wr(e) {
1793
1793
  const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
1794
1794
  for (const c of l) {
1795
1795
  if (o.length >= yr) break;
1796
- if (Ct(c)) continue;
1796
+ if (Et(c)) continue;
1797
1797
  const u = c.getAttribute("href") || "";
1798
1798
  if (!br(u)) continue;
1799
1799
  let f = u, y = !0;
@@ -1814,7 +1814,7 @@ function wr(e) {
1814
1814
  }
1815
1815
  let We = null;
1816
1816
  const _r = 5e3;
1817
- function xt() {
1817
+ function dt() {
1818
1818
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
1819
1819
  if (We && We.pathname === t && e - We.at < _r)
1820
1820
  return We.routes;
@@ -1929,7 +1929,7 @@ function Mr(e) {
1929
1929
  onTeamMemberChange: v,
1930
1930
  idleLoopUrl: w,
1931
1931
  greeting: H,
1932
- avatarImageUrl: I,
1932
+ avatarImageUrl: T,
1933
1933
  agentName: q,
1934
1934
  branding: m = {},
1935
1935
  allowCamera: R = !0,
@@ -1940,31 +1940,31 @@ function Mr(e) {
1940
1940
  pathname: F,
1941
1941
  onNavigate: G,
1942
1942
  onScrollToSelector: ie,
1943
- getPageContext: we,
1943
+ getPageContext: _e,
1944
1944
  pageContextExtras: tt,
1945
1945
  getRoutes: nt,
1946
1946
  onScrollPage: rt,
1947
1947
  onClick: it,
1948
1948
  capabilities: re,
1949
1949
  onConnect: ce,
1950
- onDisconnect: _e,
1950
+ onDisconnect: xe,
1951
1951
  onTranscript: Ne,
1952
1952
  onAgentState: Ae,
1953
1953
  onConnectionStateChange: Re,
1954
1954
  onAgentEvent: Me,
1955
1955
  onAgentCommand: Ie,
1956
- controlledSession: V,
1957
- className: pt,
1958
- style: ht,
1956
+ controlledSession: J,
1957
+ className: ht,
1958
+ style: mt,
1959
1959
  zIndex: ot = 2147483647
1960
1960
  } = e, de = On(F), Te = jn(de, M, B);
1961
1961
  N(() => {
1962
1962
  gr(), xr();
1963
1963
  }, [de]);
1964
- const Fe = C !== void 0, [xe, De] = S(() => {
1964
+ const Fe = C !== void 0, [ke, De] = S(() => {
1965
1965
  var h;
1966
1966
  return C ?? ((h = E == null ? void 0 : E[0]) == null ? void 0 : h.id);
1967
- }), X = Fe ? C : xe, ee = dt(
1967
+ }), X = Fe ? C : ke, ee = ut(
1968
1968
  () => (E == null ? void 0 : E.find((h) => h.id === X)) ?? null,
1969
1969
  [E, X]
1970
1970
  ), Pe = (ee == null ? void 0 : ee.agentId) ?? t, [oe, ue] = Dn({
@@ -1973,10 +1973,10 @@ function Mr(e) {
1973
1973
  onChange: y,
1974
1974
  persistKey: a,
1975
1975
  disablePersistence: x
1976
- }), ke = $n(s), Ue = xn(), te = kn(), le = Sn(), ae = Cn(), pe = En(), [$e, he] = S(!1), [me, je] = S(!1), [Ve, Ye] = S(!1), [ge, ye] = S(!1), [ze, lt] = S(!1), Je = A(G), Oe = A(ie), p = A(rt), Y = A(it), mt = A(we), gt = A(tt), Et = A(nt), yt = A(re), ne = A(null);
1977
- Je.current = G, Oe.current = ie, p.current = rt, Y.current = it, mt.current = we, gt.current = tt, Et.current = nt, yt.current = re;
1976
+ }), Le = $n(s), Ue = xn(), te = kn(), le = Sn(), ae = Cn(), pe = En(), [$e, he] = S(!1), [me, je] = S(!1), [Ve, Ye] = S(!1), [ge, ye] = S(!1), [ze, lt] = S(!1), Je = A(G), Oe = A(ie), p = A(rt), K = A(it), gt = A(_e), yt = A(tt), vt = A(nt), bt = A(re), ne = A(null);
1977
+ Je.current = G, Oe.current = ie, p.current = rt, K.current = it, gt.current = _e, yt.current = tt, vt.current = nt, bt.current = re;
1978
1978
  function ve(h) {
1979
- const d = yt.current;
1979
+ const d = bt.current;
1980
1980
  return d ? d.includes(h) : !0;
1981
1981
  }
1982
1982
  function be(h, d) {
@@ -1986,7 +1986,7 @@ function Mr(e) {
1986
1986
  }
1987
1987
  const Ke = L(
1988
1988
  (h) => {
1989
- var Z, Le, fe, He, Se;
1989
+ var Z, Se, fe, He, we;
1990
1990
  const d = h;
1991
1991
  if (!(!d.type || typeof d.type != "string")) {
1992
1992
  if (Me == null || Me({ eventName: d.type, data: h }), d.type === "navigate") {
@@ -2004,30 +2004,30 @@ function Mr(e) {
2004
2004
  if (Je.current) {
2005
2005
  try {
2006
2006
  Je.current(k);
2007
- } catch (T) {
2007
+ } catch (I) {
2008
2008
  console.warn(
2009
2009
  `[LiveLayer] onNavigate threw for "${k}". Falling back. Error:`,
2010
- T
2010
+ I
2011
2011
  );
2012
2012
  }
2013
2013
  return;
2014
2014
  }
2015
2015
  if (typeof document < "u") {
2016
- const T = document.querySelector(
2016
+ const I = document.querySelector(
2017
2017
  `a[href="${k.replace(/"/g, '\\"')}"]`
2018
2018
  );
2019
- if (T) {
2020
- T.click();
2019
+ if (I) {
2020
+ I.click();
2021
2021
  return;
2022
2022
  }
2023
2023
  }
2024
2024
  if (typeof window < "u" && typeof history < "u")
2025
2025
  try {
2026
2026
  history.pushState({}, "", k), window.dispatchEvent(new PopStateEvent("popstate"));
2027
- } catch (T) {
2027
+ } catch (I) {
2028
2028
  console.warn(
2029
2029
  `[LiveLayer] history.pushState fallback failed for "${k}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
2030
- T
2030
+ I
2031
2031
  );
2032
2032
  }
2033
2033
  return;
@@ -2039,36 +2039,36 @@ function Mr(e) {
2039
2039
  }
2040
2040
  const k = typeof d.selector == "string" ? d.selector : null;
2041
2041
  if (!k) return;
2042
- const T = d.behavior === "instant" ? "instant" : "smooth";
2042
+ const I = d.behavior === "instant" ? "instant" : "smooth";
2043
2043
  if (Oe.current) {
2044
2044
  try {
2045
2045
  Oe.current(
2046
2046
  k,
2047
- T
2047
+ I
2048
2048
  );
2049
- } catch (P) {
2050
- console.warn("[LiveLayer] onScrollToSelector threw.", P);
2049
+ } catch (D) {
2050
+ console.warn("[LiveLayer] onScrollToSelector threw.", D);
2051
2051
  }
2052
2052
  return;
2053
2053
  }
2054
2054
  if (typeof document < "u") {
2055
- let P = null;
2055
+ let D = null;
2056
2056
  try {
2057
- P = document.querySelector(k);
2057
+ D = document.querySelector(k);
2058
2058
  } catch {
2059
2059
  console.warn(
2060
2060
  `[LiveLayer] scroll_to: invalid selector "${k}".`
2061
2061
  );
2062
2062
  return;
2063
2063
  }
2064
- if (!P) {
2064
+ if (!D) {
2065
2065
  console.warn(
2066
2066
  `[LiveLayer] scroll_to: no element matched "${k}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
2067
2067
  );
2068
2068
  return;
2069
2069
  }
2070
- P.scrollIntoView({
2071
- behavior: T,
2070
+ D.scrollIntoView({
2071
+ behavior: I,
2072
2072
  block: "start"
2073
2073
  });
2074
2074
  }
@@ -2079,43 +2079,43 @@ function Mr(e) {
2079
2079
  be("request_page_context", "read_page");
2080
2080
  return;
2081
2081
  }
2082
- const k = typeof d.requestId == "string" ? d.requestId : void 0, T = (Z = ne.current) == null ? void 0 : Z.call(ne), P = (K) => {
2083
- const D = T, j = D == null ? void 0 : D.localParticipant;
2084
- if (j != null && j.publishData)
2082
+ const k = typeof d.requestId == "string" ? d.requestId : void 0, I = (Z = ne.current) == null ? void 0 : Z.call(ne), D = (V) => {
2083
+ const P = I, Y = P == null ? void 0 : P.localParticipant;
2084
+ if (Y != null && Y.publishData)
2085
2085
  try {
2086
- const O = k ? { ...K, requestId: k } : K, Q = new TextEncoder().encode(JSON.stringify(O));
2087
- j.publishData(Q, { reliable: !0 });
2086
+ const O = k ? { ...V, requestId: k } : V, Q = new TextEncoder().encode(JSON.stringify(O));
2087
+ Y.publishData(Q, { reliable: !0 });
2088
2088
  } catch (O) {
2089
2089
  console.warn("[LiveLayer] publishData failed.", O);
2090
2090
  }
2091
- }, $ = gt.current, J = mt.current;
2091
+ }, $ = yt.current, j = gt.current;
2092
2092
  try {
2093
- if (J) {
2094
- const K = J($);
2095
- if (K instanceof Promise) {
2096
- P({ type: "page_context_pending" }), K.then((D) => P({ type: "page_context", context: D })).catch((D) => {
2093
+ if (j) {
2094
+ const V = j($);
2095
+ if (V instanceof Promise) {
2096
+ D({ type: "page_context_pending" }), V.then((P) => D({ type: "page_context", context: P })).catch((P) => {
2097
2097
  console.warn(
2098
2098
  "[LiveLayer] getPageContext rejected; falling back to default walker.",
2099
- D
2100
- ), P({
2099
+ P
2100
+ ), D({
2101
2101
  type: "page_context",
2102
- context: _t($)
2102
+ context: kt($)
2103
2103
  });
2104
2104
  });
2105
2105
  return;
2106
2106
  }
2107
- P({ type: "page_context", context: K });
2107
+ D({ type: "page_context", context: V });
2108
2108
  return;
2109
2109
  }
2110
- P({
2110
+ D({
2111
2111
  type: "page_context",
2112
- context: _t($)
2112
+ context: kt($)
2113
2113
  });
2114
- } catch (K) {
2114
+ } catch (V) {
2115
2115
  console.warn(
2116
2116
  "[LiveLayer] page-context extraction threw. Sending empty context.",
2117
- K
2118
- ), P({
2117
+ V
2118
+ ), D({
2119
2119
  type: "page_context",
2120
2120
  context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: $ }
2121
2121
  });
@@ -2134,25 +2134,25 @@ function Mr(e) {
2134
2134
  );
2135
2135
  return;
2136
2136
  }
2137
- const T = d.behavior === "instant" ? "instant" : "smooth";
2137
+ const I = d.behavior === "instant" ? "instant" : "smooth";
2138
2138
  if (p.current) {
2139
2139
  try {
2140
2140
  p.current(
2141
2141
  k,
2142
- T
2142
+ I
2143
2143
  );
2144
- } catch (D) {
2145
- console.warn("[LiveLayer] onScrollPage threw.", D);
2144
+ } catch (P) {
2145
+ console.warn("[LiveLayer] onScrollPage threw.", P);
2146
2146
  }
2147
2147
  return;
2148
2148
  }
2149
2149
  if (typeof window > "u") return;
2150
- const P = { behavior: T }, $ = Nr(), J = (D) => {
2151
- $ instanceof Window ? $.scrollBy({ top: D, ...P }) : $.scrollBy({ top: D, ...P });
2152
- }, K = (D) => {
2153
- $ instanceof Window ? $.scrollTo({ top: D, ...P }) : $.scrollTo({ top: D, ...P });
2150
+ const D = { behavior: I }, $ = Nr(), j = (P) => {
2151
+ $ instanceof Window ? $.scrollBy({ top: P, ...D }) : $.scrollBy({ top: P, ...D });
2152
+ }, V = (P) => {
2153
+ $ instanceof Window ? $.scrollTo({ top: P, ...D }) : $.scrollTo({ top: P, ...D });
2154
2154
  };
2155
- k === "up" ? J(-Qt($)) : k === "down" ? J(Qt($)) : K(k === "top" ? 0 : Ar($));
2155
+ k === "up" ? j(-Qt($)) : k === "down" ? j(Qt($)) : V(k === "top" ? 0 : Ar($));
2156
2156
  return;
2157
2157
  }
2158
2158
  if (d.type === "click") {
@@ -2165,37 +2165,37 @@ function Mr(e) {
2165
2165
  console.warn("[LiveLayer] click: missing selector.");
2166
2166
  return;
2167
2167
  }
2168
- if (Y.current) {
2168
+ if (K.current) {
2169
2169
  try {
2170
- Y.current(k);
2171
- } catch (P) {
2172
- console.warn("[LiveLayer] onClick threw.", P);
2170
+ K.current(k);
2171
+ } catch (D) {
2172
+ console.warn("[LiveLayer] onClick threw.", D);
2173
2173
  }
2174
2174
  return;
2175
2175
  }
2176
2176
  if (typeof document > "u") return;
2177
- let T = null;
2177
+ let I = null;
2178
2178
  try {
2179
- T = document.querySelector(k);
2179
+ I = document.querySelector(k);
2180
2180
  } catch {
2181
2181
  console.warn(
2182
2182
  `[LiveLayer] click: invalid selector "${k}".`
2183
2183
  );
2184
2184
  return;
2185
2185
  }
2186
- if (!T) {
2186
+ if (!I) {
2187
2187
  console.warn(
2188
2188
  `[LiveLayer] click: no element matched "${k}". See https://livelayer.studio/docs/errors/click-no-match`
2189
2189
  );
2190
2190
  return;
2191
2191
  }
2192
- if (T.closest('[data-ll-private="true"], .ll-widget')) {
2192
+ if (I.closest('[data-ll-private="true"], .ll-widget')) {
2193
2193
  console.warn(
2194
2194
  "[LiveLayer] click: refusing to click element inside a private subtree."
2195
2195
  );
2196
2196
  return;
2197
2197
  }
2198
- (Le = T.click) == null || Le.call(T);
2198
+ (Se = I.click) == null || Se.call(I);
2199
2199
  return;
2200
2200
  }
2201
2201
  if (d.type === "fill_form" || d.type === "focus_field") {
@@ -2204,9 +2204,9 @@ function Mr(e) {
2204
2204
  return;
2205
2205
  }
2206
2206
  if (typeof document > "u") return;
2207
- const k = typeof d.requestId == "string" ? d.requestId : void 0, T = (fe = ne.current) == null ? void 0 : fe.call(ne), P = (O) => {
2207
+ const k = typeof d.requestId == "string" ? d.requestId : void 0, I = (fe = ne.current) == null ? void 0 : fe.call(ne), D = (O) => {
2208
2208
  if (d.type !== "fill_form") return;
2209
- const Q = T, se = Q == null ? void 0 : Q.localParticipant;
2209
+ const Q = I, se = Q == null ? void 0 : Q.localParticipant;
2210
2210
  if (se != null && se.publishData)
2211
2211
  try {
2212
2212
  const Ce = k ? { ...O, requestId: k } : O, hn = new TextEncoder().encode(JSON.stringify(Ce));
@@ -2216,16 +2216,16 @@ function Mr(e) {
2216
2216
  }
2217
2217
  }, $ = typeof d.formId == "string" ? d.formId : null;
2218
2218
  if (!$) {
2219
- console.warn(`[LiveLayer] ${d.type}: missing formId.`), P({ type: "fill_form_result", ok: !1, reason: "missing formId" });
2219
+ console.warn(`[LiveLayer] ${d.type}: missing formId.`), D({ type: "fill_form_result", ok: !1, reason: "missing formId" });
2220
2220
  return;
2221
2221
  }
2222
- const J = document.querySelector(
2222
+ const j = document.querySelector(
2223
2223
  `[data-ll-form="${$.replace(/"/g, '\\"')}"]`
2224
2224
  );
2225
- if (!J) {
2225
+ if (!j) {
2226
2226
  console.warn(
2227
2227
  `[LiveLayer] ${d.type}: no form with data-ll-form="${$}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2228
- ), P({
2228
+ ), D({
2229
2229
  type: "fill_form_result",
2230
2230
  ok: !1,
2231
2231
  reason: `no form with data-ll-form="${$}" on this page`,
@@ -2233,10 +2233,10 @@ function Mr(e) {
2233
2233
  });
2234
2234
  return;
2235
2235
  }
2236
- if (J.closest('[data-ll-private="true"], .ll-widget')) {
2236
+ if (j.closest('[data-ll-private="true"], .ll-widget')) {
2237
2237
  console.warn(
2238
2238
  `[LiveLayer] ${d.type}: refusing to touch a form in a private subtree.`
2239
- ), P({
2239
+ ), D({
2240
2240
  type: "fill_form_result",
2241
2241
  ok: !1,
2242
2242
  reason: "form is in a private subtree (data-ll-private)",
@@ -2250,14 +2250,14 @@ function Mr(e) {
2250
2250
  console.warn("[LiveLayer] focus_field: missing fieldName.");
2251
2251
  return;
2252
2252
  }
2253
- const Q = J.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
2253
+ const Q = j.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
2254
2254
  if (!Q) {
2255
2255
  console.warn(
2256
2256
  `[LiveLayer] focus_field: no field "${O}" in form "${$}".`
2257
2257
  );
2258
2258
  return;
2259
2259
  }
2260
- if (!ft(Q)) {
2260
+ if (!pt(Q)) {
2261
2261
  console.warn(
2262
2262
  `[LiveLayer] focus_field: field "${O}" is privacy-protected and not focusable.`
2263
2263
  );
@@ -2266,9 +2266,9 @@ function Mr(e) {
2266
2266
  Q.focus();
2267
2267
  return;
2268
2268
  }
2269
- const K = d.values && typeof d.values == "object" ? d.values : null;
2270
- if (!K) {
2271
- console.warn("[LiveLayer] fill_form: missing or invalid values."), P({
2269
+ const V = d.values && typeof d.values == "object" ? d.values : null;
2270
+ if (!V) {
2271
+ console.warn("[LiveLayer] fill_form: missing or invalid values."), D({
2272
2272
  type: "fill_form_result",
2273
2273
  ok: !1,
2274
2274
  reason: "missing or invalid values",
@@ -2276,38 +2276,38 @@ function Mr(e) {
2276
2276
  });
2277
2277
  return;
2278
2278
  }
2279
- const D = [], j = [];
2280
- for (const [O, Q] of Object.entries(K)) {
2279
+ const P = [], Y = [];
2280
+ for (const [O, Q] of Object.entries(V)) {
2281
2281
  if (typeof Q != "string") continue;
2282
- const se = J.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
2282
+ const se = j.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
2283
2283
  if (!se) {
2284
2284
  console.warn(
2285
2285
  `[LiveLayer] fill_form: no field "${O}" in form "${$}". Skipping.`
2286
- ), j.push(O);
2286
+ ), Y.push(O);
2287
2287
  continue;
2288
2288
  }
2289
- if (!ft(se)) {
2289
+ if (!pt(se)) {
2290
2290
  console.warn(
2291
2291
  `[LiveLayer] fill_form: field "${O}" is privacy-protected (password / cc-* / private). Skipping.`
2292
- ), j.push(O);
2292
+ ), Y.push(O);
2293
2293
  continue;
2294
2294
  }
2295
2295
  try {
2296
- Lr(se, Q), D.push(O);
2296
+ Lr(se, Q), P.push(O);
2297
2297
  } catch (Ce) {
2298
2298
  console.warn(
2299
2299
  `[LiveLayer] fill_form: failed to set "${O}".`,
2300
2300
  Ce
2301
- ), j.push(O);
2301
+ ), Y.push(O);
2302
2302
  }
2303
2303
  }
2304
- P({
2304
+ D({
2305
2305
  type: "fill_form_result",
2306
- ok: D.length > 0,
2306
+ ok: P.length > 0,
2307
2307
  formId: $,
2308
- filled: D,
2309
- skipped: j,
2310
- reason: D.length === 0 ? `none of the requested fields exist on this form (skipped: ${j.join(", ")})` : void 0
2308
+ filled: P,
2309
+ skipped: Y,
2310
+ reason: P.length === 0 ? `none of the requested fields exist on this form (skipped: ${Y.join(", ")})` : void 0
2311
2311
  });
2312
2312
  return;
2313
2313
  }
@@ -2322,39 +2322,39 @@ function Mr(e) {
2322
2322
  console.warn("[LiveLayer] submit_form: missing formId.");
2323
2323
  return;
2324
2324
  }
2325
- const T = document.querySelector(
2325
+ const I = document.querySelector(
2326
2326
  `[data-ll-form="${k.replace(/"/g, '\\"')}"]`
2327
2327
  );
2328
- if (!T) {
2328
+ if (!I) {
2329
2329
  console.warn(
2330
2330
  `[LiveLayer] submit_form: no form with data-ll-form="${k}".`
2331
2331
  );
2332
2332
  return;
2333
2333
  }
2334
- if (T.closest('[data-ll-private="true"], .ll-widget')) {
2334
+ if (I.closest('[data-ll-private="true"], .ll-widget')) {
2335
2335
  console.warn(
2336
2336
  "[LiveLayer] submit_form: refusing to submit a form in a private subtree."
2337
2337
  );
2338
2338
  return;
2339
2339
  }
2340
- const P = typeof d.requestId == "string" ? d.requestId : void 0, $ = (He = ne.current) == null ? void 0 : He.call(ne), J = (j) => {
2340
+ const D = typeof d.requestId == "string" ? d.requestId : void 0, $ = (He = ne.current) == null ? void 0 : He.call(ne), j = (Y) => {
2341
2341
  const O = $, Q = O == null ? void 0 : O.localParticipant;
2342
2342
  if (Q != null && Q.publishData)
2343
2343
  try {
2344
- const se = P ? { ...j, requestId: P } : j, Ce = new TextEncoder().encode(JSON.stringify(se));
2344
+ const se = D ? { ...Y, requestId: D } : Y, Ce = new TextEncoder().encode(JSON.stringify(se));
2345
2345
  Q.publishData(Ce, { reliable: !0 });
2346
2346
  } catch {
2347
2347
  }
2348
2348
  };
2349
- let K = !1;
2350
- const D = () => {
2351
- K = !0, J({ type: "form_submitted", formId: k });
2349
+ let V = !1;
2350
+ const P = () => {
2351
+ V = !0, j({ type: "form_submitted", formId: k });
2352
2352
  };
2353
- T.addEventListener("submit", D, { once: !0 });
2353
+ I.addEventListener("submit", P, { once: !0 });
2354
2354
  try {
2355
- typeof T.requestSubmit == "function" ? T.requestSubmit() : T.submit();
2356
- } catch (j) {
2357
- console.warn("[LiveLayer] submit_form: requestSubmit threw.", j), T.removeEventListener("submit", D), J({
2355
+ typeof I.requestSubmit == "function" ? I.requestSubmit() : I.submit();
2356
+ } catch (Y) {
2357
+ console.warn("[LiveLayer] submit_form: requestSubmit threw.", Y), I.removeEventListener("submit", P), j({
2358
2358
  type: "form_submit_blocked",
2359
2359
  formId: k,
2360
2360
  reason: "exception"
@@ -2362,7 +2362,7 @@ function Mr(e) {
2362
2362
  return;
2363
2363
  }
2364
2364
  setTimeout(() => {
2365
- K || (T.removeEventListener("submit", D), J({
2365
+ V || (I.removeEventListener("submit", P), j({
2366
2366
  type: "form_submit_blocked",
2367
2367
  formId: k,
2368
2368
  reason: "validation"
@@ -2375,43 +2375,43 @@ function Mr(e) {
2375
2375
  be("request_routes", "read_page");
2376
2376
  return;
2377
2377
  }
2378
- const k = typeof d.requestId == "string" ? d.requestId : void 0, P = (Se = ne.current) == null ? void 0 : Se.call(ne), $ = P == null ? void 0 : P.localParticipant;
2378
+ const k = typeof d.requestId == "string" ? d.requestId : void 0, D = (we = ne.current) == null ? void 0 : we.call(ne), $ = D == null ? void 0 : D.localParticipant;
2379
2379
  if (!($ != null && $.publishData)) return;
2380
- const J = (D) => {
2380
+ const j = (P) => {
2381
2381
  try {
2382
- const j = k ? { type: "routes", routes: D, requestId: k } : { type: "routes", routes: D }, O = new TextEncoder().encode(JSON.stringify(j));
2382
+ const Y = k ? { type: "routes", routes: P, requestId: k } : { type: "routes", routes: P }, O = new TextEncoder().encode(JSON.stringify(Y));
2383
2383
  $.publishData(O, { reliable: !0 });
2384
- } catch (j) {
2385
- console.warn("[LiveLayer] request_routes: publishData failed.", j);
2384
+ } catch (Y) {
2385
+ console.warn("[LiveLayer] request_routes: publishData failed.", Y);
2386
2386
  }
2387
- }, K = Et.current;
2388
- if (K) {
2387
+ }, V = vt.current;
2388
+ if (V) {
2389
2389
  try {
2390
- const D = K(), j = (O) => {
2390
+ const P = V(), Y = (O) => {
2391
2391
  if (!Array.isArray(O)) {
2392
- J([]);
2392
+ j([]);
2393
2393
  return;
2394
2394
  }
2395
- J(O.map(vr).slice(0, 200));
2395
+ j(O.map(vr).slice(0, 200));
2396
2396
  };
2397
- D instanceof Promise ? D.then(j).catch((O) => {
2397
+ P instanceof Promise ? P.then(Y).catch((O) => {
2398
2398
  console.warn(
2399
2399
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
2400
2400
  O
2401
- ), J(xt());
2402
- }) : j(D);
2403
- } catch (D) {
2401
+ ), j(dt());
2402
+ }) : Y(P);
2403
+ } catch (P) {
2404
2404
  console.warn(
2405
2405
  "[LiveLayer] getRoutes threw; falling back to DOM walker.",
2406
- D
2407
- ), J(xt());
2406
+ P
2407
+ ), j(dt());
2408
2408
  }
2409
2409
  return;
2410
2410
  }
2411
2411
  try {
2412
- J(xt());
2413
- } catch (D) {
2414
- console.warn("[LiveLayer] request_routes: extractRoutes threw.", D);
2412
+ j(dt());
2413
+ } catch (P) {
2414
+ console.warn("[LiveLayer] request_routes: extractRoutes threw.", P);
2415
2415
  }
2416
2416
  return;
2417
2417
  }
@@ -2420,23 +2420,23 @@ function Mr(e) {
2420
2420
  },
2421
2421
  [Ie, Me]
2422
2422
  ), U = _n({
2423
- agentId: V ? "__controlled__" : Pe,
2423
+ agentId: J ? "__controlled__" : Pe,
2424
2424
  baseUrl: i,
2425
2425
  apiKey: r,
2426
2426
  sessionEndpoint: o,
2427
2427
  sessionBody: l,
2428
- onDataMessage: V ? void 0 : Ke
2428
+ onDataMessage: J ? void 0 : Ke
2429
2429
  });
2430
2430
  N(() => {
2431
- if (V != null && V.subscribeToDataMessages)
2432
- return V.subscribeToDataMessages(Ke);
2433
- }, [V, Ke]), ne.current = () => {
2431
+ if (J != null && J.subscribeToDataMessages)
2432
+ return J.subscribeToDataMessages(Ke);
2433
+ }, [J, Ke]), ne.current = () => {
2434
2434
  var h;
2435
2435
  return (h = U.getRoom) == null ? void 0 : h.call(U);
2436
2436
  }, N(() => {
2437
- var Le;
2437
+ var Se;
2438
2438
  if (!de) return;
2439
- const h = (Le = U.getRoom) == null ? void 0 : Le.call(U), d = h == null ? void 0 : h.localParticipant;
2439
+ const h = (Se = U.getRoom) == null ? void 0 : Se.call(U), d = h == null ? void 0 : h.localParticipant;
2440
2440
  if (!(d != null && d.publishData)) return;
2441
2441
  try {
2442
2442
  const fe = new TextEncoder().encode(
@@ -2445,15 +2445,33 @@ function Mr(e) {
2445
2445
  d.publishData(fe, { reliable: !0 });
2446
2446
  } catch {
2447
2447
  }
2448
- const Z = setTimeout(() => {
2448
+ const Z = setTimeout(async () => {
2449
2449
  var fe;
2450
2450
  try {
2451
- const He = (fe = U.getRoom) == null ? void 0 : fe.call(U), Se = He == null ? void 0 : He.localParticipant;
2452
- if (!(Se != null && Se.publishData)) return;
2453
- const k = _t(gt.current), T = new TextEncoder().encode(
2454
- JSON.stringify({ type: "page_context_push", pathname: de, context: k })
2455
- );
2456
- Se.publishData(T, { reliable: !0 });
2451
+ const He = (fe = U.getRoom) == null ? void 0 : fe.call(U), we = He == null ? void 0 : He.localParticipant;
2452
+ if (!(we != null && we.publishData)) return;
2453
+ const k = kt(yt.current);
2454
+ try {
2455
+ const I = new TextEncoder().encode(
2456
+ JSON.stringify({ type: "page_context_push", pathname: de, context: k })
2457
+ );
2458
+ we.publishData(I, { reliable: !0 });
2459
+ } catch {
2460
+ }
2461
+ try {
2462
+ const I = vt.current;
2463
+ let D = [];
2464
+ if (I) {
2465
+ const j = I(), V = j instanceof Promise ? await j : j;
2466
+ D = Array.isArray(V) ? V.slice(0, 200) : [];
2467
+ } else
2468
+ D = dt();
2469
+ const $ = new TextEncoder().encode(
2470
+ JSON.stringify({ type: "routes_push", routes: D })
2471
+ );
2472
+ we.publishData($, { reliable: !0 });
2473
+ } catch {
2474
+ }
2457
2475
  } catch {
2458
2476
  }
2459
2477
  }, 250);
@@ -2463,9 +2481,9 @@ function Mr(e) {
2463
2481
  if (typeof window > "u") return;
2464
2482
  const h = ((Z = window.location) == null ? void 0 : Z.hostname) || "";
2465
2483
  if (h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h.endsWith(".local") || h.endsWith(".test"))
2466
- return window.__livelayerSimulateCommand = (Le) => {
2484
+ return window.__livelayerSimulateCommand = (Se) => {
2467
2485
  try {
2468
- Ke(Le);
2486
+ Ke(Se);
2469
2487
  } catch (fe) {
2470
2488
  console.warn("[LiveLayer] simulate-command threw:", fe);
2471
2489
  }
@@ -2473,19 +2491,19 @@ function Mr(e) {
2473
2491
  delete window.__livelayerSimulateCommand;
2474
2492
  };
2475
2493
  }, [Ke]);
2476
- const g = dt(() => V ? {
2477
- connectionState: V.connectionState,
2478
- agentState: V.agentState,
2479
- transcript: V.transcript,
2480
- videoElement: V.videoElement,
2481
- audioElement: V.audioElement,
2482
- canResume: V.canResume,
2483
- error: V.error,
2494
+ const g = ut(() => J ? {
2495
+ connectionState: J.connectionState,
2496
+ agentState: J.agentState,
2497
+ transcript: J.transcript,
2498
+ videoElement: J.videoElement,
2499
+ audioElement: J.audioElement,
2500
+ canResume: J.canResume,
2501
+ error: J.error,
2484
2502
  agentConfig: null,
2485
2503
  connect: async () => {
2486
- await V.onConnect();
2504
+ await J.onConnect();
2487
2505
  },
2488
- disconnect: () => V.onDisconnect(),
2506
+ disconnect: () => J.onDisconnect(),
2489
2507
  // Dummy getRoom for shape compatibility — controlled consumers own the Room.
2490
2508
  // Internal session's getRoom returns null when no real connect has happened,
2491
2509
  // so we reuse its reference for type consistency.
@@ -2504,7 +2522,7 @@ function Mr(e) {
2504
2522
  disconnect: U.disconnect,
2505
2523
  getRoom: U.getRoom,
2506
2524
  isControlled: !1
2507
- }, [V, U]), Nt = A(null);
2525
+ }, [J, U]), Nt = A(null);
2508
2526
  N(() => {
2509
2527
  const h = g.videoElement, d = Nt.current;
2510
2528
  if (!(!h || !d))
@@ -2530,17 +2548,17 @@ function Mr(e) {
2530
2548
  te.teardownMic(), le.teardown(), ae.teardown();
2531
2549
  };
2532
2550
  }, [g.isControlled, g.connectionState]);
2533
- const [Xe, vt] = S(!1), bt = A("idle");
2551
+ const [Xe, wt] = S(!1), _t = A("idle");
2534
2552
  N(() => {
2535
2553
  if (g.connectionState === "idle" || g.connectionState === "disconnected") {
2536
- vt(!1), bt.current = "idle";
2554
+ wt(!1), _t.current = "idle";
2537
2555
  return;
2538
2556
  }
2539
- !Xe && bt.current === "speaking" && g.agentState !== "speaking" && (vt(!0), te.setMuted(!1)), bt.current = g.agentState;
2557
+ !Xe && _t.current === "speaking" && g.agentState !== "speaking" && (wt(!0), te.setMuted(!1)), _t.current = g.agentState;
2540
2558
  }, [g.agentState, g.connectionState, Xe]), N(() => {
2541
2559
  if (g.connectionState !== "connected" || Xe) return;
2542
2560
  const h = setTimeout(() => {
2543
- vt(!0), te.setMuted(!1);
2561
+ wt(!0), te.setMuted(!1);
2544
2562
  }, 4e3);
2545
2563
  return () => clearTimeout(h);
2546
2564
  }, [g.connectionState, Xe]), N(() => {
@@ -2561,8 +2579,8 @@ function Mr(e) {
2561
2579
  lt((h) => !h);
2562
2580
  }, []);
2563
2581
  N(() => {
2564
- Re == null || Re(g.connectionState), g.connectionState === "connected" ? ce == null || ce() : g.connectionState === "disconnected" && (_e == null || _e());
2565
- }, [g.connectionState, ce, _e, Re]), N(() => {
2582
+ Re == null || Re(g.connectionState), g.connectionState === "connected" ? ce == null || ce() : g.connectionState === "disconnected" && (xe == null || xe());
2583
+ }, [g.connectionState, ce, xe, Re]), N(() => {
2566
2584
  Ne == null || Ne(g.transcript);
2567
2585
  }, [g.transcript, Ne]), N(() => {
2568
2586
  Ae == null || Ae(g.agentState);
@@ -2593,9 +2611,9 @@ function Mr(e) {
2593
2611
  };
2594
2612
  return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
2595
2613
  }, [Ve]);
2596
- const ln = !!I || !!(ee != null && ee.avatarImageUrl) || g.isControlled, Ge = Nn(Pe, i, ln);
2597
- re === void 0 && ((Mt = Ge.info) != null && Mt.capabilities) && (yt.current = Ge.info.capabilities);
2598
- const at = (ee == null ? void 0 : ee.name) ?? q ?? ((It = g.agentConfig) == null ? void 0 : It.name) ?? ((Tt = Ge.info) == null ? void 0 : Tt.name) ?? "Live Layer", wt = (ee == null ? void 0 : ee.avatarImageUrl) ?? I ?? ((Dt = g.agentConfig) == null ? void 0 : Dt.avatarImageUrl) ?? ((Pt = Ge.info) == null ? void 0 : Pt.avatarImageUrl) ?? null, an = w ?? (($t = g.agentConfig) == null ? void 0 : $t.idleLoopUrl) ?? ((zt = Ge.info) == null ? void 0 : zt.idleLoopUrl) ?? null, sn = H ?? null, cn = L(() => ue("expanded"), [ue]), dn = L(
2614
+ const ln = !!T || !!(ee != null && ee.avatarImageUrl) || g.isControlled, Ge = Nn(Pe, i, ln);
2615
+ re === void 0 && ((Mt = Ge.info) != null && Mt.capabilities) && (bt.current = Ge.info.capabilities);
2616
+ const at = (ee == null ? void 0 : ee.name) ?? q ?? ((It = g.agentConfig) == null ? void 0 : It.name) ?? ((Tt = Ge.info) == null ? void 0 : Tt.name) ?? "Live Layer", xt = (ee == null ? void 0 : ee.avatarImageUrl) ?? T ?? ((Dt = g.agentConfig) == null ? void 0 : Dt.avatarImageUrl) ?? ((Pt = Ge.info) == null ? void 0 : Pt.avatarImageUrl) ?? null, an = w ?? (($t = g.agentConfig) == null ? void 0 : $t.idleLoopUrl) ?? ((zt = Ge.info) == null ? void 0 : zt.idleLoopUrl) ?? null, sn = H ?? null, cn = L(() => ue("expanded"), [ue]), dn = L(
2599
2617
  () => ue("minimized"),
2600
2618
  [ue]
2601
2619
  ), Rt = L(() => {
@@ -2607,15 +2625,15 @@ function Mr(e) {
2607
2625
  }, [g.audioElement]), fn = L(() => {
2608
2626
  he(!1), g.connect();
2609
2627
  }, [g]), Qe = {
2610
- ...ht,
2628
+ ...mt,
2611
2629
  zIndex: ot
2612
2630
  };
2613
2631
  m.primaryColor && (Qe["--ll-color-primary"] = m.primaryColor), m.accentColor && (Qe["--ll-color-accent"] = m.accentColor), m.backgroundColor && (Qe["--ll-color-bg"] = m.backgroundColor), m.textColor && (Qe["--ll-color-fg"] = m.textColor);
2614
2632
  const pn = [
2615
2633
  "ll-widget",
2616
2634
  `ll-widget--${oe}`,
2617
- `ll-widget--${ke ? "mobile" : "desktop"}`,
2618
- pt
2635
+ `ll-widget--${Le ? "mobile" : "desktop"}`,
2636
+ ht
2619
2637
  ].filter(Boolean).join(" ");
2620
2638
  return Te ? /* @__PURE__ */ _(
2621
2639
  "div",
@@ -2629,11 +2647,11 @@ function Mr(e) {
2629
2647
  Gn,
2630
2648
  {
2631
2649
  position: b,
2632
- isMobile: ke,
2650
+ isMobile: Le,
2633
2651
  isSpeaking: g.agentState === "speaking",
2634
2652
  onExpand: () => ue("expanded"),
2635
2653
  label: `Open ${at} widget`,
2636
- avatarImageUrl: wt,
2654
+ avatarImageUrl: xt,
2637
2655
  agentName: at
2638
2656
  }
2639
2657
  ),
@@ -2641,9 +2659,9 @@ function Mr(e) {
2641
2659
  Zn,
2642
2660
  {
2643
2661
  position: b,
2644
- isMobile: ke,
2662
+ isMobile: Le,
2645
2663
  agentName: at,
2646
- avatarImageUrl: wt,
2664
+ avatarImageUrl: xt,
2647
2665
  agentState: g.agentState,
2648
2666
  isMuted: te.isMuted,
2649
2667
  audioLevel: Ue,
@@ -2656,9 +2674,9 @@ function Mr(e) {
2656
2674
  tr,
2657
2675
  {
2658
2676
  position: b,
2659
- isMobile: ke,
2677
+ isMobile: Le,
2660
2678
  agentName: at,
2661
- avatarImageUrl: wt,
2679
+ avatarImageUrl: xt,
2662
2680
  idleLoopUrl: an,
2663
2681
  greeting: sn,
2664
2682
  branding: m,
@@ -2740,7 +2758,7 @@ const qr = ({
2740
2758
  }, [e]), N(() => {
2741
2759
  f.current && (i ? f.current.setAttribute("mode", i) : f.current.removeAttribute("mode"));
2742
2760
  }, [i]), /* @__PURE__ */ n("div", { ref: u, className: l, style: c });
2743
- }, Br = St(
2761
+ }, Br = Ct(
2744
2762
  function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, u) {
2745
2763
  return gn(
2746
2764
  i,
@@ -2754,7 +2772,7 @@ const qr = ({
2754
2772
  c
2755
2773
  );
2756
2774
  }
2757
- ), Wr = St(
2775
+ ), Wr = Ct(
2758
2776
  function({ id: t, intent: r, children: i, ...o }, l) {
2759
2777
  return /* @__PURE__ */ n(
2760
2778
  "form",
@@ -2767,7 +2785,7 @@ const qr = ({
2767
2785
  }
2768
2786
  );
2769
2787
  }
2770
- ), Fr = St(
2788
+ ), Fr = Ct(
2771
2789
  function(t, r) {
2772
2790
  const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
2773
2791
  let u;
@@ -2854,13 +2872,13 @@ function Ur({
2854
2872
  });
2855
2873
  }));
2856
2874
  }, [e]), N(() => {
2857
- const v = console.warn, w = console.log, H = (I, q) => function(...m) {
2875
+ const v = console.warn, w = console.log, H = (T, q) => function(...m) {
2858
2876
  try {
2859
2877
  const R = typeof m[0] == "string" ? m[0] : "";
2860
2878
  R.startsWith("[LiveLayer]") && a.current.push({
2861
2879
  id: Zt++,
2862
2880
  ts: Date.now(),
2863
- kind: I,
2881
+ kind: T,
2864
2882
  type: R.slice(0, 120),
2865
2883
  data: { args: m.slice(1).map((W) => Tr(W)) }
2866
2884
  });
@@ -2949,7 +2967,7 @@ function Ur({
2949
2967
  {
2950
2968
  type: "button",
2951
2969
  onClick: () => b((v) => !v),
2952
- style: kt(y ? "#f59e0b" : "transparent"),
2970
+ style: Lt(y ? "#f59e0b" : "transparent"),
2953
2971
  title: "Pause / resume capture",
2954
2972
  children: y ? "▶ resume" : "⏸ pause"
2955
2973
  }
@@ -2961,7 +2979,7 @@ function Ur({
2961
2979
  onClick: () => {
2962
2980
  c([]), a.current = [];
2963
2981
  },
2964
- style: kt("transparent"),
2982
+ style: Lt("transparent"),
2965
2983
  title: "Clear buffer",
2966
2984
  children: "clear"
2967
2985
  }
@@ -2971,7 +2989,7 @@ function Ur({
2971
2989
  {
2972
2990
  type: "button",
2973
2991
  onClick: () => o(!1),
2974
- style: kt("transparent"),
2992
+ style: Lt("transparent"),
2975
2993
  "aria-label": "Close",
2976
2994
  title: "Close (Cmd/Ctrl + Shift + L)",
2977
2995
  children: "✕"
@@ -3124,7 +3142,7 @@ function Ir({
3124
3142
  }
3125
3143
  );
3126
3144
  }
3127
- function kt(e) {
3145
+ function Lt(e) {
3128
3146
  return {
3129
3147
  background: e,
3130
3148
  color: "#fff",
@@ -3172,8 +3190,8 @@ export {
3172
3190
  xr as clearRoutesCache,
3173
3191
  mr as extractPageContext,
3174
3192
  wr as extractRoutes,
3175
- _t as getCachedPageContext,
3176
- xt as getCachedRoutes,
3193
+ kt as getCachedPageContext,
3194
+ dt as getCachedRoutes,
3177
3195
  Fn as matchesPattern,
3178
3196
  vr as normalizeRouteInput,
3179
3197
  Un as shouldRenderAtPath,