@livelayer/react 0.5.2 → 0.5.3

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