@livelayer/react 0.5.10 → 0.5.11

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
2
  import { jsxs as _, jsx as n, Fragment as ht } from "react/jsx-runtime";
3
- import { Component as dn, useState as L, useRef as E, useEffect as R, useCallback as k, useMemo as rt, forwardRef as mt, createElement as un } from "react";
3
+ import { Component as dn, useState as L, useRef as E, useEffect as R, useCallback as k, useMemo as ot, forwardRef as mt, createElement as un } from "react";
4
4
  import { LiveKitSession as fn } from "@livelayer/sdk";
5
5
  import { createLocalAudioTrack as pn, Track as Gt, createLocalVideoTrack as hn } from "livekit-client";
6
6
  class mn extends dn {
@@ -34,16 +34,16 @@ class mn extends dn {
34
34
  }
35
35
  }
36
36
  function gn(e) {
37
- const [t, r] = L("idle"), [o, i] = L("idle"), [l, c] = L([]), [d, f] = L(null), [y, g] = L(null), [a, s] = L(null), [I, C] = L(!1), [S, v] = L(null), b = E(null), z = E(e.onDataMessage);
37
+ const [t, r] = L("idle"), [o, i] = L("idle"), [l, s] = L([]), [d, f] = L(null), [y, g] = L(null), [a, c] = L(null), [I, C] = L(!1), [S, v] = L(null), b = E(null), z = E(e.onDataMessage);
38
38
  z.current = e.onDataMessage, R(() => {
39
39
  const N = {
40
40
  onConnectionStateChange: (D) => {
41
41
  r(D), D === "connected" && v(null);
42
42
  },
43
43
  onAgentStateChange: i,
44
- onTranscript: (D) => c([...D]),
44
+ onTranscript: (D) => s([...D]),
45
45
  onAgentConfig: f,
46
- onAudioTrack: (D) => s(D),
46
+ onAudioTrack: (D) => c(D),
47
47
  onVideoTrack: (D) => g(D),
48
48
  onVideoTrackRemoved: () => g(null),
49
49
  onError: (D) => v(D),
@@ -62,7 +62,7 @@ function gn(e) {
62
62
  },
63
63
  N
64
64
  );
65
- return b.current = q, r("idle"), i("idle"), c([]), f(null), g(null), s(null), C(!1), v(null), () => {
65
+ return b.current = q, r("idle"), i("idle"), s([]), f(null), g(null), c(null), C(!1), v(null), () => {
66
66
  var D;
67
67
  (D = q.destroy) == null || D.call(q), b.current = null;
68
68
  };
@@ -104,7 +104,7 @@ function gn(e) {
104
104
  };
105
105
  }
106
106
  function yn() {
107
- const e = E(null), t = E(null), r = E(null), o = E(null), i = E(/* @__PURE__ */ new Set()), l = E(null), c = k(() => {
107
+ const e = E(null), t = E(null), r = E(null), o = E(null), i = E(/* @__PURE__ */ new Set()), l = E(null), s = k(() => {
108
108
  const a = t.current;
109
109
  if (!a) {
110
110
  o.current = null;
@@ -113,22 +113,22 @@ function yn() {
113
113
  (!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
114
114
  new ArrayBuffer(a.frequencyBinCount)
115
115
  ));
116
- const s = l.current;
117
- a.getByteFrequencyData(s);
116
+ const c = l.current;
117
+ a.getByteFrequencyData(c);
118
118
  let I = 0;
119
- for (let S = 0; S < s.length; S++) I += s[S];
120
- const C = I / s.length / 255;
119
+ for (let S = 0; S < c.length; S++) I += c[S];
120
+ const C = I / c.length / 255;
121
121
  for (const S of i.current)
122
122
  try {
123
123
  S(C);
124
124
  } catch (v) {
125
125
  console.error("[useAudioLevel] subscriber threw:", v);
126
126
  }
127
- o.current = requestAnimationFrame(c);
127
+ o.current = requestAnimationFrame(s);
128
128
  }, []), d = k(() => {
129
129
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
- const a = new AudioContext(), s = a.createAnalyser();
131
- s.fftSize = 64, s.connect(a.destination), e.current = a, t.current = s;
130
+ const a = new AudioContext(), c = a.createAnalyser();
131
+ c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
132
132
  }, []), f = k(
133
133
  (a) => {
134
134
  if (d(), !(!e.current || !t.current)) {
@@ -140,16 +140,16 @@ function yn() {
140
140
  r.current = null;
141
141
  }
142
142
  try {
143
- const s = e.current.createMediaElementSource(a);
144
- s.connect(t.current), r.current = s;
145
- } catch (s) {
146
- console.warn("[useAudioLevel] createMediaElementSource failed:", s);
143
+ const c = e.current.createMediaElementSource(a);
144
+ c.connect(t.current), r.current = c;
145
+ } catch (c) {
146
+ console.warn("[useAudioLevel] createMediaElementSource failed:", c);
147
147
  return;
148
148
  }
149
- o.current === null && (o.current = requestAnimationFrame(c));
149
+ o.current === null && (o.current = requestAnimationFrame(s));
150
150
  }
151
151
  },
152
- [d, c]
152
+ [d, s]
153
153
  ), y = k(() => {
154
154
  if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
155
155
  try {
@@ -180,7 +180,7 @@ function yn() {
180
180
  }, [y]), { attach: f, detach: y, subscribe: g };
181
181
  }
182
182
  function vn() {
183
- const [e, t] = L(!1), [r, o] = L(null), i = E(null), l = E(null), c = k(async (g) => {
183
+ const [e, t] = L(!1), [r, o] = L(null), i = E(null), l = E(null), s = k(async (g) => {
184
184
  if (i.current && l.current) {
185
185
  try {
186
186
  await l.current.localParticipant.unpublishTrack(i.current);
@@ -196,8 +196,8 @@ function vn() {
196
196
  });
197
197
  await g.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
198
198
  } catch (a) {
199
- const s = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
- throw o(s), a;
199
+ const c = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
+ throw o(c), a;
201
201
  }
202
202
  }, []), d = k(() => {
203
203
  const g = i.current;
@@ -217,14 +217,14 @@ function vn() {
217
217
  isMuted: e,
218
218
  micError: r,
219
219
  toggleMute: d,
220
- setupMic: c,
220
+ setupMic: s,
221
221
  teardownMic: f,
222
222
  clearError: y
223
223
  };
224
224
  }
225
225
  const bn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
226
  function wn() {
227
- const [e, t] = L(!1), [r, o] = L(null), [i, l] = L(null), [c, d] = L(""), f = E(null), y = E(null), g = k((b) => {
227
+ const [e, t] = L(!1), [r, o] = L(null), [i, l] = L(null), [s, d] = L(""), f = E(null), y = E(null), g = k((b) => {
228
228
  f.current = b;
229
229
  }, []), a = k(() => {
230
230
  const b = f.current, z = y.current;
@@ -240,7 +240,7 @@ function wn() {
240
240
  z.stop();
241
241
  }
242
242
  y.current = null, l(null), t(!1);
243
- }, []), s = k(async (b) => {
243
+ }, []), c = k(async (b) => {
244
244
  const z = f.current;
245
245
  if (z) {
246
246
  o(null);
@@ -264,10 +264,10 @@ function wn() {
264
264
  }
265
265
  }
266
266
  }, []), I = k(async () => {
267
- e ? a() : await s(c || void 0);
268
- }, [e, c, a, s]), C = k(async (b) => {
269
- a(), await s(b);
270
- }, [a, s]), S = k(() => {
267
+ e ? a() : await c(s || void 0);
268
+ }, [e, s, a, c]), C = k(async (b) => {
269
+ a(), await c(b);
270
+ }, [a, c]), S = k(() => {
271
271
  a(), f.current = null, o(null), d("");
272
272
  }, [a]), v = k(() => o(null), []);
273
273
  return R(() => () => {
@@ -276,7 +276,7 @@ function wn() {
276
276
  isEnabled: e,
277
277
  error: r,
278
278
  previewEl: i,
279
- activeDeviceId: c,
279
+ activeDeviceId: s,
280
280
  toggle: I,
281
281
  switchDevice: C,
282
282
  attachRoom: g,
@@ -285,14 +285,14 @@ function wn() {
285
285
  };
286
286
  }
287
287
  function _n() {
288
- const [e, t] = L(!1), [r, o] = L(null), [i, l] = L(null), c = E(null), d = k((s) => {
289
- c.current = s;
288
+ const [e, t] = L(!1), [r, o] = L(null), [i, l] = L(null), s = E(null), d = k((c) => {
289
+ s.current = c;
290
290
  }, []), f = k(() => l(null), []), y = k(async () => {
291
- const s = c.current;
292
- if (s) {
291
+ const c = s.current;
292
+ if (c) {
293
293
  if (e) {
294
294
  try {
295
- await s.localParticipant.setScreenShareEnabled(!1);
295
+ await c.localParticipant.setScreenShareEnabled(!1);
296
296
  } catch {
297
297
  }
298
298
  f(), t(!1);
@@ -300,15 +300,15 @@ function _n() {
300
300
  }
301
301
  o(null);
302
302
  try {
303
- await s.localParticipant.setScreenShareEnabled(!0);
303
+ await c.localParticipant.setScreenShareEnabled(!0);
304
304
  let I = 0;
305
305
  const C = () => {
306
- const S = s.localParticipant.getTrackPublication(Gt.Source.ScreenShare);
306
+ const S = c.localParticipant.getTrackPublication(Gt.Source.ScreenShare);
307
307
  if (S != null && S.track) {
308
308
  const v = S.track.attach();
309
309
  l(v), t(!0);
310
310
  try {
311
- s.localParticipant.publishData(
311
+ c.localParticipant.publishData(
312
312
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
313
313
  { reliable: !0 }
314
314
  );
@@ -325,13 +325,13 @@ function _n() {
325
325
  }
326
326
  }
327
327
  }, [e, f]), g = k(() => {
328
- const s = c.current;
329
- if (s && e)
328
+ const c = s.current;
329
+ if (c && e)
330
330
  try {
331
- s.localParticipant.setScreenShareEnabled(!1);
331
+ c.localParticipant.setScreenShareEnabled(!1);
332
332
  } catch {
333
333
  }
334
- f(), t(!1), o(null), c.current = null;
334
+ f(), t(!1), o(null), s.current = null;
335
335
  }, [e, f]), a = k(() => o(null), []);
336
336
  return { isEnabled: e, error: r, previewEl: i, toggle: y, attachRoom: d, teardown: g, clearError: a };
337
337
  }
@@ -340,7 +340,7 @@ function xn() {
340
340
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
341
341
  try {
342
342
  const l = await navigator.mediaDevices.enumerateDevices();
343
- t(l.filter((c) => c.kind === "audioinput")), o(l.filter((c) => c.kind === "videoinput"));
343
+ t(l.filter((s) => s.kind === "audioinput")), o(l.filter((s) => s.kind === "videoinput"));
344
344
  } catch {
345
345
  }
346
346
  }, []);
@@ -351,25 +351,25 @@ function xn() {
351
351
  }, [i]), { mics: e, cameras: r, refresh: i };
352
352
  }
353
353
  function kn(e, t, r = !1) {
354
- const [o, i] = L(null), [l, c] = L(null), [d, f] = L(!r && !!e);
354
+ const [o, i] = L(null), [l, s] = L(null), [d, f] = L(!r && !!e);
355
355
  return R(() => {
356
356
  if (r || !e) {
357
357
  f(!1);
358
358
  return;
359
359
  }
360
360
  const y = new AbortController(), g = t || "https://app.livelayer.studio";
361
- return f(!0), c(null), fetch(`${g}/api/widget/agent/${encodeURIComponent(e)}`, {
361
+ return f(!0), s(null), fetch(`${g}/api/widget/agent/${encodeURIComponent(e)}`, {
362
362
  signal: y.signal
363
363
  }).then(async (a) => {
364
364
  if (!a.ok) {
365
- const s = await a.json().catch(() => ({}));
366
- throw new Error(s.error || `HTTP ${a.status}`);
365
+ const c = await a.json().catch(() => ({}));
366
+ throw new Error(c.error || `HTTP ${a.status}`);
367
367
  }
368
368
  return a.json();
369
369
  }).then((a) => {
370
370
  y.signal.aborted || (i(a), f(!1));
371
371
  }).catch((a) => {
372
- y.signal.aborted || (c(a instanceof Error ? a.message : "Agent lookup failed"), f(!1));
372
+ y.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), f(!1));
373
373
  }), () => y.abort();
374
374
  }, [e, t, r]), { info: o, error: l, loading: d };
375
375
  }
@@ -393,13 +393,13 @@ function Cn({
393
393
  defaultValue: t = "expanded",
394
394
  onChange: r
395
395
  } = {}) {
396
- const o = e !== void 0, [i, l] = L(t), c = o ? e : i, d = k(
396
+ const o = e !== void 0, [i, l] = L(t), s = o ? e : i, d = k(
397
397
  (f) => {
398
- f !== c && (o || l(f), r == null || r(f));
398
+ f !== s && (o || l(f), r == null || r(f));
399
399
  },
400
- [c, o, r]
400
+ [s, o, r]
401
401
  );
402
- return [c, d];
402
+ return [s, d];
403
403
  }
404
404
  const En = ["hidden", "minimized", "expanded"];
405
405
  function Nn(e) {
@@ -412,7 +412,7 @@ function An({
412
412
  persistKey: o = "ll-widget",
413
413
  disablePersistence: i = !1
414
414
  } = {}) {
415
- const l = `${o}:display-mode`, c = E(!1), [d, f] = Cn({
415
+ const l = `${o}:display-mode`, s = E(!1), [d, f] = Cn({
416
416
  value: e,
417
417
  defaultValue: t,
418
418
  onChange: (y) => {
@@ -420,7 +420,7 @@ function An({
420
420
  }
421
421
  });
422
422
  return R(() => {
423
- if (c.current || (c.current = !0, i || e !== void 0)) return;
423
+ if (s.current || (s.current = !0, i || e !== void 0)) return;
424
424
  const y = Nn(Ln(l));
425
425
  y && y !== d && f(y);
426
426
  }, []), [d, f];
@@ -441,16 +441,16 @@ function In(e = Rn) {
441
441
  });
442
442
  }, [e]), t;
443
443
  }
444
- const It = "__llHistoryPatched", ot = "ll:pathname";
444
+ const It = "__llHistoryPatched", it = "ll:pathname";
445
445
  function Mn() {
446
446
  if (typeof window > "u" || window.history[It]) return;
447
447
  const e = window.history.pushState, t = window.history.replaceState;
448
448
  window.history.pushState = function(...r) {
449
449
  const o = e.apply(this, r);
450
- return window.dispatchEvent(new Event(ot)), o;
450
+ return window.dispatchEvent(new Event(it)), o;
451
451
  }, window.history.replaceState = function(...r) {
452
452
  const o = t.apply(this, r);
453
- return window.dispatchEvent(new Event(ot)), o;
453
+ return window.dispatchEvent(new Event(it)), o;
454
454
  }, window.history[It] = !0;
455
455
  }
456
456
  function Mt() {
@@ -464,8 +464,8 @@ function Tn(e) {
464
464
  if (e !== void 0) return;
465
465
  Mn();
466
466
  const o = () => r(Mt());
467
- return o(), window.addEventListener("popstate", o), window.addEventListener(ot, o), () => {
468
- window.removeEventListener("popstate", o), window.removeEventListener(ot, o);
467
+ return o(), window.addEventListener("popstate", o), window.addEventListener(it, o), () => {
468
+ window.removeEventListener("popstate", o), window.removeEventListener(it, o);
469
469
  };
470
470
  }, [e]), e ?? t;
471
471
  }
@@ -496,7 +496,7 @@ function On(e, t, r) {
496
496
  return e === void 0 ? !0 : Pt(r, e) ? !1 : t && t.length > 0 ? Pt(t, e) : !0;
497
497
  }
498
498
  function Bn(e, t, r) {
499
- return rt(
499
+ return ot(
500
500
  () => On(e, t, r),
501
501
  [e, t, r]
502
502
  );
@@ -623,9 +623,9 @@ const Vn = ({
623
623
  onExpand: o,
624
624
  label: i = "Open widget",
625
625
  avatarImageUrl: l,
626
- agentName: c
626
+ agentName: s
627
627
  }) => {
628
- const d = Fn(e), f = d === "right" ? "left" : "right", y = t ? 80 : 72, g = !!l, [a, s] = L(null), [I, C] = L(!1), S = E(null), v = E(!1), b = k(
628
+ const d = Fn(e), f = d === "right" ? "left" : "right", y = t ? 80 : 72, g = !!l, [a, c] = L(null), [I, C] = L(!1), S = E(null), v = E(!1), b = k(
629
629
  (A) => {
630
630
  if (typeof window > "u") return A;
631
631
  const O = y / 2, W = Ht + O, Y = window.innerHeight - Ht - O;
@@ -635,9 +635,9 @@ const Vn = ({
635
635
  );
636
636
  R(() => {
637
637
  const A = jn();
638
- s(b(A ?? window.innerHeight / 2));
638
+ c(b(A ?? window.innerHeight / 2));
639
639
  const O = () => {
640
- s((W) => W === null ? null : b(W));
640
+ c((W) => W === null ? null : b(W));
641
641
  };
642
642
  return window.addEventListener("resize", O), () => window.removeEventListener("resize", O);
643
643
  }, [b]);
@@ -661,7 +661,7 @@ const Vn = ({
661
661
  const O = S.current;
662
662
  if (!O) return;
663
663
  const W = A.clientY - O.startClientY;
664
- !O.moved && Math.abs(W) > Un && (O.moved = !0, C(!0)), O.moved && s(b(O.startCenterY + W));
664
+ !O.moved && Math.abs(W) > Un && (O.moved = !0, C(!0)), O.moved && c(b(O.startCenterY + W));
665
665
  },
666
666
  [b]
667
667
  ), H = k(
@@ -672,7 +672,7 @@ const Vn = ({
672
672
  A.currentTarget.releasePointerCapture(A.pointerId);
673
673
  } catch {
674
674
  }
675
- S.current = null, O.moved && (C(!1), v.current = !0, s((W) => (W !== null && Ot(W), W)));
675
+ S.current = null, O.moved && (C(!1), v.current = !0, c((W) => (W !== null && Ot(W), W)));
676
676
  }
677
677
  },
678
678
  []
@@ -687,7 +687,7 @@ const Vn = ({
687
687
  if (A.key === "ArrowUp" || A.key === "ArrowDown") {
688
688
  A.preventDefault();
689
689
  const O = A.key === "ArrowUp" ? -8 : 8;
690
- s((W) => {
690
+ c((W) => {
691
691
  if (W === null) return W;
692
692
  const Y = b(W + O);
693
693
  return Ot(Y), Y;
@@ -734,7 +734,7 @@ const Vn = ({
734
734
  "img",
735
735
  {
736
736
  src: l,
737
- alt: c ? `${c} avatar` : "Agent avatar",
737
+ alt: s ? `${s} avatar` : "Agent avatar",
738
738
  className: "ll-hidden__avatar",
739
739
  draggable: !1
740
740
  }
@@ -757,24 +757,24 @@ const Vn = ({
757
757
  className: i,
758
758
  barClassName: l
759
759
  }) => {
760
- const c = E(null), d = E([]), f = rt(() => {
760
+ const s = E(null), d = E([]), f = ot(() => {
761
761
  const g = (Math.sqrt(5) - 1) / 2;
762
- return Array.from({ length: t }, (a, s) => 0.5 + s * g % 1 * 0.5);
762
+ return Array.from({ length: t }, (a, c) => 0.5 + c * g % 1 * 0.5);
763
763
  }, [t]);
764
764
  R(() => e.subscribe((a) => {
765
- for (let s = 0; s < t; s++) {
766
- const I = d.current[s];
765
+ for (let c = 0; c < t; c++) {
766
+ const I = d.current[c];
767
767
  if (!I) continue;
768
- const C = Math.max(o, a * r * f[s]);
768
+ const C = Math.max(o, a * r * f[c]);
769
769
  I.style.height = `${C}px`;
770
770
  }
771
771
  }), [e, t, r, o, f]);
772
772
  const y = ["ll-waveform", i].filter(Boolean).join(" ");
773
- return /* @__PURE__ */ n("div", { ref: c, className: y, "aria-hidden": "true", children: Array.from({ length: t }, (g, a) => /* @__PURE__ */ n(
773
+ return /* @__PURE__ */ n("div", { ref: s, className: y, "aria-hidden": "true", children: Array.from({ length: t }, (g, a) => /* @__PURE__ */ n(
774
774
  "div",
775
775
  {
776
- ref: (s) => {
777
- d.current[a] = s;
776
+ ref: (c) => {
777
+ d.current[a] = c;
778
778
  },
779
779
  className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
780
780
  style: { height: `${o}px` }
@@ -788,7 +788,7 @@ const Vn = ({
788
788
  avatarImageUrl: o,
789
789
  agentState: i,
790
790
  isMuted: l,
791
- audioLevel: c,
791
+ audioLevel: s,
792
792
  onExpand: d,
793
793
  onToggleMute: f,
794
794
  onClose: y
@@ -820,7 +820,7 @@ const Vn = ({
820
820
  /* @__PURE__ */ n(
821
821
  Yn,
822
822
  {
823
- audioLevel: c,
823
+ audioLevel: s,
824
824
  bars: 16,
825
825
  maxHeight: 18,
826
826
  className: "ll-minimized__waveform"
@@ -914,9 +914,9 @@ const Vn = ({
914
914
  className: o,
915
915
  style: i
916
916
  }) => {
917
- const [l, c] = L(!1), d = E(e);
917
+ const [l, s] = L(!1), d = E(e);
918
918
  if (R(() => {
919
- d.current !== e && (d.current = e, c(!1));
919
+ d.current !== e && (d.current = e, s(!1));
920
920
  }, [e]), !e) return null;
921
921
  const f = {
922
922
  position: "absolute",
@@ -941,7 +941,7 @@ const Vn = ({
941
941
  style: f,
942
942
  loading: "eager",
943
943
  fetchPriority: "high",
944
- onLoad: () => c(!0)
944
+ onLoad: () => s(!0)
945
945
  }
946
946
  )
947
947
  );
@@ -952,13 +952,13 @@ const Vn = ({
952
952
  avatarImageUrl: o,
953
953
  idleLoopUrl: i,
954
954
  greeting: l,
955
- branding: c,
955
+ branding: s,
956
956
  teamMembers: d,
957
957
  currentTeamMemberId: f,
958
958
  isSwitchingTeamMember: y,
959
959
  teamSwitcherOpen: g,
960
960
  onToggleTeamSwitcher: a,
961
- onSelectTeamMember: s,
961
+ onSelectTeamMember: c,
962
962
  languageMenuOpen: I,
963
963
  onToggleLanguageMenu: C,
964
964
  connectionState: S,
@@ -975,13 +975,13 @@ const Vn = ({
975
975
  cameraDevices: O,
976
976
  activeCameraId: W,
977
977
  isScreenShareEnabled: Y,
978
- screenPreviewEl: te,
978
+ screenPreviewEl: ne,
979
979
  isSpeakerMuted: me,
980
980
  allowCamera: je,
981
981
  allowScreenShare: Ve,
982
982
  allowTyping: Ye,
983
983
  avatarVideoContainerRef: Ge,
984
- agentVideoEl: ee,
984
+ agentVideoEl: te,
985
985
  onConnect: ge,
986
986
  onDisconnect: we,
987
987
  onRetry: _e,
@@ -990,79 +990,79 @@ const Vn = ({
990
990
  onToggleCamera: Le,
991
991
  onSwitchCameraDevice: Se,
992
992
  onToggleScreenShare: V,
993
- onToggleSpeaker: lt,
993
+ onToggleSpeaker: at,
994
994
  onSendMessage: Je,
995
995
  onMinimize: Ke,
996
996
  onClose: se,
997
- onClearMicError: De
997
+ onClearMicError: Pe
998
998
  }) => {
999
- var Ae;
1000
- const ce = b.length > 0 ? b[b.length - 1] : null, ye = ((d == null ? void 0 : d.length) ?? 0) > 1, Ce = S === "connecting" || S === "connected", Z = S === "connected", X = S === "idle" || S === "disconnected" || S === "error", [Ee, re] = L(!1);
999
+ var Qe;
1000
+ const Q = b.length > 0 ? b[b.length - 1] : null, ye = ((d == null ? void 0 : d.length) ?? 0) > 1, Ce = S === "connecting" || S === "connected", K = S === "connected", Z = S === "idle" || S === "disconnected" || S === "error", [Ee, oe] = L(!1);
1001
1001
  R(() => {
1002
- if (!ee) {
1003
- re(!1);
1002
+ if (!te) {
1003
+ oe(!1);
1004
1004
  return;
1005
1005
  }
1006
- if (!ee.paused && ee.readyState >= 2) {
1007
- re(!0);
1006
+ if (!te.paused && te.readyState >= 2) {
1007
+ oe(!0);
1008
1008
  return;
1009
1009
  }
1010
- re(!1);
1011
- const p = () => re(!0);
1012
- return ee.addEventListener("playing", p), ee.addEventListener("loadeddata", p), () => {
1013
- ee.removeEventListener("playing", p), ee.removeEventListener("loadeddata", p);
1010
+ oe(!1);
1011
+ const p = () => oe(!0);
1012
+ return te.addEventListener("playing", p), te.addEventListener("loadeddata", p), () => {
1013
+ te.removeEventListener("playing", p), te.removeEventListener("loadeddata", p);
1014
1014
  };
1015
- }, [ee]);
1016
- const [ae, ve] = L(!1);
1015
+ }, [te]);
1016
+ const [ce, ve] = L(!1);
1017
1017
  R(() => {
1018
- if (!Z) {
1018
+ if (!K) {
1019
1019
  ve(!1);
1020
1020
  return;
1021
1021
  }
1022
1022
  if (Ee) return;
1023
1023
  const p = setTimeout(() => ve(!0), 8e3);
1024
1024
  return () => clearTimeout(p);
1025
- }, [Z, Ee]);
1026
- const $e = S === "connecting" || Z && !!o && !Ee && !ae, ne = E(null), oe = E(null);
1025
+ }, [K, Ee]);
1026
+ const De = S === "connecting" || K && !!o && !Ee && !ce, re = E(null), ie = E(null);
1027
1027
  R(() => {
1028
- const p = ne.current;
1028
+ const p = re.current;
1029
1029
  p && (p.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", p.appendChild(A)));
1030
1030
  }, [A]), R(() => {
1031
- const p = oe.current;
1032
- p && (p.innerHTML = "", te && (te.style.width = "100%", te.style.height = "100%", te.style.objectFit = "contain", p.appendChild(te)));
1033
- }, [te]);
1034
- const [ie, de] = L(!1), [Ne, ue] = L(!1);
1031
+ const p = ie.current;
1032
+ p && (p.innerHTML = "", ne && (ne.style.width = "100%", ne.style.height = "100%", ne.style.objectFit = "contain", p.appendChild(ne)));
1033
+ }, [ne]);
1034
+ const [le, de] = L(!1), [Ne, ue] = L(!1);
1035
1035
  R(() => {
1036
- if (!ie && !Ne && !I && !g) return;
1036
+ if (!le && !Ne && !I && !g) return;
1037
1037
  const p = () => {
1038
1038
  de(!1), ue(!1), I && C(), g && a();
1039
1039
  };
1040
1040
  return document.addEventListener("click", p), () => document.removeEventListener("click", p);
1041
1041
  }, [
1042
- ie,
1042
+ le,
1043
1043
  Ne,
1044
1044
  I,
1045
1045
  g,
1046
1046
  C,
1047
1047
  a
1048
1048
  ]);
1049
- const [fe, ze] = L(""), He = k(
1049
+ const [fe, $e] = L(""), ze = k(
1050
1050
  (p) => {
1051
1051
  p.preventDefault();
1052
- const K = fe.trim();
1053
- K && (Je(K), ze(""));
1052
+ const X = fe.trim();
1053
+ X && (Je(X), $e(""));
1054
1054
  },
1055
1055
  [fe, Je]
1056
- ), Oe = c.productName || "Live Layer", Xe = Z && (ce != null && ce.text) ? ce.text : l || "", at = [
1056
+ ), He = s.productName || "Live Layer", Xe = K && (Q != null && Q.text) ? Q.text : l || "", ct = K && (Q == null ? void 0 : Q.role) === "agent", Oe = [
1057
1057
  "ll-expanded",
1058
1058
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1059
1059
  ].join(" ");
1060
1060
  return /* @__PURE__ */ _(
1061
1061
  "div",
1062
1062
  {
1063
- className: at,
1063
+ className: Oe,
1064
1064
  "data-position": e,
1065
- "data-state": Z ? "connected" : Ce ? "connecting" : "idle",
1065
+ "data-state": K ? "connected" : Ce ? "connecting" : "idle",
1066
1066
  role: "dialog",
1067
1067
  "aria-label": `${r} widget`,
1068
1068
  children: [
@@ -1074,8 +1074,8 @@ const Vn = ({
1074
1074
  alt: r,
1075
1075
  className: "ll-expanded__bg-img"
1076
1076
  }
1077
- ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Ae = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Ae.toUpperCase()) || "A" }) }),
1078
- i && !Z && /* @__PURE__ */ n(
1077
+ ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Qe = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Qe.toUpperCase()) || "A" }) }),
1078
+ i && !K && /* @__PURE__ */ n(
1079
1079
  "video",
1080
1080
  {
1081
1081
  className: "ll-expanded__bg-idle",
@@ -1088,11 +1088,11 @@ const Vn = ({
1088
1088
  )
1089
1089
  ] }),
1090
1090
  /* @__PURE__ */ n("div", { ref: Ge, className: "ll-expanded__video" }),
1091
- $e && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1091
+ De && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1092
1092
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1093
1093
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: y ? "Switching..." : "Connecting..." })
1094
1094
  ] }),
1095
- M && Z && /* @__PURE__ */ _(
1095
+ M && K && /* @__PURE__ */ _(
1096
1096
  "button",
1097
1097
  {
1098
1098
  type: "button",
@@ -1119,7 +1119,7 @@ const Vn = ({
1119
1119
  "aria-expanded": ye ? g : void 0,
1120
1120
  children: [
1121
1121
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1122
- ye && /* @__PURE__ */ n(tt, {})
1122
+ ye && /* @__PURE__ */ n(nt, {})
1123
1123
  ]
1124
1124
  }
1125
1125
  ),
@@ -1134,7 +1134,7 @@ const Vn = ({
1134
1134
  {
1135
1135
  type: "button",
1136
1136
  className: `ll-hmenu__item ${p.id === f ? "is-active" : ""}`,
1137
- onClick: () => s(p.id),
1137
+ onClick: () => c(p.id),
1138
1138
  role: "option",
1139
1139
  "aria-selected": p.id === f,
1140
1140
  children: [
@@ -1170,7 +1170,7 @@ const Vn = ({
1170
1170
  title: "Language: English",
1171
1171
  children: [
1172
1172
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
1173
- /* @__PURE__ */ n(tt, {})
1173
+ /* @__PURE__ */ n(nt, {})
1174
1174
  ]
1175
1175
  }
1176
1176
  ),
@@ -1228,7 +1228,7 @@ const Vn = ({
1228
1228
  ] }) : (
1229
1229
  // Idle-state header with Live Layer product name + minimize/close
1230
1230
  /* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1231
- /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Oe }),
1231
+ /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: He }),
1232
1232
  /* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
1233
1233
  /* @__PURE__ */ n(
1234
1234
  "button",
@@ -1253,8 +1253,8 @@ const Vn = ({
1253
1253
  ] })
1254
1254
  ] })
1255
1255
  ),
1256
- X && /* @__PURE__ */ (() => {
1257
- const p = z ? "Restart paused session" : S === "disconnected" ? "Reconnect to agent" : "Start video call", K = z ? "Pick up where you left off" : null;
1256
+ Z && /* @__PURE__ */ (() => {
1257
+ const p = z ? "Restart paused session" : S === "disconnected" ? "Reconnect to agent" : "Start video call", X = z ? "Pick up where you left off" : null;
1258
1258
  return /* @__PURE__ */ _(ht, { children: [
1259
1259
  S === "idle" && !z && !H && /* @__PURE__ */ _(
1260
1260
  "button",
@@ -1271,7 +1271,7 @@ const Vn = ({
1271
1271
  ),
1272
1272
  /* @__PURE__ */ _("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1273
1273
  l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
1274
- K && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: K }),
1274
+ X && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: X }),
1275
1275
  /* @__PURE__ */ n(
1276
1276
  "button",
1277
1277
  {
@@ -1293,14 +1293,14 @@ const Vn = ({
1293
1293
  /* @__PURE__ */ n(
1294
1294
  "div",
1295
1295
  {
1296
- ref: oe,
1296
+ ref: ie,
1297
1297
  className: Y ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1298
1298
  }
1299
1299
  ),
1300
1300
  /* @__PURE__ */ n(
1301
1301
  "div",
1302
1302
  {
1303
- ref: ne,
1303
+ ref: re,
1304
1304
  className: !Y && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1305
1305
  }
1306
1306
  )
@@ -1308,7 +1308,14 @@ const Vn = ({
1308
1308
  }
1309
1309
  ),
1310
1310
  Ce ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
1311
- Xe && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Xe }) }),
1311
+ Xe && /* @__PURE__ */ n(
1312
+ "div",
1313
+ {
1314
+ className: `ll-expanded__transcript${ct ? " ll-expanded__transcript--agent" : ""}`,
1315
+ "data-role": K ? (Q == null ? void 0 : Q.role) ?? "agent" : "agent",
1316
+ children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Xe })
1317
+ }
1318
+ ),
1312
1319
  /* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (p) => p.stopPropagation(), children: [
1313
1320
  Ve && /* @__PURE__ */ n(
1314
1321
  "button",
@@ -1339,12 +1346,12 @@ const Vn = ({
1339
1346
  type: "button",
1340
1347
  className: `ll-tool ll-tool--right ${D ? "is-on" : ""}`,
1341
1348
  onClick: (p) => {
1342
- p.stopPropagation(), ue((K) => !K), de(!1);
1349
+ p.stopPropagation(), ue((X) => !X), de(!1);
1343
1350
  },
1344
1351
  "aria-label": "Camera devices",
1345
1352
  "aria-haspopup": "listbox",
1346
1353
  "aria-expanded": Ne,
1347
- children: /* @__PURE__ */ n(tt, {})
1354
+ children: /* @__PURE__ */ n(nt, {})
1348
1355
  }
1349
1356
  ),
1350
1357
  Ne && O.length > 0 && /* @__PURE__ */ n(
@@ -1377,15 +1384,15 @@ const Vn = ({
1377
1384
  type: "button",
1378
1385
  className: `ll-tool ll-tool--right ${h ? "is-muted" : ""}`,
1379
1386
  onClick: (p) => {
1380
- p.stopPropagation(), de((K) => !K), ue(!1);
1387
+ p.stopPropagation(), de((X) => !X), ue(!1);
1381
1388
  },
1382
1389
  "aria-label": "Microphone devices",
1383
1390
  "aria-haspopup": "listbox",
1384
- "aria-expanded": ie,
1385
- children: /* @__PURE__ */ n(tt, {})
1391
+ "aria-expanded": le,
1392
+ children: /* @__PURE__ */ n(nt, {})
1386
1393
  }
1387
1394
  ),
1388
- ie && q.length > 0 && /* @__PURE__ */ n(
1395
+ le && q.length > 0 && /* @__PURE__ */ n(
1389
1396
  Wt,
1390
1397
  {
1391
1398
  label: "Microphone",
@@ -1400,7 +1407,7 @@ const Vn = ({
1400
1407
  {
1401
1408
  type: "button",
1402
1409
  className: `ll-tool ${me ? "is-muted" : ""}`,
1403
- onClick: lt,
1410
+ onClick: at,
1404
1411
  "aria-label": me ? "Unmute speaker" : "Mute speaker",
1405
1412
  title: me ? "Unmute speaker" : "Mute speaker",
1406
1413
  children: /* @__PURE__ */ n(er, { muted: me })
@@ -1418,7 +1425,7 @@ const Vn = ({
1418
1425
  }
1419
1426
  )
1420
1427
  ] }),
1421
- Ye && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: He, children: [
1428
+ Ye && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: ze, children: [
1422
1429
  /* @__PURE__ */ n(
1423
1430
  "input",
1424
1431
  {
@@ -1426,7 +1433,7 @@ const Vn = ({
1426
1433
  className: "ll-message-input__field",
1427
1434
  placeholder: "Message...",
1428
1435
  value: fe,
1429
- onChange: (p) => ze(p.target.value),
1436
+ onChange: (p) => $e(p.target.value),
1430
1437
  "aria-label": "Message the agent"
1431
1438
  }
1432
1439
  ),
@@ -1450,14 +1457,14 @@ const Vn = ({
1450
1457
  {
1451
1458
  type: "button",
1452
1459
  className: "ll-expanded__banner-x",
1453
- onClick: De,
1460
+ onClick: Pe,
1454
1461
  "aria-label": "Dismiss",
1455
1462
  children: "×"
1456
1463
  }
1457
1464
  )
1458
1465
  ] });
1459
1466
  if (!H || S !== "error") return null;
1460
- let p = "Failed to connect", K = "Try again";
1467
+ let p = "Failed to connect", X = "Try again";
1461
1468
  return H === "MIC_PERMISSION_DENIED" ? p = "Microphone blocked. Allow access to talk." : H === "MIC_NOT_FOUND" ? p = "No microphone found. Plug one in + retry." : H === "MIC_UNAVAILABLE" ? p = "Mic unavailable. Check other apps using it." : H === "AGENT_TIMEOUT" ? p = "Agent didn't pick up. Try again." : H === "CONNECT_FAILED" ? p = "Connection failed. Check your network." : H.length < 80 && (p = H), /* @__PURE__ */ _("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1462
1469
  /* @__PURE__ */ n("span", { children: p }),
1463
1470
  /* @__PURE__ */ n(
@@ -1466,7 +1473,7 @@ const Vn = ({
1466
1473
  type: "button",
1467
1474
  className: "ll-expanded__banner-retry",
1468
1475
  onClick: _e,
1469
- children: K
1476
+ children: X
1470
1477
  }
1471
1478
  )
1472
1479
  ] });
@@ -1475,7 +1482,7 @@ const Vn = ({
1475
1482
  }
1476
1483
  );
1477
1484
  };
1478
- function tt() {
1485
+ function nt() {
1479
1486
  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" }) });
1480
1487
  }
1481
1488
  function Bt() {
@@ -1541,17 +1548,17 @@ const Wt = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */
1541
1548
  children: [
1542
1549
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1543
1550
  t.map((i, l) => {
1544
- const c = r === i.deviceId;
1551
+ const s = r === i.deviceId;
1545
1552
  return /* @__PURE__ */ _(
1546
1553
  "button",
1547
1554
  {
1548
1555
  type: "button",
1549
- className: `ll-device-menu__item ${c ? "is-active" : ""}`,
1556
+ className: `ll-device-menu__item ${s ? "is-active" : ""}`,
1550
1557
  onClick: () => o(i.deviceId),
1551
1558
  role: "option",
1552
- "aria-selected": c,
1559
+ "aria-selected": s,
1553
1560
  children: [
1554
- c && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1561
+ s && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1555
1562
  /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: i.label || `${e} ${l + 1}` })
1556
1563
  ]
1557
1564
  },
@@ -1573,7 +1580,7 @@ function gt(e) {
1573
1580
  }
1574
1581
  return !1;
1575
1582
  }
1576
- function it(e) {
1583
+ function lt(e) {
1577
1584
  if (gt(e)) return !1;
1578
1585
  if (e instanceof HTMLInputElement) {
1579
1586
  if (e.type === "password") return !1;
@@ -1582,7 +1589,7 @@ function it(e) {
1582
1589
  }
1583
1590
  return !0;
1584
1591
  }
1585
- const nt = 4096, or = 20, ir = 20, lr = 10, ar = 10, sr = 30, Ft = 500, cr = [
1592
+ const rt = 4096, or = 20, ir = 20, lr = 10, ar = 10, cr = 30, Ft = 500, sr = [
1586
1593
  '[data-ll-private="true"]',
1587
1594
  ".ll-widget",
1588
1595
  "script",
@@ -1594,7 +1601,7 @@ function Fe(e) {
1594
1601
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
1595
1602
  let t = e;
1596
1603
  for (; t; ) {
1597
- for (const r of cr)
1604
+ for (const r of sr)
1598
1605
  if (t.matches(r)) return !0;
1599
1606
  t = t.parentElement;
1600
1607
  }
@@ -1623,7 +1630,7 @@ function Ut(e) {
1623
1630
  function be(e, t) {
1624
1631
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
1625
1632
  }
1626
- function Me(e) {
1633
+ function Ie(e) {
1627
1634
  return e.length;
1628
1635
  }
1629
1636
  function dr(e, t = {}) {
@@ -1640,10 +1647,10 @@ function dr(e, t = {}) {
1640
1647
  forms: [],
1641
1648
  extras: e
1642
1649
  };
1643
- const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
1650
+ const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
1644
1651
  r.querySelectorAll("[data-ll-region]")
1645
1652
  ), d = [];
1646
- for (const h of c) {
1653
+ for (const h of s) {
1647
1654
  if (d.length >= lr) break;
1648
1655
  if (Fe(h) || !Ue(h)) continue;
1649
1656
  const N = h.getAttribute("data-ll-region") ?? "", q = h.getAttribute("data-ll-intent") ?? void 0, D = be(
@@ -1666,7 +1673,7 @@ function dr(e, t = {}) {
1666
1673
  const N = (h.textContent || "").trim();
1667
1674
  N.length > 10 && f.push(be(N, Ft));
1668
1675
  }
1669
- const s = f.join(`
1676
+ const c = f.join(`
1670
1677
  `), I = [], C = Array.from(r.querySelectorAll("a[href]"));
1671
1678
  for (const h of C) {
1672
1679
  if (I.length >= or) break;
@@ -1681,7 +1688,7 @@ function dr(e, t = {}) {
1681
1688
  );
1682
1689
  for (const h of v) {
1683
1690
  if (S.length >= ir) break;
1684
- if (Fe(h) || !it(h) || !Ue(h)) continue;
1691
+ if (Fe(h) || !lt(h) || !Ue(h)) continue;
1685
1692
  const N = Ut(h), q = h instanceof HTMLInputElement ? h.type : h.tagName.toLowerCase();
1686
1693
  N && S.push({ label: be(N, 100), type: q });
1687
1694
  }
@@ -1699,12 +1706,12 @@ function dr(e, t = {}) {
1699
1706
  )
1700
1707
  ), A = [];
1701
1708
  for (const O of D) {
1702
- if (A.length >= sr) break;
1703
- if (!it(O)) continue;
1709
+ if (A.length >= cr) break;
1710
+ if (!lt(O)) continue;
1704
1711
  const W = O.getAttribute("data-ll-field") || "";
1705
1712
  if (!W) continue;
1706
- const Y = Ut(O) || W, te = O instanceof HTMLInputElement ? O.type : O.tagName.toLowerCase();
1707
- A.push({ name: W, label: be(Y, 100), type: te });
1713
+ const Y = Ut(O) || W, ne = O instanceof HTMLInputElement ? O.type : O.tagName.toLowerCase();
1714
+ A.push({ name: W, label: be(Y, 100), type: ne });
1708
1715
  }
1709
1716
  z.push({ id: N, intent: q, fields: A });
1710
1717
  }
@@ -1713,29 +1720,29 @@ function dr(e, t = {}) {
1713
1720
  title: l,
1714
1721
  pathname: i,
1715
1722
  regions: d,
1716
- visibleText: s,
1723
+ visibleText: c,
1717
1724
  visibleLinks: I,
1718
1725
  visibleFields: S,
1719
1726
  forms: z,
1720
1727
  extras: e
1721
1728
  };
1722
- let H = Me(JSON.stringify(M.regions)) + Me(M.visibleText) + Me(JSON.stringify(M.visibleLinks)) + Me(JSON.stringify(M.visibleFields));
1723
- for (; H > nt && M.visibleFields.length > 0; )
1724
- M.visibleFields.pop(), H = Me(JSON.stringify(M.visibleFields));
1725
- for (; H > nt && M.visibleLinks.length > 0; )
1729
+ let H = Ie(JSON.stringify(M.regions)) + Ie(M.visibleText) + Ie(JSON.stringify(M.visibleLinks)) + Ie(JSON.stringify(M.visibleFields));
1730
+ for (; H > rt && M.visibleFields.length > 0; )
1731
+ M.visibleFields.pop(), H = Ie(JSON.stringify(M.visibleFields));
1732
+ for (; H > rt && M.visibleLinks.length > 0; )
1726
1733
  M.visibleLinks.pop(), H -= 80;
1727
- return Me(M.visibleText) > nt && (M.visibleText = be(M.visibleText, nt - 100)), M;
1734
+ return Ie(M.visibleText) > rt && (M.visibleText = be(M.visibleText, rt - 100)), M;
1728
1735
  }
1729
- let Te = null;
1736
+ let Me = null;
1730
1737
  function jt(e, t = {}) {
1731
1738
  const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1732
- if (Te && Te.key === i && r - Te.at < 1e3)
1733
- return Te.ctx;
1739
+ if (Me && Me.key === i && r - Me.at < 1e3)
1740
+ return Me.ctx;
1734
1741
  const l = dr(e, t);
1735
- return Te = { key: i, at: r, ctx: l }, l;
1742
+ return Me = { key: i, at: r, ctx: l }, l;
1736
1743
  }
1737
1744
  function ur() {
1738
- Te = null;
1745
+ Me = null;
1739
1746
  }
1740
1747
  const fr = 200;
1741
1748
  function pr(e) {
@@ -1755,10 +1762,10 @@ function mr(e) {
1755
1762
  const t = e ?? (typeof document < "u" ? document : null);
1756
1763
  if (!t) return [];
1757
1764
  const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
1758
- for (const c of l) {
1765
+ for (const s of l) {
1759
1766
  if (i.length >= fr) break;
1760
- if (gt(c)) continue;
1761
- const d = c.getAttribute("href") || "";
1767
+ if (gt(s)) continue;
1768
+ const d = s.getAttribute("href") || "";
1762
1769
  if (!hr(d)) continue;
1763
1770
  let f = d, y = !0;
1764
1771
  try {
@@ -1771,22 +1778,22 @@ function mr(e) {
1771
1778
  }
1772
1779
  if (o.has(f)) continue;
1773
1780
  o.add(f);
1774
- const g = (c.textContent || "").trim().slice(0, 120);
1781
+ const g = (s.textContent || "").trim().slice(0, 120);
1775
1782
  i.push({ href: f, text: g, internal: y });
1776
1783
  }
1777
1784
  return i;
1778
1785
  }
1779
- let Pe = null;
1786
+ let Te = null;
1780
1787
  const gr = 5e3;
1781
1788
  function ft() {
1782
1789
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
1783
- if (Pe && Pe.pathname === t && e - Pe.at < gr)
1784
- return Pe.routes;
1790
+ if (Te && Te.pathname === t && e - Te.at < gr)
1791
+ return Te.routes;
1785
1792
  const r = mr();
1786
- return Pe = { at: e, pathname: t, routes: r }, r;
1793
+ return Te = { at: e, pathname: t, routes: r }, r;
1787
1794
  }
1788
1795
  function yr() {
1789
- Pe = null;
1796
+ Te = null;
1790
1797
  }
1791
1798
  function vr(e, t) {
1792
1799
  const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, o = Object.getOwnPropertyDescriptor(r, "value"), i = o == null ? void 0 : o.set;
@@ -1798,8 +1805,8 @@ function br(e, t, r = {}) {
1798
1805
  const l = Object.getOwnPropertyDescriptor(
1799
1806
  HTMLInputElement.prototype,
1800
1807
  "checked"
1801
- ), c = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
1802
- c ? c.call(e, d) : e.checked = d, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1808
+ ), s = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
1809
+ s ? s.call(e, d) : e.checked = d, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1803
1810
  return;
1804
1811
  }
1805
1812
  vr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
@@ -1880,13 +1887,13 @@ function Cr(e) {
1880
1887
  baseUrl: o = "https://app.livelayer.studio",
1881
1888
  sessionEndpoint: i,
1882
1889
  sessionBody: l,
1883
- autoConnect: c = !1,
1890
+ autoConnect: s = !1,
1884
1891
  displayMode: d,
1885
1892
  defaultDisplayMode: f = "expanded",
1886
1893
  onDisplayModeChange: y,
1887
1894
  position: g = "bottom-right",
1888
1895
  mobileBreakpoint: a = 640,
1889
- persistKey: s = "ll-widget",
1896
+ persistKey: c = "ll-widget",
1890
1897
  disablePersistence: I = !1,
1891
1898
  teamMembers: C,
1892
1899
  currentTeamMemberId: S,
@@ -1903,13 +1910,13 @@ function Cr(e) {
1903
1910
  hideOn: O,
1904
1911
  pathname: W,
1905
1912
  onNavigate: Y,
1906
- onScrollToSelector: te,
1913
+ onScrollToSelector: ne,
1907
1914
  getPageContext: me,
1908
1915
  pageContextExtras: je,
1909
1916
  getRoutes: Ve,
1910
1917
  onScrollPage: Ye,
1911
1918
  onClick: Ge,
1912
- capabilities: ee,
1919
+ capabilities: te,
1913
1920
  onConnect: ge,
1914
1921
  onDisconnect: we,
1915
1922
  onTranscript: _e,
@@ -1918,27 +1925,27 @@ function Cr(e) {
1918
1925
  onAgentEvent: Le,
1919
1926
  onAgentCommand: Se,
1920
1927
  controlledSession: V,
1921
- className: lt,
1928
+ className: at,
1922
1929
  style: Je,
1923
1930
  zIndex: Ke = 2147483647
1924
- } = e, se = Tn(W), De = Bn(se, A, O);
1931
+ } = e, se = Tn(W), Pe = Bn(se, A, O);
1925
1932
  R(() => {
1926
1933
  ur(), yr();
1927
1934
  }, [se]);
1928
- const ce = S !== void 0, [ye, Ce] = L(() => {
1935
+ const Q = S !== void 0, [ye, Ce] = L(() => {
1929
1936
  var m;
1930
1937
  return S ?? ((m = C == null ? void 0 : C[0]) == null ? void 0 : m.id);
1931
- }), Z = ce ? S : ye, X = rt(
1932
- () => (C == null ? void 0 : C.find((m) => m.id === Z)) ?? null,
1933
- [C, Z]
1934
- ), Ee = (X == null ? void 0 : X.agentId) ?? t, [re, ae] = An({
1938
+ }), K = Q ? S : ye, Z = ot(
1939
+ () => (C == null ? void 0 : C.find((m) => m.id === K)) ?? null,
1940
+ [C, K]
1941
+ ), Ee = (Z == null ? void 0 : Z.agentId) ?? t, [oe, ce] = An({
1935
1942
  value: d,
1936
1943
  defaultValue: f,
1937
1944
  onChange: y,
1938
- persistKey: s,
1945
+ persistKey: c,
1939
1946
  disablePersistence: I
1940
- }), ve = In(a), $e = yn(), ne = vn(), oe = wn(), ie = _n(), de = xn(), [Ne, ue] = L(!1), [fe, ze] = L(!1), [He, Oe] = L(!1), [Xe, at] = L(!1), [Ae, p] = L(!1), K = E(Y), Qe = E(te), st = E(Ye), ct = E(Ge), yt = E(me), vt = E(je), bt = E(Ve), dt = E(ee), le = E(null);
1941
- K.current = Y, Qe.current = te, st.current = Ye, ct.current = Ge, yt.current = me, vt.current = je, bt.current = Ve, dt.current = ee;
1947
+ }), ve = In(a), De = yn(), re = vn(), ie = wn(), le = _n(), de = xn(), [Ne, ue] = L(!1), [fe, $e] = L(!1), [ze, He] = L(!1), [Xe, ct] = L(!1), [Oe, Qe] = L(!1), p = E(Y), X = E(ne), Ze = E(Ye), st = E(Ge), yt = E(me), vt = E(je), bt = E(Ve), dt = E(te), ae = E(null);
1948
+ p.current = Y, X.current = ne, Ze.current = Ye, st.current = Ge, yt.current = me, vt.current = je, bt.current = Ve, dt.current = te;
1942
1949
  function pe(m) {
1943
1950
  const u = dt.current;
1944
1951
  return u ? u.includes(m) : !0;
@@ -1950,7 +1957,7 @@ function Cr(e) {
1950
1957
  }
1951
1958
  const Be = k(
1952
1959
  (m) => {
1953
- var G, Re, et, Rt;
1960
+ var G, Ae, tt, Rt;
1954
1961
  const u = m;
1955
1962
  if (!(!u.type || typeof u.type != "string")) {
1956
1963
  if (Le == null || Le({ eventName: u.type, data: m }), u.type === "navigate") {
@@ -1965,9 +1972,9 @@ function Cr(e) {
1965
1972
  );
1966
1973
  return;
1967
1974
  }
1968
- if (K.current) {
1975
+ if (p.current) {
1969
1976
  try {
1970
- K.current(x);
1977
+ p.current(x);
1971
1978
  } catch (T) {
1972
1979
  console.warn(
1973
1980
  `[LiveLayer] onNavigate threw for "${x}". Falling back. Error:`,
@@ -2004,9 +2011,9 @@ function Cr(e) {
2004
2011
  const x = typeof u.selector == "string" ? u.selector : null;
2005
2012
  if (!x) return;
2006
2013
  const T = u.behavior === "instant" ? "instant" : "smooth";
2007
- if (Qe.current) {
2014
+ if (X.current) {
2008
2015
  try {
2009
- Qe.current(
2016
+ X.current(
2010
2017
  x,
2011
2018
  T
2012
2019
  );
@@ -2043,14 +2050,14 @@ function Cr(e) {
2043
2050
  he("request_page_context", "read_page");
2044
2051
  return;
2045
2052
  }
2046
- const x = typeof u.requestId == "string" ? u.requestId : void 0, T = (G = le.current) == null ? void 0 : G.call(le), B = (j) => {
2053
+ const x = typeof u.requestId == "string" ? u.requestId : void 0, T = (G = ae.current) == null ? void 0 : G.call(ae), B = (j) => {
2047
2054
  const P = T, J = P == null ? void 0 : P.localParticipant;
2048
2055
  if (J != null && J.publishData)
2049
2056
  try {
2050
- const Q = x ? { ...j, requestId: x } : j, Ie = new TextEncoder().encode(JSON.stringify(Q));
2051
- J.publishData(Ie, { reliable: !0 });
2052
- } catch (Q) {
2053
- console.warn("[LiveLayer] publishData failed.", Q);
2057
+ const ee = x ? { ...j, requestId: x } : j, Re = new TextEncoder().encode(JSON.stringify(ee));
2058
+ J.publishData(Re, { reliable: !0 });
2059
+ } catch (ee) {
2060
+ console.warn("[LiveLayer] publishData failed.", ee);
2054
2061
  }
2055
2062
  }, $ = vt.current, F = yt.current;
2056
2063
  try {
@@ -2099,9 +2106,9 @@ function Cr(e) {
2099
2106
  return;
2100
2107
  }
2101
2108
  const T = u.behavior === "instant" ? "instant" : "smooth";
2102
- if (st.current) {
2109
+ if (Ze.current) {
2103
2110
  try {
2104
- st.current(
2111
+ Ze.current(
2105
2112
  x,
2106
2113
  T
2107
2114
  );
@@ -2129,9 +2136,9 @@ function Cr(e) {
2129
2136
  console.warn("[LiveLayer] click: missing selector.");
2130
2137
  return;
2131
2138
  }
2132
- if (ct.current) {
2139
+ if (st.current) {
2133
2140
  try {
2134
- ct.current(x);
2141
+ st.current(x);
2135
2142
  } catch (B) {
2136
2143
  console.warn("[LiveLayer] onClick threw.", B);
2137
2144
  }
@@ -2159,7 +2166,7 @@ function Cr(e) {
2159
2166
  );
2160
2167
  return;
2161
2168
  }
2162
- (Re = T.click) == null || Re.call(T);
2169
+ (Ae = T.click) == null || Ae.call(T);
2163
2170
  return;
2164
2171
  }
2165
2172
  if (u.type === "fill_form" || u.type === "focus_field") {
@@ -2201,7 +2208,7 @@ function Cr(e) {
2201
2208
  );
2202
2209
  return;
2203
2210
  }
2204
- if (!it(F)) {
2211
+ if (!lt(F)) {
2205
2212
  console.warn(
2206
2213
  `[LiveLayer] focus_field: field "${$}" is privacy-protected and not focusable.`
2207
2214
  );
@@ -2224,7 +2231,7 @@ function Cr(e) {
2224
2231
  );
2225
2232
  continue;
2226
2233
  }
2227
- if (!it(j)) {
2234
+ if (!lt(j)) {
2228
2235
  console.warn(
2229
2236
  `[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
2230
2237
  );
@@ -2267,12 +2274,12 @@ function Cr(e) {
2267
2274
  );
2268
2275
  return;
2269
2276
  }
2270
- const B = typeof u.requestId == "string" ? u.requestId : void 0, $ = (et = le.current) == null ? void 0 : et.call(le), F = (J) => {
2271
- const Q = $, Ie = Q == null ? void 0 : Q.localParticipant;
2272
- if (Ie != null && Ie.publishData)
2277
+ const B = typeof u.requestId == "string" ? u.requestId : void 0, $ = (tt = ae.current) == null ? void 0 : tt.call(ae), F = (J) => {
2278
+ const ee = $, Re = ee == null ? void 0 : ee.localParticipant;
2279
+ if (Re != null && Re.publishData)
2273
2280
  try {
2274
- const sn = B ? { ...J, requestId: B } : J, cn = new TextEncoder().encode(JSON.stringify(sn));
2275
- Ie.publishData(cn, { reliable: !0 });
2281
+ const cn = B ? { ...J, requestId: B } : J, sn = new TextEncoder().encode(JSON.stringify(cn));
2282
+ Re.publishData(sn, { reliable: !0 });
2276
2283
  } catch {
2277
2284
  }
2278
2285
  };
@@ -2305,29 +2312,29 @@ function Cr(e) {
2305
2312
  he("request_routes", "read_page");
2306
2313
  return;
2307
2314
  }
2308
- const x = typeof u.requestId == "string" ? u.requestId : void 0, B = (Rt = le.current) == null ? void 0 : Rt.call(le), $ = B == null ? void 0 : B.localParticipant;
2315
+ const x = typeof u.requestId == "string" ? u.requestId : void 0, B = (Rt = ae.current) == null ? void 0 : Rt.call(ae), $ = B == null ? void 0 : B.localParticipant;
2309
2316
  if (!($ != null && $.publishData)) return;
2310
2317
  const F = (P) => {
2311
2318
  try {
2312
- const J = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P }, Q = new TextEncoder().encode(JSON.stringify(J));
2313
- $.publishData(Q, { reliable: !0 });
2319
+ const J = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P }, ee = new TextEncoder().encode(JSON.stringify(J));
2320
+ $.publishData(ee, { reliable: !0 });
2314
2321
  } catch (J) {
2315
2322
  console.warn("[LiveLayer] request_routes: publishData failed.", J);
2316
2323
  }
2317
2324
  }, j = bt.current;
2318
2325
  if (j) {
2319
2326
  try {
2320
- const P = j(), J = (Q) => {
2321
- if (!Array.isArray(Q)) {
2327
+ const P = j(), J = (ee) => {
2328
+ if (!Array.isArray(ee)) {
2322
2329
  F([]);
2323
2330
  return;
2324
2331
  }
2325
- F(Q.map(pr).slice(0, 200));
2332
+ F(ee.map(pr).slice(0, 200));
2326
2333
  };
2327
- P instanceof Promise ? P.then(J).catch((Q) => {
2334
+ P instanceof Promise ? P.then(J).catch((ee) => {
2328
2335
  console.warn(
2329
2336
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
2330
- Q
2337
+ ee
2331
2338
  ), F(ft());
2332
2339
  }) : J(P);
2333
2340
  } catch (P) {
@@ -2360,7 +2367,7 @@ function Cr(e) {
2360
2367
  R(() => {
2361
2368
  if (V != null && V.subscribeToDataMessages)
2362
2369
  return V.subscribeToDataMessages(Be);
2363
- }, [V, Be]), le.current = () => {
2370
+ }, [V, Be]), ae.current = () => {
2364
2371
  var m;
2365
2372
  return (m = U.getRoom) == null ? void 0 : m.call(U);
2366
2373
  }, R(() => {
@@ -2369,10 +2376,10 @@ function Cr(e) {
2369
2376
  const m = (G = U.getRoom) == null ? void 0 : G.call(U), u = m == null ? void 0 : m.localParticipant;
2370
2377
  if (u != null && u.publishData)
2371
2378
  try {
2372
- const Re = new TextEncoder().encode(
2379
+ const Ae = new TextEncoder().encode(
2373
2380
  JSON.stringify({ type: "pathname", pathname: se })
2374
2381
  );
2375
- u.publishData(Re, { reliable: !0 });
2382
+ u.publishData(Ae, { reliable: !0 });
2376
2383
  } catch {
2377
2384
  }
2378
2385
  }, [se, U, U.connectionState]), R(() => {
@@ -2380,17 +2387,17 @@ function Cr(e) {
2380
2387
  if (typeof window > "u") return;
2381
2388
  const m = ((G = window.location) == null ? void 0 : G.hostname) || "";
2382
2389
  if (m === "localhost" || m === "127.0.0.1" || m === "0.0.0.0" || m.endsWith(".local") || m.endsWith(".test"))
2383
- return window.__livelayerSimulateCommand = (Re) => {
2390
+ return window.__livelayerSimulateCommand = (Ae) => {
2384
2391
  try {
2385
- Be(Re);
2386
- } catch (et) {
2387
- console.warn("[LiveLayer] simulate-command threw:", et);
2392
+ Be(Ae);
2393
+ } catch (tt) {
2394
+ console.warn("[LiveLayer] simulate-command threw:", tt);
2388
2395
  }
2389
2396
  }, () => {
2390
2397
  delete window.__livelayerSimulateCommand;
2391
2398
  };
2392
2399
  }, [Be]);
2393
- const w = rt(() => V ? {
2400
+ const w = ot(() => V ? {
2394
2401
  connectionState: V.connectionState,
2395
2402
  agentState: V.agentState,
2396
2403
  transcript: V.transcript,
@@ -2431,25 +2438,25 @@ function Cr(e) {
2431
2438
  }, [w.videoElement]), R(() => {
2432
2439
  const m = w.audioElement;
2433
2440
  if (!m) return;
2434
- $e.attach(m);
2441
+ De.attach(m);
2435
2442
  const u = m.play();
2436
2443
  return u && typeof u.catch == "function" && u.catch((G) => {
2437
2444
  (G == null ? void 0 : G.name) === "NotAllowedError" && ue(!0);
2438
2445
  }), () => {
2439
- $e.detach();
2446
+ De.detach();
2440
2447
  };
2441
2448
  }, [w.audioElement]), R(() => {
2442
2449
  if (w.isControlled || w.connectionState !== "connected") return;
2443
2450
  const m = w.getRoom();
2444
2451
  if (m)
2445
- return ne.setupMic(m).catch(() => {
2446
- }), oe.attachRoom(m), ie.attachRoom(m), de.refresh(), () => {
2447
- ne.teardownMic(), oe.teardown(), ie.teardown();
2452
+ return re.setupMic(m).catch(() => {
2453
+ }), ie.attachRoom(m), le.attachRoom(m), de.refresh(), () => {
2454
+ re.teardownMic(), ie.teardown(), le.teardown();
2448
2455
  };
2449
2456
  }, [w.isControlled, w.connectionState]), R(() => {
2450
2457
  const m = w.audioElement;
2451
- m && (m.muted = Ae);
2452
- }, [w.audioElement, Ae]);
2458
+ m && (m.muted = Oe);
2459
+ }, [w.audioElement, Oe]);
2453
2460
  const Kt = k((m) => {
2454
2461
  const u = w.getRoom();
2455
2462
  if (u)
@@ -2461,7 +2468,7 @@ function Cr(e) {
2461
2468
  } catch {
2462
2469
  }
2463
2470
  }, [w]), Xt = k(() => {
2464
- p((m) => !m);
2471
+ Qe((m) => !m);
2465
2472
  }, []);
2466
2473
  R(() => {
2467
2474
  ke == null || ke(w.connectionState), w.connectionState === "connected" ? ge == null || ge() : w.connectionState === "disconnected" && (we == null || we());
@@ -2472,38 +2479,38 @@ function Cr(e) {
2472
2479
  }, [w.agentState, xe]);
2473
2480
  const _t = E(!1);
2474
2481
  R(() => {
2475
- w.isControlled || !c || _t.current || De && w.connectionState === "idle" && (_t.current = !0, w.connect());
2476
- }, [c, w.connectionState, w, De]);
2482
+ w.isControlled || !s || _t.current || Pe && w.connectionState === "idle" && (_t.current = !0, w.connect());
2483
+ }, [s, w.connectionState, w, Pe]);
2477
2484
  const Qt = k(
2478
2485
  (m) => {
2479
2486
  const u = C == null ? void 0 : C.find((G) => G.id === m);
2480
- u && (Oe(!1), m !== Z && (ze(!0), w.disconnect(), ce || Ce(m), v == null || v(u)));
2487
+ u && (He(!1), m !== K && ($e(!0), w.disconnect(), Q || Ce(m), v == null || v(u)));
2481
2488
  },
2482
2489
  [
2483
2490
  C,
2484
- Z,
2491
+ K,
2485
2492
  w,
2486
- ce,
2493
+ Q,
2487
2494
  v
2488
2495
  ]
2489
2496
  );
2490
2497
  R(() => {
2491
- fe && w.connectionState === "connected" && ze(!1);
2498
+ fe && w.connectionState === "connected" && $e(!1);
2492
2499
  }, [w.connectionState, fe]), R(() => {
2493
- if (!He) return;
2500
+ if (!ze) return;
2494
2501
  const m = (u) => {
2495
- u.key === "Escape" && Oe(!1);
2502
+ u.key === "Escape" && He(!1);
2496
2503
  };
2497
2504
  return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
2498
- }, [He]);
2499
- const Zt = !!M || !!(X != null && X.avatarImageUrl) || w.isControlled, qe = kn(Ee, o, Zt);
2500
- ee === void 0 && ((kt = qe.info) != null && kt.capabilities) && (dt.current = qe.info.capabilities);
2501
- const Ze = (X == null ? void 0 : X.name) ?? H ?? ((Lt = w.agentConfig) == null ? void 0 : Lt.name) ?? ((St = qe.info) == null ? void 0 : St.name) ?? "Live Layer", ut = (X == null ? void 0 : X.avatarImageUrl) ?? M ?? ((Ct = w.agentConfig) == null ? void 0 : Ct.avatarImageUrl) ?? ((Et = qe.info) == null ? void 0 : Et.avatarImageUrl) ?? null, en = b ?? ((Nt = w.agentConfig) == null ? void 0 : Nt.idleLoopUrl) ?? ((At = qe.info) == null ? void 0 : At.idleLoopUrl) ?? null, tn = z ?? null, nn = k(() => ae("expanded"), [ae]), rn = k(
2502
- () => ae("minimized"),
2503
- [ae]
2505
+ }, [ze]);
2506
+ const Zt = !!M || !!(Z != null && Z.avatarImageUrl) || w.isControlled, qe = kn(Ee, o, Zt);
2507
+ te === void 0 && ((kt = qe.info) != null && kt.capabilities) && (dt.current = qe.info.capabilities);
2508
+ const et = (Z == null ? void 0 : Z.name) ?? H ?? ((Lt = w.agentConfig) == null ? void 0 : Lt.name) ?? ((St = qe.info) == null ? void 0 : St.name) ?? "Live Layer", ut = (Z == null ? void 0 : Z.avatarImageUrl) ?? M ?? ((Ct = w.agentConfig) == null ? void 0 : Ct.avatarImageUrl) ?? ((Et = qe.info) == null ? void 0 : Et.avatarImageUrl) ?? null, en = b ?? ((Nt = w.agentConfig) == null ? void 0 : Nt.idleLoopUrl) ?? ((At = qe.info) == null ? void 0 : At.idleLoopUrl) ?? null, tn = z ?? null, nn = k(() => ce("expanded"), [ce]), rn = k(
2509
+ () => ce("minimized"),
2510
+ [ce]
2504
2511
  ), xt = k(() => {
2505
- w.disconnect(), ae("hidden");
2506
- }, [w, ae]), on = k(() => {
2512
+ w.disconnect(), ce("hidden");
2513
+ }, [w, ce]), on = k(() => {
2507
2514
  const m = w.audioElement;
2508
2515
  m && m.play().then(() => ue(!1)).catch(() => {
2509
2516
  });
@@ -2516,81 +2523,81 @@ function Cr(e) {
2516
2523
  h.primaryColor && (We["--ll-color-primary"] = h.primaryColor), h.accentColor && (We["--ll-color-accent"] = h.accentColor), h.backgroundColor && (We["--ll-color-bg"] = h.backgroundColor), h.textColor && (We["--ll-color-fg"] = h.textColor);
2517
2524
  const an = [
2518
2525
  "ll-widget",
2519
- `ll-widget--${re}`,
2526
+ `ll-widget--${oe}`,
2520
2527
  `ll-widget--${ve ? "mobile" : "desktop"}`,
2521
- lt
2528
+ at
2522
2529
  ].filter(Boolean).join(" ");
2523
- return De ? /* @__PURE__ */ _(
2530
+ return Pe ? /* @__PURE__ */ _(
2524
2531
  "div",
2525
2532
  {
2526
2533
  className: an,
2527
2534
  style: We,
2528
- "data-display-mode": re,
2535
+ "data-display-mode": oe,
2529
2536
  "data-position": g,
2530
2537
  children: [
2531
- re === "hidden" && /* @__PURE__ */ n(
2538
+ oe === "hidden" && /* @__PURE__ */ n(
2532
2539
  Vn,
2533
2540
  {
2534
2541
  position: g,
2535
2542
  isMobile: ve,
2536
2543
  isSpeaking: w.agentState === "speaking",
2537
- onExpand: () => ae("expanded"),
2538
- label: `Open ${Ze} widget`,
2544
+ onExpand: () => ce("expanded"),
2545
+ label: `Open ${et} widget`,
2539
2546
  avatarImageUrl: ut,
2540
- agentName: Ze
2547
+ agentName: et
2541
2548
  }
2542
2549
  ),
2543
- re === "minimized" && /* @__PURE__ */ n(
2550
+ oe === "minimized" && /* @__PURE__ */ n(
2544
2551
  Gn,
2545
2552
  {
2546
2553
  position: g,
2547
2554
  isMobile: ve,
2548
- agentName: Ze,
2555
+ agentName: et,
2549
2556
  avatarImageUrl: ut,
2550
2557
  agentState: w.agentState,
2551
- isMuted: ne.isMuted,
2552
- audioLevel: $e,
2558
+ isMuted: re.isMuted,
2559
+ audioLevel: De,
2553
2560
  onExpand: nn,
2554
- onToggleMute: ne.toggleMute,
2561
+ onToggleMute: re.toggleMute,
2555
2562
  onClose: xt
2556
2563
  }
2557
2564
  ),
2558
- re === "expanded" && /* @__PURE__ */ n(
2565
+ oe === "expanded" && /* @__PURE__ */ n(
2559
2566
  Kn,
2560
2567
  {
2561
2568
  position: g,
2562
2569
  isMobile: ve,
2563
- agentName: Ze,
2570
+ agentName: et,
2564
2571
  avatarImageUrl: ut,
2565
2572
  idleLoopUrl: en,
2566
2573
  greeting: tn,
2567
2574
  branding: h,
2568
2575
  teamMembers: C,
2569
- currentTeamMemberId: Z,
2576
+ currentTeamMemberId: K,
2570
2577
  isSwitchingTeamMember: fe,
2571
- teamSwitcherOpen: He,
2572
- onToggleTeamSwitcher: () => Oe((m) => !m),
2578
+ teamSwitcherOpen: ze,
2579
+ onToggleTeamSwitcher: () => He((m) => !m),
2573
2580
  onSelectTeamMember: Qt,
2574
2581
  connectionState: w.connectionState,
2575
2582
  agentState: w.agentState,
2576
2583
  transcript: w.transcript,
2577
- isMuted: ne.isMuted,
2584
+ isMuted: re.isMuted,
2578
2585
  micDevices: de.mics,
2579
- isCameraEnabled: oe.isEnabled,
2580
- cameraPreviewEl: oe.previewEl,
2586
+ isCameraEnabled: ie.isEnabled,
2587
+ cameraPreviewEl: ie.previewEl,
2581
2588
  cameraDevices: de.cameras,
2582
- activeCameraId: oe.activeDeviceId,
2583
- isScreenShareEnabled: ie.isEnabled,
2584
- screenPreviewEl: ie.previewEl,
2585
- isSpeakerMuted: Ae,
2589
+ activeCameraId: ie.activeDeviceId,
2590
+ isScreenShareEnabled: le.isEnabled,
2591
+ screenPreviewEl: le.previewEl,
2592
+ isSpeakerMuted: Oe,
2586
2593
  allowCamera: N,
2587
2594
  allowScreenShare: q,
2588
2595
  allowTyping: D,
2589
2596
  languageMenuOpen: Xe,
2590
- onToggleLanguageMenu: () => at((m) => !m),
2597
+ onToggleLanguageMenu: () => ct((m) => !m),
2591
2598
  needsUserGesture: Ne,
2592
2599
  canResume: w.canResume,
2593
- micError: ne.micError,
2600
+ micError: re.micError,
2594
2601
  error: w.error,
2595
2602
  avatarVideoContainerRef: wt,
2596
2603
  agentVideoEl: w.videoElement,
@@ -2598,15 +2605,15 @@ function Cr(e) {
2598
2605
  onDisconnect: () => w.disconnect(),
2599
2606
  onRetry: ln,
2600
2607
  onResumeAudio: on,
2601
- onToggleMute: ne.toggleMute,
2602
- onToggleCamera: () => void oe.toggle(),
2603
- onSwitchCameraDevice: (m) => void oe.switchDevice(m),
2604
- onToggleScreenShare: () => void ie.toggle(),
2608
+ onToggleMute: re.toggleMute,
2609
+ onToggleCamera: () => void ie.toggle(),
2610
+ onSwitchCameraDevice: (m) => void ie.switchDevice(m),
2611
+ onToggleScreenShare: () => void le.toggle(),
2605
2612
  onToggleSpeaker: Xt,
2606
2613
  onSendMessage: Kt,
2607
2614
  onMinimize: rn,
2608
2615
  onClose: xt,
2609
- onClearMicError: ne.clearError
2616
+ onClearMicError: re.clearError
2610
2617
  }
2611
2618
  )
2612
2619
  ]
@@ -2623,27 +2630,27 @@ const Dr = ({
2623
2630
  mode: o,
2624
2631
  onAgentEvent: i,
2625
2632
  className: l,
2626
- style: c
2633
+ style: s
2627
2634
  }) => {
2628
2635
  const d = E(null), f = E(null), y = E(i);
2629
2636
  y.current = i;
2630
2637
  const g = k((a) => {
2631
2638
  var I;
2632
- const s = a.detail;
2633
- (I = y.current) == null || I.call(y, s);
2639
+ const c = a.detail;
2640
+ (I = y.current) == null || I.call(y, c);
2634
2641
  }, []);
2635
2642
  return R(() => {
2636
2643
  const a = d.current;
2637
2644
  if (!a) return;
2638
- const s = document.createElement("livelayer-widget");
2639
- return s.setAttribute("agent-id", e), t && s.setAttribute("base-url", t), r && s.setAttribute("api-key", r), o && s.setAttribute("mode", o), s.addEventListener("agent-event", g), a.appendChild(s), f.current = s, () => {
2640
- s.removeEventListener("agent-event", g), a.removeChild(s), f.current = null;
2645
+ const c = document.createElement("livelayer-widget");
2646
+ return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", g), a.appendChild(c), f.current = c, () => {
2647
+ c.removeEventListener("agent-event", g), a.removeChild(c), f.current = null;
2641
2648
  };
2642
2649
  }, [e]), R(() => {
2643
2650
  f.current && (o ? f.current.setAttribute("mode", o) : f.current.removeAttribute("mode"));
2644
- }, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
2651
+ }, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2645
2652
  }, $r = mt(
2646
- function({ id: t, intent: r, as: o = "div", className: i, style: l, children: c }, d) {
2653
+ function({ id: t, intent: r, as: o = "div", className: i, style: l, children: s }, d) {
2647
2654
  return un(
2648
2655
  o,
2649
2656
  {
@@ -2653,7 +2660,7 @@ const Dr = ({
2653
2660
  className: i,
2654
2661
  style: l
2655
2662
  },
2656
- c
2663
+ s
2657
2664
  );
2658
2665
  }
2659
2666
  ), zr = mt(
@@ -2671,37 +2678,37 @@ const Dr = ({
2671
2678
  }
2672
2679
  ), Hr = mt(
2673
2680
  function(t, r) {
2674
- const { name: o, label: i, labelClassName: l } = t, c = { name: o, "data-ll-field": o };
2681
+ const { name: o, label: i, labelClassName: l } = t, s = { name: o, "data-ll-field": o };
2675
2682
  let d;
2676
2683
  if ("as" in t && t.as === "textarea") {
2677
- const { name: f, label: y, labelClassName: g, as: a, ...s } = t;
2684
+ const { name: f, label: y, labelClassName: g, as: a, ...c } = t;
2678
2685
  d = /* @__PURE__ */ n(
2679
2686
  "textarea",
2680
2687
  {
2681
2688
  ref: r,
2682
- ...c,
2683
- ...s
2689
+ ...s,
2690
+ ...c
2684
2691
  }
2685
2692
  );
2686
2693
  } else if ("as" in t && t.as === "select") {
2687
- const { name: f, label: y, labelClassName: g, as: a, children: s, ...I } = t;
2694
+ const { name: f, label: y, labelClassName: g, as: a, children: c, ...I } = t;
2688
2695
  d = /* @__PURE__ */ n(
2689
2696
  "select",
2690
2697
  {
2691
2698
  ref: r,
2692
- ...c,
2699
+ ...s,
2693
2700
  ...I,
2694
- children: s
2701
+ children: c
2695
2702
  }
2696
2703
  );
2697
2704
  } else {
2698
- const { name: f, label: y, labelClassName: g, as: a, ...s } = t;
2705
+ const { name: f, label: y, labelClassName: g, as: a, ...c } = t;
2699
2706
  d = /* @__PURE__ */ n(
2700
2707
  "input",
2701
2708
  {
2702
2709
  ref: r,
2703
- ...c,
2704
- ...s
2710
+ ...s,
2711
+ ...c
2705
2712
  }
2706
2713
  );
2707
2714
  }
@@ -2717,7 +2724,7 @@ function Or({
2717
2724
  defaultOpen: t = !1,
2718
2725
  storageKey: r = "ll-debug-open"
2719
2726
  }) {
2720
- const [o, i] = L(t), [l, c] = L([]), [d, f] = L(""), [y, g] = L(!1), a = E(/* @__PURE__ */ new Set()), s = E([]), I = E(y);
2727
+ const [o, i] = L(t), [l, s] = L([]), [d, f] = L(""), [y, g] = L(!1), a = E(/* @__PURE__ */ new Set()), c = E([]), I = E(y);
2721
2728
  I.current = y, R(() => {
2722
2729
  try {
2723
2730
  const v = localStorage.getItem(r);
@@ -2736,9 +2743,9 @@ function Or({
2736
2743
  return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
2737
2744
  }, []), R(() => {
2738
2745
  const v = setInterval(() => {
2739
- if (s.current.length === 0 || I.current) return;
2740
- const b = s.current.splice(0, s.current.length);
2741
- c(
2746
+ if (c.current.length === 0 || I.current) return;
2747
+ const b = c.current.splice(0, c.current.length);
2748
+ s(
2742
2749
  (z) => [...b.reverse(), ...z].slice(0, 200)
2743
2750
  );
2744
2751
  }, 100);
@@ -2747,7 +2754,7 @@ function Or({
2747
2754
  const C = E(!1);
2748
2755
  if (R(() => {
2749
2756
  !e || C.current || (C.current = !0, e((v) => {
2750
- s.current.push({
2757
+ c.current.push({
2751
2758
  id: Yt++,
2752
2759
  ts: Date.now(),
2753
2760
  kind: "event",
@@ -2759,7 +2766,7 @@ function Or({
2759
2766
  const v = console.warn, b = console.log, z = (M, H) => function(...h) {
2760
2767
  try {
2761
2768
  const N = typeof h[0] == "string" ? h[0] : "";
2762
- N.startsWith("[LiveLayer]") && s.current.push({
2769
+ N.startsWith("[LiveLayer]") && c.current.push({
2763
2770
  id: Yt++,
2764
2771
  ts: Date.now(),
2765
2772
  kind: M,
@@ -2861,7 +2868,7 @@ function Or({
2861
2868
  {
2862
2869
  type: "button",
2863
2870
  onClick: () => {
2864
- c([]), s.current = [];
2871
+ s([]), c.current = [];
2865
2872
  },
2866
2873
  style: pt("transparent"),
2867
2874
  title: "Clear buffer",
@@ -2945,7 +2952,7 @@ function Or({
2945
2952
  entry: v,
2946
2953
  expanded: a.current.has(v.id),
2947
2954
  onToggle: () => {
2948
- a.current.has(v.id) ? a.current.delete(v.id) : a.current.add(v.id), c((b) => [...b]);
2955
+ a.current.has(v.id) ? a.current.delete(v.id) : a.current.add(v.id), s((b) => [...b]);
2949
2956
  }
2950
2957
  },
2951
2958
  v.id
@@ -3047,10 +3054,10 @@ function Nr(e) {
3047
3054
  function Br() {
3048
3055
  const [e, t] = L([]), r = k((i) => {
3049
3056
  t((l) => {
3050
- const c = l.findIndex((d) => d.id === i.id);
3051
- if (c >= 0) {
3057
+ const s = l.findIndex((d) => d.id === i.id);
3058
+ if (s >= 0) {
3052
3059
  const d = l.slice();
3053
- return d[c] = i, d;
3060
+ return d[s] = i, d;
3054
3061
  }
3055
3062
  return [...l, i];
3056
3063
  });