@livelayer/react 0.5.2 → 0.5.4

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,9 +1,9 @@
1
1
  "use client";
2
- import { jsxs as _, jsx as n, Fragment as qt } from "react/jsx-runtime";
3
- import { Component as on, useState as N, useRef as I, useEffect as P, useCallback as S, useMemo as Je, forwardRef as st, createElement as ln } from "react";
4
- import { LiveKitSession as an } from "@livelayer/sdk";
5
- import { createLocalAudioTrack as sn, Track as Bt, createLocalVideoTrack as cn } from "livekit-client";
6
- class dn extends on {
2
+ import { jsxs as _, jsx as n, Fragment as Ft } from "react/jsx-runtime";
3
+ import { Component as sn, useState as N, useRef as I, useEffect as P, useCallback as S, useMemo as Qe, forwardRef as dt, createElement as dn } from "react";
4
+ import { LiveKitSession as un } from "@livelayer/sdk";
5
+ import { createLocalAudioTrack as fn, Track as Ut, createLocalVideoTrack as pn } from "livekit-client";
6
+ class hn extends sn {
7
7
  constructor() {
8
8
  super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
9
9
  this.setState({ hasError: !1, error: null });
@@ -13,8 +13,8 @@ class dn extends on {
13
13
  return { hasError: !0, error: t };
14
14
  }
15
15
  componentDidCatch(t, r) {
16
- var i, o;
17
- (o = (i = this.props).onError) == null || o.call(i, t, r);
16
+ var o, i;
17
+ (i = (o = this.props).onError) == null || i.call(o, t, r);
18
18
  }
19
19
  render() {
20
20
  var t;
@@ -33,26 +33,26 @@ class dn extends on {
33
33
  ] }) : this.props.children;
34
34
  }
35
35
  }
