@livelayer/react 0.5.10 → 0.5.12-pr66.0

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 {
@@ -13,8 +13,8 @@ class mn extends dn {
13
13
  return { hasError: !0, error: t };
14
14
  }
15
15
  componentDidCatch(t, r) {
16
- var o, i;
17
- (i = (o = this.props).onError) == null || i.call(o, t, r);
16
+ var i, o;
17
+ (o = (i = this.props).onError) == null || o.call(i, t, r);
18
18
  }
19
19
  render() {
20
20
  var t;
@@ -34,13 +34,13 @@ 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"), [i, o] = 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);
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
- onAgentStateChange: i,
43
+ onAgentStateChange: o,
44
44
  onTranscript: (D) => c([...D]),
45
45
  onAgentConfig: f,
46
46
  onAudioTrack: (D) => s(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"), o("idle"), c([]), f(null), g(null), s(null), C(!1), v(null), () => {
66
66
  var D;
67
67
  (D = q.destroy) == null || D.call(q), b.current = null;
68
68
  };
@@ -90,7 +90,7 @@ function gn(e) {
90
90
  }, []);
91
91
  return {
92
92
  connectionState: t,
93
- agentState: o,
93
+ agentState: i,
94
94
  transcript: l,
95
95
  agentConfig: d,
96
96
  videoElement: y,
@@ -104,10 +104,10 @@ 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), i = E(null), o = E(/* @__PURE__ */ new Set()), l = E(null), c = k(() => {
108
108
  const a = t.current;
109
109
  if (!a) {
110
- o.current = null;
110
+ i.current = null;
111
111
  return;
112
112
  }
113
113
  (!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
@@ -118,13 +118,13 @@ function yn() {
118
118
  let I = 0;
119
119
  for (let S = 0; S < s.length; S++) I += s[S];
120
120
  const C = I / s.length / 255;
121
- for (const S of i.current)
121
+ for (const S of o.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
+ i.current = requestAnimationFrame(c);
128
128
  }, []), d = k(() => {
129
129
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
130
  const a = new AudioContext(), s = a.createAnalyser();
@@ -146,20 +146,20 @@ function yn() {
146
146
  console.warn("[useAudioLevel] createMediaElementSource failed:", s);
147
147
  return;
148
148
  }
149
- o.current === null && (o.current = requestAnimationFrame(c));
149
+ i.current === null && (i.current = requestAnimationFrame(c));
150
150
  }
151
151
  },
152
152
  [d, c]
153
153
  ), y = k(() => {
154
- if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
154
+ if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
155
155
  try {
156
156
  r.current.disconnect();
157
157
  } catch {
158
158
  }
159
159
  r.current = null;
160
160
  }
161
- }, []), g = k((a) => (i.current.add(a), () => {
162
- i.current.delete(a);
161
+ }, []), g = k((a) => (o.current.add(a), () => {
162
+ o.current.delete(a);
163
163
  }), []);
164
164
  return R(() => () => {
165
165
  if (y(), t.current) {
@@ -176,34 +176,34 @@ function yn() {
176
176
  }
177
177
  e.current = null;
178
178
  }
179
- i.current.clear(), l.current = null;
179
+ o.current.clear(), l.current = null;
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) => {
184
- if (i.current && l.current) {
183
+ const [e, t] = L(!1), [r, i] = L(null), o = E(null), l = E(null), c = k(async (g) => {
184
+ if (o.current && l.current) {
185
185
  try {
186
- await l.current.localParticipant.unpublishTrack(i.current);
186
+ await l.current.localParticipant.unpublishTrack(o.current);
187
187
  } catch {
188
188
  }
189
- i.current.stop(), i.current = null;
189
+ o.current.stop(), o.current = null;
190
190
  }
191
- l.current = g, o(null);
191
+ l.current = g, i(null);
192
192
  try {
193
193
  const a = await pn({
194
194
  echoCancellation: !0,
195
195
  noiseSuppression: !0
196
196
  });
197
- await g.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
197
+ await g.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
198
198
  } catch (a) {
199
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;
200
+ throw i(s), a;
201
201
  }
202
202
  }, []), d = k(() => {
203
- const g = i.current;
203
+ const g = o.current;
204
204
  g && (g.isMuted ? (g.unmute(), t(!1)) : (g.mute(), t(!0)));
205
205
  }, []), f = k(() => {
206
- const g = i.current, a = l.current;
206
+ const g = o.current, a = l.current;
207
207
  if (g && a) {
208
208
  try {
209
209
  a.localParticipant.unpublishTrack(g);
@@ -211,8 +211,8 @@ function vn() {
211
211
  }
212
212
  g.stop();
213
213
  }
214
- i.current = null, l.current = null, t(!1);
215
- }, []), y = k(() => o(null), []);
214
+ o.current = null, l.current = null, t(!1);
215
+ }, []), y = k(() => i(null), []);
216
216
  return {
217
217
  isMuted: e,
218
218
  micError: r,
@@ -224,7 +224,7 @@ function vn() {
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, i] = L(null), [o, l] = L(null), [c, 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;
@@ -243,7 +243,7 @@ function wn() {
243
243
  }, []), s = k(async (b) => {
244
244
  const z = f.current;
245
245
  if (z) {
246
- o(null);
246
+ i(null);
247
247
  try {
248
248
  const M = { ...bn };
249
249
  b && (M.deviceId = b);
@@ -260,7 +260,7 @@ function wn() {
260
260
  }
261
261
  } catch (M) {
262
262
  const H = M instanceof Error && M.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
- o(H);
263
+ i(H);
264
264
  }
265
265
  }
266
266
  }, []), I = k(async () => {
@@ -268,14 +268,14 @@ function wn() {
268
268
  }, [e, c, a, s]), C = k(async (b) => {
269
269
  a(), await s(b);
270
270
  }, [a, s]), S = k(() => {
271
- a(), f.current = null, o(null), d("");
272
- }, [a]), v = k(() => o(null), []);
271
+ a(), f.current = null, i(null), d("");
272
+ }, [a]), v = k(() => i(null), []);
273
273
  return R(() => () => {
274
274
  y.current && y.current.stop();
275
275
  }, []), {
276
276
  isEnabled: e,
277
277
  error: r,
278
- previewEl: i,
278
+ previewEl: o,
279
279
  activeDeviceId: c,
280
280
  toggle: I,
281
281
  switchDevice: C,
@@ -285,7 +285,7 @@ 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) => {
288
+ const [e, t] = L(!1), [r, i] = L(null), [o, l] = L(null), c = E(null), d = k((s) => {
289
289
  c.current = s;
290
290
  }, []), f = k(() => l(null), []), y = k(async () => {
291
291
  const s = c.current;
@@ -298,7 +298,7 @@ function _n() {
298
298
  f(), t(!1);
299
299
  return;
300
300
  }
301
- o(null);
301
+ i(null);
302
302
  try {
303
303
  await s.localParticipant.setScreenShareEnabled(!0);
304
304
  let I = 0;
@@ -321,7 +321,7 @@ function _n() {
321
321
  C();
322
322
  } catch (I) {
323
323
  const C = I instanceof Error ? I.name : "";
324
- C !== "NotAllowedError" && C !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
324
+ C !== "NotAllowedError" && C !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
325
325
  }
326
326
  }
327
327
  }, [e, f]), g = k(() => {
@@ -331,27 +331,27 @@ function _n() {
331
331
  s.localParticipant.setScreenShareEnabled(!1);
332
332
  } catch {
333
333
  }
334
- f(), t(!1), o(null), c.current = null;
335
- }, [e, f]), a = k(() => o(null), []);
336
- return { isEnabled: e, error: r, previewEl: i, toggle: y, attachRoom: d, teardown: g, clearError: a };
334
+ f(), t(!1), i(null), c.current = null;
335
+ }, [e, f]), a = k(() => i(null), []);
336
+ return { isEnabled: e, error: r, previewEl: o, toggle: y, attachRoom: d, teardown: g, clearError: a };
337
337
  }
338
338
  function xn() {
339
- const [e, t] = L([]), [r, o] = L([]), i = k(async () => {
339
+ const [e, t] = L([]), [r, i] = L([]), o = k(async () => {
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((c) => c.kind === "audioinput")), i(l.filter((c) => c.kind === "videoinput"));
344
344
  } catch {
345
345
  }
346
346
  }, []);
347
347
  return R(() => {
348
- if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
- const l = () => void i();
348
+ if (o(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
+ const l = () => void o();
350
350
  return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
351
- }, [i]), { mics: e, cameras: r, refresh: i };
351
+ }, [o]), { mics: e, cameras: r, refresh: o };
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 [i, o] = L(null), [l, c] = L(null), [d, f] = L(!r && !!e);
355
355
  return R(() => {
356
356
  if (r || !e) {
357
357
  f(!1);
@@ -367,11 +367,11 @@ function kn(e, t, r = !1) {
367
367
  }
368
368
  return a.json();
369
369
  }).then((a) => {
370
- y.signal.aborted || (i(a), f(!1));
370
+ y.signal.aborted || (o(a), f(!1));
371
371
  }).catch((a) => {
372
372
  y.signal.aborted || (c(a instanceof Error ? a.message : "Agent lookup failed"), f(!1));
373
373
  }), () => y.abort();
374
- }, [e, t, r]), { info: o, error: l, loading: d };
374
+ }, [e, t, r]), { info: i, error: l, loading: d };
375
375
  }
376
376
  function Ln(e) {
377
377
  if (typeof window > "u") return null;
@@ -393,11 +393,11 @@ 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 i = e !== void 0, [o, l] = L(t), c = i ? e : o, d = k(
397
397
  (f) => {
398
- f !== c && (o || l(f), r == null || r(f));
398
+ f !== c && (i || l(f), r == null || r(f));
399
399
  },
400
- [c, o, r]
400
+ [c, i, r]
401
401
  );
402
402
  return [c, d];
403
403
  }
@@ -409,18 +409,18 @@ function An({
409
409
  value: e,
410
410
  defaultValue: t = "expanded",
411
411
  onChange: r,
412
- persistKey: o = "ll-widget",
413
- disablePersistence: i = !1
412
+ persistKey: i = "ll-widget",
413
+ disablePersistence: o = !1
414
414
  } = {}) {
415
- const l = `${o}:display-mode`, c = E(!1), [d, f] = Cn({
415
+ const l = `${i}:display-mode`, c = E(!1), [d, f] = Cn({
416
416
  value: e,
417
417
  defaultValue: t,
418
418
  onChange: (y) => {
419
- e === void 0 && !i && Sn(l, y), r == null || r(y);
419
+ e === void 0 && !o && Sn(l, y), r == null || r(y);
420
420
  }
421
421
  });
422
422
  return R(() => {
423
- if (c.current || (c.current = !0, i || e !== void 0)) return;
423
+ if (c.current || (c.current = !0, o || e !== void 0)) return;
424
424
  const y = Nn(Ln(l));
425
425
  y && y !== d && f(y);
426
426
  }, []), [d, f];
@@ -435,22 +435,22 @@ function In(e = Rn) {
435
435
  }
436
436
  if (typeof window > "u" || typeof window.matchMedia > "u")
437
437
  return;
438
- const o = `(max-width: ${e - 1}px)`, i = window.matchMedia(o), l = () => r(i.matches);
439
- return l(), typeof i.addEventListener == "function" ? (i.addEventListener("change", l), () => i.removeEventListener("change", l)) : (i.addListener(l), () => {
440
- i.removeListener(l);
438
+ const i = `(max-width: ${e - 1}px)`, o = window.matchMedia(i), l = () => r(o.matches);
439
+ return l(), typeof o.addEventListener == "function" ? (o.addEventListener("change", l), () => o.removeEventListener("change", l)) : (o.addListener(l), () => {
440
+ o.removeListener(l);
441
441
  });
442
442
  }, [e]), t;
443
443
  }
444
- const It = "__llHistoryPatched", ot = "ll:pathname";
444
+ const It = "__llHistoryPatched", lt = "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
- const o = e.apply(this, r);
450
- return window.dispatchEvent(new Event(ot)), o;
449
+ const i = e.apply(this, r);
450
+ return window.dispatchEvent(new Event(lt)), i;
451
451
  }, window.history.replaceState = function(...r) {
452
- const o = t.apply(this, r);
453
- return window.dispatchEvent(new Event(ot)), o;
452
+ const i = t.apply(this, r);
453
+ return window.dispatchEvent(new Event(lt)), i;
454
454
  }, window.history[It] = !0;
455
455
  }
