@livelayer/react 0.9.1 → 0.9.2

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,10 @@
1
1
  "use client";
2
2
  import { jsxs as g, jsx as n, Fragment as lt } from "react/jsx-runtime";
3
- import { Component as An, useState as L, useRef as E, useEffect as N, useCallback as x, useMemo as je, forwardRef as at, useImperativeHandle as Rn, createElement as Tn } from "react";
4
- import { LiveKitSession as In } from "@livelayer/sdk";
5
- import { createLocalAudioTrack as Mn, Track as sn, createLocalVideoTrack as Pn } from "livekit-client";
6
- class Dn extends An {
3
+ import { Component as In, useState as L, useRef as S, useEffect as A, useCallback as k, useMemo as Ue, useLayoutEffect as Tn, forwardRef as at, useImperativeHandle as Mn, createElement as Dn } from "react";
4
+ import { LiveKitSession as Pn } from "@livelayer/sdk";
5
+ import { createLocalAudioTrack as $n, Track as dn, createLocalVideoTrack as zn } from "livekit-client";
6
+ import { createPortal as On } from "react-dom";
7
+ class Hn extends In {
7
8
  constructor() {
8
9
  super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
9
10
  this.setState({ hasError: !1, error: null });
@@ -33,26 +34,26 @@ class Dn extends An {
33
34
  ] }) : this.props.children;
34
35
  }
35
36
  }
