@livelayer/react 0.10.0 → 0.10.2

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