@livelayer/react 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { jsxs as w, jsx as e, Fragment as Qe } from "react/jsx-runtime";
3
- import { Component as Ze, useState as x, useRef as S, useEffect as L, useCallback as f, useMemo as Se } from "react";
4
- import { LiveKitSession as et } from "@livelayer/sdk";
5
- import { createLocalAudioTrack as tt, Track as Oe, createLocalVideoTrack as nt } from "livekit-client";
6
- class rt extends Ze {
2
+ import { jsxs as _, jsx as e, Fragment as Ze } from "react/jsx-runtime";
3
+ import { Component as et, useState as k, useRef as M, useEffect as S, useCallback as g, useMemo as Se } from "react";
4
+ import { LiveKitSession as tt } from "@livelayer/sdk";
5
+ import { createLocalAudioTrack as nt, Track as We, createLocalVideoTrack as rt } from "livekit-client";
6
+ class it extends et {
7
7
  constructor() {
8
8
  super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
9
9
  this.setState({ hasError: !1, error: null });
@@ -13,12 +13,12 @@ class rt extends Ze {
13
13
  return { hasError: !0, error: n };
14
14
  }
15
15
  componentDidCatch(n, i) {
16
- var o, r;
17
- (r = (o = this.props).onError) == null || r.call(o, n, i);
16
+ var l, r;
17
+ (r = (l = this.props).onError) == null || r.call(l, n, i);
18
18
  }
19
19
  render() {
20
20
  var n;
21
- return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ w("div", { className: "ll-error-boundary", role: "alert", children: [
21
+ return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ _("div", { className: "ll-error-boundary", role: "alert", children: [
22
22
  /* @__PURE__ */ e("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
23
23
  /* @__PURE__ */ e("p", { className: "ll-error-boundary__message", children: ((n = this.state.error) == null ? void 0 : n.message) || "Something went wrong." }),
24
24
  /* @__PURE__ */ e(
@@ -33,26 +33,26 @@ class rt extends Ze {
33
33
  ] }) : this.props.children;
34
34
  }
35
35
  }
36
- function it(t) {
37
- const [n, i] = x("idle"), [o, r] = x("idle"), [a, c] = x([]), [m, d] = x(null), [g, u] = x(null), [s, l] = x(null), [b, _] = x(!1), [N, D] = x(null), E = S(null), R = S(t.onDataMessage);
38
- R.current = t.onDataMessage, L(() => {
39
- const k = {
36
+ function lt(t) {
37
+ const [n, i] = k("idle"), [l, r] = k("idle"), [s, c] = k([]), [m, d] = k(null), [f, p] = k(null), [o, a] = k(null), [C, b] = k(!1), [N, D] = k(null), E = M(null), R = M(t.onDataMessage);
38
+ R.current = t.onDataMessage, S(() => {
39
+ const w = {
40
40
  onConnectionStateChange: (y) => {
41
41
  i(y), y === "connected" && D(null);
42
42
  },
43
43
  onAgentStateChange: r,
44
44
  onTranscript: (y) => c([...y]),
45
45
  onAgentConfig: d,
46
- onAudioTrack: (y) => l(y),
47
- onVideoTrack: (y) => u(y),
48
- onVideoTrackRemoved: () => u(null),
46
+ onAudioTrack: (y) => a(y),
47
+ onVideoTrack: (y) => p(y),
48
+ onVideoTrackRemoved: () => p(null),
49
49
  onError: (y) => D(y),
50
50
  onDataMessage: (y) => {
51
51
  var A;
52
52
  (A = R.current) == null || A.call(R, y);
53
53
  },
54
- onResumabilityChange: _
55
- }, C = new et(
54
+ onResumabilityChange: b
55
+ }, x = new tt(
56
56
  {
57
57
  agentId: t.agentId,
58
58
  baseUrl: t.baseUrl,
@@ -60,11 +60,11 @@ function it(t) {
60
60
  sessionEndpoint: t.sessionEndpoint,
61
61
  sessionBody: t.sessionBody
62
62
  },
63
- k
63
+ w
64
64
  );
65
- return E.current = C, i("idle"), r("idle"), c([]), d(null), u(null), l(null), _(!1), D(null), () => {
65
+ return E.current = x, i("idle"), r("idle"), c([]), d(null), p(null), a(null), b(!1), D(null), () => {
66
66
  var y;
67
- (y = C.destroy) == null || y.call(C), E.current = null;
67
+ (y = x.destroy) == null || y.call(x), E.current = null;
68
68
  };
69
69
  }, [
70
70
  t.agentId,
@@ -73,29 +73,29 @@ function it(t) {
73
73
  t.sessionEndpoint,
74
74
  JSON.stringify(t.sessionBody ?? {})
75
75
  ]);
76
- const T = f(async () => {
77
- const k = E.current;
78
- if (k)
76
+ const T = g(async () => {
77
+ const w = E.current;
78
+ if (w)
79
79
  try {
80
- await k.connect();
81
- } catch (C) {
82
- throw D(C instanceof Error ? C.message : String(C)), C;
80
+ await w.connect();
81
+ } catch (x) {
82
+ throw D(x instanceof Error ? x.message : String(x)), x;
83
83
  }
84
- }, []), z = f(() => {
85
- const k = E.current;
86
- k && k.disconnect();
87
- }, []), I = f(() => {
88
- var k;
89
- return ((k = E.current) == null ? void 0 : k.getRoom()) ?? null;
84
+ }, []), z = g(() => {
85
+ const w = E.current;
86
+ w && w.disconnect();
87
+ }, []), I = g(() => {
88
+ var w;
89
+ return ((w = E.current) == null ? void 0 : w.getRoom()) ?? null;
90
90
  }, []);
91
91
  return {
92
92
  connectionState: n,
93
- agentState: o,
94
- transcript: a,
93
+ agentState: l,
94
+ transcript: s,
95
95
  agentConfig: m,
96
- videoElement: g,
97
- audioElement: s,
98
- canResume: b,
96
+ videoElement: f,
97
+ audioElement: o,
98
+ canResume: C,
99
99
  error: N,
100
100
  connect: T,
101
101
  disconnect: z,
@@ -104,33 +104,33 @@ function it(t) {
104
104
  };
105
105
  }
106
106
  function ot() {
107
- const t = S(null), n = S(null), i = S(null), o = S(null), r = S(/* @__PURE__ */ new Set()), a = S(null), c = f(() => {
108
- const s = n.current;
109
- if (!s) {
110
- o.current = null;
107
+ const t = M(null), n = M(null), i = M(null), l = M(null), r = M(/* @__PURE__ */ new Set()), s = M(null), c = g(() => {
108
+ const o = n.current;
109
+ if (!o) {
110
+ l.current = null;
111
111
  return;
112
112
  }
113
- (!a.current || a.current.length !== s.frequencyBinCount) && (a.current = new Uint8Array(
114
- new ArrayBuffer(s.frequencyBinCount)
113
+ (!s.current || s.current.length !== o.frequencyBinCount) && (s.current = new Uint8Array(
114
+ new ArrayBuffer(o.frequencyBinCount)
115
115
  ));
116
- const l = a.current;
117
- s.getByteFrequencyData(l);
118
- let b = 0;
119
- for (let N = 0; N < l.length; N++) b += l[N];
120
- const _ = b / l.length / 255;
116
+ const a = s.current;
117
+ o.getByteFrequencyData(a);
118
+ let C = 0;
119
+ for (let N = 0; N < a.length; N++) C += a[N];
120
+ const b = C / a.length / 255;
121
121
  for (const N of r.current)
122
122
  try {
123
- N(_);
123
+ N(b);
124
124
  } catch (D) {
125
125
  console.error("[useAudioLevel] subscriber threw:", D);
126
126
  }
127
- o.current = requestAnimationFrame(c);
128
- }, []), m = f(() => {
127
+ l.current = requestAnimationFrame(c);
128
+ }, []), m = g(() => {
129
129
  if (t.current || typeof window > "u" || typeof AudioContext > "u") return;
130
- const s = new AudioContext(), l = s.createAnalyser();
131
- l.fftSize = 64, l.connect(s.destination), t.current = s, n.current = l;
132
- }, []), d = f(
133
- (s) => {
130
+ const o = new AudioContext(), a = o.createAnalyser();
131
+ a.fftSize = 64, a.connect(o.destination), t.current = o, n.current = a;
132
+ }, []), d = g(
133
+ (o) => {
134
134
  if (m(), !(!t.current || !n.current)) {
135
135
  if (i.current) {
136
136
  try {
@@ -140,29 +140,29 @@ function ot() {
140
140
  i.current = null;
141
141
  }
142
142
  try {
143
- const l = t.current.createMediaElementSource(s);
144
- l.connect(n.current), i.current = l;
145
- } catch (l) {
146
- console.warn("[useAudioLevel] createMediaElementSource failed:", l);
143
+ const a = t.current.createMediaElementSource(o);
144
+ a.connect(n.current), i.current = a;
145
+ } catch (a) {
146
+ console.warn("[useAudioLevel] createMediaElementSource failed:", a);
147
147
  return;
148
148
  }
149
- o.current === null && (o.current = requestAnimationFrame(c));
149
+ l.current === null && (l.current = requestAnimationFrame(c));
150
150
  }
151
151
  },
152
152
  [m, c]
153
- ), g = f(() => {
154
- if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), i.current) {
153
+ ), f = g(() => {
154
+ if (l.current !== null && (cancelAnimationFrame(l.current), l.current = null), i.current) {
155
155
  try {
156
156
  i.current.disconnect();
157
157
  } catch {
158
158
  }
159
159
  i.current = null;
160
160
  }
161
- }, []), u = f((s) => (r.current.add(s), () => {
162
- r.current.delete(s);
161
+ }, []), p = g((o) => (r.current.add(o), () => {
162
+ r.current.delete(o);
163
163
  }), []);
164
- return L(() => () => {
165
- if (g(), n.current) {
164
+ return S(() => () => {
165
+ if (f(), n.current) {
166
166
  try {
167
167
  n.current.disconnect();
168
168
  } catch {
@@ -176,60 +176,60 @@ function ot() {
176
176
  }
177
177
  t.current = null;
178
178
  }
179
- r.current.clear(), a.current = null;
180
- }, [g]), { attach: d, detach: g, subscribe: u };
179
+ r.current.clear(), s.current = null;
180
+ }, [f]), { attach: d, detach: f, subscribe: p };
181
181
  }
182
- function lt() {
183
- const [t, n] = x(!1), [i, o] = x(null), r = S(null), a = S(null), c = f(async (u) => {
184
- if (r.current && a.current) {
182
+ function at() {
183
+ const [t, n] = k(!1), [i, l] = k(null), r = M(null), s = M(null), c = g(async (p) => {
184
+ if (r.current && s.current) {
185
185
  try {
186
- await a.current.localParticipant.unpublishTrack(r.current);
186
+ await s.current.localParticipant.unpublishTrack(r.current);
187
187
  } catch {
188
188
  }
189
189
  r.current.stop(), r.current = null;
190
190
  }
191
- a.current = u, o(null);
191
+ s.current = p, l(null);
192
192
  try {
193
- const s = await tt({
193
+ const o = await nt({
194
194
  echoCancellation: !0,
195
195
  noiseSuppression: !0
196
196
  });
197
- await u.localParticipant.publishTrack(s), r.current = s, n(s.isMuted);
198
- } catch (s) {
199
- const l = s instanceof Error && s.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
- throw o(l), s;
197
+ await p.localParticipant.publishTrack(o), r.current = o, n(o.isMuted);
198
+ } catch (o) {
199
+ const a = o instanceof Error && o.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
+ throw l(a), o;
201
201
  }
202
- }, []), m = f(() => {
203
- const u = r.current;
204
- u && (u.isMuted ? (u.unmute(), n(!1)) : (u.mute(), n(!0)));
205
- }, []), d = f(() => {
206
- const u = r.current, s = a.current;
207
- if (u && s) {
202
+ }, []), m = g(() => {
203
+ const p = r.current;
204
+ p && (p.isMuted ? (p.unmute(), n(!1)) : (p.mute(), n(!0)));
205
+ }, []), d = g(() => {
206
+ const p = r.current, o = s.current;
207
+ if (p && o) {
208
208
  try {
209
- s.localParticipant.unpublishTrack(u);
209
+ o.localParticipant.unpublishTrack(p);
210
210
  } catch {
211
211
  }
212
- u.stop();
212
+ p.stop();
213
213
  }
214
- r.current = null, a.current = null, n(!1);
215
- }, []), g = f(() => o(null), []);
214
+ r.current = null, s.current = null, n(!1);
215
+ }, []), f = g(() => l(null), []);
216
216
  return {
217
217
  isMuted: t,
218
218
  micError: i,
219
219
  toggleMute: m,
220
220
  setupMic: c,
221
221
  teardownMic: d,
222
- clearError: g
222
+ clearError: f
223
223
  };
224
224
  }
225
- const at = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
- function st() {
227
- const [t, n] = x(!1), [i, o] = x(null), [r, a] = x(null), [c, m] = x(""), d = S(null), g = S(null), u = f((E) => {
225
+ const st = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
+ function ct() {
227
+ const [t, n] = k(!1), [i, l] = k(null), [r, s] = k(null), [c, m] = k(""), d = M(null), f = M(null), p = g((E) => {
228
228
  d.current = E;
229
- }, []), s = f(() => {
230
- const E = d.current, R = g.current;
229
+ }, []), o = g(() => {
230
+ const E = d.current, R = f.current;
231
231
  if (R && E) {
232
- const T = E.localParticipant.getTrackPublication(Oe.Source.Camera);
232
+ const T = E.localParticipant.getTrackPublication(We.Source.Camera);
233
233
  if (T != null && T.track) {
234
234
  try {
235
235
  E.localParticipant.unpublishTrack(T.track);
@@ -239,18 +239,18 @@ function st() {
239
239
  } else
240
240
  R.stop();
241
241
  }
242
- g.current = null, a(null), n(!1);
243
- }, []), l = f(async (E) => {
242
+ f.current = null, s(null), n(!1);
243
+ }, []), a = g(async (E) => {
244
244
  const R = d.current;
245
245
  if (R) {
246
- o(null);
246
+ l(null);
247
247
  try {
248
- const T = { ...at };
248
+ const T = { ...st };
249
249
  E && (T.deviceId = E);
250
- const z = await nt(T);
251
- await R.localParticipant.publishTrack(z), g.current = z;
250
+ const z = await rt(T);
251
+ await R.localParticipant.publishTrack(z), f.current = z;
252
252
  const I = z.attach();
253
- a(I), n(!0), E && m(E);
253
+ s(I), n(!0), E && m(E);
254
254
  try {
255
255
  R.localParticipant.publishData(
256
256
  new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
@@ -260,55 +260,55 @@ function st() {
260
260
  }
261
261
  } catch (T) {
262
262
  const z = T instanceof Error && T.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
- o(z);
263
+ l(z);
264
264
  }
265
265
  }
266
- }, []), b = f(async () => {
267
- t ? s() : await l(c || void 0);
268
- }, [t, c, s, l]), _ = f(async (E) => {
269
- s(), await l(E);
270
- }, [s, l]), N = f(() => {
271
- s(), d.current = null, o(null), m("");
272
- }, [s]), D = f(() => o(null), []);
273
- return L(() => () => {
274
- g.current && g.current.stop();
266
+ }, []), C = g(async () => {
267
+ t ? o() : await a(c || void 0);
268
+ }, [t, c, o, a]), b = g(async (E) => {
269
+ o(), await a(E);
270
+ }, [o, a]), N = g(() => {
271
+ o(), d.current = null, l(null), m("");
272
+ }, [o]), D = g(() => l(null), []);
273
+ return S(() => () => {
274
+ f.current && f.current.stop();
275
275
  }, []), {
276
276
  isEnabled: t,
277
277
  error: i,
278
278
  previewEl: r,
279
279
  activeDeviceId: c,
280
- toggle: b,
281
- switchDevice: _,
282
- attachRoom: u,
280
+ toggle: C,
281
+ switchDevice: b,
282
+ attachRoom: p,
283
283
  teardown: N,
284
284
  clearError: D
285
285
  };
286
286
  }
287
- function ct() {
288
- const [t, n] = x(!1), [i, o] = x(null), [r, a] = x(null), c = S(null), m = f((l) => {
289
- c.current = l;
290
- }, []), d = f(() => a(null), []), g = f(async () => {
291
- const l = c.current;
292
- if (l) {
287
+ function dt() {
288
+ const [t, n] = k(!1), [i, l] = k(null), [r, s] = k(null), c = M(null), m = g((a) => {
289
+ c.current = a;
290
+ }, []), d = g(() => s(null), []), f = g(async () => {
291
+ const a = c.current;
292
+ if (a) {
293
293
  if (t) {
294
294
  try {
295
- await l.localParticipant.setScreenShareEnabled(!1);
295
+ await a.localParticipant.setScreenShareEnabled(!1);
296
296
  } catch {
297
297
  }
298
298
  d(), n(!1);
299
299
  return;
300
300
  }
301
- o(null);
301
+ l(null);
302
302
  try {
303
- await l.localParticipant.setScreenShareEnabled(!0);
304
- let b = 0;
305
- const _ = () => {
306
- const N = l.localParticipant.getTrackPublication(Oe.Source.ScreenShare);
303
+ await a.localParticipant.setScreenShareEnabled(!0);
304
+ let C = 0;
305
+ const b = () => {
306
+ const N = a.localParticipant.getTrackPublication(We.Source.ScreenShare);
307
307
  if (N != null && N.track) {
308
308
  const D = N.track.attach();
309
- a(D), n(!0);
309
+ s(D), n(!0);
310
310
  try {
311
- l.localParticipant.publishData(
311
+ a.localParticipant.publishData(
312
312
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
313
313
  { reliable: !0 }
314
314
  );
@@ -316,67 +316,64 @@ function ct() {
316
316
  }
317
317
  return;
318
318
  }
319
- b++ < 10 ? setTimeout(_, 100) : n(!0);
319
+ C++ < 10 ? setTimeout(b, 100) : n(!0);
320
320
  };
321
- _();
322
- } catch (b) {
323
- const _ = b instanceof Error ? b.name : "";
324
- _ !== "NotAllowedError" && _ !== "AbortError" && o("Screen share unavailable. Try again."), n(!1);
321
+ b();
322
+ } catch (C) {
323
+ const b = C instanceof Error ? C.name : "";
324
+ b !== "NotAllowedError" && b !== "AbortError" && l("Screen share unavailable. Try again."), n(!1);
325
325
  }
326
326
  }
327
- }, [t, d]), u = f(() => {
328
- const l = c.current;
329
- if (l && t)
327
+ }, [t, d]), p = g(() => {
328
+ const a = c.current;
329
+ if (a && t)
330
330
  try {
331
- l.localParticipant.setScreenShareEnabled(!1);
331
+ a.localParticipant.setScreenShareEnabled(!1);
332
332
  } catch {
333
333
  }
334
- d(), n(!1), o(null), c.current = null;
335
- }, [t, d]), s = f(() => o(null), []);
336
- return { isEnabled: t, error: i, previewEl: r, toggle: g, attachRoom: m, teardown: u, clearError: s };
334
+ d(), n(!1), l(null), c.current = null;
335
+ }, [t, d]), o = g(() => l(null), []);
336
+ return { isEnabled: t, error: i, previewEl: r, toggle: f, attachRoom: m, teardown: p, clearError: o };
337
337
  }
338
- function dt() {
339
- const [t, n] = x([]), [i, o] = x([]), r = f(async () => {
338
+ function ut() {
339
+ const [t, n] = k([]), [i, l] = k([]), r = g(async () => {
340
340
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
341
341
  try {
342
- const a = await navigator.mediaDevices.enumerateDevices();
343
- n(a.filter((c) => c.kind === "audioinput")), o(a.filter((c) => c.kind === "videoinput"));
342
+ const s = await navigator.mediaDevices.enumerateDevices();
343
+ n(s.filter((c) => c.kind === "audioinput")), l(s.filter((c) => c.kind === "videoinput"));
344
344
  } catch {
345
345
  }
346
346
  }, []);
347
- return L(() => {
347
+ return S(() => {
348
348
  if (r(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
- const a = () => void r();
350
- return navigator.mediaDevices.addEventListener("devicechange", a), () => navigator.mediaDevices.removeEventListener("devicechange", a);
349
+ const s = () => void r();
350
+ return navigator.mediaDevices.addEventListener("devicechange", s), () => navigator.mediaDevices.removeEventListener("devicechange", s);
351
351
  }, [r]), { mics: t, cameras: i, refresh: r };
352
352
  }
353
- function ut(t, n, i = !1) {
354
- const [o, r] = x(null), [a, c] = x(null), [m, d] = x(!i && !!t), g = S("");
355
- return L(() => {
353
+ function ht(t, n, i = !1) {
354
+ const [l, r] = k(null), [s, c] = k(null), [m, d] = k(!i && !!t);
355
+ return S(() => {
356
356
  if (i || !t) {
357
357
  d(!1);
358
358
  return;
359
359
  }
360
- const u = `${n || ""}::${t}`;
361
- if (g.current === u) return;
362
- g.current = u;
363
- const s = new AbortController(), l = n || "https://app.livelayer.studio";
364
- return d(!0), c(null), fetch(`${l}/api/widget/agent/${encodeURIComponent(t)}`, {
365
- signal: s.signal
366
- }).then(async (b) => {
367
- if (!b.ok) {
368
- const _ = await b.json().catch(() => ({}));
369
- throw new Error(_.error || `HTTP ${b.status}`);
360
+ const f = new AbortController(), p = n || "https://app.livelayer.studio";
361
+ return d(!0), c(null), fetch(`${p}/api/widget/agent/${encodeURIComponent(t)}`, {
362
+ signal: f.signal
363
+ }).then(async (o) => {
364
+ if (!o.ok) {
365
+ const a = await o.json().catch(() => ({}));
366
+ throw new Error(a.error || `HTTP ${o.status}`);
370
367
  }
371
- return b.json();
372
- }).then((b) => {
373
- r(b), d(!1);
374
- }).catch((b) => {
375
- s.signal.aborted || (c(b instanceof Error ? b.message : "Agent lookup failed"), d(!1));
376
- }), () => s.abort();
377
- }, [t, n, i]), { info: o, error: a, loading: m };
368
+ return o.json();
369
+ }).then((o) => {
370
+ f.signal.aborted || (r(o), d(!1));
371
+ }).catch((o) => {
372
+ f.signal.aborted || (c(o instanceof Error ? o.message : "Agent lookup failed"), d(!1));
373
+ }), () => f.abort();
374
+ }, [t, n, i]), { info: l, error: s, loading: m };
378
375
  }
379
- function ht(t) {
376
+ function pt(t) {
380
377
  if (typeof window > "u") return null;
381
378
  try {
382
379
  return window.localStorage.getItem(t);
@@ -384,67 +381,67 @@ function ht(t) {
384
381
  return null;
385
382
  }
386
383
  }
387
- function pt(t, n) {
384
+ function mt(t, n) {
388
385
  if (!(typeof window > "u"))
389
386
  try {
390
387
  window.localStorage.setItem(t, n);
391
388
  } catch {
392
389
  }
393
390
  }
394
- function mt({
391
+ function ft({
395
392
  value: t,
396
393
  defaultValue: n = "expanded",
397
394
  onChange: i
398
395
  } = {}) {
399
- const o = t !== void 0, [r, a] = x(n), c = o ? t : r, m = f(
396
+ const l = t !== void 0, [r, s] = k(n), c = l ? t : r, m = g(
400
397
  (d) => {
401
- d !== c && (o || a(d), i == null || i(d));
398
+ d !== c && (l || s(d), i == null || i(d));
402
399
  },
403
- [c, o, i]
400
+ [c, l, i]
404
401
  );
405
402
  return [c, m];
406
403
  }
407
- const ft = ["hidden", "minimized", "expanded"];
408
- function gt(t) {
409
- return t && ft.includes(t) ? t : null;
404
+ const gt = ["hidden", "minimized", "expanded"];
405
+ function vt(t) {
406
+ return t && gt.includes(t) ? t : null;
410
407
  }
411
- function vt({
408
+ function yt({
412
409
  value: t,
413
410
  defaultValue: n = "expanded",
414
411
  onChange: i,
415
- persistKey: o = "ll-widget",
412
+ persistKey: l = "ll-widget",
416
413
  disablePersistence: r = !1
417
414
  } = {}) {
418
- const a = `${o}:display-mode`, c = S(!1), [m, d] = mt({
415
+ const s = `${l}:display-mode`, c = M(!1), [m, d] = ft({
419
416
  value: t,
420
417
  defaultValue: n,
421
- onChange: (g) => {
422
- t === void 0 && !r && pt(a, g), i == null || i(g);
418
+ onChange: (f) => {
419
+ t === void 0 && !r && mt(s, f), i == null || i(f);
423
420
  }
424
421
  });
425
- return L(() => {
422
+ return S(() => {
426
423
  if (c.current || (c.current = !0, r || t !== void 0)) return;
427
- const g = gt(ht(a));
428
- g && g !== m && d(g);
424
+ const f = vt(pt(s));
425
+ f && f !== m && d(f);
429
426
  }, []), [m, d];
430
427
  }
431
- const yt = 640;
432
- function _t(t = yt) {
433
- const [n, i] = x(!1);
434
- return L(() => {
428
+ const _t = 640;
429
+ function bt(t = _t) {
430
+ const [n, i] = k(!1);
431
+ return S(() => {
435
432
  if (t === !1) {
436
433
  i(!1);
437
434
  return;
438
435
  }
439
436
  if (typeof window > "u" || typeof window.matchMedia > "u")
440
437
  return;
441
- const o = `(max-width: ${t - 1}px)`, r = window.matchMedia(o), a = () => i(r.matches);
442
- return a(), typeof r.addEventListener == "function" ? (r.addEventListener("change", a), () => r.removeEventListener("change", a)) : (r.addListener(a), () => {
443
- r.removeListener(a);
438
+ const l = `(max-width: ${t - 1}px)`, r = window.matchMedia(l), s = () => i(r.matches);
439
+ return s(), typeof r.addEventListener == "function" ? (r.addEventListener("change", s), () => r.removeEventListener("change", s)) : (r.addListener(s), () => {
440
+ r.removeListener(s);
444
441
  });
445
442
  }, [t]), n;
446
443
  }
447
- const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ w(
444
+ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ _(
448
445
  "svg",
449
446
  {
450
447
  className: n,
@@ -490,7 +487,7 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ w(
490
487
  }
491
488
  )
492
489
  }
493
- ), $e = ({ className: t }) => /* @__PURE__ */ e(
490
+ ), Be = ({ className: t }) => /* @__PURE__ */ e(
494
491
  "svg",
495
492
  {
496
493
  className: t,
@@ -508,7 +505,7 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ w(
508
505
  }
509
506
  )
510
507
  }
511
- ), bt = ({ className: t }) => /* @__PURE__ */ e(
508
+ ), wt = ({ className: t }) => /* @__PURE__ */ e(
512
509
  "svg",
513
510
  {
514
511
  className: t,
@@ -519,12 +516,12 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ w(
519
516
  "aria-hidden": "true",
520
517
  children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
521
518
  }
522
- ), wt = {
519
+ ), kt = {
523
520
  left: 180,
524
521
  right: 0,
525
522
  up: -90,
526
523
  down: 90
527
- }, kt = ({ direction: t = "right", className: n }) => /* @__PURE__ */ e(
524
+ }, xt = ({ direction: t = "right", className: n }) => /* @__PURE__ */ e(
528
525
  "svg",
529
526
  {
530
527
  className: n,
@@ -532,19 +529,19 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ w(
532
529
  viewBox: "0 0 24 24",
533
530
  stroke: "currentColor",
534
531
  strokeWidth: 2,
535
- style: { transform: `rotate(${wt[t]}deg)` },
532
+ style: { transform: `rotate(${kt[t]}deg)` },
536
533
  "aria-hidden": "true",
537
534
  children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
538
535
  }
539
536
  );
540
- function xt(t) {
537
+ function Ct(t) {
541
538
  return t === "top-left" || t === "bottom-left" ? "left" : "right";
542
539
  }
543
- const We = "ll-hidden-tab-center-y", Ct = 5, Be = 16;
544
- function Nt() {
540
+ const Fe = "ll-hidden-tab-center-y", Nt = 5, Ue = 16;
541
+ function Et() {
545
542
  if (typeof window > "u") return null;
546
543
  try {
547
- const t = window.localStorage.getItem(We);
544
+ const t = window.localStorage.getItem(Fe);
548
545
  if (!t) return null;
549
546
  const n = Number.parseFloat(t);
550
547
  return Number.isFinite(n) ? n : null;
@@ -552,96 +549,96 @@ function Nt() {
552
549
  return null;
553
550
  }
554
551
  }
555
- function Ue(t) {
552
+ function $e(t) {
556
553
  if (!(typeof window > "u"))
557
554
  try {
558
- window.localStorage.setItem(We, String(t));
555
+ window.localStorage.setItem(Fe, String(t));
559
556
  } catch {
560
557
  }
561
558
  }
562
- const Et = ({
559
+ const St = ({
563
560
  position: t,
564
561
  isMobile: n,
565
562
  isSpeaking: i,
566
- onExpand: o,
563
+ onExpand: l,
567
564
  label: r = "Open widget"
568
565
  }) => {
569
- const a = xt(t), c = a === "right" ? "left" : "right", m = n ? 80 : 72, [d, g] = x(null), [u, s] = x(!1), l = S(null), b = S(!1), _ = f(
570
- (k) => {
571
- if (typeof window > "u") return k;
572
- const C = m / 2, y = Be + C, A = window.innerHeight - Be - C;
573
- return A < y ? Math.max(y, k) : Math.max(y, Math.min(A, k));
566
+ const s = Ct(t), c = s === "right" ? "left" : "right", m = n ? 80 : 72, [d, f] = k(null), [p, o] = k(!1), a = M(null), C = M(!1), b = g(
567
+ (w) => {
568
+ if (typeof window > "u") return w;
569
+ const x = m / 2, y = Ue + x, A = window.innerHeight - Ue - x;
570
+ return A < y ? Math.max(y, w) : Math.max(y, Math.min(A, w));
574
571
  },
575
572
  [m]
576
573
  );
577
- L(() => {
578
- const k = Nt();
579
- g(_(k ?? window.innerHeight / 2));
580
- const C = () => {
581
- g((y) => y === null ? null : _(y));
574
+ S(() => {
575
+ const w = Et();
576
+ f(b(w ?? window.innerHeight / 2));
577
+ const x = () => {
578
+ f((y) => y === null ? null : b(y));
582
579
  };
583
- return window.addEventListener("resize", C), () => window.removeEventListener("resize", C);
584
- }, [_]);
585
- const N = f(
586
- (k) => {
587
- if (!(k.pointerType === "mouse" && k.button !== 0) && d !== null) {
580
+ return window.addEventListener("resize", x), () => window.removeEventListener("resize", x);
581
+ }, [b]);
582
+ const N = g(
583
+ (w) => {
584
+ if (!(w.pointerType === "mouse" && w.button !== 0) && d !== null) {
588
585
  try {
589
- k.currentTarget.setPointerCapture(k.pointerId);
586
+ w.currentTarget.setPointerCapture(w.pointerId);
590
587
  } catch {
591
588
  }
592
- l.current = {
593
- startClientY: k.clientY,
589
+ a.current = {
590
+ startClientY: w.clientY,
594
591
  startCenterY: d,
595
592
  moved: !1
596
593
  };
597
594
  }
598
595
  },
599
596
  [d]
600
- ), D = f(
601
- (k) => {
602
- const C = l.current;
603
- if (!C) return;
604
- const y = k.clientY - C.startClientY;
605
- !C.moved && Math.abs(y) > Ct && (C.moved = !0, s(!0)), C.moved && g(_(C.startCenterY + y));
597
+ ), D = g(
598
+ (w) => {
599
+ const x = a.current;
600
+ if (!x) return;
601
+ const y = w.clientY - x.startClientY;
602
+ !x.moved && Math.abs(y) > Nt && (x.moved = !0, o(!0)), x.moved && f(b(x.startCenterY + y));
606
603
  },
607
- [_]
608
- ), E = f(
609
- (k) => {
610
- const C = l.current;
611
- if (C) {
604
+ [b]
605
+ ), E = g(
606
+ (w) => {
607
+ const x = a.current;
608
+ if (x) {
612
609
  try {
613
- k.currentTarget.releasePointerCapture(k.pointerId);
610
+ w.currentTarget.releasePointerCapture(w.pointerId);
614
611
  } catch {
615
612
  }
616
- l.current = null, C.moved && (s(!1), b.current = !0, g((y) => (y !== null && Ue(y), y)));
613
+ a.current = null, x.moved && (o(!1), C.current = !0, f((y) => (y !== null && $e(y), y)));
617
614
  }
618
615
  },
619
616
  []
620
- ), R = f(() => {
621
- if (b.current) {
622
- b.current = !1;
617
+ ), R = g(() => {
618
+ if (C.current) {
619
+ C.current = !1;
623
620
  return;
624
621
  }
625
- o();
626
- }, [o]), T = f(
627
- (k) => {
628
- if (k.key === "ArrowUp" || k.key === "ArrowDown") {
629
- k.preventDefault();
630
- const C = k.key === "ArrowUp" ? -8 : 8;
631
- g((y) => {
622
+ l();
623
+ }, [l]), T = g(
624
+ (w) => {
625
+ if (w.key === "ArrowUp" || w.key === "ArrowDown") {
626
+ w.preventDefault();
627
+ const x = w.key === "ArrowUp" ? -8 : 8;
628
+ f((y) => {
632
629
  if (y === null) return y;
633
- const A = _(y + C);
634
- return Ue(A), A;
630
+ const A = b(y + x);
631
+ return $e(A), A;
635
632
  });
636
633
  }
637
634
  },
638
- [_]
635
+ [b]
639
636
  ), z = [
640
637
  "ll-hidden",
641
- `ll-hidden--${a}`,
638
+ `ll-hidden--${s}`,
642
639
  n ? "ll-hidden--mobile" : "ll-hidden--desktop",
643
640
  i ? "ll-hidden--speaking" : null,
644
- u ? "is-dragging" : null
641
+ p ? "is-dragging" : null
645
642
  ].filter(Boolean).join(" "), I = d === null ? void 0 : { top: `${d - m / 2}px`, transform: "none" };
646
643
  return /* @__PURE__ */ e(
647
644
  "button",
@@ -657,59 +654,59 @@ const Et = ({
657
654
  "aria-label": r,
658
655
  "data-position": t,
659
656
  style: I,
660
- children: /* @__PURE__ */ e(kt, { direction: c, className: "ll-hidden__chevron" })
657
+ children: /* @__PURE__ */ e(xt, { direction: c, className: "ll-hidden__chevron" })
661
658
  }
662
659
  );
663
- }, St = ({
660
+ }, Mt = ({
664
661
  audioLevel: t,
665
662
  bars: n = 20,
666
663
  maxHeight: i = 20,
667
- minHeight: o = 4,
664
+ minHeight: l = 4,
668
665
  className: r,
669
- barClassName: a
666
+ barClassName: s
670
667
  }) => {
671
- const c = S(null), m = S([]), d = Se(() => {
672
- const u = (Math.sqrt(5) - 1) / 2;
673
- return Array.from({ length: n }, (s, l) => 0.5 + l * u % 1 * 0.5);
668
+ const c = M(null), m = M([]), d = Se(() => {
669
+ const p = (Math.sqrt(5) - 1) / 2;
670
+ return Array.from({ length: n }, (o, a) => 0.5 + a * p % 1 * 0.5);
674
671
  }, [n]);
675
- L(() => t.subscribe((s) => {
676
- for (let l = 0; l < n; l++) {
677
- const b = m.current[l];
678
- if (!b) continue;
679
- const _ = Math.max(o, s * i * d[l]);
680
- b.style.height = `${_}px`;
672
+ S(() => t.subscribe((o) => {
673
+ for (let a = 0; a < n; a++) {
674
+ const C = m.current[a];
675
+ if (!C) continue;
676
+ const b = Math.max(l, o * i * d[a]);
677
+ C.style.height = `${b}px`;
681
678
  }
682
- }), [t, n, i, o, d]);
683
- const g = ["ll-waveform", r].filter(Boolean).join(" ");
684
- return /* @__PURE__ */ e("div", { ref: c, className: g, "aria-hidden": "true", children: Array.from({ length: n }, (u, s) => /* @__PURE__ */ e(
679
+ }), [t, n, i, l, d]);
680
+ const f = ["ll-waveform", r].filter(Boolean).join(" ");
681
+ return /* @__PURE__ */ e("div", { ref: c, className: f, "aria-hidden": "true", children: Array.from({ length: n }, (p, o) => /* @__PURE__ */ e(
685
682
  "div",
686
683
  {
687
- ref: (l) => {
688
- m.current[s] = l;
684
+ ref: (a) => {
685
+ m.current[o] = a;
689
686
  },
690
- className: ["ll-waveform__bar", a].filter(Boolean).join(" "),
691
- style: { height: `${o}px` }
687
+ className: ["ll-waveform__bar", s].filter(Boolean).join(" "),
688
+ style: { height: `${l}px` }
692
689
  },
693
- s
690
+ o
694
691
  )) });
695
692
  }, Lt = ({
696
693
  position: t,
697
694
  isMobile: n,
698
695
  agentName: i,
699
- avatarImageUrl: o,
696
+ avatarImageUrl: l,
700
697
  agentState: r,
701
- isMuted: a,
698
+ isMuted: s,
702
699
  audioLevel: c,
703
700
  onExpand: m,
704
701
  onToggleMute: d,
705
- onClose: g
702
+ onClose: f
706
703
  }) => n ? /* @__PURE__ */ e(
707
704
  "div",
708
705
  {
709
706
  className: "ll-minimized ll-minimized--mobile",
710
707
  role: "region",
711
708
  "aria-label": `${i} widget`,
712
- children: /* @__PURE__ */ w(
709
+ children: /* @__PURE__ */ _(
713
710
  "button",
714
711
  {
715
712
  type: "button",
@@ -717,19 +714,19 @@ const Et = ({
717
714
  onClick: m,
718
715
  "aria-label": `Expand ${i} widget`,
719
716
  children: [
720
- o ? (
717
+ l ? (
721
718
  // eslint-disable-next-line @next/next/no-img-element
722
719
  /* @__PURE__ */ e(
723
720
  "img",
724
721
  {
725
- src: o,
722
+ src: l,
726
723
  alt: i,
727
724
  className: "ll-minimized__avatar"
728
725
  }
729
726
  )
730
727
  ) : /* @__PURE__ */ e("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
731
728
  /* @__PURE__ */ e(
732
- St,
729
+ Mt,
733
730
  {
734
731
  audioLevel: c,
735
732
  bars: 16,
@@ -738,24 +735,24 @@ const Et = ({
738
735
  }
739
736
  ),
740
737
  /* @__PURE__ */ e("span", { className: "ll-minimized__name", children: i }),
741
- /* @__PURE__ */ w("div", { className: "ll-minimized__controls", children: [
738
+ /* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
742
739
  /* @__PURE__ */ e(
743
740
  "span",
744
741
  {
745
742
  className: "ll-minimized__btn",
746
743
  role: "button",
747
744
  tabIndex: 0,
748
- onClick: (u) => {
749
- u.stopPropagation(), d();
745
+ onClick: (p) => {
746
+ p.stopPropagation(), d();
750
747
  },
751
- onKeyDown: (u) => {
752
- (u.key === "Enter" || u.key === " ") && (u.stopPropagation(), u.preventDefault(), d());
748
+ onKeyDown: (p) => {
749
+ (p.key === "Enter" || p.key === " ") && (p.stopPropagation(), p.preventDefault(), d());
753
750
  },
754
- "aria-label": a ? "Unmute microphone" : "Mute microphone",
755
- children: /* @__PURE__ */ e(Pe, { muted: a, className: "ll-minimized__icon" })
751
+ "aria-label": s ? "Unmute microphone" : "Mute microphone",
752
+ children: /* @__PURE__ */ e(Pe, { muted: s, className: "ll-minimized__icon" })
756
753
  }
757
754
  ),
758
- /* @__PURE__ */ e($e, { className: "ll-minimized__icon ll-minimized__icon--expand" })
755
+ /* @__PURE__ */ e(Be, { className: "ll-minimized__icon ll-minimized__icon--expand" })
759
756
  ] })
760
757
  ]
761
758
  }
@@ -768,31 +765,31 @@ const Et = ({
768
765
  "data-position": t,
769
766
  role: "region",
770
767
  "aria-label": `${i} widget`,
771
- children: /* @__PURE__ */ w("div", { className: "ll-minimized__surface", children: [
772
- o ? (
768
+ children: /* @__PURE__ */ _("div", { className: "ll-minimized__surface", children: [
769
+ l ? (
773
770
  // eslint-disable-next-line @next/next/no-img-element
774
771
  /* @__PURE__ */ e(
775
772
  "img",
776
773
  {
777
- src: o,
774
+ src: l,
778
775
  alt: i,
779
776
  className: "ll-minimized__avatar"
780
777
  }
781
778
  )
782
779
  ) : /* @__PURE__ */ e("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
783
- /* @__PURE__ */ w("div", { className: "ll-minimized__meta", children: [
780
+ /* @__PURE__ */ _("div", { className: "ll-minimized__meta", children: [
784
781
  /* @__PURE__ */ e("span", { className: "ll-minimized__name", children: i }),
785
782
  /* @__PURE__ */ e("span", { className: "ll-minimized__state", children: r === "speaking" ? "Speaking" : r === "thinking" ? "Thinking" : "Listening" })
786
783
  ] }),
787
- /* @__PURE__ */ w("div", { className: "ll-minimized__controls", children: [
784
+ /* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
788
785
  /* @__PURE__ */ e(
789
786
  "button",
790
787
  {
791
788
  type: "button",
792
789
  className: "ll-minimized__btn",
793
790
  onClick: d,
794
- "aria-label": a ? "Unmute microphone" : "Mute microphone",
795
- children: /* @__PURE__ */ e(Pe, { muted: a, className: "ll-minimized__icon" })
791
+ "aria-label": s ? "Unmute microphone" : "Mute microphone",
792
+ children: /* @__PURE__ */ e(Pe, { muted: s, className: "ll-minimized__icon" })
796
793
  }
797
794
  ),
798
795
  /* @__PURE__ */ e(
@@ -802,7 +799,7 @@ const Et = ({
802
799
  className: "ll-minimized__btn",
803
800
  onClick: m,
804
801
  "aria-label": `Expand ${i} widget`,
805
- children: /* @__PURE__ */ e($e, { className: "ll-minimized__icon" })
802
+ children: /* @__PURE__ */ e(Be, { className: "ll-minimized__icon" })
806
803
  }
807
804
  ),
808
805
  /* @__PURE__ */ e(
@@ -810,23 +807,23 @@ const Et = ({
810
807
  {
811
808
  type: "button",
812
809
  className: "ll-minimized__btn ll-minimized__btn--close",
813
- onClick: g,
810
+ onClick: f,
814
811
  "aria-label": "Close widget",
815
- children: /* @__PURE__ */ e(bt, { className: "ll-minimized__icon" })
812
+ children: /* @__PURE__ */ e(wt, { className: "ll-minimized__icon" })
816
813
  }
817
814
  )
818
815
  ] })
819
816
  ] })
820
817
  }
821
- ), Mt = ({
818
+ ), It = ({
822
819
  src: t,
823
820
  alt: n,
824
821
  preCannedPlaying: i = !1,
825
- className: o,
822
+ className: l,
826
823
  style: r
827
824
  }) => {
828
- const [a, c] = x(!1), m = S(t);
829
- if (L(() => {
825
+ const [s, c] = k(!1), m = M(t);
826
+ if (S(() => {
830
827
  m.current !== t && (m.current = t, c(!1));
831
828
  }, [t]), !t) return null;
832
829
  const d = {
@@ -838,7 +835,7 @@ const Et = ({
838
835
  objectPosition: "top",
839
836
  transition: "opacity 500ms ease, transform 500ms ease",
840
837
  transform: i ? "scale(1.02)" : "scale(1)",
841
- opacity: a ? 1 : 0,
838
+ opacity: s ? 1 : 0,
842
839
  ...r
843
840
  };
844
841
  return (
@@ -848,7 +845,7 @@ const Et = ({
848
845
  {
849
846
  src: t,
850
847
  alt: n,
851
- className: o,
848
+ className: l,
852
849
  style: d,
853
850
  loading: "eager",
854
851
  fetchpriority: "high",
@@ -856,22 +853,22 @@ const Et = ({
856
853
  }
857
854
  )
858
855
  );
859
- }, It = ({
856
+ }, At = ({
860
857
  position: t,
861
858
  isMobile: n,
862
859
  agentName: i,
863
- avatarImageUrl: o,
860
+ avatarImageUrl: l,
864
861
  idleLoopUrl: r,
865
- greeting: a,
862
+ greeting: s,
866
863
  branding: c,
867
864
  teamMembers: m,
868
865
  currentTeamMemberId: d,
869
- isSwitchingTeamMember: g,
870
- teamSwitcherOpen: u,
871
- onToggleTeamSwitcher: s,
872
- onSelectTeamMember: l,
873
- languageMenuOpen: b,
874
- onToggleLanguageMenu: _,
866
+ isSwitchingTeamMember: f,
867
+ teamSwitcherOpen: p,
868
+ onToggleTeamSwitcher: o,
869
+ onSelectTeamMember: a,
870
+ languageMenuOpen: C,
871
+ onToggleLanguageMenu: b,
875
872
  connectionState: N,
876
873
  agentState: D,
877
874
  transcript: E,
@@ -879,13 +876,13 @@ const Et = ({
879
876
  needsUserGesture: T,
880
877
  error: z,
881
878
  isMuted: I,
882
- micError: k,
883
- micDevices: C,
879
+ micError: w,
880
+ micDevices: x,
884
881
  isCameraEnabled: y,
885
882
  cameraPreviewEl: A,
886
883
  cameraDevices: X,
887
884
  activeCameraId: ne,
888
- isScreenShareEnabled: U,
885
+ isScreenShareEnabled: $,
889
886
  screenPreviewEl: j,
890
887
  isSpeakerMuted: F,
891
888
  allowCamera: re,
@@ -893,68 +890,68 @@ const Et = ({
893
890
  allowTyping: be,
894
891
  avatarVideoContainerRef: we,
895
892
  onConnect: ge,
896
- onDisconnect: de,
893
+ onDisconnect: ue,
897
894
  onRetry: ke,
898
895
  onResumeAudio: xe,
899
896
  onToggleMute: Q,
900
- onToggleCamera: B,
897
+ onToggleCamera: U,
901
898
  onSwitchCameraDevice: ve,
902
899
  onToggleScreenShare: Z,
903
900
  onToggleSpeaker: G,
904
901
  onSendMessage: ee,
905
- onMinimize: ue,
902
+ onMinimize: ie,
906
903
  onClose: V,
907
904
  onClearMicError: K
908
905
  }) => {
909
906
  var ye;
910
- const O = E.length > 0 ? E[E.length - 1] : null, Y = ((m == null ? void 0 : m.length) ?? 0) > 1, ie = N === "connecting" || N === "connected", H = N === "connected", he = N === "idle" || N === "disconnected" || N === "error", pe = S(null), oe = S(null);
911
- L(() => {
907
+ const O = E.length > 0 ? E[E.length - 1] : null, Y = ((m == null ? void 0 : m.length) ?? 0) > 1, le = N === "connecting" || N === "connected", H = N === "connected", he = N === "idle" || N === "disconnected" || N === "error", pe = M(null), oe = M(null);
908
+ S(() => {
912
909
  const h = pe.current;
913
910
  h && (h.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", h.appendChild(A)));
914
- }, [A]), L(() => {
911
+ }, [A]), S(() => {
915
912
  const h = oe.current;
916
913
  h && (h.innerHTML = "", j && (j.style.width = "100%", j.style.height = "100%", j.style.objectFit = "contain", h.appendChild(j)));
917
914
  }, [j]);
918
- const [q, le] = x(!1), [ae, J] = x(!1);
919
- L(() => {
920
- if (!q && !ae && !b && !u) return;
915
+ const [q, ae] = k(!1), [se, J] = k(!1);
916
+ S(() => {
917
+ if (!q && !se && !C && !p) return;
921
918
  const h = () => {
922
- le(!1), J(!1), b && _(), u && s();
919
+ ae(!1), J(!1), C && b(), p && o();
923
920
  };
924
921
  return document.addEventListener("click", h), () => document.removeEventListener("click", h);
925
922
  }, [
926
923
  q,
927
- ae,
924
+ se,
925
+ C,
926
+ p,
928
927
  b,
929
- u,
930
- _,
931
- s
928
+ o
932
929
  ]);
933
- const [se, ce] = x(""), $ = f(
930
+ const [ce, de] = k(""), B = g(
934
931
  (h) => {
935
932
  h.preventDefault();
936
- const W = se.trim();
937
- W && (ee(W), ce(""));
933
+ const W = ce.trim();
934
+ W && (ee(W), de(""));
938
935
  },
939
- [se, ee]
940
- ), p = c.productName || "Live Layer", me = H && (O != null && O.text) ? O.text : a || "", Ce = [
936
+ [ce, ee]
937
+ ), u = c.productName || "Live Layer", me = H && (O != null && O.text) ? O.text : s || "", Ce = [
941
938
  "ll-expanded",
942
939
  n ? "ll-expanded--mobile" : "ll-expanded--desktop"
943
940
  ].join(" ");
944
- return /* @__PURE__ */ w(
941
+ return /* @__PURE__ */ _(
945
942
  "div",
946
943
  {
947
944
  className: Ce,
948
945
  "data-position": t,
949
- "data-state": H ? "connected" : ie ? "connecting" : "idle",
946
+ "data-state": H ? "connected" : le ? "connecting" : "idle",
950
947
  role: "dialog",
951
948
  "aria-label": `${i} widget`,
952
949
  children: [
953
- /* @__PURE__ */ w("div", { className: "ll-expanded__bg", children: [
954
- o ? /* @__PURE__ */ e(
955
- Mt,
950
+ /* @__PURE__ */ _("div", { className: "ll-expanded__bg", children: [
951
+ l ? /* @__PURE__ */ e(
952
+ It,
956
953
  {
957
- src: o,
954
+ src: l,
958
955
  alt: i,
959
956
  className: "ll-expanded__bg-img"
960
957
  }
@@ -972,11 +969,11 @@ const Et = ({
972
969
  )
973
970
  ] }),
974
971
  /* @__PURE__ */ e("div", { ref: we, className: "ll-expanded__video" }),
975
- N === "connecting" && /* @__PURE__ */ w("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
972
+ N === "connecting" && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
976
973
  /* @__PURE__ */ e("div", { className: "ll-expanded__spinner" }),
977
- /* @__PURE__ */ e("p", { className: "ll-expanded__overlay-text", children: g ? "Switching..." : "Connecting..." })
974
+ /* @__PURE__ */ e("p", { className: "ll-expanded__overlay-text", children: f ? "Switching..." : "Connecting..." })
978
975
  ] }),
979
- T && H && /* @__PURE__ */ w(
976
+ T && H && /* @__PURE__ */ _(
980
977
  "button",
981
978
  {
982
979
  type: "button",
@@ -988,37 +985,37 @@ const Et = ({
988
985
  ]
989
986
  }
990
987
  ),
991
- ie ? /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
992
- /* @__PURE__ */ w("div", { className: "ll-expanded__topbar-left", children: [
993
- /* @__PURE__ */ w("div", { className: "ll-expanded__pill-wrap", children: [
994
- /* @__PURE__ */ w(
988
+ le ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
989
+ /* @__PURE__ */ _("div", { className: "ll-expanded__topbar-left", children: [
990
+ /* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
991
+ /* @__PURE__ */ _(
995
992
  "button",
996
993
  {
997
994
  type: "button",
998
995
  className: "ll-hpill",
999
996
  onClick: (h) => {
1000
- Y && (h.stopPropagation(), s());
997
+ Y && (h.stopPropagation(), o());
1001
998
  },
1002
999
  "aria-haspopup": Y ? "listbox" : void 0,
1003
- "aria-expanded": Y ? u : void 0,
1000
+ "aria-expanded": Y ? p : void 0,
1004
1001
  children: [
1005
1002
  /* @__PURE__ */ e("span", { className: "ll-hpill__label", children: i }),
1006
1003
  Y && /* @__PURE__ */ e(_e, {})
1007
1004
  ]
1008
1005
  }
1009
1006
  ),
1010
- Y && u && /* @__PURE__ */ e(
1007
+ Y && p && /* @__PURE__ */ e(
1011
1008
  "div",
1012
1009
  {
1013
1010
  className: "ll-hmenu",
1014
1011
  onClick: (h) => h.stopPropagation(),
1015
1012
  role: "listbox",
1016
- children: m == null ? void 0 : m.map((h) => /* @__PURE__ */ w(
1013
+ children: m == null ? void 0 : m.map((h) => /* @__PURE__ */ _(
1017
1014
  "button",
1018
1015
  {
1019
1016
  type: "button",
1020
1017
  className: `ll-hmenu__item ${h.id === d ? "is-active" : ""}`,
1021
- onClick: () => l(h.id),
1018
+ onClick: () => a(h.id),
1022
1019
  role: "option",
1023
1020
  "aria-selected": h.id === d,
1024
1021
  children: [
@@ -1039,24 +1036,24 @@ const Et = ({
1039
1036
  }
1040
1037
  )
1041
1038
  ] }),
1042
- /* @__PURE__ */ w("div", { className: "ll-expanded__pill-wrap", children: [
1043
- /* @__PURE__ */ w(
1039
+ /* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
1040
+ /* @__PURE__ */ _(
1044
1041
  "button",
1045
1042
  {
1046
1043
  type: "button",
1047
1044
  className: "ll-hpill",
1048
1045
  onClick: (h) => {
1049
- h.stopPropagation(), _();
1046
+ h.stopPropagation(), b();
1050
1047
  },
1051
1048
  "aria-haspopup": "listbox",
1052
- "aria-expanded": b,
1049
+ "aria-expanded": C,
1053
1050
  children: [
1054
1051
  /* @__PURE__ */ e("span", { className: "ll-hpill__label", children: "English" }),
1055
1052
  /* @__PURE__ */ e(_e, {})
1056
1053
  ]
1057
1054
  }
1058
1055
  ),
1059
- b && /* @__PURE__ */ e(
1056
+ C && /* @__PURE__ */ e(
1060
1057
  "div",
1061
1058
  {
1062
1059
  className: "ll-hmenu",
@@ -1083,37 +1080,50 @@ const Et = ({
1083
1080
  }
1084
1081
  )
1085
1082
  ] }),
1086
- /* @__PURE__ */ e(
1087
- "button",
1088
- {
1089
- type: "button",
1090
- className: "ll-hbtn",
1091
- onClick: V,
1092
- "aria-label": "Close widget",
1093
- title: "Close",
1094
- children: /* @__PURE__ */ e(je, {})
1095
- }
1096
- )
1083
+ /* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
1084
+ /* @__PURE__ */ e(
1085
+ "button",
1086
+ {
1087
+ type: "button",
1088
+ className: "ll-hbtn",
1089
+ onClick: ie,
1090
+ "aria-label": "Minimize widget",
1091
+ title: "Minimize",
1092
+ children: /* @__PURE__ */ e(Ve, {})
1093
+ }
1094
+ ),
1095
+ /* @__PURE__ */ e(
1096
+ "button",
1097
+ {
1098
+ type: "button",
1099
+ className: "ll-hbtn ll-hbtn--danger",
1100
+ onClick: V,
1101
+ "aria-label": "End conversation",
1102
+ title: "End conversation",
1103
+ children: /* @__PURE__ */ e(je, {})
1104
+ }
1105
+ )
1106
+ ] })
1097
1107
  ] }) : (
1098
1108
  // Idle-state header with Live Layer product name + minimize/close
1099
- /* @__PURE__ */ w("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1100
- /* @__PURE__ */ e("span", { className: "ll-expanded__brand", children: p }),
1101
- /* @__PURE__ */ w("div", { className: "ll-expanded__header-actions", children: [
1109
+ /* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1110
+ /* @__PURE__ */ e("span", { className: "ll-expanded__brand", children: u }),
1111
+ /* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
1102
1112
  /* @__PURE__ */ e(
1103
1113
  "button",
1104
1114
  {
1105
1115
  type: "button",
1106
1116
  className: "ll-hbtn ll-hbtn--ghost",
1107
- onClick: ue,
1117
+ onClick: ie,
1108
1118
  "aria-label": "Minimize widget",
1109
- children: /* @__PURE__ */ e(At, {})
1119
+ children: /* @__PURE__ */ e(Ve, {})
1110
1120
  }
1111
1121
  ),
1112
1122
  /* @__PURE__ */ e(
1113
1123
  "button",
1114
1124
  {
1115
1125
  type: "button",
1116
- className: "ll-hbtn ll-hbtn--ghost",
1126
+ className: "ll-hbtn ll-hbtn--danger",
1117
1127
  onClick: V,
1118
1128
  "aria-label": "Close widget",
1119
1129
  children: /* @__PURE__ */ e(je, {})
@@ -1122,7 +1132,7 @@ const Et = ({
1122
1132
  ] })
1123
1133
  ] })
1124
1134
  ),
1125
- he && /* @__PURE__ */ w(
1135
+ he && /* @__PURE__ */ _(
1126
1136
  "button",
1127
1137
  {
1128
1138
  type: "button",
@@ -1136,49 +1146,49 @@ const Et = ({
1136
1146
  ]
1137
1147
  }
1138
1148
  ),
1139
- /* @__PURE__ */ w(
1149
+ /* @__PURE__ */ _(
1140
1150
  "div",
1141
1151
  {
1142
- className: `ll-expanded__pip ${ie && (y || U) ? "is-visible" : ""}`,
1152
+ className: `ll-expanded__pip ${le && (y || $) ? "is-visible" : ""}`,
1143
1153
  children: [
1144
1154
  /* @__PURE__ */ e(
1145
1155
  "div",
1146
1156
  {
1147
1157
  ref: oe,
1148
- className: U ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1158
+ className: $ ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1149
1159
  }
1150
1160
  ),
1151
1161
  /* @__PURE__ */ e(
1152
1162
  "div",
1153
1163
  {
1154
1164
  ref: pe,
1155
- className: !U && y ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1165
+ className: !$ && y ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1156
1166
  }
1157
1167
  )
1158
1168
  ]
1159
1169
  }
1160
1170
  ),
1161
- ie ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
1171
+ le ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
1162
1172
  me && /* @__PURE__ */ e("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ e("p", { className: "ll-expanded__transcript-text", children: me }) }),
1163
- /* @__PURE__ */ w("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
1173
+ /* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
1164
1174
  P && /* @__PURE__ */ e(
1165
1175
  "button",
1166
1176
  {
1167
1177
  type: "button",
1168
- className: `ll-tool ${U ? "is-on" : ""}`,
1178
+ className: `ll-tool ${$ ? "is-on" : ""}`,
1169
1179
  onClick: Z,
1170
- "aria-label": U ? "Stop sharing screen" : "Share screen",
1171
- title: U ? "Stop sharing" : "Share screen",
1180
+ "aria-label": $ ? "Stop sharing screen" : "Share screen",
1181
+ title: $ ? "Stop sharing" : "Share screen",
1172
1182
  children: /* @__PURE__ */ e(Dt, {})
1173
1183
  }
1174
1184
  ),
1175
- re && /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
1185
+ re && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
1176
1186
  /* @__PURE__ */ e(
1177
1187
  "button",
1178
1188
  {
1179
1189
  type: "button",
1180
1190
  className: `ll-tool ll-tool--left ${y ? "is-on" : ""}`,
1181
- onClick: B,
1191
+ onClick: U,
1182
1192
  "aria-label": y ? "Turn off camera" : "Turn on camera",
1183
1193
  title: y ? "Stop camera" : "Start camera",
1184
1194
  children: /* @__PURE__ */ e(Rt, {})
@@ -1190,16 +1200,16 @@ const Et = ({
1190
1200
  type: "button",
1191
1201
  className: `ll-tool ll-tool--right ${y ? "is-on" : ""}`,
1192
1202
  onClick: (h) => {
1193
- h.stopPropagation(), J((W) => !W), le(!1);
1203
+ h.stopPropagation(), J((W) => !W), ae(!1);
1194
1204
  },
1195
1205
  "aria-label": "Camera devices",
1196
1206
  "aria-haspopup": "listbox",
1197
- "aria-expanded": ae,
1207
+ "aria-expanded": se,
1198
1208
  children: /* @__PURE__ */ e(_e, {})
1199
1209
  }
1200
1210
  ),
1201
- ae && X.length > 0 && /* @__PURE__ */ e(
1202
- Ve,
1211
+ se && X.length > 0 && /* @__PURE__ */ e(
1212
+ Oe,
1203
1213
  {
1204
1214
  label: "Camera",
1205
1215
  devices: X,
@@ -1210,7 +1220,7 @@ const Et = ({
1210
1220
  }
1211
1221
  )
1212
1222
  ] }),
1213
- /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
1223
+ /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
1214
1224
  /* @__PURE__ */ e(
1215
1225
  "button",
1216
1226
  {
@@ -1228,7 +1238,7 @@ const Et = ({
1228
1238
  type: "button",
1229
1239
  className: `ll-tool ll-tool--right ${I ? "is-muted" : ""}`,
1230
1240
  onClick: (h) => {
1231
- h.stopPropagation(), le((W) => !W), J(!1);
1241
+ h.stopPropagation(), ae((W) => !W), J(!1);
1232
1242
  },
1233
1243
  "aria-label": "Microphone devices",
1234
1244
  "aria-haspopup": "listbox",
@@ -1236,13 +1246,13 @@ const Et = ({
1236
1246
  children: /* @__PURE__ */ e(_e, {})
1237
1247
  }
1238
1248
  ),
1239
- q && C.length > 0 && /* @__PURE__ */ e(
1240
- Ve,
1249
+ q && x.length > 0 && /* @__PURE__ */ e(
1250
+ Oe,
1241
1251
  {
1242
1252
  label: "Microphone",
1243
- devices: C,
1253
+ devices: x,
1244
1254
  activeId: "",
1245
- onPick: () => le(!1)
1255
+ onPick: () => ae(!1)
1246
1256
  }
1247
1257
  )
1248
1258
  ] }),
@@ -1258,19 +1268,19 @@ const Et = ({
1258
1268
  }
1259
1269
  )
1260
1270
  ] }),
1261
- be && /* @__PURE__ */ w("form", { className: "ll-message-input", onSubmit: $, children: [
1271
+ be && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: B, children: [
1262
1272
  /* @__PURE__ */ e(
1263
1273
  "input",
1264
1274
  {
1265
1275
  type: "text",
1266
1276
  className: "ll-message-input__field",
1267
1277
  placeholder: "Message...",
1268
- value: se,
1269
- onChange: (h) => ce(h.target.value),
1278
+ value: ce,
1279
+ onChange: (h) => de(h.target.value),
1270
1280
  "aria-label": "Message the agent"
1271
1281
  }
1272
1282
  ),
1273
- se.trim() && /* @__PURE__ */ e(
1283
+ ce.trim() && /* @__PURE__ */ e(
1274
1284
  "button",
1275
1285
  {
1276
1286
  type: "submit",
@@ -1285,18 +1295,18 @@ const Et = ({
1285
1295
  {
1286
1296
  type: "button",
1287
1297
  className: "ll-expanded__end",
1288
- onClick: de,
1298
+ onClick: ue,
1289
1299
  children: "End conversation"
1290
1300
  }
1291
1301
  )
1292
1302
  ] }) : (
1293
1303
  // Idle-state footer: start button + greeting
1294
- a && /* @__PURE__ */ e("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: /* @__PURE__ */ e("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ e("p", { className: "ll-expanded__transcript-text", children: a }) }) })
1304
+ s && /* @__PURE__ */ e("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: /* @__PURE__ */ e("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ e("p", { className: "ll-expanded__transcript-text", children: s }) }) })
1295
1305
  ),
1296
1306
  (() => {
1297
- if (k && N !== "error")
1298
- return /* @__PURE__ */ w("div", { className: "ll-expanded__banner", role: "alert", children: [
1299
- /* @__PURE__ */ e("span", { children: k }),
1307
+ if (w && N !== "error")
1308
+ return /* @__PURE__ */ _("div", { className: "ll-expanded__banner", role: "alert", children: [
1309
+ /* @__PURE__ */ e("span", { children: w }),
1300
1310
  /* @__PURE__ */ e(
1301
1311
  "button",
1302
1312
  {
@@ -1310,7 +1320,7 @@ const Et = ({
1310
1320
  ] });
1311
1321
  if (!z || N !== "error") return null;
1312
1322
  let h = "Failed to connect", W = "Try again";
1313
- return z === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : z === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : z === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : z === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : z === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : z.length < 80 && (h = z), /* @__PURE__ */ w("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1323
+ return z === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : z === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : z === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : z === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : z === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : z.length < 80 && (h = z), /* @__PURE__ */ _("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1314
1324
  /* @__PURE__ */ e("span", { children: h }),
1315
1325
  /* @__PURE__ */ e(
1316
1326
  "button",
@@ -1331,29 +1341,29 @@ function _e() {
1331
1341
  return /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ e("polyline", { points: "6 9 12 15 18 9" }) });
1332
1342
  }
1333
1343
  function je() {
1334
- return /* @__PURE__ */ w("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1344
+ return /* @__PURE__ */ _("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1335
1345
  /* @__PURE__ */ e("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1336
1346
  /* @__PURE__ */ e("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1337
1347
  ] });
1338
1348
  }
1339
- function At() {
1349
+ function Ve() {
1340
1350
  return /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ e("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
1341
1351
  }
1342
1352
  function Dt() {
1343
- return /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1353
+ return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1344
1354
  /* @__PURE__ */ e("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
1345
1355
  /* @__PURE__ */ e("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
1346
1356
  /* @__PURE__ */ e("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
1347
1357
  ] });
1348
1358
  }
1349
1359
  function Rt() {
1350
- return /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1360
+ return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1351
1361
  /* @__PURE__ */ e("path", { d: "M23 7l-7 5 7 5V7z" }),
1352
1362
  /* @__PURE__ */ e("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
1353
1363
  ] });
1354
1364
  }
1355
1365
  function Tt({ muted: t }) {
1356
- return /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1366
+ return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1357
1367
  /* @__PURE__ */ e("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
1358
1368
  /* @__PURE__ */ e("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
1359
1369
  /* @__PURE__ */ e("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
@@ -1361,21 +1371,21 @@ function Tt({ muted: t }) {
1361
1371
  ] });
1362
1372
  }
1363
1373
  function zt({ muted: t }) {
1364
- return /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1374
+ return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1365
1375
  /* @__PURE__ */ e("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1366
- t ? /* @__PURE__ */ e("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ w(Qe, { children: [
1376
+ t ? /* @__PURE__ */ e("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(Ze, { children: [
1367
1377
  /* @__PURE__ */ e("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
1368
1378
  /* @__PURE__ */ e("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
1369
1379
  ] })
1370
1380
  ] });
1371
1381
  }
1372
1382
  function Pt() {
1373
- return /* @__PURE__ */ w("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1383
+ return /* @__PURE__ */ _("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1374
1384
  /* @__PURE__ */ e("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
1375
1385
  /* @__PURE__ */ e("polyline", { points: "12 5 19 12 12 19" })
1376
1386
  ] });
1377
1387
  }
1378
- const Ve = ({ label: t, devices: n, activeId: i, onPick: o }) => /* @__PURE__ */ w(
1388
+ const Oe = ({ label: t, devices: n, activeId: i, onPick: l }) => /* @__PURE__ */ _(
1379
1389
  "div",
1380
1390
  {
1381
1391
  className: "ll-device-menu",
@@ -1383,27 +1393,27 @@ const Ve = ({ label: t, devices: n, activeId: i, onPick: o }) => /* @__PURE__ */
1383
1393
  role: "listbox",
1384
1394
  children: [
1385
1395
  /* @__PURE__ */ e("p", { className: "ll-device-menu__label", children: t }),
1386
- n.map((r, a) => {
1396
+ n.map((r, s) => {
1387
1397
  const c = i === r.deviceId;
1388
- return /* @__PURE__ */ w(
1398
+ return /* @__PURE__ */ _(
1389
1399
  "button",
1390
1400
  {
1391
1401
  type: "button",
1392
1402
  className: `ll-device-menu__item ${c ? "is-active" : ""}`,
1393
- onClick: () => o(r.deviceId),
1403
+ onClick: () => l(r.deviceId),
1394
1404
  role: "option",
1395
1405
  "aria-selected": c,
1396
1406
  children: [
1397
1407
  c && /* @__PURE__ */ e("span", { className: "ll-device-menu__dot", children: "●" }),
1398
- /* @__PURE__ */ e("span", { className: "ll-device-menu__name", children: r.label || `${t} ${a + 1}` })
1408
+ /* @__PURE__ */ e("span", { className: "ll-device-menu__name", children: r.label || `${t} ${s + 1}` })
1399
1409
  ]
1400
1410
  },
1401
- r.deviceId || a
1411
+ r.deviceId || s
1402
1412
  );
1403
1413
  })
1404
1414
  ]
1405
1415
  }
1406
- ), $t = /* @__PURE__ */ new Set([
1416
+ ), Bt = /* @__PURE__ */ new Set([
1407
1417
  "agent_state",
1408
1418
  "avatar_stream_ready",
1409
1419
  "avatar_active",
@@ -1413,23 +1423,23 @@ const Ve = ({ label: t, devices: n, activeId: i, onPick: o }) => /* @__PURE__ */
1413
1423
  "idle_warning",
1414
1424
  "idle_timeout"
1415
1425
  ]);
1416
- function Bt(t) {
1426
+ function Ut(t) {
1417
1427
  var Ie, Ae, De, Re, Te, ze;
1418
1428
  const {
1419
1429
  agentId: n,
1420
1430
  apiKey: i,
1421
- baseUrl: o = "https://app.livelayer.studio",
1431
+ baseUrl: l = "https://app.livelayer.studio",
1422
1432
  sessionEndpoint: r,
1423
- sessionBody: a,
1433
+ sessionBody: s,
1424
1434
  autoConnect: c = !1,
1425
1435
  displayMode: m,
1426
1436
  defaultDisplayMode: d = "expanded",
1427
- onDisplayModeChange: g,
1428
- position: u = "bottom-right",
1429
- mobileBreakpoint: s = 640,
1430
- persistKey: l = "ll-widget",
1431
- disablePersistence: b = !1,
1432
- teamMembers: _,
1437
+ onDisplayModeChange: f,
1438
+ position: p = "bottom-right",
1439
+ mobileBreakpoint: o = 640,
1440
+ persistKey: a = "ll-widget",
1441
+ disablePersistence: C = !1,
1442
+ teamMembers: b,
1433
1443
  currentTeamMemberId: N,
1434
1444
  onTeamMemberChange: D,
1435
1445
  idleLoopUrl: E,
@@ -1437,13 +1447,13 @@ function Bt(t) {
1437
1447
  avatarImageUrl: T,
1438
1448
  agentName: z,
1439
1449
  branding: I = {},
1440
- allowCamera: k = !0,
1441
- allowScreenShare: C = !0,
1450
+ allowCamera: w = !0,
1451
+ allowScreenShare: x = !0,
1442
1452
  allowTyping: y = !0,
1443
1453
  onConnect: A,
1444
1454
  onDisconnect: X,
1445
1455
  onTranscript: ne,
1446
- onAgentState: U,
1456
+ onAgentState: $,
1447
1457
  onConnectionStateChange: j,
1448
1458
  onAgentEvent: F,
1449
1459
  onAgentCommand: re,
@@ -1451,37 +1461,37 @@ function Bt(t) {
1451
1461
  className: be,
1452
1462
  style: we,
1453
1463
  zIndex: ge = 2147483647
1454
- } = t, de = N !== void 0, [ke, xe] = x(() => {
1464
+ } = t, ue = N !== void 0, [ke, xe] = k(() => {
1455
1465
  var v;
1456
- return N ?? ((v = _ == null ? void 0 : _[0]) == null ? void 0 : v.id);
1457
- }), Q = de ? N : ke, B = Se(
1458
- () => (_ == null ? void 0 : _.find((v) => v.id === Q)) ?? null,
1459
- [_, Q]
1460
- ), ve = (B == null ? void 0 : B.agentId) ?? n, [Z, G] = vt({
1466
+ return N ?? ((v = b == null ? void 0 : b[0]) == null ? void 0 : v.id);
1467
+ }), Q = ue ? N : ke, U = Se(
1468
+ () => (b == null ? void 0 : b.find((v) => v.id === Q)) ?? null,
1469
+ [b, Q]
1470
+ ), ve = (U == null ? void 0 : U.agentId) ?? n, [Z, G] = yt({
1461
1471
  value: m,
1462
1472
  defaultValue: d,
1463
- onChange: g,
1464
- persistKey: l,
1465
- disablePersistence: b
1466
- }), ee = _t(s), ue = ot(), V = lt(), K = st(), O = ct(), Y = dt(), [ie, H] = x(!1), [he, pe] = x(!1), [oe, q] = x(!1), [le, ae] = x(!1), [J, se] = x(!1), ce = f(
1473
+ onChange: f,
1474
+ persistKey: a,
1475
+ disablePersistence: C
1476
+ }), ee = bt(o), ie = ot(), V = at(), K = ct(), O = dt(), Y = ut(), [le, H] = k(!1), [he, pe] = k(!1), [oe, q] = k(!1), [ae, se] = k(!1), [J, ce] = k(!1), de = g(
1467
1477
  (v) => {
1468
- const M = v;
1469
- !M.type || typeof M.type != "string" || (F == null || F({ eventName: M.type, data: v }), $t.has(M.type) || re == null || re(M));
1478
+ const L = v;
1479
+ !L.type || typeof L.type != "string" || (F == null || F({ eventName: L.type, data: v }), Bt.has(L.type) || re == null || re(L));
1470
1480
  },
1471
1481
  [re, F]
1472
- ), $ = it({
1482
+ ), B = lt({
1473
1483
  agentId: P ? "__controlled__" : ve,
1474
- baseUrl: o,
1484
+ baseUrl: l,
1475
1485
  apiKey: i,
1476
1486
  sessionEndpoint: r,
1477
- sessionBody: a,
1478
- onDataMessage: P ? void 0 : ce
1487
+ sessionBody: s,
1488
+ onDataMessage: P ? void 0 : de
1479
1489
  });
1480
- L(() => {
1490
+ S(() => {
1481
1491
  if (P != null && P.subscribeToDataMessages)
1482
- return P.subscribeToDataMessages(ce);
1483
- }, [P, ce]);
1484
- const p = Se(() => P ? {
1492
+ return P.subscribeToDataMessages(de);
1493
+ }, [P, de]);
1494
+ const u = Se(() => P ? {
1485
1495
  connectionState: P.connectionState,
1486
1496
  agentState: P.agentState,
1487
1497
  transcript: P.transcript,
@@ -1497,130 +1507,132 @@ function Bt(t) {
1497
1507
  // Dummy getRoom for shape compatibility — controlled consumers own the Room.
1498
1508
  // Internal session's getRoom returns null when no real connect has happened,
1499
1509
  // so we reuse its reference for type consistency.
1500
- getRoom: $.getRoom,
1510
+ getRoom: B.getRoom,
1501
1511
  isControlled: !0
1502
1512
  } : {
1503
- connectionState: $.connectionState,
1504
- agentState: $.agentState,
1505
- transcript: $.transcript,
1506
- videoElement: $.videoElement,
1507
- audioElement: $.audioElement,
1508
- canResume: $.canResume,
1509
- error: $.error,
1510
- agentConfig: $.agentConfig,
1511
- connect: $.connect,
1512
- disconnect: $.disconnect,
1513
- getRoom: $.getRoom,
1513
+ connectionState: B.connectionState,
1514
+ agentState: B.agentState,
1515
+ transcript: B.transcript,
1516
+ videoElement: B.videoElement,
1517
+ audioElement: B.audioElement,
1518
+ canResume: B.canResume,
1519
+ error: B.error,
1520
+ agentConfig: B.agentConfig,
1521
+ connect: B.connect,
1522
+ disconnect: B.disconnect,
1523
+ getRoom: B.getRoom,
1514
1524
  isControlled: !1
1515
- }, [P, $]), me = S(null);
1516
- L(() => {
1517
- const v = p.videoElement, M = me.current;
1518
- if (!(!v || !M))
1519
- return M.appendChild(v), () => {
1520
- v.parentNode === M && M.removeChild(v);
1525
+ }, [P, B]), me = M(null);
1526
+ S(() => {
1527
+ const v = u.videoElement, L = me.current;
1528
+ if (!(!v || !L))
1529
+ return L.appendChild(v), () => {
1530
+ v.parentNode === L && L.removeChild(v);
1521
1531
  };
1522
- }, [p.videoElement]), L(() => {
1523
- const v = p.audioElement;
1532
+ }, [u.videoElement]), S(() => {
1533
+ const v = u.audioElement;
1524
1534
  if (!v) return;
1525
- ue.attach(v);
1526
- const M = v.play();
1527
- return M && typeof M.catch == "function" && M.catch((te) => {
1535
+ ie.attach(v);
1536
+ const L = v.play();
1537
+ return L && typeof L.catch == "function" && L.catch((te) => {
1528
1538
  (te == null ? void 0 : te.name) === "NotAllowedError" && H(!0);
1529
1539
  }), () => {
1530
- ue.detach();
1540
+ ie.detach();
1531
1541
  };
1532
- }, [p.audioElement]), L(() => {
1533
- if (p.isControlled || p.connectionState !== "connected") return;
1534
- const v = p.getRoom();
1542
+ }, [u.audioElement]), S(() => {
1543
+ if (u.isControlled || u.connectionState !== "connected") return;
1544
+ const v = u.getRoom();
1535
1545
  if (v)
1536
1546
  return V.setupMic(v).catch(() => {
1537
1547
  }), K.attachRoom(v), O.attachRoom(v), Y.refresh(), () => {
1538
1548
  V.teardownMic(), K.teardown(), O.teardown();
1539
1549
  };
1540
- }, [p.isControlled, p.connectionState]), L(() => {
1541
- const v = p.audioElement;
1550
+ }, [u.isControlled, u.connectionState]), S(() => {
1551
+ const v = u.audioElement;
1542
1552
  v && (v.muted = J);
1543
- }, [p.audioElement, J]);
1544
- const Ce = f((v) => {
1545
- const M = p.getRoom();
1546
- if (M)
1553
+ }, [u.audioElement, J]);
1554
+ const Ce = g((v) => {
1555
+ const L = u.getRoom();
1556
+ if (L)
1547
1557
  try {
1548
1558
  const te = new TextEncoder().encode(
1549
1559
  JSON.stringify({ type: "user_message", text: v })
1550
1560
  );
1551
- M.localParticipant.publishData(te, { reliable: !0 });
1561
+ L.localParticipant.publishData(te, { reliable: !0 });
1552
1562
  } catch {
1553
1563
  }
1554
- }, [p]), ye = f(() => {
1555
- se((v) => !v);
1564
+ }, [u]), ye = g(() => {
1565
+ ce((v) => !v);
1556
1566
  }, []);
1557
- L(() => {
1558
- j == null || j(p.connectionState), p.connectionState === "connected" ? A == null || A() : p.connectionState === "disconnected" && (X == null || X());
1559
- }, [p.connectionState, A, X, j]), L(() => {
1560
- ne == null || ne(p.transcript);
1561
- }, [p.transcript, ne]), L(() => {
1562
- U == null || U(p.agentState);
1563
- }, [p.agentState, U]);
1564
- const h = S(!1);
1565
- L(() => {
1566
- p.isControlled || !c || h.current || p.connectionState === "idle" && (h.current = !0, p.connect());
1567
- }, [c, p.connectionState, p]);
1568
- const W = f(
1567
+ S(() => {
1568
+ j == null || j(u.connectionState), u.connectionState === "connected" ? A == null || A() : u.connectionState === "disconnected" && (X == null || X());
1569
+ }, [u.connectionState, A, X, j]), S(() => {
1570
+ ne == null || ne(u.transcript);
1571
+ }, [u.transcript, ne]), S(() => {
1572
+ $ == null || $(u.agentState);
1573
+ }, [u.agentState, $]);
1574
+ const h = M(!1);
1575
+ S(() => {
1576
+ u.isControlled || !c || h.current || u.connectionState === "idle" && (h.current = !0, u.connect());
1577
+ }, [c, u.connectionState, u]);
1578
+ const W = g(
1569
1579
  (v) => {
1570
- const M = _ == null ? void 0 : _.find((te) => te.id === v);
1571
- M && (q(!1), v !== Q && (pe(!0), p.disconnect(), de || xe(v), D == null || D(M)));
1580
+ const L = b == null ? void 0 : b.find((te) => te.id === v);
1581
+ L && (q(!1), v !== Q && (pe(!0), u.disconnect(), ue || xe(v), D == null || D(L)));
1572
1582
  },
1573
1583
  [
1574
- _,
1584
+ b,
1575
1585
  Q,
1576
- p,
1577
- de,
1586
+ u,
1587
+ ue,
1578
1588
  D
1579
1589
  ]
1580
1590
  );
1581
- L(() => {
1582
- he && p.connectionState === "connected" && pe(!1);
1583
- }, [p.connectionState, he]), L(() => {
1591
+ S(() => {
1592
+ he && u.connectionState === "connected" && pe(!1);
1593
+ }, [u.connectionState, he]), S(() => {
1584
1594
  if (!oe) return;
1585
- const v = (M) => {
1586
- M.key === "Escape" && q(!1);
1595
+ const v = (L) => {
1596
+ L.key === "Escape" && q(!1);
1587
1597
  };
1588
1598
  return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
1589
1599
  }, [oe]);
1590
- const Fe = !!T || !!(B != null && B.avatarImageUrl) || p.isControlled, Ne = ut(ve, o, Fe), Ee = (B == null ? void 0 : B.name) ?? z ?? ((Ie = p.agentConfig) == null ? void 0 : Ie.name) ?? ((Ae = Ne.info) == null ? void 0 : Ae.name) ?? "Live Layer", Le = (B == null ? void 0 : B.avatarImageUrl) ?? T ?? ((De = p.agentConfig) == null ? void 0 : De.avatarImageUrl) ?? ((Re = Ne.info) == null ? void 0 : Re.avatarImageUrl) ?? null, Ge = E ?? ((Te = p.agentConfig) == null ? void 0 : Te.idleLoopUrl) ?? ((ze = Ne.info) == null ? void 0 : ze.idleLoopUrl) ?? null, Ke = R ?? null, Ye = f(() => G("expanded"), [G]), He = f(
1600
+ const Ge = !!T || !!(U != null && U.avatarImageUrl) || u.isControlled, Ne = ht(ve, l, Ge), Ee = (U == null ? void 0 : U.name) ?? z ?? ((Ie = u.agentConfig) == null ? void 0 : Ie.name) ?? ((Ae = Ne.info) == null ? void 0 : Ae.name) ?? "Live Layer", Me = (U == null ? void 0 : U.avatarImageUrl) ?? T ?? ((De = u.agentConfig) == null ? void 0 : De.avatarImageUrl) ?? ((Re = Ne.info) == null ? void 0 : Re.avatarImageUrl) ?? null, Ke = E ?? ((Te = u.agentConfig) == null ? void 0 : Te.idleLoopUrl) ?? ((ze = Ne.info) == null ? void 0 : ze.idleLoopUrl) ?? null, Ye = R ?? null, He = g(() => G("expanded"), [G]), qe = g(
1591
1601
  () => G("minimized"),
1592
1602
  [G]
1593
- ), Me = f(() => G("hidden"), [G]), qe = f(() => {
1594
- const v = p.audioElement;
1603
+ ), Le = g(() => {
1604
+ u.disconnect(), G("hidden");
1605
+ }, [u, G]), Je = g(() => {
1606
+ const v = u.audioElement;
1595
1607
  v && v.play().then(() => H(!1)).catch(() => {
1596
1608
  });
1597
- }, [p.audioElement]), Je = f(() => {
1598
- H(!1), p.connect();
1599
- }, [p]), fe = {
1609
+ }, [u.audioElement]), Xe = g(() => {
1610
+ H(!1), u.connect();
1611
+ }, [u]), fe = {
1600
1612
  ...we,
1601
1613
  zIndex: ge
1602
1614
  };
1603
1615
  I.primaryColor && (fe["--ll-color-primary"] = I.primaryColor), I.accentColor && (fe["--ll-color-accent"] = I.accentColor), I.backgroundColor && (fe["--ll-color-bg"] = I.backgroundColor), I.textColor && (fe["--ll-color-fg"] = I.textColor);
1604
- const Xe = [
1616
+ const Qe = [
1605
1617
  "ll-widget",
1606
1618
  `ll-widget--${Z}`,
1607
1619
  `ll-widget--${ee ? "mobile" : "desktop"}`,
1608
1620
  be
1609
1621
  ].filter(Boolean).join(" ");
1610
- return /* @__PURE__ */ w(
1622
+ return /* @__PURE__ */ _(
1611
1623
  "div",
1612
1624
  {
1613
- className: Xe,
1625
+ className: Qe,
1614
1626
  style: fe,
1615
1627
  "data-display-mode": Z,
1616
- "data-position": u,
1628
+ "data-position": p,
1617
1629
  children: [
1618
1630
  Z === "hidden" && /* @__PURE__ */ e(
1619
- Et,
1631
+ St,
1620
1632
  {
1621
- position: u,
1633
+ position: p,
1622
1634
  isMobile: ee,
1623
- isSpeaking: p.agentState === "speaking",
1635
+ isSpeaking: u.agentState === "speaking",
1624
1636
  onExpand: () => G("expanded"),
1625
1637
  label: `Open ${Ee} widget`
1626
1638
  }
@@ -1628,37 +1640,37 @@ function Bt(t) {
1628
1640
  Z === "minimized" && /* @__PURE__ */ e(
1629
1641
  Lt,
1630
1642
  {
1631
- position: u,
1643
+ position: p,
1632
1644
  isMobile: ee,
1633
1645
  agentName: Ee,
1634
- avatarImageUrl: Le,
1635
- agentState: p.agentState,
1646
+ avatarImageUrl: Me,
1647
+ agentState: u.agentState,
1636
1648
  isMuted: V.isMuted,
1637
- audioLevel: ue,
1638
- onExpand: Ye,
1649
+ audioLevel: ie,
1650
+ onExpand: He,
1639
1651
  onToggleMute: V.toggleMute,
1640
- onClose: Me
1652
+ onClose: Le
1641
1653
  }
1642
1654
  ),
1643
1655
  Z === "expanded" && /* @__PURE__ */ e(
1644
- It,
1656
+ At,
1645
1657
  {
1646
- position: u,
1658
+ position: p,
1647
1659
  isMobile: ee,
1648
1660
  agentName: Ee,
1649
- avatarImageUrl: Le,
1650
- idleLoopUrl: Ge,
1651
- greeting: Ke,
1661
+ avatarImageUrl: Me,
1662
+ idleLoopUrl: Ke,
1663
+ greeting: Ye,
1652
1664
  branding: I,
1653
- teamMembers: _,
1665
+ teamMembers: b,
1654
1666
  currentTeamMemberId: Q,
1655
1667
  isSwitchingTeamMember: he,
1656
1668
  teamSwitcherOpen: oe,
1657
1669
  onToggleTeamSwitcher: () => q((v) => !v),
1658
1670
  onSelectTeamMember: W,
1659
- connectionState: p.connectionState,
1660
- agentState: p.agentState,
1661
- transcript: p.transcript,
1671
+ connectionState: u.connectionState,
1672
+ agentState: u.agentState,
1673
+ transcript: u.transcript,
1662
1674
  isMuted: V.isMuted,
1663
1675
  micDevices: Y.mics,
1664
1676
  isCameraEnabled: K.isEnabled,
@@ -1668,28 +1680,28 @@ function Bt(t) {
1668
1680
  isScreenShareEnabled: O.isEnabled,
1669
1681
  screenPreviewEl: O.previewEl,
1670
1682
  isSpeakerMuted: J,
1671
- allowCamera: k,
1672
- allowScreenShare: C,
1683
+ allowCamera: w,
1684
+ allowScreenShare: x,
1673
1685
  allowTyping: y,
1674
- languageMenuOpen: le,
1675
- onToggleLanguageMenu: () => ae((v) => !v),
1676
- needsUserGesture: ie,
1677
- canResume: p.canResume,
1686
+ languageMenuOpen: ae,
1687
+ onToggleLanguageMenu: () => se((v) => !v),
1688
+ needsUserGesture: le,
1689
+ canResume: u.canResume,
1678
1690
  micError: V.micError,
1679
- error: p.error,
1691
+ error: u.error,
1680
1692
  avatarVideoContainerRef: me,
1681
- onConnect: () => void p.connect(),
1682
- onDisconnect: () => p.disconnect(),
1683
- onRetry: Je,
1684
- onResumeAudio: qe,
1693
+ onConnect: () => void u.connect(),
1694
+ onDisconnect: () => u.disconnect(),
1695
+ onRetry: Xe,
1696
+ onResumeAudio: Je,
1685
1697
  onToggleMute: V.toggleMute,
1686
1698
  onToggleCamera: () => void K.toggle(),
1687
1699
  onSwitchCameraDevice: (v) => void K.switchDevice(v),
1688
1700
  onToggleScreenShare: () => void O.toggle(),
1689
1701
  onToggleSpeaker: ye,
1690
1702
  onSendMessage: Ce,
1691
- onMinimize: He,
1692
- onClose: Me,
1703
+ onMinimize: qe,
1704
+ onClose: Le,
1693
1705
  onClearMicError: V.clearError
1694
1706
  }
1695
1707
  )
@@ -1698,66 +1710,66 @@ function Bt(t) {
1698
1710
  );
1699
1711
  }
1700
1712
  function Ft(t) {
1701
- return /* @__PURE__ */ e(rt, { children: /* @__PURE__ */ e(Bt, { ...t }) });
1713
+ return /* @__PURE__ */ e(it, { children: /* @__PURE__ */ e(Ut, { ...t }) });
1702
1714
  }
1703
1715
  const Gt = ({
1704
1716
  agentId: t,
1705
1717
  baseUrl: n,
1706
1718
  apiKey: i,
1707
- mode: o,
1719
+ mode: l,
1708
1720
  onAgentEvent: r,
1709
- className: a,
1721
+ className: s,
1710
1722
  style: c
1711
1723
  }) => {
1712
- const m = S(null), d = S(null), g = S(r);
1713
- g.current = r;
1714
- const u = f((s) => {
1715
- var b;
1716
- const l = s.detail;
1717
- (b = g.current) == null || b.call(g, l);
1724
+ const m = M(null), d = M(null), f = M(r);
1725
+ f.current = r;
1726
+ const p = g((o) => {
1727
+ var C;
1728
+ const a = o.detail;
1729
+ (C = f.current) == null || C.call(f, a);
1718
1730
  }, []);
1719
- return L(() => {
1720
- const s = m.current;
1721
- if (!s) return;
1722
- const l = document.createElement("livelayer-widget");
1723
- return l.setAttribute("agent-id", t), n && l.setAttribute("base-url", n), i && l.setAttribute("api-key", i), o && l.setAttribute("mode", o), l.addEventListener("agent-event", u), s.appendChild(l), d.current = l, () => {
1724
- l.removeEventListener("agent-event", u), s.removeChild(l), d.current = null;
1731
+ return S(() => {
1732
+ const o = m.current;
1733
+ if (!o) return;
1734
+ const a = document.createElement("livelayer-widget");
1735
+ return a.setAttribute("agent-id", t), n && a.setAttribute("base-url", n), i && a.setAttribute("api-key", i), l && a.setAttribute("mode", l), a.addEventListener("agent-event", p), o.appendChild(a), d.current = a, () => {
1736
+ a.removeEventListener("agent-event", p), o.removeChild(a), d.current = null;
1725
1737
  };
1726
- }, [t]), L(() => {
1727
- d.current && (o ? d.current.setAttribute("mode", o) : d.current.removeAttribute("mode"));
1728
- }, [o]), /* @__PURE__ */ e("div", { ref: m, className: a, style: c });
1738
+ }, [t]), S(() => {
1739
+ d.current && (l ? d.current.setAttribute("mode", l) : d.current.removeAttribute("mode"));
1740
+ }, [l]), /* @__PURE__ */ e("div", { ref: m, className: s, style: c });
1729
1741
  };
1730
1742
  function Kt() {
1731
- const [t, n] = x([]), i = f((r) => {
1732
- n((a) => {
1733
- const c = a.findIndex((m) => m.id === r.id);
1743
+ const [t, n] = k([]), i = g((r) => {
1744
+ n((s) => {
1745
+ const c = s.findIndex((m) => m.id === r.id);
1734
1746
  if (c >= 0) {
1735
- const m = a.slice();
1747
+ const m = s.slice();
1736
1748
  return m[c] = r, m;
1737
1749
  }
1738
- return [...a, r];
1750
+ return [...s, r];
1739
1751
  });
1740
- }, []), o = f(() => n([]), []);
1752
+ }, []), l = g(() => n([]), []);
1741
1753
  return {
1742
1754
  entries: t,
1743
1755
  pushSegment: i,
1744
- clear: o,
1756
+ clear: l,
1745
1757
  latest: t.length > 0 ? t[t.length - 1] : null
1746
1758
  };
1747
1759
  }
1748
1760
  export {
1749
1761
  Ft as AvatarWidget,
1750
- rt as ErrorBoundary,
1762
+ it as ErrorBoundary,
1751
1763
  Gt as LiveLayerWidget,
1752
- ut as useAgentInfo,
1764
+ ht as useAgentInfo,
1753
1765
  ot as useAudioLevel,
1754
- st as useCameraState,
1755
- mt as useDisplayMode,
1756
- vt as useDisplayModePersistence,
1757
- _t as useIsMobile,
1758
- it as useLiveKitSession,
1759
- dt as useMediaDevices,
1760
- lt as useMicrophoneState,
1761
- ct as useScreenShareState,
1766
+ ct as useCameraState,
1767
+ ft as useDisplayMode,
1768
+ yt as useDisplayModePersistence,
1769
+ bt as useIsMobile,
1770
+ lt as useLiveKitSession,
1771
+ ut as useMediaDevices,
1772
+ at as useMicrophoneState,
1773
+ dt as useScreenShareState,
1762
1774
  Kt as useTranscript
1763
1775
  };