@livelayer/react 0.9.5 → 0.9.6

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