36
- function un(e) {
37
- const [t, r] = N("idle"), [i, o] = N("idle"), [l, c] = N([]), [d, u] = N(null), [h, m] = N(null), [a, s] = N(null), [A, C] = N(!1), [R, b] = N(null), L = I(null), D = I(e.onDataMessage);
38
- D.current = e.onDataMessage, P(() => {
36
+ function mn(e) {
37
+ const [t, r] = N("idle"), [o, i] = N("idle"), [l, s] = N([]), [d, u] = N(null), [h, m] = N(null), [a, c] = N(null), [A, C] = N(!1), [R, b] = N(null), L = I(null), z = I(e.onDataMessage);
38
+ z.current = e.onDataMessage, P(() => {
39
39
  const g = {
40
40
  onConnectionStateChange: (x) => {
41
41
  r(x), x === "connected" && b(null);
42
42
  },
43
- onAgentStateChange: o,
44
- onTranscript: (x) => c([...x]),
43
+ onAgentStateChange: i,
44
+ onTranscript: (x) => s([...x]),
45
45
  onAgentConfig: u,
46
- onAudioTrack: (x) => s(x),
46
+ onAudioTrack: (x) => c(x),
47
47
  onVideoTrack: (x) => m(x),
48
48
  onVideoTrackRemoved: () => m(null),
49
49
  onError: (x) => b(x),
50
50
  onDataMessage: (x) => {
51
- var H;
52
- (H = D.current) == null || H.call(D, x);
51
+ var q;
52
+ (q = z.current) == null || q.call(z, x);
53
53
  },
54
54
  onResumabilityChange: C
55
- }, E = new an(
55
+ }, E = new un(
56
56
  {
57
57
  agentId: e.agentId,
58
58
  baseUrl: e.baseUrl,
@@ -62,7 +62,7 @@ function un(e) {
62
62
  },
63
63
  g
64
64
  );
65
- return L.current = E, r("idle"), o("idle"), c([]), u(null), m(null), s(null), C(!1), b(null), () => {
65
+ return L.current = E, r("idle"), i("idle"), s([]), u(null), m(null), c(null), C(!1), b(null), () => {
66
66
  var x;
67
67
  (x = E.destroy) == null || x.call(E), L.current = null;
68
68
  };
@@ -81,7 +81,7 @@ function un(e) {
81
81
  } catch (E) {
82
82
  throw b(E instanceof Error ? E.message : String(E)), E;
83
83
  }
84
- }, []), z = S(() => {
84
+ }, []), O = S(() => {
85
85
  const g = L.current;
86
86
  g && g.disconnect();
87
87
  }, []), p = S(() => {
@@ -90,7 +90,7 @@ function un(e) {
90
90
  }, []);
91
91
  return {
92
92
  connectionState: t,
93
- agentState: i,
93
+ agentState: o,
94
94
  transcript: l,
95
95
  agentConfig: d,
96
96
  videoElement: h,
@@ -98,37 +98,37 @@ function un(e) {
98
98
  canResume: A,
99
99
  error: R,
100
100
  connect: M,
101
- disconnect: z,
101
+ disconnect: O,
102
102
  getRoom: p,
103
103
  session: L.current
104
104
  };
105
105
  }
106
- function fn() {
107
- const e = I(null), t = I(null), r = I(null), i = I(null), o = I(/* @__PURE__ */ new Set()), l = I(null), c = S(() => {
106
+ function gn() {
107
+ const e = I(null), t = I(null), r = I(null), o = I(null), i = I(/* @__PURE__ */ new Set()), l = I(null), s = S(() => {
108
108
  const a = t.current;
109
109
  if (!a) {
110
- i.current = null;
110
+ o.current = null;
111
111
  return;
112
112
  }
113
113
  (!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
114
114
  new ArrayBuffer(a.frequencyBinCount)
115
115
  ));
116
- const s = l.current;
117
- a.getByteFrequencyData(s);
116
+ const c = l.current;
117
+ a.getByteFrequencyData(c);
118
118
  let A = 0;
119
- for (let R = 0; R < s.length; R++) A += s[R];
120
- const C = A / s.length / 255;
121
- for (const R of o.current)
119
+ for (let R = 0; R < c.length; R++) A += c[R];
120
+ const C = A / c.length / 255;
121
+ for (const R of i.current)
122
122
  try {
123
123
  R(C);
124
124
  } catch (b) {
125
125
  console.error("[useAudioLevel] subscriber threw:", b);
126
126
  }
127
- i.current = requestAnimationFrame(c);
127
+ o.current = requestAnimationFrame(s);
128
128
  }, []), d = S(() => {
129
129
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
- const a = new AudioContext(), s = a.createAnalyser();
131
- s.fftSize = 64, s.connect(a.destination), e.current = a, t.current = s;
130
+ const a = new AudioContext(), c = a.createAnalyser();
131
+ c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
132
132
  }, []), u = S(
133
133
  (a) => {
134
134
  if (d(), !(!e.current || !t.current)) {
@@ -140,26 +140,26 @@ function fn() {
140
140
  r.current = null;
141
141
  }
142
142
  try {
143
- const s = e.current.createMediaElementSource(a);
144
- s.connect(t.current), r.current = s;
145
- } catch (s) {
146
- console.warn("[useAudioLevel] createMediaElementSource failed:", s);
143
+ const c = e.current.createMediaElementSource(a);
144
+ c.connect(t.current), r.current = c;
145
+ } catch (c) {
146
+ console.warn("[useAudioLevel] createMediaElementSource failed:", c);
147
147
  return;
148
148
  }
149
- i.current === null && (i.current = requestAnimationFrame(c));
149
+ o.current === null && (o.current = requestAnimationFrame(s));
150
150
  }
151
151
  },
152
- [d, c]
152
+ [d, s]
153
153
  ), h = S(() => {
154
- if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
154
+ if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
155
155
  try {
156
156
  r.current.disconnect();
157
157
  } catch {
158
158
  }
159
159
  r.current = null;
160
160
  }
161
- }, []), m = S((a) => (o.current.add(a), () => {
162
- o.current.delete(a);
161
+ }, []), m = S((a) => (i.current.add(a), () => {
162
+ i.current.delete(a);
163
163
  }), []);
164
164
  return P(() => () => {
165
165
  if (h(), t.current) {
@@ -176,34 +176,34 @@ function fn() {
176
176
  }
177
177
  e.current = null;
178
178
  }
179
- o.current.clear(), l.current = null;
179
+ i.current.clear(), l.current = null;
180
180
  }, [h]), { attach: u, detach: h, subscribe: m };
181
181
  }
182
- function pn() {
183
- const [e, t] = N(!1), [r, i] = N(null), o = I(null), l = I(null), c = S(async (m) => {
184
- if (o.current && l.current) {
182
+ function yn() {
183
+ const [e, t] = N(!1), [r, o] = N(null), i = I(null), l = I(null), s = S(async (m) => {
184
+ if (i.current && l.current) {
185
185
  try {
186
- await l.current.localParticipant.unpublishTrack(o.current);
186
+ await l.current.localParticipant.unpublishTrack(i.current);
187
187
  } catch {
188
188
  }
189
- o.current.stop(), o.current = null;
189
+ i.current.stop(), i.current = null;
190
190
  }
191
- l.current = m, i(null);
191
+ l.current = m, o(null);
192
192
  try {
193
- const a = await sn({
193
+ const a = await fn({
194
194
  echoCancellation: !0,
195
195
  noiseSuppression: !0
196
196
  });
197
- await m.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
197
+ await m.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
198
198
  } catch (a) {
199
- const s = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
- throw i(s), a;
199
+ const c = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
+ throw o(c), a;
201
201
  }
202
202
  }, []), d = S(() => {
203
- const m = o.current;
203
+ const m = i.current;
204
204
  m && (m.isMuted ? (m.unmute(), t(!1)) : (m.mute(), t(!0)));
205
205
  }, []), u = S(() => {
206
- const m = o.current, a = l.current;
206
+ const m = i.current, a = l.current;
207
207
  if (m && a) {
208
208
  try {
209
209
  a.localParticipant.unpublishTrack(m);
@@ -211,25 +211,25 @@ function pn() {
211
211
  }
212
212
  m.stop();
213
213
  }
214
- o.current = null, l.current = null, t(!1);
215
- }, []), h = S(() => i(null), []);
214
+ i.current = null, l.current = null, t(!1);
215
+ }, []), h = S(() => o(null), []);
216
216
  return {
217
217
  isMuted: e,
218
218
  micError: r,
219
219
  toggleMute: d,
220
- setupMic: c,
220
+ setupMic: s,
221
221
  teardownMic: u,
222
222
  clearError: h
223
223
  };
224
224
  }
225
- const hn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
- function mn() {
227
- const [e, t] = N(!1), [r, i] = N(null), [o, l] = N(null), [c, d] = N(""), u = I(null), h = I(null), m = S((L) => {
225
+ const vn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
+ function bn() {
227
+ const [e, t] = N(!1), [r, o] = N(null), [i, l] = N(null), [s, d] = N(""), u = I(null), h = I(null), m = S((L) => {
228
228
  u.current = L;
229
229
  }, []), a = S(() => {
230
- const L = u.current, D = h.current;
231
- if (D && L) {
232
- const M = L.localParticipant.getTrackPublication(Bt.Source.Camera);
230
+ const L = u.current, z = h.current;
231
+ if (z && L) {
232
+ const M = L.localParticipant.getTrackPublication(Ut.Source.Camera);
233
233
  if (M != null && M.track) {
234
234
  try {
235
235
  L.localParticipant.unpublishTrack(M.track);
@@ -237,46 +237,46 @@ function mn() {
237
237
  }
238
238
  M.track.stop();
239
239
  } else
240
- D.stop();
240
+ z.stop();
241
241
  }
242
242
  h.current = null, l(null), t(!1);
243
- }, []), s = S(async (L) => {
244
- const D = u.current;
245
- if (D) {
246
- i(null);
243
+ }, []), c = S(async (L) => {
244
+ const z = u.current;
245
+ if (z) {
246
+ o(null);
247
247
  try {
248
- const M = { ...hn };
248
+ const M = { ...vn };
249
249
  L && (M.deviceId = L);
250
- const z = await cn(M);
251
- await D.localParticipant.publishTrack(z), h.current = z;
252
- const p = z.attach();
250
+ const O = await pn(M);
251
+ await z.localParticipant.publishTrack(O), h.current = O;
252
+ const p = O.attach();
253
253
  l(p), t(!0), L && d(L);
254
254
  try {
255
- D.localParticipant.publishData(
255
+ z.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 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);
262
+ const O = M instanceof Error && M.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
+ o(O);
264
264
  }
265
265
  }
266
266
  }, []), A = S(async () => {
267
- e ? a() : await s(c || void 0);
268
- }, [e, c, a, s]), C = S(async (L) => {
269
- a(), await s(L);
270
- }, [a, s]), R = S(() => {
271
- a(), u.current = null, i(null), d("");
272
- }, [a]), b = S(() => i(null), []);
267
+ e ? a() : await c(s || void 0);
268
+ }, [e, s, a, c]), C = S(async (L) => {
269
+ a(), await c(L);
270
+ }, [a, c]), R = S(() => {
271
+ a(), u.current = null, o(null), d("");
272
+ }, [a]), b = S(() => o(null), []);
273
273
  return P(() => () => {
274
274
  h.current && h.current.stop();
275
275
  }, []), {
276
276
  isEnabled: e,
277
277
  error: r,
278
- previewEl: o,
279
- activeDeviceId: c,
278
+ previewEl: i,
279
+ activeDeviceId: s,
280
280
  toggle: A,
281
281
  switchDevice: C,
282
282
  attachRoom: m,
@@ -284,31 +284,31 @@ function mn() {
284
284
  clearError: b
285
285
  };
286
286
  }
287
- function gn() {
288
- const [e, t] = N(!1), [r, i] = N(null), [o, l] = N(null), c = I(null), d = S((s) => {
289
- c.current = s;
287
+ function wn() {
288
+ const [e, t] = N(!1), [r, o] = N(null), [i, l] = N(null), s = I(null), d = S((c) => {
289
+ s.current = c;
290
290
  }, []), u = S(() => l(null), []), h = S(async () => {
291
- const s = c.current;
292
- if (s) {
291
+ const c = s.current;
292
+ if (c) {
293
293
  if (e) {
294
294
  try {
295
- await s.localParticipant.setScreenShareEnabled(!1);
295
+ await c.localParticipant.setScreenShareEnabled(!1);
296
296
  } catch {
297
297
  }
298
298
  u(), t(!1);
299
299
  return;
300
300
  }
301
- i(null);
301
+ o(null);
302
302
  try {
303
- await s.localParticipant.setScreenShareEnabled(!0);
303
+ await c.localParticipant.setScreenShareEnabled(!0);
304
304
  let A = 0;
305
305
  const C = () => {
306
- const R = s.localParticipant.getTrackPublication(Bt.Source.ScreenShare);
306
+ const R = c.localParticipant.getTrackPublication(Ut.Source.ScreenShare);
307
307
  if (R != null && R.track) {
308
308
  const b = R.track.attach();
309
309
  l(b), t(!0);
310
310
  try {
311
- s.localParticipant.publishData(
311
+ c.localParticipant.publishData(
312
312
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
313
313
  { reliable: !0 }
314
314
  );
@@ -321,59 +321,59 @@ function gn() {
321
321
  C();
322
322
  } catch (A) {
323
323
  const C = A instanceof Error ? A.name : "";
324
- C !== "NotAllowedError" && C !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
324
+ C !== "NotAllowedError" && C !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
325
325
  }
326
326
  }
327
327
  }, [e, u]), m = S(() => {
328
- const s = c.current;
329
- if (s && e)
328
+ const c = s.current;
329
+ if (c && e)
330
330
  try {
331
- s.localParticipant.setScreenShareEnabled(!1);
331
+ c.localParticipant.setScreenShareEnabled(!1);
332
332
  } catch {
333
333
  }
334
- u(), t(!1), i(null), c.current = null;
335
- }, [e, u]), a = S(() => i(null), []);
336
- return { isEnabled: e, error: r, previewEl: o, toggle: h, attachRoom: d, teardown: m, clearError: a };
334
+ u(), t(!1), o(null), s.current = null;
335
+ }, [e, u]), a = S(() => o(null), []);
336
+ return { isEnabled: e, error: r, previewEl: i, toggle: h, attachRoom: d, teardown: m, clearError: a };
337
337
  }
338
- function yn() {
339
- const [e, t] = N([]), [r, i] = N([]), o = S(async () => {
338
+ function _n() {
339
+ const [e, t] = N([]), [r, o] = N([]), i = S(async () => {
340
340
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
341
341
  try {
342
342
  const l = await navigator.mediaDevices.enumerateDevices();
343
- t(l.filter((c) => c.kind === "audioinput")), i(l.filter((c) => c.kind === "videoinput"));
343
+ t(l.filter((s) => s.kind === "audioinput")), o(l.filter((s) => s.kind === "videoinput"));
344
344
  } catch {
345
345
  }
346
346
  }, []);
347
347
  return P(() => {
348
- if (o(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
- const l = () => void o();
348
+ if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
+ const l = () => void i();
350
350
  return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
351
- }, [o]), { mics: e, cameras: r, refresh: o };
351
+ }, [i]), { mics: e, cameras: r, refresh: i };
352
352
  }
353
- function vn(e, t, r = !1) {
354
- const [i, o] = N(null), [l, c] = N(null), [d, u] = N(!r && !!e);
353
+ function xn(e, t, r = !1) {
354
+ const [o, i] = N(null), [l, s] = N(null), [d, u] = N(!r && !!e);
355
355
  return P(() => {
356
356
  if (r || !e) {
357
357
  u(!1);
358
358
  return;
359
359
  }
360
360
  const h = new AbortController(), m = t || "https://app.livelayer.studio";
361
- return u(!0), c(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
361
+ return u(!0), s(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
362
362
  signal: h.signal
363
363
  }).then(async (a) => {
364
364
  if (!a.ok) {
365
- const s = await a.json().catch(() => ({}));
366
- throw new Error(s.error || `HTTP ${a.status}`);
365
+ const c = await a.json().catch(() => ({}));
366
+ throw new Error(c.error || `HTTP ${a.status}`);
367
367
  }
368
368
  return a.json();
369
369
  }).then((a) => {
370
- h.signal.aborted || (o(a), u(!1));
370
+ h.signal.aborted || (i(a), u(!1));
371
371
  }).catch((a) => {
372
- h.signal.aborted || (c(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
372
+ h.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
373
373
  }), () => h.abort();
374
- }, [e, t, r]), { info: i, error: l, loading: d };
374
+ }, [e, t, r]), { info: o, error: l, loading: d };
375
375
  }
376
- function bn(e) {
376
+ function kn(e) {
377
377
  if (typeof window > "u") return null;
378
378
  try {
379
379
  return window.localStorage.getItem(e);
@@ -381,52 +381,52 @@ function bn(e) {
381
381
  return null;
382
382
  }
383
383
  }
384
- function wn(e, t) {
384
+ function Ln(e, t) {
385
385
  if (!(typeof window > "u"))
386
386
  try {
387
387
  window.localStorage.setItem(e, t);
388
388
  } catch {
389
389
  }
390
390
  }
391
- function _n({
391
+ function Sn({
392
392
  value: e,
393
393
  defaultValue: t = "expanded",
394
394
  onChange: r
395
395
  } = {}) {
396
- const i = e !== void 0, [o, l] = N(t), c = i ? e : o, d = S(
396
+ const o = e !== void 0, [i, l] = N(t), s = o ? e : i, d = S(
397
397
  (u) => {
398
- u !== c && (i || l(u), r == null || r(u));
398
+ u !== s && (o || l(u), r == null || r(u));
399
399
  },
400
- [c, i, r]
400
+ [s, o, r]
401
401
  );
402
- return [c, d];
402
+ return [s, d];
403
403
  }
404
- const xn = ["hidden", "minimized", "expanded"];
405
- function kn(e) {
406
- return e && xn.includes(e) ? e : null;
404
+ const Cn = ["hidden", "minimized", "expanded"];
405
+ function En(e) {
406
+ return e && Cn.includes(e) ? e : null;
407
407
  }
408
- function Ln({
408
+ function Nn({
409
409
  value: e,
410
410
  defaultValue: t = "expanded",
411
411
  onChange: r,
412
- persistKey: i = "ll-widget",
413
- disablePersistence: o = !1
412
+ persistKey: o = "ll-widget",
413
+ disablePersistence: i = !1
414
414
  } = {}) {
415
- const l = `${i}:display-mode`, c = I(!1), [d, u] = _n({
415
+ const l = `${o}:display-mode`, s = I(!1), [d, u] = Sn({
416
416
  value: e,
417
417
  defaultValue: t,
418
418
  onChange: (h) => {
419
- e === void 0 && !o && wn(l, h), r == null || r(h);
419
+ e === void 0 && !i && Ln(l, h), r == null || r(h);
420
420
  }
421
421
  });
422
422
  return P(() => {
423
- if (c.current || (c.current = !0, o || e !== void 0)) return;
424
- const h = kn(bn(l));
423
+ if (s.current || (s.current = !0, i || e !== void 0)) return;
424
+ const h = En(kn(l));
425
425
  h && h !== d && u(h);
426
426
  }, []), [d, u];
427
427
  }
428
- const Sn = 640;
429
- function Cn(e = Sn) {
428
+ const An = 640;
429
+ function Rn(e = An) {
430
430
  const [t, r] = N(!1);
431
431
  return P(() => {
432
432
  if (e === !1) {
@@ -435,73 +435,73 @@ function Cn(e = Sn) {
435
435
  }
436
436
  if (typeof window > "u" || typeof window.matchMedia > "u")
437
437
  return;
438
- const i = `(max-width: ${e - 1}px)`, o = window.matchMedia(i), l = () => r(o.matches);
439
- return l(), typeof o.addEventListener == "function" ? (o.addEventListener("change", l), () => o.removeEventListener("change", l)) : (o.addListener(l), () => {
440
- o.removeListener(l);
438
+ const o = `(max-width: ${e - 1}px)`, i = window.matchMedia(o), l = () => r(i.matches);
439
+ return l(), typeof i.addEventListener == "function" ? (i.addEventListener("change", l), () => i.removeEventListener("change", l)) : (i.addListener(l), () => {
440
+ i.removeListener(l);
441
441
  });
442
442
  }, [e]), t;
443
443
  }
444
- const St = "__llHistoryPatched", Ke = "ll:pathname";
445
- function En() {
446
- if (typeof window > "u" || window.history[St]) return;
444
+ const Et = "__llHistoryPatched", Ze = "ll:pathname";
445
+ function In() {
446
+ if (typeof window > "u" || window.history[Et]) return;
447
447
  const e = window.history.pushState, t = window.history.replaceState;
448
448
  window.history.pushState = function(...r) {
449
- const i = e.apply(this, r);
450
- return window.dispatchEvent(new Event(Ke)), i;
449
+ const o = e.apply(this, r);
450
+ return window.dispatchEvent(new Event(Ze)), o;
451
451
  }, window.history.replaceState = function(...r) {
452
- const i = t.apply(this, r);
453
- return window.dispatchEvent(new Event(Ke)), i;
454
- }, window.history[St] = !0;
452
+ const o = t.apply(this, r);
453
+ return window.dispatchEvent(new Event(Ze)), o;
454
+ }, window.history[Et] = !0;
455
455
  }
456
- function Ct() {
456
+ function Nt() {
457
457
  return typeof window > "u" ? "/" : window.location.pathname || "/";
458
458
  }
459
- function Nn(e) {
459
+ function Mn(e) {
460
460
  const [t, r] = N(
461
- () => e ?? Ct()
461
+ () => e ?? Nt()
462
462
  );
463
463
  return P(() => {
464
464
  if (e !== void 0) return;
465
- En();
466
- const i = () => r(Ct());
467
- return i(), window.addEventListener("popstate", i), window.addEventListener(Ke, i), () => {
468
- window.removeEventListener("popstate", i), window.removeEventListener(Ke, i);
465
+ In();
466
+ const o = () => r(Nt());
467
+ return o(), window.addEventListener("popstate", o), window.addEventListener(Ze, o), () => {
468
+ window.removeEventListener("popstate", o), window.removeEventListener(Ze, o);
469
469
  };
470
470
  }, [e]), e ?? t;
471
471
  }
472
- const Et = /* @__PURE__ */ new Map(), An = /[\\^$+?.()|{}[\]]/g;
473
- function Rn(e) {
474
- return e.replace(An, "\\$&");
472
+ const At = /* @__PURE__ */ new Map(), Tn = /[\\^$+?.()|{}[\]]/g;
473
+ function Pn(e) {
474
+ return e.replace(Tn, "\\$&");
475
475
  }
476
- function In(e) {
477
- const t = Et.get(e);
476
+ function Dn(e) {
477
+ const t = At.get(e);
478
478
  if (t) return t;
479
- const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), d = Rn(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
480
- return Et.set(e, u), u;
479
+ const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = Pn(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
480
+ return At.set(e, u), u;
481
481
  }
482
- function Mn(e, t) {
482
+ function $n(e, t) {
483
483
  const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
484
- return In(e).test(r);
484
+ return Dn(e).test(r);
485
485
  }
486
- function Tn(e, t) {
487
- return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : Mn(e, t);
486
+ function zn(e, t) {
487
+ return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : $n(e, t);
488
488
  }
489
- function Nt(e, t) {
489
+ function Rt(e, t) {
490
490
  if (!e || e.length === 0) return !1;
491
491
  for (const r of e)
492
- if (Tn(r, t)) return !0;
492
+ if (zn(r, t)) return !0;
493
493
  return !1;
494
494
  }
495
- function Pn(e, t, r) {
496
- return e === void 0 ? !0 : Nt(r, e) ? !1 : t && t.length > 0 ? Nt(t, e) : !0;
495
+ function Hn(e, t, r) {
496
+ return e === void 0 ? !0 : Rt(r, e) ? !1 : t && t.length > 0 ? Rt(t, e) : !0;
497
497
  }
498
- function Dn(e, t, r) {
499
- return Je(
500
- () => Pn(e, t, r),
498
+ function On(e, t, r) {
499
+ return Qe(
500
+ () => Hn(e, t, r),
501
501
  [e, t, r]
502
502
  );
503
503
  }
504
- const At = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
504
+ const It = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
505
505
  "svg",
506
506
  {
507
507
  className: t,
@@ -547,7 +547,7 @@ const At = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
547
547
  }
548
548
  )
549
549
  }
550
- ), Rt = ({ className: e }) => /* @__PURE__ */ n(
550
+ ), Mt = ({ className: e }) => /* @__PURE__ */ n(
551
551
  "svg",
552
552
  {
553
553
  className: e,
@@ -565,7 +565,7 @@ const At = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
565
565
  }
566
566
  )
567
567
  }
568
- ), $n = ({ className: e }) => /* @__PURE__ */ n(
568
+ ), qn = ({ className: e }) => /* @__PURE__ */ n(
569
569
  "svg",
570
570
  {
571
571
  className: e,
@@ -576,12 +576,12 @@ const At = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
576
576
  "aria-hidden": "true",
577
577
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
578
578
  }
579
- ), zn = {
579
+ ), Bn = {
580
580
  left: 180,
581
581
  right: 0,
582
582
  up: -90,
583
583
  down: 90
584
- }, On = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
584
+ }, Wn = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
585
585
  "svg",
586
586
  {
587
587
  className: t,
@@ -589,19 +589,19 @@ const At = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
589
589
  viewBox: "0 0 24 24",
590
590
  stroke: "currentColor",
591
591
  strokeWidth: 2,
592
- style: { transform: `rotate(${zn[e]}deg)` },
592
+ style: { transform: `rotate(${Bn[e]}deg)` },
593
593
  "aria-hidden": "true",
594
594
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
595
595
  }
596
596
  );
597
- function Hn(e) {
597
+ function Fn(e) {
598
598
  return e === "top-left" || e === "bottom-left" ? "left" : "right";
599
599
  }
600
- const Ft = "ll-hidden-tab-center-y", qn = 5, It = 16;
601
- function Bn() {
600
+ const jt = "ll-hidden-tab-center-y", Un = 5, Tt = 16;
601
+ function jn() {
602
602
  if (typeof window > "u") return null;
603
603
  try {
604
- const e = window.localStorage.getItem(Ft);
604
+ const e = window.localStorage.getItem(jt);
605
605
  if (!e) return null;
606
606
  const t = Number.parseFloat(e);
607
607
  return Number.isFinite(t) ? t : null;
@@ -609,30 +609,30 @@ function Bn() {
609
609
  return null;
610
610
  }
611
611
  }
612
- function Mt(e) {
612
+ function Pt(e) {
613
613
  if (!(typeof window > "u"))
614
614
  try {
615
- window.localStorage.setItem(Ft, String(e));
615
+ window.localStorage.setItem(jt, String(e));
616
616
  } catch {
617
617
  }
618
618
  }
619
- const Fn = ({
619
+ const Vn = ({
620
620
  position: e,
621
621
  isMobile: t,
622
622
  isSpeaking: r,
623
- onExpand: i,
624
- label: o = "Open widget"
623
+ onExpand: o,
624
+ label: i = "Open widget"
625
625
  }) => {
626
- const l = Hn(e), c = l === "right" ? "left" : "right", d = t ? 80 : 72, [u, h] = N(null), [m, a] = N(!1), s = I(null), A = I(!1), C = S(
626
+ const l = Fn(e), s = l === "right" ? "left" : "right", d = t ? 80 : 72, [u, h] = N(null), [m, a] = N(!1), c = I(null), A = I(!1), C = S(
627
627
  (g) => {
628
628
  if (typeof window > "u") return g;
629
- const E = d / 2, x = It + E, H = window.innerHeight - It - E;
630
- return H < x ? Math.max(x, g) : Math.max(x, Math.min(H, g));
629
+ const E = d / 2, x = Tt + E, q = window.innerHeight - Tt - E;
630
+ return q < x ? Math.max(x, g) : Math.max(x, Math.min(q, g));
631
631
  },
632
632
  [d]
633
633
  );
634
634
  P(() => {
635
- const g = Bn();
635
+ const g = jn();
636
636
  h(C(g ?? window.innerHeight / 2));
637
637
  const E = () => {
638
638
  h((x) => x === null ? null : C(x));
@@ -646,7 +646,7 @@ const Fn = ({
646
646
  g.currentTarget.setPointerCapture(g.pointerId);
647
647
  } catch {
648
648
  }
649
- s.current = {
649
+ c.current = {
650
650
  startClientY: g.clientY,
651
651
  startCenterY: u,
652
652
  moved: !1
@@ -656,44 +656,44 @@ const Fn = ({
656
656
  [u]
657
657
  ), b = S(
658
658
  (g) => {
659
- const E = s.current;
659
+ const E = c.current;
660
660
  if (!E) return;
661
661
  const x = g.clientY - E.startClientY;
662
- !E.moved && Math.abs(x) > qn && (E.moved = !0, a(!0)), E.moved && h(C(E.startCenterY + x));
662
+ !E.moved && Math.abs(x) > Un && (E.moved = !0, a(!0)), E.moved && h(C(E.startCenterY + x));
663
663
  },
664
664
  [C]
665
665
  ), L = S(
666
666
  (g) => {
667
- const E = s.current;
667
+ const E = c.current;
668
668
  if (E) {
669
669
  try {
670
670
  g.currentTarget.releasePointerCapture(g.pointerId);
671
671
  } catch {
672
672
  }
673
- s.current = null, E.moved && (a(!1), A.current = !0, h((x) => (x !== null && Mt(x), x)));
673
+ c.current = null, E.moved && (a(!1), A.current = !0, h((x) => (x !== null && Pt(x), x)));
674
674
  }
675
675
  },
676
676
  []
677
- ), D = S(() => {
677
+ ), z = S(() => {
678
678
  if (A.current) {
679
679
  A.current = !1;
680
680
  return;
681
681
  }
682
- i();
683
- }, [i]), M = S(
682
+ o();
683
+ }, [o]), M = S(
684
684
  (g) => {
685
685
  if (g.key === "ArrowUp" || g.key === "ArrowDown") {
686
686
  g.preventDefault();
687
687
  const E = g.key === "ArrowUp" ? -8 : 8;
688
688
  h((x) => {
689
689
  if (x === null) return x;
690
- const H = C(x + E);
691
- return Mt(H), H;
690
+ const q = C(x + E);
691
+ return Pt(q), q;
692
692
  });
693
693
  }
694
694
  },
695
695
  [C]
696
- ), z = [
696
+ ), O = [
697
697
  "ll-hidden",
698
698
  `ll-hidden--${l}`,
699
699
  t ? "ll-hidden--mobile" : "ll-hidden--desktop",
@@ -704,59 +704,59 @@ const Fn = ({
704
704
  "button",
705
705
  {
706
706
  type: "button",
707
- className: z,
707
+ className: O,
708
708
  onPointerDown: R,
709
709
  onPointerMove: b,
710
710
  onPointerUp: L,
711
711
  onPointerCancel: L,
712
- onClick: D,
712
+ onClick: z,
713
713
  onKeyDown: M,
714
- "aria-label": o,
714
+ "aria-label": i,
715
715
  "data-position": e,
716
716
  style: p,
717
- children: /* @__PURE__ */ n(On, { direction: c, className: "ll-hidden__chevron" })
717
+ children: /* @__PURE__ */ n(Wn, { direction: s, className: "ll-hidden__chevron" })
718
718
  }
719
719
  );
720
- }, Un = ({
720
+ }, Yn = ({
721
721
  audioLevel: e,
722
722
  bars: t = 20,
723
723
  maxHeight: r = 20,
724
- minHeight: i = 4,
725
- className: o,
724
+ minHeight: o = 4,
725
+ className: i,
726
726
  barClassName: l
727
727
  }) => {
728
- const c = I(null), d = I([]), u = Je(() => {
728
+ const s = I(null), d = I([]), u = Qe(() => {
729
729
  const m = (Math.sqrt(5) - 1) / 2;
730
- return Array.from({ length: t }, (a, s) => 0.5 + s * m % 1 * 0.5);
730
+ return Array.from({ length: t }, (a, c) => 0.5 + c * m % 1 * 0.5);
731
731
  }, [t]);
732
732
  P(() => e.subscribe((a) => {
733
- for (let s = 0; s < t; s++) {
734
- const A = d.current[s];
733
+ for (let c = 0; c < t; c++) {
734
+ const A = d.current[c];
735
735
  if (!A) continue;
736
- const C = Math.max(i, a * r * u[s]);
736
+ const C = Math.max(o, a * r * u[c]);
737
737
  A.style.height = `${C}px`;
738
738
  }
739
- }), [e, t, r, i, u]);
740
- const h = ["ll-waveform", o].filter(Boolean).join(" ");
741
- return /* @__PURE__ */ n("div", { ref: c, className: h, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
739
+ }), [e, t, r, o, u]);
740
+ const h = ["ll-waveform", i].filter(Boolean).join(" ");
741
+ return /* @__PURE__ */ n("div", { ref: s, className: h, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
742
742
  "div",
743
743
  {
744
- ref: (s) => {
745
- d.current[a] = s;
744
+ ref: (c) => {
745
+ d.current[a] = c;
746
746
  },
747
747
  className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
748
- style: { height: `${i}px` }
748
+ style: { height: `${o}px` }
749
749
  },
750
750
  a
751
751
  )) });
752
- }, Wn = ({
752
+ }, Gn = ({
753
753
  position: e,
754
754
  isMobile: t,
755
755
  agentName: r,
756
- avatarImageUrl: i,
757
- agentState: o,
756
+ avatarImageUrl: o,
757
+ agentState: i,
758
758
  isMuted: l,
759
- audioLevel: c,
759
+ audioLevel: s,
760
760
  onExpand: d,
761
761
  onToggleMute: u,
762
762
  onClose: h
@@ -774,21 +774,21 @@ const Fn = ({
774
774
  onClick: d,
775
775
  "aria-label": `Expand ${r} widget`,
776
776
  children: [
777
- i ? (
777
+ o ? (
778
778
  // eslint-disable-next-line @next/next/no-img-element
779
779
  /* @__PURE__ */ n(
780
780
  "img",
781
781
  {
782
- src: i,
782
+ src: o,
783
783
  alt: r,
784
784
  className: "ll-minimized__avatar"
785
785
  }
786
786
  )
787
787
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
788
788
  /* @__PURE__ */ n(
789
- Un,
789
+ Yn,
790
790
  {
791
- audioLevel: c,
791
+ audioLevel: s,
792
792
  bars: 16,
793
793
  maxHeight: 18,
794
794
  className: "ll-minimized__waveform"
@@ -809,10 +809,10 @@ const Fn = ({
809
809
  (m.key === "Enter" || m.key === " ") && (m.stopPropagation(), m.preventDefault(), u());
810
810
  },
811
811
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
812
- children: /* @__PURE__ */ n(At, { muted: l, className: "ll-minimized__icon" })
812
+ children: /* @__PURE__ */ n(It, { muted: l, className: "ll-minimized__icon" })
813
813
  }
814
814
  ),
815
- /* @__PURE__ */ n(Rt, { className: "ll-minimized__icon ll-minimized__icon--expand" })
815
+ /* @__PURE__ */ n(Mt, { className: "ll-minimized__icon ll-minimized__icon--expand" })
816
816
  ] })
817
817
  ]
818
818
  }
@@ -826,12 +826,12 @@ const Fn = ({
826
826
  role: "region",
827
827
  "aria-label": `${r} widget`,
828
828
  children: /* @__PURE__ */ _("div", { className: "ll-minimized__surface", children: [
829
- i ? (
829
+ o ? (
830
830
  // eslint-disable-next-line @next/next/no-img-element
831
831
  /* @__PURE__ */ n(
832
832
  "img",
833
833
  {
834
- src: i,
834
+ src: o,
835
835
  alt: r,
836
836
  className: "ll-minimized__avatar"
837
837
  }
@@ -839,7 +839,7 @@ const Fn = ({
839
839
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
840
840
  /* @__PURE__ */ _("div", { className: "ll-minimized__meta", children: [
841
841
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
842
- /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
842
+ /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: i === "speaking" ? "Speaking" : i === "thinking" ? "Thinking" : "Listening" })
843
843
  ] }),
844
844
  /* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
845
845
  /* @__PURE__ */ n(
@@ -849,7 +849,7 @@ const Fn = ({
849
849
  className: "ll-minimized__btn",
850
850
  onClick: u,
851
851
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
852
- children: /* @__PURE__ */ n(At, { muted: l, className: "ll-minimized__icon" })
852
+ children: /* @__PURE__ */ n(It, { muted: l, className: "ll-minimized__icon" })
853
853
  }
854
854
  ),
855
855
  /* @__PURE__ */ n(
@@ -859,7 +859,7 @@ const Fn = ({
859
859
  className: "ll-minimized__btn",
860
860
  onClick: d,
861
861
  "aria-label": `Expand ${r} widget`,
862
- children: /* @__PURE__ */ n(Rt, { className: "ll-minimized__icon" })
862
+ children: /* @__PURE__ */ n(Mt, { className: "ll-minimized__icon" })
863
863
  }
864
864
  ),
865
865
  /* @__PURE__ */ n(
@@ -869,22 +869,22 @@ const Fn = ({
869
869
  className: "ll-minimized__btn ll-minimized__btn--close",
870
870
  onClick: h,
871
871
  "aria-label": "Close widget",
872
- children: /* @__PURE__ */ n($n, { className: "ll-minimized__icon" })
872
+ children: /* @__PURE__ */ n(qn, { className: "ll-minimized__icon" })
873
873
  }
874
874
  )
875
875
  ] })
876
876
  ] })
877
877
  }
878
- ), jn = ({
878
+ ), Jn = ({
879
879
  src: e,
880
880
  alt: t,
881
881
  preCannedPlaying: r = !1,
882
- className: i,
883
- style: o
882
+ className: o,
883
+ style: i
884
884
  }) => {
885
- const [l, c] = N(!1), d = I(e);
885
+ const [l, s] = N(!1), d = I(e);
886
886
  if (P(() => {
887
- d.current !== e && (d.current = e, c(!1));
887
+ d.current !== e && (d.current = e, s(!1));
888
888
  }, [e]), !e) return null;
889
889
  const u = {
890
890
  position: "absolute",
@@ -896,7 +896,7 @@ const Fn = ({
896
896
  transition: "opacity 500ms ease, transform 500ms ease",
897
897
  transform: r ? "scale(1.02)" : "scale(1)",
898
898
  opacity: l ? 1 : 0,
899
- ...o
899
+ ...i
900
900
  };
901
901
  return (
902
902
  // eslint-disable-next-line @next/next/no-img-element
@@ -905,122 +905,122 @@ const Fn = ({
905
905
  {
906
906
  src: e,
907
907
  alt: t,
908
- className: i,
908
+ className: o,
909
909
  style: u,
910
910
  loading: "eager",
911
911
  fetchpriority: "high",
912
- onLoad: () => c(!0)
912
+ onLoad: () => s(!0)
913
913
  }
914
914
  )
915
915
  );
916
- }, Vn = ({
916
+ }, Kn = ({
917
917
  position: e,
918
918
  isMobile: t,
919
919
  agentName: r,
920
- avatarImageUrl: i,
921
- idleLoopUrl: o,
920
+ avatarImageUrl: o,
921
+ idleLoopUrl: i,
922
922
  greeting: l,
923
- branding: c,
923
+ branding: s,
924
924
  teamMembers: d,
925
925
  currentTeamMemberId: u,
926
926
  isSwitchingTeamMember: h,
927
927
  teamSwitcherOpen: m,
928
928
  onToggleTeamSwitcher: a,
929
- onSelectTeamMember: s,
929
+ onSelectTeamMember: c,
930
930
  languageMenuOpen: A,
931
931
  onToggleLanguageMenu: C,
932
932
  connectionState: R,
933
933
  agentState: b,
934
934
  transcript: L,
935
- canResume: D,
935
+ canResume: z,
936
936
  needsUserGesture: M,
937
- error: z,
937
+ error: O,
938
938
  isMuted: p,
939
939
  micError: g,
940
940
  micDevices: E,
941
941
  isCameraEnabled: x,
942
- cameraPreviewEl: H,
943
- cameraDevices: X,
942
+ cameraPreviewEl: q,
943
+ cameraDevices: Q,
944
944
  activeCameraId: de,
945
- isScreenShareEnabled: Q,
946
- screenPreviewEl: Z,
945
+ isScreenShareEnabled: Z,
946
+ screenPreviewEl: ee,
947
947
  isSpeakerMuted: ue,
948
- allowCamera: qe,
949
- allowScreenShare: Be,
950
- allowTyping: Fe,
951
- avatarVideoContainerRef: Ne,
952
- onConnect: fe,
948
+ allowCamera: He,
949
+ allowScreenShare: Oe,
950
+ allowTyping: qe,
951
+ avatarVideoContainerRef: Be,
952
+ onConnect: me,
953
953
  onDisconnect: ge,
954
954
  onRetry: ye,
955
955
  onResumeAudio: ve,
956
956
  onToggleMute: be,
957
957
  onToggleCamera: we,
958
958
  onSwitchCameraDevice: _e,
959
- onToggleScreenShare: q,
960
- onToggleSpeaker: Qe,
961
- onSendMessage: Ue,
962
- onMinimize: We,
963
- onClose: Ae,
964
- onClearMicError: Re
959
+ onToggleScreenShare: xe,
960
+ onToggleSpeaker: F,
961
+ onSendMessage: We,
962
+ onMinimize: Fe,
963
+ onClose: Ue,
964
+ onClearMicError: je
965
965
  }) => {
966
- var Pe;
967
- const ie = L.length > 0 ? L[L.length - 1] : null, pe = ((d == null ? void 0 : d.length) ?? 0) > 1, xe = R === "connecting" || R === "connected", ee = R === "connected", V = R === "idle" || R === "disconnected" || R === "error", Ie = I(null), oe = I(null);
966
+ var Se;
967
+ const le = L.length > 0 ? L[L.length - 1] : null, oe = ((d == null ? void 0 : d.length) ?? 0) > 1, ke = R === "connecting" || R === "connected", Le = R === "connected", fe = R === "idle" || R === "disconnected" || R === "error", V = I(null), Re = I(null);
968
968
  P(() => {
969
- const y = Ie.current;
970
- y && (y.innerHTML = "", H && (H.style.width = "100%", H.style.height = "100%", H.style.objectFit = "cover", H.style.transform = "scaleX(-1)", y.appendChild(H)));
971
- }, [H]), P(() => {
972
- const y = oe.current;
973
- y && (y.innerHTML = "", Z && (Z.style.width = "100%", Z.style.height = "100%", Z.style.objectFit = "contain", y.appendChild(Z)));
974
- }, [Z]);
975
- const [J, ne] = N(!1), [le, Y] = N(!1);
969
+ const v = V.current;
970
+ v && (v.innerHTML = "", q && (q.style.width = "100%", q.style.height = "100%", q.style.objectFit = "cover", q.style.transform = "scaleX(-1)", v.appendChild(q)));
971
+ }, [q]), P(() => {
972
+ const v = Re.current;
973
+ v && (v.innerHTML = "", ee && (ee.style.width = "100%", ee.style.height = "100%", ee.style.objectFit = "contain", v.appendChild(ee)));
974
+ }, [ee]);
975
+ const [te, X] = N(!1), [ie, ae] = N(!1);
976
976
  P(() => {
977
- if (!J && !le && !A && !m) return;
978
- const y = () => {
979
- ne(!1), Y(!1), A && C(), m && a();
977
+ if (!te && !ie && !A && !m) return;
978
+ const v = () => {
979
+ X(!1), ae(!1), A && C(), m && a();
980
980
  };
981
- return document.addEventListener("click", y), () => document.removeEventListener("click", y);
981
+ return document.addEventListener("click", v), () => document.removeEventListener("click", v);
982
982
  }, [
983
- J,
984
- le,
983
+ te,
984
+ ie,
985
985
  A,
986
986
  m,
987
987
  C,
988
988
  a
989
989
  ]);
990
- const [K, ae] = N(""), Me = S(
991
- (y) => {
992
- y.preventDefault();
993
- const W = K.trim();
994
- W && (Ue(W), ae(""));
990
+ const [J, ne] = N(""), pe = S(
991
+ (v) => {
992
+ v.preventDefault();
993
+ const Y = J.trim();
994
+ Y && (We(Y), ne(""));
995
995
  },
996
- [K, Ue]
997
- ), Ze = c.productName || "Live Layer", ke = ee && (ie != null && ie.text) ? ie.text : l || "", Te = [
996
+ [J, We]
997
+ ), Ie = s.productName || "Live Layer", Ve = Le && (le != null && le.text) ? le.text : l || "", Me = [
998
998
  "ll-expanded",
999
999
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1000
1000
  ].join(" ");
1001
1001
  return /* @__PURE__ */ _(
1002
1002
  "div",
1003
1003
  {
1004
- className: Te,
1004
+ className: Me,
1005
1005
  "data-position": e,
1006
- "data-state": ee ? "connected" : xe ? "connecting" : "idle",
1006
+ "data-state": Le ? "connected" : ke ? "connecting" : "idle",
1007
1007
  role: "dialog",
1008
1008
  "aria-label": `${r} widget`,
1009
1009
  children: [
1010
1010
  /* @__PURE__ */ _("div", { className: "ll-expanded__bg", children: [
1011
- i ? /* @__PURE__ */ n(
1012
- jn,
1011
+ o ? /* @__PURE__ */ n(
1012
+ Jn,
1013
1013
  {
1014
- src: i,
1014
+ src: o,
1015
1015
  alt: r,
1016
1016
  className: "ll-expanded__bg-img"
1017
1017
  }
1018
- ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Pe = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Pe.toUpperCase()) || "A" }) }),
1019
- o && !ee && /* @__PURE__ */ n(
1018
+ ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Se = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Se.toUpperCase()) || "A" }) }),
1019
+ i && !Le && /* @__PURE__ */ n(
1020
1020
  "video",
1021
1021
  {
1022
1022
  className: "ll-expanded__bg-idle",
1023
- src: o,
1023
+ src: i,
1024
1024
  autoPlay: !0,
1025
1025
  loop: !0,
1026
1026
  muted: !0,
@@ -1028,12 +1028,12 @@ const Fn = ({
1028
1028
  }
1029
1029
  )
1030
1030
  ] }),
1031
- /* @__PURE__ */ n("div", { ref: Ne, className: "ll-expanded__video" }),
1031
+ /* @__PURE__ */ n("div", { ref: Be, className: "ll-expanded__video" }),
1032
1032
  R === "connecting" && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1033
1033
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1034
1034
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: h ? "Switching..." : "Connecting..." })
1035
1035
  ] }),
1036
- M && ee && /* @__PURE__ */ _(
1036
+ M && Le && /* @__PURE__ */ _(
1037
1037
  "button",
1038
1038
  {
1039
1039
  type: "button",
@@ -1045,7 +1045,7 @@ const Fn = ({
1045
1045
  ]
1046
1046
  }
1047
1047
  ),
1048
- xe ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
1048
+ ke ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
1049
1049
  /* @__PURE__ */ _("div", { className: "ll-expanded__topbar-left", children: [
1050
1050
  /* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
1051
1051
  /* @__PURE__ */ _(
@@ -1053,45 +1053,45 @@ const Fn = ({
1053
1053
  {
1054
1054
  type: "button",
1055
1055
  className: "ll-hpill",
1056
- onClick: (y) => {
1057
- pe && (y.stopPropagation(), a());
1056
+ onClick: (v) => {
1057
+ oe && (v.stopPropagation(), a());
1058
1058
  },
1059
- "aria-haspopup": pe ? "listbox" : void 0,
1060
- "aria-expanded": pe ? m : void 0,
1059
+ "aria-haspopup": oe ? "listbox" : void 0,
1060
+ "aria-expanded": oe ? m : void 0,
1061
1061
  children: [
1062
1062
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1063
- pe && /* @__PURE__ */ n(Ye, {})
1063
+ oe && /* @__PURE__ */ n(Ke, {})
1064
1064
  ]
1065
1065
  }
1066
1066
  ),
1067
- pe && m && /* @__PURE__ */ n(
1067
+ oe && m && /* @__PURE__ */ n(
1068
1068
  "div",
1069
1069
  {
1070
1070
  className: "ll-hmenu",
1071
- onClick: (y) => y.stopPropagation(),
1071
+ onClick: (v) => v.stopPropagation(),
1072
1072
  role: "listbox",
1073
- children: d == null ? void 0 : d.map((y) => /* @__PURE__ */ _(
1073
+ children: d == null ? void 0 : d.map((v) => /* @__PURE__ */ _(
1074
1074
  "button",
1075
1075
  {
1076
1076
  type: "button",
1077
- className: `ll-hmenu__item ${y.id === u ? "is-active" : ""}`,
1078
- onClick: () => s(y.id),
1077
+ className: `ll-hmenu__item ${v.id === u ? "is-active" : ""}`,
1078
+ onClick: () => c(v.id),
1079
1079
  role: "option",
1080
- "aria-selected": y.id === u,
1080
+ "aria-selected": v.id === u,
1081
1081
  children: [
1082
- y.avatarImageUrl && /* @__PURE__ */ n(
1082
+ v.avatarImageUrl && /* @__PURE__ */ n(
1083
1083
  "img",
1084
1084
  {
1085
- src: y.avatarImageUrl,
1085
+ src: v.avatarImageUrl,
1086
1086
  alt: "",
1087
1087
  className: "ll-hmenu__avatar"
1088
1088
  }
1089
1089
  ),
1090
- /* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: y.name }),
1091
- y.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: y.role })
1090
+ /* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: v.name }),
1091
+ v.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: v.role })
1092
1092
  ]
1093
1093
  },
1094
- y.id
1094
+ v.id
1095
1095
  ))
1096
1096
  }
1097
1097
  )
@@ -1102,8 +1102,8 @@ const Fn = ({
1102
1102
  {
1103
1103
  type: "button",
1104
1104
  className: "ll-hpill ll-hpill--compact",
1105
- onClick: (y) => {
1106
- y.stopPropagation(), C();
1105
+ onClick: (v) => {
1106
+ v.stopPropagation(), C();
1107
1107
  },
1108
1108
  "aria-haspopup": "listbox",
1109
1109
  "aria-expanded": A,
@@ -1111,7 +1111,7 @@ const Fn = ({
1111
1111
  title: "Language: English",
1112
1112
  children: [
1113
1113
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
1114
- /* @__PURE__ */ n(Ye, {})
1114
+ /* @__PURE__ */ n(Ke, {})
1115
1115
  ]
1116
1116
  }
1117
1117
  ),
@@ -1119,7 +1119,7 @@ const Fn = ({
1119
1119
  "div",
1120
1120
  {
1121
1121
  className: "ll-hmenu",
1122
- onClick: (y) => y.stopPropagation(),
1122
+ onClick: (v) => v.stopPropagation(),
1123
1123
  role: "listbox",
1124
1124
  children: /* @__PURE__ */ n(
1125
1125
  "button",
@@ -1148,10 +1148,10 @@ const Fn = ({
1148
1148
  {
1149
1149
  type: "button",
1150
1150
  className: "ll-hbtn",
1151
- onClick: We,
1151
+ onClick: Fe,
1152
1152
  "aria-label": "Minimize widget",
1153
1153
  title: "Minimize",
1154
- children: /* @__PURE__ */ n(Pt, {})
1154
+ children: /* @__PURE__ */ n($t, {})
1155
1155
  }
1156
1156
  ),
1157
1157
  /* @__PURE__ */ n(
@@ -1159,26 +1159,26 @@ const Fn = ({
1159
1159
  {
1160
1160
  type: "button",
1161
1161
  className: "ll-hbtn ll-hbtn--danger",
1162
- onClick: Ae,
1162
+ onClick: Ue,
1163
1163
  "aria-label": "End call",
1164
1164
  title: "End call",
1165
- children: /* @__PURE__ */ n(Tt, {})
1165
+ children: /* @__PURE__ */ n(Dt, {})
1166
1166
  }
1167
1167
  )
1168
1168
  ] })
1169
1169
  ] }) : (
1170
1170
  // Idle-state header with Live Layer product name + minimize/close
1171
1171
  /* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1172
- /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ze }),
1172
+ /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ie }),
1173
1173
  /* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
1174
1174
  /* @__PURE__ */ n(
1175
1175
  "button",
1176
1176
  {
1177
1177
  type: "button",
1178
1178
  className: "ll-hbtn ll-hbtn--ghost",
1179
- onClick: We,
1179
+ onClick: Fe,
1180
1180
  "aria-label": "Minimize widget",
1181
- children: /* @__PURE__ */ n(Pt, {})
1181
+ children: /* @__PURE__ */ n($t, {})
1182
1182
  }
1183
1183
  ),
1184
1184
  /* @__PURE__ */ n(
@@ -1186,41 +1186,41 @@ const Fn = ({
1186
1186
  {
1187
1187
  type: "button",
1188
1188
  className: "ll-hbtn ll-hbtn--danger",
1189
- onClick: Ae,
1189
+ onClick: Ue,
1190
1190
  "aria-label": "Close widget",
1191
- children: /* @__PURE__ */ n(Tt, {})
1191
+ children: /* @__PURE__ */ n(Dt, {})
1192
1192
  }
1193
1193
  )
1194
1194
  ] })
1195
1195
  ] })
1196
1196
  ),
1197
- V && /* @__PURE__ */ (() => {
1198
- const y = D ? "Restart paused session" : R === "disconnected" ? "Reconnect to agent" : "Start video call", W = D ? "Pick up where you left off" : null;
1199
- return /* @__PURE__ */ _(qt, { children: [
1200
- R === "idle" && !D && !z && /* @__PURE__ */ _(
1197
+ fe && /* @__PURE__ */ (() => {
1198
+ const v = z ? "Restart paused session" : R === "disconnected" ? "Reconnect to agent" : "Start video call", Y = z ? "Pick up where you left off" : null;
1199
+ return /* @__PURE__ */ _(Ft, { children: [
1200
+ R === "idle" && !z && !O && /* @__PURE__ */ _(
1201
1201
  "button",
1202
1202
  {
1203
1203
  type: "button",
1204
1204
  className: "ll-expanded__play",
1205
- onClick: fe,
1206
- "aria-label": y,
1205
+ onClick: me,
1206
+ "aria-label": v,
1207
1207
  children: [
1208
1208
  /* @__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" }) }) }),
1209
- /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: y })
1209
+ /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: v })
1210
1210
  ]
1211
1211
  }
1212
1212
  ),
1213
1213
  /* @__PURE__ */ _("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1214
1214
  l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
1215
- W && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: W }),
1215
+ Y && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: Y }),
1216
1216
  /* @__PURE__ */ n(
1217
1217
  "button",
1218
1218
  {
1219
1219
  type: "button",
1220
1220
  className: "ll-expanded__cta",
1221
- onClick: fe,
1222
- "aria-label": y,
1223
- children: y
1221
+ onClick: me,
1222
+ "aria-label": v,
1223
+ children: v
1224
1224
  }
1225
1225
  )
1226
1226
  ] })
@@ -1229,40 +1229,40 @@ const Fn = ({
1229
1229
  /* @__PURE__ */ _(
1230
1230
  "div",
1231
1231
  {
1232
- className: `ll-expanded__pip ${xe && (x || Q) ? "is-visible" : ""}`,
1232
+ className: `ll-expanded__pip ${ke && (x || Z) ? "is-visible" : ""}`,
1233
1233
  children: [
1234
1234
  /* @__PURE__ */ n(
1235
1235
  "div",
1236
1236
  {
1237
- ref: oe,
1238
- className: Q ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1237
+ ref: Re,
1238
+ className: Z ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1239
1239
  }
1240
1240
  ),
1241
1241
  /* @__PURE__ */ n(
1242
1242
  "div",
1243
1243
  {
1244
- ref: Ie,
1245
- className: !Q && x ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1244
+ ref: V,
1245
+ className: !Z && x ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1246
1246
  }
1247
1247
  )
1248
1248
  ]
1249
1249
  }
1250
1250
  ),
1251
- xe ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
1252
- ke && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: ke }) }),
1253
- /* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (y) => y.stopPropagation(), children: [
1254
- Be && /* @__PURE__ */ n(
1251
+ ke ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
1252
+ Ve && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ve }) }),
1253
+ /* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (v) => v.stopPropagation(), children: [
1254
+ Oe && /* @__PURE__ */ n(
1255
1255
  "button",
1256
1256
  {
1257
1257
  type: "button",
1258
- className: `ll-tool ${Q ? "is-on" : ""}`,
1259
- onClick: q,
1260
- "aria-label": Q ? "Stop sharing screen" : "Share screen",
1261
- title: Q ? "Stop sharing" : "Share screen",
1262
- children: /* @__PURE__ */ n(Yn, {})
1258
+ className: `ll-tool ${Z ? "is-on" : ""}`,
1259
+ onClick: xe,
1260
+ "aria-label": Z ? "Stop sharing screen" : "Share screen",
1261
+ title: Z ? "Stop sharing" : "Share screen",
1262
+ children: /* @__PURE__ */ n(Xn, {})
1263
1263
  }
1264
1264
  ),
1265
- qe && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
1265
+ He && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
1266
1266
  /* @__PURE__ */ n(
1267
1267
  "button",
1268
1268
  {
@@ -1271,7 +1271,7 @@ const Fn = ({
1271
1271
  onClick: we,
1272
1272
  "aria-label": x ? "Turn off camera" : "Turn on camera",
1273
1273
  title: x ? "Stop camera" : "Start camera",
1274
- children: /* @__PURE__ */ n(Gn, {})
1274
+ children: /* @__PURE__ */ n(Qn, {})
1275
1275
  }
1276
1276
  ),
1277
1277
  /* @__PURE__ */ n(
@@ -1279,23 +1279,23 @@ const Fn = ({
1279
1279
  {
1280
1280
  type: "button",
1281
1281
  className: `ll-tool ll-tool--right ${x ? "is-on" : ""}`,
1282
- onClick: (y) => {
1283
- y.stopPropagation(), Y((W) => !W), ne(!1);
1282
+ onClick: (v) => {
1283
+ v.stopPropagation(), ae((Y) => !Y), X(!1);
1284
1284
  },
1285
1285
  "aria-label": "Camera devices",
1286
1286
  "aria-haspopup": "listbox",
1287
- "aria-expanded": le,
1288
- children: /* @__PURE__ */ n(Ye, {})
1287
+ "aria-expanded": ie,
1288
+ children: /* @__PURE__ */ n(Ke, {})
1289
1289
  }
1290
1290
  ),
1291
- le && X.length > 0 && /* @__PURE__ */ n(
1292
- Dt,
1291
+ ie && Q.length > 0 && /* @__PURE__ */ n(
1292
+ zt,
1293
1293
  {
1294
1294
  label: "Camera",
1295
- devices: X,
1295
+ devices: Q,
1296
1296
  activeId: de,
1297
- onPick: (y) => {
1298
- Y(!1), _e(y);
1297
+ onPick: (v) => {
1298
+ ae(!1), _e(v);
1299
1299
  }
1300
1300
  }
1301
1301
  )
@@ -1309,7 +1309,7 @@ const Fn = ({
1309
1309
  onClick: be,
1310
1310
  "aria-label": p ? "Unmute microphone" : "Mute microphone",
1311
1311
  title: p ? "Unmute" : "Mute",
1312
- children: /* @__PURE__ */ n(Jn, { muted: p })
1312
+ children: /* @__PURE__ */ n(Zn, { muted: p })
1313
1313
  }
1314
1314
  ),
1315
1315
  /* @__PURE__ */ n(
@@ -1317,22 +1317,22 @@ const Fn = ({
1317
1317
  {
1318
1318
  type: "button",
1319
1319
  className: `ll-tool ll-tool--right ${p ? "is-muted" : ""}`,
1320
- onClick: (y) => {
1321
- y.stopPropagation(), ne((W) => !W), Y(!1);
1320
+ onClick: (v) => {
1321
+ v.stopPropagation(), X((Y) => !Y), ae(!1);
1322
1322
  },
1323
1323
  "aria-label": "Microphone devices",
1324
1324
  "aria-haspopup": "listbox",
1325
- "aria-expanded": J,
1326
- children: /* @__PURE__ */ n(Ye, {})
1325
+ "aria-expanded": te,
1326
+ children: /* @__PURE__ */ n(Ke, {})
1327
1327
  }
1328
1328
  ),
1329
- J && E.length > 0 && /* @__PURE__ */ n(
1330
- Dt,
1329
+ te && E.length > 0 && /* @__PURE__ */ n(
1330
+ zt,
1331
1331
  {
1332
1332
  label: "Microphone",
1333
1333
  devices: E,
1334
1334
  activeId: "",
1335
- onPick: () => ne(!1)
1335
+ onPick: () => X(!1)
1336
1336
  }
1337
1337
  )
1338
1338
  ] }),
@@ -1341,32 +1341,32 @@ const Fn = ({
1341
1341
  {
1342
1342
  type: "button",
1343
1343
  className: `ll-tool ${ue ? "is-muted" : ""}`,
1344
- onClick: Qe,
1344
+ onClick: F,
1345
1345
  "aria-label": ue ? "Unmute speaker" : "Mute speaker",
1346
1346
  title: ue ? "Unmute speaker" : "Mute speaker",
1347
- children: /* @__PURE__ */ n(Kn, { muted: ue })
1347
+ children: /* @__PURE__ */ n(er, { muted: ue })
1348
1348
  }
1349
1349
  )
1350
1350
  ] }),
1351
- Fe && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: Me, children: [
1351
+ qe && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: pe, children: [
1352
1352
  /* @__PURE__ */ n(
1353
1353
  "input",
1354
1354
  {
1355
1355
  type: "text",
1356
1356
  className: "ll-message-input__field",
1357
1357
  placeholder: "Message...",
1358
- value: K,
1359
- onChange: (y) => ae(y.target.value),
1358
+ value: J,
1359
+ onChange: (v) => ne(v.target.value),
1360
1360
  "aria-label": "Message the agent"
1361
1361
  }
1362
1362
  ),
1363
- K.trim() && /* @__PURE__ */ n(
1363
+ J.trim() && /* @__PURE__ */ n(
1364
1364
  "button",
1365
1365
  {
1366
1366
  type: "submit",
1367
1367
  className: "ll-message-input__send",
1368
1368
  "aria-label": "Send message",
1369
- children: /* @__PURE__ */ n(Xn, {})
1369
+ children: /* @__PURE__ */ n(tr, {})
1370
1370
  }
1371
1371
  )
1372
1372
  ] }),
@@ -1389,23 +1389,23 @@ const Fn = ({
1389
1389
  {
1390
1390
  type: "button",
1391
1391
  className: "ll-expanded__banner-x",
1392
- onClick: Re,
1392
+ onClick: je,
1393
1393
  "aria-label": "Dismiss",
1394
1394
  children: "×"
1395
1395
  }
1396
1396
  )
1397
1397
  ] });
1398
- if (!z || R !== "error") return null;
1399
- let y = "Failed to connect", W = "Try again";
1400
- return z === "MIC_PERMISSION_DENIED" ? y = "Microphone blocked. Allow access to talk." : z === "MIC_NOT_FOUND" ? y = "No microphone found. Plug one in + retry." : z === "MIC_UNAVAILABLE" ? y = "Mic unavailable. Check other apps using it." : z === "AGENT_TIMEOUT" ? y = "Agent didn't pick up. Try again." : z === "CONNECT_FAILED" ? y = "Connection failed. Check your network." : z.length < 80 && (y = z), /* @__PURE__ */ _("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1401
- /* @__PURE__ */ n("span", { children: y }),
1398
+ if (!O || R !== "error") return null;
1399
+ let v = "Failed to connect", Y = "Try again";
1400
+ return O === "MIC_PERMISSION_DENIED" ? v = "Microphone blocked. Allow access to talk." : O === "MIC_NOT_FOUND" ? v = "No microphone found. Plug one in + retry." : O === "MIC_UNAVAILABLE" ? v = "Mic unavailable. Check other apps using it." : O === "AGENT_TIMEOUT" ? v = "Agent didn't pick up. Try again." : O === "CONNECT_FAILED" ? v = "Connection failed. Check your network." : O.length < 80 && (v = O), /* @__PURE__ */ _("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1401
+ /* @__PURE__ */ n("span", { children: v }),
1402
1402
  /* @__PURE__ */ n(
1403
1403
  "button",
1404
1404
  {
1405
1405
  type: "button",
1406
1406
  className: "ll-expanded__banner-retry",
1407
1407
  onClick: ye,
1408
- children: W
1408
+ children: Y
1409
1409
  }
1410
1410
  )
1411
1411
  ] });
@@ -1414,32 +1414,32 @@ const Fn = ({
1414
1414
  }
1415
1415
  );
1416
1416
  };
1417
- function Ye() {
1417
+ function Ke() {
1418
1418
  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" }) });
1419
1419
  }
1420
- function Tt() {
1420
+ function Dt() {
1421
1421
  return /* @__PURE__ */ _("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1422
1422
  /* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1423
1423
  /* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1424
1424
  ] });
1425
1425
  }
1426
- function Pt() {
1426
+ function $t() {
1427
1427
  return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
1428
1428
  }
1429
- function Yn() {
1429
+ function Xn() {
1430
1430
  return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1431
1431
  /* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
1432
1432
  /* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
1433
1433
  /* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
1434
1434
  ] });
1435
1435
  }
1436
- function Gn() {
1436
+ function Qn() {
1437
1437
  return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1438
1438
  /* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
1439
1439
  /* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
1440
1440
  ] });
1441
1441
  }
1442
- function Jn({ muted: e }) {
1442
+ function Zn({ muted: e }) {
1443
1443
  return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1444
1444
  /* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
1445
1445
  /* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
@@ -1447,64 +1447,64 @@ function Jn({ muted: e }) {
1447
1447
  e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
1448
1448
  ] });
1449
1449
  }
1450
- function Kn({ muted: e }) {
1450
+ function er({ muted: e }) {
1451
1451
  return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1452
1452
  /* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1453
- e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(qt, { children: [
1453
+ e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(Ft, { children: [
1454
1454
  /* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
1455
1455
  /* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
1456
1456
  ] })
1457
1457
  ] });
1458
1458
  }
1459
- function Xn() {
1459
+ function tr() {
1460
1460
  return /* @__PURE__ */ _("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1461
1461
  /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
1462
1462
  /* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
1463
1463
  ] });
1464
1464
  }
1465
- const Dt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ _(
1465
+ const zt = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */ _(
1466
1466
  "div",
1467
1467
  {
1468
1468
  className: "ll-device-menu",
1469
- onClick: (o) => o.stopPropagation(),
1469
+ onClick: (i) => i.stopPropagation(),
1470
1470
  role: "listbox",
1471
1471
  children: [
1472
1472
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1473
- t.map((o, l) => {
1474
- const c = r === o.deviceId;
1473
+ t.map((i, l) => {
1474
+ const s = r === i.deviceId;
1475
1475
  return /* @__PURE__ */ _(
1476
1476
  "button",
1477
1477
  {
1478
1478
  type: "button",
1479
- className: `ll-device-menu__item ${c ? "is-active" : ""}`,
1480
- onClick: () => i(o.deviceId),
1479
+ className: `ll-device-menu__item ${s ? "is-active" : ""}`,
1480
+ onClick: () => o(i.deviceId),
1481
1481
  role: "option",
1482
- "aria-selected": c,
1482
+ "aria-selected": s,
1483
1483
  children: [
1484
- c && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1485
- /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
1484
+ s && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1485
+ /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: i.label || `${e} ${l + 1}` })
1486
1486
  ]
1487
1487
  },
1488
- o.deviceId || l
1488
+ i.deviceId || l
1489
1489
  );
1490
1490
  })
1491
1491
  ]
1492
1492
  }
1493
- ), Qn = [
1493
+ ), nr = [
1494
1494
  '[data-ll-private="true"]',
1495
1495
  ".ll-widget"
1496
1496
  ];
1497
- function ct(e) {
1497
+ function ut(e) {
1498
1498
  let t = e;
1499
1499
  for (; t; ) {
1500
- for (const r of Qn)
1500
+ for (const r of nr)
1501
1501
  if (t.matches(r)) return !0;
1502
1502
  t = t.parentElement;
1503
1503
  }
1504
1504
  return !1;
1505
1505
  }
1506
- function Xe(e) {
1507
- if (ct(e)) return !1;
1506
+ function et(e) {
1507
+ if (ut(e)) return !1;
1508
1508
  if (e instanceof HTMLInputElement) {
1509
1509
  if (e.type === "password") return !1;
1510
1510
  const t = (e.getAttribute("autocomplete") || "").toLowerCase();
@@ -1512,7 +1512,7 @@ function Xe(e) {
1512
1512
  }
1513
1513
  return !0;
1514
1514
  }
1515
- const Ge = 4096, Zn = 20, er = 20, tr = 10, nr = 10, rr = 30, $t = 500, ir = [
1515
+ const Xe = 4096, rr = 20, or = 20, ir = 10, lr = 10, ar = 30, Ht = 500, cr = [
1516
1516
  '[data-ll-private="true"]',
1517
1517
  ".ll-widget",
1518
1518
  "script",
@@ -1520,24 +1520,24 @@ const Ge = 4096, Zn = 20, er = 20, tr = 10, nr = 10, rr = 30, $t = 500, ir = [
1520
1520
  "noscript",
1521
1521
  "iframe"
1522
1522
  ];
1523
- function Oe(e) {
1523
+ function $e(e) {
1524
1524
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
1525
1525
  let t = e;
1526
1526
  for (; t; ) {
1527
- for (const r of ir)
1527
+ for (const r of cr)
1528
1528
  if (t.matches(r)) return !0;
1529
1529
  t = t.parentElement;
1530
1530
  }
1531
1531
  return !1;
1532
1532
  }
1533
- function He(e) {
1533
+ function ze(e) {
1534
1534
  if (typeof window > "u") return !0;
1535
1535
  const t = e.getBoundingClientRect();
1536
1536
  if (t.width <= 0 || t.height <= 0) return !1;
1537
- const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
1538
- return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
1537
+ const r = window.innerHeight || document.documentElement.clientHeight, o = window.innerWidth || document.documentElement.clientWidth;
1538
+ return t.bottom > 0 && t.right > 0 && t.top < r && t.left < o;
1539
1539
  }
1540
- function zt(e) {
1540
+ function Ot(e) {
1541
1541
  const t = e.getAttribute("id");
1542
1542
  if (t) {
1543
1543
  const l = document.querySelector(`label[for="${CSS.escape(t)}"]`);
@@ -1545,18 +1545,18 @@ function zt(e) {
1545
1545
  }
1546
1546
  const r = e.getAttribute("aria-label");
1547
1547
  if (r) return r.trim();
1548
- const i = e.getAttribute("placeholder");
1549
- if (i) return i.trim();
1550
- const o = e.closest("label");
1551
- return o != null && o.textContent ? o.textContent.trim() : "";
1548
+ const o = e.getAttribute("placeholder");
1549
+ if (o) return o.trim();
1550
+ const i = e.closest("label");
1551
+ return i != null && i.textContent ? i.textContent.trim() : "";
1552
1552
  }
1553
- function me(e, t) {
1553
+ function he(e, t) {
1554
1554
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
1555
1555
  }
1556
- function Se(e) {
1556
+ function Ee(e) {
1557
1557
  return e.length;
1558
1558
  }
1559
- function or(e, t = {}) {
1559
+ function sr(e, t = {}) {
1560
1560
  const r = t.doc ?? (typeof document < "u" ? document : null);
1561
1561
  if (!r)
1562
1562
  return {
@@ -1570,15 +1570,15 @@ function or(e, t = {}) {
1570
1570
  forms: [],
1571
1571
  extras: e
1572
1572
  };
1573
- const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
1573
+ const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
1574
1574
  r.querySelectorAll("[data-ll-region]")
1575
1575
  ), d = [];
1576
- for (const p of c) {
1577
- if (d.length >= tr) break;
1578
- if (Oe(p) || !He(p)) continue;
1579
- const g = p.getAttribute("data-ll-region") ?? "", E = p.getAttribute("data-ll-intent") ?? void 0, x = me(
1576
+ for (const p of s) {
1577
+ if (d.length >= ir) break;
1578
+ if ($e(p) || !ze(p)) continue;
1579
+ const g = p.getAttribute("data-ll-region") ?? "", E = p.getAttribute("data-ll-intent") ?? void 0, x = he(
1580
1580
  (p.innerText || p.textContent || "").trim(),
1581
- $t * 2
1581
+ Ht * 2
1582
1582
  );
1583
1583
  !g || !x || d.push({ id: g, intent: E, text: x });
1584
1584
  }
@@ -1586,23 +1586,23 @@ function or(e, t = {}) {
1586
1586
  r.querySelectorAll("h1, h2, h3, h4, h5, h6")
1587
1587
  );
1588
1588
  for (const p of m) {
1589
- if (Oe(p) || !He(p)) continue;
1589
+ if ($e(p) || !ze(p)) continue;
1590
1590
  const g = (p.textContent || "").trim();
1591
- g && u.push(`${p.tagName}: ${me(g, 200)}`);
1591
+ g && u.push(`${p.tagName}: ${he(g, 200)}`);
1592
1592
  }
1593
1593
  const a = Array.from(r.querySelectorAll("p, li"));
1594
1594
  for (const p of a) {
1595
- if (Oe(p) || !He(p) || h.includes(p.tagName)) continue;
1595
+ if ($e(p) || !ze(p) || h.includes(p.tagName)) continue;
1596
1596
  const g = (p.textContent || "").trim();
1597
- g.length > 10 && u.push(me(g, $t));
1597
+ g.length > 10 && u.push(he(g, Ht));
1598
1598
  }
1599
- const s = u.join(`
1599
+ const c = u.join(`
1600
1600
  `), A = [], C = Array.from(r.querySelectorAll("a[href]"));
1601
1601
  for (const p of C) {
1602
- if (A.length >= Zn) break;
1603
- if (Oe(p) || !He(p)) continue;
1602
+ if (A.length >= rr) break;
1603
+ if ($e(p) || !ze(p)) continue;
1604
1604
  const g = p.getAttribute("href") || "", E = (p.textContent || "").trim();
1605
- !g || !E || A.push({ href: g, text: me(E, 100) });
1605
+ !g || !E || A.push({ href: g, text: he(E, 100) });
1606
1606
  }
1607
1607
  const R = [], b = Array.from(
1608
1608
  r.querySelectorAll(
@@ -1610,76 +1610,86 @@ function or(e, t = {}) {
1610
1610
  )
1611
1611
  );
1612
1612
  for (const p of b) {
1613
- if (R.length >= er) break;
1614
- if (Oe(p) || !Xe(p) || !He(p)) continue;
1615
- const g = zt(p), E = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
1616
- g && R.push({ label: me(g, 100), type: E });
1613
+ if (R.length >= or) break;
1614
+ if ($e(p) || !et(p) || !ze(p)) continue;
1615
+ const g = Ot(p), E = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
1616
+ g && R.push({ label: he(g, 100), type: E });
1617
1617
  }
1618
1618
  const L = Array.from(
1619
1619
  r.querySelectorAll("[data-ll-form]")
1620
- ), D = [];
1620
+ ), z = [];
1621
1621
  for (const p of L) {
1622
- if (D.length >= nr) break;
1623
- if (ct(p)) continue;
1622
+ if (z.length >= lr) break;
1623
+ if (ut(p)) continue;
1624
1624
  const g = p.getAttribute("data-ll-form") || "";
1625
1625
  if (!g) continue;
1626
1626
  const E = p.getAttribute("data-ll-intent") || void 0, x = Array.from(
1627
1627
  p.querySelectorAll(
1628
1628
  "[data-ll-field]"
1629
1629
  )
1630
- ), H = [];
1631
- for (const X of x) {
1632
- if (H.length >= rr) break;
1633
- if (!Xe(X)) continue;
1634
- const de = X.getAttribute("data-ll-field") || "";
1630
+ ), q = [];
1631
+ for (const Q of x) {
1632
+ if (q.length >= ar) break;
1633
+ if (!et(Q)) continue;
1634
+ const de = Q.getAttribute("data-ll-field") || "";
1635
1635
  if (!de) continue;
1636
- const Q = zt(X) || de, Z = X instanceof HTMLInputElement ? X.type : X.tagName.toLowerCase();
1637
- H.push({ name: de, label: me(Q, 100), type: Z });
1636
+ const Z = Ot(Q) || de, ee = Q instanceof HTMLInputElement ? Q.type : Q.tagName.toLowerCase();
1637
+ q.push({ name: de, label: he(Z, 100), type: ee });
1638
1638
  }
1639
- D.push({ id: g, intent: E, fields: H });
1639
+ z.push({ id: g, intent: E, fields: q });
1640
1640
  }
1641
1641
  const M = {
1642
- url: i,
1642
+ url: o,
1643
1643
  title: l,
1644
- pathname: o,
1644
+ pathname: i,
1645
1645
  regions: d,
1646
- visibleText: s,
1646
+ visibleText: c,
1647
1647
  visibleLinks: A,
1648
1648
  visibleFields: R,
1649
- forms: D,
1649
+ forms: z,
1650
1650
  extras: e
1651
1651
  };
1652
- let z = Se(JSON.stringify(M.regions)) + Se(M.visibleText) + Se(JSON.stringify(M.visibleLinks)) + Se(JSON.stringify(M.visibleFields));
1653
- for (; z > Ge && M.visibleFields.length > 0; )
1654
- M.visibleFields.pop(), z = Se(JSON.stringify(M.visibleFields));
1655
- for (; z > Ge && M.visibleLinks.length > 0; )
1656
- M.visibleLinks.pop(), z -= 80;
1657
- return Se(M.visibleText) > Ge && (M.visibleText = me(M.visibleText, Ge - 100)), M;
1658
- }
1659
- let Ce = null;
1660
- function Ot(e, t = {}) {
1661
- const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1662
- if (Ce && Ce.key === o && r - Ce.at < 1e3)
1663
- return Ce.ctx;
1664
- const l = or(e, t);
1665
- return Ce = { key: o, at: r, ctx: l }, l;
1666
- }
1667
- function lr() {
1668
- Ce = null;
1669
- }
1670
- const ar = 200;
1671
- function sr(e) {
1652
+ let O = Ee(JSON.stringify(M.regions)) + Ee(M.visibleText) + Ee(JSON.stringify(M.visibleLinks)) + Ee(JSON.stringify(M.visibleFields));
1653
+ for (; O > Xe && M.visibleFields.length > 0; )
1654
+ M.visibleFields.pop(), O = Ee(JSON.stringify(M.visibleFields));
1655
+ for (; O > Xe && M.visibleLinks.length > 0; )
1656
+ M.visibleLinks.pop(), O -= 80;
1657
+ return Ee(M.visibleText) > Xe && (M.visibleText = he(M.visibleText, Xe - 100)), M;
1658
+ }
1659
+ let Ne = null;
1660
+ function qt(e, t = {}) {
1661
+ const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1662
+ if (Ne && Ne.key === i && r - Ne.at < 1e3)
1663
+ return Ne.ctx;
1664
+ const l = sr(e, t);
1665
+ return Ne = { key: i, at: r, ctx: l }, l;
1666
+ }
1667
+ function dr() {
1668
+ Ne = null;
1669
+ }
1670
+ const ur = 200;
1671
+ function fr(e) {
1672
+ const t = String(e.href || "");
1673
+ return {
1674
+ href: t,
1675
+ text: String(e.text ?? e.title ?? t),
1676
+ internal: e.internal ?? !0,
1677
+ title: e.title,
1678
+ description: e.description
1679
+ };
1680
+ }
1681
+ function pr(e) {
1672
1682
  return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
1673
1683
  }
1674
- function cr(e) {
1684
+ function hr(e) {
1675
1685
  const t = e ?? (typeof document < "u" ? document : null);
1676
1686
  if (!t) return [];
1677
- const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
1678
- for (const c of l) {
1679
- if (o.length >= ar) break;
1680
- if (ct(c)) continue;
1681
- const d = c.getAttribute("href") || "";
1682
- if (!sr(d)) continue;
1687
+ const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
1688
+ for (const s of l) {
1689
+ if (i.length >= ur) break;
1690
+ if (ut(s)) continue;
1691
+ const d = s.getAttribute("href") || "";
1692
+ if (!pr(d)) continue;
1683
1693
  let u = d, h = !0;
1684
1694
  try {
1685
1695
  if (typeof window < "u") {
@@ -1689,42 +1699,87 @@ function cr(e) {
1689
1699
  } catch {
1690
1700
  continue;
1691
1701
  }
1692
- if (i.has(u)) continue;
1693
- i.add(u);
1694
- const m = (c.textContent || "").trim().slice(0, 120);
1695
- o.push({ href: u, text: m, internal: h });
1702
+ if (o.has(u)) continue;
1703
+ o.add(u);
1704
+ const m = (s.textContent || "").trim().slice(0, 120);
1705
+ i.push({ href: u, text: m, internal: h });
1696
1706
  }
1697
- return o;
1707
+ return i;
1698
1708
  }
1699
- let Ee = null;
1700
- const dr = 5e3;
1701
- function ur() {
1709
+ let Ae = null;
1710
+ const mr = 5e3;
1711
+ function ct() {
1702
1712
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
1703
- if (Ee && Ee.pathname === t && e - Ee.at < dr)
1704
- return Ee.routes;
1705
- const r = cr();
1706
- return Ee = { at: e, pathname: t, routes: r }, r;
1713
+ if (Ae && Ae.pathname === t && e - Ae.at < mr)
1714
+ return Ae.routes;
1715
+ const r = hr();
1716
+ return Ae = { at: e, pathname: t, routes: r }, r;
1707
1717
  }
1708
- function fr() {
1709
- Ee = null;
1718
+ function gr() {
1719
+ Ae = null;
1710
1720
  }
1711
- function pr(e, t) {
1712
- 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;
1713
- o ? o.call(e, t) : e.value = t;
1721
+ function yr(e, t) {
1722
+ const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, o = Object.getOwnPropertyDescriptor(r, "value"), i = o == null ? void 0 : o.set;
1723
+ i ? i.call(e, t) : e.value = t;
1714
1724
  }
1715
- function hr(e, t, r = {}) {
1716
- const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
1725
+ function vr(e, t, r = {}) {
1726
+ const o = r.triggerInput ?? !0, i = r.triggerChange ?? !0;
1717
1727
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
1718
1728
  const l = Object.getOwnPropertyDescriptor(
1719
1729
  HTMLInputElement.prototype,
1720
1730
  "checked"
1721
- ), c = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
1722
- c ? c.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1731
+ ), s = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
1732
+ s ? s.call(e, d) : e.checked = d, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1723
1733
  return;
1724
1734
  }
1725
- pr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1735
+ yr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1736
+ }
1737
+ function br() {
1738
+ if (typeof window > "u" || typeof document > "u")
1739
+ return !1;
1740
+ const e = document.scrollingElement || document.documentElement;
1741
+ if (!e || e.scrollHeight <= e.clientHeight + 2) return !1;
1742
+ const t = window.getComputedStyle(e);
1743
+ return !(t.overflowY === "hidden" || t.overflowY === "clip");
1744
+ }
1745
+ function wr(e) {
1746
+ if (!(e instanceof HTMLElement)) return !1;
1747
+ const r = window.getComputedStyle(e).overflowY;
1748
+ return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
1749
+ }
1750
+ function _r() {
1751
+ if (typeof document > "u") return null;
1752
+ const e = Array.from(
1753
+ document.querySelectorAll("body, body *")
1754
+ );
1755
+ let t = null, r = 0;
1756
+ for (const o of e) {
1757
+ if (!wr(o)) continue;
1758
+ const i = o.getBoundingClientRect();
1759
+ if (i.bottom <= 0 || i.top >= window.innerHeight || i.right <= 0 || i.left >= window.innerWidth || i.width <= 0 || i.height <= 0 || o.closest(".ll-widget")) continue;
1760
+ const l = i.width * i.height;
1761
+ l > r && (r = l, t = o);
1762
+ }
1763
+ return t;
1764
+ }
1765
+ function xr() {
1766
+ if (typeof window > "u")
1767
+ return null;
1768
+ if (br()) return window;
1769
+ const e = _r();
1770
+ return e || window;
1726
1771
  }
1727
- const mr = /* @__PURE__ */ new Set([
1772
+ function Bt(e) {
1773
+ return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
1774
+ }
1775
+ function kr(e) {
1776
+ var t, r;
1777
+ return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
1778
+ ((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
1779
+ ((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
1780
+ ) : e.scrollHeight - e.clientHeight;
1781
+ }
1782
+ const Lr = /* @__PURE__ */ new Set([
1728
1783
  "agent_state",
1729
1784
  "avatar_stream_ready",
1730
1785
  "avatar_active",
@@ -1747,89 +1802,90 @@ const mr = /* @__PURE__ */ new Set([
1747
1802
  "submit_form",
1748
1803
  "request_routes"
1749
1804
  ]);
1750
- function gr(e) {
1751
- var yt, vt, bt, wt, _t, xt, kt;
1805
+ function Sr(e) {
1806
+ var bt, wt, _t, xt, kt, Lt, St;
1752
1807
  const {
1753
1808
  agentId: t,
1754
1809
  apiKey: r,
1755
- baseUrl: i = "https://app.livelayer.studio",
1756
- sessionEndpoint: o,
1810
+ baseUrl: o = "https://app.livelayer.studio",
1811
+ sessionEndpoint: i,
1757
1812
  sessionBody: l,
1758
- autoConnect: c = !1,
1813
+ autoConnect: s = !1,
1759
1814
  displayMode: d,
1760
1815
  defaultDisplayMode: u = "expanded",
1761
1816
  onDisplayModeChange: h,
1762
1817
  position: m = "bottom-right",
1763
1818
  mobileBreakpoint: a = 640,
1764
- persistKey: s = "ll-widget",
1819
+ persistKey: c = "ll-widget",
1765
1820
  disablePersistence: A = !1,
1766
1821
  teamMembers: C,
1767
1822
  currentTeamMemberId: R,
1768
1823
  onTeamMemberChange: b,
1769
1824
  idleLoopUrl: L,
1770
- greeting: D,
1825
+ greeting: z,
1771
1826
  avatarImageUrl: M,
1772
- agentName: z,
1827
+ agentName: O,
1773
1828
  branding: p = {},
1774
1829
  allowCamera: g = !0,
1775
1830
  allowScreenShare: E = !0,
1776
1831
  allowTyping: x = !0,
1777
- showOn: H,
1778
- hideOn: X,
1832
+ showOn: q,
1833
+ hideOn: Q,
1779
1834
  pathname: de,
1780
- onNavigate: Q,
1781
- onScrollToSelector: Z,
1835
+ onNavigate: Z,
1836
+ onScrollToSelector: ee,
1782
1837
  getPageContext: ue,
1783
- pageContextExtras: qe,
1784
- onScrollPage: Be,
1785
- onClick: Fe,
1786
- capabilities: Ne,
1787
- onConnect: fe,
1788
- onDisconnect: ge,
1789
- onTranscript: ye,
1790
- onAgentState: ve,
1791
- onConnectionStateChange: be,
1792
- onAgentEvent: we,
1793
- onAgentCommand: _e,
1794
- controlledSession: q,
1795
- className: Qe,
1796
- style: Ue,
1797
- zIndex: We = 2147483647
1798
- } = e, Ae = Nn(de), Re = Dn(Ae, H, X);
1838
+ pageContextExtras: He,
1839
+ getRoutes: Oe,
1840
+ onScrollPage: qe,
1841
+ onClick: Be,
1842
+ capabilities: me,
1843
+ onConnect: ge,
1844
+ onDisconnect: ye,
1845
+ onTranscript: ve,
1846
+ onAgentState: be,
1847
+ onConnectionStateChange: we,
1848
+ onAgentEvent: _e,
1849
+ onAgentCommand: xe,
1850
+ controlledSession: F,
1851
+ className: We,
1852
+ style: Fe,
1853
+ zIndex: Ue = 2147483647
1854
+ } = e, je = Mn(de), le = On(je, q, Q);
1799
1855
  P(() => {
1800
- lr(), fr();
1801
- }, [Ae]);
1802
- const ie = R !== void 0, [pe, xe] = N(() => {
1803
- var v;
1804
- return R ?? ((v = C == null ? void 0 : C[0]) == null ? void 0 : v.id);
1805
- }), ee = ie ? R : pe, V = Je(
1806
- () => (C == null ? void 0 : C.find((v) => v.id === ee)) ?? null,
1807
- [C, ee]
1808
- ), Ie = (V == null ? void 0 : V.agentId) ?? t, [oe, J] = Ln({
1856
+ dr(), gr();
1857
+ }, [je]);
1858
+ const oe = R !== void 0, [ke, Le] = N(() => {
1859
+ var y;
1860
+ return R ?? ((y = C == null ? void 0 : C[0]) == null ? void 0 : y.id);
1861
+ }), fe = oe ? R : ke, V = Qe(
1862
+ () => (C == null ? void 0 : C.find((y) => y.id === fe)) ?? null,
1863
+ [C, fe]
1864
+ ), Re = (V == null ? void 0 : V.agentId) ?? t, [te, X] = Nn({
1809
1865
  value: d,
1810
1866
  defaultValue: u,
1811
1867
  onChange: h,
1812
- persistKey: s,
1868
+ persistKey: c,
1813
1869
  disablePersistence: A
1814
- }), ne = Cn(a), le = fn(), Y = pn(), K = mn(), ae = gn(), Me = yn(), [Ze, ke] = N(!1), [Te, Pe] = N(!1), [y, W] = N(!1), [dt, Ut] = N(!1), [et, Wt] = N(!1), tt = I(Q), nt = I(Z), rt = I(Be), it = I(Fe), ut = I(ue), ft = I(qe), ot = I(Ne), te = I(null);
1815
- tt.current = Q, nt.current = Z, rt.current = Be, it.current = Fe, ut.current = ue, ft.current = qe, ot.current = Ne;
1816
- function se(v) {
1817
- const f = ot.current;
1818
- return f ? f.includes(v) : !0;
1870
+ }), ie = Rn(a), ae = gn(), J = yn(), ne = bn(), pe = wn(), Ie = _n(), [Ve, Me] = N(!1), [Se, v] = N(!1), [Y, Ye] = N(!1), [Vt, Yt] = N(!1), [tt, Gt] = N(!1), nt = I(Z), rt = I(ee), ot = I(qe), it = I(Be), ft = I(ue), pt = I(He), ht = I(Oe), lt = I(me), re = I(null);
1871
+ nt.current = Z, rt.current = ee, ot.current = qe, it.current = Be, ft.current = ue, pt.current = He, ht.current = Oe, lt.current = me;
1872
+ function ce(y) {
1873
+ const f = lt.current;
1874
+ return f ? f.includes(y) : !0;
1819
1875
  }
1820
- function ce(v, f) {
1876
+ function se(y, f) {
1821
1877
  console.warn(
1822
- `[LiveLayer] Agent command "${v}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1878
+ `[LiveLayer] Agent command "${y}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1823
1879
  );
1824
1880
  }
1825
- const De = S(
1826
- (v) => {
1827
- var G, je, Ve, Lt;
1828
- const f = v;
1881
+ const Te = S(
1882
+ (y) => {
1883
+ var K, Ge, Je, Ct;
1884
+ const f = y;
1829
1885
  if (!(!f.type || typeof f.type != "string")) {
1830
- if (we == null || we({ eventName: f.type, data: v }), f.type === "navigate") {
1831
- if (!se("navigate")) {
1832
- ce("navigate", "navigate");
1886
+ if (_e == null || _e({ eventName: f.type, data: y }), f.type === "navigate") {
1887
+ if (!ce("navigate")) {
1888
+ se("navigate", "navigate");
1833
1889
  return;
1834
1890
  }
1835
1891
  const k = typeof f.href == "string" ? f.href : null;
@@ -1839,9 +1895,9 @@ function gr(e) {
1839
1895
  );
1840
1896
  return;
1841
1897
  }
1842
- if (tt.current) {
1898
+ if (nt.current) {
1843
1899
  try {
1844
- tt.current(k);
1900
+ nt.current(k);
1845
1901
  } catch (T) {
1846
1902
  console.warn(
1847
1903
  `[LiveLayer] onNavigate threw for "${k}". Falling back. Error:`,
@@ -1871,41 +1927,41 @@ function gr(e) {
1871
1927
  return;
1872
1928
  }
1873
1929
  if (f.type === "scroll_to") {
1874
- if (!se("scroll")) {
1875
- ce("scroll_to", "scroll");
1930
+ if (!ce("scroll")) {
1931
+ se("scroll_to", "scroll");
1876
1932
  return;
1877
1933
  }
1878
1934
  const k = typeof f.selector == "string" ? f.selector : null;
1879
1935
  if (!k) return;
1880
1936
  const T = f.behavior === "instant" ? "instant" : "smooth";
1881
- if (nt.current) {
1937
+ if (rt.current) {
1882
1938
  try {
1883
- nt.current(
1939
+ rt.current(
1884
1940
  k,
1885
1941
  T
1886
1942
  );
1887
- } catch ($) {
1888
- console.warn("[LiveLayer] onScrollToSelector threw.", $);
1943
+ } catch (H) {
1944
+ console.warn("[LiveLayer] onScrollToSelector threw.", H);
1889
1945
  }
1890
1946
  return;
1891
1947
  }
1892
1948
  if (typeof document < "u") {
1893
- let $ = null;
1949
+ let H = null;
1894
1950
  try {
1895
- $ = document.querySelector(k);
1951
+ H = document.querySelector(k);
1896
1952
  } catch {
1897
1953
  console.warn(
1898
1954
  `[LiveLayer] scroll_to: invalid selector "${k}".`
1899
1955
  );
1900
1956
  return;
1901
1957
  }
1902
- if (!$) {
1958
+ if (!H) {
1903
1959
  console.warn(
1904
1960
  `[LiveLayer] scroll_to: no element matched "${k}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
1905
1961
  );
1906
1962
  return;
1907
1963
  }
1908
- $.scrollIntoView({
1964
+ H.scrollIntoView({
1909
1965
  behavior: T,
1910
1966
  block: "start"
1911
1967
  });
@@ -1913,56 +1969,56 @@ function gr(e) {
1913
1969
  return;
1914
1970
  }
1915
1971
  if (f.type === "request_page_context") {
1916
- if (!se("read_page")) {
1917
- ce("request_page_context", "read_page");
1972
+ if (!ce("read_page")) {
1973
+ se("request_page_context", "read_page");
1918
1974
  return;
1919
1975
  }
1920
- const k = typeof f.requestId == "string" ? f.requestId : void 0, T = (G = te.current) == null ? void 0 : G.call(te), $ = (F) => {
1921
- const j = T, re = j == null ? void 0 : j.localParticipant;
1922
- if (re != null && re.publishData)
1976
+ const k = typeof f.requestId == "string" ? f.requestId : void 0, T = (K = re.current) == null ? void 0 : K.call(re), H = (W) => {
1977
+ const D = T, j = D == null ? void 0 : D.localParticipant;
1978
+ if (j != null && j.publishData)
1923
1979
  try {
1924
- const he = k ? { ...F, requestId: k } : F, Le = new TextEncoder().encode(JSON.stringify(he));
1925
- re.publishData(Le, { reliable: !0 });
1926
- } catch (he) {
1927
- console.warn("[LiveLayer] publishData failed.", he);
1980
+ const G = k ? { ...W, requestId: k } : W, Ce = new TextEncoder().encode(JSON.stringify(G));
1981
+ j.publishData(Ce, { reliable: !0 });
1982
+ } catch (G) {
1983
+ console.warn("[LiveLayer] publishData failed.", G);
1928
1984
  }
1929
- }, O = ft.current, B = ut.current;
1985
+ }, $ = pt.current, B = ft.current;
1930
1986
  try {
1931
1987
  if (B) {
1932
- const F = B(O);
1933
- if (F instanceof Promise) {
1934
- $({ type: "page_context_pending" }), F.then((j) => $({ type: "page_context", context: j })).catch((j) => {
1988
+ const W = B($);
1989
+ if (W instanceof Promise) {
1990
+ H({ type: "page_context_pending" }), W.then((D) => H({ type: "page_context", context: D })).catch((D) => {
1935
1991
  console.warn(
1936
1992
  "[LiveLayer] getPageContext rejected; falling back to default walker.",
1937
- j
1938
- ), $({
1993
+ D
1994
+ ), H({
1939
1995
  type: "page_context",
1940
- context: Ot(O)
1996
+ context: qt($)
1941
1997
  });
1942
1998
  });
1943
1999
  return;
1944
2000
  }
1945
- $({ type: "page_context", context: F });
2001
+ H({ type: "page_context", context: W });
1946
2002
  return;
1947
2003
  }
1948
- $({
2004
+ H({
1949
2005
  type: "page_context",
1950
- context: Ot(O)
2006
+ context: qt($)
1951
2007
  });
1952
- } catch (F) {
2008
+ } catch (W) {
1953
2009
  console.warn(
1954
2010
  "[LiveLayer] page-context extraction threw. Sending empty context.",
1955
- F
1956
- ), $({
2011
+ W
2012
+ ), H({
1957
2013
  type: "page_context",
1958
- context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: O }
2014
+ context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: $ }
1959
2015
  });
1960
2016
  }
1961
2017
  return;
1962
2018
  }
1963
2019
  if (f.type === "scroll_page") {
1964
- if (!se("scroll")) {
1965
- ce("scroll_page", "scroll");
2020
+ if (!ce("scroll")) {
2021
+ se("scroll_page", "scroll");
1966
2022
  return;
1967
2023
  }
1968
2024
  const k = f.direction;
@@ -1973,25 +2029,29 @@ function gr(e) {
1973
2029
  return;
1974
2030
  }
1975
2031
  const T = f.behavior === "instant" ? "instant" : "smooth";
1976
- if (rt.current) {
2032
+ if (ot.current) {
1977
2033
  try {
1978
- rt.current(
2034
+ ot.current(
1979
2035
  k,
1980
2036
  T
1981
2037
  );
1982
- } catch (O) {
1983
- console.warn("[LiveLayer] onScrollPage threw.", O);
2038
+ } catch (D) {
2039
+ console.warn("[LiveLayer] onScrollPage threw.", D);
1984
2040
  }
1985
2041
  return;
1986
2042
  }
1987
2043
  if (typeof window > "u") return;
1988
- const $ = { behavior: T };
1989
- k === "up" ? window.scrollBy({ top: -window.innerHeight, ...$ }) : k === "down" ? window.scrollBy({ top: window.innerHeight, ...$ }) : k === "top" ? window.scrollTo({ top: 0, ...$ }) : window.scrollTo({ top: document.body.scrollHeight, ...$ });
2044
+ const H = { behavior: T }, $ = xr(), B = (D) => {
2045
+ $ instanceof Window ? $.scrollBy({ top: D, ...H }) : $.scrollBy({ top: D, ...H });
2046
+ }, W = (D) => {
2047
+ $ instanceof Window ? $.scrollTo({ top: D, ...H }) : $.scrollTo({ top: D, ...H });
2048
+ };
2049
+ k === "up" ? B(-Bt($)) : k === "down" ? B(Bt($)) : W(k === "top" ? 0 : kr($));
1990
2050
  return;
1991
2051
  }
1992
2052
  if (f.type === "click") {
1993
- if (!se("click")) {
1994
- ce("click", "click");
2053
+ if (!ce("click")) {
2054
+ se("click", "click");
1995
2055
  return;
1996
2056
  }
1997
2057
  const k = typeof f.selector == "string" ? f.selector : null;
@@ -2002,8 +2062,8 @@ function gr(e) {
2002
2062
  if (it.current) {
2003
2063
  try {
2004
2064
  it.current(k);
2005
- } catch ($) {
2006
- console.warn("[LiveLayer] onClick threw.", $);
2065
+ } catch (H) {
2066
+ console.warn("[LiveLayer] onClick threw.", H);
2007
2067
  }
2008
2068
  return;
2009
2069
  }
@@ -2029,12 +2089,12 @@ function gr(e) {
2029
2089
  );
2030
2090
  return;
2031
2091
  }
2032
- (je = T.click) == null || je.call(T);
2092
+ (Ge = T.click) == null || Ge.call(T);
2033
2093
  return;
2034
2094
  }
2035
2095
  if (f.type === "fill_form" || f.type === "focus_field") {
2036
- if (!se("fill_forms")) {
2037
- ce(f.type, "fill_forms");
2096
+ if (!ce("fill_forms")) {
2097
+ se(f.type, "fill_forms");
2038
2098
  return;
2039
2099
  }
2040
2100
  if (typeof document > "u") return;
@@ -2059,61 +2119,61 @@ function gr(e) {
2059
2119
  return;
2060
2120
  }
2061
2121
  if (f.type === "focus_field") {
2062
- const O = typeof f.fieldName == "string" ? f.fieldName : null;
2063
- if (!O) {
2122
+ const $ = typeof f.fieldName == "string" ? f.fieldName : null;
2123
+ if (!$) {
2064
2124
  console.warn("[LiveLayer] focus_field: missing fieldName.");
2065
2125
  return;
2066
2126
  }
2067
- const B = T.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
2127
+ const B = T.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
2068
2128
  if (!B) {
2069
2129
  console.warn(
2070
- `[LiveLayer] focus_field: no field "${O}" in form "${k}".`
2130
+ `[LiveLayer] focus_field: no field "${$}" in form "${k}".`
2071
2131
  );
2072
2132
  return;
2073
2133
  }
2074
- if (!Xe(B)) {
2134
+ if (!et(B)) {
2075
2135
  console.warn(
2076
- `[LiveLayer] focus_field: field "${O}" is privacy-protected and not focusable.`
2136
+ `[LiveLayer] focus_field: field "${$}" is privacy-protected and not focusable.`
2077
2137
  );
2078
2138
  return;
2079
2139
  }
2080
2140
  B.focus();
2081
2141
  return;
2082
2142
  }
2083
- const $ = f.values && typeof f.values == "object" ? f.values : null;
2084
- if (!$) {
2143
+ const H = f.values && typeof f.values == "object" ? f.values : null;
2144
+ if (!H) {
2085
2145
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
2086
2146
  return;
2087
2147
  }
2088
- for (const [O, B] of Object.entries($)) {
2148
+ for (const [$, B] of Object.entries(H)) {
2089
2149
  if (typeof B != "string") continue;
2090
- const F = T.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
2091
- if (!F) {
2150
+ const W = T.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
2151
+ if (!W) {
2092
2152
  console.warn(
2093
- `[LiveLayer] fill_form: no field "${O}" in form "${k}". Skipping.`
2153
+ `[LiveLayer] fill_form: no field "${$}" in form "${k}". Skipping.`
2094
2154
  );
2095
2155
  continue;
2096
2156
  }
2097
- if (!Xe(F)) {
2157
+ if (!et(W)) {
2098
2158
  console.warn(
2099
- `[LiveLayer] fill_form: field "${O}" is privacy-protected (password / cc-* / private). Skipping.`
2159
+ `[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
2100
2160
  );
2101
2161
  continue;
2102
2162
  }
2103
2163
  try {
2104
- hr(F, B);
2105
- } catch (j) {
2164
+ vr(W, B);
2165
+ } catch (D) {
2106
2166
  console.warn(
2107
- `[LiveLayer] fill_form: failed to set "${O}".`,
2108
- j
2167
+ `[LiveLayer] fill_form: failed to set "${$}".`,
2168
+ D
2109
2169
  );
2110
2170
  }
2111
2171
  }
2112
2172
  return;
2113
2173
  }
2114
2174
  if (f.type === "submit_form") {
2115
- if (!se("submit_forms")) {
2116
- ce("submit_form", "submit_forms");
2175
+ if (!ce("submit_forms")) {
2176
+ se("submit_form", "submit_forms");
2117
2177
  return;
2118
2178
  }
2119
2179
  if (typeof document > "u") return;
@@ -2137,24 +2197,24 @@ function gr(e) {
2137
2197
  );
2138
2198
  return;
2139
2199
  }
2140
- const $ = typeof f.requestId == "string" ? f.requestId : void 0, O = (Ve = te.current) == null ? void 0 : Ve.call(te), B = (re) => {
2141
- const he = O, Le = he == null ? void 0 : he.localParticipant;
2142
- if (Le != null && Le.publishData)
2200
+ const H = typeof f.requestId == "string" ? f.requestId : void 0, $ = (Je = re.current) == null ? void 0 : Je.call(re), B = (j) => {
2201
+ const G = $, Ce = G == null ? void 0 : G.localParticipant;
2202
+ if (Ce != null && Ce.publishData)
2143
2203
  try {
2144
- const nn = $ ? { ...re, requestId: $ } : re, rn = new TextEncoder().encode(JSON.stringify(nn));
2145
- Le.publishData(rn, { reliable: !0 });
2204
+ const an = H ? { ...j, requestId: H } : j, cn = new TextEncoder().encode(JSON.stringify(an));
2205
+ Ce.publishData(cn, { reliable: !0 });
2146
2206
  } catch {
2147
2207
  }
2148
2208
  };
2149
- let F = !1;
2150
- const j = () => {
2151
- F = !0, B({ type: "form_submitted", formId: k });
2209
+ let W = !1;
2210
+ const D = () => {
2211
+ W = !0, B({ type: "form_submitted", formId: k });
2152
2212
  };
2153
- T.addEventListener("submit", j, { once: !0 });
2213
+ T.addEventListener("submit", D, { once: !0 });
2154
2214
  try {
2155
2215
  typeof T.requestSubmit == "function" ? T.requestSubmit() : T.submit();
2156
- } catch (re) {
2157
- console.warn("[LiveLayer] submit_form: requestSubmit threw.", re), T.removeEventListener("submit", j), B({
2216
+ } catch (j) {
2217
+ console.warn("[LiveLayer] submit_form: requestSubmit threw.", j), T.removeEventListener("submit", D), B({
2158
2218
  type: "form_submit_blocked",
2159
2219
  formId: k,
2160
2220
  reason: "exception"
@@ -2162,7 +2222,7 @@ function gr(e) {
2162
2222
  return;
2163
2223
  }
2164
2224
  setTimeout(() => {
2165
- F || (T.removeEventListener("submit", j), B({
2225
+ W || (T.removeEventListener("submit", D), B({
2166
2226
  type: "form_submit_blocked",
2167
2227
  formId: k,
2168
2228
  reason: "validation"
@@ -2171,66 +2231,96 @@ function gr(e) {
2171
2231
  return;
2172
2232
  }
2173
2233
  if (f.type === "request_routes") {
2174
- if (!se("read_page")) {
2175
- ce("request_routes", "read_page");
2234
+ if (!ce("read_page")) {
2235
+ se("request_routes", "read_page");
2236
+ return;
2237
+ }
2238
+ const k = typeof f.requestId == "string" ? f.requestId : void 0, H = (Ct = re.current) == null ? void 0 : Ct.call(re), $ = H == null ? void 0 : H.localParticipant;
2239
+ if (!($ != null && $.publishData)) return;
2240
+ const B = (D) => {
2241
+ try {
2242
+ const j = k ? { type: "routes", routes: D, requestId: k } : { type: "routes", routes: D }, G = new TextEncoder().encode(JSON.stringify(j));
2243
+ $.publishData(G, { reliable: !0 });
2244
+ } catch (j) {
2245
+ console.warn("[LiveLayer] request_routes: publishData failed.", j);
2246
+ }
2247
+ }, W = ht.current;
2248
+ if (W) {
2249
+ try {
2250
+ const D = W(), j = (G) => {
2251
+ if (!Array.isArray(G)) {
2252
+ B([]);
2253
+ return;
2254
+ }
2255
+ B(G.map(fr).slice(0, 200));
2256
+ };
2257
+ D instanceof Promise ? D.then(j).catch((G) => {
2258
+ console.warn(
2259
+ "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
2260
+ G
2261
+ ), B(ct());
2262
+ }) : j(D);
2263
+ } catch (D) {
2264
+ console.warn(
2265
+ "[LiveLayer] getRoutes threw; falling back to DOM walker.",
2266
+ D
2267
+ ), B(ct());
2268
+ }
2176
2269
  return;
2177
2270
  }
2178
- const k = typeof f.requestId == "string" ? f.requestId : void 0, $ = (Lt = te.current) == null ? void 0 : Lt.call(te), O = $ == null ? void 0 : $.localParticipant;
2179
- if (!(O != null && O.publishData)) return;
2180
2271
  try {
2181
- const B = ur(), F = k ? { type: "routes", routes: B, requestId: k } : { type: "routes", routes: B }, j = new TextEncoder().encode(JSON.stringify(F));
2182
- O.publishData(j, { reliable: !0 });
2183
- } catch (B) {
2184
- console.warn("[LiveLayer] request_routes: extractRoutes threw.", B);
2272
+ B(ct());
2273
+ } catch (D) {
2274
+ console.warn("[LiveLayer] request_routes: extractRoutes threw.", D);
2185
2275
  }
2186
2276
  return;
2187
2277
  }
2188
- mr.has(f.type) || _e == null || _e(f);
2278
+ Lr.has(f.type) || xe == null || xe(f);
2189
2279
  }
2190
2280
  },
2191
- [_e, we]
2192
- ), U = un({
2193
- agentId: q ? "__controlled__" : Ie,
2194
- baseUrl: i,
2281
+ [xe, _e]
2282
+ ), U = mn({
2283
+ agentId: F ? "__controlled__" : Re,
2284
+ baseUrl: o,
2195
2285
  apiKey: r,
2196
- sessionEndpoint: o,
2286
+ sessionEndpoint: i,
2197
2287
  sessionBody: l,
2198
- onDataMessage: q ? void 0 : De
2288
+ onDataMessage: F ? void 0 : Te
2199
2289
  });
2200
2290
  P(() => {
2201
- if (q != null && q.subscribeToDataMessages)
2202
- return q.subscribeToDataMessages(De);
2203
- }, [q, De]), te.current = () => {
2204
- var v;
2205
- return (v = U.getRoom) == null ? void 0 : v.call(U);
2291
+ if (F != null && F.subscribeToDataMessages)
2292
+ return F.subscribeToDataMessages(Te);
2293
+ }, [F, Te]), re.current = () => {
2294
+ var y;
2295
+ return (y = U.getRoom) == null ? void 0 : y.call(U);
2206
2296
  }, P(() => {
2207
- var G;
2297
+ var K;
2208
2298
  if (typeof window > "u") return;
2209
- const v = ((G = window.location) == null ? void 0 : G.hostname) || "";
2210
- if (v === "localhost" || v === "127.0.0.1" || v === "0.0.0.0" || v.endsWith(".local") || v.endsWith(".test"))
2211
- return window.__livelayerSimulateCommand = (je) => {
2299
+ const y = ((K = window.location) == null ? void 0 : K.hostname) || "";
2300
+ if (y === "localhost" || y === "127.0.0.1" || y === "0.0.0.0" || y.endsWith(".local") || y.endsWith(".test"))
2301
+ return window.__livelayerSimulateCommand = (Ge) => {
2212
2302
  try {
2213
- De(je);
2214
- } catch (Ve) {
2215
- console.warn("[LiveLayer] simulate-command threw:", Ve);
2303
+ Te(Ge);
2304
+ } catch (Je) {
2305
+ console.warn("[LiveLayer] simulate-command threw:", Je);
2216
2306
  }
2217
2307
  }, () => {
2218
2308
  delete window.__livelayerSimulateCommand;
2219
2309
  };
2220
- }, [De]);
2221
- const w = Je(() => q ? {
2222
- connectionState: q.connectionState,
2223
- agentState: q.agentState,
2224
- transcript: q.transcript,
2225
- videoElement: q.videoElement,
2226
- audioElement: q.audioElement,
2227
- canResume: q.canResume,
2228
- error: q.error,
2310
+ }, [Te]);
2311
+ const w = Qe(() => F ? {
2312
+ connectionState: F.connectionState,
2313
+ agentState: F.agentState,
2314
+ transcript: F.transcript,
2315
+ videoElement: F.videoElement,
2316
+ audioElement: F.audioElement,
2317
+ canResume: F.canResume,
2318
+ error: F.error,
2229
2319
  agentConfig: null,
2230
2320
  connect: async () => {
2231
- await q.onConnect();
2321
+ await F.onConnect();
2232
2322
  },
2233
- disconnect: () => q.onDisconnect(),
2323
+ disconnect: () => F.onDisconnect(),
2234
2324
  // Dummy getRoom for shape compatibility — controlled consumers own the Room.
2235
2325
  // Internal session's getRoom returns null when no real connect has happened,
2236
2326
  // so we reuse its reference for type consistency.
@@ -2249,322 +2339,322 @@ function gr(e) {
2249
2339
  disconnect: U.disconnect,
2250
2340
  getRoom: U.getRoom,
2251
2341
  isControlled: !1
2252
- }, [q, U]), pt = I(null);
2342
+ }, [F, U]), mt = I(null);
2253
2343
  P(() => {
2254
- const v = w.videoElement, f = pt.current;
2255
- if (!(!v || !f))
2256
- return f.appendChild(v), () => {
2257
- v.parentNode === f && f.removeChild(v);
2344
+ const y = w.videoElement, f = mt.current;
2345
+ if (!(!y || !f))
2346
+ return f.appendChild(y), () => {
2347
+ y.parentNode === f && f.removeChild(y);
2258
2348
  };
2259
2349
  }, [w.videoElement]), P(() => {
2260
- const v = w.audioElement;
2261
- if (!v) return;
2262
- le.attach(v);
2263
- const f = v.play();
2264
- return f && typeof f.catch == "function" && f.catch((G) => {
2265
- (G == null ? void 0 : G.name) === "NotAllowedError" && ke(!0);
2350
+ const y = w.audioElement;
2351
+ if (!y) return;
2352
+ ae.attach(y);
2353
+ const f = y.play();
2354
+ return f && typeof f.catch == "function" && f.catch((K) => {
2355
+ (K == null ? void 0 : K.name) === "NotAllowedError" && Me(!0);
2266
2356
  }), () => {
2267
- le.detach();
2357
+ ae.detach();
2268
2358
  };
2269
2359
  }, [w.audioElement]), P(() => {
2270
2360
  if (w.isControlled || w.connectionState !== "connected") return;
2271
- const v = w.getRoom();
2272
- if (v)
2273
- return Y.setupMic(v).catch(() => {
2274
- }), K.attachRoom(v), ae.attachRoom(v), Me.refresh(), () => {
2275
- Y.teardownMic(), K.teardown(), ae.teardown();
2361
+ const y = w.getRoom();
2362
+ if (y)
2363
+ return J.setupMic(y).catch(() => {
2364
+ }), ne.attachRoom(y), pe.attachRoom(y), Ie.refresh(), () => {
2365
+ J.teardownMic(), ne.teardown(), pe.teardown();
2276
2366
  };
2277
2367
  }, [w.isControlled, w.connectionState]), P(() => {
2278
- const v = w.audioElement;
2279
- v && (v.muted = et);
2280
- }, [w.audioElement, et]);
2281
- const jt = S((v) => {
2368
+ const y = w.audioElement;
2369
+ y && (y.muted = tt);
2370
+ }, [w.audioElement, tt]);
2371
+ const Jt = S((y) => {
2282
2372
  const f = w.getRoom();
2283
2373
  if (f)
2284
2374
  try {
2285
- const G = new TextEncoder().encode(
2286
- JSON.stringify({ type: "user_message", text: v })
2375
+ const K = new TextEncoder().encode(
2376
+ JSON.stringify({ type: "user_message", text: y })
2287
2377
  );
2288
- f.localParticipant.publishData(G, { reliable: !0 });
2378
+ f.localParticipant.publishData(K, { reliable: !0 });
2289
2379
  } catch {
2290
2380
  }
2291
- }, [w]), Vt = S(() => {
2292
- Wt((v) => !v);
2381
+ }, [w]), Kt = S(() => {
2382
+ Gt((y) => !y);
2293
2383
  }, []);
2294
2384
  P(() => {
2295
- be == null || be(w.connectionState), w.connectionState === "connected" ? fe == null || fe() : w.connectionState === "disconnected" && (ge == null || ge());
2296
- }, [w.connectionState, fe, ge, be]), P(() => {
2297
- ye == null || ye(w.transcript);
2298
- }, [w.transcript, ye]), P(() => {
2299
- ve == null || ve(w.agentState);
2300
- }, [w.agentState, ve]);
2301
- const ht = I(!1);
2385
+ we == null || we(w.connectionState), w.connectionState === "connected" ? ge == null || ge() : w.connectionState === "disconnected" && (ye == null || ye());
2386
+ }, [w.connectionState, ge, ye, we]), P(() => {
2387
+ ve == null || ve(w.transcript);
2388
+ }, [w.transcript, ve]), P(() => {
2389
+ be == null || be(w.agentState);
2390
+ }, [w.agentState, be]);
2391
+ const gt = I(!1);
2302
2392
  P(() => {
2303
- w.isControlled || !c || ht.current || Re && w.connectionState === "idle" && (ht.current = !0, w.connect());
2304
- }, [c, w.connectionState, w, Re]);
2305
- const Yt = S(
2306
- (v) => {
2307
- const f = C == null ? void 0 : C.find((G) => G.id === v);
2308
- f && (W(!1), v !== ee && (Pe(!0), w.disconnect(), ie || xe(v), b == null || b(f)));
2393
+ w.isControlled || !s || gt.current || le && w.connectionState === "idle" && (gt.current = !0, w.connect());
2394
+ }, [s, w.connectionState, w, le]);
2395
+ const Xt = S(
2396
+ (y) => {
2397
+ const f = C == null ? void 0 : C.find((K) => K.id === y);
2398
+ f && (Ye(!1), y !== fe && (v(!0), w.disconnect(), oe || Le(y), b == null || b(f)));
2309
2399
  },
2310
2400
  [
2311
2401
  C,
2312
- ee,
2402
+ fe,
2313
2403
  w,
2314
- ie,
2404
+ oe,
2315
2405
  b
2316
2406
  ]
2317
2407
  );
2318
2408
  P(() => {
2319
- Te && w.connectionState === "connected" && Pe(!1);
2320
- }, [w.connectionState, Te]), P(() => {
2321
- if (!y) return;
2322
- const v = (f) => {
2323
- f.key === "Escape" && W(!1);
2409
+ Se && w.connectionState === "connected" && v(!1);
2410
+ }, [w.connectionState, Se]), P(() => {
2411
+ if (!Y) return;
2412
+ const y = (f) => {
2413
+ f.key === "Escape" && Ye(!1);
2324
2414
  };
2325
- return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
2326
- }, [y]);
2327
- const Gt = !!M || !!(V != null && V.avatarImageUrl) || w.isControlled, $e = vn(Ie, i, Gt);
2328
- Ne === void 0 && ((yt = $e.info) != null && yt.capabilities) && (ot.current = $e.info.capabilities);
2329
- const lt = (V == null ? void 0 : V.name) ?? z ?? ((vt = w.agentConfig) == null ? void 0 : vt.name) ?? ((bt = $e.info) == null ? void 0 : bt.name) ?? "Live Layer", mt = (V == null ? void 0 : V.avatarImageUrl) ?? M ?? ((wt = w.agentConfig) == null ? void 0 : wt.avatarImageUrl) ?? ((_t = $e.info) == null ? void 0 : _t.avatarImageUrl) ?? null, Jt = L ?? ((xt = w.agentConfig) == null ? void 0 : xt.idleLoopUrl) ?? ((kt = $e.info) == null ? void 0 : kt.idleLoopUrl) ?? null, Kt = D ?? null, Xt = S(() => J("expanded"), [J]), Qt = S(
2330
- () => J("minimized"),
2331
- [J]
2332
- ), gt = S(() => {
2333
- w.disconnect(), J("hidden");
2334
- }, [w, J]), Zt = S(() => {
2335
- const v = w.audioElement;
2336
- v && v.play().then(() => ke(!1)).catch(() => {
2415
+ return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
2416
+ }, [Y]);
2417
+ const Qt = !!M || !!(V != null && V.avatarImageUrl) || w.isControlled, Pe = xn(Re, o, Qt);
2418
+ me === void 0 && ((bt = Pe.info) != null && bt.capabilities) && (lt.current = Pe.info.capabilities);
2419
+ const at = (V == null ? void 0 : V.name) ?? O ?? ((wt = w.agentConfig) == null ? void 0 : wt.name) ?? ((_t = Pe.info) == null ? void 0 : _t.name) ?? "Live Layer", yt = (V == null ? void 0 : V.avatarImageUrl) ?? M ?? ((xt = w.agentConfig) == null ? void 0 : xt.avatarImageUrl) ?? ((kt = Pe.info) == null ? void 0 : kt.avatarImageUrl) ?? null, Zt = L ?? ((Lt = w.agentConfig) == null ? void 0 : Lt.idleLoopUrl) ?? ((St = Pe.info) == null ? void 0 : St.idleLoopUrl) ?? null, en = z ?? null, tn = S(() => X("expanded"), [X]), nn = S(
2420
+ () => X("minimized"),
2421
+ [X]
2422
+ ), vt = S(() => {
2423
+ w.disconnect(), X("hidden");
2424
+ }, [w, X]), rn = S(() => {
2425
+ const y = w.audioElement;
2426
+ y && y.play().then(() => Me(!1)).catch(() => {
2337
2427
  });
2338
- }, [w.audioElement]), en = S(() => {
2339
- ke(!1), w.connect();
2340
- }, [w]), ze = {
2341
- ...Ue,
2342
- zIndex: We
2428
+ }, [w.audioElement]), on = S(() => {
2429
+ Me(!1), w.connect();
2430
+ }, [w]), De = {
2431
+ ...Fe,
2432
+ zIndex: Ue
2343
2433
  };
2344
- p.primaryColor && (ze["--ll-color-primary"] = p.primaryColor), p.accentColor && (ze["--ll-color-accent"] = p.accentColor), p.backgroundColor && (ze["--ll-color-bg"] = p.backgroundColor), p.textColor && (ze["--ll-color-fg"] = p.textColor);
2345
- const tn = [
2434
+ p.primaryColor && (De["--ll-color-primary"] = p.primaryColor), p.accentColor && (De["--ll-color-accent"] = p.accentColor), p.backgroundColor && (De["--ll-color-bg"] = p.backgroundColor), p.textColor && (De["--ll-color-fg"] = p.textColor);
2435
+ const ln = [
2346
2436
  "ll-widget",
2347
- `ll-widget--${oe}`,
2348
- `ll-widget--${ne ? "mobile" : "desktop"}`,
2349
- Qe
2437
+ `ll-widget--${te}`,
2438
+ `ll-widget--${ie ? "mobile" : "desktop"}`,
2439
+ We
2350
2440
  ].filter(Boolean).join(" ");
2351
- return Re ? /* @__PURE__ */ _(
2441
+ return le ? /* @__PURE__ */ _(
2352
2442
  "div",
2353
2443
  {
2354
- className: tn,
2355
- style: ze,
2356
- "data-display-mode": oe,
2444
+ className: ln,
2445
+ style: De,
2446
+ "data-display-mode": te,
2357
2447
  "data-position": m,
2358
2448
  children: [
2359
- oe === "hidden" && /* @__PURE__ */ n(
2360
- Fn,
2449
+ te === "hidden" && /* @__PURE__ */ n(
2450
+ Vn,
2361
2451
  {
2362
2452
  position: m,
2363
- isMobile: ne,
2453
+ isMobile: ie,
2364
2454
  isSpeaking: w.agentState === "speaking",
2365
- onExpand: () => J("expanded"),
2366
- label: `Open ${lt} widget`
2455
+ onExpand: () => X("expanded"),
2456
+ label: `Open ${at} widget`
2367
2457
  }
2368
2458
  ),
2369
- oe === "minimized" && /* @__PURE__ */ n(
2370
- Wn,
2459
+ te === "minimized" && /* @__PURE__ */ n(
2460
+ Gn,
2371
2461
  {
2372
2462
  position: m,
2373
- isMobile: ne,
2374
- agentName: lt,
2375
- avatarImageUrl: mt,
2463
+ isMobile: ie,
2464
+ agentName: at,
2465
+ avatarImageUrl: yt,
2376
2466
  agentState: w.agentState,
2377
- isMuted: Y.isMuted,
2378
- audioLevel: le,
2379
- onExpand: Xt,
2380
- onToggleMute: Y.toggleMute,
2381
- onClose: gt
2467
+ isMuted: J.isMuted,
2468
+ audioLevel: ae,
2469
+ onExpand: tn,
2470
+ onToggleMute: J.toggleMute,
2471
+ onClose: vt
2382
2472
  }
2383
2473
  ),
2384
- oe === "expanded" && /* @__PURE__ */ n(
2385
- Vn,
2474
+ te === "expanded" && /* @__PURE__ */ n(
2475
+ Kn,
2386
2476
  {
2387
2477
  position: m,
2388
- isMobile: ne,
2389
- agentName: lt,
2390
- avatarImageUrl: mt,
2391
- idleLoopUrl: Jt,
2392
- greeting: Kt,
2478
+ isMobile: ie,
2479
+ agentName: at,
2480
+ avatarImageUrl: yt,
2481
+ idleLoopUrl: Zt,
2482
+ greeting: en,
2393
2483
  branding: p,
2394
2484
  teamMembers: C,
2395
- currentTeamMemberId: ee,
2396
- isSwitchingTeamMember: Te,
2397
- teamSwitcherOpen: y,
2398
- onToggleTeamSwitcher: () => W((v) => !v),
2399
- onSelectTeamMember: Yt,
2485
+ currentTeamMemberId: fe,
2486
+ isSwitchingTeamMember: Se,
2487
+ teamSwitcherOpen: Y,
2488
+ onToggleTeamSwitcher: () => Ye((y) => !y),
2489
+ onSelectTeamMember: Xt,
2400
2490
  connectionState: w.connectionState,
2401
2491
  agentState: w.agentState,
2402
2492
  transcript: w.transcript,
2403
- isMuted: Y.isMuted,
2404
- micDevices: Me.mics,
2405
- isCameraEnabled: K.isEnabled,
2406
- cameraPreviewEl: K.previewEl,
2407
- cameraDevices: Me.cameras,
2408
- activeCameraId: K.activeDeviceId,
2409
- isScreenShareEnabled: ae.isEnabled,
2410
- screenPreviewEl: ae.previewEl,
2411
- isSpeakerMuted: et,
2493
+ isMuted: J.isMuted,
2494
+ micDevices: Ie.mics,
2495
+ isCameraEnabled: ne.isEnabled,
2496
+ cameraPreviewEl: ne.previewEl,
2497
+ cameraDevices: Ie.cameras,
2498
+ activeCameraId: ne.activeDeviceId,
2499
+ isScreenShareEnabled: pe.isEnabled,
2500
+ screenPreviewEl: pe.previewEl,
2501
+ isSpeakerMuted: tt,
2412
2502
  allowCamera: g,
2413
2503
  allowScreenShare: E,
2414
2504
  allowTyping: x,
2415
- languageMenuOpen: dt,
2416
- onToggleLanguageMenu: () => Ut((v) => !v),
2417
- needsUserGesture: Ze,
2505
+ languageMenuOpen: Vt,
2506
+ onToggleLanguageMenu: () => Yt((y) => !y),
2507
+ needsUserGesture: Ve,
2418
2508
  canResume: w.canResume,
2419
- micError: Y.micError,
2509
+ micError: J.micError,
2420
2510
  error: w.error,
2421
- avatarVideoContainerRef: pt,
2511
+ avatarVideoContainerRef: mt,
2422
2512
  onConnect: () => void w.connect(),
2423
2513
  onDisconnect: () => w.disconnect(),
2424
- onRetry: en,
2425
- onResumeAudio: Zt,
2426
- onToggleMute: Y.toggleMute,
2427
- onToggleCamera: () => void K.toggle(),
2428
- onSwitchCameraDevice: (v) => void K.switchDevice(v),
2429
- onToggleScreenShare: () => void ae.toggle(),
2430
- onToggleSpeaker: Vt,
2431
- onSendMessage: jt,
2432
- onMinimize: Qt,
2433
- onClose: gt,
2434
- onClearMicError: Y.clearError
2514
+ onRetry: on,
2515
+ onResumeAudio: rn,
2516
+ onToggleMute: J.toggleMute,
2517
+ onToggleCamera: () => void ne.toggle(),
2518
+ onSwitchCameraDevice: (y) => void ne.switchDevice(y),
2519
+ onToggleScreenShare: () => void pe.toggle(),
2520
+ onToggleSpeaker: Kt,
2521
+ onSendMessage: Jt,
2522
+ onMinimize: nn,
2523
+ onClose: vt,
2524
+ onClearMicError: J.clearError
2435
2525
  }
2436
2526
  )
2437
2527
  ]
2438
2528
  }
2439
2529
  ) : null;
2440
2530
  }
2441
- function Lr(e) {
2442
- return /* @__PURE__ */ n(dn, { children: /* @__PURE__ */ n(gr, { ...e }) });
2531
+ function Tr(e) {
2532
+ return /* @__PURE__ */ n(hn, { children: /* @__PURE__ */ n(Sr, { ...e }) });
2443
2533
  }
2444
- const Sr = ({
2534
+ const Pr = ({
2445
2535
  agentId: e,
2446
2536
  baseUrl: t,
2447
2537
  apiKey: r,
2448
- mode: i,
2449
- onAgentEvent: o,
2538
+ mode: o,
2539
+ onAgentEvent: i,
2450
2540
  className: l,
2451
- style: c
2541
+ style: s
2452
2542
  }) => {
2453
- const d = I(null), u = I(null), h = I(o);
2454
- h.current = o;
2543
+ const d = I(null), u = I(null), h = I(i);
2544
+ h.current = i;
2455
2545
  const m = S((a) => {
2456
2546
  var A;
2457
- const s = a.detail;
2458
- (A = h.current) == null || A.call(h, s);
2547
+ const c = a.detail;
2548
+ (A = h.current) == null || A.call(h, c);
2459
2549
  }, []);
2460
2550
  return P(() => {
2461
2551
  const a = d.current;
2462
2552
  if (!a) return;
2463
- const s = document.createElement("livelayer-widget");
2464
- 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, () => {
2465
- s.removeEventListener("agent-event", m), a.removeChild(s), u.current = null;
2553
+ const c = document.createElement("livelayer-widget");
2554
+ return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", m), a.appendChild(c), u.current = c, () => {
2555
+ c.removeEventListener("agent-event", m), a.removeChild(c), u.current = null;
2466
2556
  };
2467
2557
  }, [e]), P(() => {
2468
- u.current && (i ? u.current.setAttribute("mode", i) : u.current.removeAttribute("mode"));
2469
- }, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
2470
- }, Cr = st(
2471
- function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, d) {
2472
- return ln(
2473
- i,
2558
+ u.current && (o ? u.current.setAttribute("mode", o) : u.current.removeAttribute("mode"));
2559
+ }, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2560
+ }, Dr = dt(
2561
+ function({ id: t, intent: r, as: o = "div", className: i, style: l, children: s }, d) {
2562
+ return dn(
2563
+ o,
2474
2564
  {
2475
2565
  ref: d,
2476
2566
  "data-ll-region": t,
2477
2567
  "data-ll-intent": r,
2478
- className: o,
2568
+ className: i,
2479
2569
  style: l
2480
2570
  },
2481
- c
2571
+ s
2482
2572
  );
2483
2573
  }
2484
- ), Er = st(
2485
- function({ id: t, intent: r, children: i, ...o }, l) {
2574
+ ), $r = dt(
2575
+ function({ id: t, intent: r, children: o, ...i }, l) {
2486
2576
  return /* @__PURE__ */ n(
2487
2577
  "form",
2488
2578
  {
2489
2579
  ref: l,
2490
2580
  "data-ll-form": t,
2491
2581
  "data-ll-intent": r,
2492
- ...o,
2493
- children: i
2582
+ ...i,
2583
+ children: o
2494
2584
  }
2495
2585
  );
2496
2586
  }
2497
- ), Nr = st(
2587
+ ), zr = dt(
2498
2588
  function(t, r) {
2499
- const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
2589
+ const { name: o, label: i, labelClassName: l } = t, s = { name: o, "data-ll-field": o };
2500
2590
  let d;
2501
2591
  if ("as" in t && t.as === "textarea") {
2502
- const { name: u, label: h, labelClassName: m, as: a, ...s } = t;
2592
+ const { name: u, label: h, labelClassName: m, as: a, ...c } = t;
2503
2593
  d = /* @__PURE__ */ n(
2504
2594
  "textarea",
2505
2595
  {
2506
2596
  ref: r,
2507
- ...c,
2508
- ...s
2597
+ ...s,
2598
+ ...c
2509
2599
  }
2510
2600
  );
2511
2601
  } else if ("as" in t && t.as === "select") {
2512
- const { name: u, label: h, labelClassName: m, as: a, children: s, ...A } = t;
2602
+ const { name: u, label: h, labelClassName: m, as: a, children: c, ...A } = t;
2513
2603
  d = /* @__PURE__ */ n(
2514
2604
  "select",
2515
2605
  {
2516
2606
  ref: r,
2517
- ...c,
2607
+ ...s,
2518
2608
  ...A,
2519
- children: s
2609
+ children: c
2520
2610
  }
2521
2611
  );
2522
2612
  } else {
2523
- const { name: u, label: h, labelClassName: m, as: a, ...s } = t;
2613
+ const { name: u, label: h, labelClassName: m, as: a, ...c } = t;
2524
2614
  d = /* @__PURE__ */ n(
2525
2615
  "input",
2526
2616
  {
2527
2617
  ref: r,
2528
- ...c,
2529
- ...s
2618
+ ...s,
2619
+ ...c
2530
2620
  }
2531
2621
  );
2532
2622
  }
2533
- return o === void 0 ? d : /* @__PURE__ */ _("label", { className: l, children: [
2534
- o,
2623
+ return i === void 0 ? d : /* @__PURE__ */ _("label", { className: l, children: [
2624
+ i,
2535
2625
  d
2536
2626
  ] });
2537
2627
  }
2538
2628
  );
2539
- let Ht = 1;
2540
- function Ar({
2629
+ let Wt = 1;
2630
+ function Hr({
2541
2631
  onMount: e,
2542
2632
  defaultOpen: t = !1,
2543
2633
  storageKey: r = "ll-debug-open"
2544
2634
  }) {
2545
- const [i, o] = N(t), [l, c] = N([]), [d, u] = N(""), [h, m] = N(!1), a = I(/* @__PURE__ */ new Set()), s = I([]), A = I(h);
2635
+ const [o, i] = N(t), [l, s] = N([]), [d, u] = N(""), [h, m] = N(!1), a = I(/* @__PURE__ */ new Set()), c = I([]), A = I(h);
2546
2636
  A.current = h, P(() => {
2547
2637
  try {
2548
2638
  const b = localStorage.getItem(r);
2549
- b === "1" && o(!0), b === "0" && o(!1);
2639
+ b === "1" && i(!0), b === "0" && i(!1);
2550
2640
  } catch {
2551
2641
  }
2552
2642
  }, [r]), P(() => {
2553
2643
  try {
2554
- localStorage.setItem(r, i ? "1" : "0");
2644
+ localStorage.setItem(r, o ? "1" : "0");
2555
2645
  } catch {
2556
2646
  }
2557
- }, [i, r]), P(() => {
2647
+ }, [o, r]), P(() => {
2558
2648
  const b = (L) => {
2559
- (L.metaKey || L.ctrlKey) && L.shiftKey && L.key.toLowerCase() === "l" && (L.preventDefault(), o((D) => !D));
2649
+ (L.metaKey || L.ctrlKey) && L.shiftKey && L.key.toLowerCase() === "l" && (L.preventDefault(), i((z) => !z));
2560
2650
  };
2561
2651
  return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
2562
2652
  }, []), P(() => {
2563
2653
  const b = setInterval(() => {
2564
- if (s.current.length === 0 || A.current) return;
2565
- const L = s.current.splice(0, s.current.length);
2566
- c(
2567
- (D) => [...L.reverse(), ...D].slice(0, 200)
2654
+ if (c.current.length === 0 || A.current) return;
2655
+ const L = c.current.splice(0, c.current.length);
2656
+ s(
2657
+ (z) => [...L.reverse(), ...z].slice(0, 200)
2568
2658
  );
2569
2659
  }, 100);
2570
2660
  return () => clearInterval(b);
@@ -2572,8 +2662,8 @@ function Ar({
2572
2662
  const C = I(!1);
2573
2663
  if (P(() => {
2574
2664
  !e || C.current || (C.current = !0, e((b) => {
2575
- s.current.push({
2576
- id: Ht++,
2665
+ c.current.push({
2666
+ id: Wt++,
2577
2667
  ts: Date.now(),
2578
2668
  kind: "event",
2579
2669
  type: b.eventName,
@@ -2581,29 +2671,29 @@ function Ar({
2581
2671
  });
2582
2672
  }));
2583
2673
  }, [e]), P(() => {
2584
- const b = console.warn, L = console.log, D = (M, z) => function(...p) {
2674
+ const b = console.warn, L = console.log, z = (M, O) => function(...p) {
2585
2675
  try {
2586
2676
  const g = typeof p[0] == "string" ? p[0] : "";
2587
- g.startsWith("[LiveLayer]") && s.current.push({
2588
- id: Ht++,
2677
+ g.startsWith("[LiveLayer]") && c.current.push({
2678
+ id: Wt++,
2589
2679
  ts: Date.now(),
2590
2680
  kind: M,
2591
2681
  type: g.slice(0, 120),
2592
- data: { args: p.slice(1).map((E) => vr(E)) }
2682
+ data: { args: p.slice(1).map((E) => Er(E)) }
2593
2683
  });
2594
2684
  } catch {
2595
2685
  }
2596
- return z.apply(this, p);
2686
+ return O.apply(this, p);
2597
2687
  };
2598
- return console.warn = D("warn", b), console.log = D("log", L), () => {
2688
+ return console.warn = z("warn", b), console.log = z("log", L), () => {
2599
2689
  console.warn = b, console.log = L;
2600
2690
  };
2601
- }, []), !i)
2691
+ }, []), !o)
2602
2692
  return /* @__PURE__ */ n(
2603
2693
  "button",
2604
2694
  {
2605
2695
  type: "button",
2606
- onClick: () => o(!0),
2696
+ onClick: () => i(!0),
2607
2697
  title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
2608
2698
  "aria-label": "Open LiveLayer debug panel",
2609
2699
  style: {
@@ -2676,7 +2766,7 @@ function Ar({
2676
2766
  {
2677
2767
  type: "button",
2678
2768
  onClick: () => m((b) => !b),
2679
- style: at(h ? "#f59e0b" : "transparent"),
2769
+ style: st(h ? "#f59e0b" : "transparent"),
2680
2770
  title: "Pause / resume capture",
2681
2771
  children: h ? "▶ resume" : "⏸ pause"
2682
2772
  }
@@ -2686,9 +2776,9 @@ function Ar({
2686
2776
  {
2687
2777
  type: "button",
2688
2778
  onClick: () => {
2689
- c([]), s.current = [];
2779
+ s([]), c.current = [];
2690
2780
  },
2691
- style: at("transparent"),
2781
+ style: st("transparent"),
2692
2782
  title: "Clear buffer",
2693
2783
  children: "clear"
2694
2784
  }
@@ -2697,8 +2787,8 @@ function Ar({
2697
2787
  "button",
2698
2788
  {
2699
2789
  type: "button",
2700
- onClick: () => o(!1),
2701
- style: at("transparent"),
2790
+ onClick: () => i(!1),
2791
+ style: st("transparent"),
2702
2792
  "aria-label": "Close",
2703
2793
  title: "Close (Cmd/Ctrl + Shift + L)",
2704
2794
  children: "✕"
@@ -2765,12 +2855,12 @@ function Ar({
2765
2855
  ]
2766
2856
  }
2767
2857
  ) : R.map((b) => /* @__PURE__ */ n(
2768
- yr,
2858
+ Cr,
2769
2859
  {
2770
2860
  entry: b,
2771
2861
  expanded: a.current.has(b.id),
2772
2862
  onToggle: () => {
2773
- a.current.has(b.id) ? a.current.delete(b.id) : a.current.add(b.id), c((L) => [...L]);
2863
+ a.current.has(b.id) ? a.current.delete(b.id) : a.current.add(b.id), s((L) => [...L]);
2774
2864
  }
2775
2865
  },
2776
2866
  b.id
@@ -2781,12 +2871,12 @@ function Ar({
2781
2871
  }
2782
2872
  );
2783
2873
  }
2784
- function yr({
2874
+ function Cr({
2785
2875
  entry: e,
2786
2876
  expanded: t,
2787
2877
  onToggle: r
2788
2878
  }) {
2789
- const i = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", o = new Date(e.ts).toLocaleTimeString("en-US", {
2879
+ const o = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", i = new Date(e.ts).toLocaleTimeString("en-US", {
2790
2880
  hour12: !1
2791
2881
  });
2792
2882
  return /* @__PURE__ */ _(
@@ -2816,14 +2906,14 @@ function yr({
2816
2906
  fontVariantNumeric: "tabular-nums",
2817
2907
  fontSize: 10
2818
2908
  },
2819
- children: o
2909
+ children: i
2820
2910
  }
2821
2911
  ),
2822
2912
  /* @__PURE__ */ n(
2823
2913
  "span",
2824
2914
  {
2825
2915
  style: {
2826
- color: i,
2916
+ color: o,
2827
2917
  fontWeight: 600,
2828
2918
  flexShrink: 0
2829
2919
  },
@@ -2851,7 +2941,7 @@ function yr({
2851
2941
  }
2852
2942
  );
2853
2943
  }
2854
- function at(e) {
2944
+ function st(e) {
2855
2945
  return {
2856
2946
  background: e,
2857
2947
  color: "#fff",
@@ -2862,58 +2952,59 @@ function at(e) {
2862
2952
  cursor: "pointer"
2863
2953
  };
2864
2954
  }
2865
- function vr(e) {
2955
+ function Er(e) {
2866
2956
  try {
2867
2957
  return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
2868
2958
  } catch {
2869
2959
  return String(e);
2870
2960
  }
2871
2961
  }
2872
- function Rr() {
2873
- const [e, t] = N([]), r = S((o) => {
2962
+ function Or() {
2963
+ const [e, t] = N([]), r = S((i) => {
2874
2964
  t((l) => {
2875
- const c = l.findIndex((d) => d.id === o.id);
2876
- if (c >= 0) {
2965
+ const s = l.findIndex((d) => d.id === i.id);
2966
+ if (s >= 0) {
2877
2967
  const d = l.slice();
2878
- return d[c] = o, d;
2968
+ return d[s] = i, d;
2879
2969
  }
2880
- return [...l, o];
2970
+ return [...l, i];
2881
2971
  });
2882
- }, []), i = S(() => t([]), []);
2972
+ }, []), o = S(() => t([]), []);
2883
2973
  return {
2884
2974
  entries: e,
2885
2975
  pushSegment: r,
2886
- clear: i,
2976
+ clear: o,
2887
2977
  latest: e.length > 0 ? e[e.length - 1] : null
2888
2978
  };
2889
2979
  }
2890
2980
  export {
2891
- Lr as AvatarWidget,
2892
- dn as ErrorBoundary,
2893
- Ar as LiveLayerDebugPanel,
2894
- Nr as LiveLayerField,
2895
- Er as LiveLayerForm,
2896
- Cr as LiveLayerRegion,
2897
- Sr as LiveLayerWidget,
2898
- lr as clearPageContextCache,
2899
- fr as clearRoutesCache,
2900
- or as extractPageContext,
2901
- cr as extractRoutes,
2902
- Ot as getCachedPageContext,
2903
- ur as getCachedRoutes,
2904
- Tn as matchesPattern,
2905
- Pn as shouldRenderAtPath,
2906
- vn as useAgentInfo,
2907
- fn as useAudioLevel,
2908
- mn as useCameraState,
2909
- _n as useDisplayMode,
2910
- Ln as useDisplayModePersistence,
2911
- Cn as useIsMobile,
2912
- un as useLiveKitSession,
2913
- yn as useMediaDevices,
2914
- pn as useMicrophoneState,
2915
- Nn as usePathname,
2916
- Dn as useRouteMatch,
2917
- gn as useScreenShareState,
2918
- Rr as useTranscript
2981
+ Tr as AvatarWidget,
2982
+ hn as ErrorBoundary,
2983
+ Hr as LiveLayerDebugPanel,
2984
+ zr as LiveLayerField,
2985
+ $r as LiveLayerForm,
2986
+ Dr as LiveLayerRegion,
2987
+ Pr as LiveLayerWidget,
2988
+ dr as clearPageContextCache,
2989
+ gr as clearRoutesCache,
2990
+ sr as extractPageContext,
2991
+ hr as extractRoutes,
2992
+ qt as getCachedPageContext,
2993
+ ct as getCachedRoutes,
2994
+ zn as matchesPattern,
2995
+ fr as normalizeRouteInput,
2996
+ Hn as shouldRenderAtPath,
2997
+ xn as useAgentInfo,
2998
+ gn as useAudioLevel,
2999
+ bn as useCameraState,
3000
+ Sn as useDisplayMode,
3001
+ Nn as useDisplayModePersistence,
3002
+ Rn as useIsMobile,
3003
+ mn as useLiveKitSession,
3004
+ _n as useMediaDevices,
3005
+ yn as useMicrophoneState,
3006
+ Mn as usePathname,
3007
+ On as useRouteMatch,
3008
+ wn as useScreenShareState,
3009
+ Or as useTranscript
2919
3010
  };