@livelayer/react 0.5.5-pr66c.5 → 0.5.5-pr66c.7

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 x, jsx as n, Fragment as yt } from "react/jsx-runtime";
3
- import { Component as pn, useState as C, useRef as E, useEffect as N, useCallback as k, useMemo as Be, forwardRef as vt, createElement as hn } from "react";
3
+ import { Component as pn, useState as C, useRef as E, useEffect as N, useCallback as k, useMemo as He, forwardRef as vt, createElement as hn } from "react";
4
4
  import { LiveKitSession as mn } from "@livelayer/sdk";
5
5
  import { createLocalAudioTrack as gn, Track as Kt, createLocalVideoTrack as yn } from "livekit-client";
6
6
  class vn extends pn {
@@ -34,22 +34,22 @@ class vn extends pn {
34
34
  }
35
35
  }
36
36
  function bn(e) {
37
- const [t, r] = C("idle"), [i, o] = C("idle"), [l, s] = C([]), [d, u] = C(null), [p, m] = C(null), [a, c] = C(null), [R, q] = C(!1), [w, _] = C(null), y = E(null), z = E(e.onDataMessage);
38
- z.current = e.onDataMessage, N(() => {
37
+ const [t, r] = C("idle"), [i, o] = C("idle"), [l, c] = C([]), [d, u] = C(null), [h, m] = C(null), [a, s] = C(null), [R, q] = C(!1), [_, w] = C(null), y = E(null), H = E(e.onDataMessage);
38
+ H.current = e.onDataMessage, N(() => {
39
39
  const S = {
40
40
  onConnectionStateChange: (D) => {
41
- r(D), D === "connected" && _(null);
41
+ r(D), D === "connected" && w(null);
42
42
  },
43
43
  onAgentStateChange: o,
44
- onTranscript: (D) => s([...D]),
44
+ onTranscript: (D) => c([...D]),
45
45
  onAgentConfig: u,
46
- onAudioTrack: (D) => c(D),
46
+ onAudioTrack: (D) => s(D),
47
47
  onVideoTrack: (D) => m(D),
48
48
  onVideoTrackRemoved: () => m(null),
49
- onError: (D) => _(D),
49
+ onError: (D) => w(D),
50
50
  onDataMessage: (D) => {
51
51
  var A;
52
- (A = z.current) == null || A.call(z, D);
52
+ (A = H.current) == null || A.call(H, D);
53
53
  },
54
54
  onResumabilityChange: q
55
55
  }, B = new mn(
@@ -62,7 +62,7 @@ function bn(e) {
62
62
  },
63
63
  S
64
64
  );
65
- return y.current = B, r("idle"), o("idle"), s([]), u(null), m(null), c(null), q(!1), _(null), () => {
65
+ return y.current = B, r("idle"), o("idle"), c([]), u(null), m(null), s(null), q(!1), w(null), () => {
66
66
  var D;
67
67
  (D = B.destroy) == null || D.call(B), y.current = null;
68
68
  };
@@ -79,9 +79,9 @@ function bn(e) {
79
79
  try {
80
80
  await S.connect();
81
81
  } catch (B) {
82
- throw _(B instanceof Error ? B.message : String(B)), B;
82
+ throw w(B instanceof Error ? B.message : String(B)), B;
83
83
  }
84
- }, []), H = k(() => {
84
+ }, []), z = k(() => {
85
85
  const S = y.current;
86
86
  S && S.disconnect();
87
87
  }, []), v = k(() => {
@@ -93,18 +93,18 @@ function bn(e) {
93
93
  agentState: i,
94
94
  transcript: l,
95
95
  agentConfig: d,
96
- videoElement: p,
96
+ videoElement: h,
97
97
  audioElement: a,
98
98
  canResume: R,
99
- error: w,
99
+ error: _,
100
100
  connect: M,
101
- disconnect: H,
101
+ disconnect: z,
102
102
  getRoom: v,
103
103
  session: y.current
104
104
  };
105
105
  }
106
106
  function wn() {
107
- const e = E(null), t = E(null), r = E(null), i = E(null), o = E(/* @__PURE__ */ new Set()), l = E(null), s = 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
110
  i.current = null;
@@ -113,22 +113,22 @@ function wn() {
113
113
  (!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
114
114
  new ArrayBuffer(a.frequencyBinCount)
115
115
  ));
116
- const c = l.current;
117
- a.getByteFrequencyData(c);
116
+ const s = l.current;
117
+ a.getByteFrequencyData(s);
118
118
  let R = 0;
119
- for (let w = 0; w < c.length; w++) R += c[w];
120
- const q = R / c.length / 255;
121
- for (const w of o.current)
119
+ for (let _ = 0; _ < s.length; _++) R += s[_];
120
+ const q = R / s.length / 255;
121
+ for (const _ of o.current)
122
122
  try {
123
- w(q);
124
- } catch (_) {
125
- console.error("[useAudioLevel] subscriber threw:", _);
123
+ _(q);
124
+ } catch (w) {
125
+ console.error("[useAudioLevel] subscriber threw:", w);
126
126
  }
127
- i.current = requestAnimationFrame(s);
127
+ i.current = requestAnimationFrame(c);
128
128
  }, []), d = k(() => {
129
129
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
- const a = new AudioContext(), c = a.createAnalyser();
131
- c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
130
+ const a = new AudioContext(), s = a.createAnalyser();
131
+ s.fftSize = 64, s.connect(a.destination), e.current = a, t.current = s;
132
132
  }, []), u = k(
133
133
  (a) => {
134
134
  if (d(), !(!e.current || !t.current)) {
@@ -140,17 +140,17 @@ function wn() {
140
140
  r.current = null;
141
141
  }
142
142
  try {
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);
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);
147
147
  return;
148
148
  }
149
- i.current === null && (i.current = requestAnimationFrame(s));
149
+ i.current === null && (i.current = requestAnimationFrame(c));
150
150
  }
151
151
  },
152
- [d, s]
153
- ), p = k(() => {
152
+ [d, c]
153
+ ), h = k(() => {
154
154
  if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
155
155
  try {
156
156
  r.current.disconnect();
@@ -162,7 +162,7 @@ function wn() {
162
162
  o.current.delete(a);
163
163
  }), []);
164
164
  return N(() => () => {
165
- if (p(), t.current) {
165
+ if (h(), t.current) {
166
166
  try {
167
167
  t.current.disconnect();
168
168
  } catch {
@@ -177,10 +177,10 @@ function wn() {
177
177
  e.current = null;
178
178
  }
179
179
  o.current.clear(), l.current = null;
180
- }, [p]), { attach: u, detach: p, subscribe: m };
180
+ }, [h]), { attach: u, detach: h, subscribe: m };
181
181
  }
182
182
  function _n() {
183
- const [e, t] = C(!1), [r, i] = C(null), o = E(null), l = E(null), s = k(async (m) => {
183
+ const [e, t] = C(!1), [r, i] = C(null), o = E(null), l = E(null), c = k(async (m) => {
184
184
  if (o.current && l.current) {
185
185
  try {
186
186
  await l.current.localParticipant.unpublishTrack(o.current);
@@ -196,8 +196,8 @@ function _n() {
196
196
  });
197
197
  await m.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
198
198
  } catch (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 i(c), 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 i(s), a;
201
201
  }
202
202
  }, []), d = k(() => {
203
203
  const m = o.current;
@@ -212,23 +212,23 @@ function _n() {
212
212
  m.stop();
213
213
  }
214
214
  o.current = null, l.current = null, t(!1);
215
- }, []), p = k(() => i(null), []);
215
+ }, []), h = k(() => i(null), []);
216
216
  return {
217
217
  isMuted: e,
218
218
  micError: r,
219
219
  toggleMute: d,
220
- setupMic: s,
220
+ setupMic: c,
221
221
  teardownMic: u,
222
- clearError: p
222
+ clearError: h
223
223
  };
224
224
  }
225
225
  const xn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
226
  function kn() {
227
- const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), [s, d] = C(""), u = E(null), p = E(null), m = k((y) => {
227
+ const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), [c, d] = C(""), u = E(null), h = E(null), m = k((y) => {
228
228
  u.current = y;
229
229
  }, []), a = k(() => {
230
- const y = u.current, z = p.current;
231
- if (z && y) {
230
+ const y = u.current, H = h.current;
231
+ if (H && y) {
232
232
  const M = y.localParticipant.getTrackPublication(Kt.Source.Camera);
233
233
  if (M != null && M.track) {
234
234
  try {
@@ -237,62 +237,62 @@ function kn() {
237
237
  }
238
238
  M.track.stop();
239
239
  } else
240
- z.stop();
240
+ H.stop();
241
241
  }
242
- p.current = null, l(null), t(!1);
243
- }, []), c = k(async (y) => {
244
- const z = u.current;
245
- if (z) {
242
+ h.current = null, l(null), t(!1);
243
+ }, []), s = k(async (y) => {
244
+ const H = u.current;
245
+ if (H) {
246
246
  i(null);
247
247
  try {
248
248
  const M = { ...xn };
249
249
  y && (M.deviceId = y);
250
- const H = await yn(M);
251
- await z.localParticipant.publishTrack(H), p.current = H;
252
- const v = H.attach();
250
+ const z = await yn(M);
251
+ await H.localParticipant.publishTrack(z), h.current = z;
252
+ const v = z.attach();
253
253
  l(v), t(!0), y && d(y);
254
254
  try {
255
- z.localParticipant.publishData(
255
+ H.localParticipant.publishData(
256
256
  new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
257
257
  { reliable: !0 }
258
258
  );
259
259
  } catch {
260
260
  }
261
261
  } catch (M) {
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
- i(H);
262
+ const z = M instanceof Error && M.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
+ i(z);
264
264
  }
265
265
  }
266
266
  }, []), R = k(async () => {
267
- e ? a() : await c(s || void 0);
268
- }, [e, s, a, c]), q = k(async (y) => {
269
- a(), await c(y);
270
- }, [a, c]), w = k(() => {
267
+ e ? a() : await s(c || void 0);
268
+ }, [e, c, a, s]), q = k(async (y) => {
269
+ a(), await s(y);
270
+ }, [a, s]), _ = k(() => {
271
271
  a(), u.current = null, i(null), d("");
272
- }, [a]), _ = k(() => i(null), []);
272
+ }, [a]), w = k(() => i(null), []);
273
273
  return N(() => () => {
274
- p.current && p.current.stop();
274
+ h.current && h.current.stop();
275
275
  }, []), {
276
276
  isEnabled: e,
277
277
  error: r,
278
278
  previewEl: o,
279
- activeDeviceId: s,
279
+ activeDeviceId: c,
280
280
  toggle: R,
281
281
  switchDevice: q,
282
282
  attachRoom: m,
283
- teardown: w,
284
- clearError: _
283
+ teardown: _,
284
+ clearError: w
285
285
  };
286
286
  }
287
287
  function Ln() {
288
- const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), s = E(null), d = k((c) => {
289
- s.current = c;
290
- }, []), u = k(() => l(null), []), p = k(async () => {
291
- const c = s.current;
292
- if (c) {
288
+ const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), c = E(null), d = k((s) => {
289
+ c.current = s;
290
+ }, []), u = k(() => l(null), []), h = k(async () => {
291
+ const s = c.current;
292
+ if (s) {
293
293
  if (e) {
294
294
  try {
295
- await c.localParticipant.setScreenShareEnabled(!1);
295
+ await s.localParticipant.setScreenShareEnabled(!1);
296
296
  } catch {
297
297
  }
298
298
  u(), t(!1);
@@ -300,15 +300,15 @@ function Ln() {
300
300
  }
301
301
  i(null);
302
302
  try {
303
- await c.localParticipant.setScreenShareEnabled(!0);
303
+ await s.localParticipant.setScreenShareEnabled(!0);
304
304
  let R = 0;
305
305
  const q = () => {
306
- const w = c.localParticipant.getTrackPublication(Kt.Source.ScreenShare);
307
- if (w != null && w.track) {
308
- const _ = w.track.attach();
309
- l(_), t(!0);
306
+ const _ = s.localParticipant.getTrackPublication(Kt.Source.ScreenShare);
307
+ if (_ != null && _.track) {
308
+ const w = _.track.attach();
309
+ l(w), t(!0);
310
310
  try {
311
- c.localParticipant.publishData(
311
+ s.localParticipant.publishData(
312
312
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
313
313
  { reliable: !0 }
314
314
  );
@@ -325,22 +325,22 @@ function Ln() {
325
325
  }
326
326
  }
327
327
  }, [e, u]), m = k(() => {
328
- const c = s.current;
329
- if (c && e)
328
+ const s = c.current;
329
+ if (s && e)
330
330
  try {
331
- c.localParticipant.setScreenShareEnabled(!1);
331
+ s.localParticipant.setScreenShareEnabled(!1);
332
332
  } catch {
333
333
  }
334
- u(), t(!1), i(null), s.current = null;
334
+ u(), t(!1), i(null), c.current = null;
335
335
  }, [e, u]), a = k(() => i(null), []);
336
- return { isEnabled: e, error: r, previewEl: o, toggle: p, attachRoom: d, teardown: m, clearError: a };
336
+ return { isEnabled: e, error: r, previewEl: o, toggle: h, attachRoom: d, teardown: m, clearError: a };
337
337
  }
338
338
  function Sn() {
339
339
  const [e, t] = C([]), [r, i] = C([]), 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((s) => s.kind === "audioinput")), i(l.filter((s) => s.kind === "videoinput"));
343
+ t(l.filter((c) => c.kind === "audioinput")), i(l.filter((c) => c.kind === "videoinput"));
344
344
  } catch {
345
345
  }
346
346
  }, []);
@@ -351,26 +351,26 @@ function Sn() {
351
351
  }, [o]), { mics: e, cameras: r, refresh: o };
352
352
  }
353
353
  function Cn(e, t, r = !1) {
354
- const [i, o] = C(null), [l, s] = C(null), [d, u] = C(!r && !!e);
354
+ const [i, o] = C(null), [l, c] = C(null), [d, u] = C(!r && !!e);
355
355
  return N(() => {
356
356
  if (r || !e) {
357
357
  u(!1);
358
358
  return;
359
359
  }
360
- const p = new AbortController(), m = t || "https://app.livelayer.studio";
361
- return u(!0), s(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
362
- signal: p.signal
360
+ const h = new AbortController(), m = t || "https://app.livelayer.studio";
361
+ return u(!0), c(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
362
+ signal: h.signal
363
363
  }).then(async (a) => {
364
364
  if (!a.ok) {
365
- const c = await a.json().catch(() => ({}));
366
- throw new Error(c.error || `HTTP ${a.status}`);
365
+ const s = await a.json().catch(() => ({}));
366
+ throw new Error(s.error || `HTTP ${a.status}`);
367
367
  }
368
368
  return a.json();
369
369
  }).then((a) => {
370
- p.signal.aborted || (o(a), u(!1));
370
+ h.signal.aborted || (o(a), u(!1));
371
371
  }).catch((a) => {
372
- p.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
373
- }), () => p.abort();
372
+ h.signal.aborted || (c(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
373
+ }), () => h.abort();
374
374
  }, [e, t, r]), { info: i, error: l, loading: d };
375
375
  }
376
376
  function En(e) {
@@ -393,13 +393,13 @@ function An({
393
393
  defaultValue: t = "expanded",
394
394
  onChange: r
395
395
  } = {}) {
396
- const i = e !== void 0, [o, l] = C(t), s = i ? e : o, d = k(
396
+ const i = e !== void 0, [o, l] = C(t), c = i ? e : o, d = k(
397
397
  (u) => {
398
- u !== s && (i || l(u), r == null || r(u));
398
+ u !== c && (i || l(u), r == null || r(u));
399
399
  },
400
- [s, i, r]
400
+ [c, i, r]
401
401
  );
402
- return [s, d];
402
+ return [c, d];
403
403
  }
404
404
  const Rn = ["hidden", "minimized", "expanded"];
405
405
  function In(e) {
@@ -412,17 +412,17 @@ function Mn({
412
412
  persistKey: i = "ll-widget",
413
413
  disablePersistence: o = !1
414
414
  } = {}) {
415
- const l = `${i}:display-mode`, s = E(!1), [d, u] = An({
415
+ const l = `${i}:display-mode`, c = E(!1), [d, u] = An({
416
416
  value: e,
417
417
  defaultValue: t,
418
- onChange: (p) => {
419
- e === void 0 && !o && Nn(l, p), r == null || r(p);
418
+ onChange: (h) => {
419
+ e === void 0 && !o && Nn(l, h), r == null || r(h);
420
420
  }
421
421
  });
422
422
  return N(() => {
423
- if (s.current || (s.current = !0, o || e !== void 0)) return;
424
- const p = In(En(l));
425
- p && p !== d && u(p);
423
+ if (c.current || (c.current = !0, o || e !== void 0)) return;
424
+ const h = In(En(l));
425
+ h && h !== d && u(h);
426
426
  }, []), [d, u];
427
427
  }
428
428
  const Tn = 640;
@@ -441,16 +441,16 @@ function Pn(e = Tn) {
441
441
  });
442
442
  }, [e]), t;
443
443
  }
444
- const Pt = "__llHistoryPatched", ot = "ll:pathname";
444
+ const Pt = "__llHistoryPatched", at = "ll:pathname";
445
445
  function Dn() {
446
446
  if (typeof window > "u" || window.history[Pt]) return;
447
447
  const e = window.history.pushState, t = window.history.replaceState;
448
448
  window.history.pushState = function(...r) {
449
449
  const i = e.apply(this, r);
450
- return window.dispatchEvent(new Event(ot)), i;
450
+ return window.dispatchEvent(new Event(at)), i;
451
451
  }, window.history.replaceState = function(...r) {
452
452
  const i = t.apply(this, r);
453
- return window.dispatchEvent(new Event(ot)), i;
453
+ return window.dispatchEvent(new Event(at)), i;
454
454
  }, window.history[Pt] = !0;
455
455
  }
456
456
  function Dt() {
@@ -464,8 +464,8 @@ function $n(e) {
464
464
  if (e !== void 0) return;
465
465
  Dn();
466
466
  const i = () => r(Dt());
467
- return i(), window.addEventListener("popstate", i), window.addEventListener(ot, i), () => {
468
- window.removeEventListener("popstate", i), window.removeEventListener(ot, i);
467
+ return i(), window.addEventListener("popstate", i), window.addEventListener(at, i), () => {
468
+ window.removeEventListener("popstate", i), window.removeEventListener(at, i);
469
469
  };
470
470
  }, [e]), e ?? t;
471
471
  }
@@ -496,7 +496,7 @@ function Wn(e, t, r) {
496
496
  return e === void 0 ? !0 : zt(r, e) ? !1 : t && t.length > 0 ? zt(t, e) : !0;
497
497
  }
498
498
  function Fn(e, t, r) {
499
- return Be(
499
+ return He(
500
500
  () => Wn(e, t, r),
501
501
  [e, t, r]
502
502
  );
@@ -509,7 +509,7 @@ function Un(e) {
509
509
  };
510
510
  }
511
511
  function jn(e) {
512
- const t = Be(() => Un(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = E(null), o = k(
512
+ const t = He(() => Un(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = E(null), o = k(
513
513
  (u) => {
514
514
  try {
515
515
  new Audio(`${r}${u}`).play().catch(() => {
@@ -520,7 +520,7 @@ function jn(e) {
520
520
  [r]
521
521
  ), l = k(() => {
522
522
  t.navigate && o("/audio/page-change-sound.mp3");
523
- }, [t.navigate, o]), s = k(() => {
523
+ }, [t.navigate, o]), c = k(() => {
524
524
  t.action && o("/audio/confirmation-sound.mp3");
525
525
  }, [t.action, o]), d = k(
526
526
  (u) => {
@@ -537,10 +537,10 @@ function jn(e) {
537
537
  if (u) {
538
538
  if (i.current) return;
539
539
  try {
540
- const p = new Audio(`${r}/audio/thinking-sound.mp3`);
541
- p.loop = !0, p.volume = 0.3, p.play().catch(() => {
540
+ const h = new Audio(`${r}/audio/thinking-sound.mp3`);
541
+ h.loop = !0, h.volume = 0.3, h.play().catch(() => {
542
542
  i.current = null;
543
- }), i.current = p;
543
+ }), i.current = h;
544
544
  } catch {
545
545
  }
546
546
  } else if (i.current) {
@@ -561,9 +561,9 @@ function jn(e) {
561
561
  }
562
562
  i.current = null;
563
563
  }
564
- }, []), Be(
565
- () => ({ playPageChange: l, playConfirmation: s, setThinking: d }),
566
- [l, s, d]
564
+ }, []), He(
565
+ () => ({ playPageChange: l, playConfirmation: c, setThinking: d }),
566
+ [l, c, d]
567
567
  );
568
568
  }
569
569
  const Ht = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ x(
@@ -688,32 +688,32 @@ const Kn = ({
688
688
  onExpand: i,
689
689
  label: o = "Open widget",
690
690
  avatarImageUrl: l,
691
- agentName: s
691
+ agentName: c
692
692
  }) => {
693
- const d = Gn(e), u = d === "right" ? "left" : "right", p = t ? 80 : 72, m = !!l, [a, c] = C(null), [R, q] = C(!1), w = E(null), _ = E(!1), y = k(
693
+ const d = Gn(e), u = d === "right" ? "left" : "right", h = t ? 80 : 72, m = !!l, [a, s] = C(null), [R, q] = C(!1), _ = E(null), w = E(!1), y = k(
694
694
  (A) => {
695
695
  if (typeof window > "u") return A;
696
- const T = p / 2, W = Bt + T, V = window.innerHeight - Bt - T;
697
- return V < W ? Math.max(W, A) : Math.max(W, Math.min(V, A));
696
+ const T = h / 2, W = Bt + T, G = window.innerHeight - Bt - T;
697
+ return G < W ? Math.max(W, A) : Math.max(W, Math.min(G, A));
698
698
  },
699
- [p]
699
+ [h]
700
700
  );
701
701
  N(() => {
702
702
  const A = Jn();
703
- c(y(A ?? window.innerHeight / 2));
703
+ s(y(A ?? window.innerHeight / 2));
704
704
  const T = () => {
705
- c((W) => W === null ? null : y(W));
705
+ s((W) => W === null ? null : y(W));
706
706
  };
707
707
  return window.addEventListener("resize", T), () => window.removeEventListener("resize", T);
708
708
  }, [y]);
709
- const z = k(
709
+ const H = k(
710
710
  (A) => {
711
711
  if (!(A.pointerType === "mouse" && A.button !== 0) && a !== null) {
712
712
  try {
713
713
  A.currentTarget.setPointerCapture(A.pointerId);
714
714
  } catch {
715
715
  }
716
- w.current = {
716
+ _.current = {
717
717
  startClientY: A.clientY,
718
718
  startCenterY: a,
719
719
  moved: !1
@@ -723,27 +723,27 @@ const Kn = ({
723
723
  [a]
724
724
  ), M = k(
725
725
  (A) => {
726
- const T = w.current;
726
+ const T = _.current;
727
727
  if (!T) return;
728
728
  const W = A.clientY - T.startClientY;
729
- !T.moved && Math.abs(W) > Xn && (T.moved = !0, q(!0)), T.moved && c(y(T.startCenterY + W));
729
+ !T.moved && Math.abs(W) > Xn && (T.moved = !0, q(!0)), T.moved && s(y(T.startCenterY + W));
730
730
  },
731
731
  [y]
732
- ), H = k(
732
+ ), z = k(
733
733
  (A) => {
734
- const T = w.current;
734
+ const T = _.current;
735
735
  if (T) {
736
736
  try {
737
737
  A.currentTarget.releasePointerCapture(A.pointerId);
738
738
  } catch {
739
739
  }
740
- w.current = null, T.moved && (q(!1), _.current = !0, c((W) => (W !== null && Wt(W), W)));
740
+ _.current = null, T.moved && (q(!1), w.current = !0, s((W) => (W !== null && Wt(W), W)));
741
741
  }
742
742
  },
743
743
  []
744
744
  ), v = k(() => {
745
- if (_.current) {
746
- _.current = !1;
745
+ if (w.current) {
746
+ w.current = !1;
747
747
  return;
748
748
  }
749
749
  i();
@@ -752,10 +752,10 @@ const Kn = ({
752
752
  if (A.key === "ArrowUp" || A.key === "ArrowDown") {
753
753
  A.preventDefault();
754
754
  const T = A.key === "ArrowUp" ? -8 : 8;
755
- c((W) => {
755
+ s((W) => {
756
756
  if (W === null) return W;
757
- const V = y(W + T);
758
- return Wt(V), V;
757
+ const G = y(W + T);
758
+ return Wt(G), G;
759
759
  });
760
760
  }
761
761
  },
@@ -767,16 +767,16 @@ const Kn = ({
767
767
  r ? "ll-hidden--speaking" : null,
768
768
  R ? "is-dragging" : null,
769
769
  m ? "ll-hidden--with-avatar" : null
770
- ].filter(Boolean).join(" "), D = a === null ? void 0 : { top: `${a - p / 2}px`, transform: "none" };
770
+ ].filter(Boolean).join(" "), D = a === null ? void 0 : { top: `${a - h / 2}px`, transform: "none" };
771
771
  return /* @__PURE__ */ n(
772
772
  "button",
773
773
  {
774
774
  type: "button",
775
775
  className: B,
776
- onPointerDown: z,
776
+ onPointerDown: H,
777
777
  onPointerMove: M,
778
- onPointerUp: H,
779
- onPointerCancel: H,
778
+ onPointerUp: z,
779
+ onPointerCancel: z,
780
780
  onClick: v,
781
781
  onKeyDown: S,
782
782
  "aria-label": o,
@@ -799,7 +799,7 @@ const Kn = ({
799
799
  "img",
800
800
  {
801
801
  src: l,
802
- alt: s ? `${s} avatar` : "Agent avatar",
802
+ alt: c ? `${c} avatar` : "Agent avatar",
803
803
  className: "ll-hidden__avatar",
804
804
  draggable: !1
805
805
  }
@@ -822,24 +822,24 @@ const Kn = ({
822
822
  className: o,
823
823
  barClassName: l
824
824
  }) => {
825
- const s = E(null), d = E([]), u = Be(() => {
825
+ const c = E(null), d = E([]), u = He(() => {
826
826
  const m = (Math.sqrt(5) - 1) / 2;
827
- return Array.from({ length: t }, (a, c) => 0.5 + c * m % 1 * 0.5);
827
+ return Array.from({ length: t }, (a, s) => 0.5 + s * m % 1 * 0.5);
828
828
  }, [t]);
829
829
  N(() => e.subscribe((a) => {
830
- for (let c = 0; c < t; c++) {
831
- const R = d.current[c];
830
+ for (let s = 0; s < t; s++) {
831
+ const R = d.current[s];
832
832
  if (!R) continue;
833
- const q = Math.max(i, a * r * u[c]);
833
+ const q = Math.max(i, a * r * u[s]);
834
834
  R.style.height = `${q}px`;
835
835
  }
836
836
  }), [e, t, r, i, u]);
837
- const p = ["ll-waveform", o].filter(Boolean).join(" ");
838
- return /* @__PURE__ */ n("div", { ref: s, className: p, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
837
+ const h = ["ll-waveform", o].filter(Boolean).join(" ");
838
+ return /* @__PURE__ */ n("div", { ref: c, className: h, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
839
839
  "div",
840
840
  {
841
- ref: (c) => {
842
- d.current[a] = c;
841
+ ref: (s) => {
842
+ d.current[a] = s;
843
843
  },
844
844
  className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
845
845
  style: { height: `${i}px` }
@@ -853,10 +853,10 @@ const Kn = ({
853
853
  avatarImageUrl: i,
854
854
  agentState: o,
855
855
  isMuted: l,
856
- audioLevel: s,
856
+ audioLevel: c,
857
857
  onExpand: d,
858
858
  onToggleMute: u,
859
- onClose: p
859
+ onClose: h
860
860
  }) => t ? /* @__PURE__ */ n(
861
861
  "div",
862
862
  {
@@ -885,7 +885,7 @@ const Kn = ({
885
885
  /* @__PURE__ */ n(
886
886
  Qn,
887
887
  {
888
- audioLevel: s,
888
+ audioLevel: c,
889
889
  bars: 16,
890
890
  maxHeight: 18,
891
891
  className: "ll-minimized__waveform"
@@ -964,7 +964,7 @@ const Kn = ({
964
964
  {
965
965
  type: "button",
966
966
  className: "ll-minimized__btn ll-minimized__btn--close",
967
- onClick: p,
967
+ onClick: h,
968
968
  "aria-label": "Close widget",
969
969
  children: /* @__PURE__ */ n(Vn, { className: "ll-minimized__icon" })
970
970
  }
@@ -979,9 +979,9 @@ const Kn = ({
979
979
  className: i,
980
980
  style: o
981
981
  }) => {
982
- const [l, s] = C(!1), d = E(e);
982
+ const [l, c] = C(!1), d = E(e);
983
983
  if (N(() => {
984
- d.current !== e && (d.current = e, s(!1));
984
+ d.current !== e && (d.current = e, c(!1));
985
985
  }, [e]), !e) return null;
986
986
  const u = {
987
987
  position: "absolute",
@@ -1006,7 +1006,7 @@ const Kn = ({
1006
1006
  style: u,
1007
1007
  loading: "eager",
1008
1008
  fetchPriority: "high",
1009
- onLoad: () => s(!0)
1009
+ onLoad: () => c(!0)
1010
1010
  }
1011
1011
  )
1012
1012
  );
@@ -1017,21 +1017,21 @@ const Kn = ({
1017
1017
  avatarImageUrl: i,
1018
1018
  idleLoopUrl: o,
1019
1019
  greeting: l,
1020
- branding: s,
1020
+ branding: c,
1021
1021
  teamMembers: d,
1022
1022
  currentTeamMemberId: u,
1023
- isSwitchingTeamMember: p,
1023
+ isSwitchingTeamMember: h,
1024
1024
  teamSwitcherOpen: m,
1025
1025
  onToggleTeamSwitcher: a,
1026
- onSelectTeamMember: c,
1026
+ onSelectTeamMember: s,
1027
1027
  languageMenuOpen: R,
1028
1028
  onToggleLanguageMenu: q,
1029
- connectionState: w,
1030
- agentState: _,
1029
+ connectionState: _,
1030
+ agentState: w,
1031
1031
  transcript: y,
1032
- canResume: z,
1032
+ canResume: H,
1033
1033
  needsUserGesture: M,
1034
- error: H,
1034
+ error: z,
1035
1035
  isMuted: v,
1036
1036
  micError: S,
1037
1037
  micDevices: B,
@@ -1039,95 +1039,101 @@ const Kn = ({
1039
1039
  cameraPreviewEl: A,
1040
1040
  cameraDevices: T,
1041
1041
  activeCameraId: W,
1042
- isScreenShareEnabled: V,
1042
+ isScreenShareEnabled: G,
1043
1043
  screenPreviewEl: re,
1044
1044
  isSpeakerMuted: te,
1045
- allowCamera: be,
1046
- allowScreenShare: se,
1047
- allowTyping: he,
1045
+ allowCamera: xe,
1046
+ allowScreenShare: ce,
1047
+ allowTyping: ge,
1048
1048
  avatarVideoContainerRef: de,
1049
1049
  agentVideoEl: K,
1050
1050
  onConnect: ue,
1051
- onDisconnect: ke,
1052
- onRetry: Le,
1053
- onResumeAudio: Se,
1054
- onToggleMute: Ce,
1055
- onToggleCamera: Ee,
1056
- onSwitchCameraDevice: Ne,
1057
- onToggleScreenShare: Ae,
1058
- onToggleSpeaker: j,
1059
- onSendMessage: Xe,
1060
- onMinimize: Je,
1061
- onClose: Ke,
1062
- onClearMicError: Qe
1051
+ onDisconnect: Le,
1052
+ onRetry: Se,
1053
+ onResumeAudio: Ce,
1054
+ onToggleMute: Ee,
1055
+ onToggleCamera: Ne,
1056
+ onSwitchCameraDevice: Ae,
1057
+ onToggleScreenShare: Re,
1058
+ onToggleSpeaker: V,
1059
+ onSendMessage: Ve,
1060
+ onMinimize: Ye,
1061
+ onClose: Ge,
1062
+ onClearMicError: Xe
1063
1063
  }) => {
1064
- var $e;
1065
- const Q = y.length > 0 ? y[y.length - 1] : null, fe = ((d == null ? void 0 : d.length) ?? 0) > 1, Re = w === "connecting" || w === "connected", ie = w === "connected", we = w === "idle" || w === "disconnected" || w === "error", [Y, _e] = C(!1);
1064
+ var et;
1065
+ const fe = ((d == null ? void 0 : d.length) ?? 0) > 1, ye = _ === "connecting" || _ === "connected", ie = _ === "connected", ct = _ === "idle" || _ === "disconnected" || _ === "error", [pe, Y] = C(!1);
1066
1066
  N(() => {
1067
1067
  if (!K) {
1068
- _e(!1);
1068
+ Y(!1);
1069
1069
  return;
1070
1070
  }
1071
1071
  if (!K.paused && K.readyState >= 2) {
1072
- _e(!0);
1072
+ Y(!0);
1073
1073
  return;
1074
1074
  }
1075
- _e(!1);
1076
- const h = () => _e(!0);
1077
- return K.addEventListener("playing", h), K.addEventListener("loadeddata", h), () => {
1078
- K.removeEventListener("playing", h), K.removeEventListener("loadeddata", h);
1075
+ Y(!1);
1076
+ const f = () => Y(!0);
1077
+ return K.addEventListener("playing", f), K.addEventListener("loadeddata", f), () => {
1078
+ K.removeEventListener("playing", f), K.removeEventListener("loadeddata", f);
1079
1079
  };
1080
1080
  }, [K]);
1081
- const [xe, le] = C(!1);
1081
+ const [Je, ve] = C(!1);
1082
1082
  N(() => {
1083
1083
  if (!ie) {
1084
- le(!1);
1084
+ ve(!1);
1085
1085
  return;
1086
1086
  }
1087
- if (Y) return;
1088
- const h = setTimeout(() => le(!0), 8e3);
1089
- return () => clearTimeout(h);
1090
- }, [ie, Y]);
1091
- const Ie = w === "connecting" || ie && !!i && !Y && !xe, Me = E(null), oe = E(null);
1087
+ if (pe) return;
1088
+ const f = setTimeout(() => ve(!0), 8e3);
1089
+ return () => clearTimeout(f);
1090
+ }, [ie, pe]);
1091
+ const he = _ === "connecting" || ie && !!i && !pe && !Je, ke = E(null), Ie = E(null);
1092
1092
  N(() => {
1093
- const h = Me.current;
1094
- h && (h.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", h.appendChild(A)));
1093
+ const f = ke.current;
1094
+ f && (f.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", f.appendChild(A)));
1095
1095
  }, [A]), N(() => {
1096
- const h = oe.current;
1097
- h && (h.innerHTML = "", re && (re.style.width = "100%", re.style.height = "100%", re.style.objectFit = "contain", h.appendChild(re)));
1096
+ const f = Ie.current;
1097
+ f && (f.innerHTML = "", re && (re.style.width = "100%", re.style.height = "100%", re.style.objectFit = "contain", f.appendChild(re)));
1098
1098
  }, [re]);
1099
- const [ne, ae] = C(!1), [me, Te] = C(!1);
1099
+ const [Z, ne] = C(!1), [oe, be] = C(!1);
1100
1100
  N(() => {
1101
- if (!ne && !me && !R && !m) return;
1102
- const h = () => {
1103
- ae(!1), Te(!1), R && q(), m && a();
1101
+ if (!Z && !oe && !R && !m) return;
1102
+ const f = () => {
1103
+ ne(!1), be(!1), R && q(), m && a();
1104
1104
  };
1105
- return document.addEventListener("click", h), () => document.removeEventListener("click", h);
1105
+ return document.addEventListener("click", f), () => document.removeEventListener("click", f);
1106
1106
  }, [
1107
- ne,
1108
- me,
1107
+ Z,
1108
+ oe,
1109
1109
  R,
1110
1110
  m,
1111
1111
  q,
1112
1112
  a
1113
1113
  ]);
1114
- const [ge, Pe] = C(""), Ze = k(
1115
- (h) => {
1116
- h.preventDefault();
1117
- const G = ge.trim();
1118
- G && (Xe(G), Pe(""));
1114
+ const [Me, Te] = C(""), Oe = k(
1115
+ (f) => {
1116
+ f.preventDefault();
1117
+ const U = Me.trim();
1118
+ U && (Ve(U), Te(""));
1119
1119
  },
1120
- [ge, Xe]
1121
- ), We = s.productName || "Live Layer", De = ie && (Q != null && Q.text) ? Q.text : l || "", at = ie && (Q == null ? void 0 : Q.role) === "agent", ct = [
1120
+ [Me, Ve]
1121
+ ), Ke = c.productName || "Live Layer";
1122
+ let le = null, ae = null;
1123
+ for (let f = y.length - 1; f >= 0; f--) {
1124
+ const U = y[f];
1125
+ if (!le && U.role === "agent" ? le = U : !ae && U.role === "user" && (ae = U), le && ae) break;
1126
+ }
1127
+ const Qe = ie ? (le == null ? void 0 : le.text) || null : l || null, Ze = ie && (ae == null ? void 0 : ae.text) || null, qe = [
1122
1128
  "ll-expanded",
1123
1129
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1124
1130
  ].join(" ");
1125
1131
  return /* @__PURE__ */ x(
1126
1132
  "div",
1127
1133
  {
1128
- className: ct,
1134
+ className: qe,
1129
1135
  "data-position": e,
1130
- "data-state": ie ? "connected" : Re ? "connecting" : "idle",
1136
+ "data-state": ie ? "connected" : ye ? "connecting" : "idle",
1131
1137
  role: "dialog",
1132
1138
  "aria-label": `${r} widget`,
1133
1139
  children: [
@@ -1139,7 +1145,7 @@ const Kn = ({
1139
1145
  alt: r,
1140
1146
  className: "ll-expanded__bg-img"
1141
1147
  }
1142
- ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: (($e = r == null ? void 0 : r.charAt(0)) == null ? void 0 : $e.toUpperCase()) || "A" }) }),
1148
+ ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((et = r == null ? void 0 : r.charAt(0)) == null ? void 0 : et.toUpperCase()) || "A" }) }),
1143
1149
  o && !ie && /* @__PURE__ */ n(
1144
1150
  "video",
1145
1151
  {
@@ -1153,23 +1159,23 @@ const Kn = ({
1153
1159
  )
1154
1160
  ] }),
1155
1161
  /* @__PURE__ */ n("div", { ref: de, className: "ll-expanded__video" }),
1156
- Ie && /* @__PURE__ */ x("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1162
+ he && /* @__PURE__ */ x("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1157
1163
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1158
- /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: p ? "Switching..." : "Connecting..." })
1164
+ /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: h ? "Switching..." : "Connecting..." })
1159
1165
  ] }),
1160
1166
  M && ie && /* @__PURE__ */ x(
1161
1167
  "button",
1162
1168
  {
1163
1169
  type: "button",
1164
1170
  className: "ll-expanded__overlay ll-expanded__overlay--gesture",
1165
- onClick: Se,
1171
+ onClick: Ce,
1166
1172
  children: [
1167
1173
  /* @__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" }) }),
1168
1174
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
1169
1175
  ]
1170
1176
  }
1171
1177
  ),
1172
- Re ? /* @__PURE__ */ x("div", { className: "ll-expanded__topbar", children: [
1178
+ ye ? /* @__PURE__ */ x("div", { className: "ll-expanded__topbar", children: [
1173
1179
  /* @__PURE__ */ x("div", { className: "ll-expanded__topbar-left", children: [
1174
1180
  /* @__PURE__ */ x("div", { className: "ll-expanded__pill-wrap", children: [
1175
1181
  /* @__PURE__ */ x(
@@ -1177,14 +1183,14 @@ const Kn = ({
1177
1183
  {
1178
1184
  type: "button",
1179
1185
  className: "ll-hpill",
1180
- onClick: (h) => {
1181
- fe && (h.stopPropagation(), a());
1186
+ onClick: (f) => {
1187
+ fe && (f.stopPropagation(), a());
1182
1188
  },
1183
1189
  "aria-haspopup": fe ? "listbox" : void 0,
1184
1190
  "aria-expanded": fe ? m : void 0,
1185
1191
  children: [
1186
1192
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1187
- fe && /* @__PURE__ */ n(rt, {})
1193
+ fe && /* @__PURE__ */ n(ot, {})
1188
1194
  ]
1189
1195
  }
1190
1196
  ),
@@ -1192,30 +1198,30 @@ const Kn = ({
1192
1198
  "div",
1193
1199
  {
1194
1200
  className: "ll-hmenu",
1195
- onClick: (h) => h.stopPropagation(),
1201
+ onClick: (f) => f.stopPropagation(),
1196
1202
  role: "listbox",
1197
- children: d == null ? void 0 : d.map((h) => /* @__PURE__ */ x(
1203
+ children: d == null ? void 0 : d.map((f) => /* @__PURE__ */ x(
1198
1204
  "button",
1199
1205
  {
1200
1206
  type: "button",
1201
- className: `ll-hmenu__item ${h.id === u ? "is-active" : ""}`,
1202
- onClick: () => c(h.id),
1207
+ className: `ll-hmenu__item ${f.id === u ? "is-active" : ""}`,
1208
+ onClick: () => s(f.id),
1203
1209
  role: "option",
1204
- "aria-selected": h.id === u,
1210
+ "aria-selected": f.id === u,
1205
1211
  children: [
1206
- h.avatarImageUrl && /* @__PURE__ */ n(
1212
+ f.avatarImageUrl && /* @__PURE__ */ n(
1207
1213
  "img",
1208
1214
  {
1209
- src: h.avatarImageUrl,
1215
+ src: f.avatarImageUrl,
1210
1216
  alt: "",
1211
1217
  className: "ll-hmenu__avatar"
1212
1218
  }
1213
1219
  ),
1214
- /* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: h.name }),
1215
- h.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: h.role })
1220
+ /* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: f.name }),
1221
+ f.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: f.role })
1216
1222
  ]
1217
1223
  },
1218
- h.id
1224
+ f.id
1219
1225
  ))
1220
1226
  }
1221
1227
  )
@@ -1226,8 +1232,8 @@ const Kn = ({
1226
1232
  {
1227
1233
  type: "button",
1228
1234
  className: "ll-hpill ll-hpill--compact",
1229
- onClick: (h) => {
1230
- h.stopPropagation(), q();
1235
+ onClick: (f) => {
1236
+ f.stopPropagation(), q();
1231
1237
  },
1232
1238
  "aria-haspopup": "listbox",
1233
1239
  "aria-expanded": R,
@@ -1235,7 +1241,7 @@ const Kn = ({
1235
1241
  title: "Language: English",
1236
1242
  children: [
1237
1243
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
1238
- /* @__PURE__ */ n(rt, {})
1244
+ /* @__PURE__ */ n(ot, {})
1239
1245
  ]
1240
1246
  }
1241
1247
  ),
@@ -1243,7 +1249,7 @@ const Kn = ({
1243
1249
  "div",
1244
1250
  {
1245
1251
  className: "ll-hmenu",
1246
- onClick: (h) => h.stopPropagation(),
1252
+ onClick: (f) => f.stopPropagation(),
1247
1253
  role: "listbox",
1248
1254
  children: /* @__PURE__ */ n(
1249
1255
  "button",
@@ -1261,8 +1267,8 @@ const Kn = ({
1261
1267
  /* @__PURE__ */ n(
1262
1268
  "span",
1263
1269
  {
1264
- className: `ll-expanded__state ll-expanded__state--${_}`,
1265
- children: _
1270
+ className: `ll-expanded__state ll-expanded__state--${w}`,
1271
+ children: w
1266
1272
  }
1267
1273
  )
1268
1274
  ] }),
@@ -1272,7 +1278,7 @@ const Kn = ({
1272
1278
  {
1273
1279
  type: "button",
1274
1280
  className: "ll-hbtn",
1275
- onClick: Je,
1281
+ onClick: Ye,
1276
1282
  "aria-label": "Minimize widget",
1277
1283
  title: "Minimize",
1278
1284
  children: /* @__PURE__ */ n(Ut, {})
@@ -1283,7 +1289,7 @@ const Kn = ({
1283
1289
  {
1284
1290
  type: "button",
1285
1291
  className: "ll-hbtn ll-hbtn--danger",
1286
- onClick: Ke,
1292
+ onClick: Ge,
1287
1293
  "aria-label": "End call",
1288
1294
  title: "End call",
1289
1295
  children: /* @__PURE__ */ n(Ft, {})
@@ -1293,14 +1299,14 @@ const Kn = ({
1293
1299
  ] }) : (
1294
1300
  // Idle-state header with Live Layer product name + minimize/close
1295
1301
  /* @__PURE__ */ x("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1296
- /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: We }),
1302
+ /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ke }),
1297
1303
  /* @__PURE__ */ x("div", { className: "ll-expanded__header-actions", children: [
1298
1304
  /* @__PURE__ */ n(
1299
1305
  "button",
1300
1306
  {
1301
1307
  type: "button",
1302
1308
  className: "ll-hbtn ll-hbtn--ghost",
1303
- onClick: Je,
1309
+ onClick: Ye,
1304
1310
  "aria-label": "Minimize widget",
1305
1311
  children: /* @__PURE__ */ n(Ut, {})
1306
1312
  }
@@ -1310,7 +1316,7 @@ const Kn = ({
1310
1316
  {
1311
1317
  type: "button",
1312
1318
  className: "ll-hbtn ll-hbtn--danger",
1313
- onClick: Ke,
1319
+ onClick: Ge,
1314
1320
  "aria-label": "Close widget",
1315
1321
  children: /* @__PURE__ */ n(Ft, {})
1316
1322
  }
@@ -1318,33 +1324,33 @@ const Kn = ({
1318
1324
  ] })
1319
1325
  ] })
1320
1326
  ),
1321
- we && /* @__PURE__ */ (() => {
1322
- const h = z ? "Restart paused session" : w === "disconnected" ? "Reconnect to agent" : "Start video call", G = z ? "Pick up where you left off" : null;
1327
+ ct && /* @__PURE__ */ (() => {
1328
+ const f = H ? "Restart paused session" : _ === "disconnected" ? "Reconnect to agent" : "Start video call", U = H ? "Pick up where you left off" : null;
1323
1329
  return /* @__PURE__ */ x(yt, { children: [
1324
- w === "idle" && !z && !H && /* @__PURE__ */ x(
1330
+ !z && /* @__PURE__ */ x(
1325
1331
  "button",
1326
1332
  {
1327
1333
  type: "button",
1328
1334
  className: "ll-expanded__play",
1329
1335
  onClick: ue,
1330
- "aria-label": h,
1336
+ "aria-label": f,
1331
1337
  children: [
1332
1338
  /* @__PURE__ */ n("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ n("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
1333
- /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: h })
1339
+ /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: f })
1334
1340
  ]
1335
1341
  }
1336
1342
  ),
1337
1343
  /* @__PURE__ */ x("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1338
1344
  l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
1339
- G && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: G }),
1345
+ U && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: U }),
1340
1346
  /* @__PURE__ */ n(
1341
1347
  "button",
1342
1348
  {
1343
1349
  type: "button",
1344
1350
  className: "ll-expanded__cta",
1345
1351
  onClick: ue,
1346
- "aria-label": h,
1347
- children: h
1352
+ "aria-label": f,
1353
+ children: f
1348
1354
  }
1349
1355
  )
1350
1356
  ] })
@@ -1353,53 +1359,61 @@ const Kn = ({
1353
1359
  /* @__PURE__ */ x(
1354
1360
  "div",
1355
1361
  {
1356
- className: `ll-expanded__pip ${Re && (D || V) ? "is-visible" : ""}`,
1362
+ className: `ll-expanded__pip ${ye && (D || G) ? "is-visible" : ""}`,
1357
1363
  children: [
1358
1364
  /* @__PURE__ */ n(
1359
1365
  "div",
1360
1366
  {
1361
- ref: oe,
1362
- className: V ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1367
+ ref: Ie,
1368
+ className: G ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1363
1369
  }
1364
1370
  ),
1365
1371
  /* @__PURE__ */ n(
1366
1372
  "div",
1367
1373
  {
1368
- ref: Me,
1369
- className: !V && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1374
+ ref: ke,
1375
+ className: !G && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1370
1376
  }
1371
1377
  )
1372
1378
  ]
1373
1379
  }
1374
1380
  ),
1375
- Re ? /* @__PURE__ */ x("div", { className: "ll-expanded__bottom", children: [
1376
- De && /* @__PURE__ */ n(
1381
+ ye ? /* @__PURE__ */ x("div", { className: "ll-expanded__bottom", children: [
1382
+ Qe && /* @__PURE__ */ n(
1383
+ "div",
1384
+ {
1385
+ className: "ll-expanded__transcript ll-expanded__transcript--agent",
1386
+ "data-role": "agent",
1387
+ children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Qe })
1388
+ }
1389
+ ),
1390
+ Ze && /* @__PURE__ */ n(
1377
1391
  "div",
1378
1392
  {
1379
- className: `ll-expanded__transcript${at ? " ll-expanded__transcript--agent" : ""}`,
1380
- "data-role": ie ? (Q == null ? void 0 : Q.role) ?? "agent" : "agent",
1381
- children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: De })
1393
+ className: "ll-expanded__transcript ll-expanded__transcript--user",
1394
+ "data-role": "user",
1395
+ children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ze })
1382
1396
  }
1383
1397
  ),
1384
- /* @__PURE__ */ x("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
1385
- se && /* @__PURE__ */ n(
1398
+ /* @__PURE__ */ x("div", { className: "ll-toolbar", onClick: (f) => f.stopPropagation(), children: [
1399
+ ce && /* @__PURE__ */ n(
1386
1400
  "button",
1387
1401
  {
1388
1402
  type: "button",
1389
- className: `ll-tool ${V ? "is-on" : ""}`,
1390
- onClick: Ae,
1391
- "aria-label": V ? "Stop sharing screen" : "Share screen",
1392
- title: V ? "Stop sharing" : "Share screen",
1403
+ className: `ll-tool ${G ? "is-on" : ""}`,
1404
+ onClick: Re,
1405
+ "aria-label": G ? "Stop sharing screen" : "Share screen",
1406
+ title: G ? "Stop sharing" : "Share screen",
1393
1407
  children: /* @__PURE__ */ n(nr, {})
1394
1408
  }
1395
1409
  ),
1396
- be && /* @__PURE__ */ x("div", { className: "ll-tool-split", children: [
1410
+ xe && /* @__PURE__ */ x("div", { className: "ll-tool-split", children: [
1397
1411
  /* @__PURE__ */ n(
1398
1412
  "button",
1399
1413
  {
1400
1414
  type: "button",
1401
1415
  className: `ll-tool ll-tool--left ${D ? "is-on" : ""}`,
1402
- onClick: Ee,
1416
+ onClick: Ne,
1403
1417
  "aria-label": D ? "Turn off camera" : "Turn on camera",
1404
1418
  title: D ? "Stop camera" : "Start camera",
1405
1419
  children: /* @__PURE__ */ n(rr, {})
@@ -1410,23 +1424,23 @@ const Kn = ({
1410
1424
  {
1411
1425
  type: "button",
1412
1426
  className: `ll-tool ll-tool--right ${D ? "is-on" : ""}`,
1413
- onClick: (h) => {
1414
- h.stopPropagation(), Te((G) => !G), ae(!1);
1427
+ onClick: (f) => {
1428
+ f.stopPropagation(), be((U) => !U), ne(!1);
1415
1429
  },
1416
1430
  "aria-label": "Camera devices",
1417
1431
  "aria-haspopup": "listbox",
1418
- "aria-expanded": me,
1419
- children: /* @__PURE__ */ n(rt, {})
1432
+ "aria-expanded": oe,
1433
+ children: /* @__PURE__ */ n(ot, {})
1420
1434
  }
1421
1435
  ),
1422
- me && T.length > 0 && /* @__PURE__ */ n(
1436
+ oe && T.length > 0 && /* @__PURE__ */ n(
1423
1437
  jt,
1424
1438
  {
1425
1439
  label: "Camera",
1426
1440
  devices: T,
1427
1441
  activeId: W,
1428
- onPick: (h) => {
1429
- Te(!1), Ne(h);
1442
+ onPick: (f) => {
1443
+ be(!1), Ae(f);
1430
1444
  }
1431
1445
  }
1432
1446
  )
@@ -1437,7 +1451,7 @@ const Kn = ({
1437
1451
  {
1438
1452
  type: "button",
1439
1453
  className: `ll-tool ll-tool--left ${v ? "is-muted" : ""}`,
1440
- onClick: Ce,
1454
+ onClick: Ee,
1441
1455
  "aria-label": v ? "Unmute microphone" : "Mute microphone",
1442
1456
  title: v ? "Unmute" : "Mute",
1443
1457
  children: /* @__PURE__ */ n(ir, { muted: v })
@@ -1448,22 +1462,22 @@ const Kn = ({
1448
1462
  {
1449
1463
  type: "button",
1450
1464
  className: `ll-tool ll-tool--right ${v ? "is-muted" : ""}`,
1451
- onClick: (h) => {
1452
- h.stopPropagation(), ae((G) => !G), Te(!1);
1465
+ onClick: (f) => {
1466
+ f.stopPropagation(), ne((U) => !U), be(!1);
1453
1467
  },
1454
1468
  "aria-label": "Microphone devices",
1455
1469
  "aria-haspopup": "listbox",
1456
- "aria-expanded": ne,
1457
- children: /* @__PURE__ */ n(rt, {})
1470
+ "aria-expanded": Z,
1471
+ children: /* @__PURE__ */ n(ot, {})
1458
1472
  }
1459
1473
  ),
1460
- ne && B.length > 0 && /* @__PURE__ */ n(
1474
+ Z && B.length > 0 && /* @__PURE__ */ n(
1461
1475
  jt,
1462
1476
  {
1463
1477
  label: "Microphone",
1464
1478
  devices: B,
1465
1479
  activeId: "",
1466
- onPick: () => ae(!1)
1480
+ onPick: () => ne(!1)
1467
1481
  }
1468
1482
  )
1469
1483
  ] }),
@@ -1472,7 +1486,7 @@ const Kn = ({
1472
1486
  {
1473
1487
  type: "button",
1474
1488
  className: `ll-tool ${te ? "is-muted" : ""}`,
1475
- onClick: j,
1489
+ onClick: V,
1476
1490
  "aria-label": te ? "Unmute speaker" : "Mute speaker",
1477
1491
  title: te ? "Unmute speaker" : "Mute speaker",
1478
1492
  children: /* @__PURE__ */ n(or, { muted: te })
@@ -1483,26 +1497,26 @@ const Kn = ({
1483
1497
  {
1484
1498
  type: "button",
1485
1499
  className: "ll-tool ll-tool--danger",
1486
- onClick: ke,
1500
+ onClick: Le,
1487
1501
  "aria-label": "End conversation",
1488
1502
  title: "End conversation",
1489
1503
  children: /* @__PURE__ */ n(ar, {})
1490
1504
  }
1491
1505
  )
1492
1506
  ] }),
1493
- he && /* @__PURE__ */ x("form", { className: "ll-message-input", onSubmit: Ze, children: [
1507
+ ge && /* @__PURE__ */ x("form", { className: "ll-message-input", onSubmit: Oe, children: [
1494
1508
  /* @__PURE__ */ n(
1495
1509
  "input",
1496
1510
  {
1497
1511
  type: "text",
1498
1512
  className: "ll-message-input__field",
1499
1513
  placeholder: "Message...",
1500
- value: ge,
1501
- onChange: (h) => Pe(h.target.value),
1514
+ value: Me,
1515
+ onChange: (f) => Te(f.target.value),
1502
1516
  "aria-label": "Message the agent"
1503
1517
  }
1504
1518
  ),
1505
- ge.trim() && /* @__PURE__ */ n(
1519
+ Me.trim() && /* @__PURE__ */ n(
1506
1520
  "button",
1507
1521
  {
1508
1522
  type: "submit",
@@ -1514,7 +1528,7 @@ const Kn = ({
1514
1528
  ] })
1515
1529
  ] }) : null,
1516
1530
  (() => {
1517
- if (S && w !== "error")
1531
+ if (S && _ !== "error")
1518
1532
  return /* @__PURE__ */ x("div", { className: "ll-expanded__banner", role: "alert", children: [
1519
1533
  /* @__PURE__ */ n("span", { children: S }),
1520
1534
  /* @__PURE__ */ n(
@@ -1522,23 +1536,23 @@ const Kn = ({
1522
1536
  {
1523
1537
  type: "button",
1524
1538
  className: "ll-expanded__banner-x",
1525
- onClick: Qe,
1539
+ onClick: Xe,
1526
1540
  "aria-label": "Dismiss",
1527
1541
  children: "×"
1528
1542
  }
1529
1543
  )
1530
1544
  ] });
1531
- if (!H || w !== "error") return null;
1532
- let h = "Failed to connect", G = "Try again";
1533
- return H === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : H === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : H === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : H === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : H === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : H.length < 80 && (h = H), /* @__PURE__ */ x("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1534
- /* @__PURE__ */ n("span", { children: h }),
1545
+ if (!z || _ !== "error") return null;
1546
+ let f = "Failed to connect", U = "Try again";
1547
+ return z === "MIC_PERMISSION_DENIED" ? f = "Microphone blocked. Allow access to talk." : z === "MIC_NOT_FOUND" ? f = "No microphone found. Plug one in + retry." : z === "MIC_UNAVAILABLE" ? f = "Mic unavailable. Check other apps using it." : z === "AGENT_TIMEOUT" ? f = "Agent didn't pick up. Try again." : z === "CONNECT_FAILED" ? f = "Connection failed. Check your network." : z.length < 80 && (f = z), /* @__PURE__ */ x("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1548
+ /* @__PURE__ */ n("span", { children: f }),
1535
1549
  /* @__PURE__ */ n(
1536
1550
  "button",
1537
1551
  {
1538
1552
  type: "button",
1539
1553
  className: "ll-expanded__banner-retry",
1540
- onClick: Le,
1541
- children: G
1554
+ onClick: Se,
1555
+ children: U
1542
1556
  }
1543
1557
  )
1544
1558
  ] });
@@ -1547,7 +1561,7 @@ const Kn = ({
1547
1561
  }
1548
1562
  );
1549
1563
  };
1550
- function rt() {
1564
+ function ot() {
1551
1565
  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" }) });
1552
1566
  }
1553
1567
  function Ft() {
@@ -1613,17 +1627,17 @@ const jt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
1613
1627
  children: [
1614
1628
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1615
1629
  t.map((o, l) => {
1616
- const s = r === o.deviceId;
1630
+ const c = r === o.deviceId;
1617
1631
  return /* @__PURE__ */ x(
1618
1632
  "button",
1619
1633
  {
1620
1634
  type: "button",
1621
- className: `ll-device-menu__item ${s ? "is-active" : ""}`,
1635
+ className: `ll-device-menu__item ${c ? "is-active" : ""}`,
1622
1636
  onClick: () => i(o.deviceId),
1623
1637
  role: "option",
1624
- "aria-selected": s,
1638
+ "aria-selected": c,
1625
1639
  children: [
1626
- s && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1640
+ c && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1627
1641
  /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
1628
1642
  ]
1629
1643
  },
@@ -1632,20 +1646,20 @@ const jt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
1632
1646
  })
1633
1647
  ]
1634
1648
  }
1635
- ), cr = [
1649
+ ), sr = [
1636
1650
  '[data-ll-private="true"]',
1637
1651
  ".ll-widget"
1638
1652
  ];
1639
1653
  function bt(e) {
1640
1654
  let t = e;
1641
1655
  for (; t; ) {
1642
- for (const r of cr)
1656
+ for (const r of sr)
1643
1657
  if (t.matches(r)) return !0;
1644
1658
  t = t.parentElement;
1645
1659
  }
1646
1660
  return !1;
1647
1661
  }
1648
- function lt(e) {
1662
+ function st(e) {
1649
1663
  if (bt(e)) return !1;
1650
1664
  if (e instanceof HTMLInputElement) {
1651
1665
  if (e.type === "password") return !1;
@@ -1654,7 +1668,7 @@ function lt(e) {
1654
1668
  }
1655
1669
  return !0;
1656
1670
  }
1657
- const it = 4096, sr = 20, dr = 20, ur = 10, fr = 10, pr = 30, hr = 20, Vt = 500, mr = [
1671
+ const lt = 4096, cr = 20, dr = 20, ur = 10, fr = 10, pr = 30, hr = 20, Vt = 500, mr = [
1658
1672
  '[data-ll-private="true"]',
1659
1673
  ".ll-widget",
1660
1674
  "script",
@@ -1662,7 +1676,7 @@ const it = 4096, sr = 20, dr = 20, ur = 10, fr = 10, pr = 30, hr = 20, Vt = 500,
1662
1676
  "noscript",
1663
1677
  "iframe"
1664
1678
  ];
1665
- function Ye(e) {
1679
+ function Ue(e) {
1666
1680
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
1667
1681
  let t = e;
1668
1682
  for (; t; ) {
@@ -1672,7 +1686,7 @@ function Ye(e) {
1672
1686
  }
1673
1687
  return !1;
1674
1688
  }
1675
- function Ge(e) {
1689
+ function je(e) {
1676
1690
  if (typeof window > "u") return !0;
1677
1691
  const t = e.getBoundingClientRect();
1678
1692
  if (t.width <= 0 || t.height <= 0) return !1;
@@ -1692,10 +1706,10 @@ function Yt(e) {
1692
1706
  const o = e.closest("label");
1693
1707
  return o != null && o.textContent ? o.textContent.trim() : "";
1694
1708
  }
1695
- function pe(e, t) {
1709
+ function me(e, t) {
1696
1710
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
1697
1711
  }
1698
- function He(e) {
1712
+ function De(e) {
1699
1713
  return e.length;
1700
1714
  }
1701
1715
  function gr(e, t = {}) {
@@ -1712,56 +1726,56 @@ function gr(e, t = {}) {
1712
1726
  forms: [],
1713
1727
  extras: e
1714
1728
  };
1715
- const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
1729
+ const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
1716
1730
  r.querySelectorAll("[data-ll-region]")
1717
1731
  ), d = [];
1718
- for (const v of s) {
1732
+ for (const v of c) {
1719
1733
  if (d.length >= ur) break;
1720
- if (Ye(v) || !Ge(v)) continue;
1721
- const S = v.getAttribute("data-ll-region") ?? "", B = v.getAttribute("data-ll-intent") ?? void 0, D = pe(
1734
+ if (Ue(v) || !je(v)) continue;
1735
+ const S = v.getAttribute("data-ll-region") ?? "", B = v.getAttribute("data-ll-intent") ?? void 0, D = me(
1722
1736
  (v.innerText || v.textContent || "").trim(),
1723
1737
  Vt * 2
1724
1738
  );
1725
1739
  !S || !D || d.push({ id: S, intent: B, text: D });
1726
1740
  }
1727
- const u = [], p = ["H1", "H2", "H3", "H4", "H5", "H6"], m = Array.from(
1741
+ const u = [], h = ["H1", "H2", "H3", "H4", "H5", "H6"], m = Array.from(
1728
1742
  r.querySelectorAll("h1, h2, h3, h4, h5, h6")
1729
1743
  );
1730
1744
  for (const v of m) {
1731
- if (Ye(v) || !Ge(v)) continue;
1745
+ if (Ue(v) || !je(v)) continue;
1732
1746
  const S = (v.textContent || "").trim();
1733
- S && u.push(`${v.tagName}: ${pe(S, 200)}`);
1747
+ S && u.push(`${v.tagName}: ${me(S, 200)}`);
1734
1748
  }
1735
1749
  const a = Array.from(r.querySelectorAll("p, li"));
1736
1750
  for (const v of a) {
1737
- if (Ye(v) || !Ge(v) || p.includes(v.tagName)) continue;
1751
+ if (Ue(v) || !je(v) || h.includes(v.tagName)) continue;
1738
1752
  const S = (v.textContent || "").trim();
1739
- S.length > 10 && u.push(pe(S, Vt));
1753
+ S.length > 10 && u.push(me(S, Vt));
1740
1754
  }
1741
- const c = u.join(`
1755
+ const s = u.join(`
1742
1756
  `), R = [], q = Array.from(r.querySelectorAll("a[href]"));
1743
1757
  for (const v of q) {
1744
- if (R.length >= sr) break;
1745
- if (Ye(v) || !Ge(v)) continue;
1758
+ if (R.length >= cr) break;
1759
+ if (Ue(v) || !je(v)) continue;
1746
1760
  const S = v.getAttribute("href") || "", B = (v.textContent || "").trim();
1747
- !S || !B || R.push({ href: S, text: pe(B, 100) });
1761
+ !S || !B || R.push({ href: S, text: me(B, 100) });
1748
1762
  }
1749
- const w = [], _ = Array.from(
1763
+ const _ = [], w = Array.from(
1750
1764
  r.querySelectorAll(
1751
1765
  "input, textarea, select"
1752
1766
  )
1753
1767
  );
1754
- for (const v of _) {
1755
- if (w.length >= dr) break;
1756
- if (Ye(v) || !lt(v) || !Ge(v)) continue;
1768
+ for (const v of w) {
1769
+ if (_.length >= dr) break;
1770
+ if (Ue(v) || !st(v) || !je(v)) continue;
1757
1771
  const S = Yt(v), B = v instanceof HTMLInputElement ? v.type : v.tagName.toLowerCase();
1758
- S && w.push({ label: pe(S, 100), type: B });
1772
+ S && _.push({ label: me(S, 100), type: B });
1759
1773
  }
1760
1774
  const y = Array.from(
1761
1775
  r.querySelectorAll("[data-ll-form]")
1762
- ), z = [];
1776
+ ), H = [];
1763
1777
  for (const v of y) {
1764
- if (z.length >= fr) break;
1778
+ if (H.length >= fr) break;
1765
1779
  if (bt(v)) continue;
1766
1780
  const S = v.getAttribute("data-ll-form") || "";
1767
1781
  if (!S) continue;
@@ -1772,57 +1786,57 @@ function gr(e, t = {}) {
1772
1786
  ), A = [];
1773
1787
  for (const T of D) {
1774
1788
  if (A.length >= pr) break;
1775
- if (!lt(T)) continue;
1789
+ if (!st(T)) continue;
1776
1790
  const W = T.getAttribute("data-ll-field") || "";
1777
1791
  if (!W) continue;
1778
- const V = Yt(T) || W, re = T instanceof HTMLInputElement ? T.type : T.tagName.toLowerCase(), te = {
1792
+ const G = Yt(T) || W, re = T instanceof HTMLInputElement ? T.type : T.tagName.toLowerCase(), te = {
1779
1793
  name: W,
1780
- label: pe(V, 100),
1794
+ label: me(G, 100),
1781
1795
  type: re
1782
1796
  };
1783
1797
  if (T.required === !0 && (te.required = !0), T instanceof HTMLSelectElement) {
1784
- const se = [];
1785
- for (let he = 0; he < T.options.length && !(se.length >= hr); he++) {
1786
- const de = T.options[he];
1798
+ const ce = [];
1799
+ for (let ge = 0; ge < T.options.length && !(ce.length >= hr); ge++) {
1800
+ const de = T.options[ge];
1787
1801
  if (!de || de.disabled) continue;
1788
1802
  const K = de.value || "", ue = (de.textContent || "").trim() || K;
1789
- !K && !ue || se.push({ value: K, label: pe(ue, 60) });
1803
+ !K && !ue || ce.push({ value: K, label: me(ue, 60) });
1790
1804
  }
1791
- se.length > 0 && (te.options = se);
1805
+ ce.length > 0 && (te.options = ce);
1792
1806
  }
1793
- const be = typeof T.validationMessage == "string" ? T.validationMessage : "";
1794
- be && (te.validationMessage = pe(be, 200)), A.push(te);
1807
+ const xe = typeof T.validationMessage == "string" ? T.validationMessage : "";
1808
+ xe && (te.validationMessage = me(xe, 200)), A.push(te);
1795
1809
  }
1796
- z.push({ id: S, intent: B, fields: A });
1810
+ H.push({ id: S, intent: B, fields: A });
1797
1811
  }
1798
1812
  const M = {
1799
1813
  url: i,
1800
1814
  title: l,
1801
1815
  pathname: o,
1802
1816
  regions: d,
1803
- visibleText: c,
1817
+ visibleText: s,
1804
1818
  visibleLinks: R,
1805
- visibleFields: w,
1806
- forms: z,
1819
+ visibleFields: _,
1820
+ forms: H,
1807
1821
  extras: e
1808
1822
  };
1809
- let H = He(JSON.stringify(M.regions)) + He(M.visibleText) + He(JSON.stringify(M.visibleLinks)) + He(JSON.stringify(M.visibleFields));
1810
- for (; H > it && M.visibleFields.length > 0; )
1811
- M.visibleFields.pop(), H = He(JSON.stringify(M.visibleFields));
1812
- for (; H > it && M.visibleLinks.length > 0; )
1813
- M.visibleLinks.pop(), H -= 80;
1814
- return He(M.visibleText) > it && (M.visibleText = pe(M.visibleText, it - 100)), M;
1815
- }
1816
- let Oe = null;
1823
+ let z = De(JSON.stringify(M.regions)) + De(M.visibleText) + De(JSON.stringify(M.visibleLinks)) + De(JSON.stringify(M.visibleFields));
1824
+ for (; z > lt && M.visibleFields.length > 0; )
1825
+ M.visibleFields.pop(), z = De(JSON.stringify(M.visibleFields));
1826
+ for (; z > lt && M.visibleLinks.length > 0; )
1827
+ M.visibleLinks.pop(), z -= 80;
1828
+ return De(M.visibleText) > lt && (M.visibleText = me(M.visibleText, lt - 100)), M;
1829
+ }
1830
+ let $e = null;
1817
1831
  function Gt(e, t = {}) {
1818
1832
  const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1819
- if (Oe && Oe.key === o && r - Oe.at < 1e3)
1820
- return Oe.ctx;
1833
+ if ($e && $e.key === o && r - $e.at < 1e3)
1834
+ return $e.ctx;
1821
1835
  const l = gr(e, t);
1822
- return Oe = { key: o, at: r, ctx: l }, l;
1836
+ return $e = { key: o, at: r, ctx: l }, l;
1823
1837
  }
1824
1838
  function yr() {
1825
- Oe = null;
1839
+ $e = null;
1826
1840
  }
1827
1841
  const vr = 200;
1828
1842
  function br(e) {
@@ -1842,38 +1856,38 @@ function _r(e) {
1842
1856
  const t = e ?? (typeof document < "u" ? document : null);
1843
1857
  if (!t) return [];
1844
1858
  const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
1845
- for (const s of l) {
1859
+ for (const c of l) {
1846
1860
  if (o.length >= vr) break;
1847
- if (bt(s)) continue;
1848
- const d = s.getAttribute("href") || "";
1861
+ if (bt(c)) continue;
1862
+ const d = c.getAttribute("href") || "";
1849
1863
  if (!wr(d)) continue;
1850
- let u = d, p = !0;
1864
+ let u = d, h = !0;
1851
1865
  try {
1852
1866
  if (typeof window < "u") {
1853
1867
  const a = new URL(d, r);
1854
- p = a.origin === r, p && d.startsWith("http") && (u = a.pathname + a.search + a.hash);
1868
+ h = a.origin === r, h && d.startsWith("http") && (u = a.pathname + a.search + a.hash);
1855
1869
  }
1856
1870
  } catch {
1857
1871
  continue;
1858
1872
  }
1859
1873
  if (i.has(u)) continue;
1860
1874
  i.add(u);
1861
- const m = (s.textContent || "").trim().slice(0, 120);
1862
- o.push({ href: u, text: m, internal: p });
1875
+ const m = (c.textContent || "").trim().slice(0, 120);
1876
+ o.push({ href: u, text: m, internal: h });
1863
1877
  }
1864
1878
  return o;
1865
1879
  }
1866
- let qe = null;
1880
+ let ze = null;
1867
1881
  const xr = 5e3;
1868
1882
  function mt() {
1869
1883
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
1870
- if (qe && qe.pathname === t && e - qe.at < xr)
1871
- return qe.routes;
1884
+ if (ze && ze.pathname === t && e - ze.at < xr)
1885
+ return ze.routes;
1872
1886
  const r = _r();
1873
- return qe = { at: e, pathname: t, routes: r }, r;
1887
+ return ze = { at: e, pathname: t, routes: r }, r;
1874
1888
  }
1875
1889
  function kr() {
1876
- qe = null;
1890
+ ze = null;
1877
1891
  }
1878
1892
  function Lr(e, t) {
1879
1893
  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;
@@ -1885,8 +1899,8 @@ function Sr(e, t, r = {}) {
1885
1899
  const l = Object.getOwnPropertyDescriptor(
1886
1900
  HTMLInputElement.prototype,
1887
1901
  "checked"
1888
- ), s = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
1889
- s ? s.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1902
+ ), c = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
1903
+ c ? c.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1890
1904
  return;
1891
1905
  }
1892
1906
  Lr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
@@ -1967,21 +1981,21 @@ function Mr(e) {
1967
1981
  baseUrl: i = "https://app.livelayer.studio",
1968
1982
  sessionEndpoint: o,
1969
1983
  sessionBody: l,
1970
- soundEffects: s,
1984
+ soundEffects: c,
1971
1985
  autoConnect: d = !1,
1972
1986
  displayMode: u,
1973
- defaultDisplayMode: p = "expanded",
1987
+ defaultDisplayMode: h = "expanded",
1974
1988
  onDisplayModeChange: m,
1975
1989
  position: a = "bottom-right",
1976
- mobileBreakpoint: c = 640,
1990
+ mobileBreakpoint: s = 640,
1977
1991
  persistKey: R = "ll-widget",
1978
1992
  disablePersistence: q = !1,
1979
- teamMembers: w,
1980
- currentTeamMemberId: _,
1993
+ teamMembers: _,
1994
+ currentTeamMemberId: w,
1981
1995
  onTeamMemberChange: y,
1982
- idleLoopUrl: z,
1996
+ idleLoopUrl: H,
1983
1997
  greeting: M,
1984
- avatarImageUrl: H,
1998
+ avatarImageUrl: z,
1985
1999
  agentName: v,
1986
2000
  branding: S = {},
1987
2001
  allowCamera: B = !0,
@@ -1989,75 +2003,75 @@ function Mr(e) {
1989
2003
  allowTyping: A = !0,
1990
2004
  showOn: T,
1991
2005
  hideOn: W,
1992
- pathname: V,
2006
+ pathname: G,
1993
2007
  onNavigate: re,
1994
2008
  onScrollToSelector: te,
1995
- getPageContext: be,
1996
- pageContextExtras: se,
1997
- getRoutes: he,
2009
+ getPageContext: xe,
2010
+ pageContextExtras: ce,
2011
+ getRoutes: ge,
1998
2012
  onScrollPage: de,
1999
2013
  onClick: K,
2000
2014
  capabilities: ue,
2001
- onConnect: ke,
2002
- onDisconnect: Le,
2003
- onTranscript: Se,
2004
- onAgentState: Ce,
2005
- onConnectionStateChange: Ee,
2006
- onAgentEvent: Ne,
2007
- onAgentCommand: Ae,
2008
- controlledSession: j,
2009
- className: Xe,
2010
- style: Je,
2011
- zIndex: Ke = 2147483647
2012
- } = e, Qe = $n(V), Q = Fn(Qe, T, W);
2015
+ onConnect: Le,
2016
+ onDisconnect: Se,
2017
+ onTranscript: Ce,
2018
+ onAgentState: Ee,
2019
+ onConnectionStateChange: Ne,
2020
+ onAgentEvent: Ae,
2021
+ onAgentCommand: Re,
2022
+ controlledSession: V,
2023
+ className: Ve,
2024
+ style: Ye,
2025
+ zIndex: Ge = 2147483647
2026
+ } = e, Xe = $n(G), fe = Fn(Xe, T, W);
2013
2027
  N(() => {
2014
2028
  yr(), kr();
2015
- }, [Qe]);
2016
- const fe = _ !== void 0, [Re, ie] = C(() => {
2029
+ }, [Xe]);
2030
+ const ye = w !== void 0, [ie, ct] = C(() => {
2017
2031
  var g;
2018
- return _ ?? ((g = w == null ? void 0 : w[0]) == null ? void 0 : g.id);
2019
- }), we = fe ? _ : Re, Y = Be(
2020
- () => (w == null ? void 0 : w.find((g) => g.id === we)) ?? null,
2021
- [w, we]
2022
- ), _e = (Y == null ? void 0 : Y.agentId) ?? t, [xe, le] = Mn({
2032
+ return w ?? ((g = _ == null ? void 0 : _[0]) == null ? void 0 : g.id);
2033
+ }), pe = ye ? w : ie, Y = He(
2034
+ () => (_ == null ? void 0 : _.find((g) => g.id === pe)) ?? null,
2035
+ [_, pe]
2036
+ ), Je = (Y == null ? void 0 : Y.agentId) ?? t, [ve, he] = Mn({
2023
2037
  value: u,
2024
- defaultValue: p,
2038
+ defaultValue: h,
2025
2039
  onChange: m,
2026
2040
  persistKey: R,
2027
2041
  disablePersistence: q
2028
- }), Ie = Pn(c), Me = wn(), oe = _n(), ne = kn(), ae = Ln(), me = Sn(), [Te, ge] = C(!1), [Pe, Ze] = C(!1), [We, De] = C(!1), [at, ct] = C(!1), [$e, h] = C(!1), G = jn({ baseUrl: i, config: s }), Fe = E(G);
2029
- Fe.current = G;
2030
- const st = E(re), dt = E(te), ut = E(de), ft = E(K), wt = E(be), _t = E(se), xt = E(he), pt = E(ue), ce = E(null);
2031
- st.current = re, dt.current = te, ut.current = de, ft.current = K, wt.current = be, _t.current = se, xt.current = he, pt.current = ue;
2032
- function ye(g) {
2033
- const f = pt.current;
2034
- return f ? f.includes(g) : !0;
2042
+ }), ke = Pn(s), Ie = wn(), Z = _n(), ne = kn(), oe = Ln(), be = Sn(), [Me, Te] = C(!1), [Oe, Ke] = C(!1), [le, ae] = C(!1), [Qe, Ze] = C(!1), [qe, et] = C(!1), f = jn({ baseUrl: i, config: c }), U = E(f);
2043
+ U.current = f;
2044
+ const tt = E(re), dt = E(te), ut = E(de), ft = E(K), wt = E(xe), _t = E(ce), xt = E(ge), pt = E(ue), se = E(null);
2045
+ tt.current = re, dt.current = te, ut.current = de, ft.current = K, wt.current = xe, _t.current = ce, xt.current = ge, pt.current = ue;
2046
+ function we(g) {
2047
+ const p = pt.current;
2048
+ return p ? p.includes(g) : !0;
2035
2049
  }
2036
- function ve(g, f) {
2050
+ function _e(g, p) {
2037
2051
  console.warn(
2038
- `[LiveLayer] Agent command "${g}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
2052
+ `[LiveLayer] Agent command "${g}" blocked — capability "${p}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
2039
2053
  );
2040
2054
  }
2041
- const Ue = k(
2055
+ const Be = k(
2042
2056
  (g) => {
2043
- var ee, tt, nt, Tt;
2044
- const f = g;
2045
- if (!(!f.type || typeof f.type != "string")) {
2046
- if (Ne == null || Ne({ eventName: f.type, data: g }), f.type === "navigate") {
2047
- if (!ye("navigate")) {
2048
- ve("navigate", "navigate");
2057
+ var ee, rt, it, Tt;
2058
+ const p = g;
2059
+ if (!(!p.type || typeof p.type != "string")) {
2060
+ if (Ae == null || Ae({ eventName: p.type, data: g }), p.type === "navigate") {
2061
+ if (!we("navigate")) {
2062
+ _e("navigate", "navigate");
2049
2063
  return;
2050
2064
  }
2051
- const L = typeof f.href == "string" ? f.href : null;
2065
+ const L = typeof p.href == "string" ? p.href : null;
2052
2066
  if (!L) {
2053
2067
  console.warn(
2054
2068
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
2055
2069
  );
2056
2070
  return;
2057
2071
  }
2058
- if (Fe.current.playPageChange(), st.current) {
2072
+ if (U.current.playPageChange(), tt.current) {
2059
2073
  try {
2060
- st.current(L);
2074
+ tt.current(L);
2061
2075
  } catch (I) {
2062
2076
  console.warn(
2063
2077
  `[LiveLayer] onNavigate threw for "${L}". Falling back. Error:`,
@@ -2086,14 +2100,14 @@ function Mr(e) {
2086
2100
  }
2087
2101
  return;
2088
2102
  }
2089
- if (f.type === "scroll_to") {
2090
- if (!ye("scroll")) {
2091
- ve("scroll_to", "scroll");
2103
+ if (p.type === "scroll_to") {
2104
+ if (!we("scroll")) {
2105
+ _e("scroll_to", "scroll");
2092
2106
  return;
2093
2107
  }
2094
- const L = typeof f.selector == "string" ? f.selector : null;
2108
+ const L = typeof p.selector == "string" ? p.selector : null;
2095
2109
  if (!L) return;
2096
- const I = f.behavior === "instant" ? "instant" : "smooth";
2110
+ const I = p.behavior === "instant" ? "instant" : "smooth";
2097
2111
  if (dt.current) {
2098
2112
  try {
2099
2113
  dt.current(
@@ -2128,26 +2142,26 @@ function Mr(e) {
2128
2142
  }
2129
2143
  return;
2130
2144
  }
2131
- if (f.type === "request_page_context") {
2132
- if (!ye("read_page")) {
2133
- ve("request_page_context", "read_page");
2145
+ if (p.type === "request_page_context") {
2146
+ if (!we("read_page")) {
2147
+ _e("request_page_context", "read_page");
2134
2148
  return;
2135
2149
  }
2136
- const L = typeof f.requestId == "string" ? f.requestId : void 0, I = (ee = ce.current) == null ? void 0 : ee.call(ce), O = (U) => {
2150
+ const L = typeof p.requestId == "string" ? p.requestId : void 0, I = (ee = se.current) == null ? void 0 : ee.call(se), O = (j) => {
2137
2151
  const P = I, J = P == null ? void 0 : P.localParticipant;
2138
2152
  if (J != null && J.publishData)
2139
2153
  try {
2140
- const Z = L ? { ...U, requestId: L } : U, ze = new TextEncoder().encode(JSON.stringify(Z));
2141
- J.publishData(ze, { reliable: !0 });
2142
- } catch (Z) {
2143
- console.warn("[LiveLayer] publishData failed.", Z);
2154
+ const Q = L ? { ...j, requestId: L } : j, Pe = new TextEncoder().encode(JSON.stringify(Q));
2155
+ J.publishData(Pe, { reliable: !0 });
2156
+ } catch (Q) {
2157
+ console.warn("[LiveLayer] publishData failed.", Q);
2144
2158
  }
2145
2159
  }, $ = _t.current, F = wt.current;
2146
2160
  try {
2147
2161
  if (F) {
2148
- const U = F($);
2149
- if (U instanceof Promise) {
2150
- O({ type: "page_context_pending" }), U.then((P) => O({ type: "page_context", context: P })).catch((P) => {
2162
+ const j = F($);
2163
+ if (j instanceof Promise) {
2164
+ O({ type: "page_context_pending" }), j.then((P) => O({ type: "page_context", context: P })).catch((P) => {
2151
2165
  console.warn(
2152
2166
  "[LiveLayer] getPageContext rejected; falling back to default walker.",
2153
2167
  P
@@ -2158,17 +2172,17 @@ function Mr(e) {
2158
2172
  });
2159
2173
  return;
2160
2174
  }
2161
- O({ type: "page_context", context: U });
2175
+ O({ type: "page_context", context: j });
2162
2176
  return;
2163
2177
  }
2164
2178
  O({
2165
2179
  type: "page_context",
2166
2180
  context: Gt($)
2167
2181
  });
2168
- } catch (U) {
2182
+ } catch (j) {
2169
2183
  console.warn(
2170
2184
  "[LiveLayer] page-context extraction threw. Sending empty context.",
2171
- U
2185
+ j
2172
2186
  ), O({
2173
2187
  type: "page_context",
2174
2188
  context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: $ }
@@ -2176,19 +2190,19 @@ function Mr(e) {
2176
2190
  }
2177
2191
  return;
2178
2192
  }
2179
- if (f.type === "scroll_page") {
2180
- if (!ye("scroll")) {
2181
- ve("scroll_page", "scroll");
2193
+ if (p.type === "scroll_page") {
2194
+ if (!we("scroll")) {
2195
+ _e("scroll_page", "scroll");
2182
2196
  return;
2183
2197
  }
2184
- const L = f.direction;
2198
+ const L = p.direction;
2185
2199
  if (L !== "up" && L !== "down" && L !== "top" && L !== "bottom") {
2186
2200
  console.warn(
2187
2201
  `[LiveLayer] scroll_page: invalid direction "${String(L)}". Expected up | down | top | bottom.`
2188
2202
  );
2189
2203
  return;
2190
2204
  }
2191
- const I = f.behavior === "instant" ? "instant" : "smooth";
2205
+ const I = p.behavior === "instant" ? "instant" : "smooth";
2192
2206
  if (ut.current) {
2193
2207
  try {
2194
2208
  ut.current(
@@ -2203,18 +2217,18 @@ function Mr(e) {
2203
2217
  if (typeof window > "u") return;
2204
2218
  const O = { behavior: I }, $ = Ar(), F = (P) => {
2205
2219
  $ instanceof Window ? $.scrollBy({ top: P, ...O }) : $.scrollBy({ top: P, ...O });
2206
- }, U = (P) => {
2220
+ }, j = (P) => {
2207
2221
  $ instanceof Window ? $.scrollTo({ top: P, ...O }) : $.scrollTo({ top: P, ...O });
2208
2222
  };
2209
- L === "up" ? F(-Xt($)) : L === "down" ? F(Xt($)) : U(L === "top" ? 0 : Rr($));
2223
+ L === "up" ? F(-Xt($)) : L === "down" ? F(Xt($)) : j(L === "top" ? 0 : Rr($));
2210
2224
  return;
2211
2225
  }
2212
- if (f.type === "click") {
2213
- if (!ye("click")) {
2214
- ve("click", "click");
2226
+ if (p.type === "click") {
2227
+ if (!we("click")) {
2228
+ _e("click", "click");
2215
2229
  return;
2216
2230
  }
2217
- const L = typeof f.selector == "string" ? f.selector : null;
2231
+ const L = typeof p.selector == "string" ? p.selector : null;
2218
2232
  if (!L) {
2219
2233
  console.warn("[LiveLayer] click: missing selector.");
2220
2234
  return;
@@ -2249,19 +2263,19 @@ function Mr(e) {
2249
2263
  );
2250
2264
  return;
2251
2265
  }
2252
- (tt = I.click) == null || tt.call(I);
2266
+ (rt = I.click) == null || rt.call(I);
2253
2267
  return;
2254
2268
  }
2255
- if (f.type === "fill_form" || f.type === "focus_field") {
2256
- if (!ye("fill_forms")) {
2257
- ve(f.type, "fill_forms");
2269
+ if (p.type === "fill_form" || p.type === "focus_field") {
2270
+ if (!we("fill_forms")) {
2271
+ _e(p.type, "fill_forms");
2258
2272
  return;
2259
2273
  }
2260
2274
  if (typeof document > "u") return;
2261
- f.type === "fill_form" && Fe.current.playConfirmation();
2262
- const L = typeof f.formId == "string" ? f.formId : null;
2275
+ p.type === "fill_form" && U.current.playConfirmation();
2276
+ const L = typeof p.formId == "string" ? p.formId : null;
2263
2277
  if (!L) {
2264
- console.warn(`[LiveLayer] ${f.type}: missing formId.`);
2278
+ console.warn(`[LiveLayer] ${p.type}: missing formId.`);
2265
2279
  return;
2266
2280
  }
2267
2281
  const I = document.querySelector(
@@ -2269,18 +2283,18 @@ function Mr(e) {
2269
2283
  );
2270
2284
  if (!I) {
2271
2285
  console.warn(
2272
- `[LiveLayer] ${f.type}: no form with data-ll-form="${L}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2286
+ `[LiveLayer] ${p.type}: no form with data-ll-form="${L}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2273
2287
  );
2274
2288
  return;
2275
2289
  }
2276
2290
  if (I.closest('[data-ll-private="true"], .ll-widget')) {
2277
2291
  console.warn(
2278
- `[LiveLayer] ${f.type}: refusing to touch a form in a private subtree.`
2292
+ `[LiveLayer] ${p.type}: refusing to touch a form in a private subtree.`
2279
2293
  );
2280
2294
  return;
2281
2295
  }
2282
- if (f.type === "focus_field") {
2283
- const $ = typeof f.fieldName == "string" ? f.fieldName : null;
2296
+ if (p.type === "focus_field") {
2297
+ const $ = typeof p.fieldName == "string" ? p.fieldName : null;
2284
2298
  if (!$) {
2285
2299
  console.warn("[LiveLayer] focus_field: missing fieldName.");
2286
2300
  return;
@@ -2292,7 +2306,7 @@ function Mr(e) {
2292
2306
  );
2293
2307
  return;
2294
2308
  }
2295
- if (!lt(F)) {
2309
+ if (!st(F)) {
2296
2310
  console.warn(
2297
2311
  `[LiveLayer] focus_field: field "${$}" is privacy-protected and not focusable.`
2298
2312
  );
@@ -2301,28 +2315,28 @@ function Mr(e) {
2301
2315
  F.focus();
2302
2316
  return;
2303
2317
  }
2304
- const O = f.values && typeof f.values == "object" ? f.values : null;
2318
+ const O = p.values && typeof p.values == "object" ? p.values : null;
2305
2319
  if (!O) {
2306
2320
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
2307
2321
  return;
2308
2322
  }
2309
2323
  for (const [$, F] of Object.entries(O)) {
2310
2324
  if (typeof F != "string") continue;
2311
- const U = I.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
2312
- if (!U) {
2325
+ const j = I.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
2326
+ if (!j) {
2313
2327
  console.warn(
2314
2328
  `[LiveLayer] fill_form: no field "${$}" in form "${L}". Skipping.`
2315
2329
  );
2316
2330
  continue;
2317
2331
  }
2318
- if (!lt(U)) {
2332
+ if (!st(j)) {
2319
2333
  console.warn(
2320
2334
  `[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
2321
2335
  );
2322
2336
  continue;
2323
2337
  }
2324
2338
  try {
2325
- Sr(U, F);
2339
+ Sr(j, F);
2326
2340
  } catch (P) {
2327
2341
  console.warn(
2328
2342
  `[LiveLayer] fill_form: failed to set "${$}".`,
@@ -2332,18 +2346,18 @@ function Mr(e) {
2332
2346
  }
2333
2347
  return;
2334
2348
  }
2335
- if (f.type === "submit_form") {
2336
- if (!ye("submit_forms")) {
2337
- ve("submit_form", "submit_forms");
2349
+ if (p.type === "submit_form") {
2350
+ if (!we("submit_forms")) {
2351
+ _e("submit_form", "submit_forms");
2338
2352
  return;
2339
2353
  }
2340
2354
  if (typeof document > "u") return;
2341
- const L = typeof f.formId == "string" ? f.formId : null;
2355
+ const L = typeof p.formId == "string" ? p.formId : null;
2342
2356
  if (!L) {
2343
2357
  console.warn("[LiveLayer] submit_form: missing formId.");
2344
2358
  return;
2345
2359
  }
2346
- Fe.current.playConfirmation();
2360
+ U.current.playConfirmation();
2347
2361
  const I = document.querySelector(
2348
2362
  `[data-ll-form="${L.replace(/"/g, '\\"')}"]`
2349
2363
  );
@@ -2359,18 +2373,18 @@ function Mr(e) {
2359
2373
  );
2360
2374
  return;
2361
2375
  }
2362
- const O = typeof f.requestId == "string" ? f.requestId : void 0, $ = (nt = ce.current) == null ? void 0 : nt.call(ce), F = (J) => {
2363
- const Z = $, ze = Z == null ? void 0 : Z.localParticipant;
2364
- if (ze != null && ze.publishData)
2376
+ const O = typeof p.requestId == "string" ? p.requestId : void 0, $ = (it = se.current) == null ? void 0 : it.call(se), F = (J) => {
2377
+ const Q = $, Pe = Q == null ? void 0 : Q.localParticipant;
2378
+ if (Pe != null && Pe.publishData)
2365
2379
  try {
2366
2380
  const un = O ? { ...J, requestId: O } : J, fn = new TextEncoder().encode(JSON.stringify(un));
2367
- ze.publishData(fn, { reliable: !0 });
2381
+ Pe.publishData(fn, { reliable: !0 });
2368
2382
  } catch {
2369
2383
  }
2370
2384
  };
2371
- let U = !1;
2385
+ let j = !1;
2372
2386
  const P = () => {
2373
- U = !0, F({ type: "form_submitted", formId: L });
2387
+ j = !0, F({ type: "form_submitted", formId: L });
2374
2388
  };
2375
2389
  I.addEventListener("submit", P, { once: !0 });
2376
2390
  try {
@@ -2384,7 +2398,7 @@ function Mr(e) {
2384
2398
  return;
2385
2399
  }
2386
2400
  setTimeout(() => {
2387
- U || (I.removeEventListener("submit", P), F({
2401
+ j || (I.removeEventListener("submit", P), F({
2388
2402
  type: "form_submit_blocked",
2389
2403
  formId: L,
2390
2404
  reason: "validation"
@@ -2392,34 +2406,34 @@ function Mr(e) {
2392
2406
  }, 500);
2393
2407
  return;
2394
2408
  }
2395
- if (f.type === "request_routes") {
2396
- if (!ye("read_page")) {
2397
- ve("request_routes", "read_page");
2409
+ if (p.type === "request_routes") {
2410
+ if (!we("read_page")) {
2411
+ _e("request_routes", "read_page");
2398
2412
  return;
2399
2413
  }
2400
- const L = typeof f.requestId == "string" ? f.requestId : void 0, O = (Tt = ce.current) == null ? void 0 : Tt.call(ce), $ = O == null ? void 0 : O.localParticipant;
2414
+ const L = typeof p.requestId == "string" ? p.requestId : void 0, O = (Tt = se.current) == null ? void 0 : Tt.call(se), $ = O == null ? void 0 : O.localParticipant;
2401
2415
  if (!($ != null && $.publishData)) return;
2402
2416
  const F = (P) => {
2403
2417
  try {
2404
- const J = L ? { type: "routes", routes: P, requestId: L } : { type: "routes", routes: P }, Z = new TextEncoder().encode(JSON.stringify(J));
2405
- $.publishData(Z, { reliable: !0 });
2418
+ const J = L ? { type: "routes", routes: P, requestId: L } : { type: "routes", routes: P }, Q = new TextEncoder().encode(JSON.stringify(J));
2419
+ $.publishData(Q, { reliable: !0 });
2406
2420
  } catch (J) {
2407
2421
  console.warn("[LiveLayer] request_routes: publishData failed.", J);
2408
2422
  }
2409
- }, U = xt.current;
2410
- if (U) {
2423
+ }, j = xt.current;
2424
+ if (j) {
2411
2425
  try {
2412
- const P = U(), J = (Z) => {
2413
- if (!Array.isArray(Z)) {
2426
+ const P = j(), J = (Q) => {
2427
+ if (!Array.isArray(Q)) {
2414
2428
  F([]);
2415
2429
  return;
2416
2430
  }
2417
- F(Z.map(br).slice(0, 200));
2431
+ F(Q.map(br).slice(0, 200));
2418
2432
  };
2419
- P instanceof Promise ? P.then(J).catch((Z) => {
2433
+ P instanceof Promise ? P.then(J).catch((Q) => {
2420
2434
  console.warn(
2421
2435
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
2422
- Z
2436
+ Q
2423
2437
  ), F(mt());
2424
2438
  }) : J(P);
2425
2439
  } catch (P) {
@@ -2437,22 +2451,22 @@ function Mr(e) {
2437
2451
  }
2438
2452
  return;
2439
2453
  }
2440
- Ir.has(f.type) || Ae == null || Ae(f);
2454
+ Ir.has(p.type) || Re == null || Re(p);
2441
2455
  }
2442
2456
  },
2443
- [Ae, Ne]
2457
+ [Re, Ae]
2444
2458
  ), X = bn({
2445
- agentId: j ? "__controlled__" : _e,
2459
+ agentId: V ? "__controlled__" : Je,
2446
2460
  baseUrl: i,
2447
2461
  apiKey: r,
2448
2462
  sessionEndpoint: o,
2449
2463
  sessionBody: l,
2450
- onDataMessage: j ? void 0 : Ue
2464
+ onDataMessage: V ? void 0 : Be
2451
2465
  });
2452
2466
  N(() => {
2453
- if (j != null && j.subscribeToDataMessages)
2454
- return j.subscribeToDataMessages(Ue);
2455
- }, [j, Ue]), ce.current = () => {
2467
+ if (V != null && V.subscribeToDataMessages)
2468
+ return V.subscribeToDataMessages(Be);
2469
+ }, [V, Be]), se.current = () => {
2456
2470
  var g;
2457
2471
  return (g = X.getRoom) == null ? void 0 : g.call(X);
2458
2472
  }, N(() => {
@@ -2460,29 +2474,29 @@ function Mr(e) {
2460
2474
  if (typeof window > "u") return;
2461
2475
  const g = ((ee = window.location) == null ? void 0 : ee.hostname) || "";
2462
2476
  if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
2463
- return window.__livelayerSimulateCommand = (tt) => {
2477
+ return window.__livelayerSimulateCommand = (rt) => {
2464
2478
  try {
2465
- Ue(tt);
2466
- } catch (nt) {
2467
- console.warn("[LiveLayer] simulate-command threw:", nt);
2479
+ Be(rt);
2480
+ } catch (it) {
2481
+ console.warn("[LiveLayer] simulate-command threw:", it);
2468
2482
  }
2469
2483
  }, () => {
2470
2484
  delete window.__livelayerSimulateCommand;
2471
2485
  };
2472
- }, [Ue]);
2473
- const b = Be(() => j ? {
2474
- connectionState: j.connectionState,
2475
- agentState: j.agentState,
2476
- transcript: j.transcript,
2477
- videoElement: j.videoElement,
2478
- audioElement: j.audioElement,
2479
- canResume: j.canResume,
2480
- error: j.error,
2486
+ }, [Be]);
2487
+ const b = He(() => V ? {
2488
+ connectionState: V.connectionState,
2489
+ agentState: V.agentState,
2490
+ transcript: V.transcript,
2491
+ videoElement: V.videoElement,
2492
+ audioElement: V.audioElement,
2493
+ canResume: V.canResume,
2494
+ error: V.error,
2481
2495
  agentConfig: null,
2482
2496
  connect: async () => {
2483
- await j.onConnect();
2497
+ await V.onConnect();
2484
2498
  },
2485
- disconnect: () => j.onDisconnect(),
2499
+ disconnect: () => V.onDisconnect(),
2486
2500
  // Dummy getRoom for shape compatibility — controlled consumers own the Room.
2487
2501
  // Internal session's getRoom returns null when no real connect has happened,
2488
2502
  // so we reuse its reference for type consistency.
@@ -2501,194 +2515,194 @@ function Mr(e) {
2501
2515
  disconnect: X.disconnect,
2502
2516
  getRoom: X.getRoom,
2503
2517
  isControlled: !1
2504
- }, [j, X]), kt = E(null);
2518
+ }, [V, X]), kt = E(null);
2505
2519
  N(() => {
2506
- const g = b.videoElement, f = kt.current;
2507
- if (!(!g || !f))
2508
- return f.appendChild(g), () => {
2509
- g.parentNode === f && f.removeChild(g);
2520
+ const g = b.videoElement, p = kt.current;
2521
+ if (!(!g || !p))
2522
+ return p.appendChild(g), () => {
2523
+ g.parentNode === p && p.removeChild(g);
2510
2524
  };
2511
2525
  }, [b.videoElement]), N(() => {
2512
2526
  const g = b.audioElement;
2513
2527
  if (!g) return;
2514
- Me.attach(g);
2515
- const f = g.play();
2516
- return f && typeof f.catch == "function" && f.catch((ee) => {
2517
- (ee == null ? void 0 : ee.name) === "NotAllowedError" && ge(!0);
2528
+ Ie.attach(g);
2529
+ const p = g.play();
2530
+ return p && typeof p.catch == "function" && p.catch((ee) => {
2531
+ (ee == null ? void 0 : ee.name) === "NotAllowedError" && Te(!0);
2518
2532
  }), () => {
2519
- Me.detach();
2533
+ Ie.detach();
2520
2534
  };
2521
2535
  }, [b.audioElement]), N(() => {
2522
2536
  if (b.isControlled || b.connectionState !== "connected") return;
2523
2537
  const g = b.getRoom();
2524
2538
  if (g)
2525
- return oe.setupMic(g).catch(() => {
2526
- }), ne.attachRoom(g), ae.attachRoom(g), me.refresh(), () => {
2527
- oe.teardownMic(), ne.teardown(), ae.teardown();
2539
+ return Z.setupMic(g).catch(() => {
2540
+ }), ne.attachRoom(g), oe.attachRoom(g), be.refresh(), () => {
2541
+ Z.teardownMic(), ne.teardown(), oe.teardown();
2528
2542
  };
2529
2543
  }, [b.isControlled, b.connectionState]), N(() => {
2530
2544
  const g = b.audioElement;
2531
- g && (g.muted = $e);
2532
- }, [b.audioElement, $e]);
2545
+ g && (g.muted = qe);
2546
+ }, [b.audioElement, qe]);
2533
2547
  const Zt = k((g) => {
2534
- const f = b.getRoom();
2535
- if (f)
2548
+ const p = b.getRoom();
2549
+ if (p)
2536
2550
  try {
2537
2551
  const ee = new TextEncoder().encode(
2538
2552
  JSON.stringify({ type: "user_message", text: g })
2539
2553
  );
2540
- f.localParticipant.publishData(ee, { reliable: !0 });
2554
+ p.localParticipant.publishData(ee, { reliable: !0 });
2541
2555
  } catch {
2542
2556
  }
2543
2557
  }, [b]), en = k(() => {
2544
- h((g) => !g);
2558
+ et((g) => !g);
2545
2559
  }, []);
2546
2560
  N(() => {
2547
- Ee == null || Ee(b.connectionState), b.connectionState === "connected" ? ke == null || ke() : b.connectionState === "disconnected" && (Le == null || Le());
2548
- }, [b.connectionState, ke, Le, Ee]), N(() => {
2549
- Se == null || Se(b.transcript);
2550
- }, [b.transcript, Se]), N(() => {
2551
- Ce == null || Ce(b.agentState);
2552
- }, [b.agentState, Ce]), N(() => {
2553
- G.setThinking(b.agentState === "thinking");
2554
- }, [b.agentState, G]);
2561
+ Ne == null || Ne(b.connectionState), b.connectionState === "connected" ? Le == null || Le() : b.connectionState === "disconnected" && (Se == null || Se());
2562
+ }, [b.connectionState, Le, Se, Ne]), N(() => {
2563
+ Ce == null || Ce(b.transcript);
2564
+ }, [b.transcript, Ce]), N(() => {
2565
+ Ee == null || Ee(b.agentState);
2566
+ }, [b.agentState, Ee]), N(() => {
2567
+ f.setThinking(b.agentState === "thinking");
2568
+ }, [b.agentState, f]);
2555
2569
  const Lt = E(!1);
2556
2570
  N(() => {
2557
- b.isControlled || !d || Lt.current || Q && b.connectionState === "idle" && (Lt.current = !0, b.connect());
2558
- }, [d, b.connectionState, b, Q]);
2571
+ b.isControlled || !d || Lt.current || fe && b.connectionState === "idle" && (Lt.current = !0, b.connect());
2572
+ }, [d, b.connectionState, b, fe]);
2559
2573
  const tn = k(
2560
2574
  (g) => {
2561
- const f = w == null ? void 0 : w.find((ee) => ee.id === g);
2562
- f && (De(!1), g !== we && (Ze(!0), b.disconnect(), fe || ie(g), y == null || y(f)));
2575
+ const p = _ == null ? void 0 : _.find((ee) => ee.id === g);
2576
+ p && (ae(!1), g !== pe && (Ke(!0), b.disconnect(), ye || ct(g), y == null || y(p)));
2563
2577
  },
2564
2578
  [
2565
- w,
2566
- we,
2579
+ _,
2580
+ pe,
2567
2581
  b,
2568
- fe,
2582
+ ye,
2569
2583
  y
2570
2584
  ]
2571
2585
  );
2572
2586
  N(() => {
2573
- Pe && b.connectionState === "connected" && Ze(!1);
2574
- }, [b.connectionState, Pe]), N(() => {
2575
- if (!We) return;
2576
- const g = (f) => {
2577
- f.key === "Escape" && De(!1);
2587
+ Oe && b.connectionState === "connected" && Ke(!1);
2588
+ }, [b.connectionState, Oe]), N(() => {
2589
+ if (!le) return;
2590
+ const g = (p) => {
2591
+ p.key === "Escape" && ae(!1);
2578
2592
  };
2579
2593
  return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
2580
- }, [We]);
2581
- const nn = !!H || !!(Y != null && Y.avatarImageUrl) || b.isControlled, je = Cn(_e, i, nn);
2582
- ue === void 0 && ((Ct = je.info) != null && Ct.capabilities) && (pt.current = je.info.capabilities);
2583
- const et = (Y == null ? void 0 : Y.name) ?? v ?? ((Et = b.agentConfig) == null ? void 0 : Et.name) ?? ((Nt = je.info) == null ? void 0 : Nt.name) ?? "Live Layer", ht = (Y == null ? void 0 : Y.avatarImageUrl) ?? H ?? ((At = b.agentConfig) == null ? void 0 : At.avatarImageUrl) ?? ((Rt = je.info) == null ? void 0 : Rt.avatarImageUrl) ?? null, rn = z ?? ((It = b.agentConfig) == null ? void 0 : It.idleLoopUrl) ?? ((Mt = je.info) == null ? void 0 : Mt.idleLoopUrl) ?? null, on = M ?? null, ln = k(() => le("expanded"), [le]), an = k(
2584
- () => le("minimized"),
2585
- [le]
2594
+ }, [le]);
2595
+ const nn = !!z || !!(Y != null && Y.avatarImageUrl) || b.isControlled, We = Cn(Je, i, nn);
2596
+ ue === void 0 && ((Ct = We.info) != null && Ct.capabilities) && (pt.current = We.info.capabilities);
2597
+ const nt = (Y == null ? void 0 : Y.name) ?? v ?? ((Et = b.agentConfig) == null ? void 0 : Et.name) ?? ((Nt = We.info) == null ? void 0 : Nt.name) ?? "Live Layer", ht = (Y == null ? void 0 : Y.avatarImageUrl) ?? z ?? ((At = b.agentConfig) == null ? void 0 : At.avatarImageUrl) ?? ((Rt = We.info) == null ? void 0 : Rt.avatarImageUrl) ?? null, rn = H ?? ((It = b.agentConfig) == null ? void 0 : It.idleLoopUrl) ?? ((Mt = We.info) == null ? void 0 : Mt.idleLoopUrl) ?? null, on = M ?? null, ln = k(() => he("expanded"), [he]), an = k(
2598
+ () => he("minimized"),
2599
+ [he]
2586
2600
  ), St = k(() => {
2587
- b.disconnect(), le("hidden");
2588
- }, [b, le]), cn = k(() => {
2601
+ b.disconnect(), he("hidden");
2602
+ }, [b, he]), sn = k(() => {
2589
2603
  const g = b.audioElement;
2590
- g && g.play().then(() => ge(!1)).catch(() => {
2604
+ g && g.play().then(() => Te(!1)).catch(() => {
2591
2605
  });
2592
- }, [b.audioElement]), sn = k(() => {
2593
- ge(!1), b.connect();
2594
- }, [b]), Ve = {
2595
- ...Je,
2596
- zIndex: Ke
2606
+ }, [b.audioElement]), cn = k(() => {
2607
+ Te(!1), b.connect();
2608
+ }, [b]), Fe = {
2609
+ ...Ye,
2610
+ zIndex: Ge
2597
2611
  };
2598
- S.primaryColor && (Ve["--ll-color-primary"] = S.primaryColor), S.accentColor && (Ve["--ll-color-accent"] = S.accentColor), S.backgroundColor && (Ve["--ll-color-bg"] = S.backgroundColor), S.textColor && (Ve["--ll-color-fg"] = S.textColor);
2612
+ S.primaryColor && (Fe["--ll-color-primary"] = S.primaryColor), S.accentColor && (Fe["--ll-color-accent"] = S.accentColor), S.backgroundColor && (Fe["--ll-color-bg"] = S.backgroundColor), S.textColor && (Fe["--ll-color-fg"] = S.textColor);
2599
2613
  const dn = [
2600
2614
  "ll-widget",
2601
- `ll-widget--${xe}`,
2602
- `ll-widget--${Ie ? "mobile" : "desktop"}`,
2603
- Xe
2615
+ `ll-widget--${ve}`,
2616
+ `ll-widget--${ke ? "mobile" : "desktop"}`,
2617
+ Ve
2604
2618
  ].filter(Boolean).join(" ");
2605
- return Q ? /* @__PURE__ */ x(
2619
+ return fe ? /* @__PURE__ */ x(
2606
2620
  "div",
2607
2621
  {
2608
2622
  className: dn,
2609
- style: Ve,
2610
- "data-display-mode": xe,
2623
+ style: Fe,
2624
+ "data-display-mode": ve,
2611
2625
  "data-position": a,
2612
2626
  children: [
2613
- xe === "hidden" && /* @__PURE__ */ n(
2627
+ ve === "hidden" && /* @__PURE__ */ n(
2614
2628
  Kn,
2615
2629
  {
2616
2630
  position: a,
2617
- isMobile: Ie,
2631
+ isMobile: ke,
2618
2632
  isSpeaking: b.agentState === "speaking",
2619
- onExpand: () => le("expanded"),
2620
- label: `Open ${et} widget`,
2633
+ onExpand: () => he("expanded"),
2634
+ label: `Open ${nt} widget`,
2621
2635
  avatarImageUrl: ht,
2622
- agentName: et
2636
+ agentName: nt
2623
2637
  }
2624
2638
  ),
2625
- xe === "minimized" && /* @__PURE__ */ n(
2639
+ ve === "minimized" && /* @__PURE__ */ n(
2626
2640
  Zn,
2627
2641
  {
2628
2642
  position: a,
2629
- isMobile: Ie,
2630
- agentName: et,
2643
+ isMobile: ke,
2644
+ agentName: nt,
2631
2645
  avatarImageUrl: ht,
2632
2646
  agentState: b.agentState,
2633
- isMuted: oe.isMuted,
2634
- audioLevel: Me,
2647
+ isMuted: Z.isMuted,
2648
+ audioLevel: Ie,
2635
2649
  onExpand: ln,
2636
- onToggleMute: oe.toggleMute,
2650
+ onToggleMute: Z.toggleMute,
2637
2651
  onClose: St
2638
2652
  }
2639
2653
  ),
2640
- xe === "expanded" && /* @__PURE__ */ n(
2654
+ ve === "expanded" && /* @__PURE__ */ n(
2641
2655
  tr,
2642
2656
  {
2643
2657
  position: a,
2644
- isMobile: Ie,
2645
- agentName: et,
2658
+ isMobile: ke,
2659
+ agentName: nt,
2646
2660
  avatarImageUrl: ht,
2647
2661
  idleLoopUrl: rn,
2648
2662
  greeting: on,
2649
2663
  branding: S,
2650
- teamMembers: w,
2651
- currentTeamMemberId: we,
2652
- isSwitchingTeamMember: Pe,
2653
- teamSwitcherOpen: We,
2654
- onToggleTeamSwitcher: () => De((g) => !g),
2664
+ teamMembers: _,
2665
+ currentTeamMemberId: pe,
2666
+ isSwitchingTeamMember: Oe,
2667
+ teamSwitcherOpen: le,
2668
+ onToggleTeamSwitcher: () => ae((g) => !g),
2655
2669
  onSelectTeamMember: tn,
2656
2670
  connectionState: b.connectionState,
2657
2671
  agentState: b.agentState,
2658
2672
  transcript: b.transcript,
2659
- isMuted: oe.isMuted,
2660
- micDevices: me.mics,
2673
+ isMuted: Z.isMuted,
2674
+ micDevices: be.mics,
2661
2675
  isCameraEnabled: ne.isEnabled,
2662
2676
  cameraPreviewEl: ne.previewEl,
2663
- cameraDevices: me.cameras,
2677
+ cameraDevices: be.cameras,
2664
2678
  activeCameraId: ne.activeDeviceId,
2665
- isScreenShareEnabled: ae.isEnabled,
2666
- screenPreviewEl: ae.previewEl,
2667
- isSpeakerMuted: $e,
2679
+ isScreenShareEnabled: oe.isEnabled,
2680
+ screenPreviewEl: oe.previewEl,
2681
+ isSpeakerMuted: qe,
2668
2682
  allowCamera: B,
2669
2683
  allowScreenShare: D,
2670
2684
  allowTyping: A,
2671
- languageMenuOpen: at,
2672
- onToggleLanguageMenu: () => ct((g) => !g),
2673
- needsUserGesture: Te,
2685
+ languageMenuOpen: Qe,
2686
+ onToggleLanguageMenu: () => Ze((g) => !g),
2687
+ needsUserGesture: Me,
2674
2688
  canResume: b.canResume,
2675
- micError: oe.micError,
2689
+ micError: Z.micError,
2676
2690
  error: b.error,
2677
2691
  avatarVideoContainerRef: kt,
2678
2692
  agentVideoEl: b.videoElement,
2679
2693
  onConnect: () => void b.connect(),
2680
2694
  onDisconnect: () => b.disconnect(),
2681
- onRetry: sn,
2682
- onResumeAudio: cn,
2683
- onToggleMute: oe.toggleMute,
2695
+ onRetry: cn,
2696
+ onResumeAudio: sn,
2697
+ onToggleMute: Z.toggleMute,
2684
2698
  onToggleCamera: () => void ne.toggle(),
2685
2699
  onSwitchCameraDevice: (g) => void ne.switchDevice(g),
2686
- onToggleScreenShare: () => void ae.toggle(),
2700
+ onToggleScreenShare: () => void oe.toggle(),
2687
2701
  onToggleSpeaker: en,
2688
2702
  onSendMessage: Zt,
2689
2703
  onMinimize: an,
2690
2704
  onClose: St,
2691
- onClearMicError: oe.clearError
2705
+ onClearMicError: Z.clearError
2692
2706
  }
2693
2707
  )
2694
2708
  ]
@@ -2705,27 +2719,27 @@ const Br = ({
2705
2719
  mode: i,
2706
2720
  onAgentEvent: o,
2707
2721
  className: l,
2708
- style: s
2722
+ style: c
2709
2723
  }) => {
2710
- const d = E(null), u = E(null), p = E(o);
2711
- p.current = o;
2724
+ const d = E(null), u = E(null), h = E(o);
2725
+ h.current = o;
2712
2726
  const m = k((a) => {
2713
2727
  var R;
2714
- const c = a.detail;
2715
- (R = p.current) == null || R.call(p, c);
2728
+ const s = a.detail;
2729
+ (R = h.current) == null || R.call(h, s);
2716
2730
  }, []);
2717
2731
  return N(() => {
2718
2732
  const a = d.current;
2719
2733
  if (!a) return;
2720
- const c = document.createElement("livelayer-widget");
2721
- return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), i && c.setAttribute("mode", i), c.addEventListener("agent-event", m), a.appendChild(c), u.current = c, () => {
2722
- c.removeEventListener("agent-event", m), a.removeChild(c), u.current = null;
2734
+ const s = document.createElement("livelayer-widget");
2735
+ 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", m), a.appendChild(s), u.current = s, () => {
2736
+ s.removeEventListener("agent-event", m), a.removeChild(s), u.current = null;
2723
2737
  };
2724
2738
  }, [e]), N(() => {
2725
2739
  u.current && (i ? u.current.setAttribute("mode", i) : u.current.removeAttribute("mode"));
2726
- }, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2740
+ }, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
2727
2741
  }, Wr = vt(
2728
- function({ id: t, intent: r, as: i = "div", className: o, style: l, children: s }, d) {
2742
+ function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, d) {
2729
2743
  return hn(
2730
2744
  i,
2731
2745
  {
@@ -2735,7 +2749,7 @@ const Br = ({
2735
2749
  className: o,
2736
2750
  style: l
2737
2751
  },
2738
- s
2752
+ c
2739
2753
  );
2740
2754
  }
2741
2755
  ), Fr = vt(
@@ -2753,37 +2767,37 @@ const Br = ({
2753
2767
  }
2754
2768
  ), Ur = vt(
2755
2769
  function(t, r) {
2756
- const { name: i, label: o, labelClassName: l } = t, s = { name: i, "data-ll-field": i };
2770
+ const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
2757
2771
  let d;
2758
2772
  if ("as" in t && t.as === "textarea") {
2759
- const { name: u, label: p, labelClassName: m, as: a, ...c } = t;
2773
+ const { name: u, label: h, labelClassName: m, as: a, ...s } = t;
2760
2774
  d = /* @__PURE__ */ n(
2761
2775
  "textarea",
2762
2776
  {
2763
2777
  ref: r,
2764
- ...s,
2765
- ...c
2778
+ ...c,
2779
+ ...s
2766
2780
  }
2767
2781
  );
2768
2782
  } else if ("as" in t && t.as === "select") {
2769
- const { name: u, label: p, labelClassName: m, as: a, children: c, ...R } = t;
2783
+ const { name: u, label: h, labelClassName: m, as: a, children: s, ...R } = t;
2770
2784
  d = /* @__PURE__ */ n(
2771
2785
  "select",
2772
2786
  {
2773
2787
  ref: r,
2774
- ...s,
2788
+ ...c,
2775
2789
  ...R,
2776
- children: c
2790
+ children: s
2777
2791
  }
2778
2792
  );
2779
2793
  } else {
2780
- const { name: u, label: p, labelClassName: m, as: a, ...c } = t;
2794
+ const { name: u, label: h, labelClassName: m, as: a, ...s } = t;
2781
2795
  d = /* @__PURE__ */ n(
2782
2796
  "input",
2783
2797
  {
2784
2798
  ref: r,
2785
- ...s,
2786
- ...c
2799
+ ...c,
2800
+ ...s
2787
2801
  }
2788
2802
  );
2789
2803
  }
@@ -2799,11 +2813,11 @@ function jr({
2799
2813
  defaultOpen: t = !1,
2800
2814
  storageKey: r = "ll-debug-open"
2801
2815
  }) {
2802
- const [i, o] = C(t), [l, s] = C([]), [d, u] = C(""), [p, m] = C(!1), a = E(/* @__PURE__ */ new Set()), c = E([]), R = E(p);
2803
- R.current = p, N(() => {
2816
+ const [i, o] = C(t), [l, c] = C([]), [d, u] = C(""), [h, m] = C(!1), a = E(/* @__PURE__ */ new Set()), s = E([]), R = E(h);
2817
+ R.current = h, N(() => {
2804
2818
  try {
2805
- const _ = localStorage.getItem(r);
2806
- _ === "1" && o(!0), _ === "0" && o(!1);
2819
+ const w = localStorage.getItem(r);
2820
+ w === "1" && o(!0), w === "0" && o(!1);
2807
2821
  } catch {
2808
2822
  }
2809
2823
  }, [r]), N(() => {
@@ -2812,36 +2826,36 @@ function jr({
2812
2826
  } catch {
2813
2827
  }
2814
2828
  }, [i, r]), N(() => {
2815
- const _ = (y) => {
2816
- (y.metaKey || y.ctrlKey) && y.shiftKey && y.key.toLowerCase() === "l" && (y.preventDefault(), o((z) => !z));
2829
+ const w = (y) => {
2830
+ (y.metaKey || y.ctrlKey) && y.shiftKey && y.key.toLowerCase() === "l" && (y.preventDefault(), o((H) => !H));
2817
2831
  };
2818
- return window.addEventListener("keydown", _), () => window.removeEventListener("keydown", _);
2832
+ return window.addEventListener("keydown", w), () => window.removeEventListener("keydown", w);
2819
2833
  }, []), N(() => {
2820
- const _ = setInterval(() => {
2821
- if (c.current.length === 0 || R.current) return;
2822
- const y = c.current.splice(0, c.current.length);
2823
- s(
2824
- (z) => [...y.reverse(), ...z].slice(0, 200)
2834
+ const w = setInterval(() => {
2835
+ if (s.current.length === 0 || R.current) return;
2836
+ const y = s.current.splice(0, s.current.length);
2837
+ c(
2838
+ (H) => [...y.reverse(), ...H].slice(0, 200)
2825
2839
  );
2826
2840
  }, 100);
2827
- return () => clearInterval(_);
2841
+ return () => clearInterval(w);
2828
2842
  }, []);
2829
2843
  const q = E(!1);
2830
2844
  if (N(() => {
2831
- !e || q.current || (q.current = !0, e((_) => {
2832
- c.current.push({
2845
+ !e || q.current || (q.current = !0, e((w) => {
2846
+ s.current.push({
2833
2847
  id: Jt++,
2834
2848
  ts: Date.now(),
2835
2849
  kind: "event",
2836
- type: _.eventName,
2837
- data: _.data
2850
+ type: w.eventName,
2851
+ data: w.data
2838
2852
  });
2839
2853
  }));
2840
2854
  }, [e]), N(() => {
2841
- const _ = console.warn, y = console.log, z = (M, H) => function(...v) {
2855
+ const w = console.warn, y = console.log, H = (M, z) => function(...v) {
2842
2856
  try {
2843
2857
  const S = typeof v[0] == "string" ? v[0] : "";
2844
- S.startsWith("[LiveLayer]") && c.current.push({
2858
+ S.startsWith("[LiveLayer]") && s.current.push({
2845
2859
  id: Jt++,
2846
2860
  ts: Date.now(),
2847
2861
  kind: M,
@@ -2850,10 +2864,10 @@ function jr({
2850
2864
  });
2851
2865
  } catch {
2852
2866
  }
2853
- return H.apply(this, v);
2867
+ return z.apply(this, v);
2854
2868
  };
2855
- return console.warn = z("warn", _), console.log = z("log", y), () => {
2856
- console.warn = _, console.log = y;
2869
+ return console.warn = H("warn", w), console.log = H("log", y), () => {
2870
+ console.warn = w, console.log = y;
2857
2871
  };
2858
2872
  }, []), !i)
2859
2873
  return /* @__PURE__ */ n(
@@ -2882,10 +2896,10 @@ function jr({
2882
2896
  children: "🛰 LL debug"
2883
2897
  }
2884
2898
  );
2885
- const w = l.filter((_) => {
2899
+ const _ = l.filter((w) => {
2886
2900
  if (!d) return !0;
2887
2901
  const y = d.toLowerCase();
2888
- return _.type.toLowerCase().includes(y) || JSON.stringify(_.data || {}).toLowerCase().includes(y);
2902
+ return w.type.toLowerCase().includes(y) || JSON.stringify(w.data || {}).toLowerCase().includes(y);
2889
2903
  });
2890
2904
  return /* @__PURE__ */ x(
2891
2905
  "div",
@@ -2932,10 +2946,10 @@ function jr({
2932
2946
  "button",
2933
2947
  {
2934
2948
  type: "button",
2935
- onClick: () => m((_) => !_),
2936
- style: gt(p ? "#f59e0b" : "transparent"),
2949
+ onClick: () => m((w) => !w),
2950
+ style: gt(h ? "#f59e0b" : "transparent"),
2937
2951
  title: "Pause / resume capture",
2938
- children: p ? "▶ resume" : "⏸ pause"
2952
+ children: h ? "▶ resume" : "⏸ pause"
2939
2953
  }
2940
2954
  ),
2941
2955
  /* @__PURE__ */ n(
@@ -2943,7 +2957,7 @@ function jr({
2943
2957
  {
2944
2958
  type: "button",
2945
2959
  onClick: () => {
2946
- s([]), c.current = [];
2960
+ c([]), s.current = [];
2947
2961
  },
2948
2962
  style: gt("transparent"),
2949
2963
  title: "Clear buffer",
@@ -2969,7 +2983,7 @@ function jr({
2969
2983
  {
2970
2984
  type: "text",
2971
2985
  value: d,
2972
- onChange: (_) => u(_.target.value),
2986
+ onChange: (w) => u(w.target.value),
2973
2987
  placeholder: "filter by type or data…",
2974
2988
  style: {
2975
2989
  margin: 8,
@@ -2991,7 +3005,7 @@ function jr({
2991
3005
  overflowY: "auto",
2992
3006
  padding: "0 8px 8px"
2993
3007
  },
2994
- children: w.length === 0 ? /* @__PURE__ */ x(
3008
+ children: _.length === 0 ? /* @__PURE__ */ x(
2995
3009
  "div",
2996
3010
  {
2997
3011
  style: {
@@ -3021,16 +3035,16 @@ function jr({
3021
3035
  )
3022
3036
  ]
3023
3037
  }
3024
- ) : w.map((_) => /* @__PURE__ */ n(
3038
+ ) : _.map((w) => /* @__PURE__ */ n(
3025
3039
  Tr,
3026
3040
  {
3027
- entry: _,
3028
- expanded: a.current.has(_.id),
3041
+ entry: w,
3042
+ expanded: a.current.has(w.id),
3029
3043
  onToggle: () => {
3030
- a.current.has(_.id) ? a.current.delete(_.id) : a.current.add(_.id), s((y) => [...y]);
3044
+ a.current.has(w.id) ? a.current.delete(w.id) : a.current.add(w.id), c((y) => [...y]);
3031
3045
  }
3032
3046
  },
3033
- _.id
3047
+ w.id
3034
3048
  ))
3035
3049
  }
3036
3050
  )
@@ -3129,10 +3143,10 @@ function Pr(e) {
3129
3143
  function Vr() {
3130
3144
  const [e, t] = C([]), r = k((o) => {
3131
3145
  t((l) => {
3132
- const s = l.findIndex((d) => d.id === o.id);
3133
- if (s >= 0) {
3146
+ const c = l.findIndex((d) => d.id === o.id);
3147
+ if (c >= 0) {
3134
3148
  const d = l.slice();
3135
- return d[s] = o, d;
3149
+ return d[c] = o, d;
3136
3150
  }
3137
3151
  return [...l, o];
3138
3152
  });