@livelayer/react 0.13.0 → 0.14.1

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