@livelayer/react 0.5.19 → 0.5.20

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 wt } from "react/jsx-runtime";
3
- import { Component as yn, useState as L, useRef as E, useEffect as A, useCallback as k, useMemo as st, forwardRef as _t, createElement as vn } from "react";
2
+ import { jsxs as _, jsx as n, Fragment as _t } from "react/jsx-runtime";
3
+ import { Component as yn, useState as L, useRef as E, useEffect as A, useCallback as k, useMemo as ct, forwardRef as xt, createElement as vn } from "react";
4
4
  import { LiveKitSession as bn } from "@livelayer/sdk";
5
5
  import { createLocalAudioTrack as wn, Track as nn, createLocalVideoTrack as _n } from "livekit-client";
6
6
  class xn extends yn {
@@ -34,14 +34,14 @@ class xn extends yn {
34
34
  }
35
35
  }
36
36
  function kn(e) {
37
- const [t, r] = L("idle"), [i, o] = L("idle"), [l, d] = L([]), [u, f] = L(null), [y, b] = L(null), [s, a] = L(null), [x, N] = L(!1), [C, v] = L(null), w = E(null), O = E(e.onDataMessage);
37
+ const [t, r] = L("idle"), [i, o] = L("idle"), [l, c] = L([]), [u, f] = L(null), [y, b] = L(null), [s, a] = L(null), [x, N] = L(!1), [C, v] = L(null), w = E(null), O = E(e.onDataMessage);
38
38
  O.current = e.onDataMessage, A(() => {
39
39
  const R = {
40
40
  onConnectionStateChange: (z) => {
41
41
  r(z), z === "connected" && v(null);
42
42
  },
43
43
  onAgentStateChange: o,
44
- onTranscript: (z) => d([...z]),
44
+ onTranscript: (z) => c([...z]),
45
45
  onAgentConfig: f,
46
46
  onAudioTrack: (z) => a(z),
47
47
  onVideoTrack: (z) => b(z),
@@ -62,7 +62,7 @@ function kn(e) {
62
62
  },
63
63
  R
64
64
  );
65
- return w.current = W, r("idle"), o("idle"), d([]), f(null), b(null), a(null), N(!1), v(null), () => {
65
+ return w.current = W, r("idle"), o("idle"), c([]), f(null), b(null), a(null), N(!1), v(null), () => {
66
66
  var z;
67
67
  (z = W.destroy) == null || z.call(W), w.current = null;
68
68
  };
@@ -104,7 +104,7 @@ function kn(e) {
104
104
  };
105
105
  }
106
106
  function Ln() {
107
- const e = E(null), t = E(null), r = E(null), i = E(null), o = E(/* @__PURE__ */ new Set()), l = E(null), d = k(() => {
107
+ const e = E(null), t = E(null), r = E(null), i = E(null), o = E(/* @__PURE__ */ new Set()), l = E(null), c = k(() => {
108
108
  const s = t.current;
109
109
  if (!s) {
110
110
  i.current = null;
@@ -124,7 +124,7 @@ function Ln() {
124
124
  } catch (v) {
125
125
  console.error("[useAudioLevel] subscriber threw:", v);
126
126
  }
127
- i.current = requestAnimationFrame(d);
127
+ i.current = requestAnimationFrame(c);
128
128
  }, []), u = k(() => {
129
129
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
130
  const s = new AudioContext(), a = s.createAnalyser();
@@ -146,10 +146,10 @@ function Ln() {
146
146
  console.warn("[useAudioLevel] createMediaElementSource failed:", a);
147
147
  return;
148
148
  }
149
- i.current === null && (i.current = requestAnimationFrame(d));
149
+ i.current === null && (i.current = requestAnimationFrame(c));
150
150
  }
151
151
  },
152
- [u, d]
152
+ [u, c]
153
153
  ), y = k(() => {
154
154
  if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
155
155
  try {
@@ -180,7 +180,7 @@ function Ln() {
180
180
  }, [y]), { attach: f, detach: y, subscribe: b };
181
181
  }
182
182
  function Sn() {
183
- const [e, t] = L(!1), [r, i] = L(null), o = E(null), l = E(null), d = k(
183
+ const [e, t] = L(!1), [r, i] = L(null), o = E(null), l = E(null), c = k(
184
184
  async (s, a) => {
185
185
  if (o.current && l.current) {
186
186
  try {
@@ -224,14 +224,14 @@ function Sn() {
224
224
  micError: r,
225
225
  toggleMute: u,
226
226
  setMuted: f,
227
- setupMic: d,
227
+ setupMic: c,
228
228
  teardownMic: y,
229
229
  clearError: b
230
230
  };
231
231
  }
232
232
  const Cn = { resolution: { width: 640, height: 480, frameRate: 24 } };
233
233
  function En() {
234
- const [e, t] = L(!1), [r, i] = L(null), [o, l] = L(null), [d, u] = L(""), f = E(null), y = E(null), b = k((w) => {
234
+ const [e, t] = L(!1), [r, i] = L(null), [o, l] = L(null), [c, u] = L(""), f = E(null), y = E(null), b = k((w) => {
235
235
  f.current = w;
236
236
  }, []), s = k(() => {
237
237
  const w = f.current, O = y.current;
@@ -271,8 +271,8 @@ function En() {
271
271
  }
272
272
  }
273
273
  }, []), x = k(async () => {
274
- e ? s() : await a(d || void 0);
275
- }, [e, d, s, a]), N = k(async (w) => {
274
+ e ? s() : await a(c || void 0);
275
+ }, [e, c, s, a]), N = k(async (w) => {
276
276
  s(), await a(w);
277
277
  }, [s, a]), C = k(() => {
278
278
  s(), f.current = null, i(null), u("");
@@ -283,7 +283,7 @@ function En() {
283
283
  isEnabled: e,
284
284
  error: r,
285
285
  previewEl: o,
286
- activeDeviceId: d,
286
+ activeDeviceId: c,
287
287
  toggle: x,
288
288
  switchDevice: N,
289
289
  attachRoom: b,
@@ -292,10 +292,10 @@ function En() {
292
292
  };
293
293
  }
294
294
  function Nn() {
295
- const [e, t] = L(!1), [r, i] = L(null), [o, l] = L(null), d = E(null), u = k((a) => {
296
- d.current = a;
295
+ const [e, t] = L(!1), [r, i] = L(null), [o, l] = L(null), c = E(null), u = k((a) => {
296
+ c.current = a;
297
297
  }, []), f = k(() => l(null), []), y = k(async () => {
298
- const a = d.current;
298
+ const a = c.current;
299
299
  if (a) {
300
300
  if (e) {
301
301
  try {
@@ -332,13 +332,13 @@ function Nn() {
332
332
  }
333
333
  }
334
334
  }, [e, f]), b = k(() => {
335
- const a = d.current;
335
+ const a = c.current;
336
336
  if (a && e)
337
337
  try {
338
338
  a.localParticipant.setScreenShareEnabled(!1);
339
339
  } catch {
340
340
  }
341
- f(), t(!1), i(null), d.current = null;
341
+ f(), t(!1), i(null), c.current = null;
342
342
  }, [e, f]), s = k(() => i(null), []);
343
343
  return { isEnabled: e, error: r, previewEl: o, toggle: y, attachRoom: u, teardown: b, clearError: s };
344
344
  }
@@ -347,7 +347,7 @@ function An() {
347
347
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
348
348
  try {
349
349
  const l = await navigator.mediaDevices.enumerateDevices();
350
- t(l.filter((d) => d.kind === "audioinput")), i(l.filter((d) => d.kind === "videoinput"));
350
+ t(l.filter((c) => c.kind === "audioinput")), i(l.filter((c) => c.kind === "videoinput"));
351
351
  } catch {
352
352
  }
353
353
  }, []);
@@ -358,14 +358,14 @@ function An() {
358
358
  }, [o]), { mics: e, cameras: r, refresh: o };
359
359
  }
360
360
  function Rn(e, t, r = !1) {
361
- const [i, o] = L(null), [l, d] = L(null), [u, f] = L(!r && !!e);
361
+ const [i, o] = L(null), [l, c] = L(null), [u, f] = L(!r && !!e);
362
362
  return A(() => {
363
363
  if (r || !e) {
364
364
  f(!1);
365
365
  return;
366
366
  }
367
367
  const y = new AbortController(), b = t || "https://app.livelayer.studio";
368
- return f(!0), d(null), fetch(`${b}/api/widget/agent/${encodeURIComponent(e)}`, {
368
+ return f(!0), c(null), fetch(`${b}/api/widget/agent/${encodeURIComponent(e)}`, {
369
369
  signal: y.signal
370
370
  }).then(async (s) => {
371
371
  if (!s.ok) {
@@ -376,7 +376,7 @@ function Rn(e, t, r = !1) {
376
376
  }).then((s) => {
377
377
  y.signal.aborted || (o(s), f(!1));
378
378
  }).catch((s) => {
379
- y.signal.aborted || (d(s instanceof Error ? s.message : "Agent lookup failed"), f(!1));
379
+ y.signal.aborted || (c(s instanceof Error ? s.message : "Agent lookup failed"), f(!1));
380
380
  }), () => y.abort();
381
381
  }, [e, t, r]), { info: i, error: l, loading: u };
382
382
  }
@@ -400,13 +400,13 @@ function Tn({
400
400
  defaultValue: t = "expanded",
401
401
  onChange: r
402
402
  } = {}) {
403
- const i = e !== void 0, [o, l] = L(t), d = i ? e : o, u = k(
403
+ const i = e !== void 0, [o, l] = L(t), c = i ? e : o, u = k(
404
404
  (f) => {
405
- f !== d && (i || l(f), r == null || r(f));
405
+ f !== c && (i || l(f), r == null || r(f));
406
406
  },
407
- [d, i, r]
407
+ [c, i, r]
408
408
  );
409
- return [d, u];
409
+ return [c, u];
410
410
  }
411
411
  const Pn = ["hidden", "minimized", "expanded"];
412
412
  function Dn(e) {
@@ -419,7 +419,7 @@ function $n({
419
419
  persistKey: i = "ll-widget",
420
420
  disablePersistence: o = !1
421
421
  } = {}) {
422
- const l = `${i}:display-mode`, d = E(!1), [u, f] = Tn({
422
+ const l = `${i}:display-mode`, c = E(!1), [u, f] = Tn({
423
423
  value: e,
424
424
  defaultValue: t,
425
425
  onChange: (y) => {
@@ -427,7 +427,7 @@ function $n({
427
427
  }
428
428
  });
429
429
  return A(() => {
430
- if (d.current || (d.current = !0, o || e !== void 0)) return;
430
+ if (c.current || (c.current = !0, o || e !== void 0)) return;
431
431
  const y = Dn(Mn(l));
432
432
  y && y !== u && f(y);
433
433
  }, []), [u, f];
@@ -448,16 +448,16 @@ function Hn(e = zn) {
448
448
  });
449
449
  }, [e]), t;
450
450
  }
451
- const Ot = "__llHistoryPatched", ct = "ll:pathname";
451
+ const Ot = "__llHistoryPatched", dt = "ll:pathname";
452
452
  function On() {
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(ct)), i;
457
+ return window.dispatchEvent(new Event(dt)), i;
458
458
  }, window.history.replaceState = function(...r) {
459
459
  const i = t.apply(this, r);
460
- return window.dispatchEvent(new Event(ct)), i;
460
+ return window.dispatchEvent(new Event(dt)), i;
461
461
  }, window.history[Ot] = !0;
462
462
  }
463
463
  function qt() {
@@ -471,8 +471,8 @@ function qn(e) {
471
471
  if (e !== void 0) return;
472
472
  On();
473
473
  const i = () => r(qt());
474
- return i(), window.addEventListener("popstate", i), window.addEventListener(ct, i), () => {
475
- window.removeEventListener("popstate", i), window.removeEventListener(ct, i);
474
+ return i(), window.addEventListener("popstate", i), window.addEventListener(dt, i), () => {
475
+ window.removeEventListener("popstate", i), window.removeEventListener(dt, i);
476
476
  };
477
477
  }, [e]), e ?? t;
478
478
  }
@@ -503,7 +503,7 @@ function Vn(e, t, r) {
503
503
  return e === void 0 ? !0 : Wt(r, e) ? !1 : t && t.length > 0 ? Wt(t, e) : !0;
504
504
  }
505
505
  function Yn(e, t, r) {
506
- return st(
506
+ return ct(
507
507
  () => Vn(e, t, r),
508
508
  [e, t, r]
509
509
  );
@@ -630,7 +630,7 @@ const Zn = ({
630
630
  onExpand: i,
631
631
  label: o = "Open widget",
632
632
  avatarImageUrl: l,
633
- agentName: d
633
+ agentName: c
634
634
  }) => {
635
635
  const u = Xn(e), f = u === "right" ? "left" : "right", y = t ? 80 : 72, b = !!l, [s, a] = L(null), [x, N] = L(!1), C = E(null), v = E(!1), w = k(
636
636
  (M) => {
@@ -729,7 +729,7 @@ const Zn = ({
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__ */ _(wt, { children: [
732
+ /* @__PURE__ */ _(_t, { children: [
733
733
  /* @__PURE__ */ n(
734
734
  jt,
735
735
  {
@@ -741,7 +741,7 @@ const Zn = ({
741
741
  "img",
742
742
  {
743
743
  src: l,
744
- alt: d ? `${d} avatar` : "Agent avatar",
744
+ alt: c ? `${c} avatar` : "Agent avatar",
745
745
  className: "ll-hidden__avatar",
746
746
  draggable: !1
747
747
  }
@@ -764,7 +764,7 @@ const Zn = ({
764
764
  className: o,
765
765
  barClassName: l
766
766
  }) => {
767
- const d = E(null), u = E([]), f = st(() => {
767
+ const c = E(null), u = E([]), f = ct(() => {
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]);
@@ -777,7 +777,7 @@ const Zn = ({
777
777
  }
778
778
  }), [e, t, r, i, f]);
779
779
  const y = ["ll-waveform", o].filter(Boolean).join(" ");
780
- return /* @__PURE__ */ n("div", { ref: d, className: y, "aria-hidden": "true", children: Array.from({ length: t }, (b, s) => /* @__PURE__ */ n(
780
+ return /* @__PURE__ */ n("div", { ref: c, className: y, "aria-hidden": "true", children: Array.from({ length: t }, (b, s) => /* @__PURE__ */ n(
781
781
  "div",
782
782
  {
783
783
  ref: (a) => {
@@ -795,7 +795,7 @@ const Zn = ({
795
795
  avatarImageUrl: i,
796
796
  agentState: o,
797
797
  isMuted: l,
798
- audioLevel: d,
798
+ audioLevel: c,
799
799
  onExpand: u,
800
800
  onToggleMute: f,
801
801
  onClose: y
@@ -827,7 +827,7 @@ const Zn = ({
827
827
  /* @__PURE__ */ n(
828
828
  er,
829
829
  {
830
- audioLevel: d,
830
+ audioLevel: c,
831
831
  bars: 16,
832
832
  maxHeight: 18,
833
833
  className: "ll-minimized__waveform"
@@ -921,9 +921,9 @@ const Zn = ({
921
921
  className: i,
922
922
  style: o
923
923
  }) => {
924
- const [l, d] = L(!1), u = E(e);
924
+ const [l, c] = L(!1), u = E(e);
925
925
  if (A(() => {
926
- u.current !== e && (u.current = e, d(!1));
926
+ u.current !== e && (u.current = e, c(!1));
927
927
  }, [e]), !e) return null;
928
928
  const f = {
929
929
  position: "absolute",
@@ -948,7 +948,7 @@ const Zn = ({
948
948
  style: f,
949
949
  loading: "eager",
950
950
  fetchPriority: "high",
951
- onLoad: () => d(!0)
951
+ onLoad: () => c(!0)
952
952
  }
953
953
  )
954
954
  );
@@ -959,7 +959,7 @@ const Zn = ({
959
959
  avatarImageUrl: i,
960
960
  idleLoopUrl: o,
961
961
  greeting: l,
962
- branding: d,
962
+ branding: c,
963
963
  teamMembers: u,
964
964
  currentTeamMemberId: f,
965
965
  isSwitchingTeamMember: y,
@@ -997,8 +997,8 @@ const Zn = ({
997
997
  onToggleMute: Ae,
998
998
  onToggleCamera: Re,
999
999
  onSwitchCameraDevice: V,
1000
- onToggleScreenShare: ut,
1001
- onToggleSpeaker: ft,
1000
+ onToggleScreenShare: ft,
1001
+ onToggleSpeaker: pt,
1002
1002
  onSendMessage: nt,
1003
1003
  onMinimize: ue,
1004
1004
  onClose: Me,
@@ -1061,7 +1061,7 @@ const Zn = ({
1061
1061
  Y && (nt(Y), Fe(""));
1062
1062
  },
1063
1063
  [he, nt]
1064
- ), je = d.productName || "Live Layer";
1064
+ ), je = c.productName || "Live Layer";
1065
1065
  let me = null, ge = null;
1066
1066
  for (let p = w.length - 1; p >= 0; p--) {
1067
1067
  const Y = w[p];
@@ -1133,7 +1133,7 @@ const Zn = ({
1133
1133
  "aria-expanded": _e ? b : void 0,
1134
1134
  children: [
1135
1135
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1136
- _e && /* @__PURE__ */ n(lt, {})
1136
+ _e && /* @__PURE__ */ n(at, {})
1137
1137
  ]
1138
1138
  }
1139
1139
  ),
@@ -1184,7 +1184,7 @@ const Zn = ({
1184
1184
  title: "Language: English",
1185
1185
  children: [
1186
1186
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
1187
- /* @__PURE__ */ n(lt, {})
1187
+ /* @__PURE__ */ n(at, {})
1188
1188
  ]
1189
1189
  }
1190
1190
  ),
@@ -1269,7 +1269,7 @@ const Zn = ({
1269
1269
  ),
1270
1270
  te && /* @__PURE__ */ (() => {
1271
1271
  const p = O ? "Restart paused session" : C === "disconnected" ? "Reconnect to agent" : "Start video call", Y = O ? "Pick up where you left off" : null;
1272
- return /* @__PURE__ */ _(wt, { children: [
1272
+ return /* @__PURE__ */ _(_t, { children: [
1273
1273
  C === "idle" && !O && !q && /* @__PURE__ */ _(
1274
1274
  "button",
1275
1275
  {
@@ -1344,7 +1344,7 @@ const Zn = ({
1344
1344
  {
1345
1345
  type: "button",
1346
1346
  className: `ll-tool ${G ? "is-on" : ""}`,
1347
- onClick: ut,
1347
+ onClick: ft,
1348
1348
  "aria-label": G ? "Stop sharing screen" : "Share screen",
1349
1349
  title: G ? "Stop sharing" : "Share screen",
1350
1350
  children: /* @__PURE__ */ n(ir, {})
@@ -1373,7 +1373,7 @@ const Zn = ({
1373
1373
  "aria-label": "Camera devices",
1374
1374
  "aria-haspopup": "listbox",
1375
1375
  "aria-expanded": Pe,
1376
- children: /* @__PURE__ */ n(lt, {})
1376
+ children: /* @__PURE__ */ n(at, {})
1377
1377
  }
1378
1378
  ),
1379
1379
  Pe && B.length > 0 && /* @__PURE__ */ n(
@@ -1416,7 +1416,7 @@ const Zn = ({
1416
1416
  "aria-label": "Microphone devices",
1417
1417
  "aria-haspopup": "listbox",
1418
1418
  "aria-expanded": ae,
1419
- children: /* @__PURE__ */ n(lt, {})
1419
+ children: /* @__PURE__ */ n(at, {})
1420
1420
  }
1421
1421
  ),
1422
1422
  ae && W.length > 0 && /* @__PURE__ */ n(
@@ -1436,7 +1436,7 @@ const Zn = ({
1436
1436
  {
1437
1437
  type: "button",
1438
1438
  className: `ll-tool ${be ? "is-muted" : ""}`,
1439
- onClick: ft,
1439
+ onClick: pt,
1440
1440
  "aria-label": be ? "Unmute speaker" : "Mute speaker",
1441
1441
  title: be ? "Unmute speaker" : "Mute speaker",
1442
1442
  children: /* @__PURE__ */ n(ar, { muted: be })
@@ -1511,7 +1511,7 @@ const Zn = ({
1511
1511
  }
1512
1512
  );
1513
1513
  };
1514
- function lt() {
1514
+ function at() {
1515
1515
  return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" }) });
1516
1516
  }
1517
1517
  function Jt() {
@@ -1547,7 +1547,7 @@ function lr({ muted: e }) {
1547
1547
  function ar({ 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__ */ _(wt, { children: [
1550
+ e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(_t, { 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
  ] })
@@ -1577,17 +1577,17 @@ const Xt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
1577
1577
  children: [
1578
1578
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1579
1579
  t.map((o, l) => {
1580
- const d = r === o.deviceId;
1580
+ const c = r === o.deviceId;
1581
1581
  return /* @__PURE__ */ _(
1582
1582
  "button",
1583
1583
  {
1584
1584
  type: "button",
1585
- className: `ll-device-menu__item ${d ? "is-active" : ""}`,
1585
+ className: `ll-device-menu__item ${c ? "is-active" : ""}`,
1586
1586
  onClick: () => i(o.deviceId),
1587
1587
  role: "option",
1588
- "aria-selected": d,
1588
+ "aria-selected": c,
1589
1589
  children: [
1590
- d && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1590
+ c && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1591
1591
  /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
1592
1592
  ]
1593
1593
  },
@@ -1600,7 +1600,7 @@ const Xt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
1600
1600
  '[data-ll-private="true"]',
1601
1601
  ".ll-widget"
1602
1602
  ];
1603
- function xt(e) {
1603
+ function kt(e) {
1604
1604
  let t = e;
1605
1605
  for (; t; ) {
1606
1606
  for (const r of dr)
@@ -1609,8 +1609,8 @@ function xt(e) {
1609
1609
  }
1610
1610
  return !1;
1611
1611
  }
1612
- function dt(e) {
1613
- if (xt(e)) return !1;
1612
+ function ut(e) {
1613
+ if (kt(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();
@@ -1618,7 +1618,7 @@ function dt(e) {
1618
1618
  }
1619
1619
  return !0;
1620
1620
  }
1621
- const at = 4096, ur = 20, fr = 20, pr = 10, hr = 10, mr = 30, Gt = 500, gr = [
1621
+ const st = 4096, ur = 20, fr = 20, pr = 10, hr = 10, mr = 30, Gt = 500, gr = [
1622
1622
  '[data-ll-private="true"]',
1623
1623
  ".ll-widget",
1624
1624
  "script",
@@ -1676,10 +1676,10 @@ function yr(e, t = {}) {
1676
1676
  forms: [],
1677
1677
  extras: e
1678
1678
  };
1679
- const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", d = Array.from(
1679
+ const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
1680
1680
  r.querySelectorAll("[data-ll-region]")
1681
1681
  ), u = [];
1682
- for (const m of d) {
1682
+ for (const m of c) {
1683
1683
  if (u.length >= pr) break;
1684
1684
  if (Xe(m) || !Ge(m)) continue;
1685
1685
  const R = m.getAttribute("data-ll-region") ?? "", W = m.getAttribute("data-ll-intent") ?? void 0, z = Se(
@@ -1717,7 +1717,7 @@ function yr(e, t = {}) {
1717
1717
  );
1718
1718
  for (const m of v) {
1719
1719
  if (C.length >= fr) break;
1720
- if (Xe(m) || !dt(m) || !Ge(m)) continue;
1720
+ if (Xe(m) || !ut(m) || !Ge(m)) continue;
1721
1721
  const R = Qt(m), W = m instanceof HTMLInputElement ? m.type : m.tagName.toLowerCase();
1722
1722
  R && C.push({ label: Se(R, 100), type: W });
1723
1723
  }
@@ -1726,7 +1726,7 @@ function yr(e, t = {}) {
1726
1726
  ), O = [];
1727
1727
  for (const m of w) {
1728
1728
  if (O.length >= hr) break;
1729
- if (xt(m)) continue;
1729
+ if (kt(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 yr(e, t = {}) {
1736
1736
  ), M = [];
1737
1737
  for (const B of z) {
1738
1738
  if (M.length >= mr) break;
1739
- if (!dt(B)) continue;
1739
+ if (!ut(B)) continue;
1740
1740
  const F = B.getAttribute("data-ll-field") || "";
1741
1741
  if (!F) continue;
1742
1742
  const G = Qt(B) || F, ie = B instanceof HTMLInputElement ? B.type : B.tagName.toLowerCase();
@@ -1756,11 +1756,11 @@ function yr(e, t = {}) {
1756
1756
  extras: e
1757
1757
  };
1758
1758
  let q = He(JSON.stringify(I.regions)) + He(I.visibleText) + He(JSON.stringify(I.visibleLinks)) + He(JSON.stringify(I.visibleFields));
1759
- for (; q > at && I.visibleFields.length > 0; )
1759
+ for (; q > st && I.visibleFields.length > 0; )
1760
1760
  I.visibleFields.pop(), q = He(JSON.stringify(I.visibleFields));
1761
- for (; q > at && I.visibleLinks.length > 0; )
1761
+ for (; q > st && I.visibleLinks.length > 0; )
1762
1762
  I.visibleLinks.pop(), q -= 80;
1763
- return He(I.visibleText) > at && (I.visibleText = Se(I.visibleText, at - 100)), I;
1763
+ return He(I.visibleText) > st && (I.visibleText = Se(I.visibleText, st - 100)), I;
1764
1764
  }
1765
1765
  let Oe = null;
1766
1766
  function Zt(e, t = {}) {
@@ -1791,10 +1791,10 @@ function xr(e) {
1791
1791
  const t = e ?? (typeof document < "u" ? document : null);
1792
1792
  if (!t) return [];
1793
1793
  const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
1794
- for (const d of l) {
1794
+ for (const c of l) {
1795
1795
  if (o.length >= br) break;
1796
- if (xt(d)) continue;
1797
- const u = d.getAttribute("href") || "";
1796
+ if (kt(c)) continue;
1797
+ const u = c.getAttribute("href") || "";
1798
1798
  if (!_r(u)) continue;
1799
1799
  let f = u, y = !0;
1800
1800
  try {
@@ -1807,14 +1807,14 @@ function xr(e) {
1807
1807
  }
1808
1808
  if (i.has(f)) continue;
1809
1809
  i.add(f);
1810
- const b = (d.textContent || "").trim().slice(0, 120);
1810
+ const b = (c.textContent || "").trim().slice(0, 120);
1811
1811
  o.push({ href: f, text: b, internal: y });
1812
1812
  }
1813
1813
  return o;
1814
1814
  }
1815
1815
  let qe = null;
1816
1816
  const kr = 5e3;
1817
- function vt() {
1817
+ function bt() {
1818
1818
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
1819
1819
  if (qe && qe.pathname === t && e - qe.at < kr)
1820
1820
  return qe.routes;
@@ -1834,8 +1834,8 @@ function Cr(e, t, r = {}) {
1834
1834
  const l = Object.getOwnPropertyDescriptor(
1835
1835
  HTMLInputElement.prototype,
1836
1836
  "checked"
1837
- ), d = l == null ? void 0 : l.set, u = t === "true" || t === "1" || t === "on";
1838
- d ? d.call(e, u) : e.checked = u, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1837
+ ), c = l == null ? void 0 : l.set, u = t === "true" || t === "1" || t === "on";
1838
+ c ? c.call(e, u) : e.checked = u, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1839
1839
  return;
1840
1840
  }
1841
1841
  Sr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
@@ -1916,7 +1916,7 @@ function Tr(e) {
1916
1916
  baseUrl: i = "https://app.livelayer.studio",
1917
1917
  sessionEndpoint: o,
1918
1918
  sessionBody: l,
1919
- autoConnect: d = !1,
1919
+ autoConnect: c = !1,
1920
1920
  displayMode: u,
1921
1921
  defaultDisplayMode: f = "expanded",
1922
1922
  onDisplayModeChange: y,
@@ -1954,8 +1954,8 @@ function Tr(e) {
1954
1954
  onAgentEvent: Ae,
1955
1955
  onAgentCommand: Re,
1956
1956
  controlledSession: V,
1957
- className: ut,
1958
- style: ft,
1957
+ className: ft,
1958
+ style: pt,
1959
1959
  zIndex: nt = 2147483647
1960
1960
  } = e, ue = qn(F), Me = Yn(ue, M, B);
1961
1961
  A(() => {
@@ -1964,7 +1964,7 @@ function Tr(e) {
1964
1964
  const Be = C !== void 0, [_e, Ie] = L(() => {
1965
1965
  var h;
1966
1966
  return C ?? ((h = N == null ? void 0 : N[0]) == null ? void 0 : h.id);
1967
- }), X = Be ? C : _e, te = st(
1967
+ }), X = Be ? C : _e, te = ct(
1968
1968
  () => (N == null ? void 0 : N.find((h) => h.id === X)) ?? null,
1969
1969
  [N, X]
1970
1970
  ), Te = (te == null ? void 0 : te.agentId) ?? t, [oe, de] = $n({
@@ -1973,28 +1973,28 @@ function Tr(e) {
1973
1973
  onChange: y,
1974
1974
  persistKey: a,
1975
1975
  disablePersistence: x
1976
- }), xe = Hn(s), We = Ln(), Z = Sn(), le = En(), ae = Nn(), fe = An(), [Pe, pe] = L(!1), [he, Fe] = L(!1), [Ue, je] = L(!1), [me, ge] = L(!1), [De, rt] = L(!1), Ve = E(G), $e = E(ie), p = E(et), Y = E(tt), pt = E(be), kt = E(Qe), Lt = E(Ze), ht = E(re), ne = E(null);
1977
- Ve.current = G, $e.current = ie, p.current = et, Y.current = tt, pt.current = be, kt.current = Qe, Lt.current = Ze, ht.current = re;
1976
+ }), xe = Hn(s), We = Ln(), Z = Sn(), le = En(), ae = Nn(), fe = An(), [Pe, pe] = L(!1), [he, Fe] = L(!1), [Ue, je] = L(!1), [me, ge] = L(!1), [De, rt] = L(!1), Ve = E(G), $e = E(ie), p = E(et), Y = E(tt), ht = E(be), Lt = E(Qe), St = E(Ze), mt = E(re), ne = E(null);
1977
+ Ve.current = G, $e.current = ie, p.current = et, Y.current = tt, ht.current = be, Lt.current = Qe, St.current = Ze, mt.current = re;
1978
1978
  function ye(h) {
1979
- const c = ht.current;
1980
- return c ? c.includes(h) : !0;
1979
+ const d = mt.current;
1980
+ return d ? d.includes(h) : !0;
1981
1981
  }
1982
- function ve(h, c) {
1982
+ function ve(h, d) {
1983
1983
  console.warn(
1984
- `[LiveLayer] Agent command "${h}" blocked — capability "${c}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1984
+ `[LiveLayer] Agent command "${h}" blocked — capability "${d}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1985
1985
  );
1986
1986
  }
1987
1987
  const Ye = k(
1988
1988
  (h) => {
1989
- var ee, ze, ot, zt, Ht;
1990
- const c = h;
1991
- if (!(!c.type || typeof c.type != "string")) {
1992
- if (Ae == null || Ae({ eventName: c.type, data: h }), c.type === "navigate") {
1989
+ var ee, ze, lt, zt, Ht;
1990
+ const d = h;
1991
+ if (!(!d.type || typeof d.type != "string")) {
1992
+ if (Ae == null || Ae({ eventName: d.type, data: h }), d.type === "navigate") {
1993
1993
  if (!ye("navigate")) {
1994
1994
  ve("navigate", "navigate");
1995
1995
  return;
1996
1996
  }
1997
- const S = typeof c.href == "string" ? c.href : null;
1997
+ const S = typeof d.href == "string" ? d.href : null;
1998
1998
  if (!S) {
1999
1999
  console.warn(
2000
2000
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
@@ -2032,14 +2032,14 @@ function Tr(e) {
2032
2032
  }
2033
2033
  return;
2034
2034
  }
2035
- if (c.type === "scroll_to") {
2035
+ if (d.type === "scroll_to") {
2036
2036
  if (!ye("scroll")) {
2037
2037
  ve("scroll_to", "scroll");
2038
2038
  return;
2039
2039
  }
2040
- const S = typeof c.selector == "string" ? c.selector : null;
2040
+ const S = typeof d.selector == "string" ? d.selector : null;
2041
2041
  if (!S) return;
2042
- const P = c.behavior === "instant" ? "instant" : "smooth";
2042
+ const P = d.behavior === "instant" ? "instant" : "smooth";
2043
2043
  if ($e.current) {
2044
2044
  try {
2045
2045
  $e.current(
@@ -2074,12 +2074,12 @@ function Tr(e) {
2074
2074
  }
2075
2075
  return;
2076
2076
  }
2077
- if (c.type === "request_page_context") {
2077
+ if (d.type === "request_page_context") {
2078
2078
  if (!ye("read_page")) {
2079
2079
  ve("request_page_context", "read_page");
2080
2080
  return;
2081
2081
  }
2082
- const S = typeof c.requestId == "string" ? c.requestId : void 0, P = (ee = ne.current) == null ? void 0 : ee.call(ne), D = (K) => {
2082
+ const S = typeof d.requestId == "string" ? d.requestId : void 0, P = (ee = ne.current) == null ? void 0 : ee.call(ne), D = (K) => {
2083
2083
  const T = P, U = T == null ? void 0 : T.localParticipant;
2084
2084
  if (U != null && U.publishData)
2085
2085
  try {
@@ -2088,7 +2088,7 @@ function Tr(e) {
2088
2088
  } catch (H) {
2089
2089
  console.warn("[LiveLayer] publishData failed.", H);
2090
2090
  }
2091
- }, $ = kt.current, J = pt.current;
2091
+ }, $ = Lt.current, J = ht.current;
2092
2092
  try {
2093
2093
  if (J) {
2094
2094
  const K = J($);
@@ -2122,19 +2122,19 @@ function Tr(e) {
2122
2122
  }
2123
2123
  return;
2124
2124
  }
2125
- if (c.type === "scroll_page") {
2125
+ if (d.type === "scroll_page") {
2126
2126
  if (!ye("scroll")) {
2127
2127
  ve("scroll_page", "scroll");
2128
2128
  return;
2129
2129
  }
2130
- const S = c.direction;
2130
+ const S = d.direction;
2131
2131
  if (S !== "up" && S !== "down" && S !== "top" && S !== "bottom") {
2132
2132
  console.warn(
2133
2133
  `[LiveLayer] scroll_page: invalid direction "${String(S)}". Expected up | down | top | bottom.`
2134
2134
  );
2135
2135
  return;
2136
2136
  }
2137
- const P = c.behavior === "instant" ? "instant" : "smooth";
2137
+ const P = d.behavior === "instant" ? "instant" : "smooth";
2138
2138
  if (p.current) {
2139
2139
  try {
2140
2140
  p.current(
@@ -2155,12 +2155,12 @@ function Tr(e) {
2155
2155
  S === "up" ? J(-en($)) : S === "down" ? J(en($)) : K(S === "top" ? 0 : Mr($));
2156
2156
  return;
2157
2157
  }
2158
- if (c.type === "click") {
2158
+ if (d.type === "click") {
2159
2159
  if (!ye("click")) {
2160
2160
  ve("click", "click");
2161
2161
  return;
2162
2162
  }
2163
- const S = typeof c.selector == "string" ? c.selector : null;
2163
+ const S = typeof d.selector == "string" ? d.selector : null;
2164
2164
  if (!S) {
2165
2165
  console.warn("[LiveLayer] click: missing selector.");
2166
2166
  return;
@@ -2198,14 +2198,14 @@ function Tr(e) {
2198
2198
  (ze = P.click) == null || ze.call(P);
2199
2199
  return;
2200
2200
  }
2201
- if (c.type === "fill_form" || c.type === "focus_field") {
2201
+ if (d.type === "fill_form" || d.type === "focus_field") {
2202
2202
  if (!ye("fill_forms")) {
2203
- ve(c.type, "fill_forms");
2203
+ ve(d.type, "fill_forms");
2204
2204
  return;
2205
2205
  }
2206
2206
  if (typeof document > "u") return;
2207
- const S = typeof c.requestId == "string" ? c.requestId : void 0, P = (ot = ne.current) == null ? void 0 : ot.call(ne), D = (H) => {
2208
- if (c.type !== "fill_form") return;
2207
+ const S = typeof d.requestId == "string" ? d.requestId : void 0, P = (lt = ne.current) == null ? void 0 : lt.call(ne), D = (H) => {
2208
+ if (d.type !== "fill_form") return;
2209
2209
  const Q = P, se = Q == null ? void 0 : Q.localParticipant;
2210
2210
  if (se != null && se.publishData)
2211
2211
  try {
@@ -2214,9 +2214,9 @@ function Tr(e) {
2214
2214
  } catch (Le) {
2215
2215
  console.warn("[LiveLayer] publishData failed.", Le);
2216
2216
  }
2217
- }, $ = typeof c.formId == "string" ? c.formId : null;
2217
+ }, $ = typeof d.formId == "string" ? d.formId : null;
2218
2218
  if (!$) {
2219
- console.warn(`[LiveLayer] ${c.type}: missing formId.`), D({ 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
2222
  const J = document.querySelector(
@@ -2224,7 +2224,7 @@ function Tr(e) {
2224
2224
  );
2225
2225
  if (!J) {
2226
2226
  console.warn(
2227
- `[LiveLayer] ${c.type}: no form with data-ll-form="${$}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
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
2228
  ), D({
2229
2229
  type: "fill_form_result",
2230
2230
  ok: !1,
@@ -2235,7 +2235,7 @@ function Tr(e) {
2235
2235
  }
2236
2236
  if (J.closest('[data-ll-private="true"], .ll-widget')) {
2237
2237
  console.warn(
2238
- `[LiveLayer] ${c.type}: refusing to touch a form in a private subtree.`
2238
+ `[LiveLayer] ${d.type}: refusing to touch a form in a private subtree.`
2239
2239
  ), D({
2240
2240
  type: "fill_form_result",
2241
2241
  ok: !1,
@@ -2244,8 +2244,8 @@ function Tr(e) {
2244
2244
  });
2245
2245
  return;
2246
2246
  }
2247
- if (c.type === "focus_field") {
2248
- const H = typeof c.fieldName == "string" ? c.fieldName : null;
2247
+ if (d.type === "focus_field") {
2248
+ const H = typeof d.fieldName == "string" ? d.fieldName : null;
2249
2249
  if (!H) {
2250
2250
  console.warn("[LiveLayer] focus_field: missing fieldName.");
2251
2251
  return;
@@ -2257,7 +2257,7 @@ function Tr(e) {
2257
2257
  );
2258
2258
  return;
2259
2259
  }
2260
- if (!dt(Q)) {
2260
+ if (!ut(Q)) {
2261
2261
  console.warn(
2262
2262
  `[LiveLayer] focus_field: field "${H}" is privacy-protected and not focusable.`
2263
2263
  );
@@ -2266,7 +2266,7 @@ function Tr(e) {
2266
2266
  Q.focus();
2267
2267
  return;
2268
2268
  }
2269
- const K = c.values && typeof c.values == "object" ? c.values : null;
2269
+ const K = d.values && typeof d.values == "object" ? d.values : null;
2270
2270
  if (!K) {
2271
2271
  console.warn("[LiveLayer] fill_form: missing or invalid values."), D({
2272
2272
  type: "fill_form_result",
@@ -2286,7 +2286,7 @@ function Tr(e) {
2286
2286
  ), U.push(H);
2287
2287
  continue;
2288
2288
  }
2289
- if (!dt(se)) {
2289
+ if (!ut(se)) {
2290
2290
  console.warn(
2291
2291
  `[LiveLayer] fill_form: field "${H}" is privacy-protected (password / cc-* / private). Skipping.`
2292
2292
  ), U.push(H);
@@ -2311,13 +2311,13 @@ function Tr(e) {
2311
2311
  });
2312
2312
  return;
2313
2313
  }
2314
- if (c.type === "submit_form") {
2314
+ if (d.type === "submit_form") {
2315
2315
  if (!ye("submit_forms")) {
2316
2316
  ve("submit_form", "submit_forms");
2317
2317
  return;
2318
2318
  }
2319
2319
  if (typeof document > "u") return;
2320
- const S = typeof c.formId == "string" ? c.formId : null;
2320
+ const S = typeof d.formId == "string" ? d.formId : null;
2321
2321
  if (!S) {
2322
2322
  console.warn("[LiveLayer] submit_form: missing formId.");
2323
2323
  return;
@@ -2337,7 +2337,7 @@ function Tr(e) {
2337
2337
  );
2338
2338
  return;
2339
2339
  }
2340
- const D = typeof c.requestId == "string" ? c.requestId : void 0, $ = (zt = ne.current) == null ? void 0 : zt.call(ne), J = (U) => {
2340
+ const D = typeof d.requestId == "string" ? d.requestId : void 0, $ = (zt = ne.current) == null ? void 0 : zt.call(ne), J = (U) => {
2341
2341
  const H = $, Q = H == null ? void 0 : H.localParticipant;
2342
2342
  if (Q != null && Q.publishData)
2343
2343
  try {
@@ -2370,12 +2370,12 @@ function Tr(e) {
2370
2370
  }, 500);
2371
2371
  return;
2372
2372
  }
2373
- if (c.type === "request_routes") {
2373
+ if (d.type === "request_routes") {
2374
2374
  if (!ye("read_page")) {
2375
2375
  ve("request_routes", "read_page");
2376
2376
  return;
2377
2377
  }
2378
- const S = typeof c.requestId == "string" ? c.requestId : void 0, D = (Ht = ne.current) == null ? void 0 : Ht.call(ne), $ = D == null ? void 0 : D.localParticipant;
2378
+ const S = typeof d.requestId == "string" ? d.requestId : void 0, D = (Ht = ne.current) == null ? void 0 : Ht.call(ne), $ = D == null ? void 0 : D.localParticipant;
2379
2379
  if (!($ != null && $.publishData)) return;
2380
2380
  const J = (T) => {
2381
2381
  try {
@@ -2384,7 +2384,7 @@ function Tr(e) {
2384
2384
  } catch (U) {
2385
2385
  console.warn("[LiveLayer] request_routes: publishData failed.", U);
2386
2386
  }
2387
- }, K = Lt.current;
2387
+ }, K = St.current;
2388
2388
  if (K) {
2389
2389
  try {
2390
2390
  const T = K(), U = (H) => {
@@ -2398,24 +2398,24 @@ function Tr(e) {
2398
2398
  console.warn(
2399
2399
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
2400
2400
  H
2401
- ), J(vt());
2401
+ ), J(bt());
2402
2402
  }) : U(T);
2403
2403
  } catch (T) {
2404
2404
  console.warn(
2405
2405
  "[LiveLayer] getRoutes threw; falling back to DOM walker.",
2406
2406
  T
2407
- ), J(vt());
2407
+ ), J(bt());
2408
2408
  }
2409
2409
  return;
2410
2410
  }
2411
2411
  try {
2412
- J(vt());
2412
+ J(bt());
2413
2413
  } catch (T) {
2414
2414
  console.warn("[LiveLayer] request_routes: extractRoutes threw.", T);
2415
2415
  }
2416
2416
  return;
2417
2417
  }
2418
- Ir.has(c.type) || Re == null || Re(c);
2418
+ Ir.has(d.type) || Re == null || Re(d);
2419
2419
  }
2420
2420
  },
2421
2421
  [Re, Ae]
@@ -2436,13 +2436,13 @@ function Tr(e) {
2436
2436
  }, A(() => {
2437
2437
  var ee;
2438
2438
  if (!ue) return;
2439
- const h = (ee = j.getRoom) == null ? void 0 : ee.call(j), c = h == null ? void 0 : h.localParticipant;
2440
- if (c != null && c.publishData)
2439
+ const h = (ee = j.getRoom) == null ? void 0 : ee.call(j), d = h == null ? void 0 : h.localParticipant;
2440
+ if (d != null && d.publishData)
2441
2441
  try {
2442
2442
  const ze = new TextEncoder().encode(
2443
2443
  JSON.stringify({ type: "pathname", pathname: ue })
2444
2444
  );
2445
- c.publishData(ze, { reliable: !0 });
2445
+ d.publishData(ze, { reliable: !0 });
2446
2446
  } catch {
2447
2447
  }
2448
2448
  }, [ue, j, j.connectionState]), A(() => {
@@ -2453,14 +2453,14 @@ function Tr(e) {
2453
2453
  return window.__livelayerSimulateCommand = (ze) => {
2454
2454
  try {
2455
2455
  Ye(ze);
2456
- } catch (ot) {
2457
- console.warn("[LiveLayer] simulate-command threw:", ot);
2456
+ } catch (lt) {
2457
+ console.warn("[LiveLayer] simulate-command threw:", lt);
2458
2458
  }
2459
2459
  }, () => {
2460
2460
  delete window.__livelayerSimulateCommand;
2461
2461
  };
2462
2462
  }, [Ye]);
2463
- const g = st(() => V ? {
2463
+ const g = ct(() => V ? {
2464
2464
  connectionState: V.connectionState,
2465
2465
  agentState: V.agentState,
2466
2466
  transcript: V.transcript,
@@ -2491,19 +2491,19 @@ function Tr(e) {
2491
2491
  disconnect: j.disconnect,
2492
2492
  getRoom: j.getRoom,
2493
2493
  isControlled: !1
2494
- }, [V, j]), St = E(null);
2494
+ }, [V, j]), Ct = E(null);
2495
2495
  A(() => {
2496
- const h = g.videoElement, c = St.current;
2497
- if (!(!h || !c))
2498
- return c.appendChild(h), () => {
2499
- h.parentNode === c && c.removeChild(h);
2496
+ const h = g.videoElement, d = Ct.current;
2497
+ if (!(!h || !d))
2498
+ return d.appendChild(h), () => {
2499
+ h.parentNode === d && d.removeChild(h);
2500
2500
  };
2501
2501
  }, [g.videoElement]), A(() => {
2502
2502
  const h = g.audioElement;
2503
2503
  if (!h) return;
2504
2504
  We.attach(h);
2505
- const c = h.play();
2506
- return c && typeof c.catch == "function" && c.catch((ee) => {
2505
+ const d = h.play();
2506
+ return d && typeof d.catch == "function" && d.catch((ee) => {
2507
2507
  (ee == null ? void 0 : ee.name) === "NotAllowedError" && pe(!0);
2508
2508
  }), () => {
2509
2509
  We.detach();
@@ -2517,37 +2517,37 @@ function Tr(e) {
2517
2517
  Z.teardownMic(), le.teardown(), ae.teardown();
2518
2518
  };
2519
2519
  }, [g.isControlled, g.connectionState]);
2520
- const [ke, mt] = L(!1), gt = E("idle");
2520
+ const [ke, gt] = L(!1), yt = E("idle");
2521
2521
  A(() => {
2522
2522
  if (g.connectionState === "idle" || g.connectionState === "disconnected") {
2523
- mt(!1), gt.current = "idle";
2523
+ gt(!1), yt.current = "idle";
2524
2524
  return;
2525
2525
  }
2526
- !ke && gt.current === "speaking" && g.agentState !== "speaking" && (mt(!0), Z.setMuted(!1)), gt.current = g.agentState;
2526
+ !ke && yt.current === "speaking" && g.agentState !== "speaking" && (gt(!0), Z.setMuted(!1)), yt.current = g.agentState;
2527
2527
  }, [g.agentState, g.connectionState, ke]), A(() => {
2528
2528
  if (g.connectionState !== "connected" || ke) return;
2529
2529
  const h = setTimeout(() => {
2530
- mt(!0), Z.setMuted(!1);
2530
+ gt(!0), Z.setMuted(!1);
2531
2531
  }, 4e3);
2532
2532
  return () => clearTimeout(h);
2533
2533
  }, [g.connectionState, ke]);
2534
- const Ct = E(!1), Et = E(!1);
2534
+ const Et = E(!1), it = E(!1);
2535
2535
  A(() => {
2536
2536
  if (!ke) return;
2537
- const h = g.agentState === "speaking", c = Et.current;
2538
- h && !c ? (Ct.current = Z.isMuted, Z.setMuted(!0)) : !h && c && Z.setMuted(Ct.current), Et.current = h;
2537
+ const h = g.agentState;
2538
+ !it.current && (h === "speaking" || h === "thinking") ? (Et.current = Z.isMuted, it.current = !0, Z.setMuted(!0)) : it.current && h === "listening" && (it.current = !1, Z.setMuted(Et.current));
2539
2539
  }, [g.agentState, ke]), A(() => {
2540
2540
  const h = g.audioElement;
2541
2541
  h && (h.muted = De);
2542
2542
  }, [g.audioElement, De]);
2543
2543
  const on = k((h) => {
2544
- const c = g.getRoom();
2545
- if (c)
2544
+ const d = g.getRoom();
2545
+ if (d)
2546
2546
  try {
2547
2547
  const ee = new TextEncoder().encode(
2548
2548
  JSON.stringify({ type: "user_message", text: h })
2549
2549
  );
2550
- c.localParticipant.publishData(ee, { reliable: !0 });
2550
+ d.localParticipant.publishData(ee, { reliable: !0 });
2551
2551
  } catch {
2552
2552
  }
2553
2553
  }, [g]), ln = k(() => {
@@ -2562,12 +2562,12 @@ function Tr(e) {
2562
2562
  }, [g.agentState, Ee]);
2563
2563
  const Nt = E(!1);
2564
2564
  A(() => {
2565
- g.isControlled || !d || Nt.current || Me && g.connectionState === "idle" && (Nt.current = !0, g.connect());
2566
- }, [d, g.connectionState, g, Me]);
2565
+ g.isControlled || !c || Nt.current || Me && g.connectionState === "idle" && (Nt.current = !0, g.connect());
2566
+ }, [c, g.connectionState, g, Me]);
2567
2567
  const an = k(
2568
2568
  (h) => {
2569
- const c = N == null ? void 0 : N.find((ee) => ee.id === h);
2570
- c && (je(!1), h !== X && (Fe(!0), g.disconnect(), Be || Ie(h), v == null || v(c)));
2569
+ const d = N == null ? void 0 : N.find((ee) => ee.id === h);
2570
+ d && (je(!1), h !== X && (Fe(!0), g.disconnect(), Be || Ie(h), v == null || v(d)));
2571
2571
  },
2572
2572
  [
2573
2573
  N,
@@ -2581,14 +2581,14 @@ function Tr(e) {
2581
2581
  he && g.connectionState === "connected" && Fe(!1);
2582
2582
  }, [g.connectionState, he]), A(() => {
2583
2583
  if (!Ue) return;
2584
- const h = (c) => {
2585
- c.key === "Escape" && je(!1);
2584
+ const h = (d) => {
2585
+ d.key === "Escape" && je(!1);
2586
2586
  };
2587
2587
  return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
2588
2588
  }, [Ue]);
2589
2589
  const sn = !!I || !!(te != null && te.avatarImageUrl) || g.isControlled, Je = Rn(Te, i, sn);
2590
- re === void 0 && ((Rt = Je.info) != null && Rt.capabilities) && (ht.current = Je.info.capabilities);
2591
- const it = (te == null ? void 0 : te.name) ?? q ?? ((Mt = g.agentConfig) == null ? void 0 : Mt.name) ?? ((It = Je.info) == null ? void 0 : It.name) ?? "Live Layer", yt = (te == null ? void 0 : te.avatarImageUrl) ?? I ?? ((Tt = g.agentConfig) == null ? void 0 : Tt.avatarImageUrl) ?? ((Pt = Je.info) == null ? void 0 : Pt.avatarImageUrl) ?? null, cn = w ?? ((Dt = g.agentConfig) == null ? void 0 : Dt.idleLoopUrl) ?? (($t = Je.info) == null ? void 0 : $t.idleLoopUrl) ?? null, dn = O ?? null, un = k(() => de("expanded"), [de]), fn = k(
2590
+ re === void 0 && ((Rt = Je.info) != null && Rt.capabilities) && (mt.current = Je.info.capabilities);
2591
+ const ot = (te == null ? void 0 : te.name) ?? q ?? ((Mt = g.agentConfig) == null ? void 0 : Mt.name) ?? ((It = Je.info) == null ? void 0 : It.name) ?? "Live Layer", vt = (te == null ? void 0 : te.avatarImageUrl) ?? I ?? ((Tt = g.agentConfig) == null ? void 0 : Tt.avatarImageUrl) ?? ((Pt = Je.info) == null ? void 0 : Pt.avatarImageUrl) ?? null, cn = w ?? ((Dt = g.agentConfig) == null ? void 0 : Dt.idleLoopUrl) ?? (($t = Je.info) == null ? void 0 : $t.idleLoopUrl) ?? null, dn = O ?? null, un = k(() => de("expanded"), [de]), fn = k(
2592
2592
  () => de("minimized"),
2593
2593
  [de]
2594
2594
  ), At = k(() => {
@@ -2600,7 +2600,7 @@ function Tr(e) {
2600
2600
  }, [g.audioElement]), hn = k(() => {
2601
2601
  pe(!1), g.connect();
2602
2602
  }, [g]), Ke = {
2603
- ...ft,
2603
+ ...pt,
2604
2604
  zIndex: nt
2605
2605
  };
2606
2606
  m.primaryColor && (Ke["--ll-color-primary"] = m.primaryColor), m.accentColor && (Ke["--ll-color-accent"] = m.accentColor), m.backgroundColor && (Ke["--ll-color-bg"] = m.backgroundColor), m.textColor && (Ke["--ll-color-fg"] = m.textColor);
@@ -2608,7 +2608,7 @@ function Tr(e) {
2608
2608
  "ll-widget",
2609
2609
  `ll-widget--${oe}`,
2610
2610
  `ll-widget--${xe ? "mobile" : "desktop"}`,
2611
- ut
2611
+ ft
2612
2612
  ].filter(Boolean).join(" ");
2613
2613
  return Me ? /* @__PURE__ */ _(
2614
2614
  "div",
@@ -2625,9 +2625,9 @@ function Tr(e) {
2625
2625
  isMobile: xe,
2626
2626
  isSpeaking: g.agentState === "speaking",
2627
2627
  onExpand: () => de("expanded"),
2628
- label: `Open ${it} widget`,
2629
- avatarImageUrl: yt,
2630
- agentName: it
2628
+ label: `Open ${ot} widget`,
2629
+ avatarImageUrl: vt,
2630
+ agentName: ot
2631
2631
  }
2632
2632
  ),
2633
2633
  oe === "minimized" && /* @__PURE__ */ n(
@@ -2635,8 +2635,8 @@ function Tr(e) {
2635
2635
  {
2636
2636
  position: b,
2637
2637
  isMobile: xe,
2638
- agentName: it,
2639
- avatarImageUrl: yt,
2638
+ agentName: ot,
2639
+ avatarImageUrl: vt,
2640
2640
  agentState: g.agentState,
2641
2641
  isMuted: Z.isMuted,
2642
2642
  audioLevel: We,
@@ -2650,8 +2650,8 @@ function Tr(e) {
2650
2650
  {
2651
2651
  position: b,
2652
2652
  isMobile: xe,
2653
- agentName: it,
2654
- avatarImageUrl: yt,
2653
+ agentName: ot,
2654
+ avatarImageUrl: vt,
2655
2655
  idleLoopUrl: cn,
2656
2656
  greeting: dn,
2657
2657
  branding: m,
@@ -2682,7 +2682,7 @@ function Tr(e) {
2682
2682
  canResume: g.canResume,
2683
2683
  micError: Z.micError,
2684
2684
  error: g.error,
2685
- avatarVideoContainerRef: St,
2685
+ avatarVideoContainerRef: Ct,
2686
2686
  agentVideoEl: g.videoElement,
2687
2687
  micGateOpen: g.isControlled ? !0 : ke,
2688
2688
  onConnect: () => void g.connect(),
@@ -2714,7 +2714,7 @@ const Wr = ({
2714
2714
  mode: i,
2715
2715
  onAgentEvent: o,
2716
2716
  className: l,
2717
- style: d
2717
+ style: c
2718
2718
  }) => {
2719
2719
  const u = E(null), f = E(null), y = E(o);
2720
2720
  y.current = o;
@@ -2732,9 +2732,9 @@ const Wr = ({
2732
2732
  };
2733
2733
  }, [e]), A(() => {
2734
2734
  f.current && (i ? f.current.setAttribute("mode", i) : f.current.removeAttribute("mode"));
2735
- }, [i]), /* @__PURE__ */ n("div", { ref: u, className: l, style: d });
2736
- }, Fr = _t(
2737
- function({ id: t, intent: r, as: i = "div", className: o, style: l, children: d }, u) {
2735
+ }, [i]), /* @__PURE__ */ n("div", { ref: u, className: l, style: c });
2736
+ }, Fr = xt(
2737
+ function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, u) {
2738
2738
  return vn(
2739
2739
  i,
2740
2740
  {
@@ -2744,10 +2744,10 @@ const Wr = ({
2744
2744
  className: o,
2745
2745
  style: l
2746
2746
  },
2747
- d
2747
+ c
2748
2748
  );
2749
2749
  }
2750
- ), Ur = _t(
2750
+ ), Ur = xt(
2751
2751
  function({ id: t, intent: r, children: i, ...o }, l) {
2752
2752
  return /* @__PURE__ */ n(
2753
2753
  "form",
@@ -2760,9 +2760,9 @@ const Wr = ({
2760
2760
  }
2761
2761
  );
2762
2762
  }
2763
- ), jr = _t(
2763
+ ), jr = xt(
2764
2764
  function(t, r) {
2765
- const { name: i, label: o, labelClassName: l } = t, d = { name: i, "data-ll-field": i };
2765
+ const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
2766
2766
  let u;
2767
2767
  if ("as" in t && t.as === "textarea") {
2768
2768
  const { name: f, label: y, labelClassName: b, as: s, ...a } = t;
@@ -2770,7 +2770,7 @@ const Wr = ({
2770
2770
  "textarea",
2771
2771
  {
2772
2772
  ref: r,
2773
- ...d,
2773
+ ...c,
2774
2774
  ...a
2775
2775
  }
2776
2776
  );
@@ -2780,7 +2780,7 @@ const Wr = ({
2780
2780
  "select",
2781
2781
  {
2782
2782
  ref: r,
2783
- ...d,
2783
+ ...c,
2784
2784
  ...x,
2785
2785
  children: a
2786
2786
  }
@@ -2791,7 +2791,7 @@ const Wr = ({
2791
2791
  "input",
2792
2792
  {
2793
2793
  ref: r,
2794
- ...d,
2794
+ ...c,
2795
2795
  ...a
2796
2796
  }
2797
2797
  );
@@ -2808,7 +2808,7 @@ function Vr({
2808
2808
  defaultOpen: t = !1,
2809
2809
  storageKey: r = "ll-debug-open"
2810
2810
  }) {
2811
- const [i, o] = L(t), [l, d] = L([]), [u, f] = L(""), [y, b] = L(!1), s = E(/* @__PURE__ */ new Set()), a = E([]), x = E(y);
2811
+ const [i, o] = L(t), [l, c] = L([]), [u, f] = L(""), [y, b] = L(!1), s = E(/* @__PURE__ */ new Set()), a = E([]), x = E(y);
2812
2812
  x.current = y, A(() => {
2813
2813
  try {
2814
2814
  const v = localStorage.getItem(r);
@@ -2829,7 +2829,7 @@ function Vr({
2829
2829
  const v = setInterval(() => {
2830
2830
  if (a.current.length === 0 || x.current) return;
2831
2831
  const w = a.current.splice(0, a.current.length);
2832
- d(
2832
+ c(
2833
2833
  (O) => [...w.reverse(), ...O].slice(0, 200)
2834
2834
  );
2835
2835
  }, 100);
@@ -2942,7 +2942,7 @@ function Vr({
2942
2942
  {
2943
2943
  type: "button",
2944
2944
  onClick: () => b((v) => !v),
2945
- style: bt(y ? "#f59e0b" : "transparent"),
2945
+ style: wt(y ? "#f59e0b" : "transparent"),
2946
2946
  title: "Pause / resume capture",
2947
2947
  children: y ? "▶ resume" : "⏸ pause"
2948
2948
  }
@@ -2952,9 +2952,9 @@ function Vr({
2952
2952
  {
2953
2953
  type: "button",
2954
2954
  onClick: () => {
2955
- d([]), a.current = [];
2955
+ c([]), a.current = [];
2956
2956
  },
2957
- style: bt("transparent"),
2957
+ style: wt("transparent"),
2958
2958
  title: "Clear buffer",
2959
2959
  children: "clear"
2960
2960
  }
@@ -2964,7 +2964,7 @@ function Vr({
2964
2964
  {
2965
2965
  type: "button",
2966
2966
  onClick: () => o(!1),
2967
- style: bt("transparent"),
2967
+ style: wt("transparent"),
2968
2968
  "aria-label": "Close",
2969
2969
  title: "Close (Cmd/Ctrl + Shift + L)",
2970
2970
  children: "✕"
@@ -3036,7 +3036,7 @@ function Vr({
3036
3036
  entry: v,
3037
3037
  expanded: s.current.has(v.id),
3038
3038
  onToggle: () => {
3039
- s.current.has(v.id) ? s.current.delete(v.id) : s.current.add(v.id), d((w) => [...w]);
3039
+ s.current.has(v.id) ? s.current.delete(v.id) : s.current.add(v.id), c((w) => [...w]);
3040
3040
  }
3041
3041
  },
3042
3042
  v.id
@@ -3117,7 +3117,7 @@ function Pr({
3117
3117
  }
3118
3118
  );
3119
3119
  }
3120
- function bt(e) {
3120
+ function wt(e) {
3121
3121
  return {
3122
3122
  background: e,
3123
3123
  color: "#fff",
@@ -3138,10 +3138,10 @@ function Dr(e) {
3138
3138
  function Yr() {
3139
3139
  const [e, t] = L([]), r = k((o) => {
3140
3140
  t((l) => {
3141
- const d = l.findIndex((u) => u.id === o.id);
3142
- if (d >= 0) {
3141
+ const c = l.findIndex((u) => u.id === o.id);
3142
+ if (c >= 0) {
3143
3143
  const u = l.slice();
3144
- return u[d] = o, u;
3144
+ return u[c] = o, u;
3145
3145
  }
3146
3146
  return [...l, o];
3147
3147
  });
@@ -3166,7 +3166,7 @@ export {
3166
3166
  yr as extractPageContext,
3167
3167
  xr as extractRoutes,
3168
3168
  Zt as getCachedPageContext,
3169
- vt as getCachedRoutes,
3169
+ bt as getCachedRoutes,
3170
3170
  jn as matchesPattern,
3171
3171
  wr as normalizeRouteInput,
3172
3172
  Vn as shouldRenderAtPath,