36
- function $n(e) {
37
- const [t, r] = L("idle"), [o, i] = L("idle"), [l, d] = L([]), [s, u] = L(null), [f, m] = L(null), [a, c] = L(null), [R, P] = L(!1), [C, v] = L(null), b = E(null), A = E(e.onDataMessage);
38
- A.current = e.onDataMessage, N(() => {
39
- const T = {
37
+ function Wn(e) {
38
+ const [t, r] = L("idle"), [o, i] = L("idle"), [l, u] = L([]), [d, c] = L(null), [f, h] = L(null), [a, s] = L(null), [R, D] = L(!1), [E, v] = L(null), b = S(null), N = S(e.onDataMessage);
39
+ N.current = e.onDataMessage, A(() => {
40
+ const I = {
40
41
  onConnectionStateChange: (z) => {
41
42
  r(z), z === "connected" && v(null);
42
43
  },
43
44
  onAgentStateChange: i,
44
- onTranscript: (z) => d([...z]),
45
- onAgentConfig: u,
46
- onAudioTrack: (z) => c(z),
47
- onVideoTrack: (z) => m(z),
48
- onVideoTrackRemoved: () => m(null),
45
+ onTranscript: (z) => u([...z]),
46
+ onAgentConfig: c,
47
+ onAudioTrack: (z) => s(z),
48
+ onVideoTrack: (z) => h(z),
49
+ onVideoTrackRemoved: () => h(null),
49
50
  onError: (z) => v(z),
50
51
  onDataMessage: (z) => {
51
- var S;
52
- (S = A.current) == null || S.call(A, z);
52
+ var C;
53
+ (C = N.current) == null || C.call(N, z);
53
54
  },
54
- onResumabilityChange: P
55
- }, B = new In(
55
+ onResumabilityChange: D
56
+ }, B = new Pn(
56
57
  {
57
58
  agentId: e.agentId,
58
59
  baseUrl: e.baseUrl,
@@ -60,9 +61,9 @@ function $n(e) {
60
61
  sessionEndpoint: e.sessionEndpoint,
61
62
  sessionBody: e.sessionBody
62
63
  },
63
- T
64
+ I
64
65
  );
65
- return b.current = B, r("idle"), i("idle"), d([]), u(null), m(null), c(null), P(!1), v(null), () => {
66
+ return b.current = B, r("idle"), i("idle"), u([]), c(null), h(null), s(null), D(!1), v(null), () => {
66
67
  var z;
67
68
  (z = B.destroy) == null || z.call(B), b.current = null;
68
69
  };
@@ -73,38 +74,38 @@ function $n(e) {
73
74
  e.sessionEndpoint,
74
75
  JSON.stringify(e.sessionBody ?? {})
75
76
  ]);
76
- const I = x(async () => {
77
- const T = b.current;
78
- if (T)
77
+ const T = k(async () => {
78
+ const I = b.current;
79
+ if (I)
79
80
  try {
80
- await T.connect();
81
+ await I.connect();
81
82
  } catch (B) {
82
83
  throw v(B instanceof Error ? B.message : String(B)), B;
83
84
  }
84
- }, []), $ = x(() => {
85
- const T = b.current;
86
- T && T.disconnect();
87
- }, []), w = x(() => {
88
- var T;
89
- return ((T = b.current) == null ? void 0 : T.getRoom()) ?? null;
85
+ }, []), $ = k(() => {
86
+ const I = b.current;
87
+ I && I.disconnect();
88
+ }, []), w = k(() => {
89
+ var I;
90
+ return ((I = b.current) == null ? void 0 : I.getRoom()) ?? null;
90
91
  }, []);
91
92
  return {
92
93
  connectionState: t,
93
94
  agentState: o,
94
95
  transcript: l,
95
- agentConfig: s,
96
+ agentConfig: d,
96
97
  videoElement: f,
97
98
  audioElement: a,
98
99
  canResume: R,
99
- error: C,
100
- connect: I,
100
+ error: E,
101
+ connect: T,
101
102
  disconnect: $,
102
103
  getRoom: w,
103
104
  session: b.current
104
105
  };
105
106
  }
106
- function zn() {
107
- const e = E(null), t = E(null), r = E(null), o = E(null), i = E(/* @__PURE__ */ new Set()), l = E(null), d = x(() => {
107
+ function Bn() {
108
+ const e = S(null), t = S(null), r = S(null), o = S(null), i = S(/* @__PURE__ */ new Set()), l = S(null), u = k(() => {
108
109
  const a = t.current;
109
110
  if (!a) {
110
111
  o.current = null;
@@ -113,25 +114,25 @@ function zn() {
113
114
  (!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
114
115
  new ArrayBuffer(a.frequencyBinCount)
115
116
  ));
116
- const c = l.current;
117
- a.getByteFrequencyData(c);
117
+ const s = l.current;
118
+ a.getByteFrequencyData(s);
118
119
  let R = 0;
119
- for (let C = 0; C < c.length; C++) R += c[C];
120
- const P = R / c.length / 255;
121
- for (const C of i.current)
120
+ for (let E = 0; E < s.length; E++) R += s[E];
121
+ const D = R / s.length / 255;
122
+ for (const E of i.current)
122
123
  try {
123
- C(P);
124
+ E(D);
124
125
  } catch (v) {
125
126
  console.error("[useAudioLevel] subscriber threw:", v);
126
127
  }
127
- o.current = requestAnimationFrame(d);
128
- }, []), s = x(() => {
128
+ o.current = requestAnimationFrame(u);
129
+ }, []), d = k(() => {
129
130
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
- const a = new AudioContext(), c = a.createAnalyser();
131
- c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
132
- }, []), u = x(
131
+ const a = new AudioContext(), s = a.createAnalyser();
132
+ s.fftSize = 64, s.connect(a.destination), e.current = a, t.current = s;
133
+ }, []), c = k(
133
134
  (a) => {
134
- if (s(), !(!e.current || !t.current)) {
135
+ if (d(), !(!e.current || !t.current)) {
135
136
  if (r.current) {
136
137
  try {
137
138
  r.current.disconnect();
@@ -140,17 +141,17 @@ function zn() {
140
141
  r.current = null;
141
142
  }
142
143
  try {
143
- const c = e.current.createMediaElementSource(a);
144
- c.connect(t.current), r.current = c;
145
- } catch (c) {
146
- console.warn("[useAudioLevel] createMediaElementSource failed:", c);
144
+ const s = e.current.createMediaElementSource(a);
145
+ s.connect(t.current), r.current = s;
146
+ } catch (s) {
147
+ console.warn("[useAudioLevel] createMediaElementSource failed:", s);
147
148
  return;
148
149
  }
149
- o.current === null && (o.current = requestAnimationFrame(d));
150
+ o.current === null && (o.current = requestAnimationFrame(u));
150
151
  }
151
152
  },
152
- [s, d]
153
- ), f = x(() => {
153
+ [d, u]
154
+ ), f = k(() => {
154
155
  if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
155
156
  try {
156
157
  r.current.disconnect();
@@ -158,10 +159,10 @@ function zn() {
158
159
  }
159
160
  r.current = null;
160
161
  }
161
- }, []), m = x((a) => (i.current.add(a), () => {
162
+ }, []), h = k((a) => (i.current.add(a), () => {
162
163
  i.current.delete(a);
163
164
  }), []);
164
- return N(() => () => {
165
+ return A(() => () => {
165
166
  if (f(), t.current) {
166
167
  try {
167
168
  t.current.disconnect();
@@ -177,10 +178,10 @@ function zn() {
177
178
  e.current = null;
178
179
  }
179
180
  i.current.clear(), l.current = null;
180
- }, [f]), { attach: u, detach: f, subscribe: m };
181
+ }, [f]), { attach: c, detach: f, subscribe: h };
181
182
  }
182
- function On() {
183
- const [e, t] = L(!1), [r, o] = L(null), i = E(null), l = E(null), d = x(async (m) => {
183
+ function qn() {
184
+ const [e, t] = L(!1), [r, o] = L(null), i = S(null), l = S(null), u = k(async (h) => {
184
185
  if (i.current && l.current) {
185
186
  try {
186
187
  await l.current.localParticipant.unpublishTrack(i.current);
@@ -188,127 +189,127 @@ function On() {
188
189
  }
189
190
  i.current.stop(), i.current = null;
190
191
  }
191
- l.current = m, o(null);
192
+ l.current = h, o(null);
192
193
  try {
193
- const a = await Mn({
194
+ const a = await $n({
194
195
  echoCancellation: !0,
195
196
  noiseSuppression: !0
196
197
  });
197
- await m.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
198
+ await h.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
198
199
  } catch (a) {
199
- const c = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
- throw o(c), a;
200
+ const s = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
201
+ throw o(s), a;
201
202
  }
202
- }, []), s = x(() => {
203
- const m = i.current;
204
- m && (m.isMuted ? (m.unmute(), t(!1)) : (m.mute(), t(!0)));
205
- }, []), u = x(() => {
206
- const m = i.current, a = l.current;
207
- if (m && a) {
203
+ }, []), d = k(() => {
204
+ const h = i.current;
205
+ h && (h.isMuted ? (h.unmute(), t(!1)) : (h.mute(), t(!0)));
206
+ }, []), c = k(() => {
207
+ const h = i.current, a = l.current;
208
+ if (h && a) {
208
209
  try {
209
- a.localParticipant.unpublishTrack(m);
210
+ a.localParticipant.unpublishTrack(h);
210
211
  } catch {
211
212
  }
212
- m.stop();
213
+ h.stop();
213
214
  }
214
215
  i.current = null, l.current = null, t(!1);
215
- }, []), f = x(() => o(null), []);
216
+ }, []), f = k(() => o(null), []);
216
217
  return {
217
218
  isMuted: e,
218
219
  micError: r,
219
- toggleMute: s,
220
- setupMic: d,
221
- teardownMic: u,
220
+ toggleMute: d,
221
+ setupMic: u,
222
+ teardownMic: c,
222
223
  clearError: f
223
224
  };
224
225
  }
225
- const Hn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
- function Wn() {
227
- const [e, t] = L(!1), [r, o] = L(null), [i, l] = L(null), [d, s] = L(""), u = E(null), f = E(null), m = x((b) => {
228
- u.current = b;
229
- }, []), a = x(() => {
230
- const b = u.current, A = f.current;
231
- if (A && b) {
232
- const I = b.localParticipant.getTrackPublication(sn.Source.Camera);
233
- if (I != null && I.track) {
226
+ const Fn = { resolution: { width: 640, height: 480, frameRate: 24 } };
227
+ function Un() {
228
+ const [e, t] = L(!1), [r, o] = L(null), [i, l] = L(null), [u, d] = L(""), c = S(null), f = S(null), h = k((b) => {
229
+ c.current = b;
230
+ }, []), a = k(() => {
231
+ const b = c.current, N = f.current;
232
+ if (N && b) {
233
+ const T = b.localParticipant.getTrackPublication(dn.Source.Camera);
234
+ if (T != null && T.track) {
234
235
  try {
235
- b.localParticipant.unpublishTrack(I.track);
236
+ b.localParticipant.unpublishTrack(T.track);
236
237
  } catch {
237
238
  }
238
- I.track.stop();
239
+ T.track.stop();
239
240
  } else
240
- A.stop();
241
+ N.stop();
241
242
  }
242
243
  f.current = null, l(null), t(!1);
243
- }, []), c = x(async (b) => {
244
- const A = u.current;
245
- if (A) {
244
+ }, []), s = k(async (b) => {
245
+ const N = c.current;
246
+ if (N) {
246
247
  o(null);
247
248
  try {
248
- const I = { ...Hn };
249
- b && (I.deviceId = b);
250
- const $ = await Pn(I);
251
- await A.localParticipant.publishTrack($), f.current = $;
249
+ const T = { ...Fn };
250
+ b && (T.deviceId = b);
251
+ const $ = await zn(T);
252
+ await N.localParticipant.publishTrack($), f.current = $;
252
253
  const w = $.attach();
253
- l(w), t(!0), b && s(b);
254
+ l(w), t(!0), b && d(b);
254
255
  try {
255
- A.localParticipant.publishData(
256
+ N.localParticipant.publishData(
256
257
  new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
257
258
  { reliable: !0 }
258
259
  );
259
260
  } catch {
260
261
  }
261
- } catch (I) {
262
- const $ = I instanceof Error && I.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
262
+ } catch (T) {
263
+ const $ = T instanceof Error && T.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
264
  o($);
264
265
  }
265
266
  }
266
- }, []), R = x(async () => {
267
- e ? a() : await c(d || void 0);
268
- }, [e, d, a, c]), P = x(async (b) => {
269
- a(), await c(b);
270
- }, [a, c]), C = x(() => {
271
- a(), u.current = null, o(null), s("");
272
- }, [a]), v = x(() => o(null), []);
273
- return N(() => () => {
267
+ }, []), R = k(async () => {
268
+ e ? a() : await s(u || void 0);
269
+ }, [e, u, a, s]), D = k(async (b) => {
270
+ a(), await s(b);
271
+ }, [a, s]), E = k(() => {
272
+ a(), c.current = null, o(null), d("");
273
+ }, [a]), v = k(() => o(null), []);
274
+ return A(() => () => {
274
275
  f.current && f.current.stop();
275
276
  }, []), {
276
277
  isEnabled: e,
277
278
  error: r,
278
279
  previewEl: i,
279
- activeDeviceId: d,
280
+ activeDeviceId: u,
280
281
  toggle: R,
281
- switchDevice: P,
282
- attachRoom: m,
283
- teardown: C,
282
+ switchDevice: D,
283
+ attachRoom: h,
284
+ teardown: E,
284
285
  clearError: v
285
286
  };
286
287
  }
287
- function Bn() {
288
- const [e, t] = L(!1), [r, o] = L(null), [i, l] = L(null), d = E(null), s = x((c) => {
289
- d.current = c;
290
- }, []), u = x(() => l(null), []), f = x(async () => {
291
- const c = d.current;
292
- if (c) {
288
+ function jn() {
289
+ const [e, t] = L(!1), [r, o] = L(null), [i, l] = L(null), u = S(null), d = k((s) => {
290
+ u.current = s;
291
+ }, []), c = k(() => l(null), []), f = k(async () => {
292
+ const s = u.current;
293
+ if (s) {
293
294
  if (e) {
294
295
  try {
295
- await c.localParticipant.setScreenShareEnabled(!1);
296
+ await s.localParticipant.setScreenShareEnabled(!1);
296
297
  } catch {
297
298
  }
298
- u(), t(!1);
299
+ c(), t(!1);
299
300
  return;
300
301
  }
301
302
  o(null);
302
303
  try {
303
- await c.localParticipant.setScreenShareEnabled(!0);
304
+ await s.localParticipant.setScreenShareEnabled(!0);
304
305
  let R = 0;
305
- const P = () => {
306
- const C = c.localParticipant.getTrackPublication(sn.Source.ScreenShare);
307
- if (C != null && C.track) {
308
- const v = C.track.attach();
306
+ const D = () => {
307
+ const E = s.localParticipant.getTrackPublication(dn.Source.ScreenShare);
308
+ if (E != null && E.track) {
309
+ const v = E.track.attach();
309
310
  l(v), t(!0);
310
311
  try {
311
- c.localParticipant.publishData(
312
+ s.localParticipant.publishData(
312
313
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
313
314
  { reliable: !0 }
314
315
  );
@@ -316,64 +317,64 @@ function Bn() {
316
317
  }
317
318
  return;
318
319
  }
319
- R++ < 10 ? setTimeout(P, 100) : t(!0);
320
+ R++ < 10 ? setTimeout(D, 100) : t(!0);
320
321
  };
321
- P();
322
+ D();
322
323
  } catch (R) {
323
- const P = R instanceof Error ? R.name : "";
324
- P !== "NotAllowedError" && P !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
324
+ const D = R instanceof Error ? R.name : "";
325
+ D !== "NotAllowedError" && D !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
325
326
  }
326
327
  }
327
- }, [e, u]), m = x(() => {
328
- const c = d.current;
329
- if (c && e)
328
+ }, [e, c]), h = k(() => {
329
+ const s = u.current;
330
+ if (s && e)
330
331
  try {
331
- c.localParticipant.setScreenShareEnabled(!1);
332
+ s.localParticipant.setScreenShareEnabled(!1);
332
333
  } catch {
333
334
  }
334
- u(), t(!1), o(null), d.current = null;
335
- }, [e, u]), a = x(() => o(null), []);
336
- return { isEnabled: e, error: r, previewEl: i, toggle: f, attachRoom: s, teardown: m, clearError: a };
335
+ c(), t(!1), o(null), u.current = null;
336
+ }, [e, c]), a = k(() => o(null), []);
337
+ return { isEnabled: e, error: r, previewEl: i, toggle: f, attachRoom: d, teardown: h, clearError: a };
337
338
  }
338
- function qn() {
339
- const [e, t] = L([]), [r, o] = L([]), i = x(async () => {
339
+ function Vn() {
340
+ const [e, t] = L([]), [r, o] = L([]), i = k(async () => {
340
341
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
341
342
  try {
342
343
  const l = await navigator.mediaDevices.enumerateDevices();
343
- t(l.filter((d) => d.kind === "audioinput")), o(l.filter((d) => d.kind === "videoinput"));
344
+ t(l.filter((u) => u.kind === "audioinput")), o(l.filter((u) => u.kind === "videoinput"));
344
345
  } catch {
345
346
  }
346
347
  }, []);
347
- return N(() => {
348
+ return A(() => {
348
349
  if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
350
  const l = () => void i();
350
351
  return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
351
352
  }, [i]), { mics: e, cameras: r, refresh: i };
352
353
  }
353
- function Fn(e, t, r = !1) {
354
- const [o, i] = L(null), [l, d] = L(null), [s, u] = L(!r && !!e);
355
- return N(() => {
354
+ function Yn(e, t, r = !1) {
355
+ const [o, i] = L(null), [l, u] = L(null), [d, c] = L(!r && !!e);
356
+ return A(() => {
356
357
  if (r || !e) {
357
- u(!1);
358
+ c(!1);
358
359
  return;
359
360
  }
360
- const f = new AbortController(), m = t || "https://app.livelayer.studio";
361
- return u(!0), d(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
361
+ const f = new AbortController(), h = t || "https://app.livelayer.studio";
362
+ return c(!0), u(null), fetch(`${h}/api/widget/agent/${encodeURIComponent(e)}`, {
362
363
  signal: f.signal
363
364
  }).then(async (a) => {
364
365
  if (!a.ok) {
365
- const c = await a.json().catch(() => ({}));
366
- throw new Error(c.error || `HTTP ${a.status}`);
366
+ const s = await a.json().catch(() => ({}));
367
+ throw new Error(s.error || `HTTP ${a.status}`);
367
368
  }
368
369
  return a.json();
369
370
  }).then((a) => {
370
- f.signal.aborted || (i(a), u(!1));
371
+ f.signal.aborted || (i(a), c(!1));
371
372
  }).catch((a) => {
372
- f.signal.aborted || (d(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
373
+ f.signal.aborted || (u(a instanceof Error ? a.message : "Agent lookup failed"), c(!1));
373
374
  }), () => f.abort();
374
- }, [e, t, r]), { info: o, error: l, loading: s };
375
+ }, [e, t, r]), { info: o, error: l, loading: d };
375
376
  }
376
- function Un(e) {
377
+ function Gn(e) {
377
378
  if (typeof window > "u") return null;
378
379
  try {
379
380
  return window.localStorage.getItem(e);
@@ -381,54 +382,54 @@ function Un(e) {
381
382
  return null;
382
383
  }
383
384
  }
384
- function jn(e, t) {
385
+ function Jn(e, t) {
385
386
  if (!(typeof window > "u"))
386
387
  try {
387
388
  window.localStorage.setItem(e, t);
388
389
  } catch {
389
390
  }
390
391
  }
391
- function Vn({
392
+ function Kn({
392
393
  value: e,
393
394
  defaultValue: t = "expanded",
394
395
  onChange: r
395
396
  } = {}) {
396
- const o = e !== void 0, [i, l] = L(t), d = o ? e : i, s = x(
397
- (u) => {
398
- u !== d && (o || l(u), r == null || r(u));
397
+ const o = e !== void 0, [i, l] = L(t), u = o ? e : i, d = k(
398
+ (c) => {
399
+ c !== u && (o || l(c), r == null || r(c));
399
400
  },
400
- [d, o, r]
401
+ [u, o, r]
401
402
  );
402
- return [d, s];
403
+ return [u, d];
403
404
  }
404
- const Yn = ["hidden", "minimized", "expanded"];
405
- function Gn(e) {
406
- return e && Yn.includes(e) ? e : null;
405
+ const Xn = ["hidden", "minimized", "expanded"];
406
+ function Qn(e) {
407
+ return e && Xn.includes(e) ? e : null;
407
408
  }
408
- function Jn({
409
+ function Zn({
409
410
  value: e,
410
411
  defaultValue: t = "expanded",
411
412
  onChange: r,
412
413
  persistKey: o = "ll-widget",
413
414
  disablePersistence: i = !1
414
415
  } = {}) {
415
- const l = `${o}:display-mode`, d = E(!1), [s, u] = Vn({
416
+ const l = `${o}:display-mode`, u = S(!1), [d, c] = Kn({
416
417
  value: e,
417
418
  defaultValue: t,
418
419
  onChange: (f) => {
419
- e === void 0 && !i && jn(l, f), r == null || r(f);
420
+ e === void 0 && !i && Jn(l, f), r == null || r(f);
420
421
  }
421
422
  });
422
- return N(() => {
423
- if (d.current || (d.current = !0, i || e !== void 0)) return;
424
- const f = Gn(Un(l));
425
- f && f !== s && u(f);
426
- }, []), [s, u];
427
- }
428
- const Kn = 640;
429
- function Xn(e = Kn) {
423
+ return A(() => {
424
+ if (u.current || (u.current = !0, i || e !== void 0)) return;
425
+ const f = Qn(Gn(l));
426
+ f && f !== d && c(f);
427
+ }, []), [d, c];
428
+ }
429
+ const er = 640;
430
+ function tr(e = er) {
430
431
  const [t, r] = L(!1);
431
- return N(() => {
432
+ return A(() => {
432
433
  if (e === !1) {
433
434
  r(!1);
434
435
  return;
@@ -441,9 +442,9 @@ function Xn(e = Kn) {
441
442
  });
442
443
  }, [e]), t;
443
444
  }
444
- const Ut = "__llHistoryPatched", gt = "ll:pathname";
445
- function Qn() {
446
- if (typeof window > "u" || window.history[Ut]) return;
445
+ const jt = "__llHistoryPatched", gt = "ll:pathname";
446
+ function nr() {
447
+ if (typeof window > "u" || window.history[jt]) return;
447
448
  const e = window.history.pushState, t = window.history.replaceState;
448
449
  window.history.pushState = function(...r) {
449
450
  const o = e.apply(this, r);
@@ -451,79 +452,79 @@ function Qn() {
451
452
  }, window.history.replaceState = function(...r) {
452
453
  const o = t.apply(this, r);
453
454
  return window.dispatchEvent(new Event(gt)), o;
454
- }, window.history[Ut] = !0;
455
+ }, window.history[jt] = !0;
455
456
  }
456
- function jt() {
457
+ function Vt() {
457
458
  return typeof window > "u" ? "/" : window.location.pathname || "/";
458
459
  }
459
- function Zn(e) {
460
+ function rr(e) {
460
461
  const [t, r] = L(
461
- () => e ?? jt()
462
+ () => e ?? Vt()
462
463
  );
463
- return N(() => {
464
+ return A(() => {
464
465
  if (e !== void 0) return;
465
- Qn();
466
- const o = () => r(jt());
466
+ nr();
467
+ const o = () => r(Vt());
467
468
  return o(), window.addEventListener("popstate", o), window.addEventListener(gt, o), () => {
468
469
  window.removeEventListener("popstate", o), window.removeEventListener(gt, o);
469
470
  };
470
471
  }, [e]), e ?? t;
471
472
  }
472
- const Vt = /* @__PURE__ */ new Map(), er = /[\\^$+?.()|{}[\]]/g;
473
- function tr(e) {
474
- return e.replace(er, "\\$&");
473
+ const Yt = /* @__PURE__ */ new Map(), or = /[\\^$+?.()|{}[\]]/g;
474
+ function ir(e) {
475
+ return e.replace(or, "\\$&");
475
476
  }
476
- function nr(e) {
477
- const t = Vt.get(e);
477
+ function lr(e) {
478
+ const t = Yt.get(e);
478
479
  if (t) return t;
479
- const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), s = tr(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), u = new RegExp(`^${s}\\/?$`);
480
- return Vt.set(e, u), u;
480
+ const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = ir(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), c = new RegExp(`^${d}\\/?$`);
481
+ return Yt.set(e, c), c;
481
482
  }
482
- function rr(e, t) {
483
+ function ar(e, t) {
483
484
  const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
484
- return nr(e).test(r);
485
+ return lr(e).test(r);
485
486
  }
486
- function or(e, t) {
487
- return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : rr(e, t);
487
+ function sr(e, t) {
488
+ return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : ar(e, t);
488
489
  }
489
- function Yt(e, t) {
490
+ function Gt(e, t) {
490
491
  if (!e || e.length === 0) return !1;
491
492
  for (const r of e)
492
- if (or(r, t)) return !0;
493
+ if (sr(r, t)) return !0;
493
494
  return !1;
494
495
  }
495
- function ir(e, t, r) {
496
- return e === void 0 ? !0 : Yt(r, e) ? !1 : t && t.length > 0 ? Yt(t, e) : !0;
496
+ function cr(e, t, r) {
497
+ return e === void 0 ? !0 : Gt(r, e) ? !1 : t && t.length > 0 ? Gt(t, e) : !0;
497
498
  }
498
- function lr(e, t, r) {
499
- return je(
500
- () => ir(e, t, r),
499
+ function dr(e, t, r) {
500
+ return Ue(
501
+ () => cr(e, t, r),
501
502
  [e, t, r]
502
503
  );
503
504
  }
504
- function ar(e) {
505
+ function ur(e) {
505
506
  return e === !1 ? { navigate: !1, thinking: !1, action: !1 } : e === void 0 || e === !0 ? { navigate: !0, thinking: !0, action: !0 } : {
506
507
  navigate: e.navigate !== !1,
507
508
  thinking: e.thinking !== !1,
508
509
  action: e.action !== !1
509
510
  };
510
511
  }
511
- function sr(e) {
512
- const t = je(() => ar(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), o = E(null), i = x(
513
- (u) => {
512
+ function fr(e) {
513
+ const t = Ue(() => ur(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), o = S(null), i = k(
514
+ (c) => {
514
515
  try {
515
- new Audio(`${r}${u}`).play().catch(() => {
516
+ new Audio(`${r}${c}`).play().catch(() => {
516
517
  });
517
518
  } catch {
518
519
  }
519
520
  },
520
521
  [r]
521
- ), l = x(() => {
522
+ ), l = k(() => {
522
523
  t.navigate && i("/audio/page-change-sound.mp3");
523
- }, [t.navigate, i]), d = x(() => {
524
+ }, [t.navigate, i]), u = k(() => {
524
525
  t.action && i("/audio/confirmation-sound.mp3");
525
- }, [t.action, i]), s = x(
526
- (u) => {
526
+ }, [t.action, i]), d = k(
527
+ (c) => {
527
528
  if (!t.thinking) {
528
529
  if (o.current) {
529
530
  try {
@@ -534,7 +535,7 @@ function sr(e) {
534
535
  }
535
536
  return;
536
537
  }
537
- if (u) {
538
+ if (c) {
538
539
  if (o.current) return;
539
540
  try {
540
541
  const f = new Audio(`${r}/audio/thinking-sound.mp3`);
@@ -553,7 +554,7 @@ function sr(e) {
553
554
  },
554
555
  [r, t.thinking]
555
556
  );
556
- return N(() => () => {
557
+ return A(() => () => {
557
558
  if (o.current) {
558
559
  try {
559
560
  o.current.pause();
@@ -561,12 +562,12 @@ function sr(e) {
561
562
  }
562
563
  o.current = null;
563
564
  }
564
- }, []), je(
565
- () => ({ playPageChange: l, playConfirmation: d, setThinking: s }),
566
- [l, d, s]
565
+ }, []), Ue(
566
+ () => ({ playPageChange: l, playConfirmation: u, setThinking: d }),
567
+ [l, u, d]
567
568
  );
568
569
  }
569
- const Gt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ g(
570
+ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ g(
570
571
  "svg",
571
572
  {
572
573
  className: t,
@@ -612,7 +613,7 @@ const Gt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ g(
612
613
  }
613
614
  )
614
615
  }
615
- ), Jt = ({ className: e }) => /* @__PURE__ */ n(
616
+ ), Kt = ({ className: e }) => /* @__PURE__ */ n(
616
617
  "svg",
617
618
  {
618
619
  className: e,
@@ -630,7 +631,7 @@ const Gt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ g(
630
631
  }
631
632
  )
632
633
  }
633
- ), cr = ({ className: e }) => /* @__PURE__ */ n(
634
+ ), pr = ({ className: e }) => /* @__PURE__ */ n(
634
635
  "svg",
635
636
  {
636
637
  className: e,
@@ -641,12 +642,12 @@ const Gt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ g(
641
642
  "aria-hidden": "true",
642
643
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
643
644
  }
644
- ), dr = {
645
+ ), hr = {
645
646
  left: 180,
646
647
  right: 0,
647
648
  up: -90,
648
649
  down: 90
649
- }, Kt = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
650
+ }, Xt = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
650
651
  "svg",
651
652
  {
652
653
  className: t,
@@ -654,19 +655,19 @@ const Gt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ g(
654
655
  viewBox: "0 0 24 24",
655
656
  stroke: "currentColor",
656
657
  strokeWidth: 2,
657
- style: { transform: `rotate(${dr[e]}deg)` },
658
+ style: { transform: `rotate(${hr[e]}deg)` },
658
659
  "aria-hidden": "true",
659
660
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
660
661
  }
661
662
  );
662
- function ur(e) {
663
+ function mr(e) {
663
664
  return e === "top-left" || e === "bottom-left" ? "left" : "right";
664
665
  }
665
- const cn = "ll-hidden-tab-center-y", fr = 5, Xt = 16;
666
- function pr() {
666
+ const un = "ll-hidden-tab-center-y", gr = 5, Qt = 16;
667
+ function yr() {
667
668
  if (typeof window > "u") return null;
668
669
  try {
669
- const e = window.localStorage.getItem(cn);
670
+ const e = window.localStorage.getItem(un);
670
671
  if (!e) return null;
671
672
  const t = Number.parseFloat(e);
672
673
  return Number.isFinite(t) ? t : null;
@@ -674,124 +675,124 @@ function pr() {
674
675
  return null;
675
676
  }
676
677
  }
677
- function Qt(e) {
678
+ function Zt(e) {
678
679
  if (!(typeof window > "u"))
679
680
  try {
680
- window.localStorage.setItem(cn, String(e));
681
+ window.localStorage.setItem(un, String(e));
681
682
  } catch {
682
683
  }
683
684
  }
684
- const hr = ({
685
+ const vr = ({
685
686
  position: e,
686
687
  isMobile: t,
687
688
  isSpeaking: r,
688
689
  onExpand: o,
689
690
  label: i = "Open widget",
690
691
  avatarImageUrl: l,
691
- agentName: d
692
+ agentName: u
692
693
  }) => {
693
- const s = ur(e), u = s === "right" ? "left" : "right", f = t ? 80 : 72, m = !!l, [a, c] = L(null), [R, P] = L(!1), C = E(null), v = E(!1), b = x(
694
- (S) => {
695
- if (typeof window > "u") return S;
696
- const D = f / 2, q = Xt + D, G = window.innerHeight - Xt - D;
697
- return G < q ? Math.max(q, S) : Math.max(q, Math.min(G, S));
694
+ const d = mr(e), c = d === "right" ? "left" : "right", f = t ? 80 : 72, h = !!l, [a, s] = L(null), [R, D] = L(!1), E = S(null), v = S(!1), b = k(
695
+ (C) => {
696
+ if (typeof window > "u") return C;
697
+ const P = f / 2, F = Qt + P, G = window.innerHeight - Qt - P;
698
+ return G < F ? Math.max(F, C) : Math.max(F, Math.min(G, C));
698
699
  },
699
700
  [f]
700
701
  );
701
- N(() => {
702
- const S = pr();
703
- c(b(S ?? window.innerHeight / 2));
704
- const D = () => {
705
- c((q) => q === null ? null : b(q));
702
+ A(() => {
703
+ const C = yr();
704
+ s(b(C ?? window.innerHeight / 2));
705
+ const P = () => {
706
+ s((F) => F === null ? null : b(F));
706
707
  };
707
- return window.addEventListener("resize", D), () => window.removeEventListener("resize", D);
708
+ return window.addEventListener("resize", P), () => window.removeEventListener("resize", P);
708
709
  }, [b]);
709
- const A = x(
710
- (S) => {
711
- if (!(S.pointerType === "mouse" && S.button !== 0) && a !== null) {
710
+ const N = k(
711
+ (C) => {
712
+ if (!(C.pointerType === "mouse" && C.button !== 0) && a !== null) {
712
713
  try {
713
- S.currentTarget.setPointerCapture(S.pointerId);
714
+ C.currentTarget.setPointerCapture(C.pointerId);
714
715
  } catch {
715
716
  }
716
- C.current = {
717
- startClientY: S.clientY,
717
+ E.current = {
718
+ startClientY: C.clientY,
718
719
  startCenterY: a,
719
720
  moved: !1
720
721
  };
721
722
  }
722
723
  },
723
724
  [a]
724
- ), I = x(
725
- (S) => {
726
- const D = C.current;
727
- if (!D) return;
728
- const q = S.clientY - D.startClientY;
729
- !D.moved && Math.abs(q) > fr && (D.moved = !0, P(!0)), D.moved && c(b(D.startCenterY + q));
725
+ ), T = k(
726
+ (C) => {
727
+ const P = E.current;
728
+ if (!P) return;
729
+ const F = C.clientY - P.startClientY;
730
+ !P.moved && Math.abs(F) > gr && (P.moved = !0, D(!0)), P.moved && s(b(P.startCenterY + F));
730
731
  },
731
732
  [b]
732
- ), $ = x(
733
- (S) => {
734
- const D = C.current;
735
- if (D) {
733
+ ), $ = k(
734
+ (C) => {
735
+ const P = E.current;
736
+ if (P) {
736
737
  try {
737
- S.currentTarget.releasePointerCapture(S.pointerId);
738
+ C.currentTarget.releasePointerCapture(C.pointerId);
738
739
  } catch {
739
740
  }
740
- C.current = null, D.moved && (P(!1), v.current = !0, c((q) => (q !== null && Qt(q), q)));
741
+ E.current = null, P.moved && (D(!1), v.current = !0, s((F) => (F !== null && Zt(F), F)));
741
742
  }
742
743
  },
743
744
  []
744
- ), w = x(() => {
745
+ ), w = k(() => {
745
746
  if (v.current) {
746
747
  v.current = !1;
747
748
  return;
748
749
  }
749
750
  o();
750
- }, [o]), T = x(
751
- (S) => {
752
- if (S.key === "ArrowUp" || S.key === "ArrowDown") {
753
- S.preventDefault();
754
- const D = S.key === "ArrowUp" ? -8 : 8;
755
- c((q) => {
756
- if (q === null) return q;
757
- const G = b(q + D);
758
- return Qt(G), G;
751
+ }, [o]), I = k(
752
+ (C) => {
753
+ if (C.key === "ArrowUp" || C.key === "ArrowDown") {
754
+ C.preventDefault();
755
+ const P = C.key === "ArrowUp" ? -8 : 8;
756
+ s((F) => {
757
+ if (F === null) return F;
758
+ const G = b(F + P);
759
+ return Zt(G), G;
759
760
  });
760
761
  }
761
762
  },
762
763
  [b]
763
764
  ), B = [
764
765
  "ll-hidden",
765
- `ll-hidden--${s}`,
766
+ `ll-hidden--${d}`,
766
767
  t ? "ll-hidden--mobile" : "ll-hidden--desktop",
767
768
  r ? "ll-hidden--speaking" : null,
768
769
  R ? "is-dragging" : null,
769
- m ? "ll-hidden--with-avatar" : null
770
+ h ? "ll-hidden--with-avatar" : null
770
771
  ].filter(Boolean).join(" "), z = a === null ? void 0 : { top: `${a - f / 2}px`, transform: "none" };
771
772
  return /* @__PURE__ */ n(
772
773
  "button",
773
774
  {
774
775
  type: "button",
775
776
  className: B,
776
- onPointerDown: A,
777
- onPointerMove: I,
777
+ onPointerDown: N,
778
+ onPointerMove: T,
778
779
  onPointerUp: $,
779
780
  onPointerCancel: $,
780
781
  onClick: w,
781
- onKeyDown: T,
782
+ onKeyDown: I,
782
783
  "aria-label": i,
783
784
  "data-position": e,
784
785
  style: z,
785
- children: m ? (
786
+ children: h ? (
786
787
  // Layout: tiny chevron flush against the inward edge (peeks out
787
788
  // as the click affordance), then the circular avatar photo
788
789
  // taking the rest of the tab. Reinforces "this is an
789
790
  // avatar-based experience" even when collapsed.
790
791
  /* @__PURE__ */ g(lt, { children: [
791
792
  /* @__PURE__ */ n(
792
- Kt,
793
+ Xt,
793
794
  {
794
- direction: u,
795
+ direction: c,
795
796
  className: "ll-hidden__chevron ll-hidden__chevron--mini"
796
797
  }
797
798
  ),
@@ -799,22 +800,22 @@ const hr = ({
799
800
  "img",
800
801
  {
801
802
  src: l,
802
- alt: d ? `${d} avatar` : "Agent avatar",
803
+ alt: u ? `${u} avatar` : "Agent avatar",
803
804
  className: "ll-hidden__avatar",
804
805
  draggable: !1
805
806
  }
806
807
  )
807
808
  ] })
808
809
  ) : /* @__PURE__ */ n(
809
- Kt,
810
+ Xt,
810
811
  {
811
- direction: u,
812
+ direction: c,
812
813
  className: "ll-hidden__chevron"
813
814
  }
814
815
  )
815
816
  }
816
817
  );
817
- }, mr = ({
818
+ }, br = ({
818
819
  audioLevel: e,
819
820
  bars: t = 20,
820
821
  maxHeight: r = 20,
@@ -822,40 +823,40 @@ const hr = ({
822
823
  className: i,
823
824
  barClassName: l
824
825
  }) => {
825
- const d = E(null), s = E([]), u = je(() => {
826
- const m = (Math.sqrt(5) - 1) / 2;
827
- return Array.from({ length: t }, (a, c) => 0.5 + c * m % 1 * 0.5);
826
+ const u = S(null), d = S([]), c = Ue(() => {
827
+ const h = (Math.sqrt(5) - 1) / 2;
828
+ return Array.from({ length: t }, (a, s) => 0.5 + s * h % 1 * 0.5);
828
829
  }, [t]);
829
- N(() => e.subscribe((a) => {
830
- for (let c = 0; c < t; c++) {
831
- const R = s.current[c];
830
+ A(() => e.subscribe((a) => {
831
+ for (let s = 0; s < t; s++) {
832
+ const R = d.current[s];
832
833
  if (!R) continue;
833
- const P = Math.max(o, a * r * u[c]);
834
- R.style.height = `${P}px`;
834
+ const D = Math.max(o, a * r * c[s]);
835
+ R.style.height = `${D}px`;
835
836
  }
836
- }), [e, t, r, o, u]);
837
+ }), [e, t, r, o, c]);
837
838
  const f = ["ll-waveform", i].filter(Boolean).join(" ");
838
- return /* @__PURE__ */ n("div", { ref: d, className: f, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
839
+ return /* @__PURE__ */ n("div", { ref: u, className: f, "aria-hidden": "true", children: Array.from({ length: t }, (h, a) => /* @__PURE__ */ n(
839
840
  "div",
840
841
  {
841
- ref: (c) => {
842
- s.current[a] = c;
842
+ ref: (s) => {
843
+ d.current[a] = s;
843
844
  },
844
845
  className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
845
846
  style: { height: `${o}px` }
846
847
  },
847
848
  a
848
849
  )) });
849
- }, gr = ({
850
+ }, wr = ({
850
851
  position: e,
851
852
  isMobile: t,
852
853
  agentName: r,
853
854
  avatarImageUrl: o,
854
855
  agentState: i,
855
856
  isMuted: l,
856
- audioLevel: d,
857
- onExpand: s,
858
- onToggleMute: u,
857
+ audioLevel: u,
858
+ onExpand: d,
859
+ onToggleMute: c,
859
860
  onClose: f
860
861
  }) => t ? /* @__PURE__ */ n(
861
862
  "div",
@@ -868,7 +869,7 @@ const hr = ({
868
869
  {
869
870
  type: "button",
870
871
  className: "ll-minimized__surface",
871
- onClick: s,
872
+ onClick: d,
872
873
  "aria-label": `Expand ${r} widget`,
873
874
  children: [
874
875
  o ? (
@@ -883,9 +884,9 @@ const hr = ({
883
884
  )
884
885
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
885
886
  /* @__PURE__ */ n(
886
- mr,
887
+ br,
887
888
  {
888
- audioLevel: d,
889
+ audioLevel: u,
889
890
  bars: 16,
890
891
  maxHeight: 18,
891
892
  className: "ll-minimized__waveform"
@@ -899,17 +900,17 @@ const hr = ({
899
900
  className: "ll-minimized__btn",
900
901
  role: "button",
901
902
  tabIndex: 0,
902
- onClick: (m) => {
903
- m.stopPropagation(), u();
903
+ onClick: (h) => {
904
+ h.stopPropagation(), c();
904
905
  },
905
- onKeyDown: (m) => {
906
- (m.key === "Enter" || m.key === " ") && (m.stopPropagation(), m.preventDefault(), u());
906
+ onKeyDown: (h) => {
907
+ (h.key === "Enter" || h.key === " ") && (h.stopPropagation(), h.preventDefault(), c());
907
908
  },
908
909
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
909
- children: /* @__PURE__ */ n(Gt, { muted: l, className: "ll-minimized__icon" })
910
+ children: /* @__PURE__ */ n(Jt, { muted: l, className: "ll-minimized__icon" })
910
911
  }
911
912
  ),
912
- /* @__PURE__ */ n(Jt, { className: "ll-minimized__icon ll-minimized__icon--expand" })
913
+ /* @__PURE__ */ n(Kt, { className: "ll-minimized__icon ll-minimized__icon--expand" })
913
914
  ] })
914
915
  ]
915
916
  }
@@ -944,9 +945,9 @@ const hr = ({
944
945
  {
945
946
  type: "button",
946
947
  className: "ll-minimized__btn",
947
- onClick: u,
948
+ onClick: c,
948
949
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
949
- children: /* @__PURE__ */ n(Gt, { muted: l, className: "ll-minimized__icon" })
950
+ children: /* @__PURE__ */ n(Jt, { muted: l, className: "ll-minimized__icon" })
950
951
  }
951
952
  ),
952
953
  /* @__PURE__ */ n(
@@ -954,9 +955,9 @@ const hr = ({
954
955
  {
955
956
  type: "button",
956
957
  className: "ll-minimized__btn",
957
- onClick: s,
958
+ onClick: d,
958
959
  "aria-label": `Expand ${r} widget`,
959
- children: /* @__PURE__ */ n(Jt, { className: "ll-minimized__icon" })
960
+ children: /* @__PURE__ */ n(Kt, { className: "ll-minimized__icon" })
960
961
  }
961
962
  ),
962
963
  /* @__PURE__ */ n(
@@ -966,24 +967,24 @@ const hr = ({
966
967
  className: "ll-minimized__btn ll-minimized__btn--close",
967
968
  onClick: f,
968
969
  "aria-label": "Close widget",
969
- children: /* @__PURE__ */ n(cr, { className: "ll-minimized__icon" })
970
+ children: /* @__PURE__ */ n(pr, { className: "ll-minimized__icon" })
970
971
  }
971
972
  )
972
973
  ] })
973
974
  ] })
974
975
  }
975
- ), yr = ({
976
+ ), _r = ({
976
977
  src: e,
977
978
  alt: t,
978
979
  preCannedPlaying: r = !1,
979
980
  className: o,
980
981
  style: i
981
982
  }) => {
982
- const [l, d] = L(!1), s = E(e);
983
- if (N(() => {
984
- s.current !== e && (s.current = e, d(!1));
983
+ const [l, u] = L(!1), d = S(e);
984
+ if (A(() => {
985
+ d.current !== e && (d.current = e, u(!1));
985
986
  }, [e]), !e) return null;
986
- const u = {
987
+ const c = {
987
988
  position: "absolute",
988
989
  inset: 0,
989
990
  width: "100%",
@@ -1003,77 +1004,85 @@ const hr = ({
1003
1004
  src: e,
1004
1005
  alt: t,
1005
1006
  className: o,
1006
- style: u,
1007
+ style: c,
1007
1008
  loading: "eager",
1008
1009
  fetchPriority: "high",
1009
- onLoad: () => d(!0)
1010
+ onLoad: () => u(!0)
1010
1011
  }
1011
1012
  )
1012
1013
  );
1013
- }, vr = ({
1014
+ }, xr = 8, en = 8, kr = ({
1014
1015
  open: e,
1015
1016
  onClose: t,
1016
1017
  anchorRef: r,
1017
1018
  children: o
1018
1019
  }) => {
1019
- const i = E(null), [l, d] = L(null);
1020
- return N(() => {
1020
+ const i = S(null), [l, u] = L(null);
1021
+ return Tn(() => {
1021
1022
  if (!e) {
1022
- d(null);
1023
+ u(null);
1023
1024
  return;
1024
1025
  }
1025
- const s = r.current;
1026
- if (!s) return;
1027
- const u = s.offsetTop, f = s.offsetLeft, m = s.offsetWidth;
1028
- s.offsetHeight, d({
1029
- top: u - 8,
1030
- left: f + m / 2
1031
- });
1032
- }, [e, r]), N(() => {
1026
+ const d = r.current;
1027
+ if (!d) return;
1028
+ const c = () => {
1029
+ const f = d.getBoundingClientRect(), h = {
1030
+ top: f.top - xr,
1031
+ left: f.left + f.width / 2
1032
+ }, a = en + 90, s = window.innerWidth - en - 90;
1033
+ h.left < a && (h.left = a), h.left > s && (h.left = s), u(h);
1034
+ };
1035
+ return c(), window.addEventListener("scroll", c, !0), window.addEventListener("resize", c), () => {
1036
+ window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c);
1037
+ };
1038
+ }, [e, r]), A(() => {
1033
1039
  if (!e) return;
1034
- const s = (f) => {
1035
- const m = f.target, a = i.current, c = r.current;
1036
- a && a.contains(m) || c && c.contains(m) || t();
1037
- }, u = (f) => {
1040
+ const d = (f) => {
1041
+ const h = f.target, a = i.current, s = r.current;
1042
+ a && a.contains(h) || s && s.contains(h) || t();
1043
+ }, c = (f) => {
1038
1044
  f.key === "Escape" && (f.stopPropagation(), t());
1039
1045
  };
1040
- return document.addEventListener("mousedown", s), document.addEventListener("keydown", u), () => {
1041
- document.removeEventListener("mousedown", s), document.removeEventListener("keydown", u);
1046
+ return document.addEventListener("mousedown", d), document.addEventListener("keydown", c), () => {
1047
+ document.removeEventListener("mousedown", d), document.removeEventListener("keydown", c);
1042
1048
  };
1043
- }, [e, t, r]), !e || l === null ? null : /* @__PURE__ */ n(
1044
- "div",
1045
- {
1046
- ref: i,
1047
- className: "ll-overflow-popover",
1048
- role: "menu",
1049
- style: {
1050
- position: "absolute",
1051
- // Lift the popover above the anchor via translateY(-100%).
1052
- // top points to (anchorTop - GAP); transform pulls bottom up to there.
1053
- top: l.top,
1054
- left: l.left,
1055
- transform: "translate(-50%, -100%)"
1056
- },
1057
- children: o
1058
- }
1049
+ }, [e, t, r]), !e || l === null || typeof document > "u" ? null : On(
1050
+ /* @__PURE__ */ n(
1051
+ "div",
1052
+ {
1053
+ ref: i,
1054
+ className: "ll-overflow-popover",
1055
+ role: "menu",
1056
+ style: {
1057
+ position: "fixed",
1058
+ // Lift the popover above the anchor via translateY(-100%).
1059
+ // top points to (anchorTop - GAP); transform pulls bottom up to there.
1060
+ top: l.top,
1061
+ left: l.left,
1062
+ transform: "translate(-50%, -100%)"
1063
+ },
1064
+ children: o
1065
+ }
1066
+ ),
1067
+ document.body
1059
1068
  );
1060
- }, br = ({
1069
+ }, Lr = ({
1061
1070
  isMuted: e,
1062
1071
  onToggleMute: t,
1063
1072
  isCameraEnabled: r,
1064
1073
  onToggleCamera: o,
1065
1074
  allowCamera: i,
1066
1075
  isScreenShareEnabled: l,
1067
- onToggleScreenShare: d,
1068
- allowScreenShare: s,
1069
- isSpeakerMuted: u,
1076
+ onToggleScreenShare: u,
1077
+ allowScreenShare: d,
1078
+ isSpeakerMuted: c,
1070
1079
  onToggleSpeaker: f,
1071
- allowTyping: m,
1080
+ allowTyping: h,
1072
1081
  isTypingOpen: a,
1073
- onToggleTyping: c,
1082
+ onToggleTyping: s,
1074
1083
  onDisconnect: R
1075
1084
  }) => {
1076
- const [P, C] = L(!1), v = E(null);
1085
+ const [D, E] = L(!1), v = S(null);
1077
1086
  return /* @__PURE__ */ g(lt, { children: [
1078
1087
  /* @__PURE__ */ g(
1079
1088
  "div",
@@ -1089,7 +1098,7 @@ const hr = ({
1089
1098
  className: `ll-tool ${e ? "is-muted" : ""}`,
1090
1099
  onClick: t,
1091
1100
  "aria-label": e ? "Unmute microphone" : "Mute microphone",
1092
- children: /* @__PURE__ */ n(fn, { muted: e })
1101
+ children: /* @__PURE__ */ n(hn, { muted: e })
1093
1102
  }
1094
1103
  ),
1095
1104
  /* @__PURE__ */ n(
@@ -1097,12 +1106,12 @@ const hr = ({
1097
1106
  {
1098
1107
  ref: v,
1099
1108
  type: "button",
1100
- className: `ll-tool ${P ? "is-on" : ""}`,
1101
- onClick: () => C((b) => !b),
1109
+ className: `ll-tool ${D ? "is-on" : ""}`,
1110
+ onClick: () => E((b) => !b),
1102
1111
  "aria-label": "More controls",
1103
1112
  "aria-haspopup": "menu",
1104
- "aria-expanded": P,
1105
- children: /* @__PURE__ */ n(wr, {})
1113
+ "aria-expanded": D,
1114
+ children: /* @__PURE__ */ n(Er, {})
1106
1115
  }
1107
1116
  ),
1108
1117
  /* @__PURE__ */ n(
@@ -1112,17 +1121,17 @@ const hr = ({
1112
1121
  className: "ll-tool ll-tool--danger",
1113
1122
  onClick: R,
1114
1123
  "aria-label": "End conversation",
1115
- children: /* @__PURE__ */ n(hn, {})
1124
+ children: /* @__PURE__ */ n(gn, {})
1116
1125
  }
1117
1126
  )
1118
1127
  ]
1119
1128
  }
1120
1129
  ),
1121
1130
  /* @__PURE__ */ g(
1122
- vr,
1131
+ kr,
1123
1132
  {
1124
- open: P,
1125
- onClose: () => C(!1),
1133
+ open: D,
1134
+ onClose: () => E(!1),
1126
1135
  anchorRef: v,
1127
1136
  children: [
1128
1137
  i && /* @__PURE__ */ g(
@@ -1131,24 +1140,24 @@ const hr = ({
1131
1140
  type: "button",
1132
1141
  className: `ll-overflow-popover__item ${r ? "is-on" : ""}`,
1133
1142
  onClick: () => {
1134
- o(), C(!1);
1143
+ o(), E(!1);
1135
1144
  },
1136
1145
  children: [
1137
- /* @__PURE__ */ n(un, {}),
1146
+ /* @__PURE__ */ n(pn, {}),
1138
1147
  /* @__PURE__ */ n("span", { children: r ? "Stop camera" : "Start camera" })
1139
1148
  ]
1140
1149
  }
1141
1150
  ),
1142
- s && /* @__PURE__ */ g(
1151
+ d && /* @__PURE__ */ g(
1143
1152
  "button",
1144
1153
  {
1145
1154
  type: "button",
1146
1155
  className: `ll-overflow-popover__item ${l ? "is-on" : ""}`,
1147
1156
  onClick: () => {
1148
- d(), C(!1);
1157
+ u(), E(!1);
1149
1158
  },
1150
1159
  children: [
1151
- /* @__PURE__ */ n(dn, {}),
1160
+ /* @__PURE__ */ n(fn, {}),
1152
1161
  /* @__PURE__ */ n("span", { children: l ? "Stop sharing" : "Share screen" })
1153
1162
  ]
1154
1163
  }
@@ -1157,26 +1166,26 @@ const hr = ({
1157
1166
  "button",
1158
1167
  {
1159
1168
  type: "button",
1160
- className: `ll-overflow-popover__item ${u ? "is-on" : ""}`,
1169
+ className: `ll-overflow-popover__item ${c ? "is-on" : ""}`,
1161
1170
  onClick: () => {
1162
- f(), C(!1);
1171
+ f(), E(!1);
1163
1172
  },
1164
1173
  children: [
1165
- /* @__PURE__ */ n(pn, { muted: u }),
1166
- /* @__PURE__ */ n("span", { children: u ? "Unmute speaker" : "Mute speaker" })
1174
+ /* @__PURE__ */ n(mn, { muted: c }),
1175
+ /* @__PURE__ */ n("span", { children: c ? "Unmute speaker" : "Mute speaker" })
1167
1176
  ]
1168
1177
  }
1169
1178
  ),
1170
- m && /* @__PURE__ */ g(
1179
+ h && /* @__PURE__ */ g(
1171
1180
  "button",
1172
1181
  {
1173
1182
  type: "button",
1174
1183
  className: `ll-overflow-popover__item ${a ? "is-on" : ""}`,
1175
1184
  onClick: () => {
1176
- c(), C(!1);
1185
+ s(), E(!1);
1177
1186
  },
1178
1187
  children: [
1179
- /* @__PURE__ */ n(_r, {}),
1188
+ /* @__PURE__ */ n(Cr, {}),
1180
1189
  /* @__PURE__ */ n("span", { children: a ? "Hide typing" : "Type a message" })
1181
1190
  ]
1182
1191
  }
@@ -1199,7 +1208,7 @@ const hr = ({
1199
1208
  )
1200
1209
  ] });
1201
1210
  };
1202
- function wr() {
1211
+ function Er() {
1203
1212
  return /* @__PURE__ */ g(
1204
1213
  "svg",
1205
1214
  {
@@ -1216,7 +1225,7 @@ function wr() {
1216
1225
  }
1217
1226
  );
1218
1227
  }
1219
- function _r() {
1228
+ function Cr() {
1220
1229
  return /* @__PURE__ */ n(
1221
1230
  "svg",
1222
1231
  {
@@ -1233,65 +1242,65 @@ function _r() {
1233
1242
  }
1234
1243
  );
1235
1244
  }
1236
- const xr = ({
1245
+ const Sr = ({
1237
1246
  position: e,
1238
1247
  isMobile: t,
1239
1248
  agentName: r,
1240
1249
  avatarImageUrl: o,
1241
1250
  idleLoopUrl: i,
1242
1251
  greeting: l,
1243
- branding: d,
1244
- teamMembers: s,
1245
- currentTeamMemberId: u,
1252
+ branding: u,
1253
+ teamMembers: d,
1254
+ currentTeamMemberId: c,
1246
1255
  isSwitchingTeamMember: f,
1247
- teamSwitcherOpen: m,
1256
+ teamSwitcherOpen: h,
1248
1257
  onToggleTeamSwitcher: a,
1249
- onSelectTeamMember: c,
1258
+ onSelectTeamMember: s,
1250
1259
  languageMenuOpen: R,
1251
- onToggleLanguageMenu: P,
1252
- connectionState: C,
1260
+ onToggleLanguageMenu: D,
1261
+ connectionState: E,
1253
1262
  agentState: v,
1254
1263
  transcript: b,
1255
- canResume: A,
1256
- needsUserGesture: I,
1264
+ canResume: N,
1265
+ needsUserGesture: T,
1257
1266
  error: $,
1258
1267
  isMuted: w,
1259
- micError: T,
1268
+ micError: I,
1260
1269
  micDevices: B,
1261
1270
  isCameraEnabled: z,
1262
- cameraPreviewEl: S,
1263
- cameraDevices: D,
1264
- activeCameraId: q,
1271
+ cameraPreviewEl: C,
1272
+ cameraDevices: P,
1273
+ activeCameraId: F,
1265
1274
  isScreenShareEnabled: G,
1266
- screenPreviewEl: ie,
1275
+ screenPreviewEl: le,
1267
1276
  isSpeakerMuted: Z,
1268
- allowCamera: ke,
1269
- allowScreenShare: de,
1270
- allowTyping: ye,
1271
- showMinimize: ue = !0,
1272
- chromeless: le = !1,
1277
+ allowCamera: Le,
1278
+ allowScreenShare: ue,
1279
+ allowTyping: ve,
1280
+ showMinimize: fe = !0,
1281
+ chromeless: ae = !1,
1273
1282
  compactControls: ee = !1,
1274
1283
  transforming: st,
1275
- transformingLabel: Ve,
1284
+ transformingLabel: je,
1276
1285
  avatarVideoContainerRef: ct,
1277
1286
  agentVideoEl: ne,
1278
- onConnect: Ye,
1279
- onDisconnect: Ge,
1287
+ onConnect: Ve,
1288
+ onDisconnect: Ye,
1280
1289
  onRetry: dt,
1281
- onResumeAudio: Je,
1282
- onToggleMute: Le,
1290
+ onResumeAudio: Ge,
1291
+ onToggleMute: Ee,
1283
1292
  onToggleCamera: Ce,
1284
- onSwitchCameraDevice: De,
1293
+ onSwitchCameraDevice: Pe,
1285
1294
  onToggleScreenShare: Se,
1286
- onToggleSpeaker: Ee,
1287
- onSendMessage: Ne,
1288
- onMinimize: Ae,
1289
- onClose: U,
1295
+ onToggleSpeaker: Ne,
1296
+ onSendMessage: Ae,
1297
+ onMinimize: Re,
1298
+ onClose: q,
1290
1299
  onClearMicError: vt
1291
1300
  }) => {
1292
1301
  var He;
1293
- const Re = ((s == null ? void 0 : s.length) ?? 0) > 1, $e = C === "connecting" || C === "connected", re = C === "connected", Ke = C === "idle" || C === "disconnected" || C === "error", [Te, ze] = L(!1);
1294
- N(() => {
1302
+ const Ie = ((d == null ? void 0 : d.length) ?? 0) > 1, $e = E === "connecting" || E === "connected", re = E === "connected", Je = E === "idle" || E === "disconnected" || E === "error", [Te, ze] = L(!1);
1303
+ A(() => {
1295
1304
  if (!ne) {
1296
1305
  ze(!1);
1297
1306
  return;
@@ -1301,58 +1310,58 @@ const xr = ({
1301
1310
  return;
1302
1311
  }
1303
1312
  ze(!1);
1304
- const h = () => ze(!0);
1305
- return ne.addEventListener("playing", h), ne.addEventListener("loadeddata", h), () => {
1306
- ne.removeEventListener("playing", h), ne.removeEventListener("loadeddata", h);
1313
+ const m = () => ze(!0);
1314
+ return ne.addEventListener("playing", m), ne.addEventListener("loadeddata", m), () => {
1315
+ ne.removeEventListener("playing", m), ne.removeEventListener("loadeddata", m);
1307
1316
  };
1308
1317
  }, [ne]);
1309
- const [bt, ve] = L(!1);
1310
- N(() => {
1318
+ const [bt, be] = L(!1);
1319
+ A(() => {
1311
1320
  if (!re) {
1312
- ve(!1);
1321
+ be(!1);
1313
1322
  return;
1314
1323
  }
1315
1324
  if (Te) return;
1316
- const h = setTimeout(() => ve(!0), 8e3);
1317
- return () => clearTimeout(h);
1325
+ const m = setTimeout(() => be(!0), 8e3);
1326
+ return () => clearTimeout(m);
1318
1327
  }, [re, Te]);
1319
- const X = C === "connecting" || re && !!o && !Te && !bt, Xe = E(null), Ie = E(null);
1320
- N(() => {
1321
- const h = Xe.current;
1322
- h && (h.innerHTML = "", S && (S.style.width = "100%", S.style.height = "100%", S.style.objectFit = "cover", S.style.transform = "scaleX(-1)", h.appendChild(S)));
1323
- }, [S]), N(() => {
1324
- const h = Ie.current;
1325
- h && (h.innerHTML = "", ie && (ie.style.width = "100%", ie.style.height = "100%", ie.style.objectFit = "contain", h.appendChild(ie)));
1326
- }, [ie]);
1327
- const [ae, te] = L(!1), [fe, be] = L(!1);
1328
- N(() => {
1329
- if (!ae && !fe && !R && !m) return;
1330
- const h = () => {
1331
- te(!1), be(!1), R && P(), m && a();
1328
+ const X = E === "connecting" || re && !!o && !Te && !bt, Ke = S(null), Me = S(null);
1329
+ A(() => {
1330
+ const m = Ke.current;
1331
+ m && (m.innerHTML = "", C && (C.style.width = "100%", C.style.height = "100%", C.style.objectFit = "cover", C.style.transform = "scaleX(-1)", m.appendChild(C)));
1332
+ }, [C]), A(() => {
1333
+ const m = Me.current;
1334
+ m && (m.innerHTML = "", le && (le.style.width = "100%", le.style.height = "100%", le.style.objectFit = "contain", m.appendChild(le)));
1335
+ }, [le]);
1336
+ const [se, te] = L(!1), [pe, we] = L(!1);
1337
+ A(() => {
1338
+ if (!se && !pe && !R && !h) return;
1339
+ const m = () => {
1340
+ te(!1), we(!1), R && D(), h && a();
1332
1341
  };
1333
- return document.addEventListener("click", h), () => document.removeEventListener("click", h);
1342
+ return document.addEventListener("click", m), () => document.removeEventListener("click", m);
1334
1343
  }, [
1335
- ae,
1336
- fe,
1344
+ se,
1345
+ pe,
1337
1346
  R,
1338
- m,
1339
- P,
1347
+ h,
1348
+ D,
1340
1349
  a
1341
1350
  ]);
1342
- const [oe, pe] = L(!1), Me = x(() => pe((h) => !h), []), [we, ut] = L(""), Qe = x(
1343
- (h) => {
1344
- h.preventDefault();
1345
- const j = we.trim();
1346
- j && (Ne(j), ut(""));
1351
+ const [oe, he] = L(!1), De = k(() => he((m) => !m), []), [_e, ut] = L(""), Xe = k(
1352
+ (m) => {
1353
+ m.preventDefault();
1354
+ const j = _e.trim();
1355
+ j && (Ae(j), ut(""));
1347
1356
  },
1348
- [we, Ne]
1349
- ), Ze = d.productName || "Live Layer";
1350
- let he = null, se = null;
1351
- for (let h = b.length - 1; h >= 0; h--) {
1352
- const j = b[h];
1353
- if (!he && j.role === "agent" ? he = j : !se && j.role === "user" && (se = j), he && se) break;
1357
+ [_e, Ae]
1358
+ ), Qe = u.productName || "Live Layer";
1359
+ let me = null, ce = null;
1360
+ for (let m = b.length - 1; m >= 0; m--) {
1361
+ const j = b[m];
1362
+ if (!me && j.role === "agent" ? me = j : !ce && j.role === "user" && (ce = j), me && ce) break;
1354
1363
  }
1355
- const Oe = re ? (he == null ? void 0 : he.text) || null : l || null, ft = re && (se == null ? void 0 : se.text) || null, wt = [
1364
+ const Oe = re ? (me == null ? void 0 : me.text) || null : l || null, ft = re && (ce == null ? void 0 : ce.text) || null, wt = [
1356
1365
  "ll-expanded",
1357
1366
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1358
1367
  ].join(" ");
@@ -1367,7 +1376,7 @@ const xr = ({
1367
1376
  children: [
1368
1377
  /* @__PURE__ */ g("div", { className: "ll-expanded__bg", children: [
1369
1378
  o ? /* @__PURE__ */ n(
1370
- yr,
1379
+ _r,
1371
1380
  {
1372
1381
  src: o,
1373
1382
  alt: r,
@@ -1391,12 +1400,12 @@ const xr = ({
1391
1400
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1392
1401
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: f ? "Switching..." : "Connecting..." })
1393
1402
  ] }),
1394
- I && re && /* @__PURE__ */ g(
1403
+ T && re && /* @__PURE__ */ g(
1395
1404
  "button",
1396
1405
  {
1397
1406
  type: "button",
1398
1407
  className: "ll-expanded__overlay ll-expanded__overlay--gesture",
1399
- onClick: Je,
1408
+ onClick: Ge,
1400
1409
  children: [
1401
1410
  /* @__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" }) }),
1402
1411
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
@@ -1409,61 +1418,61 @@ const xr = ({
1409
1418
  className: "ll-expanded__overlay ll-expanded__overlay--transforming",
1410
1419
  role: "status",
1411
1420
  "aria-live": "polite",
1412
- "aria-label": Ve,
1421
+ "aria-label": je,
1413
1422
  children: [
1414
1423
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1415
- /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: Ve })
1424
+ /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: je })
1416
1425
  ]
1417
1426
  }
1418
1427
  ),
1419
1428
  $e ? /* @__PURE__ */ g(lt, { children: [
1420
1429
  !ee && /* @__PURE__ */ g("div", { className: "ll-expanded__topbar", children: [
1421
- !le && /* @__PURE__ */ g("div", { className: "ll-expanded__topbar-left", children: [
1430
+ !ae && /* @__PURE__ */ g("div", { className: "ll-expanded__topbar-left", children: [
1422
1431
  /* @__PURE__ */ g("div", { className: "ll-expanded__pill-wrap", children: [
1423
1432
  /* @__PURE__ */ g(
1424
1433
  "button",
1425
1434
  {
1426
1435
  type: "button",
1427
1436
  className: "ll-hpill",
1428
- onClick: (h) => {
1429
- Re && (h.stopPropagation(), a());
1437
+ onClick: (m) => {
1438
+ Ie && (m.stopPropagation(), a());
1430
1439
  },
1431
- "aria-haspopup": Re ? "listbox" : void 0,
1432
- "aria-expanded": Re ? m : void 0,
1440
+ "aria-haspopup": Ie ? "listbox" : void 0,
1441
+ "aria-expanded": Ie ? h : void 0,
1433
1442
  children: [
1434
1443
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1435
- Re && /* @__PURE__ */ n(ht, {})
1444
+ Ie && /* @__PURE__ */ n(ht, {})
1436
1445
  ]
1437
1446
  }
1438
1447
  ),
1439
- Re && m && /* @__PURE__ */ n(
1448
+ Ie && h && /* @__PURE__ */ n(
1440
1449
  "div",
1441
1450
  {
1442
1451
  className: "ll-hmenu",
1443
- onClick: (h) => h.stopPropagation(),
1452
+ onClick: (m) => m.stopPropagation(),
1444
1453
  role: "listbox",
1445
- children: s == null ? void 0 : s.map((h) => /* @__PURE__ */ g(
1454
+ children: d == null ? void 0 : d.map((m) => /* @__PURE__ */ g(
1446
1455
  "button",
1447
1456
  {
1448
1457
  type: "button",
1449
- className: `ll-hmenu__item ${h.id === u ? "is-active" : ""}`,
1450
- onClick: () => c(h.id),
1458
+ className: `ll-hmenu__item ${m.id === c ? "is-active" : ""}`,
1459
+ onClick: () => s(m.id),
1451
1460
  role: "option",
1452
- "aria-selected": h.id === u,
1461
+ "aria-selected": m.id === c,
1453
1462
  children: [
1454
- h.avatarImageUrl && /* @__PURE__ */ n(
1463
+ m.avatarImageUrl && /* @__PURE__ */ n(
1455
1464
  "img",
1456
1465
  {
1457
- src: h.avatarImageUrl,
1466
+ src: m.avatarImageUrl,
1458
1467
  alt: "",
1459
1468
  className: "ll-hmenu__avatar"
1460
1469
  }
1461
1470
  ),
1462
- /* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: h.name }),
1463
- h.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: h.role })
1471
+ /* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: m.name }),
1472
+ m.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: m.role })
1464
1473
  ]
1465
1474
  },
1466
- h.id
1475
+ m.id
1467
1476
  ))
1468
1477
  }
1469
1478
  )
@@ -1474,8 +1483,8 @@ const xr = ({
1474
1483
  {
1475
1484
  type: "button",
1476
1485
  className: "ll-hpill ll-hpill--compact",
1477
- onClick: (h) => {
1478
- h.stopPropagation(), P();
1486
+ onClick: (m) => {
1487
+ m.stopPropagation(), D();
1479
1488
  },
1480
1489
  "aria-haspopup": "listbox",
1481
1490
  "aria-expanded": R,
@@ -1491,7 +1500,7 @@ const xr = ({
1491
1500
  "div",
1492
1501
  {
1493
1502
  className: "ll-hmenu",
1494
- onClick: (h) => h.stopPropagation(),
1503
+ onClick: (m) => m.stopPropagation(),
1495
1504
  role: "listbox",
1496
1505
  children: /* @__PURE__ */ n(
1497
1506
  "button",
@@ -1515,15 +1524,15 @@ const xr = ({
1515
1524
  )
1516
1525
  ] }),
1517
1526
  /* @__PURE__ */ g("div", { className: "ll-expanded__header-actions", children: [
1518
- ue !== !1 && /* @__PURE__ */ n(
1527
+ fe !== !1 && /* @__PURE__ */ n(
1519
1528
  "button",
1520
1529
  {
1521
1530
  type: "button",
1522
1531
  className: "ll-hbtn",
1523
- onClick: Ae,
1532
+ onClick: Re,
1524
1533
  "aria-label": "Minimize widget",
1525
1534
  title: "Minimize",
1526
- children: /* @__PURE__ */ n(en, {})
1535
+ children: /* @__PURE__ */ n(nn, {})
1527
1536
  }
1528
1537
  ),
1529
1538
  /* @__PURE__ */ n(
@@ -1531,10 +1540,10 @@ const xr = ({
1531
1540
  {
1532
1541
  type: "button",
1533
1542
  className: "ll-hbtn ll-hbtn--danger",
1534
- onClick: U,
1543
+ onClick: q,
1535
1544
  "aria-label": "End call",
1536
1545
  title: "End call",
1537
- children: /* @__PURE__ */ n(Zt, {})
1546
+ children: /* @__PURE__ */ n(tn, {})
1538
1547
  }
1539
1548
  )
1540
1549
  ] })
@@ -1546,16 +1555,16 @@ const xr = ({
1546
1555
  ] }) : (
1547
1556
  // Idle-state header with Live Layer product name + minimize/close
1548
1557
  /* @__PURE__ */ g("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1549
- /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ze }),
1558
+ /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Qe }),
1550
1559
  /* @__PURE__ */ g("div", { className: "ll-expanded__header-actions", children: [
1551
- ue !== !1 && /* @__PURE__ */ n(
1560
+ fe !== !1 && /* @__PURE__ */ n(
1552
1561
  "button",
1553
1562
  {
1554
1563
  type: "button",
1555
1564
  className: "ll-hbtn ll-hbtn--ghost",
1556
- onClick: Ae,
1565
+ onClick: Re,
1557
1566
  "aria-label": "Minimize widget",
1558
- children: /* @__PURE__ */ n(en, {})
1567
+ children: /* @__PURE__ */ n(nn, {})
1559
1568
  }
1560
1569
  ),
1561
1570
  /* @__PURE__ */ n(
@@ -1563,27 +1572,27 @@ const xr = ({
1563
1572
  {
1564
1573
  type: "button",
1565
1574
  className: "ll-hbtn ll-hbtn--danger",
1566
- onClick: U,
1575
+ onClick: q,
1567
1576
  "aria-label": "Close widget",
1568
- children: /* @__PURE__ */ n(Zt, {})
1577
+ children: /* @__PURE__ */ n(tn, {})
1569
1578
  }
1570
1579
  )
1571
1580
  ] })
1572
1581
  ] })
1573
1582
  ),
1574
- Ke && /* @__PURE__ */ (() => {
1575
- const h = A ? "Restart paused session" : C === "disconnected" ? "Reconnect to agent" : "Start video call", j = A ? "Pick up where you left off" : null;
1583
+ Je && /* @__PURE__ */ (() => {
1584
+ const m = N ? "Restart paused session" : E === "disconnected" ? "Reconnect to agent" : "Start video call", j = N ? "Pick up where you left off" : null;
1576
1585
  return /* @__PURE__ */ g(lt, { children: [
1577
1586
  !$ && /* @__PURE__ */ g(
1578
1587
  "button",
1579
1588
  {
1580
1589
  type: "button",
1581
1590
  className: "ll-expanded__play",
1582
- onClick: Ye,
1583
- "aria-label": h,
1591
+ onClick: Ve,
1592
+ "aria-label": m,
1584
1593
  children: [
1585
1594
  /* @__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" }) }) }),
1586
- /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: h })
1595
+ /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: m })
1587
1596
  ]
1588
1597
  }
1589
1598
  ),
@@ -1595,9 +1604,9 @@ const xr = ({
1595
1604
  {
1596
1605
  type: "button",
1597
1606
  className: "ll-expanded__cta",
1598
- onClick: Ye,
1599
- "aria-label": h,
1600
- children: h
1607
+ onClick: Ve,
1608
+ "aria-label": m,
1609
+ children: m
1601
1610
  }
1602
1611
  )
1603
1612
  ] })
@@ -1611,14 +1620,14 @@ const xr = ({
1611
1620
  /* @__PURE__ */ n(
1612
1621
  "div",
1613
1622
  {
1614
- ref: Ie,
1623
+ ref: Me,
1615
1624
  className: G ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1616
1625
  }
1617
1626
  ),
1618
1627
  /* @__PURE__ */ n(
1619
1628
  "div",
1620
1629
  {
1621
- ref: Xe,
1630
+ ref: Ke,
1622
1631
  className: !G && z ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1623
1632
  }
1624
1633
  )
@@ -1642,8 +1651,8 @@ const xr = ({
1642
1651
  children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: ft })
1643
1652
  }
1644
1653
  ),
1645
- !le && !ee && /* @__PURE__ */ g("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
1646
- de && /* @__PURE__ */ n(
1654
+ !ae && !ee && /* @__PURE__ */ g("div", { className: "ll-toolbar", onClick: (m) => m.stopPropagation(), children: [
1655
+ ue && /* @__PURE__ */ n(
1647
1656
  "button",
1648
1657
  {
1649
1658
  type: "button",
@@ -1651,10 +1660,10 @@ const xr = ({
1651
1660
  onClick: Se,
1652
1661
  "aria-label": G ? "Stop sharing screen" : "Share screen",
1653
1662
  title: G ? "Stop sharing" : "Share screen",
1654
- children: /* @__PURE__ */ n(dn, {})
1663
+ children: /* @__PURE__ */ n(fn, {})
1655
1664
  }
1656
1665
  ),
1657
- ke && /* @__PURE__ */ g("div", { className: "ll-tool-split", children: [
1666
+ Le && /* @__PURE__ */ g("div", { className: "ll-tool-split", children: [
1658
1667
  /* @__PURE__ */ n(
1659
1668
  "button",
1660
1669
  {
@@ -1663,7 +1672,7 @@ const xr = ({
1663
1672
  onClick: Ce,
1664
1673
  "aria-label": z ? "Turn off camera" : "Turn on camera",
1665
1674
  title: z ? "Stop camera" : "Start camera",
1666
- children: /* @__PURE__ */ n(un, {})
1675
+ children: /* @__PURE__ */ n(pn, {})
1667
1676
  }
1668
1677
  ),
1669
1678
  /* @__PURE__ */ n(
@@ -1671,23 +1680,23 @@ const xr = ({
1671
1680
  {
1672
1681
  type: "button",
1673
1682
  className: `ll-tool ll-tool--right ${z ? "is-on" : ""}`,
1674
- onClick: (h) => {
1675
- h.stopPropagation(), be((j) => !j), te(!1);
1683
+ onClick: (m) => {
1684
+ m.stopPropagation(), we((j) => !j), te(!1);
1676
1685
  },
1677
1686
  "aria-label": "Camera devices",
1678
1687
  "aria-haspopup": "listbox",
1679
- "aria-expanded": fe,
1688
+ "aria-expanded": pe,
1680
1689
  children: /* @__PURE__ */ n(ht, {})
1681
1690
  }
1682
1691
  ),
1683
- fe && D.length > 0 && /* @__PURE__ */ n(
1684
- tn,
1692
+ pe && P.length > 0 && /* @__PURE__ */ n(
1693
+ rn,
1685
1694
  {
1686
1695
  label: "Camera",
1687
- devices: D,
1688
- activeId: q,
1689
- onPick: (h) => {
1690
- be(!1), De(h);
1696
+ devices: P,
1697
+ activeId: F,
1698
+ onPick: (m) => {
1699
+ we(!1), Pe(m);
1691
1700
  }
1692
1701
  }
1693
1702
  )
@@ -1698,10 +1707,10 @@ const xr = ({
1698
1707
  {
1699
1708
  type: "button",
1700
1709
  className: `ll-tool ll-tool--left ${w ? "is-muted" : ""}`,
1701
- onClick: Le,
1710
+ onClick: Ee,
1702
1711
  "aria-label": w ? "Unmute microphone" : "Mute microphone",
1703
1712
  title: w ? "Unmute" : "Mute",
1704
- children: /* @__PURE__ */ n(fn, { muted: w })
1713
+ children: /* @__PURE__ */ n(hn, { muted: w })
1705
1714
  }
1706
1715
  ),
1707
1716
  /* @__PURE__ */ n(
@@ -1709,17 +1718,17 @@ const xr = ({
1709
1718
  {
1710
1719
  type: "button",
1711
1720
  className: `ll-tool ll-tool--right ${w ? "is-muted" : ""}`,
1712
- onClick: (h) => {
1713
- h.stopPropagation(), te((j) => !j), be(!1);
1721
+ onClick: (m) => {
1722
+ m.stopPropagation(), te((j) => !j), we(!1);
1714
1723
  },
1715
1724
  "aria-label": "Microphone devices",
1716
1725
  "aria-haspopup": "listbox",
1717
- "aria-expanded": ae,
1726
+ "aria-expanded": se,
1718
1727
  children: /* @__PURE__ */ n(ht, {})
1719
1728
  }
1720
1729
  ),
1721
- ae && B.length > 0 && /* @__PURE__ */ n(
1722
- tn,
1730
+ se && B.length > 0 && /* @__PURE__ */ n(
1731
+ rn,
1723
1732
  {
1724
1733
  label: "Microphone",
1725
1734
  devices: B,
@@ -1733,10 +1742,10 @@ const xr = ({
1733
1742
  {
1734
1743
  type: "button",
1735
1744
  className: `ll-tool ${Z ? "is-muted" : ""}`,
1736
- onClick: Ee,
1745
+ onClick: Ne,
1737
1746
  "aria-label": Z ? "Unmute speaker" : "Mute speaker",
1738
1747
  title: Z ? "Unmute speaker" : "Mute speaker",
1739
- children: /* @__PURE__ */ n(pn, { muted: Z })
1748
+ children: /* @__PURE__ */ n(mn, { muted: Z })
1740
1749
  }
1741
1750
  ),
1742
1751
  /* @__PURE__ */ n(
@@ -1744,59 +1753,59 @@ const xr = ({
1744
1753
  {
1745
1754
  type: "button",
1746
1755
  className: "ll-tool ll-tool--danger",
1747
- onClick: Ge,
1756
+ onClick: Ye,
1748
1757
  "aria-label": "End conversation",
1749
1758
  title: "End conversation",
1750
- children: /* @__PURE__ */ n(hn, {})
1759
+ children: /* @__PURE__ */ n(gn, {})
1751
1760
  }
1752
1761
  )
1753
1762
  ] }),
1754
- !le && ee && /* @__PURE__ */ n(
1755
- br,
1763
+ !ae && ee && /* @__PURE__ */ n(
1764
+ Lr,
1756
1765
  {
1757
1766
  isMuted: w,
1758
- onToggleMute: Le,
1767
+ onToggleMute: Ee,
1759
1768
  isCameraEnabled: z,
1760
1769
  onToggleCamera: Ce,
1761
- allowCamera: ke,
1770
+ allowCamera: Le,
1762
1771
  isScreenShareEnabled: G,
1763
1772
  onToggleScreenShare: Se,
1764
- allowScreenShare: de,
1773
+ allowScreenShare: ue,
1765
1774
  isSpeakerMuted: Z,
1766
- onToggleSpeaker: Ee,
1767
- allowTyping: ye,
1775
+ onToggleSpeaker: Ne,
1776
+ allowTyping: ve,
1768
1777
  isTypingOpen: oe,
1769
- onToggleTyping: Me,
1770
- onDisconnect: Ge
1778
+ onToggleTyping: De,
1779
+ onDisconnect: Ye
1771
1780
  }
1772
1781
  ),
1773
- !le && ye && (ee ? oe : !0) && /* @__PURE__ */ g("form", { className: "ll-message-input", onSubmit: Qe, children: [
1782
+ !ae && ve && (ee ? oe : !0) && /* @__PURE__ */ g("form", { className: "ll-message-input", onSubmit: Xe, children: [
1774
1783
  /* @__PURE__ */ n(
1775
1784
  "input",
1776
1785
  {
1777
1786
  type: "text",
1778
1787
  className: "ll-message-input__field",
1779
1788
  placeholder: "Message...",
1780
- value: we,
1781
- onChange: (h) => ut(h.target.value),
1789
+ value: _e,
1790
+ onChange: (m) => ut(m.target.value),
1782
1791
  "aria-label": "Message the agent"
1783
1792
  }
1784
1793
  ),
1785
- we.trim() && /* @__PURE__ */ n(
1794
+ _e.trim() && /* @__PURE__ */ n(
1786
1795
  "button",
1787
1796
  {
1788
1797
  type: "submit",
1789
1798
  className: "ll-message-input__send",
1790
1799
  "aria-label": "Send message",
1791
- children: /* @__PURE__ */ n(kr, {})
1800
+ children: /* @__PURE__ */ n(Nr, {})
1792
1801
  }
1793
1802
  )
1794
1803
  ] })
1795
1804
  ] }) : null,
1796
1805
  (() => {
1797
- if (T && C !== "error")
1806
+ if (I && E !== "error")
1798
1807
  return /* @__PURE__ */ g("div", { className: "ll-expanded__banner", role: "alert", children: [
1799
- /* @__PURE__ */ n("span", { children: T }),
1808
+ /* @__PURE__ */ n("span", { children: I }),
1800
1809
  /* @__PURE__ */ n(
1801
1810
  "button",
1802
1811
  {
@@ -1808,10 +1817,10 @@ const xr = ({
1808
1817
  }
1809
1818
  )
1810
1819
  ] });
1811
- if (!$ || C !== "error") return null;
1812
- let h = "Failed to connect", j = "Try again";
1813
- return $ === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : $ === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : $ === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : $ === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : $ === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : $.length < 80 && (h = $), /* @__PURE__ */ g("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1814
- /* @__PURE__ */ n("span", { children: h }),
1820
+ if (!$ || E !== "error") return null;
1821
+ let m = "Failed to connect", j = "Try again";
1822
+ return $ === "MIC_PERMISSION_DENIED" ? m = "Microphone blocked. Allow access to talk." : $ === "MIC_NOT_FOUND" ? m = "No microphone found. Plug one in + retry." : $ === "MIC_UNAVAILABLE" ? m = "Mic unavailable. Check other apps using it." : $ === "AGENT_TIMEOUT" ? m = "Agent didn't pick up. Try again." : $ === "CONNECT_FAILED" ? m = "Connection failed. Check your network." : $.length < 80 && (m = $), /* @__PURE__ */ g("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1823
+ /* @__PURE__ */ n("span", { children: m }),
1815
1824
  /* @__PURE__ */ n(
1816
1825
  "button",
1817
1826
  {
@@ -1830,29 +1839,29 @@ const xr = ({
1830
1839
  function ht() {
1831
1840
  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" }) });
1832
1841
  }
1833
- function Zt() {
1842
+ function tn() {
1834
1843
  return /* @__PURE__ */ g("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1835
1844
  /* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1836
1845
  /* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1837
1846
  ] });
1838
1847
  }
1839
- function en() {
1848
+ function nn() {
1840
1849
  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" }) });
1841
1850
  }
1842
- function dn() {
1851
+ function fn() {
1843
1852
  return /* @__PURE__ */ g("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: [
1844
1853
  /* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
1845
1854
  /* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
1846
1855
  /* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
1847
1856
  ] });
1848
1857
  }
1849
- function un() {
1858
+ function pn() {
1850
1859
  return /* @__PURE__ */ g("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: [
1851
1860
  /* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
1852
1861
  /* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
1853
1862
  ] });
1854
1863
  }
1855
- function fn({ muted: e }) {
1864
+ function hn({ muted: e }) {
1856
1865
  return /* @__PURE__ */ g("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: [
1857
1866
  /* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
1858
1867
  /* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
@@ -1860,7 +1869,7 @@ function fn({ muted: e }) {
1860
1869
  e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
1861
1870
  ] });
1862
1871
  }
1863
- function pn({ muted: e }) {
1872
+ function mn({ muted: e }) {
1864
1873
  return /* @__PURE__ */ g("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: [
1865
1874
  /* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1866
1875
  e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ g(lt, { children: [
@@ -1869,13 +1878,13 @@ function pn({ muted: e }) {
1869
1878
  ] })
1870
1879
  ] });
1871
1880
  }
1872
- function kr() {
1881
+ function Nr() {
1873
1882
  return /* @__PURE__ */ g("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1874
1883
  /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
1875
1884
  /* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
1876
1885
  ] });
1877
1886
  }
1878
- function hn() {
1887
+ function gn() {
1879
1888
  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(
1880
1889
  "path",
1881
1890
  {
@@ -1884,7 +1893,7 @@ function hn() {
1884
1893
  }
1885
1894
  ) });
1886
1895
  }
1887
- const tn = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */ g(
1896
+ const rn = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */ g(
1888
1897
  "div",
1889
1898
  {
1890
1899
  className: "ll-device-menu",
@@ -1893,17 +1902,17 @@ const tn = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */
1893
1902
  children: [
1894
1903
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1895
1904
  t.map((i, l) => {
1896
- const d = r === i.deviceId;
1905
+ const u = r === i.deviceId;
1897
1906
  return /* @__PURE__ */ g(
1898
1907
  "button",
1899
1908
  {
1900
1909
  type: "button",
1901
- className: `ll-device-menu__item ${d ? "is-active" : ""}`,
1910
+ className: `ll-device-menu__item ${u ? "is-active" : ""}`,
1902
1911
  onClick: () => o(i.deviceId),
1903
1912
  role: "option",
1904
- "aria-selected": d,
1913
+ "aria-selected": u,
1905
1914
  children: [
1906
- d && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1915
+ u && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1907
1916
  /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: i.label || `${e} ${l + 1}` })
1908
1917
  ]
1909
1918
  },
@@ -1912,14 +1921,14 @@ const tn = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */
1912
1921
  })
1913
1922
  ]
1914
1923
  }
1915
- ), Lr = [
1924
+ ), Ar = [
1916
1925
  '[data-ll-private="true"]',
1917
1926
  ".ll-widget"
1918
1927
  ];
1919
1928
  function At(e) {
1920
1929
  let t = e;
1921
1930
  for (; t; ) {
1922
- for (const r of Lr)
1931
+ for (const r of Ar)
1923
1932
  if (t.matches(r)) return !0;
1924
1933
  t = t.parentElement;
1925
1934
  }
@@ -1934,7 +1943,7 @@ function yt(e) {
1934
1943
  }
1935
1944
  return !0;
1936
1945
  }
1937
- const mt = 4096, Cr = 20, Sr = 20, Er = 10, Nr = 10, Ar = 30, Rr = 20, nn = 500, Tr = [
1946
+ const mt = 4096, Rr = 20, Ir = 20, Tr = 10, Mr = 10, Dr = 30, Pr = 20, on = 500, $r = [
1938
1947
  '[data-ll-private="true"]',
1939
1948
  ".ll-widget",
1940
1949
  "script",
@@ -1946,7 +1955,7 @@ function ot(e) {
1946
1955
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
1947
1956
  let t = e;
1948
1957
  for (; t; ) {
1949
- for (const r of Tr)
1958
+ for (const r of $r)
1950
1959
  if (t.matches(r)) return !0;
1951
1960
  t = t.parentElement;
1952
1961
  }
@@ -1959,7 +1968,7 @@ function it(e) {
1959
1968
  const r = window.innerHeight || document.documentElement.clientHeight, o = window.innerWidth || document.documentElement.clientWidth;
1960
1969
  return t.bottom > 0 && t.right > 0 && t.top < r && t.left < o;
1961
1970
  }
1962
- function rn(e) {
1971
+ function ln(e) {
1963
1972
  const t = e.getAttribute("id");
1964
1973
  if (t) {
1965
1974
  const l = document.querySelector(`label[for="${CSS.escape(t)}"]`);
@@ -1972,13 +1981,13 @@ function rn(e) {
1972
1981
  const i = e.closest("label");
1973
1982
  return i != null && i.textContent ? i.textContent.trim() : "";
1974
1983
  }
1975
- function ge(e, t) {
1984
+ function ye(e, t) {
1976
1985
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
1977
1986
  }
1978
- function qe(e) {
1987
+ function Be(e) {
1979
1988
  return e.length;
1980
1989
  }
1981
- function Ir(e, t = {}) {
1990
+ function zr(e, t = {}) {
1982
1991
  const r = t.doc ?? (typeof document < "u" ? document : null);
1983
1992
  if (!r)
1984
1993
  return {
@@ -1992,120 +2001,120 @@ function Ir(e, t = {}) {
1992
2001
  forms: [],
1993
2002
  extras: e
1994
2003
  };
1995
- const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", d = Array.from(
2004
+ const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", u = Array.from(
1996
2005
  r.querySelectorAll("[data-ll-region]")
1997
- ), s = [];
1998
- for (const w of d) {
1999
- if (s.length >= Er) break;
2006
+ ), d = [];
2007
+ for (const w of u) {
2008
+ if (d.length >= Tr) break;
2000
2009
  if (ot(w) || !it(w)) continue;
2001
- const T = w.getAttribute("data-ll-region") ?? "", B = w.getAttribute("data-ll-intent") ?? void 0, z = ge(
2010
+ const I = w.getAttribute("data-ll-region") ?? "", B = w.getAttribute("data-ll-intent") ?? void 0, z = ye(
2002
2011
  (w.innerText || w.textContent || "").trim(),
2003
- nn * 2
2012
+ on * 2
2004
2013
  );
2005
- !T || !z || s.push({ id: T, intent: B, text: z });
2014
+ !I || !z || d.push({ id: I, intent: B, text: z });
2006
2015
  }
2007
- const u = [], f = ["H1", "H2", "H3", "H4", "H5", "H6"], m = Array.from(
2016
+ const c = [], f = ["H1", "H2", "H3", "H4", "H5", "H6"], h = Array.from(
2008
2017
  r.querySelectorAll("h1, h2, h3, h4, h5, h6")
2009
2018
  );
2010
- for (const w of m) {
2019
+ for (const w of h) {
2011
2020
  if (ot(w) || !it(w)) continue;
2012
- const T = (w.textContent || "").trim();
2013
- T && u.push(`${w.tagName}: ${ge(T, 200)}`);
2021
+ const I = (w.textContent || "").trim();
2022
+ I && c.push(`${w.tagName}: ${ye(I, 200)}`);
2014
2023
  }
2015
2024
  const a = Array.from(r.querySelectorAll("p, li"));
2016
2025
  for (const w of a) {
2017
2026
  if (ot(w) || !it(w) || f.includes(w.tagName)) continue;
2018
- const T = (w.textContent || "").trim();
2019
- T.length > 10 && u.push(ge(T, nn));
2027
+ const I = (w.textContent || "").trim();
2028
+ I.length > 10 && c.push(ye(I, on));
2020
2029
  }
2021
- const c = u.join(`
2022
- `), R = [], P = Array.from(r.querySelectorAll("a[href]"));
2023
- for (const w of P) {
2024
- if (R.length >= Cr) break;
2030
+ const s = c.join(`
2031
+ `), R = [], D = Array.from(r.querySelectorAll("a[href]"));
2032
+ for (const w of D) {
2033
+ if (R.length >= Rr) break;
2025
2034
  if (ot(w) || !it(w)) continue;
2026
- const T = w.getAttribute("href") || "", B = (w.textContent || "").trim();
2027
- !T || !B || R.push({ href: T, text: ge(B, 100) });
2035
+ const I = w.getAttribute("href") || "", B = (w.textContent || "").trim();
2036
+ !I || !B || R.push({ href: I, text: ye(B, 100) });
2028
2037
  }
2029
- const C = [], v = Array.from(
2038
+ const E = [], v = Array.from(
2030
2039
  r.querySelectorAll(
2031
2040
  "input, textarea, select"
2032
2041
  )
2033
2042
  );
2034
2043
  for (const w of v) {
2035
- if (C.length >= Sr) break;
2044
+ if (E.length >= Ir) break;
2036
2045
  if (ot(w) || !yt(w) || !it(w)) continue;
2037
- const T = rn(w), B = w instanceof HTMLInputElement ? w.type : w.tagName.toLowerCase();
2038
- T && C.push({ label: ge(T, 100), type: B });
2046
+ const I = ln(w), B = w instanceof HTMLInputElement ? w.type : w.tagName.toLowerCase();
2047
+ I && E.push({ label: ye(I, 100), type: B });
2039
2048
  }
2040
2049
  const b = Array.from(
2041
2050
  r.querySelectorAll("[data-ll-form]")
2042
- ), A = [];
2051
+ ), N = [];
2043
2052
  for (const w of b) {
2044
- if (A.length >= Nr) break;
2053
+ if (N.length >= Mr) break;
2045
2054
  if (At(w)) continue;
2046
- const T = w.getAttribute("data-ll-form") || "";
2047
- if (!T) continue;
2055
+ const I = w.getAttribute("data-ll-form") || "";
2056
+ if (!I) continue;
2048
2057
  const B = w.getAttribute("data-ll-intent") || void 0, z = Array.from(
2049
2058
  w.querySelectorAll(
2050
2059
  "[data-ll-field]"
2051
2060
  )
2052
- ), S = [];
2053
- for (const D of z) {
2054
- if (S.length >= Ar) break;
2055
- if (!yt(D)) continue;
2056
- const q = D.getAttribute("data-ll-field") || "";
2057
- if (!q) continue;
2058
- const G = rn(D) || q, ie = D instanceof HTMLInputElement ? D.type : D.tagName.toLowerCase(), Z = {
2059
- name: q,
2060
- label: ge(G, 100),
2061
- type: ie
2061
+ ), C = [];
2062
+ for (const P of z) {
2063
+ if (C.length >= Dr) break;
2064
+ if (!yt(P)) continue;
2065
+ const F = P.getAttribute("data-ll-field") || "";
2066
+ if (!F) continue;
2067
+ const G = ln(P) || F, le = P instanceof HTMLInputElement ? P.type : P.tagName.toLowerCase(), Z = {
2068
+ name: F,
2069
+ label: ye(G, 100),
2070
+ type: le
2062
2071
  };
2063
- if (D.required === !0 && (Z.required = !0), D instanceof HTMLSelectElement) {
2064
- const de = [];
2065
- for (let ye = 0; ye < D.options.length && !(de.length >= Rr); ye++) {
2066
- const ue = D.options[ye];
2067
- if (!ue || ue.disabled) continue;
2068
- const le = ue.value || "", ee = (ue.textContent || "").trim() || le;
2069
- !le && !ee || de.push({ value: le, label: ge(ee, 60) });
2072
+ if (P.required === !0 && (Z.required = !0), P instanceof HTMLSelectElement) {
2073
+ const ue = [];
2074
+ for (let ve = 0; ve < P.options.length && !(ue.length >= Pr); ve++) {
2075
+ const fe = P.options[ve];
2076
+ if (!fe || fe.disabled) continue;
2077
+ const ae = fe.value || "", ee = (fe.textContent || "").trim() || ae;
2078
+ !ae && !ee || ue.push({ value: ae, label: ye(ee, 60) });
2070
2079
  }
2071
- de.length > 0 && (Z.options = de);
2080
+ ue.length > 0 && (Z.options = ue);
2072
2081
  }
2073
- const ke = typeof D.validationMessage == "string" ? D.validationMessage : "";
2074
- ke && (Z.validationMessage = ge(ke, 200)), S.push(Z);
2082
+ const Le = typeof P.validationMessage == "string" ? P.validationMessage : "";
2083
+ Le && (Z.validationMessage = ye(Le, 200)), C.push(Z);
2075
2084
  }
2076
- A.push({ id: T, intent: B, fields: S });
2085
+ N.push({ id: I, intent: B, fields: C });
2077
2086
  }
2078
- const I = {
2087
+ const T = {
2079
2088
  url: o,
2080
2089
  title: l,
2081
2090
  pathname: i,
2082
- regions: s,
2083
- visibleText: c,
2091
+ regions: d,
2092
+ visibleText: s,
2084
2093
  visibleLinks: R,
2085
- visibleFields: C,
2086
- forms: A,
2094
+ visibleFields: E,
2095
+ forms: N,
2087
2096
  extras: e
2088
2097
  };
2089
- let $ = qe(JSON.stringify(I.regions)) + qe(I.visibleText) + qe(JSON.stringify(I.visibleLinks)) + qe(JSON.stringify(I.visibleFields));
2090
- for (; $ > mt && I.visibleFields.length > 0; )
2091
- I.visibleFields.pop(), $ = qe(JSON.stringify(I.visibleFields));
2092
- for (; $ > mt && I.visibleLinks.length > 0; )
2093
- I.visibleLinks.pop(), $ -= 80;
2094
- return qe(I.visibleText) > mt && (I.visibleText = ge(I.visibleText, mt - 100)), I;
2095
- }
2096
- let Fe = null;
2097
- function on(e, t = {}) {
2098
+ let $ = Be(JSON.stringify(T.regions)) + Be(T.visibleText) + Be(JSON.stringify(T.visibleLinks)) + Be(JSON.stringify(T.visibleFields));
2099
+ for (; $ > mt && T.visibleFields.length > 0; )
2100
+ T.visibleFields.pop(), $ = Be(JSON.stringify(T.visibleFields));
2101
+ for (; $ > mt && T.visibleLinks.length > 0; )
2102
+ T.visibleLinks.pop(), $ -= 80;
2103
+ return Be(T.visibleText) > mt && (T.visibleText = ye(T.visibleText, mt - 100)), T;
2104
+ }
2105
+ let qe = null;
2106
+ function an(e, t = {}) {
2098
2107
  const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
2099
- if (Fe && Fe.key === i && r - Fe.at < 1e3)
2100
- return Fe.ctx;
2101
- const l = Ir(e, t);
2102
- return Fe = { key: i, at: r, ctx: l }, l;
2108
+ if (qe && qe.key === i && r - qe.at < 1e3)
2109
+ return qe.ctx;
2110
+ const l = zr(e, t);
2111
+ return qe = { key: i, at: r, ctx: l }, l;
2103
2112
  }
2104
- function Mr() {
2105
- Fe = null;
2113
+ function Or() {
2114
+ qe = null;
2106
2115
  }
2107
- const Pr = 200;
2108
- function Dr(e) {
2116
+ const Hr = 200;
2117
+ function Wr(e) {
2109
2118
  const t = String(e.href || "");
2110
2119
  return {
2111
2120
  href: t,
@@ -2115,63 +2124,63 @@ function Dr(e) {
2115
2124
  description: e.description
2116
2125
  };
2117
2126
  }
2118
- function $r(e) {
2127
+ function Br(e) {
2119
2128
  return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
2120
2129
  }
2121
- function zr(e) {
2130
+ function qr(e) {
2122
2131
  const t = e ?? (typeof document < "u" ? document : null);
2123
2132
  if (!t) return [];
2124
2133
  const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
2125
- for (const d of l) {
2126
- if (i.length >= Pr) break;
2127
- if (At(d)) continue;
2128
- const s = d.getAttribute("href") || "";
2129
- if (!$r(s)) continue;
2130
- let u = s, f = !0;
2134
+ for (const u of l) {
2135
+ if (i.length >= Hr) break;
2136
+ if (At(u)) continue;
2137
+ const d = u.getAttribute("href") || "";
2138
+ if (!Br(d)) continue;
2139
+ let c = d, f = !0;
2131
2140
  try {
2132
2141
  if (typeof window < "u") {
2133
- const a = new URL(s, r);
2134
- f = a.origin === r, f && s.startsWith("http") && (u = a.pathname + a.search + a.hash);
2142
+ const a = new URL(d, r);
2143
+ f = a.origin === r, f && d.startsWith("http") && (c = a.pathname + a.search + a.hash);
2135
2144
  }
2136
2145
  } catch {
2137
2146
  continue;
2138
2147
  }
2139
- if (o.has(u)) continue;
2140
- o.add(u);
2141
- const m = (d.textContent || "").trim().slice(0, 120);
2142
- i.push({ href: u, text: m, internal: f });
2148
+ if (o.has(c)) continue;
2149
+ o.add(c);
2150
+ const h = (u.textContent || "").trim().slice(0, 120);
2151
+ i.push({ href: c, text: h, internal: f });
2143
2152
  }
2144
2153
  return i;
2145
2154
  }
2146
- let Ue = null;
2147
- const Or = 5e3;
2148
- function Et() {
2155
+ let Fe = null;
2156
+ const Fr = 5e3;
2157
+ function St() {
2149
2158
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
2150
- if (Ue && Ue.pathname === t && e - Ue.at < Or)
2151
- return Ue.routes;
2152
- const r = zr();
2153
- return Ue = { at: e, pathname: t, routes: r }, r;
2159
+ if (Fe && Fe.pathname === t && e - Fe.at < Fr)
2160
+ return Fe.routes;
2161
+ const r = qr();
2162
+ return Fe = { at: e, pathname: t, routes: r }, r;
2154
2163
  }
2155
- function Hr() {
2156
- Ue = null;
2164
+ function Ur() {
2165
+ Fe = null;
2157
2166
  }
2158
- function Wr(e, t) {
2167
+ function jr(e, t) {
2159
2168
  const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, o = Object.getOwnPropertyDescriptor(r, "value"), i = o == null ? void 0 : o.set;
2160
2169
  i ? i.call(e, t) : e.value = t;
2161
2170
  }
2162
- function Br(e, t, r = {}) {
2171
+ function Vr(e, t, r = {}) {
2163
2172
  const o = r.triggerInput ?? !0, i = r.triggerChange ?? !0;
2164
2173
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
2165
2174
  const l = Object.getOwnPropertyDescriptor(
2166
2175
  HTMLInputElement.prototype,
2167
2176
  "checked"
2168
- ), d = l == null ? void 0 : l.set, s = t === "true" || t === "1" || t === "on";
2169
- d ? d.call(e, s) : e.checked = s, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2177
+ ), u = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
2178
+ u ? u.call(e, d) : e.checked = d, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2170
2179
  return;
2171
2180
  }
2172
- Wr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2181
+ jr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2173
2182
  }
2174
- function qr() {
2183
+ function Yr() {
2175
2184
  if (typeof window > "u" || typeof document > "u")
2176
2185
  return !1;
2177
2186
  const e = document.scrollingElement || document.documentElement;
@@ -2179,19 +2188,19 @@ function qr() {
2179
2188
  const t = window.getComputedStyle(e);
2180
2189
  return !(t.overflowY === "hidden" || t.overflowY === "clip");
2181
2190
  }
2182
- function Fr(e) {
2191
+ function Gr(e) {
2183
2192
  if (!(e instanceof HTMLElement)) return !1;
2184
2193
  const r = window.getComputedStyle(e).overflowY;
2185
2194
  return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
2186
2195
  }
2187
- function Ur() {
2196
+ function Jr() {
2188
2197
  if (typeof document > "u") return null;
2189
2198
  const e = Array.from(
2190
2199
  document.querySelectorAll("body, body *")
2191
2200
  );
2192
2201
  let t = null, r = 0;
2193
2202
  for (const o of e) {
2194
- if (!Fr(o)) continue;
2203
+ if (!Gr(o)) continue;
2195
2204
  const i = o.getBoundingClientRect();
2196
2205
  if (i.bottom <= 0 || i.top >= window.innerHeight || i.right <= 0 || i.left >= window.innerWidth || i.width <= 0 || i.height <= 0 || o.closest(".ll-widget")) continue;
2197
2206
  const l = i.width * i.height;
@@ -2199,24 +2208,24 @@ function Ur() {
2199
2208
  }
2200
2209
  return t;
2201
2210
  }
2202
- function jr() {
2211
+ function Kr() {
2203
2212
  if (typeof window > "u")
2204
2213
  return null;
2205
- if (qr()) return window;
2206
- const e = Ur();
2214
+ if (Yr()) return window;
2215
+ const e = Jr();
2207
2216
  return e || window;
2208
2217
  }
2209
- function ln(e) {
2218
+ function sn(e) {
2210
2219
  return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
2211
2220
  }
2212
- function Vr(e) {
2221
+ function Xr(e) {
2213
2222
  var t, r;
2214
2223
  return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
2215
2224
  ((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
2216
2225
  ((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
2217
2226
  ) : e.scrollHeight - e.clientHeight;
2218
2227
  }
2219
- const Yr = /* @__PURE__ */ new Set([
2228
+ const Qr = /* @__PURE__ */ new Set([
2220
2229
  "agent_state",
2221
2230
  "avatar_stream_ready",
2222
2231
  "avatar_active",
@@ -2238,115 +2247,115 @@ const Yr = /* @__PURE__ */ new Set([
2238
2247
  "focus_field",
2239
2248
  "submit_form",
2240
2249
  "request_routes"
2241
- ]), mn = at(
2250
+ ]), yn = at(
2242
2251
  function(t, r) {
2243
- var zt, Ot, Ht, Wt, Bt, qt, Ft;
2252
+ var Ot, Ht, Wt, Bt, qt, Ft, Ut;
2244
2253
  const {
2245
2254
  agentId: o,
2246
2255
  apiKey: i,
2247
2256
  baseUrl: l = "https://app.livelayer.studio",
2248
- sessionEndpoint: d,
2249
- sessionBody: s,
2250
- soundEffects: u,
2257
+ sessionEndpoint: u,
2258
+ sessionBody: d,
2259
+ soundEffects: c,
2251
2260
  experienceMode: f = "WIDGET",
2252
- autoConnect: m = !1,
2261
+ autoConnect: h = !1,
2253
2262
  displayMode: a,
2254
- defaultDisplayMode: c = "expanded",
2263
+ defaultDisplayMode: s = "expanded",
2255
2264
  onDisplayModeChange: R,
2256
- position: P = "bottom-right",
2257
- mobileBreakpoint: C = 640,
2265
+ position: D = "bottom-right",
2266
+ mobileBreakpoint: E = 640,
2258
2267
  persistKey: v = "ll-widget",
2259
2268
  disablePersistence: b = !1,
2260
- teamMembers: A,
2261
- currentTeamMemberId: I,
2269
+ teamMembers: N,
2270
+ currentTeamMemberId: T,
2262
2271
  onTeamMemberChange: $,
2263
2272
  idleLoopUrl: w,
2264
- greeting: T,
2273
+ greeting: I,
2265
2274
  avatarImageUrl: B,
2266
2275
  agentName: z,
2267
- branding: S = {},
2268
- allowCamera: D = !0,
2269
- allowScreenShare: q = !0,
2276
+ branding: C = {},
2277
+ allowCamera: P = !0,
2278
+ allowScreenShare: F = !0,
2270
2279
  allowTyping: G = !0,
2271
- showMinimize: ie = !0,
2280
+ showMinimize: le = !0,
2272
2281
  chromeless: Z = !1,
2273
- compactControls: ke = !1,
2274
- transforming: de = !1,
2275
- transformingLabel: ye = "Transforming…",
2276
- showOn: ue,
2277
- hideOn: le,
2282
+ compactControls: Le = !1,
2283
+ transforming: ue = !1,
2284
+ transformingLabel: ve = "Transforming…",
2285
+ showOn: fe,
2286
+ hideOn: ae,
2278
2287
  pathname: ee,
2279
2288
  onNavigate: st,
2280
- onScrollToSelector: Ve,
2289
+ onScrollToSelector: je,
2281
2290
  getPageContext: ct,
2282
2291
  pageContextExtras: ne,
2283
- getRoutes: Ye,
2284
- onScrollPage: Ge,
2292
+ getRoutes: Ve,
2293
+ onScrollPage: Ye,
2285
2294
  onClick: dt,
2286
- capabilities: Je,
2287
- onConnect: Le,
2295
+ capabilities: Ge,
2296
+ onConnect: Ee,
2288
2297
  onDisconnect: Ce,
2289
- onTranscript: De,
2298
+ onTranscript: Pe,
2290
2299
  onAgentState: Se,
2291
- onConnectionStateChange: Ee,
2292
- onAgentEvent: Ne,
2293
- onAgentCommand: Ae,
2294
- controlledSession: U,
2300
+ onConnectionStateChange: Ne,
2301
+ onAgentEvent: Ae,
2302
+ onAgentCommand: Re,
2303
+ controlledSession: q,
2295
2304
  className: vt,
2296
- style: Re,
2305
+ style: Ie,
2297
2306
  zIndex: $e = 2147483647
2298
- } = t, re = Zn(ee), Ke = lr(re, ue, le);
2299
- N(() => {
2300
- Mr(), Hr();
2307
+ } = t, re = rr(ee), Je = dr(re, fe, ae);
2308
+ A(() => {
2309
+ Or(), Ur();
2301
2310
  }, [re]);
2302
- const Te = I !== void 0, [ze, bt] = L(() => {
2311
+ const Te = T !== void 0, [ze, bt] = L(() => {
2303
2312
  var y;
2304
- return I ?? ((y = A == null ? void 0 : A[0]) == null ? void 0 : y.id);
2305
- }), ve = Te ? I : ze, X = je(
2306
- () => (A == null ? void 0 : A.find((y) => y.id === ve)) ?? null,
2307
- [A, ve]
2308
- ), Xe = (X == null ? void 0 : X.agentId) ?? o, Ie = f === "EMBEDDED", [ae, te] = Jn({
2309
- value: Ie ? "expanded" : a,
2310
- defaultValue: Ie ? "expanded" : c,
2313
+ return T ?? ((y = N == null ? void 0 : N[0]) == null ? void 0 : y.id);
2314
+ }), be = Te ? T : ze, X = Ue(
2315
+ () => (N == null ? void 0 : N.find((y) => y.id === be)) ?? null,
2316
+ [N, be]
2317
+ ), Ke = (X == null ? void 0 : X.agentId) ?? o, Me = f === "EMBEDDED", [se, te] = Zn({
2318
+ value: Me ? "expanded" : a,
2319
+ defaultValue: Me ? "expanded" : s,
2311
2320
  onChange: R,
2312
2321
  persistKey: v,
2313
- disablePersistence: Ie || b
2314
- }), fe = Xn(C), be = zn(), oe = On(), pe = Wn(), Me = Bn(), we = qn(), [ut, Qe] = L(!1), [Ze, he] = L(!1), [se, Oe] = L(!1), [ft, wt] = L(!1), [He, h] = L(!1), j = sr({ baseUrl: l, config: u }), et = E(j);
2315
- et.current = j;
2316
- const _t = E(st), xt = E(Ve), kt = E(Ge), Lt = E(dt), Rt = E(ct), Tt = E(ne), It = E(Ye), Ct = E(Je), ce = E(null);
2317
- _t.current = st, xt.current = Ve, kt.current = Ge, Lt.current = dt, Rt.current = ct, Tt.current = ne, It.current = Ye, Ct.current = Je;
2318
- function _e(y) {
2319
- const p = Ct.current;
2322
+ disablePersistence: Me || b
2323
+ }), pe = tr(E), we = Bn(), oe = qn(), he = Un(), De = jn(), _e = Vn(), [ut, Xe] = L(!1), [Qe, me] = L(!1), [ce, Oe] = L(!1), [ft, wt] = L(!1), [He, m] = L(!1), j = fr({ baseUrl: l, config: c }), Ze = S(j);
2324
+ Ze.current = j;
2325
+ const _t = S(st), xt = S(je), kt = S(Ye), Lt = S(dt), Rt = S(ct), It = S(ne), Tt = S(Ve), Et = S(Ge), de = S(null);
2326
+ _t.current = st, xt.current = je, kt.current = Ye, Lt.current = dt, Rt.current = ct, It.current = ne, Tt.current = Ve, Et.current = Ge;
2327
+ function xe(y) {
2328
+ const p = Et.current;
2320
2329
  return p ? p.includes(y) : !0;
2321
2330
  }
2322
- function xe(y, p) {
2331
+ function ke(y, p) {
2323
2332
  console.warn(
2324
2333
  `[LiveLayer] Agent command "${y}" blocked — capability "${p}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
2325
2334
  );
2326
2335
  }
2327
- const tt = x(
2336
+ const et = k(
2328
2337
  (y) => {
2329
- var Y, me, Pe, We;
2338
+ var Y, ie, ge, rt;
2330
2339
  const p = y;
2331
2340
  if (!(!p.type || typeof p.type != "string")) {
2332
- if (Ne == null || Ne({ eventName: p.type, data: y }), p.type === "navigate") {
2333
- if (!_e("navigate")) {
2334
- xe("navigate", "navigate");
2341
+ if (Ae == null || Ae({ eventName: p.type, data: y }), p.type === "navigate") {
2342
+ if (!xe("navigate")) {
2343
+ ke("navigate", "navigate");
2335
2344
  return;
2336
2345
  }
2337
- const k = typeof p.href == "string" ? p.href : null;
2338
- if (!k) {
2346
+ const x = typeof p.href == "string" ? p.href : null;
2347
+ if (!x) {
2339
2348
  console.warn(
2340
2349
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
2341
2350
  );
2342
2351
  return;
2343
2352
  }
2344
- if (et.current.playPageChange(), _t.current) {
2353
+ if (Ze.current.playPageChange(), _t.current) {
2345
2354
  try {
2346
- _t.current(k);
2355
+ _t.current(x);
2347
2356
  } catch (M) {
2348
2357
  console.warn(
2349
- `[LiveLayer] onNavigate threw for "${k}". Falling back. Error:`,
2358
+ `[LiveLayer] onNavigate threw for "${x}". Falling back. Error:`,
2350
2359
  M
2351
2360
  );
2352
2361
  }
@@ -2354,7 +2363,7 @@ const Yr = /* @__PURE__ */ new Set([
2354
2363
  }
2355
2364
  if (typeof document < "u") {
2356
2365
  const M = document.querySelector(
2357
- `a[href="${k.replace(/"/g, '\\"')}"]`
2366
+ `a[href="${x.replace(/"/g, '\\"')}"]`
2358
2367
  );
2359
2368
  if (M) {
2360
2369
  M.click();
@@ -2363,27 +2372,27 @@ const Yr = /* @__PURE__ */ new Set([
2363
2372
  }
2364
2373
  if (typeof window < "u" && typeof history < "u")
2365
2374
  try {
2366
- history.pushState({}, "", k), window.dispatchEvent(new PopStateEvent("popstate"));
2375
+ history.pushState({}, "", x), window.dispatchEvent(new PopStateEvent("popstate"));
2367
2376
  } catch (M) {
2368
2377
  console.warn(
2369
- `[LiveLayer] history.pushState fallback failed for "${k}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
2378
+ `[LiveLayer] history.pushState fallback failed for "${x}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
2370
2379
  M
2371
2380
  );
2372
2381
  }
2373
2382
  return;
2374
2383
  }
2375
2384
  if (p.type === "scroll_to") {
2376
- if (!_e("scroll")) {
2377
- xe("scroll_to", "scroll");
2385
+ if (!xe("scroll")) {
2386
+ ke("scroll_to", "scroll");
2378
2387
  return;
2379
2388
  }
2380
- const k = typeof p.selector == "string" ? p.selector : null;
2381
- if (!k) return;
2389
+ const x = typeof p.selector == "string" ? p.selector : null;
2390
+ if (!x) return;
2382
2391
  const M = p.behavior === "instant" ? "instant" : "smooth";
2383
2392
  if (xt.current) {
2384
2393
  try {
2385
2394
  xt.current(
2386
- k,
2395
+ x,
2387
2396
  M
2388
2397
  );
2389
2398
  } catch (W) {
@@ -2394,16 +2403,16 @@ const Yr = /* @__PURE__ */ new Set([
2394
2403
  if (typeof document < "u") {
2395
2404
  let W = null;
2396
2405
  try {
2397
- W = document.querySelector(k);
2406
+ W = document.querySelector(x);
2398
2407
  } catch {
2399
2408
  console.warn(
2400
- `[LiveLayer] scroll_to: invalid selector "${k}".`
2409
+ `[LiveLayer] scroll_to: invalid selector "${x}".`
2401
2410
  );
2402
2411
  return;
2403
2412
  }
2404
2413
  if (!W) {
2405
2414
  console.warn(
2406
- `[LiveLayer] scroll_to: no element matched "${k}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
2415
+ `[LiveLayer] scroll_to: no element matched "${x}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
2407
2416
  );
2408
2417
  return;
2409
2418
  }
@@ -2415,23 +2424,23 @@ const Yr = /* @__PURE__ */ new Set([
2415
2424
  return;
2416
2425
  }
2417
2426
  if (p.type === "request_page_context") {
2418
- if (!_e("read_page")) {
2419
- xe("request_page_context", "read_page");
2427
+ if (!xe("read_page")) {
2428
+ ke("request_page_context", "read_page");
2420
2429
  return;
2421
2430
  }
2422
- const k = typeof p.requestId == "string" ? p.requestId : void 0, M = (Y = ce.current) == null ? void 0 : Y.call(ce), W = (V) => {
2431
+ const x = typeof p.requestId == "string" ? p.requestId : void 0, M = (Y = de.current) == null ? void 0 : Y.call(de), W = (V) => {
2423
2432
  const O = M, K = O == null ? void 0 : O.localParticipant;
2424
2433
  if (K != null && K.publishData)
2425
2434
  try {
2426
- const Q = k ? { ...V, requestId: k } : V, Be = new TextEncoder().encode(JSON.stringify(Q));
2427
- K.publishData(Be, { reliable: !0 });
2435
+ const Q = x ? { ...V, requestId: x } : V, We = new TextEncoder().encode(JSON.stringify(Q));
2436
+ K.publishData(We, { reliable: !0 });
2428
2437
  } catch (Q) {
2429
2438
  console.warn("[LiveLayer] publishData failed.", Q);
2430
2439
  }
2431
- }, H = Tt.current, F = Rt.current;
2440
+ }, H = It.current, U = Rt.current;
2432
2441
  try {
2433
- if (F) {
2434
- const V = F(H);
2442
+ if (U) {
2443
+ const V = U(H);
2435
2444
  if (V instanceof Promise) {
2436
2445
  W({ type: "page_context_pending" }), V.then((O) => W({ type: "page_context", context: O })).catch((O) => {
2437
2446
  console.warn(
@@ -2439,7 +2448,7 @@ const Yr = /* @__PURE__ */ new Set([
2439
2448
  O
2440
2449
  ), W({
2441
2450
  type: "page_context",
2442
- context: on(H)
2451
+ context: an(H)
2443
2452
  });
2444
2453
  });
2445
2454
  return;
@@ -2449,7 +2458,7 @@ const Yr = /* @__PURE__ */ new Set([
2449
2458
  }
2450
2459
  W({
2451
2460
  type: "page_context",
2452
- context: on(H)
2461
+ context: an(H)
2453
2462
  });
2454
2463
  } catch (V) {
2455
2464
  console.warn(
@@ -2463,14 +2472,14 @@ const Yr = /* @__PURE__ */ new Set([
2463
2472
  return;
2464
2473
  }
2465
2474
  if (p.type === "scroll_page") {
2466
- if (!_e("scroll")) {
2467
- xe("scroll_page", "scroll");
2475
+ if (!xe("scroll")) {
2476
+ ke("scroll_page", "scroll");
2468
2477
  return;
2469
2478
  }
2470
- const k = p.direction;
2471
- if (k !== "up" && k !== "down" && k !== "top" && k !== "bottom") {
2479
+ const x = p.direction;
2480
+ if (x !== "up" && x !== "down" && x !== "top" && x !== "bottom") {
2472
2481
  console.warn(
2473
- `[LiveLayer] scroll_page: invalid direction "${String(k)}". Expected up | down | top | bottom.`
2482
+ `[LiveLayer] scroll_page: invalid direction "${String(x)}". Expected up | down | top | bottom.`
2474
2483
  );
2475
2484
  return;
2476
2485
  }
@@ -2478,7 +2487,7 @@ const Yr = /* @__PURE__ */ new Set([
2478
2487
  if (kt.current) {
2479
2488
  try {
2480
2489
  kt.current(
2481
- k,
2490
+ x,
2482
2491
  M
2483
2492
  );
2484
2493
  } catch (O) {
@@ -2487,27 +2496,27 @@ const Yr = /* @__PURE__ */ new Set([
2487
2496
  return;
2488
2497
  }
2489
2498
  if (typeof window > "u") return;
2490
- const W = { behavior: M }, H = jr(), F = (O) => {
2499
+ const W = { behavior: M }, H = Kr(), U = (O) => {
2491
2500
  H instanceof Window ? H.scrollBy({ top: O, ...W }) : H.scrollBy({ top: O, ...W });
2492
2501
  }, V = (O) => {
2493
2502
  H instanceof Window ? H.scrollTo({ top: O, ...W }) : H.scrollTo({ top: O, ...W });
2494
2503
  };
2495
- k === "up" ? F(-ln(H)) : k === "down" ? F(ln(H)) : V(k === "top" ? 0 : Vr(H));
2504
+ x === "up" ? U(-sn(H)) : x === "down" ? U(sn(H)) : V(x === "top" ? 0 : Xr(H));
2496
2505
  return;
2497
2506
  }
2498
2507
  if (p.type === "click") {
2499
- if (!_e("click")) {
2500
- xe("click", "click");
2508
+ if (!xe("click")) {
2509
+ ke("click", "click");
2501
2510
  return;
2502
2511
  }
2503
- const k = typeof p.selector == "string" ? p.selector : null;
2504
- if (!k) {
2512
+ const x = typeof p.selector == "string" ? p.selector : null;
2513
+ if (!x) {
2505
2514
  console.warn("[LiveLayer] click: missing selector.");
2506
2515
  return;
2507
2516
  }
2508
2517
  if (Lt.current) {
2509
2518
  try {
2510
- Lt.current(k);
2519
+ Lt.current(x);
2511
2520
  } catch (W) {
2512
2521
  console.warn("[LiveLayer] onClick threw.", W);
2513
2522
  }
@@ -2516,16 +2525,16 @@ const Yr = /* @__PURE__ */ new Set([
2516
2525
  if (typeof document > "u") return;
2517
2526
  let M = null;
2518
2527
  try {
2519
- M = document.querySelector(k);
2528
+ M = document.querySelector(x);
2520
2529
  } catch {
2521
2530
  console.warn(
2522
- `[LiveLayer] click: invalid selector "${k}".`
2531
+ `[LiveLayer] click: invalid selector "${x}".`
2523
2532
  );
2524
2533
  return;
2525
2534
  }
2526
2535
  if (!M) {
2527
2536
  console.warn(
2528
- `[LiveLayer] click: no element matched "${k}". See https://livelayer.studio/docs/errors/click-no-match`
2537
+ `[LiveLayer] click: no element matched "${x}". See https://livelayer.studio/docs/errors/click-no-match`
2529
2538
  );
2530
2539
  return;
2531
2540
  }
@@ -2535,27 +2544,27 @@ const Yr = /* @__PURE__ */ new Set([
2535
2544
  );
2536
2545
  return;
2537
2546
  }
2538
- (me = M.click) == null || me.call(M);
2547
+ (ie = M.click) == null || ie.call(M);
2539
2548
  return;
2540
2549
  }
2541
2550
  if (p.type === "fill_form" || p.type === "focus_field") {
2542
- if (!_e("fill_forms")) {
2543
- xe(p.type, "fill_forms");
2551
+ if (!xe("fill_forms")) {
2552
+ ke(p.type, "fill_forms");
2544
2553
  return;
2545
2554
  }
2546
2555
  if (typeof document > "u") return;
2547
- p.type === "fill_form" && et.current.playConfirmation();
2548
- const k = typeof p.formId == "string" ? p.formId : null;
2549
- if (!k) {
2556
+ p.type === "fill_form" && Ze.current.playConfirmation();
2557
+ const x = typeof p.formId == "string" ? p.formId : null;
2558
+ if (!x) {
2550
2559
  console.warn(`[LiveLayer] ${p.type}: missing formId.`);
2551
2560
  return;
2552
2561
  }
2553
2562
  const M = document.querySelector(
2554
- `[data-ll-form="${k.replace(/"/g, '\\"')}"]`
2563
+ `[data-ll-form="${x.replace(/"/g, '\\"')}"]`
2555
2564
  );
2556
2565
  if (!M) {
2557
2566
  console.warn(
2558
- `[LiveLayer] ${p.type}: no form with data-ll-form="${k}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2567
+ `[LiveLayer] ${p.type}: no form with data-ll-form="${x}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2559
2568
  );
2560
2569
  return;
2561
2570
  }
@@ -2571,20 +2580,20 @@ const Yr = /* @__PURE__ */ new Set([
2571
2580
  console.warn("[LiveLayer] focus_field: missing fieldName.");
2572
2581
  return;
2573
2582
  }
2574
- const F = M.querySelector(`[data-ll-field="${H.replace(/"/g, '\\"')}"]`);
2575
- if (!F) {
2583
+ const U = M.querySelector(`[data-ll-field="${H.replace(/"/g, '\\"')}"]`);
2584
+ if (!U) {
2576
2585
  console.warn(
2577
- `[LiveLayer] focus_field: no field "${H}" in form "${k}".`
2586
+ `[LiveLayer] focus_field: no field "${H}" in form "${x}".`
2578
2587
  );
2579
2588
  return;
2580
2589
  }
2581
- if (!yt(F)) {
2590
+ if (!yt(U)) {
2582
2591
  console.warn(
2583
2592
  `[LiveLayer] focus_field: field "${H}" is privacy-protected and not focusable.`
2584
2593
  );
2585
2594
  return;
2586
2595
  }
2587
- F.focus();
2596
+ U.focus();
2588
2597
  return;
2589
2598
  }
2590
2599
  const W = p.values && typeof p.values == "object" ? p.values : null;
@@ -2592,12 +2601,12 @@ const Yr = /* @__PURE__ */ new Set([
2592
2601
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
2593
2602
  return;
2594
2603
  }
2595
- for (const [H, F] of Object.entries(W)) {
2596
- if (typeof F != "string") continue;
2604
+ for (const [H, U] of Object.entries(W)) {
2605
+ if (typeof U != "string") continue;
2597
2606
  const V = M.querySelector(`[data-ll-field="${H.replace(/"/g, '\\"')}"]`);
2598
2607
  if (!V) {
2599
2608
  console.warn(
2600
- `[LiveLayer] fill_form: no field "${H}" in form "${k}". Skipping.`
2609
+ `[LiveLayer] fill_form: no field "${H}" in form "${x}". Skipping.`
2601
2610
  );
2602
2611
  continue;
2603
2612
  }
@@ -2608,7 +2617,7 @@ const Yr = /* @__PURE__ */ new Set([
2608
2617
  continue;
2609
2618
  }
2610
2619
  try {
2611
- Br(V, F);
2620
+ Vr(V, U);
2612
2621
  } catch (O) {
2613
2622
  console.warn(
2614
2623
  `[LiveLayer] fill_form: failed to set "${H}".`,
@@ -2619,23 +2628,23 @@ const Yr = /* @__PURE__ */ new Set([
2619
2628
  return;
2620
2629
  }
2621
2630
  if (p.type === "submit_form") {
2622
- if (!_e("submit_forms")) {
2623
- xe("submit_form", "submit_forms");
2631
+ if (!xe("submit_forms")) {
2632
+ ke("submit_form", "submit_forms");
2624
2633
  return;
2625
2634
  }
2626
2635
  if (typeof document > "u") return;
2627
- const k = typeof p.formId == "string" ? p.formId : null;
2628
- if (!k) {
2636
+ const x = typeof p.formId == "string" ? p.formId : null;
2637
+ if (!x) {
2629
2638
  console.warn("[LiveLayer] submit_form: missing formId.");
2630
2639
  return;
2631
2640
  }
2632
- et.current.playConfirmation();
2641
+ Ze.current.playConfirmation();
2633
2642
  const M = document.querySelector(
2634
- `[data-ll-form="${k.replace(/"/g, '\\"')}"]`
2643
+ `[data-ll-form="${x.replace(/"/g, '\\"')}"]`
2635
2644
  );
2636
2645
  if (!M) {
2637
2646
  console.warn(
2638
- `[LiveLayer] submit_form: no form with data-ll-form="${k}".`
2647
+ `[LiveLayer] submit_form: no form with data-ll-form="${x}".`
2639
2648
  );
2640
2649
  return;
2641
2650
  }
@@ -2645,130 +2654,130 @@ const Yr = /* @__PURE__ */ new Set([
2645
2654
  );
2646
2655
  return;
2647
2656
  }
2648
- const W = typeof p.requestId == "string" ? p.requestId : void 0, H = (Pe = ce.current) == null ? void 0 : Pe.call(ce), F = (K) => {
2649
- const Q = H, Be = Q == null ? void 0 : Q.localParticipant;
2650
- if (Be != null && Be.publishData)
2657
+ const W = typeof p.requestId == "string" ? p.requestId : void 0, H = (ge = de.current) == null ? void 0 : ge.call(de), U = (K) => {
2658
+ const Q = H, We = Q == null ? void 0 : Q.localParticipant;
2659
+ if (We != null && We.publishData)
2651
2660
  try {
2652
- const En = W ? { ...K, requestId: W } : K, Nn = new TextEncoder().encode(JSON.stringify(En));
2653
- Be.publishData(Nn, { reliable: !0 });
2661
+ const An = W ? { ...K, requestId: W } : K, Rn = new TextEncoder().encode(JSON.stringify(An));
2662
+ We.publishData(Rn, { reliable: !0 });
2654
2663
  } catch {
2655
2664
  }
2656
2665
  };
2657
2666
  let V = !1;
2658
2667
  const O = () => {
2659
- V = !0, F({ type: "form_submitted", formId: k });
2668
+ V = !0, U({ type: "form_submitted", formId: x });
2660
2669
  };
2661
2670
  M.addEventListener("submit", O, { once: !0 });
2662
2671
  try {
2663
2672
  typeof M.requestSubmit == "function" ? M.requestSubmit() : M.submit();
2664
2673
  } catch (K) {
2665
- console.warn("[LiveLayer] submit_form: requestSubmit threw.", K), M.removeEventListener("submit", O), F({
2674
+ console.warn("[LiveLayer] submit_form: requestSubmit threw.", K), M.removeEventListener("submit", O), U({
2666
2675
  type: "form_submit_blocked",
2667
- formId: k,
2676
+ formId: x,
2668
2677
  reason: "exception"
2669
2678
  });
2670
2679
  return;
2671
2680
  }
2672
2681
  setTimeout(() => {
2673
- V || (M.removeEventListener("submit", O), F({
2682
+ V || (M.removeEventListener("submit", O), U({
2674
2683
  type: "form_submit_blocked",
2675
- formId: k,
2684
+ formId: x,
2676
2685
  reason: "validation"
2677
2686
  }));
2678
2687
  }, 500);
2679
2688
  return;
2680
2689
  }
2681
2690
  if (p.type === "request_routes") {
2682
- if (!_e("read_page")) {
2683
- xe("request_routes", "read_page");
2691
+ if (!xe("read_page")) {
2692
+ ke("request_routes", "read_page");
2684
2693
  return;
2685
2694
  }
2686
- const k = typeof p.requestId == "string" ? p.requestId : void 0, W = (We = ce.current) == null ? void 0 : We.call(ce), H = W == null ? void 0 : W.localParticipant;
2695
+ const x = typeof p.requestId == "string" ? p.requestId : void 0, W = (rt = de.current) == null ? void 0 : rt.call(de), H = W == null ? void 0 : W.localParticipant;
2687
2696
  if (!(H != null && H.publishData)) return;
2688
- const F = (O) => {
2697
+ const U = (O) => {
2689
2698
  try {
2690
- const K = k ? { type: "routes", routes: O, requestId: k } : { type: "routes", routes: O }, Q = new TextEncoder().encode(JSON.stringify(K));
2699
+ const K = x ? { type: "routes", routes: O, requestId: x } : { type: "routes", routes: O }, Q = new TextEncoder().encode(JSON.stringify(K));
2691
2700
  H.publishData(Q, { reliable: !0 });
2692
2701
  } catch (K) {
2693
2702
  console.warn("[LiveLayer] request_routes: publishData failed.", K);
2694
2703
  }
2695
- }, V = It.current;
2704
+ }, V = Tt.current;
2696
2705
  if (V) {
2697
2706
  try {
2698
2707
  const O = V(), K = (Q) => {
2699
2708
  if (!Array.isArray(Q)) {
2700
- F([]);
2709
+ U([]);
2701
2710
  return;
2702
2711
  }
2703
- F(Q.map(Dr).slice(0, 200));
2712
+ U(Q.map(Wr).slice(0, 200));
2704
2713
  };
2705
2714
  O instanceof Promise ? O.then(K).catch((Q) => {
2706
2715
  console.warn(
2707
2716
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
2708
2717
  Q
2709
- ), F(Et());
2718
+ ), U(St());
2710
2719
  }) : K(O);
2711
2720
  } catch (O) {
2712
2721
  console.warn(
2713
2722
  "[LiveLayer] getRoutes threw; falling back to DOM walker.",
2714
2723
  O
2715
- ), F(Et());
2724
+ ), U(St());
2716
2725
  }
2717
2726
  return;
2718
2727
  }
2719
2728
  try {
2720
- F(Et());
2729
+ U(St());
2721
2730
  } catch (O) {
2722
2731
  console.warn("[LiveLayer] request_routes: extractRoutes threw.", O);
2723
2732
  }
2724
2733
  return;
2725
2734
  }
2726
- Yr.has(p.type) || Ae == null || Ae(p);
2735
+ Qr.has(p.type) || Re == null || Re(p);
2727
2736
  }
2728
2737
  },
2729
- [Ae, Ne]
2730
- ), J = $n({
2731
- agentId: U ? "__controlled__" : Xe,
2738
+ [Re, Ae]
2739
+ ), J = Wn({
2740
+ agentId: q ? "__controlled__" : Ke,
2732
2741
  baseUrl: l,
2733
2742
  apiKey: i,
2734
- sessionEndpoint: d,
2735
- sessionBody: s,
2736
- onDataMessage: U ? void 0 : tt
2743
+ sessionEndpoint: u,
2744
+ sessionBody: d,
2745
+ onDataMessage: q ? void 0 : et
2737
2746
  });
2738
- N(() => {
2739
- if (U != null && U.subscribeToDataMessages)
2740
- return U.subscribeToDataMessages(tt);
2741
- }, [U, tt]), ce.current = () => {
2747
+ A(() => {
2748
+ if (q != null && q.subscribeToDataMessages)
2749
+ return q.subscribeToDataMessages(et);
2750
+ }, [q, et]), de.current = () => {
2742
2751
  var y;
2743
2752
  return (y = J.getRoom) == null ? void 0 : y.call(J);
2744
- }, N(() => {
2753
+ }, A(() => {
2745
2754
  var Y;
2746
2755
  if (typeof window > "u") return;
2747
2756
  const y = ((Y = window.location) == null ? void 0 : Y.hostname) || "";
2748
2757
  if (y === "localhost" || y === "127.0.0.1" || y === "0.0.0.0" || y.endsWith(".local") || y.endsWith(".test"))
2749
- return window.__livelayerSimulateCommand = (me) => {
2758
+ return window.__livelayerSimulateCommand = (ie) => {
2750
2759
  try {
2751
- tt(me);
2752
- } catch (Pe) {
2753
- console.warn("[LiveLayer] simulate-command threw:", Pe);
2760
+ et(ie);
2761
+ } catch (ge) {
2762
+ console.warn("[LiveLayer] simulate-command threw:", ge);
2754
2763
  }
2755
2764
  }, () => {
2756
2765
  delete window.__livelayerSimulateCommand;
2757
2766
  };
2758
- }, [tt]);
2759
- const _ = je(() => U ? {
2760
- connectionState: U.connectionState,
2761
- agentState: U.agentState,
2762
- transcript: U.transcript,
2763
- videoElement: U.videoElement,
2764
- audioElement: U.audioElement,
2765
- canResume: U.canResume,
2766
- error: U.error,
2767
+ }, [et]);
2768
+ const _ = Ue(() => q ? {
2769
+ connectionState: q.connectionState,
2770
+ agentState: q.agentState,
2771
+ transcript: q.transcript,
2772
+ videoElement: q.videoElement,
2773
+ audioElement: q.audioElement,
2774
+ canResume: q.canResume,
2775
+ error: q.error,
2767
2776
  agentConfig: null,
2768
2777
  connect: async () => {
2769
- await U.onConnect();
2778
+ await q.onConnect();
2770
2779
  },
2771
- disconnect: () => U.onDisconnect(),
2780
+ disconnect: () => q.onDisconnect(),
2772
2781
  // Dummy getRoom for shape compatibility — controlled consumers own the Room.
2773
2782
  // Internal session's getRoom returns null when no real connect has happened,
2774
2783
  // so we reuse its reference for type consistency.
@@ -2787,197 +2796,214 @@ const Yr = /* @__PURE__ */ new Set([
2787
2796
  disconnect: J.disconnect,
2788
2797
  getRoom: J.getRoom,
2789
2798
  isControlled: !1
2790
- }, [U, J]), Mt = E(_);
2791
- Mt.current = _, Rn(
2799
+ }, [q, J]), Mt = S(_);
2800
+ Mt.current = _;
2801
+ const Dt = S(q);
2802
+ Dt.current = q, Mn(
2792
2803
  r,
2793
2804
  () => ({
2794
2805
  sendData: async (y) => {
2795
- var me, Pe;
2796
- const p = (Pe = (me = Mt.current) == null ? void 0 : me.getRoom) == null ? void 0 : Pe.call(me), Y = p == null ? void 0 : p.localParticipant;
2797
- if (Y != null && Y.publishData)
2806
+ var ge, rt;
2807
+ const p = Dt.current;
2808
+ if (p != null && p.publishData) {
2798
2809
  try {
2799
- const We = new TextEncoder().encode(JSON.stringify(y));
2800
- await Y.publishData(We, { reliable: !0 });
2801
- } catch (We) {
2802
- console.warn("[AvatarWidget] sendData failed:", We);
2810
+ await p.publishData(y);
2811
+ } catch (x) {
2812
+ console.warn("[AvatarWidget] sendData (controlled) failed:", x);
2813
+ }
2814
+ return;
2815
+ }
2816
+ const Y = (rt = (ge = Mt.current) == null ? void 0 : ge.getRoom) == null ? void 0 : rt.call(ge), ie = Y == null ? void 0 : Y.localParticipant;
2817
+ if (ie != null && ie.publishData)
2818
+ try {
2819
+ const x = new TextEncoder().encode(JSON.stringify(y));
2820
+ await ie.publishData(x, { reliable: !0 });
2821
+ } catch (x) {
2822
+ console.warn("[AvatarWidget] sendData failed:", x);
2803
2823
  }
2804
2824
  }
2805
2825
  }),
2806
2826
  []
2807
2827
  );
2808
- const Pt = E(null);
2809
- N(() => {
2828
+ const Pt = S(null);
2829
+ A(() => {
2810
2830
  const y = _.videoElement, p = Pt.current;
2811
2831
  if (!(!y || !p))
2812
2832
  return p.appendChild(y), () => {
2813
2833
  y.parentNode === p && p.removeChild(y);
2814
2834
  };
2815
- }, [_.videoElement]), N(() => {
2835
+ }, [_.videoElement]), A(() => {
2816
2836
  const y = _.audioElement;
2817
2837
  if (!y) return;
2818
- be.attach(y);
2838
+ we.attach(y);
2819
2839
  const p = y.play();
2820
2840
  return p && typeof p.catch == "function" && p.catch((Y) => {
2821
- (Y == null ? void 0 : Y.name) === "NotAllowedError" && Qe(!0);
2841
+ (Y == null ? void 0 : Y.name) === "NotAllowedError" && Xe(!0);
2822
2842
  }), () => {
2823
- be.detach();
2843
+ we.detach();
2824
2844
  };
2825
- }, [_.audioElement]), N(() => {
2845
+ }, [_.audioElement]), A(() => {
2826
2846
  if (_.isControlled || _.connectionState !== "connected") return;
2827
2847
  const y = _.getRoom();
2828
2848
  if (y)
2829
2849
  return oe.setupMic(y).catch(() => {
2830
- }), pe.attachRoom(y), Me.attachRoom(y), we.refresh(), () => {
2831
- oe.teardownMic(), pe.teardown(), Me.teardown();
2850
+ }), he.attachRoom(y), De.attachRoom(y), _e.refresh(), () => {
2851
+ oe.teardownMic(), he.teardown(), De.teardown();
2832
2852
  };
2833
- }, [_.isControlled, _.connectionState]), N(() => {
2853
+ }, [_.isControlled, _.connectionState]), A(() => {
2834
2854
  const y = _.audioElement;
2835
2855
  y && (y.muted = He);
2836
2856
  }, [_.audioElement, He]);
2837
- const gn = x((y) => {
2838
- const p = _.getRoom();
2839
- if (p)
2857
+ const vn = k((y) => {
2858
+ const p = { type: "user_message", text: y };
2859
+ if (q != null && q.publishData) {
2840
2860
  try {
2841
- const Y = new TextEncoder().encode(
2842
- JSON.stringify({ type: "user_message", text: y })
2843
- );
2844
- p.localParticipant.publishData(Y, { reliable: !0 });
2861
+ q.publishData(p);
2845
2862
  } catch {
2846
2863
  }
2847
- }, [_]), yn = x(() => {
2848
- h((y) => !y);
2864
+ return;
2865
+ }
2866
+ const Y = _.getRoom();
2867
+ if (Y)
2868
+ try {
2869
+ const ie = new TextEncoder().encode(JSON.stringify(p));
2870
+ Y.localParticipant.publishData(ie, { reliable: !0 });
2871
+ } catch {
2872
+ }
2873
+ }, [_, q]), bn = k(() => {
2874
+ m((y) => !y);
2849
2875
  }, []);
2850
- N(() => {
2851
- Ee == null || Ee(_.connectionState), _.connectionState === "connected" ? Le == null || Le() : _.connectionState === "disconnected" && (Ce == null || Ce());
2852
- }, [_.connectionState, Le, Ce, Ee]), N(() => {
2853
- De == null || De(_.transcript);
2854
- }, [_.transcript, De]), N(() => {
2876
+ A(() => {
2877
+ Ne == null || Ne(_.connectionState), _.connectionState === "connected" ? Ee == null || Ee() : _.connectionState === "disconnected" && (Ce == null || Ce());
2878
+ }, [_.connectionState, Ee, Ce, Ne]), A(() => {
2879
+ Pe == null || Pe(_.transcript);
2880
+ }, [_.transcript, Pe]), A(() => {
2855
2881
  Se == null || Se(_.agentState);
2856
- }, [_.agentState, Se]), N(() => {
2882
+ }, [_.agentState, Se]), A(() => {
2857
2883
  j.setThinking(_.agentState === "thinking");
2858
2884
  }, [_.agentState, j]);
2859
- const Dt = E(!1);
2860
- N(() => {
2861
- _.isControlled || !m || Dt.current || Ke && _.connectionState === "idle" && (Dt.current = !0, _.connect());
2862
- }, [m, _.connectionState, _, Ke]);
2863
- const vn = x(
2885
+ const $t = S(!1);
2886
+ A(() => {
2887
+ _.isControlled || !h || $t.current || Je && _.connectionState === "idle" && ($t.current = !0, _.connect());
2888
+ }, [h, _.connectionState, _, Je]);
2889
+ const wn = k(
2864
2890
  (y) => {
2865
- const p = A == null ? void 0 : A.find((Y) => Y.id === y);
2866
- p && (Oe(!1), y !== ve && (he(!0), _.disconnect(), Te || bt(y), $ == null || $(p)));
2891
+ const p = N == null ? void 0 : N.find((Y) => Y.id === y);
2892
+ p && (Oe(!1), y !== be && (me(!0), _.disconnect(), Te || bt(y), $ == null || $(p)));
2867
2893
  },
2868
2894
  [
2869
- A,
2870
- ve,
2895
+ N,
2896
+ be,
2871
2897
  _,
2872
2898
  Te,
2873
2899
  $
2874
2900
  ]
2875
2901
  );
2876
- N(() => {
2877
- Ze && _.connectionState === "connected" && he(!1);
2878
- }, [_.connectionState, Ze]), N(() => {
2879
- if (!se) return;
2902
+ A(() => {
2903
+ Qe && _.connectionState === "connected" && me(!1);
2904
+ }, [_.connectionState, Qe]), A(() => {
2905
+ if (!ce) return;
2880
2906
  const y = (p) => {
2881
2907
  p.key === "Escape" && Oe(!1);
2882
2908
  };
2883
2909
  return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
2884
- }, [se]);
2885
- const bn = !!B || !!(X != null && X.avatarImageUrl) || _.isControlled, nt = Fn(Xe, l, bn);
2886
- Je === void 0 && ((zt = nt.info) != null && zt.capabilities) && (Ct.current = nt.info.capabilities);
2887
- const pt = (X == null ? void 0 : X.name) ?? z ?? ((Ot = _.agentConfig) == null ? void 0 : Ot.name) ?? ((Ht = nt.info) == null ? void 0 : Ht.name) ?? "Live Layer", St = (X == null ? void 0 : X.avatarImageUrl) ?? B ?? ((Wt = _.agentConfig) == null ? void 0 : Wt.avatarImageUrl) ?? ((Bt = nt.info) == null ? void 0 : Bt.avatarImageUrl) ?? null, wn = w ?? ((qt = _.agentConfig) == null ? void 0 : qt.idleLoopUrl) ?? ((Ft = nt.info) == null ? void 0 : Ft.idleLoopUrl) ?? null, _n = T ?? null, xn = x(() => te("expanded"), [te]), kn = x(
2910
+ }, [ce]);
2911
+ const _n = !!B || !!(X != null && X.avatarImageUrl) || _.isControlled, tt = Yn(Ke, l, _n);
2912
+ Ge === void 0 && ((Ot = tt.info) != null && Ot.capabilities) && (Et.current = tt.info.capabilities);
2913
+ const pt = (X == null ? void 0 : X.name) ?? z ?? ((Ht = _.agentConfig) == null ? void 0 : Ht.name) ?? ((Wt = tt.info) == null ? void 0 : Wt.name) ?? "Live Layer", Ct = (X == null ? void 0 : X.avatarImageUrl) ?? B ?? ((Bt = _.agentConfig) == null ? void 0 : Bt.avatarImageUrl) ?? ((qt = tt.info) == null ? void 0 : qt.avatarImageUrl) ?? null, xn = w ?? ((Ft = _.agentConfig) == null ? void 0 : Ft.idleLoopUrl) ?? ((Ut = tt.info) == null ? void 0 : Ut.idleLoopUrl) ?? null, kn = I ?? null, Ln = k(() => te("expanded"), [te]), En = k(
2888
2914
  () => te("minimized"),
2889
2915
  [te]
2890
- ), $t = x(() => {
2916
+ ), zt = k(() => {
2891
2917
  _.disconnect(), te("hidden");
2892
- }, [_, te]), Ln = x(() => {
2918
+ }, [_, te]), Cn = k(() => {
2893
2919
  const y = _.audioElement;
2894
- y && y.play().then(() => Qe(!1)).catch(() => {
2920
+ y && y.play().then(() => Xe(!1)).catch(() => {
2895
2921
  });
2896
- }, [_.audioElement]), Cn = x(() => {
2897
- Qe(!1), _.connect();
2898
- }, [_]), rt = {
2899
- ...Re,
2900
- ...Ie ? {} : { zIndex: $e }
2922
+ }, [_.audioElement]), Sn = k(() => {
2923
+ Xe(!1), _.connect();
2924
+ }, [_]), nt = {
2925
+ ...Ie,
2926
+ ...Me ? {} : { zIndex: $e }
2901
2927
  };
2902
- S.primaryColor && (rt["--ll-color-primary"] = S.primaryColor), S.accentColor && (rt["--ll-color-accent"] = S.accentColor), S.backgroundColor && (rt["--ll-color-bg"] = S.backgroundColor), S.textColor && (rt["--ll-color-fg"] = S.textColor);
2903
- const Sn = [
2928
+ C.primaryColor && (nt["--ll-color-primary"] = C.primaryColor), C.accentColor && (nt["--ll-color-accent"] = C.accentColor), C.backgroundColor && (nt["--ll-color-bg"] = C.backgroundColor), C.textColor && (nt["--ll-color-fg"] = C.textColor);
2929
+ const Nn = [
2904
2930
  "ll-widget",
2905
- `ll-widget--${ae}`,
2906
- `ll-widget--${fe ? "mobile" : "desktop"}`,
2931
+ `ll-widget--${se}`,
2932
+ `ll-widget--${pe ? "mobile" : "desktop"}`,
2907
2933
  vt
2908
2934
  ].filter(Boolean).join(" ");
2909
- return Ke ? /* @__PURE__ */ g(
2935
+ return Je ? /* @__PURE__ */ g(
2910
2936
  "div",
2911
2937
  {
2912
- className: Sn,
2913
- style: rt,
2914
- "data-display-mode": ae,
2915
- "data-position": P,
2938
+ className: Nn,
2939
+ style: nt,
2940
+ "data-display-mode": se,
2941
+ "data-position": D,
2916
2942
  "data-experience-mode": f === "EMBEDDED" ? "embedded" : "widget",
2917
2943
  children: [
2918
- ae === "hidden" && /* @__PURE__ */ n(
2919
- hr,
2944
+ se === "hidden" && /* @__PURE__ */ n(
2945
+ vr,
2920
2946
  {
2921
- position: P,
2922
- isMobile: fe,
2947
+ position: D,
2948
+ isMobile: pe,
2923
2949
  isSpeaking: _.agentState === "speaking",
2924
2950
  onExpand: () => te("expanded"),
2925
2951
  label: `Open ${pt} widget`,
2926
- avatarImageUrl: St,
2952
+ avatarImageUrl: Ct,
2927
2953
  agentName: pt
2928
2954
  }
2929
2955
  ),
2930
- ae === "minimized" && /* @__PURE__ */ n(
2931
- gr,
2956
+ se === "minimized" && /* @__PURE__ */ n(
2957
+ wr,
2932
2958
  {
2933
- position: P,
2934
- isMobile: fe,
2959
+ position: D,
2960
+ isMobile: pe,
2935
2961
  agentName: pt,
2936
- avatarImageUrl: St,
2962
+ avatarImageUrl: Ct,
2937
2963
  agentState: _.agentState,
2938
2964
  isMuted: oe.isMuted,
2939
- audioLevel: be,
2940
- onExpand: xn,
2965
+ audioLevel: we,
2966
+ onExpand: Ln,
2941
2967
  onToggleMute: oe.toggleMute,
2942
- onClose: $t
2968
+ onClose: zt
2943
2969
  }
2944
2970
  ),
2945
- ae === "expanded" && /* @__PURE__ */ n(
2946
- xr,
2971
+ se === "expanded" && /* @__PURE__ */ n(
2972
+ Sr,
2947
2973
  {
2948
- position: P,
2949
- isMobile: fe,
2974
+ position: D,
2975
+ isMobile: pe,
2950
2976
  agentName: pt,
2951
- avatarImageUrl: St,
2952
- idleLoopUrl: wn,
2953
- greeting: _n,
2954
- branding: S,
2955
- teamMembers: A,
2956
- currentTeamMemberId: ve,
2957
- isSwitchingTeamMember: Ze,
2958
- teamSwitcherOpen: se,
2977
+ avatarImageUrl: Ct,
2978
+ idleLoopUrl: xn,
2979
+ greeting: kn,
2980
+ branding: C,
2981
+ teamMembers: N,
2982
+ currentTeamMemberId: be,
2983
+ isSwitchingTeamMember: Qe,
2984
+ teamSwitcherOpen: ce,
2959
2985
  onToggleTeamSwitcher: () => Oe((y) => !y),
2960
- onSelectTeamMember: vn,
2986
+ onSelectTeamMember: wn,
2961
2987
  connectionState: _.connectionState,
2962
2988
  agentState: _.agentState,
2963
2989
  transcript: _.transcript,
2964
2990
  isMuted: oe.isMuted,
2965
- micDevices: we.mics,
2966
- isCameraEnabled: pe.isEnabled,
2967
- cameraPreviewEl: pe.previewEl,
2968
- cameraDevices: we.cameras,
2969
- activeCameraId: pe.activeDeviceId,
2970
- isScreenShareEnabled: Me.isEnabled,
2971
- screenPreviewEl: Me.previewEl,
2991
+ micDevices: _e.mics,
2992
+ isCameraEnabled: he.isEnabled,
2993
+ cameraPreviewEl: he.previewEl,
2994
+ cameraDevices: _e.cameras,
2995
+ activeCameraId: he.activeDeviceId,
2996
+ isScreenShareEnabled: De.isEnabled,
2997
+ screenPreviewEl: De.previewEl,
2972
2998
  isSpeakerMuted: He,
2973
- allowCamera: D,
2974
- allowScreenShare: q,
2999
+ allowCamera: P,
3000
+ allowScreenShare: F,
2975
3001
  allowTyping: G,
2976
- showMinimize: ie,
3002
+ showMinimize: le,
2977
3003
  chromeless: Z,
2978
- compactControls: ke,
2979
- transforming: de,
2980
- transformingLabel: ye,
3004
+ compactControls: Le,
3005
+ transforming: ue,
3006
+ transformingLabel: ve,
2981
3007
  languageMenuOpen: ft,
2982
3008
  onToggleLanguageMenu: () => wt((y) => !y),
2983
3009
  needsUserGesture: ut,
@@ -2988,16 +3014,16 @@ const Yr = /* @__PURE__ */ new Set([
2988
3014
  agentVideoEl: _.videoElement,
2989
3015
  onConnect: () => void _.connect(),
2990
3016
  onDisconnect: () => _.disconnect(),
2991
- onRetry: Cn,
2992
- onResumeAudio: Ln,
3017
+ onRetry: Sn,
3018
+ onResumeAudio: Cn,
2993
3019
  onToggleMute: oe.toggleMute,
2994
- onToggleCamera: () => void pe.toggle(),
2995
- onSwitchCameraDevice: (y) => void pe.switchDevice(y),
2996
- onToggleScreenShare: () => void Me.toggle(),
2997
- onToggleSpeaker: yn,
2998
- onSendMessage: gn,
2999
- onMinimize: kn,
3000
- onClose: $t,
3020
+ onToggleCamera: () => void he.toggle(),
3021
+ onSwitchCameraDevice: (y) => void he.switchDevice(y),
3022
+ onToggleScreenShare: () => void De.toggle(),
3023
+ onToggleSpeaker: bn,
3024
+ onSendMessage: vn,
3025
+ onMinimize: En,
3026
+ onClose: zt,
3001
3027
  onClearMicError: oe.clearError
3002
3028
  }
3003
3029
  )
@@ -3006,54 +3032,54 @@ const Yr = /* @__PURE__ */ new Set([
3006
3032
  ) : null;
3007
3033
  }
3008
3034
  );
3009
- mn.displayName = "AvatarWidgetInner";
3010
- const Gr = at(
3035
+ yn.displayName = "AvatarWidgetInner";
3036
+ const Zr = at(
3011
3037
  function(t, r) {
3012
- return /* @__PURE__ */ n(Dn, { children: /* @__PURE__ */ n(mn, { ...t, ref: r }) });
3038
+ return /* @__PURE__ */ n(Hn, { children: /* @__PURE__ */ n(yn, { ...t, ref: r }) });
3013
3039
  }
3014
3040
  );
3015
- Gr.displayName = "AvatarWidget";
3016
- const no = ({
3041
+ Zr.displayName = "AvatarWidget";
3042
+ const so = ({
3017
3043
  agentId: e,
3018
3044
  baseUrl: t,
3019
3045
  apiKey: r,
3020
3046
  mode: o,
3021
3047
  onAgentEvent: i,
3022
3048
  className: l,
3023
- style: d
3049
+ style: u
3024
3050
  }) => {
3025
- const s = E(null), u = E(null), f = E(i);
3051
+ const d = S(null), c = S(null), f = S(i);
3026
3052
  f.current = i;
3027
- const m = x((a) => {
3053
+ const h = k((a) => {
3028
3054
  var R;
3029
- const c = a.detail;
3030
- (R = f.current) == null || R.call(f, c);
3055
+ const s = a.detail;
3056
+ (R = f.current) == null || R.call(f, s);
3031
3057
  }, []);
3032
- return N(() => {
3033
- const a = s.current;
3058
+ return A(() => {
3059
+ const a = d.current;
3034
3060
  if (!a) return;
3035
- const c = document.createElement("livelayer-widget");
3036
- return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", m), a.appendChild(c), u.current = c, () => {
3037
- c.removeEventListener("agent-event", m), a.removeChild(c), u.current = null;
3061
+ const s = document.createElement("livelayer-widget");
3062
+ return s.setAttribute("agent-id", e), t && s.setAttribute("base-url", t), r && s.setAttribute("api-key", r), o && s.setAttribute("mode", o), s.addEventListener("agent-event", h), a.appendChild(s), c.current = s, () => {
3063
+ s.removeEventListener("agent-event", h), a.removeChild(s), c.current = null;
3038
3064
  };
3039
- }, [e]), N(() => {
3040
- u.current && (o ? u.current.setAttribute("mode", o) : u.current.removeAttribute("mode"));
3041
- }, [o]), /* @__PURE__ */ n("div", { ref: s, className: l, style: d });
3042
- }, ro = at(
3043
- function({ id: t, intent: r, as: o = "div", className: i, style: l, children: d }, s) {
3044
- return Tn(
3065
+ }, [e]), A(() => {
3066
+ c.current && (o ? c.current.setAttribute("mode", o) : c.current.removeAttribute("mode"));
3067
+ }, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: u });
3068
+ }, co = at(
3069
+ function({ id: t, intent: r, as: o = "div", className: i, style: l, children: u }, d) {
3070
+ return Dn(
3045
3071
  o,
3046
3072
  {
3047
- ref: s,
3073
+ ref: d,
3048
3074
  "data-ll-region": t,
3049
3075
  "data-ll-intent": r,
3050
3076
  className: i,
3051
3077
  style: l
3052
3078
  },
3053
- d
3079
+ u
3054
3080
  );
3055
3081
  }
3056
- ), oo = at(
3082
+ ), uo = at(
3057
3083
  function({ id: t, intent: r, children: o, ...i }, l) {
3058
3084
  return /* @__PURE__ */ n(
3059
3085
  "form",
@@ -3066,108 +3092,108 @@ const no = ({
3066
3092
  }
3067
3093
  );
3068
3094
  }
3069
- ), io = at(
3095
+ ), fo = at(
3070
3096
  function(t, r) {
3071
- const { name: o, label: i, labelClassName: l } = t, d = { name: o, "data-ll-field": o };
3072
- let s;
3097
+ const { name: o, label: i, labelClassName: l } = t, u = { name: o, "data-ll-field": o };
3098
+ let d;
3073
3099
  if ("as" in t && t.as === "textarea") {
3074
- const { name: u, label: f, labelClassName: m, as: a, ...c } = t;
3075
- s = /* @__PURE__ */ n(
3100
+ const { name: c, label: f, labelClassName: h, as: a, ...s } = t;
3101
+ d = /* @__PURE__ */ n(
3076
3102
  "textarea",
3077
3103
  {
3078
3104
  ref: r,
3079
- ...d,
3080
- ...c
3105
+ ...u,
3106
+ ...s
3081
3107
  }
3082
3108
  );
3083
3109
  } else if ("as" in t && t.as === "select") {
3084
- const { name: u, label: f, labelClassName: m, as: a, children: c, ...R } = t;
3085
- s = /* @__PURE__ */ n(
3110
+ const { name: c, label: f, labelClassName: h, as: a, children: s, ...R } = t;
3111
+ d = /* @__PURE__ */ n(
3086
3112
  "select",
3087
3113
  {
3088
3114
  ref: r,
3089
- ...d,
3115
+ ...u,
3090
3116
  ...R,
3091
- children: c
3117
+ children: s
3092
3118
  }
3093
3119
  );
3094
3120
  } else {
3095
- const { name: u, label: f, labelClassName: m, as: a, ...c } = t;
3096
- s = /* @__PURE__ */ n(
3121
+ const { name: c, label: f, labelClassName: h, as: a, ...s } = t;
3122
+ d = /* @__PURE__ */ n(
3097
3123
  "input",
3098
3124
  {
3099
3125
  ref: r,
3100
- ...d,
3101
- ...c
3126
+ ...u,
3127
+ ...s
3102
3128
  }
3103
3129
  );
3104
3130
  }
3105
- return i === void 0 ? s : /* @__PURE__ */ g("label", { className: l, children: [
3131
+ return i === void 0 ? d : /* @__PURE__ */ g("label", { className: l, children: [
3106
3132
  i,
3107
- s
3133
+ d
3108
3134
  ] });
3109
3135
  }
3110
3136
  );
3111
- let an = 1;
3112
- function lo({
3137
+ let cn = 1;
3138
+ function po({
3113
3139
  onMount: e,
3114
3140
  defaultOpen: t = !1,
3115
3141
  storageKey: r = "ll-debug-open"
3116
3142
  }) {
3117
- const [o, i] = L(t), [l, d] = L([]), [s, u] = L(""), [f, m] = L(!1), a = E(/* @__PURE__ */ new Set()), c = E([]), R = E(f);
3118
- R.current = f, N(() => {
3143
+ const [o, i] = L(t), [l, u] = L([]), [d, c] = L(""), [f, h] = L(!1), a = S(/* @__PURE__ */ new Set()), s = S([]), R = S(f);
3144
+ R.current = f, A(() => {
3119
3145
  try {
3120
3146
  const v = localStorage.getItem(r);
3121
3147
  v === "1" && i(!0), v === "0" && i(!1);
3122
3148
  } catch {
3123
3149
  }
3124
- }, [r]), N(() => {
3150
+ }, [r]), A(() => {
3125
3151
  try {
3126
3152
  localStorage.setItem(r, o ? "1" : "0");
3127
3153
  } catch {
3128
3154
  }
3129
- }, [o, r]), N(() => {
3155
+ }, [o, r]), A(() => {
3130
3156
  const v = (b) => {
3131
- (b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), i((A) => !A));
3157
+ (b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), i((N) => !N));
3132
3158
  };
3133
3159
  return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
3134
- }, []), N(() => {
3160
+ }, []), A(() => {
3135
3161
  const v = setInterval(() => {
3136
- if (c.current.length === 0 || R.current) return;
3137
- const b = c.current.splice(0, c.current.length);
3138
- d(
3139
- (A) => [...b.reverse(), ...A].slice(0, 200)
3162
+ if (s.current.length === 0 || R.current) return;
3163
+ const b = s.current.splice(0, s.current.length);
3164
+ u(
3165
+ (N) => [...b.reverse(), ...N].slice(0, 200)
3140
3166
  );
3141
3167
  }, 100);
3142
3168
  return () => clearInterval(v);
3143
3169
  }, []);
3144
- const P = E(!1);
3145
- if (N(() => {
3146
- !e || P.current || (P.current = !0, e((v) => {
3147
- c.current.push({
3148
- id: an++,
3170
+ const D = S(!1);
3171
+ if (A(() => {
3172
+ !e || D.current || (D.current = !0, e((v) => {
3173
+ s.current.push({
3174
+ id: cn++,
3149
3175
  ts: Date.now(),
3150
3176
  kind: "event",
3151
3177
  type: v.eventName,
3152
3178
  data: v.data
3153
3179
  });
3154
3180
  }));
3155
- }, [e]), N(() => {
3156
- const v = console.warn, b = console.log, A = (I, $) => function(...w) {
3181
+ }, [e]), A(() => {
3182
+ const v = console.warn, b = console.log, N = (T, $) => function(...w) {
3157
3183
  try {
3158
- const T = typeof w[0] == "string" ? w[0] : "";
3159
- T.startsWith("[LiveLayer]") && c.current.push({
3160
- id: an++,
3184
+ const I = typeof w[0] == "string" ? w[0] : "";
3185
+ I.startsWith("[LiveLayer]") && s.current.push({
3186
+ id: cn++,
3161
3187
  ts: Date.now(),
3162
- kind: I,
3163
- type: T.slice(0, 120),
3164
- data: { args: w.slice(1).map((B) => Kr(B)) }
3188
+ kind: T,
3189
+ type: I.slice(0, 120),
3190
+ data: { args: w.slice(1).map((B) => to(B)) }
3165
3191
  });
3166
3192
  } catch {
3167
3193
  }
3168
3194
  return $.apply(this, w);
3169
3195
  };
3170
- return console.warn = A("warn", v), console.log = A("log", b), () => {
3196
+ return console.warn = N("warn", v), console.log = N("log", b), () => {
3171
3197
  console.warn = v, console.log = b;
3172
3198
  };
3173
3199
  }, []), !o)
@@ -3197,9 +3223,9 @@ function lo({
3197
3223
  children: "🛰 LL debug"
3198
3224
  }
3199
3225
  );
3200
- const C = l.filter((v) => {
3201
- if (!s) return !0;
3202
- const b = s.toLowerCase();
3226
+ const E = l.filter((v) => {
3227
+ if (!d) return !0;
3228
+ const b = d.toLowerCase();
3203
3229
  return v.type.toLowerCase().includes(b) || JSON.stringify(v.data || {}).toLowerCase().includes(b);
3204
3230
  });
3205
3231
  return /* @__PURE__ */ g(
@@ -3247,7 +3273,7 @@ function lo({
3247
3273
  "button",
3248
3274
  {
3249
3275
  type: "button",
3250
- onClick: () => m((v) => !v),
3276
+ onClick: () => h((v) => !v),
3251
3277
  style: Nt(f ? "#f59e0b" : "transparent"),
3252
3278
  title: "Pause / resume capture",
3253
3279
  children: f ? "▶ resume" : "⏸ pause"
@@ -3258,7 +3284,7 @@ function lo({
3258
3284
  {
3259
3285
  type: "button",
3260
3286
  onClick: () => {
3261
- d([]), c.current = [];
3287
+ u([]), s.current = [];
3262
3288
  },
3263
3289
  style: Nt("transparent"),
3264
3290
  title: "Clear buffer",
@@ -3283,8 +3309,8 @@ function lo({
3283
3309
  "input",
3284
3310
  {
3285
3311
  type: "text",
3286
- value: s,
3287
- onChange: (v) => u(v.target.value),
3312
+ value: d,
3313
+ onChange: (v) => c(v.target.value),
3288
3314
  placeholder: "filter by type or data…",
3289
3315
  style: {
3290
3316
  margin: 8,
@@ -3306,7 +3332,7 @@ function lo({
3306
3332
  overflowY: "auto",
3307
3333
  padding: "0 8px 8px"
3308
3334
  },
3309
- children: C.length === 0 ? /* @__PURE__ */ g(
3335
+ children: E.length === 0 ? /* @__PURE__ */ g(
3310
3336
  "div",
3311
3337
  {
3312
3338
  style: {
@@ -3336,13 +3362,13 @@ function lo({
3336
3362
  )
3337
3363
  ]
3338
3364
  }
3339
- ) : C.map((v) => /* @__PURE__ */ n(
3340
- Jr,
3365
+ ) : E.map((v) => /* @__PURE__ */ n(
3366
+ eo,
3341
3367
  {
3342
3368
  entry: v,
3343
3369
  expanded: a.current.has(v.id),
3344
3370
  onToggle: () => {
3345
- a.current.has(v.id) ? a.current.delete(v.id) : a.current.add(v.id), d((b) => [...b]);
3371
+ a.current.has(v.id) ? a.current.delete(v.id) : a.current.add(v.id), u((b) => [...b]);
3346
3372
  }
3347
3373
  },
3348
3374
  v.id
@@ -3353,7 +3379,7 @@ function lo({
3353
3379
  }
3354
3380
  );
3355
3381
  }
3356
- function Jr({
3382
+ function eo({
3357
3383
  entry: e,
3358
3384
  expanded: t,
3359
3385
  onToggle: r
@@ -3434,24 +3460,24 @@ function Nt(e) {
3434
3460
  cursor: "pointer"
3435
3461
  };
3436
3462
  }
3437
- function Kr(e) {
3463
+ function to(e) {
3438
3464
  try {
3439
3465
  return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
3440
3466
  } catch {
3441
3467
  return String(e);
3442
3468
  }
3443
3469
  }
3444
- function ao() {
3445
- const [e, t] = L([]), r = x((i) => {
3470
+ function ho() {
3471
+ const [e, t] = L([]), r = k((i) => {
3446
3472
  t((l) => {
3447
- const d = l.findIndex((s) => s.id === i.id);
3448
- if (d >= 0) {
3449
- const s = l.slice();
3450
- return s[d] = i, s;
3473
+ const u = l.findIndex((d) => d.id === i.id);
3474
+ if (u >= 0) {
3475
+ const d = l.slice();
3476
+ return d[u] = i, d;
3451
3477
  }
3452
3478
  return [...l, i];
3453
3479
  });
3454
- }, []), o = x(() => t([]), []);
3480
+ }, []), o = k(() => t([]), []);
3455
3481
  return {
3456
3482
  entries: e,
3457
3483
  pushSegment: r,
@@ -3460,33 +3486,33 @@ function ao() {
3460
3486
  };
3461
3487
  }
3462
3488
  export {
3463
- Gr as AvatarWidget,
3464
- Dn as ErrorBoundary,
3465
- lo as LiveLayerDebugPanel,
3466
- io as LiveLayerField,
3467
- oo as LiveLayerForm,
3468
- ro as LiveLayerRegion,
3469
- no as LiveLayerWidget,
3470
- Mr as clearPageContextCache,
3471
- Hr as clearRoutesCache,
3472
- Ir as extractPageContext,
3473
- zr as extractRoutes,
3474
- on as getCachedPageContext,
3475
- Et as getCachedRoutes,
3476
- or as matchesPattern,
3477
- Dr as normalizeRouteInput,
3478
- ir as shouldRenderAtPath,
3479
- Fn as useAgentInfo,
3480
- zn as useAudioLevel,
3481
- Wn as useCameraState,
3482
- Vn as useDisplayMode,
3483
- Jn as useDisplayModePersistence,
3484
- Xn as useIsMobile,
3485
- $n as useLiveKitSession,
3486
- qn as useMediaDevices,
3487
- On as useMicrophoneState,
3488
- Zn as usePathname,
3489
- lr as useRouteMatch,
3490
- Bn as useScreenShareState,
3491
- ao as useTranscript
3489
+ Zr as AvatarWidget,
3490
+ Hn as ErrorBoundary,
3491
+ po as LiveLayerDebugPanel,
3492
+ fo as LiveLayerField,
3493
+ uo as LiveLayerForm,
3494
+ co as LiveLayerRegion,
3495
+ so as LiveLayerWidget,
3496
+ Or as clearPageContextCache,
3497
+ Ur as clearRoutesCache,
3498
+ zr as extractPageContext,
3499
+ qr as extractRoutes,
3500
+ an as getCachedPageContext,
3501
+ St as getCachedRoutes,
3502
+ sr as matchesPattern,
3503
+ Wr as normalizeRouteInput,
3504
+ cr as shouldRenderAtPath,
3505
+ Yn as useAgentInfo,
3506
+ Bn as useAudioLevel,
3507
+ Un as useCameraState,
3508
+ Kn as useDisplayMode,
3509
+ Zn as useDisplayModePersistence,
3510
+ tr as useIsMobile,
3511
+ Wn as useLiveKitSession,
3512
+ Vn as useMediaDevices,
3513
+ qn as useMicrophoneState,
3514
+ rr as usePathname,
3515
+ dr as useRouteMatch,
3516
+ jn as useScreenShareState,
3517
+ ho as useTranscript
3492
3518
  };