456
456
  function Mt() {
@@ -463,9 +463,9 @@ function Tn(e) {
463
463
  return R(() => {
464
464
  if (e !== void 0) return;
465
465
  Mn();
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);
466
+ const i = () => r(Mt());
467
+ return i(), window.addEventListener("popstate", i), window.addEventListener(lt, i), () => {
468
+ window.removeEventListener("popstate", i), window.removeEventListener(lt, i);
469
469
  };
470
470
  }, [e]), e ?? t;
471
471
  }
@@ -476,7 +476,7 @@ function Dn(e) {
476
476
  function $n(e) {
477
477
  const t = Tt.get(e);
478
478
  if (t) return t;
479
- const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = Dn(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), f = new RegExp(`^${d}\\/?$`);
479
+ const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), d = Dn(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), f = new RegExp(`^${d}\\/?$`);
480
480
  return Tt.set(e, f), f;
481
481
  }
482
482
  function zn(e, t) {
@@ -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
  );
@@ -620,16 +620,16 @@ const Vn = ({
620
620
  position: e,
621
621
  isMobile: t,
622
622
  isSpeaking: r,
623
- onExpand: o,
624
- label: i = "Open widget",
623
+ onExpand: i,
624
+ label: o = "Open widget",
625
625
  avatarImageUrl: l,
626
626
  agentName: c
627
627
  }) => {
628
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(
629
629
  (A) => {
630
630
  if (typeof window > "u") return A;
631
- const O = y / 2, W = Ht + O, Y = window.innerHeight - Ht - O;
632
- return Y < W ? Math.max(W, A) : Math.max(W, Math.min(Y, A));
631
+ const O = y / 2, W = Ht + O, G = window.innerHeight - Ht - O;
632
+ return G < W ? Math.max(W, A) : Math.max(W, Math.min(G, A));
633
633
  },
634
634
  [y]
635
635
  );
@@ -681,16 +681,16 @@ const Vn = ({
681
681
  v.current = !1;
682
682
  return;
683
683
  }
684
- o();
685
- }, [o]), N = k(
684
+ i();
685
+ }, [i]), N = k(
686
686
  (A) => {
687
687
  if (A.key === "ArrowUp" || A.key === "ArrowDown") {
688
688
  A.preventDefault();
689
689
  const O = A.key === "ArrowUp" ? -8 : 8;
690
690
  s((W) => {
691
691
  if (W === null) return W;
692
- const Y = b(W + O);
693
- return Ot(Y), Y;
692
+ const G = b(W + O);
693
+ return Ot(G), G;
694
694
  });
695
695
  }
696
696
  },
@@ -714,7 +714,7 @@ const Vn = ({
714
714
  onPointerCancel: H,
715
715
  onClick: h,
716
716
  onKeyDown: N,
717
- "aria-label": i,
717
+ "aria-label": o,
718
718
  "data-position": e,
719
719
  style: D,
720
720
  children: g ? (
@@ -753,11 +753,11 @@ const Vn = ({
753
753
  audioLevel: e,
754
754
  bars: t = 20,
755
755
  maxHeight: r = 20,
756
- minHeight: o = 4,
757
- className: i,
756
+ minHeight: i = 4,
757
+ className: o,
758
758
  barClassName: l
759
759
  }) => {
760
- const c = E(null), d = E([]), f = rt(() => {
760
+ const c = E(null), d = E([]), f = ot(() => {
761
761
  const g = (Math.sqrt(5) - 1) / 2;
762
762
  return Array.from({ length: t }, (a, s) => 0.5 + s * g % 1 * 0.5);
763
763
  }, [t]);
@@ -765,11 +765,11 @@ const Vn = ({
765
765
  for (let s = 0; s < t; s++) {
766
766
  const I = d.current[s];
767
767
  if (!I) continue;
768
- const C = Math.max(o, a * r * f[s]);
768
+ const C = Math.max(i, a * r * f[s]);
769
769
  I.style.height = `${C}px`;
770
770
  }
771
- }), [e, t, r, o, f]);
772
- const y = ["ll-waveform", i].filter(Boolean).join(" ");
771
+ }), [e, t, r, i, f]);
772
+ const y = ["ll-waveform", o].filter(Boolean).join(" ");
773
773
  return /* @__PURE__ */ n("div", { ref: c, className: y, "aria-hidden": "true", children: Array.from({ length: t }, (g, a) => /* @__PURE__ */ n(
774
774
  "div",
775
775
  {
@@ -777,7 +777,7 @@ const Vn = ({
777
777
  d.current[a] = s;
778
778
  },
779
779
  className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
780
- style: { height: `${o}px` }
780
+ style: { height: `${i}px` }
781
781
  },
782
782
  a
783
783
  )) });
@@ -785,8 +785,8 @@ const Vn = ({
785
785
  position: e,
786
786
  isMobile: t,
787
787
  agentName: r,
788
- avatarImageUrl: o,
789
- agentState: i,
788
+ avatarImageUrl: i,
789
+ agentState: o,
790
790
  isMuted: l,
791
791
  audioLevel: c,
792
792
  onExpand: d,
@@ -806,12 +806,12 @@ const Vn = ({
806
806
  onClick: d,
807
807
  "aria-label": `Expand ${r} widget`,
808
808
  children: [
809
- o ? (
809
+ i ? (
810
810
  // eslint-disable-next-line @next/next/no-img-element
811
811
  /* @__PURE__ */ n(
812
812
  "img",
813
813
  {
814
- src: o,
814
+ src: i,
815
815
  alt: r,
816
816
  className: "ll-minimized__avatar"
817
817
  }
@@ -858,12 +858,12 @@ const Vn = ({
858
858
  role: "region",
859
859
  "aria-label": `${r} widget`,
860
860
  children: /* @__PURE__ */ _("div", { className: "ll-minimized__surface", children: [
861
- o ? (
861
+ i ? (
862
862
  // eslint-disable-next-line @next/next/no-img-element
863
863
  /* @__PURE__ */ n(
864
864
  "img",
865
865
  {
866
- src: o,
866
+ src: i,
867
867
  alt: r,
868
868
  className: "ll-minimized__avatar"
869
869
  }
@@ -871,7 +871,7 @@ const Vn = ({
871
871
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
872
872
  /* @__PURE__ */ _("div", { className: "ll-minimized__meta", children: [
873
873
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
874
- /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: i === "speaking" ? "Speaking" : i === "thinking" ? "Thinking" : "Listening" })
874
+ /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
875
875
  ] }),
876
876
  /* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
877
877
  /* @__PURE__ */ n(
@@ -911,8 +911,8 @@ const Vn = ({
911
911
  src: e,
912
912
  alt: t,
913
913
  preCannedPlaying: r = !1,
914
- className: o,
915
- style: i
914
+ className: i,
915
+ style: o
916
916
  }) => {
917
917
  const [l, c] = L(!1), d = E(e);
918
918
  if (R(() => {
@@ -928,7 +928,7 @@ const Vn = ({
928
928
  transition: "opacity 500ms ease, transform 500ms ease",
929
929
  transform: r ? "scale(1.02)" : "scale(1)",
930
930
  opacity: l ? 1 : 0,
931
- ...i
931
+ ...o
932
932
  };
933
933
  return (
934
934
  // eslint-disable-next-line @next/next/no-img-element
@@ -937,7 +937,7 @@ const Vn = ({
937
937
  {
938
938
  src: e,
939
939
  alt: t,
940
- className: o,
940
+ className: i,
941
941
  style: f,
942
942
  loading: "eager",
943
943
  fetchPriority: "high",
@@ -949,8 +949,8 @@ const Vn = ({
949
949
  position: e,
950
950
  isMobile: t,
951
951
  agentName: r,
952
- avatarImageUrl: o,
953
- idleLoopUrl: i,
952
+ avatarImageUrl: i,
953
+ idleLoopUrl: o,
954
954
  greeting: l,
955
955
  branding: c,
956
956
  teamMembers: d,
@@ -974,112 +974,118 @@ const Vn = ({
974
974
  cameraPreviewEl: A,
975
975
  cameraDevices: O,
976
976
  activeCameraId: W,
977
- isScreenShareEnabled: Y,
977
+ isScreenShareEnabled: G,
978
978
  screenPreviewEl: te,
979
979
  isSpeakerMuted: me,
980
- allowCamera: je,
981
- allowScreenShare: Ve,
982
- allowTyping: Ye,
983
- avatarVideoContainerRef: Ge,
984
- agentVideoEl: ee,
980
+ allowCamera: Ve,
981
+ allowScreenShare: Ye,
982
+ allowTyping: Ge,
983
+ avatarVideoContainerRef: Je,
984
+ agentVideoEl: Z,
985
985
  onConnect: ge,
986
- onDisconnect: we,
987
- onRetry: _e,
988
- onResumeAudio: xe,
989
- onToggleMute: ke,
990
- onToggleCamera: Le,
991
- onSwitchCameraDevice: Se,
986
+ onDisconnect: _e,
987
+ onRetry: xe,
988
+ onResumeAudio: ke,
989
+ onToggleMute: Le,
990
+ onToggleCamera: Se,
991
+ onSwitchCameraDevice: Ce,
992
992
  onToggleScreenShare: V,
993
- onToggleSpeaker: lt,
994
- onSendMessage: Je,
995
- onMinimize: Ke,
996
- onClose: se,
997
- onClearMicError: De
993
+ onToggleSpeaker: st,
994
+ onSendMessage: Ke,
995
+ onMinimize: Xe,
996
+ onClose: ce,
997
+ onClearMicError: Oe
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 Te;
1000
+ const se = ((d == null ? void 0 : d.length) ?? 0) > 1, Ee = S === "connecting" || S === "connected", re = S === "connected", ye = S === "idle" || S === "disconnected" || S === "error", [J, ve] = L(!1);
1001
1001
  R(() => {
1002
- if (!ee) {
1003
- re(!1);
1002
+ if (!Z) {
1003
+ ve(!1);
1004
1004
  return;
1005
1005
  }
1006
- if (!ee.paused && ee.readyState >= 2) {
1007
- re(!0);
1006
+ if (!Z.paused && Z.readyState >= 2) {
1007
+ ve(!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
+ ve(!1);
1011
+ const p = () => ve(!0);
1012
+ return Z.addEventListener("playing", p), Z.addEventListener("loadeddata", p), () => {
1013
+ Z.removeEventListener("playing", p), Z.removeEventListener("loadeddata", p);
1014
1014
  };
1015
- }, [ee]);
1016
- const [ae, ve] = L(!1);
1015
+ }, [Z]);
1016
+ const [be, ie] = L(!1);
1017
1017
  R(() => {
1018
- if (!Z) {
1019
- ve(!1);
1018
+ if (!re) {
1019
+ ie(!1);
1020
1020
  return;
1021
1021
  }
1022
- if (Ee) return;
1023
- const p = setTimeout(() => ve(!0), 8e3);
1022
+ if (J) return;
1023
+ const p = setTimeout(() => ie(!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
+ }, [re, J]);
1026
+ const Ne = S === "connecting" || re && !!i && !J && !be, Ae = E(null), ne = E(null);
1027
1027
  R(() => {
1028
- const p = ne.current;
1028
+ const p = Ae.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;
1031
+ const p = ne.current;
1032
1032
  p && (p.innerHTML = "", te && (te.style.width = "100%", te.style.height = "100%", te.style.objectFit = "contain", p.appendChild(te)));
1033
1033
  }, [te]);
1034
- const [ie, de] = L(!1), [Ne, ue] = L(!1);
1034
+ const [ee, oe] = L(!1), [de, Re] = L(!1);
1035
1035
  R(() => {
1036
- if (!ie && !Ne && !I && !g) return;
1036
+ if (!ee && !de && !I && !g) return;
1037
1037
  const p = () => {
1038
- de(!1), ue(!1), I && C(), g && a();
1038
+ oe(!1), Re(!1), I && C(), g && a();
1039
1039
  };
1040
1040
  return document.addEventListener("click", p), () => document.removeEventListener("click", p);
1041
1041
  }, [
1042
- ie,
1043
- Ne,
1042
+ ee,
1043
+ de,
1044
1044
  I,
1045
1045
  g,
1046
1046
  C,
1047
1047
  a
1048
1048
  ]);
1049
- const [fe, ze] = L(""), He = k(
1049
+ const [ue, Ie] = L(""), Qe = k(
1050
1050
  (p) => {
1051
1051
  p.preventDefault();
1052
- const K = fe.trim();
1053
- K && (Je(K), ze(""));
1052
+ const Y = ue.trim();
1053
+ Y && (Ke(Y), Ie(""));
1054
1054
  },
1055
- [fe, Je]
1056
- ), Oe = c.productName || "Live Layer", Xe = Z && (ce != null && ce.text) ? ce.text : l || "", at = [
1055
+ [ue, Ke]
1056
+ ), Be = c.productName || "Live Layer";
1057
+ let le = null, fe = null;
1058
+ for (let p = b.length - 1; p >= 0; p--) {
1059
+ const Y = b[p];
1060
+ if (!le && Y.role === "agent" ? le = Y : !fe && Y.role === "user" && (fe = Y), le && fe) break;
1061
+ }
1062
+ const Ze = re ? (le == null ? void 0 : le.text) || null : l || null, Me = re && (fe == null ? void 0 : fe.text) || null, ct = [
1057
1063
  "ll-expanded",
1058
1064
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1059
1065
  ].join(" ");
1060
1066
  return /* @__PURE__ */ _(
1061
1067
  "div",
1062
1068
  {
1063
- className: at,
1069
+ className: ct,
1064
1070
  "data-position": e,
1065
- "data-state": Z ? "connected" : Ce ? "connecting" : "idle",
1071
+ "data-state": re ? "connected" : Ee ? "connecting" : "idle",
1066
1072
  role: "dialog",
1067
1073
  "aria-label": `${r} widget`,
1068
1074
  children: [
1069
1075
  /* @__PURE__ */ _("div", { className: "ll-expanded__bg", children: [
1070
- o ? /* @__PURE__ */ n(
1076
+ i ? /* @__PURE__ */ n(
1071
1077
  Jn,
1072
1078
  {
1073
- src: o,
1079
+ src: i,
1074
1080
  alt: r,
1075
1081
  className: "ll-expanded__bg-img"
1076
1082
  }
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(
1083
+ ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Te = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Te.toUpperCase()) || "A" }) }),
1084
+ o && !re && /* @__PURE__ */ n(
1079
1085
  "video",
1080
1086
  {
1081
1087
  className: "ll-expanded__bg-idle",
1082
- src: i,
1088
+ src: o,
1083
1089
  autoPlay: !0,
1084
1090
  loop: !0,
1085
1091
  muted: !0,
@@ -1087,24 +1093,24 @@ const Vn = ({
1087
1093
  }
1088
1094
  )
1089
1095
  ] }),
1090
- /* @__PURE__ */ n("div", { ref: Ge, className: "ll-expanded__video" }),
1091
- $e && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1096
+ /* @__PURE__ */ n("div", { ref: Je, className: "ll-expanded__video" }),
1097
+ Ne && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1092
1098
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1093
1099
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: y ? "Switching..." : "Connecting..." })
1094
1100
  ] }),
1095
- M && Z && /* @__PURE__ */ _(
1101
+ M && re && /* @__PURE__ */ _(
1096
1102
  "button",
1097
1103
  {
1098
1104
  type: "button",
1099
1105
  className: "ll-expanded__overlay ll-expanded__overlay--gesture",
1100
- onClick: xe,
1106
+ onClick: ke,
1101
1107
  children: [
1102
1108
  /* @__PURE__ */ n("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.54.12a5 5 0 0 1 0 5.76l-1.41-1.41a3 3 0 0 0 0-2.94L16.54 9.12z" }) }),
1103
1109
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
1104
1110
  ]
1105
1111
  }
1106
1112
  ),
1107
- Ce ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
1113
+ Ee ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
1108
1114
  /* @__PURE__ */ _("div", { className: "ll-expanded__topbar-left", children: [
1109
1115
  /* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
1110
1116
  /* @__PURE__ */ _(
@@ -1113,17 +1119,17 @@ const Vn = ({
1113
1119
  type: "button",
1114
1120
  className: "ll-hpill",
1115
1121
  onClick: (p) => {
1116
- ye && (p.stopPropagation(), a());
1122
+ se && (p.stopPropagation(), a());
1117
1123
  },
1118
- "aria-haspopup": ye ? "listbox" : void 0,
1119
- "aria-expanded": ye ? g : void 0,
1124
+ "aria-haspopup": se ? "listbox" : void 0,
1125
+ "aria-expanded": se ? g : void 0,
1120
1126
  children: [
1121
1127
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1122
- ye && /* @__PURE__ */ n(tt, {})
1128
+ se && /* @__PURE__ */ n(rt, {})
1123
1129
  ]
1124
1130
  }
1125
1131
  ),
1126
- ye && g && /* @__PURE__ */ n(
1132
+ se && g && /* @__PURE__ */ n(
1127
1133
  "div",
1128
1134
  {
1129
1135
  className: "ll-hmenu",
@@ -1170,7 +1176,7 @@ const Vn = ({
1170
1176
  title: "Language: English",
1171
1177
  children: [
1172
1178
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
1173
- /* @__PURE__ */ n(tt, {})
1179
+ /* @__PURE__ */ n(rt, {})
1174
1180
  ]
1175
1181
  }
1176
1182
  ),
@@ -1207,7 +1213,7 @@ const Vn = ({
1207
1213
  {
1208
1214
  type: "button",
1209
1215
  className: "ll-hbtn",
1210
- onClick: Ke,
1216
+ onClick: Xe,
1211
1217
  "aria-label": "Minimize widget",
1212
1218
  title: "Minimize",
1213
1219
  children: /* @__PURE__ */ n(qt, {})
@@ -1218,7 +1224,7 @@ const Vn = ({
1218
1224
  {
1219
1225
  type: "button",
1220
1226
  className: "ll-hbtn ll-hbtn--danger",
1221
- onClick: se,
1227
+ onClick: ce,
1222
1228
  "aria-label": "End call",
1223
1229
  title: "End call",
1224
1230
  children: /* @__PURE__ */ n(Bt, {})
@@ -1228,14 +1234,14 @@ const Vn = ({
1228
1234
  ] }) : (
1229
1235
  // Idle-state header with Live Layer product name + minimize/close
1230
1236
  /* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1231
- /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Oe }),
1237
+ /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Be }),
1232
1238
  /* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
1233
1239
  /* @__PURE__ */ n(
1234
1240
  "button",
1235
1241
  {
1236
1242
  type: "button",
1237
1243
  className: "ll-hbtn ll-hbtn--ghost",
1238
- onClick: Ke,
1244
+ onClick: Xe,
1239
1245
  "aria-label": "Minimize widget",
1240
1246
  children: /* @__PURE__ */ n(qt, {})
1241
1247
  }
@@ -1245,7 +1251,7 @@ const Vn = ({
1245
1251
  {
1246
1252
  type: "button",
1247
1253
  className: "ll-hbtn ll-hbtn--danger",
1248
- onClick: se,
1254
+ onClick: ce,
1249
1255
  "aria-label": "Close widget",
1250
1256
  children: /* @__PURE__ */ n(Bt, {})
1251
1257
  }
@@ -1253,8 +1259,8 @@ const Vn = ({
1253
1259
  ] })
1254
1260
  ] })
1255
1261
  ),
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;
1262
+ ye && /* @__PURE__ */ (() => {
1263
+ const p = z ? "Restart paused session" : S === "disconnected" ? "Reconnect to agent" : "Start video call", Y = z ? "Pick up where you left off" : null;
1258
1264
  return /* @__PURE__ */ _(ht, { children: [
1259
1265
  S === "idle" && !z && !H && /* @__PURE__ */ _(
1260
1266
  "button",
@@ -1271,7 +1277,7 @@ const Vn = ({
1271
1277
  ),
1272
1278
  /* @__PURE__ */ _("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1273
1279
  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 }),
1280
+ Y && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: Y }),
1275
1281
  /* @__PURE__ */ n(
1276
1282
  "button",
1277
1283
  {
@@ -1288,46 +1294,61 @@ const Vn = ({
1288
1294
  /* @__PURE__ */ _(
1289
1295
  "div",
1290
1296
  {
1291
- className: `ll-expanded__pip ${Ce && (D || Y) ? "is-visible" : ""}`,
1297
+ className: `ll-expanded__pip ${Ee && (D || G) ? "is-visible" : ""}`,
1292
1298
  children: [
1293
1299
  /* @__PURE__ */ n(
1294
1300
  "div",
1295
1301
  {
1296
- ref: oe,
1297
- className: Y ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1302
+ ref: ne,
1303
+ className: G ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1298
1304
  }
1299
1305
  ),
1300
1306
  /* @__PURE__ */ n(
1301
1307
  "div",
1302
1308
  {
1303
- ref: ne,
1304
- className: !Y && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1309
+ ref: Ae,
1310
+ className: !G && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1305
1311
  }
1306
1312
  )
1307
1313
  ]
1308
1314
  }
1309
1315
  ),
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 }) }),
1316
+ Ee ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
1317
+ Ze && /* @__PURE__ */ n(
1318
+ "div",
1319
+ {
1320
+ className: "ll-expanded__transcript ll-expanded__transcript--agent",
1321
+ "data-role": "agent",
1322
+ children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ze })
1323
+ }
1324
+ ),
1325
+ Me && /* @__PURE__ */ n(
1326
+ "div",
1327
+ {
1328
+ className: "ll-expanded__transcript ll-expanded__transcript--user",
1329
+ "data-role": "user",
1330
+ children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Me })
1331
+ }
1332
+ ),
1312
1333
  /* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (p) => p.stopPropagation(), children: [
1313
- Ve && /* @__PURE__ */ n(
1334
+ Ye && /* @__PURE__ */ n(
1314
1335
  "button",
1315
1336
  {
1316
1337
  type: "button",
1317
- className: `ll-tool ${Y ? "is-on" : ""}`,
1338
+ className: `ll-tool ${G ? "is-on" : ""}`,
1318
1339
  onClick: V,
1319
- "aria-label": Y ? "Stop sharing screen" : "Share screen",
1320
- title: Y ? "Stop sharing" : "Share screen",
1340
+ "aria-label": G ? "Stop sharing screen" : "Share screen",
1341
+ title: G ? "Stop sharing" : "Share screen",
1321
1342
  children: /* @__PURE__ */ n(Xn, {})
1322
1343
  }
1323
1344
  ),
1324
- je && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
1345
+ Ve && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
1325
1346
  /* @__PURE__ */ n(
1326
1347
  "button",
1327
1348
  {
1328
1349
  type: "button",
1329
1350
  className: `ll-tool ll-tool--left ${D ? "is-on" : ""}`,
1330
- onClick: Le,
1351
+ onClick: Se,
1331
1352
  "aria-label": D ? "Turn off camera" : "Turn on camera",
1332
1353
  title: D ? "Stop camera" : "Start camera",
1333
1354
  children: /* @__PURE__ */ n(Qn, {})
@@ -1339,22 +1360,22 @@ const Vn = ({
1339
1360
  type: "button",
1340
1361
  className: `ll-tool ll-tool--right ${D ? "is-on" : ""}`,
1341
1362
  onClick: (p) => {
1342
- p.stopPropagation(), ue((K) => !K), de(!1);
1363
+ p.stopPropagation(), Re((Y) => !Y), oe(!1);
1343
1364
  },
1344
1365
  "aria-label": "Camera devices",
1345
1366
  "aria-haspopup": "listbox",
1346
- "aria-expanded": Ne,
1347
- children: /* @__PURE__ */ n(tt, {})
1367
+ "aria-expanded": de,
1368
+ children: /* @__PURE__ */ n(rt, {})
1348
1369
  }
1349
1370
  ),
1350
- Ne && O.length > 0 && /* @__PURE__ */ n(
1371
+ de && O.length > 0 && /* @__PURE__ */ n(
1351
1372
  Wt,
1352
1373
  {
1353
1374
  label: "Camera",
1354
1375
  devices: O,
1355
1376
  activeId: W,
1356
1377
  onPick: (p) => {
1357
- ue(!1), Se(p);
1378
+ Re(!1), Ce(p);
1358
1379
  }
1359
1380
  }
1360
1381
  )
@@ -1365,7 +1386,7 @@ const Vn = ({
1365
1386
  {
1366
1387
  type: "button",
1367
1388
  className: `ll-tool ll-tool--left ${h ? "is-muted" : ""}`,
1368
- onClick: ke,
1389
+ onClick: Le,
1369
1390
  "aria-label": h ? "Unmute microphone" : "Mute microphone",
1370
1391
  title: h ? "Unmute" : "Mute",
1371
1392
  children: /* @__PURE__ */ n(Zn, { muted: h })
@@ -1377,21 +1398,21 @@ const Vn = ({
1377
1398
  type: "button",
1378
1399
  className: `ll-tool ll-tool--right ${h ? "is-muted" : ""}`,
1379
1400
  onClick: (p) => {
1380
- p.stopPropagation(), de((K) => !K), ue(!1);
1401
+ p.stopPropagation(), oe((Y) => !Y), Re(!1);
1381
1402
  },
1382
1403
  "aria-label": "Microphone devices",
1383
1404
  "aria-haspopup": "listbox",
1384
- "aria-expanded": ie,
1385
- children: /* @__PURE__ */ n(tt, {})
1405
+ "aria-expanded": ee,
1406
+ children: /* @__PURE__ */ n(rt, {})
1386
1407
  }
1387
1408
  ),
1388
- ie && q.length > 0 && /* @__PURE__ */ n(
1409
+ ee && q.length > 0 && /* @__PURE__ */ n(
1389
1410
  Wt,
1390
1411
  {
1391
1412
  label: "Microphone",
1392
1413
  devices: q,
1393
1414
  activeId: "",
1394
- onPick: () => de(!1)
1415
+ onPick: () => oe(!1)
1395
1416
  }
1396
1417
  )
1397
1418
  ] }),
@@ -1400,7 +1421,7 @@ const Vn = ({
1400
1421
  {
1401
1422
  type: "button",
1402
1423
  className: `ll-tool ${me ? "is-muted" : ""}`,
1403
- onClick: lt,
1424
+ onClick: st,
1404
1425
  "aria-label": me ? "Unmute speaker" : "Mute speaker",
1405
1426
  title: me ? "Unmute speaker" : "Mute speaker",
1406
1427
  children: /* @__PURE__ */ n(er, { muted: me })
@@ -1411,26 +1432,26 @@ const Vn = ({
1411
1432
  {
1412
1433
  type: "button",
1413
1434
  className: "ll-tool ll-tool--danger",
1414
- onClick: we,
1435
+ onClick: _e,
1415
1436
  "aria-label": "End conversation",
1416
1437
  title: "End conversation",
1417
1438
  children: /* @__PURE__ */ n(nr, {})
1418
1439
  }
1419
1440
  )
1420
1441
  ] }),
1421
- Ye && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: He, children: [
1442
+ Ge && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: Qe, children: [
1422
1443
  /* @__PURE__ */ n(
1423
1444
  "input",
1424
1445
  {
1425
1446
  type: "text",
1426
1447
  className: "ll-message-input__field",
1427
1448
  placeholder: "Message...",
1428
- value: fe,
1429
- onChange: (p) => ze(p.target.value),
1449
+ value: ue,
1450
+ onChange: (p) => Ie(p.target.value),
1430
1451
  "aria-label": "Message the agent"
1431
1452
  }
1432
1453
  ),
1433
- fe.trim() && /* @__PURE__ */ n(
1454
+ ue.trim() && /* @__PURE__ */ n(
1434
1455
  "button",
1435
1456
  {
1436
1457
  type: "submit",
@@ -1450,14 +1471,14 @@ const Vn = ({
1450
1471
  {
1451
1472
  type: "button",
1452
1473
  className: "ll-expanded__banner-x",
1453
- onClick: De,
1474
+ onClick: Oe,
1454
1475
  "aria-label": "Dismiss",
1455
1476
  children: "×"
1456
1477
  }
1457
1478
  )
1458
1479
  ] });
1459
1480
  if (!H || S !== "error") return null;
1460
- let p = "Failed to connect", K = "Try again";
1481
+ let p = "Failed to connect", Y = "Try again";
1461
1482
  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
1483
  /* @__PURE__ */ n("span", { children: p }),
1463
1484
  /* @__PURE__ */ n(
@@ -1465,8 +1486,8 @@ const Vn = ({
1465
1486
  {
1466
1487
  type: "button",
1467
1488
  className: "ll-expanded__banner-retry",
1468
- onClick: _e,
1469
- children: K
1489
+ onClick: xe,
1490
+ children: Y
1470
1491
  }
1471
1492
  )
1472
1493
  ] });
@@ -1475,7 +1496,7 @@ const Vn = ({
1475
1496
  }
1476
1497
  );
1477
1498
  };
1478
- function tt() {
1499
+ function rt() {
1479
1500
  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
1501
  }
1481
1502
  function Bt() {
@@ -1532,30 +1553,30 @@ function nr() {
1532
1553
  }
1533
1554
  ) });
1534
1555
  }
1535
- const Wt = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */ _(
1556
+ const Wt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ _(
1536
1557
  "div",
1537
1558
  {
1538
1559
  className: "ll-device-menu",
1539
- onClick: (i) => i.stopPropagation(),
1560
+ onClick: (o) => o.stopPropagation(),
1540
1561
  role: "listbox",
1541
1562
  children: [
1542
1563
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1543
- t.map((i, l) => {
1544
- const c = r === i.deviceId;
1564
+ t.map((o, l) => {
1565
+ const c = r === o.deviceId;
1545
1566
  return /* @__PURE__ */ _(
1546
1567
  "button",
1547
1568
  {
1548
1569
  type: "button",
1549
1570
  className: `ll-device-menu__item ${c ? "is-active" : ""}`,
1550
- onClick: () => o(i.deviceId),
1571
+ onClick: () => i(o.deviceId),
1551
1572
  role: "option",
1552
1573
  "aria-selected": c,
1553
1574
  children: [
1554
1575
  c && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1555
- /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: i.label || `${e} ${l + 1}` })
1576
+ /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
1556
1577
  ]
1557
1578
  },
1558
- i.deviceId || l
1579
+ o.deviceId || l
1559
1580
  );
1560
1581
  })
1561
1582
  ]
@@ -1573,7 +1594,7 @@ function gt(e) {
1573
1594
  }
1574
1595
  return !1;
1575
1596
  }
1576
- function it(e) {
1597
+ function at(e) {
1577
1598
  if (gt(e)) return !1;
1578
1599
  if (e instanceof HTMLInputElement) {
1579
1600
  if (e.type === "password") return !1;
@@ -1582,7 +1603,7 @@ function it(e) {
1582
1603
  }
1583
1604
  return !0;
1584
1605
  }
1585
- const nt = 4096, or = 20, ir = 20, lr = 10, ar = 10, sr = 30, Ft = 500, cr = [
1606
+ const it = 4096, ir = 20, or = 20, lr = 10, ar = 10, sr = 30, Ft = 500, cr = [
1586
1607
  '[data-ll-private="true"]',
1587
1608
  ".ll-widget",
1588
1609
  "script",
@@ -1590,7 +1611,7 @@ const nt = 4096, or = 20, ir = 20, lr = 10, ar = 10, sr = 30, Ft = 500, cr = [
1590
1611
  "noscript",
1591
1612
  "iframe"
1592
1613
  ];
1593
- function Fe(e) {
1614
+ function Ue(e) {
1594
1615
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
1595
1616
  let t = e;
1596
1617
  for (; t; ) {
@@ -1600,12 +1621,12 @@ function Fe(e) {
1600
1621
  }
1601
1622
  return !1;
1602
1623
  }
1603
- function Ue(e) {
1624
+ function je(e) {
1604
1625
  if (typeof window > "u") return !0;
1605
1626
  const t = e.getBoundingClientRect();
1606
1627
  if (t.width <= 0 || t.height <= 0) return !1;
1607
- const r = window.innerHeight || document.documentElement.clientHeight, o = window.innerWidth || document.documentElement.clientWidth;
1608
- return t.bottom > 0 && t.right > 0 && t.top < r && t.left < o;
1628
+ const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
1629
+ return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
1609
1630
  }
1610
1631
  function Ut(e) {
1611
1632
  const t = e.getAttribute("id");
@@ -1615,15 +1636,15 @@ function Ut(e) {
1615
1636
  }
1616
1637
  const r = e.getAttribute("aria-label");
1617
1638
  if (r) return r.trim();
1618
- const o = e.getAttribute("placeholder");
1619
- if (o) return o.trim();
1620
- const i = e.closest("label");
1621
- return i != null && i.textContent ? i.textContent.trim() : "";
1639
+ const i = e.getAttribute("placeholder");
1640
+ if (i) return i.trim();
1641
+ const o = e.closest("label");
1642
+ return o != null && o.textContent ? o.textContent.trim() : "";
1622
1643
  }
1623
- function be(e, t) {
1644
+ function we(e, t) {
1624
1645
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
1625
1646
  }
1626
- function Me(e) {
1647
+ function $e(e) {
1627
1648
  return e.length;
1628
1649
  }
1629
1650
  function dr(e, t = {}) {
@@ -1640,13 +1661,13 @@ function dr(e, t = {}) {
1640
1661
  forms: [],
1641
1662
  extras: e
1642
1663
  };
1643
- const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
1664
+ const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
1644
1665
  r.querySelectorAll("[data-ll-region]")
1645
1666
  ), d = [];
1646
1667
  for (const h of c) {
1647
1668
  if (d.length >= lr) break;
1648
- if (Fe(h) || !Ue(h)) continue;
1649
- const N = h.getAttribute("data-ll-region") ?? "", q = h.getAttribute("data-ll-intent") ?? void 0, D = be(
1669
+ if (Ue(h) || !je(h)) continue;
1670
+ const N = h.getAttribute("data-ll-region") ?? "", q = h.getAttribute("data-ll-intent") ?? void 0, D = we(
1650
1671
  (h.innerText || h.textContent || "").trim(),
1651
1672
  Ft * 2
1652
1673
  );
@@ -1656,23 +1677,23 @@ function dr(e, t = {}) {
1656
1677
  r.querySelectorAll("h1, h2, h3, h4, h5, h6")
1657
1678
  );
1658
1679
  for (const h of g) {
1659
- if (Fe(h) || !Ue(h)) continue;
1680
+ if (Ue(h) || !je(h)) continue;
1660
1681
  const N = (h.textContent || "").trim();
1661
- N && f.push(`${h.tagName}: ${be(N, 200)}`);
1682
+ N && f.push(`${h.tagName}: ${we(N, 200)}`);
1662
1683
  }
1663
1684
  const a = Array.from(r.querySelectorAll("p, li"));
1664
1685
  for (const h of a) {
1665
- if (Fe(h) || !Ue(h) || y.includes(h.tagName)) continue;
1686
+ if (Ue(h) || !je(h) || y.includes(h.tagName)) continue;
1666
1687
  const N = (h.textContent || "").trim();
1667
- N.length > 10 && f.push(be(N, Ft));
1688
+ N.length > 10 && f.push(we(N, Ft));
1668
1689
  }
1669
1690
  const s = f.join(`
1670
1691
  `), I = [], C = Array.from(r.querySelectorAll("a[href]"));
1671
1692
  for (const h of C) {
1672
- if (I.length >= or) break;
1673
- if (Fe(h) || !Ue(h)) continue;
1693
+ if (I.length >= ir) break;
1694
+ if (Ue(h) || !je(h)) continue;
1674
1695
  const N = h.getAttribute("href") || "", q = (h.textContent || "").trim();
1675
- !N || !q || I.push({ href: N, text: be(q, 100) });
1696
+ !N || !q || I.push({ href: N, text: we(q, 100) });
1676
1697
  }
1677
1698
  const S = [], v = Array.from(
1678
1699
  r.querySelectorAll(
@@ -1680,10 +1701,10 @@ function dr(e, t = {}) {
1680
1701
  )
1681
1702
  );
1682
1703
  for (const h of v) {
1683
- if (S.length >= ir) break;
1684
- if (Fe(h) || !it(h) || !Ue(h)) continue;
1704
+ if (S.length >= or) break;
1705
+ if (Ue(h) || !at(h) || !je(h)) continue;
1685
1706
  const N = Ut(h), q = h instanceof HTMLInputElement ? h.type : h.tagName.toLowerCase();
1686
- N && S.push({ label: be(N, 100), type: q });
1707
+ N && S.push({ label: we(N, 100), type: q });
1687
1708
  }
1688
1709
  const b = Array.from(
1689
1710
  r.querySelectorAll("[data-ll-form]")
@@ -1700,18 +1721,18 @@ function dr(e, t = {}) {
1700
1721
  ), A = [];
1701
1722
  for (const O of D) {
1702
1723
  if (A.length >= sr) break;
1703
- if (!it(O)) continue;
1724
+ if (!at(O)) continue;
1704
1725
  const W = O.getAttribute("data-ll-field") || "";
1705
1726
  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 });
1727
+ const G = Ut(O) || W, te = O instanceof HTMLInputElement ? O.type : O.tagName.toLowerCase();
1728
+ A.push({ name: W, label: we(G, 100), type: te });
1708
1729
  }
1709
1730
  z.push({ id: N, intent: q, fields: A });
1710
1731
  }
1711
1732
  const M = {
1712
- url: o,
1733
+ url: i,
1713
1734
  title: l,
1714
- pathname: i,
1735
+ pathname: o,
1715
1736
  regions: d,
1716
1737
  visibleText: s,
1717
1738
  visibleLinks: I,
@@ -1719,23 +1740,23 @@ function dr(e, t = {}) {
1719
1740
  forms: z,
1720
1741
  extras: e
1721
1742
  };
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; )
1743
+ let H = $e(JSON.stringify(M.regions)) + $e(M.visibleText) + $e(JSON.stringify(M.visibleLinks)) + $e(JSON.stringify(M.visibleFields));
1744
+ for (; H > it && M.visibleFields.length > 0; )
1745
+ M.visibleFields.pop(), H = $e(JSON.stringify(M.visibleFields));
1746
+ for (; H > it && M.visibleLinks.length > 0; )
1726
1747
  M.visibleLinks.pop(), H -= 80;
1727
- return Me(M.visibleText) > nt && (M.visibleText = be(M.visibleText, nt - 100)), M;
1748
+ return $e(M.visibleText) > it && (M.visibleText = we(M.visibleText, it - 100)), M;
1728
1749
  }
1729
- let Te = null;
1750
+ let ze = null;
1730
1751
  function jt(e, t = {}) {
1731
- 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;
1752
+ const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1753
+ if (ze && ze.key === o && r - ze.at < 1e3)
1754
+ return ze.ctx;
1734
1755
  const l = dr(e, t);
1735
- return Te = { key: i, at: r, ctx: l }, l;
1756
+ return ze = { key: o, at: r, ctx: l }, l;
1736
1757
  }
1737
1758
  function ur() {
1738
- Te = null;
1759
+ ze = null;
1739
1760
  }
1740
1761
  const fr = 200;
1741
1762
  function pr(e) {
@@ -1754,9 +1775,9 @@ function hr(e) {
1754
1775
  function mr(e) {
1755
1776
  const t = e ?? (typeof document < "u" ? document : null);
1756
1777
  if (!t) return [];
1757
- const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
1778
+ const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
1758
1779
  for (const c of l) {
1759
- if (i.length >= fr) break;
1780
+ if (o.length >= fr) break;
1760
1781
  if (gt(c)) continue;
1761
1782
  const d = c.getAttribute("href") || "";
1762
1783
  if (!hr(d)) continue;
@@ -1769,40 +1790,40 @@ function mr(e) {
1769
1790
  } catch {
1770
1791
  continue;
1771
1792
  }
1772
- if (o.has(f)) continue;
1773
- o.add(f);
1793
+ if (i.has(f)) continue;
1794
+ i.add(f);
1774
1795
  const g = (c.textContent || "").trim().slice(0, 120);
1775
- i.push({ href: f, text: g, internal: y });
1796
+ o.push({ href: f, text: g, internal: y });
1776
1797
  }
1777
- return i;
1798
+ return o;
1778
1799
  }
1779
- let Pe = null;
1800
+ let He = null;
1780
1801
  const gr = 5e3;
1781
1802
  function ft() {
1782
1803
  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;
1804
+ if (He && He.pathname === t && e - He.at < gr)
1805
+ return He.routes;
1785
1806
  const r = mr();
1786
- return Pe = { at: e, pathname: t, routes: r }, r;
1807
+ return He = { at: e, pathname: t, routes: r }, r;
1787
1808
  }
1788
1809
  function yr() {
1789
- Pe = null;
1810
+ He = null;
1790
1811
  }
1791
1812
  function vr(e, t) {
1792
- 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;
1793
- i ? i.call(e, t) : e.value = t;
1813
+ const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), o = i == null ? void 0 : i.set;
1814
+ o ? o.call(e, t) : e.value = t;
1794
1815
  }
1795
1816
  function br(e, t, r = {}) {
1796
- const o = r.triggerInput ?? !0, i = r.triggerChange ?? !0;
1817
+ const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
1797
1818
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
1798
1819
  const l = Object.getOwnPropertyDescriptor(
1799
1820
  HTMLInputElement.prototype,
1800
1821
  "checked"
1801
1822
  ), 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 }));
1823
+ c ? c.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1803
1824
  return;
1804
1825
  }
1805
- vr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1826
+ vr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1806
1827
  }
1807
1828
  function wr() {
1808
1829
  if (typeof window > "u" || typeof document > "u")
@@ -1823,12 +1844,12 @@ function xr() {
1823
1844
  document.querySelectorAll("body, body *")
1824
1845
  );
1825
1846
  let t = null, r = 0;
1826
- for (const o of e) {
1827
- if (!_r(o)) continue;
1828
- const i = o.getBoundingClientRect();
1829
- if (i.bottom <= 0 || i.top >= window.innerHeight || i.right <= 0 || i.left >= window.innerWidth || i.width <= 0 || i.height <= 0 || o.closest(".ll-widget")) continue;
1830
- const l = i.width * i.height;
1831
- l > r && (r = l, t = o);
1847
+ for (const i of e) {
1848
+ if (!_r(i)) continue;
1849
+ const o = i.getBoundingClientRect();
1850
+ if (o.bottom <= 0 || o.top >= window.innerHeight || o.right <= 0 || o.left >= window.innerWidth || o.width <= 0 || o.height <= 0 || i.closest(".ll-widget")) continue;
1851
+ const l = o.width * o.height;
1852
+ l > r && (r = l, t = i);
1832
1853
  }
1833
1854
  return t;
1834
1855
  }
@@ -1877,8 +1898,8 @@ function Cr(e) {
1877
1898
  const {
1878
1899
  agentId: t,
1879
1900
  apiKey: r,
1880
- baseUrl: o = "https://app.livelayer.studio",
1881
- sessionEndpoint: i,
1901
+ baseUrl: i = "https://app.livelayer.studio",
1902
+ sessionEndpoint: o,
1882
1903
  sessionBody: l,
1883
1904
  autoConnect: c = !1,
1884
1905
  displayMode: d,
@@ -1902,43 +1923,43 @@ function Cr(e) {
1902
1923
  showOn: A,
1903
1924
  hideOn: O,
1904
1925
  pathname: W,
1905
- onNavigate: Y,
1926
+ onNavigate: G,
1906
1927
  onScrollToSelector: te,
1907
1928
  getPageContext: me,
1908
- pageContextExtras: je,
1909
- getRoutes: Ve,
1910
- onScrollPage: Ye,
1911
- onClick: Ge,
1912
- capabilities: ee,
1929
+ pageContextExtras: Ve,
1930
+ getRoutes: Ye,
1931
+ onScrollPage: Ge,
1932
+ onClick: Je,
1933
+ capabilities: Z,
1913
1934
  onConnect: ge,
1914
- onDisconnect: we,
1915
- onTranscript: _e,
1916
- onAgentState: xe,
1917
- onConnectionStateChange: ke,
1918
- onAgentEvent: Le,
1919
- onAgentCommand: Se,
1935
+ onDisconnect: _e,
1936
+ onTranscript: xe,
1937
+ onAgentState: ke,
1938
+ onConnectionStateChange: Le,
1939
+ onAgentEvent: Se,
1940
+ onAgentCommand: Ce,
1920
1941
  controlledSession: V,
1921
- className: lt,
1922
- style: Je,
1923
- zIndex: Ke = 2147483647
1924
- } = e, se = Tn(W), De = Bn(se, A, O);
1942
+ className: st,
1943
+ style: Ke,
1944
+ zIndex: Xe = 2147483647
1945
+ } = e, ce = Tn(W), Oe = Bn(ce, A, O);
1925
1946
  R(() => {
1926
1947
  ur(), yr();
1927
- }, [se]);
1928
- const ce = S !== void 0, [ye, Ce] = L(() => {
1948
+ }, [ce]);
1949
+ const se = S !== void 0, [Ee, re] = L(() => {
1929
1950
  var m;
1930
1951
  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({
1952
+ }), ye = se ? S : Ee, J = ot(
1953
+ () => (C == null ? void 0 : C.find((m) => m.id === ye)) ?? null,
1954
+ [C, ye]
1955
+ ), ve = (J == null ? void 0 : J.agentId) ?? t, [be, ie] = An({
1935
1956
  value: d,
1936
1957
  defaultValue: f,
1937
1958
  onChange: y,
1938
1959
  persistKey: s,
1939
1960
  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;
1961
+ }), Ne = In(a), Ae = yn(), ne = vn(), ee = wn(), oe = _n(), de = xn(), [Re, ue] = L(!1), [Ie, Qe] = L(!1), [Be, le] = L(!1), [fe, Ze] = L(!1), [Me, ct] = L(!1), Te = E(G), p = E(te), Y = E(Ge), et = E(Je), yt = E(me), vt = E(Ve), bt = E(Ye), dt = E(Z), ae = E(null);
1962
+ Te.current = G, p.current = te, Y.current = Ge, et.current = Je, yt.current = me, vt.current = Ve, bt.current = Ye, dt.current = Z;
1942
1963
  function pe(m) {
1943
1964
  const u = dt.current;
1944
1965
  return u ? u.includes(m) : !0;
@@ -1948,12 +1969,12 @@ function Cr(e) {
1948
1969
  `[LiveLayer] Agent command "${m}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1949
1970
  );
1950
1971
  }
1951
- const Be = k(
1972
+ const qe = k(
1952
1973
  (m) => {
1953
- var G, Re, et, Rt;
1974
+ var K, Pe, nt, Rt;
1954
1975
  const u = m;
1955
1976
  if (!(!u.type || typeof u.type != "string")) {
1956
- if (Le == null || Le({ eventName: u.type, data: m }), u.type === "navigate") {
1977
+ if (Se == null || Se({ eventName: u.type, data: m }), u.type === "navigate") {
1957
1978
  if (!pe("navigate")) {
1958
1979
  he("navigate", "navigate");
1959
1980
  return;
@@ -1965,9 +1986,9 @@ function Cr(e) {
1965
1986
  );
1966
1987
  return;
1967
1988
  }
1968
- if (K.current) {
1989
+ if (Te.current) {
1969
1990
  try {
1970
- K.current(x);
1991
+ Te.current(x);
1971
1992
  } catch (T) {
1972
1993
  console.warn(
1973
1994
  `[LiveLayer] onNavigate threw for "${x}". Falling back. Error:`,
@@ -2004,9 +2025,9 @@ function Cr(e) {
2004
2025
  const x = typeof u.selector == "string" ? u.selector : null;
2005
2026
  if (!x) return;
2006
2027
  const T = u.behavior === "instant" ? "instant" : "smooth";
2007
- if (Qe.current) {
2028
+ if (p.current) {
2008
2029
  try {
2009
- Qe.current(
2030
+ p.current(
2010
2031
  x,
2011
2032
  T
2012
2033
  );
@@ -2043,12 +2064,12 @@ function Cr(e) {
2043
2064
  he("request_page_context", "read_page");
2044
2065
  return;
2045
2066
  }
2046
- const x = typeof u.requestId == "string" ? u.requestId : void 0, T = (G = le.current) == null ? void 0 : G.call(le), B = (j) => {
2047
- const P = T, J = P == null ? void 0 : P.localParticipant;
2048
- if (J != null && J.publishData)
2067
+ const x = typeof u.requestId == "string" ? u.requestId : void 0, T = (K = ae.current) == null ? void 0 : K.call(ae), B = (j) => {
2068
+ const P = T, X = P == null ? void 0 : P.localParticipant;
2069
+ if (X != null && X.publishData)
2049
2070
  try {
2050
- const Q = x ? { ...j, requestId: x } : j, Ie = new TextEncoder().encode(JSON.stringify(Q));
2051
- J.publishData(Ie, { reliable: !0 });
2071
+ const Q = x ? { ...j, requestId: x } : j, De = new TextEncoder().encode(JSON.stringify(Q));
2072
+ X.publishData(De, { reliable: !0 });
2052
2073
  } catch (Q) {
2053
2074
  console.warn("[LiveLayer] publishData failed.", Q);
2054
2075
  }
@@ -2099,9 +2120,9 @@ function Cr(e) {
2099
2120
  return;
2100
2121
  }
2101
2122
  const T = u.behavior === "instant" ? "instant" : "smooth";
2102
- if (st.current) {
2123
+ if (Y.current) {
2103
2124
  try {
2104
- st.current(
2125
+ Y.current(
2105
2126
  x,
2106
2127
  T
2107
2128
  );
@@ -2129,9 +2150,9 @@ function Cr(e) {
2129
2150
  console.warn("[LiveLayer] click: missing selector.");
2130
2151
  return;
2131
2152
  }
2132
- if (ct.current) {
2153
+ if (et.current) {
2133
2154
  try {
2134
- ct.current(x);
2155
+ et.current(x);
2135
2156
  } catch (B) {
2136
2157
  console.warn("[LiveLayer] onClick threw.", B);
2137
2158
  }
@@ -2159,7 +2180,7 @@ function Cr(e) {
2159
2180
  );
2160
2181
  return;
2161
2182
  }
2162
- (Re = T.click) == null || Re.call(T);
2183
+ (Pe = T.click) == null || Pe.call(T);
2163
2184
  return;
2164
2185
  }
2165
2186
  if (u.type === "fill_form" || u.type === "focus_field") {
@@ -2201,7 +2222,7 @@ function Cr(e) {
2201
2222
  );
2202
2223
  return;
2203
2224
  }
2204
- if (!it(F)) {
2225
+ if (!at(F)) {
2205
2226
  console.warn(
2206
2227
  `[LiveLayer] focus_field: field "${$}" is privacy-protected and not focusable.`
2207
2228
  );
@@ -2224,7 +2245,7 @@ function Cr(e) {
2224
2245
  );
2225
2246
  continue;
2226
2247
  }
2227
- if (!it(j)) {
2248
+ if (!at(j)) {
2228
2249
  console.warn(
2229
2250
  `[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
2230
2251
  );
@@ -2267,12 +2288,12 @@ function Cr(e) {
2267
2288
  );
2268
2289
  return;
2269
2290
  }
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)
2291
+ const B = typeof u.requestId == "string" ? u.requestId : void 0, $ = (nt = ae.current) == null ? void 0 : nt.call(ae), F = (X) => {
2292
+ const Q = $, De = Q == null ? void 0 : Q.localParticipant;
2293
+ if (De != null && De.publishData)
2273
2294
  try {
2274
- const sn = B ? { ...J, requestId: B } : J, cn = new TextEncoder().encode(JSON.stringify(sn));
2275
- Ie.publishData(cn, { reliable: !0 });
2295
+ const sn = B ? { ...X, requestId: B } : X, cn = new TextEncoder().encode(JSON.stringify(sn));
2296
+ De.publishData(cn, { reliable: !0 });
2276
2297
  } catch {
2277
2298
  }
2278
2299
  };
@@ -2283,8 +2304,8 @@ function Cr(e) {
2283
2304
  T.addEventListener("submit", P, { once: !0 });
2284
2305
  try {
2285
2306
  typeof T.requestSubmit == "function" ? T.requestSubmit() : T.submit();
2286
- } catch (J) {
2287
- console.warn("[LiveLayer] submit_form: requestSubmit threw.", J), T.removeEventListener("submit", P), F({
2307
+ } catch (X) {
2308
+ console.warn("[LiveLayer] submit_form: requestSubmit threw.", X), T.removeEventListener("submit", P), F({
2288
2309
  type: "form_submit_blocked",
2289
2310
  formId: x,
2290
2311
  reason: "exception"
@@ -2305,31 +2326,31 @@ function Cr(e) {
2305
2326
  he("request_routes", "read_page");
2306
2327
  return;
2307
2328
  }
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;
2329
+ 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
2330
  if (!($ != null && $.publishData)) return;
2310
2331
  const F = (P) => {
2311
2332
  try {
2312
- const J = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P }, Q = new TextEncoder().encode(JSON.stringify(J));
2333
+ const X = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P }, Q = new TextEncoder().encode(JSON.stringify(X));
2313
2334
  $.publishData(Q, { reliable: !0 });
2314
- } catch (J) {
2315
- console.warn("[LiveLayer] request_routes: publishData failed.", J);
2335
+ } catch (X) {
2336
+ console.warn("[LiveLayer] request_routes: publishData failed.", X);
2316
2337
  }
2317
2338
  }, j = bt.current;
2318
2339
  if (j) {
2319
2340
  try {
2320
- const P = j(), J = (Q) => {
2341
+ const P = j(), X = (Q) => {
2321
2342
  if (!Array.isArray(Q)) {
2322
2343
  F([]);
2323
2344
  return;
2324
2345
  }
2325
2346
  F(Q.map(pr).slice(0, 200));
2326
2347
  };
2327
- P instanceof Promise ? P.then(J).catch((Q) => {
2348
+ P instanceof Promise ? P.then(X).catch((Q) => {
2328
2349
  console.warn(
2329
2350
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
2330
2351
  Q
2331
2352
  ), F(ft());
2332
- }) : J(P);
2353
+ }) : X(P);
2333
2354
  } catch (P) {
2334
2355
  console.warn(
2335
2356
  "[LiveLayer] getRoutes threw; falling back to DOM walker.",
@@ -2345,52 +2366,52 @@ function Cr(e) {
2345
2366
  }
2346
2367
  return;
2347
2368
  }
2348
- Sr.has(u.type) || Se == null || Se(u);
2369
+ Sr.has(u.type) || Ce == null || Ce(u);
2349
2370
  }
2350
2371
  },
2351
- [Se, Le]
2372
+ [Ce, Se]
2352
2373
  ), U = gn({
2353
- agentId: V ? "__controlled__" : Ee,
2354
- baseUrl: o,
2374
+ agentId: V ? "__controlled__" : ve,
2375
+ baseUrl: i,
2355
2376
  apiKey: r,
2356
- sessionEndpoint: i,
2377
+ sessionEndpoint: o,
2357
2378
  sessionBody: l,
2358
- onDataMessage: V ? void 0 : Be
2379
+ onDataMessage: V ? void 0 : qe
2359
2380
  });
2360
2381
  R(() => {
2361
2382
  if (V != null && V.subscribeToDataMessages)
2362
- return V.subscribeToDataMessages(Be);
2363
- }, [V, Be]), le.current = () => {
2383
+ return V.subscribeToDataMessages(qe);
2384
+ }, [V, qe]), ae.current = () => {
2364
2385
  var m;
2365
2386
  return (m = U.getRoom) == null ? void 0 : m.call(U);
2366
2387
  }, R(() => {
2367
- var G;
2368
- if (!se) return;
2369
- const m = (G = U.getRoom) == null ? void 0 : G.call(U), u = m == null ? void 0 : m.localParticipant;
2388
+ var K;
2389
+ if (!ce) return;
2390
+ const m = (K = U.getRoom) == null ? void 0 : K.call(U), u = m == null ? void 0 : m.localParticipant;
2370
2391
  if (u != null && u.publishData)
2371
2392
  try {
2372
- const Re = new TextEncoder().encode(
2373
- JSON.stringify({ type: "pathname", pathname: se })
2393
+ const Pe = new TextEncoder().encode(
2394
+ JSON.stringify({ type: "pathname", pathname: ce })
2374
2395
  );
2375
- u.publishData(Re, { reliable: !0 });
2396
+ u.publishData(Pe, { reliable: !0 });
2376
2397
  } catch {
2377
2398
  }
2378
- }, [se, U, U.connectionState]), R(() => {
2379
- var G;
2399
+ }, [ce, U, U.connectionState]), R(() => {
2400
+ var K;
2380
2401
  if (typeof window > "u") return;
2381
- const m = ((G = window.location) == null ? void 0 : G.hostname) || "";
2402
+ const m = ((K = window.location) == null ? void 0 : K.hostname) || "";
2382
2403
  if (m === "localhost" || m === "127.0.0.1" || m === "0.0.0.0" || m.endsWith(".local") || m.endsWith(".test"))
2383
- return window.__livelayerSimulateCommand = (Re) => {
2404
+ return window.__livelayerSimulateCommand = (Pe) => {
2384
2405
  try {
2385
- Be(Re);
2386
- } catch (et) {
2387
- console.warn("[LiveLayer] simulate-command threw:", et);
2406
+ qe(Pe);
2407
+ } catch (nt) {
2408
+ console.warn("[LiveLayer] simulate-command threw:", nt);
2388
2409
  }
2389
2410
  }, () => {
2390
2411
  delete window.__livelayerSimulateCommand;
2391
2412
  };
2392
- }, [Be]);
2393
- const w = rt(() => V ? {
2413
+ }, [qe]);
2414
+ const w = ot(() => V ? {
2394
2415
  connectionState: V.connectionState,
2395
2416
  agentState: V.agentState,
2396
2417
  transcript: V.transcript,
@@ -2431,164 +2452,164 @@ function Cr(e) {
2431
2452
  }, [w.videoElement]), R(() => {
2432
2453
  const m = w.audioElement;
2433
2454
  if (!m) return;
2434
- $e.attach(m);
2455
+ Ae.attach(m);
2435
2456
  const u = m.play();
2436
- return u && typeof u.catch == "function" && u.catch((G) => {
2437
- (G == null ? void 0 : G.name) === "NotAllowedError" && ue(!0);
2457
+ return u && typeof u.catch == "function" && u.catch((K) => {
2458
+ (K == null ? void 0 : K.name) === "NotAllowedError" && ue(!0);
2438
2459
  }), () => {
2439
- $e.detach();
2460
+ Ae.detach();
2440
2461
  };
2441
2462
  }, [w.audioElement]), R(() => {
2442
2463
  if (w.isControlled || w.connectionState !== "connected") return;
2443
2464
  const m = w.getRoom();
2444
2465
  if (m)
2445
2466
  return ne.setupMic(m).catch(() => {
2446
- }), oe.attachRoom(m), ie.attachRoom(m), de.refresh(), () => {
2447
- ne.teardownMic(), oe.teardown(), ie.teardown();
2467
+ }), ee.attachRoom(m), oe.attachRoom(m), de.refresh(), () => {
2468
+ ne.teardownMic(), ee.teardown(), oe.teardown();
2448
2469
  };
2449
2470
  }, [w.isControlled, w.connectionState]), R(() => {
2450
2471
  const m = w.audioElement;
2451
- m && (m.muted = Ae);
2452
- }, [w.audioElement, Ae]);
2472
+ m && (m.muted = Me);
2473
+ }, [w.audioElement, Me]);
2453
2474
  const Kt = k((m) => {
2454
2475
  const u = w.getRoom();
2455
2476
  if (u)
2456
2477
  try {
2457
- const G = new TextEncoder().encode(
2478
+ const K = new TextEncoder().encode(
2458
2479
  JSON.stringify({ type: "user_message", text: m })
2459
2480
  );
2460
- u.localParticipant.publishData(G, { reliable: !0 });
2481
+ u.localParticipant.publishData(K, { reliable: !0 });
2461
2482
  } catch {
2462
2483
  }
2463
2484
  }, [w]), Xt = k(() => {
2464
- p((m) => !m);
2485
+ ct((m) => !m);
2465
2486
  }, []);
2466
2487
  R(() => {
2467
- ke == null || ke(w.connectionState), w.connectionState === "connected" ? ge == null || ge() : w.connectionState === "disconnected" && (we == null || we());
2468
- }, [w.connectionState, ge, we, ke]), R(() => {
2469
- _e == null || _e(w.transcript);
2470
- }, [w.transcript, _e]), R(() => {
2471
- xe == null || xe(w.agentState);
2472
- }, [w.agentState, xe]);
2488
+ Le == null || Le(w.connectionState), w.connectionState === "connected" ? ge == null || ge() : w.connectionState === "disconnected" && (_e == null || _e());
2489
+ }, [w.connectionState, ge, _e, Le]), R(() => {
2490
+ xe == null || xe(w.transcript);
2491
+ }, [w.transcript, xe]), R(() => {
2492
+ ke == null || ke(w.agentState);
2493
+ }, [w.agentState, ke]);
2473
2494
  const _t = E(!1);
2474
2495
  R(() => {
2475
- w.isControlled || !c || _t.current || De && w.connectionState === "idle" && (_t.current = !0, w.connect());
2476
- }, [c, w.connectionState, w, De]);
2496
+ w.isControlled || !c || _t.current || Oe && w.connectionState === "idle" && (_t.current = !0, w.connect());
2497
+ }, [c, w.connectionState, w, Oe]);
2477
2498
  const Qt = k(
2478
2499
  (m) => {
2479
- 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)));
2500
+ const u = C == null ? void 0 : C.find((K) => K.id === m);
2501
+ u && (le(!1), m !== ye && (Qe(!0), w.disconnect(), se || re(m), v == null || v(u)));
2481
2502
  },
2482
2503
  [
2483
2504
  C,
2484
- Z,
2505
+ ye,
2485
2506
  w,
2486
- ce,
2507
+ se,
2487
2508
  v
2488
2509
  ]
2489
2510
  );
2490
2511
  R(() => {
2491
- fe && w.connectionState === "connected" && ze(!1);
2492
- }, [w.connectionState, fe]), R(() => {
2493
- if (!He) return;
2512
+ Ie && w.connectionState === "connected" && Qe(!1);
2513
+ }, [w.connectionState, Ie]), R(() => {
2514
+ if (!Be) return;
2494
2515
  const m = (u) => {
2495
- u.key === "Escape" && Oe(!1);
2516
+ u.key === "Escape" && le(!1);
2496
2517
  };
2497
2518
  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]
2519
+ }, [Be]);
2520
+ const Zt = !!M || !!(J != null && J.avatarImageUrl) || w.isControlled, We = kn(ve, i, Zt);
2521
+ Z === void 0 && ((kt = We.info) != null && kt.capabilities) && (dt.current = We.info.capabilities);
2522
+ const tt = (J == null ? void 0 : J.name) ?? H ?? ((Lt = w.agentConfig) == null ? void 0 : Lt.name) ?? ((St = We.info) == null ? void 0 : St.name) ?? "Live Layer", ut = (J == null ? void 0 : J.avatarImageUrl) ?? M ?? ((Ct = w.agentConfig) == null ? void 0 : Ct.avatarImageUrl) ?? ((Et = We.info) == null ? void 0 : Et.avatarImageUrl) ?? null, en = b ?? ((Nt = w.agentConfig) == null ? void 0 : Nt.idleLoopUrl) ?? ((At = We.info) == null ? void 0 : At.idleLoopUrl) ?? null, tn = z ?? null, nn = k(() => ie("expanded"), [ie]), rn = k(
2523
+ () => ie("minimized"),
2524
+ [ie]
2504
2525
  ), xt = k(() => {
2505
- w.disconnect(), ae("hidden");
2506
- }, [w, ae]), on = k(() => {
2526
+ w.disconnect(), ie("hidden");
2527
+ }, [w, ie]), on = k(() => {
2507
2528
  const m = w.audioElement;
2508
2529
  m && m.play().then(() => ue(!1)).catch(() => {
2509
2530
  });
2510
2531
  }, [w.audioElement]), ln = k(() => {
2511
2532
  ue(!1), w.connect();
2512
- }, [w]), We = {
2513
- ...Je,
2514
- zIndex: Ke
2533
+ }, [w]), Fe = {
2534
+ ...Ke,
2535
+ zIndex: Xe
2515
2536
  };
2516
- 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);
2537
+ h.primaryColor && (Fe["--ll-color-primary"] = h.primaryColor), h.accentColor && (Fe["--ll-color-accent"] = h.accentColor), h.backgroundColor && (Fe["--ll-color-bg"] = h.backgroundColor), h.textColor && (Fe["--ll-color-fg"] = h.textColor);
2517
2538
  const an = [
2518
2539
  "ll-widget",
2519
- `ll-widget--${re}`,
2520
- `ll-widget--${ve ? "mobile" : "desktop"}`,
2521
- lt
2540
+ `ll-widget--${be}`,
2541
+ `ll-widget--${Ne ? "mobile" : "desktop"}`,
2542
+ st
2522
2543
  ].filter(Boolean).join(" ");
2523
- return De ? /* @__PURE__ */ _(
2544
+ return Oe ? /* @__PURE__ */ _(
2524
2545
  "div",
2525
2546
  {
2526
2547
  className: an,
2527
- style: We,
2528
- "data-display-mode": re,
2548
+ style: Fe,
2549
+ "data-display-mode": be,
2529
2550
  "data-position": g,
2530
2551
  children: [
2531
- re === "hidden" && /* @__PURE__ */ n(
2552
+ be === "hidden" && /* @__PURE__ */ n(
2532
2553
  Vn,
2533
2554
  {
2534
2555
  position: g,
2535
- isMobile: ve,
2556
+ isMobile: Ne,
2536
2557
  isSpeaking: w.agentState === "speaking",
2537
- onExpand: () => ae("expanded"),
2538
- label: `Open ${Ze} widget`,
2558
+ onExpand: () => ie("expanded"),
2559
+ label: `Open ${tt} widget`,
2539
2560
  avatarImageUrl: ut,
2540
- agentName: Ze
2561
+ agentName: tt
2541
2562
  }
2542
2563
  ),
2543
- re === "minimized" && /* @__PURE__ */ n(
2564
+ be === "minimized" && /* @__PURE__ */ n(
2544
2565
  Gn,
2545
2566
  {
2546
2567
  position: g,
2547
- isMobile: ve,
2548
- agentName: Ze,
2568
+ isMobile: Ne,
2569
+ agentName: tt,
2549
2570
  avatarImageUrl: ut,
2550
2571
  agentState: w.agentState,
2551
2572
  isMuted: ne.isMuted,
2552
- audioLevel: $e,
2573
+ audioLevel: Ae,
2553
2574
  onExpand: nn,
2554
2575
  onToggleMute: ne.toggleMute,
2555
2576
  onClose: xt
2556
2577
  }
2557
2578
  ),
2558
- re === "expanded" && /* @__PURE__ */ n(
2579
+ be === "expanded" && /* @__PURE__ */ n(
2559
2580
  Kn,
2560
2581
  {
2561
2582
  position: g,
2562
- isMobile: ve,
2563
- agentName: Ze,
2583
+ isMobile: Ne,
2584
+ agentName: tt,
2564
2585
  avatarImageUrl: ut,
2565
2586
  idleLoopUrl: en,
2566
2587
  greeting: tn,
2567
2588
  branding: h,
2568
2589
  teamMembers: C,
2569
- currentTeamMemberId: Z,
2570
- isSwitchingTeamMember: fe,
2571
- teamSwitcherOpen: He,
2572
- onToggleTeamSwitcher: () => Oe((m) => !m),
2590
+ currentTeamMemberId: ye,
2591
+ isSwitchingTeamMember: Ie,
2592
+ teamSwitcherOpen: Be,
2593
+ onToggleTeamSwitcher: () => le((m) => !m),
2573
2594
  onSelectTeamMember: Qt,
2574
2595
  connectionState: w.connectionState,
2575
2596
  agentState: w.agentState,
2576
2597
  transcript: w.transcript,
2577
2598
  isMuted: ne.isMuted,
2578
2599
  micDevices: de.mics,
2579
- isCameraEnabled: oe.isEnabled,
2580
- cameraPreviewEl: oe.previewEl,
2600
+ isCameraEnabled: ee.isEnabled,
2601
+ cameraPreviewEl: ee.previewEl,
2581
2602
  cameraDevices: de.cameras,
2582
- activeCameraId: oe.activeDeviceId,
2583
- isScreenShareEnabled: ie.isEnabled,
2584
- screenPreviewEl: ie.previewEl,
2585
- isSpeakerMuted: Ae,
2603
+ activeCameraId: ee.activeDeviceId,
2604
+ isScreenShareEnabled: oe.isEnabled,
2605
+ screenPreviewEl: oe.previewEl,
2606
+ isSpeakerMuted: Me,
2586
2607
  allowCamera: N,
2587
2608
  allowScreenShare: q,
2588
2609
  allowTyping: D,
2589
- languageMenuOpen: Xe,
2590
- onToggleLanguageMenu: () => at((m) => !m),
2591
- needsUserGesture: Ne,
2610
+ languageMenuOpen: fe,
2611
+ onToggleLanguageMenu: () => Ze((m) => !m),
2612
+ needsUserGesture: Re,
2592
2613
  canResume: w.canResume,
2593
2614
  micError: ne.micError,
2594
2615
  error: w.error,
@@ -2599,9 +2620,9 @@ function Cr(e) {
2599
2620
  onRetry: ln,
2600
2621
  onResumeAudio: on,
2601
2622
  onToggleMute: ne.toggleMute,
2602
- onToggleCamera: () => void oe.toggle(),
2603
- onSwitchCameraDevice: (m) => void oe.switchDevice(m),
2604
- onToggleScreenShare: () => void ie.toggle(),
2623
+ onToggleCamera: () => void ee.toggle(),
2624
+ onSwitchCameraDevice: (m) => void ee.switchDevice(m),
2625
+ onToggleScreenShare: () => void oe.toggle(),
2605
2626
  onToggleSpeaker: Xt,
2606
2627
  onSendMessage: Kt,
2607
2628
  onMinimize: rn,
@@ -2620,13 +2641,13 @@ const Dr = ({
2620
2641
  agentId: e,
2621
2642
  baseUrl: t,
2622
2643
  apiKey: r,
2623
- mode: o,
2624
- onAgentEvent: i,
2644
+ mode: i,
2645
+ onAgentEvent: o,
2625
2646
  className: l,
2626
2647
  style: c
2627
2648
  }) => {
2628
- const d = E(null), f = E(null), y = E(i);
2629
- y.current = i;
2649
+ const d = E(null), f = E(null), y = E(o);
2650
+ y.current = o;
2630
2651
  const g = k((a) => {
2631
2652
  var I;
2632
2653
  const s = a.detail;
@@ -2636,42 +2657,42 @@ const Dr = ({
2636
2657
  const a = d.current;
2637
2658
  if (!a) return;
2638
2659
  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, () => {
2660
+ return s.setAttribute("agent-id", e), t && s.setAttribute("base-url", t), r && s.setAttribute("api-key", r), i && s.setAttribute("mode", i), s.addEventListener("agent-event", g), a.appendChild(s), f.current = s, () => {
2640
2661
  s.removeEventListener("agent-event", g), a.removeChild(s), f.current = null;
2641
2662
  };
2642
2663
  }, [e]), R(() => {
2643
- f.current && (o ? f.current.setAttribute("mode", o) : f.current.removeAttribute("mode"));
2644
- }, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
2664
+ f.current && (i ? f.current.setAttribute("mode", i) : f.current.removeAttribute("mode"));
2665
+ }, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
2645
2666
  }, $r = mt(
2646
- function({ id: t, intent: r, as: o = "div", className: i, style: l, children: c }, d) {
2667
+ function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, d) {
2647
2668
  return un(
2648
- o,
2669
+ i,
2649
2670
  {
2650
2671
  ref: d,
2651
2672
  "data-ll-region": t,
2652
2673
  "data-ll-intent": r,
2653
- className: i,
2674
+ className: o,
2654
2675
  style: l
2655
2676
  },
2656
2677
  c
2657
2678
  );
2658
2679
  }
2659
2680
  ), zr = mt(
2660
- function({ id: t, intent: r, children: o, ...i }, l) {
2681
+ function({ id: t, intent: r, children: i, ...o }, l) {
2661
2682
  return /* @__PURE__ */ n(
2662
2683
  "form",
2663
2684
  {
2664
2685
  ref: l,
2665
2686
  "data-ll-form": t,
2666
2687
  "data-ll-intent": r,
2667
- ...i,
2668
- children: o
2688
+ ...o,
2689
+ children: i
2669
2690
  }
2670
2691
  );
2671
2692
  }
2672
2693
  ), Hr = mt(
2673
2694
  function(t, r) {
2674
- const { name: o, label: i, labelClassName: l } = t, c = { name: o, "data-ll-field": o };
2695
+ const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
2675
2696
  let d;
2676
2697
  if ("as" in t && t.as === "textarea") {
2677
2698
  const { name: f, label: y, labelClassName: g, as: a, ...s } = t;
@@ -2705,8 +2726,8 @@ const Dr = ({
2705
2726
  }
2706
2727
  );
2707
2728
  }
2708
- return i === void 0 ? d : /* @__PURE__ */ _("label", { className: l, children: [
2709
- i,
2729
+ return o === void 0 ? d : /* @__PURE__ */ _("label", { className: l, children: [
2730
+ o,
2710
2731
  d
2711
2732
  ] });
2712
2733
  }
@@ -2717,21 +2738,21 @@ function Or({
2717
2738
  defaultOpen: t = !1,
2718
2739
  storageKey: r = "ll-debug-open"
2719
2740
  }) {
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);
2741
+ const [i, o] = L(t), [l, c] = L([]), [d, f] = L(""), [y, g] = L(!1), a = E(/* @__PURE__ */ new Set()), s = E([]), I = E(y);
2721
2742
  I.current = y, R(() => {
2722
2743
  try {
2723
2744
  const v = localStorage.getItem(r);
2724
- v === "1" && i(!0), v === "0" && i(!1);
2745
+ v === "1" && o(!0), v === "0" && o(!1);
2725
2746
  } catch {
2726
2747
  }
2727
2748
  }, [r]), R(() => {
2728
2749
  try {
2729
- localStorage.setItem(r, o ? "1" : "0");
2750
+ localStorage.setItem(r, i ? "1" : "0");
2730
2751
  } catch {
2731
2752
  }
2732
- }, [o, r]), R(() => {
2753
+ }, [i, r]), R(() => {
2733
2754
  const v = (b) => {
2734
- (b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), i((z) => !z));
2755
+ (b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), o((z) => !z));
2735
2756
  };
2736
2757
  return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
2737
2758
  }, []), R(() => {
@@ -2773,12 +2794,12 @@ function Or({
2773
2794
  return console.warn = z("warn", v), console.log = z("log", b), () => {
2774
2795
  console.warn = v, console.log = b;
2775
2796
  };
2776
- }, []), !o)
2797
+ }, []), !i)
2777
2798
  return /* @__PURE__ */ n(
2778
2799
  "button",
2779
2800
  {
2780
2801
  type: "button",
2781
- onClick: () => i(!0),
2802
+ onClick: () => o(!0),
2782
2803
  title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
2783
2804
  "aria-label": "Open LiveLayer debug panel",
2784
2805
  style: {
@@ -2872,7 +2893,7 @@ function Or({
2872
2893
  "button",
2873
2894
  {
2874
2895
  type: "button",
2875
- onClick: () => i(!1),
2896
+ onClick: () => o(!1),
2876
2897
  style: pt("transparent"),
2877
2898
  "aria-label": "Close",
2878
2899
  title: "Close (Cmd/Ctrl + Shift + L)",
@@ -2961,7 +2982,7 @@ function Er({
2961
2982
  expanded: t,
2962
2983
  onToggle: r
2963
2984
  }) {
2964
- const o = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", i = new Date(e.ts).toLocaleTimeString("en-US", {
2985
+ const i = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", o = new Date(e.ts).toLocaleTimeString("en-US", {
2965
2986
  hour12: !1
2966
2987
  });
2967
2988
  return /* @__PURE__ */ _(
@@ -2991,14 +3012,14 @@ function Er({
2991
3012
  fontVariantNumeric: "tabular-nums",
2992
3013
  fontSize: 10
2993
3014
  },
2994
- children: i
3015
+ children: o
2995
3016
  }
2996
3017
  ),
2997
3018
  /* @__PURE__ */ n(
2998
3019
  "span",
2999
3020
  {
3000
3021
  style: {
3001
- color: o,
3022
+ color: i,
3002
3023
  fontWeight: 600,
3003
3024
  flexShrink: 0
3004
3025
  },
@@ -3045,20 +3066,20 @@ function Nr(e) {
3045
3066
  }
3046
3067
  }
3047
3068
  function Br() {
3048
- const [e, t] = L([]), r = k((i) => {
3069
+ const [e, t] = L([]), r = k((o) => {
3049
3070
  t((l) => {
3050
- const c = l.findIndex((d) => d.id === i.id);
3071
+ const c = l.findIndex((d) => d.id === o.id);
3051
3072
  if (c >= 0) {
3052
3073
  const d = l.slice();
3053
- return d[c] = i, d;
3074
+ return d[c] = o, d;
3054
3075
  }
3055
- return [...l, i];
3076
+ return [...l, o];
3056
3077
  });
3057
- }, []), o = k(() => t([]), []);
3078
+ }, []), i = k(() => t([]), []);
3058
3079
  return {
3059
3080
  entries: e,
3060
3081
  pushSegment: r,
3061
- clear: o,
3082
+ clear: i,
3062
3083
  latest: e.length > 0 ? e[e.length - 1] : null
3063
3084
  };
3064
3085
  }