@livelayer/react 0.5.14 → 0.5.16

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